From 6dfbdf41795931d30c9219fe528855c6deabfd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Sat, 9 Sep 2017 14:00:35 +0200 Subject: [PATCH] Use py3-cmd to update bar --- i3/config | 10 +++++++--- i3/scripts/bar-update | 9 +++++++++ i3/scripts/pa-volume | 17 ++++++++--------- 3 files changed, 24 insertions(+), 12 deletions(-) create mode 100755 i3/scripts/bar-update diff --git a/i3/config b/i3/config index 1027222..3a1d4f3 100644 --- a/i3/config +++ b/i3/config @@ -265,9 +265,13 @@ bindsym $mod+F9 exec --no-startup-id evolution ################################################################################ bindsym XF86Sleep exec --no-startup-id $scriptdir/i3exit suspend -bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle ; exec --no-startup-id $update-status -bindsym XF86AudioRaiseVolume exec --no-startup-id $scriptdir/pa-volume set-vol +5 ; exec --no-startup-id $scriptdir/update-status -bindsym XF86AudioLowerVolume exec --no-startup-id $scriptdir/pa-volume set-vol -5 ; exec --no-startup-id $scriptdir/update-status +bindsym XF86AudioMute exec --no-startup-id $scriptdir/pa-volume mute-toggle +bindsym XF86AudioRaiseVolume exec --no-startup-id $scriptdir/pa-volume set-vol +3 +bindsym XF86AudioLowerVolume exec --no-startup-id $scriptdir/pa-volume set-vol -3 + +bindsym XF86AudioPlay exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause +bindsym XF86AudioNext exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next +bindsym XF86AudioPrev exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous # keys seemingly switched bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -dec 5 ; exec --no-startup-id $scriptdir/update-status diff --git a/i3/scripts/bar-update b/i3/scripts/bar-update new file mode 100755 index 0000000..24906fc --- /dev/null +++ b/i3/scripts/bar-update @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ "$1" ]] ; then + modules="$1" +else + modules=all +fi + +py3-cmd refresh "$modules" diff --git a/i3/scripts/pa-volume b/i3/scripts/pa-volume index b098c33..7a38011 100755 --- a/i3/scripts/pa-volume +++ b/i3/scripts/pa-volume @@ -75,6 +75,10 @@ usage() { echo "$0 set-vol VOL_PERC" } +update_status_bar() { + ~/.i3/scripts/bar-update volume_status +} + case "$1" in "get-vol") echo $(getvol) @@ -85,19 +89,19 @@ case "$1" in else setvol "$2" fi - hook="$3" + update_status_bar ;; "mute") mute - hook="$2" + update_status_bar ;; "unmute") unmute - hook="$2" + update_status_bar ;; "mute-toggle") mute-toggle - hook="$2" + update_status_bar ;; "is-muted") echo $(ismuted) @@ -109,8 +113,3 @@ case "$1" in usage ;; esac - -if [[ -n "$hook" ]] ; then - echo "volume changed, executing hook: $hook" - $hook -fi