Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dd Install Method (Requires Root):
- Download the latest image file (.img) from the download link above. Place it in the root of your /sdcard folder and rename it to twrp.img. Run the following commands via adb shell or a terminal emulator app:
- su
- dd if=/sdcard/twrp.img of=/dev/block/bootdevice/by-name/recovery
- Changelog:
- npm i -D electron@latest
- npm i -D electron@beta
- npm i -D electron-nightly
- 59
- Before actually using GUI dialogues, consider using console prompts. Quite often you can get away with simple "y/n?" prompts, which in bash you achieve via the read command..
- read -p "Do something? ";
- if [ $REPLY == "y" ]; then
- echo yay;
- fi
- If console prompt's just won't cut it, Zenity is really easy to use, for example:
- zenity --error --text="Testing..."
- zenity --question --text="Continue?"
- This only works on Linux/Gnome (or rather, it'll only be installed by default on such systems). The read method will work on pretty much any platform (including headless machines, or via SSH)
- If you need anything more complex than what read or Zenity provides, "change to C++" is really the best method (although I'd recommend Python/Ruby over C++ for such shell-script-replacement tasks)
- I want to do simple interface for some strange game, the progress bar for health or something is the example for what I want. Variable "HEALTH" is 34, so make progress bar filled in 34/100
- As a command-line script, it'd use Python:
- $ export HEALTH=34
- $ python -c "import os; print '*' * int(os.environ.get('HEALTH', 0))"
- **********************************
- Or to normalise the values between 1 and 78 (so you don't get line-wrapping on a standard terminal size):
- $ python -c "import os; print '*' * int((int(os.environ.get('HEALTH', 0)) / 100.0) * 78)"
- Zenity also has a Progress Dialog,
- #!/bin/sh
- (
- echo "10" ; sleep 1
- echo "# Updating mail logs" ; sleep 1
- echo "20" ; sleep 1
- echo "# Resetting cron jobs" ; sleep 1
- echo "50" ; sleep 1
- echo "This line will just be ignored" ; sleep 1
- echo "75" ; sleep 1
- echo "# Rebooting system" ; sleep 1
- echo "100" ; sleep 1
- ) |
- zenity --progress \
- --title="Update System Logs" \
- --text="Scanning mail logs..." \
- --percentage=0
- if [ "$?" = -1 ] ; then
- zenity --error \
- --text="Update canceled."
- fi
- As I said before, if Zenity cannot do what you need, look into writing your game-thing as a "proper" script in Python/Ruby/Perl/C++/etc as it sounds like you're pushing the bounds of what a shell-script can do..
- shareimprove this answer
- edited Feb 19 '16 at 12:55
- Chris
- 8516
- answered May 29 '09 at 20:54
- dbr
- 120k57251317
- 1
- I don't want the yes/no, but I want to do simple interface for some strange game, the progress bar for health or something is the example for what I want. Variable "HEALTH" is 34, so make progress bar filled in 34/100. That I want to do. – lauriys May 29 '09 at 20:58
- The Progress Dialog link above is broken :( – Jeremy Iglehart Jul 24 '18 at 1:34
- add a comment
- 20
- If you want to write a graphical UI in bash, zenity is the way to go. This is what you can do with it:
- Application Options:
- --calendar Display calendar dialog
- --entry Display text entry dialog
- --error Display error dialog
- --info Display info dialog
- --file-selection Display file selection dialog
- --list Display list dialog
- --notification Display notification
- --progress Display progress indication dialog
- --question Display question dialog
- --warning Display warning dialog
- --scale Display scale dialog
- --text-info Display text information dialog
- Combining these widgets you can create pretty usable GUIs. Of course, it's not as flexible as a toolkit integrated into a programming language, but in some cases it's really useful.
- shareimprove this answer
- edited May 10 '18 at 20:43
- answered May 29 '09 at 21:07
- nxadm
- 1,9711016
- add a comment
- 13
- there is a command called dialog which uses the ncurses library. "Dialog is a program that will let you to present a variety of questions or display messages using dialog boxes from a shell script. These types of dialog boxes are implemented (though not all are necessarily compiled into dialog)"
- see http://pwet.fr/man/linux/commandes/dialog
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement