An open API service indexing awesome lists of open source software.

https://github.com/sharadcodes/deskpat


https://github.com/sharadcodes/deskpat

Last synced: 25 days ago
JSON representation

Awesome Lists containing this project

README

          

# ๐Ÿ’ป DESKPAT: Spanned Wallpaper & System Dashboard

Welcome to **DESKPAT** (derived from the Hindi word **เคชเคŸ (Pat)**, meaning *screen, canvas, or backdrop*), a modular, spanned multi-monitor wallpaper generator and real-time developer status HUD. Turn your empty desktop workspace into an elegant, custom-rendered dashboard.

![DESKPAT Showcase](deskpat_promo.png)

> [!NOTE]
> **OS Compatibility Support**:
> * **Windows**: Fully supported and tested.
> * **macOS & Linux**: Core telemetry queries, multi-monitor display calculations, and background setters are implemented but currently **untested/experimental**. If you run these platforms, feedback and pull requests are highly welcome!

---

## โœจ Features

* ๐Ÿ“ **Display Spanning**: Dynamically queries monitor coordinates, resolutions, and scaling factors to compile a single unified wallpaper canvas spanning all screens.
* ๐Ÿ“Š **Live Diagnostics**: Built-in telemetry sensors track system uptime, local IP address, RAM/CPU load, and custom registered variables.
* ๐Ÿ“‹ **Todo Checklist CLI**: Interactively append, complete, and clear tasks from your checklist directly using CLI commands.
* ๐ŸŽจ **HTML/CSS Visual Templates**: Design and render layouts using modern web technologies (compiled via headless Puppeteer).
* ๐Ÿ”Œ **Scriptable Fetchers**: Execute custom scripts (Node.js, Python, PowerShell, or Bash) to pull dynamic external APIs (quotes, weather, RSS feeds) into your background.

---

## ๐Ÿ“‚ Project Structure

All core implementation files are stored in `deskpat_src/` to keep your root directory clean:

```text
deskpat/
โ”‚
โ”œโ”€โ”€ deskpat.bat / deskpat.ps1 # Root wrappers (launchers)
โ”œโ”€โ”€ README.md # This guide
โ”œโ”€โ”€ deskpat_promo.png # Promotional banner
โ””โ”€โ”€ deskpat_src/
โ”œโ”€โ”€ deskpat.py # Python orchestrator & monitor engine
โ”œโ”€โ”€ sensors.py # System telemetry sensor plugins
โ”œโ”€โ”€ render.js # Puppeteer HTML screenshot render engine
โ”œโ”€โ”€ config.json # Theme & default configurations
โ”œโ”€โ”€ todo.json # Local tasks list database
โ”œโ”€โ”€ data.json # Standardized API payload context
โ”œโ”€โ”€ scripts/ # Custom fetchers folder
โ”‚ โ”œโ”€โ”€ sadhguru.js # Dynamic quotes & feeds fetcher
โ”‚ โ””โ”€โ”€ template.js # Fetcher boilerplate template
โ””โ”€โ”€ templates/ # HTML layout templates
โ”œโ”€โ”€ default/ # Glassmorphic full-stats dashboard
โ””โ”€โ”€ minimal/ # Joyful split layout (Checklist & Quotes)
```

---

## โšก Quick Start & Setup

### 1. Prerequisites
Ensure you have the following installed on your computer:
* **Python 3.x** (with `pip` in your system `PATH`)
* **Node.js & npm** (with `node` in your system `PATH`)

### 2. Dependency Initialization
When you run the tool for the first time, it automatically installs any missing dependencies:
* **Python**: `Pillow` (PIL) library
* **Node.js**: `puppeteer` (headless compiler)

### 3. Running the Engine
To fetch the latest data, build the layout canvas, and set the Span desktop wallpaper, run the launcher for your shell:

```bash
# Using Batch (Windows CMD)
.\deskpat.bat

# Using PowerShell
.\deskpat.ps1

# Directly via Python
python deskpat_src/deskpat.py
```

---

## โฐ Pro-Tip: Automate Updates with Task Scheduler

To re-apply the generated wallpaper after Windows sign-in and keep system stats fresh, register two current-user tasks:

* `Deskpat-AtLogon` runs once after sign-in. The 30-second delay gives Windows time to initialize the monitor layout before Deskpat generates the spanned wallpaper.
* `Deskpat-Every15Min` refreshes the wallpaper every 15 minutes so uptime, RAM, todos, and fetched content stay current.

### On Windows (via PowerShell)
Run this command from the project root. Administrator PowerShell is not required for the current-user task:

```powershell
$taskName = "Deskpat-AtLogon"
$deskpat = "C:\SOFTWARES\deskpat\deskpat.ps1"

$action = New-ScheduledTaskAction `
-Execute "powershell.exe" `
-Argument "-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$deskpat`"" `
-WorkingDirectory "C:\SOFTWARES\deskpat"

$trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
$trigger.Delay = "PT30S"

$settings = New-ScheduledTaskSettingsSet `
-StartWhenAvailable `
-AllowStartIfOnBatteries `
-DontStopIfGoingOnBatteries

Register-ScheduledTask `
-TaskName $taskName `
-Action $action `
-Trigger $trigger `
-Settings $settings `
-Description "Run Deskpat wallpaper generator after user logon" `
-Force
```

Register the repeating refresh task:

```powershell
$taskName = "Deskpat-Every15Min"
$deskpat = "C:\SOFTWARES\deskpat\deskpat.ps1"

