aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/utils.c7
-rw-r--r--src/utils.h3
-rw-r--r--tests/tst_utils.cpp17
3 files changed, 22 insertions, 5 deletions
diff --git a/src/utils.c b/src/utils.c
index 38ad1d8..152f226 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,5 +1,6 @@
/*
* Copyright 2021 Marius Gripsgard <marius@ubports.com>
+ * Copyright 2021 Robert Tari <robert@tari.in>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -82,6 +83,12 @@ is_pantheon ()
return is_xdg_current_desktop(DESKTOP_PANTHEON);
}
+gboolean
+is_budgie ()
+{
+ return is_xdg_current_desktop(DESKTOP_BUDGIE);
+}
+
// Bit of a hacky way? should use xdg open
char *
find_browser ()
diff --git a/src/utils.h b/src/utils.h
index 52e491f..60c5ed4 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,5 +1,6 @@
/*
* Copyright 2021 Marius Gripsgard <marius@ubports.com>
+ * Copyright 2021 Robert Tari <robert@tari.in>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -25,6 +26,7 @@
#define DESKTOP_GNOME "GNOME"
#define DESKTOP_XFCE "XFCE"
#define DESKTOP_PANTHEON "PANTHEON"
+#define DESKTOP_BUDGIE "Budgie"
gboolean is_lomiri();
gboolean is_unity();
@@ -32,6 +34,7 @@ gboolean is_gnome();
gboolean is_mate();
gboolean is_xfce();
gboolean is_pantheon();
+gboolean is_budgie();
gboolean execute_command(const gchar * cmd);
gboolean open_url(const gchar * url);
diff --git a/tests/tst_utils.cpp b/tests/tst_utils.cpp
index d7a4946..503afc9 100644
--- a/tests/tst_utils.cpp
+++ b/tests/tst_utils.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2021 Marius Gripsgard <marius@ubports.com>
+ * Copyright 2021 Robert Tari <robert@tari.in>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -22,15 +23,15 @@ extern "C" {
}
class XdgCurrentDesktopUtilsTest : public ::testing::Test
-{
-public:
- XdgCurrentDesktopUtilsTest() {}
+{
+public:
+ XdgCurrentDesktopUtilsTest() {}
- void SetUp() {
+ void SetUp() {
unsetenv("XDG_CURRENT_DESKTOP");
}
- void TearDown() {
+ void TearDown() {
unsetenv("XDG_CURRENT_DESKTOP");
}
};
@@ -72,3 +73,9 @@ TEST_F(XdgCurrentDesktopUtilsTest, isPantheon)
setenv("XDG_CURRENT_DESKTOP", "PANTHEON", 1);
EXPECT_TRUE(is_pantheon());
}
+TEST_F(XdgCurrentDesktopUtilsTest, isBudgie)
+{
+ EXPECT_FALSE(is_budgie());
+ setenv("XDG_CURRENT_DESKTOP", "Budgie:GNOME", 1);
+ EXPECT_TRUE(is_budgie());
+}