Update to Apps and Networking and added Idle Button
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import "../../../colors"
|
||||
|
||||
MouseArea {
|
||||
id: idleButton
|
||||
width: Math.max(idleText.width + parent.spacing*2, bar.height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
property int idle: 0
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: idleButton.containsMouse ? Colors.tertiary : Qt.alpha(Colors.tertiaryContainer, 0.25)
|
||||
radius: 6
|
||||
border.width: 2
|
||||
border.color: idleButton.containsMouse ? Colors.tertiaryContainer_fg
|
||||
: Colors.secondaryContainer_fg
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Process {
|
||||
id: idleScript
|
||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/bar/scripts/Idle.sh"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: idleButton.idle ? console.log(`Disabling Idle`) : console.log(`Enabling Idle`)
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
console.log("Running Idle Script")
|
||||
idleScript.startDetached()
|
||||
idleButton.idle = !idleButton.idle
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: idleText
|
||||
anchors.centerIn: parent
|
||||
text: idleButton.idle ? "" : ""
|
||||
font.pixelSize: 26
|
||||
font.family: "Nerd Font"
|
||||
color: idleButton.containsMouse ? Colors.tertiary_fg : Colors.primary
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,8 @@ import "../../../colors"
|
||||
|
||||
MouseArea {
|
||||
id: networkButton
|
||||
width: bar.height
|
||||
width: Math.max(networkText.width + parent.spacing*2, bar.height)
|
||||
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -24,11 +25,11 @@ MouseArea {
|
||||
: Colors.secondaryContainer_fg
|
||||
|
||||
Text {
|
||||
id: output
|
||||
id: networkText
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 26
|
||||
font.family: "Nerd Font"
|
||||
color: networkButton.containsMouse ? Colors.tertiary_fg : output.text === " /" ? Colors.error : Colors.primary
|
||||
color: networkButton.containsMouse ? Colors.tertiary_fg : networkText.text === " /" ? Colors.error : Colors.primary
|
||||
}
|
||||
|
||||
Process {
|
||||
@@ -38,8 +39,8 @@ MouseArea {
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
output.text = this.text.trim()
|
||||
// console.log("networkScript output:", this.text.trim())
|
||||
networkText.text = this.text.trim()
|
||||
// console.log("networkScript networkText:", this.text.trim())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user