Something went wrong. Try again.
My NixOS configuration and dotfiles
Something went wrong. Try again.
7.5 kB 270 lines
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271import Quickshellimport Quickshell.Ioimport QtQuick
// Wallpaper overlay, Google TV "spotlight" style: soft black gradient scrim// at the bottom with the clock and photo caption in the bottom-right corner;// systemd timers as a small dim readout top-right. Sits on the layer-shell// bottom layer, so it renders above the awww wallpaper (background layer)// but below windows, only visible on an empty workspace.//// The same instance hosts VocabPanel, the dictation vocabulary editor that// Mod+Shift+Space toggles over IPC. Keeping it here means the editor is up// the moment the keybind fires, with no process start.//// The window color MUST be transparent or the default opaque white surface// covers the wallpaper.
Scope { id: root
property string captionText: "" property string timersUserText: "" property string timersAllText: "" property string captionLoc: "" property string captionDesc: "" property bool timersHover: false
// caption.txt is "LOCATION: description" or bare "description". Split the // location off so it can be styled as an accent. function splitCaption() { var i = root.captionText.indexOf(": ") if (i > 0) { root.captionLoc = root.captionText.slice(0, i) root.captionDesc = root.captionText.slice(i + 2) } else { root.captionLoc = "" root.captionDesc = root.captionText } } function esc(s) { return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">") }
PanelWindow { id: win anchors { top: true left: true right: true bottom: true } color: "transparent" surfaceFormat.opaque: false aboveWindows: false focusable: false exclusionMode: ExclusionMode.Ignore
// Google TV spotlight scrim: dark fading up from the bottom so the text // stays readable over any photo. Rectangle { anchors { left: parent.left right: parent.right bottom: parent.bottom } height: parent.height * 0.5 gradient: Gradient { GradientStop { position: 0.0; color: "#00000000" } GradientStop { position: 0.7; color: "#50000000" } GradientStop { position: 1.0; color: "#d4000000" } } }
// Right-to-left blackish gradient down the whole right edge, so text on // both corners reads against a darker backdrop. Rectangle { anchors { top: parent.top bottom: parent.bottom right: parent.right } width: parent.width * 0.7 gradient: Gradient { orientation: Qt.Horizontal GradientStop { position: 0.0; color: "#00000000" } GradientStop { position: 0.5; color: "#40000000" } GradientStop { position: 1.0; color: "#cc000000" } } }
// Bottom-right: hero clock over the caption. Column { anchors { right: parent.right bottom: parent.bottom rightMargin: 36 bottomMargin: 32 } spacing: 12
Text { anchors.right: parent.right text: Qt.formatDateTime(clock.date, "HH:mm") font.family: "JetBrainsMono Nerd Font" font.pixelSize: 56 font.weight: Font.Bold color: "#ebdbb2" }
// Location above the description, styled as an orange accent. Text { id: captionLoc visible: root.captionLoc !== "" anchors.right: parent.right text: root.esc(root.captionLoc) textFormat: Text.RichText font.family: "JetBrainsMono Nerd Font" font.pixelSize: 17 font.weight: Font.Bold color: "#e78a4e" horizontalAlignment: Text.AlignRight lineHeight: 1.25 }
Text { id: caption anchors.right: parent.right width: Math.min(1100, win.width * 0.95) text: root.esc(root.captionDesc) textFormat: Text.RichText font.family: "JetBrainsMono Nerd Font" font.pixelSize: 17 color: "#d4be98" wrapMode: Text.Wrap maximumLineCount: 3 elide: Text.ElideRight horizontalAlignment: Text.AlignRight lineHeight: 1.25 } }
// Top-right: faint scrim + small timers readout. Rectangle { anchors { top: parent.top left: parent.left right: parent.right } height: parent.height * 0.24 gradient: Gradient { GradientStop { position: 0.0; color: "#6b000000" } GradientStop { position: 1.0; color: "#00000000" } } } // Fixed-size hover box (decoupled from the text size) so the trigger // region never moves under the cursor; otherwise the expand/collapse // resize feeds back into enter/exit and flickers. Item { id: timersBox anchors { top: parent.top right: parent.right margins: 32 } width: 460 height: 340 // Both states cached by their own 60s poll; hover just toggles which // one is visible, so there is no process-restart race to flicker. Text { id: timersText visible: !root.timersHover anchors { top: parent.top right: parent.right } text: root.timersUserText textFormat: Text.RichText font.family: "JetBrainsMono Nerd Font" font.pixelSize: 16 color: "#d4be98" horizontalAlignment: Text.AlignRight lineHeight: 1.5 } Text { visible: root.timersHover anchors { top: parent.top right: parent.right } text: root.timersAllText textFormat: Text.RichText font.family: "JetBrainsMono Nerd Font" font.pixelSize: 16 color: "#d4be98" horizontalAlignment: Text.AlignRight lineHeight: 1.5 } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: root.timersHover = true onExited: root.timersHover = false } }
SystemClock { id: clock precision: SystemClock.Minutes } }
onCaptionTextChanged: root.splitCaption()
// Caption: wallpaper-guardian writes this file on every wallpaper change. Process { id: captionProc command: [ "sh", "-c", "cat ~/.cache/wallpaper-guardian/caption.txt" ] running: true stdout: StdioCollector { onStreamFinished: root.captionText = text.trim() } } Timer { interval: 5000 running: true repeat: true onTriggered: captionProc.running = true }
// Timers: USER always cached, USER+SYSTEM cached on the same 60s tick. // Hover only flips visibility, so it is deterministic (no command swap). Process { id: userProc command: [ "sh", "-c", "~/.config/quickshell/timers.mjs" ] running: true stdout: StdioCollector { onStreamFinished: root.timersUserText = text } } Process { id: allProc command: [ "sh", "-c", "~/.config/quickshell/timers.mjs all" ] running: true stdout: StdioCollector { onStreamFinished: root.timersAllText = text } } Timer { interval: 60000 running: true repeat: true onTriggered: { userProc.running = true allProc.running = true } }
// The dictation vocabulary editor, opened by Mod+Shift+Space. Hidden until // the bind calls `quickshell ipc call vocab toggle`. VocabPanel { id: vocab }
IpcHandler { target: "vocab" function toggle(): string { return vocab.toggle() } }}