Compare commits

..
7 Commits
Author SHA1 Message Date
pascalyazid a614f9190a refactor(controls): type monitor prop as Gdk.Monitor 2026-11-27 18:55:33 +01:00
pascalyazid 2be30164a0 fix(power-menu): sign out through uwsm
Use uwsm stop for Sign Out so the session shuts down cleanly, and pass systemctl and uwsm commands as argument arrays.
2026-11-27 18:55:33 +01:00
pascalyazid 2913fb020f perf(media): stop vinyl animation when hidden
Only run the rotation timer while the record is mapped and playing, and clean up the map and unmap handlers.
2026-11-27 18:55:33 +01:00
pascalyazid 38c6ce5812 perf(quicksettings): poll VPNs only while the popover is open
Replace the always-on 2s nmcli poll with a shared poller that runs only while Quick Settings is visible, coalesce refreshes, and reuse the Bluetooth power binding.
2026-11-27 18:55:33 +01:00
pascalyazid a1cea0e3be feat(greeter): add themed greetd login screen
- Add an AstalGreet login UI with PAM messages, reboot and shutdown.

- Run it under cage via start-greeter.sh and start a uwsm-managed Hyprland session.

- Include install script, polkit rule, fallback theme and README.
2026-11-27 18:55:33 +01:00
pascalyazid 8aea20ea9f feat(theme): sync shell palette with greetd greeter
- Export compiled greeter CSS and wallpaper to /var/tmp for the greeter user.

- Serialize theme changes so rapid switches cannot race wal and sass.

- Avoid duplicate greeter export on startup and disable sass source maps.

- Pass command arguments as arrays and use forEach when creating windows.
2026-11-27 18:55:33 +01:00
pascalyazid 628ebb13ba chore(deps): update dev dependencies and lockfile
Bump eslint and typescript-eslint, drop the ags file dependency, and refresh bun.lock.
2026-11-27 18:55:33 +01:00
13 changed files with 1029 additions and 74 deletions

No files matched your search

