From a0ac11339d7f380a63041da46b6f2917a80eed29 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Mon, 21 Oct 2024 14:48:05 -0400 Subject: [PATCH] Some updates to get locking working again, also added performance mode script --- home-config/hypr/autostart.sh | 4 +++- home-config/hypr/hypridle.conf | 16 ++++++++++++++++ home-config/hypr/hyprland.conf | 7 +++++-- home-config/hypr/perf_mode.sh | 14 ++++++++++++++ home-config/nix-home-manager/home.nix | 9 ++++++++- modules/ryan-config/base-system.scm | 21 +++++++++++++++------ 6 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 home-config/hypr/hypridle.conf create mode 100755 home-config/hypr/perf_mode.sh diff --git a/home-config/hypr/autostart.sh b/home-config/hypr/autostart.sh index 8c7c502..b531c5b 100755 --- a/home-config/hypr/autostart.sh +++ b/home-config/hypr/autostart.sh @@ -11,7 +11,9 @@ nice -n13 swww init & #~/.config/hypr/wallpaper-daemon.sh & wpaperd -d & -swayidle -w timeout 300 'swaylock --screenshots --clock --indicator --grace 3 --fade-in 1 --effect-blur 7x5 --effect-greyscale' timeout 600 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep 'swaylock -f -c 000000' & +#swayidle -w timeout 300 'swaylock --screenshots --clock --indicator --grace 3 --fade-in 1 --effect-blur 7x5 --effect-greyscale' timeout 600 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep 'swaylock -f -c 000000' & + +hypridle & syncthing serve --no-browser & diff --git a/home-config/hypr/hypridle.conf b/home-config/hypr/hypridle.conf new file mode 100644 index 0000000..72688da --- /dev/null +++ b/home-config/hypr/hypridle.conf @@ -0,0 +1,16 @@ +general { + lock_cmd = pidof hyprlock || hyprlock + before_sleep_cmd = loginctl lock-session + after_sleep_cmd = hyprctl dispatch dpms on +} + +listener { + timeout = 300 + on-timeout = loginctl lock-session +} + +listener { + timeout = 600 + on-timeout = hyprctl dispatch dpms off + on-resume = hyprctl dispatch dpms on +} diff --git a/home-config/hypr/hyprland.conf b/home-config/hypr/hyprland.conf index 5fab592..b896c5a 100644 --- a/home-config/hypr/hyprland.conf +++ b/home-config/hypr/hyprland.conf @@ -203,8 +203,11 @@ bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow # Bind mainMod + L to screenlocker -bind = $mainMod, L, exec, swaylock --screenshots --clock --indicator --fade-in 0.3 --effect-blur 7x5 --effect-greyscale -bind = $mainMod SHIFT, L, exec, swaylock --screenshots --clock --indicator --effect-blur 7x5 --effect-greyscale & sleep 0.5; loginctl suspend +bind = $mainMod, L, exec, hyprlock +bind = $mainMod SHIFT, L, exec, loginctl suspend + +# Keybind to toggle "performance mode" (toggles GPU intensive things) +bind = $mainMod, F1, exec, ~/.config/hypr/perf_mode.sh # Keybind for screenshot bind = $mainMod SHIFT, S, exec, grimblast copy area diff --git a/home-config/hypr/perf_mode.sh b/home-config/hypr/perf_mode.sh new file mode 100755 index 0000000..c195688 --- /dev/null +++ b/home-config/hypr/perf_mode.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') +if [ "$HYPRGAMEMODE" = 1 ] ; then + hyprctl --batch "\ + keyword animations:enabled 0;\ + keyword decoration:drop_shadow 0;\ + keyword decoration:blur:enabled 0;\ + keyword general:gaps_in 0;\ + keyword general:gaps_out 0;\ + keyword general:border_size 1;\ + keyword decoration:rounding 0" + exit +fi +hyprctl reload diff --git a/home-config/nix-home-manager/home.nix b/home-config/nix-home-manager/home.nix index 72ddf3a..1e0046d 100644 --- a/home-config/nix-home-manager/home.nix +++ b/home-config/nix-home-manager/home.nix @@ -45,7 +45,6 @@ gdu spotify-player hyprpicker - hyprlock xwayland xdg-desktop-portal xdg-desktop-portal-gtk @@ -54,6 +53,14 @@ libva libvdpau wpaperd + hypridle + + # Wrapped programs for some env variables + (pkgs.writeScriptBin "hyprlock" '' + #! ${pkgs.bash}/bin/bash + export LD_PRELOAD="/run/current-system/profile/lib/libpam.so.0:$LD_PRELOAD" + exec ${pkgs.hyprlock}/bin/hyprlock "$@" + '') # Flakes specific things defined in flake.nix hyprland.packages.${pkgs.system}.default diff --git a/modules/ryan-config/base-system.scm b/modules/ryan-config/base-system.scm index ca13e77..01c5836 100644 --- a/modules/ryan-config/base-system.scm +++ b/modules/ryan-config/base-system.scm @@ -130,6 +130,7 @@ ;"swaylock-effects" "fuzzel" "foot" + "linux-pam" ; installed directly to get libs in profile directly "pinentry-qt" "adwaita-icon-theme" "hicolor-icon-theme" @@ -162,7 +163,7 @@ "wireshark" "webkitgtk-with-libsoup2" ; Needed for Go wails development "zsh")) - (list my-ca-certs virt-manager-ovmf bluez-ryan blueman-ryan swayidle-new) + (list my-ca-certs virt-manager-ovmf bluez-ryan blueman-ryan) %my-base-packages )) ;; Below is the list of system services. To search for available @@ -189,16 +190,24 @@ (socket "/var/run/tailscale/tailscaled.sock"))) (service containerd-service-type) (service nix-service-type) + (simple-service 'hyprlock-pam pam-root-service-type + (list + (pam-service + (name "hyprlock") + (auth + (list + (pam-entry (control "include") + (module "login"))))))) (service libvirt-service-type (libvirt-configuration (libvirt libvirt-ovmf) (unix-sock-group "libvirt"))) (service virtlog-service-type) - (service screen-locker-service-type - (screen-locker-configuration - (name "hyprlock") - (program (file-append swaylock "/bin/swaylock")) - (using-pam? #t))) + ;(service screen-locker-service-type + ; (screen-locker-configuration + ; (name "hyprlock") + ; (program (file-append swaylock "/bin/swaylock")) + ; (using-pam? #t))) (simple-service 'spice-polkit polkit-service-type (list spice-gtk)) (simple-service 'hwdb-creation etc-service-type (list `("udev-here-oneoneone" ,(plain-file "issue" "test\n")))) (service bluetooth-service-type