Formatting
This commit is contained in:
parent
4ebc4cd299
commit
8a16b6b7f5
8 changed files with 163 additions and 156 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
pragma ComponentBehavior
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|
@ -8,149 +9,149 @@ import Quickshell.Hyprland
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property ListModel workspaces: ListModel {}
|
property ListModel workspaces: ListModel {}
|
||||||
property bool isHyprland: false
|
property bool isHyprland: false
|
||||||
property bool isNiri: false
|
property bool isNiri: false
|
||||||
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) {
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
} catch (e) {
|
||||||
|
console.log("Hyprland not available:", e)
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize Hyprland integration
|
if (typeof Niri !== "undefined") {
|
||||||
function initHyprland() {
|
console.log("Detected Niri service")
|
||||||
try {
|
isHyprland = false
|
||||||
// Fixes the odd workspace issue.
|
isNiri = true
|
||||||
Hyprland.refreshWorkspaces();
|
initNiri()
|
||||||
// hlWorkspaces = Hyprland.workspaces.values;
|
return
|
||||||
// updateHyprlandWorkspaces();
|
}
|
||||||
return true;
|
|
||||||
} catch (e) {
|
console.log("No supported compositor detected")
|
||||||
console.error("Error initializing Hyprland:", e);
|
} catch (e) {
|
||||||
isHyprland = false;
|
console.error("Error detecting compositor:", e)
|
||||||
return false;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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: {
|
workspacesChanged()
|
||||||
updateHyprlandWorkspaces();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
function switchToWorkspace(workspaceId) {
|
||||||
target: Hyprland.workspaces
|
if (isHyprland) {
|
||||||
function onValuesChanged() {
|
try {
|
||||||
updateHyprlandWorkspaces();
|
Hyprland.dispatch(`workspace ${workspaceId}`)
|
||||||
}
|
} catch (e) {
|
||||||
}
|
console.error("Error switching Hyprland workspace:", e)
|
||||||
|
}
|
||||||
Connections {
|
} else if (isNiri) {
|
||||||
target: Hyprland
|
try {
|
||||||
function onRawEvent(event) {
|
Quickshell.execDetached(["niri", "msg", "action", "focus-workspace", workspaceId.toString()])
|
||||||
updateHyprlandWorkspaces();
|
} catch (e) {
|
||||||
}
|
console.error("Error switching Niri workspace:", e)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
function updateHyprlandWorkspaces() {
|
console.warn("No supported compositor detected for workspace switching")
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue