feat: add hypridle

This commit is contained in:
Nydragon 2024-06-26 10:14:22 +02:00
parent bcb19a1420
commit 24e98d63f3
No known key found for this signature in database
GPG key ID: 14AA30A865EA1209
7 changed files with 70 additions and 5 deletions

34
home/hypridle/default.nix Normal file
View file

@ -0,0 +1,34 @@
{
lib,
pkgs,
osConfig,
...
}:
lib.mkIf osConfig.programs.hyprland.enable {
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
};
listener = [
{
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

@ -23,7 +23,9 @@ lib.mkIf osConfig.programs.hyprland.enable {
"${pkgs.kdeconnect}/bin/kdeconnect-indicator" "${pkgs.kdeconnect}/bin/kdeconnect-indicator"
"${pkgs.protonmail-bridge-gui}/bin/protonmail-bridge-gui --no-window" "${pkgs.protonmail-bridge-gui}/bin/protonmail-bridge-gui --no-window"
"${pkgs.waybar}/bin/waybar" "${pkgs.waybar}/bin/waybar"
#"${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store -max-items 10" "${pkgs.keepassxc}/bin/keepassxc"
"${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store -max-items 10"
(lib.mkIf config.services.hypridle.enable "${pkgs.hypridle}/bin/hypridle")
]; ];
general = { general = {

View file

@ -1,11 +1,17 @@
{ {
position = "top";
layer = "top";
reload_style_on_change = true;
modules-left = [ modules-left = [
"tray" "tray"
"privacy" "privacy"
"clock" "clock"
"sway/mode" "sway/mode"
]; ];
modules-center = [ "sway/workspaces" ]; modules-center = [
"sway/workspaces"
"hyprland/workspaces"
];
modules-right = [ modules-right = [
"backlight" "backlight"
"pulseaudio" "pulseaudio"
@ -111,7 +117,6 @@
deactivated = ""; deactivated = "";
}; };
}; };
layer = "bottom";
memory = { memory = {
format = " {}%"; format = " {}%";
interval = 30; interval = 30;
@ -122,7 +127,6 @@
format-wifi = "{essid} ({signalStrength}%) "; format-wifi = "{essid} ({signalStrength}%) ";
on-click = "alacritty -t nmtui -e nmtui"; on-click = "alacritty -t nmtui -e nmtui";
}; };
position = "top";
privacy = { privacy = {
icon-size = 18; icon-size = 18;
icon-spacing = 4; icon-spacing = 4;
@ -178,6 +182,10 @@
disable-scroll = true; disable-scroll = true;
format = "{name}"; format = "{name}";
}; };
"hyprland/workspaces" = {
all-outputs = true;
format = "{name}";
};
tray = { tray = {
icon-size = 18; icon-size = 18;
show-passive-items = false; show-passive-items = false;

View file

@ -62,6 +62,7 @@ window#waybar.hidden {
background-color: rgba(13, 214, 250, 0.4); background-color: rgba(13, 214, 250, 0.4);
button { button {
color: white;
padding: 1px 5px; padding: 1px 5px;
} }
@ -72,6 +73,14 @@ window#waybar.hidden {
button.focused { button.focused {
background-color: rgba(50, 194, 219, 0.7); background-color: rgba(50, 194, 219, 0.7);
} }
button.active {
background-color: rgba(80, 194, 219, 0.7);
}
button.urgent {
background-color: rgba(255, 0, 0, 0.7);
}
} }
#network { #network {

View file

@ -17,6 +17,8 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = hostname; networking.hostName = hostname;
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true; services.blueman.enable = true;
services.greetd = { services.greetd = {
@ -29,6 +31,14 @@
default_session = initial_session; default_session = initial_session;
}; };
}; };
xdg.portal = {
enable = true;
config.common.default = "*";
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
];
};
services.pipewire = { services.pipewire = {
enable = true; enable = true;

View file

@ -17,6 +17,7 @@
../../home/waybar ../../home/waybar
../../home/hyprland ../../home/hyprland
../../home/hyprlock ../../home/hyprlock
../../home/hypridle
]; ];
programs.direnv = { programs.direnv = {

View file

@ -30,6 +30,8 @@ in
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true; hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true;
hardware.graphics.enable = true; hardware.graphics.enable = true;
# Configure keymap in X11 # Configure keymap in X11
@ -43,7 +45,6 @@ in
powerKey = "hibernate"; powerKey = "hibernate";
}; };
services.blueman.enable = true;
systemd.sleep.extraConfig = '' systemd.sleep.extraConfig = ''
HibernateDelaySec=1200 HibernateDelaySec=1200
''; '';