Skip to content

Instantly share code, notes, and snippets.

@justbrowsing
Created August 29, 2013 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justbrowsing/6376957 to your computer and use it in GitHub Desktop.
Save justbrowsing/6376957 to your computer and use it in GitHub Desktop.
Simplistic terminal emulator script displaying one command at a time built with gtkdialog for [SuperUser](http://goo.gl/oDrgKl)
#!/bin/bash
####################
### oneterm ########
version="0.1" ######
### justbrowsing ###
####################
# Variables
GTKDIALOG=$(which gtkdialog 2>/dev/null);
TMPDIR="/tmp"
TMPFILE="${TMPDIR}/oneterm.log"
# Define dialog
ONE_TERM='
<window title="OneTerm" resizable="true">
<vbox>
<text width-request="300">
<label>Type something, press the Enter key, repeat...</label>
</text>
<comboboxentry has-focus="true">
<variable>readinput</variable>
<default>Type something here...</default>
<output file>'"$TMPFILE"'</output>
<action signal="activate">save:readinput</action>
<action signal="activate">refresh:readinput</action>
<action>echo >> '"$TMPFILE"'</action>
<action signal="activate">clear:vte0</action>
<action signal="activate">refresh:vte0</action>
</comboboxentry>
<terminal text-background-color="#fff" text-foreground-color="#000">
<variable>vte0</variable>
<input file>'"$TMPFILE"'</input>
</terminal>
</vbox>
</window>
'
# Create temp file
mkdir -p "$TMPDIR"
> "$TMPFILE"
# Run dialog
export PS1=''
export ONE_TERM
[ ! -z "$GTKDIALOG" ] && $GTKDIALOG --program=ONE_TERM || echo "==> ERROR: missing gtkdialog dependency"
### END ###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment