Skip to content

New mod: OmniButton Customizer v1.0#3859

Closed
sb4ssman wants to merge 1 commit into
ramensoftware:mainfrom
sb4ssman:sb4ssman-vertical-omnibutton
Closed

New mod: OmniButton Customizer v1.0#3859
sb4ssman wants to merge 1 commit into
ramensoftware:mainfrom
sb4ssman:sb4ssman-vertical-omnibutton

Conversation

@sb4ssman

@sb4ssman sb4ssman commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Adds OmniButton Customizer (v1.0): gives independent layout and appearance control over every native Windows 11 OmniButton item — wifi, volume, battery, and battery percentage — for both standard and multi-row taskbars.

This supersedes the narrower Vertical OmniButton implementation previously proposed in this PR. Vertical layout remains available as one configuration of the full customizer.

Highlights:

  • Arrange the four native items in a smart grid, single row/column, or fixed rows/columns/grid, with row- or column-first fill and short-group placement/alignment.
  • Reorder items with a comma-separated itemOrder list or omit tokens to hide individual items. Items unavailable on the current system are skipped.
  • Keep battery and percentage coupled as Windows renders them, or make them independent grid items that can occupy non-adjacent cells.
  • Control each item independently: color, glyph size, font family, opacity, and X/Y optical nudges, plus group padding and visual offsets.
  • Preserve the native ControlCenterButton, Quick Settings behavior, and tray ordering. Exact original XAML dependency-property values are restored on settings changes and unload.
  • Hardened taskbar lifecycle: taskbar-thread-only XAML cleanup, exception-contained callbacks, bounded startup retry, and Explorer/taskbar restart recovery.

Screenshots (also embedded in the mod readme):

Wifi, volume, battery, and percentage in a compact grid

Battery percentage, battery, volume, and wifi reordered into one row

OmniButton Customizer in a busy multi-row system tray

Tested live on Windows 11: default compact 2×2, reordered single-row and tall vertical layouts, independent and coupled battery/percentage, per-item optical nudges, a busy multi-row tray alongside other mods, settings reload, Explorer restart, Quick Settings interaction, and disable/native restoration/re-enable.

Changelog

If this pull request updates an existing mod, describe the changes below:

  • Replaced the proposed Vertical OmniButton implementation with the full OmniButton Customizer v1.0.

Mod authorship

If this pull request introduces a new mod, please complete the section below.

This mod was created by:

    • The submitter, without AI assistance
    • The submitter, with AI assistance
    • Claude
    • ChatGPT
    • Gemini
    • Another AI (please specify):
    • Other (please specify):

Please select the options that best apply. Your selection does not affect the acceptance criteria, but it helps reviewers understand the context of the code and provide relevant feedback.

Comment thread mods/vertical-omnibutton.wh.cpp Outdated
Comment thread mods/vertical-omnibutton.wh.cpp Outdated
@sb4ssman

Copy link
Copy Markdown
Contributor Author

This version should be much more agreeable.

@sb4ssman
sb4ssman requested a review from m417z April 28, 2026 22:56
@m417z

m417z commented May 2, 2026

Copy link
Copy Markdown
Member

I see that the code is similar to #3932 which I reviewed. Please apply my comments here too, let me know when it's ready for review.

@sb4ssman

sb4ssman commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

