added zenity examples

This commit is contained in:
Alexander Popov 2024-07-31 00:34:35 +03:00
parent dd1c195da5
commit 09352fb219
2 changed files with 34 additions and 0 deletions

26
code/Bash/zenity/progress.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
# https://help.gnome.org/users/zenity/stable/progress.html.en
(
echo "0" ; sleep 1
echo "# Scanning mail logs..." ; sleep 1
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="..." \
--percentage=0
if [ "$?" = -1 ] ; then
zenity --error \
--text="Update canceled."
fi

8
code/Bash/zenity/table.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
for i in $(seq 1 10)
do
echo "bla bla"
echo "xxx"
echo "$i"
done | zenity --list --title="title" --text="text" --column="X" --column="Y" --column="Z"