Repository navigation
Fix Linux compatibility without changing macOS/Windows behavior - #9
Open
josephdadams wants to merge 1 commit into
Open
josephdadams wants to merge 1 commit into
josephdadams wants to merge 1 commit into
Conversation
Several command handlers used Linux branches that no longer work on
mainstream distributions, and one packaging choice made the released
build hard to run. Every change here is confined to the Linux code
path; the darwin and win32 branches are untouched.
- robotjs was imported at module scope in inputHandlers, which the
command table pulls in. A native module that failed to build or load
took down the whole app rather than just sendInput. It now loads
lazily on first use and reports a CommandError(501).
- lock used gnome-screensaver-command, absent from modern GNOME. Try
loginctl lock-session, then xdg-screensaver, then the old command.
- shutdown, reboot and shutdown_cancel invoked sudo, which has no TTY
to prompt on when spawned. On Linux these go through systemd, which
authorizes an active local session via polkit.
- Run at Login silently did nothing: setLoginItemSettings is
macOS/Windows only. Linux now writes an XDG autostart entry,
preferring $APPIMAGE over getPath('exe') since the latter points at
a temporary mount inside an AppImage.
- focusApp falls back to xdotool when wmctrl is unavailable, and
quitApp uses pkill -x so it matches the process name instead of
anything containing that string.
- Ship deb and rpm alongside AppImage, which avoids the missing
libfuse2 on Ubuntu 22.04+, and pin CI to ubuntu-22.04 so the
compiled native module does not require a newer glibc than the
target provides.
Also validate the shutdown 'time' parameter, which was unvalidated and
interpolated into the macOS osascript string.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Several command handlers used Linux branches that no longer work on mainstream distributions, and one packaging choice made the released build hard to run. This fixes them without changing macOS or Windows behavior — every change is confined to the Linux code path, and the
darwin/win32branches are byte-identical to before.What was broken on Linux
robotjsimported at module scope ininputHandlersrunScriptincluded, not justsendInputCommandError(501)with a platform-specific hintlockshelled out tognome-screensaver-commandloginctl lock-session, falling back toxdg-screensaver lock, then the old commandshutdown/reboot/shutdown_cancelusedsudospawngivessudono TTY to prompt on, so these silently failedapp.setLoginItemSettingsis macOS/Windows only — the checkbox wrote to the store and did nothinghelpers/autoLaunch.tswrites an XDG autostart entryfocusApprequiredwmctrlxdotoolquitAppusedpkill -fpkill -x, matching the process namePackaging
debandrpmalongsideAppImage. Ubuntu 22.04+ no longer shipslibfuse2, so the AppImage fails with alibfuse.so.2load error on a stock modern Ubuntu. Native packages sidestep FUSE entirely and give RPM distros a first-class install.ubuntu-22.04(wasubuntu-latest, now 24.04). The native module compiled on the runner links against the build host's glibc, so building on 24.04 (2.39) produced artifacts too new for Ubuntu 22.04 (2.35) and RHEL 9 (2.34). Building on the oldest supported distro widens compatibility.rpmto the Linux apt step for the new target.Incidental hardening
While making the Linux shutdown path shell-free I noticed the
shutdowncommand'stimeparameter was completely unvalidated and interpolated into the macOSosascript -estring. AddedassertNonNegativeIntegerwith test coverage. Valid input behaves exactly as before on every platform.Not fixable in code
Two Linux limitations remain, for the record:
ubuntu-appindicatorsenabled so it works there, but stock GNOME (RHEL 9, Fedora, Debian GNOME) shows nothing — and since Settings and Quit live only in the tray menu, that leaves no way to set the password or port short of hand-editingconfig.json. Worth considering a non-tray settings path separately.sendInputcannot work under Wayland. robotjs is X11/XTest-only, and Ubuntu 22.04+ and RHEL 9 both default to Wayland. The new error message says so explicitly instead of failing opaquely.Also noted, deliberately left alone
runSystemCommandreturnsvoid, so everyawait runSystemCommand(...)in the command table is a no-op — failures reach the socket but never the caller's return value, meaning alockon a box withoutloginctlstill reports "System locked." Fixing that changes error propagation on all three platforms, so it felt out of scope here.Testing
yarn buildclean,yarn test17/17 passing (one new test for the validator).robotjsmethodssendInputCommanduses, so input simulation is unaffected./commandsandgetFontsrespond, password check still rejects bad credentials.shutdownfor obvious reasons.Version bumped 1.9.0 → 1.10.0 (minor: working Linux autostart and the new package targets are user-facing additions, not just fixes).
🤖 Generated with Claude Code