Skip to content

Commit 714e3f0

Browse files
authored
MainWindow: center and keep above with Pantheon protocol (#158)
1 parent 2167dae commit 714e3f0

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install Dependencies
2424
run: |
2525
apt update
26-
apt install -y libgee-0.8-dev libgranite-7-dev libgtk-4-dev meson valac
26+
apt install -y libgee-0.8-dev libgranite-7-dev libgtk-4-dev libpantheon-wayland-1-dev meson valac
2727
- name: Build
2828
env:
2929
DESTDIR: out

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ You'll need the following dependencies:
2121
* libgee-0.8-dev
2222
* libgranite-7-dev >= 7.3.0
2323
* libgtk-4-dev
24+
* libpantheon-wayland-1-dev
2425
* meson
2526
* valac
2627

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ executable(
3838
dependency('granite-7', version: '>= 7.3.0'),
3939
dependency('gtk4'),
4040
dependency('gee-0.8'),
41+
dependency('pantheon-wayland-1'),
4142
meson.get_compiler('vala').find_library('posix'),
4243
],
4344
install : true

src/MainWindow.vala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
public class ShortcutOverlay.MainWindow : Gtk.Window {
18+
public class ShortcutOverlay.MainWindow : Gtk.Window, PantheonWayland.ExtendedBehavior {
1919
public MainWindow (Gtk.Application application) {
2020
Object (
2121
application: application,
@@ -41,5 +41,11 @@ public class ShortcutOverlay.MainWindow : Gtk.Window {
4141
titlebar.add_css_class (Granite.STYLE_CLASS_DEFAULT_DECORATION);
4242

4343
set_titlebar (titlebar);
44+
45+
child.realize.connect (() => {
46+
connect_to_shell ();
47+
set_keep_above ();
48+
make_centered ();
49+
});
4450
}
4551
}

0 commit comments

Comments
 (0)