-
Notifications
You must be signed in to change notification settings - Fork 0
feat(noctalia): lid lock, AC-aware idle, 5min dimlock 10min suspend #1651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dff5dde
3bf9272
424623d
2f72482
ca98d82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||
| # Inhibit idle when on AC power so noctalia's idle timeouts only fire on battery. | ||||||||||||||||||||||||||||||||||||
| # Polls every 2s so AC state changes take effect well within the 5-min idle window. | ||||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| AC=/sys/class/power_supply/ACAD/online | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| while true; do | ||||||||||||||||||||||||||||||||||||
| if [ "$(cat "$AC" 2>/dev/null)" = "1" ]; then | ||||||||||||||||||||||||||||||||||||
| systemd-inhibit --what=idle --why="On AC power" --mode=block sleep 2 | ||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||
| sleep 2 | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script hardcodes the AC adapter path to
Suggested change
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,21 @@ | |||||
| force = true; | ||||||
| }; | ||||||
|
|
||||||
| # Inhibit idle when plugged into AC; noctalia's idle timeouts apply on battery only. | ||||||
| systemd.user.services.ac-idle-inhibit = { | ||||||
| Unit = { | ||||||
| Description = "Inhibit idle when on AC power"; | ||||||
| After = [ "graphical-session.target" ]; | ||||||
| PartOf = [ "graphical-session.target" ]; | ||||||
| }; | ||||||
| Service = { | ||||||
| Type = "simple"; | ||||||
| ExecStart = "${pkgs.bash}/bin/bash ${./ac-idle-inhibit.sh}"; | ||||||
| Restart = "on-failure"; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add The script runs under Other similar units in this repo set this:
Suggested: Restart = "on-failure";
RestartSec = 5; |
||||||
| }; | ||||||
|
Comment on lines
+19
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The systemd service relies on |
||||||
| Install.WantedBy = [ "graphical-session.target" ]; | ||||||
| }; | ||||||
|
|
||||||
| programs.noctalia-shell = { | ||||||
| enable = true; | ||||||
| package = inputs.noctalia-shell.packages.${pkgs.system}.default; | ||||||
|
|
@@ -20,6 +35,7 @@ | |||||
| capsuleOpacity = 0; | ||||||
| widgets.left = [ | ||||||
| { id = "Launcher"; } | ||||||
| { id = "Workspaces"; } | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invalid widget id — Workspaces (plural) is not registered in noctalia. noctalia-shell @ 9f8dd48 only registers the singular Fix: use the singular id.
Suggested change
|
||||||
| { | ||||||
| id = "Clock"; | ||||||
| formatHorizontal = "yyyy/MM/dd HH:mm:ss"; | ||||||
|
|
@@ -44,12 +60,11 @@ | |||||
| { id = "PowerProfile"; } | ||||||
| { id = "Volume"; } | ||||||
| { id = "Brightness"; } | ||||||
| { id = "Settings"; } | ||||||
| { id = "ControlCenter"; } | ||||||
| ]; | ||||||
| }; | ||||||
| ui = { | ||||||
| fontDefault = "JetBrainsMono Nerd Font"; | ||||||
| fontDefault = "Noto Sans"; | ||||||
| fontFixed = "JetBrainsMono Nerd Font"; | ||||||
| }; | ||||||
| notifications = { | ||||||
|
|
@@ -69,20 +84,36 @@ | |||||
| compactLockScreen = true; | ||||||
| autoStartAuth = true; | ||||||
| allowPasswordWithFprintd = true; | ||||||
| lockOnSuspend = true; | ||||||
| }; | ||||||
| colorSchemes.predefinedScheme = "Dracula-Custom"; | ||||||
| hooks = { | ||||||
| enabled = true; | ||||||
| darkModeChange = ''if [ "$1" = "true" ]; then dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" && dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita-dark'"; else dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'" && dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita'"; fi''; | ||||||
| darkModeChange = '' | ||||||
| if [ "$1" = "true" ]; then | ||||||
| dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" | ||||||
| dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita-dark'" | ||||||
| dconf write /org/gnome/desktop/interface/icon-theme "'Adwaita'" | ||||||
| else | ||||||
| dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'" | ||||||
| dconf write /org/gnome/desktop/interface/gtk-theme "'Adwaita'" | ||||||
| dconf write /org/gnome/desktop/interface/icon-theme "'Adwaita'" | ||||||
| fi | ||||||
| ''; | ||||||
|
Comment on lines
+92
to
+102
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The References
|
||||||
| }; | ||||||
| dock = { | ||||||
| colorizeIcons = true; | ||||||
| showLauncherIcon = true; | ||||||
| showDockIndicator = true; | ||||||
| showDockIndicator = false; | ||||||
| }; | ||||||
| desktopWidgets.enabled = true; | ||||||
| wallpaper.enabled = false; | ||||||
| idle.enabled = true; | ||||||
| idle = { | ||||||
| enabled = true; | ||||||
| screenOffTimeout = 300; # 5 min on battery | ||||||
| lockTimeout = 300; | ||||||
| suspendTimeout = 600; # 10 min on battery | ||||||
| }; | ||||||
| systemMonitor.enableDgpuMonitoring = true; | ||||||
| colorSchemes.schedulingMode = "location"; | ||||||
| location.autoLocate = true; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -360,6 +360,7 @@ config/git-ai/activate.sh | |
| config/hyprland/scripts/record-screen.sh | ||
| config/hyprland/scripts/toggle-terminal.sh | ||
| config/k3s/activate.sh | ||
| config/noctalia/ac-idle-inhibit.sh | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This new shell script is added to the coverage list without a corresponding spec-file check, so the coverage guard no longer verifies test-file presence for it. Prompt for AI agents |
||
| config/obsidian/activate.sh | ||
| config/omp/activate.sh | ||
| config/openclaw/hydrate.sh | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded
ACADpath diverges from the repo's portable pattern.This repo already has two AC-aware scripts that don't hardcode the adapter name:
home-manager/modules/local-scripts/decafinate.sh:42-46and:174-178iteratefor ac_path in /sys/class/power_supply/AC*/online; do ....scripts/wallpaper-power-check.shtakes the path as@ac_supply_path@viapkgs.replaceVars.With the hardcoded path here,
cat "$AC" 2>/dev/nullreturns empty when the file is missing, the test fails, and the script silently behaves as if on battery — with no warning. It works today only becauseconfig/noctalia/is loaded underisDesktop = true, which onlynamed-hosts/maticenables. If noctalia is ever turned on for another desktop host with a different adapter name (e.g.AC0,ADP1), this script will silently do nothing and the failure will be invisible.Consider switching to the
AC*/onlineglob to match the existing pattern.