config: sway QoL

This commit is contained in:
Felipe M 2020-12-29 12:09:35 +01:00
parent 7818a89560
commit 214b74dbde
4 changed files with 107 additions and 23 deletions

View File

@ -166,29 +166,6 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Keybinds:
#
bindsym alt+shift+4 exec ~/.dotfiles/bin/screenshot.sh
#
# Gaps:
#
gaps inner 8
smart_gaps on
#
# Notifications:
#
bindsym ctrl+space exec makoctl dismiss
bindsym ctrl+shift+space exec makoctl dismiss --all
#
# Window decorations:
#
default_border pixel 2
#
# Scratchpad:
#

View File

@ -0,0 +1,12 @@
#
# Gaps:
#
gaps inner 8
smart_gaps on
#
# Window decorations:
#
default_border pixel 2
hide_edge_borders smart

View File

@ -0,0 +1,41 @@
set $locker ~/.dotfiles/bin/lock.sh
# Notifications:
bindsym ctrl+space exec makoctl dismiss
bindsym ctrl+shift+space exec makoctl dismiss --all
# Screenshot
bindsym alt+shift+4 exec ~/.dotfiles/bin/screenshot.sh
# Multimedia Keys
# Requires: playerctl
bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+
bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 5%-
bindsym XF86AudioMute exec amixer sset Master toggle
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Screen brightness
bindsym XF86MonBrightnessUp exec brightnessctl set +5%
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
# Lock
bindsym $mod+l exec $locker
# Sticky windows
bindsym $mod+j sticky toggle
# System menu
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
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"
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+F12 mode "$mode_system"

54
.dotfiles/bin/lock.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
# vi: ts=4
# Lockscreen script that will capture a screenshot, pixelate and add an overlay (all optional).
# If no toggle is enabled, the overlay image for the final image is used instead. $overlayPath with
# a black backgrond color.
# Optional features require the `imagemagick` package.
# Constants
lockscreenDir=$(mktemp -d)
lockscreenPath=$lockscreenDir/lock.png
# Config
screenshotBin=grim
lockscreenBin=swaylock
overlayPath=~/.dotfiles/lock_overlay.png
font=Terminus
extraArguments=
# Toggles
screenshot=false
pixelate=false
overlay=false
cd $lockscreenDir
# Take screenshot
if $screenshot; then
$screenshotBin $lockscreenPath
else
cp $HOME/.wallpaper $lockscreenPath
fi
# Pixelate
if $pixelate; then
convert $lockscreenPath -scale 10% -scale 1000% $lockscreenPath
fi
# Overlay
if $overlay; then
convert "$lockscreenPath" "$overlayPath" -gravity center -composite "$lockscreenPath"
fi
if ! $screenshot && ! $pixelate && ! $overlay; then
lockscreenPath=$overlayPath
extraArguments="$extraArguments --scaling=center --color=#000001ff"
fi
# Lock screen
$lockscreenBin \
-n \
--image $lockscreenPath \
--font=$font \
$extraArguments