add hyprlock and hypridle

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
ahuston-0 2024-10-20 01:26:35 -04:00
parent f024f7e49a
commit bfccadf416
No known key found for this signature in database
GPG Key ID: 47940175096C1330
5 changed files with 147 additions and 0 deletions

View File

@ -8,6 +8,7 @@
enable = true; enable = true;
xwayland.enable = true; xwayland.enable = true;
}; };
hyprlock.enable = true;
gnupg.agent = { gnupg.agent = {
enable = true; enable = true;
#pinentryPackage = pkgs.pinentry-rofi; #pinentryPackage = pkgs.pinentry-rofi;
@ -54,6 +55,13 @@
}; };
}; };
powerManagement = {
enable = true;
resumeCommands = ''
${pkgs.hyprlock}/bin/hyprlock -c /home/alice/.config/hypr/hyprlock.conf
'';
};
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
libsForQt5.qt5.qtwayland libsForQt5.qt5.qtwayland
qt6.qtwayland qt6.qtwayland

View File

@ -19,3 +19,6 @@
(setq! lsp-enable-suggest-server-download nil) (setq! lsp-enable-suggest-server-download nil)
;; (keychain-refresh-environment) ;; (keychain-refresh-environment)
(setq! lsp-nix-nil-max-mem 20000)
(setq! lsp-nix-nil-formatter ["nixfmt"])

View File

@ -9,4 +9,9 @@
xdg.configFile = { xdg.configFile = {
"hypr/hyprland.conf".source = ./hyprland.conf; "hypr/hyprland.conf".source = ./hyprland.conf;
}; };
imports = [
./hyprlock.nix
./hypridle.nix
];
} }

View File

@ -0,0 +1,47 @@
{
config,
lib,
pkgs,
...
}:
{
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock --immediate --immediate-render"; # avoid starting multiple hyprlock instances.
before_sleep_cmd = "loginctl lock-session"; # lock before suspend.
after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
};
listener = [
{
timeout = 150; # 2.5min.
on-timeout = "brightnessctl -s set 1"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r"; # monitor backlight restore.
}
# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight.
{
timeout = 150; # 2.5min.
on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0"; # turn off keyboard backlight.
on-resume = "brightnessctl -rd rgb:kbd_backlight"; # turn on keyboard backlight.
}
{
timeout = 300; # 5min
on-timeout = "loginctl lock-session"; # lock screen when timeout has passed
}
{
timeout = 330; # 5.5min
on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed
on-resume = "hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired.
}
{
timeout = 1800; # 30min
on-timeout = "systemctl suspend"; # suspend pc
}
];
};
};
}

View File

@ -0,0 +1,84 @@
{
config,
lib,
pkgs,
...
}:
{
programs.hyprlock = {
enable = true;
settings = {
general = {
immediate_render = true;
no_fade_in = true;
};
background = {
monitor = "";
#path = /home/me/someImage.png # supports png, jpg, webp (no animations, though)
path = "screenshot";
color = "rgba(25, 20, 20, 1.0)";
# all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations
blur_passes = 3; # 0 disables blurring
blur_size = 7;
noise = 1.17e-2;
contrast = 0.8916;
brightness = 0.8172;
vibrancy = 0.1696;
vibrancy_darkness = 0.0;
};
image = {
monitor = "";
path = "/home/alice/Pictures/PXL_20240408_192537608-EDIT.jpg";
size = 350; # lesser side if not 1:1 ratio
rounding = -1; # negative values mean circle
border_size = 4;
border_color = "rgb(221, 221, 221)";
rotate = 0; # degrees, counter-clockwise
reload_time = -1; # seconds between reloading, 0 to reload with SIGUSR2
reload_cmd = ""; # command to get new path. if empty, old path will be used. don't run "follow" commands like tail -F
position = "0, 100";
halign = "center";
valign = "center";
};
input-field = {
monitor = "";
size = "400, 50";
outline_thickness = 3;
dots_size = 0.33; # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.15; # Scale of dots' absolute size, -1.0 - 1.0
dots_center = false;
dots_rounding = -1; # -1 default circle, -2 follow input-field rounding
dots_fade_time = 200; # Milliseconds until a dot fully fades in
dots_text_format = ""; # Text character used for the input indicator. Leave empty for a rectangle that will be rounded via dots_rounding (default).
outer_color = "rgb(151515)";
inner_color = "rgb(200, 200, 200)";
font_color = "rgb(10, 10, 10)";
font_family = "Noto Sans"; # Font used for placeholder_text, fail_text and dots_text_format.
fade_on_empty = false;
fade_timeout = 1000; # Milliseconds before fade_on_empty is triggered.
placeholder_text = "<i>Input Password...</i>"; # Text rendered in the input box when it's empty.
hide_input = false;
rounding = -1; # -1 means complete rounding (circle/oval)
check_color = "rgb(204, 136, 34)";
fail_color = "rgb(204, 34, 34)"; # if authentication failed, changes outer_color and fail message color
fail_text = "<i>$FAIL <b>($ATTEMPTS)</b></i>"; # can be set to empty
fail_timeout = 2000; # milliseconds before fail_text and fail_color disappears
fail_transition = 300; # transition time in ms between normal outer_color and fail_color
capslock_color = -1;
numlock_color = -1;
bothlock_color = -1; # when both locks are active. -1 means don't change outer color (same for above)
invert_numlock = false; # change color if numlock is off
swap_font_color = false; # see below
position = "0, -200";
halign = "center";
valign = "center";
};
};
};
}