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.
|
- 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.
|
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
|
- Some Linux drivers view or modify the setting Scroll Wheel Resolution to
|
||||||
implement smooth scrolling. If Solaar changes this setting after the driver is
|
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
|
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.
|
but this needs write permission on /dev/uinput.
|
||||||
For more information see [the rules page](https://pwr-solaar.github.io/Solaar/rules).
|
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
|
## Contributing to Solaar
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,13 @@ depending on your distribution).
|
||||||
If you are running a version of Python different from the system version,
|
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.
|
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
|
If desktop notifications bindings are also installed
|
||||||
(`gir1.2-notify-0.7` for Debian/Ubuntu),
|
(`gir1.2-notify-0.7` for Debian/Ubuntu),
|
||||||
you will also see desktop notifications when devices come online/go offline.
|
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')
|
NET_WM_PID = xdisplay.intern_atom('_NET_WM_PID')
|
||||||
WM_CLASS = xdisplay.intern_atom('WM_CLASS')
|
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
|
# set up to get keyboard state using ctypes interface to libx11
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|
||||||
|
@ -99,17 +109,14 @@ try:
|
||||||
X11Lib.XOpenDisplay.restype = ctypes.POINTER(XkbDisplay)
|
X11Lib.XOpenDisplay.restype = ctypes.POINTER(XkbDisplay)
|
||||||
X11Lib.XkbGetState.argtypes = [ctypes.POINTER(XkbDisplay), ctypes.c_uint, ctypes.POINTER(XkbStateRec)]
|
X11Lib.XkbGetState.argtypes = [ctypes.POINTER(XkbDisplay), ctypes.c_uint, ctypes.POINTER(XkbStateRec)]
|
||||||
Xkbdisplay = X11Lib.XOpenDisplay(None)
|
Xkbdisplay = X11Lib.XOpenDisplay(None)
|
||||||
except Exception:
|
|
||||||
_log.warn(
|
except Exception:
|
||||||
'X11 not available - rules cannot access current process, modifier keys, or keyboard group. %s',
|
_log.warn('X11 library not available - rules cannot access keyboard group. %s', exc_info=_sys.exc_info())
|
||||||
exc_info=_sys.exc_info()
|
Xkbdisplay = None
|
||||||
)
|
|
||||||
modifier_keycodes = []
|
|
||||||
x11 = False
|
|
||||||
|
|
||||||
|
|
||||||
def kbdgroup():
|
def kbdgroup():
|
||||||
if x11:
|
if Xkbdisplay:
|
||||||
state = XkbStateRec()
|
state = XkbStateRec()
|
||||||
X11Lib.XkbGetState(Xkbdisplay, XkbUseCoreKbd, ctypes.pointer(state))
|
X11Lib.XkbGetState(Xkbdisplay, XkbUseCoreKbd, ctypes.pointer(state))
|
||||||
return state.group
|
return state.group
|
||||||
|
|
Loading…
Reference in New Issue