From b6bff47ed1fd818260bb55a66547443c74569a96 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 8 Mar 2024 17:24:47 -0800 Subject: [PATCH] Move quickshell to its own module --- flake.lock | 11 ++++++----- modules/hyprland/default.nix | 4 ---- modules/hyprland/hyprland.conf | 2 +- modules/user/general.nix | 1 + modules/user/modules/quickshell/default.nix | 12 ++++++++++++ .../modules/quickshell}/lockscreen/AuthContext.qml | 10 +++++----- .../modules/quickshell}/lockscreen/Lockscreen.qml | 4 +--- .../modules/quickshell}/lockscreen/shell.qml | 13 ++++++------- .../modules/quickshell}/lockscreen/test.qml | 7 ++----- 9 files changed, 34 insertions(+), 30 deletions(-) create mode 100644 modules/user/modules/quickshell/default.nix rename modules/{hyprland => user/modules/quickshell}/lockscreen/AuthContext.qml (80%) rename modules/{hyprland => user/modules/quickshell}/lockscreen/Lockscreen.qml (91%) rename modules/{hyprland => user/modules/quickshell}/lockscreen/shell.qml (63%) rename modules/{hyprland => user/modules/quickshell}/lockscreen/test.qml (65%) diff --git a/flake.lock b/flake.lock index 2f733a2..0d2edea 100644 --- a/flake.lock +++ b/flake.lock @@ -443,12 +443,13 @@ ] }, "locked": { - "dirtyRev": "f32b4175fbc25bf9cf022c8edffe74696ecb5abb-dirty", - "dirtyShortRev": "f32b417-dirty", - "lastModified": 1709821149, - "narHash": "sha256-ZBKOlWd8sBG3bArCVM6squuJkVblGn3p0gy176KRoxg=", + "lastModified": 1709945683, + "narHash": "sha256-4mU58/em5UccBXrCBNds7heuoL5TTE4DTFQFsQDcCmY=", + "ref": "refs/heads/master", + "rev": "46d15228a690cd0a515f2baf4d94c6875a83686e", + "revCount": 95, "type": "git", - "url": "file:///home/admin/programming/outfoxxed/qtshell" + "url": "https://git.outfoxxed.me/outfoxxed/quickshell" }, "original": { "type": "git", diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index cb87464..ab64692 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -52,10 +52,6 @@ in { wrapper hyprpaper - pamtester # quickshell lockscreen - quickshell.packages.${system}.default - (writeShellScriptBin "quickshell-lock" "quickshell -c ${impurity.link ./lockscreen/shell.qml}") - # environment programs wl-clipboard grim diff --git a/modules/hyprland/hyprland.conf b/modules/hyprland/hyprland.conf index 4edfe64..68fc4fd 100644 --- a/modules/hyprland/hyprland.conf +++ b/modules/hyprland/hyprland.conf @@ -146,7 +146,7 @@ bind = ,XF86AudioPrev, exec, playerctl previous bind = $mod+SHIFT, s, exec, grim -g "$(slurp)" - | wl-copy -bind = $mod, PERIOD, exec, quickshell-lock +bind = $mod, PERIOD, exec, quickshell -c lockscreen bind = $mod, h, hy3:movefocus, l bind = $mod, j, hy3:movefocus, d diff --git a/modules/user/general.nix b/modules/user/general.nix index 1faa00a..7898480 100644 --- a/modules/user/general.nix +++ b/modules/user/general.nix @@ -69,6 +69,7 @@ homeConfig = homeInputs.config; in { imports = [ + ./modules/quickshell ./modules/fcitx5 ./modules/wofi ./modules/dolphin diff --git a/modules/user/modules/quickshell/default.nix b/modules/user/modules/quickshell/default.nix new file mode 100644 index 0000000..4ebb747 --- /dev/null +++ b/modules/user/modules/quickshell/default.nix @@ -0,0 +1,12 @@ +{ inputs, pkgs, lib, system, impurity, ... }: let + inherit (inputs) quickshell; +in { + home.packages = [ + quickshell.packages.${system}.default + pamtester # lockscreen + ]; + + xdg.configFile."quickshell/manifest.conf".text = lib.generators.toKeyValue {} { + lockscreen = impurity.link ./lockscreen; + }; +} diff --git a/modules/hyprland/lockscreen/AuthContext.qml b/modules/user/modules/quickshell/lockscreen/AuthContext.qml similarity index 80% rename from modules/hyprland/lockscreen/AuthContext.qml rename to modules/user/modules/quickshell/lockscreen/AuthContext.qml index 53ba63d..f5c5745 100644 --- a/modules/hyprland/lockscreen/AuthContext.qml +++ b/modules/user/modules/quickshell/lockscreen/AuthContext.qml @@ -3,11 +3,11 @@ import Quickshell import Quickshell.Io QtObject { - property int status: AuthContext.Status.FirstEntry - signal success(); + property int status: AuthContext.Status.FirstLogin + signal unlocked(); enum Status { - FirstEntry, + FirstLogin, Authenticating, LoginFailed } @@ -28,9 +28,9 @@ QtObject { onExited: { if (failed) { - status = AuthContext.Status.LoginFailed + status = AuthContext.Status.LoginFailed; } else { - success(); + unlocked(); } } } diff --git a/modules/hyprland/lockscreen/Lockscreen.qml b/modules/user/modules/quickshell/lockscreen/Lockscreen.qml similarity index 91% rename from modules/hyprland/lockscreen/Lockscreen.qml rename to modules/user/modules/quickshell/lockscreen/Lockscreen.qml index 28f424d..d9fa6d4 100644 --- a/modules/hyprland/lockscreen/Lockscreen.qml +++ b/modules/user/modules/quickshell/lockscreen/Lockscreen.qml @@ -1,7 +1,5 @@ import QtQuick import QtQuick.Controls.Universal -import QtQuick.Layouts -import Quickshell Item { required property AuthContext context @@ -43,7 +41,7 @@ Item { text: { switch (context.status) { - case AuthContext.Status.FirstEntry: return "" + case AuthContext.Status.FirstLogin: return "" case AuthContext.Status.Authenticating: return "Authenticating" case AuthContext.Status.LoginFailed: return "Login Failed" } diff --git a/modules/hyprland/lockscreen/shell.qml b/modules/user/modules/quickshell/lockscreen/shell.qml similarity index 63% rename from modules/hyprland/lockscreen/shell.qml rename to modules/user/modules/quickshell/lockscreen/shell.qml index b9abc68..0dc15c0 100644 --- a/modules/hyprland/lockscreen/shell.qml +++ b/modules/user/modules/quickshell/lockscreen/shell.qml @@ -1,26 +1,25 @@ import QtQuick -import QtQuick.Controls import Quickshell import Quickshell.Wayland ShellRoot { AuthContext { id: authContext - onSuccess: { - lock.locked = false; - Qt.quit() - } + onUnlocked: lock.locked = false } SessionLock { id: lock locked: true + onLockedChanged: { + if (!locked) Qt.quit(); + } + SessionLockSurface { - id: surface Image { anchors.fill: parent - source: screen.name == "DP-1" ? "../5120x1440.png" : "../1920x1080.png" + source: `../../../../hyprland/${screen.name == "DP-1" ? "5120x1440" : "1920x1080"}.png` } Lockscreen { diff --git a/modules/hyprland/lockscreen/test.qml b/modules/user/modules/quickshell/lockscreen/test.qml similarity index 65% rename from modules/hyprland/lockscreen/test.qml rename to modules/user/modules/quickshell/lockscreen/test.qml index 4710ae3..2917665 100644 --- a/modules/hyprland/lockscreen/test.qml +++ b/modules/user/modules/quickshell/lockscreen/test.qml @@ -4,14 +4,11 @@ import Quickshell ShellRoot { AuthContext { id: authContext - onSuccess: Qt.quit() + onUnlocked: Qt.quit() } FloatingWindow { - Image { - anchors.fill: parent - source: "../1920x1080.png" - } + color: "#303030" Lockscreen { anchors.fill: parent