1
0
Fork
You've already forked okoleko
0
A tool that puts your program usage in a CSV. Works only on niri.
  • Lua 100%
2026年06月27日 15:20:39 +02:00
.gitignore Initial commit 2026年06月27日 14:54:17 +02:00
analyze.lua make comment better 2026年06月27日 15:20:39 +02:00
monitor.lua make comment better 2026年06月27日 15:20:39 +02:00
README.md Initial commit 2026年06月27日 14:54:17 +02:00
stylua.toml Initial commit 2026年06月27日 14:54:17 +02:00

Warning!!!

This is a project made specifically for me, to monitor my usage of programs. It will likely not work properly on your machine.

I am putting this out to the world in the hopes it will be useful for someone.

okoleko

A tool that puts your program usage in a CSV. Works only on niri.

The csv format is date,program_name,time_in_seconds

Requirements

  • Some lua knowledge, you will need to modify the source code.
  • Niri window manager, you may modify the code to work on hyprland too if you want to
  • notify-send working
  • luajit
  • a desire to run this

Usage

  1. Git clone the project
  2. Look into monitor.lua AND analyze.lua, change path = "<whatever>" to the path where you want the csv
  3. Create an empty file in that path (so if path was /db.csv, you would create an empty file named that)
  4. Give it a test run, run with luajit monitor.lua and check the csv after some time
  5. Customise in monitor.lua the give_name function to things relevant to you. (Returned value must not contain commas or anything weird, you can get the app id by running niri msg windows)
  6. Deploy!! Inside ~/.config/niri/config.kdl add spawn-sh-at-startup "luajit </path/to/monitor.lua>"

The monitor.lua is the only file from this project that you need.

What to do with the data?

You can display the data for the current day by running analyze.lua. You can also modify analyze.lua to do some actual analysis (like the difference between yesterday's usage and today's), but that is an excercise for the reader.

Anything fun?

You can plot the data with matplotlib:

# The base of this code was LLM generated, sorry... i know.... :(
# But no other code in the repository has been impacted by LLMs, it would take away the fun
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("db.csv", header=None, parse_dates=[0])
plt.figure(figsize=(10, 5))
for app, g in df.groupby(1).filter(lambda x: x[2].mean() > 2000 and x[2].sum() > 10000).groupby(1):
 g = g.sort_values(0)
 plt.plot(g[0], g[2], marker="o", linewidth=1, label=app)
plt.xlabel("Date")
plt.ylabel("Time (seconds)")
plt.title("Program usage time over time")
plt.legend(title="Program")
plt.show()

License

BSD Zero Clause License
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Have fun!