dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Compare Notes Search feat(nuguland): add persistent widget-usage tracker 4df0f3efcfa91fa73ea7777de41928099f73edf9
Oliver Jan Krylow <oliver@bugabinga.net > · 26 Jun 2026
unsigned
Browse files Compare with HEAD
Usage.qml counts how often each bar widget is opened, persisting to
$XDG_STATE_HOME via FileView+JsonAdapter. Exposes a usage-sorted layout
order, snapshotted at load so the bar stays stable within a session and
re-sorts across restarts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Changed files (1) quickshell/nuguland/Usage.qml Added new file mode 100644 13 + readonly property
var widgets: [
"clock" ,
"launcher" ,
"media" ,
"system" ,
"clipboard" ,
"audio" ,
"brightness" ,
"connectivity" ,
"power" ,
"notifications" ,
"tray" ,
"idle" ]
16 + property
var layoutOrder: widgets
18 + function countFor (name) {
19 + const counts
= usageAdapter.counts
|| ({
21 + return Number (counts[
String (name)]
|| 0 );
25 + function ordered () {
26 + return root.widgets.slice().map((name, index)
=> {
30 + "count" : root.countFor(name)
33 + return (b.count
- a.count)
|| (a.index
- b.index);
39 + function record (name) {
40 + const key
= String (name);
41 + if (root.widgets.indexOf(key)
< 0 )
42 + return root.stateJson();
44 + const next
= Object .
assign ({
45 + }, usageAdapter.counts);
46 + next[key]
= (
Number (next[key])
|| 0 )
+ 1 ;
47 + usageAdapter.counts
= next;
48 + return root.stateJson();
51 + function stateJson () {
52 + return JSON .
stringify ({
53 + "backend" :
"Usage.qml" ,
54 + "path" : usageFile.path,
55 + "counts" : usageAdapter.counts
|| ({
57 + "layoutOrder" : root.layoutOrder,
58 + "liveOrder" : root.ordered()
65 + path :
Quickshell .statePath(
"nuguland-widget-usage.json" )
67 + onFileChanged : reload()
68 + onAdapterUpdated : writeAdapter()
69 + onLoaded : root.layoutOrder
= root.ordered()
70 + onLoadFailed : root.layoutOrder
= root.widgets
75 + property
var counts: ({