Tips and Tricks | Trucs et Astuces
Guest, Monday 09 May 2011 à 18:42
|
|
|
I have added a custom launcher to my cairo-dock. The custom launcher executes a python script that I wrote to provide users a GUI interface to change their LDAP password. My question is how do I configure the launcher so that when the icon in the dock is clicked:
1. The application will start (I already have this working),
2. The dock will know that the application is active and display the indicator under the custom icon on the dock,
3. Clicking the icon (while its still active) will minimize/maximize the window instead of attempting to launch the application again.
Thank you in advance for any help you can provide. Reagrds. |
matttbe, Monday 09 May 2011 à 22:25
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Hello and thank you for this quesiton.
2. The dock will know that the application is active and display the indicator under the custom icon on the dock,
3. Clicking the icon (while its still active) will minimize/maximize the window instead of attempting to launch the application again. This is the same problem. In fact, the dock looks at the class of your application. You can edit your launcher and grab the class of any windows (extras settings).
But you can also easily and quickly create an applet for the dock in your language => http://www.glx-dock.org/ww_page.php?p=Documentation&lang=en#4-Write simply an applet in your favorite language (in bash, python, vala, C, mono, ruby, etc.) |
Subscription date : 30 November 2007
Messages : 17118
|
yep, either make a "smart launcher" with a few Python lines, or try to set the class of the launcher.  |
Guest, Tuesday 10 May 2011 à 17:10
|
|
|
Thank you for the responses. As I have already completed the python script I would prefer not to write a new "smart launcher" but will if it comes to that. I tried to set the class of the window but the behavior is still the same.
Here is the output from the xprop: WM_CLASS(STRING) = "change_password.py", "Change_password.py"
and here is the contents of my 01changepassword.desktop file:
#!en
[Desktop Entry]
Name=Change Password
Exec=/usr/bin/python /home/user/change_password.py
Icon=changepassword
Container=_MainDock_
frame_extra=
Order=1
prevent inhibate=false
StartupWMClass=Change_password.py
Terminal=false
ShowOnViewport=1
Is container=false
Renderer=Caroussel
Base URI=
Is mounting point=false
Nb subicons=0
Categories=GNOME;GTK;Utility;Password;
Comment=Change LDAP Password
NoDisplay=false
StartupNotify=true
Type=Application
Is URI=false
[Icon]
order=2
Any further help you could provide would be greatly appreciated. Thanks. |
matttbe, Tuesday 10 May 2011 à 17:59
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Try without '.py' => Change_password |
Guest, Wednesday 11 May 2011 à 16:51
|
|
|
Unfortunately updating the config without the .py did not help. As I create the change_password dialog box in pygtk, is there any other setting that you know of that the window manager typically sets that cairo-dock uses (in addition to WM_CLASS) that maybe I have not configured?
Thanks again for all your help/suggestions. Looks like I may be writing a "smart launcher" after all. |
matttbe, Wednesday 11 May 2011 à 22:36
|
|
Subscription date : 24 January 2009
Messages : 12573
|
It's strange
Which version of Cairo-Dock are you using?
@ fabounet: any idea? |
Guest, Thursday 12 May 2011 à 18:52
|
|
|
I was running 2.1.3. I just upgraded to 2.3 but this did not solve the problem. The indicator never appears on the icon and the dock continues to launch new instances of the change_password program. |
matttbe, Friday 13 May 2011 à 11:55
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Is it possible to change the class of your program and remove this .py? |
Subscription date : 30 November 2007
Messages : 17118
|
I think the dock can handle the class correctly, even with the .py.
maybe it's the type of the window that is not good, how do you create it ?
try running the dock with debug (cairo-dock -l debug), then launch your program, and copy-paste the terminal output of the dock here.
thanks ! |
Guest, Tuesday 17 May 2011 à 16:11
|
|
|
The window I create for the change_password program is a message dialog of type gtk.MessageDialog(). The debug output after clicking on the launcher is below:
debug : (/build/buildd/cairo-dock-2.3.0~2/src/gldit/cairo-dock-callbacks.c:cairo_dock_on_button_press:1211)
clicked on Change Password
debug : (/build/buildd/cairo-dock-2.3.0~2/src/gldit/cairo-dock-callbacks.c:cairo_dock_on_button_press:1093)
activate Change Password (Change Password)
debug : (/build/buildd/cairo-dock-2.3.0~2/src/gldit/cairo-dock-launcher-manager.c:cairo_dock_launch_command_full:537)
cairo_dock_launch_command_full (/home/user/change_password , (null))
message : (/build/buildd/cairo-dock-2.3.0~2/src/gldit/cairo-dock-animations.c:cairo_dock_start_icon_animation:786)
cairo_dock_start_icon_animation (Change Password, 2)
/home/user/change_password:16: Warning: value "((GtkMessageType) -1)" of type `GtkMessageType' is invalid or out of range for property `message-type' of type `GtkMessageType'
dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, -1, gtk.BUTTONS_OK_CANCEL, None)
message : (/build/buildd/cairo-dock-2.3.0~2/src/gldit/cairo-dock-applications-manager.c:_on_update_applis_list:298)
cette fenetre (75497475) de la pile n'est pas dans la liste
debug : (/build/buildd/cairo-dock-2.3.0~2/src/icon-factory/cairo-dock-application-factory.c:cairo_dock_new_appli_icon:165)
cette fenetre est timide
debug : (/build/buildd/cairo-dock-2.3.0~2/src/gldit/cairo-dock-applications-manager.c:cairo_dock_blacklist_appli:794)
cairo_dock_blacklist_appli (75497475)
debug : (/build/buildd/cairo-dock-2.3.0~2/src/gldit/cairo-dock-class-manager.c:cairo_dock_update_inactivity_on_inhibitors:670)
user@linux-5: ~ aussi devient inactive
debug : (/build/buildd/cairo-dock-2.3.0~2/src/gldit/cairo-dock-class-manager.c:cairo_dock_update_activity_on_inhibitors:647)
user@linux-5: ~ aussi devient active
Based on your previous post I was thinking that maybe creating a dialog window was the issue. I rewrote a mostly functional version of the change_password program using the gtk.Window() object instead of the gtk.MessageDialog(). With the new program, cairo-dock behaves as expected, i.e. the indicator comes on when active and clicking on the launcher after its been launched results in the window minimizing/maximizing rather than launching a new instance. Despite having the same WM_CLASS, and many other window properties, I guess the WM and cairo-dock treat dialog boxes differently than top-level windows. |
Subscription date : 30 November 2007
Messages : 17118
|
I guess the WM and cairo-dock treat dialog boxes differently than top-level windows.
indeed
so problem solved ? (you can edit your first message to solve it). |
Tips and Tricks | Trucs et Astuces
|