120 lines
3.0 KiB
Markdown
120 lines
3.0 KiB
Markdown
# Deskmeter GNOME Task Indicator
|
|
|
|
A GNOME Shell extension that displays your current deskmeter task in the top panel, positioned to the left of the panel indicators.
|
|
|
|
## Prerequisites
|
|
|
|
- GNOME Shell (versions 40-47 supported)
|
|
- Deskmeter web server running on `http://localhost:10000`
|
|
- The `/api/current_task` endpoint must be accessible
|
|
|
|
## Installation
|
|
|
|
1. Copy the extension to your GNOME extensions directory:
|
|
|
|
```bash
|
|
cp -r /home/mariano/wdir/dm/gnome-extension/deskmeter-indicator@local ~/.local/share/gnome-shell/extensions/
|
|
```
|
|
|
|
2. Restart GNOME Shell:
|
|
- On X11: Press `Alt+F2`, type `r`, and press Enter
|
|
- On Wayland: Log out and log back in
|
|
|
|
3. Enable the extension:
|
|
|
|
```bash
|
|
gnome-extensions enable deskmeter-indicator@local
|
|
```
|
|
|
|
Or use GNOME Extensions app (install with `sudo apt install gnome-shell-extension-prefs` if needed).
|
|
|
|
## Configuration
|
|
|
|
The extension updates automatically when you switch workspaces. It waits 2.2 seconds after a workspace switch to allow dmcore (which polls every 2 seconds) to detect the change and update MongoDB.
|
|
|
|
You can adjust the delay in `extension.js`:
|
|
|
|
```javascript
|
|
const DEBOUNCE_DELAY = 2200; // milliseconds
|
|
```
|
|
|
|
The API URL is set to:
|
|
|
|
```javascript
|
|
const DESKMETER_API_URL = 'http://localhost:10000/api/current_task';
|
|
```
|
|
|
|
## Uninstallation
|
|
|
|
```bash
|
|
gnome-extensions disable deskmeter-indicator@local
|
|
rm -rf ~/.local/share/gnome-shell/extensions/deskmeter-indicator@local
|
|
```
|
|
|
|
Then restart GNOME Shell.
|
|
|
|
## Updating the Extension
|
|
|
|
After making changes to the extension code:
|
|
|
|
```bash
|
|
# Use the update script
|
|
cd /home/mariano/wdir/dm/gnome-extension
|
|
./update.sh
|
|
|
|
# Then restart GNOME Shell (X11 only)
|
|
Alt+F2, type: r, press Enter
|
|
|
|
# On Wayland: log out and back in
|
|
```
|
|
|
|
Or manually:
|
|
```bash
|
|
cp -r /home/mariano/wdir/dm/gnome-extension/deskmeter-indicator@local \
|
|
~/.local/share/gnome-shell/extensions/
|
|
# Then restart GNOME Shell
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Extension not showing
|
|
|
|
1. Check if the extension is enabled:
|
|
```bash
|
|
gnome-extensions list --enabled
|
|
```
|
|
|
|
2. Check for errors:
|
|
```bash
|
|
journalctl -f -o cat /usr/bin/gnome-shell
|
|
```
|
|
|
|
3. Try disabling and re-enabling:
|
|
```bash
|
|
gnome-extensions disable deskmeter-indicator@local
|
|
gnome-extensions enable deskmeter-indicator@local
|
|
```
|
|
|
|
### Shows "offline" or "error"
|
|
|
|
- Ensure dmweb Flask server is running on port 10000
|
|
- Test the API endpoint:
|
|
```bash
|
|
curl http://localhost:10000/api/current_task
|
|
```
|
|
Should return JSON like: `{"task_id":"12345678","task_path":"work/default"}`
|
|
|
|
### Changes not appearing
|
|
|
|
- Make sure you copied files after editing
|
|
- GNOME Shell must be restarted (no way around this)
|
|
- Check logs for JavaScript errors: `journalctl -b -o cat /usr/bin/gnome-shell | grep deskmeter`
|
|
|
|
### Debug with Looking Glass
|
|
|
|
Press `Alt+F2`, type `lg`, press Enter. Go to Extensions tab to see if the extension loaded and check for errors.
|
|
|
|
### Task path too long
|
|
|
|
The extension automatically truncates paths longer than 40 characters, showing only the last two segments with a `.../ ` prefix.
|