From 6fc8077a97ac23242c2492f13691042be2f276f5 Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Fri, 29 Mar 2024 22:45:12 +0100 Subject: [PATCH] [hyprland] switched from swaylock to hyprlock --- apps/swaylock/lock.sh | 54 --------------- nix/home/hyprland/default.nix | 1 + nix/home/hyprland/hyprland-bindings.nix | 2 +- nix/home/hyprland/hyprlock.nix | 92 +++++++++++++++++++++++++ nix/systems/packages.nix | 2 +- 5 files changed, 95 insertions(+), 56 deletions(-) delete mode 100755 apps/swaylock/lock.sh create mode 100644 nix/home/hyprland/hyprlock.nix diff --git a/apps/swaylock/lock.sh b/apps/swaylock/lock.sh deleted file mode 100755 index b7b2a14..0000000 --- a/apps/swaylock/lock.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env zsh - -# get active monitors -active_monitors=($(hyprctl monitors | grep -i monitor | awk '{print $2}')) -home_dir=$(xdg-user-dir) - - -# create blurred images per active screen -for monitor in ${active_monitors} -do - - # variables - image=/tmp/swaylock_$monitor.png - image_blur=/tmp/swaylock_blur_$monitor.png - lockargs=($lockargs --image $monitor:$image_blur) - - # create image - grim -o $monitor $image - - # create blurred image - convert $image -blur 0x5 $image_blur - -done - - -# lock the screen using the newly created image -swaylock \ - --scaling center \ - --hide-keyboard-layout \ - --indicator-radius 100 \ - --indicator-thickness 5 \ - --ring-color 285577ff \ - --ring-ver-color 89b4fa \ - --ring-wrong-color f38ba8 \ - --ring-clear-color a6e3a1 \ - --key-hl-color 1e1e2e \ - --bs-hl-color eba0ac \ - --text-color 11111b \ - --text-caps-lock-color 11111b \ - --line-color 00000000 \ - --line-ver-color 00000000 \ - --line-wrong-color 00000000 \ - --line-clear-color 00000000 \ - --separator-color 00000000 \ - --inside-color 285577ff \ - --inside-ver-color 89b4fa\ - --inside-wrong-color f38ba8 \ - --inside-clear-color a6e3a1 \ - --color 1e1e2e80 \ - $lockargs - - -# cleanup -rm -f /tmp/swaylock*.png diff --git a/nix/home/hyprland/default.nix b/nix/home/hyprland/default.nix index 9b22276..1c69181 100644 --- a/nix/home/hyprland/default.nix +++ b/nix/home/hyprland/default.nix @@ -8,5 +8,6 @@ ./hyprland-graphics.nix ./hyprland-input.nix ./hyprland-window_rules.nix + ./hyprlock.nix ]; } diff --git a/nix/home/hyprland/hyprland-bindings.nix b/nix/home/hyprland/hyprland-bindings.nix index 652a959..e8b38e7 100644 --- a/nix/home/hyprland/hyprland-bindings.nix +++ b/nix/home/hyprland/hyprland-bindings.nix @@ -19,6 +19,7 @@ bind = $mainMod, F, fullscreen bind = $mainMod, J, togglesplit bind = $mainMod, K, exec, alacritty --class scratchbox + bind = $mainMod, L, exec, hyprlock bind = $mainMod, M, exit, bind = $mainMod, N, exec, alacritty --class nmtui --command ~/.dotfiles/apps/hyprland/nmtui.sh bind = $mainMod, P, pseudo @@ -29,7 +30,6 @@ bind = $mainMod, V, togglefloating # manage lockscreen - bind = $mainMod, L, exec, ~/.dotfiles/apps/swaylock/lock.sh bindl = ,switch:on:Lid Switch, exec, ~/.dotfiles/apps/swaylock/lock.sh # focus bindings diff --git a/nix/home/hyprland/hyprlock.nix b/nix/home/hyprland/hyprlock.nix new file mode 100644 index 0000000..db7bb80 --- /dev/null +++ b/nix/home/hyprland/hyprlock.nix @@ -0,0 +1,92 @@ +{ config, ... }: +{ + + # include hyprland configs + home.file.".config/hypr/hyprlock.conf".text = '' + + # general + general { + no_fade_in = false + no_fade_out = false + } + + # background + background { + monitor = + path = $HOME/Pictures/wallpaper.png + } + + + # password input + input-field { + monitor = + + dots_center = true + dots_size = 0.2 + dots_spacing = 0.64 + + fade_on_empty = true + hide_input = false + placeholder_text = 1 2 3 4 5 ... + + position = 0, 150 + size = 250, 50 + + outline_thickness = 3 + font_color = rgb(250, 179, 135) + inner_color = rgb(12, 12, 12) + outer_color = rgb(71, 80, 201) + + halign = center + valign = bottom + } + + + # time + label { + monitor = + + text = cmd[update:1000] echo " $(date +"%H:%M:%S") " + position = 0, 20 + + color = rgb(250, 179, 135) + font_size = 64 + font_family = JetBrains Mono Nerd Font 10 + + halign = center + valign = center + } + + + # user + label { + monitor = + + text = cmd[update:1000] echo "$(date +%A) $(date +%d) $(date +%B)" + position = 0, 0 + + color = rgb(250, 179, 135) + font_size = 20 + font_family = JetBrains Mono Nerd Font 10 + + halign = center + valign = center + } + + + # unlock + label { + monitor = + + text = 👤 siempie + position = 0, 120 + + color = rgb(137, 180, 250) + font_size = 14 + font_family = JetBrains Mono Nerd Font 10 + + halign = center + valign = bottom + } + ''; +} diff --git a/nix/systems/packages.nix b/nix/systems/packages.nix index e2f6f87..1a8ec8e 100644 --- a/nix/systems/packages.nix +++ b/nix/systems/packages.nix @@ -25,6 +25,7 @@ brightnessctl grim unstable.grimblast + unstable.hyprlock imagemagick jq lxappearance-gtk2 @@ -32,7 +33,6 @@ slurp socat swaybg - swaylock waybar wofi xfce.xfce4-settings