Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use user-defined mode when toggling visibility rather than resetting to default #1479

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

dorgnarg
Copy link
Contributor

Fixes #958 and #491 (or at least this comment), this way if the bar is configured to be in overlay mode, it will stay in that mode when it's re-shown after being hidden. If there's a better way to do this, let me know, I just reused the code elsewhere that retrieved the config mode in the first place

@dorgnarg dorgnarg changed the title Uses user-defined mode when toggling visibility rather than resetting to default Use user-defined mode when toggling visibility rather than resetting to default Mar 13, 2022
@@ -665,7 +665,11 @@ void waybar::Bar::onMap(GdkEventAny*) {

void waybar::Bar::setVisible(bool value) {
visible = value;
setMode(visible ? MODE_DEFAULT : MODE_INVISIBLE);
if (auto mode = config.get("mode", {}); mode.isString()) {
setMode(visible ? config["mode"].asString() : MODE_INVISIBLE);
Copy link
Owner

Choose a reason for hiding this comment

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

Do you think it's worse to check if mode is available?
Against a hard-coded list, for example.

Copy link
Contributor

Choose a reason for hiding this comment

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

setMode already does the check with fallback to default, no need to do it twice.

@Alexays Alexays merged commit a37ef74 into Alexays:master Mar 15, 2022
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.

Height and overlay configuration?
4 participants