Skip to content

About

aliasOS bar widget for notch: live time-tracking status with quick start/stop

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Notch bar widget

A bar widget for aliasOS and Omarchy that shows your running notch timer and lets you start, stop and edit time entries without opening the TUI.

What it does

  • In the bar: a dim timer glyph when idle. While a timer runs, a dot and the elapsed time (the time is always there, so the dot is never the only sign). Click to open the panel; middle-click to stop, or to resume the last task. To show the task's name after the time, add "showTask": true to the plugin's entry in ~/.config/aliasos/shell.json:

    "plugins": [{ "id": "io.github.aliasproject.notch", "showTask": true }]
  • In the panel (440 px wide):

    • Hero: a stop or resume button, TRACKING or NOT TRACKING, the task, client › project, the elapsed time and, with a client rate, what it has earned so far. Click the task to edit the running timer.
    • Stats: today, this week and unbilled (unbilled needs notch v0.11.0). Today and this week tick with the running timer. Unbilled counts finished entries only, as the CLI and the TUI do; the running timer joins it when it stops.
    • Tabs: Timers (1), Clients (2) and Reports (3). Clients and Reports are being built (ALI-2621 and ALI-2622) and show disabled until then.
    • Timers: your recent tasks. Start or stop one with a click, or expand it to see its sessions. Quick add: type a task name and press Enter; it starts under Uncategorized, and you can assign a client and project afterwards. Edit the running timer, a whole task or a single session, and delete a task, a session or the running timer, with confirmation.
    • Footer: Open notch (o) opens the full TUI, and ? shows every key.
  • Keyboard: Tab and Shift+Tab move through the panel's controls (past the last, Tab moves to the bar's next panel), 1 2 3 switch tabs, ? shows the keys, Space stops or resumes, s stops, o opens notch, Esc closes. In Timers, the arrow keys move and expand, Enter starts or stops the selected row, n quick adds, e edits, and x or Delete deletes.

  • Accessibility: every control is a real button with a 44 px target and a name for screen readers, and keyboard focus shows a ring of at least 3:1 against the background and every fill, in any theme: 0.55 alpha or more, raised per theme at runtime.

The widget has no daemon of its own. Every action is a one-shot notch CLI call: version, status, tasks, summary, entries, projects and clients (with -json) to read, and start, stop, edit and delete to write. It also runs notch watch to pick up changes you make in the TUI right away.

Requirements

  • notch on your PATH. The panel asks notch version each time it opens and hides what your notch can't do, instead of running a command that fails:
    • v0.10.0: the stats, a task's sessions, delete, and editing a whole task or a session's times.
    • v0.11.0: unbilled, the running timer's cost, and the Clients and Reports tabs once they land.
    • Run notch upgrade to get them.
  • aliasOS: the shell's Color palette is reached as Commons.Color, which Qt 6.12 requires (see aliasOS's docs/plugins.md).
  • aliasOS 1.11.0 or later: the bar icon is fitted with OpticalGlyph.paintedSize, which arrived with 1.11.0's bar icons.

Install

On aliasOS:

aliasos-plugin-add https://github.com/aliasproject/notch-plugin
aliasos-plugin-enable io.github.aliasproject.notch

It goes in the center section by default. You can drag it anywhere on the bar.

Develop

Edit the files here, then copy them over the installed plugin and restart the shell. The shell loads plugins only once, at startup:

cp *.qml Model.js manifest.json ~/.config/aliasos/plugins/io.github.aliasproject.notch/
aliasos-restart-shell

To open the panel without clicking:

quickshell ipc -p /usr/share/aliasos/shell call io.github.aliasproject.notch open

Errors from the plugin show up in quickshell log -p /usr/share/aliasos/shell.

Model.js holds the parsing and formatting, with no QML in it, and has Node tests:

node --test test/

Panel layout

The panel is split so each tab can be built on its own. Every file sits in the plugin's root: the shell loads the entry point from a file:// URL, so sibling .qml files resolve as types without an import.

File What it is
BarWidget.qml The entry point: the bar chip and the panel's shell (hero, stats, tab row, footer, keys sheet, confirm), plus the data every tab shares.
TimersTab.qml The Timers tab body. ALI-2620 redesigns it.
ClientsTab.qml The Clients tab body, a placeholder until ALI-2621.
ReportsTab.qml The Reports tab body, a placeholder until ALI-2622.
NotchTheme.qml Colours and sizes, one instance passed down as theme. Sizes cite notch's design/tokens.json.
NotchButton.qml The one button: 44 px target, accessible name, focus ring, variants plain, bordered, primary and danger, an optional key hint.
NotchChip.qml A toggle chip for a range picker, built on NotchButton.
NotchField.qml A labelled text field with an error line tied to it.
FocusRing.qml The focus ring every control draws: opaque, 3:1 on the background and on every fill (the alpha is raised per theme at runtime), with a gap in the background colour inside it.
NotchConfirm.qml The confirm the shell shows for any tab.
NameField.qml A typeahead field for a client or project name.
Model.js Parsing, formatting, version gating, money and contrast helpers.

