config_sway/config

336 lines
10 KiB
Text
Raw Normal View History

2020-12-18 14:28:23 +01:00
# Default config for sway
2020-12-18 20:02:50 +01:00
# vim: ft=i3
2020-12-18 14:28:23 +01:00
#
# Read `man 5 sway` for a complete reference.
2020-12-19 13:08:55 +01:00
#
2020-12-18 14:28:23 +01:00
### 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
2021-04-27 15:47:22 +02:00
set $term foot
2021-05-02 13:34:11 +02:00
set $term_cmd foot -T float
2020-12-18 15:26:02 +01:00
set $background $HOME/Cloud/xkonni/Pictures/wallpaper/5k_bavarian_forest_bw.jpg
2021-01-04 18:46:33 +01:00
set $lock_cmd $HOME/.config/sway/bin/sway_lock
2021-01-19 17:23:18 +01:00
set $brightness_cmd $HOME/.config/sway/bin/sway_brightness
set $output_cmd $HOME/.config/sway/bin/sway_output
set $suspend_cmd $HOME/.config/sway/bin/sway_suspend
set $volume_cmd $HOME/.config/sway/bin/sway_volume
set $move_cmd $HOME/.config/sway/bin/sway_move
set $font Cascadia Code PL Regular 10
2020-12-18 15:33:47 +01:00
2020-12-18 14:28:23 +01:00
# Your preferred application launcher
set $menu wofi --show drun --prompt applications
2021-03-04 20:41:00 +01:00
set $search_cmd $HOME/.config/sway/bin/sway_search
set $exit_cmd $HOME/.config/sway/bin/sway_exit
2021-02-25 07:57:43 +01:00
#
# Host Specific
#
include $HOME/.config/sway/hosts.d/$(hostname).conf
#
# General Options
#
focus_wrapping no
# nextcloud workaround
mouse_warping container
# floating_maximum_size 1600 x 900
font pango:$font
hide_edge_borders --i3 smart
smart_gaps on
default_border pixel 4
#
# Gaps
#
gaps inner 5
gaps outer 0
gaps left 0
gaps right 0
2020-12-18 14:28:23 +01:00
### Output configuration
2020-12-18 15:26:02 +01:00
output * bg $background fill
2020-12-18 14:28:23 +01:00
# 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
2021-01-03 19:51:23 +01:00
# 10 min screen off
# 15 min lock
# 30 min suspend on battery
# 120 min suspend
2020-12-18 15:33:47 +01:00
exec swayidle -w \
2021-10-23 22:05:21 +02:00
timeout 1800 '$lock_cmd off' \
2020-12-22 13:19:58 +01:00
resume '$lock_cmd on' \
2021-10-23 22:05:21 +02:00
timeout 2700 '$lock_cmd lockonly' \
timeout 3600 '$suspend_cmd suspend' \
2021-01-03 19:51:23 +01:00
timeout 7200 '$suspend_cmd force' \
2021-01-03 12:17:33 +01:00
before-sleep '$lock_cmd lock'
2020-12-22 13:19:58 +01:00
bindsym $mod+Ctrl+Escape exec '$lock_cmd lock'
2020-12-18 14:28:23 +01:00
### Input configuration
# 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.
2020-12-18 15:53:19 +01:00
input type:keyboard {
xkb_layout "eu"
}
2020-12-18 14:28:23 +01:00
### Key bindings
#
# Basics:
#
2020-12-18 15:53:19 +01:00
# Start a terminal
bindsym $mod+Return exec $term
2020-12-18 14:28:23 +01:00
2020-12-18 15:53:19 +01:00
# Kill focused window
bindsym $mod+Shift+q kill
bindsym --release button3 kill
2020-12-18 14:28:23 +01:00
2020-12-18 15:53:19 +01:00
# Start your launcher
bindsym $mod+r exec $menu
2021-03-04 20:41:00 +01:00
bindsym $mod+Shift+r exec $search_cmd
2020-12-18 14:28:23 +01:00
2020-12-18 15:53:19 +01: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
2020-12-18 14:28:23 +01:00
# Show exit menu
bindsym $mod+Shift+e exec $exit_cmd
2020-12-18 14:28:23 +01:00
# Moving around:
#
2020-12-18 15:53:19 +01:00
# Move your focus around
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
# Move the focused workspace to another monitor
bindsym $mod+o move workspace to output right
bindsym $mod+Shift+o move workspace to output left
#
# Resize
#
bindsym $mod+Ctrl+$left resize shrink width 50px
bindsym $mod+Ctrl+$down resize grow height 50px
bindsym $mod+Ctrl+$up resize shrink height 50px
bindsym $mod+Ctrl+$right resize grow width 50px
2020-12-18 14:28:23 +01:00
#
# Workspaces:
#
2020-12-18 15:53:19 +01:00
# Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
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
bindsym $mod+Escape workspace back_and_forth
2020-12-18 15:53:19 +01:00
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
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.
2020-12-18 14:28:23 +01:00
#
# Urgent
#
bindsym $mod+u [urgent=latest] focus
#
2020-12-18 14:28:23 +01:00
# Layout stuff:
#
2020-12-18 15:53:19 +01:00
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
2020-12-18 14:28:23 +01:00
2020-12-18 15:53:19 +01:00
# Switch the current container between different layout styles
bindsym $mod+q layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
2020-12-18 14:28:23 +01:00
2020-12-18 15:53:19 +01:00
# Make the current focus fullscreen
bindsym $mod+f fullscreen
2020-12-18 14:28:23 +01:00
2020-12-18 15:53:19 +01:00
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Toggle border/titlebar
bindsym $mod+Shift+b border toggle
2020-12-18 14:28:23 +01:00
2020-12-18 15:53:19 +01:00
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
2020-12-18 14:28:23 +01:00
2020-12-18 15:53:19 +01:00
# Move focus to the parent container
2021-08-12 11:23:50 +02:00
bindsym $mod+i focus parent
2021-05-13 23:50:00 +02:00
# Move focus to the child
2021-08-12 11:23:50 +02:00
bindsym $mod+Shift+i focus child
2020-12-18 20:02:50 +01:00
#
2020-12-19 13:09:22 +01:00
## Volume
#
bindsym XF86AudioRaiseVolume exec $volume_cmd increase
bindsym XF86AudioLowerVolume exec $volume_cmd decrease
bindsym XF86AudioMute exec $volume_cmd mute
2021-01-03 13:18:37 +01:00
bindsym XF86MonBrightnessUp exec $brightness_cmd increase
bindsym XF86MonBrightnessDown exec $brightness_cmd decrease
2020-12-19 13:09:22 +01:00
#
#
2020-12-18 20:02:50 +01:00
## Screenshot
#
# copy selection to clipboard
bindsym Print exec grim -g "$(slurp)" - | wl-copy
2021-02-18 16:25:02 +01:00
# copy selection to swappy
bindsym Shift+Print exec grim -g "$(slurp)" - | swappy -f -
2020-12-18 20:02:50 +01:00
# save selection
bindsym $mod+Print exec grim -g "$(slurp)" \
$(xdg-user-dir PICTURES)/screenshot_$(date +'%Y%m%d_%H%M%S').png
#
## Output
#
2021-05-02 13:34:11 +02:00
bindsym $mod+p exec "$term_cmd $output_cmd"
2020-12-18 15:30:29 +01:00
#
# Gaps
#
2020-12-18 15:53:19 +01:00
gaps inner 5
gaps outer 0
gaps left 0
gaps right 0
2020-12-18 15:30:29 +01:00
2020-12-18 14:28:23 +01:00
#
# Scratchpad:
#
2020-12-18 15:53:19 +01:00
# Move the currently focused window to the scratchpad
2021-08-12 11:23:50 +02:00
bindsym $mod+Shift+a mark a; move scratchpad
2020-12-23 11:24:22 +01:00
bindsym $mod+Shift+s mark s; move scratchpad
2021-08-12 11:23:50 +02:00
bindsym $mod+Shift+d mark d; move scratchpad
2022-02-11 10:35:48 +01:00
bindsym $mod+Shift+z mark z; floating enable; resize set width 1250; resize set height 800; move scratchpad
bindsym $mod+Shift+x mark x; floating enable; resize set width 1250; resize set height 800; move scratchpad
bindsym $mod+Shift+c mark c; floating enable; resize set width 1250; resize set height 800; move scratchpad
2021-08-12 11:23:50 +02:00
# bindsym $mod+s [con_mark="^(?!(c|d)$)"] scratchpad show
bindsym $mod+Ctrl+s scratchpad show
bindsym $mod+a [con_mark="a"] scratchpad show
2020-12-23 11:24:22 +01:00
bindsym $mod+s [con_mark="s"] scratchpad show
2021-08-12 11:23:50 +02:00
bindsym $mod+d [con_mark="d"] scratchpad show
2020-12-23 11:24:22 +01:00
bindsym $mod+z [con_mark="z"] scratchpad show
bindsym $mod+x [con_mark="x"] scratchpad show
bindsym $mod+c [con_mark="c"] scratchpad show
2020-12-18 14:28:23 +01:00
#
# Notifications
#
bindsym $mod+comma exec dunstctl close
bindsym $mod+Shift+comma exec dunstctl close-all
bindsym $mod+period exec dunstctl history-pop
2021-02-03 09:47:54 +01:00
bindsym $mod+Shift+period exec dunstctl set-paused toggle
#
# Modes
#
2020-12-23 11:24:22 +01:00
mode "move" {
bindsym $left move left 25px
bindsym $down move down 25px
bindsym $up move up 25px
bindsym $right move right 25px
# move more
bindsym Shift+$left move left 100px
bindsym Shift+$down move down 100px
bindsym Shift+$up move up 100px
bindsym Shift+$right move right 100px
# edges
bindsym q exec $move_cmd top-left
bindsym w exec $move_cmd top-center
bindsym e exec $move_cmd top-right
bindsym a exec $move_cmd center-left
bindsym s exec $move_cmd center-center
bindsym d exec $move_cmd center-right
bindsym z exec $move_cmd bottom-left
bindsym x exec $move_cmd bottom-center
bindsym c exec $move_cmd bottom-right
# resize presets
bindsym 1 resize set width 700; resize set height 390
bindsym 2 resize set width 800; resize set height 450
bindsym 3 resize set width 900; resize set height 510
bindsym 4 resize set width 1000; resize set height 560
bindsym 5 resize set width 1100; resize set height 620
bindsym 6 resize set width 1200; resize set height 680
bindsym 7 resize set width 1300; resize set height 730
bindsym 8 resize set width 1400; resize set height 790
bindsym 9 resize set width 1500; resize set height 840
bindsym 0 resize set width 1600; resize set height 900
# focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
2020-12-23 11:24:22 +01:00
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+m mode "move"
2020-12-19 02:08:41 +01:00
#
# Window Rules:
#
for_window [title="nmtui"] floating enable
2021-04-29 10:38:50 +02:00
for_window [app_id="nm-connection-editor"] floating enable
for_window [title="float*"] floating enable
for_window [app_id="pavucontrol"] floating enable
for_window [app_id="com.nextcloud.desktopclient.nextcloud"] floating enable
2021-03-21 12:12:24 +01:00
for_window [app_id="imv"] floating enable
for_window [app_id="nm-openconnect-auth-dialog"] floating enable
for_window [app_id=".*"] title_format '<span font_weight="bold">%title</span> <span>(%app_id)</span>'
for_window [class=".*"] title_format '<span font_weight="bold">%title</span> <span>(%class:%instance)</span>'
2021-04-29 10:38:50 +02:00
# different dashes!
for_window [app_id="firefox" title="Firefox — Sharing Indicator"] floating enable
2021-04-29 10:38:50 +02:00
for_window [app_id="firefox" title="Firefox - Sharing Indicator"] floating enable
for_window [app_id="firefox" title="Picture-in-Picture"] floating enable
for_window [title="bluetoothctl"] floating enable
2021-02-25 07:57:43 +01:00
for_window [title="fzf"] floating enable
2021-03-01 11:03:38 +01:00
# scratchpad rules
2021-03-19 21:36:38 +01:00
for_window [class="Plexamp" window_type="normal"] exec sh -c "sleep 1"; mark s; floating enable; resize set width 1200; resize set height 700; move scratchpad
2022-02-11 10:35:48 +01:00
for_window [class="Ferdi" window_type="normal"] exec sh -c "sleep 1"; mark z; floating enable; resize set width 1250; resize set height 800; move scratchpad
for_window [class="Signal" window_type="normal"] exec sh -c "sleep 1"; mark x; floating enable; resize set width 1250; resize set height 800; move scratchpad
for_window [class="Microsoft Teams - Preview" window_type="normal"] exec sh -c "sleep 1"; mark c; floating enable; resize set width 1250; resize set height 800; move scratchpad
2021-07-07 10:34:40 +02:00
# matlab workaround
no_focus [class="MATLAB R2021a" instance="sun-awt-X11-XDialogPeer"]
2020-12-19 02:08:41 +01:00
2020-12-18 14:28:23 +01:00
#
# Status Bar:
#
exec_always $HOME/.config/sway/bin/start_waybar.sh
#
# Autostart
#
exec --no-startup-id nextcloud --background
2021-02-01 12:07:41 +01:00
exec --no-startup-id dunst
2021-05-07 11:41:52 +02:00
exec --no-startup-id nm-applet --indicator
2020-12-18 14:28:23 +01:00
include /etc/sway/config.d/*