From 8a8c38be6720b375296170d0693c4235d67aa86d Mon Sep 17 00:00:00 2001 From: Hannes Date: Sun, 22 Mar 2026 20:53:49 +0100 Subject: [PATCH] Update to Apps and Networking and added Idle Button --- modules/bar/Bar.qml | 1 + modules/bar/scripts/Apps.sh | 11 +++--- modules/bar/scripts/Idle.sh | 5 +++ modules/bar/widgets/IdleButton.qml | 55 ++++++++++++++++++++++++++++++ modules/bar/widgets/Network.qml | 11 +++--- 5 files changed, 74 insertions(+), 9 deletions(-) create mode 100755 modules/bar/scripts/Idle.sh create mode 100644 modules/bar/widgets/IdleButton.qml diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 901b4ee..549ba40 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -74,6 +74,7 @@ PanelWindow { // TODO: Add bluetooth, network, audio, power, maybe HW monitor Tray{} Network {} + IdleButton {} PowerButton {} } diff --git a/modules/bar/scripts/Apps.sh b/modules/bar/scripts/Apps.sh index 7ccb403..69eae56 100755 --- a/modules/bar/scripts/Apps.sh +++ b/modules/bar/scripts/Apps.sh @@ -26,6 +26,8 @@ declare -A MAP=( ["VLC media player"]="󰕼" ["mpv"]="" ["ffplay"]="" + # Video editing + ["org.kde.kdenlive"]="" # Chats ["discord"]="" ["vesktop"]="" @@ -37,7 +39,7 @@ declare -A MAP=( ["jetbrains-idea"]="" ["jetbrains-studio"]="" # Text Editor - ["mousepad"]="󱩼" + ["org.xfce.mousepad"]="󱩼" # Password ["org.keepassxc.KeePassXC"]="" ["Yubico Authenticator"]="" @@ -66,12 +68,13 @@ declare -A MAP=( # Document Editor/Viewer ["libreoffice-startcenter"]="" ["libreoffice-base"]="" - ["libreoffice-calc"]="" - ["libreoffice-draw"]="" + ["libreoffice-calc"]="󱎏" + ["libreoffice-draw"]="󱎐" ["libreoffice-impress"]="" ["libreoffice-math"]="" - ["libreoffice-writer"]="" + ["libreoffice-writer"]="󱎒" ["com.github.flxzt.rnote"]="󱩼" + ["Xreader"]="󱩼" ["com.github.xournalpp.xournalpp"]="󱩼" ["qpdfview.local.qpdfview"]="󱩼" # Hardware diff --git a/modules/bar/scripts/Idle.sh b/modules/bar/scripts/Idle.sh new file mode 100755 index 0000000..f62f726 --- /dev/null +++ b/modules/bar/scripts/Idle.sh @@ -0,0 +1,5 @@ +if pgrep -x "hypridle" >/dev/null ;then + killall hypridle +else + hypridle & +fi \ No newline at end of file diff --git a/modules/bar/widgets/IdleButton.qml b/modules/bar/widgets/IdleButton.qml new file mode 100644 index 0000000..f08554e --- /dev/null +++ b/modules/bar/widgets/IdleButton.qml @@ -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 + } + } +} \ No newline at end of file diff --git a/modules/bar/widgets/Network.qml b/modules/bar/widgets/Network.qml index e8d45fe..61547df 100644 --- a/modules/bar/widgets/Network.qml +++ b/modules/bar/widgets/Network.qml @@ -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()) } } }