AndyObtiva / glimmer-dsl-libui

Glimmer DSL for LibUI - Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library - The Quickest Way From Zero To GUI - If You Liked Shoes, You'll Love Glimmer! - No need to pre-install any prerequisites. Just install the gem and have platform-independent GUI that just works on Mac, Windows, and Linux.
MIT License
458 stars 15 forks source link

[Meta-suggestion / Functionality-related for the whole glimmer suite] Glimmer going zenity (the gtk application) #32

Open rubyFeedback opened 1 year ago

rubyFeedback commented 1 year ago

Hey Andy,

You may probably know the application called "zenity". It is somewhat popular on linux; not sure how you handle things on OSX but on linux zenity is quite useful, for simple scripts.

Just in case you don't know zenity - let me show three images to give an overview, or refresh your memory if you forgot about it. :)

https://upload.wikimedia.org/wikipedia/commons/e/e5/A_Zenity_infobox_as_displayed_on_GNOME_3_%28Fedora_17%29.png

https://www.howtoforge.de/images/so-zeigen-sie-gui-dialoge-in-einem-bash-skript-mit-zenity-an/upload-7.jpg ^^^ this one also shows the commandline invocation; this is one idea for glimmer libui by the way

https://i.stack.imgur.com/CWVL0.png

Ok. I think you can already see my aim with this.

I am kind of proposing that the glimmer suite supports something LIKE zenity. I am not saying you should support ALL of zenity as such, mind you - I refer mostly to the functionality. Like, the basic use cases for zenity could be covered by the glimmer suite too. It could also give people an additional motivation to use glimmer. And perhaps even allow for people to switch on the commandline between different toolkits, example:

"zenity-like options specifying width, height, calendar, grid, and then also a flag to select between glimmer{gtk, tk, sdl, libui, swt}" you name it. I am not referring to really complicated use cases, simplicity is key - but to be ABLE to do so would be really really nice, from within glimmer as such, and the commandline. (On windows we may be a bit more limited but libui works for basic use cases fine.)

In the last some days I worked on my old backup gem. I use it to back up data on linux on external USB devices. I also use it on windows, to some extent. Windows is so slow though.

Anyway - I wanted to show a small pop up message on windows. And libui on windows works fine, so the natural thing was to use it there. It works fine too. \o/

I also found out that I can daemonize via Proess.daemon()

I don't quite yet know how to close the application though automatically after 30 seconds for instance. I assume it is possible but I don't know how. My idea was to show this for 30 seconds and then remove the libui widget.

Anyway.

I believe it may be useful for glimmer to support something like zenity too. Not only via commandline options (not sure whether all flags make sense but things such as --width=1200 probably would make sense), but also programmatically from within ruby code - perhaps both as a toplevel API or some other way for glimmer (just a lame example, Glimmer.zenity(hash_here)), but perhaps also via the DSL you created. Glimmer itself probably already supports all of zenity, so this is not so much related to new functionality, but more where glimmer as such could be used as replacement or surrogate for zenity. Like in the use case I described to pop up a small window after having worked on the commandline. And a simple call to the glimmer suite to enable this too - not sure how to do so but like people just calling glimmer and passing the options to glimmer to handle that. Or, if you remember, the progress-indicator example, that could also be used. Like "downloading this file, at 15% now" and showing this in a window, and once it is done, after 20 additional seconds to close that window. Things like that.

Anyway. I hope I could explain what I am meaning here. So the TL;DR variant:

PS: Process.daemon is quite nice; I have not tested it on windows yet, but my hope is that I can start libui widgets from irb on windows and they will stay there, no matter whether I quit irb on windows or not. Perhaps that may be also useful for glimmer or the glimmer-shell.

AndyObtiva commented 1 year ago

This is a good idea. I'm going to move this issue to the Glimmer DSL for LibUI project because I think it is the Glimmer gem most suitable for this idea given that it works in CRuby and does not need any pre-requisites installed.

Otherwise, you are welcome to implement the idea yourself and submit a Pull Request if I don't get to it soon enough. When you think of simple ideas like this one, it would be better if you implement them and submit a Pull Request instead of submitting an issue. You would gain full credit for them and have a contribution made to Glimmer under your name in that case.