Skip to content

Commit 5b523b5

Browse files
authored
Merge pull request #5 from ryonakano/add-granite-init
Use elementary stylesheet on Pantheon
2 parents 6ef1f91 + 60eeab1 commit 5b523b5

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ A simple focus timer app.
1818
## ⚡️ Requirements
1919

2020
- elementary OS 7.0 or later
21+
- Granite 7.2.0 or later
2122
- GTK 4.0 or later
2223
- libadwaita 1.0 or later
2324

src/application.vala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ public class Pomerode.Application : Adw.Application {
1616
this.set_accels_for_action ("app.quit", {"<primary>q"});
1717
}
1818

19+
protected override void startup () {
20+
// Make sure to use elementary stylesheet on Pantheon
21+
if (Util.is_on_pantheon ()) {
22+
Granite.init ();
23+
}
24+
25+
base.startup ();
26+
}
27+
1928
public override void activate () {
2029
base.activate ();
2130
var win = this.active_window ?? new Pomerode.Window (this);

src/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pomerode_vala_sources = files(
2222
'main.vala',
2323
'application.vala',
2424
'preferences.vala',
25+
'util.vala',
2526
'window.vala'
2627
)
2728

@@ -34,6 +35,7 @@ pomerode_sources = [
3435

3536
pomerode_dependencies = [
3637
dependency('gtk4'),
38+
dependency('granite-7', version: '>= 7.2.0'),
3739
dependency('libadwaita-1'),
3840
dependency('glib-2.0'),
3941
dependency('gobject-2.0'),

src/util.vala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Util {
2+
/**
3+
* Whether the app is running on Pantheon desktop environment.
4+
*/
5+
public static bool is_on_pantheon () {
6+
return Environment.get_variable ("XDG_CURRENT_DESKTOP") == "Pantheon";
7+
}
8+
}

0 commit comments

Comments
 (0)