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