Skip to content

Implement desktop shell (panel, wallpaper, launcher) #409

Description

@pbalduino

Summary

Implement the desktop shell that provides the desktop environment, including panel/taskbar, wallpaper, application launcher, and system tray.

Goals

  • Desktop background/wallpaper
  • Panel/taskbar at top or bottom
  • Application launcher menu
  • System tray (clock, volume, etc.)
  • Window list in panel
  • Logout/shutdown menu

Implementation

Desktop Background

```c
void desktop_draw_background() {
cairo_t *cr = cairo_create(screen_surface);

// Solid color or gradient
cairo_set_source_rgb(cr, 0.15, 0.15, 0.20);
cairo_paint(cr);

// Or load wallpaper image
// cairo_surface_t *wallpaper = cairo_image_surface_create_from_png(...);
// cairo_set_source_surface(cr, wallpaper, 0, 0);
// cairo_paint(cr);

cairo_destroy(cr);

}
```

Panel

```c
#define PANEL_HEIGHT 28

void panel_draw() {
cairo_t *cr = cairo_create(screen_surface);

// Panel background
cairo_rectangle(cr, 0, 0, screen_width, PANEL_HEIGHT);
cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
cairo_fill(cr);

// Application menu button
draw_button(cr, 5, 2, 80, 24, "Applications");

// Window list
int x = 100;
for (struct window *w = windows; w; w = w->next) {
    draw_button(cr, x, 2, 100, 24, w->title);
    x += 105;
}

// System tray (right side)
draw_clock(cr, screen_width - 100, 2);
draw_volume_icon(cr, screen_width - 150, 2);

cairo_destroy(cr);

}
```

Application Launcher

```c
struct app_entry {
const char *name;
const char *exec;
const char *icon;
};

struct app_entry apps[] = {
{ "Terminal", "/bin/terminal", "terminal.png" },
{ "Text Editor", "/bin/editor", "editor.png" },
{ "File Manager", "/bin/files", "folder.png" },
{ "Calculator", "/bin/calc", "calc.png" },
{ NULL, NULL, NULL }
};

void launcher_show_menu() {
// Draw menu popup
cairo_t *cr = cairo_create(screen_surface);

int y = PANEL_HEIGHT + 5;
for (int i = 0; apps[i].name; i++) {
    draw_menu_item(cr, 5, y, 200, 30, apps[i].name, apps[i].icon);
    y += 35;
}

cairo_destroy(cr);

}

void launcher_exec(const char *command) {
if (fork() == 0) {
execl(command, command, NULL);
exit(1);
}
}
```

Timeline

Total: 3-4 weeks

Definition of Done

  • Desktop background renders
  • Panel/taskbar displays
  • Application launcher works
  • Can launch applications from menu
  • System tray shows clock
  • Window list shows open windows
  • Professional desktop appearance

Dependencies

See docs/road/road_to_gui.md for complete roadmap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GUIGraphical user interface componentsenhancementNew feature or request

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions