diff --git a/devices/wim/default.nix b/devices/wim/default.nix index d9499171..1dad5b0e 100644 --- a/devices/wim/default.nix +++ b/devices/wim/default.nix @@ -71,7 +71,7 @@ in { roles.desktop = { user = mainUser; - ags.enable = true; + ags-v2.enable = true; mainMonitor = "eDP-1"; isLaptop = true; isTouchscreen = true; diff --git a/nixosModules/ags/v2/.envrc b/nixosModules/ags-v2/config/.envrc similarity index 100% rename from nixosModules/ags/v2/.envrc rename to nixosModules/ags-v2/config/.envrc diff --git a/nixosModules/ags/v2/.gitignore b/nixosModules/ags-v2/config/.gitignore similarity index 100% rename from nixosModules/ags/v2/.gitignore rename to nixosModules/ags-v2/config/.gitignore diff --git a/nixosModules/ags/v2/app.ts b/nixosModules/ags-v2/config/app.ts similarity index 90% rename from nixosModules/ags/v2/app.ts rename to nixosModules/ags-v2/config/app.ts index 69fd1ab9..70bd0493 100644 --- a/nixosModules/ags/v2/app.ts +++ b/nixosModules/ags-v2/config/app.ts @@ -1,3 +1,4 @@ +import { execAsync } from 'astal'; import { App } from 'astal/gtk3'; import GLib from 'gi://GLib'; @@ -56,6 +57,8 @@ switch (CONF) { }, main: () => { + execAsync('hyprpaper').catch(print); + AppLauncher(); Bar(); BgFade(); @@ -74,6 +77,10 @@ switch (CONF) { caps: 'input1::capslock', }); new MonitorClicks(); + + setTimeout(() => { + App.get_window('win-applauncher')?.set_visible(true); + }, 3 * 1000); }, }); diff --git a/nixosModules/ags/v2/colors.scss b/nixosModules/ags-v2/config/colors.scss similarity index 100% rename from nixosModules/ags/v2/colors.scss rename to nixosModules/ags-v2/config/colors.scss diff --git a/nixosModules/ags/v2/env.d.ts b/nixosModules/ags-v2/config/env.d.ts similarity index 100% rename from nixosModules/ags/v2/env.d.ts rename to nixosModules/ags-v2/config/env.d.ts diff --git a/nixosModules/ags/v2/eslint.config.ts b/nixosModules/ags-v2/config/eslint.config.ts similarity index 100% rename from nixosModules/ags/v2/eslint.config.ts rename to nixosModules/ags-v2/config/eslint.config.ts diff --git a/nixosModules/ags/v2/lib.ts b/nixosModules/ags-v2/config/lib.ts similarity index 100% rename from nixosModules/ags/v2/lib.ts rename to nixosModules/ags-v2/config/lib.ts diff --git a/nixosModules/ags/v2/package-lock.json b/nixosModules/ags-v2/config/package-lock.json similarity index 100% rename from nixosModules/ags/v2/package-lock.json rename to nixosModules/ags-v2/config/package-lock.json diff --git a/nixosModules/ags/v2/package.json b/nixosModules/ags-v2/config/package.json similarity index 100% rename from nixosModules/ags/v2/package.json rename to nixosModules/ags-v2/config/package.json diff --git a/nixosModules/ags/v2/services/brightness.ts b/nixosModules/ags-v2/config/services/brightness.ts similarity index 100% rename from nixosModules/ags/v2/services/brightness.ts rename to nixosModules/ags-v2/config/services/brightness.ts diff --git a/nixosModules/ags/v2/services/monitor-clicks.ts b/nixosModules/ags-v2/config/services/monitor-clicks.ts similarity index 100% rename from nixosModules/ags/v2/services/monitor-clicks.ts rename to nixosModules/ags-v2/config/services/monitor-clicks.ts diff --git a/nixosModules/ags/v2/style.scss b/nixosModules/ags-v2/config/style.scss similarity index 100% rename from nixosModules/ags/v2/style.scss rename to nixosModules/ags-v2/config/style.scss diff --git a/nixosModules/ags/v2/widgets/applauncher/app-item.tsx b/nixosModules/ags-v2/config/widgets/applauncher/app-item.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/applauncher/app-item.tsx rename to nixosModules/ags-v2/config/widgets/applauncher/app-item.tsx diff --git a/nixosModules/ags/v2/widgets/applauncher/launch.ts b/nixosModules/ags-v2/config/widgets/applauncher/launch.ts similarity index 100% rename from nixosModules/ags/v2/widgets/applauncher/launch.ts rename to nixosModules/ags-v2/config/widgets/applauncher/launch.ts diff --git a/nixosModules/ags/v2/widgets/applauncher/main.tsx b/nixosModules/ags-v2/config/widgets/applauncher/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/applauncher/main.tsx rename to nixosModules/ags-v2/config/widgets/applauncher/main.tsx diff --git a/nixosModules/ags/v2/widgets/applauncher/style.scss b/nixosModules/ags-v2/config/widgets/applauncher/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/applauncher/style.scss rename to nixosModules/ags-v2/config/widgets/applauncher/style.scss diff --git a/nixosModules/ags/v2/widgets/bar/fullscreen.tsx b/nixosModules/ags-v2/config/widgets/bar/fullscreen.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bar/fullscreen.tsx rename to nixosModules/ags-v2/config/widgets/bar/fullscreen.tsx diff --git a/nixosModules/ags/v2/widgets/bar/items/battery.tsx b/nixosModules/ags-v2/config/widgets/bar/items/battery.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bar/items/battery.tsx rename to nixosModules/ags-v2/config/widgets/bar/items/battery.tsx diff --git a/nixosModules/ags/v2/widgets/bar/items/clock.tsx b/nixosModules/ags-v2/config/widgets/bar/items/clock.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bar/items/clock.tsx rename to nixosModules/ags-v2/config/widgets/bar/items/clock.tsx diff --git a/nixosModules/ags/v2/widgets/bar/items/current-client.tsx b/nixosModules/ags-v2/config/widgets/bar/items/current-client.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bar/items/current-client.tsx rename to nixosModules/ags-v2/config/widgets/bar/items/current-client.tsx diff --git a/nixosModules/ags/v2/widgets/bar/items/notif-button.tsx b/nixosModules/ags-v2/config/widgets/bar/items/notif-button.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bar/items/notif-button.tsx rename to nixosModules/ags-v2/config/widgets/bar/items/notif-button.tsx diff --git a/nixosModules/ags/v2/widgets/bar/items/tray.tsx b/nixosModules/ags-v2/config/widgets/bar/items/tray.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bar/items/tray.tsx rename to nixosModules/ags-v2/config/widgets/bar/items/tray.tsx diff --git a/nixosModules/ags/v2/widgets/bar/items/workspaces.tsx b/nixosModules/ags-v2/config/widgets/bar/items/workspaces.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bar/items/workspaces.tsx rename to nixosModules/ags-v2/config/widgets/bar/items/workspaces.tsx diff --git a/nixosModules/ags/v2/widgets/bar/style.scss b/nixosModules/ags-v2/config/widgets/bar/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/bar/style.scss rename to nixosModules/ags-v2/config/widgets/bar/style.scss diff --git a/nixosModules/ags/v2/widgets/bar/wim.tsx b/nixosModules/ags-v2/config/widgets/bar/wim.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bar/wim.tsx rename to nixosModules/ags-v2/config/widgets/bar/wim.tsx diff --git a/nixosModules/ags/v2/widgets/bg-fade/main.tsx b/nixosModules/ags-v2/config/widgets/bg-fade/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/bg-fade/main.tsx rename to nixosModules/ags-v2/config/widgets/bg-fade/main.tsx diff --git a/nixosModules/ags/v2/widgets/clipboard/clip-item.tsx b/nixosModules/ags-v2/config/widgets/clipboard/clip-item.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/clipboard/clip-item.tsx rename to nixosModules/ags-v2/config/widgets/clipboard/clip-item.tsx diff --git a/nixosModules/ags/v2/widgets/clipboard/cliphist.sh b/nixosModules/ags-v2/config/widgets/clipboard/cliphist.sh similarity index 100% rename from nixosModules/ags/v2/widgets/clipboard/cliphist.sh rename to nixosModules/ags-v2/config/widgets/clipboard/cliphist.sh diff --git a/nixosModules/ags/v2/widgets/clipboard/main.tsx b/nixosModules/ags-v2/config/widgets/clipboard/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/clipboard/main.tsx rename to nixosModules/ags-v2/config/widgets/clipboard/main.tsx diff --git a/nixosModules/ags/v2/widgets/clipboard/style.scss b/nixosModules/ags-v2/config/widgets/clipboard/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/clipboard/style.scss rename to nixosModules/ags-v2/config/widgets/clipboard/style.scss diff --git a/nixosModules/ags/v2/widgets/corners/main.tsx b/nixosModules/ags-v2/config/widgets/corners/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/corners/main.tsx rename to nixosModules/ags-v2/config/widgets/corners/main.tsx diff --git a/nixosModules/ags/v2/widgets/corners/screen-corners.tsx b/nixosModules/ags-v2/config/widgets/corners/screen-corners.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/corners/screen-corners.tsx rename to nixosModules/ags-v2/config/widgets/corners/screen-corners.tsx diff --git a/nixosModules/ags/v2/widgets/date/main.tsx b/nixosModules/ags-v2/config/widgets/date/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/date/main.tsx rename to nixosModules/ags-v2/config/widgets/date/main.tsx diff --git a/nixosModules/ags/v2/widgets/date/style.scss b/nixosModules/ags-v2/config/widgets/date/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/date/style.scss rename to nixosModules/ags-v2/config/widgets/date/style.scss diff --git a/nixosModules/ags/v2/widgets/icon-browser/main.tsx b/nixosModules/ags-v2/config/widgets/icon-browser/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/icon-browser/main.tsx rename to nixosModules/ags-v2/config/widgets/icon-browser/main.tsx diff --git a/nixosModules/ags/v2/widgets/icon-browser/style.scss b/nixosModules/ags-v2/config/widgets/icon-browser/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/icon-browser/style.scss rename to nixosModules/ags-v2/config/widgets/icon-browser/style.scss diff --git a/nixosModules/ags/v2/widgets/lockscreen/main.tsx b/nixosModules/ags-v2/config/widgets/lockscreen/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/lockscreen/main.tsx rename to nixosModules/ags-v2/config/widgets/lockscreen/main.tsx diff --git a/nixosModules/ags/v2/widgets/lockscreen/style.scss b/nixosModules/ags-v2/config/widgets/lockscreen/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/lockscreen/style.scss rename to nixosModules/ags-v2/config/widgets/lockscreen/style.scss diff --git a/nixosModules/ags/v2/widgets/misc/popup-window.tsx b/nixosModules/ags-v2/config/widgets/misc/popup-window.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/misc/popup-window.tsx rename to nixosModules/ags-v2/config/widgets/misc/popup-window.tsx diff --git a/nixosModules/ags/v2/widgets/misc/separator.tsx b/nixosModules/ags-v2/config/widgets/misc/separator.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/misc/separator.tsx rename to nixosModules/ags-v2/config/widgets/misc/separator.tsx diff --git a/nixosModules/ags/v2/widgets/misc/smooth-progress.tsx b/nixosModules/ags-v2/config/widgets/misc/smooth-progress.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/misc/smooth-progress.tsx rename to nixosModules/ags-v2/config/widgets/misc/smooth-progress.tsx diff --git a/nixosModules/ags/v2/widgets/misc/sorted-list.tsx b/nixosModules/ags-v2/config/widgets/misc/sorted-list.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/misc/sorted-list.tsx rename to nixosModules/ags-v2/config/widgets/misc/sorted-list.tsx diff --git a/nixosModules/ags/v2/widgets/misc/style.scss b/nixosModules/ags-v2/config/widgets/misc/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/misc/style.scss rename to nixosModules/ags-v2/config/widgets/misc/style.scss diff --git a/nixosModules/ags/v2/widgets/notifs/center.tsx b/nixosModules/ags-v2/config/widgets/notifs/center.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/notifs/center.tsx rename to nixosModules/ags-v2/config/widgets/notifs/center.tsx diff --git a/nixosModules/ags/v2/widgets/notifs/gesture.tsx b/nixosModules/ags-v2/config/widgets/notifs/gesture.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/notifs/gesture.tsx rename to nixosModules/ags-v2/config/widgets/notifs/gesture.tsx diff --git a/nixosModules/ags/v2/widgets/notifs/main.tsx b/nixosModules/ags-v2/config/widgets/notifs/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/notifs/main.tsx rename to nixosModules/ags-v2/config/widgets/notifs/main.tsx diff --git a/nixosModules/ags/v2/widgets/notifs/notification.tsx b/nixosModules/ags-v2/config/widgets/notifs/notification.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/notifs/notification.tsx rename to nixosModules/ags-v2/config/widgets/notifs/notification.tsx diff --git a/nixosModules/ags/v2/widgets/notifs/popups.tsx b/nixosModules/ags-v2/config/widgets/notifs/popups.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/notifs/popups.tsx rename to nixosModules/ags-v2/config/widgets/notifs/popups.tsx diff --git a/nixosModules/ags/v2/widgets/notifs/style.scss b/nixosModules/ags-v2/config/widgets/notifs/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/notifs/style.scss rename to nixosModules/ags-v2/config/widgets/notifs/style.scss diff --git a/nixosModules/ags/v2/widgets/osd/main.tsx b/nixosModules/ags-v2/config/widgets/osd/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/osd/main.tsx rename to nixosModules/ags-v2/config/widgets/osd/main.tsx diff --git a/nixosModules/ags/v2/widgets/osd/style.scss b/nixosModules/ags-v2/config/widgets/osd/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/osd/style.scss rename to nixosModules/ags-v2/config/widgets/osd/style.scss diff --git a/nixosModules/ags/v2/widgets/powermenu/main.tsx b/nixosModules/ags-v2/config/widgets/powermenu/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/powermenu/main.tsx rename to nixosModules/ags-v2/config/widgets/powermenu/main.tsx diff --git a/nixosModules/ags/v2/widgets/powermenu/style.scss b/nixosModules/ags-v2/config/widgets/powermenu/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/powermenu/style.scss rename to nixosModules/ags-v2/config/widgets/powermenu/style.scss diff --git a/nixosModules/ags/v2/widgets/screenshot/main.tsx b/nixosModules/ags-v2/config/widgets/screenshot/main.tsx similarity index 100% rename from nixosModules/ags/v2/widgets/screenshot/main.tsx rename to nixosModules/ags-v2/config/widgets/screenshot/main.tsx diff --git a/nixosModules/ags/v2/widgets/screenshot/style.scss b/nixosModules/ags-v2/config/widgets/screenshot/style.scss similarity index 100% rename from nixosModules/ags/v2/widgets/screenshot/style.scss rename to nixosModules/ags-v2/config/widgets/screenshot/style.scss diff --git a/nixosModules/ags-v2/default.nix b/nixosModules/ags-v2/default.nix new file mode 100644 index 00000000..08aeea38 --- /dev/null +++ b/nixosModules/ags-v2/default.nix @@ -0,0 +1,39 @@ +self: { + config, + lib, + pkgs, + ... +}: { + config = let + inherit (lib) hasPrefix mkIf removePrefix; + + # Configs + cfgDesktop = config.roles.desktop; + flakeDir = config.environment.variables.FLAKE; + + agsConfigDir = "${removePrefix "/home/${cfgDesktop.user}/" flakeDir}/nixosModules/ags-v2/config"; + in + mkIf cfgDesktop.ags-v2.enable { + assertions = [ + { + assertion = hasPrefix "/home/${cfgDesktop.user}/" flakeDir; + message = '' + Your $FLAKE environment variable needs to point to a directory in + the main users' home to use the AGS module. + ''; + } + ]; + + # Machine config + security.pam.services.astal-auth = {}; + services.upower.enable = true; + + home-manager.users.${cfgDesktop.user}.imports = [ + (import ./packages.nix {inherit self agsConfigDir;}) + ./hyprland.nix + ]; + }; + + # For accurate stack trace + _file = ./default.nix; +} diff --git a/nixosModules/ags-v2/hyprland.nix b/nixosModules/ags-v2/hyprland.nix new file mode 100644 index 00000000..d09ddaaa --- /dev/null +++ b/nixosModules/ags-v2/hyprland.nix @@ -0,0 +1,46 @@ +{...}: { + wayland.windowManager.hyprland = { + settings = { + animations = { + bezier = [ + "easeInOutQuart, 0.77, 0 , 0.175, 1" + "easeInExpo , 0.95, 0.05, 0.795, 0.035" + ]; + + animation = [ + "fadeLayersIn , 0" + "fadeLayersOut, 1, 3000, easeInExpo" + "layers , 1, 4 , easeInOutQuart, slide left" + ]; + }; + + layerrule = [ + "noanim, ^(?!win-).*" + + # Lockscreen blur + "blur, ^(blur-bg.*)" + "ignorealpha 0.19, ^(blur-bg.*)" + ]; + + exec-once = ["ags"]; + + bind = [ + "$mainMod SHIFT, E , exec, ags -t win-powermenu" + "$mainMod , D , exec, ags -t win-applauncher" + "$mainMod , V , exec, ags -t win-clipboard" + " , Print, exec, ags -t win-screenshot" + ]; + binde = [ + ## Brightness control + ", XF86MonBrightnessUp , exec, ags -m 'Brightness.screen += 0.05'" + ", XF86MonBrightnessDown, exec, ags -m 'Brightness.screen -= 0.05'" + + ## Volume control + ", XF86AudioRaiseVolume , exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ & ags -m 'popup_osd(\"speaker\")' &" + ", XF86AudioLowerVolume , exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- & ags -m 'popup_osd(\"speaker\")' &" + ]; + bindn = [" , Escape , exec, ags -m 'closeAll()'"]; + bindr = ["CAPS, Caps_Lock, exec, ags -m 'Brightness.fetchCapsState()'"]; + }; + }; +} diff --git a/nixosModules/ags/v2/default.nix b/nixosModules/ags-v2/packages.nix similarity index 52% rename from nixosModules/ags/v2/default.nix rename to nixosModules/ags-v2/packages.nix index 89d69ec9..164f2acb 100644 --- a/nixosModules/ags/v2/default.nix +++ b/nixosModules/ags-v2/packages.nix @@ -1,41 +1,75 @@ -self: { +{ + self, + agsConfigDir, +}: { lib, osConfig, pkgs, ... }: { + options.programs.ags-v2.lockPkg = lib.mkOption { + type = with lib.types; nullOr package; + default = null; + }; + config = let - inherit (lib) attrValues boolToString removeAttrs; - - inherit (osConfig.vars) hostName; - cfgDesktop = osConfig.roles.desktop; - + # Inputs inherit (self.inputs) agsV2 gtk-session-lock; - gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default; + # Libs + inherit (lib) attrValues boolToString optionals removeAttrs; + # Cfg info + inherit (osConfig.networking) hostName; + cfgDesktop = osConfig.roles.desktop; + + # Astal libraries + gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default; agsV2Packages = agsV2.packages.${pkgs.system}; astalLibs = attrValues (removeAttrs agsV2.inputs.astal.packages.${pkgs.system} ["docs" "gjs"]) ++ [gtkSessionLock]; + + # Final ags package agsFull = agsV2Packages.ags.override {extraPackages = astalLibs;}; - configDir = "/home/matt/.nix/nixosModules/ags/v2"; in { + programs.ags-v2.lockPkg = pkgs.writeShellApplication { + name = "lock"; + text = '' + export CONF="lock" + exec ${agsFull}/bin/ags --config ${agsConfigDir} "$@" + ''; + }; + home = { - packages = [ - (pkgs.writeShellApplication { - name = "agsV2"; - text = '' - export CONF="wim" - exec ${agsFull}/bin/ags --config ${configDir} "$@" - ''; + packages = + [ + (pkgs.writeShellApplication { + name = "ags"; + text = '' + export CONF="${hostName}" + exec ${agsFull}/bin/ags --config ${agsConfigDir} "$@" + ''; + }) + (pkgs.writeShellApplication { + name = "agsConf"; + text = '' + export CONF="$1" + exec ${agsFull}/bin/ags --config ${agsConfigDir} + ''; + }) + ] + ++ (builtins.attrValues { + inherit + (pkgs) + playerctl + pavucontrol # TODO: replace with ags widget + ; }) - (pkgs.writeShellApplication { - name = "agsConf"; - text = '' - export CONF="$1" - exec ${agsFull}/bin/ags --config ${configDir} - ''; - }) - ]; + ++ (optionals cfgDesktop.isTouchscreen (builtins.attrValues { + inherit + (pkgs) + ydotool + ; + })); file = let inherit @@ -46,14 +80,14 @@ self: { in ( (buildNodeTypes { pname = "agsV2"; - configPath = "${configDir}/@girs"; + configPath = "${agsConfigDir}/@girs"; packages = astalLibs; }) // { - "${configDir}/node_modules".source = - buildNodeModules ./. "sha256-pK9S6qUjTIL0JDegYJlHSY5XEpLFKfA98MfZ59Q3IL4="; + "${agsConfigDir}/node_modules".source = + buildNodeModules ./config "sha256-pK9S6qUjTIL0JDegYJlHSY5XEpLFKfA98MfZ59Q3IL4="; - "${configDir}/tsconfig.json".source = pkgs.writers.writeJSON "tsconfig.json" { + "${agsConfigDir}/tsconfig.json".source = pkgs.writers.writeJSON "tsconfig.json" { "$schema" = "https://json.schemastore.org/tsconfig"; "compilerOptions" = { "experimentalDecorators" = true; @@ -72,7 +106,7 @@ self: { }; }; - "${configDir}/widgets/lockscreen/vars.ts".text = + "${agsConfigDir}/widgets/lockscreen/vars.ts".text = # javascript '' export default { diff --git a/nixosModules/ags/default.nix b/nixosModules/ags/default.nix index c35a3807..1eceafdd 100644 --- a/nixosModules/ags/default.nix +++ b/nixosModules/ags/default.nix @@ -19,10 +19,7 @@ in { gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default; in mkIf cfgDesktop.ags.enable { - # Enable pam for ags security.pam.services.ags = {}; - security.pam.services.astal-auth = {}; - services.upower.enable = true; home-manager.users.${cfgDesktop.user}.imports = [ @@ -59,8 +56,6 @@ in { } ]; - imports = [(import ./v2 self)]; - programs.ags = { enable = true; extraPackages = [ diff --git a/nixosModules/desktop/default.nix b/nixosModules/desktop/default.nix index 0b6e8f9e..1f1e91be 100644 --- a/nixosModules/desktop/default.nix +++ b/nixosModules/desktop/default.nix @@ -44,6 +44,14 @@ in { ''; }; + ags-v2.enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether we want to enable AGSv2 for the DE shell. + ''; + }; + mainMonitor = mkOption { type = types.str; description = '' diff --git a/nixosModules/desktop/environment/default.nix b/nixosModules/desktop/environment/default.nix index b232ef0c..70ad4d81 100644 --- a/nixosModules/desktop/environment/default.nix +++ b/nixosModules/desktop/environment/default.nix @@ -8,6 +8,7 @@ self: { in { imports = [ (import ../../ags self) + (import ../../ags-v2 self) ./modules/dconf.nix ./modules/printer.nix diff --git a/nixosModules/desktop/environment/modules/security.nix b/nixosModules/desktop/environment/modules/security.nix index 1a873006..6f5dc8ca 100644 --- a/nixosModules/desktop/environment/modules/security.nix +++ b/nixosModules/desktop/environment/modules/security.nix @@ -10,14 +10,26 @@ cfg = config.roles.desktop; hmCfg = config.home-manager.users.${cfg.user}; - agsPkg = hmCfg.programs.ags.finalPackage; hyprPkg = hmCfg.wayland.windowManager.hyprland.finalPackage; + lockPkg = + if cfg.ags.enable + then + pkgs.writeShellApplication { + name = "lock"; + runtimeInputs = [hmCfg.programs.ags.finalPackage]; + + text = '' + ags -r 'Tablet.setLaptopMode()' + ags -b lockscreen -c /home/${cfg.user}/.config/ags/lockscreen.js + ''; + } + else hmCfg.programs.ags-v2.lockPkg; + runInDesktop = pkgs.writeShellApplication { name = "runInDesktop"; runtimeInputs = [ pkgs.sudo - agsPkg hyprPkg ]; @@ -38,18 +50,6 @@ done ''; }; - - lockPkg = pkgs.writeShellApplication { - name = "lock"; - runtimeInputs = [ - agsPkg - ]; - - text = '' - ags -r 'Tablet.setLaptopMode()' - ags -b lockscreen -c /home/${cfg.user}/.config/ags/lockscreen.js - ''; - }; in { services.acpid = mkIf cfg.isLaptop { enable = true; @@ -62,7 +62,7 @@ case "$state" in *open*) - ${getExe runInDesktop} "ags -b lockscreen -r 'authFinger()'" + ${getExe runInDesktop} "${getExe lockPkg} -m 'authFinger()'" ;; *close*) diff --git a/nixosModules/desktop/manager/ags/default.nix b/nixosModules/desktop/manager/ags/default.nix index bcf99739..e1f8edfd 100644 --- a/nixosModules/desktop/manager/ags/default.nix +++ b/nixosModules/desktop/manager/ags/default.nix @@ -29,7 +29,9 @@ in { home-manager.users.${cfg.user}.home.file = let flakeDir = config.environment.variables.FLAKE; modulesDir = "${lib.removePrefix "/home/${cfg.user}/" flakeDir}/nixosModules"; - nodeModules = config.home-manager.users.${cfg.user}.home.file."${modulesDir}/ags/config/node_modules".source; + nodeModules = + config.home-manager.users.${cfg.user}.home.file."${modulesDir}/ags/config/node_modules".source + or config.home-manager.users.${cfg.user}.home.file."${modulesDir}/ags-v2/config/node_modules".source; in { "${modulesDir}/desktop/manager/ags/node_modules".source = nodeModules; };