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": "",
|
"steam": "",
|
||||||
"vbeterm": "",
|
"vbeterm": "",
|
||||||
"zathura": "",
|
"zathura": "",
|
||||||
"zoom": "",
|
"zoom": ""
|
||||||
"NOMATCH": ""
|
|
||||||
}
|
}
|
||||||
|
application_icons_nomatch = ""
|
||||||
application_icons_alone = {
|
application_icons_alone = {
|
||||||
application_icons[k] for k in {
|
application_icons[k] for k in {
|
||||||
"vbeterm"
|
"vbeterm"
|
||||||
|
@ -69,17 +69,16 @@ async def workspace_rename(i3, event):
|
||||||
|
|
||||||
def application_icon(window):
|
def application_icon(window):
|
||||||
"""Get application icon for a window."""
|
"""Get application icon for a window."""
|
||||||
for attr in ('name',
|
for attr in ('window_instance',
|
||||||
'window_instance',
|
|
||||||
'window_class'):
|
'window_class'):
|
||||||
name = getattr(window, attr, None)
|
name = getattr(window, attr, None)
|
||||||
if name is None:
|
if name is None:
|
||||||
continue
|
continue
|
||||||
for k, v in application_icons.items():
|
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}")
|
logger.debug(f"in {attr}, found '{name}', matching {k}")
|
||||||
return v
|
return v
|
||||||
return application_icons["NOMATCH"]
|
return application_icons_nomatch
|
||||||
|
|
||||||
for workspace in workspaces:
|
for workspace in workspaces:
|
||||||
icons = set()
|
icons = set()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue