Files
skygqts/workspace-manager/shell.qml
T
2026-09-23 10:17:06 -04:00

77 lines
1.7 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Io
ShellRoot {
id: shell
// "", "rename", or "goto".
property string mode: ""
// Set only when Ctrl+G opens the carousel from the rename bar.
property bool gotoReturnsToRename: false
Compositor {
id: compositor
}
Theme {
id: theme
}
Component.onCompleted: {
if (compositor.kind === "")
console.warn("workspace-manager: neither niri nor Hyprland was detected");
}
function openGoto(returnToRename: bool): void {
shell.gotoReturnsToRename = returnToRename;
shell.mode = "goto";
}
function closeAll(): void {
shell.mode = "";
shell.gotoReturnsToRename = false;
}
IpcHandler {
target: "workspace"
function toggle(): void {
if (shell.mode === "")
shell.mode = "rename";
else
shell.closeAll();
}
// "goto" is a reserved word, so the IPC name is goTo.
function goTo(): void {
if (shell.mode === "goto")
shell.closeAll();
else
shell.openGoto(false);
}
}
RenameBar {
shellOpen: shell.mode === "rename"
compositor: compositor
theme: theme
onRequestClose: shell.closeAll()
onRequestGoto: shell.openGoto(true)
}
GotoView {
shellOpen: shell.mode === "goto"
compositor: compositor
theme: theme
onRequestClose: shell.closeAll()
onRequestBack: {
if (shell.gotoReturnsToRename)
shell.mode = "rename";
else
shell.mode = "";
shell.gotoReturnsToRename = false;
}
}
}