.dotfiles/sway/bindings

356 lines
12 KiB
Bash

# vim: ft=sh
# TODO: get started with Distrobox. Once I have apps in a distro toolbox they can be added to the launcher with:
# distrobox-export --app <app>
# Attempt to remove as many rpm-ostree layers as possible and replace them with containerized versions.
# Also change terminal bindings to launch in a distro toolbox with the primary binding and the host in a secondary:
# - Research terminals that supprot "profiles"
# - Create "profiles" for each box that are visually distinct from the host
# - Set an auto-run command to: distrobox-enter --name <distro>
### Keybindings
## Vim-style navigation and movement
# Vim navigation between containers
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Add Shift: move containers around display
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
## Home Row Left
# Index Stretch: todo.txt
bindsym $mod+i exec /usr/bin/uxterm -e "$HOME/.local/bin/todotxt-machine $HOME/nextcloud/todo.txt"
# Add Shift: resize mode ($mod + right-mouse is easier)
bindsym $mod+Shift+i mode "resize"
# Index: start wofi (launch applications)
bindsym $mod+u exec $HOME/scripts/wofi/wofi-drun.sh
# Add Shift: Alternative launcher for literal commands
bindsym $mod+Shift+u exec gmrun
# Middle: start a terminal
bindsym $mod+e exec xfce4-terminal
# Add Shift: start a remote shell
# TODO: bindsym $mod+Shift+e exec $HOME/scripts/wofi/wofi-ssh-menu.sh
bindsym $mod+Shift+e exec $HOME/scripts/rofi/rofi-ssh-menu.sh
# Ring: start a file manager
#bindsym $mod+o exec xfce4-terminal -c /usr/bin/mc
bindsym $mod+o exec thunar
# Add Shift: VPN quick menu
# TODO: bindsym $mod+Shift+o exec $HOME/scripts/wofi/wofi-vpn.sh
bindsym $mod+Shift+o exec $HOME/scripts/rofi/rofi-openvpn.sh
# Pinky: Open Browser
bindsym $mod+a exec $HOME/.local/bin/firefox/firefox-bin
# Add Shift: Secondary Browser
bindsym $mod+Shift+a exec $HOME/scripts/send-to-kodi.sh
### Above Home Row: Media keys for MOC + Workflow
# TODO: replace with ncmpcpp
# Index Stretch: Initiate current playlist in background
bindsym $mod+y exec ssh -i ~/.ssh/no_pass 10.10.0.66 -t "$HOME/bin/mocp_start.pl"
# Add Shift: Launch MOC with theme in foreground
# Note: UXTerm opens in a floating terminal. If a `grave` terminal is not yet running, it can then be hidden and called back with $mod+grave
bindsym $mod+Shift+y exec /usr/bin/uxterm -e /bin/bash -c "ssh -i ~/.ssh/no_pass 10.10.0.66 -t 'mocp -T solarized'"
# Index: Toggle Play/Pause
bindsym $mod+p exec ssh -i ~/.ssh/no_pass 10.10.0.66 -t 'mocp -G'
# Add Shift: Toggle Shuffle
bindsym $mod+Shift+p exec ssh -i ~/.ssh/no_pass 10.10.0.66 -t 'mocp -t shuffle'
# Middle: Volume up
bindsym $mod+period exec ssh -i ~/.ssh/no_pass 10.10.0.66 -t 'mocp -v +5'
# Add Shift: Next Song
bindsym $mod+Shift+period exec ssh -i ~/.ssh/no_pass 10.10.0.66 -t 'mocp -f'
# Ring: Volume down
bindsym $mod+comma exec ssh -i ~/.ssh/no_pass 10.10.0.66 -t 'mocp -v -5'
# Add Shift: Previous Song
bindsym $mod+Shift+comma exec ssh -i ~/.ssh/no_pass 10.10.0.66 -t 'mocp -r'
# Pinky: Run init script to start workflow (Shift added so that I would stop accidentally lanching it instead of switching to workspace 1):
# TODO: 2 free binding spaces here too
## Below Home Row: Program hotkeys as applicable to workspace number
# Pinky Irssi
bindsym $mod+semicolon exec xterm -e /bin/bash -c "ssh -i ~/.ssh/no_pass jpm@john.me.tz -t 'screen -x irssi'"
#Add Shift: Discord
bindsym $mod+Shift+Semicolon exec flatpak run com.discordapp.Discord
# Ring: Email
bindsym $mod+q exec thunderbird
# Add Shift: Calendar (deprecated, TODO: figure out a new calendar)
#bindsym $mod+Shift+q exec orage -t
# Middle: Occupied at top; switch to container below
# Add Shift: Occupied at top; move focused container down
# Index: Occupied at top; switch to container above
# Add Shift: Occupied at top; move focused container up
# Index Stretch: Windows VNC
# TODO: I no longer have/need a windows or Mac machine to connect to. Replace with something useful
#bindsym $mod+x exec vncviewer 192.168.2.166 -p .vnc/passwd
# Add Shift: Mac VNC
#bindsym $mod+x exec vncviewer 192.168.2.167 -p .vnc/passwd
### Right Hand
## Home Row Right : Window/workspace management; power
# Index Stretch: set future splits to horizontal (to the side of the home key)
bindsym $mod+d split h
# Add Shift: Unassigned
#bindsym $mod+Shift+d
# Index : Occupied above; switch to container to the left
# Add Shift: Occupied above; move container to the left
# TODO: Middle: Switch to output to the left
# TODO: Add Shift: Move workspace to output to the left
# TODO: Ring: Switch to output to the right
# TODO: Add Shift: Move workspace to output to the right
# Pinky: toggle float/tile
bindsym $mod+s floating toggle
# Add Shift: Toggle stickying of floating container to the focused workspace
bindsym $mod+Shift+s sticky toggle
# Pinky Stretch: kill focused container
bindsym $mod+minus kill
# Add Shift: Power menu
bindsym $mod+underscore exec $HOME/scripts/sway/power-menu.sh
## Above Home Row: Change containers arrangement methods
# Index Stretch: Fullscreen
bindsym $mod+f fullscreen
# Add Shift: Unassigned
#bindsym $mod+Shift+f
# Index: split layout (toggles vertical/horizontal)
bindsym $mod+g layout toggle split
# Add Shift: Unassigned
#bindsym $mod+Shift+g
# Middle: tabbed layout
bindsym $mod+c layout tabbed
# Add Shift: Unassigned
#bindsym $mod+Shift+c
# Ring: stacked layout
bindsym $mod+r layout stacking
# Add Shift: Unassigned
#bindsym $mod+Shift+r
# Pinky: Occupied above; switch to container to the right
# Add Shift: Occupied above; move container to the right
# Pinky Stretch: Unassigned
#bindsym $mod+slash
# Add Shift: Unassigned
#bindsym $mod+Shift+slash
## Below Home Row: Preemplive split direction, focus switching
# Index Stretch: Rotate wallpaper
bindsym $mod+b exec $HOME/scripts/sway/rotate-wallpaper.sh
# Add Shift: Unassigned
#bindsym $mod+Shift+b
# Index: set future splits to vertical (beneath the home key, get it?)
bindsym $mod+m split v
# Add Shift: Unassigned
#bindsym $mod+Shift+m
# Middle: focus parent
bindsym $mod+w focus parent
# Add shift: focus child
bindsym $mod+Shift+w focus child
# Ring: Unassigned
#bindsym $mod+v
# Add Shift: Unassigned
#bindsym $mod+Shift+v
# Pinky: change between focuses
bindsym $mod+z focus mode_toggle
# Add Shift: Unassigned
#bindsym $mod+Shift+z
### Numberline: Workspace Swtching and Movement
# Grave: DIY version of Tilde pop-up terminal
bindsym $mod+Grave exec $HOME/scripts/sway/popup-term.pl
# Add Shift: Switch to Grave workspace
bindsym $mod+Shift+Grave move container to workspace grave
# Add Control: Move to Grave workspace
bindsym $mod+Control+Grave workspace grave
# Numbers: Switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 0
# Add Shift: Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 0
## Add Control: Switch to overflow workspaces
bindsym $mod+Control+1 workspace C1
bindsym $mod+Control+2 workspace C2
bindsym $mod+Control+3 workspace C3
bindsym $mod+Control+4 workspace C4
bindsym $mod+Control+5 workspace C5
bindsym $mod+Control+6 workspace C6
bindsym $mod+Control+7 workspace C7
bindsym $mod+Control+8 workspace C8
bindsym $mod+Control+9 workspace C9
bindsym $mod+Control+0 workspace C0
## Add Control+Shift: Move container to overflow workspaces
bindsym $mod+Control+Shift+1 move container to workspace C1
bindsym $mod+Control+Shift+2 move container to workspace C2
bindsym $mod+Control+Shift+3 move container to workspace C3
bindsym $mod+Control+Shift+4 move container to workspace C4
bindsym $mod+Control+Shift+5 move container to workspace C5
bindsym $mod+Control+Shift+6 move container to workspace C6
bindsym $mod+Control+Shift+7 move container to workspace C7
bindsym $mod+Control+Shift+8 move container to workspace C8
bindsym $mod+Control+Shift+9 move container to workspace C9
bindsym $mod+Control+Shift+0 move container to workspace C0
# Square bracket left: Unassigned; pretty sure that this keycode is incorrect
#bindsym $mod+[
# Add Shift: Unassigned
#bindsym $mod+Shift+[
# Square bracket right: Unassigned; pretty sure that this keycode is incorrect
#bindsym $mod+]
# Add Shift: Unassigned
#bindsym $mod+Shift+]
# Backspace: switch between previous workspace
bindsym $mod+Backspace workspace back_and_forth
# Add Shift: move container between previous workspaces
bindsym $mod+Shift+Backspace move container to workspace back_and_forth
### Function row
# Escape: Lock
bindsym $mod+Escape exec /usr/bin/kill -SIGUSR1 `cat ${HOME}/.spool/sway-transparency`
# Add Shift: Blank screen
bindsym $mod+Shift+Escape exec /usr/bin/sh -c "sleep 1 ; /usr/bin/kill -SIGUSR1 $(pgrep swayidle)"
# F1: Mute Audio
bindsym $mod+F1 $HOME/scripts/audio/mute.sh
# F2: Volume down
#bindsym $mod+F2
# F3: Volume up
#bindsym $mod+F3
# F4: Mute microphone
#bindsym $mod+F4
# F5: Brightness down
bindsym $mod+F5 exec $HOME/scripts/thinkpad/blc.pl --notify --
# F6: Brightness up
bindsym $mod+F6 exec $HOME/scripts/thinkpad/blc.pl --notify ++
# F7: Switch between docked and detached
bindsym $mod+F7 $HOME/scripts/thinkpad/toggle_outputs.sh
# F8: Toggle wifi
#bindsym $mod+F8
# F9: Open settings
#bindsym $mod+F9
# F10: Open bluetooth devices
#bindsym $mod+F10
# F10: TODO: use actual PrtSc button
bindsym $mod+F10 exec grim
# Add Shift: capture region
#bindsym $mod+Shift+F10
# F11: Keyboard Backlight
bindsym $mod+F11 exec $HOME/scripts/thinkpad/kbd_backlight.pl 2> /dev/null
# F12: Unassigned
#bindsym $mod+F12
# Home+End: Increase Brightness
bindsym $mod+Home exec $HOME/scripts/thinkpad/blc.pl --notify ++
# Add Shift: Change Bigly
bindsym $mod+Shift+Home exec $HOME/scripts/thinkpad/blc.pl --notify += 10
# End: Reduce Brightness
bindsym $mod+End exec $HOME/scripts/thinkpad/blc.pl --notify --
# Add Shift: Change Bigly
bindsym $mod+Shift+End exec $HOME/scripts/thinkpad/blc.pl --notify -= 10
# Insert: Unassigned
#bindsym $mod+Insert
# Delete: Unassigned
#bindsym $mod+Delete
# Miscellaneous
# Tab: Quick change. Shows all windows on all pages by name in wofi
bindsym $mod+Tab exec "~/scripts/wofi/wofi-alt-tab.sh"
# Resize Mode (you can also use the mouse for that): Entered with $mod+i
mode "resize" {
# Vim direction key to modify the size of containers
# D: shrink width
bindsym d resize shrink width 10 px or 10 ppt
# N: grow width
bindsym n resize grow width 10 px or 10 ppt
# H: shrink height
bindsym h resize shrink height 10 px or 10 ppt
# T: grow height
bindsym t resize grow height 10 px or 10 ppt
# Same system with half of the effect for more granularity with the arrow keys
bindsym Left resize shrink width 5 px or 5 ppt
bindsym Down resize grow height 5 px or 5 ppt
bindsym Up resize shrink height 5 px or 5 ppt
bindsym Right resize grow width 5 px or 5 ppt
# Switch back to normal mode: Enter, Escape or Q
bindsym q mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}