feat(theme,display,wm,power,make): add Anodized theme, editors, multi-monitor arrangement, power timeouts, bar compaction, and replace state preservation
- Replace deprecated AnodeDefault with dark-silvery Anodized default theme - Add interactive theme editor, duplicator, and non-standard .xth importer to anode-themes (+ CLI --install) - Fix multi-monitor dwm/lock/vkbd/EDID edge cases and integrate monitor arrangement + 15s revert into anode-display and anode-apply-display - Gate anode-touchd behind WITH_TOUCHD=1 (keeping anode-vkbd unconditional) and add help/rebuild/install-touch/install-system targets to Makefile - Add idle screen dim, lock, suspend, and suspend-on-AC timeout controls to anode-power and anode-display backed by power.conf + SIGUSR1 - Prevent lockscreen subtitle overflow and progressively compact status bar segments so focused window titles remain visible - Preserve workspaces, active desktop, monitor state, floating/fullscreen states, and focus across anode-replace and restarts
This commit is contained in:
1 parent
bb81541b42
commit
4ec3f59e02
40 files changed
+5843
-768
No files matched your search
+103
-14
@@ -121,9 +121,9 @@ def test_fractional_scales():
|
||||
assert f'gtk-font-name="{exp_ui} 10"' in gtk2, gtk2
|
||||
assert f"gtk-cursor-theme-size={exp_cur}" in gtk2, gtk2
|
||||
|
||||
assert os.path.isfile(os.path.join(tmp, ".themes", "ANODE-AnodeDefault", "index.theme"))
|
||||
assert os.path.islink(os.path.join(tmp, ".local", "share", "themes", "ANODE-AnodeDefault"))
|
||||
with open(os.path.join(tmp, ".themes", "ANODE-AnodeDefault", "gtk-2.0", "gtkrc"), "r", encoding="utf-8") as f:
|
||||
assert os.path.isfile(os.path.join(tmp, ".themes", "ANODE-Anodized", "index.theme"))
|
||||
assert os.path.islink(os.path.join(tmp, ".local", "share", "themes", "ANODE-Anodized"))
|
||||
with open(os.path.join(tmp, ".themes", "ANODE-Anodized", "gtk-2.0", "gtkrc"), "r", encoding="utf-8") as f:
|
||||
gtk2rc = f.read()
|
||||
assert "GtkButton::inner-border" in gtk2rc, gtk2rc
|
||||
assert "GtkEntry::inner-border" in gtk2rc, gtk2rc
|
||||
@@ -140,7 +140,7 @@ def test_fractional_scales():
|
||||
for bad in ("min-height:", "min-width:", "padding:", "margin:", "font-family:"):
|
||||
assert bad not in gcss, f"Unexpected {bad} in .config/{gver}/gtk.css"
|
||||
|
||||
tcss_p = os.path.join(tmp, ".themes", "ANODE-AnodeDefault", gver, "gtk.css")
|
||||
tcss_p = os.path.join(tmp, ".themes", "ANODE-Anodized", gver, "gtk.css")
|
||||
with open(tcss_p, "r", encoding="utf-8") as f:
|
||||
tcss = f.read()
|
||||
exp_imp = (
|
||||
@@ -253,8 +253,8 @@ def test_st_overrides_and_xresources_local():
|
||||
f.write("St.alpha: 0.95\n")
|
||||
|
||||
# Repeated theme applications must preserve St.* cleanly without duplication
|
||||
run_env(env, [APPLY_THEME, "AnodeDefault"])
|
||||
run_env(env, [APPLY_THEME, "AnodeDefault"])
|
||||
run_env(env, [APPLY_THEME, "Anodized"])
|
||||
run_env(env, [APPLY_THEME, "Anodized"])
|
||||
with open(xres_p, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
assert content.count("St.font:") == 1, content
|
||||
@@ -267,8 +267,8 @@ def test_st_overrides_and_xresources_local():
|
||||
f.write("St.font: Fira Code:size=16:antialias=true\n")
|
||||
f.write("*.cursorBlink: true\n")
|
||||
|
||||
run_env(env, [APPLY_THEME, "AnodeDefault"])
|
||||
run_env(env, [APPLY_THEME, "AnodeDefault"])
|
||||
run_env(env, [APPLY_THEME, "Anodized"])
|
||||
run_env(env, [APPLY_THEME, "Anodized"])
|
||||
with open(xres_p, "r", encoding="utf-8") as f:
|
||||
content2 = f.read()
|
||||
assert content2.count("St.font:") == 1, content2
|
||||
@@ -343,7 +343,7 @@ def test_stale_env_does_not_override_scale_conf():
|
||||
assert "gtk-cursor-theme-size=24" in f.read()
|
||||
|
||||
# Re-applying theme with stale ANODE_SCALE/ANODE_TOUCH still honors scale.conf
|
||||
run_env(stale_env, [APPLY_THEME, "AnodeDefault"])
|
||||
run_env(stale_env, [APPLY_THEME, "Anodized"])
|
||||
xres2 = parse_xres(os.path.join(tmp, ".Xresources"))
|
||||
assert xres2["theme.scale"] == "1.25" and xres2["Xft.dpi"] == "120" and xres2["theme.touchMode"] == "0"
|
||||
|
||||
@@ -372,8 +372,8 @@ def test_gtk_theme_light_dark_detection_and_css_parse():
|
||||
assert txt3.splitlines()[0] == '@import url("resource:///org/gtk/libgtk/theme/Adwaita/gtk-contained.css");'
|
||||
assert txt4.splitlines()[0] == '@import url("resource:///org/gtk/libgtk/theme/Default/Default-light.css");'
|
||||
|
||||
run_env(env, [APPLY_THEME, "AnodeDefault"])
|
||||
t3_dark = os.path.join(tmp, ".themes", "ANODE-AnodeDefault", "gtk-3.0", "gtk.css")
|
||||
run_env(env, [APPLY_THEME, "Anodized"])
|
||||
t3_dark = os.path.join(tmp, ".themes", "ANODE-Anodized", "gtk-3.0", "gtk.css")
|
||||
with open(t3_dark, "r", encoding="utf-8") as f:
|
||||
t3_txt = f.read()
|
||||
assert "menu separator" in t3_txt, t3_txt
|
||||
@@ -412,8 +412,8 @@ def test_gtk_theme_light_dark_detection_and_css_parse():
|
||||
sys.executable,
|
||||
"-c",
|
||||
gtk4_check,
|
||||
os.path.join(tmp, ".themes", "ANODE-AnodeDefault", "gtk-4.0", "gtk.css"),
|
||||
os.path.join(tmp, ".themes", "ANODE-AnodeDefault", "gtk-4.0", "gtk-dark.css"),
|
||||
os.path.join(tmp, ".themes", "ANODE-Anodized", "gtk-4.0", "gtk.css"),
|
||||
os.path.join(tmp, ".themes", "ANODE-Anodized", "gtk-4.0", "gtk-dark.css"),
|
||||
os.path.join(tmp, ".config", "gtk-4.0", "gtk.css"),
|
||||
],
|
||||
env=env,
|
||||
@@ -472,6 +472,93 @@ def test_ui_font_fallback_roboto_to_noto_sans():
|
||||
assert aliases.get("monospace") == ["Fira Code"], aliases
|
||||
|
||||
|
||||
def test_deprecated_anodedefault_fallback_and_install():
|
||||
assert not os.path.exists(os.path.join(THEMES_DIR, "AnodeDefault.xth"))
|
||||
assert os.path.isfile(os.path.join(THEMES_DIR, "Anodized.xth"))
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
env = dict(os.environ)
|
||||
env.pop("DISPLAY", None)
|
||||
env["HOME"] = tmp
|
||||
env["XDG_CONFIG_HOME"] = os.path.join(tmp, ".config")
|
||||
env["XDG_DATA_HOME"] = os.path.join(tmp, ".local", "share")
|
||||
env["ANODE_PREFIX"] = ROOT
|
||||
env["ANODE_NO_SIGNAL"] = "1"
|
||||
env["ANODE_NO_DBUS"] = "1"
|
||||
|
||||
res = run_env(env, [APPLY_THEME, "AnodeDefault"])
|
||||
assert "deprecated" in res.stderr.lower(), res.stderr
|
||||
with open(os.path.join(tmp, ".config", "anode", "theme.conf"), "r", encoding="utf-8") as f:
|
||||
assert "THEME=Anodized" in f.read()
|
||||
|
||||
dl_dir = os.path.join(tmp, "custom_downloads")
|
||||
os.makedirs(dl_dir)
|
||||
custom_src = os.path.join(dl_dir, "SteelMint.xth")
|
||||
with open(custom_src, "w", encoding="utf-8") as f:
|
||||
f.write("theme.name: SteelMint\ntheme.bgMain: #0c1012\ntheme.fgMain: #dce4e8\ntheme.accent: #90c8b8\n")
|
||||
run_env(env, [APPLY_THEME, "--install", custom_src, "InstalledMint"])
|
||||
dest_p = os.path.join(tmp, ".config", "anode", "themes", "InstalledMint.xth")
|
||||
assert os.path.isfile(dest_p)
|
||||
xres = parse_xres(os.path.join(tmp, ".Xresources"))
|
||||
assert xres["theme.name"] == "InstalledMint"
|
||||
|
||||
|
||||
def test_primary_edid_and_apply_display():
|
||||
APPLY_DISP = os.path.join(ROOT, "scripts", "anode-apply-display")
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
fbin = os.path.join(tmp, "bin")
|
||||
os.makedirs(fbin)
|
||||
calls_log = os.path.join(tmp, "xrandr.calls")
|
||||
xr_p = os.path.join(fbin, "xrandr")
|
||||
with open(xr_p, "w", encoding="utf-8") as f:
|
||||
f.write(
|
||||
"#!/bin/sh\n"
|
||||
"if [ \"$1\" = \"--query\" ]; then\n"
|
||||
" cat <<'EOF'\n"
|
||||
"Screen 0: minimum 320 x 200, current 4480 x 1440, maximum 16384 x 16384\n"
|
||||
"DP-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 600mm x 340mm\n"
|
||||
" 2560x1440 59.95*+\n"
|
||||
" 1920x1080 60.00\n"
|
||||
"eDP-1 connected primary 1920x1200+2560+0 (normal left inverted right x axis y axis) 301mm x 188mm\n"
|
||||
" 1920x1200 60.00*+\n"
|
||||
"EOF\n"
|
||||
"else\n"
|
||||
f" printf '%s\\n' \"$*\" >> {calls_log!r}\n"
|
||||
"fi\n"
|
||||
)
|
||||
os.chmod(xr_p, 0o755)
|
||||
|
||||
env = dict(os.environ)
|
||||
env["DISPLAY"] = ":99"
|
||||
env["HOME"] = tmp
|
||||
env["XDG_CONFIG_HOME"] = os.path.join(tmp, ".config")
|
||||
env["XDG_DATA_HOME"] = os.path.join(tmp, ".local", "share")
|
||||
env["ANODE_PREFIX"] = ROOT
|
||||
env["ANODE_NO_SIGNAL"] = "1"
|
||||
env["ANODE_NO_DBUS"] = "1"
|
||||
env["PATH"] = fbin + ":" + env.get("PATH", "")
|
||||
|
||||
# Without xdpyinfo overriding DPI, auto scale must pick connected primary eDP-1 (~162 DPI -> 1.70x)
|
||||
run_env(env, [APPLY_SCALE, "auto", "--no-apply"])
|
||||
with open(os.path.join(tmp, ".config", "anode", "scale.conf"), "r", encoding="utf-8") as f:
|
||||
sconf = f.read()
|
||||
assert "SCALE=1.70" in sconf, sconf
|
||||
|
||||
# Saved multi-monitor profile restores matching signature via atomic xrandr call
|
||||
os.makedirs(os.path.join(tmp, ".config", "anode"), exist_ok=True)
|
||||
with open(os.path.join(tmp, ".config", "anode", "displays.conf"), "w", encoding="utf-8") as f:
|
||||
f.write(
|
||||
"[profile:DP-1,eDP-1]\n"
|
||||
"output=eDP-1,1,1,1920x1200,60.00,0,0,normal\n"
|
||||
"output=DP-1,1,0,2560x1440,59.95,1920,0,left\n"
|
||||
)
|
||||
run_env(env, [APPLY_DISP])
|
||||
with open(calls_log, "r", encoding="utf-8") as f:
|
||||
applied = f.read().strip()
|
||||
assert "--output eDP-1 --mode 1920x1200 --rate 60.00 --pos 0x0 --rotate normal --primary" in applied, applied
|
||||
assert "--output DP-1 --mode 2560x1440 --rate 59.95 --pos 1920x0 --rotate left" in applied, applied
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(os.path.join(ROOT, "data", "env.sh"), "r", encoding="utf-8") as f:
|
||||
env_sh = f.read()
|
||||
@@ -485,4 +572,6 @@ if __name__ == "__main__":
|
||||
test_stale_env_does_not_override_scale_conf()
|
||||
test_gtk_theme_light_dark_detection_and_css_parse()
|
||||
test_ui_font_fallback_roboto_to_noto_sans()
|
||||
print("test_theme_scale: ALL PASSED (7 fractional scales, 22 themes, legacy 192-DPI import, St overrides, auto DPI, scale.conf precedence, GTK light/dark, Roboto->Noto Sans fallback)")
|
||||
test_deprecated_anodedefault_fallback_and_install()
|
||||
test_primary_edid_and_apply_display()
|
||||
print("test_theme_scale: ALL PASSED (7 fractional scales, 22 themes, legacy 192-DPI import, St overrides, auto DPI, scale.conf precedence, GTK light/dark, Roboto->Noto Sans fallback, AnodeDefault fallback/install, primary/displays.conf)")
|
||||
Reference in new issue
Block a user