diff --git a/i38.sh b/i38.sh old mode 100755 new mode 100644 index 95f3b5f..8245ec6 --- a/i38.sh +++ b/i38.sh @@ -146,7 +146,7 @@ done # Configuration questions #Prevent setting ratpoison mode key to the same as default mode key -while [ "$escapeKey" == "$mod" ] +while [ "$escapeKey" == "$mod" ] do escapeKey="$(menulist "Ratpoison mode key:" Control+t Control+z Control+Escape Alt+Escape Control+Space Super)" escapeKey="${escapeKey//Alt/Mod1}" @@ -332,16 +332,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 &') diff --git a/scripts/window_list.sh b/scripts/window_list.sh index 37b765b..fc837da 100755 --- a/scripts/window_list.sh +++ b/scripts/window_list.sh @@ -1,10 +1,16 @@ #!/usr/bin/env bash -select_window() { - local window="$(yad --list --column "Select Window" "$@")" - echo "${window%|}" -} +mapfile -t windowList < <(python3 -c ' +import i3ipc -i3-msg '[title="'$(i3-msg -t get_tree | jq -r "recurse(.nodes[]) | select(.window) | .name" | select_window)'"] focus' +i3 = i3ipc.Connection() -exit 0 +for con in i3.get_tree(): + if con.window and con.parent.type != "dockarea": + print(con.window) + print(con.name)') +id="$(yad --title "I38" --list --separator "" --column "id" --column "Select Window" --hide-column 1 --print-column 1 "${windowList[@]}")" +if [[ -z "${id}" ]]; then + exit 0 +fi +i3-msg \[id="${id}"\] focus