# Wii Desktop Environment

A Wii System Menu-style X11 window manager / app launcher written in C.

## Features
- Fullscreen channel grid layout (4×3 tiles, scrollable)
- Apps sourced automatically from `.desktop` files
- Pulsing glow ring on focused channel
- Double-buffered rendering (flicker-free)
- Works as a standalone WM **or** as a fullscreen overlay on top of an existing WM
- Pure Xlib — no extra toolkits

## Dependencies

| Package          | Debian/Ubuntu              | Fedora/RHEL          | Arch          |
|------------------|----------------------------|----------------------|---------------|
| Xlib headers     | `libx11-dev`               | `libX11-devel`       | `libx11`      |
| C compiler       | `build-essential`          | `gcc make`           | `base-devel`  |
| math lib         | _(included with libc)_     | same                 | same          |

```bash
# Debian/Ubuntu
sudo apt install libx11-dev build-essential

# Arch
sudo pacman -S libx11 base-devel
```

## Build

```bash
make
```

The binary `wii_wm` appears in the project root.

## Run

### As an overlay (test inside your current desktop)
```bash
./wii_wm
```
A fullscreen Wii-style menu will appear. Press `Q` or `Escape` to exit.

### As a standalone window manager (startx)
Add to `~/.xinitrc`:
```bash
exec /path/to/wii_wm
```
Then start with `startx`.

### As a display-manager session
Create `/usr/share/xsessions/wii-wm.desktop`:
```ini
[Desktop Entry]
Name=Wii WM
Exec=/usr/local/bin/wii_wm
Type=Application
```
Install with `make install`, then select "Wii WM" from your login manager.

## Controls

| Key                     | Action                         |
|-------------------------|--------------------------------|
| ← → ↑ ↓  (arrow keys)  | Navigate channels              |
| `h j k l`               | Vi-style navigation            |
| `Enter`                 | Launch focused app             |
| `Page Up / Page Down`   | Scroll page                    |
| `Q` / `Escape`          | Quit                           |

## Extending

### Adding real icons
Install **Imlib2** and add to `renderer.c`:
```bash
sudo apt install libimlib2-dev
```
Then use `imlib_load_image(icon_path)` to render app icons instead of the
coloured initial block.

### Theming
Edit the `alloc_color()` calls in `renderer_init()` inside `renderer.c`.
The palette is defined in the `WiiColors` struct.

### Grid layout
Adjust `COLS`, `ROWS`, `TILE_W`, `TILE_H`, `TILE_GAP` in `renderer.h`.

### Custom app sources
Call `desktop_parse_file("/path/to/myapp.desktop", &list)` before the
renderer is initialised in `wii_wm.c`.

## Project layout

```
wii-wm/
├── Makefile
├── README.md
└── src/
    ├── wii_wm.c           # main entry, X11 setup, event loop
    ├── desktop_parser.c/h # .desktop file scanning and parsing
    ├── renderer.c/h       # Wii-style channel grid drawing
    └── launcher.c/h       # fork/exec app launching
```

## Caveats
- No icon rendering out of the box (coloured initials shown instead)
- No mouse support yet (keyboard-only navigation)
- Single monitor only
- No EWMH/ICCCM compliant WM management beyond basic MapRequest/ConfigureRequest