mirror of
https://git.pumpin.online/funkpower/menologion.git
synced 2026-10-22 18:57:14 +00:00
desktop front ends for typikon
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.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
*.qmlc
|
||||
*.jsc
|
||||
@@ -0,0 +1,338 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
<https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Moe Ghoul>, 1 April 1989
|
||||
Moe Ghoul, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,124 @@
|
||||
# horologion
|
||||
|
||||
Desktop front ends for [`typikon`](https://git.pumpin.online/funkpower/typikon)
|
||||
— the Orthodox liturgical day on your desktop, in Hyprland (Quickshell),
|
||||
waybar or eww.
|
||||
|
||||
Everything is computed locally by `typikon`, so none of this touches the
|
||||
network, and the widget re-reads only when the date rolls over — the answer
|
||||
changes at midnight and at no other moment.
|
||||
|
||||
## Install
|
||||
|
||||
`typikon` first, since all three front ends shell out to it:
|
||||
|
||||
```console
|
||||
$ pip install typikon
|
||||
$ typikon --set-default rocor # or antiochian, oca, greece, ...
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```console
|
||||
$ git clone https://git.pumpin.online/funkpower/horologion
|
||||
$ cd horologion && ./bin/horologion-install
|
||||
```
|
||||
|
||||
That links rather than copies, so `git pull` updates what you are running. Pass
|
||||
`quickshell`, `waybar`, `eww` or `bin` to do just one.
|
||||
|
||||
## Quickshell
|
||||
|
||||
A desktop widget for Hyprland and anything else Quickshell runs on.
|
||||
|
||||
```console
|
||||
$ quickshell -p ~/.config/quickshell/horologion/shell.qml
|
||||
```
|
||||
|
||||
It sits on the background layer, so it behaves like part of the wallpaper —
|
||||
always under your windows, never stealing a click.
|
||||
|
||||
To drop it into a shell you already have:
|
||||
|
||||
```qml
|
||||
import qs.horologion.modules
|
||||
|
||||
Horologion {}
|
||||
```
|
||||
|
||||
Three pieces, each usable on its own:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| `services/Typikon.qml` | a singleton wrapping the CLI — bind to it from anything |
|
||||
| `services/Theme.qml` | colours, from JSON, with defaults for every key |
|
||||
| `modules/Horologion.qml` | the widget |
|
||||
|
||||
Set a jurisdiction per-widget if you want one different from your default:
|
||||
|
||||
```qml
|
||||
Horologion {
|
||||
Component.onCompleted: Typikon.jurisdiction = "moscow"
|
||||
}
|
||||
```
|
||||
|
||||
### Colours
|
||||
|
||||
`Theme.qml` reads `~/.config/horologion/colors.json`, or whatever
|
||||
`HOROLOGION_COLORS` points at, and watches it for changes. Every key has a
|
||||
default, so the widget is legible with no file at all. See
|
||||
`quickshell/colors.example.json` — the flat shape most theme generators
|
||||
already emit.
|
||||
|
||||
## waybar
|
||||
|
||||
```jsonc
|
||||
"custom/typikon": {
|
||||
"exec": "horologion-waybar",
|
||||
"return-type": "json",
|
||||
"interval": 1800,
|
||||
"on-click": "typikon --days 7"
|
||||
}
|
||||
```
|
||||
|
||||
The module's CSS class is the fast level — `.xerophagy`, `.wine_oil`, `.fish`
|
||||
— so a day's discipline reads off the colour without reading the text.
|
||||
`.obligatory` is added only where a particular law actually binds, which under
|
||||
the Typikon is never: the Orthodox Church keeps the fast as tradition, not as
|
||||
precept. `waybar/style.css` has a starting palette.
|
||||
|
||||
Change what the text says with `--format`:
|
||||
|
||||
```console
|
||||
$ horologion-waybar --format '{emoji} {fastLabel}'
|
||||
$ horologion-waybar -j moscow --format '{emoji} {churchDate}'
|
||||
```
|
||||
|
||||
## eww
|
||||
|
||||
```lisp
|
||||
(include "horologion/horologion.yuck")
|
||||
```
|
||||
|
||||
Then `(horologion)` for the full panel or `(horologion-bar)` for one line.
|
||||
`horologion.scss` carries the styling; its colours are `!default` variables, so
|
||||
set your own before the `@import`.
|
||||
|
||||
## What it shows
|
||||
|
||||
The feast or the day's principal commemoration, the fast and why, the season,
|
||||
the week ahead, and Pascha. Two details worth pointing out:
|
||||
|
||||
- **The church date** appears beside the civil one whenever they differ, which
|
||||
on the old calendar is always. 25 December and 7 January are the same feast.
|
||||
- **Forefeasts, afterfeasts and leave-takings** get their own quiet line rather
|
||||
than crowding out the commemoration that makes the day itself. They repeat
|
||||
for days at a time.
|
||||
|
||||
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.
|
||||
|
||||
## Licence
|
||||
|
||||
GPL-2.0-only — see [LICENSE](LICENSE).
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
# Link the front ends into place. Nothing is copied, so a `git pull` updates
|
||||
# what you are running.
|
||||
set -euo pipefail
|
||||
|
||||
src="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
config="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
binhome="${HOME}/.local/bin"
|
||||
|
||||
usage() {
|
||||
cat <<USAGE
|
||||
horologion-install [quickshell|waybar|eww|bin|all]
|
||||
|
||||
quickshell link quickshell/ into a quickshell config as horologion/
|
||||
waybar link the bar script and print the module to merge
|
||||
eww link eww/ into your eww config
|
||||
bin link horologion-waybar into ~/.local/bin
|
||||
all bin + whichever of the three are already configured
|
||||
|
||||
USAGE
|
||||
}
|
||||
|
||||
link() {
|
||||
local from="$1" to="$2"
|
||||
mkdir -p "$(dirname "$to")"
|
||||
if [ -e "$to" ] && [ ! -L "$to" ]; then
|
||||
echo " ! $to exists and is not a link — leaving it alone" >&2
|
||||
return 1
|
||||
fi
|
||||
ln -sfn "$from" "$to"
|
||||
echo " $to -> $from"
|
||||
}
|
||||
|
||||
do_bin() {
|
||||
link "$src/bin/horologion-waybar" "$binhome/horologion-waybar"
|
||||
case ":$PATH:" in
|
||||
*":$binhome:"*) ;;
|
||||
*) echo " note: $binhome is not on your PATH" >&2 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
do_quickshell() {
|
||||
link "$src/quickshell" "$config/quickshell/horologion"
|
||||
cat <<'NOTE'
|
||||
|
||||
Add to your shell.qml:
|
||||
|
||||
import qs.horologion.modules
|
||||
...
|
||||
Horologion {}
|
||||
|
||||
Or run it on its own:
|
||||
|
||||
quickshell -p ~/.config/quickshell/horologion/shell.qml
|
||||
NOTE
|
||||
}
|
||||
|
||||
do_waybar() {
|
||||
link "$src/waybar/style.css" "$config/waybar/horologion.css"
|
||||
cat <<'NOTE'
|
||||
|
||||
Add "custom/typikon" to a modules list, merge waybar/config.jsonc into
|
||||
your config, and @import "horologion.css" from your style.css.
|
||||
NOTE
|
||||
}
|
||||
|
||||
do_eww() {
|
||||
link "$src/eww" "$config/eww/horologion"
|
||||
cat <<'NOTE'
|
||||
|
||||
Add to your eww.yuck: (include "horologion/horologion.yuck")
|
||||
Add to your eww.scss: @import "horologion/horologion.scss";
|
||||
Then put (horologion) in a window, or (horologion-bar) in a bar.
|
||||
NOTE
|
||||
}
|
||||
|
||||
command -v typikon >/dev/null 2>&1 || {
|
||||
echo "horologion: typikon is not on PATH." >&2
|
||||
echo " pip install typikon" >&2
|
||||
echo " https://git.pumpin.online/funkpower/typikon" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
case "${1:-all}" in
|
||||
quickshell) do_bin; do_quickshell ;;
|
||||
waybar) do_bin; do_waybar ;;
|
||||
eww) do_bin; do_eww ;;
|
||||
bin) do_bin ;;
|
||||
all)
|
||||
do_bin
|
||||
[ -d "$config/quickshell" ] && do_quickshell
|
||||
[ -d "$config/waybar" ] && do_waybar
|
||||
[ -d "$config/eww" ] && do_eww
|
||||
;;
|
||||
-h|--help|help) usage ;;
|
||||
*) usage; exit 2 ;;
|
||||
esac
|
||||
Executable
+99
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env python3
|
||||
"""waybar custom module — the liturgical day in the bar.
|
||||
|
||||
"custom/typikon": {
|
||||
"exec": "horologion-waybar",
|
||||
"return-type": "json",
|
||||
"interval": 1800,
|
||||
"on-click": "typikon --days 7"
|
||||
}
|
||||
|
||||
The class is the fast level, so the bar can colour it: style
|
||||
`#custom-typikon.xerophagy` and the rest. `.obligatory` is added where a
|
||||
particular law actually binds.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def run(jurisdiction, days):
|
||||
cmd = ["typikon", "--json", "--days", str(days)]
|
||||
if jurisdiction:
|
||||
cmd += ["--jurisdiction", jurisdiction]
|
||||
out = subprocess.run(cmd, capture_output=True, text=True, check=True).stdout
|
||||
parsed = json.loads(out)
|
||||
return parsed.get("days", [parsed])
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("-j", "--jurisdiction", default=None)
|
||||
ap.add_argument("-n", "--days", type=int, default=7)
|
||||
ap.add_argument("--no-emoji", action="store_true")
|
||||
ap.add_argument("--format", default="{emoji} {title}",
|
||||
help="{emoji} {title} {feast} {fast} {fastLabel} "
|
||||
"{season} {weekday} {churchDate}")
|
||||
args = ap.parse_args()
|
||||
|
||||
try:
|
||||
days = run(args.jurisdiction, args.days)
|
||||
except FileNotFoundError:
|
||||
print(json.dumps({"text": "typikon?", "tooltip":
|
||||
"typikon is not on PATH", "class": "error"}))
|
||||
return 1
|
||||
except (subprocess.CalledProcessError, ValueError) as exc:
|
||||
print(json.dumps({"text": "⚠", "tooltip": str(exc), "class": "error"}))
|
||||
return 1
|
||||
|
||||
today = days[0]
|
||||
fields = dict(today)
|
||||
if args.no_emoji:
|
||||
fields["emoji"] = ""
|
||||
text = args.format.format(**{k: fields.get(k) or "" for k in fields}).strip()
|
||||
|
||||
tip = []
|
||||
head = today["title"]
|
||||
if today.get("churchDate") and today["churchDate"] not in head:
|
||||
head += f" ({today['churchDate']})"
|
||||
tip.append(f"<b>{head}</b>")
|
||||
if today.get("cycle"):
|
||||
tip.append(f"<i>{today['cycle']}</i>")
|
||||
tip.append("")
|
||||
line = today["fastLabel"]
|
||||
if today.get("obligation") == "obligatory":
|
||||
line += " — obligatory"
|
||||
tip.append(line)
|
||||
if today.get("reason"):
|
||||
tip.append(today["reason"])
|
||||
if today.get("season"):
|
||||
tip.append(today["season"])
|
||||
for c in today.get("commemorations", []):
|
||||
if c != today["title"]:
|
||||
tip.append(f"· {c}")
|
||||
if len(days) > 1:
|
||||
tip.append("")
|
||||
for d in days[1:]:
|
||||
tip.append(f"{d['emoji']} {d['weekday'][:3]} {d['title'][:46]}")
|
||||
tip.append("")
|
||||
tip.append(f"Pascha {today['pascha']}")
|
||||
|
||||
classes = [today["fast"]]
|
||||
if today.get("obligation") == "obligatory":
|
||||
classes.append("obligatory")
|
||||
if today.get("rank"):
|
||||
classes.append(today["rank"])
|
||||
|
||||
print(json.dumps({
|
||||
"text": text,
|
||||
"tooltip": "\n".join(tip),
|
||||
"class": classes,
|
||||
"alt": today["fast"],
|
||||
}, ensure_ascii=False))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,62 @@
|
||||
// horologion — colours are variables so you can point them at your own theme.
|
||||
// Defaults are a neutral dark set; override them before the @import.
|
||||
|
||||
$horologion-fg: #ebdbb2 !default;
|
||||
$horologion-fg-dim: #a89984 !default;
|
||||
$horologion-accent: #d3869b !default;
|
||||
$horologion-red: #fb4934 !default;
|
||||
$horologion-yellow: #fabd2f !default;
|
||||
$horologion-surface: #282828 !default;
|
||||
$horologion-overlay: #504945 !default;
|
||||
|
||||
.horologion {
|
||||
background-color: rgba(40, 40, 40, 0.82);
|
||||
border: 1px solid $horologion-overlay;
|
||||
border-radius: 14px;
|
||||
padding: 14px;
|
||||
color: $horologion-fg;
|
||||
min-width: 400px;
|
||||
|
||||
.glyph-big { font-size: 28px; }
|
||||
.glyph { font-size: 15px; }
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
&.feast { color: $horologion-accent; }
|
||||
}
|
||||
|
||||
.sub {
|
||||
font-size: 10px;
|
||||
color: $horologion-yellow;
|
||||
&.obligatory { color: $horologion-red; font-weight: bold; }
|
||||
}
|
||||
|
||||
.cycle {
|
||||
font-size: 10px;
|
||||
font-style: italic;
|
||||
color: rgba(168, 153, 132, 0.8);
|
||||
}
|
||||
|
||||
.fast { font-size: 11px; color: $horologion-fg-dim; }
|
||||
|
||||
.rule {
|
||||
background-color: rgba(80, 73, 69, 0.6);
|
||||
min-height: 1px;
|
||||
}
|
||||
|
||||
.weekday { font-size: 11px; color: $horologion-yellow; }
|
||||
|
||||
.day {
|
||||
font-size: 10px;
|
||||
color: $horologion-fg-dim;
|
||||
&.feast { color: $horologion-accent; }
|
||||
}
|
||||
|
||||
.pascha { font-size: 10px; color: $horologion-fg-dim; }
|
||||
}
|
||||
|
||||
.horologion-bar {
|
||||
.glyph { font-size: 14px; }
|
||||
.title { font-size: 12px; }
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
;; horologion — the liturgical day for eww
|
||||
;;
|
||||
;; Include this from your own eww.yuck:
|
||||
;;
|
||||
;; (include "horologion/horologion.yuck")
|
||||
;;
|
||||
;; and put (horologion) in a window, or (horologion-bar) in a bar. Set a
|
||||
;; jurisdiction by editing the two defpoll commands below; leaving them as
|
||||
;; they are follows whatever `typikon --set-default` wrote.
|
||||
|
||||
(defpoll typikon-day
|
||||
:interval "30m"
|
||||
:initial "{}"
|
||||
`typikon --json`)
|
||||
|
||||
(defpoll typikon-week
|
||||
:interval "30m"
|
||||
:initial "{\"days\":[]}"
|
||||
`typikon --json --days 7`)
|
||||
|
||||
;; ── the one-line version, for a bar
|
||||
(defwidget horologion-bar []
|
||||
(box :class "horologion-bar"
|
||||
:space-evenly false
|
||||
:spacing 6
|
||||
(label :class "glyph" :text {typikon-day.emoji ?: ""})
|
||||
(label :class "title"
|
||||
:limit-width 42
|
||||
:text {typikon-day.title ?: "typikon?"})))
|
||||
|
||||
;; ── the full panel
|
||||
(defwidget horologion []
|
||||
(box :class "horologion"
|
||||
:orientation "v"
|
||||
:space-evenly false
|
||||
:spacing 8
|
||||
|
||||
(box :class "head" :space-evenly false :spacing 11
|
||||
(label :class "glyph-big" :text {typikon-day.emoji ?: ""})
|
||||
(box :orientation "v" :space-evenly false :halign "start" :hexpand true
|
||||
(label :class {typikon-day.feast != "" ? "title feast" : "title"}
|
||||
:halign "start"
|
||||
:wrap true
|
||||
:lines 2
|
||||
:text {typikon-day.title ?: "typikon is not on PATH"})
|
||||
(label :class {typikon-day.obligation == "obligatory"
|
||||
? "sub obligatory" : "sub"}
|
||||
:halign "start"
|
||||
:text "${typikon-day.weekday ?: ""}${
|
||||
typikon-day.season != "" ? " · " : ""}${
|
||||
typikon-day.season ?: ""}${
|
||||
typikon-day.obligation == "obligatory"
|
||||
? " · obligatory" : ""}")
|
||||
(label :class "cycle"
|
||||
:halign "start"
|
||||
:visible {(typikon-day.cycle ?: "") != ""}
|
||||
:text {typikon-day.cycle ?: ""})))
|
||||
|
||||
(label :class "fast"
|
||||
:halign "start"
|
||||
:text "${typikon-day.fastLabel ?: ""}${
|
||||
(typikon-day.reason ?: "") != ""
|
||||
? " — " : ""}${typikon-day.reason ?: ""}")
|
||||
|
||||
(box :class "rule")
|
||||
|
||||
;; the rest of the week
|
||||
(box :orientation "v" :space-evenly false :spacing 2
|
||||
(for d in {typikon-week.days ?: []}
|
||||
(box :space-evenly false :spacing 9
|
||||
(label :class "glyph" :text {d.emoji})
|
||||
(label :class "weekday" :width 34 :xalign 0 :text {d.weekday})
|
||||
(label :class {d.feast != "" ? "day feast" : "day"}
|
||||
:hexpand true :xalign 0 :limit-width 40 :text {d.title}))))
|
||||
|
||||
(box :class "rule")
|
||||
|
||||
(box :space-evenly false
|
||||
(label :class "pascha" :hexpand true :xalign 0
|
||||
:text "Pascha ${typikon-day.pascha ?: ""}")
|
||||
(label :class "pascha" :text {typikon-day.churchDate ?: ""}))))
|
||||
@@ -0,0 +1,12 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
|
||||
// Everything tunable in one place.
|
||||
Singleton {
|
||||
readonly property string font: "sans-serif"
|
||||
readonly property int fontSize: 13
|
||||
readonly property int radius: 14
|
||||
readonly property int width: 430
|
||||
readonly property real opacity: 0.82
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"bg": "#1d2021",
|
||||
"surface": "#282828",
|
||||
"overlay": "#504945",
|
||||
"fg": "#ebdbb2",
|
||||
"fgDim": "#a89984",
|
||||
"accent": "#d3869b",
|
||||
"red": "#fb4934",
|
||||
"yellow": "#fabd2f",
|
||||
"green": "#b8bb26"
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs
|
||||
import qs.services
|
||||
|
||||
Panel {
|
||||
id: root
|
||||
title: "Church calendar"
|
||||
note: Typikon.available
|
||||
? (Typikon.season || Typikon.churchDate)
|
||||
: ""
|
||||
|
||||
// The glyph carries what kind of fast it is, so obligation has to be shown
|
||||
// some other way or it disappears with the text: the weekday takes the
|
||||
// colour. Under the Typikon nothing binds and everything is yellow; under
|
||||
// a particular law that does bind, the days that bind go red. A panel that
|
||||
// blurs the two states something untrue.
|
||||
function tint(d) {
|
||||
if (!d) return Theme.fgDim;
|
||||
if (d.fast === "none") return Theme.fgDim;
|
||||
return d.obligation === "obligatory" ? Theme.red : Theme.yellow;
|
||||
}
|
||||
|
||||
// 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 law — and the words for them differ too.
|
||||
readonly property var legend: {
|
||||
const seen = [], out = [];
|
||||
for (const d of Typikon.week) {
|
||||
if (!d.emoji || seen.indexOf(d.fast) !== -1) continue;
|
||||
seen.push(d.fast);
|
||||
out.push({ emoji: d.emoji, label: d.fastLabel });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 7
|
||||
|
||||
Text {
|
||||
visible: !Typikon.available
|
||||
Layout.fillWidth: true
|
||||
text: Typikon.error !== "" ? Typikon.error
|
||||
: "unavailable — is `typikon` on PATH?"
|
||||
color: Theme.fgDim
|
||||
wrapMode: Text.WordWrap
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 1
|
||||
}
|
||||
|
||||
// Today, given room because it is the day being asked about.
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: Typikon.available
|
||||
spacing: 11
|
||||
|
||||
Text {
|
||||
text: Typikon.emoji
|
||||
font.family: Config.font
|
||||
font.pixelSize: 28
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 1
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: Typikon.title
|
||||
color: Typikon.feast !== "" ? Theme.accent : Theme.fg
|
||||
wrapMode: Text.WordWrap
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: {
|
||||
const bits = [Typikon.weekday];
|
||||
if (Typikon.churchDate !== ""
|
||||
&& Typikon.churchDate !== Qt.formatDate(new Date(), "d MMMM"))
|
||||
bits.push(Typikon.churchDate);
|
||||
if (Typikon.season !== "") bits.push(Typikon.season);
|
||||
if (Typikon.obligatory) bits.push("obligatory");
|
||||
return bits.join(" · ");
|
||||
}
|
||||
color: root.tint(Typikon.today)
|
||||
elide: Text.ElideRight
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 3
|
||||
font.bold: Typikon.obligatory
|
||||
}
|
||||
|
||||
// Forefeast, afterfeast, leave-taking. These repeat for days at
|
||||
// a time, so they get their own quiet line rather than crowding
|
||||
// out the commemoration that makes the day itself.
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
visible: Typikon.cycle !== ""
|
||||
text: Typikon.cycle
|
||||
color: Qt.alpha(Theme.fgDim, 0.8)
|
||||
elide: Text.ElideRight
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 3
|
||||
font.italic: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The rest of today's commemorations, under it.
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 39
|
||||
visible: Typikon.available
|
||||
spacing: 0
|
||||
|
||||
Repeater {
|
||||
model: Typikon.commemorations.filter(c => c !== Typikon.title).slice(0, 3)
|
||||
|
||||
delegate: Text {
|
||||
required property var modelData
|
||||
Layout.fillWidth: true
|
||||
text: "· " + modelData
|
||||
color: Theme.fgDim
|
||||
elide: Text.ElideRight
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
visible: Typikon.week.length > 1
|
||||
implicitHeight: 1
|
||||
color: Qt.alpha(Theme.overlay, 0.6)
|
||||
}
|
||||
|
||||
// The rest of the week: glyph, weekday, and what is kept that day.
|
||||
Repeater {
|
||||
model: Typikon.week.length > 1 ? Typikon.week.slice(1) : []
|
||||
|
||||
delegate: RowLayout {
|
||||
required property var modelData
|
||||
Layout.fillWidth: true
|
||||
spacing: 9
|
||||
|
||||
Text {
|
||||
text: modelData.emoji
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize + 3
|
||||
}
|
||||
Text {
|
||||
Layout.preferredWidth: 32
|
||||
text: modelData.weekday.substring(0, 3)
|
||||
color: root.tint(modelData)
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 2
|
||||
font.bold: modelData.obligation === "obligatory"
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: modelData.title
|
||||
color: modelData.feast ? Theme.accent : Theme.fgDim
|
||||
elide: Text.ElideRight
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
visible: Typikon.available
|
||||
implicitHeight: 1
|
||||
color: Qt.alpha(Theme.overlay, 0.6)
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: Typikon.available
|
||||
spacing: 10
|
||||
|
||||
Flow {
|
||||
Layout.fillWidth: true
|
||||
spacing: 9
|
||||
|
||||
Repeater {
|
||||
model: root.legend
|
||||
delegate: Text {
|
||||
required property var modelData
|
||||
text: modelData.emoji + " " + modelData.label
|
||||
color: Qt.alpha(Theme.fgDim, 0.75)
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: Typikon.pascha
|
||||
color: Theme.fgDim
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs
|
||||
import qs.services
|
||||
|
||||
// Chrome for the widget. Slightly translucent so a wallpaper reads through it,
|
||||
// opaque enough to stay legible over a busy picture.
|
||||
Rectangle {
|
||||
id: root
|
||||
property string title: ""
|
||||
property string note: ""
|
||||
default property alias content: body.data
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: col.implicitHeight + 28
|
||||
radius: Config.radius
|
||||
color: Qt.alpha(Theme.surface, Config.opacity)
|
||||
border.width: 1
|
||||
border.color: Qt.alpha(Theme.overlay, 0.7)
|
||||
|
||||
ColumnLayout {
|
||||
id: col
|
||||
anchors.fill: parent
|
||||
anchors.margins: 14
|
||||
spacing: 10
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: root.title !== ""
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: root.title
|
||||
color: Theme.accent
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize
|
||||
font.bold: true
|
||||
}
|
||||
Text {
|
||||
text: root.note
|
||||
color: Theme.fgDim
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize - 2
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: body
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: children.length > 0 ? children[0].implicitHeight : 0
|
||||
onWidthChanged: if (children.length > 0) children[0].width = width
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
// The liturgical day, from the `typikon` command.
|
||||
//
|
||||
// Computed locally, so this needs no network and cannot go stale. It only has
|
||||
// to be re-read when the date changes, which a clock at minute precision
|
||||
// notices without polling a subprocess every few seconds.
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// Set this to a jurisdiction key — "rocor", "antiochian", "oca" — or leave
|
||||
// it empty to use whatever `typikon --set-default` wrote.
|
||||
property string jurisdiction: ""
|
||||
// Today plus the next six, so the week ahead is visible at a glance.
|
||||
property int days: 7
|
||||
|
||||
property bool available: false
|
||||
property string error: ""
|
||||
|
||||
property var week: []
|
||||
property var today: ({})
|
||||
|
||||
readonly property string date: today.date ?? ""
|
||||
readonly property string weekday: today.weekday ?? ""
|
||||
readonly property string churchDate: today.churchDate ?? ""
|
||||
readonly property string season: today.season ?? ""
|
||||
readonly property string cycle: today.cycle ?? ""
|
||||
readonly property string feast: today.feast ?? ""
|
||||
readonly property string title: today.title ?? ""
|
||||
readonly property string rank: today.rank ?? ""
|
||||
readonly property string fast: today.fast ?? "none"
|
||||
readonly property string fastLabel: today.fastLabel ?? ""
|
||||
readonly property string emoji: today.emoji ?? ""
|
||||
readonly property string reason: today.reason ?? ""
|
||||
readonly property string obligation: today.obligation ?? ""
|
||||
readonly property string pascha: today.pascha ?? ""
|
||||
readonly property int daysToPascha: today.daysToPascha ?? 0
|
||||
readonly property var commemorations: today.commemorations ?? []
|
||||
|
||||
readonly property bool obligatory: obligation === "obligatory"
|
||||
|
||||
function refresh() { if (!proc.running) proc.running = true; }
|
||||
|
||||
SystemClock { id: clock; precision: SystemClock.Minutes }
|
||||
|
||||
// Re-read when the day rolls over, not on a timer. The answer changes at
|
||||
// midnight and at no other moment.
|
||||
readonly property string _day: Qt.formatDateTime(clock.date, "yyyy-MM-dd")
|
||||
on_DayChanged: root.refresh()
|
||||
Component.onCompleted: root.refresh()
|
||||
|
||||
Process {
|
||||
id: proc
|
||||
command: {
|
||||
const c = ["typikon", "--json", "--days", String(root.days)];
|
||||
if (root.jurisdiction !== "")
|
||||
c.push("--jurisdiction", root.jurisdiction);
|
||||
return c;
|
||||
}
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
try {
|
||||
const parsed = JSON.parse(this.text);
|
||||
root.week = parsed.days ?? [parsed];
|
||||
root.today = root.week.length ? root.week[0] : {};
|
||||
root.available = true;
|
||||
root.error = "";
|
||||
} catch (e) {
|
||||
root.available = false;
|
||||
root.error = "could not read typikon";
|
||||
}
|
||||
}
|
||||
}
|
||||
stderr: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (this.text.trim() !== "") {
|
||||
root.available = false;
|
||||
root.error = this.text.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//@ pragma UseQApplication
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs
|
||||
import qs.modules
|
||||
import qs.services
|
||||
|
||||
// A runnable widget on its own — `quickshell -p quickshell/shell.qml`.
|
||||
//
|
||||
// It sits on the background layer, so it behaves like part of the wallpaper:
|
||||
// always under your windows, never stealing a click. Drop the Horologion
|
||||
// component into an existing shell instead if you already have one.
|
||||
ShellRoot {
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
PanelWindow {
|
||||
required property var modelData
|
||||
screen: modelData
|
||||
|
||||
WlrLayershell.layer: WlrLayer.Background
|
||||
WlrLayershell.namespace: "horologion"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
color: "transparent"
|
||||
|
||||
anchors { top: true; right: true }
|
||||
margins { top: 24; right: 24 }
|
||||
|
||||
implicitWidth: Config.width
|
||||
implicitHeight: content.implicitHeight
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
anchors.fill: parent
|
||||
|
||||
Horologion {
|
||||
// Leave empty to follow `typikon --set-default`, or name a
|
||||
// jurisdiction here: "rocor", "antiochian", "oca", ...
|
||||
Component.onCompleted: Typikon.jurisdiction = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Drop this module into your waybar config's "modules-right" as
|
||||
// "custom/typikon", and merge the block below.
|
||||
{
|
||||
"custom/typikon": {
|
||||
"exec": "horologion-waybar",
|
||||
// Add -j to pin a jurisdiction, e.g. "horologion-waybar -j rocor".
|
||||
// Without it, whatever `typikon --set-default` wrote is used.
|
||||
"return-type": "json",
|
||||
// The answer changes at midnight and at no other moment, so this is only
|
||||
// about noticing the rollover.
|
||||
"interval": 1800,
|
||||
"tooltip": true,
|
||||
"on-click": "typikon --days 7"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* horologion — waybar styling for the custom/typikon module.
|
||||
*
|
||||
* The module's class is the fast level, so a day's discipline can be read off
|
||||
* the colour without reading the text. `.obligatory` is added only where a
|
||||
* particular law actually binds — under the Typikon it never appears, which is
|
||||
* correct: the Orthodox Church keeps the fast as tradition, not as precept. */
|
||||
|
||||
#custom-typikon {
|
||||
padding: 0 10px;
|
||||
color: #a89984;
|
||||
}
|
||||
|
||||
#custom-typikon.strict { color: #fb4934; font-weight: bold; }
|
||||
#custom-typikon.xerophagy { color: #fe8019; }
|
||||
#custom-typikon.wine_oil { color: #fabd2f; }
|
||||
#custom-typikon.fish { color: #8ec07c; }
|
||||
#custom-typikon.dairy { color: #83a598; }
|
||||
#custom-typikon.none { color: #a89984; }
|
||||
|
||||
#custom-typikon.obligatory { text-decoration: underline; }
|
||||
|
||||
/* A great feast outranks the fast in what you would want to see first. */
|
||||
#custom-typikon.great { color: #d3869b; font-weight: bold; }
|
||||
|
||||
#custom-typikon.error { color: #fb4934; }
|
||||
Reference in New Issue
Block a user