Skip to content

desktop-session: add startup logging and improve monitor/lid handling - #16

Merged
krishna-bala merged 5 commits into
mainfrom
claude/apply-local-changes-udassj
Aug 13, 2026
Merged

krishna-bala merged 5 commits into
mainfrom
claude/apply-local-changes-udassj

Conversation

@krishna-bala

Copy link
Copy Markdown
Owner

Add comprehensive graphical-session startup diagnostics and improve display configuration matching for laptop lids.

Summary

This change introduces a new desktop-session-log utility to capture safe, local diagnostics for X11 session startup, and enhances the bspwm monitor-manager to intelligently handle laptop lid state when matching display profiles. It also refactors the polybar network module to use a custom script for better MST monitor name compatibility.

Key Changes

  • New bin/desktop-session-log script: Captures session metadata, active window manager, monitor topology, relevant processes, failed systemd units, and filtered journal events. Logs are stored under XDG_STATE_HOME/desktop-session/ organized by boot ID. Supports three modes: --startup (called from bspwmrc and GNOME autostart), --exit (logs session termination), and --diagnose (manual diagnostic capture).

  • GNOME autostart integration: Added desktop-environment/session/dotfiles-session-log.desktop to invoke the logger during GNOME graphical-session startup.

  • bspwmrc integration: Calls desktop-session-log --startup bspwm at startup and --exit on exit via trap handler. Also sets remove_disabled_monitors true to prevent stale monitor windows from blocking polybar clicks.

  • Monitor profile matching with lid state: Enhanced ProfileService to read ACPI lid state from /proc/acpi/button/lid/*/state and skip profiles with enabled laptop displays when the lid is closed. Falls back to checking for active Xrandr modes when lid state is unavailable. Includes new test cases for lid-closed and clamshell scenarios.

  • New work-laptop profiles: Added work-laptop-woodinville.yaml (with laptop fallback enabled) and work-laptop-woodinville-clamshell.yaml (external monitors only, no laptop display).

  • Polybar network module refactor: Replaced inline internal/network module with custom/script calling new network-label.sh. The script renders wireless/wired icons with signal strength indicators and handles SSID/connection name display. Fixes MST monitor name compatibility issues where dots in output names (e.g., DP-2.1) were misinterpreted as bspc modifier syntax.

  • Polybar bspwm module: Disabled built-in click handlers (enable-click = false) and added explicit label actions using bspc desktop -f %name% to work around MST monitor naming issues.

  • Documentation updates: Updated CLAUDE.md and README.md to reflect new logging infrastructure and reorganized agent-config layout. Changed Dotbot link defaults from force: true to backup: true for safer installation.

Implementation Details

  • The session logger uses umask 077 for privacy and creates boot-ID-indexed logs to correlate multiple session starts within the same boot.
  • Lid state detection is optional and gracefully degrades; profiles can be designed to work with or without lid awareness.
  • The network label script uses nmcli and iw to determine connection type and signal strength, rendering appropriate Nerd Font icons.
  • All new scripts follow the repo's bash conventions (set -u, proper quoting, error handling).

https://claude.ai/code/session_011WEQYKyt4zoh6XGG446RFG

claude added 5 commits August 13, 2026 00:04
Move user-level agent content into the harness-agnostic namespace, keep
Claude integration separate, and make both install configs back up
existing paths instead of forcing replacement.
Add public Woodinville monitor profiles with ACPI lid-aware
auto-selection and scaled clamshell geometry, plus graphical-session
diagnostics and cleanup-safe sxhkd watchdog behavior. Fix Polybar's
network module to render the live Wi-Fi signal and SSID without literal
environment expressions.
Polybar's built-in bspwm click action embeds the monitor name in the bspc
selector, and MST output names such as DP-2.1 contain a '.' that bspc
parses as modifier syntax, so clicks on those bars did nothing. Turn
enable-click off and wrap each desktop label in an explicit
`bspc desktop -f %name%` action instead. Set remove_disabled_monitors too,
so disabling a display leaves no stale monitor window sitting above polybar
and swallowing its clicks.

network-env.sh now leaves NETWORK_LABEL unset on Wi-Fi instead of exporting
the literal %essid%, which nothing has read since the network module became
a custom script; the wired branch still exports the NetworkManager
connection name. Update bspwm/CLAUDE.md to describe that split. Retitle
bspwmrc's EXIT trap message, which fires when the config script finishes
rather than when the session ends.
network-env.sh leaves NETWORK_LABEL unset on Wi-Fi, so the startup line
logged a bare `NETWORK_LABEL=` that reads like a failed lookup rather than
the wireless path. Name the case instead. Uses `-` rather than `:-` so an
empty-but-set value still logs as empty, which would be a real fault.
shellcheck's SC2154 fires on `rc=$?` assigned inside a single-quoted trap
body — it does not track that assignment, so the `$rc` beside it reads as
unassigned and CI fails at `-S warning`. Move the handler into on_exit(),
where `local rc=$?` is an assignment shellcheck can see. The status logged
is unchanged for both an explicit exit and a failing final command.
@krishna-bala
krishna-bala merged commit 507060c into main Aug 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants