View Full Version : WANTED: Tiny window-opener
Hey programmer-types,
I wrote a tiny Python app to open a window and put some text in it. But because it is in Python, I need to depend on Python for my package, which otherwise wouldn't have any dependencies.
Could someone write a small compiled program (in C or something) that uses the stock libraries to do the same thing?
Here's the Python code. I mostly ripped it off from the Maemo Python tutorial. It should be very obvious what I want, and I can't imagine it is difficult for any C programmer to whip something up.
#!/usr/bin/env python2.5
import gtk
import sys
wmname = sys.argv[1]
exttxt = sys.argv[2]
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_title (wmname)
window.connect("destroy", gtk.main_quit)
label1 = gtk.Label("This is the "+wmname+" host window.\n"+exttxt)
window.add(label1)
window.show_all ()
gtk.main()
rbrewer123
07-11-2008, 11:41 PM
There are a couple of threads on here for "zenity" and "gxmessage" which may be what you want.
Bundyo
07-12-2008, 12:35 AM
You can try with Vala too.
Thanks for your suggestions.
I am familiar with gxmessage and Zenity. I don't want a dialog box, I want a window. I also want no dependencies.
As I asked in the first post, I would like someone to post (or PM me) a dependency-free, compiled file that does what the python script does, please. I don't care what language it is written in originally. I don't need the source, either.
Bundyo
07-12-2008, 01:22 AM
Do you want to run it from the menu?
I want to run it as part of a script that is run from the menu.
If you want more context: I need a host window for the Xephyr nested x-server. This host window supplies the panel icon and task menu entry for Xephyr, which doesn't have such things in Hildon.
If you've tried my easy chroot package, you see this window before IceWM starts.
EDIT: Here's a screenshot of what the Python script does:
Running the following:
/usr/bin/openhostwin.py IceWM "Please log out of IceWM before closing this window."
Produces this:
http://farm4.static.flickr.com/3241/2660697890_e14b67c8b2_o.png (http://www.flickr.com/photos/qole2/2660697890/)
It would really be cool if the program could be linked to an arbitrary png file (say, "hostwin.png") that would show in the left-hand task bar and on the task chooser menu, and that I could modify.
I'm willing to discuss payment via PayPal. I was the recipient of some donations, I should pass on the joy.
Bundyo
07-12-2008, 05:40 AM
I almost done it 2 hours ago, but had to go out :)
Bundyo
07-12-2008, 07:32 AM
http://bundyo.org/maemo/hostwin.bz2
Is this okay?
Btw, if you run it from the menu, i'm registering it with osso_initialize, so i guess it will show you the icon.
Or maybe i can do it so you can pass a script to run as third parameter?
Perfect! That does what my Python script does, but faster. That is just what I asked for!
Enhancement talk:
So if I made a dbus service entry for it, that would add more integration?
The only way I could run it from the menu would be if I could pass a script name that this app could run after opening the window...
Bundyo
07-12-2008, 12:53 PM
You can run it from the menu as a service with the name you give it as a first parameter, that's what i'm initializing it with.
I like your signature :)
I made a new file, /usr/share/dbus-1/services/org.maemobox.bundyo.hostwin.service:
[D-BUS Service]
Name=IceWM
Exec=/usr/bin/hostwin
Your program no longer complains about being unable to do osso-initialize; there's no errors... but that's the only difference... Should something else happen?
I think the absolute best enhancement you could give me is the ability to run a shell script from within the program. When the shell script returns, the window closes and your program quits.
The second best enhancement would be the ability to have a custom icon associated to the window.
But if you do nothing else, you have helped me immensely!
Bundyo
07-12-2008, 02:32 PM
It wouldn't complain about osso_initialize whenever you give at least one parameter. I'll add the other features whenever my wife gets up and stops Skyping ;)
Bundyo
07-13-2008, 08:46 AM
Redownload the archive - now takes third parameter - a path to start, waits for it to die, then closes. I'm setting an icon with the /usr/share/pixmaps/[first parameter].png, but i think maemo doesn't obey that and instead sets it from the .desktop file. Check older posts for info.
Wow! That is marvellous! Icon works, script executes fast, window closes automatically...
The window text no longer displays, but everything is so fast now, I barely miss it ;)
Bundyo
07-13-2008, 04:31 PM
That's because I'm calling the script before showing the text and its synchronous, so the text shows after closing your script and before closing the program. :) For a very short time.
EDIT: Never wrote a GTK+ application before, if someone cares to give me a hint which signal i should bind to in order to detect that the text is shown, please be welcome :)
Bundyo, could you please make one more change for me?
Either have the text show as soon as the window opens, and before the script is run (that's what I really want), or remove the text parameter, since it doesn't show anyway.
Bundyo
07-16-2008, 01:42 AM
http://bundyo.org/maemo/hostwin_2params.bz2
If i find a way to show the label, I'll make another one.
I'll have to call the next version of Easy Debian the "Bundyo Build" in your honour. ;-)
Bundyo
07-17-2008, 06:42 AM
Heh, no need :)
Benson
07-17-2008, 09:25 PM
OK, I'm just a little unsure on how to apply this; I should edit /usr/share/applications/hildon/debwm.desktop and change the
Exec=/usr/bin/debwm IceWM xpice
to use hostwin, but xpice can't stay the same, because it doesn't chroot...
I need to write a script that does sudo debian xpiceand have hostwin call that script, I think.
Is that all?
fatalsaint
07-17-2008, 09:30 PM
edit /usr/bin/debwm and change the line that says
openhostwin.py $1 &
to use your hostwin $1 &
i think...
OK, I'm just a little unsure on how to apply this; I should edit /usr/share/applications/hildon/debwm.desktop and change the
Exec=/usr/bin/debwm IceWM xpice
to use hostwin, but xpice can't stay the same, because it doesn't chroot...
I need to write a script that does sudo debian xpiceand have hostwin call that script, I think.
Is that all?
If you can't wait for the 'Bundyo Build' ;), put this in your .desktop file:
Exec=/usr/bin/hostwin IceWM 'sudo debian xpice'
Bundyo, could your "hostwin" app be GPL? If so, could I have the source, so I can include it in my package? I'm trying to assemble a package that can be uploaded to Extras.
Bundyo
10-08-2008, 03:31 PM
Yeah, but it doesn't have a Makefile :)
Anyway, Jaffa's mud-builder (http://mud-builder.garage.maemo.org/) should support Vala builds, so you can actually build your whole deb from waf (not sure if he supports it) - i can give you a newer wscript for it which can autocreate a deb.
P.S. I never tried it though, but i'll have to very soon. Tear approaches 0.2...
...getting closer and closer to just calling my package "non-free" even though it is composed entirely of free components...
(no idea what you're talking about with Vala, etc)
Bundyo
10-08-2008, 03:33 PM
Yes, that's the easy way out :)
Benson
10-08-2008, 03:38 PM
The great thing about having it built from source, though, is that when each upgrade comes out (e.g. Maemo 4.2), it should simply be remade automatically from source for any new dependencies. It does look like a major headache for this sort of project, but it's not hopeless. :)
(Ulterior motive: Tried twice, and I still haven't been able to build hostwin; hopefully when you've got it capable of going through the autobuilder, I'll be able to see what I'm doing wrong. :p See, I had an evil scheme to swallow rdesktop in a scrollbar-augmented hostwin mutant, and not being able to build a purebred hostwin really interferes with that.)
Bundyo
10-08-2008, 04:06 PM
Qole, some time before i posted the source for Benson, probably you didn't see it:
http://www.internettablettalk.com/forums/showpost.php?p=220545&postcount=122
(Removed the X.VAPI dependencies, included the file anyway)
If you want a WAF that can build a deb for it, just tell me.
I just want to upload my easy debian package to the extras repository. It is turning out to be very difficult. Any help would be appreciated.
Bundyo
10-08-2008, 04:31 PM
I can't offer any help for now, since i didn't test Jaffa's mud-builder, maybe he can chime in here? :)
Maybe better to chime in over here (http://internettablettalk.com/forums/showthread.php?t=24161).
So, I would like someone to make me a Fremantle version of this.
I need a Fremantle window that is fullscreen but has a way to get to the dashboard (the task manager).
Is the transparent fullscreen icon in the lower right that I see in the fullscreen browser window a special browser feature, or is that a feature of the window itself?
I suspect that this will be problematic. I want to put a Xephyr window inside this window, and anything that I run inside that window will take over the input, so there's no way to get out of that screen. In Maemo 4 and below, you could hit the task switcher key and get the menu, but in Fremantle you can't do that anymore.
So I need some way to first get out of fullscreen mode and then I can switch windows, or some way to switch windows when in the secondary window manager...
zerojay
10-22-2009, 02:20 PM
So, I would like someone to make me a Fremantle version of this.
I need a Fremantle window that is fullscreen but has a way to get to the dashboard (the task manager).
Is the transparent fullscreen icon in the lower right that I see in the fullscreen browser window a special browser feature, or is that a feature of the window itself?
I suspect that this will be problematic. I want to put a Xephyr window inside this window, and anything that I run inside that window will take over the input, so there's no way to get out of that screen. In Maemo 4 and below, you could hit the task switcher key and get the menu, but in Fremantle you can't do that anymore.
So I need some way to first get out of fullscreen mode and then I can switch windows, or some way to switch windows when in the secondary window manager...
Ctrl+Backspace won't work?
qwerty12
10-22-2009, 02:26 PM
Is the transparent fullscreen icon in the lower right that I see in the fullscreen browser window a special browser feature, or is that a feature of the window itself?
Browser feature, but Nokia have put out a varient that lacks transparency effects in its MaemoPad source code, found in maemo-examples.
I need a Fremantle window that is fullscreen but has a way to get to the dashboard (the task manager).
Not really fluent on the DBus-GLib C API, myself, but "dbus-send --type=signal --session /com/nokia/hildon_desktop com.nokia.hildon_desktop.exit_app_view" works from a shell...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.