Launcher in Python / How to proceed?


ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
I am interested to try to make a launcher a python (a la GnomeDo) and I am wondering on how to do the following:


- how would you ensure the launcher auto-launches in the background everytime your start the Pandora ?


- How would you ensure that a specific combination of keys is "intercepted" by the launcher even when there is no focus on the launcher window (which would happen 99% of the time since the launcher would be minimized in the background)


If anyone has any idea on how to solve these two issues that would be great :)
 
- how would you ensure the launcher auto-launches in the background everytime your start the Pandora ?

You want to modify X's startup script, I think, though someone more familiar with this kind of thing can give you a better answer.

- How would you ensure that a specific combination of keys is "intercepted" by the launcher even when there is no focus on the launcher window (which would happen 99% of the time since the launcher would be minimized in the background)

I don't think you can. Pygame has pygame.event.set_grab, but I don't think that's what you want (it grabs all input, locking the user from using the keyboard in other programs). Then again, I know some programs do something like what you want to do, so I'm probably wrong.
 
Last edited by a moderator:
Depends what you mean .. do you mean something similar to minimenu? or more like xfce?


We have a config file to set a 'desktop environment', which is how users can switch between minimenu and xfce (or others); you could just adds your to the end and good to go, really; your pnd would be an installer to add/remove your entry there, and install into NAND (you wouldnt' w2ant a launcher in pnd or on removable media, for obvious reasons :)


So, that takes care of users changing menus, and how you get launched.


As to operations and livecycle, thats up to you..


Minimenu's lifecycle is to come up, and then when it launches a pnd, it _exits_ and launches the pnd, to minimize memory footprint (almost none. Like 5K footprint :)


xfce is more traditional in the Window Manager style, where it stays live always, and lets you multyitask, with handy app flipping and window management and so forth.


If you make a new menu, do you mean to replace somethig nlike minimenu, or augment it.. somethign that comes up while another desktop environment is in control? (like a pause screen)?


If you're replacing one, then chances are you'd be operating like minimenu, since writing a full window manager is a Lot of work :) Now that said, if you wanted to leverge part of minimenu (like the mmwrapper that does the launching of pnds and launchign of mmenu UI) you could, or roll your own.


Anyway, fill me in with details and I can guide you in the right direction :)


jeff


As to how to capture keys.. we have a daemon that watches for various things to happen, so it can react; like when the screen lid closes, it fires off a script to turn off the display; see the conf file at /etc/pandora/eventmap if memory serves.


The pandora button launches a script, which in turn checks if its 'xfce or somethign else'; for xfce it pops up the xfce menu, for everything else it attempts an app kill, on the assumption this will let the suer preferred menu come back up (ie: minimenu.)


IF you wanted one of those behavious, easy.. or if you wanted another behaviour, we could script it in.
 
Last edited by a moderator:
Depends what you mean .. do you mean something similar to minimenu? or more like xfce?


We have a config file to set a 'desktop environment', which is how users can switch between minimenu and xfce (or others); you could just adds your to the end and good to go, really; your pnd would be an installer to add/remove your entry there, and install into NAND (you wouldnt' w2ant a launcher in pnd or on removable media, for obvious reasons :)


So, that takes care of users changing menus, and how you get launched.


As to operations and livecycle, thats up to you..


Minimenu's lifecycle is to come up, and then when it launches a pnd, it _exits_ and launches the pnd, to minimize memory footprint (almost none. Like 5K footprint :)


xfce is more traditional in the Window Manager style, where it stays live always, and lets you multyitask, with handy app flipping and window management and so forth.


If you make a new menu, do you mean to replace somethig nlike minimenu, or augment it.. somethign that comes up while another desktop environment is in control? (like a pause screen)?


If you're replacing one, then chances are you'd be operating like minimenu, since writing a full window manager is a Lot of work :) Now that said, if you wanted to leverge part of minimenu (like the mmwrapper that does the launching of pnds and launchign of mmenu UI) you could, or roll your own.


Anyway, fill me in with details and I can guide you in the right direction :)


jeff


As to how to capture keys.. we have a daemon that watches for various things to happen, so it can react; like when the screen lid closes, it fires off a script to turn off the display; see the conf file at /etc/pandora/eventmap if memory serves.


The pandora button launches a script, which in turn checks if its 'xfce or somethign else'; for xfce it pops up the xfce menu, for everything else it attempts an app kill, on the assumption this will let the suer preferred menu come back up (ie: minimenu.)


