Formatting

This commit is contained in:
quadbyte 2025-08-12 12:07:51 -04:00
parent 4ebc4cd299
commit 8a16b6b7f5
8 changed files with 163 additions and 156 deletions

View file

@ -8,7 +8,8 @@ Variants {
delegate: PanelWindow { delegate: PanelWindow {
required property ShellScreen modelData 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 visible: wallpaperSource !== "" && !Settings.data.wallpaper.swww.enabled

View file

@ -9,7 +9,8 @@ Variants {
delegate: PanelWindow { delegate: PanelWindow {
required property ShellScreen modelData 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 visible: wallpaperSource !== "" && !Settings.data.wallpaper.swww.enabled
color: "transparent" color: "transparent"

View file

@ -46,13 +46,11 @@ NLoader {
"label": "Wallpaper", "label": "Wallpaper",
"icon": "image", "icon": "image",
"source": "Tabs/Wallpaper.qml" "source": "Tabs/Wallpaper.qml"
}, }, {
{
"label": "Wallpaper Selector", "label": "Wallpaper Selector",
"icon": "wallpaper_slideshow", "icon": "wallpaper_slideshow",
"source": "Tabs/WallpaperSelector.qml" "source": "Tabs/WallpaperSelector.qml"
}, }, {
{
"label": "Misc", "label": "Misc",
"icon": "more_horiz", "icon": "more_horiz",
"source": "Tabs/Misc.qml" "source": "Tabs/Misc.qml"

View file

@ -188,8 +188,14 @@ Singleton {
Connections { Connections {
target: adapter.wallpaper target: adapter.wallpaper
function onIsRandomChanged() { Wallpapers.toggleRandomWallpaper() } function onIsRandomChanged() {
function onRandomIntervalChanged() { Wallpapers.restartRandomWallpaperTimer() } Wallpapers.toggleRandomWallpaper()
function onDirectoryChanged() { Wallpapers.loadWallpapers() } }
function onRandomIntervalChanged() {
Wallpapers.restartRandomWallpaperTimer()
}
function onDirectoryChanged() {
Wallpapers.loadWallpapers()
}
} }
} }

View file

@ -143,7 +143,7 @@ Singleton {
console.log("SWWW: Process started with command:", command.join(" ")) 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) console.log("SWWW: Process finished with exit code:", exitCode, "status:", exitStatus)
if (exitCode !== 0) { if (exitCode !== 0) {
console.log("SWWW: Process failed. Make sure swww-daemon is running with: swww-daemon") console.log("SWWW: Process failed. Make sure swww-daemon is running with: swww-daemon")
@ -168,7 +168,7 @@ Singleton {
console.log("SWWW: Daemon start process initiated") 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) console.log("SWWW: Daemon start process finished with exit code:", exitCode)
if (exitCode === 0) { if (exitCode === 0) {
console.log("SWWW: Daemon started successfully") console.log("SWWW: Daemon started successfully")

View file

@ -1,5 +1,6 @@
pragma Singleton pragma Singleton
pragma ComponentBehavior: Bound
pragma ComponentBehavior
import QtQuick import QtQuick
import Quickshell import Quickshell
@ -16,35 +17,35 @@ Singleton {
property var hlWorkspaces: Hyprland.workspaces.values property var hlWorkspaces: Hyprland.workspaces.values
// Detect which compositor we're using // Detect which compositor we're using
Component.onCompleted: { Component.onCompleted: {
console.log("WorkspaceManager initializing..."); console.log("WorkspaceManager initializing...")
detectCompositor(); detectCompositor()
} }
function detectCompositor() { function detectCompositor() {
try { try {
try { try {
if (Hyprland.eventSocketPath) { if (Hyprland.eventSocketPath) {
console.log("Detected Hyprland compositor"); console.log("Detected Hyprland compositor")
isHyprland = true; isHyprland = true
isNiri = false; isNiri = false
initHyprland(); initHyprland()
return; return
} }
} catch (e) { } catch (e) {
console.log("Hyprland not available:", e); console.log("Hyprland not available:", e)
} }
if (typeof Niri !== "undefined") { if (typeof Niri !== "undefined") {
console.log("Detected Niri service"); console.log("Detected Niri service")
isHyprland = false; isHyprland = false
isNiri = true; isNiri = true
initNiri(); initNiri()
return; return
} }
console.log("No supported compositor detected"); console.log("No supported compositor detected")
} catch (e) { } catch (e) {
console.error("Error detecting compositor:", e); console.error("Error detecting compositor:", e)
} }
} }
@ -52,105 +53,105 @@ Singleton {
function initHyprland() { function initHyprland() {
try { try {
// Fixes the odd workspace issue. // Fixes the odd workspace issue.
Hyprland.refreshWorkspaces(); Hyprland.refreshWorkspaces()
// hlWorkspaces = Hyprland.workspaces.values; // hlWorkspaces = Hyprland.workspaces.values;
// updateHyprlandWorkspaces(); // updateHyprlandWorkspaces();
return true; return true
} catch (e) { } catch (e) {
console.error("Error initializing Hyprland:", e); console.error("Error initializing Hyprland:", e)
isHyprland = false; isHyprland = false
return false; return false
} }
} }
onHlWorkspacesChanged: { onHlWorkspacesChanged: {
updateHyprlandWorkspaces(); updateHyprlandWorkspaces()
} }
Connections { Connections {
target: Hyprland.workspaces target: Hyprland.workspaces
function onValuesChanged() { function onValuesChanged() {
updateHyprlandWorkspaces(); updateHyprlandWorkspaces()
} }
} }
Connections { Connections {
target: Hyprland target: Hyprland
function onRawEvent(event) { function onRawEvent(event) {
updateHyprlandWorkspaces(); updateHyprlandWorkspaces()
} }
} }
function updateHyprlandWorkspaces() { function updateHyprlandWorkspaces() {
workspaces.clear(); workspaces.clear()
try { try {
for (let i = 0; i < hlWorkspaces.length; i++) { for (var i = 0; i < hlWorkspaces.length; i++) {
const ws = hlWorkspaces[i]; const ws = hlWorkspaces[i]
// Only append workspaces with id >= 1 // Only append workspaces with id >= 1
if (ws.id >= 1) { if (ws.id >= 1) {
workspaces.append({ workspaces.append({
id: i, "id": i,
idx: ws.id, "idx": ws.id,
name: ws.name || "", "name": ws.name || "",
output: ws.monitor?.name || "", "output": ws.monitor?.name || "",
isActive: ws.active === true, "isActive": ws.active === true,
isFocused: ws.focused === true, "isFocused": ws.focused === true,
isUrgent: ws.urgent === true "isUrgent": ws.urgent === true
}); })
} }
} }
workspacesChanged(); workspacesChanged()
} catch (e) { } catch (e) {
console.error("Error updating Hyprland workspaces:", e); console.error("Error updating Hyprland workspaces:", e)
} }
} }
function initNiri() { function initNiri() {
updateNiriWorkspaces(); updateNiriWorkspaces()
} }
Connections { Connections {
target: Niri target: Niri
function onWorkspacesChanged() { function onWorkspacesChanged() {
updateNiriWorkspaces(); updateNiriWorkspaces()
} }
} }
function updateNiriWorkspaces() { function updateNiriWorkspaces() {
const niriWorkspaces = Niri.workspaces || []; const niriWorkspaces = Niri.workspaces || []
workspaces.clear(); workspaces.clear()
for (let i = 0; i < niriWorkspaces.length; i++) { for (var i = 0; i < niriWorkspaces.length; i++) {
const ws = niriWorkspaces[i]; const ws = niriWorkspaces[i]
workspaces.append({ workspaces.append({
id: ws.id, "id": ws.id,
idx: ws.idx || 1, "idx": ws.idx || 1,
name: ws.name || "", "name": ws.name || "",
output: ws.output || "", "output": ws.output || "",
isFocused: ws.isFocused === true, "isFocused": ws.isFocused === true,
isActive: ws.isActive === true, "isActive": ws.isActive === true,
isUrgent: ws.isUrgent === true, "isUrgent": ws.isUrgent === true,
isOccupied: ws.isOccupied === true, "isOccupied": ws.isOccupied === true
}); })
} }
workspacesChanged(); workspacesChanged()
} }
function switchToWorkspace(workspaceId) { function switchToWorkspace(workspaceId) {
if (isHyprland) { if (isHyprland) {
try { try {
Hyprland.dispatch(`workspace ${workspaceId}`); Hyprland.dispatch(`workspace ${workspaceId}`)
} catch (e) { } catch (e) {
console.error("Error switching Hyprland workspace:", e); console.error("Error switching Hyprland workspace:", e)
} }
} else if (isNiri) { } else if (isNiri) {
try { try {
Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", workspaceId.toString()]); Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", workspaceId.toString()])
} catch (e) { } catch (e) {
console.error("Error switching Niri workspace:", e); console.error("Error switching Niri workspace:", e)
} }
} else { } else {
console.warn("No supported compositor detected for workspace switching"); console.warn("No supported compositor detected for workspace switching")
} }
} }
} }