Use theme for every colour and size, never a literal. The main ones: text, dim, accentText, errorText and success (text colours that pass 4.5:1, falling back to the foreground on a theme where they wouldn't), line, tile, hoverFill, selectedFill, focusRing and focusWidth, target (44), heroButton (52), panelWidth (440), and the type scale fontCaption to fontDisplay.

The tab contract

The shell builds all three tab bodies once and keeps them, showing the current one. Each tab body is an Item with:

  • Given by the shell: shell (BarWidget's root, below), theme, and active (this tab is showing).
  • Read by the shell:
    • ready: the tab has a real body. A tab that isn't ready shows disabled in the tab row, and so does one whose notch is too old (shell.features.catalog for Clients, shell.features.report for Reports).
    • blocksKeys: an inline editor is open, so the shell stops handling keys and the editor gets them.
    • shortcuts: [{key, label}] for the keys sheet.
    • implicitHeight: the body's height. The shell scrolls it when the panel reaches the screen's height.
  • Called by the shell:
    • panelOpened() and panelClosed().
    • keyMove(dx, dy) for the arrow keys and hjkl.
    • keyActivate() for Enter and Space. Return false when nothing is selected, and the shell stops or resumes the timer.
    • keyDelete() for x, Delete and Backspace. Return false when nothing is selected.
    • keyText(text) for any other key. Return true if the tab used it. The shell keeps 1 2 3, ?, s and o.
    • focusFirst() and focusLast() when Tab or Shift+Tab reaches the body: focus the first or last control there and return true, or return false when nothing in the body takes Tab focus (the shell skips it).
    • focusNext(direction) for Tab (1) or Shift+Tab (-1) while focus is inside the body: move it and return true, or return false to leave the body. The rows aren't on the Tab path; the arrow keys move through them.

Tab order: the hero's button, the hero's edit area (while running), the available tabs, the active tab's body, Open notch, then ?. Past either end, Tab moves to the bar's next or previous panel, the key's job before the panel had controls on the Tab path. The arrow keys hand focus back to the panel so the list's cursor gets them.

The Timers tab also gives the shell resumeTask, the task the hero resumes.

The shell API

What shell offers a tab body:

  • Status: running, statusTask, statusProjectId, statusProjectName, statusClientName, statusEntryId, statusNotes, startTimeMs, elapsedSeconds, nowMs (ticks every second while running) and notchAvailable.
  • Totals: todaySeconds and weekSeconds, live while running, and held at their last values when the running timer stops until the summary that counts it lands. unbilled is finished entries only, from summary -json. runningRate and runningCost are the running timer's.
  • Catalog: allClients (clients -json, with hourlyRate, monthSeconds, monthEarned and unbilled on v0.11.0) and allProjects (projects -json). refreshCatalog() reloads both.
  • Version: version and features (see below).
  • Writes: runAction(argv) runs one notch write, shows its error under the stats, and refreshes everything after it. startTask(projectId, task, notes), startTaskByName(client, project, task, notes) and stopTimer() are shortcuts for it.
  • Confirm: requestConfirm(message, confirmText, argv) shows the confirm, with Cancel selected, and runs argv once confirmed.
  • Signals: statusLanded() after each status read, refreshed() after a write here or elsewhere (re-read what the tab shows), and actionFailed().
  • Other: restoreFocus() after an editor closes, ensureVisible(item) to scroll a row into view, selectTab(i) and openTui().

A tab reads anything else, such as notch report -json or notch entries --from --to -json, with its own Process, parses it in Model.js, and runs it again on refreshed().

Data and version gating

Model.features(version) says what this notch can do. Gate every control on the flag for the command it runs:

Flag notch Commands
summary v0.10.0 summary -json
sessions v0.10.0 entries --project --task -json
delete v0.10.0 delete
editTask v0.10.0 edit --from-project --from-task, edit --start --end
money v0.11.0 money in summary -json, clients -json and projects -json
report v0.11.0 report -json, report --csv
entriesRange v0.11.0 entries --from --to -json
catalog v0.11.0 clients add/edit/delete, projects add/edit/delete
billing v0.11.0 edit --invoiced, edit --paid
logPast v0.11.0 start --start --end
placement v0.11.0 start --task "task @client/project"

A notch older than v0.9.0 doesn't answer version (an unknown subcommand falls through to the TUI and exits 1), so every flag is off; a local dev build has them all. notch's README "Scripting" section documents each command's JSON.

Model.js helpers for tab bodies: parseVersion, versionAtLeast, features, parseSummary, parseTasks, parseEntries, parseClients, parseProjects, clientRate, earnedFor, formatMoney, formatSeconds, formatSessionLabel, formatClockTime, parseClockTime, toRfc3339, startOfDayMs, startOfWeekMs, billingLabel, contrastRatio, readable, alphaFor, focusAlphaFor, tabs and nextFocusStop. Add new parsing there with a test in test/model.test.js.

License

MIT. See LICENSE.

About

aliasOS bar widget for notch: live time-tracking status with quick start/stop

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages