From fcbcffc7823ea719a14162fe73c60bc14036c255 Mon Sep 17 00:00:00 2001 From: Amstel Date: Wed, 11 Jun 2025 14:18:15 +0800 Subject: Fixed Logout Function When Running "uwsm stop" it replies: > Stopping compositor... > Compositor is not running. so the "or" operator would not work since the "uwsm stop" command didn't return as "FALSE". --- modules/session/Content.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/session/Content.qml b/modules/session/Content.qml index d6cacd6..7c69bbd 100644 --- a/modules/session/Content.qml +++ b/modules/session/Content.qml @@ -23,7 +23,7 @@ Column { id: logout icon: "logout" - command: ["sh", "-c", "uwsm stop || loginctl terminate-session $XDG_SESSION_ID"] + command: ["sh", "-c", "(uwsm stop | grep -q 'Compositor is not running' && loginctl terminate-user $USER) || uwsm stop"] KeyNavigation.down: shutdown -- cgit v1.2.3-freya From 9308c9b67f491ff32c57d037f16ac6e9148f9dae Mon Sep 17 00:00:00 2001 From: Amstel Date: Wed, 11 Jun 2025 14:50:31 +0800 Subject: Dashboard Avatar Picker 1.0a This will allows users to update/change their profile icon from the dashboard by clicking the profile icon. ### How it works? > Once the profile icon is clicked it will launch zenity file picker. Once selected the target new profile Icon this script will do the following: - Deletes the current ~/.face - Deletes all .face cached files in ~/.cache/caelestia/thumbnails/ - Copies the new selected profile-icon to ~/.face ### Issues - Once the profile is update, the user must manually reload the shell by restarting the shell session. **NOTE:** Make sure to chmod +x the picker.sh before using. Dependencies: - zenity --- modules/dashboard/dash/User.qml | 64 +++++++++++++++++++++++++++++++++----- scripts/caelestia-avatar-picker.sh | 21 +++++++++++++ 2 files changed, 78 insertions(+), 7 deletions(-) create mode 100755 scripts/caelestia-avatar-picker.sh (limited to 'modules') diff --git a/modules/dashboard/dash/User.qml b/modules/dashboard/dash/User.qml index c7d2bfd..4aefb31 100644 --- a/modules/dashboard/dash/User.qml +++ b/modules/dashboard/dash/User.qml @@ -19,17 +19,67 @@ Row { radius: Appearance.rounding.full color: Colours.palette.m3surfaceContainerHigh - MaterialIcon { - anchors.centerIn: parent + CachingImage { + anchors.fill: parent + path: `${Paths.home}/.face` + fillMode: Image.PreserveAspectCrop + smooth: true + } - text: "person" - fill: 1 - font.pointSize: (info.implicitHeight / 2) || 1 + Rectangle { + id: overlay + anchors.fill: parent + radius: avatarRect.radius + color: Qt.rgba(0, 0, 0, 0.4) + opacity: mouseArea.containsMouse ? 1.0 : 0.0 + visible: opacity > 0 + Behavior on opacity { + NumberAnimation { + duration: 300 + easing.type: Easing.InOutQuad + } + } + + MaterialIcon { + anchors.centerIn: parent + text: "photo_camera" + color: "white" + font.pointSize: info.implicitHeight / 4 + } } - CachingImage { + MouseArea { + id: mouseArea anchors.fill: parent - path: `${Paths.home}/.face` + hoverEnabled: true + onClicked: avatarUpdateProc.running = true + cursorShape: Qt.PointingHandCursor + } + + Process { + id: avatarUpdateProc + running: false + command: [`${Paths.home}/.local/share/caelestia/shell/scripts/caelestia-avatar-picker.sh`] + + stdout: SplitParser { + onRead: { + notifyProc.running = true + } + } + } + + Process { + id: notifyProc + running: false + command: [ + "notify-send", + "-u", "low", + "-i", "dialog-information-symbolic", + "Profile Updated", + "Your avatar has been successfully changed.", + "-a", "Shell", + "-A", "OK=Got it!" + ] } } diff --git a/scripts/caelestia-avatar-picker.sh b/scripts/caelestia-avatar-picker.sh new file mode 100755 index 0000000..4ca5cfb --- /dev/null +++ b/scripts/caelestia-avatar-picker.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +export DISPLAY=${DISPLAY:-:0} +export DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS:-"unix:path=/run/user/$UID/bus"} + +# Pick an image file with zenity +FILE=$(zenity --file-selection --file-filter="Images | *.png *.jpg *.jpeg *.webp") + +# Exit if cancelled +[ -z "$FILE" ] && exit 1 + +# Deletes existing ~/.face & caches +rm -f "$HOME/.face" +rm -f "$HOME/.cache/caelestia/thumbnails/@0x0-exact.png" +rm -f "$HOME/.cache/caelestia/thumbnails/@93x93-exact.png" +rm -f "$HOME/.cache/caelestia/thumbnails/@93x94-exact.png" +rm -f "$HOME/.cache/caelestia/thumbnails/@94x94-exact.png" + +cp "$FILE" "$HOME/.face" + +echo "$HOME/.face" -- cgit v1.2.3-freya From 92f05c00281d63f9aa21f1575547a36da4e2fc42 Mon Sep 17 00:00:00 2001 From: Amstel Date: Wed, 11 Jun 2025 15:44:46 +0800 Subject: Revert "Dashboard Avatar Picker 1.0a" This reverts commit 9308c9b67f491ff32c57d037f16ac6e9148f9dae. --- modules/dashboard/dash/User.qml | 64 +++++--------------------------------- scripts/caelestia-avatar-picker.sh | 21 ------------- 2 files changed, 7 insertions(+), 78 deletions(-) delete mode 100755 scripts/caelestia-avatar-picker.sh (limited to 'modules') diff --git a/modules/dashboard/dash/User.qml b/modules/dashboard/dash/User.qml index 4aefb31..c7d2bfd 100644 --- a/modules/dashboard/dash/User.qml +++ b/modules/dashboard/dash/User.qml @@ -19,67 +19,17 @@ Row { radius: Appearance.rounding.full color: Colours.palette.m3surfaceContainerHigh - CachingImage { - anchors.fill: parent - path: `${Paths.home}/.face` - fillMode: Image.PreserveAspectCrop - smooth: true - } - - Rectangle { - id: overlay - anchors.fill: parent - radius: avatarRect.radius - color: Qt.rgba(0, 0, 0, 0.4) - opacity: mouseArea.containsMouse ? 1.0 : 0.0 - visible: opacity > 0 - Behavior on opacity { - NumberAnimation { - duration: 300 - easing.type: Easing.InOutQuad - } - } + MaterialIcon { + anchors.centerIn: parent - MaterialIcon { - anchors.centerIn: parent - text: "photo_camera" - color: "white" - font.pointSize: info.implicitHeight / 4 - } + text: "person" + fill: 1 + font.pointSize: (info.implicitHeight / 2) || 1 } - MouseArea { - id: mouseArea + CachingImage { anchors.fill: parent - hoverEnabled: true - onClicked: avatarUpdateProc.running = true - cursorShape: Qt.PointingHandCursor - } - - Process { - id: avatarUpdateProc - running: false - command: [`${Paths.home}/.local/share/caelestia/shell/scripts/caelestia-avatar-picker.sh`] - - stdout: SplitParser { - onRead: { - notifyProc.running = true - } - } - } - - Process { - id: notifyProc - running: false - command: [ - "notify-send", - "-u", "low", - "-i", "dialog-information-symbolic", - "Profile Updated", - "Your avatar has been successfully changed.", - "-a", "Shell", - "-A", "OK=Got it!" - ] + path: `${Paths.home}/.face` } } diff --git a/scripts/caelestia-avatar-picker.sh b/scripts/caelestia-avatar-picker.sh deleted file mode 100755 index 4ca5cfb..0000000 --- a/scripts/caelestia-avatar-picker.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -export DISPLAY=${DISPLAY:-:0} -export DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS:-"unix:path=/run/user/$UID/bus"} - -# Pick an image file with zenity -FILE=$(zenity --file-selection --file-filter="Images | *.png *.jpg *.jpeg *.webp") - -# Exit if cancelled -[ -z "$FILE" ] && exit 1 - -# Deletes existing ~/.face & caches -rm -f "$HOME/.face" -rm -f "$HOME/.cache/caelestia/thumbnails/@0x0-exact.png" -rm -f "$HOME/.cache/caelestia/thumbnails/@93x93-exact.png" -rm -f "$HOME/.cache/caelestia/thumbnails/@93x94-exact.png" -rm -f "$HOME/.cache/caelestia/thumbnails/@94x94-exact.png" - -cp "$FILE" "$HOME/.face" - -echo "$HOME/.face" -- cgit v1.2.3-freya