macOS: restore GlazeWM's Karabiner variable after Karabiner restarts

Open Beginner friendly
#61 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
lua, macos
Domain
desktop

Research direction

Read macos/glazewm/stowed/.local/bin/glazewm-helper, focusing on the main loop, written, and sync_once. Clear written about once a minute so the current value is rewritten, while preserving the immediate start write and shutdown reset. With GlazeWM running, restart Karabiner-Elements and confirm the bindings return within about a minute.

Written by the indexing model from the issue text.

Description

Follow-up to #55. Low priority: rare, and fails safe.

Problem

macos/glazewm/stowed/.local/bin/glazewm-helper keeps Karabiner's glazewm_running variable in step with GlazeWM. It writes the variable only when the value changes from the last value it wrote (written).

Karabiner keeps variables in memory. When Karabiner's core service restarts, for example after a Karabiner-Elements update or a manual restart, the variable is back to unset. The helper still has written=1, so it never writes it again. The Left Option rule stays off and the GlazeWM bindings stop working until GlazeWM restarts or the Mac wakes from sleep (the wake path rewrites it).

This fails safe: with the rule off, Left Option+key reaches apps as plain Option+key.

CodeRabbit flagged the same thing on #55.

Fix

In the main loop, clear written about once a minute so the next sync_once writes the current value again. One karabiner_cli call a minute is cheap. Keep the immediate write on GlazeWM start and the shutdown command's immediate reset.

For the Mac agent to check

  1. With GlazeWM running, restart Karabiner-Elements (quit and reopen it, or launchctl kickstart -k on its core service if allowed). Do the GlazeWM bindings come back within about a minute?
Dominant language
Lua
Stars
10
Forks
2
Avg merge
4h 53m
Merged PRs (30d)
30

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Gelio/dotfiles

All issues in Gelio/dotfiles

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.