arnaucube
arnaucube/configsPublic Self-hosted repository
configs/sway/config
sway/configRaw
  1# Sway config file, placed at ~/.config/sway/config
  2#
  3# Read `man 5 sway` for a complete reference.
  4
  5### Variables
  6#
  7# Logo key. Use Mod1 for Alt.
  8set $mod Mod4
  9# Home row direction keys, like vim
 10set $left h
 11set $down j
 12set $up k
 13set $right l
 14# Your preferred terminal emulator
 15set $term alacritty
 16# Your preferred application launcher
 17set $menu wmenu-run
 18
 19### Output configuration
 20#
 21# Default wallpaper (more resolutions are available in /run/current-system/sw/share/backgrounds/sway/)
 22# output * bg /run/current-system/sw/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
 23output * bg ~/Sync-tablet/wallpapers/geometry02_croped1920x1080.png fill
 24#
 25# Example configuration:
 26#
 27#   output HDMI-A-1 resolution 1920x1080 position 1920,0
 28#
 29# You can get the names of your outputs by running: swaymsg -t get_outputs
 30
 31# home setup:
 32output HDMI-A-1 resolution 3840x2160 position 1920 0
 33# output eDP-1 resolution 1920x1200 position 0 0 transform 90
 34output DSI-1 resolution 1920x1200 position 0 0 transform 90
 35
 36# portable external monitor setup:
 37# output DP-1 resolution 3840x2160 position 1920 0
 38# output eDP-1 resolution 1920x1200 position 0 0
 39# output DP-1 {
 40#     transform 270
 41# }
 42
 43### Idle configuration
 44#
 45# Example configuration:
 46#
 47# exec swayidle -w \
 48#          timeout 300 'swaylock -f -c 000000' \
 49#          timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
 50#          before-sleep 'swaylock -f -c 000000'
 51#
 52# This will lock your screen after 300 seconds of inactivity, then turn off
 53# your displays after another 300 seconds, and turn your screens back on when
 54# resumed. It will also lock your screen before your computer goes to sleep.
 55
 56# lock screen
 57bindsym $mod+Control+l exec swaylock -i ~/Sync/wallpapers/geometry02_croped1920x1080_pixelized.png -c 000000
 58
 59bindsym $mod+Control+d exec poweroff
 60
 61### Input configuration
 62#
 63# Example configuration:
 64#
 65#   input "2:14:SynPS/2_Synaptics_TouchPad" {
 66#       dwt enabled
 67#       tap enabled
 68#       natural_scroll enabled
 69#       middle_emulation enabled
 70#   }
 71#
 72# You can get the names of your inputs by running: swaymsg -t get_inputs
 73# Read `man 5 sway-input` for more information about this section.
 74
 75### Key bindings
 76#
 77# Basics:
 78#
 79    # Start a terminal
 80    bindsym $mod+Return exec $term
 81
 82    # Kill focused window
 83    bindsym $mod+Shift+q kill
 84
 85    # Start your launcher
 86    bindsym $mod+d exec $menu
 87
 88    # Drag floating windows by holding down $mod and left mouse button.
 89    # Resize them with right mouse button + $mod.
 90    # Despite the name, also works for non-floating windows.
 91    # Change normal to inverse to use left mouse button for resizing and right
 92    # mouse button for dragging.
 93    floating_modifier $mod normal
 94
 95    # Reload the configuration file
 96    bindsym $mod+Shift+c reload
 97
 98    # Exit sway (logs you out of your Wayland session)
 99    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'
