desktop: an agent and a mini timer, not an application window

The design of the full desktop app was still bad, and the reason it stayed bad
is that it had no business existing. Five pages — Timer, Tasks, Blocker, Report,
Settings — each a second view of the *server's* data: a second place to be
wrong, a second place to style, and a second place to keep in step with a web
app that already does lists, rules and reports properly in a browser, on any
device. So it is gone, along with 2,100 lines of QML and the controller surface
that fed it.

What is left is what only a program on your machine can do, plus the two
surfaces worth having in front of you:

* **the tray menu — unchanged**, as asked. All fourteen entries, plus
  "Settings…". "Open Kadence" now brings the countdown up, because that is what
  it meant all along.
* **the mini timer**, which is now the whole of this app's own interface and so
  finally carries the house style on its own: warm surface, hairline instead of
  shadow, a letterspaced eyebrow, the progress lane as a rule, and exactly one
  filled button — whichever action is the obvious next one. The countdown is set
  in the display serif on a **fixed advance**, because Fraunces has no tabular
  figures and ships no `tnum`: each glyph now sits in a box as wide as the widest
  digit, instead of the clock shifting sideways on every tick. The phone client
  documents the same trap; the desktop had it too and nobody had looked.
  It also says OFFLINE when the backend is away — the count and the clock are
  both the server's, and this is the only window left to say it in.
* **a settings dialog**, because a fresh install has to be pointed at a backend
  somewhere. One column, hairline sections: the backend and its token, where the
  mini timer sits, what this machine enforces, and what it does to the session.
  It edits `desktop.json` and nothing else — with one honest exception, view-only
  mode, which is a server-side flag the other clients have to honour too.

Structurally, `app.py` no longer loads a QML root at all: a plain `QQmlEngine`
with the mini timer as a component, and the dialog built on demand. Everything
that used to ask "is the main window visible?" is simpler for not having one —
the mini timer's auto-show rule is now just "an interval is running", which is
what the setting always claimed.

The window-only controller surface goes with the pages: tasks and task writes,
stats, the daily report, the settings document, the presets, the cycle and
interruption counters, and their worker jobs and API calls. Two things were kept
deliberately: the task list is still read once a minute for one fact — which task
is pinned, so "Start focus" from the tray attaches what you pinned this morning —
and `timerEnabled` now comes from the timer state, which already carries
`timer_enabled`, rather than from a second fetch of a document this app can no
longer edit.

Also: `--settings` and a `Settings` D-Bus verb; toasts go to the tray's balloon
now that the snackbar is gone; the launcher entry starts the agent and grew a
Settings action; a systemd user unit is shipped rather than only written at
runtime; and both READMEs say what this piece is.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
timka123andClaude Opus 5 committed 2026-10-22 18:00:52 +03:00
1 parent 81032aca51
commit 8e659cd315
26 files changed
+752 -2690

No files matched your search

