From 70acde96ea40b9d33027fb1a86525b889bbaf19f Mon Sep 17 00:00:00 2001 From: stormdragon2976 Date: Wed, 30 Nov 2022 02:25:23 -0500 Subject: [PATCH] make a bit of ear candy for workspace movement. Commented out original event in sound.py, we can remove it once this is well tested. --- i38.sh | 20 ++++++++++---------- scripts/announce_workspace.sh | 25 +++++++++++++++++++++++++ scripts/sound.py | 3 ++- 3 files changed, 37 insertions(+), 11 deletions(-) create mode 100755 scripts/announce_workspace.sh diff --git a/i38.sh b/i38.sh index 8f539ec..91b1f10 100755 --- a/i38.sh +++ b/i38.sh @@ -322,16 +322,16 @@ set \$ws9 "9" set \$ws10 "10" # switch to workspace -bindsym Control+F1 workspace number \$ws1, exec spd-say -P important -Cw "workspace 1" -bindsym Control+F2 workspace number \$ws2, exec spd-say -P important -Cw "workspace 2" -bindsym Control+F3 workspace number \$ws3, exec spd-say -P important -Cw "workspace 3" -bindsym Control+F4 workspace number \$ws4, exec spd-say -P important -Cw "workspace 4" -bindsym Control+F5 workspace number \$ws5, exec spd-say -P important -Cw "workspace 5" -bindsym Control+F6 workspace number \$ws6, exec spd-say -P important -Cw "workspace 6" -bindsym Control+F7 workspace number \$ws7, exec spd-say -P important -Cw "workspace 7" -bindsym Control+F8 workspace number \$ws8, exec spd-say -P important -Cw "workspace 8" -bindsym Control+F9 workspace number \$ws9, exec spd-say -P important -Cw "workspace 9" -bindsym Control+F10 workspace number \$ws10, exec spd-say -P important -Cw "workspace 10" +bindsym Control+F1 workspace number \$ws1, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F2 workspace number \$ws2, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F3 workspace number \$ws3, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F4 workspace number \$ws4, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F5 workspace number \$ws5, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F6 workspace number \$ws6, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F7 workspace number \$ws7, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F8 workspace number \$ws8, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F9 workspace number \$ws9, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh +bindsym Control+F10 workspace number \$ws10, exec --no-startup-id ${i3Path}/scripts/announce_workspace.sh # move focused container to workspace bindsym Control+Shift+F1 move container to workspace number \$ws1, exec spd-say -P important -Cw "moved to workspace 1" diff --git a/scripts/announce_workspace.sh b/scripts/announce_workspace.sh new file mode 100755 index 0000000..cd62e5b --- /dev/null +++ b/scripts/announce_workspace.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +workSpace="$(i3-msg -t get_workspaces \ + | jq '.[] | select(.focused==true).name' \ + | cut -d"\"" -f2)" +left=9 +right=0 +msg="Workspace ${workSpace}" +if ! [[ "${workSpace}" =~ ^[0-9]+$ ]]; then + right=9 +else + if [[ ${workSpace} -eq 10 ]]; then + left=0 + right=9 + elif [[ ${workSpace} -eq 5 ]]; then + right=9 + elif [[ ${workSpace} -gt 5 ]]; then + right=9 + ((left-=${workSpace})) + else + ((right+=${workSpace})) + fi +fi +play -nqV0 synth pi fade 0 .25 .15 pad 0 1 reverb overdrive riaa norm -5 speed 1 remix v0.${left} v0.${right} & +spd-say -P important -Cw "${msg}" diff --git a/scripts/sound.py b/scripts/sound.py index 21f41f3..9fd3e28 100755 --- a/scripts/sound.py +++ b/scripts/sound.py @@ -20,7 +20,8 @@ def on_mode(self,event): system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 &') def on_workspace_focus(self,i3): - system('play -qnV0 synth pi fade 0 .25 .15 pad 0 1 reverb overdrive riaa norm -8 speed 1 &') + #system('play -qnV0 synth pi fade 0 .25 .15 pad 0 1 reverb overdrive riaa norm -8 speed 1 &') + pass def on_workspace_move(self,i3): system('play -qnV0 synth pi fade 0 .25 .15 pad 0 1 reverb overdrive riaa norm -8 speed 1 reverse &')