From b1dbf62ab9dcad03138a52a8596dccdf9286d958 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Wed, 3 Apr 2019 00:51:56 +0100 Subject: Add spotify volume commands --- Window_Manager/ratpoison/ratpoisonrc.conf | 32 +++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'Window_Manager/ratpoison') diff --git a/Window_Manager/ratpoison/ratpoisonrc.conf b/Window_Manager/ratpoison/ratpoisonrc.conf index 757d186..8b00a30 100644 --- a/Window_Manager/ratpoison/ratpoisonrc.conf +++ b/Window_Manager/ratpoison/ratpoisonrc.conf @@ -1,13 +1,15 @@ #using jcs hacks # info: C=control, M=meta/alt, s=super, S=shift, H = Hyper # xnest for testing + +set onlyborder 0 + escape grave definekey top s-grave meta definekey top Arabic_dammatan meta #set quiet 1 - set historyexpansion 1 #find files script @@ -54,7 +56,7 @@ showpanel alias showborder set border 2 alias hideborder set border 0 -bordscript +#bordscript ###################################### # Panel @@ -73,7 +75,7 @@ addhook switchwin barsend #addhook deletewindow barsend addhook switchframe barsend addhook switchgroup barsend -addhook switchgroup bordscript +#addhook switchgroup bordscript #addhook titlechanged barsend #addhook key barsend @@ -105,7 +107,7 @@ bind V hsplit 2/3 bind s vsplit bind S vsplit 2/3 bind d remove -bind space exec urxvt +bind space exec alacritty bind o only bind semicolon colon bind e exec @@ -126,7 +128,7 @@ alias paneltoggle exec ~/.config/ratpoison/paneltoggle -addhook key bordscript +#addhook key bordscript definekey top s-b bordtoggle definekey top s-p paneltoggle @@ -176,18 +178,28 @@ definekey top KP_Enter exec ~/Dropbox/speech/run-duplex.sh # Volume Control #------------------------------------------------------------- # Up -#alias volup exec amixer -q set Master 5+ && ratpoison -c "echo `$HOME/.config/ratpoison/volind`" & volume -f 'V%i' > /tmp/panel-fifo -alias volup exec amixer -q set Master 5+ && volume -f 'V%i' > /tmp/panel-fifo +#alias volup exec amixer -D pulse -q set Master 5+ && ratpoison -c "echo `$HOME/.config/ratpoison/volind`" & volume -f 'V%i' > /tmp/panel-fifo +alias volup exec pactl set-sink-volume `pactl list sinks short | perl -ne '/^(\d*)/; $x=$1; END { print $x }'` +2% && volume -f 'V%i' > /tmp/panel-fifo +alias voldown exec pactl set-sink-volume `pactl list sinks short | perl -ne '/^(\d*)/; $x=$1; END { print $x }'` -2% && volume -f 'V%i' > /tmp/panel-fifo -definekey top XF86AudioRaiseVolume volup +alias spvolup exec pactl set-sink-input-volume `.config/ratpoison/get_spotify_sink` +2% +alias spvoldown exec pactl set-sink-input-volume `.config/ratpoison/get_spotify_sink` -2% + + +definekey top M-XF86AudioRaiseVolume spvolup definekey top s-Prior volup definekey top s-q volup +definekey top XF86AudioPlay exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause +definekey top XF86AudioStop exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop +definekey top XF86AudioNext exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next +definekey top XF86AudioPrev exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous + # Down -#alias voldown exec amixer -q set Master 5- && ratpoison -c "echo `$HOME/.config/ratpoison/volind`" & volume -f 'V%i' > /tmp/panel-fifo -alias voldown exec amixer -q set Master 5- && volume -f 'V%i' > /tmp/panel-fifo +#alias voldown exec amixer -D pulse -q set Master 5- && ratpoison -c "echo `$HOME/.config/ratpoison/volind`" & volume -f 'V%i' > /tmp/panel-fifo definekey top XF86AudioLowerVolume voldown +definekey top M-XF86AudioLowerVolume spvoldown definekey top s-Next voldown definekey top s-a voldown -- cgit v1.2.3-54-g00ecf From 9e057a7cdeb3eddbe842bf3e5902753e7b556e7b Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Wed, 3 Apr 2019 00:59:03 +0100 Subject: Add script to get spotify sink number --- Window_Manager/ratpoison/get_spotify_sink | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 Window_Manager/ratpoison/get_spotify_sink (limited to 'Window_Manager/ratpoison') diff --git a/Window_Manager/ratpoison/get_spotify_sink b/Window_Manager/ratpoison/get_spotify_sink new file mode 100755 index 0000000..58ba5e9 --- /dev/null +++ b/Window_Manager/ratpoison/get_spotify_sink @@ -0,0 +1,4 @@ +#!/bin/sh +pacmd list-sink-inputs | +tr '\n' '\r' | +perl -ne 's/ *index: ([0-9]+).+?application\.name = "([^\r]+)"\r.+?(?=index:|$)/\2:\1\r/g; print $1 if $2=="Spotify"' -- cgit v1.2.3-54-g00ecf