rules: only use X11 code when X11 is available
This commit is contained in:
parent
0427e5607e
commit
7d0402a97f
|
@ -20,20 +20,17 @@ and `hid-logitech-hidpp` loaded. Also, the `udev` package must be installed
|
|||
and its daemon running. If you have a recent Linux distribution, you are
|
||||
most likely good to go.
|
||||
|
||||
Solaar requires Python 3.6+
|
||||
and the `python3-pyudev` package.
|
||||
To run the GUI Solaar also requires Gtk3, its GObject
|
||||
introspection bindings.
|
||||
Solaar requires Python 3.6+ and the
|
||||
`python3-pyudev` package.
|
||||
The Solaar GUI requires the
|
||||
`python3-psutil`, `python3-xlib`, and `python3-pyyaml` packages.
|
||||
To run the GUI Solaar also requires Gtk3 and its GObject introspection bindings.
|
||||
The Debian/Ubuntu packages that need to be installed are
|
||||
`python3-gi` and `gir1.2-gtk-3.0`;
|
||||
in Fedora you need `gtk3` and `python3-gobject`;
|
||||
if you're using another
|
||||
distribution the required packages are most likely named something similar.
|
||||
The Solaar GUI also requires Python packages
|
||||
`PyYAML` (>= 5.1), `python-xlib` (>= 0.27), and `psutil` (>= 5.7.3).
|
||||
These are best installed using `pip` via `pip install --user <package>`
|
||||
if they are not already available.
|
||||
You may have to install the `gcc` and the Python development package (`python3-dev` or `python3-devel`,
|
||||
You may have to install `gcc` and the Python development package (`python3-dev` or `python3-devel`,
|
||||
depending on your distribution).
|
||||
|
||||
If desktop notifications bindings are also installed
|
||||
|
|
|
@ -53,13 +53,14 @@ except Exception:
|
|||
XK_KEYS = {}
|
||||
x11 = False
|
||||
|
||||
if x11:
|
||||
# determine name of active process
|
||||
|
||||
disp_prog = Display()
|
||||
NET_ACTIVE_WINDOW = disp_prog.intern_atom('_NET_ACTIVE_WINDOW')
|
||||
NET_WM_PID = disp_prog.intern_atom('_NET_WM_PID')
|
||||
root2 = disp_prog.screen().root
|
||||
root2.change_attributes(event_mask=Xlib.X.PropertyChangeMask)
|
||||
|
||||
active_process_name = None
|
||||
|
||||
|
||||
|
@ -82,11 +83,13 @@ def determine_active_program():
|
|||
active_process_name = active_program()
|
||||
|
||||
|
||||
if x11:
|
||||
_thread.start_new_thread(determine_active_program, ())
|
||||
|
||||
# determine current key modifiers
|
||||
# there must be a better way to do this
|
||||
|
||||
if x11:
|
||||
display = Display()
|
||||
context = display.record_create_context(
|
||||
0, [record.AllClients], [{
|
||||
|
@ -101,7 +104,6 @@ context = display.record_create_context(
|
|||
'client_died': False,
|
||||
}]
|
||||
)
|
||||
|
||||
modifier_keycodes = display.get_modifier_mapping()
|
||||
current_key_modifiers = 0
|
||||
|
||||
|
@ -162,6 +164,7 @@ TESTS = {
|
|||
|
||||
COMPONENTS = {}
|
||||
|
||||
if x11:
|
||||
displayt = Display()
|
||||
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -63,7 +63,7 @@ battery status, and show and modify some of the modifiable features of devices.
|
|||
'pyudev (>= 0.13)',
|
||||
'PyYAML (>= 5.1)',
|
||||
'python-xlib (>= 0.27)',
|
||||
'psutil (>= 5.7.3)',
|
||||
'psutil (>= 5.6.0)',
|
||||
],
|
||||
package_dir={'': 'lib'},
|
||||
packages=['hidapi', 'logitech_receiver', 'solaar', 'solaar.ui', 'solaar.cli'],
|
||||
|
|
Loading…
Reference in New Issue