From 8a16b6b7f567416668ee51c18864a0306a9588fb Mon Sep 17 00:00:00 2001 From: quadbyte Date: Tue, 12 Aug 2025 12:07:51 -0400 Subject: [PATCH] Formatting --- Modules/Background/Background.qml | 5 +- Modules/Background/Overview.qml | 3 +- Modules/Settings/SettingsWindow.qml | 6 +- Modules/Settings/Tabs/Display.qml | 2 +- Modules/Settings/Tabs/ScreenRecorder.qml | 2 +- Services/Settings.qml | 12 +- Services/Wallpapers.qml | 12 +- Services/Workspaces.qml | 277 ++++++++++++----------- 8 files changed, 163 insertions(+), 156 deletions(-) diff --git a/Modules/Background/Background.qml b/Modules/Background/Background.qml index 20752c9..4e2175e 100644 --- a/Modules/Background/Background.qml +++ b/Modules/Background/Background.qml @@ -8,10 +8,11 @@ Variants { delegate: PanelWindow { required property ShellScreen modelData - property string wallpaperSource: Wallpapers.currentWallpaper !== "" && !Settings.data.wallpaper.swww.enabled ? Wallpapers.currentWallpaper : "" + property string wallpaperSource: Wallpapers.currentWallpaper !== "" + && !Settings.data.wallpaper.swww.enabled ? Wallpapers.currentWallpaper : "" visible: wallpaperSource !== "" && !Settings.data.wallpaper.swww.enabled - + // Force update when SWWW setting changes onVisibleChanged: { if (visible) { diff --git a/Modules/Background/Overview.qml b/Modules/Background/Overview.qml index d2a7aad..1f64f7c 100644 --- a/Modules/Background/Overview.qml +++ b/Modules/Background/Overview.qml @@ -9,7 +9,8 @@ Variants { delegate: PanelWindow { required property ShellScreen modelData - property string wallpaperSource: Wallpapers.currentWallpaper !== "" && !Settings.data.wallpaper.swww.enabled ? Wallpapers.currentWallpaper : "" + property string wallpaperSource: Wallpapers.currentWallpaper !== "" + && !Settings.data.wallpaper.swww.enabled ? Wallpapers.currentWallpaper : "" visible: wallpaperSource !== "" && !Settings.data.wallpaper.swww.enabled color: "transparent" diff --git a/Modules/Settings/SettingsWindow.qml b/Modules/Settings/SettingsWindow.qml index c05e32b..cae584f 100644 --- a/Modules/Settings/SettingsWindow.qml +++ b/Modules/Settings/SettingsWindow.qml @@ -46,13 +46,11 @@ NLoader { "label": "Wallpaper", "icon": "image", "source": "Tabs/Wallpaper.qml" - }, - { + }, { "label": "Wallpaper Selector", "icon": "wallpaper_slideshow", "source": "Tabs/WallpaperSelector.qml" - }, - { + }, { "label": "Misc", "icon": "more_horiz", "source": "Tabs/Misc.qml" diff --git a/Modules/Settings/Tabs/Display.qml b/Modules/Settings/Tabs/Display.qml index 86dea3d..ea587d7 100644 --- a/Modules/Settings/Tabs/Display.qml +++ b/Modules/Settings/Tabs/Display.qml @@ -116,4 +116,4 @@ Item { Layout.fillHeight: true } } -} \ No newline at end of file +} diff --git a/Modules/Settings/Tabs/ScreenRecorder.qml b/Modules/Settings/Tabs/ScreenRecorder.qml index d102ce9..286908f 100644 --- a/Modules/Settings/Tabs/ScreenRecorder.qml +++ b/Modules/Settings/Tabs/ScreenRecorder.qml @@ -324,4 +324,4 @@ ColumnLayout { } } } -} \ No newline at end of file +} diff --git a/Services/Settings.qml b/Services/Settings.qml index 7e7b0b4..9420b82 100644 --- a/Services/Settings.qml +++ b/Services/Settings.qml @@ -188,8 +188,14 @@ Singleton { Connections { target: adapter.wallpaper - function onIsRandomChanged() { Wallpapers.toggleRandomWallpaper() } - function onRandomIntervalChanged() { Wallpapers.restartRandomWallpaperTimer() } - function onDirectoryChanged() { Wallpapers.loadWallpapers() } + function onIsRandomChanged() { + Wallpapers.toggleRandomWallpaper() + } + function onRandomIntervalChanged() { + Wallpapers.restartRandomWallpaperTimer() + } + function onDirectoryChanged() { + Wallpapers.loadWallpapers() + } } } diff --git a/Services/Wallpapers.qml b/Services/Wallpapers.qml index e586a09..f087da4 100644 --- a/Services/Wallpapers.qml +++ b/Services/Wallpapers.qml @@ -138,12 +138,12 @@ Singleton { ), "--transition-type", transitionType, "--transition-duration", Settings.data.wallpaper.swww.transitionDuration.toString( ), currentWallpaper] running: false - + onStarted: { console.log("SWWW: Process started with command:", command.join(" ")) } - - onExited: function(exitCode, exitStatus) { + + onExited: function (exitCode, exitStatus) { console.log("SWWW: Process finished with exit code:", exitCode, "status:", exitStatus) if (exitCode !== 0) { console.log("SWWW: Process failed. Make sure swww-daemon is running with: swww-daemon") @@ -163,12 +163,12 @@ Singleton { id: startDaemonProcess command: ["swww-daemon", "--format", "xrgb"] running: false - + onStarted: { console.log("SWWW: Daemon start process initiated") } - - onExited: function(exitCode, exitStatus) { + + onExited: function (exitCode, exitStatus) { console.log("SWWW: Daemon start process finished with exit code:", exitCode) if (exitCode === 0) { console.log("SWWW: Daemon started successfully") diff --git a/Services/Workspaces.qml b/Services/Workspaces.qml index 9bedc6b..b73713d 100644 --- a/Services/Workspaces.qml +++ b/Services/Workspaces.qml @@ -1,5 +1,6 @@ pragma Singleton -pragma ComponentBehavior: Bound + +pragma ComponentBehavior import QtQuick import Quickshell @@ -8,149 +9,149 @@ import Quickshell.Hyprland import qs.Services Singleton { - id: root + id: root - property ListModel workspaces: ListModel {} - property bool isHyprland: false - property bool isNiri: false - property var hlWorkspaces: Hyprland.workspaces.values - // Detect which compositor we're using - Component.onCompleted: { - console.log("WorkspaceManager initializing..."); - detectCompositor(); - } + property ListModel workspaces: ListModel {} + property bool isHyprland: false + property bool isNiri: false + property var hlWorkspaces: Hyprland.workspaces.values + // Detect which compositor we're using + Component.onCompleted: { + console.log("WorkspaceManager initializing...") + detectCompositor() + } - function detectCompositor() { - try { - try { - if (Hyprland.eventSocketPath) { - console.log("Detected Hyprland compositor"); - isHyprland = true; - isNiri = false; - initHyprland(); - return; - } - } catch (e) { - console.log("Hyprland not available:", e); - } - - if (typeof Niri !== "undefined") { - console.log("Detected Niri service"); - isHyprland = false; - isNiri = true; - initNiri(); - return; - } - - console.log("No supported compositor detected"); - } catch (e) { - console.error("Error detecting compositor:", e); + function detectCompositor() { + try { + try { + if (Hyprland.eventSocketPath) { + console.log("Detected Hyprland compositor") + isHyprland = true + isNiri = false + initHyprland() + return } - } + } catch (e) { + console.log("Hyprland not available:", e) + } - // Initialize Hyprland integration - function initHyprland() { - try { - // Fixes the odd workspace issue. - Hyprland.refreshWorkspaces(); - // hlWorkspaces = Hyprland.workspaces.values; - // updateHyprlandWorkspaces(); - return true; - } catch (e) { - console.error("Error initializing Hyprland:", e); - isHyprland = false; - return false; + if (typeof Niri !== "undefined") { + console.log("Detected Niri service") + isHyprland = false + isNiri = true + initNiri() + return + } + + console.log("No supported compositor detected") + } catch (e) { + console.error("Error detecting compositor:", e) + } + } + + // Initialize Hyprland integration + function initHyprland() { + try { + // Fixes the odd workspace issue. + Hyprland.refreshWorkspaces() + // hlWorkspaces = Hyprland.workspaces.values; + // updateHyprlandWorkspaces(); + return true + } catch (e) { + console.error("Error initializing Hyprland:", e) + isHyprland = false + return false + } + } + + onHlWorkspacesChanged: { + updateHyprlandWorkspaces() + } + + Connections { + target: Hyprland.workspaces + function onValuesChanged() { + updateHyprlandWorkspaces() + } + } + + Connections { + target: Hyprland + function onRawEvent(event) { + updateHyprlandWorkspaces() + } + } + + function updateHyprlandWorkspaces() { + workspaces.clear() + try { + for (var i = 0; i < hlWorkspaces.length; i++) { + const ws = hlWorkspaces[i] + // Only append workspaces with id >= 1 + if (ws.id >= 1) { + workspaces.append({ + "id": i, + "idx": ws.id, + "name": ws.name || "", + "output": ws.monitor?.name || "", + "isActive": ws.active === true, + "isFocused": ws.focused === true, + "isUrgent": ws.urgent === true + }) } + } + workspacesChanged() + } catch (e) { + console.error("Error updating Hyprland workspaces:", e) + } + } + + function initNiri() { + updateNiriWorkspaces() + } + + Connections { + target: Niri + function onWorkspacesChanged() { + updateNiriWorkspaces() + } + } + + function updateNiriWorkspaces() { + const niriWorkspaces = Niri.workspaces || [] + workspaces.clear() + for (var i = 0; i < niriWorkspaces.length; i++) { + const ws = niriWorkspaces[i] + workspaces.append({ + "id": ws.id, + "idx": ws.idx || 1, + "name": ws.name || "", + "output": ws.output || "", + "isFocused": ws.isFocused === true, + "isActive": ws.isActive === true, + "isUrgent": ws.isUrgent === true, + "isOccupied": ws.isOccupied === true + }) } - onHlWorkspacesChanged: { - updateHyprlandWorkspaces(); - } + workspacesChanged() + } - Connections { - target: Hyprland.workspaces - function onValuesChanged() { - updateHyprlandWorkspaces(); - } + function switchToWorkspace(workspaceId) { + if (isHyprland) { + try { + Hyprland.dispatch(`workspace ${workspaceId}`) + } catch (e) { + console.error("Error switching Hyprland workspace:", e) + } + } else if (isNiri) { + try { + Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", workspaceId.toString()]) + } catch (e) { + console.error("Error switching Niri workspace:", e) + } + } else { + console.warn("No supported compositor detected for workspace switching") } - - Connections { - target: Hyprland - function onRawEvent(event) { - updateHyprlandWorkspaces(); - } - } - - function updateHyprlandWorkspaces() { - workspaces.clear(); - try { - for (let i = 0; i < hlWorkspaces.length; i++) { - const ws = hlWorkspaces[i]; - // Only append workspaces with id >= 1 - if (ws.id >= 1) { - workspaces.append({ - id: i, - idx: ws.id, - name: ws.name || "", - output: ws.monitor?.name || "", - isActive: ws.active === true, - isFocused: ws.focused === true, - isUrgent: ws.urgent === true - }); - } - } - workspacesChanged(); - } catch (e) { - console.error("Error updating Hyprland workspaces:", e); - } - } - - function initNiri() { - updateNiriWorkspaces(); - } - - Connections { - target: Niri - function onWorkspacesChanged() { - updateNiriWorkspaces(); - } - } - - function updateNiriWorkspaces() { - const niriWorkspaces = Niri.workspaces || []; - workspaces.clear(); - for (let i = 0; i < niriWorkspaces.length; i++) { - const ws = niriWorkspaces[i]; - workspaces.append({ - id: ws.id, - idx: ws.idx || 1, - name: ws.name || "", - output: ws.output || "", - isFocused: ws.isFocused === true, - isActive: ws.isActive === true, - isUrgent: ws.isUrgent === true, - isOccupied: ws.isOccupied === true, - }); - } - - workspacesChanged(); - } - - function switchToWorkspace(workspaceId) { - if (isHyprland) { - try { - Hyprland.dispatch(`workspace ${workspaceId}`); - } catch (e) { - console.error("Error switching Hyprland workspace:", e); - } - } else if (isNiri) { - try { - Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", workspaceId.toString()]); - } catch (e) { - console.error("Error switching Niri workspace:", e); - } - } else { - console.warn("No supported compositor detected for workspace switching"); - } - } -} \ No newline at end of file + } +}