nixos-configs/modules/ags/default.nix
matt1432 06a8d50fb1
All checks were successful
Discord / discord commits (push) Has been skipped
feat(ags): add gtk4 version of ags astal
2024-03-05 19:37:09 -05:00

104 lines
2.7 KiB
Nix

{
ags,
astal,
config,
pkgs,
...
}: let
inherit (config.vars) mainUser hostName;
isTouchscreen = config.hardware.sensor.iio.enable;
in {
# Enable pam for ags and astal
security.pam.services.ags = {};
security.pam.services.astal = {};
services.upower.enable = true;
home-manager.users.${mainUser}.imports = [
ags.homeManagerModules.default
astal.homeManagerModules.default
({
config,
lib,
...
}: let
symlink = config.lib.file.mkOutOfStoreSymlink;
inherit (lib) optionals;
# https://github.com/Aylur/ags/blob/e1f2d311ceb496a69ef6daa6aebb46ce511b2f22/nix/hm-module.nix#L69
agsTypes = config.home.file.".local//share/com.github.Aylur.ags/types";
agsConfigDir = ".nix/modules/ags/config";
in {
# Experimental Gtk4 ags
programs.astal = {
enable = true;
extraPackages = with pkgs; [
libadwaita
];
};
programs.ags.enable = true;
home = {
file =
{
".config/ags".source = symlink /home/${mainUser}/.nix/modules/ags/config;
"${agsConfigDir}/types".source = agsTypes.source;
"${agsConfigDir}/config.js".text =
/*
javascript
*/
''
import { transpileTypeScript } from './js/utils.js';
export default (await transpileTypeScript('${hostName}')).default;
'';
}
// (import ./icons.nix {inherit pkgs agsConfigDir;});
packages =
[config.customPkgs.coloryou]
++ (with pkgs; [
# ags
sassc
bun
playerctl
## gui
pavucontrol # TODO: replace with ags widget
])
++ (optionals isTouchscreen (with pkgs; [
lisgd
squeekboard
ydotool
]));
};
wayland.windowManager.hyprland = {
settings = {
exec-once =
[
"ags"
"sleep 3; ags -r 'App.openWindow(\"applauncher\")'"
]
++ optionals isTouchscreen ["squeekboard"];
bind = [
"$mainMod SHIFT, E , exec, ags -t powermenu"
"$mainMod , D , exec, ags -t applauncher"
];
binde = [
## Brightness control
", XF86MonBrightnessUp, exec, ags -r 'Brightness.screen += 0.05'"
", XF86MonBrightnessDown, exec, ags -r 'Brightness.screen -= 0.05'"
];
bindn = [",Escape, exec, ags run-js 'closeAll()'"];
bindr = ["CAPS, Caps_Lock, exec, ags -r 'Brightness.fetchCapsState()'"];
};
};
})
];
}