SergKolo / launcher-list-indicator

Indicator for Ubuntu with Unity desktop , which allows switching between profiles for the Unity launcher
MIT License
21 stars 2 forks source link

Toggle Workspace Switcher only starts the first time #13

Closed hotice closed 8 years ago

hotice commented 8 years ago

Toggle Workspace Switcher only starts the first time. If I open it for the first time (when no ~/.launcher_workspaces.json file exists), and then close it without setting anything, upon launching it again, it fails to start with the following error:

$ launcher-list-indicator 

** (launcher-list-indicator:18141): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-bbQTjASYXo: Connection refused

** (zenity:18149): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-bbQTjASYXo: Connection refused
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "/usr/bin/launcher-list-indicator", line 466, in get_workspace_list
    with open(config_file) as conf:
FileNotFoundError: [Errno 2] No such file or directory: '/home/andrei/.launcher_workspaces.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/launcher-list-indicator", line 490, in callback_workspaces
    self.get_workspace_list()
  File "/usr/bin/launcher-list-indicator", line 470, in get_workspace_list
    self.configure_workspaces()
  File "/usr/bin/launcher-list-indicator", line 508, in configure_workspaces
    workspace_lists = self.run_cmd(command).decode().strip().split('|')
AttributeError: 'NoneType' object has no attribute 'decode'

That's not all though. If I do set some profiles, so the ~/.launcher_workspaces.json file exists, the "Toggle Workspace Switcher" window never opens again. This is the terminal output in this case (but this I doubt is related to the actual issue):

$ launcher-list-indicator 

** (launcher-list-indicator:18194): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-bbQTjASYXo: Connection refused

** (zenity:18203): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-bbQTjASYXo: Connection refused
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
andrei@andrei-desktop:~$ launcher-list-indicator 

** (launcher-list-indicator:18413): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-bbQTjASYXo: Connection refused
andrei@andrei-desktop:~$ launcher-list-indicator 

** (launcher-list-indicator:18465): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-bbQTjASYXo: Connection refused
SergKolo commented 8 years ago

@hotice I've pushed a commit which has fixes for all 3 issues, 11,12, and 13. Comments added to mark where each fix is in the source code.

There's a few issues that are out of my control. Warnings for dbus (in this issue) as well as missing icon on the launcher for the dialog (https://github.com/SergKolo/launcher-list-indicator/issues/13) are zenity issues (and I asked around in AskUbuntu community - zenity dialogs don't show icons on the launcher for them as well), so perhaps these bugs/feature requests should be directed to zenity developers.

SergKolo commented 8 years ago

Additional note: the indicator now has its own ppa: https://launchpad.net/~launcher-list-indicator/+archive/ubuntu/ppa It is synced with github repository, so fixes should get there faster. If it is possible, consider importing that .deb package into webupd8 ppa

hotice commented 8 years ago

Can you please copy the packages in the PPA for all Ubuntu versions? That way I can change the PPA in my article to yours (I will continue to publish packages in my PPA so those who didn't see the PPA change will still receive updates). You don't have to upload a separate package for each Ubuntu version - since it's Python, nothing is built against specific Ubuntu libraries, so you can just copy the packages from the Launchpad interface (View package details > Copy packages).

hotice commented 8 years ago

Also, I still can't open the dialog that allows setting which profile to use for each workspace via Extras > Toggle Workspace Switcher. How is it supposed to work? Only run the dialog once, and then just toggle it on/off? But then how can I reconfigure it?

SergKolo commented 8 years ago

@hotice Yes, i intended it to run once, then toggle on/off. Reconfigure should be done by deleting the config file for it (~/.launcher_workspaces.json ). So as long as file exists, dialog won't be called again.

Seems like this way is confusing, so I'll probably add a menu entry for reconfiguring workspace settings

SergKolo commented 8 years ago

@hotice I've added option for reconfiguring workspaces, so now users should be able to bring up that dialog even when the file exists.

hotice commented 8 years ago

Thanks, I'll check it out and update the PPA right away!

hotice commented 8 years ago

The option to reconfigure workspace list doesn't show up if I start the indicator for the fist time (so there's no ~/.launcher_workspaces.json, and I set the workspaces. I need to restart the indicator for this option to show up.

SergKolo commented 8 years ago

@hotice yes, that's intended. The "Reconfigure" option should show up only if the configuration exists.

The first time user clicks "Toggle Workspace" there is no config file, so dialog will show up. After that, there's going to be "Reconfigure" entry.

Basic idea is to let user arrange workspaces only once and then just turn it on/off. Users don't want to create settings each time, especially if there is a lot of workspaces.

hotice commented 8 years ago

Yes but if I just start the indicator for the fist time, then configure which profile to be used for each workspace, then I change my mind, the option to reconfigure it is not there until the indicator is restarted.

SergKolo commented 8 years ago

@hotice I see what you're saying. I've pushed another commit , made a call to remaking menu in the function that calls the dialog. Now the option shows up if you configure workspaces for the first time , too. Tested with removing the config file and pressing "Toggle Workspaces" option

hotice commented 8 years ago

Yes, on start, the profile file doesn't exist, but it's created while having the indicator running, and yet the option to reconfigure it doesn't show up until the indicator is restarted. I assume the indicator checks for this file only on startup. To get it to show up after that file is created, but without restarting the indicator, it would need to recheck for the existence of the configuration file once the window that allows configuring the workspaces is closed.

SergKolo commented 8 years ago

@hotice You said: "I assume the indicator checks for this file only on startup." That's almost true, but not exactly. There's a function make_menu() , which is called on startup , but also during switching of profiles (that's how the checkmark is added to show which profile is active ). If you created workspace config and then tried switching to another profile manually , the option would appear, because make_menu() function was called.

So all that was needed to be done is to call that function after configuration ( which I did already with latest commit)

hotice commented 8 years ago

It's working great now, thank you for your time and patience!

SergKolo commented 8 years ago

@hotice Thank you for all the testing and PPA :) I'm still just learning a lot of things