updated audioscirpts and xmonad.hs to reflect changes, much finer grain control now

This commit is contained in:
Solomon Laing 2021-03-24 18:13:57 +10:30
parent 654d7cf14f
commit eae08b35a4
9 changed files with 68 additions and 8 deletions

View File

@ -3,7 +3,7 @@
default_loc=/tmp/pactl-default-sink
if [ ! -f "$default_loc" ] ; then
/home/solomon/.scripts/set-default-card
/home/solomon/.scripts/set-default-sink
fi
default=$(cat $default_loc)

11
.scripts/dec-source-volume Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
default_loc=/tmp/pactl-default-source
if [ ! -f "$default_loc" ] ; then
/home/solomon/.scripts/set-default-source
fi
default=$(cat $default_loc)
pactl set-source-volume $default -5%

View File

@ -3,7 +3,7 @@
default_loc=/tmp/pactl-default-sink
if [ ! -f "$default_loc" ] ; then
/home/solomon/.scripts/set-default-card
/home/solomon/.scripts/set-default-sink
fi
default=$(cat $default_loc)

11
.scripts/inc-source-volume Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
default_loc=/tmp/pactl-default-source
if [ ! -f "$default_loc" ] ; then
/home/solomon/.scripts/set-default-source
fi
default=$(cat $default_loc)
pactl set-source-volume $default +5%

View File

@ -2,10 +2,12 @@
choice=$(pactl list short sinks | awk '{print $2}' | dmenu -i -p "which sink should be default?")
if [ $choice=="" ] ; then
if [ -z "$choice" ] ; then
exit 0;
fi
rm /tmp/pactl-default-sink --force # to ignore if it isn't there
echo "$choice" >> /tmp/pactl-default-sink
touch /tmp/pactl-default-sink
echo "$choice" > /tmp/pactl-default-sink
pactl set-default-sink $choice # make sure that the chosen sink is the

13
.scripts/set-default-source Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
choice=$(pactl list short sources | awk '{print $2}' | dmenu -i -p "which source should be default?")
if [ -z "$choice" ] ; then
exit 0;
fi
rm /tmp/pactl-default-source --force # to ignore if it isn't there
touch /tmp/pactl-default-source
echo "$choice" > /tmp/pactl-default-source
pactl set-default-source $choice # make sure that the chosen sink is the

11
.scripts/toggle-source-mute Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
default_loc=/tmp/pactl-default-source
if [ ! -f "$default_loc" ] ; then
/home/solomon/.scripts/set-default-source
fi
default=$(cat $default_loc)
pactl set-source-mute $default toggle

View File

@ -235,16 +235,28 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
--
[
-- decrease volume with mod+f11
((modm, xK_F11), spawn "/home/solomon/.scripts/dec-default-volume")
((modm, xK_F11), spawn "/home/solomon/.scripts/dec-sink-volume")
-- increase volume with mod+f12
,((modm, xK_F12), spawn "/home/solomon/.scripts/inc-default-volume")
,((modm, xK_F12), spawn "/home/solomon/.scripts/inc-sink-volume")
-- toggle mute with mod+f10
,((modm, xK_F10), spawn "/home/solomon/.scripts/toggle-default-mute")
,((modm, xK_F10), spawn "/home/solomon/.scripts/toggle-sink-mute")
-- decrease volume with mod+f11
,((modm .|. shiftMask, xK_F11), spawn "/home/solomon/.scripts/dec-source-volume")
-- increase volume with mod+f12
,((modm .|. shiftMask, xK_F12), spawn "/home/solomon/.scripts/inc-source-volume")
-- toggle mute with mod+f10
,((modm .|. shiftMask, xK_F10), spawn "/home/solomon/.scripts/toggle-source-mute")
-- set default sink for pactl to allow above scripts to run
,((modm .|. shiftMask, xK_F10), spawn "/home/solomon/.scripts/set-sound-card")
,((modm, xK_F7), spawn "/home/solomon/.scripts/set-default-sink")
-- set default source for pactl
,((modm .|. shiftMask, xK_F7), spawn "/home/solomon/.scripts/set-default-source")
]
++