Skip to content

probeldev/niri-screen-time

Repository files navigation

Niri Screen Time

A utility that tracks how much time was spent on applications by their class and its title.

Report Example

Supported OS

MacOs

  • AeroSpace
  • Default windows manager

Linux

Supported Wayland Compositors:

  • Niri
  • Hyprland

Installation

go

go install github.com/probeldev/niri-screen-time@latest

Note

If you get an error claiming that niri-screen-time cannot be found or that it is not defined, you may need to add ~/go/bin to your $PATH.

aur (unofficial)

yay -S niri-screen-time-git

nix

nix profile install github:probeldev/niri-screen-time

Note

This is an imperative way of installing, and it is not preferred on Nix. You should define it in your Nix configuration instead.

Usage

Daemon

Daemon — a background service that collects data on application usage time (requires adding to startup for proper operation).

Start the daemon:

niri-screen-time -daemon 

Add to startup for MacOs

niri-screen-time -autostart enable

Report

(without key)

niri-screen-time 

View data from a selected date until today:

niri-screen-time -from=2023-10-20

View data within a date range:

niri-screen-time -from=2023-10-01 -to=2023-10-31 

Subroutine and Website Configuration

To track specific websites or console commands within applications, use the configuration file:

Supported formats: YAML (.yaml, .yml) or JSON (.json) Location: ~/.config/niri-screen-time/subprograms.{yaml,yml,json} Priority order: .yaml → .yml → .json

Configuration Format

YAML:

- app_ids:
    - application_identi1
    - application_identi2
  title_list:
    - partial_window_title1
    - partial_window_title2
  alias: display_name

JSON:

[
  {
    "app_ids": [
        "application_identi1",
        "application_identi2"
    ],
    "title_list": [
        "partial_window_title1",
        "partial_window_title2"
    ],
    "alias": "display_name"
  }
]
Configuration Examples

For terminal commands:

YAML:

- app_ids:
    - com.mitchellh.ghostty
  title_list:
    - "NeoVim: ~/script/"
    - "NeoVim: ~/.config"
  alias: "NeoVim: edit configs"

JSON:

{
    "app_ids": [
        "com.mitchellh.ghostty"
    ],
    "title_list": [
        "NeoVim: ~/script/",
        "NeoVim: ~/.config"
    ],
    "alias": "NeoVim: edit configs"
}

For websites in browser:

YAML:

- app_ids:
    - zen
    - app.zen_browser.zen
  title_list:
    - Monkeytype
  alias: Monkeytype

JSON:

{
    "app_ids": [
        "zen",
        "app.zen_browser.zen"
    ],
    "title_list":[
        "Monkeytype"
    ],
    "alias": "Monkeytype"
}

Just alias:

YAML:

- app_ids:
    - org.gnome.Nautilus
  title_list: []
  alias: Nautilus

JSON:

{
    "app_ids": [
        "org.gnome.Nautilus"
    ],
    "title_list": [ ],
    "alias": "Nautilus"
}

Details

This mod adds detailed per-application stats.

niri-screen-time -details -appid="org.telegram.desktop" -title="" -from='2025-01-20' -to='2025-08-20' -limit=20 -onlytex
t

License

This project is licensed under the MIT License - see the LICENSE file for details.