merged worktrees, task gkt window and gnome extension
This commit is contained in:
9
.env
Normal file
9
.env
Normal file
@@ -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
|
||||||
12
.env.example
Normal file
12
.env.example
Normal file
@@ -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
|
||||||
@@ -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.
|
|
||||||
@@ -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.
|
|
||||||
@@ -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
|
|
||||||
467
docs/README.md
467
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
|
## Quick Start
|
||||||
Complete testing guide with checklists, troubleshooting, and commands. Everything you need to test both the task window and GNOME extension.
|
|
||||||
|
|
||||||
### 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
|
```bash
|
||||||
# Run with auto port detection
|
# Run with auto port detection
|
||||||
python3 task_window.py
|
python3 dmos/task_window.py
|
||||||
|
|
||||||
# Specify port manually
|
# Make it always-on-top
|
||||||
python3 task_window.py 10001
|
wmctrl -r "Deskmeter Task" -b add,above,sticky
|
||||||
```
|
```
|
||||||
|
|
||||||
### GNOME Extension
|
### GNOME Extension (Requires logout)
|
||||||
|
|
||||||
```bash
|
```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
|
gnome-extensions list --enabled | grep deskmeter
|
||||||
|
|
||||||
# View logs
|
# View logs
|
||||||
journalctl --user -u org.gnome.Shell@wayland.service -f | grep deskmeter
|
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
|
```bash
|
||||||
# Test dmweb API
|
|
||||||
curl http://localhost:10001/api/current_task
|
curl http://localhost:10001/api/current_task
|
||||||
curl http://localhost:10000/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 |
|
```javascript
|
||||||
|------|---------|----------|
|
// In dmos/gnome-extension/deskmeter-indicator@local/extension.js (line 11)
|
||||||
| READY_TO_TEST.md | Complete testing guide | Everyone - start here |
|
const DEFAULT_PORTS = [10001, 10000];
|
||||||
| 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 |
|
|
||||||
|
## 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('<span font_desc="14">Loading...</span>')
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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 <<EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=Deskmeter Task Window
|
||||||
|
Exec=/home/mariano/wdir/dm/dmos/task_window.py
|
||||||
|
Hidden=false
|
||||||
|
NoDisplay=false
|
||||||
|
X-GNOME-Autostart-enabled=true
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
### GNOME Extension
|
||||||
|
|
||||||
|
Enabled extensions auto-start with GNOME Shell. Just ensure it's enabled:
|
||||||
|
```bash
|
||||||
|
gnome-extensions enable deskmeter-indicator@local
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Files Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
dmos/
|
||||||
|
├── gnome-extension/
|
||||||
|
│ ├── deskmeter-indicator@local/
|
||||||
|
│ │ ├── extension.js # Main extension code
|
||||||
|
│ │ ├── metadata.json # GNOME metadata
|
||||||
|
│ │ ├── stylesheet.css # Panel styling
|
||||||
|
│ │ └── deskmeter-indicator@local.zip # Packaged extension
|
||||||
|
│ ├── install.sh # Initial installation
|
||||||
|
│ └── update.sh # Update after changes
|
||||||
|
└── task_window.py # GTK4 window app
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Testing Checklist
|
||||||
|
|
||||||
|
### GTK Window
|
||||||
|
- [ ] Window appears without decorations
|
||||||
|
- [ ] Shows current task path
|
||||||
|
- [ ] Can be moved/positioned
|
||||||
|
- [ ] Closes with Alt+F4
|
||||||
|
- [ ] Updates on workspace change (~2s delay)
|
||||||
|
- [ ] Can set always-on-top with wmctrl
|
||||||
|
- [ ] Auto-detects port (check console)
|
||||||
|
|
||||||
|
### GNOME Extension
|
||||||
|
- [ ] Shows in panel (left side)
|
||||||
|
- [ ] Displays current task
|
||||||
|
- [ ] Updates on workspace switch (~2s delay)
|
||||||
|
- [ ] Doesn't crash GNOME Shell if dmweb offline
|
||||||
|
- [ ] Can disable: `gnome-extensions disable deskmeter-indicator@local`
|
||||||
|
- [ ] Truncates long paths correctly
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
### GTK Window
|
||||||
|
- Workspace checks: 200ms interval (lightweight wmctrl)
|
||||||
|
- Task updates: 2000ms interval
|
||||||
|
- Post-switch delay: 2200ms (allows dmcore to update)
|
||||||
|
- CPU usage: ~0.1-0.2%
|
||||||
|
|
||||||
|
### GNOME Extension
|
||||||
|
- Event-driven (workspace switches)
|
||||||
|
- Periodic refresh: 30s
|
||||||
|
- Debounce delay: 2200ms
|
||||||
|
- Minimal overhead (GNOME Shell event loop)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Updating Extension
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd dmos/gnome-extension
|
||||||
|
|
||||||
|
# 1. Edit extension.js, metadata.json, or stylesheet.css
|
||||||
|
|
||||||
|
# 2. Update installed version
|
||||||
|
./update.sh
|
||||||
|
|
||||||
|
# 3. Restart GNOME Shell
|
||||||
|
# X11: Alt+F2 → 'r' → Enter
|
||||||
|
# Wayland: Log out and back in
|
||||||
|
|
||||||
|
# 4. Check logs for errors
|
||||||
|
journalctl -f -o cat /usr/bin/gnome-shell | grep deskmeter
|
||||||
|
```
|
||||||
|
|
||||||
|
### Updating Window
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Edit dmos/task_window.py
|
||||||
|
|
||||||
|
# 2. Kill running instance
|
||||||
|
pkill -f task_window.py
|
||||||
|
|
||||||
|
# 3. Run updated version
|
||||||
|
python3 dmos/task_window.py
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## API Endpoint
|
||||||
|
|
||||||
|
Both components use the same endpoint:
|
||||||
|
|
||||||
|
**URL**: `http://localhost:{PORT}/api/current_task`
|
||||||
|
|
||||||
|
**Response**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"task_id": "abc12345",
|
||||||
|
"task_path": "work/default"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Error Handling**:
|
||||||
|
- Connection refused → "offline"
|
||||||
|
- Invalid JSON → "error"
|
||||||
|
- Missing task_path → "no task"
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Need Help?
|
## Need Help?
|
||||||
|
|
||||||
1. **Start with** [READY_TO_TEST.md](READY_TO_TEST.md) for immediate testing
|
1. **Start dmweb**: `cd dmapp/dmweb && python3 run.py`
|
||||||
2. **For task window issues** see [TASK_WINDOW_README.md](TASK_WINDOW_README.md)
|
2. **Test API**: `curl http://localhost:10000/api/current_task`
|
||||||
3. **For extension issues** see [INSTALL_STATUS.md](INSTALL_STATUS.md)
|
3. **Try window first**: `python3 dmos/task_window.py` (no logout)
|
||||||
4. **For port problems** see [PORT_DETECTION_README.md](PORT_DETECTION_README.md)
|
4. **Check logs**: `journalctl` for extension, console for window
|
||||||
|
5. **Verify ports**: `ss -tlnp | grep -E "(10000|10001)"`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Ready to test!** Start with the GTK window for immediate feedback, then try the extension for permanent integration.
|
||||||
|
|||||||
@@ -1,268 +0,0 @@
|
|||||||
# Ready to Test - Deskmeter Task Display
|
|
||||||
|
|
||||||
**Date**: 2025-12-19
|
|
||||||
**Status**: ✅ All updates complete and ready for testing
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## What's Been Updated
|
|
||||||
|
|
||||||
### 1. Task Window (task_window.py) ✅
|
|
||||||
|
|
||||||
**New Features**:
|
|
||||||
- ✅ **No window decorations** - Clean minimal window, no title bar or close button
|
|
||||||
- ✅ **Workspace change detection** - Updates 2.2s after you switch workspaces
|
|
||||||
- ✅ **Auto port detection** - Finds dmweb on port 10001 or 10000 automatically
|
|
||||||
- ✅ **Faster updates** - Polls every 500ms to catch changes quickly
|
|
||||||
- ✅ **Smaller window** - 400x60px (reduced from 400x80)
|
|
||||||
|
|
||||||
**How to Close**:
|
|
||||||
- `Alt+F4` (keyboard)
|
|
||||||
- `pkill -f task_window.py` (command line)
|
|
||||||
- Kill the terminal where you started it
|
|
||||||
|
|
||||||
### 2. GNOME Extension ✅
|
|
||||||
|
|
||||||
**New Features**:
|
|
||||||
- ✅ **Error handling** - Won't crash GNOME Shell if something fails
|
|
||||||
- ✅ **Auto port detection** - Same as window, tries 10001 then 10000
|
|
||||||
- ✅ **Safe enable/disable** - All operations wrapped in try-catch
|
|
||||||
|
|
||||||
**Updated files in**: `~/.local/share/gnome-shell/extensions/deskmeter-indicator@local/`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## How to Test
|
|
||||||
|
|
||||||
### Option 1: Test Window Now (No Logout Required)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /home/mariano/wdir/dm-gnomeext
|
|
||||||
|
|
||||||
# Run the window
|
|
||||||
python3 task_window.py
|
|
||||||
```
|
|
||||||
|
|
||||||
**Expected behavior**:
|
|
||||||
1. Console shows: `Found dmweb API on port 10001`
|
|
||||||
2. Small window appears showing: **work/own/deskmeter**
|
|
||||||
3. Window has **no title bar** (clean, minimal)
|
|
||||||
4. When you switch workspaces, it updates after ~2 seconds
|
|
||||||
|
|
||||||
**Make it always-on-top** (in another terminal):
|
|
||||||
```bash
|
|
||||||
wmctrl -r "Deskmeter Task" -b add,above,sticky
|
|
||||||
```
|
|
||||||
|
|
||||||
**Position it** where you want (drag with mouse or use wmctrl)
|
|
||||||
|
|
||||||
### Option 2: Test GNOME Extension (Requires Logout)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Verify extension is enabled
|
|
||||||
gnome-extensions list --enabled | grep deskmeter
|
|
||||||
|
|
||||||
# 2. Check extension files are updated
|
|
||||||
ls -la ~/.local/share/gnome-shell/extensions/deskmeter-indicator@local/
|
|
||||||
|
|
||||||
# 3. Log out and log back in
|
|
||||||
|
|
||||||
# 4. After login, check panel for task indicator (left side)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## What You'll See
|
|
||||||
|
|
||||||
### Task Window
|
|
||||||
```
|
|
||||||
┌────────────────────────┐
|
|
||||||
│ work/own/deskmeter │
|
|
||||||
└────────────────────────┘
|
|
||||||
```
|
|
||||||
- No borders, no title bar, just the task text
|
|
||||||
- Clean minimal display
|
|
||||||
- Position anywhere, stays on top
|
|
||||||
|
|
||||||
### GNOME Extension
|
|
||||||
```
|
|
||||||
[Activities] [deskmeter] [detecting...] → [work/own/deskmeter]
|
|
||||||
└─ Panel indicator
|
|
||||||
```
|
|
||||||
- Shows in panel (left side)
|
|
||||||
- "detecting..." while finding port
|
|
||||||
- Then shows current task
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Testing Checklist
|
|
||||||
|
|
||||||
### Window Testing
|
|
||||||
- [ ] Window appears without title bar/decorations
|
|
||||||
- [ ] Shows current task: "work/own/deskmeter"
|
|
||||||
- [ ] Can be moved by dragging
|
|
||||||
- [ ] Can close with Alt+F4
|
|
||||||
- [ ] Updates when you switch workspaces (wait ~2s after switch)
|
|
||||||
- [ ] Can be set always-on-top with wmctrl
|
|
||||||
- [ ] Auto-detects port 10001 (check console output)
|
|
||||||
|
|
||||||
### Extension Testing (after logout/login)
|
|
||||||
- [ ] Extension shows in panel (left side)
|
|
||||||
- [ ] Shows "detecting..." briefly
|
|
||||||
- [ ] Shows current task after detection
|
|
||||||
- [ ] Updates when switching workspaces (wait ~2s)
|
|
||||||
- [ ] If extension fails, GNOME Shell still works (doesn't crash)
|
|
||||||
- [ ] Can disable extension: `gnome-extensions disable deskmeter-indicator@local`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Window shows "offline - dmweb not running"
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check if dmweb is running
|
|
||||||
ps aux | grep dmweb
|
|
||||||
|
|
||||||
# Check what's on port 10001
|
|
||||||
curl http://localhost:10001/api/current_task
|
|
||||||
|
|
||||||
# Should show: {"task_id":"8f797adb","task_path":"work/own/deskmeter"}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Window doesn't update on workspace change
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Test wmctrl is working
|
|
||||||
wmctrl -d
|
|
||||||
|
|
||||||
# Should show workspaces with * marking current one
|
|
||||||
```
|
|
||||||
|
|
||||||
### Window won't stay on top
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# After starting window, in another terminal:
|
|
||||||
wmctrl -r "Deskmeter Task" -b add,above,sticky
|
|
||||||
|
|
||||||
# Verify it worked:
|
|
||||||
wmctrl -l -x | grep -i deskmeter
|
|
||||||
```
|
|
||||||
|
|
||||||
### Extension doesn't appear in panel after logout/login
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check if enabled
|
|
||||||
gnome-extensions list --enabled | grep deskmeter
|
|
||||||
|
|
||||||
# Check for errors
|
|
||||||
journalctl --user -u org.gnome.Shell@wayland.service --since "5 minutes ago" | grep -i deskmeter
|
|
||||||
|
|
||||||
# Try manually enabling
|
|
||||||
gnome-extensions enable deskmeter-indicator@local
|
|
||||||
# Then logout/login again
|
|
||||||
```
|
|
||||||
|
|
||||||
### Extension shows "detecting..." forever
|
|
||||||
|
|
||||||
dmweb is not running on any of the tried ports (10001, 10000). Start dmweb:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd ~/wdir/dm/dmapp/dmweb # or wherever your dmweb is
|
|
||||||
python3 run.py
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Performance Notes
|
|
||||||
|
|
||||||
### Task Window
|
|
||||||
- Checks workspace every 200ms (lightweight wmctrl call)
|
|
||||||
- Updates task every 500ms when no workspace change
|
|
||||||
- After workspace change: waits 2200ms before updating (gives dmcore time)
|
|
||||||
- Minimal CPU usage: ~0.1-0.2%
|
|
||||||
|
|
||||||
### GNOME Extension
|
|
||||||
- Only updates on workspace switch + periodic refresh
|
|
||||||
- Uses debounce delay of 2200ms
|
|
||||||
- Minimal overhead, integrated with GNOME Shell event loop
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Commands Quick Reference
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Start task window
|
|
||||||
cd /home/mariano/wdir/dm-gnomeext
|
|
||||||
python3 task_window.py
|
|
||||||
|
|
||||||
# Make window always-on-top + sticky (all workspaces)
|
|
||||||
wmctrl -r "Deskmeter Task" -b add,above,sticky
|
|
||||||
|
|
||||||
# Position window (example: top-right corner)
|
|
||||||
wmctrl -r "Deskmeter Task" -e 0,1500,0,400,60
|
|
||||||
|
|
||||||
# Close window
|
|
||||||
pkill -f task_window.py
|
|
||||||
# OR
|
|
||||||
Alt+F4 (when window has focus)
|
|
||||||
|
|
||||||
# Check extension status
|
|
||||||
gnome-extensions list --enabled | grep deskmeter
|
|
||||||
|
|
||||||
# View extension logs
|
|
||||||
journalctl --user -u org.gnome.Shell@wayland.service -f | grep deskmeter
|
|
||||||
|
|
||||||
# Test API manually
|
|
||||||
curl http://localhost:10001/api/current_task
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
1. **Test the window now** - No logout required, immediate feedback
|
|
||||||
2. **When satisfied with window behavior** - Log out/in to test extension
|
|
||||||
3. **Choose your preference**:
|
|
||||||
- Use window for now (quick to start/stop)
|
|
||||||
- Use extension after logout (cleaner, integrated into panel)
|
|
||||||
- Use both (why not?)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## File Locations
|
|
||||||
|
|
||||||
```
|
|
||||||
/home/mariano/wdir/dm-gnomeext/
|
|
||||||
├── task_window.py ← Updated window app
|
|
||||||
├── run_task_window.sh ← Helper script (can also use directly)
|
|
||||||
├── gnome-extension/
|
|
||||||
│ └── deskmeter-indicator@local/ ← Source (updated)
|
|
||||||
│ ├── extension.js ✅ Error handling added
|
|
||||||
│ ├── metadata.json ✅ GNOME 49 support
|
|
||||||
│ └── stylesheet.css
|
|
||||||
└── ~/.local/share/gnome-shell/extensions/
|
|
||||||
└── deskmeter-indicator@local/ ← Installed (updated)
|
|
||||||
├── extension.js ✅ Error handling added
|
|
||||||
├── metadata.json ✅ GNOME 49 support
|
|
||||||
└── stylesheet.css
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
- `INSTALL_STATUS.md` - Extension installation troubleshooting
|
|
||||||
- `PORT_DETECTION_README.md` - How auto port detection works
|
|
||||||
- `TASK_WINDOW_README.md` - Task window usage guide
|
|
||||||
- `READY_TO_TEST.md` - This file
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Everything is ready! Start with the window test - it's the quickest way to verify everything works.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 task_window.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Then when you're ready, log out/in to test the extension.
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
# Deskmeter Task Window - Regular Mode
|
|
||||||
|
|
||||||
A simple GTK4 window that displays your current deskmeter task, with always-on-top and sticky (visible on all workspaces) properties.
|
|
||||||
|
|
||||||
## Why Use This?
|
|
||||||
|
|
||||||
- **Testing**: Test the dmweb API integration without needing to restart GNOME Shell
|
|
||||||
- **Temporary solution**: Use while waiting to log out/in to activate the extension
|
|
||||||
- **Standalone mode**: If you prefer a window instead of a panel indicator
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Python 3 with GTK4 bindings (`python3-gi`)
|
|
||||||
- dmweb server running on `http://localhost:10000`
|
|
||||||
- `wmctrl` installed (for always-on-top functionality)
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
### Option 1: Using the launcher script (recommended)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /home/mariano/wdir/dm-gnomeext
|
|
||||||
./run_task_window.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
This will:
|
|
||||||
1. Start the task window
|
|
||||||
2. Automatically set it to always-on-top
|
|
||||||
3. Make it visible on all workspaces (sticky)
|
|
||||||
|
|
||||||
### Option 2: Run Python script directly
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /home/mariano/wdir/dm-gnomeext
|
|
||||||
python3 task_window.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Then manually set window properties:
|
|
||||||
- Right-click window title bar → "Always on Top"
|
|
||||||
- Right-click window title bar → "Always on Visible Workspace" (if available)
|
|
||||||
|
|
||||||
Or use wmctrl:
|
|
||||||
```bash
|
|
||||||
# After window appears
|
|
||||||
wmctrl -r "Deskmeter Task" -b add,above,sticky
|
|
||||||
```
|
|
||||||
|
|
||||||
## What You'll See
|
|
||||||
|
|
||||||
- **Loading...** - Initial state while fetching first task
|
|
||||||
- **work/default** - Your current task path (updates every 2.2 seconds)
|
|
||||||
- **offline - dmweb not running** (red) - Cannot connect to API
|
|
||||||
- **error - invalid API response** (orange) - API returned invalid JSON
|
|
||||||
- **no task** - Valid response but no current task set
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Edit `task_window.py` to customize:
|
|
||||||
|
|
||||||
```python
|
|
||||||
UPDATE_INTERVAL = 2200 # Update frequency in milliseconds
|
|
||||||
DESKMETER_API_URL = 'http://localhost:10000/api/current_task' # API endpoint
|
|
||||||
```
|
|
||||||
|
|
||||||
Window appearance (line ~24):
|
|
||||||
```python
|
|
||||||
self.set_default_size(400, 80) # Width x Height
|
|
||||||
```
|
|
||||||
|
|
||||||
Font size and styling (line ~27):
|
|
||||||
```python
|
|
||||||
self.label.set_markup('<span font_desc="14">Loading...</span>')
|
|
||||||
```
|
|
||||||
|
|
||||||
## 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 <<EOF
|
|
||||||
[Desktop Entry]
|
|
||||||
Type=Application
|
|
||||||
Name=Deskmeter Task Window
|
|
||||||
Exec=/home/mariano/wdir/dm-gnomeext/run_task_window.sh
|
|
||||||
Hidden=false
|
|
||||||
NoDisplay=false
|
|
||||||
X-GNOME-Autostart-enabled=true
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
## Files
|
|
||||||
|
|
||||||
- `task_window.py` - Main GTK4 Python application
|
|
||||||
- `run_task_window.sh` - Launcher script with wmctrl integration
|
|
||||||
- `TASK_WINDOW_README.md` - This file
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
Once you've tested that the API integration works with this window, you can log out/in to test the GNOME extension, which will provide the same information in the panel without taking up window space.
|
|
||||||
Reference in New Issue
Block a user