mirror of
https://git.pumpin.online/funkpower/menologion.git
synced 2026-10-22 18:57:14 +00:00
A Quickshell widget for Hyprland, a waybar module and an eww panel, all reading the same JSON from the typikon CLI so none of them touches the network and all three agree. The Quickshell piece is three separable parts: a Typikon singleton that wraps the CLI and re-reads only when the date rolls over, a Theme singleton that takes colours from JSON with a default for every key, and the widget itself. The legend is built from the week in view rather than hardcoded, because the levels a tradition uses are its own -- six under the Typikon, three under Ruthenian particular law -- and the words for them differ too. The church date shows beside the civil one whenever they differ, which on the old calendar is always. Forefeasts and afterfeasts get their own line instead of crowding out the commemoration that makes the day.
53 lines
1.5 KiB
QML
53 lines
1.5 KiB
QML
pragma Singleton
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
// Colours, read from a JSON file so the widget follows whatever themes the
|
|
// rest of your desktop.
|
|
//
|
|
// Every key has a default, so the widget is legible with no file at all. Point
|
|
// HOROLOGION_COLORS at your own, or drop one at the path below. The shape is
|
|
// the flat sixteen-colour kind most theme generators already emit.
|
|
Singleton {
|
|
id: root
|
|
|
|
readonly property string path: {
|
|
const env = Quickshell.env("HOROLOGION_COLORS");
|
|
return env && env !== ""
|
|
? env
|
|
: Quickshell.env("HOME") + "/.config/horologion/colors.json";
|
|
}
|
|
|
|
property var c: ({})
|
|
|
|
readonly property color bg: c.bg ?? "#1d2021"
|
|
readonly property color surface: c.surface ?? "#282828"
|
|
readonly property color overlay: c.overlay ?? "#504945"
|
|
readonly property color fg: c.fg ?? "#ebdbb2"
|
|
readonly property color fgDim: c.fgDim ?? "#a89984"
|
|
readonly property color accent: c.accent ?? "#d3869b"
|
|
readonly property color red: c.red ?? "#fb4934"
|
|
readonly property color yellow: c.yellow ?? "#fabd2f"
|
|
readonly property color green: c.green ?? "#b8bb26"
|
|
|
|
function reload() { file.reload(); load(); }
|
|
|
|
function load() {
|
|
try {
|
|
root.c = JSON.parse(file.text());
|
|
} catch (e) {
|
|
root.c = ({});
|
|
}
|
|
}
|
|
|
|
FileView {
|
|
id: file
|
|
path: root.path
|
|
watchChanges: true
|
|
onFileChanged: root.reload()
|
|
onLoaded: root.load()
|
|
}
|
|
}
|