rules: handle missing libX11 more gracefully and document dependency
This commit is contained in:
parent
d500642352
commit
fc2b8accbf
|
@ -136,10 +136,6 @@ for the step-by-step procedure for manual installation.
|
|||
- Sometimes the system tray icon does not show up. The cause of this is unknown.
|
||||
Either wait a while and try again or try with the `--window=hide` option.
|
||||
|
||||
- Running the command-line application while the GUI
|
||||
application is also running *may* occasionally cause either of them to become
|
||||
confused about the state of the devices.
|
||||
|
||||
- Some Linux drivers view or modify the setting Scroll Wheel Resolution to
|
||||
implement smooth scrolling. If Solaar changes this setting after the driver is
|
||||
set up scrolling can be either very fast or very slow. To fix this problem
|
||||
|
@ -156,6 +152,8 @@ for the step-by-step procedure for manual installation.
|
|||
but this needs write permission on /dev/uinput.
|
||||
For more information see [the rules page](https://pwr-solaar.github.io/Solaar/rules).
|
||||
|
||||
- Sometimes bluetooth connections are not torn down correctly.
|
||||
This can result in two entries in Solaar for the same device, with only one being active.
|
||||
|
||||
## Contributing to Solaar
|
||||
|
||||
|
|
|
@ -35,6 +35,13 @@ depending on your distribution).
|
|||
If you are running a version of Python different from the system version,
|
||||
you may need to use pip to install projects that provide the above Python packages.
|
||||
|
||||
Solaar runs best under X11 with the Xtest extension enabled so that Solaar rules can fake keyboard input using Xtest.
|
||||
Solaar also uses the X11 library to access the XKB extension,
|
||||
which requires installation of the X11 development package.
|
||||
(In Fedora this is `libX11-devel`. In other distributions it may be `libX11-dev`.)
|
||||
Solaar will run under Wayland but some parts of Solaar rules will not work.
|
||||
For more information see [the rules page](https://pwr-solaar.github.io/Solaar/rules).
|
||||
|
||||
If desktop notifications bindings are also installed
|
||||
(`gir1.2-notify-0.7` for Debian/Ubuntu),
|
||||
you will also see desktop notifications when devices come online/go offline.
|
||||
|
|
|
@ -80,6 +80,16 @@ try:
|
|||
NET_WM_PID = xdisplay.intern_atom('_NET_WM_PID')
|
||||
WM_CLASS = xdisplay.intern_atom('WM_CLASS')
|
||||
|
||||
except Exception:
|
||||
_log.warn(
|
||||
'X11 not available - rules cannot access current process, modifier keys, or keyboard group. %s',
|
||||
exc_info=_sys.exc_info()
|
||||
)
|
||||
modifier_keycodes = []
|
||||
x11 = False
|
||||
|
||||
if x11:
|
||||
try:
|
||||
# set up to get keyboard state using ctypes interface to libx11
|
||||
import ctypes
|
||||
|
||||
|
@ -99,17 +109,14 @@ try:
|
|||
X11Lib.XOpenDisplay.restype = ctypes.POINTER(XkbDisplay)
|
||||
X11Lib.XkbGetState.argtypes = [ctypes.POINTER(XkbDisplay), ctypes.c_uint, ctypes.POINTER(XkbStateRec)]
|
||||
Xkbdisplay = X11Lib.XOpenDisplay(None)
|
||||
except Exception:
|
||||
_log.warn(
|
||||
'X11 not available - rules cannot access current process, modifier keys, or keyboard group. %s',
|
||||
exc_info=_sys.exc_info()
|
||||
)
|
||||
modifier_keycodes = []
|
||||
x11 = False
|
||||
|
||||
except Exception:
|
||||
_log.warn('X11 library not available - rules cannot access keyboard group. %s', exc_info=_sys.exc_info())
|
||||
Xkbdisplay = None
|
||||
|
||||
|
||||
def kbdgroup():
|
||||
if x11:
|
||||
if Xkbdisplay:
|
||||
state = XkbStateRec()
|
||||
X11Lib.XkbGetState(Xkbdisplay, XkbUseCoreKbd, ctypes.pointer(state))
|
||||
return state.group
|
||||
|
|
Loading…
Reference in New Issue