Skip to content

Commit

Permalink
Only fallback to cmd identifier when needed
Browse files Browse the repository at this point in the history
Using the cmd identifier is quite problematic.  If it contains null
bytes, it will result in an error farther down the line, causing the
group not to be shown!  This change makes cmd act in the same way as the
window title, in that res_class and res_name are preferred.

It is probably wise to split cmd by null bytes and choose only the first
one, but since I am unsure of all the potential ramifications of such a
change (would it be better to replace null bytes with spaces?) and
because this change fixes the problem for me, I will not include that in
this commit.
  • Loading branch information
benburrill committed Jan 8, 2018
1 parent 3793ae7 commit 26570a7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dockbarx/dockbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ def __add_window(self, window):
res_class = window.get_class_group().get_res_class().lower()
res_name = window.get_class_group().get_name().lower()
if window.has_name():
identifier = res_class or res_name or window.get_name().lower()
fallback = window.get_name().lower()
else:
#in case window has no name - issue with Spotify
pid = window.get_pid()
Expand All @@ -917,9 +917,10 @@ def __add_window(self, window):
raise
cmd = f.readline()
if "/" in cmd:
identifier = cmd.split("/")[-1]
fallback = cmd.split("/")[-1]
else:
identifier = cmd
fallback = cmd
identifier = res_class or res_name or fallback
# Special cases
if identifier in SPECIAL_RES_CLASSES:
identifier = SPECIAL_RES_CLASSES[identifier]
Expand Down

0 comments on commit 26570a7

Please sign in to comment.