IF you wanted one of those behavious, easy.. or if you wanted another behaviour, we could script it in.
Is there any extended version on how minimenu works? I really interested in make some similar or add some stupid-for-personal-use functions to it.

As far I understand, when minimenu is working, there is no other desktop environment running in background. Is this correct?
 
As far I understand, when minimenu is working, there is no other desktop environment running in background. Is this correct?
This is correct.  When you "Switch GUI" from XFCE to MiniMenu, it does this:


Close XFCE (Desktop Environment)
Close xfwm4 (Window Manager)
Start xfwm4 (Window Manager)
Start mmwrapper (App Launcher)
Start mmenu (UI)
 When you launch a PND from MiniMenu, mmenu quits and mmwrapper runs the application.  When you quit the application, it goes back to mmwrapper, which runs the UI again.
 
Last edited by a moderator:
As far I understand, when minimenu is working, there is no other desktop environment running in background. Is this correct?
This is correct.  When you "Switch GUI" from XFCE to MiniMenu, it does this:


Close XFCE (Desktop Environment)
Close xfwm4 (Window Manager)
Start xfwm4 (Window Manager)
Start mmwrapper (App Launcher)
Start mmenu (UI)

 
When you launch a PND from MiniMenu, mmenu quits and mmwrapper runs the application.  When you quit the application, it goes back to mmwrapper, which runs the UI again.
Sorry for my ignorance, but xfwm4 is not the window manager of XFCe?

So, what is the mmenu? Some kind of collection of custom windows using xfwm4?

Thanks for the info!
 
xfwm4 is XFCE's window manager, correct, but you can also use it on its own. Window managers control the positioning and appearance of windows - almost all graphical applications need one to be running, since it's not usually the kind of thing they want to implement themselves. However, very few applications actually need a full desktop environment like XFCE to running: once you've got the Pandora started up and a window manager running, you can then run any application.

mmenu is just an application, like any other. It could probably make use of any window manager, but since xfwm4 is already available, it may as well use that. In a sense, there's nothing special about mmenu - in much the same way that Mousepad lets you open a text file, edit it and save it, MiniMenu scans the system for PNDs, presents them in a nice display, and lets you launch them.

(None of this is intended to diminish skeezix's achievement in writing MiniMenu, of course :) )
 
xfwm4 is XFCE's window manager, correct, but you can also use it on its own. Window managers control the positioning and appearance of windows - almost all graphical applications need one to be running, since it's not usually the kind of thing they want to implement themselves. However, very few applications actually need a full desktop environment like XFCE to running: once you've got the Pandora started up and a window manager running, you can then run any application.


mmenu is just an application, like any other. It could probably make use of any window manager, but since xfwm4 is already available, it may as well use that. In a sense, there's nothing special about mmenu - in much the same way that Mousepad lets you open a text file, edit it and save it, MiniMenu scans the system for PNDs, presents them in a nice display, and lets you launch them.


(None of this is intended to diminish skeezix's achievement in writing MiniMenu, of course :) )
DUDE! Thank you very MUCH!  B)

That explanation was perfect for me!

So, basically, you launch the minimum environment to run a graphical application, and then, you launch the app. NICE!

OFFTOPIC: 

I browse your PND's, and I got impressed by Openbox.

Is more resource-efficient than XCFE? I don't know keymappings depends on the desktop. Does this mean I can map space to a L-button?

Again, thanks.
 
OFFTOPIC: 

I browse your PND's, and I got impressed by Openbox.

Is more resource-efficient than XCFE? I don't know keymappings depends on the desktop. Does this mean I can map space to a L-button?
Openbox is definitely more resource-efficient than XFCE, yeah. It will let you map keys to perform a particular action, so you could, for instance, map Ctrl + m to launch a web browser, or to minimize or a application, or to switch workspace - that kind of thing.

Remapping space to a L-Button is a different kind of key mapping. If you wanted to permanently remap it, you could edit $HOME/.pndXmodmap and change it so that it reads "keycode 62 = space NoSymbol space". This file is read at boot up - you can test the change without rebooting though by typing "xmodmap $HOME/.pndXmodmap" in a terminal.

Permanent remapping is probably not ideal though, since it'll break the functionality of applications that assume that the left trigger is Shift-R. As such, it's probably better to remap just for when you need it, using something like xbindkeys: http://boards.openpandora.org/index.php/topic/11073-quick-howto-about-manually-installing-xbindkeys/
 
Last edited by a moderator:
Back
Top