aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/user/UserRow.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/user/UserRow.qml')
-rw-r--r--desktop/modules/user/UserRow.qml14
1 files changed, 12 insertions, 2 deletions
diff --git a/desktop/modules/user/UserRow.qml b/desktop/modules/user/UserRow.qml
index b67d591..311c6df 100644
--- a/desktop/modules/user/UserRow.qml
+++ b/desktop/modules/user/UserRow.qml
@@ -16,7 +16,7 @@ import QtQuick
import "../.."
import "User.js" as U
-// The drawer's greeting: avatar, login name, real name. It re-reads each time
+// The drawer's greeting: avatar, a random greeting, real name. It re-reads each time
// it becomes visible, which is every drawer open and every return from a
// page, so a save on the user page shows here on the way back.
Rectangle {
@@ -38,6 +38,16 @@ Rectangle {
onVisibleChanged: if (visible) read()
Component.onCompleted: read()
+ // Read on creation, which is every drawer open, so an edit to the file
+ // shows on the next one with no watch.
+ property string greeting: "Hello " + Quickshell.env("USER")
+ FileView {
+ path: (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/quickshell/greetings"
+ printErrors: false
+ onLoaded: row.greeting = U.greeting(text(), Quickshell.env("USER"))
+ onLoadFailed: row.greeting = U.greeting("", Quickshell.env("USER"))
+ }
+
Process {
id: reader
command: [Qt.resolvedUrl("userctl").toString().replace(/^file:\/\//, ""), "get"]
@@ -78,7 +88,7 @@ Rectangle {
verticalCenter: parent.verticalCenter }
spacing: 2
Text {
- text: "Hello " + Quickshell.env("USER")
+ text: row.greeting
font { family: Theme.fontFamily; pixelSize: Theme.fontSize + 2; bold: true }
color: Theme.text
}