From 0579602a72495d5901f92993946caf37f43b7172 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 21 Jul 2023 21:50:38 -0400 Subject: [PATCH] add sway --- dot_config/sway/config | 362 +++++++++++++++++++++++++++++++++ dot_config/sway/themes/gruvbox | 57 ++++++ 2 files changed, 419 insertions(+) create mode 100644 dot_config/sway/config create mode 100644 dot_config/sway/themes/gruvbox diff --git a/dot_config/sway/config b/dot_config/sway/config new file mode 100644 index 0000000..a6ef2d0 --- /dev/null +++ b/dot_config/sway/config @@ -0,0 +1,362 @@ +# config for sway +# +# Read `man 5 sway` for a complete reference. + +# Import theme first so invidual modifications can be made +include ~/.config/sway/themes/gruvbox + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +set $term GDK_BACKEND=wayland kitty +# Your preferred application launcher +set $DMENU_LINES 6 +set $menu wofi --show drun +set $userpass rofi-rbw +set $user rofi-rbw --target username +set $pass rofi-rbw --target password +set $totp rofi-rbw --target TOTP +# Your preferred screen locker (also starts BOINC to ensure all idle time is +# being used) +set $lock swaylock -f --scaling=center -i /home/joel/Pictures/wallpapers/the-northern-forest-1920×1080.jpg +# Volume commands +set $volume-up pactl set-sink-volume @DEFAULT_SINK@ +2% && killall -SIGUSR1 i3status +set $volume-down pactl set-sink-volume @DEFAULT_SINK@ -2% && killall -SIGUSR1 i3status +set $volume-mute pactl set-sink-mute @DEFAULT_SINK@ toggle && killall -SIGUSR1 i3status + +# Brightness commands +set $brightness-up brightnessctl s 1%+ +set $brightness-down brightnessctl s 1%- + +# BOINC commands +set $start_boinc boinccmd --set_run_mode auto +set $stop_boinc boinccmd --set_run_mode never + +# lazy-load Xwayland +xwayland enable + +### Output configuration +# +# Configuration for TV: +output DP-1 pos 0,0 +output HDMI-A-1 pos 1680,0 +# +# Example configuration: +# +# output VGA-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs +#output eDP-1 resolution 1366X768 position 0,0 +#output VGA-1 resolution 1680x1050 position 1366,0 + +### Input configuration +# +# Example configuration: +# +# input "2:14:SynPS/2_Synaptics_TouchPad" { +# dwt enabled +# tap enabled +# natural_scroll enabled +# middle_emulation enabled +# } +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + +# Keyboard configuration +input "16700:8197:DELL_DELL_USB_Keyboard" { + xkb_layout "us,us" + xkb_variant ",dvorak" + xkb_options "caps:swapescape, grp:shifts_toggle" +} + +input "1118:2092:Microsoft_Microsoft_Ergonomic_Keyboard" { + xkb_layout "us,us" + xkb_variant ",dvorak" + xkb_options "caps:swapescape, grp:shifts_toggle" +} + +input "1155:22288:STMicroelectronics_obins_anne_keyboard" { + xkb_layout "us,us" + xkb_variant ",dvorak" + xkb_options "caps:swapescape, grp:shifts_toggle" +} + +focus_follows_mouse no +focus_wrapping yes + +font "Ubuntu Light 8" +title_align center + +### Key bindings +# +# Basics: +# +# start a terminal +bindsym $mod+Return exec $term + +# kill focused window +bindsym $mod+u kill + +# start your launcher/dmenu +bindsym $mod+o exec $menu + +# screenshot +bindsym $mod+x exec grim -c -g "$(slurp)" /home/joel/Pictures/screenshots/$(date +'%Y-%m-%d-%H%M%S_grim.png') +bindsym $mod+Shift+x exec grim -c /home/joel/Pictures/screenshots/$(date +'%Y-%m-%d-%H%M%S_grim.png') + +# Drag floating windows by holding down $mod and left mouse button. +# Resize them with right mouse button + $mod. +# Despite the name, also works for non-floating windows. +# Change normal to inverse to use left mouse button for resizing and right +# mouse button for dragging. +floating_modifier $mod normal + +# reload the configuration file +bindsym $mod+Alt+c reload + +# +# Moving around: +# +# Move your focus around +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right +# or use $mod+[up|down|left|right] +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# Move the focused window with the same, but add Alt +bindsym $mod+Alt+$left move left +bindsym $mod+Alt+$down move down +bindsym $mod+Alt+$up move up +bindsym $mod+Alt+$right move right +# ditto, with arrow keys +bindsym $mod+Alt+Left move left +bindsym $mod+Alt+Down move down +bindsym $mod+Alt+Up move up +bindsym $mod+Alt+Right move right +# +# Workspaces: +# +# switch to workspace +bindsym $mod+1 workspace 1 +workspace 1 output DP-2 +bindsym $mod+2 workspace 2 +workspace 2 output DP-2 +bindsym $mod+3 workspace 3 +workspace 3 output DP-2 +bindsym $mod+4 workspace 4 +workspace 4 output DP-2 +bindsym $mod+5 workspace 5 +workspace 5 output HDMI-A-1 +bindsym $mod+6 workspace 6 +workspace 6 output HDMI-A-1 +bindsym $mod+7 workspace 7 +workspace 7 output HDMI-A-1 +bindsym $mod+8 workspace 8 +workspace 8 output HDMI-A-1 +bindsym $mod+9 workspace 9 +workspace 9 output HDMI-A-1 +bindsym $mod+0 workspace 10 +workspace 10 output HDMI-A-1 +bindsym $mod+i workspace back_and_forth +bindsym alt+tab workspace back_and_forth +bindsym $mod+semicolon workspace prev +bindsym $mod+apostrophe workspace next + +bindsym $mod+Control+l move workspace to output HDMI-A-1 +bindsym $mod+Control+h move workspace to output DP-2 +# move focused container to workspace +bindsym $mod+Alt+1 move container to workspace 1 +bindsym $mod+Alt+2 move container to workspace 2 +bindsym $mod+Alt+3 move container to workspace 3 +bindsym $mod+Alt+4 move container to workspace 4 +bindsym $mod+Alt+5 move container to workspace 5 +bindsym $mod+Alt+6 move container to workspace 6 +bindsym $mod+Alt+7 move container to workspace 7 +bindsym $mod+Alt+8 move container to workspace 8 +bindsym $mod+Alt+9 move container to workspace 9 +bindsym $mod+Alt+0 move container to workspace 10 +bindsym $mod+Alt+t move container to workspace prev +bindsym $mod+Alt+y move container to workspace next + +# Note: workspaces can have any name you want, not just numbers. +# We just use 1-10 as the default. +# +# Layout stuff: +# +# You can "split" the current object of your focus with +# $mod+b or $mod+v, for horizontal and vertical splits +# respectively. (This is disgusting, but the only way I can find +# to bind square brackets) +bindsym $mod+m splith +bindsym $mod+n splitv + +# Switch the current container between different layout styles +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# Make the current focus fullscreen +bindsym $mod+f fullscreen + +# Toggle the current focus between tiling and floating mode +bindsym $mod+Alt+space floating toggle + +# Swap focus between the tiling area and the floating area +bindsym $mod+space focus mode_toggle + +# move focus to the parent container +bindsym $mod+a focus parent +bindsym $mod+d focus child +# +# Scratchpad: +# +# Sway has a "scratchpad", which is a bag of holding for windows. +# You can send windows there and get them back later. + +# Move the currently focused window to the scratchpad +bindsym $mod+Alt+minus move scratchpad + +# Show the next scratchpad window or hide the focused scratchpad window. +# If there are multiple scratchpad windows, this command cycles through them. +bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { +# left will shrink the containers width +# right will grow the containers width +# up will shrink the containers height +# down will grow the containers height + bindsym $left resize shrink width 10 px or 10 ppt + bindsym $down resize grow height 10 px or 10 ppt + bindsym $up resize shrink height 10 px or 10 ppt + bindsym $right resize grow width 10 px or 10 ppt + +# ditto, with arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + +# return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +mode "(l)ock, (s)uspend, (e)xit, (r)eboot, (p)ower" { + bindsym l exec $lock, mode "default" + bindsym s exec $lock && loginctl suspend, mode "default" + bindsym e exit + bindsym r exec loginctl reboot, mode "default" + bindsym p exec loginctl poweroff, mode "default" + + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+y mode "(l)ock, (s)uspend, (e)xit, (r)eboot, (p)ower" + +mode "(a)utotype, (u)sername only, (p)assword only, (t) totp" { + bindsym a exec $userpass, mode "default" + bindsym u exec $user, mode "default" + bindsym p exec $pass, mode "default" + bindsym t exec $totp, mode "default" + + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+p mode "(a)utotype, (u)sername only, (p)assword only, (t) totp" + +bindsym $mod+shift+p exec wofi-pass --type + +### Brightness control keybindings +bindsym --locked XF86MonBrightnessUp exec --no-startup-id $brightness-up +bindsym --locked XF86MonBrightnessDown exec --no-startup-id $brightness-down + +### Volume control keybindings +bindsym --locked XF86AudioRaiseVolume exec --no-startup-id $volume-up +bindsym --locked XF86AudioLowerVolume exec --no-startup-id $volume-down +bindsym --locked XF86AudioMute exec --no-startup-id $volume-mute +# Same, for external keyboards +bindsym --locked $mod+period exec --no-startup-id $volume-up +bindsym --locked $mod+comma exec --no-startup-id $volume-down +bindsym --locked $mod+slash exec --no-startup-id $volume-mute + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + swaybar_command waybar +} + +# swayidle +exec swayidle -w \ +# timeout 300 '$start_boinc && $lock' \ +# timeout 600 'swaymsg "output * dpms off" && $start_boinc' \ +# resume 'swaymsg "output * dpms on"' \ +# before-sleep '$start_boinc && $lock' \ + +# window rules to make Steam games behave nice +#inhibit_idle fullscreen + +# NOTE: app_id, title, etc. can potentially be found using `swaymsg -t get_tree` +# window rules to deeply integrate browser with WM (aka I'm lazy and want to +# save myself a few keystrokes on opening) +exec firefox +for_window [app_id="Firefox"] move container to workspace 9 +#for_window [app_id="Firefox" tiling] move container to workspace 9; layout tabbed +#for_window [title="Beckmeyer Social.*" tiling] move container to workspace 10; layout tabbed +#for_window [title="Beckmeyer Chat.*" tiling] move container to workspace 10; layout tabbed + +for_window [app_id="pinentry*"]; floating enable + +# Stick window to output +bindsym $mod+grave sticky toggle + +### Export GTK theme to all programs running under Sway +set $gnome-schema org.gnome.desktop.interface + +exec_always { + gsettings set $gnome-schema gtk-theme 'Adwaita-dark' + gsettings set $gnome-schema icon-theme 'Adwaita' + gsettings set $gnome-schema cursor-theme 'Adwaita' +} + +### Notification Service +exec mako + +### Screen tint +exec wlsunset -l 42.2 -L -83.4 + +### for BOINC GPU computing ### +exec xhost si:localuser:boinc + +### devmon (automounting daemon) ### +exec devmon + +### pipewire (PulseAudio/ALSA/JACK replacement) ### +exec pipewire +exec pipewire-pulse + +### https://wiki.archlinux.org/title/Xsettingsd ### +exec xsettingsd + +exec variety + +exec blueman-applet + +include /etc/sway/config.d/* diff --git a/dot_config/sway/themes/gruvbox b/dot_config/sway/themes/gruvbox new file mode 100644 index 0000000..94b9fa1 --- /dev/null +++ b/dot_config/sway/themes/gruvbox @@ -0,0 +1,57 @@ +# +# Color definition +# + +set $c1 #fd472f +set $c2 #d79921 +set $c3 #99a2ea +set $c4 #333142 +set $c5 #342f73 + + +set $white #f4f4f8 +set $dark #333333 +set $dim #666666 + + +set $focused_bgcolor $c2 +set $focused_textcolor $dark +set $focused_indicator $c3 + +set $inactive_bgcolor $c5 +set $inactive_textcolor $white +set $inactive_indicator $c5 + +set $unfocused_bgcolor $c4 +set $unfocused_textcolor $dim +set $unfocused_indicator $c5 + +set $urgent_bgcolor $c1 +set $urgent_textcolor $c4 +set $urgent_indicator $c3 + +# +# Appearance: +# + +# Set inner/outer gaps +default_border normal 0 +gaps inner 0 +gaps outer 0 + +# Smart gaps (gaps used if only more than one container on the workspace) +smart_gaps on + +# Smart borders (draw borders around container only if it is not the only container on this workspace) +smart_borders on + +# Hide Title Bars +for_window [app_id="^.*"] border pixel 2, opacity 1 +default_border pixel 2 +default_floating_border pixel 5 +hide_edge_borders smart + +client.focused $focused_bgcolor $focused_bgcolor $focused_textcolor $focused_indicator $focused_bgcolor +client.focused_inactive $inactive_bgcolor $inactive_bgcolor $inactive_textcolor $inactive_indicator $inactive_bgcolor +client.unfocused $unfocused_bgcolor $unfocused_bgcolor $unfocused_textcolor $unfocused_indicator $unfocused_bgcolor +client.urgent $urgent_bgcolor $urgent_bgcolor $urgent_textcolor $urgent_indicator $urgent_bgcolor