xfce4-panel-profiles errors with KeyError when panel contains launchers with no items
If I add a launcher to a panel, and the launcher is more of a "stub" - it has no items, and then I try to export panels, i get:
Traceback (most recent call last):
File "/usr/share/xfce4-panel-profiles/xfce4-panel-profiles/xfce4-panel-profiles.py", line 223, in on_save_clicked
self.save_configuration(name)
File "/usr/share/xfce4-panel-profiles/xfce4-panel-profiles/xfce4-panel-profiles.py", line 211, in save_configuration
PanelConfig.from_xfconf(self.xfconf).to_file(filename)
File "/usr/share/xfce4-panel-profiles/xfce4-panel-profiles/panelconfig.py", line 69, in from_xfconf
pc.find_desktops()
File "/usr/share/xfce4-panel-profiles/xfce4-panel-profiles/panelconfig.py", line 165, in find_desktops
for d in self.properties['/plugins/plugin-' + number +
KeyError: '/plugins/plugin-32/items'
I traced this to code in panelconfig.py, I have a fix:
def find_desktops(self):
rem_keys = []
for pp, pv in self.properties.items():
print(f"pp: {pp}, pv: {pv}")
path = pp.split('/')
if len(path) == 3 and path[0] == '' and path[1] == 'plugins' and \
path[2].startswith('plugin-'):
number = path[2].split('-')[1]
print(f" Path: {path}, number: {number}")
if pv.get_type_string() == 's' and \
pv.get_string() == 'launcher':
items_key='/plugins/plugin-' + number + '/items'
if self.properties.get(items_key):
for d in self.properties[items_key].unpack():
desktop_path = 'launcher-' + number + '/' + d
if self.check_desktop(desktop_path):
self.desktops.append(desktop_path)
else:
rem_keys.append('/plugins/plugin-' + number)
I'm happy to submit a PR if you like - but i would need access.