Files
skygqts/workspace-manager/shell.qml
T
2026-10-16 15:18:18 -04:00

87 lines
2.0 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Io
ShellRoot {
id: shell
property bool open: false
// Open the search bar once the carousel opens.
property bool searchOnOpen: 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(search: bool, windows: bool): void {
shell.searchOnOpen = search;
shell.openWindowsOnOpen = windows;
// Already open, so there is no fresh open to wait for.
if (shell.open) {
if (windows)
gotoView.expandWindows(false);
if (search)
gotoView.enterSearch();
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 openSearch(): void {
shell.openWith(true, false);
}
}
GotoView {
id: gotoView
shellOpen: shell.open
compositor: compositor
theme: theme
config: config
searchOnOpen: shell.searchOnOpen
openWindowsOnOpen: shell.openWindowsOnOpen
onRequestClose: shell.closeAll()
onRequestBack: shell.closeAll()
}
}