blob: 38943fa9bcfddb4642c125c14d3ba8945975d914 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# 🖥 fish-screen-time
A lightweight daily screen time tracker that shows up in your Fish shell greeting. Resets automatically every day at midnight. Uses ~1–3 MB of RAM.
## Install via AUR
```bash
yay -S fish-screen-time
```
or with paru:
```bash
paru -S fish-screen-time
```
## After installing
**1. Start the background tracker:**
```bash
systemctl --user enable --now screen-time-tracker
```
**2. Add to your fish greeting:**
```fish
function fish_greeting
show_screen_time
end
funcsave fish_greeting
```
That's it. Open a new terminal and you'll see:
```
🟢 Screen time today: 1h 23m
🟡 Screen time today: 5h 10m Consider a break soon.
🔴 Screen time today: 8h 45m Take a long break!
```
## How it works
A systemd user service runs `screen_time_tracker.sh` silently in the background. Every 60 seconds it adds 60 to a date-stamped file in `~/.local/share/screen_time/`. When midnight passes, a new file starts for the new day — no cron job needed.
`show_screen_time` reads that file and formats it whenever you open a terminal.
## Manual install (non-Arch systems)
```bash
# Clone the repo
git clone https://github.com/YOURUSERNAME/fish-screen-time
cd fish-screen-time
# Install tracker script
mkdir -p ~/.local/bin
cp screen_time_tracker.sh ~/.local/bin/
chmod +x ~/.local/bin/screen_time_tracker.sh
# Install fish function
cp show_screen_time.fish ~/.config/fish/functions/
# Install and start systemd service
mkdir -p ~/.config/systemd/user
cp screen-time-tracker.service ~/.config/systemd/user/
systemctl --user enable --now screen-time-tracker
```
## Dependencies
- `fish` shell
- `bash`
- `systemd`
## License
MIT
|