Initial commit for sway

This commit is contained in:
John Mertz 2022-04-19 00:45:01 -04:00
parent 136436502e
commit ae04bc9745
5 changed files with 563 additions and 0 deletions

53
sway/autostart Normal file
View File

@ -0,0 +1,53 @@
# vim: ft=sh
################################################################################
# Background utilities
################################################################################
# SSH Add - Should be started by profile instead
# exec eval `ssh-agent -a ${SSH_AUTH_SOCK}`
exec ssh-add &
# Automatically restore last used output configuration
# TODO: Need to add fail-safe to script in case the outputs are unavailable
#exec $HOME/scripts/sway/displays.pl &
# Enable automatic color temperature change
exec ${HOME}/scripts/sway/gammastep.pl &
# Notification daemon
exec mako &
# Tray icons
# TODO: Orage is dead. Find a new calendaring solution
#exec orage &
exec nm-applet &
exec blueman-applet &
exec nextcloud &
exec pasystray &
################################################################################
# Applications by workspace
################################################################################
# 0:cal
# TODO: as above, need new calendaring solution.
# 1:chat
# TODO: Set up ZNC then use a client that can actually generate notifications
exec xterm -e /bin/bash -c "ssh -i ~/.ssh/no_pass jpm@john.me.tz -t 'screen -x irssi'" &
exec flatpak run com.mattermost.Desktop
# 2:mail - Should also prompt for keyring
exec thunderbird &
# 3:chrm
# Don't launch chromium because it hogs resources
# exec chromium &
# 5:call
# Currently preferring mobile
#exec linphone &
# 7:FF Dev edition
exec $HOME/.local/bin/firefox/firefox-bin &

34
sway/behaviours Normal file
View File

@ -0,0 +1,34 @@
# vim: ft=sh
################################################################################
# Default workspaces
################################################################################
#assign [class="Xchat"] 1-chat Replaced by irssi which will open on the first workspace at startup
assign [class="XTerm"] 1
assign [class="UXTerm"] grave
assign [class="thunderbird"] 2
assign [class="Chromium"] 3
assign [class="Linphone"] 5
assign [class="firefox-aurora"] 7
# Don't use VNC viewer anymore. I've defaulted to running virt-manager on this workspace because it's similar
#assign [class="Vncviewer"] 9
################################################################################
# Floating windows
################################################################################
for_window [shell="xdg_shell"] floating enable # Picture-in-picture firefox
# Also make Picture-in-picture windows stick to active workspace
for_window [shell="xdg_shell"] sticky enable # Picture-in-picture firefox
for_window [instance="Download"] floating enable
for_window [window_role="plugin_ui"] floating enable
for_window [title="Menu Update"] floating enable
for_window [title="___"] floating enable
for_window [class="UXTerm"] floating enable, resize set height 600px, resize set width 800px, move position 1120px 460px
for_window [class="Tlpui"] floating enable
for_window [title="XTerm"] floating enable
for_window [class="Gvim"] floating enable
for_window [class="Orage"] floating enable
for_window [class="Claws-mail"] layout stacking
for_window [class="Vncviewer"] fullscreen enable

346
sway/bindings Normal file
View File

@ -0,0 +1,346 @@
# vim: ft=sh
### 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 rofi (launch applications)
# TODO: migrate from rofi to wofi when stable
bindsym $mod+u exec rofi -config $HOME/.config/rofi/config.rasi -theme $HOME/.config/rofi/sidebar -show drun -lines 20
# 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
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
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 in rofi
bindsym $mod+underscore exec $HOME/scripts/rofi/rofi-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: Unassigned
#bindsym $mod+b
# 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: Blank screen
bindsym $mod+Escape exec /usr/bin/sh -c 'sleep 1 ; /usr/bin/kill -USR1 swayidle'
# Add Shift: Lock
#bindsym $mod+Escape exec ~/.config/sway/swaylock.sh
# 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 rofi
bindsym $mod+Tab exec "~/scripts/rofi/sway-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"
}

