3

I've created a couple of very simple bash scripts for a home-made games arcade (input configuration, updating stuff etc). I've got a launcher, so it's not a problem to direct the user to run the wanted shell script, but while running a bash script functionality-wise gives me everything I need, the default low-res text-on-black look scares the end user.

What is the simplest way to "prettify" fullscreen shell scripts? Something that'll run the script in 1080p, use bigger bubbly antialiased fonts, add a fancy animated background etc., but still pretty much lets me stick to write good-old shell scripts?

I guess another way to ask is: Does a prettier, more modern GUI-looking alternative to whiptail exist?

I am running from the terminal, so the GUI library it would have to be as fully self-contained as possible.

jkgeyti
  • 2,344
  • 18
  • 31

2 Answers2

1

The ability of a shell script to display a quit within the terminal window itself is limited entirely to the graphical capabilities of the terminal (and to what termcap/terminfo has support for).

Most terminals max out at 256 colors (though supposedly konsole has support for arbitrary RGB colors somehow).

Control over font sizing/etc. from the shell is limited to the escape sequences that the terminal is willing to respond to (and I don't know if those are at all standard or discoverable at runtime).

The best option for this might be to have your script re-exec itself in a new terminal window to which it passes appropriate arguments to control font selection, window geometry, color selection, etc.

That being said even reliably doing that isn't necessarily the easiest thing in the world (I'm not sure how portable the command line options are between different terminal emulators or how many more advanced features they expose).

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
  • It doesn't even have to be a "better" terminal, such as `fbterm`. I wouldn't mind using some sort of SDL based whiptail alternative, as long the programming interface fits well into a bash script, e.g. `myval = $('whatever --popup ...'). I really just need a reasonably simple way to create extremely simple, reasonably pretty, fullscreen applications. – jkgeyti Aug 24 '14 at 14:03
  • That, to one extent or another, describes just about every "scripting" language that exists. From perl, python and ruby to tcl and lua. None of them all the shell but they all can do that sort of work. If you are interested in simple prompts and not an "application" as such then something like `zenity` might be of use. (I imagine a similar thing exists for Qt/KDE.) – Etan Reisner Aug 24 '14 at 15:57
  • Trouble is either that they're too complex for simple workflows (qt), or targeted towards the wrong thing, i.e. zenity being targeted towards windowed mouse/keyboard modes. I need extremely simple input, but it has to be full-screen and somewhat flashy. I am considering if setting a background image in fbterm, using a different font, and using whiptail would be good enough. – jkgeyti Aug 24 '14 at 16:06
1

You could use python with the library Gooey that makes easy to turn CLI applications to GUI:

Gooey

It can be customized and it takes only one line for the magic to happen:

from gooey import Gooey

@Gooey      <--- all it takes! :)
def main():
  # rest of code
enrico.bacis
  • 30,497
  • 10
  • 86
  • 115
  • Someone reads hackernews ;) While nifty, it solves the same problem as zenity. It's very mouse-GUI-centric. Think gooey for fullscreen gaming-interfaces. – jkgeyti Aug 25 '14 at 08:32
  • @jkgeyti Exactly ;) But i think Gooey is a good resource for future readers – enrico.bacis Aug 25 '14 at 08:33