Created
August 29, 2013 11:34
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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