feat(sway): add sway config

This commit is contained in:
Bruno Carlin 2024-04-20 17:24:57 +02:00
parent 667b3b0f32
commit 68343d86df
Signed by: bcarlin
GPG key ID: 8E254EA0FFEB9B6D

312
sway/.config/sway/config Normal file
View file

@ -0,0 +1,312 @@
### 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 kitty
# 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.
set $menu wofi --show drun,run
### 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
#
# 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:
#
# exec swayidle -w \
# timeout 300 'swaylock -f -c 000000' \
# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
# 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
# }
#
# 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.
input type:keyboard {
xkb_layout "fr"
xkb_variant "latin9"
xkb_options "terminate:ctrl_alt_bksp,caps:escape"
}
input type:touchpad {
dwt enabled
drag_lock enabledwt enabled
tap enabled
middle_emulation enabled
}
### Key bindings
#
# Basics:
#
# Start a terminal
bindsym $mod+Return exec $term
#bindsym Mod4+Return exec st
#bindsym Mod4+Shift+Return exec kitty
# Kill focused window
bindsym $mod+Shift+q kill
# Start your launcher
bindsym $mod+d 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
# Reload the configuration file
bindsym $mod+Shift+c 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'
#
# 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+ampersand workspace 1
bindsym $mod+eacute workspace 2
bindsym $mod+quotedbl workspace 3
bindsym $mod+apostrophe workspace 4
bindsym $mod+parenleft workspace 5
bindsym $mod+minus workspace 6
bindsym $mod+egrave workspace 7
bindsym $mod+underscore workspace 8
bindsym $mod+ccedilla workspace 9
bindsym $mod+agrave workspace 10
# Move focused container to workspace
bindsym $mod+Shift+ampersand move container to workspace 1
bindsym $mod+Shift+eacute move container to workspace 2
bindsym $mod+Shift+quotedbl move container to workspace 3
bindsym $mod+Shift+apostrophe move container to workspace 4
bindsym $mod+Shift+parenleft move container to workspace 5
bindsym $mod+Shift+minus move container to workspace 6
bindsym $mod+Shift+egrave move container to workspace 7
bindsym $mod+Shift+underscore move container to workspace 8
bindsym $mod+Shift+ccedilla move container to workspace 9
bindsym $mod+Shift+agrave move container to workspace 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+b splith
bindsym $mod+v 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+Shift+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
#
# 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+p 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+p 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 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $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+r mode "resize"
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
position bottom
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command i3status
colors {
statusline #ffffff
background #000000
inactive_workspace #32323200 #32323200 #5c5c5c
}
}
include /etc/sway/config.d/*
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:Source Code Pro, Font Awesome 5 Free 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
#toggle between split h and v
bindsym Mod4+t split toggle
# focus the child container
#bindsym Mod4+d focus child
bindsym Mod4+c focus child
bindsym Mod4+Tab workspace next
bindsym Mod4+Shift+Tab workspace prev
bindsym Mod4+z workspace back_and_forth
# move focused container to workspace
bindsym Mod4+Mod1+Left move workspace to output left
bindsym Mod4+Mod1+Right move workspace to output right
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod4+Shift+r restart
## Media keys
# volume control
bindsym XF86AudioLowerVolume exec /usr/bin/pactl set-sink-volume @DEFAULT_SINK@ '-5%'
bindsym XF86AudioRaiseVolume exec /usr/bin/pactl set-sink-volume @DEFAULT_SINK@ '+5%'
bindsym XF86AudioMute exec /usr/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle
#bindsym Shift+Escape exec pactl list sources short | cut -f1 | xargs -I{} pactl set-source-mute {} 0
#bindsym --release Shift+Escape exec pactl list sources short | cut -f1 | xargs -I{} pactl set-source-mute {} 1
# Playback control
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Backlight level control
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
# Screenshots
#bindsym --release Print exec --no-startup-id scrot -e 'mv $f ~/Images/screenshots/'
#bindsym --release Shift+Print exec --no-startup-id scrot -s -e 'mv $f ~/Images/screenshots/'
## Locker and reboot
set $Locker swaylock -i /home/bca/Images/waarp_wallpaper_x3.png && sleep 1
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (S) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id $Locker, mode "default"
bindsym e exec --no-startup-id sway-msg exit, mode "default"
bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default"
bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default"
bindsym r exec --no-startup-id systemctl reboot, mode "default"
bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod4+Escape mode "$mode_system"
## Workspaces
workspace_auto_back_and_forth yes
## Commands for specific windows
for_window [class="^kitty$" instance="^meta$"] move scratchpad, scratchpad show
## Programs at launch
#exec --no-startup-id nextcloud
for_window [shell="xwayland"] title_format "%title [xwayland]"