Skip to content

Add option to hide on close - #741

Open
City-busz wants to merge 1 commit into
iptux-src:mainfrom
City-busz:hide-on-close
Open

Add option to hide on close#741
City-busz wants to merge 1 commit into
iptux-src:mainfrom
City-busz:hide-on-close

Conversation

@City-busz

@City-busz City-busz commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Instead of hiding the main window from the taskbar, hide the window on close if the option is checked. This works also on Wayland.

Summary by Sourcery

Allow users to hide the main window on close while keeping the application running.

New Features:

  • Add a setting to hide the main window instead of quitting when it is closed.

Enhancements:

  • Replace taskbar-hiding behavior on minimize with close-to-hide behavior that also works under Wayland.

@sourcery-ai

sourcery-ai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR repurposes the existing taskbar-related setting so that, when enabled, closing the main window hides it and prevents application exit; otherwise the close event proceeds normally. Implementation moves from window-state/taskbar-hint updates to a delete-event handler using gtk_widget_hide(), which is compatible with Wayland.

Sequence diagram for hiding the main window on close

sequenceDiagram
    participant User
    participant MainWindow
    participant DeleteHandler
    participant ProgramData

    User->>MainWindow: close
    MainWindow->>DeleteHandler: main_window_on_delete_event
    DeleteHandler->>ProgramData: isHideTaskbarWhenMainWindowIconified()
    alt hide-on-close enabled
        DeleteHandler->>MainWindow: gtk_widget_hide
        DeleteHandler-->>MainWindow: TRUE
        MainWindow-->>User: window hidden, application remains running
    else option disabled
        DeleteHandler-->>MainWindow: FALSE
        MainWindow-->>User: close proceeds normally
    end
Loading

File-Level Changes

Change Details Files
Replaces minimize-time taskbar hiding with close-time window hiding controlled by the existing preference.
  • Updates the preference label to describe hiding the main window instead of quitting on close.
  • Replaces window-state handling with a delete-event callback that hides the window and consumes the close event when the option is enabled.
  • Preserves normal close behavior when the option is disabled or app-indicator support is unavailable.
  • Keeps the behavior behind the existing HAVE_APPINDICATOR conditional, supporting Wayland without taskbar-hint manipulation.
src/iptux/DataSettings.cpp
src/iptux/MainWindow.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Aug 24, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@lidaobing

Copy link
Copy Markdown
Member

build failed @City-busz

../src/iptux/MainWindow.cpp: In function ‘gboolean iptux::main_window_on_delete_event(GtkWidget*, GdkEvent*, gpointer)’:
../src/iptux/MainWindow.cpp:76:55: error: unused parameter ‘event’ [-Werror=unused-parameter]
   76 |                                             GdkEvent *event,
      |                                             ~~~~~~~~~~^~~~~
cc1plus: all warnings being treated as errors

Instead of hiding the main window from the taskbar, hide the window on
close if the option is checked. This works also on Wayland.
@City-busz

Copy link
Copy Markdown
Contributor Author

I removed the unused parameter to fix the build.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.49%. Comparing base (f47c73f) to head (bd26a94).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/iptux/MainWindow.cpp 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #741      +/-   ##
==========================================
+ Coverage   52.47%   52.49%   +0.01%     
==========================================
  Files          71       71              
  Lines        9004     9001       -3     
==========================================
  Hits         4725     4725              
+ Misses       4279     4276       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

Copy link
Copy Markdown

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