Skip to content

Commit

Permalink
Only use rofi_highlight when config file says to
Browse files Browse the repository at this point in the history
  • Loading branch information
firecat53 committed May 28, 2017
1 parent 8875279 commit eeb8e69
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions networkmanager_dmenu
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,15 @@ def dmenu_cmd(num_lines, prompt="Networks", active_lines=None): # pylint: disab
lines = "{} {}".format(lines, num_lines)
if "pinentry" in args_dict:
del args_dict["pinentry"]
if "rofi_highlight" in args_dict:
try:
rofi_highlight = conf.getboolean('dmenu', 'rofi_highlight')
del args_dict["rofi_highlight"]
except (configparser.NoOptionError, configparser.NoSectionError):
rofi_highlight = False
if rofi_highlight is True and "rofi" in dmenu_command:
if active_lines:
dmenu_args.extend(["-a", ",".join([str(num)
for num in active_lines])])
del args_dict["rofi_highlight"]
extras = (["-" + str(k), str(v)] for (k, v) in args_dict.items())
res = [dmenu_command, "-p", str(prompt)]
res.extend(dmenu_args)
Expand Down Expand Up @@ -331,7 +335,7 @@ def get_selection(aps, vpns, gsms, others):
all_actions += gsms + empty_action if gsms else []
all_actions += others

if rofi_highlight:
if rofi_highlight is True:
inp = [str(action) for action in all_actions]
else:
inp = [('** ' if action.is_active else ' ') + str(action)
Expand All @@ -347,7 +351,7 @@ def get_selection(aps, vpns, gsms, others):
if not sel.rstrip():
sys.exit()

if not rofi_highlight:
if rofi_highlight is False:
action = [i for i in aps + vpns + gsms + others
if ((str(i).strip() == str(sel.strip())
and not i.is_active) or
Expand Down

0 comments on commit eeb8e69

Please sign in to comment.