Updated to v1.4 with the review comments applied (same changes as #3932):

  • GetSystemTrayModuleHandle() pattern: tries SystemTray.dll first (Win11 26200+), falls back to Taskbar.View.dll (skipped at version ≥2604), then ExplorerExtensions.dll
  • GetTaskbarXamlRoot: added #elif defined(_M_ARM64) and #else #error arms
  • Added -lversion to compilerOptions; switched to WindhawkUtils::Wh_SetFunctionHookT

Also included since the last review:

  • buttonHorizontalPadding setting to control OmniButton width
  • Stoppable retry thread (no dangling thread handle on uninit)
  • Inline mode: button auto-sizes instead of fixed width, so the hover highlight matches the battery glyph + % text exactly

Comment thread mods/vertical-omnibutton.wh.cpp Outdated
// Use default offset.
#else
#error "Unsupported architecture"
#endif

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread mods/vertical-omnibutton.wh.cpp Outdated
if (WaitForSingleObject(stopEvent, 2000) != WAIT_TIMEOUT) break;
if (g_omniStackPanel || g_unloading) break;
Wh_Log(L"[AfterInit] Retry %d — XAML not yet applied", i + 1);
ApplyAllSettingsOnWindowThread();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mod already hooks IconView::IconView, so why is this thread needed?

Comment thread mods/vertical-omnibutton.wh.cpp Outdated

static void FlipBatteryLayout(FrameworkElement const& batteryCP) {
if (!WalkBatteryTree(batteryCP, 0))
Wh_Log(L"[Battery4] No inner StackPanel found (% may not be in tree yet)");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use %% to escape the % sign.

Comment thread mods/vertical-omnibutton.wh.cpp Outdated
with the Windows 11 Taskbar Styler out of the box — no special settings required.

For basic vertical stacking without battery percentage, paste [style.yaml](https://github.com/sb4ssman/Windhawk-Vertical-OmniButton/blob/main/style.yaml)
into Windows 11 Taskbar Styler → Settings → Advanced.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
into Windows 11 Taskbar Styler → Settings → Advanced.
into Windows 11 Taskbar Styler → Settings → Textual mode.

Comment thread mods/vertical-omnibutton.wh.cpp Outdated

iconView.Loaded([](IInspectable const&, RoutedEventArgs const&) {
if (!g_unloading && !g_omniStackPanel)
ApplyAllSettings();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsubscribe after handling, otherwise the callback might be called again when the mod is unloaded, causing a crash. There's an example below, but if you prefer something simpler, allocate memory for the revoke token, assign it from iconView.Loaded, pass the pointer to the lambda, and unsubscribe when it's called.

g_autoRevokerList.emplace_back();
auto autoRevokerIt = g_autoRevokerList.end();
--autoRevokerIt;
*autoRevokerIt = iconView.Loaded(
winrt::auto_revoke_t{},
[autoRevokerIt](winrt::Windows::Foundation::IInspectable const& sender,
RoutedEventArgs const& e) {
Wh_Log(L">");
g_autoRevokerList.erase(autoRevokerIt);

@sb4ssman

Copy link
Copy Markdown
Contributor Author

@m417z Vertical-omnibutton was the first pass at this; in the interim I built a more comprehensive replacement (omnibutton-customizer) that covers vertical as one configuration of a full grid layout, adds per-element nudging, item reordering, and fill-order control among other details. I'd like to close this PR and submit omnibutton-customizer instead as the single OmniButton mod. Do you have any concerns with that, may I just close it and submit?

@m417z

m417z commented Jun 21, 2026

Copy link
Copy Markdown
Member

No concerns, go ahead. Alternatively, you can update this PR, whatever you prefer.

@sb4ssman
sb4ssman force-pushed the sb4ssman-vertical-omnibutton branch from c07e595 to b523971 Compare July 21, 2026 14:17
@sb4ssman sb4ssman changed the title Add Vertical OmniButton mod New mod: OmniButton Customizer v1.0 Jul 21, 2026
@sb4ssman
sb4ssman force-pushed the sb4ssman-vertical-omnibutton branch from b523971 to b7beff8 Compare July 21, 2026 14:19
@sb4ssman

Copy link
Copy Markdown
Contributor Author

Closing in favor of #4855, which submits OmniButton Customizer v1.0 on a correctly named branch with a clean thread. Same code, same file (mods/omnibutton-customizer.wh.cpp). Thanks!

@sb4ssman sb4ssman closed this Jul 21, 2026
@sb4ssman
sb4ssman deleted the sb4ssman-vertical-omnibutton branch July 21, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants