From a188b0e930d3c7cdc92712f2400685b769211895 Mon Sep 17 00:00:00 2001 From: M1dgard Date: Tue, 17 Apr 2018 15:34:06 +0200 Subject: [PATCH] Add wicked MPD setup to Polybar --- .gitignore | 1 + polybar/config.ini | 106 +++++++++++++++++++++++++++++++++++++++------ polybar/launch.sh | 8 +++- 3 files changed, 100 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 5554b4d..6d333f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ nvim/plug nvim/**/.* +**/secrets.sh diff --git a/polybar/config.ini b/polybar/config.ini index 3c143b2..0723d98 100644 --- a/polybar/config.ini +++ b/polybar/config.ini @@ -62,9 +62,9 @@ font-7 = "Material Wifi Signal strength:pixelsize=14;2" ;font-1 = "Roboto:size=11:weight=bold;2" ;font-2 = "Noto Sans:size=11;1" -modules-left = i3 +modules-left = i3 mpd-local mpd-online-1 modules-center = date -modules-right = mpd volume battery cpu memory temperature eth wlan +modules-right = volume battery cpu memory temperature eth wlan tray-position = right tray-padding = 2 @@ -169,24 +169,102 @@ label-urgent = %index% label-urgent-background = ${module/bspwm.label-urgent-background} label-urgent-padding = ${module/bspwm.label-urgent-padding} -[module/mpd] -type = internal/mpd +[mpd-shared] format-online = -;icon-prev =  -;icon-stop =  -;icon-play =  +;icon-prev =  +;icon-stop =  +;icon-play =  ;icon-pause =  -;icon-next =  -icon-prev =  -icon-stop =  -icon-play =  +;icon-next =  +icon-prev =  +icon-stop =  +icon-play =  icon-pause =  -icon-next =  +icon-next =  -label-song-maxlen = 25 +label-song = %artist% - %title% +label-song-maxlen = 25 label-song-ellipsis = true +bar-progress-width = 45 +bar-progress-indicator = | +bar-progress-fill = ─ +bar-progress-empty = ─ + +; {{{ nothing interesting here, just copying MPD settings +[module/mpd-local] +type = internal/mpd + +host = localhost +port = 6600 + +format-online = ${mpd-shared.format-online} + +icon-prev = ${mpd-shared.icon-prev} +icon-stop = ${mpd-shared.icon-stop} +icon-play = ${mpd-shared.icon-play} +icon-pause = ${mpd-shared.icon-pause} +icon-next = ${mpd-shared.icon-next} + +label-song = ${mpd-shared.label-song} +label-song-maxlen = ${mpd-shared.label-song-maxlen} +label-song-ellipsis = ${mpd-shared.label-song-ellipsis} + +bar-progress-width = ${mpd-shared.bar-progress-width} +bar-progress-indicator = ${mpd-shared.bar-progress-indicator} +bar-progress-fill = ${mpd-shared.bar-progress-fill} +bar-progress-empty = ${mpd-shared.bar-progress-empty} + +[module/mpd-online-1] +type = internal/mpd + +host = ${env:MPD_ONLINE_1_HOST} +port = ${env:MPD_ONLINE_1_PORT} +password = ${env:MPD_ONLINE_1_PASS} + +format-online = ${mpd-shared.format-online} + +icon-prev = ${mpd-shared.icon-prev} +icon-stop = ${mpd-shared.icon-stop} +icon-play = ${mpd-shared.icon-play} +icon-pause = ${mpd-shared.icon-pause} +icon-next = ${mpd-shared.icon-next} + +label-song = ${mpd-shared.label-song} +label-song-maxlen = ${mpd-shared.label-song-maxlen} +label-song-ellipsis = ${mpd-shared.label-song-ellipsis} + +bar-progress-width = ${mpd-shared.bar-progress-width} +bar-progress-indicator = ${mpd-shared.bar-progress-indicator} +bar-progress-fill = ${mpd-shared.bar-progress-fill} +bar-progress-empty = ${mpd-shared.bar-progress-empty} + +[module/mpd-online-2] +type = internal/mpd + +host = ${env:MPD_ONLINE_2_HOST} +port = ${env:MPD_ONLINE_2_PORT} +password = ${env:MPD_ONLINE_2_PASS} + +format-online = ${mpd-shared.format-online} + +icon-prev = ${mpd-shared.icon-prev} +icon-stop = ${mpd-shared.icon-stop} +icon-play = ${mpd-shared.icon-play} +icon-pause = ${mpd-shared.icon-pause} +icon-next = ${mpd-shared.icon-next} + +label-song = ${mpd-shared.label-song} +label-song-maxlen = ${mpd-shared.label-song-maxlen} +label-song-ellipsis = ${mpd-shared.label-song-ellipsis} + +bar-progress-width = ${mpd-shared.bar-progress-width} +bar-progress-indicator = ${mpd-shared.bar-progress-indicator} +bar-progress-fill = ${mpd-shared.bar-progress-fill} +bar-progress-empty = ${mpd-shared.bar-progress-empty} +; }}} + [module/xbacklight] type = internal/xbacklight @@ -460,4 +538,4 @@ screenchange-reload = true margin-top = 5 margin-bottom = 5 -; vim:ft=dosini +; vim: set ft=dosini foldmethod=marker foldlevel=0 : diff --git a/polybar/launch.sh b/polybar/launch.sh index f7bc9ec..851bfcd 100755 --- a/polybar/launch.sh +++ b/polybar/launch.sh @@ -8,6 +8,12 @@ killall -q polybar # Wait until the processes have been shut down while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done -polybar --config="$HOME/.config/polybar/config.ini" midbard & +( + set -o allexport # Make all assignments exports + source "$(dirname "$0")"/secrets.sh + set +o allexport + + polybar --config="$HOME/.config/polybar/config.ini" midbard & +) echo "Polybar launched."