+4 -4
View File
@@ -12,18 +12,18 @@ const colorsPath = `${HOME}/.cache/wal/colors.scss`
if (!GLib.file_test(colorsPath, GLib.FileTest.EXISTS)) {
const agsDir = `${HOME}/.config/ags`
exec(`wal -q -n -i ${agsDir}/pywal.jpg`)
exec(["wal", "-q", "-n", "-i", `${agsDir}/pywal.jpg`])
}
const scss = `${HOME}/.config/ags/style.scss`
const css = `/tmp/ags-compiled-style.css`
exec(`sass ${scss} ${css}`)
exec(["sass", "--no-source-map", scss, css])
app.start({
css: css,
main() {
restoreTheme()
app.get_monitors().map(Bar)
app.get_monitors().map(PowerMenu)
app.get_monitors().forEach(Bar)
app.get_monitors().forEach(PowerMenu)
},
})
+81 -26
View File
@@ -4,7 +4,6 @@
"workspaces": {
"": {
"dependencies": {
"ags": "*",
"gnim": "*",
"prettier": "^3.8.1",
},
@@ -12,36 +11,48 @@
"@eslint/js": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^8.57.2",
"@typescript-eslint/parser": "^8.57.2",
"eslint": "^10.1.0",
"typescript-eslint": "^8.57.2",
"eslint": "^10.16.0",
"typescript-eslint": "^8.74.0",
},
},
},
"packages": {
"@cacheable/memory": ["@cacheable/memory@2.2.0", "", { "dependencies": { "@cacheable/utils": "^2.5.0", "@keyv/bigmap": "^1.3.1", "hookified": "^1.15.1", "keyv": "^5.6.0" } }, "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ=="],
"@cacheable/utils": ["@cacheable/utils@2.5.0", "", { "dependencies": { "hashery": "^1.5.1", "keyv": "^5.6.0" } }, "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA=="],
"@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="],
"@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.2", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],
"@eslint/config-array": ["@eslint/config-array@0.23.3", "", { "dependencies": { "@eslint/object-schema": "^3.0.3", "debug": "^4.3.1", "minimatch": "^10.2.4" } }, "sha512-j+eEWmB6YYLwcNOdlwQ6L2OsptI/LO6lNBuLIqe5R7RetD658HLoF+Mn7LzYmAWWNNzdC6cqP+L6r8ujeYXWLw=="],
"@eslint/config-array": ["@eslint/config-array@0.23.7", "", { "dependencies": { "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", "minimatch": "^11.0.5" } }, "sha512-Ix1tmZjA7/OmE7ROAfORe83hVnqlDzLpZVHFjHQt5mvLm1U03qMexpaxKqFIL362QV32SoPaZqmKQr3tdqFY2w=="],
"@eslint/config-helpers": ["@eslint/config-helpers@0.5.3", "", { "dependencies": { "@eslint/core": "^1.1.1" } }, "sha512-lzGN0onllOZCGroKJmRwY6QcEHxbjBw1gwB8SgRSqK8YbbtEXMvKynsXc3553ckIEBxsbMBU7oOZXKIPGZNeZw=="],
"@eslint/config-helpers": ["@eslint/config-helpers@0.7.0", "", { "dependencies": { "@eslint/core": "^1.2.1" } }, "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw=="],
"@eslint/core": ["@eslint/core@1.1.1", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-QUPblTtE51/7/Zhfv8BDwO0qkkzQL7P/aWWbqcf4xWLEYn1oKjdO0gglQBB4GAsu7u6wjijbCmzsUTy6mnk6oQ=="],
"@eslint/core": ["@eslint/core@1.2.1", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ=="],
"@eslint/js": ["@eslint/js@10.0.1", "", { "peerDependencies": { "eslint": "^10.0.0" } }, "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA=="],
"@eslint/object-schema": ["@eslint/object-schema@3.0.3", "", {}, "sha512-iM869Pugn9Nsxbh/YHRqYiqd23AmIbxJOcpUMOuWCVNdoQJ5ZtwL6h3t0bcZzJUlC3Dq9jCFCESBZnX0GTv7iQ=="],
"@eslint/object-schema": ["@eslint/object-schema@3.0.5", "", {}, "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw=="],
"@eslint/plugin-kit": ["@eslint/plugin-kit@0.6.1", "", { "dependencies": { "@eslint/core": "^1.1.1", "levn": "^0.4.1" } }, "sha512-iH1B076HoAshH1mLpHMgwdGeTs0CYwL0SPMkGuSebZrwBp16v415e9NZXg2jtrqPVQjf6IANe2Vtlr5KswtcZQ=="],
"@eslint/plugin-kit": ["@eslint/plugin-kit@0.7.3", "", { "dependencies": { "@eslint/core": "^1.2.1", "levn": "^0.4.1" } }, "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q=="],
"@humanfs/core": ["@humanfs/core@0.19.1", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="],
"@humanfs/core": ["@humanfs/core@0.19.2", "", { "dependencies": { "@humanfs/types": "^0.15.0" } }, "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA=="],
"@humanfs/node": ["@humanfs/node@0.16.7", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ=="],
"@humanfs/node": ["@humanfs/node@0.16.8", "", { "dependencies": { "@humanfs/core": "^0.19.2", "@humanfs/types": "^0.15.0", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ=="],
"@humanfs/types": ["@humanfs/types@0.15.0", "", {}, "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q=="],
"@humanwhocodes/module-importer": ["@humanwhocodes/module-importer@1.0.1", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="],
"@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.3", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="],
"@isaacs/nonrecursive-glob-match": ["@isaacs/nonrecursive-glob-match@1.1.0", "", {}, "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw=="],
"@keyv/bigmap": ["@keyv/bigmap@1.3.1", "", { "dependencies": { "hashery": "^1.4.0", "hookified": "^1.15.0" }, "peerDependencies": { "keyv": "^5.6.0" } }, "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ=="],
"@keyv/serialize": ["@keyv/serialize@1.1.1", "", {}, "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA=="],
"@types/esrecurse": ["@types/esrecurse@4.3.1", "", {}, "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw=="],
"@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
@@ -72,13 +83,13 @@
"acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="],
"ags": ["ags@file:../../../../usr/share/ags/js", { "devDependencies": { "@eslint/js": "latest", "eslint": "^9.39.1", "typescript": "^5.9.3", "typescript-eslint": "^8.48.0" }, "peerDependencies": { "gnim": "^1.9.0" }, "os": "linux" }],
"ajv": ["ajv@6.14.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="],
"balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
"brace-expansion": ["brace-expansion@5.0.5", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ=="],
"brace-expansion": ["brace-expansion@5.1.0", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg=="],
"cacheable": ["cacheable@2.5.0", "", { "dependencies": { "@cacheable/memory": "^2.2.0", "@cacheable/utils": "^2.5.0", "hookified": "^1.15.0", "keyv": "^5.6.0", "qified": "^0.10.1" } }, "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g=="],
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
@@ -88,7 +99,7 @@
"escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
"eslint": ["eslint@10.1.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.3", "@eslint/config-helpers": "^0.5.3", "@eslint/core": "^1.1.1", "@eslint/plugin-kit": "^0.6.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^10.2.4", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": "bin/eslint.js" }, "sha512-S9jlY/ELKEUwwQnqWDO+f+m6sercqOPSqXM5Go94l7DOmxHVDgmSFGWEzeE/gwgTAr0W103BWt0QLe/7mabIvA=="],
"eslint": ["eslint@10.16.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.7", "@eslint/config-helpers": "^0.7.0", "@eslint/core": "^1.2.1", "@eslint/plugin-kit": "^0.7.3", "@humanfs/node": "^0.16.8", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "11.1.5 || >11.1.6 <12", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^11.0.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-Xu3PRLG/wCaZWZ20gkExUcNqL2mWWsXTR+Lln3Sof4Y9WuA678fH9hrlQ8B6UNwbTnsKdDdBYOd2jxtycXVTGQ=="],
"eslint-scope": ["eslint-scope@9.1.2", "", { "dependencies": { "@types/esrecurse": "^4.3.1", "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ=="],
@@ -112,17 +123,21 @@
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" } }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
"file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="],
"file-entry-cache": ["file-entry-cache@11.1.5", "", { "dependencies": { "flat-cache": "^6.1.23" } }, "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q=="],
"find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="],
"flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="],
"flat-cache": ["flat-cache@6.1.23", "", { "dependencies": { "cacheable": "^2.5.0", "flatted": "^3.4.2", "hookified": "^1.15.0" } }, "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA=="],
"flatted": ["flatted@3.4.2", "", {}, "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA=="],
"glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],
"gnim": ["gnim@file:../../../../usr/share/ags/js/node_modules/gnim", {}],
"gnim": ["gnim@1.9.1", "", {}, "sha512-WttkzzZg17qrJKGk87HlE1zHKUdYoimSqjmsULt4C6DNq3JfYSPhYNjwUjBMHFpzZMbyUVHgpTTW6IIehme9tQ=="],
"hashery": ["hashery@1.5.1", "", { "dependencies": { "hookified": "^1.15.0" } }, "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ=="],
"hookified": ["hookified@1.15.1", "", {}, "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg=="],
"ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],
@@ -134,19 +149,17 @@
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
"json-buffer": ["json-buffer@3.0.1", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="],
"json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
"json-stable-stringify-without-jsonify": ["json-stable-stringify-without-jsonify@1.0.1", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="],
"keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="],
"keyv": ["keyv@5.6.0", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw=="],
"levn": ["levn@0.4.1", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],
"locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="],
"minimatch": ["minimatch@10.2.4", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg=="],
"minimatch": ["minimatch@11.0.9", "", { "dependencies": { "@isaacs/nonrecursive-glob-match": "^1.1.0", "brace-expansion": "^5.0.12" } }, "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q=="],
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
@@ -170,6 +183,8 @@
"punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
"qified": ["qified@0.10.1", "", { "dependencies": { "hookified": "^2.1.1" } }, "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA=="],
"semver": ["semver@7.7.4", "", { "bin": "bin/semver.js" }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
@@ -184,7 +199,7 @@
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
"typescript-eslint": ["typescript-eslint@8.57.2", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.57.2", "@typescript-eslint/parser": "8.57.2", "@typescript-eslint/typescript-estree": "8.57.2", "@typescript-eslint/utils": "8.57.2" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-VEPQ0iPgWO/sBaZOU1xo4nuNdODVOajPnTIbog2GKYr31nIlZ0fWPoCQgGfF3ETyBl1vn63F/p50Um9Z4J8O8A=="],
"typescript-eslint": ["typescript-eslint@8.74.0", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.74.0", "@typescript-eslint/parser": "8.74.0", "@typescript-eslint/typescript-estree": "8.74.0", "@typescript-eslint/utils": "8.74.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-OsWQlsedt1ZpZXfZZMNK3m4SoQONFFcy4h/uRznsCeRfVuEic3gh4KGUs2pJJ5o0Jj0Jr7keUHQGN1Ns9aDw7Q=="],
"uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
@@ -196,12 +211,52 @@
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
"@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@5.0.1", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],
"ags/gnim": ["gnim@file:../../../../usr/share/ags/js/node_modules/gnim", {}],
"@typescript-eslint/typescript-estree/minimatch": ["minimatch@10.2.4", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg=="],
"eslint/ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
"espree/eslint-visitor-keys": ["eslint-visitor-keys@5.0.1", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],
"qified/hookified": ["hookified@2.2.0", "", {}, "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA=="],
"typescript-eslint/@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.74.0", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.74.0", "@typescript-eslint/type-utils": "8.74.0", "@typescript-eslint/utils": "8.74.0", "@typescript-eslint/visitor-keys": "8.74.0", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.74.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-z3KXk1+Vm+d82ZRplOoC89ho4Rf1da5ju6sx8//92GnN532U62DGPjECXkkVqtYzIv0zoJlpO39SX2Z9tk6LVw=="],
"typescript-eslint/@typescript-eslint/parser": ["@typescript-eslint/parser@8.74.0", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.74.0", "@typescript-eslint/types": "8.74.0", "@typescript-eslint/typescript-estree": "8.74.0", "@typescript-eslint/visitor-keys": "8.74.0", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-ecr8AYdig7avVkxaHdQvxHnIJ/mOyliO4Gv/uWF8q69vBew/z3sexqBwHUZX5Vql+Ns0w4sH6gBLkICGbOvJkA=="],
"typescript-eslint/@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.74.0", "", { "dependencies": { "@typescript-eslint/project-service": "8.74.0", "@typescript-eslint/tsconfig-utils": "8.74.0", "@typescript-eslint/types": "8.74.0", "@typescript-eslint/visitor-keys": "8.74.0", "debug": "^4.4.3", "minimatch": "^11.0.1", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev", "typescript": ">=4.8.4 <6.1.0" }, "optionalPeers": ["@typescript/native"] }, "sha512-wL348k6l92DNG+kPP5rVpKwNBoz7a3xRZy3TPKc1uymQttd7u7gcMv3eENmcuh4CjC4mO3FTM0DYstFXMyDLuw=="],
"typescript-eslint/@typescript-eslint/utils": ["@typescript-eslint/utils@8.74.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.74.0", "@typescript-eslint/types": "8.74.0", "@typescript-eslint/typescript-estree": "8.74.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-IpWXPxXXomzxyTcvjhZJexgdvtTR1TooLAPpuxzaGqQ8BHll1lf4Ysp/BTE/l0U5TJ+x1j7B4bEM8pLRrvY+XA=="],
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@5.0.5", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ=="],
"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.74.0", "", { "dependencies": { "@typescript-eslint/types": "8.74.0", "@typescript-eslint/visitor-keys": "8.74.0" } }, "sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ=="],
"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.74.0", "", { "dependencies": { "@typescript-eslint/types": "8.74.0", "@typescript-eslint/typescript-estree": "8.74.0", "@typescript-eslint/utils": "8.74.0", "debug": "^4.4.3", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-CV3Y3la8l3F9ANfxcfpgSSiQgJTe4IeLEoZV4O/gcW86Ugp8X6SKiQ0vm+QegXaRIbbDMokZZSF3A1CgiU/kPw=="],
"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.74.0", "", { "dependencies": { "@typescript-eslint/types": "8.74.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g=="],
"typescript-eslint/@typescript-eslint/parser/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.74.0", "", { "dependencies": { "@typescript-eslint/types": "8.74.0", "@typescript-eslint/visitor-keys": "8.74.0" } }, "sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ=="],
"typescript-eslint/@typescript-eslint/parser/@typescript-eslint/types": ["@typescript-eslint/types@8.74.0", "", {}, "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA=="],
"typescript-eslint/@typescript-eslint/parser/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.74.0", "", { "dependencies": { "@typescript-eslint/types": "8.74.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g=="],
"typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.74.0", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.74.0", "@typescript-eslint/types": "^8.74.0", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-z/mymuE+JlEeSFIv3Mo70EvgG1Zz74Hl0IDfExfXutARAP834bt+MppTD7mVAwmZO0GdxdOAi0jbTam749eH6g=="],
"typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.74.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-p07wAuaS6BjCYgOSXKJi4YhvTnAf7fiG37e9THcpnYaQEt2QiTTYZWKwUFNgeRiywiMudazhzgddAirZ0GgHtQ=="],
"typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/types": ["@typescript-eslint/types@8.74.0", "", {}, "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA=="],
"typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.74.0", "", { "dependencies": { "@typescript-eslint/types": "8.74.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g=="],
"typescript-eslint/@typescript-eslint/utils/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.74.0", "", { "dependencies": { "@typescript-eslint/types": "8.74.0", "@typescript-eslint/visitor-keys": "8.74.0" } }, "sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ=="],
"typescript-eslint/@typescript-eslint/utils/@typescript-eslint/types": ["@typescript-eslint/types@8.74.0", "", {}, "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA=="],
"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager/@typescript-eslint/types": ["@typescript-eslint/types@8.74.0", "", {}, "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA=="],
"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/type-utils/@typescript-eslint/types": ["@typescript-eslint/types@8.74.0", "", {}, "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA=="],
"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/visitor-keys/@typescript-eslint/types": ["@typescript-eslint/types@8.74.0", "", {}, "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA=="],
"typescript-eslint/@typescript-eslint/utils/@typescript-eslint/scope-manager/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.74.0", "", { "dependencies": { "@typescript-eslint/types": "8.74.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g=="],
}
}
+120
View File
@@ -0,0 +1,120 @@
# AGS greeter for greetd
A small AGS (GTK4) login UI that reuses this shell's pywal theme, wired to
greetd through [AstalGreet](https://aylur.github.io/libastal/greet/).
## How it fits together
```
greetd ──exec──> start-greeter.sh ──> cage ──> dbus-run-session ──> ags run greeter.tsx
^ │
└──────────────── AstalGreet.Greeter (GREETD_SOCK) <─────────────────────┘
```
AstalGreet is only the greetd IPC client; a compositor still has to host the
GTK window. Cage is used because it is a tiny kiosk compositor. Cage does not
support `wlr-layer-shell`, so the greeter is a plain `Gtk.ApplicationWindow`
(which cage maximizes) instead of an `Astal.Window`.
## Requirements
- `greetd` (already installed)
- `libastal-greetd` (already installed, provides `AstalGreet-0.1`)
- `ags` (already installed)
- `cage` — `pacman -S cage`
- `dart-sass` (already installed, used to compile the theme)
- a `greeter` user in the `video` group (already present)
## Install
```sh
sudo pacman -S cage
sudo ./greeter/install.sh
```
The script:
- copies `greeter.tsx`, `style.scss`, and `start-greeter.sh` to
`/etc/greetd/ags` (the `greeter` user cannot read `/home/pascal`, which is
`0700`)
- creates `/var/lib/greetd/{run,.cache}` owned by `greeter`
- compiles a fallback theme and seeds the current pywal theme/wallpaper
- installs `/etc/polkit-1/rules.d/49-greetd-greeter.rules` so the `greeter`
user can reboot/power off from the login screen
- writes `/etc/greetd/config.toml` (backup at `config.toml.bak`)
**Keep a TTY available (Ctrl+Alt+F2)** before restarting greetd so you can
recover if the greeter fails.
```sh
sudo systemctl restart greetd
```
## Theming
`theme.ts` now calls `exportGreeterTheme()` on startup and after every
`setTheme()`:
- `greeter/style.scss` is compiled with the current `wal` palette to
`/var/tmp/ags-greeter/greeter.css`
- `~/.cache/current_wallpaper.jpg` is copied to
`/var/tmp/ags-greeter/wallpaper.jpg`
`/var/tmp` is used because it survives reboots and is readable by the
`greeter` user. `/tmp` is empty at boot (the greeter runs before login) and
`~/.cache/wal` is unreadable by `greeter`.
If the exported files do not exist yet, the greeter uses
`/etc/greetd/ags/fallback.css`, then an inline fallback.
## Preview
In a running Hyprland session:
```sh
ags run ./greeter/greeter.tsx
```
This shows the real UI, but pressing "Log in" reports that the greeter must be
started by greetd (there is no `GREETD_SOCK` in your session).
## Login messages and power buttons
PAM info/error messages are shown in the card. greetd often reports only a
result code (for example `authenticate: AUTH_ERR`), so the greeter maps those
to readable text such as "Incorrect password. Please try again."
The card also has reboot and shut-down buttons. They call
`/usr/bin/systemctl`; the polkit rule installed by `install.sh` allows the
`greeter` user to perform those two actions without an authentication agent.
## Debugging
`greetd` prefixes its command with `exec`, so the chain lives in
`start-greeter.sh`. Its output (cage/AGS) is logged to:
```sh
cat /tmp/greeter.log
```
If greetd hits `start-limit-hit`, reset it after fixing:
```sh
sudo systemctl reset-failed greetd
sudo systemctl start greetd
```
## Notes / limitations
- `cage -m last` (in `start-greeter.sh`) puts the greeter on one monitor only.
Use `-m extend` to span all monitors, or switch to a layer-shell compositor
(sway/Hyprland) if you want per-monitor greeter windows.
- After a successful login the greeter starts
`/usr/bin/uwsm start -e -D Hyprland hyprland.desktop` (the same command as
`/usr/share/wayland-sessions/hyprland-uwsm.desktop`). No greetd-specific
uwsm configuration is needed; `~/.config/uwsm/env*` is still read from your
home when uwsm starts the user session. If you stop using uwsm, replace
`SESSION_CMD` in `greeter.tsx` with `["/usr/bin/start-hyprland"]`.
- The username field defaults to the user recorded in
`/etc/greetd/ags/default-user`; it can be edited before logging in.
- The greeter does not implement reboot/shutdown buttons yet.
+371
View File
@@ -0,0 +1,371 @@
import app from "ags/gtk4/app"
import { Gtk } from "ags/gtk4"
import Greet from "gi://AstalGreet?version=0.1"
import GLib from "gi://GLib?version=2.0"
import Gio from "gi://Gio?version=2.0"
import { execAsync } from "ags/process"
// Filled in by greeter/install.sh. Falls back to the local user for preview.
const DEFAULT_USER_FILE = "/etc/greetd/ags/default-user"
// Matches /usr/share/wayland-sessions/hyprland-uwsm.desktop.
// If you ever stop using uwsm, replace this with ["/usr/bin/start-hyprland"].
const SESSION_CMD = [
"/usr/bin/uwsm",
"start",
"-e",
"-D",
"Hyprland",
"hyprland.desktop",
]
const SESSION_ENV = [
"XDG_SESSION_TYPE=wayland",
"XDG_CURRENT_DESKTOP=Hyprland",
"XDG_SESSION_DESKTOP=Hyprland",
]
// Written by exportGreeterTheme() in theme.ts whenever the shell theme changes.
const THEME_CSS = "/var/tmp/ags-greeter/greeter.css"
const FALLBACK_CSS = "/etc/greetd/ags/fallback.css"
const WALLPAPER = "/var/tmp/ags-greeter/wallpaper.jpg"
const INLINE_CSS = `
window.Greeter { background-color: #1e1e1e; color: #d4d4d4; }
window.Greeter .scrim { background-color: rgba(30, 30, 30, 0.45); padding: 32px; }
window.Greeter .login-card {
background-color: rgba(30, 30, 30, 0.9);
border: 1px solid rgba(212, 212, 212, 0.15);
border-radius: 16px;
padding: 32px;
min-width: 320px;
}
window.Greeter .greeting { font-size: 2em; font-weight: bold; }
window.Greeter .subtitle { opacity: 0.65; margin-bottom: 8px; }
window.Greeter entry {
background-color: rgba(212, 212, 212, 0.08);
border: 1px solid rgba(212, 212, 212, 0.15);
border-radius: 8px;
padding: 10px 12px;
color: #d4d4d4;
}
window.Greeter button.login-btn {
background-color: #6a9955;
color: #1e1e1e;
border: none;
border-radius: 8px;
padding: 10px;
font-weight: bold;
}
window.Greeter .messages { min-height: 1.2em; }
window.Greeter .message { font-size: 0.9em; opacity: 0.85; }
window.Greeter .message.error { color: #f44747; }
window.Greeter .message.info { color: #569cd6; }
window.Greeter .power-row { margin-top: 4px; }
window.Greeter button.power-action {
background-color: rgba(212, 212, 212, 0.06);
border: 1px solid rgba(212, 212, 212, 0.1);
border-radius: 8px;
padding: 8px;
min-width: 36px;
min-height: 36px;
}
window.Greeter button.power-action:hover {
background-color: rgba(212, 212, 212, 0.12);
}
window.Greeter button.power-action image { -gtk-icon-size: 18px; }
`
// greetd only reports PAM result codes in the error description, e.g.
// "authenticate: AUTH_ERR". Map them to something human readable.
const AUTH_ERROR_MESSAGES: Record<string, string> = {
AUTH_ERR: "Incorrect password. Please try again.",
MAXTRIES: "Too many failed attempts.",
CRED_EXPIRED: "Your credentials have expired.",
ACCT_EXPIRED: "Your account has expired.",
CRED_INSUFFICIENT: "Insufficient credentials.",
USER_UNKNOWN: "Unknown username.",
PERM_DENIED: "Permission denied.",
SERVICE_ERR: "Authentication service error.",
ABORT: "Authentication aborted.",
}
function errorDescription(error: any): string {
try {
if (typeof error?.get_description === "function")
return error.get_description() ?? ""
return typeof error?.description === "string" ? error.description : ""
} catch {
return ""
}
}
function errorType(error: any): number | null {
try {
if (typeof error?.get_error_type === "function")
return error.get_error_type()
return typeof error?.error_type === "number" ? error.error_type : null
} catch {
return null
}
}
function humanizeError(error: any): string {
const description = errorDescription(error)
const code = description.match(/\b([A-Z][A-Z_]+)\b\s*$/)?.[1]
if (code && AUTH_ERROR_MESSAGES[code]) return AUTH_ERROR_MESSAGES[code]
// Only show the raw description when it is not a cryptic PAM result code.
if (description && !/^[a-z_]+: [A-Z_]+$/.test(description)) return description
// AstalGreet.ErrorType.AUTH_ERROR is 0
if (errorType(error) === 0) return "Authentication failed. Please try again."
return description || "Login failed"
}
function readTextFile(path: string): string | null {
try {
const [ok, contents] = GLib.file_get_contents(path)
if (!ok) return null
let text = ""
for (const byte of contents) text += String.fromCharCode(byte)
return text.trim()
} catch {
return null
}
}
function defaultUser() {
return readTextFile(DEFAULT_USER_FILE) || "pascal"
}
function themeCss() {
if (GLib.file_test(THEME_CSS, GLib.FileTest.EXISTS)) return THEME_CSS
if (GLib.file_test(FALLBACK_CSS, GLib.FileTest.EXISTS)) return FALLBACK_CSS
return INLINE_CSS
}
function Greeter() {
const user = defaultUser()
const underGreetd = GLib.getenv("GREETD_SOCK") !== null
const greeter = new Greet.Greeter()
let userEntry: Gtk.Entry | null = null
let passEntry: Gtk.Entry | null = null
let messageList: Gtk.Box | null = null
let loginButton: Gtk.Button | null = null
let busy = false
let lastPamError = ""
const messageWidgets: Gtk.Label[] = []
const appendMessage = (text: string, kind: "error" | "info" = "info") => {
if (!messageList || !text) return
const label = new Gtk.Label({ label: text, wrap: true, xalign: 0 })
label.set_css_classes(["message", kind])
messageList.append(label)
messageWidgets.push(label)
while (messageWidgets.length > 4) {
const old = messageWidgets.shift()
if (old) messageList.remove(old)
}
}
const clearMessages = () => {
if (!messageList) return
for (const label of messageWidgets) messageList.remove(label)
messageWidgets.length = 0
}
const reset = () => {
busy = false
if (loginButton) loginButton.sensitive = true
if (passEntry) {
passEntry.set_text("")
passEntry.grab_focus()
}
}
const runPower = (action: "reboot" | "poweroff") => {
if (!underGreetd) {
appendMessage("This greeter must be started by greetd", "error")
return
}
appendMessage(action === "reboot" ? "Rebooting…" : "Shutting down…")
execAsync(["/usr/bin/systemctl", action]).catch((error: unknown) => {
appendMessage(`Failed to ${action}: ${`${error}`.trim()}`, "error")
})
}
const login = () => {
if (busy) return
if (!underGreetd) {
appendMessage("This greeter must be started by greetd", "error")
return
}
const username = userEntry?.get_text().trim() || user
if (!passEntry?.get_text()) {
appendMessage("Enter your password", "error")
passEntry?.grab_focus()
return
}
busy = true
if (loginButton) loginButton.sensitive = false
lastPamError = ""
clearMessages()
greeter.create_session(username)
}
greeter.connect("visible-request", (_src: unknown, _message: string) => {
lastPamError = ""
greeter.post_auth(userEntry?.get_text().trim() || user)
})
greeter.connect("secret-request", (_src: unknown, _message: string) => {
lastPamError = ""
greeter.post_auth(passEntry?.get_text() ?? "")
})
greeter.connect("info-message", (_src: unknown, message: string) => {
appendMessage(message)
})
greeter.connect("error-message", (_src: unknown, message: string) => {
lastPamError = message
appendMessage(message, "error")
})
greeter.connect("cancelled", (_src: unknown, error: any) => {
if (!lastPamError) appendMessage(humanizeError(error), "error")
lastPamError = ""
reset()
})
greeter.connect("authenticated", () => {
greeter.start_session(
SESSION_CMD,
SESSION_ENV,
(_src: unknown, res: any) => {
try {
greeter.start_session_finish(res)
} catch (error: any) {
appendMessage(error?.message ?? `${error}`, "error")
reset()
return
}
// greetd starts the session once the greeter process exits.
app.quit()
},
)
})
return (
<Gtk.ApplicationWindow
application={app}
class="Greeter"
title="Login"
decorated={false}
defaultWidth={800}
defaultHeight={500}
$={(window: Gtk.ApplicationWindow) => {
window.present()
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
passEntry?.grab_focus()
return GLib.SOURCE_REMOVE
})
}}
>
<overlay
$={(overlay: Gtk.Overlay) => {
const content = overlay.get_child()
const picture = new Gtk.Picture()
picture.set_content_fit(Gtk.ContentFit.COVER)
picture.set_hexpand(true)
picture.set_vexpand(true)
if (GLib.file_test(WALLPAPER, GLib.FileTest.EXISTS)) {
picture.set_file(Gio.File.new_for_path(WALLPAPER))
}
overlay.set_child(picture)
if (content) overlay.add_overlay(content)
}}
>
<box cssClasses={["scrim"]} orientation={Gtk.Orientation.VERTICAL}>
<box vexpand />
<box
cssClasses={["login-card"]}
orientation={Gtk.Orientation.VERTICAL}
spacing={12}
halign={Gtk.Align.CENTER}
>
<label label="Welcome back" cssClasses={["greeting"]} />
<label
label="Log in to start your session"
cssClasses={["subtitle"]}
/>
<entry
text={user}
placeholderText="Username"
onActivate={login}
$={(entry: Gtk.Entry) => (userEntry = entry)}
/>
<entry
placeholderText="Password"
visibility={false}
onActivate={login}
$={(entry: Gtk.Entry) => (passEntry = entry)}
/>
<button
cssClasses={["login-btn"]}
onClicked={login}
$={(button: Gtk.Button) => (loginButton = button)}
>
<label label="Log in" />
</button>
<box
cssClasses={["messages"]}
orientation={Gtk.Orientation.VERTICAL}
spacing={4}
$={(box: Gtk.Box) => (messageList = box)}
/>
<box
cssClasses={["power-row"]}
spacing={8}
halign={Gtk.Align.CENTER}
>
<button
cssClasses={["power-action"]}
tooltipText="Reboot"
onClicked={() => runPower("reboot")}
>
<image iconName="system-reboot-symbolic" />
</button>
<button
cssClasses={["power-action"]}
tooltipText="Shut down"
onClicked={() => runPower("poweroff")}
>
<image iconName="system-shutdown-symbolic" />
</button>
</box>
</box>
<box vexpand />
</box>
</overlay>
</Gtk.ApplicationWindow>
)
}
app.start({
css: themeCss(),
main() {
Greeter()
},
})
+146
View File
@@ -0,0 +1,146 @@
#!/bin/sh
# Installs the AGS greeter for greetd.
#
# Usage: sudo ./greeter/install.sh
#
# This replaces /etc/greetd/config.toml (a .bak copy is kept) and copies the
# greeter into /etc/greetd/ags so the `greeter` user can read it.
set -eu
if [ "$(id -u)" -ne 0 ]; then
echo "Run this script with sudo." >&2
exit 1
fi
SRC=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
TARGET_USER=${SUDO_USER:-pascal}
for bin in cage sass dbus-run-session; do
if ! command -v "$bin" >/dev/null 2>&1; then
echo "Missing dependency: $bin" >&2
case "$bin" in
cage) echo "Install it with: pacman -S cage" >&2 ;;
sass) echo "Install it with: pacman -S dart-sass" >&2 ;;
esac
exit 1
fi
done
if ! id greeter >/dev/null 2>&1; then
echo "The 'greeter' user does not exist. Create it with:" >&2
echo " useradd -M -G video greeter" >&2
exit 1
fi
install -d -m 755 /etc/greetd/ags
install -d -o greeter -g greeter -m 700 \
/var/lib/greetd /var/lib/greetd/run /var/lib/greetd/.cache
install -m 644 -o root -g root "$SRC/greeter.tsx" /etc/greetd/ags/greeter.tsx
install -m 644 -o root -g root "$SRC/style.scss" /etc/greetd/ags/style.scss
install -m 755 -o root -g root "$SRC/start-greeter.sh" /etc/greetd/ags/start-greeter.sh
rm -f /etc/greetd/ags/*.map
printf '%s\n' "$TARGET_USER" > /etc/greetd/ags/default-user
chmod 644 /etc/greetd/ags/default-user
# Compile a fallback theme in case the shell has never exported one.
# /tmp is sticky and fs.protected_regular is enabled, so root cannot
# overwrite an existing user-owned file there. Remove it first and give it
# back to the user at the end so theme switching keeps working.
rm -f /tmp/ags-colors.scss
cat > /tmp/ags-colors.scss <<'EOF'
$wallpaper: "";
$background: #1e1e1e;
$foreground: #d4d4d4;
$cursor: #d4d4d4;
$color0: #1e1e1e;
$color1: #f44747;
$color2: #6a9955;
$color3: #d7ba7d;
$color4: #569cd6;
$color5: #c586c0;
$color6: #4ec9b0;
$color7: #d4d4d4;
$color8: #808080;
$color9: #f44747;
$color10: #6a9955;
$color11: #d7ba7d;
$color12: #569cd6;
$color13: #c586c0;
$color14: #4ec9b0;
$color15: #d4d4d4;
EOF
sass --no-source-map /etc/greetd/ags/style.scss /etc/greetd/ags/fallback.css
chmod 644 /etc/greetd/ags/fallback.css
# Seed the greeter theme from the user's current pywal state.
USER_HOME=$(getent passwd "$TARGET_USER" | cut -d: -f6 || true)
if [ -n "${USER_HOME:-}" ] && [ -f "$USER_HOME/.cache/wal/colors.scss" ]; then
install -d -m 755 -o "$TARGET_USER" -g "$TARGET_USER" /var/tmp/ags-greeter
rm -f /var/tmp/ags-greeter/greeter.css \
/var/tmp/ags-greeter/greeter.css.map /var/tmp/ags-greeter/wallpaper.jpg
cp "$USER_HOME/.cache/wal/colors.scss" /tmp/ags-colors.scss
sass --no-source-map /etc/greetd/ags/style.scss \
/var/tmp/ags-greeter/greeter.css
if [ -f "$USER_HOME/.cache/current_wallpaper.jpg" ]; then
cp "$USER_HOME/.cache/current_wallpaper.jpg" \
/var/tmp/ags-greeter/wallpaper.jpg
fi
chown "$TARGET_USER:$TARGET_USER" \
/var/tmp/ags-greeter/greeter.css /var/tmp/ags-greeter/wallpaper.jpg \
2>/dev/null || true
fi
if [ -f /etc/greetd/config.toml ]; then
cp /etc/greetd/config.toml /etc/greetd/config.toml.bak
fi
chown "$TARGET_USER:$TARGET_USER" /tmp/ags-colors.scss 2>/dev/null || true
cat > /etc/greetd/config.toml <<'EOF'
[terminal]
vt = 1
[default_session]
# greetd prefixes the command with `exec`, so it must be a single executable.
# start-greeter.sh sets HOME/XDG dirs, starts cage, then AGS.
command = "/etc/greetd/ags/start-greeter.sh"
user = "greeter"
EOF
# Allow the greeter user to power off/reboot without an auth agent.
if [ ! -d /etc/polkit-1/rules.d ]; then
install -d -m 755 /etc/polkit-1/rules.d
fi
cat > /etc/polkit-1/rules.d/49-greetd-greeter.rules <<'EOF'
polkit.addRule(function(action, subject) {
if (subject.user !== "greeter")
return null;
const allowed = [
"org.freedesktop.login1.power-off",
"org.freedesktop.login1.power-off-multiple-sessions",
"org.freedesktop.login1.reboot",
"org.freedesktop.login1.reboot-multiple-sessions",
];
if (allowed.indexOf(action.id) !== -1)
return polkit.Result.YES;
return null;
});
EOF
chmod 644 /etc/polkit-1/rules.d/49-greetd-greeter.rules
cat <<EOF
Installed.
Keep a TTY available (Ctrl+Alt+F2) before restarting greetd, in case the
greeter fails to start.
Test or apply with:
sudo systemctl restart greetd
Preview the UI in your current session with:
ags run "$SRC/greeter.tsx"
EOF
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
# Launched by greetd as the `greeter` user.
#
# greetd runs `exec <command>`, so the command must be a single executable
# (not a `mkdir ... && cage ...` compound list).
set -eu
LOG=/tmp/greeter.log
exec >>"$LOG" 2>&1
echo "=== $(date -Is) starting greeter ==="
mkdir -p /var/lib/greetd/run /var/lib/greetd/.cache
chmod 700 /var/lib/greetd/run
export HOME=/var/lib/greetd
export XDG_RUNTIME_DIR=/var/lib/greetd/run
export XDG_CACHE_HOME=/var/lib/greetd/.cache
exec /usr/bin/cage -m last -s -d -- \
/usr/bin/dbus-run-session -- \
/usr/bin/ags run /etc/greetd/ags/greeter.tsx
+101
View File
@@ -0,0 +1,101 @@
@use "/tmp/ags-colors.scss" as wal;
window.Greeter {
background-color: wal.$background;
color: wal.$foreground;
.scrim {
background-color: rgba(wal.$background, 0.45);
padding: 32px;
}
.login-card {
background-color: rgba(wal.$background, 0.9);
border: 1px solid rgba(wal.$foreground, 0.12);
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
padding: 32px;
min-width: 320px;
.greeting {
font-size: 2em;
font-weight: bold;
}
.subtitle {
opacity: 0.65;
margin-bottom: 8px;
}
}
entry {
background-color: rgba(wal.$foreground, 0.08);
border: 1px solid rgba(wal.$foreground, 0.12);
border-radius: 8px;
padding: 10px 12px;
color: wal.$foreground;
caret-color: wal.$color2;
transition: border-color 0.2s ease-in-out;
&:focus {
border-color: wal.$color2;
}
}
button.login-btn {
background-color: wal.$color2;
color: wal.$background;
border: none;
border-radius: 8px;
padding: 10px;
font-weight: bold;
transition: background-color 0.2s ease-in-out;
&:hover {
background-color: rgba(wal.$color2, 0.85);
}
&:disabled {
opacity: 0.6;
}
}
.messages {
min-height: 1.2em;
}
.message {
font-size: 0.9em;
opacity: 0.85;
&.error {
color: wal.$color1;
}
&.info {
color: wal.$color4;
}
}
.power-row {
margin-top: 4px;
}
button.power-action {
background-color: rgba(wal.$foreground, 0.06);
border: 1px solid rgba(wal.$foreground, 0.1);
border-radius: 8px;
padding: 8px;
min-width: 36px;
min-height: 36px;
transition: background-color 0.2s ease-in-out;
&:hover {
background-color: rgba(wal.$foreground, 0.12);
}
image {
-gtk-icon-size: 18px;
}
}
}
+2 -3
View File
@@ -2,7 +2,6 @@
"name": "tacitshell",
"version": "0.1.0",
"dependencies": {
"ags": "*",
"gnim": "*",
"prettier": "^3.8.1"
},
@@ -14,8 +13,8 @@
"@eslint/js": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^8.57.2",
"@typescript-eslint/parser": "^8.57.2",
"eslint": "^10.1.0",
"typescript-eslint": "^8.57.2"
"eslint": "^10.16.0",
"typescript-eslint": "^8.74.0"
},
"scripts": {
"lint": "eslint .",
+67 -6
View File
@@ -5,6 +5,39 @@ import Gio from "gi://Gio?version=2.0"
const HOME = GLib.getenv("HOME") || ""
const WALLPAPER_DIR = `${HOME}/wallpapers`
const GREETER_DIR = "/var/tmp/ags-greeter"
/**
* Export the current palette and wallpaper for the greetd greeter.
* The greeter runs as the `greeter` user, which cannot read the user's home
* directory, and /tmp is empty at boot. /var/tmp persists across reboots and
* is world-readable, so it works for both.
*/
export async function exportGreeterTheme() {
try {
await execAsync(["mkdir", "-p", GREETER_DIR])
const walCache = `${HOME}/.cache/wal/colors.scss`
const tmpColors = `/tmp/ags-colors.scss`
if (GLib.file_test(walCache, GLib.FileTest.EXISTS)) {
await execAsync(["cp", walCache, tmpColors])
}
await execAsync([
"sass",
"--no-source-map",
`${HOME}/.config/ags/greeter/style.scss`,
`${GREETER_DIR}/greeter.css`,
])
const wallpaper = `${HOME}/.cache/current_wallpaper.jpg`
if (GLib.file_test(wallpaper, GLib.FileTest.EXISTS)) {
await execAsync(["cp", wallpaper, `${GREETER_DIR}/wallpaper.jpg`])
}
} catch (error) {
console.error("Failed to export greeter theme:", error)
}
}
/**
* Get a list of all wallpapers in the default wallpapers directory.
@@ -83,20 +116,25 @@ $color15: #d4d4d4;
* Restore the last set wallpaper.
*/
export async function restoreTheme() {
let themed = false
try {
const out = await execAsync(["cat", `${HOME}/.cache/wal/wal`])
const wallpaperPath = out.trim()
if (wallpaperPath) {
// setTheme() exports the greeter theme as its last step.
await setTheme(wallpaperPath)
themed = true
}
} catch {}
if (!themed) await exportGreeterTheme()
}
/**
* Set the wallpaper using hyprpaper, generate colors with pywal,
* Apply the wallpaper using hyprpaper, generate colors with pywal,
* and reload the AGS theme.
*/
export async function setTheme(wallpaperPath: string) {
async function applyTheme(wallpaperPath: string) {
// 1. Set wallpaper with hyprpaper
try {
// Preload the wallpaper first
@@ -121,7 +159,15 @@ export async function setTheme(wallpaperPath: string) {
// 2. Generate colors with pywal16
try {
// -q: quiet, -i: image, -n: skip setting wallpaper (hyprpaper does it)
await execAsync(`wal --contrast 21.0 -q -n -i "${wallpaperPath}"`)
await execAsync([
"wal",
"--contrast",
"21.0",
"-q",
"-n",
"-i",
wallpaperPath,
])
// Add this line so hyprlock always knows the current wallpaper:
await execAsync([
@@ -149,7 +195,7 @@ export async function setTheme(wallpaperPath: string) {
}
// Compile SCSS to CSS using the sass CLI
await execAsync(`sass ${scss} ${css}`)
await execAsync(["sass", "--no-source-map", scss, css])
// Reset any previously applied CSS and apply the new one
app.reset_css()
@@ -158,11 +204,26 @@ export async function setTheme(wallpaperPath: string) {
console.error("Failed to recompile and apply AGS styles:", error)
}
// 4. Run update script
// 4. Keep the greetd greeter in sync with the current palette/wallpaper
await exportGreeterTheme()
// 5. Run update script
try {
const agsDir = `${HOME}/.config/ags`
await execAsync(`${agsDir}/update_script.sh`)
await execAsync([`${agsDir}/update_script.sh`])
} catch (error) {
console.error("Failed to run update script:", error)
}
}
let themeQueue: Promise<void> = Promise.resolve()
/**
* Set the wallpaper and palette. Calls are serialized so rapid theme switches
* cannot run wal/sass concurrently and race on the same output files.
*/
export function setTheme(wallpaperPath: string): Promise<void> {
const run = () => applyTheme(wallpaperPath)
themeQueue = themeQueue.then(run, run)
return themeQueue
}
+3 -3
View File
@@ -1,8 +1,8 @@
import { Gtk } from "ags/gtk4"
import { Gdk, Gtk } from "ags/gtk4"
import app from "ags/gtk4/app"
import QuickSettings from "./QuickSettings"
export function PowerButton({ gdkmonitor }: { gdkmonitor: any }) {
export function PowerButton({ gdkmonitor }: { gdkmonitor: Gdk.Monitor }) {
return (
<button
cssClasses={["control-btn", "power-btn"]}
@@ -15,7 +15,7 @@ export function PowerButton({ gdkmonitor }: { gdkmonitor: any }) {
)
}
export default function Controls({ gdkmonitor }: { gdkmonitor: any }) {
export default function Controls({ gdkmonitor }: { gdkmonitor: Gdk.Monitor }) {
return (
<box
cssClasses={["controls-container"]}
+24 -9
View File
@@ -13,6 +13,8 @@ function VinylRecord({ player, size }: { player: any; size: number }) {
$={(box) => {
let angle = 0
let timerId: number | null = null
let playing =
player.playback_status === AstalMpris.PlaybackStatus.PLAYING
const rotProvider = new Gtk.CssProvider()
box
@@ -39,6 +41,11 @@ function VinylRecord({ player, size }: { player: any; size: number }) {
}
}
const syncSpin = () => {
if (playing && box.get_mapped()) startSpin()
else stopSpin()
}
const frame = new Gtk.Frame()
const provider = new Gtk.CssProvider()
provider.load_from_string(`
@@ -73,21 +80,23 @@ function VinylRecord({ player, size }: { player: any; size: number }) {
}
}
updateArt()
if (player.playback_status === AstalMpris.PlaybackStatus.PLAYING) {
startSpin()
}
applyAngle()
const artConn = player.connect("notify::cover-art", updateArt)
const statusConn = player.connect("notify::playback-status", () => {
if (player.playback_status === AstalMpris.PlaybackStatus.PLAYING) {
startSpin()
} else {
stopSpin()
}
playing =
player.playback_status === AstalMpris.PlaybackStatus.PLAYING
syncSpin()
})
// Keep the timer stopped while the record is hidden (other players,
// closed popover, or the whole bar) to avoid burning CPU.
const mapConn = box.connect("map", () => {
if (playing) startSpin()
})
const unmapConn = box.connect("unmap", stopSpin)
syncSpin()
onCleanup(() => {
stopSpin()
try {
@@ -96,6 +105,12 @@ function VinylRecord({ player, size }: { player: any; size: number }) {
try {
player.disconnect(statusConn)
} catch {}
try {
box.disconnect(mapConn)
} catch {}
try {
box.disconnect(unmapConn)
} catch {}
})
}}
/>
+5 -5
View File
@@ -5,7 +5,7 @@ import { execAsync } from "ags/process"
interface SysButtonProps {
icon: string
label: string
command: string
command: string[]
}
function SysButton({ icon, label, command }: SysButtonProps) {
@@ -66,22 +66,22 @@ export default function PowerMenu(gdkmonitor: Gdk.Monitor) {
<SysButton
icon="system-shutdown-symbolic"
label="Power Off"
command="systemctl poweroff"
command={["/usr/bin/systemctl", "poweroff"]}
/>
<SysButton
icon="system-reboot-symbolic"
label="Reboot"
command="systemctl reboot"
command={["/usr/bin/systemctl", "reboot"]}
/>
<SysButton
icon="system-log-out-symbolic"
label="Sign Out"
command="hyprctl dispatch exit"
command={["/usr/bin/uwsm", "stop"]}
/>
<SysButton
icon="weather-clear-night-symbolic"
label="Sleep"
command="systemctl suspend"
command={["/usr/bin/systemctl", "suspend"]}
/>
</box>
</window>
+84 -18
View File
@@ -4,8 +4,8 @@ import AstalBluetooth from "gi://AstalBluetooth?version=0.1"
import AstalWp from "gi://AstalWp?version=0.1"
import AstalPowerProfiles from "gi://AstalPowerProfiles?version=0.1"
import { createBinding, createComputed, createState, For } from "ags"
import { interval } from "ags/time"
import { exec, execAsync } from "ags/process"
import { interval, Timer } from "ags/time"
import { execAsync } from "ags/process"
interface VpnConn {
name: string
@@ -14,9 +14,9 @@ interface VpnConn {
const VPN_TYPES = new Set(["vpn", "wireguard"])
function fetchVpns(): VpnConn[] {
async function fetchVpns(): Promise<VpnConn[]> {
try {
const stdout = exec([
const stdout = await execAsync([
"nmcli",
"-t",
"-f",
@@ -27,6 +27,7 @@ function fetchVpns(): VpnConn[] {
return stdout
.trim()
.split("\n")
.filter(Boolean)
.map((line) => line.split(":"))
.filter(([, type]) => VPN_TYPES.has(type))
.map(([name, , device]) => ({ name, active: !!device }))
@@ -36,12 +37,58 @@ function fetchVpns(): VpnConn[] {
}
}
const [vpns, setVpns] = createState<VpnConn[]>(fetchVpns())
interval(2000, () => setVpns(fetchVpns()))
const [vpns, setVpns] = createState<VpnConn[]>([])
const vpnActive = vpns((list) => list.some((c) => c.active))
function sameVpns(a: VpnConn[], b: VpnConn[]) {
return (
a.length === b.length &&
a.every((conn, i) => conn.name === b[i].name && conn.active === b[i].active)
)
}
let refreshingVpns = false
let vpnRefreshQueued = false
async function refreshVpns() {
if (refreshingVpns) {
vpnRefreshQueued = true
return
}
refreshingVpns = true
try {
do {
vpnRefreshQueued = false
const next = await fetchVpns()
setVpns((prev) => (sameVpns(prev, next) ? prev : next))
} while (vpnRefreshQueued)
} finally {
refreshingVpns = false
}
}
// nmcli is only polled while a Quick Settings popover is open, and only one
// poller runs no matter how many bars have their popover open.
let vpnPollers = 0
let vpnTimer: Timer | null = null
function acquireVpnPolling() {
vpnPollers += 1
if (vpnTimer) return
// interval() runs its callback immediately, so this also refreshes on open.
vpnTimer = interval(3000, refreshVpns)
}
function releaseVpnPolling() {
vpnPollers = Math.max(0, vpnPollers - 1)
if (vpnPollers > 0 || vpnTimer === null) return
vpnTimer.cancel()
vpnTimer = null
}
const POWER_PROFILE_ICONS: Record<string, string> = {
"power-saver": "power-profile-power-saver-symbolic",
balanced: "power-profile-balanced-symbolic",
@@ -95,25 +142,28 @@ function NetworkItem() {
function BluetoothItem() {
const bluetooth = AstalBluetooth.get_default()
const powered = createBinding(bluetooth, "is-powered")
return (
<box spacing={12} valign={Gtk.Align.CENTER} cssClasses={["qs-item"]}>
<image
iconName={createBinding(bluetooth, "is-powered").as((powered) =>
powered ? "bluetooth-active-symbolic" : "bluetooth-disabled-symbolic",
iconName={powered.as((isPowered) =>
isPowered
? "bluetooth-active-symbolic"
: "bluetooth-disabled-symbolic",
)}
cssClasses={["qs-icon"]}
/>
<label
label={createBinding(bluetooth, "is-powered").as((powered) =>
powered ? "Bluetooth On" : "Bluetooth Off",
label={powered.as((isPowered) =>
isPowered ? "Bluetooth On" : "Bluetooth Off",
)}
halign={Gtk.Align.START}
hexpand
/>
<switch
valign={Gtk.Align.CENTER}
active={createBinding(bluetooth, "is-powered")}
active={powered}
onNotifyActive={(sw) => {
if (bluetooth.adapter) {
bluetooth.adapter.set_powered(sw.get_active())
@@ -156,13 +206,16 @@ function AudioSlider({ type }: { type: "speaker" | "microphone" }) {
function VpnList() {
const isEmpty = vpns((list) => list.length === 0)
function toggle(conn: VpnConn) {
async function toggle(conn: VpnConn) {
const cmd = conn.active
? ["nmcli", "connection", "down", conn.name]
: ["nmcli", "connection", "up", conn.name]
execAsync(cmd)
.then(() => setVpns(fetchVpns()))
.catch((e) => console.error("VPN toggle failed:", e))
try {
await execAsync(cmd)
await refreshVpns()
} catch (e) {
console.error("VPN toggle failed:", e)
}
}
return (
@@ -261,13 +314,26 @@ function PowerProfileItem() {
}
export default function QuickSettings() {
let popoverOpen = false
return (
<menubutton
cssClasses={["control-btn", "settings-btn"]}
tooltipText="Quick Settings"
>
<image iconName="emblem-system-symbolic" />
<popover>
<popover
$={(popover: Gtk.Popover) => {
popover.connect("notify::visible", () => {
const visible = popover.get_visible()
if (visible === popoverOpen) return
popoverOpen = visible
if (visible) acquireVpnPolling()
else releaseVpnPolling()
})
}}
>
<box
orientation={Gtk.Orientation.VERTICAL}
spacing={16}