dotfiles/sway/config
Freyja Wildes 2cb57b147a [sway] Add comments to describe shortcuts with symbols
- Keyboard shortcuts are declared using bindkey and not redeable. Add
  some comment to describe them with symbols off the corresponding key
  code on a QWERTY key map
2025-06-01 14:45:25 +02:00

263 lines
8.1 KiB
Text

# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
# Keyboard shortcuts are defined using key codes. Comments describe the shortcut using symbol corresponding to the keycode on a QWERTY keymap.
### Variables
# mod is Logo/Windows/Super key
set $mod Mod4
# Home row direction keys, like vim
set $left 43
set $down 44
set $up 45
set $right 46
# Your preferred terminal emulator
set $term footclient
# Your preferred application launcher
set $menu fuzzel
# Set numbers of layout workspace
set $ws-work-num 1
set $ws-web-num 2
set $ws-com-num 3
set $ws-tools-num 4
set $ws-media-num 5
# Set names of layout workspace
set $ws-work work
set $ws-web web
set $ws-com com
set $ws-tools tools
set $ws-media media
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg $HOME/Pictures/backgrounds/Desktop/power_et_miaouche.jpg fill
output eDP-1
### Idle configuration
exec swayidle -C "$HOME/.config/swayidle/config"
#######################
# Input configuration #
input type:keyboard {
xkb_layout us,fr
xkb_variant ,ergol
xkb_options grp:win_space_toggle
}
################
# Key bindings #
#
# Basics:
#
# Start a terminal
# mod+Enter
bindcode $mod+36 exec $term
# Invoke bemoji short. Options: simulate typing (t), copy to clipboard (c) and no newline (n)
bindcode $mod+Shift+31 exec BEMOJI_PICKER_CMD="fuzzel -d -p 🔍" bemoji -t -c -n
# Kill focused window
# mod+Shift+q
bindcode $mod+Shift+24 kill
# Start your launcher mod+d
bindcode $mod+40 exec $menu
# 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
# Lock screen (mod+Shift+f), f like fuck-off
bindcode $mod+Shift+41 exec swaylock
# Reload the mod+Shift+c configuration file
bindcode $mod+Shift+54 reload
# Exit sway (logs you out of your Wayland session)
# mod+Shift+e
bindcode $mod+Shift+26 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'
#
# Moving around:
#
# Move your focus around
bindcode $mod+$left focus left
bindcode $mod+$down focus down
bindcode $mod+$up focus up
bindcode $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
bindcode $mod+Shift+$left move left
bindcode $mod+Shift+$down move down
bindcode $mod+Shift+$up move up
bindcode $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+$ws-work-num workspace $ws-work-num:$ws-work
bindsym $mod+$ws-web-num workspace $ws-web-num:$ws-web
bindsym $mod+$ws-com-num workspace $ws-com-num:$ws-com
bindsym $mod+$ws-tools-num workspace $ws-tools-num:$ws-tools
bindsym $mod+$ws-media-num workspace $ws-media-num:$ws-media
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+$ws-work-num move container to workspace $ws-work-num:$ws-work
bindsym $mod+Shift+$ws-web-num move container to workspace $ws-web-num:$ws-web
bindsym $mod+Shift+$ws-com-num move container to workspace $ws-com-num:$ws-com
bindsym $mod+Shift+$ws-tools-num move container to workspace $ws-tools-num:$ws-tools
bindsym $mod+Shift+$ws-media-num move container to workspace $ws-media-num:$ws-media
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# 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.
bindsym $mod+h splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+k layout stacking
bindsym $mod+b layout tabbed
bindsym $mod+i layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#
# 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
#
# 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
bindcode $left resize shrink width 10px
bindcode $down resize grow height 10px
bindcode $up resize shrink height 10px
bindcode $right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+z mode "resize"
#
# Utilities:
#
# Special keys to adjust volume via PulseAudio
bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
# Special keys to adjust brightness via brightnessctl
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 2%-
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 2%+
# Special key to take a screenshot with grim
bindsym Print exec grim -t jpeg -q 95 "$HOME/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).jpeg"
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar swaybar_command waybar
include /etc/sway/config.d/*
#########################
# Start-up applications #
exec nm-applet
exec blueman-applet
exec swaync
exec --no-startup-id foot --server
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
#####################
# Making the layout #
workspace $ws-media-num:$ws-media
assign [app_id="org.strawberrymusicplayer.strawberry"] workspace $ws-media-num:$ws-media
assign [class="steam"] workspace $ws-media-num:$ws-media
workspace $ws-tools-num:$ws-tools
assign [app_id="thunar"] workspace $ws-tools-num:$ws-tools
workspace $ws-tools-num:$ws-tools
assign [app_id="thunar"] workspace $ws-tools-num:$ws-tools
assign [instance="keepassxc"] workspace $ws-tools-num:$ws-tools
exec keepassxc
assign [app_id="libreoffice"] workspace $ws-tools-num:$ws-tools
workspace $ws-com-num:$ws-com
default_orientation vertical
assign [app_id="org.gajim.Gajim"] workspace $ws-com-num:$ws-com
assign [instance="mumble"] workspace $ws-com-num:$ws-com
exec footclient -e weechat
workspace $ws-web-num:$ws-web
workspace_layout tabbed
assign [app_id="firefox"] workspace $ws-web-num:$ws-web
assign [app_id="thunderbird"] workspace $ws-web-num:$ws-web
assign [class="Tor Browser"] workspace $ws-web-num:$ws-web
exec firefox
exec thunderbird
workspace $ws-work-num:$ws-work
default_orientation vertical
exec footclient