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 {
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

View file

@ -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"

View file

@ -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"

View file

@ -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()
}
}
}

View file

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