dotfiles

My PC Dotfiles & Website
commit 0b0b0c6739cab6e50bdf94611ce631f482576db0
parent d87357407ba5e72851e6c3bd8d7eb00e23ad3a32
Author: maydayv7 <maydayv7@gmail.com>
Date:   Wed,  8 May 2024 11:56:53 +0530

fix(Hyprland): Screen Locking (again)

Also float dialogs

Diffstat:

Mfiles/vscode/settings.json | 4++--
Mmodules/gui/desktop/hyprland/apps/rules.nix | 10++++++++++
Mmodules/gui/desktop/hyprland/apps/security.nix | 58++++++++++++++++++++++++----------------------------------
3 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/files/vscode/settings.json b/files/vscode/settings.json @@ -7,8 +7,8 @@ "editor.suggest.preview": true, "editor.suggest.showStatusBar": true, "editor.unfoldOnClickAfterEndOfLine": true, - "explorer.incrementalNaming": "smart", "explorer.confirmDelete": false, + "explorer.incrementalNaming": "smart", "explorer.openEditors.visible": 7, "extensions.autoCheckUpdates": false, "extensions.autoUpdate": false, @@ -24,8 +24,8 @@ "gitlens.advanced.commitOrdering": "date", "gitlens.advanced.fileHistoryFollowsRenames": true, "nix.enableLanguageServer": true, - "nix.serverPath": "nil", "nix.formatterPath": "alejandra", + "nix.serverPath": "nil", "scm.repositories.visible": 7, "search.showLineNumbers": true, "search.smartCase": true, diff --git a/modules/gui/desktop/hyprland/apps/rules.nix b/modules/gui/desktop/hyprland/apps/rules.nix @@ -11,6 +11,9 @@ _: { # Clipboard "float, class:^(clipse)$" + # Screen Tearing + "immediate, class:^(.+exe)$" + # Application Launcher "opacity 0.9 override, class:^(ulauncher)$" "move cursor -50% -50%, class:^(ulauncher)$" @@ -25,6 +28,13 @@ _: { "idleinhibit focus, class:^(firefox|google-chrome)$, title:^(.*YouTube.*)$" "idleinhibit fullscreen, class:^(firefox|google-chrome)$" + # Dialogs + "float, title:^(Open File)(.*)$" + "float, title:^(Select a File)(.*)$" + "float, title:^(Open Folder)(.*)$" + "float, title:^(Save As)(.*)$" + "float, title:^(Library)(.*)$" + # Prompt Windows "dimaround, class:^(gcr-prompter)$" "dimaround, class:^(xdg-desktop-portal-gtk)$" diff --git a/modules/gui/desktop/hyprland/apps/security.nix b/modules/gui/desktop/hyprland/apps/security.nix @@ -4,19 +4,15 @@ pkgs, files, ... -}: let - inherit (lib) concatMapStringsSep getExe; - inherit (sys.stylix) fonts; - locker = pkgs.swaylock-effects; -in { +}: rec { # Locker programs.swaylock = { enable = true; - package = locker; + package = pkgs.swaylock-effects; settings = { clock = true; indicator = true; - font = fonts.sansSerif.name; + font = sys.stylix.fonts.sansSerif.name; fade-in = 1; effect-vignette = "0.3:1"; }; @@ -29,13 +25,14 @@ in { }; # Idle Daemon - services.swayidle = { + services.swayidle = let + inherit (lib) getExe getExe'; + toggle = "${getExe pkgs.custom.hyprutils} toggle media"; + lock = flag: "sh -c '${toggle}; ${getExe programs.swaylock.package} ${flag}; ${toggle}'"; + in { enable = true; systemdTarget = "hyprland-session.target"; - events = let - toggle = "${getExe pkgs.custom.hyprutils} toggle media"; - lock = flag: "sh -c '${toggle}; ${getExe locker} ${flag}; ${toggle}'"; - in [ + events = [ { event = "before-sleep"; command = lock ""; @@ -45,29 +42,22 @@ in { command = lock "--grace 10"; } ]; - timeouts = [ + timeouts = let + script = command: getExe (pkgs.writeShellScript "idle" command); + 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 = 500; - command = "${pkgs.writeShellApplication { - name = "suspend"; # Suspend if no audio is playing - runtimeInputs = with pkgs; [pipewire gnugrep systemd]; - text = '' - pw-cli info all | grep running - if [ $? == 1 ]; then systemctl suspend; fi - ''; - }}/bin/suspend"; + 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 + ''; } - (let - script = text: "${pkgs.writeShellApplication { - name = "dpms"; - runtimeInputs = [sys.programs.hyprland.package pkgs.procps]; - inherit text; - }}/bin/dpms"; - in { - timeout = 30; # Turn off display after locking - command = script "if pgrep -x swaylock; then hyprctl dispatch dpms off; fi"; - resumeCommand = script "hyprctl dispatch dpms on"; - }) ]; }; @@ -77,7 +67,7 @@ in { style = files.hyprland.wlogout + '' - ${concatMapStringsSep "\n" ( + ${lib.concatMapStringsSep "\n" ( name: '' #${name} { background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/${name}.png"));