diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini
index 04a385d3..2b2f035d 100644
--- a/data/locale/en-US.ini
+++ b/data/locale/en-US.ini
@@ -28,6 +28,7 @@ AdvSceneSwitcher.generalTab.generalBehavior.cooldown="After a match do not switc
AdvSceneSwitcher.generalTab.generalBehavior.cooldownHint="During this time potential matches will be ignored!"
AdvSceneSwitcher.generalTab.generalBehavior.verboseLogging="Enable verbose logging"
AdvSceneSwitcher.generalTab.generalBehavior.saveWindowGeo="Save window position and size"
+AdvSceneSwitcher.generalTab.generalBehavior.showTrayNotifications="Show system tray notifications"
AdvSceneSwitcher.generalTab.generalBehavior.disableUIHints="Disable UI hints"
AdvSceneSwitcher.generalTab.priority="Priority"
AdvSceneSwitcher.generalTab.priority.description="Switching methods priority (Highest priority is at the top)"
@@ -614,6 +615,8 @@ AdvSceneSwitcher.selectWindowTip="Use \"OBS\" to specify OBS window\nUse \"Task
AdvSceneSwitcher.status.active="Active"
AdvSceneSwitcher.status.inactive="Inactive"
+AdvSceneSwitcher.running="Plugin running"
+AdvSceneSwitcher.stopped="Plugin stopped"
AdvSceneSwitcher.unit.milliseconds="milliseconds"
AdvSceneSwitcher.unit.secends="seconds"
diff --git a/forms/advanced-scene-switcher.ui b/forms/advanced-scene-switcher.ui
index 9772a0e4..fdd29c14 100644
--- a/forms/advanced-scene-switcher.ui
+++ b/forms/advanced-scene-switcher.ui
@@ -306,6 +306,30 @@
+ -
+
+
-
+
+
+ AdvSceneSwitcher.generalTab.generalBehavior.showTrayNotifications
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
-
-
@@ -355,8 +379,7 @@
-
-
-
-
+
diff --git a/src/advanced-scene-switcher.cpp b/src/advanced-scene-switcher.cpp
index a9fdcb47..c4b8eb64 100644
--- a/src/advanced-scene-switcher.cpp
+++ b/src/advanced-scene-switcher.cpp
@@ -415,6 +415,12 @@ void SwitcherData::Start()
if (networkConfig.ClientEnabled) {
client.connect(networkConfig.GetClientUri());
}
+
+ if (showSystemTrayNotifications) {
+ DisplayTrayMessage(
+ obs_module_text("AdvSceneSwitcher.pluginName"),
+ obs_module_text("AdvSceneSwitcher.running"));
+ }
}
void ResetMacroCounters()
@@ -441,6 +447,12 @@ void SwitcherData::Stop()
server.stop();
client.disconnect();
+
+ if (showSystemTrayNotifications) {
+ DisplayTrayMessage(
+ obs_module_text("AdvSceneSwitcher.pluginName"),
+ obs_module_text("AdvSceneSwitcher.stopped"));
+ }
}
void SwitcherData::setWaitScene()
diff --git a/src/general.cpp b/src/general.cpp
index fa0c12f1..e15e0ffd 100644
--- a/src/general.cpp
+++ b/src/general.cpp
@@ -210,6 +210,15 @@ void AdvSceneSwitcher::on_saveWindowGeo_stateChanged(int state)
switcher->saveWindowGeo = state;
}
+void AdvSceneSwitcher::on_showTrayNotifications_stateChanged(int state)
+{
+ if (loading) {
+ return;
+ }
+
+ switcher->showSystemTrayNotifications = state;
+}
+
void AdvSceneSwitcher::on_uiHintsDisable_stateChanged(int state)
{
if (loading) {
@@ -503,6 +512,8 @@ void SwitcherData::saveGeneralSettings(obs_data_t *obj)
static_cast(autoStartEvent));
obs_data_set_bool(obj, "verbose", verbose);
+ obs_data_set_bool(obj, "showSystemTrayNotifications",
+ showSystemTrayNotifications);
obs_data_set_bool(obj, "disableHints", disableHints);
obs_data_set_int(obj, "priority0", functionNamesByPriority[0]);
@@ -574,6 +585,8 @@ void SwitcherData::loadGeneralSettings(obs_data_t *obj)
obs_data_get_int(obj, "autoStartEvent"));
verbose = obs_data_get_bool(obj, "verbose");
+ showSystemTrayNotifications =
+ obs_data_get_bool(obj, "showSystemTrayNotifications");
disableHints = obs_data_get_bool(obj, "disableHints");
obs_data_set_default_int(obj, "priority0", default_priority_0);
@@ -800,6 +813,8 @@ void AdvSceneSwitcher::setupGeneralTab()
ui->verboseLogging->setChecked(switcher->verbose);
ui->saveWindowGeo->setChecked(switcher->saveWindowGeo);
+ ui->showTrayNotifications->setChecked(
+ switcher->showSystemTrayNotifications);
ui->uiHintsDisable->setChecked(switcher->disableHints);
for (int p : switcher->functionNamesByPriority) {
diff --git a/src/headers/advanced-scene-switcher.hpp b/src/headers/advanced-scene-switcher.hpp
index 8abdf617..0ec289ac 100644
--- a/src/headers/advanced-scene-switcher.hpp
+++ b/src/headers/advanced-scene-switcher.hpp
@@ -164,6 +164,7 @@ public slots:
void on_verboseLogging_stateChanged(int state);
void on_saveWindowGeo_stateChanged(int state);
+ void on_showTrayNotifications_stateChanged(int state);
void on_uiHintsDisable_stateChanged(int state);
void on_exportSettings_clicked();
diff --git a/src/headers/switcher-data-structs.hpp b/src/headers/switcher-data-structs.hpp
index 4a03ac61..20f16fe3 100644
--- a/src/headers/switcher-data-structs.hpp
+++ b/src/headers/switcher-data-structs.hpp
@@ -70,6 +70,7 @@ struct SwitcherData {
bool stop = false;
bool verbose = false;
bool disableHints = false;
+ bool showSystemTrayNotifications = false;
bool showFrame = false;
bool transitionOverrideOverride = false;
bool adjustActiveTransitionType = true;
diff --git a/src/headers/utility.hpp b/src/headers/utility.hpp
index 2cff5fd4..15165eca 100644
--- a/src/headers/utility.hpp
+++ b/src/headers/utility.hpp
@@ -55,6 +55,7 @@ void listAddClicked(QListWidget *list, QWidget *newWidget,
bool listMoveUp(QListWidget *list);
bool listMoveDown(QListWidget *list);
bool DisplayMessage(const QString &msg, bool question = false);
+void DisplayTrayMessage(const QString &title, const QString &msg);
void addSelectionEntry(QComboBox *sel, const char *description,
bool selectable = false, const char *tooltip = "");
void populateTransitionSelection(QComboBox *sel, bool addCurrent = true,
diff --git a/src/utility.cpp b/src/utility.cpp
index 1c1fede5..62031c98 100644
--- a/src/utility.cpp
+++ b/src/utility.cpp
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -443,6 +444,17 @@ bool DisplayMessage(const QString &msg, bool question)
return false;
}
+void DisplayTrayMessage(const QString &title, const QString &msg)
+{
+ auto tray = reinterpret_cast(
+ obs_frontend_get_system_tray());
+ if (!tray) {
+ return;
+ }
+
+ tray->showMessage(title, msg);
+}
+
void addSelectionEntry(QComboBox *sel, const char *description, bool selectable,
const char *tooltip)
{