mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-04 07:14:21 +02:00
i3-companion: only consider instance/class for icon
Name may be too random. Straighten a bit the regex too to avoid matching on prefixes.
This commit is contained in:
parent
396ca23b33
commit
7f17d6f397
1 changed files with 5 additions and 6 deletions
|
@ -50,9 +50,9 @@ application_icons = {
|
|||
"steam": "",
|
||||
"vbeterm": "",
|
||||
"zathura": "",
|
||||
"zoom": "",
|
||||
"NOMATCH": ""
|
||||
"zoom": ""
|
||||
}
|
||||
application_icons_nomatch = ""
|
||||
application_icons_alone = {
|
||||
application_icons[k] for k in {
|
||||
"vbeterm"
|
||||
|
@ -69,17 +69,16 @@ async def workspace_rename(i3, event):
|
|||
|
||||
def application_icon(window):
|
||||
"""Get application icon for a window."""
|
||||
for attr in ('name',
|
||||
'window_instance',
|
||||
for attr in ('window_instance',
|
||||
'window_class'):
|
||||
name = getattr(window, attr, None)
|
||||
if name is None:
|
||||
continue
|
||||
for k, v in application_icons.items():
|
||||
if re.match(k, name, re.IGNORECASE):
|
||||
if re.match(rf"^{k}\b", name, re.IGNORECASE):
|
||||
logger.debug(f"in {attr}, found '{name}', matching {k}")
|
||||
return v
|
||||
return application_icons["NOMATCH"]
|
||||
return application_icons_nomatch
|
||||
|
||||
for workspace in workspaces:
|
||||
icons = set()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue