From 73569b9394ebeb938e4b9d368a49f3625cc1cea7 Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Mon, 24 May 2021 20:09:50 -0400 Subject: [PATCH] Pactl Script and Game Exit Script Fix - Add pactl script to control volume - Add pactl to control center rofi menu - Comment out picom on in game_exit script - Set struts when switching layouts in xmonad - Add keybinding for pactl script --- .scripts/control-center.sh | 4 +++ .scripts/game_exit.sh | 1 + .scripts/pactl.sh | 53 ++++++++++++++++++++++++++++++++ .xmonad | 2 +- README.org | 62 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 121 insertions(+), 1 deletion(-) create mode 100755 .scripts/pactl.sh diff --git a/.scripts/control-center.sh b/.scripts/control-center.sh index bb22bda..d13408b 100755 --- a/.scripts/control-center.sh +++ b/.scripts/control-center.sh @@ -14,6 +14,7 @@ rofi_menu() { " Compositor - picom" " Notifications - dunst" " Media - playerctl" + "墳Volume - pactl" " Hardware - system76-power" " Power Menu - session" " Quit - quit" @@ -45,6 +46,9 @@ main() { --playerctl) /home/sravan/.scripts/playerctl.sh --rofi ;; + --pactl) + /home/sravan/.scripts/pactl.sh --rofi + ;; --system76-power) /home/sravan/.scripts/system76-power.sh --rofi ;; diff --git a/.scripts/game_exit.sh b/.scripts/game_exit.sh index d987064..c0ed723 100755 --- a/.scripts/game_exit.sh +++ b/.scripts/game_exit.sh @@ -1,2 +1,3 @@ #!/bin/bash /home/sravan/.scripts/dunst.sh --dnd +# /home/sravan/.scripts/picom.sh --on diff --git a/.scripts/pactl.sh b/.scripts/pactl.sh new file mode 100755 index 0000000..64cdd99 --- /dev/null +++ b/.scripts/pactl.sh @@ -0,0 +1,53 @@ +#!/bin/bash +help_menu() { + echo "Script to interact with pactl. Use only one argument at a time." + # echo " - Play / Pause: playerctl.sh --play-pause" + # echo " - Next: playerctl.sh --next" + # echo " - Previous: playerctl.sh --prev" + # echo " - Change Player: playerctl.sh --change" + # echo " - Rofi Menu: playerctl.sh --rofi" + # echo " - Help: playerctl.sh --help OR playerctl.sh -h" +} + +rofi_menu() { + declare -a options=( + " Raise Volume - raise" + " Lower Volume - lower" + " Mute - mute" + " Quit - quit" + ) + + choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i) + option=$(printf '%s\n' "${choice}" | awk '{print $NF}') + + if [[ "$option" != "quit" ]]; then + main "--$option" && main "--rofi" + fi +} + +main() { + if [ $# -eq 0 ]; then + # No arguments + help_menu + else + case $1 in + --help | -h) + help_menu + ;; + --raise) + pactl set-sink-volume @DEFAULT_SINK@ +5% + ;; + --lower) + pactl set-sink-volume @DEFAULT_SINK@ -5% + ;; + --mute) + pactl set-sink-mute @DEFAULT_SINK@ toggle + ;; + --rofi) + rofi_menu + ;; + esac + fi +} + +main $@ diff --git a/.xmonad b/.xmonad index f1a1d83..1acc6a0 160000 --- a/.xmonad +++ b/.xmonad @@ -1 +1 @@ -Subproject commit f1a1d837c3b0a4fc2cf050b2db9c2ec748b184a6 +Subproject commit 1acc6a0755996700f288898f0f3bebca2db7ada7 diff --git a/README.org b/README.org index 0076bf7..05f5673 100644 --- a/README.org +++ b/README.org @@ -6656,6 +6656,63 @@ Configuration for Alacritty, the GPU enhanced terminal emulator. main $@ #+end_src +** Volume Control + +#+begin_src shell :shebang #!/bin/bash :tangle .scripts/pactl.sh + help_menu() { + echo "Script to interact with pactl. Use only one argument at a time." + # echo " - Play / Pause: playerctl.sh --play-pause" + # echo " - Next: playerctl.sh --next" + # echo " - Previous: playerctl.sh --prev" + # echo " - Change Player: playerctl.sh --change" + # echo " - Rofi Menu: playerctl.sh --rofi" + # echo " - Help: playerctl.sh --help OR playerctl.sh -h" + } + + rofi_menu() { + declare -a options=( + " Raise Volume - raise" + " Lower Volume - lower" + " Mute - mute" + " Quit - quit" + ) + + choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i) + option=$(printf '%s\n' "${choice}" | awk '{print $NF}') + + if [[ "$option" != "quit" ]]; then + main "--$option" && main "--rofi" + fi + } + + main() { + if [ $# -eq 0 ]; then + # No arguments + help_menu + else + case $1 in + --help | -h) + help_menu + ;; + --raise) + pactl set-sink-volume @DEFAULT_SINK@ +5% + ;; + --lower) + pactl set-sink-volume @DEFAULT_SINK@ -5% + ;; + --mute) + pactl set-sink-mute @DEFAULT_SINK@ toggle + ;; + --rofi) + rofi_menu + ;; + esac + fi + } + + main $@ +#+end_src + ** System76 Power Control #+begin_src shell :shebang #!/bin/bash :tangle .scripts/system76-power.sh @@ -7021,6 +7078,7 @@ These are scripts that should be run from Lutris when launching or exiting a gam #+begin_src shell :shebang #!/bin/bash :tangle .scripts/game_exit.sh /home/sravan/.scripts/dunst.sh --dnd + # /home/sravan/.scripts/picom.sh --on #+end_src ** Control Center @@ -7041,6 +7099,7 @@ These are scripts that should be run from Lutris when launching or exiting a gam " Compositor - picom" " Notifications - dunst" " Media - playerctl" + "墳Volume - pactl" " Hardware - system76-power" " Power Menu - session" " Quit - quit" @@ -7072,6 +7131,9 @@ These are scripts that should be run from Lutris when launching or exiting a gam --playerctl) /home/sravan/.scripts/playerctl.sh --rofi ;; + --pactl) + /home/sravan/.scripts/pactl.sh --rofi + ;; --system76-power) /home/sravan/.scripts/system76-power.sh --rofi ;;