Skip to content

Instantly share code, notes, and snippets.

@Mel34
Created April 21, 2019 10:40
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Mel34/ab9b6d562f9181ed8bbdc7c76022b85b to your computer and use it in GitHub Desktop.
Save Mel34/ab9b6d562f9181ed8bbdc7c76022b85b to your computer and use it in GitHub Desktop.
Sway config
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Your preferred terminal emulator
set $term konsole
# Your preferred application launcher
# Note: it's recommended that you pass the final command to sway
set $uifont "Ubuntu 14"
set $highlight #3daee9
set $prompt #18b218
set $menu bemenu-run --fn $uifont -b -p "▶" --tf "$prompt" --hf "$highlight" --sf "$highlight" --scf "$highlight" | xargs swaymsg exec
set $wallpaper ~/Pictures/DzNT32SVAAU2o1D.jpg
set $lock swaylock -f -i $wallpaper -s fill
### Needed for xdg-desktop-portal-kde
exec dbus-update-activation-environment --systemd --all
exec /usr/lib/xdg-desktop-portal --replace
exec kdeconnect-indicator
exec mako
### 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
output HDMI-A-2 resolution 2560x1080 position 0,0 background $wallpaper fill
output DVI-D-1 resolution 1920x1080 position 2560,0 background $wallpaper fill
### Idle configuration
#
# Example configuration:
#
# exec swayidle -w \
# timeout 300 'swaylock -f -c 000000' \
# timeout 600 'swaymsg "output * dpms off"' \
# resume 'swaymsg "output * dpms 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 "2385:5815:Kingston_HyperX_Alloy_FPS_Mechanical_Gaming_Keyboard" {
xkb_layout hr(us)
}
### Key bindings
#
# Basics:
#
# start a terminal
bindsym $mod+Return exec $term
# kill focused window
bindsym $mod+q kill
bindsym Mod1+F4 kill
# start your launcher
bindsym $mod+d exec $menu
#bindcode 133 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'
bindsym Control+Mod1+Backspace exec swaymsg exit
for_window [window_role="pop-up"] floating enable
for_window [window_role="bubble"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [window_role="Preferences"] floating enable
for_window [window_type="dialog"] floating enable
for_window [window_type="menu"] floating enable
for_window [window_role="About"] floating enable
for_window [class="xdg-desktop-portal-kde"] floating enable
for_window [class="ksysguard"] floating enable
for_window [class="ksysguard"] sticky enable
#for_window [app_id="mpv"] layout tabbed
for_window [class="Wine"] floating enable
for_window [app_id="lutris"] floating enable
bindsym $mod+F12 exec shutdown now
bindsym Mod4+L exec $lock
bindsym Control+Mod1+Delete exec ksysguard
bindsym $mod+F1 exec dolphin
bindsym $mod+F2 exec cantata
bindsym $mod+F3 exec mpv --player-operation-mode=pseudo-gui
bindsym $mod+F4 exec firefox
bindsym $mod+F5 exec kate
bindsym $mod+F6 exec lutris
bindsym $mod+F7 exec notify-send $(weather)
bindsym $mod+F8 exec pkill kmousetool || kmousetool
bindsym $mod+shift+F4 exec firefox --private-window
bindsym Print exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') $(xdg-user-dir)/Pictures/Screenshot_$(date +'%Y-%m-%d-%H%M%S.png')
bindsym Alt+Print exec grim $(xdg-user-dir)/Pictures/Screenshot_$(date +'%Y-%m-%d-%H%M%S.png')
bindsym Control+Print exec grim -g "$(slurp)" $(xdg-user-dir)/Pictures/Screenshot_$(date +'%Y-%m-%d-%H%M%S.png')
bindsym Shift+Print exec grim -g "$(slurp)" - | wl-copy
bindsym $mod+tab workspace back_and_forth
#
# Multimedia keys
#
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound
# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
#
# Moving around:
#
# Move your focus around 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 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+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 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 F11 fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+Shift+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+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
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 {
mode hide
hidden_state hide
modifier $mod
font $uifont
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command while date +'%-d.%-m.%Y. %H:%M:%S %p'; do sleep 1; done
colors {
statusline #ffffff
background #121212
#background #00000000
focused_workspace #121212 #18b218 #232627
active_workspace #121212 $highlight #232627
inactive_workspace #121212 #7f8c8d #232627
}
}
#
# Titlebars
#
default_border pixel
default_floating_border pixel
hide_edge_borders smart
#
# Colors #93cee9
#
# class border backgr. text indicator child_border
client.focused #4c7899 #285577 #ffffff $highlight $highlight
client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a
client.unfocused #333333 #222222 #888888 #292d2e #222222
client.urgent #2f343a #900000 #ffffff #900000 #900000
include /etc/sway/config.d/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment