Taskbar Icon Group Centering
Center the taskbar icons after a chosen position as one group relative to the whole taskbar. Requires the taskbar to be set to Left alignment.
Author: Suioio
Center the taskbar icons after a chosen position as one group, relative to the
whole taskbar. There is no line, dot or shape anywhere: the mod only measures
the buttons and writes the margins that move the group, and it adds no element
of its own to the taskbar.
Preview


What it does
- The icons after Icon group position form a single group that is centered
relative to the entire taskbar, including the system tray.
- The group is clamped so it cannot run into the tray: when centering would
push it under the tray, the gap is reduced instead.
- Stop centering when the icon count after the position reaches stops
centering once that many icons are after the position, which restores the
normal left-aligned layout. The default 0 never stops.
- The mod only adds its own delta on top of the button margins that already
exist, and hands back exactly the value it still owns when centering stops,
so margins written by Windows or by another mod are never overwritten.
When it applies
Only while the taskbar is left-aligned, horizontal and not mirrored
(right-to-left). On a centered taskbar Windows centers the whole row itself
and this mod has nothing to add: the gap it computes there comes out as zero,
so no margin is written. If no getter has produced a value and the stored one
cannot be read either, the mod assumes left and does the same work with the same
zero result instead of going quiet. Nothing is applied on a
vertical or mirrored taskbar, and the mod never writes the taskbar alignment or
any other Windows setting.
To use it, switch the taskbar to Left alignment in Windows' taskbar
settings. Whether the taskbar is left-aligned is the value the shell's own
alignment getter returns, which this mod hooks, and which is seeded once from
the stored setting when the mod is loaded after the shell has already read it -
so switching the alignment is picked up in both directions on the fly, without
a mod reload. Because that getter sits above the stored value, the mod follows
the alignment the shell itself reads. The one seed covers the case where
the shell has already read it before the mod was loaded. There is no polling
and no thread of its own: the layout is watched through an event the shell
already raises, a switch to the alignment is followed inside a bounded settling
window instead of being polled for, and where the getter could not be hooked
the stored value is re-read at most once per second.
Differences from the neighbouring mods
- taskbar-separators groups icons by drawing separators between them.
This mod draws nothing at all; it only moves the icons after the position.
- taskbar-split inserts flexible space between the running and the pinned
group. This mod centers a single group whose position you pick.
- taskbar-centered-start-split-icons splits the buttons into two groups
around a centered Start button. This mod never touches the Start button,
and the position is a plain setting rather than a consequence of Start.
Settings
| Setting |
Default |
Meaning |
| Icon group position |
2 |
1-based position counted from the first application button (the Start button is not counted). The icons after this position are the centered group. |
| Stop centering when the icon count after the position reaches |
0 |
Stop centering once this many usable application buttons are after the position, which restores the normal left-aligned layout. The default 0 never stops. |
Compatibility
- Windows 11, horizontal taskbar, x86-64
- Compatible with Windows 11 Taskbar Styler in normal configurations
- Taskbar labels, and uncombined or otherwise variable-width taskbar buttons
- Mixed multi-monitor layouts with different button modes on each taskbar
- The mod adds no element to the taskbar at all: it only writes button margins,
and unload hands every tracked margin back, so nothing of the mod is left
behind
- Layered margin mods: any mod that rewrites taskbar button margins by reading
the current value and adding its own gap on top compounds with this one - both
ledgers keep adding to each other without bound, so do not run two of those at
once. A mod that writes an absolute margin is fine: this mod re-bases on
top of whatever it finds. Taskbar Separators is the layering kind; its default
Divider gap is 0, in which case it writes no button margins and the two
coexist, but raise that gap and the two should not be enabled together.
Uninstall
Disabling or removing the mod stops centering and hands back the button margins
it applied. The taskbar alignment is never written, so there is nothing to
restore.
License and attribution
Licensed under the GNU General Public License v3.0.
This mod is extracted from Taskbar Separators Dynamic Centering, which is a
fork of Taskbar Separators by digART; the original mod and its copyright
belong to digART. The centering geometry in this mod is kept from that fork.
Taskbar hook and UI-thread infrastructure includes code and patterns adapted
from Windhawk mods by Michael Maltsev (m417z), including Taskbar Labels for
Windows 11, Taskbar Multirow, and Windows 11 Taskbar Styler.
Known limitations
- Closing a pinned-release icon that sits exactly on the split — the last icon of
the left group or the first icon of the centered group — removes a button the
mod is measuring, so the spacing can look one layout pass stale for a few tens
of milliseconds before it settles. The split is anchored on that button itself
rather than on its position in the realized list, so a button appearing or
disappearing anywhere else no longer moves it, and the anchor is relearned only
once the boundary button has really been gone for a quarter of a second.
- While an icon is being dragged, Explorer draws the dragged icon as a floating
copy that follows the cursor. Holding it inside the spacing makes the spacing
look like two halves with the icon in between. The margins the mod writes are
unaffected: the spacing returns as soon as the icon is dropped.
- The taskbar hooks rely on Windows component symbols, vtable slots and a
machine-code pattern. A Windows update that changes them can stop the mod from
working; a symbol that fails to resolve and every failed reconciliation are
logged. The alignment is read from the two getters Windows has served it
from and from the stored value; a build that removes or changes all three
stops the mod from centering.
- If unload cannot detach its event handlers from the taskbar thread, those
handlers stay registered and applied margins may not be handed back; the mod
log records it. This limitation is shared with the mod it was derived from.
中文说明
把任务栏中指定位置之后的图标作为一组,相对整条任务栏(含系统托盘)
居中。画面里没有任何线条或方块:本模组只测量按钮并写入移动该组所需的边距,
不向任务栏添加任何元素。
功能
- 图标组位置之后的图标构成一个整体,相对整条任务栏居中。
- 该组会被钳制,不会压到系统托盘:居中会把组推入托盘时,间距会被减小。
- 位置之后的图标数量达到该值时停止居中:达到设定值后停止居中,恢复正常的
左对齐排布。默认 0 表示永不停止。
- 本模组只在已有按钮边距之上叠加自己的增量,并在停止居中时只归还自己仍然持有的
那个值,因此不会覆盖 Windows 或其它模组写入的边距。
生效条件
只在任务栏左对齐、水平且**非镜像(从右到左)**时生效。任务栏居中时整排按钮
由系统居中,本模组保持不生效;垂直任务栏与镜像任务栏上也不生效。模组从不写入任务栏
对齐设置或任何其它 Windows 设置。
请在 Windows 的任务栏设置里把对齐方式改为左对齐。是否左对齐取的是系统自身的
对齐 getter 返回值(本模组挂钩了它),并在模组晚于系统首次读取才启用时用存储的设置值
播种一次——因此切换对齐会被实时识别,双向响应,无需重新加载模组。由于该 getter
位于存储值之上,本模组跟随的是“shell 自己读到的对齐”。那次播种用于覆盖“shell
在本模组加载之前就已经读过该值”的情形。模组不轮询、也
不保留自己的线程:布局只
通过 shell 本就会触发的事件观察,切换对齐在有界的沉降窗口内跟随而不是靠轮询;没有
getter 产生过值时,存储值至多每秒回读一次;若连存储值也读不到,模组按左对齐处理:此时在真居中的任务栏上算出的间隙为 0,不会写入任何边距,只是仍会做同样的计算,而不是保持沉默。
与相邻模组的区别
- taskbar-separators:用画分隔线的方式把图标分组;本模组什么都不画,
只移动指定位置之后的图标。
- taskbar-split:在“运行中”和“固定”两组之间插入弹性空白;本模组居中单个
由你指定位置的组。
- taskbar-centered-start-split-icons:围绕居中的开始按钮把按钮分成两组;
本模组完全不涉及开始按钮,位置只是一个普通设置项。
设置项
| 设置项 |
默认 |
说明 |
| 图标组位置 |
2 |
从第一个应用按钮算起的 1 基位置(不含开始按钮);该位置之后的图标构成居中的那一组。 |
| 位置之后的图标数量达到该值时停止居中 |
0 |
该位置之后的可用应用按钮数量达到该值时停止居中,恢复正常左对齐排布。默认 0 表示永不停止。 |
兼容性
- Windows 11、水平任务栏、x86-64
- 正常情况下与 Windows 11 Taskbar Styler 兼容
- 任务栏标签,以及不合并或其它可变宽度的任务栏按钮
- 多显示器下每条任务栏按钮模式不同的混合布局
- 模组不向任务栏添加任何元素,只写入按钮边距;卸载时会归还全部被跟踪的边距,
不留下模组的任何痕迹
- 叠加式边距模组:任何“先读当前值、再把自己的间隙加上去”的模组都会与本模组互相累积,两套账本会无上限地叠加,因此不要同时启用两个这类模组。写绝对值边距的模组没有问题——本模组会自动在其之上重设基准。Taskbar Separators 属于叠加式:它的 Divider gap 默认为 0(此时不写按钮边距,可共存);若把该值调大于 0,请勿同时启用两个模组。
卸载
停用或移除模组会停止居中并归还它写入的按钮边距。任务栏对齐设置从未被写入,
因此没有需要恢复的内容。
许可与署名
以 GNU General Public License v3.0 发布。
本模组抽取自 Taskbar Separators Dynamic Centering,后者是 digART 的
Taskbar Separators 的分叉;原模组及其版权归 digART 所有。本模组中的居中几何
代码取自该分叉。
任务栏挂钩与 UI 线程基础设施包含改编自 Michael Maltsev(m417z)模组的代码与模式,
包括 Taskbar Labels for Windows 11、Taskbar Multirow 与 Windows 11 Taskbar Styler。
已知限制
- 关闭正好位于分割点上的“未固定”图标(左组最后一个、或居中组第一个)时,被移除的正是模组正在测量的按钮,间距可能有一个布局帧的陈旧感(几十毫秒)后自行恢复正常。分割点锚定在该按钮本身、而不是它在“已实现列表”中的位置,因此其它位置出现或消失按钮都不会再让它移位;只有边界按钮确实消失约四分之一秒后才会重新锚定。
- 拖动图标时,Explorer 会把被拖图标做成跟随光标的浮动副本;把它停在空隙中间时,视觉上会像“空隙被劈成两半、中间夹着图标”。模组写入的间距并未改变,放下图标即恢复。
- 任务栏挂钩依赖 Windows 组件的符号、虚表槽位与一段机器码特征;Windows 更新若改变它们,模组可能失效,届时模组日志会记录重排失败。对齐值会同时从 Windows 曾提供的两个 getter 与存储值读取;若某个版本把这三者都改掉或去掉,模组就不再居中。
- 若卸载时无法从任务栏线程注销事件处理器,这些处理器会保留、已应用的边距可能未归还;模组日志会记录。这一限制与其来源模组相同。