Add ToastService, NToast etc

This commit is contained in:
Ly-sec 2025-08-19 14:14:00 +02:00
parent 1993e28c18
commit 1d860da42e
18 changed files with 534 additions and 31 deletions

View file

@ -71,9 +71,9 @@ ColumnLayout {
name: "Bottom"
}
}
currentKey: Settings.data.bar.barPosition
currentKey: Settings.data.bar.position
onSelected: function (key) {
Settings.data.bar.barPosition = key
Settings.data.bar.position = key
}
}
}

View file

@ -1,10 +1,10 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell.Io
import qs.Commons
import qs.Services
import qs.Widgets
import Quickshell.Io
ColumnLayout {
id: root
@ -147,9 +147,12 @@ ColumnLayout {
description: "Automatically generate colors based on your active wallpaper."
checked: Settings.data.colorSchemes.useWallpaperColors
onToggled: checked => {
Settings.data.colorSchemes.useWallpaperColors = checked
if (Settings.data.colorSchemes.useWallpaperColors) {
ColorSchemeService.changedWallpaper()
if (checked) {
// Check if matugen is installed
matugenCheck.running = true
} else {
Settings.data.colorSchemes.useWallpaperColors = false
ToastService.showNotice("Matugen:\nDisabled")
}
}
}
@ -337,4 +340,26 @@ ColumnLayout {
}
}
}
// Simple process to check if matugen exists
Process {
id: matugenCheck
command: ["which", "matugen"]
running: false
onExited: function(exitCode) {
if (exitCode === 0) {
// Matugen exists, enable it
Settings.data.colorSchemes.useWallpaperColors = true
ColorSchemeService.changedWallpaper()
ToastService.showNotice("Matugen:\nEnabled!")
} else {
// Matugen not found
ToastService.showWarning("Matugen:\nNot installed!")
}
}
stdout: StdioCollector {}
stderr: StdioCollector {}
}
}

View file

@ -49,6 +49,11 @@ ColumnLayout {
onToggled: checked => {
Settings.data.network.wifiEnabled = checked
NetworkService.setWifiEnabled(checked)
if (checked) {
ToastService.showNotice("WiFi:\nEnabled")
} else {
ToastService.showNotice("WiFi:\nDisabled")
}
}
}
@ -59,6 +64,11 @@ ColumnLayout {
onToggled: checked => {
Settings.data.network.bluetoothEnabled = checked
BluetoothService.setBluetoothEnabled(checked)
if (checked) {
ToastService.showNotice("Bluetooth:\nEnabled")
} else {
ToastService.showNotice("Bluetooth:\nDisabled")
}
}
}
}

View file

@ -1,6 +1,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell.Io
import qs.Commons
import qs.Services
import qs.Widgets
@ -147,7 +148,13 @@ ColumnLayout {
description: "Use SWWW daemon for advanced wallpaper management."
checked: Settings.data.wallpaper.swww.enabled
onToggled: checked => {
Settings.data.wallpaper.swww.enabled = checked
if (checked) {
// Check if swww is installed
swwwCheck.running = true
} else {
Settings.data.wallpaper.swww.enabled = false
ToastService.showNotice("SWWW:\nDisabled")
}
}
}
@ -335,4 +342,26 @@ ColumnLayout {
}
}
}
// Process to check if swww is installed
Process {
id: swwwCheck
command: ["which", "swww"]
running: false
onExited: function(exitCode) {
if (exitCode === 0) {
// SWWW exists, enable it
Settings.data.wallpaper.swww.enabled = true
WallpaperService.startSWWWDaemon()
ToastService.showNotice("SWWW:\nEnabled!")
} else {
// SWWW not found
ToastService.showWarning("SWWW:\nNot installed!")
}
}
stdout: StdioCollector {}
stderr: StdioCollector {}
}
}