diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bcbe982..e5315db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ include: checks:pylint: stage: checks before_script: - - sudo dnf install -y python3-gobject gtk3 xorg-x11-server-Xvfb python3-mypy + - sudo dnf install -y python3-gobject gtk3 xorg-x11-server-Xvfb python3-mypy gtk-layer-shell - pip3 install --quiet -r ci/requirements.txt - git clone https://github.com/QubesOS/qubes-core-admin-client ~/core-admin-client script: @@ -23,7 +23,7 @@ checks:tests: before_script: &before-script - "PATH=$PATH:$HOME/.local/bin" - sudo dnf install -y python3-gobject gtk3 python3-pytest python3-pytest-asyncio - python3-coverage xorg-x11-server-Xvfb python3-inotify sequoia-sqv + python3-coverage xorg-x11-server-Xvfb python3-inotify sequoia-sqv gtk-layer-shell - pip3 install --quiet -r ci/requirements.txt - git clone https://github.com/QubesOS/qubes-core-admin-client ~/core-admin-client - git clone https://github.com/QubesOS/qubes-desktop-linux-manager ~/desktop-linux-manager diff --git a/debian/control b/debian/control index b0af4e8..64c12c0 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,8 @@ Build-Depends: qubes-desktop-linux-manager, python3-gi, gobject-introspection, - gir1.2-gtk-3.0 + gir1.2-gtk-3.0, + gir1.2-gtklayershell-0.1, Standards-Version: 3.9.5 Homepage: https://www.qubes-os.org/ X-Python3-Version: >= 3.5 diff --git a/qubes_menu/appmenu.py b/qubes_menu/appmenu.py index e24fa90..9de2552 100644 --- a/qubes_menu/appmenu.py +++ b/qubes_menu/appmenu.py @@ -27,7 +27,8 @@ import gi gi.require_version('Gtk', '3.0') -from gi.repository import Gtk, Gdk, GLib, Gio +gi.require_version('GtkLayerShell', '0.1') +from gi.repository import Gtk, Gdk, GLib, Gio, GtkLayerShell import gbulb gbulb.install() @@ -208,12 +209,23 @@ def do_activate(self, *args, **kwargs): if not self.start_in_background: self.main_window.show_all() self.initialize_state() - # set size if too big + current_width = self.main_window.get_allocated_width() current_height = self.main_window.get_allocated_height() - max_height = self.main_window.get_screen().get_height() * 0.9 + # set size if too big + max_height = int(self.main_window.get_screen().get_height() * 0.9) + assert max_height > 0 if current_height > max_height: - self.main_window.resize(self.main_window.get_allocated_width(), - int(max_height)) + self.main_window.resize(current_height, max_height) + if GtkLayerShell.is_supported(): + # The default for layer shell is no keyboard input. + # Explicitly request that the compositor use the normal + # rules for keyboard input as if this was a normal window. + GtkLayerShell.set_keyboard_mode(self.main_window, + GtkLayerShell.KeyboardMode.ON_DEMAND) + # Work around https://github.com/wmww/gtk-layer-shell/issues/167 + # by explicitly setting the window size. + self.main_window.set_size_request(current_width, + min(current_height, max_height)) # grab a focus on the initially selected page so that keyboard # navigation works @@ -341,6 +353,14 @@ def perform_setup(self): 'domain-feature-delete:' + feature, self._update_settings) + if GtkLayerShell.is_supported(): + GtkLayerShell.init_for_window(self.main_window) + GtkLayerShell.auto_exclusive_zone_enable(self.main_window) + GtkLayerShell.set_anchor(self.main_window, GtkLayerShell.Edge.LEFT, + True) + GtkLayerShell.set_anchor(self.main_window, GtkLayerShell.Edge.TOP, + True) + def load_style(self, *_args): """Load appropriate CSS stylesheet and associated properties.""" light_ref = (importlib.resources.files('qubes_menu') / diff --git a/rpm_spec/qubes-desktop-linux-menu.spec.in b/rpm_spec/qubes-desktop-linux-menu.spec.in index a4412c8..5d361e8 100644 --- a/rpm_spec/qubes-desktop-linux-menu.spec.in +++ b/rpm_spec/qubes-desktop-linux-menu.spec.in @@ -49,6 +49,7 @@ BuildRequires: gettext Requires: python%{python3_pkgversion}-setuptools Requires: python%{python3_pkgversion}-gbulb Requires: gtk3 +Requires: gtk-layer-shell Requires: python%{python3_pkgversion}-qubesadmin >= 4.1.8 Requires: qubes-artwork >= 4.1.5 Requires: qubes-desktop-linux-manager