feat(agsV2): separate from agsV1
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
1fc5a48bf9
commit
f522c984c4
64 changed files with 182 additions and 50 deletions
|
@ -71,7 +71,7 @@ in {
|
|||
roles.desktop = {
|
||||
user = mainUser;
|
||||
|
||||
ags.enable = true;
|
||||
ags-v2.enable = true;
|
||||
mainMonitor = "eDP-1";
|
||||
isLaptop = true;
|
||||
isTouchscreen = true;
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
});
|
||||
|
39
nixosModules/ags-v2/default.nix
Normal file
39
nixosModules/ags-v2/default.nix
Normal file
|
@ -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;
|
||||
}
|
46
nixosModules/ags-v2/hyprland.nix
Normal file
46
nixosModules/ags-v2/hyprland.nix
Normal file
|
@ -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()'"];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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 {
|
||||
home = {
|
||||
packages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "agsV2";
|
||||
programs.ags-v2.lockPkg = pkgs.writeShellApplication {
|
||||
name = "lock";
|
||||
text = ''
|
||||
export CONF="wim"
|
||||
exec ${agsFull}/bin/ags --config ${configDir} "$@"
|
||||
export CONF="lock"
|
||||
exec ${agsFull}/bin/ags --config ${agsConfigDir} "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
home = {
|
||||
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 ${configDir}
|
||||
exec ${agsFull}/bin/ags --config ${agsConfigDir}
|
||||
'';
|
||||
})
|
||||
];
|
||||
]
|
||||
++ (builtins.attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
playerctl
|
||||
pavucontrol # TODO: replace with ags widget
|
||||
;
|
||||
})
|
||||
++ (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 {
|
|
@ -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 = [
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -8,6 +8,7 @@ self: {
|
|||
in {
|
||||
imports = [
|
||||
(import ../../ags self)
|
||||
(import ../../ags-v2 self)
|
||||
|
||||
./modules/dconf.nix
|
||||
./modules/printer.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*)
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue