-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshell.qml
More file actions
183 lines (163 loc) · 7.34 KB
/
Copy pathshell.qml
File metadata and controls
183 lines (163 loc) · 7.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
//@ pragma UseQApplication
import QtQuick
import QtQml 2.15
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import "bar"
import "bar/Menu"
import "bar/Menu/components"
import "services"
import "Settings"
import "windows"
Scope {
readonly property var _notifications: NotificationService
readonly property var _battery: BatteryService
readonly property var _media: MediaPlayerService
readonly property var _productivity: ProductivityService
// --- IPC HANDLER FOR ZENITH:MENU ---
IpcHandler {
target: "zenith:menu"
function toggle(drawer: string): void {
handleCommand(drawer);
}
function launcher(): void { handleCommand("launcher"); }
function dashboard(): void { handleCommand("dashboard"); }
function wallpaper(): void { handleCommand("wallpaper"); }
function mail(): void { handleCommand("mail"); }
function pomodoro(): void { handleCommand("pomodoro"); }
function volume(): void { handleCommand("volume"); }
function clipboard(): void { handleCommand("clipboard"); }
function emoji(): void { handleCommand("emoji"); }
function power(): void { handleCommand("power"); }
function settings(): void { handleCommand("settings"); }
function close(): void { handleCommand("close"); }
}
// --- INSTANT IPC VIA NAMED PIPE (FIFO) ---
property string cmdPath: Quickshell.env("HOME") + "/.cache/zenith_fifo"
// --- NATIVE HYPRLAND GLOBAL SHORTCUTS ---
GlobalShortcut { appid: "zenith"; name: "launcher"; onPressed: handleCommand("launcher") }
GlobalShortcut { appid: "zenith"; name: "dashboard"; onPressed: handleCommand("dashboard") }
GlobalShortcut { appid: "zenith"; name: "wallpaper"; onPressed: handleCommand("wallpaper") }
GlobalShortcut { appid: "zenith"; name: "pomodoro"; onPressed: handleCommand("pomodoro") }
GlobalShortcut { appid: "zenith"; name: "volume"; onPressed: handleCommand("volume") }
GlobalShortcut { appid: "zenith"; name: "close"; onPressed: handleCommand("close") }
GlobalShortcut { appid: "zenith"; name: "clipboard"; onPressed: handleCommand("clipboard") }
GlobalShortcut { appid: "zenith"; name: "emoji"; onPressed: handleCommand("emoji") }
GlobalShortcut { appid: "zenith"; name: "power"; onPressed: handleCommand("power") }
GlobalShortcut { appid: "zenith"; name: "settings"; onPressed: handleCommand("settings") }
property bool settingsVisible: false
Process {
id: ipcReader
command: ["sh", "-c", "mkdir -p $HOME/.cache && (rm -f " + cmdPath + " 2>/dev/null; mkfifo " + cmdPath + " 2>/dev/null || true) && while true; do cat " + cmdPath + " 2>/dev/null || sleep 0.1; done"]
running: true
stdout: SplitParser {
onRead: (data) => {
let cmd = data.trim();
if (cmd !== "") {
handleCommand(cmd);
}
}
}
}
function handleCommand(cmd) {
let parts = cmd.split(":");
let action = parts[0].trim();
let lowerAction = action.toLowerCase();
let arg = parts.length > 1 ? parts[1].trim() : "";
let lowerArg = arg.toLowerCase();
if (lowerAction === "launcher" || lowerAction === "toggle_launcher" || lowerAction === "applauncher") {
DynamicIslandService.toggle("launcher");
} else if (lowerAction === "clipboard" || lowerAction === "toggle_clipboard" || lowerAction === "clip" || lowerAction === "cliphist") {
DynamicIslandService.toggle("clipboard");
} else if (lowerAction === "emoji" || lowerAction === "toggle_emoji" || lowerAction === "emojis" || lowerAction === "emojiselector") {
DynamicIslandService.toggle("emoji");
} else if (lowerAction === "dashboard" || lowerAction === "toggle_dashboard" || lowerAction === "actionlauncher" || lowerAction === "overview") {
let tab = "Default";
if (lowerArg === "pomodoro") tab = "Pomodoro";
else if (lowerArg === "wallpaper" || lowerArg === "wallpapers") tab = "Wallpaper";
else if (lowerArg === "roadmap" || lowerArg === "roadmaps") { tab = "Pomodoro"; CenterState.focusTool = "Roadmap"; }
CenterState.toggle(tab);
} else if (lowerAction === "quicksettings" || lowerAction === "toggle_quicksettings") {
let tab = arg || "network";
QuickSettingsService.toggle(tab);
} else if (lowerAction === "mail" || lowerAction === "email" || lowerAction === "inbox") {
CenterState.toggle("Mail");
} else if (lowerAction === "wallpaper" || lowerAction === "wallpapers") {
CenterState.toggle("Wallpaper");
} else if (lowerAction === "roadmap" || lowerAction === "roadmaps") {
// Roadmap lives inside the Focus tab now, alongside the todo list.
CenterState.focusTool = "Roadmap";
CenterState.toggle("Pomodoro");
} else if (lowerAction === "pomodoro") {
CenterState.toggle("Pomodoro");
} else if (lowerAction === "wifi" || lowerAction === "network") {
QuickSettingsService.toggle("network");
} else if (lowerAction === "bluetooth" || lowerAction === "bt") {
QuickSettingsService.toggle("bluetooth");
} else if (lowerAction === "volume" || lowerAction === "audio") {
QuickSettingsService.toggle("volume");
} else if (lowerAction === "powerprofile" || lowerAction === "prof") {
QuickSettingsService.toggle("powerprofile");
} else if (lowerAction === "battery" || lowerAction === "pwr") {
QuickSettingsService.toggle("battery");
} else if (lowerAction === "power" || lowerAction === "sys") {
QuickSettingsService.toggle("power");
} else if (lowerAction === "settings" || lowerAction === "config") {
settingsVisible = !settingsVisible;
} else if (lowerAction === "close" || lowerAction === "close_all") {
MenuService.closeAll();
DynamicIslandService.close();
}
}
DismissOverlay {
id: dismissOverlay
}
Connections {
target: HyprlandService
function onIsFullscreenChanged() {
if (HyprlandService.isFullscreen) {
MenuService.closeAll();
DynamicIslandService.close();
}
}
}
Bar {
id: bar
controlCenterMenuRef: controlCenterMenu
}
ControlCenter {
id: controlCenterMenu
parentWindow: bar
visible: CenterState.qsVisible
Component.onCompleted: CenterState.menuRef = this
}
QuickSettingsMenu {
id: quickSettingsMenu
parentWindow: bar
visible: QuickSettingsService.qsVisible
Component.onCompleted: QuickSettingsService.menuRef = this
}
NotificationPopup {
id: notificationPopup
}
OsdPopup {
id: osdPopup
}
DynamicIslandOverlay {
id: dynamicIslandOverlay
visible: DynamicIslandService.active
}
Loader {
id: settingsLoader
active: settingsVisible
sourceComponent: Component {
SettingsWindow {
Component.onCompleted: visible = true
onVisibleChanged: {
if (!visible) settingsVisible = false;
}
}
}
}
}