dotfiles

My PC Dotfiles & Website
commit 7becb5534fac894b3a600cdc5bdef38748233c40
parent 0b0b0c6739cab6e50bdf94611ce631f482576db0
Author: maydayv7 <maydayv7@gmail.com>
Date:   Fri, 10 May 2024 21:42:07 +0530

feat: Allow Hibernation

Fingers crossed (ZFS)
Also /* Take 3 */ of fixing system idle on Hyprland, but now it works!

Diffstat:

5 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/modules/base/security.nix b/modules/base/security.nix @@ -8,7 +8,7 @@ # Protocols programs.firejail.enable = true; security = { - protectKernelImage = true; + protectKernelImage = false; # To enable Hibernation apparmor = { enable = true; killUnconfinedConfinables = true; @@ -24,6 +24,7 @@ kernel.sysctl = { # Kernel "kernel.ftrace_enabled" = false; + "kernel.kexec_load_disabled" = true; "kernel.kptr_restrict" = lib.mkOverride 500 2; "kernel.sysrq" = 0; "kernel.yama.ptrace_scope" = lib.mkOverride 500 1; diff --git a/modules/gui/desktop/hyprland/apps/default.nix b/modules/gui/desktop/hyprland/apps/default.nix @@ -97,7 +97,6 @@ in { }; # App Environment - dconf.settings."org/gnome/desktop/wm/preferences".button-layout = "appmenu"; wayland.windowManager.hyprland.settings.env = [ # Screengrab "SLURP_ARGS, -dc ${colors.base0D}" @@ -106,6 +105,12 @@ in { "QT_WAYLAND_DISABLE_WINDOWDECORATION, 1" ]; + # GTK Apps + dconf.settings."org/gnome/desktop/wm/preferences" = { + action-double-click-titlebar = "none"; + button-layout = "appmenu"; + }; + # Shortcuts wayland.windowManager.hyprland.settings.bind = [ "$mod SHIFT, slash, exec, pkill -f -1 nwg-wrapper" # Binds List diff --git a/modules/gui/desktop/hyprland/apps/rules.nix b/modules/gui/desktop/hyprland/apps/rules.nix @@ -30,6 +30,7 @@ _: { # Dialogs "float, title:^(Open File)(.*)$" + "float, title:^(Save File)(.*)$" "float, title:^(Select a File)(.*)$" "float, title:^(Open Folder)(.*)$" "float, title:^(Save As)(.*)$" diff --git a/modules/gui/desktop/hyprland/apps/security.nix b/modules/gui/desktop/hyprland/apps/security.nix @@ -6,6 +6,11 @@ ... }: rec { # Locker + stylix.targets.swaylock = { + enable = true; + useImage = true; + }; + programs.swaylock = { enable = true; package = pkgs.swaylock-effects; @@ -18,12 +23,6 @@ }; }; - # Theming - stylix.targets.swaylock = { - enable = true; - useImage = true; - }; - # Idle Daemon services.swayidle = let inherit (lib) getExe getExe'; @@ -43,20 +42,20 @@ } ]; timeouts = let - script = command: getExe (pkgs.writeShellScript "idle" command); + audio = command: "${pkgs.writeShellScript "audio" '' + ${getExe' pkgs.pipewire "pw-cli"} info all | ${getExe pkgs.gnugrep} running + if [ $? == 1 ]; then ${command}; fi + ''}"; # Check if audio is playing hyprctl = getExe' sys.programs.hyprland.package "hyprctl"; in [ { - timeout = 300; # Turn off display and lock - command = script "${hyprctl} dispatch dpms off; ${lock ""}"; - resumeCommand = script "${hyprctl} dispatch dpms on"; + timeout = 300; # Turn off display + command = audio "${hyprctl} dispatch dpms off"; + resumeCommand = "${hyprctl} dispatch dpms on"; } { - timeout = 1000; # Suspend if no audio is playing - command = script '' - ${getExe' pkgs.pipewire "pw-cli"} info all | ${getExe pkgs.gnugrep} running - if [ $? == 1 ]; then ${getExe' pkgs.systemd "systemctl"} suspend; fi - ''; + timeout = 600; # Suspend then Hibernate computer + command = audio "${hyprctl} dispatch dpms on && ${getExe' pkgs.systemd "systemctl"} suspend-then-hibernate"; } ]; }; diff --git a/modules/hardware/filesystem.nix b/modules/hardware/filesystem.nix @@ -127,8 +127,9 @@ in { boot = { resumeDevice = "/dev/disk/by-partlabel/swap"; supportedFilesystems = ["zfs"]; - kernelParams = ["elevator=none" "nohibernate"]; + kernelParams = ["elevator=none"]; zfs = { + allowHibernation = true; forceImportRoot = false; forceImportAll = false; devNodes = "/dev/disk/by-partlabel/System";