diff -Nru launcher-list-indicator-0.1+git20160905/debian/changelog launcher-list-indicator-0.1+git20160912+1/debian/changelog --- launcher-list-indicator-0.1+git20160905/debian/changelog 2016-09-05 08:46:13.000000000 +0000 +++ launcher-list-indicator-0.1+git20160912+1/debian/changelog 2016-09-12 09:59:01.000000000 +0000 @@ -1,3 +1,15 @@ +launcher-list-indicator (0.1+git20160912+1-0~webupd8~0) xenial; urgency=medium + + * New Git pull + + -- Alin Andrei Mon, 12 Sep 2016 12:58:36 +0200 + +launcher-list-indicator (0.1+git20160907+1-0~webupd8~0) xenial; urgency=medium + + * New Git pull + + -- Alin Andrei Wed, 07 Sep 2016 11:46:24 +0200 + launcher-list-indicator (0.1+git20160905-0~webupd8~0) xenial; urgency=medium * New Git pull diff -Nru launcher-list-indicator-0.1+git20160905/debian/launcher-list-indicator.desktop launcher-list-indicator-0.1+git20160912+1/debian/launcher-list-indicator.desktop --- launcher-list-indicator-0.1+git20160905/debian/launcher-list-indicator.desktop 2016-08-24 12:34:57.000000000 +0000 +++ launcher-list-indicator-0.1+git20160912+1/debian/launcher-list-indicator.desktop 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=Launcher List Indicator -Comment=Indicator for Ubuntu with Unity desktop, which allows switching between profiles for the Unity launcher -Exec=launcher-list-indicator -Icon=/opt/launcher-list-indicator/indicator-icon.png -Type=Application -StartupNotify=true -Categories=Utility;GTK;; -MimeType=text/plain; diff -Nru launcher-list-indicator-0.1+git20160905/debian/links launcher-list-indicator-0.1+git20160912+1/debian/links --- launcher-list-indicator-0.1+git20160905/debian/links 2016-08-24 12:36:31.000000000 +0000 +++ launcher-list-indicator-0.1+git20160912+1/debian/links 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/opt/launcher-list-indicator/launcher-list-indicator usr/bin/launcher-list-indicator diff -Nru launcher-list-indicator-0.1+git20160905/launcher-list-indicator launcher-list-indicator-0.1+git20160912+1/launcher-list-indicator --- launcher-list-indicator-0.1+git20160905/launcher-list-indicator 2016-09-05 08:43:27.000000000 +0000 +++ launcher-list-indicator-0.1+git20160912+1/launcher-list-indicator 2016-09-12 09:58:30.000000000 +0000 @@ -66,17 +66,18 @@ self.user_home, '.launcher_profiles.json' ) - self.make_menu() + self.alt_icon_path = os.path.join( self.user_home, '.local/share/icons/launcher-list-indicator' ) + # Default to current directory for icon path + # https://github.com/SergKolo/launcher-list-indicator/issues/11 + self.icon_path = os.path.dirname(os.path.realpath(__file__)) if os.path.exists(self.alt_icon_path): self.icon_path = self.alt_icon_path elif os.path.exists('/usr/share/pixmaps/indicator-icon.png'): - os.icon_path = '/usr/share/pixmaps/' - else: - self.icon_path = os.path.dirname(os.path.realpath(__file__)) + self.icon_path = '/usr/share/pixmaps/' self.app.set_icon( os.path.join(self.icon_path, "indicator-icon.png") ) @@ -85,8 +86,9 @@ self.link_workspaces = False self.workspaces_file = '.launcher_workspaces.json' self.last_workspace = None - + self.get_workspace_list() + self.make_menu() self.update() self.app.set_status(appindicator.IndicatorStatus.ACTIVE) @@ -171,6 +173,12 @@ self.extras_menu.append(self.toggle_wp_switcher) self.toggle_wp_switcher.show() + if os.path.exists(os.path.join(self.user_home,self.workspaces_file)): + self.reconfig_wp = gtk.MenuItem('Reconfigure Worspace Lists') + self.reconfig_wp.connect('activate', self.configure_workspaces) + self.extras_menu.append(self.reconfig_wp) + self.reconfig_wp.show() + self.change_icon = gtk.MenuItem('Change icon') self.change_icon.connect('activate',self.set_new_icon) self.extras_menu.append(self.change_icon) @@ -287,10 +295,19 @@ def remove_entry(self, lists=None): """ deletes a list from config """ - entry = self.run_cmd([ - 'zenity', '--entry', - '--title=""', '--text="Which entry to remove?"' - ]).decode().strip() + + app_lists = '|'.join([i.replace(u'\u2714 ',"") for i in self.parse_menu()]) + + dialog = [ + 'zenity','--forms', '--title', + 'Select list to remove', '--text', '', + '--add-combo','List Name','--combo-values', + app_lists + ] + try: + entry = self.run_cmd(dialog).decode().strip() + except: + return if os.path.isfile(self.config_file): found = False @@ -346,7 +363,8 @@ timeout = 0.75 if not value_found: label = "N/A" self.app.set_label(label, "") - if not value_found: + + if not value_found and hasattr(self, 'app_menu'): for item in self.app_menu.get_children(): entry_label = item.get_label() if entry_label.startswith(u'\u2714 '): @@ -374,7 +392,7 @@ if args[-1] == ScrollDirection.UP: labels.reverse() - #print(labels) + # to_activate = None for index,item in enumerate(labels): @@ -417,7 +435,10 @@ # Merely saving as new icon doesn't work # we have to give it "different" file - self.app.set_icon(alt_icon) + timestamp = str(int(time.time())) + temp_icon = "/tmp/icon_" + timestamp + copyfile(new_icon_path,temp_icon) + self.app.set_icon(temp_icon) except: pass @@ -451,29 +472,32 @@ timeout = 1.15 new_list = None + config_file = os.path.join(self.user_home,self.workspaces_file) # Menuitems to be excluded x = ['', 'Remove entry', 'Save current', 'Extras', 'Quit' ] if self.link_workspaces: - current = self.get_current_viewport() - #print(current) - if current != self.last_workspace: - viewports_dict = self.enumerate_viewports() - config_file = os.path.join(self.user_home,self.workspaces_file) - - try: - with open(config_file) as conf: - data = json.load(conf) - #print(data) - except: - self.configure_workspaces() - else: + + # Existence of file is presequisite for + # running workspace list-switcher + # Fixes: + # https://github.com/SergKolo/launcher-list-indicator/issues/13 + try: + with open(config_file) as conf: + data = json.load(conf) + except Exception as e: + # TODO + self.configure_workspaces() + else: + current = self.get_current_viewport() + if current != self.last_workspace: + viewports_dict = self.enumerate_viewports() + + menu = self.app_menu.get_children() label_pairs = { i.get_label().replace(u'\u2714 ',''):i for i in menu if i.get_label() not in x } - #print(label_pairs.keys()) - #menu = None if data: current_vp_number = viewports_dict[current] for key,val in data.items(): @@ -497,20 +521,30 @@ viewports = self.enumerate_viewports() num_viewports = len(viewports) - command=["zenity", '--forms', '--title', "Window title", '--text', "Combo name"] - labels = "|".join([ i.replace(u'\u2714',"") for i in self.parse_menu()]) - #print(labels) + + # https://github.com/SergKolo/launcher-list-indicator/issues/12 + command=['zenity', '--forms', '--title', + 'Assing Profiles per Workspace', '--text', ''] + labels = "|".join([ i.replace(u'\u2714 ',"") for i in self.parse_menu()]) + # for i in range(num_viewports): command.append('--add-combo') command.append( "Workspace # " + str(i+1)) command.append('--combo-values') command.append(labels) - workspace_lists = self.run_cmd(command).decode().strip().split('|') - workspace_dict = { wp:name for wp,name in enumerate(workspace_lists,1) } - - workspaces_config = os.path.join(self.user_home,self.workspaces_file) - with open(workspaces_config,'w') as config: - json.dump(workspace_dict,config,indent=4,sort_keys=True) + try: + + workspace_lists = self.run_cmd(command).decode().strip().split('|') + + except Exception as e: + + self.link_workspaces = False + else: + workspace_dict = { wp:name for wp,name in enumerate(workspace_lists,1) } + workspaces_config = os.path.join(self.user_home,self.workspaces_file) + with open(workspaces_config,'w') as config: + json.dump(workspace_dict,config,indent=4,sort_keys=True) + self.make_menu() #---| <- Marks 4 character width for class functions diff -Nru launcher-list-indicator-0.1+git20160905/launcher-list-indicator.desktop launcher-list-indicator-0.1+git20160912+1/launcher-list-indicator.desktop --- launcher-list-indicator-0.1+git20160905/launcher-list-indicator.desktop 2016-09-05 08:43:27.000000000 +0000 +++ launcher-list-indicator-0.1+git20160912+1/launcher-list-indicator.desktop 2016-09-06 14:51:14.000000000 +0000 @@ -5,4 +5,3 @@ Exec=launcher-list-indicator Type=Application Icon=indicator-icon.png -