87 lines
2.0 KiB
QML
87 lines
2.0 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
ShellRoot {
|
|
id: shell
|
|
|
|
property bool open: false
|
|
// Focus the name field once the carousel opens.
|
|
property bool renameOnOpen: false
|
|
// Open the window loop on the focused workspace once the carousel opens.
|
|
property bool openWindowsOnOpen: false
|
|
|
|
Compositor {
|
|
id: compositor
|
|
livePreviews: theme.livePreviews
|
|
snapshotPreviewsHyprland: theme.snapshotPreviewsHyprland
|
|
snapshotPreviewsNiri: theme.snapshotPreviewsNiri
|
|
}
|
|
|
|
Theme {
|
|
id: theme
|
|
}
|
|
|
|
Config {
|
|
id: config
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
if (compositor.kind === "")
|
|
console.warn("workspace-manager: neither niri nor Hyprland was detected");
|
|
}
|
|
|
|
function closeAll(): void {
|
|
shell.open = false;
|
|
}
|
|
|
|
function openWith(rename: bool, windows: bool): void {
|
|
shell.renameOnOpen = rename;
|
|
shell.openWindowsOnOpen = windows;
|
|
// Already open, so there is no fresh open to wait for.
|
|
if (shell.open) {
|
|
if (windows)
|
|
gotoView.expandWindows(false);
|
|
if (rename)
|
|
gotoView.enterRename();
|
|
return;
|
|
}
|
|
shell.open = true;
|
|
}
|
|
|
|
IpcHandler {
|
|
target: "workspace"
|
|
|
|
function toggle(): void {
|
|
if (shell.open)
|
|
shell.closeAll();
|
|
else
|
|
shell.openWith(false, false);
|
|
}
|
|
|
|
function goTo(): void {
|
|
shell.openWith(false, false);
|
|
}
|
|
|
|
function openWindowSelection(): void {
|
|
shell.openWith(false, true);
|
|
}
|
|
|
|
function openWorkspaceRename(): void {
|
|
shell.openWith(true, false);
|
|
}
|
|
}
|
|
|
|
GotoView {
|
|
id: gotoView
|
|
shellOpen: shell.open
|
|
compositor: compositor
|
|
theme: theme
|
|
config: config
|
|
renameOnOpen: shell.renameOnOpen
|
|
openWindowsOnOpen: shell.openWindowsOnOpen
|
|
onRequestClose: shell.closeAll()
|
|
onRequestBack: shell.closeAll()
|
|
}
|
|
}
|