* Add scripts to create macOS app bundle and LaunchAgent #1244
This change introduces two new helper scripts for macOS users to improve integration with the operating system.
The `create-macos-app.sh` script builds a minimal `.app` wrapper for Solaar. This allows Solaar to be treated as a standard macOS application, enabling it to request necessary permissions, such as input monitoring, and to be discoverable by the OS. The script generates the required directory structure, a wrapper executable to launch Solaar, a standard `Info.plist` file, and an application icon from the source PNG.
The `create-macos-launchagent.sh` script sets up a LaunchAgent to automatically start Solaar at login and keep it running in the background. This ensures that the Solaar process is always available for device management without requiring manual intervention from the user. The script also configures log file locations for standard output and error streams.
Together, these scripts provide a more native and user-friendly experience for Solaar on macOS.
https://github.com/pwr-Solaar/Solaar/issues/1244
* Fix icon in script to create macOS app bundle #1244https://github.com/pwr-Solaar/Solaar/issues/1244
* build: Remove hardcoded Homebrew path for solaar in macOS script
The `create-macos-app.sh` script previously defaulted to a hardcoded Homebrew path for the `solaar` executable. This change removes the specific path, defaulting instead to `solaar`.
This modification makes the script more flexible and robust. It allows the system's `PATH` to resolve the location of the `solaar` binary, accommodating various installation methods beyond a fixed Homebrew directory. The explicit check for the executable's existence is also removed, as the script will now rely on the command being available in the shell's environment, which is a more standard approach.
* refactor(macos): Improve solaar executable lookup in launchagent script
This change improves how the `create-macos-launchagent.sh` script locates the `solaar` executable.
Previously, the script defaulted to a hardcoded path (`/opt/homebrew/bin/solaar`) and would exit with an error if that specific file was not found and executable. This was too restrictive and failed in environments where `solaar` is installed in a different location, such as through `pipx` or in standard system paths like `/usr/local/bin`.
Now, the script defaults the `SOLAAR_PATH` to just `solaar` and uses the `command -v` utility to find the executable in the user's `PATH`. This allows the system to resolve the correct location of the `solaar` binary automatically. If the executable cannot be found in the `PATH`, the script now issues a warning instead of exiting, and proceeds to use the provided `SOLAAR_PATH` value in the generated LaunchAgent plist. This makes the script more flexible and robust for different installation methods.
* refactor(macos): Improve solaar executable lookup in launchagent script
This change improves how the `create-macos-launchagent.sh` script locates the `solaar` executable.
Previously, the script defaulted to a hardcoded path (`/opt/homebrew/bin/solaar`) and would exit with an error if that specific file was not found and executable. This was too restrictive and failed in environments where `solaar` is installed in a different location, such as through `pipx` or in standard system paths like `/usr/local/bin`.
Now, the script defaults the `SOLAAR_PATH` to just `solaar` and uses the `command -v` utility to find the executable in the user's `PATH`. This allows the system to resolve the correct location of the `solaar` binary automatically. If the executable cannot be found in the `PATH`, the script now issues a warning instead of exiting, and proceeds to use the provided `SOLAAR_PATH` value in the generated LaunchAgent plist. This makes the script more flexible and robust for different installation methods.
* refactor: Improve Solaar path resolution in macOS helper scripts
This change improves the robustness of the macOS helper scripts by ensuring the Solaar executable is found before proceeding.
Previously, `create-macos-launchagent.sh` would only issue a warning and continue with a potentially invalid path if the `solaar` command was not found. `create-macos-app.sh` had a typo (`SOLAR_PATH`) and lacked a check altogether.
Now, both scripts (`create-macos-app.sh` and `create-macos-launchagent.sh`) will:
- Correctly check if the `solaar` executable exists in the system's `PATH`.
- Use the resolved, absolute path to the executable to avoid ambiguity.
- Exit with an error if the executable cannot be found, preventing the creation of a broken app bundle or launch agent.
* feat(macos): Relaunch app to fix tray icon and add Dock icon
This change modifies the macOS app bundle creation script to improve the application's behavior and user experience on macOS.
Previously, when Solaar was launched as a standard `.app` bundle, macOS restrictions sometimes prevented the GTK tray icon from appearing correctly. This change introduces a workaround in the wrapper script. The application now relaunches itself as a detached background process on the first launch. This new, detached process is no longer subject to the same `.app` bundle restrictions, allowing the tray icon to be created reliably.
Additionally, the `LSUIElement` key in the `Info.plist` is set to `false`. This makes Solaar a regular application with an icon in the Dock, which is the standard behavior expected by most macOS users for a graphical application.
* docs: Explain macOS Python.app Dock icon limitation
This change adds a comment to the `create-macos-app.sh` script to explain why the Solaar application may still show a Dock icon on macOS, even when it is not desired for a background utility.
On macOS, Python often runs as `Python.app`, which has its own `Info.plist` file. This built-in `Info.plist` takes precedence over the one generated for the Solaar app bundle. As a result, settings like `LSUIElement=true`, which would normally hide the Dock icon, are overridden. This comment clarifies that this behavior is a known limitation of the Python distribution on macOS and not a bug in the Solaar packaging script.
* docs: Add instructions for creating macOS launcher options
This update enhances the installation guide by including steps to set up macOS launchers for Solaar. Two options are provided:
- LaunchAgent for automatic background execution and crash recovery.
- App launcher for manual addition to Login Items.
Fix the `Failed to load shared library 'libglib-2.0.0.dylib' referenced
by the typelib` error by adding the common Homebrew's shared library
directory (i.e., `$(brew --prefix)/lib`) to the dyld library search path.
This ensures that all Homebrew-installed shared libraries are discoverable
via `dlopen()`-like loading mechanism. (Previously, only directory
with `libhidapi` shared library was explicitly added to search path).
Use `DYLD_FALLBACK_LIBRARY_PATH` instead of `DYLD_LIBRARY_PATH` to
register the Homebrew library directory as a fallback search path
rather than preferred/default one. In general, this should be
preferred way of modifying library search path with 3rd-party
installations, even though it probably bears no real difference in
this particular scenario.
These actions now need to react to "change" uevents, not only "add"
uevents. The recommendation from
5a8b9fd49f/NEWS (L22)
is to apply them on all non-"remove" uevents, which is what is done
here.
See also https://bugs.debian.org/1112660
Signed-off-by: Stephen Kitt <steve@sk2.org>
* Unsupported locale: Fall back to English
For any locale that is not supported, automatically fall back to no
translation, so it is English.
Fixes#2889
* Update lib/solaar/i18n.py
---------
Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
* Fix listing hidpp10 devices - bytes vs string concatenation
Fix error concatenating a bytes with a string.
Closes#2855.
Fixes: 5e0c85a6 receiver: Refactor extraction of serial and max. devices
* Update lib/logitech_receiver/receiver.py
---------
Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
The Flag enum was applied the value method twice. remove the value
method call from the set_flag_bits in device.py. There is no such value
call in receiver.py set_flag_bits in the same commit so I believe this
was a mistake.
With this fix the LX7 mouse is properly enumerated over a Logitech
C-BT44 Receiver (seen as EX100, compatible 27MHz FastRF protocol)
Close#2850.
Fixes: 72c9dfc5 Remove NamedInts: Convert NotificationFlag to flag
Fixes "solaar show" for hidpp10 device (or at least for 27MHz FastRF
hidpp10 peripherals).
Fixes: 72c9dfc5 Remove NamedInts: Convert NotificationFlag to flag
python 3.13 brings pygobject >= 3.52.1 which requires libgirepository 2.0.
Add gobject-introspection has libgirepository-2.0-dev does not depends
on it and it is required by PyGObject.
Closes#2857.