+52 -26
View File
@@ -1,9 +1,9 @@
// The floating mini timer.
// The mini timer — which is now the whole of Kadence's own window.
//
// A small pill you keep in a corner while you work: the countdown, what you are
// working on, and the three controls you actually reach for. It appears on
// demand (tray, Ctrl+M, the D-Bus verb) and — if you let it — by itself
// whenever an interval is running and the main window is out of the way.
// working on, and the controls you actually reach for. It appears on demand
// (tray, Ctrl+M, the D-Bus verb) and — if you let it — by itself whenever an
// interval is running.
//
// Everything has its own row. An earlier version saved space by swapping the
// task line for the controls on hover and by drawing the progress bar over the
@@ -14,22 +14,27 @@
// that works on Wayland, and the window refuses keyboard focus rather than
// being a `Qt.Tool` — Qt hides tool windows whenever the application is
// deactivated, which made this one vanish on every click in another app.
//
// The design is the house one, and now it carries it alone: warm surface, a
// hairline rather than a shadow, a letterspaced eyebrow, the figures in the
// display serif on a fixed advance, and exactly one filled button — whichever
// action is the obvious next one.
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import "."
import "components"
Window {
id: mini
width: 252
width: 268
height: card.implicitHeight + 12
color: "transparent"
// KWin's rule matches a substring of this, so it must stay distinct from
// the main window's caption. Qt appends " — Kadence" to it.
// KWin's rule matches a substring of this. Qt appends " — Kadence" to it.
title: "Kadence mini"
flags: Qt.Window | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
@@ -48,20 +53,19 @@ Window {
onTriggered: if (mini.visible) controller.saveMiniPosition(mini.x, mini.y)
}
// A small pill button. `filled` marks the one action you want by default —
// Resume when paused, Start when idle.
// A small pill button. `filled` marks the one action you want by default.
component MiniButton: Rectangle {
id: button
property string label: ""
property bool filled: false
signal clicked()
implicitWidth: buttonText.implicitWidth + 18
implicitHeight: 24
implicitWidth: buttonText.implicitWidth + 20
implicitHeight: 25
radius: 7
color: filled
? (buttonHover.hovered ? Qt.lighter(mini.accent, 1.08) : mini.accent)
: (buttonHover.hovered ? Qt.alpha(mini.accent, 0.12) : "transparent")
: (buttonHover.hovered ? Qt.alpha(mini.accent, 0.10) : "transparent")
border.width: filled ? 0 : 1
border.color: buttonHover.hovered ? mini.accent : Theme.rule
Behavior on color { ColorAnimation { duration: 110 } }
@@ -104,7 +108,9 @@ Window {
TapHandler {
acceptedButtons: Qt.LeftButton
onDoubleTapped: controller.showWindowRequested()
// There is no main window to open any more; the rules, the lists and
// the report live in the web app, so that is where a double-click goes.
onDoubleTapped: controller.openWebUi()
}
ColumnLayout {
@@ -112,10 +118,10 @@ Window {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 12
spacing: 3
anchors.margins: 13
spacing: 4
// ---- state -------------------------------------------------------
// ---- what is happening -------------------------------------------
RowLayout {
Layout.fillWidth: true
spacing: 7
@@ -135,17 +141,30 @@ Window {
+ (mini.paused ? " · PAUSED" : "")
color: mini.paused ? Theme.amber : (controller.running ? mini.accent : Theme.muted)
font.pixelSize: 9
font.letterSpacing: 1.2
font.letterSpacing: 1.3
font.weight: Font.DemiBold
font.family: Theme.sansFamily
Layout.fillWidth: true
elide: Text.ElideRight
}
// The backend being away is worth saying: the count and the clock
// are both the server's, and this is the only window left to say it in.
Label {
visible: !controller.connected
text: "OFFLINE"
color: Theme.amber
font.pixelSize: 9
font.letterSpacing: 1.1
font.weight: Font.DemiBold
font.family: Theme.sansFamily
}
Label {
visible: controller.connected
text: controller.completedToday + "/" + controller.goal
color: Theme.faint
font.pixelSize: 10
font.family: Theme.sansFamily
font.features: ({ "tnum": 1 })
}
Label {
text: "✕"
@@ -166,23 +185,22 @@ Window {
}
// ---- the time ----------------------------------------------------
Label {
ClockFigures {
text: controller.clockText
color: Theme.ink
pixelSize: 34
ink: Theme.ink
opacity: mini.paused ? 0.55 : 1
font.pixelSize: 32
font.family: Theme.displayFamily
font.letterSpacing: -1
Layout.topMargin: -2
Layout.topMargin: -1
Behavior on opacity { NumberAnimation { duration: 150 } }
}
// ---- what you are on ---------------------------------------------
Label {
Layout.fillWidth: true
Layout.topMargin: 1
text: controller.taskTitle !== ""
? controller.taskTitle
: (controller.running ? "no task attached" : "double-click to open Kadence")
: (controller.running ? "no task attached" : "double-click for the web app")
color: Theme.muted
font.pixelSize: 11
font.family: Theme.sansFamily
@@ -192,12 +210,15 @@ Window {
// ---- controls, always visible --------------------------------------
RowLayout {
Layout.fillWidth: true
Layout.topMargin: 4
Layout.topMargin: 6
spacing: 6
// One filled button, and it is whichever action is the obvious
// next one: pause what is running, resume what is held, start
// when there is nothing.
MiniButton {
label: mini.paused ? "Resume" : "Pause"
filled: mini.paused
filled: controller.running
visible: controller.running
onClicked: mini.paused ? controller.resume() : controller.pause()
}
@@ -239,6 +260,11 @@ Window {
height: 3
clip: true
Rectangle {
anchors.fill: parent
color: Theme.rule
opacity: 0.6
}
Rectangle {
width: parent.width * Math.max(0, Math.min(1, controller.progress))
height: parent.height