diff --git a/.scripts/dec-default-volume b/.scripts/dec-sink-volume similarity index 77% rename from .scripts/dec-default-volume rename to .scripts/dec-sink-volume index 417c017..403f892 100755 --- a/.scripts/dec-default-volume +++ b/.scripts/dec-sink-volume @@ -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) diff --git a/.scripts/dec-source-volume b/.scripts/dec-source-volume new file mode 100755 index 0000000..b097679 --- /dev/null +++ b/.scripts/dec-source-volume @@ -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% diff --git a/.scripts/inc-default-volume b/.scripts/inc-sink-volume similarity index 77% rename from .scripts/inc-default-volume rename to .scripts/inc-sink-volume index 3f03891..869ec0f 100755 --- a/.scripts/inc-default-volume +++ b/.scripts/inc-sink-volume @@ -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) diff --git a/.scripts/inc-source-volume b/.scripts/inc-source-volume new file mode 100755 index 0000000..c7b711d --- /dev/null +++ b/.scripts/inc-source-volume @@ -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% diff --git a/.scripts/set-sound-card b/.scripts/set-default-sink similarity index 72% rename from .scripts/set-sound-card rename to .scripts/set-default-sink index e55b7d1..212bae9 100755 --- a/.scripts/set-sound-card +++ b/.scripts/set-default-sink @@ -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 \ No newline at end of file diff --git a/.scripts/set-default-source b/.scripts/set-default-source new file mode 100755 index 0000000..a5f6f62 --- /dev/null +++ b/.scripts/set-default-source @@ -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 \ No newline at end of file diff --git a/.scripts/toggle-default-mute b/.scripts/toggle-sink-mute similarity index 100% rename from .scripts/toggle-default-mute rename to .scripts/toggle-sink-mute diff --git a/.scripts/toggle-source-mute b/.scripts/toggle-source-mute new file mode 100755 index 0000000..aa42592 --- /dev/null +++ b/.scripts/toggle-source-mute @@ -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 diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index fbf9f73..646acab 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -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") ] ++