Peter Petigru
Peter Petigru

Reputation: 234

Qtile: Make parse function for long texts like browsers

I have the following problem. The widget "WindowName" displays very long Browser names (ie "Stackoverflow | Questions | Ask -- Mozilla Firefox) Is there a way to shorten this? I am aware that qtile comes with a parse function but it's default function doesnt work

Upvotes: 0

Views: 446

Answers (1)

Peter Petigru
Peter Petigru

Reputation: 234

The following function solved this issue, however if someone has a better implementation I would greatly appreciate it.

Add this function to your config.py file

def longNameParse(text): 
for string in ["Chromium", "Firefox"]: #Add any other apps that have long names here
    if string in text:
        text = string
    else:
        text = text
return text

And then when you call your Window Name widget, you use the function as an argument

widget.WindowName(parse_text=longNameParse)

That fixed it

Upvotes: 0

Related Questions