From ac475b9a5ac6238d69eb5f359a8ff5e7d614bef9 Mon Sep 17 00:00:00 2001 From: buenosairesam Date: Tue, 23 Dec 2025 19:06:43 -0300 Subject: [PATCH] merged worktrees, task gkt window and gnome extension --- .env | 9 + .env.example | 12 + .../deskmeter-indicator@local.zip | Bin .../deskmeter-indicator@local/extension.js | 0 .../deskmeter-indicator@local/metadata.json | 0 .../deskmeter-indicator@local/stylesheet.css | 0 .../dmos/gnome-extension}/install.sh | 0 .../dmos/gnome-extension}/update.sh | 0 task_window.py => dmapp/dmos/task_window.py | 0 docs/EXTENSION_ORIGINAL.md | 119 ----- docs/INSTALL_STATUS.md | 298 ----------- docs/PORT_DETECTION_README.md | 148 ------ docs/README.md | 467 +++++++++++++++--- docs/READY_TO_TEST.md | 268 ---------- docs/TASK_WINDOW_README.md | 161 ------ 15 files changed, 430 insertions(+), 1052 deletions(-) create mode 100644 .env create mode 100644 .env.example rename {gnome-extension => dmapp/dmos/gnome-extension}/deskmeter-indicator@local.zip (100%) rename {gnome-extension => dmapp/dmos/gnome-extension}/deskmeter-indicator@local/extension.js (100%) rename {gnome-extension => dmapp/dmos/gnome-extension}/deskmeter-indicator@local/metadata.json (100%) rename {gnome-extension => dmapp/dmos/gnome-extension}/deskmeter-indicator@local/stylesheet.css (100%) rename {gnome-extension => dmapp/dmos/gnome-extension}/install.sh (100%) rename {gnome-extension => dmapp/dmos/gnome-extension}/update.sh (100%) rename task_window.py => dmapp/dmos/task_window.py (100%) delete mode 100644 docs/EXTENSION_ORIGINAL.md delete mode 100644 docs/INSTALL_STATUS.md delete mode 100644 docs/PORT_DETECTION_README.md delete mode 100644 docs/READY_TO_TEST.md delete mode 100644 docs/TASK_WINDOW_README.md diff --git a/.env b/.env new file mode 100644 index 0000000..f46bfce --- /dev/null +++ b/.env @@ -0,0 +1,9 @@ +# Deskmeter Configuration + +# dmweb API port (auto-detects if not set) +# DESKMETER_PORT=10001 + +# Window position for right monitor (1920x1080) +# Upper-right area (near red circle position) +WINDOW_X=3360 +WINDOW_Y=100 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..7d9f385 --- /dev/null +++ b/.env.example @@ -0,0 +1,12 @@ +# Deskmeter Configuration + +# Override dmweb API port (default: auto-detect 10001, then 10000) +# DESKMETER_PORT=10001 + +# Example for different worktree +# DESKMETER_PORT=10002 + +# Window position (X,Y coordinates) +# Example: middle of upper-right quadrant of left monitor (1920x1080) +# WINDOW_X=1440 +# WINDOW_Y=270 diff --git a/gnome-extension/deskmeter-indicator@local.zip b/dmapp/dmos/gnome-extension/deskmeter-indicator@local.zip similarity index 100% rename from gnome-extension/deskmeter-indicator@local.zip rename to dmapp/dmos/gnome-extension/deskmeter-indicator@local.zip diff --git a/gnome-extension/deskmeter-indicator@local/extension.js b/dmapp/dmos/gnome-extension/deskmeter-indicator@local/extension.js similarity index 100% rename from gnome-extension/deskmeter-indicator@local/extension.js rename to dmapp/dmos/gnome-extension/deskmeter-indicator@local/extension.js diff --git a/gnome-extension/deskmeter-indicator@local/metadata.json b/dmapp/dmos/gnome-extension/deskmeter-indicator@local/metadata.json similarity index 100% rename from gnome-extension/deskmeter-indicator@local/metadata.json rename to dmapp/dmos/gnome-extension/deskmeter-indicator@local/metadata.json diff --git a/gnome-extension/deskmeter-indicator@local/stylesheet.css b/dmapp/dmos/gnome-extension/deskmeter-indicator@local/stylesheet.css similarity index 100% rename from gnome-extension/deskmeter-indicator@local/stylesheet.css rename to dmapp/dmos/gnome-extension/deskmeter-indicator@local/stylesheet.css diff --git a/gnome-extension/install.sh b/dmapp/dmos/gnome-extension/install.sh similarity index 100% rename from gnome-extension/install.sh rename to dmapp/dmos/gnome-extension/install.sh diff --git a/gnome-extension/update.sh b/dmapp/dmos/gnome-extension/update.sh similarity index 100% rename from gnome-extension/update.sh rename to dmapp/dmos/gnome-extension/update.sh diff --git a/task_window.py b/dmapp/dmos/task_window.py similarity index 100% rename from task_window.py rename to dmapp/dmos/task_window.py diff --git a/docs/EXTENSION_ORIGINAL.md b/docs/EXTENSION_ORIGINAL.md deleted file mode 100644 index e867983..0000000 --- a/docs/EXTENSION_ORIGINAL.md +++ /dev/null @@ -1,119 +0,0 @@ -# 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. diff --git a/docs/INSTALL_STATUS.md b/docs/INSTALL_STATUS.md deleted file mode 100644 index fabbbc4..0000000 --- a/docs/INSTALL_STATUS.md +++ /dev/null @@ -1,298 +0,0 @@ -# Deskmeter GNOME Extension - Installation Status - -**Date**: 2025-12-19 -**GNOME Shell Version**: 49.2 (Wayland) -**Extension UUID**: deskmeter-indicator@local - ---- - -## ✅ Installation Complete - -1. **Extension files installed** to `~/.local/share/gnome-shell/extensions/deskmeter-indicator@local/` -2. **metadata.json updated** to support GNOME Shell 48 and 49 -3. **Extension enabled** via dconf (added to enabled-extensions list) - ---- - -## ⚠️ IMPORTANT: Required Before Testing - -### 1. Log Out and Back In (Wayland Requirement) - -Since you're on Wayland, GNOME Shell **cannot** be restarted without logging out. The extension will **only** load after you log back in. - -```bash -# After logging back in, verify extension is loaded: -gnome-extensions list --enabled | grep deskmeter -``` - -Expected output: `deskmeter-indicator@local` - ---- - -### 2. Start dmweb Server - -The extension requires the dmweb Flask server running on port 10000: - -```bash -# Navigate to dmweb directory -cd ~/wdir/dm-gnomeext/../../dm/dmapp/dmweb -# or wherever your dmapp directory is located - -# Start the server -python3 run.py -``` - -**Test the API endpoint:** -```bash -curl http://localhost:10000/api/current_task -``` - -Expected response: -```json -{"task_id":"12345678","task_path":"work/default"} -``` - -If you get an error, dmweb is not running. - ---- - -## 🎯 What to Expect - -After logging back in and starting dmweb, you should see: - -- **Extension indicator** in the top-left panel (left of other indicators) -- **Initial state**: Shows "loading..." for ~2 seconds -- **Normal state**: Displays current task path (e.g., "work/default") -- **After workspace switch**: Updates after 2.2 second delay -- **Long paths**: Auto-truncates to show last 2 segments (e.g., ".../project/task") - ---- - -## 🔧 Troubleshooting - -### Extension Not Showing in Panel - -```bash -# 1. Check if extension is in enabled list -gnome-extensions list --enabled | grep deskmeter - -# 2. If not listed, manually enable again -gnome-extensions enable deskmeter-indicator@local - -# 3. Check extension info -gnome-extensions info deskmeter-indicator@local - -# 4. View GNOME Shell logs for errors -journalctl --user -u org.gnome.Shell@wayland.service -f - -# Filter for deskmeter errors: -journalctl --user -u org.gnome.Shell@wayland.service --since "5 minutes ago" | grep -i deskmeter -``` - -### Shows "offline" Instead of Task - -```bash -# Check if dmweb is running -curl http://localhost:10000/api/current_task - -# Check if port 10000 is listening -ss -tlnp | grep 10000 - -# Start dmweb if not running -cd ~/wdir/dm-gnomeext/../../dm/dmapp/dmweb -python3 run.py -``` - -### Shows "error" Instead of Task - -This means the API is reachable but returned invalid JSON. Check dmweb logs: - -```bash -# In dmweb terminal, you should see the request -# Look for Python errors or exceptions -``` - -### Extension Shows in List but Not Enabled - -```bash -# Force enable via dconf -dconf write /org/gnome/shell/enabled-extensions \ - "$(dconf read /org/gnome/shell/enabled-extensions | sed "s/]$/, 'deskmeter-indicator@local']/")" - -# Verify it was added -dconf read /org/gnome/shell/enabled-extensions - -# Then log out/in again -``` - -### Extension Loads but Causes GNOME Shell Issues - -```bash -# Disable the extension -gnome-extensions disable deskmeter-indicator@local - -# Or remove from dconf -dconf write /org/gnome/shell/enabled-extensions \ - "$(dconf read /org/gnome/shell/enabled-extensions | sed "s/, 'deskmeter-indicator@local'//")" - -# View detailed error logs -journalctl --user -u org.gnome.Shell@wayland.service -n 200 | grep -A 10 -i "error.*deskmeter" -``` - ---- - -## 🐛 Debug Mode: View Live Logs - -```bash -# Watch GNOME Shell logs in real-time (useful for debugging) -journalctl --user -u org.gnome.Shell@wayland.service -f | grep --line-buffered -i "deskmeter\|error" - -# In another terminal, try interacting with the extension -# (switch workspaces, etc.) and watch for log output -``` - ---- - -## 🔍 Using GNOME Looking Glass for Debug - -If the extension loads but doesn't work: - -1. Press `Alt+F2` -2. Type `lg` and press Enter -3. Go to the **Extensions** tab -4. Find `deskmeter-indicator@local` -5. Check if it shows as **ACTIVE** or has error state -6. Click on it to see error details - ---- - -## 📝 Extension Files Location - -``` -~/.local/share/gnome-shell/extensions/deskmeter-indicator@local/ -├── extension.js (Main extension code) -├── metadata.json (Extension metadata with GNOME version support) -└── stylesheet.css (Panel label styling) -``` - ---- - -## 🔄 Update Extension After Code Changes - -```bash -# 1. Copy updated files -cp -r gnome-extension/deskmeter-indicator@local/* \ - ~/.local/share/gnome-shell/extensions/deskmeter-indicator@local/ - -# 2. On Wayland: MUST log out and back in -# (No way around this unfortunately) - -# 3. On X11: Can reload with Alt+F2 → r → Enter -# (But you're on Wayland) -``` - ---- - -## ✅ Quick Test Checklist - -After logging back in: - -- [ ] Extension appears in `gnome-extensions list --enabled` -- [ ] dmweb server is running (`curl http://localhost:10000/api/current_task` works) -- [ ] Task indicator visible in top panel (left side) -- [ ] Shows current task path (not "loading...", "offline", or "error") -- [ ] Updates when switching workspaces (after ~2 second delay) - ---- - -## 📚 Useful Commands Reference - -```bash -# List all extensions -gnome-extensions list - -# List enabled extensions -gnome-extensions list --enabled - -# Enable extension -gnome-extensions enable deskmeter-indicator@local - -# Disable extension -gnome-extensions disable deskmeter-indicator@local - -# Get extension info -gnome-extensions info deskmeter-indicator@local - -# View current dconf enabled extensions -dconf read /org/gnome/shell/enabled-extensions - -# Test dmweb API -curl http://localhost:10000/api/current_task - -# Check GNOME Shell version -gnome-shell --version - -# View GNOME Shell service status -systemctl --user status org.gnome.Shell@wayland.service -``` - ---- - -## 🚨 If Everything Fails - -1. **Collect logs:** - ```bash - journalctl --user -u org.gnome.Shell@wayland.service --since "10 minutes ago" > /tmp/gnome-shell-logs.txt - ``` - -2. **Check extension syntax:** - ```bash - cat ~/.local/share/gnome-shell/extensions/deskmeter-indicator@local/extension.js | head -20 - cat ~/.local/share/gnome-shell/extensions/deskmeter-indicator@local/metadata.json - ``` - -3. **Disable and remove:** - ```bash - gnome-extensions disable deskmeter-indicator@local - rm -rf ~/.local/share/gnome-shell/extensions/deskmeter-indicator@local - ``` - -4. **Reinstall from scratch:** - ```bash - cp -r gnome-extension/deskmeter-indicator@local ~/.local/share/gnome-shell/extensions/ - gnome-extensions enable deskmeter-indicator@local - # Log out and back in - ``` - ---- - -## 📁 Project Structure - -``` -dm-gnomeext/ -└── gnome-extension/ - ├── deskmeter-indicator@local/ - │ ├── extension.js ← Main extension code - │ ├── metadata.json ← Updated to support GNOME 49 - │ └── stylesheet.css ← Panel styling - ├── README.md - ├── install.sh - └── update.sh -``` - ---- - -## 💡 Extension Behavior Notes - -- **Debounce delay**: Extension waits 2.2 seconds after workspace switch before querying API - - This allows dmcore (polls every 2s) to detect the change and update MongoDB -- **Path truncation**: Paths longer than 40 chars show as `.../last/two` -- **Error handling**: - - "loading..." = Initial state or pending update - - "offline" = Cannot reach API endpoint - - "error" = API reachable but invalid response - - "no task" = Valid response but no current task - ---- - -Good luck! If you see the task indicator after logging back in, it's working perfectly. diff --git a/docs/PORT_DETECTION_README.md b/docs/PORT_DETECTION_README.md deleted file mode 100644 index 9cdacfa..0000000 --- a/docs/PORT_DETECTION_README.md +++ /dev/null @@ -1,148 +0,0 @@ -# Port Auto-Detection - -Both the task window and GNOME extension now automatically detect which port dmweb is running on. - -## How It Works - -### Automatic Detection - -Both apps try ports in this order: -1. **10001** - Worktree instance (tried first) -2. **10000** - Default instance (fallback) - -The first port that responds successfully is used. - -### Task Window (task_window.py) - -**Auto-detection** (recommended): -```bash -./task_window.py -# OR -python3 task_window.py -``` - -Output will show: -``` -Found dmweb API on port 10001 -API URL: http://localhost:10001/api/current_task -``` - -**Manual port specification:** -```bash -# Specify custom port as argument -python3 task_window.py 10001 -python3 task_window.py 10000 -python3 task_window.py 9999 -``` - -**Environment variable:** -```bash -# Set port via environment variable -DESKMETER_PORT=10001 python3 task_window.py -``` - -Priority order: Command line arg > Environment variable > Auto-detection - -### GNOME Extension - -The extension automatically tries ports 10001 and 10000 when it starts. - -You'll see "detecting..." in the panel while it searches, then it will show: -- The task name when port is found -- "offline" if no port responds - -## Testing - -### Test with curl - -```bash -# Check which ports are running -curl http://localhost:10000/api/current_task # default -curl http://localhost:10001/api/current_task # worktree -``` - -### Test task window - -```bash -# Auto-detect (will find port 10001 first) -python3 task_window.py - -# Force specific port -python3 task_window.py 10000 -``` - -Watch the console output to see which port was detected/used. - -## Configuration - -### Changing Port Priority - -Edit `task_window.py` line 16: -```python -DEFAULT_PORTS = [10001, 10000] # Try in this order -``` - -Edit `gnome-extension/deskmeter-indicator@local/extension.js` line 11: -```javascript -const DEFAULT_PORTS = [10001, 10000]; // Try in this order -``` - -### Adding More Ports - -```python -# In task_window.py -DEFAULT_PORTS = [10001, 10000, 9999, 8080] -``` - -```javascript -// In extension.js -const DEFAULT_PORTS = [10001, 10000, 9999, 8080]; -``` - -## Troubleshooting - -### Window shows "offline - dmweb not running" - -```bash -# Check if any dmweb is running -ps aux | grep dmweb - -# Check what ports are listening -ss -tlnp | grep -E "(10000|10001)" - -# Test ports manually -curl http://localhost:10000/api/current_task -curl http://localhost:10001/api/current_task -``` - -### Extension shows "detecting..." forever - -The extension couldn't connect to any port. Check: - -```bash -# View extension logs -journalctl --user -u org.gnome.Shell@wayland.service -f | grep deskmeter -``` - -Common issues: -- dmweb not running -- Firewall blocking localhost connections -- Wrong API endpoint (make sure `/api/current_task` exists) - -### Force specific port for extension - -Edit `~/.local/share/gnome-shell/extensions/deskmeter-indicator@local/extension.js` line 11: - -```javascript -// Only try one port -const DEFAULT_PORTS = [10001]; -``` - -Then log out and back in to reload the extension. - -## Summary - -✅ **Task window**: Auto-detects ports 10001, 10000 (can override with arg or env var) -✅ **GNOME extension**: Auto-detects ports 10001, 10000 -✅ **Worktree-first**: Both try port 10001 before 10000 -✅ **Configurable**: Easy to change port list or add more ports diff --git a/docs/README.md b/docs/README.md index a395a32..135afac 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,85 +1,436 @@ -# Deskmeter GNOME Integration - Documentation +# Deskmeter OS Integration -Complete documentation for the Deskmeter GNOME task display tools. +Display your current deskmeter task using GNOME Shell extension or standalone GTK window. -## Documentation Files +**Location**: `dmos/` (OS-specific components) -### Getting Started +--- -**[READY_TO_TEST.md](READY_TO_TEST.md)** - ⭐ START HERE -Complete testing guide with checklists, troubleshooting, and commands. Everything you need to test both the task window and GNOME extension. +## Quick Start -### Task Window +### GTK Task Window (Immediate - No logout) -**[TASK_WINDOW_README.md](TASK_WINDOW_README.md)** -Detailed guide for the standalone GTK task window: -- Usage instructions -- Configuration options -- Startup and autostart setup -- Comparison with extension - -### GNOME Extension - -**[INSTALL_STATUS.md](INSTALL_STATUS.md)** -Extension installation status and troubleshooting: -- Installation checklist -- Wayland requirements -- Detailed troubleshooting steps -- GNOME Looking Glass debugging -- Extension file locations - -**[EXTENSION_ORIGINAL.md](EXTENSION_ORIGINAL.md)** -Original extension README (kept for reference) - -### Technical Details - -**[PORT_DETECTION_README.md](PORT_DETECTION_README.md)** -How automatic port detection works: -- Auto-detection mechanism -- Manual port configuration -- Priority order -- Testing and troubleshooting - -## Quick Links - -### Task Window ```bash # Run with auto port detection -python3 task_window.py +python3 dmos/task_window.py -# Specify port manually -python3 task_window.py 10001 +# Make it always-on-top +wmctrl -r "Deskmeter Task" -b add,above,sticky ``` -### GNOME Extension +### GNOME Extension (Requires logout) + ```bash -# Check if enabled +cd dmos/gnome-extension +./install.sh + +# Enable extension +gnome-extensions enable deskmeter-indicator@local + +# Log out and back in (required on Wayland) +``` + +--- + +## Components + +### 1. GTK Task Window (`dmos/task_window.py`) + +Standalone GTK4 window showing current task, always-on-top and visible on all workspaces. + +**Features**: +- No window decorations (minimal UI) +- Updates every 500ms +- Workspace change detection (updates 2.2s after switch) +- Auto port detection (tries 10001, then 10000) + +**Usage**: +```bash +# Auto-detect port +python3 dmos/task_window.py + +# Specify port +python3 dmos/task_window.py 10001 + +# Or via environment +DESKMETER_PORT=10001 python3 dmos/task_window.py +``` + +**Window States**: +- `Loading...` - Initial state +- `work/default` - Current task path +- `offline - dmweb not running` (red) - Cannot connect +- `error - invalid API response` (orange) - Invalid JSON +- `no task` - Valid response, no task set + +**Close**: +- `Alt+F4` +- `pkill -f task_window.py` + +### 2. GNOME Extension (`dmos/gnome-extension/`) + +Panel indicator integrated into GNOME Shell top bar. + +**Features**: +- Native panel integration (left side) +- Workspace switch detection with 2.2s debounce +- Auto port detection (10001, 10000) +- Error handling (won't crash GNOME Shell) +- Auto-truncates long paths (shows `.../last/two`) + +**Files**: +- `extension.js` - Main extension code +- `metadata.json` - Extension metadata (GNOME 40-49) +- `stylesheet.css` - Panel styling + +**Installation**: +```bash +cd dmos/gnome-extension +./install.sh # First install +# OR +./update.sh # After code changes + +# Restart GNOME Shell: +# X11: Alt+F2 → 'r' → Enter +# Wayland: Log out and back in +``` + +**Check Status**: +```bash +# List enabled extensions gnome-extensions list --enabled | grep deskmeter # View logs journalctl --user -u org.gnome.Shell@wayland.service -f | grep deskmeter + +# Debug with Looking Glass +# Alt+F2 → 'lg' → Extensions tab ``` -### API Testing +--- + +## Port Auto-Detection + +Both components automatically detect dmweb port: + +**Priority Order**: +1. Command line argument (window only) +2. Environment variable `DESKMETER_PORT` (window only) +3. Auto-detection: tries 10001, then 10000 + +**Test Ports**: ```bash -# Test dmweb API curl http://localhost:10001/api/current_task curl http://localhost:10000/api/current_task ``` -## Documentation Index +**Configure Ports**: +```python +# In dmos/task_window.py (line 36) +DEFAULT_PORTS = [10001, 10000] +``` -| File | Purpose | Audience | -|------|---------|----------| -| READY_TO_TEST.md | Complete testing guide | Everyone - start here | -| TASK_WINDOW_README.md | Task window documentation | Window users | -| INSTALL_STATUS.md | Extension troubleshooting | Extension users | -| PORT_DETECTION_README.md | Port detection details | Advanced users | -| EXTENSION_ORIGINAL.md | Original extension docs | Reference | +```javascript +// In dmos/gnome-extension/deskmeter-indicator@local/extension.js (line 11) +const DEFAULT_PORTS = [10001, 10000]; +``` + +--- + +## Requirements + +### Both Components +- dmweb Flask server running (`cd dmapp/dmweb && python3 run.py`) +- `/api/current_task` endpoint accessible + +### GTK Window +- Python 3 with GTK4: `sudo apt install python3-gi gir1.2-gtk-4.0` +- wmctrl: `sudo apt install wmctrl` + +### GNOME Extension +- GNOME Shell 40-49 +- Works on X11 and Wayland + +--- + +## Troubleshooting + +### dmweb Not Running + +```bash +# Check if dmweb is running +ps aux | grep dmweb + +# Check listening ports +ss -tlnp | grep -E "(10000|10001)" + +# Start dmweb +cd dmapp/dmweb +python3 run.py + +# Test API +curl http://localhost:10000/api/current_task +# Expected: {"task_id":"abc12345","task_path":"work/default"} +``` + +### GTK Window Issues + +**"offline - dmweb not running"**: +- Start dmweb (see above) + +**Window not staying on top**: +```bash +wmctrl -r "Deskmeter Task" -b add,above,sticky +``` + +**GTK4 not found**: +```bash +sudo apt install python3-gi gir1.2-gtk-4.0 +``` + +**Window doesn't update on workspace change**: +```bash +# Test wmctrl +wmctrl -d +# Should show workspaces with * marking current +``` + +### GNOME Extension Issues + +**Extension not showing in panel**: +```bash +# Check if enabled +gnome-extensions list --enabled | grep deskmeter + +# Re-enable +gnome-extensions enable deskmeter-indicator@local + +# View errors +journalctl --user -u org.gnome.Shell@wayland.service --since "5 minutes ago" | grep -i deskmeter +``` + +**Shows "detecting..." forever**: +- dmweb not running on 10001 or 10000 +- Start dmweb and log out/in + +**Shows "offline"**: +```bash +# Test API endpoint +curl http://localhost:10000/api/current_task + +# Check dmweb logs for errors +``` + +**Changes not appearing after update**: +- Ensure `./update.sh` ran successfully +- Must restart GNOME Shell (X11) or logout/login (Wayland) +- Check logs: `journalctl -f -o cat /usr/bin/gnome-shell` + +--- + +## Comparison: Window vs Extension + +| Feature | GTK Window | GNOME Extension | +|---------|------------|-----------------| +| Visibility | Separate window | Panel indicator | +| Screen space | Takes window space | Minimal (panel) | +| Setup | Run anytime | Requires logout | +| Restart needed | No | Yes (Wayland) | +| All workspaces | ✅ (sticky) | ✅ (panel) | +| Integration | Standalone | Native GNOME | + +**Use GTK window for**: +- Quick testing +- No logout required +- Temporary usage + +**Use GNOME extension for**: +- Permanent setup +- Cleaner integration +- Less screen clutter + +--- + +## Configuration + +### GTK Window Settings + +Edit `dmos/task_window.py`: + +```python +# Update frequency (line 37) +UPDATE_INTERVAL = 2000 # milliseconds + +# Workspace check frequency (line 38) +WORKSPACE_CHECK_INTERVAL = 200 # milliseconds + +# Window size (line ~50) +self.set_default_size(400, 60) # width x height + +# Font size (line ~27) +self.label.set_markup('Loading...') +``` + +### GNOME Extension Settings + +Edit `dmos/gnome-extension/deskmeter-indicator@local/extension.js`: + +```javascript +// Debounce delay (line 10) +const DEBOUNCE_DELAY = 2200; // milliseconds + +// Port list (line 11) +const DEFAULT_PORTS = [10001, 10000]; + +// Update interval (line 12) +const UPDATE_INTERVAL = 30000; // 30 seconds +``` + +--- + +## Auto-start (Optional) + +### GTK Window on Login + +```bash +# Create desktop entry +cat > ~/.config/autostart/deskmeter-task-window.desktop <Loading...') -``` - -## Stopping the Window - -- Close the window normally (X button) -- Or kill the process: `pkill -f task_window.py` - -## Troubleshooting - -### "offline - dmweb not running" - -Start the dmweb server: -```bash -cd ~/path/to/dm/dmapp/dmweb -python3 run.py -``` - -Test manually: -```bash -curl http://localhost:10000/api/current_task -``` - -### Window not staying on top - -```bash -# Manually set properties -wmctrl -r "Deskmeter Task" -b add,above,sticky - -# Check if wmctrl is installed -which wmctrl -# If not: sudo apt install wmctrl -``` - -### GTK4 not found - -```bash -# Install GTK4 Python bindings -sudo apt install python3-gi gir1.2-gtk-4.0 -``` - -### Window appears on wrong workspace - -Use wmctrl to make it sticky (visible on all workspaces): -```bash -wmctrl -r "Deskmeter Task" -b add,sticky -``` - -## Comparison: Window vs Extension - -| Feature | Task Window (this) | GNOME Extension | -|---------|-------------------|-----------------| -| Always visible | ✅ (when on top) | ✅ (in panel) | -| All workspaces | ✅ (sticky) | ✅ (panel always visible) | -| Screen space | Takes window space | No extra space | -| Setup | Run anytime | Requires logout/login | -| Integration | Separate window | Native panel integration | -| Restart needed | No | Yes (on Wayland) | - -## Usage Tips - -1. **Position**: Drag to top-right corner of screen for minimal interference -2. **Size**: The window can be resized - smaller is less intrusive -3. **Transparency**: You can use GNOME Tweaks to make unfocused windows transparent -4. **Auto-start**: Add to Startup Applications if you want it to run on login - -## Adding to Startup (Optional) - -```bash -# Create desktop entry -cat > ~/.config/autostart/deskmeter-task-window.desktop <