split up sway.conf

This commit is contained in:
lelgenio 2020-12-01 16:10:22 -03:00
parent 109a6a774f
commit 7a139163ae
11 changed files with 531 additions and 394 deletions

View File

@ -152,8 +152,8 @@ dotfiles: # {{{
actions:
- vimplug
sway:
src: sway.conf
dst: ~/.config/sway/config
src: sway
dst: ~/.config/sway
actions:
- reload_sway
fish:

View File

@ -1,392 +0,0 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
# Variables {{{
#
# Logo key.
set $mod Mod4
# Home row direction keys, like vim
set $left {{@@ key.left @@}}
set $down {{@@ key.down @@}}
set $up {{@@ key.up @@}}
set $right {{@@ key.right @@}}
set $menu s
set $mus r
set $term terminal
# set $menu wofi --show drun --allow-images --insensitive --term $term -p'Iniciar: '
# set $menu bmenu run $term
font {{@@ font.interface @@}} {{@@ font.size.medium @@}}px
#{%@@ if color.type == 'dark' @@%}#
set $wallPath ~/.local/share/wallpapers/assembly.png
#{%@@ else @@%}#
set $wallPath ~/.local/share/wallpapers/austria.jpg
#{%@@ endif @@%}#
# }}}
# Output configuration {{{
#
# output * bg '#252525' solid_color
output * bg $wallPath fill
# Output HDMI-A-1 resolution 1280x720
# Disable laptop screen if closed, --reload is important
# set $laptop eDP-1
# bindswitch --reload lid:on output $laptop disable
# bindswitch --reload lid:off output $laptop enable
# output $laptop disable
# bindsym $mod+o output eDP-1 toggle
# exec_always swaymsg -t get_outputs | grep HDMI || swaymsg 'output eDP-1 enable'
# Backlight settings for laptops
exec light -N 1
bindsym XF86MonBrightnessUp exec light -A 5
bindsym XF86MonBrightnessDown exec light -U 5
# }}}
# Input configuration {{{
#hide the mouse after 10 seconds
seat * hide_cursor 10000
seat * xcursor_theme {{@@ cursor_theme @@}} {{@@ cursor_size @@}}
input "type:touchpad" {
#disable while typing
dwt disabled
natural_scroll enabled
tap enabled
}
input * {
# {%@@ if key_layout == "colemak" @@%}
#
xkb_layout "us(colemak),br"
xkb_options "lv3:lsgt_switch,grp:shifts_toggle"
# {%@@ elif key_layout == "dvorak" @@%}
#
xkb_layout us(dvorak)
# {%@@ endif @@%}
xkb_options caps:backspace
xkb_numlock enabled
}
# }}}
# Key bindings: {{{
# mouse button for dragging.
floating_modifier $mod normal
bindsym {
# Basic {{{
# Start a terminal
$mod+Return exec $term
#start web browser
$mod+b exec qutebrowser
#start file manager
$mod+Control+Return exec {{@@ file_manager @@}}
$mod+g exec emoji
# Kill focused window
$mod+x kill
# Start your launcher
$mod+$menu exec launcher
# Fill passwords
$mod+p exec wpass
# Reload the configuration file
$mod+Shift+c reload
# Lock Sway
--locked $mod+Control+z exec loginctl suspend || systemctl suspend
# Exit sway (logs you out of your Wayland session)
$mod+Shift+q exec swaynag -t warning -m 'Do you really want to exit sway?' -b 'Yes, exit sway' 'swaymsg exit'
Control+Alt+delete exit
# }}}
# Moving around: {{{
# Move your focus around
#{%@@ for d in "up,down,left,right".split(',') @@%}#
$mod+${{@@ d @@}} focus {{@@ d @@}}
$mod+{{@@ d.capitalize() @@}} focus {{@@ d @@}}
$mod+Shift+${{@@ d @@}} move {{@@ d @@}}
#{%@@ endfor @@%}#
# Resizing containers:
$mod+Control+$left resize shrink width 20px
$mod+Control+$down resize grow height 20px
$mod+Control+$up resize shrink height 20px
$mod+Control+$right resize grow width 20px
#}}}
# Workspaces: {{{
# Mouse prev/next button
--whole-window $mod+button8 workspace next_on_output
--whole-window $mod+button9 workspace prev_on_output
$mod+{{@@ key.tabL @@}} workspace prev_on_output
$mod+{{@@ key.tabR @@}} workspace next_on_output
$mod+Shift+{{@@ key.tabL @@}} move workspace prev_on_output
$mod+Shift+{{@@ key.tabR @@}} move workspace next_on_output
# Switch to workspace
# Move focused container to workspace
#{%@@ for i in range(1,11) @@%}#
$mod+{{@@ i % 10 @@}} workspace {{@@ i @@}}
$mod+Shift+{{@@ i % 10 @@}} move container to workspace {{@@ i @@}}
#{%@@ endfor @@%}#
# }}}
# Layout stuff: {{{
#
# Splits
# bindsym $mod+b splith
$mod+v splitv
# Layout styles
$mod+t layout tabbed
$mod+r layout toggle split
# Make the current focus fullscreen
$mod+f fullscreen
# Floating
$mod+Shift+space floating toggle
$mod+space focus mode_toggle
# Move focus to the parent container
$mod+a focus parent
$mod+z focus child
# }}}
# Screenshots: {{{
# Screens to file
Print exec screenshotsh def
# Screen area to file
Shift+Print exec screenshotsh area
# Screen area to clipboard
Control+Shift+Print exec screenshotsh area-clip
# Focused monitor to clipboard
Control+Print exec screenshotsh clip
# Screen recorder
Control+Alt+Shift+r exec wf-recorder -a
# Mirror selection as window
$mod+Alt+r exec sssway
# Color picker
$mod+c exec color-picker
# show keys being pressed
$mod+k exec showkeys
# }}}
# Audio: {{{
# Volume controll
# script in dotfiles
--locked XF86AudioRaiseVolume exec volumesh -i 10
--locked XF86AudioLowerVolume exec volumesh -d 10
--locked XF86AudioMute exec volumesh -t
# Media player controls
--locked XF86AudioPlay exec mpc toggle
--locked XF86AudioNext exec mpc next
--locked XF86AudioPrev exec mpc prev
# }}}
# Special Keys{{{
XF86Calculator exec $term ipython
XF86Mail exec $term neomutt
XF86Explorer exec {{@@ file_manager @@}}
XF86HomePage exec xdg-open http://start.duckduckgo.com
# }}}
}
# Modes {{{
set $dexec mode default;exec
# Music {{{
bindsym $mod+m mode Music
mode Music bindsym {
m exec volumesh -t
{{@@ key.tabL @@}} exec volumesh -d 10
{{@@ key.tabR @@}} exec volumesh -i 10
{{@@ key.right @@}} exec mpc next
{{@@ key.left @@}} exec mpc prev
{{@@ key.up @@}} exec volumesh --mpd -i 10
{{@@ key.down @@}} exec volumesh --mpd -d 10
space $dexec mpc toggle
p $dexec mpc toggle
d $dexec musmenu delete
f $dexec musmenu search
a $dexec dzadd
s $dexec pulse-sink
escape mode default
q mode default
}
# }}}
mode Passthrough {
bindsym $mod+escape mode default
}
bindsym $mod+escape mode Passthrough
# }}}
# }}}
# Visual: {{{
#
set $accent {{@@ accent_color @@}}
set $fg_color {{@@ color.txt @@}}
set $bg_color {{@@ color.bg_dark @@}}
set $alert #000000
# border background text indicator child_border
client.focused $accent $accent $fg_color $accent $accent
client.focused_inactive $bg_color $bg_color $fg_color $bg_color $bg_color
client.unfocused $bg_color $bg_color $fg_color $bg_color $bg_color
client.urgent $alert $alert $fg_color $alert $alert
{%@@ if bar == "waybar" @@%}
# Wake up pulseaudio
exec pactl set-sink-volume @DEFAULT_SINK@ +0%
bar swaybar_command waybar
{%@@ else @@%}
# I rarely use this
bar {
position {{@@ bar_pos @@}}
# status_command i3blocks
# gaps 5px
icon_theme {{@@ icon_theme @@}}
font {{@@ font.interface @@}} 14px
colors {
statusline $fg_color
background $bg_color
focused_workspace $accent $bg_color $fg_color
}
}
{%@@ endif @@%}
default_border pixel 2px
default_floating_border normal 2px
gaps inner 5px
smart_gaps on
smart_borders on
# for_window [app_id=mpv] floating enable
for_window [app_id=weather] fullscreen
# for_window [app_id=weather] resize set 635px 700px
# for_window [app_id=weather] resize set 1500px 750px
# set theme
set $gnome-schema org.gnome.desktop.interface
exec_always {
kvantummanager --set '{{@@ kvantum_theme @@}}'
gsettings set $gnome-schema gtk-theme '{{@@ gtk_theme @@}}'
gsettings set $gnome-schema icon-theme '{{@@ icon_theme @@}}'
gsettings set $gnome-schema cursor-theme '{{@@ cursor_theme @@}}'
}
# }}}
# Assigns {{{
for_window [app_id=pavucontrol] floating enable
assign [app_id=qutebrowser] workspace 2
assign [class=qutebrowser] workspace 2
assign [class=Steam] workspace 9
assign [app_id=telegram.?desktop] workspace 10
assign [class=TelegramDesktop] workspace 10
assign [class=discord] workspace 10
#}}}
# Daemons {{{
#
# start dbusd just in case
exec 'dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus'
#Notification Daemon
exec_always pidof mako || mako
# Block device Mounter to /run/media/<username>
exec udiskie
# gesture daemon
exec fusuma
# exec sh -c 'pkill fusuma; fusuma'
# Blue light filter
exec_always pidof redshift || redshift
# kde connect
exec /usr/lib/kdeconnectd
exec kdeconnect-indicator
# Telegram
exec telegram-desktop-bin || telegram-desktop
# Music Player Daemon
exec pidof mpd || mpd
exec pgrep -f mpDris2|| mpDris2
# Prevent the screen from locking if fullscreen
for_window [title=.*] inhibit_idle fullscreen
# Lock configuration
set $lock swaylock -f \
--image $wallPath \
--font '{{@@ font.interface @@}}' \
set $screenReload \
pkill kanshi; \
kanshi & disown\
# Idle daemon
exec_always pkill swayidle && false || \
exec swayidle -w \
before-sleep '$lock' \
after-resume '$screenReload' \
timeout 360 '$lock' \
resume '$screenReload' \
timeout 1800 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on";$screenReload' \
# Screen manager
exec_always $screenReload
include /etc/sway/config.d/
#}}}
# vim:filetype=sh:foldmethod=marker

33
dotfiles/sway/assigns Normal file
View File

@ -0,0 +1,33 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
###############################################################
# Assigns
###############################################################
for_window [app_id=pavucontrol] floating enable
for_window [app_id=weather] fullscreen
###############################################################
# Workspaces
###############################################################
assign [app_id=qutebrowser] workspace 2
assign [class=qutebrowser] workspace 2
assign [class=Steam] workspace 9
assign [title=^steam] workspace 9
assign [app_id=telegram.?desktop] workspace 10
assign [class=TelegramDesktop] workspace 10
assign [class=discord] workspace 10
# vim: ft=sh

54
dotfiles/sway/config Normal file
View File

@ -0,0 +1,54 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
###############################################################
# Variables
###############################################################
# Logo key.
set $mod Mod4
# mouse button for dragging.
floating_modifier $mod normal
# Home row direction keys, like vim
set $left {{@@ key.left @@}}
set $down {{@@ key.down @@}}
set $up {{@@ key.up @@}}
set $right {{@@ key.right @@}}
set $menu s
set $mus r
set $wallPath\
{%@@ if color.type == 'dark' @@%}
~/.local/share/wallpapers/assembly.png
{%@@ else @@%}
~/.local/share/wallpapers/austria.jpg
{%@@ endif @@%}
###############################################################
# Includes
###############################################################
include input
include visual
include keys-window
include keys-run
include keys-special
include modes
include assigns
include daemons
include /etc/sway/config.d/
# vim:ft=sh

81
dotfiles/sway/daemons Normal file
View File

@ -0,0 +1,81 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
###############################################################
# User Programs
###############################################################
# kde connect
exec /usr/lib/kdeconnectd
exec kdeconnect-indicator
# Telegram
exec telegram-desktop-bin || telegram-desktop
# Music Player Daemon
exec pidof mpd || mpd
exec pgrep -f mpDris2|| mpDris2
###############################################################
# Screen locking
###############################################################
# Lock configuration
set $lock \
pkill caffeinated;\
swaylock -f \
--image $wallPath \
--font '{{@@ font.interface @@}}' \
set $screenReload \
pkill kanshi; \
kanshi & disown\
###############################################################
# System Daemons
###############################################################
# start dbusd just in case
exec 'dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus'
#Notification Daemon
exec_always pidof mako || mako
# Block device Mounter to /run/media/<username>
exec udiskie
# gesture daemon
exec fusuma
# Blue light filter
exec_always pidof redshift || redshift
# Screen manager
exec_always $screenReload
# Set minimum brightness to 1 instead of 0
# not exactly a daemon
exec light -N 1
###############################################################
# Idle
###############################################################
# Prevent the screen from locking if fullscreen
for_window [title=.*] inhibit_idle fullscreen
# Idle daemon
exec_always pkill swayidle && false || \
exec swayidle -w \
before-sleep '$lock' \
after-resume '$screenReload' \
timeout 360 '$lock' \
resume '$screenReload' \
timeout 1800 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on";$screenReload' \
# vim: ft=sh

