11 KiB
11 KiB
ANODE session management & status bar
Starting or live-replacing an X11 session
- Fresh X11 startup: Launch ANODE from
~/.xinitrc(exec /usr/local/bin/anode-session [--profile NAME]) or select the installedANODEsession in a display manager. PassXSESSIONSDIR=/usr/share/xsessionstomake install(e.g.sudo make XSESSIONSDIR=/usr/share/xsessions install) when installing into/usr/localso LightDM, SDDM, and GDM discoveranode.desktop.anode-sessionalso accepts--replaceand--no-autostartand forwards--replacetodwm --replace. - Live replacement (
anode-replace): Replace an active X11 window manager or desktop session without logging out or closing open X11 windows, or switch to a clean ANODE display-manager session on a new VT:
anode-replace --dry-run
anode-replace
anode-replace --switch-session
anode-replace --profile work --keep-panels
| Flag | Behavior |
|---|---|
--profile NAME / --profile=NAME |
Pass session autostart profile NAME (ANODE_SESSION_PROFILE) to anode-session |
--keep-panels |
Keep existing third-party panels, notification daemons, and settings daemons running |
--foreground |
Exec anode-session --replace in the foreground instead of detaching |
--no-autostart |
Skip anode-autostart start during replacement |
--force |
Proceed with in-place replacement even when the active WM is a direct session child of a display manager or xinit |
--switch-session |
Switch via LightDM (dm-tool switch-to-user) to an anode XSession when no user session is active yet; if a LightDM session for the current user is already active (where dm-tool merely refocuses the current VT), schedule a one-shot ~/.xprofile handoff ($XDG_CACHE_HOME/anode/switch-once) and exit the current WM so LightDM starts ANODE cleanly and returns to the previous default session on logout |
--dry-run |
Print the detected WM (_NET_SUPPORTING_WM_CHECK window, PID, parent process, and DM session-leader warning) without replacing |
-h, --help |
Print command usage and exit |
- Display manager session-leader safety guard: When a standalone window manager (such as
i3) was launched directly as the session child of a display manager (lightdm,sddm,gdm,xdm,lxdm,slim,ly,greetd,emptty) orxinit/startx, causing it to exit via ICCCM replacement makes the display manager terminate the X server and restart/log out the session.anode-replaceresolves the active WM PID (via_NET_WM_PIDor falling back to a UID-filteredpslookup by_NET_WM_NAMEwhen_NET_WM_PIDis omitted), checks its parent process, and refuses destructive in-place replacement unless--forceis given — recommendinganode-replace --switch-session(aftersudo make XSESSIONSDIR=/usr/share/xsessions install) or selectingANODEat login instead. - ANODE session holder (
exit 75): Whendwmyields ownership to another WM via ICCCMSelectionClear,dwmexits with status75.anode-sessionstops its old background daemons and remains alive monitoring_NET_SUPPORTING_WM_CHECKuntil the replacement WM exits cleanly (tolerating brief transient reloads across 2 s) so a display manager does not kill the X server during in-place handoff. - Two-stage WM handoff:
- ICCCM 2.0
WM_S<screen>takeover:dwmclaimsWM_S<screen>on its check window and handlesSelectionClearby cleanly unwinding (replaced_by_other = 1; restart_dwm = 0; running = 0;). When invoked with--replace,dwmacquiresWM_S<screen>, broadcasts a rootMANAGERClientMessage, and pollsConnectionNumber(dpy)for up to 5 s until the previous owner destroys its selection window and releasesSubstructureRedirectMask. - Non-ICCCM fallback: Before launching
anode-session --replace,anode-replacerecords_NET_WM_PID(or UID-matched WM PID fallback) from_NET_SUPPORTING_WM_CHECK. If the previous window manager still holds_NET_SUPPORTING_WM_CHECKafter 1.5 s and its PID belongs to the current UID (checked via POSIXps),anode-replacesendsSIGTERMsodwm --replacecan take overSubstructureRedirectMask.
- ICCCM 2.0
- Process cleanup & detached readiness:
anode-replaceterminates duplicate UID-owned ANODE daemons (anode-statusd,anode-powerd,anode-touchd,anode-vkbd) and, unless--keep-panelsis given, stops conflicting third-party panels, notification daemons, and settings daemons (xfce4-panel,mate-panel,lxpanel,i3bar,tint2,polybar,lemonbar,fbpanel,plank,wingpanel,dunst,xfce4-notifyd,xsettingsd,xfsettingsd). By default it launchesanode-session --replaceimmune toSIGHUPand waits up to 5 s forANODE WMto advertise itself on_NET_SUPPORTING_WM_CHECK.
Desktop environment & window manager identity
- EWMH & ICCCM properties:
dwmsets_NET_WM_NAME = "ANODE WM",XA_WM_NAME = "ANODE WM",_NET_SUPPORTING_WM_CHECK, and_NET_WM_PIDonwmcheckwin, and sets{"anode-wm", "ANODE"}as theXClassHinton status bar windows. - Clean session environment: Both
anode-sessionandanode-replaceunset stale third-party DE variables (KDE_FULL_SESSION,KDE_SESSION_VERSION,KDE_SESSION_UID,GNOME_DESKTOP_SESSION_ID,MATE_DESKTOP_SESSION_ID,CINNAMON_VERSION,XFCE_SESSION,LXQT_SESSION_CONFIG,TDE_FULL_SESSION,HYPRLAND_INSTANCE_SIGNATURE,SWAYSOCK,I3SOCK,BSPWM_SOCKET,WINDOWMAKER,E_START,GDMSESSION) as well as stale foreignGTK_THEMEoverrides unlessANODE_KEEP_GTK_THEME=1, exportXDG_CURRENT_DESKTOP=ANODE,XDG_SESSION_DESKTOP=anode,DESKTOP_SESSION=anode, andXDG_SESSION_TYPE=x11, sync DE identity andQT_QPA_PLATFORMTHEME=gtk3:qt6ct:qt5ctto DBus/systemd user activation environments when available (unlessANODE_NO_DBUS=1), andanode-sessionrefreshes generated GTK/Qt/Fontconfig/Dunst theme files viaanode-sync-gtk-themeandanode-sync-dunst-themeon startup even when~/.Xresourcesalready exists. - System info reporting: Tools such as
fastfetchreportDesktop Environment: ANODEandWindow Manager: ANODE WM (X11)instead ofdwm. Terminals that were already open before runninganode-replacekeep their earlier shell environment until a new terminal is launched orexport XDG_CURRENT_DESKTOP=ANODEis run.
Status bar & XKB layout indicator
- Format:
anode-statusdpublishesVOL <n%> | CPU <c%> | RAM <r%> | <bat/AC> | <xkb> | YYYY-MM-DD HH:MM(plusVOL MUTEwhen muted) to the X11 rootWM_NAME. TheVOLsegment is omitted when no audio backend is detected,CPU/RAMuse cross-Unix kernel telemetry (/proc/stat+/proc/meminfoon Linux,sysctlon FreeBSD/OpenBSD/NetBSD), and<xkb>is omitted cleanly if XKB is unavailable. - Text-only layout indicator:
<xkb>is a plain lowercase ASCII layout code (for exampleus,de,ru,ua,latam,jp) positioned immediately to the left of the datetime with no prefix labels, icons, or graphics. - Event-driven status loop: After
XkbQueryExtension(),anode-statusdsubscribes toXkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbNamesNotifyMask(XkbSelectEvents) andXkbStateNotifyfiltered solely toXkbGroupStateMask(XkbSelectEventDetails) so regular keystrokes and modifier presses never wake the loop, pairing XKB/signal events with a<= 2000 mspoll()refresh cadence for CPU/RAM telemetry and minute-aligned clock ticks without busy-polling. - Layout code resolution (
src/common/anode_xkb_parse.h):- Parse the live XKB symbols name (
XkbSymbolsNameMask), handlingsetxkbmapandxkbcompkeymaps while stripping:Ngroup selectors,(variant)suffixes, vendor prefixes (such asnec_vndr/jp->jp), and non-layout components (pc,evdev,inet,group,level3, etc.). - Fall back to the root
_XKB_RULES_NAMESlayouts CSV when the symbols string cannot be matched. - Fall back to the first two lowercase ASCII letters of the active XKB group name (
XkbGroupNamesMask).
- Parse the live XKB symbols name (
Application launcher & XDG integration
- Normalized XDG & Flatpak search path (
data/env.sh):anode-sessionsourcesdata/env.sh, which normalizes and exportsXDG_DATA_DIRSwithout duplicates while appending$XDG_DATA_HOME/flatpak/exports/share,/var/lib/flatpak/exports/share, and/var/lib/snapd/desktopwhen present. - Desktop entry discovery (
scripts/anode-launcher): Recursively scansapplications/directories (regular.desktopfiles and symlinks), builds standard XDG Desktop File IDs (translating subdirectories to-) so earlier user entries andHidden=true/NoDisplay=trueentries mask lower-priority system entries cleanly, and accepts--listto inspect resolved entries (label<TAB>workdir<TAB>term<TAB>cmd). - Execution semantics: Enforces
Type=Application, case-insensitiveOnlyShowIn/NotShowInmatching againstXDG_CURRENT_DESKTOP,TryExecexecutability/PATHchecks, locale priority (LC_ALL/LC_MESSAGES/LANG) forNameandGenericName, Flatpak@@u %U @@wrapper and%i/%c/%k/%%field-code handling,[Desktop Action ...]sub-entries,Path=working directory changes,Terminal=trueexecution viast -e,DBusActivatable=trueactivation viagdbus, andsetsidbackground detachment. - Full-height
dmenulayout:anode-launcherinvokesdmenu -i -l 0; insrc/dmenu/dmenu.c, passing-l 0(or omitting-l) fills the active monitor height (mh = sh) with all fitting(sh - bh) / bhrows, whereas explicit-l Nsizes the menu tightly to(N + 1) * bh.
Idle power policy & screen locking
- Idle policy (
src/daemons/anode-powerd.c&src/common/anode_power_policy.h): Defaults to5 mindim (DIM_SEC=300, dimming tomax(0.35, 45%)of current brightness and polling every500 mswhile dimmed for responsive wake),10 minlock (LOCK_SEC=600),30 minbattery-only suspend (SUSPEND_SEC=1800,SUSPEND_ON_AC=0), and5%critical-battery warning/suspend (CRIT_BATT_PCT=5), configurable in$XDG_CONFIG_HOME/anode/power.conf. - Brightness restoration & backlight access: Automatically restores saved brightness when waking from
ANODE_PWR_DIMMED/ANODE_PWR_LOCKED/ANODE_PWR_SUSPENDEDor on daemon exit. On Linux,anode_backlight_get()(src/common/anode_plat.c) verifies writable/sys/class/backlight/*/brightness(access(..., W_OK) == 0) before using sysfs, falling back tobrightnessctl/xrandrwhen unprivileged. - Screen-lock authentication & stacking (
src/daemons/anode-checkpw.c,src/apps/anode-lock.c): Verifies against/etc/shadow/ BSDgetpwnamdirectly when permitted and falls back to the setuid PAM helper (/sbin/unix_chkpwd//usr/sbin/unix_chkpwd//usr/libexec/unix_chkpwd) when running non-root;make installapplieschmod 4755toanode-checkpwwhen invoked asrootwith an emptyDESTDIR.anode-lock(fullscreen_override) stays visually stacked abovedwm's systray (systray->winconfiguredAbovem->barwin) and status bar while still allowinganode-vkbdon top when toggled.