From 050bcb5bf244682e9ae106b9b520b10158d16a38 Mon Sep 17 00:00:00 2001 From: James Patrick Date: Mon, 3 Jun 2019 00:41:43 -0400 Subject: [PATCH] Added Rofi Script for media controls. Normally I would just bind this media keys but that doesn't exist on this laptop. --- rofi/scripts/media_controls | 28 ++++++++++++++++++++++++++++ sway/config | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 rofi/scripts/media_controls diff --git a/rofi/scripts/media_controls b/rofi/scripts/media_controls new file mode 100755 index 0000000..c45e8a1 --- /dev/null +++ b/rofi/scripts/media_controls @@ -0,0 +1,28 @@ +#! env zsh + +STATUS="$(playerctl status)" +MSG="$(playerctl metadata --format '{{xesam:title}} - {{xesam:artist}}')" +OPTIONS="玲 Back +怜 Next +懶 Play/Pause + Stop" + +SELECTED="$( +rofi -dmenu -i -width 15 -mesg "${MSG:-"No infomation"}" -p "${STATUS:-"Not Playing"}" --hide-scrollbar -line-padding 4 <<< $OPTIONS +)" + +echo $SELECTED + +case $SELECTED in + *Next) + playerctl next ;; + *Back) + playerctl previous ;; + *Play/Pause) + playerctl play-pause ;; + *Stop) + playerctl stop ;; + *) + echo $SELCTED ;; +esac + diff --git a/sway/config b/sway/config index 9e174fd..1c15df5 100644 --- a/sway/config +++ b/sway/config @@ -200,7 +200,7 @@ bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle bindsym XF86MonBrightnessDown exec brightnessctl set 5%- bindsym XF86MonBrightnessUp exec brightnessctl set +5% bindsym Pause exec playerctl play-pause - +bindsym Shift+Pause exec sh $XDG_CONFIG_HOME/rofi/scripts/media_controls # Status Bar: