From 0840364f0792b9d3fc11e0a0f7df1cf5dce0fabe Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Mon, 26 Apr 2021 12:01:23 +0200 Subject: [PATCH] Fix swaylock config --- tree/.config/sway/config | 30 +++++++++++++----------- tree/.config/sway/swaylock.config | 39 +++++++++++++++++++++++++++++++ tree/.local/bin/swaylock-cool | 29 +++++++++++++++++++++++ 3 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 tree/.config/sway/swaylock.config create mode 100755 tree/.local/bin/swaylock-cool diff --git a/tree/.config/sway/config b/tree/.config/sway/config index 860e516..d6e10fa 100644 --- a/tree/.config/sway/config +++ b/tree/.config/sway/config @@ -26,7 +26,6 @@ xwayland enable ### 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 output * bg ~/.config/sway/background.png fill # Window decoration @@ -53,9 +52,9 @@ exec mako # Example configuration: # exec swayidle -w \ - timeout 300 'swaylock -f -c 000000' \ + timeout 300 'swaylock-cool -f' \ timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ - before-sleep 'swaylock -f -c 000000' + before-sleep 'swaylock-cool -f' # 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 @@ -92,6 +91,9 @@ input * { # Start your launcher bindsym $mod+d exec $menu + # Lock the screen + bindsym $mod+Shift+Plus exec "swaylock-cool -f" + # 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. @@ -107,17 +109,17 @@ input * { # # Volume & Brightness # -#bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% -#bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% -bindsym XF86AudioRaiseVolume exec volup -bindsym XF86AudioLowerVolume exec voldown -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 10%- -bindsym XF86MonBrightnessUp exec brightnessctl set +10% -bindsym XF86AudioPlay exec playerctl play-pause -bindsym XF86AudioNext exec playerctl next -bindsym XF86AudioPrev exec playerctl previous + #bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% + #bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% + bindsym XF86AudioRaiseVolume exec volup + bindsym XF86AudioLowerVolume exec voldown + 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 10%- + bindsym XF86MonBrightnessUp exec brightnessctl set +10% + bindsym XF86AudioPlay exec playerctl play-pause + bindsym XF86AudioNext exec playerctl next + bindsym XF86AudioPrev exec playerctl previous # # Moving around: # diff --git a/tree/.config/sway/swaylock.config b/tree/.config/sway/swaylock.config new file mode 100644 index 0000000..4fa6907 --- /dev/null +++ b/tree/.config/sway/swaylock.config @@ -0,0 +1,39 @@ +ignore-empty-password +font=Ubuntu + +indicator-idle-visible +indicator-radius=240 +indicator-thickness=20 +indicator-caps-lock + +key-hl-color=880033 + +separator-color=00000000 + +inside-color=00000099 +inside-clear-color=ffd20400 +inside-caps-lock-color=009ddc00 +inside-ver-color=d9d8d800 +inside-wrong-color=ee2e2400 + +ring-color=231f20D9 +ring-clear-color=231f20D9 +ring-caps-lock-color=231f20D9 +ring-ver-color=231f20D9 +ring-wrong-color=231f20D9 + +line-color=00000000 +line-clear-color=ffd204FF +line-caps-lock-color=009ddcFF +line-ver-color=d9d8d8FF +line-wrong-color=ee2e24FF + +text-clear-color=ffd20400 +text-ver-color=d9d8d800 +text-wrong-color=ee2e2400 + +bs-hl-color=ee2e24FF +caps-lock-key-hl-color=ffd204FF +caps-lock-bs-hl-color=ee2e24FF +disable-caps-lock-text +text-caps-lock-color=009ddc diff --git a/tree/.local/bin/swaylock-cool b/tree/.local/bin/swaylock-cool new file mode 100755 index 0000000..d255d0a --- /dev/null +++ b/tree/.local/bin/swaylock-cool @@ -0,0 +1,29 @@ +#!/bin/sh + +BLUR_FACTOR=64; + +OPTIONAL_CMDS=("convert" "python3" "grim") + +for CMD in $OPTIONAL_CMDS; do + if ! command -v "$CMD" &> /dev/null + then + echo "$CMD could not be found, falling back to basic mode." + + swaylock --config ~/.config/sway/swaylock.config --color 302f3b $@ + + exit 0 + fi +done + +FILE="$(mktemp)" +FILE_RAW="$FILE.raw.jpg" +FILE="$FILE.jpg" + +UPSCALE="$(python3 -c "print(100*$BLUR_FACTOR, end='')")%" +DOWNSCALE="$(python3 -c "print(100/$BLUR_FACTOR, end='')")%" + +grim "$FILE_RAW" + +convert -scale $DOWNSCALE -scale $UPSCALE "$FILE_RAW" "$FILE" + +swaylock --config ~/.config/sway/swaylock.config --image "$FILE" $@