Skip to content

Feat/taskbar progressbar#715

Open
cubekii wants to merge 26 commits intoaui-framework:developfrom
cubekii:feat/taskbar_progressbar
Open

Feat/taskbar progressbar#715
cubekii wants to merge 26 commits intoaui-framework:developfrom
cubekii:feat/taskbar_progressbar

Conversation

@cubekii
Copy link
Copy Markdown

@cubekii cubekii commented Mar 23, 2026

solves: #57

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new cross-platform API to allow applications to display progress indicators directly on their taskbar or dock icons. This feature significantly enhances user experience by providing visual feedback for long-running operations, making it easier for users to monitor application status without needing to keep the application window in focus.

Highlights

  • New setTaskbarProgress method: Introduced a new method setTaskbarProgress to the AWindow class, allowing applications to display a progress indicator on the taskbar or dock icon.
  • Cross-platform implementation: Provided platform-specific implementations for Windows (using ITaskbarList3), macOS (using NSDockTile), and Linux (using X11 atoms, with a note about KDE compatibility).
  • Example usage: Updated the progressbar example to demonstrate how to use the new setTaskbarProgress functionality.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new cross-platform API, setTaskbarProgress, to the AWindow class, enabling the display of progress indicators on taskbars or docks across Windows, macOS, and Linux. The implementation includes platform-specific logic for each OS, and an example usage in the progress bar UI example. The review comments highlight several issues: a critical memory leak and deprecated API usage in the macOS implementation, an empty stub for the GTK platform that contradicts the documentation, a COM object resource leak in the Windows implementation, and an unused header inclusion in the X11 platform abstraction.

