Add ToastService, NToast etc
This commit is contained in:
parent
1993e28c18
commit
1d860da42e
18 changed files with 534 additions and 31 deletions
|
|
@ -44,10 +44,10 @@ NLoader {
|
|||
|
||||
margins {
|
||||
top: (Settings.data.bar.monitors.includes(modelData.name)
|
||||
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.barPosition === "top"
|
||||
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.position === "top"
|
||||
? Math.floor(Style.barHeight * scaling) : 0
|
||||
bottom: (Settings.data.bar.monitors.includes(modelData.name)
|
||||
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.barPosition === "bottom"
|
||||
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.position === "bottom"
|
||||
? Math.floor(Style.barHeight * scaling) : 0
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ Variants {
|
|||
|| (Settings.data.bar.monitors.length === 0)) : false
|
||||
|
||||
anchors {
|
||||
top: Settings.data.bar.barPosition === "top"
|
||||
bottom: Settings.data.bar.barPosition === "bottom"
|
||||
top: Settings.data.bar.position === "top"
|
||||
bottom: Settings.data.bar.position === "bottom"
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,10 +76,10 @@ NLoader {
|
|||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: Style.marginXS * scaling
|
||||
top: Settings.data.bar.barPosition === "top" ? parent.top : undefined
|
||||
bottom: Settings.data.bar.barPosition === "bottom" ? parent.bottom : undefined
|
||||
topMargin: Settings.data.bar.barPosition === "top" ? Style.marginXS * scaling : undefined
|
||||
bottomMargin: Settings.data.bar.barPosition === "bottom" ? Style.barHeight * scaling + Style.marginXS * scaling : undefined
|
||||
top: Settings.data.bar.position === "top" ? parent.top : undefined
|
||||
bottom: Settings.data.bar.position === "bottom" ? parent.bottom : undefined
|
||||
topMargin: Settings.data.bar.position === "top" ? Style.marginXS * scaling : undefined
|
||||
bottomMargin: Settings.data.bar.position === "bottom" ? Style.barHeight * scaling + Style.marginXS * scaling : undefined
|
||||
}
|
||||
|
||||
// Animation properties
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Rectangle {
|
|||
id: tooltip
|
||||
text: Time.dateString
|
||||
target: clock
|
||||
positionAbove: Settings.data.bar.barPosition === "bottom"
|
||||
positionAbove: Settings.data.bar.position === "bottom"
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ Rectangle {
|
|||
id: trayTooltip
|
||||
target: trayIcon
|
||||
text: modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item"
|
||||
positionAbove: Settings.data.bar.barPosition === "bottom"
|
||||
positionAbove: Settings.data.bar.position === "bottom"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,10 +91,10 @@ NLoader {
|
|||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: Style.marginXS * scaling
|
||||
top: Settings.data.bar.barPosition === "top" ? parent.top : undefined
|
||||
bottom: Settings.data.bar.barPosition === "bottom" ? parent.bottom : undefined
|
||||
topMargin: Settings.data.bar.barPosition === "top" ? Style.marginXS * scaling : undefined
|
||||
bottomMargin: Settings.data.bar.barPosition === "bottom" ? Style.barHeight * scaling + Style.marginXS * scaling : undefined
|
||||
top: Settings.data.bar.position === "top" ? parent.top : undefined
|
||||
bottom: Settings.data.bar.position === "bottom" ? parent.bottom : undefined
|
||||
topMargin: Settings.data.bar.position === "top" ? Style.marginXS * scaling : undefined
|
||||
bottomMargin: Settings.data.bar.position === "bottom" ? Style.barHeight * scaling + Style.marginXS * scaling : undefined
|
||||
}
|
||||
|
||||
// Animation properties
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,10 +91,10 @@ NLoader {
|
|||
// Height scales to content plus vertical padding
|
||||
height: content.implicitHeight + innerMargin * 2
|
||||
// Place the panel relative to the bar based on its position
|
||||
y: Settings.data.bar.barPosition === "top" ? Style.marginS * scaling : undefined
|
||||
y: Settings.data.bar.position === "top" ? Style.marginS * scaling : undefined
|
||||
anchors {
|
||||
bottom: Settings.data.bar.barPosition === "bottom" ? parent.bottom : undefined
|
||||
bottomMargin: Settings.data.bar.barPosition === "bottom" ? Style.barHeight * scaling + Style.marginS * scaling : undefined
|
||||
bottom: Settings.data.bar.position === "bottom" ? parent.bottom : undefined
|
||||
bottomMargin: Settings.data.bar.position === "bottom" ? Style.barHeight * scaling + Style.marginS * scaling : undefined
|
||||
}
|
||||
// Center horizontally under the anchorX, clamped to the screen bounds
|
||||
x: Math.max(Style.marginS * scaling, Math.min(parent.width - width - Style.marginS * scaling,
|
||||
|
|
|
|||
54
Modules/Toast/ToastManager.qml
Normal file
54
Modules/Toast/ToastManager.qml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
// ToastManager creates toast overlays on each screen
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
delegate: PanelWindow {
|
||||
id: root
|
||||
|
||||
required property ShellScreen modelData
|
||||
readonly property real scaling: ScalingService.scale(screen)
|
||||
screen: modelData
|
||||
|
||||
// Position at top, centered horizontally
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
|
||||
// Small height when hidden, appropriate height when visible
|
||||
implicitHeight: toast.visible ? toast.height + Style.barHeight * scaling + Style.marginS * scaling : 1
|
||||
|
||||
// Transparent background
|
||||
color: Color.transparent
|
||||
|
||||
// High layer to appear above other panels
|
||||
//WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
exclusionMode: PanelWindow.ExclusionMode.Ignore
|
||||
|
||||
NToast {
|
||||
id: toast
|
||||
scaling: root.scaling
|
||||
|
||||
// Position just below where the bar would be
|
||||
targetY: Style.barHeight * scaling + Style.marginS * scaling
|
||||
|
||||
Component.onCompleted: {
|
||||
// Register this toast with the service
|
||||
ToastService.currentToast = toast
|
||||
|
||||
// Connect dismissal signal
|
||||
toast.dismissed.connect(ToastService.onToastDismissed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue