refactor(greetd): astal -> ags
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
aa979f0fe4
commit
85ff6af1bf
24 changed files with 142 additions and 198 deletions
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
|
@ -162,11 +162,6 @@ let
|
|||
owner = "Cu3PO42";
|
||||
repo = "gtk-session-lock";
|
||||
};
|
||||
|
||||
astal = mkDep {
|
||||
owner = "Aylur";
|
||||
repo = "Astal";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
astalTray = astal-tray.packages.${pkgs.system}.tray;
|
||||
gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default;
|
||||
in {
|
||||
# Enable pam for ags and astal
|
||||
# Enable pam for ags
|
||||
security.pam.services.ags = {};
|
||||
|
||||
services.upower.enable = true;
|
||||
|
@ -40,6 +40,8 @@ in {
|
|||
configJs =
|
||||
# javascript
|
||||
''
|
||||
Utils.execAsync('hyprpaper');
|
||||
|
||||
import { transpileTypeScript } from './js/utils.js';
|
||||
|
||||
export default (await transpileTypeScript('${hostName}')).default;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
inherit (config.vars) configDir;
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cursorTheme = self.legacyPackages.${pkgs.system}.dracula.hyprcursor;
|
||||
cursorThemeName = "Dracula-cursors";
|
||||
|
@ -19,7 +20,8 @@ in {
|
|||
home.file.".local/share/icons/${hyprcursorThemeName}".source = cursorTheme;
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
settings = {
|
||||
settings =
|
||||
{
|
||||
envd = [
|
||||
"XCURSOR_THEME, ${cursorThemeName}"
|
||||
"XCURSOR_SIZE, ${cursorSize}"
|
||||
|
@ -27,7 +29,6 @@ in {
|
|||
|
||||
exec-once = [
|
||||
"hyprctl setcursor ${hyprcursorThemeName} ${cursorSize}"
|
||||
"hyprpaper"
|
||||
];
|
||||
|
||||
windowrule = [
|
||||
|
@ -41,9 +42,12 @@ in {
|
|||
layerrule = [
|
||||
"noanim, selection"
|
||||
];
|
||||
|
||||
}
|
||||
// (
|
||||
mkIf (config.home.username != "greeter") {
|
||||
# This file should only be used for theming
|
||||
source = ["${configDir}/hypr/main.conf"];
|
||||
};
|
||||
source = ["${config.vars.configDir}/hypr/main.conf"];
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
1
modules/desktop/display-manager/ags/.envrc
Symbolic link
1
modules/desktop/display-manager/ags/.envrc
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../ags/config/.envrc
|
67
modules/desktop/display-manager/ags/default.nix
Normal file
67
modules/desktop/display-manager/ags/default.nix
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
ags,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.roles.desktop;
|
||||
|
||||
hyprland =
|
||||
config
|
||||
.home-manager
|
||||
.users
|
||||
.${cfg.user}
|
||||
.wayland
|
||||
.windowManager
|
||||
.hyprland
|
||||
.finalPackage;
|
||||
in {
|
||||
# Add home folder for home-manager to work
|
||||
users.users.greeter = {
|
||||
home = "/var/lib/greeter";
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
home-manager.users.greeter = {
|
||||
imports = [ags.homeManagerModules.default];
|
||||
|
||||
programs.ags.enable = true;
|
||||
|
||||
home.packages = [
|
||||
hyprland
|
||||
pkgs.gtk3
|
||||
pkgs.glib
|
||||
];
|
||||
|
||||
xdg.configFile = {
|
||||
"ags".source = pkgs.stdenv.mkDerivation {
|
||||
name = "ags-greeter";
|
||||
src = lib.fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = lib.fileset.unions [
|
||||
./scss
|
||||
./greeter.ts
|
||||
./ts
|
||||
./tsconfig.json
|
||||
];
|
||||
};
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
bun
|
||||
dart-sass
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
sass ./scss/greeter.scss style.css
|
||||
bun build ./greeter.ts --external resource:///* --external gi://* --external cairo > config.js
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
mv style.css config.js $out/
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
1
modules/desktop/display-manager/ags/eslint.config.js
Symbolic link
1
modules/desktop/display-manager/ags/eslint.config.js
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../ags/config/eslint.config.js
|
11
modules/desktop/display-manager/ags/greeter.ts
Normal file
11
modules/desktop/display-manager/ags/greeter.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
Utils.execAsync('hyprpaper');
|
||||
|
||||
import Greeter from './ts/greetd/main.ts';
|
||||
|
||||
App.config({
|
||||
style: './style.css',
|
||||
|
||||
windows: () => [
|
||||
Greeter(),
|
||||
],
|
||||
});
|
1
modules/desktop/display-manager/ags/package-lock.json
generated
Symbolic link
1
modules/desktop/display-manager/ags/package-lock.json
generated
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../ags/config/package-lock.json
|
1
modules/desktop/display-manager/ags/package.json
Symbolic link
1
modules/desktop/display-manager/ags/package.json
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../ags/config/package.json
|
|
@ -7,9 +7,6 @@ const { Gtk } = imports.gi;
|
|||
|
||||
const DEFAULT_NAME = 'matt';
|
||||
|
||||
// Types
|
||||
import { StringObject } from 'types/@girs/gtk-4.0/gtk-4.0.cjs';
|
||||
|
||||
|
||||
const parsePasswd = (fileContent: string) => {
|
||||
const splitUsers = fileContent.split('\n');
|
||||
|
@ -35,7 +32,11 @@ const parsePasswd = (fileContent: string) => {
|
|||
};
|
||||
const users = parsePasswd(await readFileAsync('/etc/passwd'));
|
||||
|
||||
const dropdown = Gtk.DropDown.new_from_strings(users.map((u) => u.name));
|
||||
const dropdown = new Gtk.ComboBoxText();
|
||||
|
||||
users.forEach((u) => {
|
||||
dropdown.append(null, u.name);
|
||||
});
|
||||
|
||||
const password = Entry({
|
||||
placeholderText: 'Password',
|
||||
|
@ -47,7 +48,7 @@ const password = Entry({
|
|||
|
||||
on_accept: () => {
|
||||
greetd.login(
|
||||
(dropdown.selectedItem as StringObject)['string'] || '',
|
||||
dropdown.get_active_text() ?? '',
|
||||
password.text || '',
|
||||
'Hyprland',
|
||||
|
||||
|
@ -70,7 +71,7 @@ export default () => Window({
|
|||
vpack: 'center',
|
||||
hexpand: true,
|
||||
vexpand: true,
|
||||
cssClasses: ['base'],
|
||||
class_names: ['base'],
|
||||
|
||||
children: [
|
||||
Box({
|
||||
|
@ -79,23 +80,14 @@ export default () => Window({
|
|||
vpack: 'center',
|
||||
hexpand: true,
|
||||
vexpand: true,
|
||||
class_names: ['linked'],
|
||||
|
||||
setup: (self) => {
|
||||
self.add_css_class('linked');
|
||||
|
||||
setup: () => {
|
||||
idle(() => {
|
||||
const usernames = [] as string[];
|
||||
|
||||
for (let i = 0; i < dropdown.model.get_n_items(); ++i) {
|
||||
const name = (dropdown.model.get_item(i) as StringObject)['string'];
|
||||
|
||||
if (name) {
|
||||
usernames.push(name);
|
||||
}
|
||||
}
|
||||
const usernames = users.map((u) => u.name);
|
||||
|
||||
if (usernames.includes(DEFAULT_NAME)) {
|
||||
dropdown.set_selected(usernames.indexOf(DEFAULT_NAME));
|
||||
dropdown.set_active(usernames.indexOf(DEFAULT_NAME));
|
||||
}
|
||||
});
|
||||
},
|
|
@ -2,22 +2,24 @@
|
|||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"lib": [
|
||||
"ES2022"
|
||||
],
|
||||
"lib": ["ES2022"],
|
||||
"noEmit": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"strict": true,
|
||||
"noImplicitAny": false,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"gi://Adw": ["./node_modules/@girs/adw-1/adw-1.d.ts"],
|
||||
"gi://Adw?version=1": ["./node_modules/@girs/adw-1/adw-1.d.ts"]
|
||||
"fzf": ["./node_modules/fzf/dist/types"]
|
||||
},
|
||||
"typeRoots": [
|
||||
"./types",
|
||||
"./global-types.d.ts",
|
||||
"./node_modules"
|
||||
],
|
||||
"skipLibCheck": true
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
{
|
||||
astal,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.roles.desktop;
|
||||
|
||||
hyprland =
|
||||
config
|
||||
.home-manager
|
||||
.users
|
||||
.${cfg.user}
|
||||
.wayland
|
||||
.windowManager
|
||||
.hyprland
|
||||
.finalPackage;
|
||||
in {
|
||||
# Add home folder for home-manager to work
|
||||
users.users.greeter = {
|
||||
home = "/var/lib/greeter";
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
home-manager.users.greeter = {
|
||||
imports = [
|
||||
astal.homeManagerModules.default
|
||||
../home/theme
|
||||
../home/hyprpaper.nix
|
||||
];
|
||||
|
||||
programs.astal.enable = true;
|
||||
|
||||
home.packages = [
|
||||
hyprland
|
||||
pkgs.bun
|
||||
pkgs.dart-sass
|
||||
pkgs.gtk3
|
||||
pkgs.glib
|
||||
];
|
||||
|
||||
xdg.configFile = {
|
||||
"astal" = {
|
||||
source = ./astal;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
"astal/config.js".text =
|
||||
# javascript
|
||||
''
|
||||
import { transpileTypeScript } from './js/utils.js';
|
||||
|
||||
Utils.execAsync('hyprpaper');
|
||||
|
||||
export default (await transpileTypeScript('greeter')).default;
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
use flake $FLAKE#node
|
|
@ -1 +0,0 @@
|
|||
../../../ags/config/.eslintrc.json
|
|
@ -1 +0,0 @@
|
|||
../../../ags/config/.stylelintrc.yml
|
|
@ -1,7 +0,0 @@
|
|||
import Greeter from './ts/greetd/main';
|
||||
|
||||
App.config({
|
||||
windows: () => [
|
||||
Greeter(),
|
||||
],
|
||||
});
|
|
@ -1,47 +0,0 @@
|
|||
const { execAsync, monitorFile } = Utils;
|
||||
|
||||
|
||||
/** @param {string} host */
|
||||
const watchAndCompileSass = (host) => {
|
||||
const reloadCss = () => {
|
||||
const scss = `${App.configDir}/scss/${host}.scss`;
|
||||
const css = `/tmp/astal-${host}/style.css`;
|
||||
|
||||
execAsync(`sass ${scss} ${css}`).then(() => {
|
||||
App.resetCss();
|
||||
App.applyCss(css);
|
||||
}).catch(print);
|
||||
};
|
||||
|
||||
monitorFile(
|
||||
`${App.configDir}/scss`,
|
||||
reloadCss,
|
||||
);
|
||||
reloadCss();
|
||||
};
|
||||
|
||||
/** @param {string} host */
|
||||
export const transpileTypeScript = async(host) => {
|
||||
const outPath = `/tmp/astal-${host}/index.js`;
|
||||
|
||||
await execAsync([
|
||||
'bash', '-c',
|
||||
// Create the dir if it doesn't exist
|
||||
`mkdir -p /tmp/astal-${host}; ` +
|
||||
|
||||
// Let bun see tsconfig.json
|
||||
`cd ${App.configDir};` +
|
||||
|
||||
`bun build ${App.configDir}/${host}.ts ` +
|
||||
'--external resource:///* ' +
|
||||
'--external gi://* ' +
|
||||
'--external cairo ' +
|
||||
|
||||
// Since bun wants to write in cwd, we just redirect stdin instead
|
||||
`> ${outPath}`,
|
||||
]).catch(print);
|
||||
|
||||
watchAndCompileSass(host);
|
||||
|
||||
return await import(`file://${outPath}`);
|
||||
};
|
BIN
modules/desktop/display-manager/astal/package-lock.json
generated
BIN
modules/desktop/display-manager/astal/package-lock.json
generated
Binary file not shown.
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"main": "config.js",
|
||||
"dependencies": {
|
||||
"fzf": "^0.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@girs/adw-1": "^1.4.3-3.2.9",
|
||||
"@stylistic/eslint-plugin": "^1.4.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
||||
"@typescript-eslint/parser": "^6.9.1",
|
||||
"eslint": "^8.52.0"
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@
|
|||
'');
|
||||
in {
|
||||
imports = [
|
||||
./astal.nix
|
||||
./ags
|
||||
./hyprland.nix
|
||||
];
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
devices = filterAttrs (n: v: hasPrefix "device:" n) cfgHypr.settings;
|
||||
in {
|
||||
home-manager.users.greeter = {
|
||||
imports = [../desktop-environment/home/style.nix];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
package = cfgHypr.finalPackage;
|
||||
|
@ -32,16 +34,12 @@ in {
|
|||
{
|
||||
inherit (cfgHypr.settings) cursor input misc monitor;
|
||||
|
||||
envd =
|
||||
(optionals (config.nvidia.enable) [
|
||||
envd = optionals (config.nvidia.enable) [
|
||||
"LIBVA_DRIVER_NAME, nvidia"
|
||||
"NVD_BACKEND, direct"
|
||||
"XDG_SESSION_TYPE, wayland"
|
||||
"GBM_BACKEND, nvidia-drm"
|
||||
"__GLX_VENDOR_LIBRARY_NAME, nvidia"
|
||||
])
|
||||
++ [
|
||||
"XCURSOR_SIZE,24"
|
||||
];
|
||||
|
||||
general.border_size = 0;
|
||||
|
@ -52,10 +50,8 @@ in {
|
|||
};
|
||||
|
||||
exec-once = [
|
||||
"hyprctl setcursor Dracula-cursors 24"
|
||||
|
||||
setupMonitors
|
||||
"astal -b greeter &> /tmp/astal.log; hyprctl dispatch exit"
|
||||
"ags -b greeter &> /tmp/ags-greetd.log; hyprctl dispatch exit"
|
||||
];
|
||||
}
|
||||
// devices;
|
||||
|
|
Loading…
Reference in a new issue