mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
Compare commits
1 Commits
monorepo
...
more-loadi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
983d185de6 |
373
IPC.qml
Normal file
373
IPC.qml
Normal file
@@ -0,0 +1,373 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var powermenu: null
|
||||
property var processlist: null
|
||||
property var controlCenter: null
|
||||
property var dash: null
|
||||
property var notepadVariants: null
|
||||
property var spotlight: null
|
||||
property var clipboard: null
|
||||
property var notifications: null
|
||||
property var settings: null
|
||||
|
||||
function getFocusedScreenName() {
|
||||
if (CompositorService.isHyprland && Hyprland.focusedWorkspace && Hyprland.focusedWorkspace.monitor) {
|
||||
return Hyprland.focusedWorkspace.monitor.name
|
||||
}
|
||||
if (CompositorService.isNiri && NiriService.currentOutput) {
|
||||
return NiriService.currentOutput
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
function getActiveNotepadInstance() {
|
||||
if (!notepadVariants || notepadVariants.instances.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (notepadVariants.instances.length === 1) {
|
||||
return notepadVariants.instances[0]
|
||||
}
|
||||
|
||||
var focusedScreen = getFocusedScreenName()
|
||||
if (focusedScreen && notepadVariants.instances.length > 0) {
|
||||
for (var i = 0; i < notepadVariants.instances.length; i++) {
|
||||
var slideout = notepadVariants.instances[i]
|
||||
if (slideout.modelData && slideout.modelData.name === focusedScreen) {
|
||||
return slideout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < notepadVariants.instances.length; i++) {
|
||||
var slideout = notepadVariants.instances[i]
|
||||
if (slideout.isVisible) {
|
||||
return slideout
|
||||
}
|
||||
}
|
||||
|
||||
return notepadVariants.instances[0]
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open() {
|
||||
powermenu.active = true
|
||||
if (powermenu.item)
|
||||
powermenu.item.open()
|
||||
return "POWERMENU_OPEN_SUCCESS"
|
||||
}
|
||||
|
||||
function close() {
|
||||
if (powermenu.item) {
|
||||
powermenu.item.close()
|
||||
powermenu.active = false
|
||||
}
|
||||
return "POWERMENU_CLOSE_SUCCESS"
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
powermenu.active = true
|
||||
if (powermenu.item)
|
||||
powermenu.item.toggle()
|
||||
return "POWERMENU_TOGGLE_SUCCESS"
|
||||
}
|
||||
|
||||
target: "powermenu"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
processlist.active = true
|
||||
if (processlist.item)
|
||||
processlist.item.show()
|
||||
return "PROCESSLIST_OPEN_SUCCESS"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (processlist.item) {
|
||||
processlist.item.hide()
|
||||
processlist.active = false
|
||||
}
|
||||
return "PROCESSLIST_CLOSE_SUCCESS"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
processlist.active = true
|
||||
if (processlist.item)
|
||||
processlist.item.toggle()
|
||||
return "PROCESSLIST_TOGGLE_SUCCESS"
|
||||
}
|
||||
|
||||
target: "processlist"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
controlCenter.active = true
|
||||
if (controlCenter.item) {
|
||||
controlCenter.item.open()
|
||||
return "CONTROL_CENTER_OPEN_SUCCESS"
|
||||
}
|
||||
return "CONTROL_CENTER_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (controlCenter.item) {
|
||||
controlCenter.item.close()
|
||||
controlCenter.active = false
|
||||
return "CONTROL_CENTER_CLOSE_SUCCESS"
|
||||
}
|
||||
return "CONTROL_CENTER_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
controlCenter.active = true
|
||||
if (controlCenter.item) {
|
||||
controlCenter.item.toggle()
|
||||
return "CONTROL_CENTER_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "CONTROL_CENTER_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "control-center"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(tab: string): string {
|
||||
dash.active = true
|
||||
if (dash.item) {
|
||||
switch (tab.toLowerCase()) {
|
||||
case "media":
|
||||
dash.item.currentTabIndex = 1
|
||||
break
|
||||
case "weather":
|
||||
dash.item.currentTabIndex = SettingsData.weatherEnabled ? 2 : 0
|
||||
break
|
||||
default:
|
||||
dash.item.currentTabIndex = 0
|
||||
break
|
||||
}
|
||||
dash.item.setTriggerPosition(Screen.width / 2, Theme.barHeight + Theme.spacingS, 100, "center", Screen)
|
||||
dash.item.dashVisible = true
|
||||
return "DASH_OPEN_SUCCESS"
|
||||
}
|
||||
return "DASH_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (dash.item) {
|
||||
dash.item.dashVisible = false
|
||||
dash.active = false
|
||||
return "DASH_CLOSE_SUCCESS"
|
||||
}
|
||||
return "DASH_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(tab: string): string {
|
||||
dash.active = true
|
||||
if (dash.item) {
|
||||
if (dash.item.dashVisible) {
|
||||
dash.item.dashVisible = false
|
||||
} else {
|
||||
switch (tab.toLowerCase()) {
|
||||
case "media":
|
||||
dash.item.currentTabIndex = 1
|
||||
break
|
||||
case "weather":
|
||||
dash.item.currentTabIndex = SettingsData.weatherEnabled ? 2 : 0
|
||||
break
|
||||
default:
|
||||
dash.item.currentTabIndex = 0
|
||||
break
|
||||
}
|
||||
dash.item.setTriggerPosition(Screen.width / 2, Theme.barHeight + Theme.spacingS, 100, "center", Screen)
|
||||
dash.item.dashVisible = true
|
||||
}
|
||||
return "DASH_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "DASH_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "dash"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
var instance = getActiveNotepadInstance()
|
||||
if (instance) {
|
||||
instance.show()
|
||||
return "NOTEPAD_OPEN_SUCCESS"
|
||||
}
|
||||
return "NOTEPAD_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
var instance = getActiveNotepadInstance()
|
||||
if (instance) {
|
||||
instance.hide()
|
||||
return "NOTEPAD_CLOSE_SUCCESS"
|
||||
}
|
||||
return "NOTEPAD_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
var instance = getActiveNotepadInstance()
|
||||
if (instance) {
|
||||
instance.toggle()
|
||||
return "NOTEPAD_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "NOTEPAD_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "notepad"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
spotlight.active = true
|
||||
if (spotlight.item) {
|
||||
spotlight.item.show()
|
||||
return "SPOTLIGHT_OPEN_SUCCESS"
|
||||
}
|
||||
return "SPOTLIGHT_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (spotlight.item) {
|
||||
spotlight.item.hide()
|
||||
spotlight.active = false
|
||||
return "SPOTLIGHT_CLOSE_SUCCESS"
|
||||
}
|
||||
return "SPOTLIGHT_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
spotlight.active = true
|
||||
if (spotlight.item) {
|
||||
spotlight.item.toggle()
|
||||
return "SPOTLIGHT_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "SPOTLIGHT_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "spotlight"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
clipboard.active = true
|
||||
if (clipboard.item) {
|
||||
clipboard.item.show()
|
||||
return "CLIPBOARD_OPEN_SUCCESS"
|
||||
}
|
||||
return "CLIPBOARD_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (clipboard.item) {
|
||||
clipboard.item.hide()
|
||||
clipboard.active = false
|
||||
return "CLIPBOARD_CLOSE_SUCCESS"
|
||||
}
|
||||
return "CLIPBOARD_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
clipboard.active = true
|
||||
if (clipboard.item) {
|
||||
clipboard.item.toggle()
|
||||
return "CLIPBOARD_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "CLIPBOARD_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "clipboard"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
notifications.active = true
|
||||
if (notifications.item) {
|
||||
notifications.item.show()
|
||||
return "NOTIFICATION_MODAL_OPEN_SUCCESS"
|
||||
}
|
||||
return "NOTIFICATION_MODAL_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (notifications.item) {
|
||||
notifications.item.hide()
|
||||
notifications.active = false
|
||||
return "NOTIFICATION_MODAL_CLOSE_SUCCESS"
|
||||
}
|
||||
return "NOTIFICATION_MODAL_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
notifications.active = true
|
||||
if (notifications.item) {
|
||||
notifications.item.toggle()
|
||||
return "NOTIFICATION_MODAL_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "NOTIFICATION_MODAL_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "notifications"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
settings.active = true
|
||||
if (settings.item) {
|
||||
settings.item.show()
|
||||
return "SETTINGS_OPEN_SUCCESS"
|
||||
}
|
||||
return "SETTINGS_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (settings.item) {
|
||||
settings.item.hide()
|
||||
settings.active = false
|
||||
return "SETTINGS_CLOSE_SUCCESS"
|
||||
}
|
||||
return "SETTINGS_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
settings.active = true
|
||||
if (settings.item) {
|
||||
settings.item.toggle()
|
||||
return "SETTINGS_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "SETTINGS_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "settings"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function browse(type: string) {
|
||||
settings.active = true
|
||||
if (settings.item) {
|
||||
if (type === "wallpaper") {
|
||||
settings.item.wallpaperBrowser.allowStacking = false
|
||||
settings.item.wallpaperBrowser.open()
|
||||
} else if (type === "profile") {
|
||||
settings.item.profileBrowser.allowStacking = false
|
||||
settings.item.profileBrowser.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
target: "file"
|
||||
}
|
||||
}
|
||||
@@ -187,24 +187,6 @@ DankModal {
|
||||
filteredClipboardModel: filteredClipboardModel
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
clipboardHistoryModal.show()
|
||||
return "CLIPBOARD_OPEN_SUCCESS"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
clipboardHistoryModal.hide()
|
||||
return "CLIPBOARD_CLOSE_SUCCESS"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
clipboardHistoryModal.toggle()
|
||||
return "CLIPBOARD_TOGGLE_SUCCESS"
|
||||
}
|
||||
|
||||
target: "clipboard"
|
||||
}
|
||||
|
||||
clipboardContent: Component {
|
||||
ClipboardContent {
|
||||
|
||||
@@ -71,24 +71,6 @@ DankModal {
|
||||
onClose: () => notificationModal.hide()
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
notificationModal.show();
|
||||
return "NOTIFICATION_MODAL_OPEN_SUCCESS";
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
notificationModal.hide();
|
||||
return "NOTIFICATION_MODAL_CLOSE_SUCCESS";
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
notificationModal.toggle();
|
||||
return "NOTIFICATION_MODAL_TOGGLE_SUCCESS";
|
||||
}
|
||||
|
||||
target: "notifications"
|
||||
}
|
||||
|
||||
content: Component {
|
||||
Item {
|
||||
|
||||
@@ -41,38 +41,6 @@ DankModal {
|
||||
}
|
||||
content: settingsContent
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
settingsModal.show();
|
||||
return "SETTINGS_OPEN_SUCCESS";
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
settingsModal.hide();
|
||||
return "SETTINGS_CLOSE_SUCCESS";
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
settingsModal.toggle();
|
||||
return "SETTINGS_TOGGLE_SUCCESS";
|
||||
}
|
||||
|
||||
target: "settings"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function browse(type: string) {
|
||||
if (type === "wallpaper") {
|
||||
wallpaperBrowser.allowStacking = false;
|
||||
wallpaperBrowser.open();
|
||||
} else if (type === "profile") {
|
||||
profileBrowser.allowStacking = false;
|
||||
profileBrowser.open();
|
||||
}
|
||||
}
|
||||
|
||||
target: "file"
|
||||
}
|
||||
|
||||
FileBrowserModal {
|
||||
id: profileBrowser
|
||||
|
||||
@@ -82,24 +82,6 @@ DankModal {
|
||||
target: ModalManager
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
spotlightModal.show()
|
||||
return "SPOTLIGHT_OPEN_SUCCESS"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
spotlightModal.hide()
|
||||
return "SPOTLIGHT_CLOSE_SUCCESS"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
spotlightModal.toggle()
|
||||
return "SPOTLIGHT_TOGGLE_SUCCESS"
|
||||
}
|
||||
|
||||
target: "spotlight"
|
||||
}
|
||||
|
||||
spotlightContent: Component {
|
||||
SpotlightContent {
|
||||
|
||||
@@ -208,7 +208,7 @@ PanelWindow {
|
||||
"loader": controlCenterLoader,
|
||||
"prop": "shouldBeVisible"
|
||||
}, {
|
||||
"loader": clipboardHistoryModalPopup,
|
||||
"loader": clipboardHistoryModalLoader.item,
|
||||
"prop": "visible"
|
||||
}, {
|
||||
"loader": systemUpdateLoader,
|
||||
@@ -823,7 +823,9 @@ PanelWindow {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
clipboardHistoryModalPopup.toggle()
|
||||
clipboardHistoryModalLoader.active = true
|
||||
if (clipboardHistoryModalLoader.item)
|
||||
clipboardHistoryModalLoader.item.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
257
shell.qml
257
shell.qml
@@ -52,7 +52,11 @@ ShellRoot {
|
||||
delegate: TopBar {
|
||||
modelData: item
|
||||
notepadVariants: notepadSlideoutVariants
|
||||
onColorPickerRequested: colorPickerModal.show()
|
||||
onColorPickerRequested: {
|
||||
colorPickerModalLoader.active = true
|
||||
if (colorPickerModalLoader.item)
|
||||
colorPickerModalLoader.item.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,9 +248,15 @@ ShellRoot {
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: settingsModalLoader
|
||||
|
||||
active: false
|
||||
|
||||
SettingsModal {
|
||||
id: settingsModal
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: appDrawerLoader
|
||||
@@ -258,20 +268,45 @@ ShellRoot {
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: spotlightModalLoader
|
||||
|
||||
active: false
|
||||
|
||||
SpotlightModal {
|
||||
id: spotlightModal
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: clipboardHistoryModalLoader
|
||||
|
||||
active: false
|
||||
|
||||
ClipboardHistoryModal {
|
||||
id: clipboardHistoryModalPopup
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: notificationModalLoader
|
||||
|
||||
active: false
|
||||
|
||||
NotificationModal {
|
||||
id: notificationModal
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: colorPickerModalLoader
|
||||
|
||||
active: false
|
||||
|
||||
ColorPickerModal {
|
||||
id: colorPickerModal
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: processListModalLoader
|
||||
@@ -360,216 +395,18 @@ ShellRoot {
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open() {
|
||||
powerMenuModalLoader.active = true
|
||||
if (powerMenuModalLoader.item)
|
||||
powerMenuModalLoader.item.open()
|
||||
IPC {
|
||||
id: ipcHandlers
|
||||
|
||||
return "POWERMENU_OPEN_SUCCESS"
|
||||
}
|
||||
|
||||
function close() {
|
||||
if (powerMenuModalLoader.item)
|
||||
powerMenuModalLoader.item.close()
|
||||
|
||||
return "POWERMENU_CLOSE_SUCCESS"
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
powerMenuModalLoader.active = true
|
||||
if (powerMenuModalLoader.item)
|
||||
powerMenuModalLoader.item.toggle()
|
||||
|
||||
return "POWERMENU_TOGGLE_SUCCESS"
|
||||
}
|
||||
|
||||
target: "powermenu"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
processListModalLoader.active = true
|
||||
if (processListModalLoader.item)
|
||||
processListModalLoader.item.show()
|
||||
|
||||
return "PROCESSLIST_OPEN_SUCCESS"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (processListModalLoader.item)
|
||||
processListModalLoader.item.hide()
|
||||
|
||||
return "PROCESSLIST_CLOSE_SUCCESS"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
processListModalLoader.active = true
|
||||
if (processListModalLoader.item)
|
||||
processListModalLoader.item.toggle()
|
||||
|
||||
return "PROCESSLIST_TOGGLE_SUCCESS"
|
||||
}
|
||||
|
||||
target: "processlist"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
controlCenterLoader.active = true
|
||||
if (controlCenterLoader.item) {
|
||||
controlCenterLoader.item.open()
|
||||
return "CONTROL_CENTER_OPEN_SUCCESS"
|
||||
}
|
||||
return "CONTROL_CENTER_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (controlCenterLoader.item) {
|
||||
controlCenterLoader.item.close()
|
||||
return "CONTROL_CENTER_CLOSE_SUCCESS"
|
||||
}
|
||||
return "CONTROL_CENTER_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
controlCenterLoader.active = true
|
||||
if (controlCenterLoader.item) {
|
||||
controlCenterLoader.item.toggle()
|
||||
return "CONTROL_CENTER_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "CONTROL_CENTER_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "control-center"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function open(tab: string): string {
|
||||
dankDashPopoutLoader.active = true
|
||||
if (dankDashPopoutLoader.item) {
|
||||
switch (tab.toLowerCase()) {
|
||||
case "media":
|
||||
dankDashPopoutLoader.item.currentTabIndex = 1
|
||||
break
|
||||
case "weather":
|
||||
dankDashPopoutLoader.item.currentTabIndex = SettingsData.weatherEnabled ? 2 : 0
|
||||
break
|
||||
default:
|
||||
dankDashPopoutLoader.item.currentTabIndex = 0
|
||||
break
|
||||
}
|
||||
dankDashPopoutLoader.item.setTriggerPosition(Screen.width / 2, Theme.barHeight + Theme.spacingS, 100, "center", Screen)
|
||||
dankDashPopoutLoader.item.dashVisible = true
|
||||
return "DASH_OPEN_SUCCESS"
|
||||
}
|
||||
return "DASH_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (dankDashPopoutLoader.item) {
|
||||
dankDashPopoutLoader.item.dashVisible = false
|
||||
return "DASH_CLOSE_SUCCESS"
|
||||
}
|
||||
return "DASH_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(tab: string): string {
|
||||
dankDashPopoutLoader.active = true
|
||||
if (dankDashPopoutLoader.item) {
|
||||
if (dankDashPopoutLoader.item.dashVisible) {
|
||||
dankDashPopoutLoader.item.dashVisible = false
|
||||
} else {
|
||||
switch (tab.toLowerCase()) {
|
||||
case "media":
|
||||
dankDashPopoutLoader.item.currentTabIndex = 1
|
||||
break
|
||||
case "weather":
|
||||
dankDashPopoutLoader.item.currentTabIndex = SettingsData.weatherEnabled ? 2 : 0
|
||||
break
|
||||
default:
|
||||
dankDashPopoutLoader.item.currentTabIndex = 0
|
||||
break
|
||||
}
|
||||
dankDashPopoutLoader.item.setTriggerPosition(Screen.width / 2, Theme.barHeight + Theme.spacingS, 100, "center", Screen)
|
||||
dankDashPopoutLoader.item.dashVisible = true
|
||||
}
|
||||
return "DASH_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "DASH_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "dash"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function getFocusedScreenName() {
|
||||
if (CompositorService.isHyprland && Hyprland.focusedWorkspace && Hyprland.focusedWorkspace.monitor) {
|
||||
return Hyprland.focusedWorkspace.monitor.name
|
||||
}
|
||||
if (CompositorService.isNiri && NiriService.currentOutput) {
|
||||
return NiriService.currentOutput
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
function getActiveNotepadInstance() {
|
||||
if (notepadSlideoutVariants.instances.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (notepadSlideoutVariants.instances.length === 1) {
|
||||
return notepadSlideoutVariants.instances[0]
|
||||
}
|
||||
|
||||
var focusedScreen = getFocusedScreenName()
|
||||
if (focusedScreen && notepadSlideoutVariants.instances.length > 0) {
|
||||
for (var i = 0; i < notepadSlideoutVariants.instances.length; i++) {
|
||||
var slideout = notepadSlideoutVariants.instances[i]
|
||||
if (slideout.modelData && slideout.modelData.name === focusedScreen) {
|
||||
return slideout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < notepadSlideoutVariants.instances.length; i++) {
|
||||
var slideout = notepadSlideoutVariants.instances[i]
|
||||
if (slideout.isVisible) {
|
||||
return slideout
|
||||
}
|
||||
}
|
||||
|
||||
return notepadSlideoutVariants.instances[0]
|
||||
}
|
||||
|
||||
function open(): string {
|
||||
var instance = getActiveNotepadInstance()
|
||||
if (instance) {
|
||||
instance.show()
|
||||
return "NOTEPAD_OPEN_SUCCESS"
|
||||
}
|
||||
return "NOTEPAD_OPEN_FAILED"
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
var instance = getActiveNotepadInstance()
|
||||
if (instance) {
|
||||
instance.hide()
|
||||
return "NOTEPAD_CLOSE_SUCCESS"
|
||||
}
|
||||
return "NOTEPAD_CLOSE_FAILED"
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
var instance = getActiveNotepadInstance()
|
||||
if (instance) {
|
||||
instance.toggle()
|
||||
return "NOTEPAD_TOGGLE_SUCCESS"
|
||||
}
|
||||
return "NOTEPAD_TOGGLE_FAILED"
|
||||
}
|
||||
|
||||
target: "notepad"
|
||||
powermenu: powerMenuModalLoader
|
||||
processlist: processListModalLoader
|
||||
controlCenter: controlCenterLoader
|
||||
dash: dankDashPopoutLoader
|
||||
notepadVariants: notepadSlideoutVariants
|
||||
spotlight: spotlightModalLoader
|
||||
clipboard: clipboardHistoryModalLoader
|
||||
notifications: notificationModalLoader
|
||||
settings: settingsModalLoader
|
||||
}
|
||||
|
||||
Variants {
|
||||
|
||||
Reference in New Issue
Block a user