macOS-style polish: fix seam, bidirectional Alt+Tab, minimized windows in switcher, rounded corners, deskbar context menu

Fix #1: Replace hardcoded 185px deskbar-offset in client.c and events.c with
DESKBAR_W constant (200) to eliminate the 15px gap between the WM frame and
deskbar edge.

Fix #2: Add Shift+Alt+Tab reverse-direction support — grab Mod1+Shift+XK_Tab
in wm.c, detect ShiftMask in events.c, and implement switcher_prev() in
switcher.c.

Fix #3: Include minimized windows in the Alt+Tab switcher. swl_populate() no
longer skips minimized clients; swl_mini[] tracks state so switcher_draw()
can dim them with bracketed titles and darker card backgrounds.

Fix #4: Rewrite themes/picom.conf with macOS-inspired settings — 10px corner
radius on normal windows, 8px on menus, soft downward shadow (radius 18,
offset-y 8, opacity 0.35), smooth fading (step 0.08), no dock/tray rounding.

Fix #5: Add per-app right-click context menu to the deskbar. Right-clicking
an app row opens a popup with Raise / Minimize / Close actions (Close shown
in red). Actions are sent as EWMH client messages (_NET_ACTIVE_WINDOW,
WM_CHANGE_STATE+IconicState, _NET_CLOSE_WINDOW) with matching handlers added
to the WM's on_client_message. Pointer grab closes the menu on any outside
click.
This commit is contained in:
Claude committed 2026-08-30 19:51:54 +00:00
1 parent 0d874617dd
commit 36641e77e2
8 files changed
+311 -42

No files matched your search

+34 -12
View File
@@ -8,17 +8,19 @@
static void swl_populate(WM *wm) {
wm->swl_count = 0;
/* current focused window goes first */
/* current focused (non-minimized) window goes first */
if (wm->focused && !wm->focused->minimized) {
wm->swl_wins[0] = wm->focused->win;
wm->swl_wins[0] = wm->focused->win;
wm->swl_mini[0] = 0;
strncpy(wm->swl_titles[0], wm->focused->title, 127);
wm->swl_titles[0][127] = '\0';
wm->swl_count = 1;
}
/* all other windows, including minimized ones */
for (Client *c = wm->clients; c && wm->swl_count < 64; c = c->next) {
if (c->minimized) continue;
if (wm->focused && c == wm->focused) continue;
wm->swl_wins[wm->swl_count] = c->win;
wm->swl_wins[wm->swl_count] = c->win;
wm->swl_mini[wm->swl_count] = c->minimized;
strncpy(wm->swl_titles[wm->swl_count], c->title, 127);
wm->swl_titles[wm->swl_count][127] = '\0';
wm->swl_count++;
@@ -61,29 +63,34 @@ void switcher_draw(WM *wm) {
for (int vi = 0; vi < vis; vi++) {
int i = vstart + vi;
int selected = (i == wm->swl_idx);
int mini = wm->swl_mini[i];
int ix = SWL_PAD + vi * (SWL_ITEM_W + SWL_PAD);
int iy = SWL_PAD;
unsigned long card_bg = color_alloc(wm, selected ? COLOR_TITLE_ACTIVE : 0x1C2338);
unsigned long card_bg = color_alloc(wm,
selected ? COLOR_TITLE_ACTIVE : (mini ? 0x141820 : 0x1C2338));
XSetForeground(wm->dpy, wm->gc, card_bg);
XFillRectangle(wm->dpy, wm->swl_win, wm->gc, ix, iy, SWL_ITEM_W, SWL_ITEM_H);
XSetForeground(wm->dpy, wm->gc,
color_alloc(wm, selected ? COLOR_BORDER_LIGHT : 0x242C3E));
color_alloc(wm, selected ? COLOR_BORDER_LIGHT : (mini ? 0x202028 : 0x242C3E)));
XDrawRectangle(wm->dpy, wm->swl_win, wm->gc, ix, iy, SWL_ITEM_W - 1, SWL_ITEM_H - 1);
/* letter icon */
/* letter icon — dimmed for minimized */
int icon_x = ix + (SWL_ITEM_W - SWL_ICON_SZ) / 2;
int icon_y = iy + 8;
XSetForeground(wm->dpy, wm->gc,
color_alloc(wm, selected ? 0x285898 : 0x182538));
color_alloc(wm, selected ? 0x285898 : (mini ? 0x1A1E28 : 0x182538)));
XFillRectangle(wm->dpy, wm->swl_win, wm->gc, icon_x, icon_y, SWL_ICON_SZ, SWL_ICON_SZ);
char letter[2] = { wm->swl_titles[i][0] ? wm->swl_titles[i][0] : '?', '\0' };
if (letter[0] >= 'a' && letter[0] <= 'z') letter[0] -= 32;
unsigned long icon_rgb = selected ? COLOR_TITLE_TEXT_ACT
: (mini ? 0x3A4860
: COLOR_TITLE_TEXT_INACT);
XftColor icon_col;
xft_color(wm, selected ? COLOR_TITLE_TEXT_ACT : COLOR_TITLE_TEXT_INACT, &icon_col);
xft_color(wm, icon_rgb, &icon_col);
XGlyphInfo ext;
XftTextExtentsUtf8(wm->dpy, wm->font_title, (const FcChar8 *)letter, 1, &ext);
int lx = icon_x + (SWL_ICON_SZ - (int)ext.width) / 2;
@@ -91,10 +98,19 @@ void switcher_draw(WM *wm) {
XftDrawStringUtf8(xd, &icon_col, wm->font_title, lx, ly, (const FcChar8 *)letter, 1);
XftColorFree(wm->dpy, wm->visual, wm->cmap, &icon_col);
/* title below icon */
const char *title = wm->swl_titles[i];
/* title below icon — prefix [..] for minimized */
char title_buf[132];
const char *base_title = wm->swl_titles[i];
if (mini && !selected)
snprintf(title_buf, sizeof(title_buf), "[%s]", base_title);
else
snprintf(title_buf, sizeof(title_buf), "%s", base_title);
const char *title = title_buf;
XftColor title_col;
xft_color(wm, selected ? COLOR_TITLE_TEXT_ACT : COLOR_TITLE_TEXT_INACT, &title_col);
unsigned long title_rgb = selected ? COLOR_TITLE_TEXT_ACT
: (mini ? 0x3A4860
: COLOR_TITLE_TEXT_INACT);
xft_color(wm, title_rgb, &title_col);
XGlyphInfo text_ext;
XftTextExtentsUtf8(wm->dpy, wm->font_title,
(const FcChar8 *)title, strlen(title), &text_ext);
@@ -163,6 +179,12 @@ void switcher_next(WM *wm) {
switcher_draw(wm);
}
void switcher_prev(WM *wm) {
if (!wm->swl_visible) return;
wm->swl_idx = (wm->swl_idx - 1 + wm->swl_count) % wm->swl_count;
switcher_draw(wm);
}
void switcher_hide(WM *wm, int commit) {
if (!wm->swl_visible) return;
XUngrabKeyboard(wm->dpy, CurrentTime);