29
dotfiles/sway/input Normal file
View File

@ -0,0 +1,29 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
# Hide the mouse after 10 seconds
seat * hide_cursor 10000
input "type:touchpad" {
# Disable While Typing
dwt disabled
natural_scroll enabled
tap enabled
}
input * {
{%@@ if key_layout == "colemak" @@%}
xkb_layout "us(colemak),br"
xkb_options "lv3:lsgt_switch,grp:shifts_toggle"
{%@@ elif key_layout == "dvorak" @@%}
xkb_layout "us(dvorak)"
{%@@ endif @@%}
xkb_options caps:backspace
xkb_numlock enabled
}
# vim: ft=sh

42
dotfiles/sway/keys-run Normal file
View File

@ -0,0 +1,42 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
bindsym {
# Start a terminal
$mod+Return exec terminal
#start web browser
$mod+b exec qutebrowser
#start file manager
$mod+Control+Return exec {{@@ file_manager @@}}
# Insert special characters
$mod+g exec emoji
# Kill focused window
$mod+x kill
# Start your launcher
$mod+$menu exec launcher
# Fill passwords
$mod+p exec wpass
# Reload the configuration file
$mod+Shift+c reload
# Lock Sway and suspend
--locked $mod+Control+z exec loginctl suspend || systemctl suspend
# Exit sway
Control+Alt+delete exit
}
# vim: ft=sh

View File

@ -0,0 +1,73 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
bindsym {
###############################################################
# Screenshots
###############################################################
# Screens to file
Print exec screenshotsh def
# Screen area to file
Shift+Print exec screenshotsh area
# Screen area to clipboard
Control+Shift+Print exec screenshotsh area-clip
# Focused monitor to clipboard
Control+Print exec screenshotsh clip
# Screen recorder
Control+Alt+Shift+r exec wf-recorder -a
# Mirror selection as window
$mod+Alt+r exec sssway
# Color picker
$mod+c exec color-picker
# show keys being pressed
$mod+k exec showkeys
###############################################################
# Audio
###############################################################
# Volume controll, script in dotfiles
--locked XF86AudioRaiseVolume exec volumesh -i 10
--locked XF86AudioLowerVolume exec volumesh -d 10
--locked XF86AudioMute exec volumesh -t
# Media player controls
--locked XF86AudioPlay exec mpc toggle
--locked XF86AudioNext exec mpc next
--locked XF86AudioPrev exec mpc prev
###############################################################
# Backlight settings for laptops
###############################################################
XF86MonBrightnessUp exec light -A 5
XF86MonBrightnessDown exec light -U 5
###############################################################
# Special Keys
###############################################################
XF86Calculator exec terminal ipython
XF86Mail exec terminal neomutt
XF86Explorer exec {{@@ file_manager @@}}
XF86HomePage exec xdg-open http://start.duckduckgo.com
}
# vim: ft=sh

79
dotfiles/sway/keys-window Normal file
View File

@ -0,0 +1,79 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
bindsym {
###############################################################
# Moving around
###############################################################
# Move your focus around
{%@@ for dir in "up,down,left,right".split(',') @@%}
{%@@ set DIR = dir.capitalize() @@%}
$mod+${{@@ dir @@}} focus {{@@ dir @@}}
$mod+{{@@ DIR @@}} focus {{@@ dir @@}}
$mod+Shift+${{@@ dir @@}} move {{@@ dir @@}}
{%@@ endfor @@%}
# Resizing containers:
$mod+Control+$left resize shrink width 20px
$mod+Control+$down resize grow height 20px
$mod+Control+$up resize shrink height 20px
$mod+Control+$right resize grow width 20px
###############################################################
# Workspaces
###############################################################
# Switch to workspace
# Move focused container to workspace
{%@@ for i in range(1,11) @@%}
$mod+{{@@ i%10 @@}} workspace {{@@ i @@}}
$mod+Shift+{{@@ i%10 @@}} move container workspace {{@@ i @@}}
{%@@ endfor @@%}
# go/move to Workspaces
# button8,9 = Mouse next/prev button
{%@@ for targ, buttons in {
"prev_on_output": [ key.tabL, "bracketleft", "button9", ],
"next_on_output": [ key.tabR, "bracketright", "button8", ],
}.items() @@%}
{%@@ for button in buttons @@%}
{%@@ set pref = ("--whole-window " if "button" in button) @@%}
{{@@ pref @@}}$mod+{{@@ button @@}} workspace {{@@ targ @@}}
{{@@ pref @@}}$mod+Shift+{{@@ button @@}} move workspace {{@@ targ @@}}
{%@@ endfor @@%}
{%@@ endfor @@%}
###############################################################
# Layout
###############################################################
# Splits
$mod+v splitv
# No splith since we can just mod+r
# Layout styles
$mod+t layout tabbed
$mod+r layout toggle split
# Make the current focus fullscreen
$mod+f fullscreen
# Floating
$mod+Shift+space floating toggle
$mod+space focus mode_toggle
# Move focus to the parent container
$mod+a focus parent
$mod+z focus child
}
# vim: ft=sh

48
dotfiles/sway/modes Normal file
View File

@ -0,0 +1,48 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
set $dexec mode default;exec
###############################################################
# Music
###############################################################
bindsym $mod+m mode Music
mode Music bindsym {
m exec volumesh -t
{{@@ key.tabL @@}} exec volumesh -d 10
{{@@ key.tabR @@}} exec volumesh -i 10
{{@@ key.right @@}} exec mpc next
{{@@ key.left @@}} exec mpc prev
{{@@ key.up @@}} exec volumesh --mpd -i 10
{{@@ key.down @@}} exec volumesh --mpd -d 10
space $dexec mpc toggle
p $dexec mpc toggle
d $dexec musmenu delete
f $dexec musmenu search
a $dexec dzadd
s $dexec pulse-sink
escape mode default
q mode default
}
###############################################################
# Passthrough
###############################################################
mode Passthrough {
bindsym $mod+escape mode default
}
bindsym $mod+escape mode Passthrough
# vim: ft=sh

90
dotfiles/sway/visual Normal file
View File

@ -0,0 +1,90 @@
# {{@@ header() @@}}
# _____ ____ _ _ _
# / __\ \ /\ / / _` | | | |
# \__ \\ V V / (_| | |_| |
# |___/ \_/\_/ \__,_|\__, |
# |___/
###############################################################
# Variables
###############################################################
set $accent {{@@ accent_color @@}}
set $fg_color {{@@ color.txt @@}}
set $bg_color {{@@ color.bg_dark @@}}
set $alert #000000
font {{@@ font.interface @@}} {{@@ font.size.medium @@}}px
output * bg $wallPath fill
###############################################################
# window decoration, aka border
###############################################################
default_border pixel 2px
default_floating_border normal 2px
# border background text indicator child_border
client.focused $accent $accent $fg_color $accent $accent
client.focused_inactive $bg_color $bg_color $fg_color $bg_color $bg_color
client.unfocused $bg_color $bg_color $fg_color $bg_color $bg_color
client.urgent $alert $alert $fg_color $alert $alert
###############################################################
# Bar configuration
###############################################################
{%@@ if bar == "waybar" @@%}
# Wake up pulseaudio
exec pactl set-sink-volume @DEFAULT_SINK@ +0%
bar swaybar_command waybar
{%@@ else @@%}
# I rarely use this
bar {
position {{@@ bar_pos @@}}
# status_command i3blocks
# gaps 5px
icon_theme {{@@ icon_theme @@}}
font {{@@ font.interface @@}} {{@@ font.size.medium @@}}px
colors {
statusline $fg_color
background $bg_color
focused_workspace $accent $bg_color $fg_color
}
}
{%@@ endif @@%}
###############################################################
# Gaps
###############################################################
smart_gaps on
smart_borders on
gaps inner 5px
###############################################################
# Themes
###############################################################
set $gnome-schema org.gnome.desktop.interface
exec_always {
# In case of errors, kvantummanager opens a window
# this is retarded
timeout 1s kvantummanager --set '{{@@ kvantum_theme @@}}'
gsettings set $gnome-schema gtk-theme '{{@@ gtk_theme @@}}'
gsettings set $gnome-schema icon-theme '{{@@ icon_theme @@}}'
gsettings set $gnome-schema cursor-theme '{{@@ cursor_theme @@}}'
}
seat * xcursor_theme "{{@@ cursor_theme @@}}" "{{@@ cursor_size @@}}"
# vim: ft=sh