feat: move dash open state to singleton
This commit is contained in:
parent
c4b71fc0d4
commit
770b5aa968
5 changed files with 27 additions and 20 deletions
|
@ -1,5 +1,4 @@
|
|||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQml
|
||||
|
@ -11,11 +10,11 @@ import "provider"
|
|||
PanelWindow {
|
||||
id: homeWindow
|
||||
|
||||
required property var root
|
||||
property bool animRunning: false
|
||||
|
||||
color: "transparent"
|
||||
visible: animRunning || homeWindow.root.enabled
|
||||
visible: animRunning || NyshState.dashOpen
|
||||
|
||||
focusable: true
|
||||
|
||||
anchors {
|
||||
|
@ -30,7 +29,7 @@ PanelWindow {
|
|||
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: homeWindow.root.enabled = false
|
||||
onClicked: NyshState.dashOpen = false
|
||||
|
||||
BRectangle {
|
||||
id: home
|
||||
|
@ -41,7 +40,7 @@ PanelWindow {
|
|||
topRightRadius: 10
|
||||
border.color: "transparent"
|
||||
height: parent.height
|
||||
width: homeWindow.root.enabled ? maxSize : 0
|
||||
width: NyshState.dashOpen ? maxSize : 0
|
||||
clip: true
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -15,8 +15,6 @@ import QtQuick.Layouts
|
|||
PanelWindow {
|
||||
id: lbar
|
||||
|
||||
required property var root
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
left: Config.alignment === Config.BarAlignment.Left
|
||||
|
@ -74,7 +72,7 @@ PanelWindow {
|
|||
|
||||
MouseArea {
|
||||
id: mouse
|
||||
onClicked: lbar.root.enabled = !lbar.root.enabled
|
||||
onClicked: NyshState.toggleDash()
|
||||
height: width
|
||||
width: 30
|
||||
anchors.bottom: parent.bottom
|
||||
|
|
12
src/Nysh.qml
12
src/Nysh.qml
|
@ -1,4 +1,3 @@
|
|||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
|
||||
|
@ -6,23 +5,12 @@ Item {
|
|||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
property bool enabled: false
|
||||
|
||||
property IpcHandler ipc: IpcHandler {
|
||||
target: "dash"
|
||||
|
||||
function toggle() {
|
||||
root.enabled = !root.enabled;
|
||||
}
|
||||
}
|
||||
|
||||
property MainBar mainBar: MainBar {
|
||||
screen: root.screen
|
||||
root: root
|
||||
}
|
||||
|
||||
property Dashboard dash: Dashboard {
|
||||
screen: root.screen
|
||||
root: root
|
||||
}
|
||||
}
|
||||
|
|
21
src/provider/NyshState.qml
Normal file
21
src/provider/NyshState.qml
Normal file
|
@ -0,0 +1,21 @@
|
|||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
Singleton {
|
||||
id: state
|
||||
property bool dashOpen: false
|
||||
|
||||
property IpcHandler ipc: IpcHandler {
|
||||
target: "dash"
|
||||
|
||||
function toggle() {
|
||||
state.toggleDash;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleDash() {
|
||||
state.dashOpen = !state.dashOpen;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
module Provider
|
||||
singleton Config 0.1 Config.qml
|
||||
singleton NyshState 0.1 NyshState.qml
|
||||
singleton Player 0.1 Player.qml
|
||||
singleton Inhibitor 0.1 Inhibitor.qml
|
||||
singleton Notifications 0.1 Notifications.qml
|
||||
|
|
Loading…
Add table
Reference in a new issue