added adaptive quickshell
This commit is contained in:
1 parent
6eb56d2065
commit
5b33a73fd8
189 files changed
+8678
-15
No files matched your search
@@ -0,0 +1,113 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
import "services/WindowPolicy.js" as WindowPolicy
|
||||
import "services"
|
||||
|
||||
ShellRoot {
|
||||
id: shell
|
||||
property string page: ""
|
||||
property bool settingsVisible: false
|
||||
property int lastCycledWindow: -1
|
||||
function cycleApplication(direction) {
|
||||
const windows = WindowPolicy.ordered(ToplevelManager.toplevels.values);
|
||||
const target = WindowPolicy.cycle(windows, lastCycledWindow, direction);
|
||||
if (!target) return;
|
||||
lastCycledWindow = windows.indexOf(target);
|
||||
target.activate();
|
||||
page = "";
|
||||
}
|
||||
property var targetScreen: Quickshell.screens[0] || null
|
||||
function openPage(name, screen) {
|
||||
targetScreen = screen || Quickshell.screens.find(s => s.name === Hyprland.focusedMonitor?.name) || targetScreen || Quickshell.screens[0];
|
||||
if (name === "settings" || name === "audio" || name === "wallpapers" || name === "network" || name === "bluetooth" || name === "modem" || name === "system" || name === "display") {
|
||||
page = "";
|
||||
settingsWindow.section = name === "wallpapers" ? "wallpaper" : name === "settings" ? "appearance" : name;
|
||||
settingsVisible = true;
|
||||
return;
|
||||
}
|
||||
page = page === name ? "" : name;
|
||||
}
|
||||
Connections {
|
||||
target: Quickshell
|
||||
function onScreensChanged() {
|
||||
if (Quickshell.screens.indexOf(shell.targetScreen) < 0) {
|
||||
shell.page = "";
|
||||
shell.targetScreen = Quickshell.screens[0] || null;
|
||||
}
|
||||
}
|
||||
}
|
||||
IpcHandler {
|
||||
target: "shell"
|
||||
function status(): string {
|
||||
return JSON.stringify({page: shell.page, settingsVisible: shell.settingsVisible,
|
||||
targetScreen: shell.targetScreen?.name || "", preferencesWritable: Preferences.writable,
|
||||
preferencesError: Preferences.error, favorites: Preferences.data.favorites || [],
|
||||
notificationsReady: Notifications.ready, notificationGroups: Notifications.groups.length, notificationDnd: Notifications.dnd, notificationPopup: notificationToast.notification?.id || 0,
|
||||
notifications: Notifications.items.map(n => ({id: n.id, summary: n.summary, urgency: n.urgency})),
|
||||
notificationHistoryCount: Notifications.history.length, notificationHistoryError: Notifications.error,
|
||||
wallpapers: Wallpapers.states, wallpaperError: Wallpapers.error,
|
||||
networkBackend: Hardware.networkBackend, networkInterfaces: Hardware.networks.length,
|
||||
audioReady: Hardware.audioReady, outputs: Hardware.outputs.length, inputs: Hardware.inputs.length});
|
||||
}
|
||||
function dnd(value: bool): void { Notifications.setDnd(value); }
|
||||
function dismissNotification(id: int): void { Notifications.dismiss(id); }
|
||||
function notificationAction(id: int, action: string): void { Notifications.invoke(id, action); }
|
||||
function notificationHistory(value: bool): void { Notifications.setSaveHistory(value); }
|
||||
function reload(): void { Quickshell.reload(false); }
|
||||
function clearNotifications(): void { Notifications.clear(); }
|
||||
function launcher(): void { shell.openPage("launcher"); }
|
||||
function audio(): void { shell.openPage("audio"); }
|
||||
function wallpapers(): void { shell.openPage("wallpapers"); }
|
||||
function setWallpaper(output: string, source: string): void { Wallpapers.set(output, source); }
|
||||
function inheritWallpaper(output: string): void { Wallpapers.inherit(output); }
|
||||
function network(): void { shell.openPage("network"); }
|
||||
function bluetooth(): void { shell.openPage("bluetooth"); }
|
||||
function settings(): void { shell.openPage("settings"); }
|
||||
function quickSettings(): void { shell.openPage("quick"); }
|
||||
function notifications(): void { shell.openPage("notifications"); }
|
||||
function recent(): void { shell.openPage("recent"); }
|
||||
function home(): void { shell.openPage("home"); }
|
||||
function power(): void { shell.openPage("power"); }
|
||||
function mode(value: string): void { Preferences.setValue("mode", value); }
|
||||
function theme(value: string): void { Preferences.setValue("theme", value); }
|
||||
function close(): void { shell.page = ""; shell.settingsVisible = false; }
|
||||
}
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
Bar {
|
||||
required property var modelData
|
||||
screen: modelData
|
||||
onNavigate: (name) => shell.openPage(name, modelData)
|
||||
}
|
||||
}
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
MobileNavigation {
|
||||
required property var modelData
|
||||
output: modelData
|
||||
onNavigate: name => shell.openPage(name, modelData)
|
||||
onCycleApplication: direction => shell.cycleApplication(direction)
|
||||
}
|
||||
}
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
Wallpaper { required property var modelData; output: modelData }
|
||||
}
|
||||
SettingsWindow {
|
||||
id: settingsWindow
|
||||
visible: shell.settingsVisible
|
||||
onCloseRequested: shell.settingsVisible = false
|
||||
onNavigate: name => shell.openPage(name)
|
||||
}
|
||||
Toast { id: notificationToast; screen: shell.targetScreen }
|
||||
Overlay {
|
||||
screen: shell.targetScreen
|
||||
page: shell.page
|
||||
onNavigate: name => shell.openPage(name)
|
||||
onCloseRequested: shell.page = ""
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user