#ifndef DESKBAR_H #define DESKBAR_H #include #include #include #include #include #include #include #include #include #include /* * SkyDeskbar — modern dark panel, docked top-right. * * ┌──────────────────────────┐ * │ [Sky ▾] │ 12:00 PM │ <- top strip: menu + clock * │ │ Wed Jul 23 │ <- date line * ├──────────────────────────┤ * │ [F] Firefox ▸ │ <- app entries (letter icon + name) * │ [T] Thunar ▸ │ * │ [X] [xterm] ▸ │ <- minimized: bracketed + dimmed * ├──────────────────────────┤ * │ [1] [2] [3] [4] │ <- workspace strip * ├──────────────────────────┤ * │ CPU 12% MEM 45% │ <- status bar * └──────────────────────────┘ */ /* ── layout ──────────────────────────────────────────────────────────── */ #define DB_W 200 /* deskbar total width */ #define DB_TOP_H 52 /* top strip height (menu + clock + date) */ #define DB_MENU_W 68 /* width of the Sky menu button */ #define DB_ITEM_H 26 /* app entry row height */ #define DB_ICON_SZ 18 /* app icon square size */ #define DB_WS_H 28 /* workspace strip height */ #define DB_STATUS_H 22 /* status bar height */ #define DB_MAX_APPS 32 /* ── fly-out menu ────────────────────────────────────────────────────── */ #define DB_FLYOUT_W 196 /* fly-out menu panel width */ #define DB_FLYOUT_IH 28 /* item row height */ #define DB_FLYOUT_SH 8 /* separator height */ #define DB_FLYOUT_PAD 4 /* top/bottom outer padding */ #define DB_FLYOUT_LPD 13 /* left label padding */ /* ── modern dark palette ──────────────────────────────────────────────── */ #define DB_COL_BG 0x111520 /* dark navy body */ #define DB_COL_MENU_BG 0x0E1A32 /* menu button bg */ #define DB_COL_LOGO_TEXT 0x90BBEE /* "Sky" text */ #define DB_COL_ITEM_BG 0x141828 /* app row bg */ #define DB_COL_ITEM_ALT 0x111520 /* alternate row */ #define DB_COL_ITEM_HOV 0x1E4878 /* hover — blue */ #define DB_COL_ITEM_FOCUS 0x183860 /* focused window row */ #define DB_COL_ITEM_TEXT 0xC0D0E8 /* normal app name */ #define DB_COL_ITEM_HTXT 0xF0F6FF /* text on hover/focus */ #define DB_COL_ITEM_MINI 0x485868 /* dimmed minimized text */ #define DB_COL_DIVIDER 0x1C2030 /* row separator */ #define DB_COL_WS_ACTIVE 0x1E58A8 /* active workspace */ #define DB_COL_WS_INACT 0x202838 /* inactive workspace */ #define DB_COL_WS_TEXT 0x8AB0D0 /* workspace number */ #define DB_COL_CLOCK_TXT 0xD8E8FF /* clock text */ #define DB_COL_DATE_TXT 0x5878A0 /* date text */ #define DB_COL_STATUS_TXT 0x486080 /* status text */ #define DB_COL_BORDER_L 0x223050 /* bevel light */ #define DB_COL_BORDER_D 0x080C14 /* bevel dark */ #define DB_COL_ACCENT 0x1E58A8 /* accent stripe */ /* ── fonts ───────────────────────────────────────────────────────────── */ #define DB_FONT_UI "Sans:size=9" #define DB_FONT_MENU "Sans:size=10:weight=bold" #define DB_FONT_CLOCK "Sans:size=11:weight=bold" #define DB_FONT_DATE "Sans:size=8" #define DB_FONT_ICON "Sans:size=8:weight=bold" /* ── app icon color palette (cycled by name hash) ────────────────────── */ static const unsigned long DB_ICON_COLORS[] = { 0x2060A0, /* blue */ 0x206040, /* forest green */ 0x804020, /* burnt orange */ 0x602080, /* purple */ 0x208060, /* teal */ 0x802040, /* crimson */ 0x406020, /* olive */ 0x204060, /* dark blue */ }; #define DB_ICON_NCOLORS 8 typedef struct AppEntry { Window win; char title[64]; int focused; int minimized; } AppEntry; typedef struct Deskbar { Display *dpy; int screen; Window root; Window win; GC gc; Colormap cmap; Visual *visual; int depth; XftFont *font_ui; XftFont *font_menu; XftFont *font_clock; XftFont *font_date; XftFont *font_icon; int bar_h; int hovered; int cur_ws; int num_ws; AppEntry apps[DB_MAX_APPS]; int napps; Atom net_client_list; Atom net_active_window; Atom net_current_desktop; Atom net_number_of_desktops; Atom net_wm_name; Atom utf8_string; /* fly-out menu state */ Window menu_win; /* main fly-out, None when closed */ Window sub_win; /* sub-menu panel, None when closed */ int menu_hov; /* hovered item index in main menu, -1 = none */ int sub_active; /* which sub-menu is open: 0=Apps, 1=Settings, -1=none */ int sub_hov; /* hovered item in sub-menu */ int sw_cache; /* cached screen width for menu positioning */ } Deskbar; void db_init(Deskbar *db); void db_run(Deskbar *db); void db_draw(Deskbar *db); void db_update_apps(Deskbar *db); void db_update_workspace(Deskbar *db); void db_resize(Deskbar *db); void db_click(Deskbar *db, int x, int y); void db_hover(Deskbar *db, int x, int y); void db_menu_open(Deskbar *db); void db_menu_close(Deskbar *db); unsigned long db_color(Deskbar *db, unsigned long rgb); void db_xft_color(Deskbar *db, unsigned long rgb, XftColor *out); int db_apps_y(void); int db_ws_y(Deskbar *db); #endif