Start a new widget at its natural width in whole columns

The shell's widgetLimits now reports the provider's natural width ("w"), and
when a widget is added the page turns it into grid columns (WIDGET_COLS), so a
small widget takes the columns it needs instead of the whole row. Resizing
still snaps to whole columns and rows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NYASJ6JNxhYwNNJK7ypK2V
This commit is contained in:
Claude committed 2026-10-22 06:02:10 +00:00
1 parent 43cb884a5d
commit 205c7dbed2
4 files changed
+25 -5

No files matched your search

+5
View File
@@ -102,6 +102,7 @@ RESIZE: Const[i32] = 40 # arg: columns * 4096 + height in px for the widg
RESIZE_DONE: Const[i32] = 41
GRAB: Const[i32] = 42 # arg: the widget slot showing handles, picked up by its body
CHECK_UPDATES: Const[i32] = 43
WIDGET_COLS: Const[i32] = 44 # arg: columns for the widget just added (0: the whole row)
CAP: Const[i32] = 512
HOME_CAP: Const[i32] = 200
@@ -539,6 +540,10 @@ def update(msg: i32, arg: i32) -> None:
if chosen >= 0 and nh < HOME_CAP:
push_slot(WIDGET, s_dup(wlabels[chosen]), arg, wheights[chosen])
chosen = -1
elif msg == WIDGET_COLS:
if nh > 0 and hkind[nh - 1] == WIDGET:
hw[nh - 1] = arg
save_home()
elif msg == REMOVE:
resizing = -1
remove_slot(arg)