From 09352fb21933b7aa1880c2e25df1bc1fdb928ab4 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Wed, 31 Jul 2024 00:34:35 +0300 Subject: [PATCH] added zenity examples --- code/Bash/zenity/progress.sh | 26 ++++++++++++++++++++++++++ code/Bash/zenity/table.sh | 8 ++++++++ 2 files changed, 34 insertions(+) create mode 100755 code/Bash/zenity/progress.sh create mode 100755 code/Bash/zenity/table.sh diff --git a/code/Bash/zenity/progress.sh b/code/Bash/zenity/progress.sh new file mode 100755 index 0000000..ce881a4 --- /dev/null +++ b/code/Bash/zenity/progress.sh @@ -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 diff --git a/code/Bash/zenity/table.sh b/code/Bash/zenity/table.sh new file mode 100755 index 0000000..4f3b9bf --- /dev/null +++ b/code/Bash/zenity/table.sh @@ -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"