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

TaskBar: Show xwayland mark even if name is not shown #166

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

joezak11
Copy link

This makes more sense to me to allow xwayland mark to be shown when I don't need the window name

Copy link
Owner

@nwg-piotr nwg-piotr left a comment

Choose a reason for hiding this comment

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

This way we have no tooltip_text for X apps, if not settings["show-app-name"] . Please fix.

Copy link
Owner

@nwg-piotr nwg-piotr left a comment

Choose a reason for hiding this comment

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

Setting tooltip text should not depend on not len(name) > 0 but on settings["show-app-name"].

            if settings["show-app-name"]:
               (...)
            else:
                self.set_tooltip_text(_name)

@joezak11
Copy link
Author

joezak11 commented Dec 7, 2022

Yes but if settings["show-app-name"] is true then len(name) > 0 is also true so it should work the same way as before

@nwg-piotr
Copy link
Owner

Just check if X11 apps have tooltips. They have not on my side.

@joezak11
Copy link
Author

joezak11 commented Dec 7, 2022

Oops, my bad when xwayland mark is added to name it doesn't show tooltip

Copy link
Owner

@nwg-piotr nwg-piotr left a comment

Choose a reason for hiding this comment

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

You do need to test your code before submission. It still doesn't work as it should.

If I understand well, you want the label to show up regardless of the "show-app-name" value, if the app has no app_id (runs on XWayland). IMO the simplest way to achieve this result is:

        if con.name:
            check_key(settings, "show-app-name", True)
            check_key(settings, "name-max-len", 20)

            name = con.name[:settings["name-max-len"]] if len(con.name) > settings["name-max-len"] else con.name
            if settings["mark-xwayland"] and not con.app_id:
                name = "X|" + name

            label = Gtk.Label()
            if settings["show-app-name"]:
                label.set_text(name)
            else:
                self.set_tooltip_text(name)
                if not con.app_id:
                    label.set_text("X")

            label.set_angle(settings["angle"])
            if settings["show-app-name"] or (settings["mark-xwayland"] and not con.app_id):
                self.box.pack_start(label, False, False, 0)

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