17
sway/colorscheme Normal file
View File

@ -0,0 +1,17 @@
set $base0D #000000
set $base00 #ebdbb2
set $base01 #282828
set $base02 #cc241d
set $base03 #98971a
set $base04 #d79921
set $base05 #458588
set $base06 #b16286
set $base07 #68986a
set $base08 #a89984
set $base09 #928374
set $base0A #fb4934
set $base0B #b8bb26
set $base0C #fabd2f
set $base0D #83a598
set $base0E #d3869b
set $base0F #8ec07c

113
sway/config Executable file
View File

@ -0,0 +1,113 @@
# vim: ft=sh
################################################################################
# Keyboard
################################################################################
# I use a Dvorak keyboard, like a weirdo
input * xkb_layout "us"
input * xkb_variant "dvorak"
# Key repeat values
input * repeat_delay 300
input * repeat_rate 30
################################################################################
# Mouse
################################################################################
# TrackPoint acceleration
input 1133:49291:Logitech_G502_HERO_SE accel_profile flat
input 1133:49291:Logitech_G502_HERO_SE pointer_accel -0.966
# When using a 2-button mouse, simulate button 3 with simultaneous press
input * middle_emulation enable
# Hide cursor after 1 second
seat seat0 hide_cursor 1000
# Disable mouse as trigger to wake from idle
seat * idle_wake keyboard switch
################################################################################
# Appearance
################################################################################
# Gtk themes
exec gsettings set org.gnome.desktop.interface gtk-theme 'Oled' &
exec gsettings set org.gnome.desktop.interface icon-theme 'Papirus-Dark-Grey' &
# X11 Cursor theme
exec gsettings set org.gnome.desktop.interface cursor-theme 'FlatbedCursors-Blue' &
seat seat0 xcursor_theme FlatbedCursors-Blue
# Minimize borders from all windows
hide_edge_borders none
default_floating_border normal 1
default_border pixel 1
# Font only visible in tabbed mode. Also inheritted by bar.
font pango:Anonymous Pro 12
# Start Waybar with IPC functionality (requires waybar>=0.9.9, wlroots>=0.15)
bar bar-1 {
swaybar_command /usr/bin/waybar -c $HOME/.config/waybar/config
mode hide
hidden_state hide
position bottom
}
# gaps
gaps inner 3
gaps outer 1
# Color definitions
include $HOME/.dotfiles/sway/colorscheme
# Assign colors to elements (TODO: actually name the colors for better readability)
client.background $base00
# Property Name Border BG Text Indicator Child Border
client.focused $base05 $base0D $base00 $base0D $base0D
client.focused_inactive $base01 $base01 $base05 $base03 $base01
client.unfocused $base01 $base00 $base05 $base01 $base01
client.urgent $base08 $base08 $base00 $base08 $base08
# Feature request placed for this, but it does not exist as of 1.7
#client.sticky $base08 $base08 $base00 $base08 $base08
client.placeholder $base00 $base00 $base05 $base00 $base00
client.background $base07
################################################################################
# Bindings
################################################################################
# Set super key to Windows/Super key
set $mod Mod4
### Load keybindings
include $HOME/.dotfiles/sway/bindings
################################################################################
# Behaviour
################################################################################
# Custom SwayIdle script
exec swayidle -w timeout 500 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' &
# Allow movement of floating windows with Left Click+Drag
floating_modifier $mod
# Load special window behaviours
include $HOME/.dotfiles/sway/behaviours
# TODO Execute actions upon entering/exiting a device mode
# bindswitch [lib|tablet]:[on|off|toggle]
# eg. bindswitch tablet:on tablet_mode.sh on
# X window 'activation' should just make a window 'urgent' instead of 'focused'
focus_on_window_activation urgent
################################################################################
# Start-up Applications
################################################################################
include $HOME/.dotfiles/sway/autostart