From b462ad13446d3176944785b262c9a3c0d22c298e Mon Sep 17 00:00:00 2001 From: David Mohammed Date: Sat, 25 Jan 2025 12:38:41 +0000 Subject: [PATCH] Center the polkit dialog (#664) --- src/dialogs/polkit/meson.build | 3 +++ src/dialogs/polkit/polkitdialog.vala | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dialogs/polkit/meson.build b/src/dialogs/polkit/meson.build index 92ca59961..0c4c64077 100644 --- a/src/dialogs/polkit/meson.build +++ b/src/dialogs/polkit/meson.build @@ -35,6 +35,8 @@ pkversion = '>= 0.105' polkit_deps = [ dep_giounix, dep_gtk3, + dep_gtk_layer_shell, + dep_xfce4windowing, link_libconfig, link_libtheme, link_libsession, @@ -59,6 +61,7 @@ executable( '--pkg', 'gio-unix-2.0', '--pkg', 'budgie-config', '--pkg', 'gtk+-3.0', + '--pkg', 'libxfce4windowing-0', '--pkg', 'polkit-gobject-1', '--pkg', 'polkit-agent-1', '--pkg', 'posix', diff --git a/src/dialogs/polkit/polkitdialog.vala b/src/dialogs/polkit/polkitdialog.vala index 955c8403a..bb9b06e02 100644 --- a/src/dialogs/polkit/polkitdialog.vala +++ b/src/dialogs/polkit/polkitdialog.vala @@ -142,7 +142,13 @@ namespace Budgie { combobox_idents.add_attribute(render, "text", 0); combobox_idents.set_id_column(0); - window_position = Gtk.WindowPosition.CENTER_ALWAYS; + // center dialog on the primary screen + var primary_monitor = libxfce4windowing.Screen.get_default().get_primary_monitor(); + GtkLayerShell.init_for_window(this); + GtkLayerShell.set_layer(this, GtkLayerShell.Layer.TOP); + GtkLayerShell.set_monitor(this, primary_monitor.get_gdk_monitor()); + GtkLayerShell.set_anchor(this, GtkLayerShell.Edge.LEFT, false); + GtkLayerShell.set_anchor(this, GtkLayerShell.Edge.TOP, false); key_release_event.connect(on_key_release);