Live data from Hacker News

Modernize your Bash Scripts by adding GUI

medium.com

31–40 of 72 posts

Re: Modernize your Bash Scripts by adding GUI

#31
post #24

Can’t read the article, guess I’m out of free reads this month/week. I wish there was some kind of rule against posting medium.com links on HN. That would incentivise people to use some other tools, for example dev.to or personal blogs.

Just block cookies on medium.com and enjoy the paywall-free experience. On Chrome, click the lock icon in the address bar, hit "Cookies", select "medium.com" and block. Then refresh.

Re: Modernize your Bash Scripts by adding GUI

#32
While the tool suggested here isn't the best interest of the HN community, I think it has some good use cases. Just think of making an otherwise terminal-only tool more usable for non tech-savvy folks. There are many terminal only tools out there that we have no problem using, but appear scary and unusable to people who haven't used a shell before. This might work as a "gateway drug" to GUI people into making text based interfaces more familiar.

Re: Modernize your Bash Scripts by adding GUI

#33
I once developed an entire CMS in Bash and Zenity. We could not use dynamic languages on the web server and only had an SSH access to a very restricted machine. The users where not technical and resented command line interface. So I learned Zenity and played with it up to te point where the website (it was essentially a calendar + attached documents interface) was entirely editable using the Zenity GUI. A few years later I heard that my script was still in use at the place where I made it. It was good fun. I just like doing stuff with Bash :).

Re: Modernize your Bash Scripts by adding GUI

#34
I use gitk pretty often and really like the fact that it acts like a modal, showing a richer UI visualization based on a shell command I run, and when I close it, I'm back to the command line where I was. I've been hoping to write my own CLI tools like that, ideally using React for the UI, but it seems like it's a big pain to set up right now. Is anyone aware of a nice way to do that? Maybe Zenity is flexible enough for arbitrary UIs, not just dialog boxes?

Re: Modernize your Bash Scripts by adding GUI

#35

"Tired of displaying raw text on Console?" Nope. I am a scripter. I will never get tired of raw text, but I sure get tired of GUIs, fast. If the author had pitched this as a way to make the scripter's scripts accessible to others who do not understand scripts, I would have a different response.

I feel like notifications would be the only thing on that list I could see myself using. I know you can make the terminal make a noise, but I sometimes prefer visual alerts.

Edit: I read the article, this is covered a bit.

On Linux you can use `notify-send "title" "content"`. The only limitation it has is that you can't query the notification id to update or selectively dismiss it later.

Also, many terminals will have a visual alert instead/together with a sound: konsole does this, for instance.

Re: Modernize your Bash Scripts by adding GUI

#36

This is such a backwards way of thinking. Like modernizing math by using little colored blocks with symbols written on them, because your tired of using boring old white and black pencil and paper... It's what you do to entertain children into being interested in something, not how adults get stuff done.

The vast majority of adults, like, all of them for pretty much any practical purpose, gets stuff done on computers outside of a shell using GUI programs exclusively. Outside of dev, ops, research etc. bubbles, bash might as well not exist at all. GUI apps are also a much more recent and, yes, modern evolution of human-computer interfaces, so modernizing doesn't sound wrong to me – we keep the terminal as a UI paradigm because it works very well for a certain class of interfacing needs, but it is low-tech and ancient and very limited when dealing with anything that isn't exclusively unicode text. Targeted UI modernization of select terminal programs by lifting them to the UI paradigm the industry has moved to decades ago doesn't feel backwards to me at all if it makes bits of shell technology available to everyone else without the steep and brutal learning curve of getting used to working in a shell.

Besides, isn't programming with syntax highlighting pretty much ubiquitous? Since, at this point in history, all programming I'm aware of boils down to a relatively practical application of maths, I'd argue colored blocks have already pretty much supplanted pencil and paper as the interface adults use to get stuff done.

Re: Modernize your Bash Scripts by adding GUI

#37

"Tired of displaying raw text on Console?" Nope. I am a scripter. I will never get tired of raw text, but I sure get tired of GUIs, fast. If the author had pitched this as a way to make the scripter's scripts accessible to others who do not understand scripts, I would have a different response.

Last sentence of the first paragraph "But if it is used by a general audience it is obviously good to have some user friendly interactions."

Yeah but was is this then a shell script which randomly pops up some windows you need to click away?

When your script was a bash script chances are you targeted proficient users with it. These might get annoyed by popping up stuff. This means ultimately you are probably better off adding a GUI and a --headless flag so both user categories are happy.

As I see it the only thing that is a little useful are the notifications (e.g. if you have some sort of daemon running in background that needs to bring sth to the users attention)

Re: Modernize your Bash Scripts by adding GUI

#39
post #10
post #3

If you just need to display some text or at most you need a "yes/no" answer that integrates well with your bash script, you could try herbe[1]. I was somewhat inspired by zenity, but it felt too heavy for my minimal use case. [1] https://github.com/dudik/herbe

Try `notify-send TEXT` instead. E.g. alias n="notify-send Completed."

I use something like:

    echo -e "command\n with a long output,\n and it's last line" |tee /dev/tty| tail -n 1| { read -d '\n' _output ; notify-send "$_output"; telegram-send "$_output"; }
This will send the last n lines of stdout to:

- gnome-notifications

- telegram on my phone from a bot account that uses a unique notification sound

Re: Modernize your Bash Scripts by adding GUI

#40
post #24

Can’t read the article, guess I’m out of free reads this month/week. I wish there was some kind of rule against posting medium.com links on HN. That would incentivise people to use some other tools, for example dev.to or personal blogs.

Just go incognito in the meantime..

Incognito is also blocking me.
Post reply on HN