100#
101# Moving around:
102#
103    # Move your focus around
104    bindsym $mod+$left focus left
105    bindsym $mod+$down focus down
106    bindsym $mod+$up focus up
107    bindsym $mod+$right focus right
108    # Or use $mod+[up|down|left|right]
109    bindsym $mod+Left focus left
110    bindsym $mod+Down focus down
111    bindsym $mod+Up focus up
112    bindsym $mod+Right focus right
113
114    # Move the focused window with the same, but add Shift
115    bindsym $mod+Shift+$left move left
116    bindsym $mod+Shift+$down move down
117    bindsym $mod+Shift+$up move up
118    bindsym $mod+Shift+$right move right
119    # Ditto, with arrow keys
120    bindsym $mod+Shift+Left move left
121    bindsym $mod+Shift+Down move down
122    bindsym $mod+Shift+Up move up
123    bindsym $mod+Shift+Right move right
124#
125# Workspaces:
126#
127    # Switch to workspace
128    bindsym $mod+1 workspace number 1
129    bindsym $mod+2 workspace number 2
130    bindsym $mod+3 workspace number 3
131    bindsym $mod+4 workspace number 4
132    bindsym $mod+5 workspace number 5
133    bindsym $mod+6 workspace number 6
134    bindsym $mod+7 workspace number 7
135    bindsym $mod+8 workspace number 8
136    bindsym $mod+9 workspace number 9
137    bindsym $mod+0 workspace number 10
138    # Move focused container to workspace
139    bindsym $mod+Shift+1 move container to workspace number 1
140    bindsym $mod+Shift+2 move container to workspace number 2
141    bindsym $mod+Shift+3 move container to workspace number 3
142    bindsym $mod+Shift+4 move container to workspace number 4
143    bindsym $mod+Shift+5 move container to workspace number 5
144    bindsym $mod+Shift+6 move container to workspace number 6
145    bindsym $mod+Shift+7 move container to workspace number 7
146    bindsym $mod+Shift+8 move container to workspace number 8
147    bindsym $mod+Shift+9 move container to workspace number 9
148    bindsym $mod+Shift+0 move container to workspace number 10
149    # Note: workspaces can have any name you want, not just numbers.
150    # We just use 1-10 as the default.
151#
152# Layout stuff:
153#
154    # You can "split" the current object of your focus with
155    # $mod+b or $mod+v, for horizontal and vertical splits
156    # respectively.
157    bindsym $mod+b splith
158    bindsym $mod+v splitv
159
160    # Switch the current container between different layout styles
161    bindsym $mod+s layout stacking
162    bindsym $mod+w layout tabbed
163    bindsym $mod+e layout toggle split
164
165    # Make the current focus fullscreen
166    bindsym $mod+f fullscreen
167
168    # Toggle the current focus between tiling and floating mode
169    bindsym $mod+Shift+space floating toggle
170
171    # Swap focus between the tiling area and the floating area
172    bindsym $mod+space focus mode_toggle
173
174    # Move focus to the parent container
175    bindsym $mod+a focus parent
176#
177# Scratchpad:
178#
179    # Sway has a "scratchpad", which is a bag of holding for windows.
180    # You can send windows there and get them back later.
181
182    # Move the currently focused window to the scratchpad
183    bindsym $mod+Shift+minus move scratchpad
184
185    # Show the next scratchpad window or hide the focused scratchpad window.
186    # If there are multiple scratchpad windows, this command cycles through them.
187    bindsym $mod+minus scratchpad show
188#
189# Resizing containers:
190#
191mode "resize" {
192    # left will shrink the containers width
193    # right will grow the containers width
194    # up will shrink the containers height
195    # down will grow the containers height
196    bindsym $left resize shrink width 10px
197    bindsym $down resize grow height 10px
198    bindsym $up resize shrink height 10px
199    bindsym $right resize grow width 10px
200
201    # Ditto, with arrow keys
202    bindsym Left resize shrink width 10px
203    bindsym Down resize grow height 10px
204    bindsym Up resize shrink height 10px
205    bindsym Right resize grow width 10px
206
207    # Return to default mode
208    bindsym Return mode "default"
209    bindsym Escape mode "default"
210}
211bindsym $mod+r mode "resize"
212#
213# Utilities:
214#
215    # Special keys to adjust volume via PulseAudio
216    bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
217    bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
218    bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
219    bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
220    # Special keys to adjust brightness via brightnessctl
221    bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
222    bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
223    # Special key to take a screenshot with grim
224    bindsym Print exec grim
225
226#
227# Status Bar:
228#
229# Read `man 5 sway-bar` for more information about this section.
230bar {
231    position bottom
232    status_command while ~/.config/sway/status.sh; do sleep 1; done
233
234    # When the status_command prints a new line to stdout, swaybar updates.
235    # The default just shows the current date and time.
236    # status_command while date +'%Y-%m-%d %X'; do sleep 1; done
237
238    colors {
239        statusline #ffffff
240        background #000000
241        inactive_workspace #32323200 #32323200 #5c5c5c
242    }
243}
244
245default_border pixel 1
246
247# shortcut to switch regular/bold font in alacritty configuration
248bindsym $mod+Control+b exec sed -i 's/\"Regular\"#tag_for_shortcut/\"Bold\"#tag_for_shortcut/g' ~/.config/alacritty/alacritty.toml
249bindsym $mod+Control+Shift+b exec sed -i 's/\"Bold\"#tag_for_shortcut/\"Regular\"#tag_for_shortcut/g' ~/.config/alacritty/alacritty.toml
250
251# move current workspace to another display
252bindsym $mod+Control+k move workspace to output HDMI-A-1
253bindsym $mod+Control+j move workspace to output eDP-1
254# bindsym $mod+Control+j move workspace to output DP-1
255# bindsym $mod+Control+k move workspace to output eDP-1
256# bindsym $mod+Control+k move workspace to output DP-1
257
258# remap capslock to control
259input * {
260    xkb_options ctrl:nocaps
261}
262
263# for screen sharing
264exec systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
265exec dbus-update-activation-environment WAYLAND_DISPLAY
266# systemctl --user daemon-reexec
267# systemctl --user restart pipewire
268# systemctl --user restart xdg-desktop-portal
269# systemctl --user restart xdg-desktop-portal-wlr
270
271include /etc/sway/config.d/*