Adjustable tray icons padding for Win10 taskbar
Makes padding of tray and tray popup icons adjustable in legacy taskbar
Author: Anixx
This is a port of functionality of 7+ Taskbar Tweaker by m417z that allows to adjust the padding of the tray icons
in classic (Windows 10) taskbar (running either under Windows 10 or Windows 11). To adjust the tray icons padding on the new Win11 taskbar,
use the mod Taskbar tray icon spacing and grid. The version 2.0 of the mod was comprehensively reworked
by piknockyou.

- Tray icon padding - the spacing between the tray icons on the taskbar.
- Hidden icons popup icon size - the size of the icons in the popup that
opens when you click the chevron, which also shrinks that popup.
- Hidden icons popup cell padding - the empty border around each icon in
the popup.
0 packs the icons next to each other at their normal size.
The default padding value is set to 2, the same as under Windows 95-Windows XP, more dense than under Windows 7, but can be changed in mod's options.
Screenshots
Windows defaults: 16 pixel icons in 40 pixel cells.
All paddings zero: the icons sit next to each other.
Paddings zero with 50 pixel popup icons.
How it works
Tray icons. The shell reserves one fixed-width slot per tray icon and
computes its width from GetSystemMetrics(SM_CXSMICON) (16 pixels at 100%
scaling) plus a fixed padding, then pushes the result into the tray toolbar. The
mod never resizes the tray window itself. While the taskbar lays the tray out,
the mod
- redirects
SM_CXSMICON for the query the shell makes on the taskbar
thread,
- rewrites the horizontal padding the shell sends to the tray toolbar, and
- after a settings change, asks Explorer to reload the notification area so
that this work happens in the shell's own layout pass.
This update adds:
- less cases for Explorer's restart,
- the
-1 off value on every setting, which restores the previous state
without disabling the mod,
- the hidden icons popup settings (icon size and cell padding).
Hidden icons popup. The popup sizes its cells from two things: the icon
images in its toolbar, and the theme's content margins around each cell
(measured on Windows 10 22H2: the shell's 16 pixel icons plus the theme's 12
pixel margins on each side give 40 pixel cells and a 120x120 popup for 9
icons). The toolbar refuses TB_SETBUTTONSIZE outright, so the mod replaces
the icon images with scaled copies for the icon-size setting, and answers the
shell's own theme queries (TrayNotifyFlyout, part 3) with the configured
cell padding instead of the theme's 12 pixels. The popup re-measures itself
every time it opens. The tray and the popup draw from one image list, and the
shell edits that list in place when a tray icon appears, disappears or is
replaced, without telling the popup. The mod therefore applies every such
edit to its scaled copy as well, scaling only the picture that changed; a copy
kept from before the edit would draw another application's picture under the
button's tooltip.
Notes
-1 switches a setting off and restores what was there before, without
disabling the mod. For the tray, disabling redirection and asking Explorer
to reload lets the shell recompute its own spacing.
- Value ranges: tray icon padding
-1 or 0-32 (the Windows default is about
16, 0 and 1 are the tightest); hidden icons popup icon size -1 or
8-96 (the Windows default is 16 at 100% scaling); hidden icons popup
cell padding -1 or 0-24 (-1 = the theme's 12 pixels per side, 0 =
the icons sit next to each other). Values outside a range are clamped and the
clamped value is logged.
- For the tray spacing, small values are denser than the Windows default and
larger values wider; the icons stay evenly spaced. The exact mapping is not
documented, so try a value and adjust from there. All settings are applied
without disabling the mod.
- Disabling the mod removes the redirection, restores the pending flag state,
and asks Explorer to reload, so the tray returns to its own layout.
- If a setting seems not to take effect right after enabling the mod, restart
Explorer once; changes afterwards are applied live.
- The mod writes to Explorer's memory only to flip the two "pointer device"
flag bytes that decide how the shell lays the tray out. They are restored
immediately, a writable-memory check and a sanity check guard the write, and
the mod does nothing at all while the setting is
-1.