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

wlr/taskbar: add support for rewrite rules #2269

Merged
merged 2 commits into from
Jul 4, 2023
Merged

Conversation

Arcus92
Copy link
Contributor

@Arcus92 Arcus92 commented Jul 2, 2023

Hello,

I'm using the wlr/taskbar and I was annoyed by some long application names like "Firefox Web Browser". I would prefer to just read "Firefox", so the button doesn't take so much space.

I simply implemented the rewrite logic from sway/window and hyprland/window for wlr/taskbar. A simple waybar::util::rewriteString was added and the man page was updated.

Here is an example:
grafik
The top waybar is using the rewrite rules. The bottom waybar is the old version with the full names.

You see, that the taskbar is way shorter by removing unnecessary parts from the application name.

        "wlr/taskbar": {
            "format": "{icon} {name}",
            "icon-size": 20,
            "tooltip": false,
            "on-click": "activate",
            "on-click-middle": "close",
            "on-click-right": "minimize-raise",
            "rewrite": {
                "(\\s*)Firefox Web Browser": "$1Firefox",
                "(\\s*)Foot Server": "$1Terminal",
                "(\\s*)CLion.*": "$1CLion",
                "(\\s*)IntelliJ IDEA.*": "$1IDEA"
            }
        },

I had to include the whitespace between the {icon} and {name}.

Sure, you could simply change the .desktop file for these application, but they may reset after an update. I hope this change is useful for some of you.

@Alexays
Copy link
Owner

Alexays commented Jul 4, 2023

Nice!
Thanks!

@Alexays Alexays merged commit 65f73d3 into Alexays:master Jul 4, 2023
@Alexays
Copy link
Owner

Alexays commented Jul 4, 2023

Can you also update the Github wiki?

@Arcus92
Copy link
Contributor Author

Arcus92 commented Jul 5, 2023

@Alexays Done :-)

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.

None yet

2 participants