File tree Expand file tree Collapse file tree 5 files changed +10
-3
lines changed
Expand file tree Collapse file tree 5 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 2323from plover import _
2424from plover .oslayer .serial import patch_ports_info
2525from plover .oslayer .config import PLATFORM
26+ from plover .oslayer .linux .display_server import DISPLAY_SERVER
2627
2728from plover .gui_qt .config_keyboard_widget_ui import Ui_KeyboardWidget
2829from plover .gui_qt .config_serial_widget_ui import Ui_SerialWidget
@@ -204,7 +205,7 @@ def __init__(self):
204205 )
205206 )
206207 self ._value = {}
207- if PLATFORM == "linux" :
208+ if PLATFORM == "linux" and DISPLAY_SERVER == "wayland" :
208209 self .setup_keyboard_selection ()
209210
210211 def setValue (self , value ):
Original file line number Diff line number Diff line change 99from plover .misc import boolean
1010from plover .oslayer .keyboardcontrol import KeyboardCapture
1111from plover .oslayer .config import PLATFORM
12+ from plover .oslayer .linux .display_server import DISPLAY_SERVER
1213
1314
1415# i18n: Machine name.
@@ -91,7 +92,7 @@ def start_capture(self):
9192 self ._initializing ()
9293 try :
9394 self ._keyboard_capture = KeyboardCapture ()
94- if PLATFORM == "linux" :
95+ if PLATFORM == "linux" and DISPLAY_SERVER == "wayland" :
9596 self ._keyboard_capture .set_keyboard_selection (self ._keyboard_selection )
9697 self ._keyboard_capture .key_down = self ._key_down
9798 self ._keyboard_capture .key_up = self ._key_up
Original file line number Diff line number Diff line change 66 - wayland
77 - tty
88"""
9+ print (os .environ .items ())
910DISPLAY_SERVER = os .environ .get ("XDG_SESSION_TYPE" , None )
Original file line number Diff line number Diff line change 55from plover .machine .keymap import Keymap
66from plover .oslayer .keyboardcontrol import KeyboardCapture
77from plover .oslayer .config import PLATFORM
8+ from plover .oslayer .linux .display_server import DISPLAY_SERVER
89
910from unittest import mock
1011
@@ -66,7 +67,7 @@ def strokes(machine):
6667def test_lifecycle (capture , machine , strokes ):
6768 # Start machine.
6869 machine .start_capture ()
69- if PLATFORM == "linux" :
70+ if PLATFORM == "linux" and DISPLAY_SERVER == "wayland" :
7071 assert capture .mock_calls == [
7172 mock .call .set_keyboard_selection ("" ),
7273 mock .call .start (),
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ setenv =
6060 # Linux: add to library path so ctypes can find hidapi libraries
6161 LD_LIBRARY_PATH = {env:HIDAPI_DEV_LIB_LNX}{:}{env:LD_LIBRARY_PATH:}
6262
63+ # Linux: pass XDG_SESSION_TYPE to distinguish between X and Wayland
64+ XDG_SESSION_TYPE = {env:XDG_SESSION_TYPE}
65+
6366 # Windows: not done via path; see dev/write_hidapi_pth.py
6467
6568# Lightweight tests only environments.
You can’t perform that action at this time.
0 commit comments