forked from Shinonome/dots-hyprland
put right sidebar in loader
This commit is contained in:
@@ -21,16 +21,26 @@ Scope {
|
||||
id: sidebarVariants
|
||||
model: Quickshell.screens
|
||||
|
||||
Loader {
|
||||
id: sidebarLoader
|
||||
active: false
|
||||
property var modelData
|
||||
onActiveChanged: {
|
||||
GlobalStates.sidebarRightOpenCount += active ? 1 : -1
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
id: sidebarRoot
|
||||
visible: false
|
||||
visible: sidebarLoader.active
|
||||
focusable: true
|
||||
|
||||
onVisibleChanged: {
|
||||
GlobalStates.sidebarRightOpenCount += visible ? 1 : -1
|
||||
if (!visible) sidebarLoader.active = false
|
||||
}
|
||||
|
||||
property var modelData
|
||||
function hide() {
|
||||
sidebarLoader.active = false
|
||||
}
|
||||
|
||||
screen: modelData
|
||||
exclusiveZone: 0
|
||||
@@ -51,7 +61,7 @@ Scope {
|
||||
windows: [ sidebarRoot ]
|
||||
active: false
|
||||
onCleared: () => {
|
||||
if (!active) sidebarRoot.visible = false
|
||||
if (!active) sidebarRoot.hide()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +93,7 @@ Scope {
|
||||
|
||||
Keys.onPressed: (event) => {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
sidebarRoot.visible = false;
|
||||
sidebarRoot.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +202,7 @@ Scope {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -200,30 +211,22 @@ Scope {
|
||||
|
||||
function toggle(): void {
|
||||
for (let i = 0; i < sidebarVariants.instances.length; i++) {
|
||||
let panelWindow = sidebarVariants.instances[i];
|
||||
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
|
||||
panelWindow.visible = !panelWindow.visible;
|
||||
if(panelWindow.visible) Notifications.timeoutAll();
|
||||
}
|
||||
let loader = sidebarVariants.instances[i];
|
||||
loader.active = !loader.active;
|
||||
}
|
||||
}
|
||||
|
||||
function close(): void {
|
||||
for (let i = 0; i < sidebarVariants.instances.length; i++) {
|
||||
let panelWindow = sidebarVariants.instances[i];
|
||||
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
|
||||
panelWindow.visible = false;
|
||||
}
|
||||
let loader = sidebarVariants.instances[i];
|
||||
loader.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
function open(): void {
|
||||
for (let i = 0; i < sidebarVariants.instances.length; i++) {
|
||||
let panelWindow = sidebarVariants.instances[i];
|
||||
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
|
||||
panelWindow.visible = true;
|
||||
if(panelWindow.visible) Notifications.timeoutAll();
|
||||
}
|
||||
let loader = sidebarVariants.instances[i];
|
||||
loader.active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,11 +237,8 @@ Scope {
|
||||
|
||||
onPressed: {
|
||||
for (let i = 0; i < sidebarVariants.instances.length; i++) {
|
||||
let panelWindow = sidebarVariants.instances[i];
|
||||
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
|
||||
panelWindow.visible = !panelWindow.visible;
|
||||
if(panelWindow.visible) Notifications.timeoutAll();
|
||||
}
|
||||
let loader = sidebarVariants.instances[i];
|
||||
loader.active = !loader.active;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,11 +248,8 @@ Scope {
|
||||
|
||||
onPressed: {
|
||||
for (let i = 0; i < sidebarVariants.instances.length; i++) {
|
||||
let panelWindow = sidebarVariants.instances[i];
|
||||
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
|
||||
panelWindow.visible = true;
|
||||
if(panelWindow.visible) Notifications.timeoutAll();
|
||||
}
|
||||
let loader = sidebarVariants.instances[i];
|
||||
loader.active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,11 +259,8 @@ Scope {
|
||||
|
||||
onPressed: {
|
||||
for (let i = 0; i < sidebarVariants.instances.length; i++) {
|
||||
let panelWindow = sidebarVariants.instances[i];
|
||||
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
|
||||
panelWindow.visible = false;
|
||||
if(panelWindow.visible) Notifications.timeoutAll();
|
||||
}
|
||||
let loader = sidebarVariants.instances[i];
|
||||
loader.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user