mirror of
https://github.com/ItsDrike/nixdots
synced 2024-12-25 06:04:33 +00:00
Add hypridle & hyprlock
This commit is contained in:
parent
c7bb1768be
commit
8b0bd140db
|
@ -7,5 +7,6 @@ _: {
|
|||
./browsers
|
||||
./file-managers
|
||||
./games
|
||||
./screen-lockers
|
||||
];
|
||||
}
|
||||
|
|
5
home/programs/graphical/screen-lockers/default.nix
Normal file
5
home/programs/graphical/screen-lockers/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
imports = [
|
||||
./hyprlock.nix
|
||||
];
|
||||
}
|
209
home/programs/graphical/screen-lockers/hyprlock.nix
Normal file
209
home/programs/graphical/screen-lockers/hyprlock.nix
Normal file
|
@ -0,0 +1,209 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
osConfig,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = osConfig.myOptions.home-manager.programs.screen-lockers.hyprlock;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
programs.hyprlock = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
general = {
|
||||
disable_loading_bar = false;
|
||||
hide_cursor = true;
|
||||
grace = 3;
|
||||
};
|
||||
|
||||
background = [
|
||||
{
|
||||
# TODO: Keep the wallpaper in dotfiles
|
||||
path = "~/Media/Pictures/Wallpapers/Categories/Extra/origami.png";
|
||||
blur_passes = 3;
|
||||
blur_size = 6;
|
||||
#contrast = 0.7;
|
||||
#brightness = 0.7;
|
||||
noise = 0.01;
|
||||
contrast = 0.9;
|
||||
brightness = 0.6;
|
||||
}
|
||||
];
|
||||
|
||||
# Password circle
|
||||
input-field = [
|
||||
{
|
||||
size = "300, 250";
|
||||
rounding = -1;
|
||||
outline_thickness = 30;
|
||||
outer_color = "rgba(129, 162, 190, 85)";
|
||||
inner_color = "rgb(29, 31, 33)";
|
||||
font_color = "rgb(100, 100, 100)";
|
||||
|
||||
check_color = "rgb(204, -136, 34)"; # override outer_color while checking the pw (could take a while sometimes - pam lockouts)
|
||||
fail_color = "rgb(204, 34, 34)"; # override outer_color and fail message color if auth failed
|
||||
fail_transition = 500; # transition time in ms between normal outer_color and fail_color
|
||||
fail_text = ""; # Leave this empty (amt of attempts and fail reason shown with labels)
|
||||
|
||||
hide_input = true;
|
||||
fade_on_empty = false;
|
||||
placeholder_text = ""; # Leave this empty
|
||||
|
||||
position = "0, 0";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
}
|
||||
];
|
||||
|
||||
label = [
|
||||
# Show time (inside of the circle)
|
||||
{
|
||||
text = "cmd[update:200] date +'%H:%M:%S'";
|
||||
color = "rgba(129, 162, 190, 1.0)";
|
||||
font_size = 35;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
position = "0, 30";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
}
|
||||
|
||||
# Show date (inside of the circle, below time)
|
||||
{
|
||||
text = "cmd[update:1000] date +'%a, %d-%m-%Y'";
|
||||
color = "rgba(129, 162, 190, 1.0)";
|
||||
font_size = 20;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
position = "0, -20";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
}
|
||||
|
||||
# Keyboard layout
|
||||
{
|
||||
text = "cmd[update:200] hyprctl devices -j | jq -r '.keyboards[] | select(.name == \"at-translated-set-2-keyboard\") | .active_keymap'";
|
||||
color = "rgba(129, 162, 190, 1.0)";
|
||||
font_size = 10;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
position = "0, -90";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
}
|
||||
|
||||
# Failed attempts count
|
||||
{
|
||||
text = "<i>Logged <span foreground='##FFA500'>$ATTEMPTS[0]</span> failure(s)</i>";
|
||||
color = "rgba(153, 153, 153, 1.0)"; # gray
|
||||
font_size = 14;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
shadow_passes = 1;
|
||||
shadow_size = 1.2;
|
||||
shadow_boost = 1.0;
|
||||
|
||||
position = "0, -200";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
}
|
||||
|
||||
# Fail reason
|
||||
{
|
||||
text = "<i>$FAIL</i>";
|
||||
color = "rgba(255, 34, 34, 1.0)"; # red
|
||||
font_size = 14;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
shadow_passes = 1;
|
||||
shadow_size = 1.2;
|
||||
shadow_boost = 1.0;
|
||||
|
||||
position = "0, -230";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
}
|
||||
|
||||
# Splash text
|
||||
{
|
||||
text = "Session Locked";
|
||||
color = "rgba(255, 255, 255, 1.0)";
|
||||
font_size = 40;
|
||||
font_family = "Monaspace Krypton";
|
||||
|
||||
shadow_passes = 1;
|
||||
shadow_size = 5;
|
||||
shadow_boost = 1.8;
|
||||
|
||||
position = "0, 220";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
}
|
||||
|
||||
# Device uptime
|
||||
{
|
||||
text = "cmd[update:1000] echo \" $(awk '{days=int($1/86400); hours=int(($1%86400)/3600); minutes=int(($1%3600)/60); if (days>0) printf \"%dd %dh %dm\\n\", days, hours, minutes; else if (hours>0) printf \"%dh %dm\\n\", hours, minutes; else printf \"%dm\\n\", minutes; }' /proc/uptime)\"";
|
||||
color = "rgba(129, 162, 190, 1.0)";
|
||||
font_size = 11;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
position = "-90, -20";
|
||||
halign = "right";
|
||||
valign = "top";
|
||||
}
|
||||
|
||||
# Battery percentage
|
||||
{
|
||||
text = "cmd[update:1000] echo \" $(cat /sys/class/power_supply/BAT0/capacity)%\"";
|
||||
color = "rgba(129, 162, 190, 1.0)";
|
||||
font_size = 11;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
shadow_passes = 1;
|
||||
shadow_size = 5;
|
||||
shadow_boost = 1.8;
|
||||
|
||||
position = "-20, -20";
|
||||
halign = "right";
|
||||
valign = "top";
|
||||
}
|
||||
|
||||
# User account
|
||||
{
|
||||
text = " $USER";
|
||||
color = "rgba(129, 162, 190, 1.0)";
|
||||
font_size = 11;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
shadow_passes = 1;
|
||||
shadow_size = 5;
|
||||
shadow_boost = 1.8;
|
||||
|
||||
position = "20, -20";
|
||||
halign = "left";
|
||||
valign = "top";
|
||||
}
|
||||
|
||||
# Recovery email (lost device)
|
||||
{
|
||||
text = "recovery@itsdrike.com";
|
||||
color = "rgba(129, 162, 190, 1.0)";
|
||||
font_size = 11;
|
||||
font_family = "Noto Sans";
|
||||
|
||||
shadow_passes = 1;
|
||||
shadow_size = 5;
|
||||
shadow_boost = 1.8;
|
||||
|
||||
position = "20, 12";
|
||||
halign = "left";
|
||||
valign = "bottom";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -2,5 +2,6 @@ _: {
|
|||
imports = [
|
||||
./dunst.nix
|
||||
./hyprpaper.nix
|
||||
./hypridle.nix
|
||||
];
|
||||
}
|
||||
|
|
56
home/services/hypridle.nix
Normal file
56
home/services/hypridle.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = osConfig.myOptions.home-manager.services.hypridle;
|
||||
cfgIsWayland = osConfig.myOptions.home-manager.wms.isWayland;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfgIsWayland) {
|
||||
# NOTE: This assumes dunst, hyprlock and Hyprland are installed
|
||||
services.hypridle = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
lock_cmd = "hyprlock && dunstctl set-paused true";
|
||||
unlock_cmd = "killall -s SIGUSR1 hyprlock && dustctl set-paused false";
|
||||
before_sleep_cmd = "loginctl lock-session && dunstctl set-paused true && sleep 2";
|
||||
after_sleep_cmd = "dunstctl set-paused false";
|
||||
ignore_dbus_inhibit = false;
|
||||
ignore_systemd_inhibit = false;
|
||||
};
|
||||
|
||||
listener = [
|
||||
# Warn about going idle (5 mins)
|
||||
{
|
||||
timeout = 300;
|
||||
# use hyprland notifications, in case dunst notifs are paused or whatever
|
||||
on-timeout = "hyprctl notify 0 10000 'rgb(ff0000)' 'fontsize:20 System going idle in 10 seconds...'";
|
||||
on-resume = "hyprctl dismissnotify 1";
|
||||
}
|
||||
|
||||
# Lock the session & disable dunst notifications
|
||||
{
|
||||
timeout = 310;
|
||||
on-timeout = "loginctl lock-session";
|
||||
}
|
||||
|
||||
# Turn off the screen after another 50s
|
||||
{
|
||||
timeout = 400;
|
||||
on-timeout = "hyprctl dispatch dpms off";
|
||||
on-resume = "hyprctl dispatch dpms on";
|
||||
}
|
||||
|
||||
# Enter suspend/sleep state (10 minutes)
|
||||
{
|
||||
timeout = 600;
|
||||
on-timeout = "systemctl suspend-then-hibernate";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -189,6 +189,7 @@
|
|||
|
||||
programs = {
|
||||
bars.eww.enable = true;
|
||||
screen-lockers.hyprlock.enable = true;
|
||||
browsers = {
|
||||
firefox.enable = true;
|
||||
chromium.enable = true;
|
||||
|
@ -241,6 +242,7 @@
|
|||
# to whatever file you wish to actually be your wallpaper
|
||||
wallpaperPath = "/data/Data/Media/Pictures/Wallpapers/active";
|
||||
};
|
||||
hypridle.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -67,5 +67,9 @@ in {
|
|||
steam.enable = mkEnableOption "Steam client";
|
||||
prismlauncher.enable = mkEnableOption "PrismLauncher";
|
||||
};
|
||||
|
||||
screen-lockers = {
|
||||
hyprlock.enable = mkEnableOption "HyprLock (A screenlocker for Hyprland)";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,5 +12,6 @@ in {
|
|||
description = "Path to the wallpaper of your choosing";
|
||||
};
|
||||
};
|
||||
hypridle.enable = mkEnableOption "Hypridle (Hyprland idle daemon)";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue