dotfiles/symlinks/config/sway/config

285 lines
9.0 KiB
Plaintext
Raw Normal View History

2021-01-07 08:09:41 +00:00
# Read `man 5 sway` for a complete reference.
# Set mod key to Meta/Windows
set $mod Mod4
set $alt Mod1
set $term alacritty
set $menu "wofi -G -modi drun,run --show drun"
set $filemanager $term -e ranger
set $processviewer $term -e htop
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg ~/.config/wallpapers/gruvbox-dark/gruvbox-gadgets.png fill
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:Cantarell 12px
# start a terminal
bindsym $mod+t exec $term
# start todoist
bindsym $mod+$alt+t exec todoist
# kill focused window
bindsym $mod+q kill
# start menu (program launcher)
bindsym $mod+space exec $menu
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
# start file explorer
bindsym $mod+Shift+period exec $filemanager
# start process viewer
bindsym $mod+p exec $processviewer
# Open configration menu
bindsym $mod+Shift+comma exec ~/bin/settings-selector
# Change focus with arrow keys
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move around windows 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
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# toggle tiling / floating
bindsym $mod+Shift+backslash floating toggle
# change focus between tiling / floating windows
bindsym $mod+backslash focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# Screenshot tools
set $screenshot_name $(date +"%m-%d-%Y_%T").png
set $screenshot_dir ~/Pictures/Screenshots
set $screenshot grim
set $screenclip slurp | grim -g -
set $windowshot grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') -g -
set $screenshot_to_file $screenshot $screenshot_dir/$screenshot_name
set $screenclip_to_file $screenclip $screenshot_dir/$screenshot_name
set $windowshot_to_file $windowshot $screenshot_dir/$screenshot_name
set $screenshot_clipboard $screenshot - | wl-copy
set $screenclip_clipboard $screenclip - | wl-copy
set $windowshot_clipboard $windowshot - | wl-copy
bindsym $mod+Control+3 exec $screeshot_to_file
bindsym $mod+Control+4 exec $screenclip_to_file
bindsym $mod+Control+5 exec $windowshot_to_file
# Selection screenshots
bindsym $mod+Control+Shift+3 exec $screenshot_clipboard
bindsym $mod+Control+Shift+4 exec $screenclip_clipboard
bindsym $mod+Control+Shift+5 exec $windowshot_clipboard
# Default workspaces definitions
set $terminal_workspace "1:"
set $editor_workspace "2:"
set $browser_workspace "3:"
set $chat_workspace "6:"
set $ongoing_operations "9:"
set $ide_workspace "4:"
set $workspace7 "7:Custom"
set $note_workspace "8:"
set $git_workspace "5:"
set $music_workspace "10:"
# switch to workspace
bindsym $mod+1 workspace $terminal_workspace
bindsym $mod+2 workspace $editor_workspace
bindsym $mod+3 workspace $browser_workspace
bindsym $mod+6 workspace $chat_workspace
bindsym $mod+9 workspace $ongoing_operations
bindsym $mod+4 workspace $ide_workspace
bindsym $mod+7 workspace $workspace7
bindsym $mod+8 workspace $note_workspace
bindsym $mod+5 workspace $git_workspace
bindsym $mod+0 workspace $music_workspace
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $terminal_workspace
bindsym $mod+Shift+2 move container to workspace $editor_workspace
bindsym $mod+Shift+3 move container to workspace $browser_workspace
bindsym $mod+Shift+6 move container to workspace $chat_workspace
bindsym $mod+Shift+9 move container to workspace $ongoing_operations
bindsym $mod+Shift+4 move container to workspace $ide_workspace
bindsym $mod+Shift+7 move container to workspace $workspace7
bindsym $mod+Shift+8 move container to workspace $note_workspace
bindsym $mod+Shift+5 move container to workspace $git_workspace
bindsym $mod+Shift+0 move container to workspace $music_workspace
# Alt+Tab like switching of workspaces
bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev
# Make the currently focused window a scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the first scratchpad window
bindsym $mod+minus scratchpad show
bindsym $mod+s layout toggle tabbed split
# resize window (you can also use the mouse for that)
mode "resize" {
# resize with arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# press p to enter precise resize mode
bindsym p mode "resize_precise"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "resize_precise" {
# resize with arrow keys
bindsym Left resize shrink width 1 px or 1 ppt
bindsym Down resize grow height 1 px or 1 ppt
bindsym Up resize shrink height 1 px or 1 ppt
bindsym Right resize grow width 1 px or 1 ppt
# go back to normal resize mode with p
bindsym p mode "resize"
# back to normal with Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
# enter resize mode with r
bindsym $mod+r mode "resize"
# Define locker script
set $wallpaper ~/.config/lock-wallpapers/oscar-wallpaper.jpg
set $locker swaylock -f -i $wallpaper -s fill
bindsym $mod+L exec --no-startup-id $locker
# IDLE CONFIG
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'
# Setup text for system mode
set $mode_system "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"
# System mode - system menu
mode $mode_system {
bindsym l exec --no-startup-id $locker, mode "default"
bindsym e exec --no-startup-id swaymsg 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"
}
# Use mod+F4 to open up system menu
bindsym $mod+F4 mode $mode_system
input type:keyboard {
xkb_layout us,bs
xkb_options grp:alt_space_toggle,ctrl:nocaps
repeat_delay 400
repeat_rate 25
}
input type:pointer {
accel_profile flat
}
# Set up gaps
gaps inner 10
gaps outer 5
smart_gaps on
default_border none
# Assign windows to workspaces
assign [app_id="firefox"] $browser_workspace
assign [class="Spotify"] $music_workspace
assign [class="Hexchat"] $chat_workspace
assign [class="Slack"] $chat_workspace
assign [class="Gvim"] $editor_workspace
assign [class="jetbrains-idea-ce"] $ide_workspace
assign [class="libreoffice"] $note_workspace
assign [class="jetbrains-studio"] $ide_workspace
assign [class="jetbrains-rider"] $ide_workspace
assign [class="octave-gui"] $ide_workspace
assign [instance="vim"] $editor_workspace
assign [instance="download"] $ongoing_operations
# Floating exceptions
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
# Remove titles from windows
# Set up colors of windows
client.focused #98971a #98971a #ebdbb2 #98971a
client.focused_inactive #282828 #282828 #a89984 #d3869b
client.unfocused #282828 #282828 #8ec07c #586e75
client.urgent #d33682 #d33682 #ebdbb2 #dc322f
bar {
swaybar_command waybar
}
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec brightnessctl set +5%
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Start up notification manager
exec --no-startup-id mako
exec kdeconnect-indicator
exec spotify
exec slack
# Taken from https://github.com/robertjk/dotfiles/blob/master/.config/sway/key-bindings
bindsym $alt+space exec "pkill --signal SIGRTMIN+1 waybar"
bindsym --release control+space exec makoctl dismiss
bindsym --release control+space+period exec makoctl dismiss --all
bindsym --release control+space+o exec makoctl menu wofi -d
include /etc/sway/config.d/*