Skip to content

screentime: initial submission - #1899

Open
aliiakbarkhan wants to merge 2 commits into
linuxmint:masterfrom
aliiakbarkhan:master
Open

screentime: initial submission#1899
aliiakbarkhan wants to merge 2 commits into
linuxmint:masterfrom
aliiakbarkhan:master

Conversation

@aliiakbarkhan

Copy link
Copy Markdown

Screen Time desklet

A simple desklet that shows today's active screen time on the desktop (e.g. 3h 42m).

Features

  • Tracks active usage time only — counting automatically pauses when there's no mouse/keyboard input (idle/AFK)
  • Resets automatically at midnight each day
  • Idle threshold, font size, and whether to show seconds are all configurable via the desklet's settings
  • Progress is saved to disk periodically so it survives a Cinnamon restart
  • Uses Cinnamon/Mutter's built-in idle monitor, no external dependencies

Testing

  • Validated with ./validate-spice screentime@aliiakbarkhan
  • Tested locally on Linux Mint (Cinnamon)

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Best-practices scanner

This is a regex-based check for API usage that can pose security, performance or
maintainability issues, or that may already be provided by Cinnamon. Most findings
are advisory and do not automatically disqualify a pull request.

This check is not perfect and will not replace a normal review.


Found 4 potential issue(s):

⚠️ WARNING

⚠️ sync_file_get_contents

screentime@aliiakbarkhan/files/screentime@aliiakbarkhan/desklet.js:83

let [ok, contents] = GLib.file_get_contents(DATA_FILE);

Synchronous file_get_contents() blocks the main loop.
Use Gio.File.load_contents_async() instead.

⚠️ sync_file_test

screentime@aliiakbarkhan/files/screentime@aliiakbarkhan/desklet.js:82

if (GLib.file_test(DATA_FILE, GLib.FileTest.EXISTS)) {

file_test() is a synchronous stat call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

⚠️ hardcoded_cache_dir

screentime@aliiakbarkhan/files/screentime@aliiakbarkhan/desklet.js:10

const DATA_FILE = GLib.get_home_dir() + "/.cache/screentime-desklet.json";

Avoid hardcoding .cache in paths. Use GLib.get_user_cache_dir() instead,
which respects the XDG_CACHE_HOME environment variable.

⚠️ lang_bind

screentime@aliiakbarkhan/files/screentime@aliiakbarkhan/desklet.js:67

Lang.bind(this, this._tick)

Lang.bind() is deprecated. Use arrow functions (() => {}) or Function.prototype.bind() instead.


Automated pattern check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant