[HN Gopher] Yad: Create ad-hoc GTK GUIs from shell
___________________________________________________________________
Yad: Create ad-hoc GTK GUIs from shell
Author : asicsp
Score : 47 points
Date : 2021-09-07 12:15 UTC (1 days ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| dwheeler wrote:
| I've used zenity to do the same kind of thing. If you're writing
| a simple shell script & need some simplistic local GUI
| interaction, zenity is great; it's easy to create / read / modify
| the code.
| marcodiego wrote:
| Quick look at the examples: https://sanana.kiev.ua/index.php/yad
| ... Looks like too much code.
|
| I think apple's Visual Format Language
| https://developer.apple.com/library/archive/documentation/Us...
| seems a better approach.
| PaulDavisThe1st wrote:
| VFL uses a constraint-packing model, which is excellent for UIs
| that may be resized (can we all say "mobile" ?).
|
| It doesn't offer the same level of fine-grained control over
| the actual widgets, and tends to feel (in|less ) appropriate
| with fixed-sized windows.
|
| Also, these are not really comparable examples. The Yad one
| shows the full interaction with the shell script; the VPL one
| shows merely how to construct the UI, but does not show any
| integration with the logic residing in a script.
| ducktective wrote:
| Yad is fantastic! Write the core of your app in bash/curl/jq,
| then write a thin wrapper to invoke yad so your app is
| presentable to non-techie people.
|
| Also see:
|
| https://wiki.gnome.org/Projects/Zenity (also gtk, less features,
| GNOME project)
|
| In KDE/Qt domain:
|
| https://github.com/KDE/kdialog
|
| https://github.com/luebking/qarma
| jhgb wrote:
| There's also GTK-server: https://www.gtk-server.org
| amelius wrote:
| Sounds like something Tcl/Tk would be an appropriate tool for.
| fwip wrote:
| This is nifty. Is there any similar tool that presents the UI as
| a web page, rather than a GTK gui?
| nsajko wrote:
| GTK actually seems to be capable of this for many years, with
| its "Broadway" GDK backend:
|
| GTK4 docs: https://docs.gtk.org/gtk4/broadway.html
|
| GTK3 docs: https://docs.gtk.org/gtk3/broadway.html
| moondev wrote:
| You can run broadway inside a container as well. Yad could
| make an interesting entrypoint for it
| overgard wrote:
| I think this is super impressive and super far into the realm of
| "oh my god please don't actually use this for anything real".
| jlg23 wrote:
| > "oh my god please don't actually use this for anything real"
|
| Dare do explain why? If all you need is a form to pop up and
| some way to save the data, this is probably the least steep
| learning curve for anyone who already has to work on a UNIX but
| is clueless about it.
| overgard wrote:
| A few reasons:
|
| - Now you can't use these shell scripts purely on the shell
|
| - Bash is a terrible language for writing complex programs.
| If you actually are at the point where you need a GUI your
| program is complex enough that you should use a scripting
| language. It's going to be more maintainable, probably
| shorter. I don't really buy that bash is more accessible to
| non-programmer ops people. If you're getting to the point
| where you're writing a GUI, you are programming, you're just
| programming in a bad/slow language.
| calvinmorrison wrote:
| zenity also does this. It can be useful to gather user data for
| scripts you don't run from the terminal (say a hotkey)
| jordemort wrote:
| This appears to allow you to build significantly more complex
| dialogs than zenity.
| jandrese wrote:
| Zenity is very limited in what it can do though. You slam into
| the limits with some pretty simple requirements. Plus it spits
| out an annoying warning about parentless modal dialogs every
| time you use it.
|
| That said I've used it quite a lot because it is installed by
| default. If you can't guarantee that anything has been
| installed on the system or that you have an Internet connection
| it is incredibly helpful to have a simple GUI system available
| to shell scripts by default.
| indigodaddy wrote:
| Yad has been around for a very long time. I was using it ~2010 to
| build system startup login dialogs for systems I was purposing as
| "thin clients"
| stuaxo wrote:
| This really needs a few examples with screenshots.
| ducktective wrote:
| http://smokey01.com/yad/
|
| https://sourceforge.net/p/yad-dialog/wiki/Examples/
| p4bl0 wrote:
| A long time ago when I was a student and elected at my
| university's board, I built an entire CMS system using zenity (an
| equivalent of Yad) because I wanted non-technical people (other
| elected students) to be able to update a static website easily.
| We only had static web space to publish the board's documents and
| our minutes of each of the boards reunion for other students. It
| even worked okay over ssh with -X (of course I created a clic-me
| launcher for the other they wouldn't open a terminal and ssh -X
| into the university's server). It was... _kinda_ fun, in its own
| way.
___________________________________________________________________
(page generated 2021-09-08 23:01 UTC)