$action = New-ScheduledTaskAction `
-Execute "powershell.exe" `
-Argument "-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$deskpat`"" `
-WorkingDirectory "C:\SOFTWARES\deskpat"

$trigger = New-ScheduledTaskTrigger `
-Once `
-At (Get-Date).AddMinutes(1) `
-RepetitionInterval (New-TimeSpan -Minutes 15) `
-RepetitionDuration (New-TimeSpan -Days 3650)

$settings = New-ScheduledTaskSettingsSet `
-StartWhenAvailable `
-AllowStartIfOnBatteries `
-DontStopIfGoingOnBatteries

Register-ScheduledTask `
-TaskName $taskName `
-Action $action `
-Trigger $trigger `
-Settings $settings `
-Description "Update Deskpat wallpaper every 15 minutes" `
-Force
```

The refresh interval is customizable. Change `New-TimeSpan -Minutes 15` to any interval you want, such as `New-TimeSpan -Minutes 5` or `New-TimeSpan -Minutes 30`. Shorter intervals work, but each run launches Puppeteer and rewrites the wallpaper, so 15 minutes is a practical default.

Verify the task without signing out:

```powershell
Start-ScheduledTask -TaskName "Deskpat-Every15Min"
Get-ScheduledTaskInfo -TaskName "Deskpat-Every15Min" |
Select-Object LastRunTime, LastTaskResult

schtasks /Query /TN Deskpat-Every15Min /FO LIST /V
```

`LastTaskResult` should be `0`, and `schtasks` should show `Repeat: Every: 0 Hour(s), 15 Minute(s)`. You can also confirm Windows is caching the correct spanned wallpaper dimensions:

```powershell
Add-Type -AssemblyName System.Drawing
$path = "$env:APPDATA\Microsoft\Windows\Themes\TranscodedWallpaper"
$img = [System.Drawing.Image]::FromFile($path)
try {
[pscustomobject]@{ Width = $img.Width; Height = $img.Height }
} finally {
$img.Dispose()
}
```

For a two-monitor layout, the cached dimensions should match the full virtual desktop canvas, not a single monitor. For example, a 2560x1440 primary plus a 1920x1080 secondary may produce a `4480x1440` spanned cache.

Remove the task if needed:

```powershell
Unregister-ScheduledTask -TaskName "Deskpat-AtLogon" -Confirm:$false
Unregister-ScheduledTask -TaskName "Deskpat-Every15Min" -Confirm:$false
```

### On macOS / Linux (via Cron)
Add a crontab entry to execute the orchestrator:
```bash
# Run crontab -e and append:
*/15 * * * * cd /path/to/deskpat && ./deskpat.bat >/dev/null 2>&1
```

---

## ๐Ÿ› ๏ธ CLI Options

The orchestrator CLI accepts arguments to override default configurations:

| Option | Description |
| :--- | :--- |
| `--script ` | Run a custom data fetcher script from `scripts/` (e.g. `--script sadhguru.js`) |
| `--template ` | Render a specific layout template folder (e.g. `--template default`) |
| `--url ` | Fetch raw text or JSON data directly from a web URL (bypassing custom scripts) |
| `--select` | Interactively list and pick an available template in the console |

*Note: Any unrecognized arguments are automatically forwarded straight to your custom script (e.g. `deskpat --script my_script.py --city "Seattle"`).*

---

## ๐Ÿ“‹ Local Todo Subcommand

DESKPAT includes a built-in command-line task checklist manager. Running these commands will modify `todo.json`, and the changes will render on your desktop checklist instantly on the next background update:

| Command | Description |
| :--- | :--- |
| `deskpat todo list` | List all active checklist tasks |
| `deskpat todo add "Task"` | Add a new task to your checklist |
| `deskpat todo done ` | Toggle completion status of task `` (e.g. `deskpat todo done 1`) |
| `deskpat todo remove `| Remove task `` from the checklist |
| `deskpat todo clear` | Clear all tasks |

---

## ๐Ÿ”Œ Extensibility & Customization

### 1. Writing Custom Data Fetchers
You can drop scripts into `deskpat_src/scripts/`. Fetcher scripts can be written in **Node.js (`.js`)**, **Python (`.py`)**, **PowerShell (`.ps1`)**, or **Shell (`.sh`/`.bat`)**.
* **Requirement**: The script must output a clean JSON object to `stdout`.
* The orchestrator automatically executes your script, parses its output, and saves it into `data.json`.

### 2. Creating New Visual Layouts
Templates are stored under `deskpat_src/templates/`. To build your own:
1. Create a folder (e.g., `templates/custom-dashboard/`).
2. Add a `template.html` and `style.css`.
3. In `template.html`, read the global context `window.wallpaperData` in JavaScript to populate your fields.
4. Set it as default in `config.json` or call `deskpat --template custom-dashboard`.

### 3. Adding New Modular OS/System Sensors
OS-level metrics are queried via `deskpat_src/sensors.py`. To add a new system stat (e.g., free disk space, CPU temperature, or battery level):
1. Open `sensors.py` and write a Python function.
2. Register it using the `@sensor("metric_name")` decorator.

```python
@sensor("disk_free_gb")
def get_disk_free():
import shutil
total, used, free = shutil.disk_usage("/")
return round(free / (1024**3), 1)
```

This variable automatically loads into `data.json` and becomes instantly available inside your HTML templates in JavaScript at `window.wallpaperData.system.disk_free_gb`!