forked from Shinonome/dots-hyprland
left sidebar: slightly simplify opening/closing
This commit is contained in:
@@ -20,14 +20,11 @@ Scope { // Scope
|
|||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: sidebarLoader
|
id: sidebarLoader
|
||||||
active: false
|
active: GlobalStates.sidebarLeftOpen
|
||||||
onActiveChanged: {
|
|
||||||
GlobalStates.sidebarLeftOpen = sidebarLoader.active
|
|
||||||
}
|
|
||||||
|
|
||||||
PanelWindow { // Window
|
PanelWindow { // Window
|
||||||
id: sidebarRoot
|
id: sidebarRoot
|
||||||
visible: sidebarLoader.active
|
visible: GlobalStates.sidebarLeftOpen
|
||||||
|
|
||||||
property int selectedTab: 0
|
property int selectedTab: 0
|
||||||
property bool extend: false
|
property bool extend: false
|
||||||
@@ -35,7 +32,7 @@ Scope { // Scope
|
|||||||
property real sidebarWidth: sidebarRoot.extend ? Appearance.sizes.sidebarWidthExtended : Appearance.sizes.sidebarWidth
|
property real sidebarWidth: sidebarRoot.extend ? Appearance.sizes.sidebarWidthExtended : Appearance.sizes.sidebarWidth
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
sidebarLoader.active = false
|
GlobalStates.sidebarLeftOpen = false
|
||||||
}
|
}
|
||||||
|
|
||||||
exclusiveZone: sidebarRoot.pin ? sidebarWidth : 0
|
exclusiveZone: sidebarRoot.pin ? sidebarWidth : 0
|
||||||
@@ -179,15 +176,15 @@ Scope { // Scope
|
|||||||
target: "sidebarLeft"
|
target: "sidebarLeft"
|
||||||
|
|
||||||
function toggle(): void {
|
function toggle(): void {
|
||||||
sidebarLoader.active = !sidebarLoader.active
|
GlobalStates.sidebarLeftOpen = !GlobalStates.sidebarLeftOpen
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(): void {
|
function close(): void {
|
||||||
sidebarLoader.active = false
|
GlobalStates.sidebarLeftOpen = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function open(): void {
|
function open(): void {
|
||||||
sidebarLoader.active = true
|
GlobalStates.sidebarLeftOpen = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +193,7 @@ Scope { // Scope
|
|||||||
description: qsTr("Toggles left sidebar on press")
|
description: qsTr("Toggles left sidebar on press")
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
sidebarLoader.active = !sidebarLoader.active;
|
GlobalStates.sidebarLeftOpen = !GlobalStates.sidebarLeftOpen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +202,7 @@ Scope { // Scope
|
|||||||
description: qsTr("Opens left sidebar on press")
|
description: qsTr("Opens left sidebar on press")
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
sidebarLoader.active = true;
|
GlobalStates.sidebarLeftOpen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +211,7 @@ Scope { // Scope
|
|||||||
description: qsTr("Closes left sidebar on press")
|
description: qsTr("Closes left sidebar on press")
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
sidebarLoader.active = false;
|
GlobalStates.sidebarLeftOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user