Comment on lines +159 to +175
void AWindow::setTaskbarProgress(aui::float_within_0_1 p) {
if (!mHandle) return;

NSDockTile* dockTile = [NSApp dockTile];
if (p == 0.0f) {
[dockTile setProgressIndicator:nil];
[dockTile setProgress:-1.0];
} else {
NSProgressIndicator* progressIndicator = [[NSProgressIndicator alloc] init];
[progressIndicator setIndeterminate:NO];
[progressIndicator setMinValue:0.0];
[progressIndicator setMaxValue:1.0];
[progressIndicator setDoubleValue:p];
[dockTile setProgressIndicator:progressIndicator];
[dockTile setProgress:p];
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The current implementation for setTaskbarProgress on macOS has a critical issue. The NSProgressIndicator object is created with [[NSProgressIndicator alloc] init] but is never released. According to Apple's documentation for -[NSDockTile setProgressIndicator:], the dock tile does not take ownership of the indicator object. This leads to a memory leak if not using ARC, or a dangling pointer and potential crash if using ARC, as the object will be deallocated at the end of the function's scope.

Furthermore, the use of setProgressIndicator: is deprecated since macOS 12 and is likely redundant, as [dockTile setProgress:p] should be sufficient to display a progress bar.

I suggest simplifying the implementation to avoid these issues. The following implementation is safer, simpler, and uses the modern API:

void AWindow::setTaskbarProgress(aui::float_within_0_1 p) {
    if (!mHandle) return;
    
    NSDockTile* dockTile = [NSApp dockTile];
    if (p == 0.0f) {
        [dockTile setProgressIndicator:nil];
        [dockTile setProgress:-1.0];
    } else {
        [dockTile setProgress:p];
    }
}

gtk_window_present(nativeHandle(window));
}

void PlatformAbstractionGtk::setTaskbarProgress(AWindow &window, aui::float_within_0_1 p) {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The implementation of setTaskbarProgress is currently an empty stub. This means the taskbar progress feature will not work on GTK-based desktop environments like GNOME. This contradicts the documentation in AWindow.h which states the feature works on GNOME/Cinnamon.

Please either implement this feature for GTK or update the documentation to reflect its current limitations.

Comment thread aui.views/src/AUI/Platform/win32/AWindowsImpl.cpp Outdated
Comment thread aui.views/src/AUI/Platform/linux/x11/PlatformAbstractionX11.cpp Outdated
@Nelonn Nelonn linked an issue Mar 23, 2026 that may be closed by this pull request
Comment thread aui.views/src/AUI/Platform/AWindow.h Outdated
* @details
* On Windows, displays progress on the taskbar button.
* On macOS, displays progress on the dock icon.
* On Linux, works on desktop environments like GNOME/Cinnamon.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you didn't mention KDE 🙃

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I wrote about this in the issue #57

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

so you should document KDEs behaviour

@cubekii
Copy link
Copy Markdown
Author

cubekii commented Mar 30, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a cross-platform setTaskbarProgress API to show progress on the taskbar or dock across Windows, macOS, and Linux. While the implementation covers all major platforms, several issues need addressing: the X11 implementation risks a crash by passing a potential null pointer from std::getenv to std::string_view and should avoid log flooding; the macOS implementation uses non-standard NSDockTile methods that may cause compilation or runtime failures; and the Win32 implementation uses a static COM pointer which can lead to crashes during application shutdown. An unused include was also identified in the X11 source file.

Comment on lines +543 to +546
if (std::string_view(std::getenv("XDG_CURRENT_DESKTOP")) == "KDE") {
ALogger::warn("KDE") << "setTaskbarProgress() is not working on KDE";
return;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

std::getenv can return nullptr if the environment variable is not set. Passing nullptr to the std::string_view constructor is undefined behavior and will likely cause a crash. Additionally, logging a warning every time this function is called on KDE will flood the logs if the progress is updated frequently (e.g., during an animation). It is better to check for nullptr and log the warning only once.

    if (const char* desktop = std::getenv("XDG_CURRENT_DESKTOP"); desktop && std::string_view(desktop) == "KDE") {
        static bool warned = false;
        if (!warned) {
            ALogger::warn("KDE") << "setTaskbarProgress() is not working on KDE";
            warned = true;
        }
        return;
    }

Comment on lines +165 to +168
[dockTile setProgressIndicator:nil];
[dockTile setProgress:-1.0];
} else {
[dockTile setProgress:p];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

NSDockTile does not have setProgressIndicator: or setProgress: methods in the standard AppKit API. These appear to be private APIs, which are generally discouraged as they can break with OS updates. Unless these are provided by a custom category defined elsewhere in the project, this code will fail to compile or cause a runtime crash. The standard way to display progress on the Dock icon is to assign a custom NSView to the contentView property of the NSDockTile.

Comment on lines +487 to +496
static AComPtr<ITaskbarList3> pTaskbar;
if (!pTaskbar) {
HRESULT hr = CoCreateInstance(
CLSID_TaskbarList, nullptr,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pTaskbar)
);
if (FAILED(hr)) return;
pTaskbar->HrInit();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using a static AComPtr for a COM object can lead to a crash or hang during application exit. The static object's destructor (which calls Release()) may run after CoUninitialize() has been called. It is safer to manage the lifetime of the COM object such that it is released before COM is uninitialized, or use a local variable if the overhead of CoCreateInstance is acceptable for your performance requirements.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

static was removed

#include "AUI/Platform/ARenderingContextOptions.h"
#include "OpenGLRenderingContextX11.h"
#include "SoftwareRenderingContextX11.h"
#include "AUI/Platform/linux/ADBus.h"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The include AUI/Platform/linux/ADBus.h appears to be unused in this file and should be removed to keep the code clean.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ADBus need to work with (KDE), this template was removed

@cubekii
Copy link
Copy Markdown
Author

cubekii commented Apr 4, 2026

working in macos!
изображение

…essbar

# Conflicts:
#	examples/7guis/flight_booker/CMakeLists.txt
@Alex2772
Copy link
Copy Markdown
Collaborator

Alex2772 commented Apr 9, 2026

Please address or comment PR feedback

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.

Provide taskbar progress bar (Windows+Linux+macOS)

2 participants