From 44fcdd56637a77501902bdd4d1f98a161c8b2a8b Mon Sep 17 00:00:00 2001 From: Viyurz Date: Mon, 4 Mar 2024 10:01:26 +0100 Subject: [PATCH] Replace Sway lock/idle by Hypr lock/idle & use loginctl for lock. --- .config/hypr/hypridle.conf | 17 +++++++ .config/hypr/hyprland.d/bindings.conf | 2 +- .config/hypr/hyprland.d/exec.conf | 6 +-- .config/hypr/hyprlock.conf | 51 +++++++++++++++++++ .config/wlogout/layout | 6 +-- .scripts/swayidle.sh | 12 ----- .scripts/swaylock.sh | 70 --------------------------- 7 files changed, 75 insertions(+), 89 deletions(-) create mode 100644 .config/hypr/hypridle.conf create mode 100644 .config/hypr/hyprlock.conf delete mode 100755 .scripts/swayidle.sh delete mode 100755 .scripts/swaylock.sh diff --git a/.config/hypr/hypridle.conf b/.config/hypr/hypridle.conf new file mode 100644 index 0000000..aef8e4d --- /dev/null +++ b/.config/hypr/hypridle.conf @@ -0,0 +1,17 @@ +general { + lock_cmd = hyprlock + before_sleep_cmd = hyprlock +} + +# Lock after 5min +listener { + timeout = 300 + on-timeout = hyprlock +} + +# Turn of screen after 6min +listener { + timeout = 360 + on-timeout = hyprctl dispatch dpms off + on-resume = hyprctl dispatch dpms on +} diff --git a/.config/hypr/hyprland.d/bindings.conf b/.config/hypr/hyprland.d/bindings.conf index 35abd40..af8e5af 100644 --- a/.config/hypr/hyprland.d/bindings.conf +++ b/.config/hypr/hyprland.d/bindings.conf @@ -5,7 +5,7 @@ bind = $mainMod_SHIFT, E, exec, wlogout -b 4 -T 400 -B 400 -p layer-shell binde = $mainMod_SHIFT, Space, togglefloating, binde = $mainMod, P, pseudo, binde = $mainMod_SHIFT, V, togglesplit, -bind = $mainMod, L, exec, $HOME/.scripts/swaylock.sh +bind = $mainMod, L, exec, loginctl lock-session bind = $mainMod, F, fullscreen bind = $mainMod_SHIFT, N, exec, $HOME/.scripts/waybar-dnd-toggle.sh; pkill -SIGRTMIN+2 waybar diff --git a/.config/hypr/hyprland.d/exec.conf b/.config/hypr/hyprland.d/exec.conf index 8551194..9b669f2 100644 --- a/.config/hypr/hyprland.d/exec.conf +++ b/.config/hypr/hyprland.d/exec.conf @@ -12,6 +12,9 @@ exec-once = element-desktop --hidden # Gnome keyring (for Mailspring) exec-once = gnome-keyring +# Hypridle +exec-once = hypridle + # Mailspring exec-once = mailspring --background --password-store="gnome-libsecret" @@ -24,9 +27,6 @@ exec-once = artix-pipewire-launcher restart # Polkit exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 -# Swayidle -exec-once = $HOME/.scripts/swayidle.sh - # Swayosd exec-once = swayosd-server diff --git a/.config/hypr/hyprlock.conf b/.config/hypr/hyprlock.conf new file mode 100644 index 0000000..ed13e78 --- /dev/null +++ b/.config/hypr/hyprlock.conf @@ -0,0 +1,51 @@ +source = hyprland.d/colors.conf + +background { + monitor = + path = screenshot + + blur_passes = 1 + blur_size = 2 +} + +input-field { + monitor = + size = 300, 42 + outline_thickness = $border_size + dots_center = false + outer_color = $accent1 + inner_color = $background1 + font_color = $foreground + fade_on_empty = false + placeholder_text = + hide_input = false + rounding = -1 + + position = 0, -50 + halign = center + valign = center +} + +label { + monitor = + text = cmd[update:0] echo "$(date '+%A%e %b %Y')" + color = $foreground + font_size = 25 + font_family = $font + + position = 0, 50 + halign = center + valign = center +} + +label { + monitor = + text = cmd[update:1000] echo "$(date '+%H:%M:%S')" + color = $foreground + font_size = 25 + font_family = $font + + position = 0, 0 + halign = center + valign = center +} diff --git a/.config/wlogout/layout b/.config/wlogout/layout index 229b1f8..43c4e31 100644 --- a/.config/wlogout/layout +++ b/.config/wlogout/layout @@ -1,6 +1,6 @@ { "label" : "lock", - "action" : "~/.config/hypr/swaylock", + "action" : "loginctl lock-session", "text" : "Lock", "keybind" : "l" } @@ -12,13 +12,13 @@ } { "label" : "shutdown", - "action" : "sudo poweroff", + "action" : "loginctl poweroff", "text" : "Shutdown", "keybind" : "s" } { "label" : "reboot", - "action" : "sudo reboot", + "action" : "loginctl reboot", "text" : "Reboot", "keybind" : "r" } diff --git a/.scripts/swayidle.sh b/.scripts/swayidle.sh deleted file mode 100755 index 6893a68..0000000 --- a/.scripts/swayidle.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Edit /etc/elogind/logind.conf and change these lines: -# HandleLidSwitch=suspend -> HandleLidSwitch=lock -# HandleLidSwitchExternalPower=suspend -> HandleLidSwitchExternalPower=lock - -swayidle -w \ - timeout 300 "$HOME/.scripts/swaylock.sh" \ - timeout 360 'hyprctl dispatch dpms off' \ - resume 'hyprctl dispatch dpms on' \ - before-sleep "$HOME/.scripts/swaylock.sh" \ - lock "$HOME/.scripts/swaylock.sh" diff --git a/.scripts/swaylock.sh b/.scripts/swaylock.sh deleted file mode 100755 index 7b3ed2e..0000000 --- a/.scripts/swaylock.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh - -source "$HOME/.cache/colors.sh" - -options=( - --daemonize - --font Hack - --indicator-caps-lock - --indicator-radius 100 - --indicator-thickness 7 - --text-color "$foreground" - --text-caps-lock-color "$foreground" - --text-ver-color "$foreground" - --text-wrong-color "$foreground" - --text-clear-color "$disabled" - --ring-color "$accent1" - --ring-caps-lock-color "$accent2" - --ring-ver-color "$good" - --ring-wrong-color "$bad" - --ring-clear-color "$disabled" - --key-hl-color "$foreground" - --bs-hl-color "$disabled" - --caps-lock-key-hl-color "$foreground" - --caps-lock-bs-hl-color "$disabled2" - --separator-color 00000000 - --line-color 00000000 - --line-caps-lock-color 00000000 - --line-ver-color 00000000 - --line-wrong-color 00000000 - --line-clear-color 00000000 - --inside-color 00000000 - --inside-caps-lock-color 00000000 - --inside-ver-color 00000000 - --inside-wrong-color 00000000 - --inside-clear-color 00000000 - --separator-color 00000000 -) - -if swaylock --help 2>&1 | grep -qe '--screenshots'; then - options+=( - --disable-caps-lock-text - --indicator - --clock - --screenshots - --effect-blur 7x5 - --effect-vignette 0.5:0.5 - --grace 0 - --fade-in 0.2 - ) -else - options+=( - --show-failed-attempts - --indicator-idle-visible - ) - if grep -q 1 "$HOME/.cache/weeb-mode"; then - options+=(--image "$HOME/.cache/wallpaper-blurred.jpg") - else - options+=(--image "$HOME/.cache/wallpaper-hypr-blurred.jpg") - fi -fi - -if swaylock -v | grep -q fprintd; then - options+=( - --fingerprint - ) -fi - -swaylock "${options[@]}" - -$HOME/.scripts/set-wallpaper.sh -r