From a02ed79a923d7c180d31ef85ee65eace291afd3f Mon Sep 17 00:00:00 2001 From: Hannes Date: Thu, 12 Feb 2026 21:40:13 +0100 Subject: [PATCH] Added PowerOff button with wlogout --- modules/bar/Bar.qml | 1 + modules/bar/widgets/PowerButton.qml | 47 ++++++++++++++++++++++++++++ modules/wp/WallpaperPickerLoader.qml | 3 -- modules/wp/set-wallpaper.sh | 16 ++++++++-- 4 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 modules/bar/widgets/PowerButton.qml diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index bc857eb..423ef2c 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -70,6 +70,7 @@ PanelWindow { spacing: 8 // TODO: Add bluetooth, network, audio, power, maybe HW monitor + PowerButton {} } diff --git a/modules/bar/widgets/PowerButton.qml b/modules/bar/widgets/PowerButton.qml new file mode 100644 index 0000000..a3a0ce1 --- /dev/null +++ b/modules/bar/widgets/PowerButton.qml @@ -0,0 +1,47 @@ +import QtQuick +import Quickshell +import Quickshell.Hyprland +import Quickshell.Io + +MouseArea { + id: archButton + width: 30 + height: 28 + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + + Rectangle { + anchors.fill: parent + color: archButton.containsMouse ? "#2a2a2a" : "transparent" + radius: 6 + + Item { + anchors.fill: parent + Process { + id: powerOff + command: ["wlogout", "-b", "2"] + stdout: StdioCollector { + onStreamFinished: console.log(`line read: ${this.text}`) + } + } + + MouseArea { + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + anchors.fill: parent + onClicked: { + console.log("Running PowerOff Menu") + powerOff.startDetached() + } + } + } + + Text { + anchors.centerIn: parent + text: "" + font.pixelSize: 26 + font.family: "Nerd Font" + color: "#ffffff" + } + } +} \ No newline at end of file diff --git a/modules/wp/WallpaperPickerLoader.qml b/modules/wp/WallpaperPickerLoader.qml index c1ede6d..3b8232f 100644 --- a/modules/wp/WallpaperPickerLoader.qml +++ b/modules/wp/WallpaperPickerLoader.qml @@ -1,10 +1,7 @@ import QtQuick import Quickshell import Quickshell.Hyprland - -import QtQuick.Controls import Quickshell.Io -import Qt.labs.folderlistmodel Item { // container, invisible diff --git a/modules/wp/set-wallpaper.sh b/modules/wp/set-wallpaper.sh index 938751f..4fa0950 100755 --- a/modules/wp/set-wallpaper.sh +++ b/modules/wp/set-wallpaper.sh @@ -5,8 +5,6 @@ IMAGE="$1" image_name=$(basename "$IMAGE") image="$HOME/Pictures/Wallpapers/$image_name" -echo "$image" - echo "start" # Check if an image was provided @@ -45,4 +43,16 @@ elif [ -x "/usr/bin/hyprpaper" ]; then echo "daemon started" fi hyprctl hyprpaper wallpaper ", $image" -fi \ No newline at end of file +fi + +### Blured Wallpaper for wlogout +blur="50x30" +static_wallpaper_dir="/home/honney/Pictures/Wallpapers/Static" + +if [ ! -d $static_wallpaper_dir ]; then + mkdir -p $static_wallpaper_dir; +fi + +blurred_wp="$static_wallpaper_dir/blurred.jpg" + +magick $image -blur $blur $blurred_wp