← KD100

Fix wheel button width and ensure equal padding in OSD

90fc298513c32f6fdcef30a874484bbc95e4d865 · Claude · Feb 7, 2026 05:26

- Wheel button now matches the width of the 4-column grid
- Adjusted expanded_width from 400 to 375 for equal padding on all sides
- Grid width calculated as: 4 * key_width + 3 * grid_padding = 355px
- With 10px padding on each side: 10 + 355 + 10 = 375px total

https://claude.ai/code/session_01H5sr8TkRyt6U1vdkVZRRvy

+9 −6 · 3 files changed

  • default.cfg +1 −1
  • src/config.c +1 −1
  • src/osd.c +7 −4
diff --git a/default.cfg b/default.cfg
index 792bbe3..869dfbe 100644
--- a/default.cfg
+++ b/default.cfg
@@ -78,7 +78,7 @@ osd_position: 50,50
 osd_opacity: 0.67
 osd_display_duration: 3000
 osd_min_size: 200,100
-osd_expanded_size: 400,380
+osd_expanded_size: 375,380
 osd_toggle_button: -1
 osd_font_size: 13
 
diff --git a/src/config.c b/src/config.c
index aa41555..8c2fae3 100644
--- a/src/config.c
+++ b/src/config.c
@@ -97,7 +97,7 @@ config_t* config_create(void) {
     config->osd.display_duration_ms = 3000;
     config->osd.min_width = 200;
     config->osd.min_height = 100;
-    config->osd.expanded_width = 400;
+    config->osd.expanded_width = 375;
     config->osd.expanded_height = 380;
     config->osd.osd_toggle_button = -1;  // Disabled by default
     config->osd.font_size = 13;  // Default font size
diff --git a/src/osd.c b/src/osd.c
index b310b87..6c09bf9 100644
--- a/src/osd.c
+++ b/src/osd.c
@@ -78,7 +78,7 @@ osd_state_t* osd_create(config_t* config) {
     osd->pos_y = 50;
     osd->min_width = 200;
     osd->min_height = 100;
-    osd->expanded_width = 400;
+    osd->expanded_width = 375;
     osd->expanded_height = 380;
     osd->width = osd->min_width;
     osd->height = osd->min_height;
@@ -435,12 +435,15 @@ void osd_redraw(osd_state_t* osd) {
         int start_x = padding;
         int start_y = y_offset;
 
-        // Draw wheel button (top, spanning)
+        // Calculate grid width (4 columns)
+        int grid_width = 4 * key_width + 3 * grid_padding;
+
+        // Draw wheel button (top, spanning same width as grid)
         int wheel_y = start_y;
         XSetForeground(dpy, gc, highlight_color);
-        XFillRectangle(dpy, win, gc, start_x, wheel_y, osd->width - 2 * padding, key_height - 10);
+        XFillRectangle(dpy, win, gc, start_x, wheel_y, grid_width, key_height - 10);
         XSetForeground(dpy, gc, fg_color);
-        XDrawRectangle(dpy, win, gc, start_x, wheel_y, osd->width - 2 * padding - 1, key_height - 11);
+        XDrawRectangle(dpy, win, gc, start_x, wheel_y, grid_width - 1, key_height - 11);
 
         // Wheel button label
         const char* wheel_desc = osd->key_descriptions[18] ? osd->key_descriptions[18] : "Wheel Toggle";