Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for wlroots-based Wayland compositors like Sway #1461

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include plover/gui_qt/resources/*.qrc
include plover/gui_qt/resources/*.svg
include plover/messages/*/LC_MESSAGES/*.po
include plover/messages/plover.pot
include plover/oslayer/wayland/*.xml
include plover_build_utils/*.sh
include pyproject.toml
include pytest.ini
Expand Down
1 change: 1 addition & 0 deletions news.d/feature/1461.linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for wlroots-based Wayland compositors like Sway, and other compositors that implement the `virtual_keyboard_unstable_v1` and `input_method_unstable_v2` protocols.
10 changes: 10 additions & 0 deletions plover/oslayer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
else:
PLATFORM = None

if PLATFORM in {'linux', 'bsd'}:
if os.environ.get('WAYLAND_DISPLAY', None):
DISPLAY_SERVER = 'wayland'
else:
DISPLAY_SERVER = 'xorg'
elif PLATFORM in {'win', 'mac'}:
DISPLAY_SERVER = PLATFORM
else:
DISPLAY_SERVER = None

# If the program's working directory has a plover.cfg file then run in
# "portable mode", i.e. store all data in the same directory. This allows
# keeping all Plover files in a portable drive.
Expand Down
12 changes: 7 additions & 5 deletions plover/oslayer/keyboardcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@

"""

from plover.oslayer.config import PLATFORM
from plover.oslayer.config import DISPLAY_SERVER

KEYBOARDCONTROL_NOT_FOUND_FOR_OS = \
"No keyboard control module was found for platform: %s" % PLATFORM
"No keyboard control module was found for platform: %s" % DISPLAY_SERVER

if PLATFORM in {'linux', 'bsd'}:
if DISPLAY_SERVER == 'xorg':
from plover.oslayer import xkeyboardcontrol as keyboardcontrol
elif PLATFORM == 'win':
elif DISPLAY_SERVER == 'wayland':
from plover.oslayer import waykeyboardcontrol as keyboardcontrol
elif DISPLAY_SERVER == 'win':
from plover.oslayer import winkeyboardcontrol as keyboardcontrol
elif PLATFORM == 'mac':
elif DISPLAY_SERVER == 'mac':
from plover.oslayer import osxkeyboardcontrol as keyboardcontrol
else:
raise Exception(KEYBOARDCONTROL_NOT_FOUND_FOR_OS)
Expand Down
Loading