dotfiles/.config/sway/config

408 lines
13 KiB
Plaintext
Raw Normal View History

2022-09-19 19:18:27 +08:00
# Default config for sway.conf
2022-01-18 09:17:36 +08:00
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
# Environment
exec --no-startup-id dbus-update-activation-environment --all
#exec --no-startup-id dbus-update-activation-environment DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec /usr/libexec/polkit-gnome-authentication-agent-1
exec_always ~/.config/scripts/sway/import-gsettings
2022-01-18 09:17:36 +08:00
### Variables
#
2022-01-20 02:50:12 +08:00
# Colors
include gruvbox
2022-01-21 10:08:34 +08:00
# Font
#set $font SourceCodePro Semibold 11px
set $font FiraCode SemiBold 11px
2022-01-18 09:17:36 +08:00
# 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
2023-06-18 22:26:22 +08:00
set $term alacritty
#set $term kitty
2022-01-18 09:17:36 +08:00
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
#
# This line is was the equivalent to the bemenu command in ~/.config/wm_scripts/menucmd
#set $menucmd bemenu -l 10 --scrollbar always --fn '$font' --tb '$base02' --tf '$green' --fb '$base03' --ff '$base0' --nb '$base03' --nf '$base0' --sb '$base02' --sf 'cyan' --hb '$base02' --hf '$cyan' --scb '$base02' --scf '$cyan'
# Default launch using swaymsg
#set $menu $menucmd | xargs swaymsg exec --
set $menucmd j4-dmenu-desktop --dmenu=menucmd
2022-01-24 05:16:59 +08:00
# Screenshot
set $screenshot "~/.config/scripts/wm/screenshot.sh"
set $screenshot_sel "~/.config/scripts/wm/screenshot.sh -s"
2022-01-21 10:08:34 +08:00
### Monitor config
#
# Monitor layout
2022-09-19 19:18:27 +08:00
xwayland force
2022-01-18 09:17:36 +08:00
2022-09-19 19:18:27 +08:00
include monitor
2022-01-18 09:17:36 +08:00
2022-02-18 11:48:06 +08:00
#output $mon1 adaptive_sync on
2022-01-18 09:17:36 +08:00
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
#output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
output * bg /home/sheldonmlee/wallpaper/wallpaper fill
#
# Example configuration:
#
# output HDMI-A-1 resolution 1920x1080 position 1920,0
#
# You can get the names of your outputs by running: swaymsg -t get_outputs
### Idle configuration
#
# Example configuration:
#
2022-01-18 09:17:36 +08:00
exec swayidle -w \
timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"; set-primary-monitor' \
timeout 310 'swaylock -f -c 000000' \
2022-01-18 09:17:36 +08:00
before-sleep 'swaylock -f -c 000000'
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
#
input 1133:50503:Logitech_USB_Receiver accel_profile flat
input 1133:16500:Logitech_G304 accel_profile flat
input 1133:16521:Logitech_K580 {
xkb_layout us
xkb_variant colemak
}
input 1204:4621:Majestouch_Convertible_2 {
xkb_layout us
xkb_variant colemak
}
2022-08-16 20:06:12 +08:00
input 1:1:AT_Translated_Set_2_keyboard {
xkb_layout "us"
xkb_variant "colemak"
xkb_options "caps:ctrl_modifier,altwin:swap_alt_win"
}
2022-09-19 17:39:21 +08:00
input 2:10:TPPS/2_Elan_TrackPoint {
accel_profile "flat"
pointer_accel 1
}
2022-01-18 09:17:36 +08:00
# 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.
### Key bindings
#
# Basics:
#
# Start a terminal
bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+w kill
# Start your launcher
bindsym $mod+space exec $menucmd
2022-01-24 05:16:59 +08:00
# Screenshot
bindsym $mod+q exec $screenshot
bindsym Print exec $screenshot_sel
2022-01-18 09:17:36 +08:00
# 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+Control+r reload
# Exit sway (logs you out of your Wayland session)
#bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
bindsym $mod+Control+q exec swaymsg exit
# Lock Sway
2022-11-19 04:06:55 +08:00
#bindsym $mod+Escape exec sh -c 'swaylock -f -c 000000; sleep 0.1; pkill -10 swayidle'
2023-04-20 03:28:59 +08:00
bindsym $mod+Escape exec lockscreen
2022-01-18 09:17:36 +08:00
#
# 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 Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow 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
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+a workspace number 1:a
bindsym $mod+r workspace number 2:r
bindsym $mod+s workspace number 3:s
bindsym $mod+t workspace number 4:t
bindsym $mod+z workspace number 5:z
bindsym $mod+x workspace number 6:x
bindsym $mod+c workspace number 7:c
bindsym $mod+v workspace number 8:v
2022-11-19 04:06:55 +08:00
# Trash workspace
bindsym $mod+Mod1+1 workspace left
bindsym $mod+Mod1+2 workspace right
# Trash workspace
bindsym $mod+Mod1+a workspace trash
2022-01-18 09:17:36 +08:00
# Move focused container to workspace
bindsym $mod+Shift+a move container to workspace number 1:a
bindsym $mod+Shift+r move container to workspace number 2:r
bindsym $mod+Shift+s move container to workspace number 3:s
bindsym $mod+Shift+t move container to workspace number 4:t
bindsym $mod+Shift+z move container to workspace number 5:z
bindsym $mod+Shift+x move container to workspace number 6:x
bindsym $mod+Shift+c move container to workspace number 7:c
bindsym $mod+Shift+v move container to workspace number 8:v
# Note: workspaces can have any name you want, not just numbers.
2022-01-18 09:17:36 +08:00
# We just use 1-10 as the default.
2022-11-19 04:06:55 +08:00
# Bind workspaces to monitor
2022-01-18 09:17:36 +08:00
workspace 1:a output $mon1
workspace 2:r output $mon1
workspace 3:s output $mon1
workspace 4:t output $mon1
2022-11-19 04:06:55 +08:00
workspace 5:z output $mon1
workspace 6:x output $mon1
workspace 7:c output $mon1
workspace 8:v output $mon1
2022-11-19 04:06:55 +08:00
workspace left output $mon2
workspace right output $mon3
2022-01-18 09:17:36 +08:00
#
# Monitors:
#
bindsym $mod+comma focus output left
bindsym $mod+period focus output right
2022-11-19 04:06:55 +08:00
bindsym $mod+Shift+comma move container to output left
bindsym $mod+Shift+period move container to output right
2022-01-18 09:17:36 +08:00
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+d splith
bindsym $mod+b splitv
# Switch the current container between different layout styles
bindsym $mod+u layout stacking
bindsym $mod+y layout tabbed
bindsym $mod+n layout toggle split
2022-11-19 04:06:55 +08:00
bindsym $mod+Shift+n split toggle
2022-01-18 09:17:36 +08:00
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Control+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+m focus mode_toggle
# Move focus to the parent container
bindsym $mod+p focus parent
2022-11-19 04:06:55 +08:00
bindsym $mod+Shift+p focus child
2022-01-18 09:17:36 +08:00
#
# 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+Shift+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
#
2022-10-09 06:27:34 +08:00
# Audio:
#
bindsym $mod+Tab exec toggle-mic-notify
2022-10-09 06:27:34 +08:00
bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
2023-09-07 00:50:28 +08:00
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
#
2022-01-18 09:17:36 +08:00
# Resizing containers:
#
set $def_mode mode "default"
2022-01-18 09:17:36 +08:00
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 200px
bindsym $down resize grow height 200px
bindsym $up resize shrink height 200px
bindsym $right resize grow width 200px
2022-01-18 09:17:36 +08:00
# Ditto, with arrow keys
bindsym Left resize shrink width 200px
bindsym Down resize grow height 200px
bindsym Up resize shrink height 200px
bindsym Right resize grow width 200px
2022-01-18 09:17:36 +08:00
# Return to default mode
bindsym Return $def_mode
bindsym Escape $def_mode
2022-01-18 09:17:36 +08:00
}
2022-03-24 22:28:53 +08:00
bindsym $mod+Shift+Return mode "resize"
2022-01-18 09:17:36 +08:00
mode "gaming" {
bindsym $mod+g $def_mode
2022-01-18 09:17:36 +08:00
}
bindsym $mod+g mode "gaming"
mode "mode" {
bindsym s sticky toggle; mode "default"
bindsym Return $def_mode
bindsym Escape $def_mode
}
bindsym $mod+e mode "mode"
2022-01-18 09:17:36 +08:00
#
2022-11-19 04:06:55 +08:00
# Status ar:
2022-01-18 09:17:36 +08:00
#
# Read `man 5 sway-bar` for more information about this section.
2022-01-21 10:08:34 +08:00
font pango:$font
2022-01-20 02:50:12 +08:00
titlebar_padding 3
2022-01-18 09:17:36 +08:00
bar {
2023-06-05 08:29:47 +08:00
position bottom
2022-01-18 09:17:36 +08:00
#gaps 20 900
2023-06-05 08:29:47 +08:00
mode hide
output $mon1
2022-01-18 09:17:36 +08:00
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command slstatus -s
colors {
background $base03t
2022-01-20 02:50:12 +08:00
statusline $base0
separator $base0
focused_workspace $orange $base02 $cyan
active_workspace $base02 $base03t $base0
inactive_workspace $base02 $base03t $base0
urgent_workspace $cyan $red $base03t
2022-01-18 09:17:36 +08:00
}
2022-01-21 10:08:34 +08:00
font pango:$font
#tray_output primary
2022-01-18 09:17:36 +08:00
}
2022-01-20 02:50:12 +08:00
#
# Window Colors and aesthetics:
2022-01-20 02:50:12 +08:00
#
client.focused $base01 $base0 $base03 $blue $orange
2022-01-20 02:50:12 +08:00
client.focused_inactive $base0 $base02 $base0 $blue $base0
client.unfocused $base01 $base03 $base01 $blue $base01
client.urgent $base03 $red $base0 $red $red
client.placeholder #000000 $base01 $base0 #000000 $base01
client.background $base03
2022-01-18 09:17:36 +08:00
bindsym $mod+Control+h gaps horizontal current plus 200
bindsym $mod+Control+l gaps horizontal current minus 200
2022-11-19 04:06:55 +08:00
bindsym $mod+Shift+f gaps horizontal current toggle 400
2022-01-18 09:17:36 +08:00
smart_gaps inverse_outer
2023-06-18 22:26:22 +08:00
#gaps inner 2
2022-11-19 04:06:55 +08:00
2022-01-18 09:17:36 +08:00
default_border pixel 3
2023-06-18 22:26:22 +08:00
#smart_borders on
2022-01-18 09:17:36 +08:00
#
# Startup programs:
#
exec gentoo-pipewire-launcher restart
2022-01-18 09:17:36 +08:00
exec dunst
exec wlsunset -l 55.0 -L -1.6
2022-01-18 09:17:36 +08:00
2023-06-18 22:26:22 +08:00
exec $term
exec swaymsg "workspace 2:r; exec thunderbird"
exec swaymsg "workspace 2:r; exec firefox"
exec element-desktop
2023-09-07 00:50:28 +08:00
exec webcord
exec signal-desktop
exec swaymsg "workspace 1:a"
#
# Application rules:
#
2022-06-19 13:08:25 +08:00
# Xwayland applications tend to use 'class=<class>', whereas wayland applications use 'appid=<appid>'
#assign [app_id="firefox"] workspace 2:r
#assign [class="firefox"] workspace 2:r
assign [app_id="Discord Firefox"] workspace 3:s
for_window [title="^Discord — Mozilla Firefox$"] fullscreen disable
assign [class="WebCord"] workspace 3:s
assign [class="Signal"] workspace 3:s
assign [class="Element"] workspace 3:s
2022-11-19 04:06:55 +08:00
for_window [title="^WhatsApp — Mozilla Firefox$"] move container to workspace 3:s;
assign [class="steam"] workspace 4:t
2022-11-19 04:06:55 +08:00
# Inhibit idle if fullscreen
for_window [app_id="^.*"] inhibit_idle fullscreen
for_window [class="^.*"] inhibit_idle fullscreen
# Inhibit idle on focus
for_window [class="WebCord"] inhibit_idle focus
for_window [app_id="org.jellyfin.jellyfinmediaplayer"] inhibit_idle focus
# Floating windows
2023-06-05 08:29:47 +08:00
for_window [title="^Firefox — Sharing Indicator$"] floating enable, move position 50ppt 0px, move container to workspace trash;
for_window [app_id="firefox" title="^Picture-in-Picture$"] floating enable, sticky enable
for_window [class="^steam$"] floating enable
for_window [class="^steam$" title="^Steam$"] floating disable
for_window [class="genshinimact.exe"] floating enable
for_window [class=".*.exe$"] floating enable
for_window [class="^QjackCtl$"] floating enable
for_window [class="^QjackCtl$" title="Graph — QjackCtl"] floating disable
for_window [app_id="^app.drey.Dialect$"] floating enable
for_window [app_id="^io.crow_translate.CrowTranslate$"] floating enable
# Move windows to trash workspace
for_window [title="^Origin$"] floating enable, move container to workspace trash;
for_window [title="^Wine System Tray$"] move container to workspace trash;
2022-01-18 09:17:36 +08:00
2023-06-18 22:26:22 +08:00
for_window [app_id="^com.example.MyApplication$"] floating enable
2022-01-18 09:17:36 +08:00
include /etc/sway/config.d/*