gnome_dbus_interface_setup() imports dbus inside the try block but catches
dbus.exceptions.DBusException. If the import itself raises ImportError --
dbus-python is only installed on Linux -- the name dbus is unbound, so the
ImportError is not caught and merely evaluating the except clause raises
NameError. Catch Exception instead.
evdev was imported unconditionally on every OS except macOS and Windows,
i.e. the code assumed "not macOS and not Windows" means Linux. On any
other platform the import is a hard failure at startup.
evdev is also genuinely optional: setup.py only installs it when
platform_system == "Linux", and packagers may make it optional. Select on
whether the module imports rather than on the OS name.
click_uinput() dereferenced evdev.ecodes before calling simulate_uinput(),
so it raised AttributeError rather than degrading; click() has no handler,
so that escaped to the caller. Bail out early there and in setup_uinput()
when evdev is absent. simulate_scroll() was already safe, but only because
setup_uinput()'s blanket except swallowed the AttributeError.
Use hidapi on macOS to communicate and configure Logitech peripherals
connected via Bluetooth. This brings macOS device support on the same
level as Linux. However, some rules might not be supported yet on macOS.
Tested with MX Keys and MX Master 3S.
Fixes#2729
Warnings found by automatic code inspection and partially tackled
- Drop distuitls inf favour of setuptools
- Replace deprecated pyudev.Device.from_device_number
- Remove unnecessary brackets
- Avoid access to private variables etc.
- Shadows built-in name
- Line length >120 characters
- Not a module level variable
- Simplify clause
and more
* Fix CI for macOS
* Fix error message for missing hidapi
* Skip some device and receiver tests on macOS
Tests fail on macOS, enable them when unit tests are
refined to only test the module without dependencies.
* Safe guard dbus import
device: move some imports to top of modules
device: break up imports loop with device descriptors
device: break up imports loop by moving a function from notifications.py to setting_templates.py
device: break import loop between device.py and diversion.py by using device to access method
* Add support for macOS via hidapi
* Style fixes
* Ignore keyboard and mouse input devices
* Don't require pyudev on mac and windows
* Fix debug log format error
* More logging for failed hidpp checks
* Don't try to load hid_darwin_set_open_exclusive on windows
* Bring back button for rule editor since some rules will work
---------
Co-authored-by: markopy <(none)>
Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
* Add support for process condition under wayland using solaar-gnome-extension
* Fix typo
* Improvements
* Rename dbus extension
* Final fixes
* Fix style checks
* More styling fixes
* More fixes
* More fixes
---------
Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>