config: enable/disable specific toasts
This commit is contained in:
parent
bef5359702
commit
21e1efd944
6 changed files with 23 additions and 6 deletions
|
|
@ -569,8 +569,12 @@ default, you must create it manually.
|
|||
"enabled": true,
|
||||
"maxToasts": 4,
|
||||
"toasts": {
|
||||
"audioInputChanged": true,
|
||||
"audioOutputChanged": true,
|
||||
"audioInputChanged": true
|
||||
"chargingChanged": true,
|
||||
"configLoaded": true,
|
||||
"dndChanged": true,
|
||||
"gameModeChanged": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ Singleton {
|
|||
onLoaded: {
|
||||
try {
|
||||
JSON.parse(text());
|
||||
if (adapter.utilities.toasts.configLoaded)
|
||||
Toaster.toast(qsTr("Config loaded"), qsTr("Config loaded in %1ms").arg(timer.elapsedMs()), "rule_settings");
|
||||
} catch (e) {
|
||||
Toaster.toast(qsTr("Failed to load config"), e.message, "settings_alert", Toast.Error);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ JsonObject {
|
|||
}
|
||||
|
||||
component Toasts: JsonObject {
|
||||
property bool configLoaded: true
|
||||
property bool chargingChanged: true
|
||||
property bool gameModeChanged: true
|
||||
property bool dndChanged: true
|
||||
property bool audioOutputChanged: true
|
||||
property bool audioInputChanged: true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@ Scope {
|
|||
|
||||
function onOnBatteryChanged(): void {
|
||||
if (UPower.onBattery) {
|
||||
if (Config.utilities.toasts.chargingChanged)
|
||||
Toaster.toast(qsTr("Charger unplugged"), qsTr("Battery is now on AC"), "power_off");
|
||||
} else {
|
||||
if (Config.utilities.toasts.chargingChanged)
|
||||
Toaster.toast(qsTr("Charger plugged in"), qsTr("Battery is charging"), "power");
|
||||
for (const level of root.warnLevels)
|
||||
level.warned = false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
pragma Singleton
|
||||
|
||||
import qs.config
|
||||
import Caelestia
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
|
@ -17,9 +18,11 @@ Singleton {
|
|||
onEnabledChanged: {
|
||||
if (enabled) {
|
||||
setDynamicConfs();
|
||||
if (Config.utilities.toasts.gameModeChanged)
|
||||
Toaster.toast(qsTr("Game mode enabled"), qsTr("Disabled Hyprland animations, blur, gaps and shadows"), "gamepad");
|
||||
} else {
|
||||
Quickshell.execDetached(["hyprctl", "reload"]);
|
||||
if (Config.utilities.toasts.gameModeChanged)
|
||||
Toaster.toast(qsTr("Game mode disabled"), qsTr("Hyprland settings restored"), "gamepad");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ Singleton {
|
|||
property bool loaded
|
||||
|
||||
onDndChanged: {
|
||||
if (!Config.utilities.toasts.dndChanged)
|
||||
return;
|
||||
|
||||
if (dnd)
|
||||
Toaster.toast(qsTr("Do not disturb enabled"), qsTr("Popup notifications are now disabled"), "do_not_disturb_on");
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue