The empty launcher stays in the widened notch, now laid out exactly like the launcher window's bar. Typing (or the magnifying glass / Down) hands over to the launcher window, which opens at the notch's size with the text already in it and only grows down with the results; clearing the search shrinks it back into the notch. The query and browse state are shared through ShellState, keys typed during the hand-over carry across, and the bar keeps its keyboard claim so focus returns on its own. The launcher window's open state is read from plain properties so it never maps for a frame on a stale value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
218 lines
7.3 KiB
QML
218 lines
7.3 KiB
QML
pragma Singleton
|
|
import QtQuick
|
|
import Quickshell
|
|
import "../services"
|
|
|
|
Singleton {
|
|
property bool wallpaperPickerOpen: false
|
|
property var wallpaperScreen: null
|
|
property var wallpaperWindow: null
|
|
function openWallpaperPicker() {
|
|
settingsOpen=false;launcherOpen=false;controlCenterOpen=false;dashboardOpen=false;overviewOpen=false;notchOpen=false;
|
|
wallpaperScreen=activeScreen();wallpaperPickerOpen=true;
|
|
}
|
|
property var systemPills: []
|
|
property bool controlCenterOpen: false
|
|
property var controlCenterScreen: null
|
|
property var controlCenterWindow: null
|
|
function openControlCenter() {
|
|
if (notchMode)
|
|
return openNotch();
|
|
wallpaperPickerOpen=false;
|
|
overviewOpen = false;
|
|
dashboardOpen = false;
|
|
if (controlCenterOpen)
|
|
return;
|
|
launcherOpen = false;
|
|
settingsOpen = false;
|
|
controlCenterScreen = activeScreen();
|
|
controlCenterOpen = true;
|
|
}
|
|
function toggleControlCenter() {
|
|
if (notchMode)
|
|
return toggleNotch();
|
|
if (controlCenterOpen)
|
|
controlCenterOpen = false;
|
|
else
|
|
openControlCenter();
|
|
}
|
|
// Caelestia-style dashboard; `dashboardTab` is a tab id, not an index.
|
|
property bool dashboardOpen: false
|
|
property var dashboardScreen: null
|
|
property var dashboardWindow: null
|
|
property string dashboardTab: ""
|
|
function openDashboard(tab) {
|
|
if (notchMode)
|
|
return openNotch();
|
|
wallpaperPickerOpen = false;
|
|
overviewOpen = false;
|
|
controlCenterOpen = false;
|
|
launcherOpen = false;
|
|
settingsOpen = false;
|
|
if (tab)
|
|
dashboardTab = tab;
|
|
if (!dashboardOpen)
|
|
dashboardScreen = activeScreen();
|
|
dashboardOpen = true;
|
|
}
|
|
function toggleDashboard(tab) {
|
|
if (notchMode)
|
|
return toggleNotch();
|
|
if (dashboardOpen && (!tab || tab === dashboardTab))
|
|
dashboardOpen = false;
|
|
else
|
|
openDashboard(tab);
|
|
}
|
|
// Notch mode (pocket-dots style): the bar splits into side islands and a
|
|
// centre notch; the Control Center and Dashboard keys open the notch instead.
|
|
readonly property bool notchMode: ConfigService.ready && !!ConfigService.data.notch && ConfigService.data.notch.enabled
|
|
property bool notchOpen: false
|
|
// Collapsed notch body width (ears excluded): clock alone, or art + clock + cava.
|
|
readonly property real notchPillWidth: MediaService.playing ? 236 : 128
|
|
property var notchScreen: null
|
|
property var notchWindow: null
|
|
property var launcherWindow: null
|
|
// "main" is the three-column panel; "computer" is the full Performance view.
|
|
property string notchView: "main"
|
|
function openNotch() {
|
|
wallpaperPickerOpen = false;
|
|
overviewOpen = false;
|
|
controlCenterOpen = false;
|
|
dashboardOpen = false;
|
|
launcherOpen = false;
|
|
settingsOpen = false;
|
|
if (!notchOpen) {
|
|
notchScreen = activeScreen();
|
|
notchView = "main";
|
|
}
|
|
notchOpen = true;
|
|
}
|
|
function toggleNotch() {
|
|
if (notchOpen)
|
|
notchOpen = false;
|
|
else
|
|
openNotch();
|
|
}
|
|
onNotchModeChanged: if (!notchMode)
|
|
notchOpen = false
|
|
// Super+N: swaps between notch mode and the full bar.
|
|
function toggleNotchMode() {
|
|
if (!ConfigService.ready)
|
|
return false;
|
|
notchOpen = false;
|
|
return ConfigService.setValue("notch.enabled", !notchMode);
|
|
}
|
|
// Workspace overview (SUPER+Tab): a drawer of live workspace thumbnails.
|
|
property bool overviewOpen: false
|
|
property var overviewScreen: null
|
|
property var overviewWindow: null
|
|
function openOverview() {
|
|
wallpaperPickerOpen = false;
|
|
notchOpen = false;
|
|
controlCenterOpen = false;
|
|
dashboardOpen = false;
|
|
launcherOpen = false;
|
|
settingsOpen = false;
|
|
if (!overviewOpen)
|
|
overviewScreen = activeScreen();
|
|
overviewOpen = true;
|
|
}
|
|
function toggleOverview() {
|
|
if (overviewOpen)
|
|
overviewOpen = false;
|
|
else
|
|
openOverview();
|
|
}
|
|
property bool launcherOpen: false
|
|
property var launcherScreen: null
|
|
// "apps" searches applications and commands; "clipboard" is Clipboard History;
|
|
// "emoji" is the Emoji Picker.
|
|
// Changing it on an open launcher switches in place.
|
|
property string launcherMode: "apps"
|
|
// Notch mode opens the launcher in the notch pill itself, the way a
|
|
// notification widens it. While the search is empty it stays there
|
|
// (notchSearch); typing or browsing hands over to the launcher window,
|
|
// which grows down from the widened pill. Both share the query.
|
|
property string launcherQuery: ""
|
|
property bool launcherBrowse: false
|
|
readonly property bool notchLauncher: notchMode && launcherOpen && launcherMode === "apps"
|
|
readonly property bool notchSearch: notchLauncher && launcherQuery === "" && !launcherBrowse
|
|
onLauncherOpenChanged: {
|
|
launcherQuery = "";
|
|
launcherBrowse = false;
|
|
}
|
|
onLauncherModeChanged: {
|
|
launcherQuery = "";
|
|
launcherBrowse = false;
|
|
}
|
|
function activeScreen() {
|
|
return ScreenService.active;
|
|
}
|
|
function openLauncher(mode) {
|
|
wallpaperPickerOpen=false;
|
|
notchOpen = false;
|
|
overviewOpen = false;
|
|
dashboardOpen = false;
|
|
launcherMode = mode === "clipboard" || mode === "emoji" ? mode : "apps";
|
|
if (launcherOpen)
|
|
return;
|
|
controlCenterOpen = false;
|
|
settingsOpen = false;
|
|
launcherScreen = activeScreen();
|
|
launcherOpen = true;
|
|
}
|
|
function toggleLauncher() {
|
|
if (launcherOpen)
|
|
launcherOpen = false;
|
|
else
|
|
openLauncher();
|
|
}
|
|
function toggleLauncherMode(mode) {
|
|
if (launcherOpen && launcherMode === mode)
|
|
launcherOpen = false;
|
|
else
|
|
openLauncher(mode);
|
|
}
|
|
function toggleClipboard() {
|
|
toggleLauncherMode("clipboard");
|
|
}
|
|
property var settingsWindow: null
|
|
property bool settingsOpen: false
|
|
property string settingsPage: "about"
|
|
// Setting title flashed after a settings search jump; the serial re-triggers repeats.
|
|
property string settingsHighlight: ""
|
|
property int settingsHighlightSerial: 0
|
|
function revealSetting(page, title) {
|
|
openSettings(page);
|
|
settingsHighlight = title || "";
|
|
settingsHighlightSerial++;
|
|
}
|
|
property var targetScreen: null
|
|
property var osdWindow: null
|
|
// Raised by Lock buttons when the built-in lock screen is enabled.
|
|
signal lockRequested
|
|
function requestLock() {
|
|
lockRequested();
|
|
}
|
|
function openSettings(page) {
|
|
wallpaperPickerOpen=false;
|
|
notchOpen = false;
|
|
overviewOpen = false;
|
|
dashboardOpen = false;
|
|
controlCenterOpen = false;
|
|
launcherOpen = false;
|
|
const destination = SettingsRegistry.page(page || "about");
|
|
settingsPage = destination ? destination.id : "about";
|
|
if (!settingsOpen) {
|
|
targetScreen = activeScreen();
|
|
}
|
|
settingsOpen = true;
|
|
}
|
|
function toggleSettings() {
|
|
if (settingsOpen)
|
|
settingsOpen = false;
|
|
else
|
|
openSettings("about");
|
|
}
|
|
}
|