Skip to content

Commit

Permalink
Switch keyboard management to Localed
Browse files Browse the repository at this point in the history
Because of the switch to Wayland Anaconda has to change compositor
keyboard manager because libxklavier doesn't work on Wayland.

To fix that we migrated to Gnome Kiosk DBus API in RHEL-10, however,
this solution can't be used outside of Gnome Kiosk. For that reason,
we are switching to Localed which we set as the default to enable
Anaconda to control keyboard switching.
  • Loading branch information
jkonecny12 committed Aug 28, 2024
1 parent 2342a26 commit 7931f1f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 335 deletions.
5 changes: 0 additions & 5 deletions pyanaconda/modules/common/constants/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@

# Session services.

GK_INPUT_SOURCES = DBusServiceIdentifier(
namespace=("org", "gnome", "Kiosk"),
message_bus=SessionBus
)

MUTTER_DISPLAY_CONFIG = DBusServiceIdentifier(
namespace=("org", "gnome", "Mutter", "DisplayConfig"),
message_bus=SessionBus
Expand Down
135 changes: 0 additions & 135 deletions pyanaconda/modules/localization/gk_keyboard_manager.py

This file was deleted.

32 changes: 12 additions & 20 deletions pyanaconda/modules/localization/localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from pyanaconda.modules.localization.runtime import GetMissingKeyboardConfigurationTask, \
ApplyKeyboardTask, AssignGenericKeyboardSettingTask
from pyanaconda.modules.localization.localed import LocaledWrapper
from pyanaconda.modules.localization.gk_keyboard_manager import GkKeyboardManager

from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)
Expand Down Expand Up @@ -71,7 +70,6 @@ def __init__(self):
self.compositor_layouts_changed = Signal()

self._localed_wrapper = None
self._compositor_keyboard_manager = None

def publish(self):
"""Publish the module."""
Expand Down Expand Up @@ -249,6 +247,13 @@ def set_keyboard_seen(self, keyboard_seen):
def localed_wrapper(self):
if not self._localed_wrapper:
self._localed_wrapper = LocaledWrapper()

self._localed_wrapper.compositor_selected_layout_changed.connect(
self.compositor_selected_layout_changed.emit
)
self._localed_wrapper.compositor_layouts_changed.connect(
self.compositor_layouts_changed.emit
)
return self._localed_wrapper

def install_with_tasks(self):
Expand Down Expand Up @@ -321,30 +326,17 @@ def set_from_generic_keyboard_setting(self, keyboard):
result = task.run()
self._update_settings_from_task(result)

@property
def compositor_keyboard_manager(self):
if not self._compositor_keyboard_manager:
self._compositor_keyboard_manager = GkKeyboardManager()
self._compositor_keyboard_manager.compositor_selected_layout_changed.connect(
lambda layout: self.compositor_selected_layout_changed.emit(layout)
)
self._compositor_keyboard_manager.compositor_layouts_changed.connect(
lambda layouts: self.compositor_layouts_changed.emit(layouts)
)

return self._compositor_keyboard_manager

def get_compositor_selected_layout(self):
return self.compositor_keyboard_manager.get_compositor_selected_layout()
return self.localed_wrapper.current_layout_variant

def set_compositor_selected_layout(self, layout_variant):
return self.compositor_keyboard_manager.set_compositor_selected_layout(layout_variant)
return self.localed_wrapper.set_current_layout(layout_variant)

def select_next_compositor_layout(self):
return self.compositor_keyboard_manager.select_next_compositor_layout()
return self.localed_wrapper.select_next_layout(self.x_layouts)

def get_compositor_layouts(self):
return self.compositor_keyboard_manager.get_compositor_layouts()
return self.localed_wrapper.layouts_variants

def set_compositor_layouts(self, layout_variants, options):
self.compositor_keyboard_manager.set_compositor_layouts(layout_variants, options)
self.localed_wrapper.set_layouts(layout_variants, options)

This file was deleted.

Loading

0 comments on commit 7931f1f

Please sign in to comment.