Skip to content

Commit 9c89e5c

Browse files
committed
Some minor bugfixes in "gum" mode
1 parent a716a78 commit 9c89e5c

5 files changed

Lines changed: 94 additions & 32 deletions

File tree

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ Simplified way to code bash made GUI frontend dialogs! Check the youtube video:
99

1010
## Introduction to EBG
1111

12-
... There is [bashlib](https://github.com/cyberark/bash-lib) that is for the code
13-
itselft, well so for the GUIs there is **EasyBashGUI** then!
14-
1512
**E**asy **B**ash **G**ui shortened as EBG, is a Posix compliant Bash functions
1613
library that aims to give unified GUI functions using frontends for dialogs boxeds
1714
(from the user's point of view are frontends but from the EGB side are backends)

lib/easybashgui.lib

Lines changed: 77 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#####################################
3636
#####################################
3737
#
38-
LIB_VERSION="13.0.0"
38+
LIB_VERSION="13.0.1"
3939
LIB_NAME="easybashgui.lib"
4040
LIB_URL="https://github.com/BashGui/easybashgui"
4141
LIB_AUTHOR="Vittorio Cagnetta"
@@ -1436,11 +1436,37 @@ elif [ "${mode}" = "gum" ]
14361436
#
14371437
testo="${@}"
14381438
#
1439+
#which_terminal="$(ps -o comm= -p $(ps -o ppid= -p $(ps -o ppid= -p $$ )))"
1440+
which_terminal="$(ps -o comm= -p $(ps -o ppid= -p $$ ))"
1441+
#
14391442
#########################################
14401443
#
14411444
frame "${widget_color}" "please confirm"
1442-
gum confirm --affirmative="Ok" --negative="Cancel" "$(echo -e "${testo}" )"
1443-
exit_code="${?}"
1445+
#
1446+
if [ "${which_terminal}" = "mate-terminal" -o "${which_terminal}" = "qterminal" -o "${which_terminal}" = "lxterminal" ]
1447+
then
1448+
#
1449+
gum confirm --affirmative="Ok" --negative="Cancel" "$(echo -e "${testo}" )"
1450+
exit_code="${?}"
1451+
echo -e "\n\t${testo}"
1452+
#
1453+
else
1454+
#
1455+
echo -e "\n\t${testo}"
1456+
gum choose --item.foreground 250 "Ok" "Cancel" 1> "${dir_tmp}/${file_tmp}"
1457+
answer=$(0< "${dir_tmp}/${file_tmp}" )
1458+
exit_code=$(if [ "${answer}" = "Ok" ]
1459+
then
1460+
echo 0
1461+
elif [ "${answer}" = "Cancel" ]
1462+
then
1463+
echo 1
1464+
else
1465+
echo 1
1466+
fi )
1467+
#
1468+
fi
1469+
#
14441470
echo
14451471
#########################################
14461472
#
@@ -1551,6 +1577,35 @@ elif [ "${notify_send}" = "NO" ]
15511577
#
15521578
notify_message_alt()
15531579
{
1580+
local FUNCT_NAME="notify_message_alt"
1581+
local IFS=$' \t\n'
1582+
#
1583+
#########################################
1584+
# Begin check for user custom geometry (and let's remove icon option)...
1585+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" -o "${1}" = "--icon" -o "${1}" = "-i" ]
1586+
do
1587+
if [ "${1}" = "--icon" -o "${1}" = "-i" ]
1588+
then
1589+
icon_parameter="${2}" ; [ -e "${icon_parameter}" ] && shift 2 || shift 1
1590+
continue
1591+
fi
1592+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
1593+
then
1594+
echo "width"
1595+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
1596+
then
1597+
echo "height"
1598+
fi )"
1599+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
1600+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
1601+
done
1602+
# End check for user custom geometry (and let's remove icon option)...
1603+
#########################################
1604+
#
1605+
: notify_send_seconds
1606+
notify_message_text="${@}"
1607+
#
1608+
#########################################
15541609
wait_for "\n\n${notify_message_text}\n\n\n\n(Please, install \"kdialog\" or \"notify-send\" for a nicer notification)\n\n."
15551610
sleep ${notify_send_seconds}
15561611
terminate_wait_for
@@ -1565,31 +1620,36 @@ elif [ "${notify_send}" = "NO" ]
15651620
local widget_color="yellow"
15661621
#
15671622
#########################################
1568-
# Begin check for user custom geometry...
1569-
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
1623+
# Begin check for user custom geometry (and let's remove icon option)...
1624+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" -o "${1}" = "--icon" -o "${1}" = "-i" ]
15701625
do
1626+
if [ "${1}" = "--icon" -o "${1}" = "-i" ]
1627+
then
1628+
icon_parameter="${2}" ; [ -e "${icon_parameter}" ] && shift 2 || shift 1
1629+
continue
1630+
fi
15711631
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
1572-
then
1573-
echo "width"
1574-
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
1575-
then
1576-
echo "height"
1577-
fi )"
1632+
then
1633+
echo "width"
1634+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
1635+
then
1636+
echo "height"
1637+
fi )"
15781638
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
15791639
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
15801640
done
1581-
# End check for user custom geometry...
1641+
# End check for user custom geometry (and let's remove icon option)...
15821642
#########################################
15831643
#
1584-
num_secondi=4
1585-
testo="${@}"
1644+
: notify_send_seconds
1645+
notify_message_text="${@}"
15861646
#
15871647
#########################################
15881648
frame "${widget_color}" "notification"
1589-
#bare_msg "${widget_color}" "${testo}"
1649+
#
15901650
echo -e "############################\n############################\n\n"
1591-
gum spin -s pulse --title "$(echo -e "${testo}" )" -- sleep ${num_secondi}
1592-
echo -e "${testo}"
1651+
gum spin -s pulse --title "$(echo -e "${notify_message_text}" )" -- sleep ${notify_send_seconds}
1652+
echo -e "${notify_message_text}"
15931653
echo -e "\n\n############################\n############################"
15941654
#
15951655
echo

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#EBGlib=$(wildcard easybashgui_[0-9].[0-9].[0-9])
2-
VERSION=13.0.0
2+
VERSION=13.0.1
33

44
#cartelle di destinazione
55
DESTDIR ?= ""

src/easybashgui

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
#
7777
#
7878
###################################################################
79-
MODULE_VERSION="13.0.0"
79+
MODULE_VERSION="13.0.1"
8080
MODULE_NAME="easybashgui"
8181
libexec_dir="/usr/lib/easybashgui"
8282
###################################################################
@@ -670,20 +670,25 @@ elif [ "${eb_gui_fallback}" = "true" ]
670670
local IFS=$' \t\n'
671671
#
672672
#########################################
673-
# Begin check for user custom geometry...
674-
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
673+
# Begin check for user custom geometry (and let's remove icon option)...
674+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" -o "${1}" = "--icon" -o "${1}" = "-i" ]
675675
do
676+
if [ "${1}" = "--icon" -o "${1}" = "-i" ]
677+
then
678+
icon_parameter="${2}" ; [ -e "${icon_parameter}" ] && shift 2 || shift 1
679+
continue
680+
fi
676681
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
677-
then
678-
echo "width"
679-
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
680-
then
681-
echo "height"
682-
fi )"
682+
then
683+
echo "width"
684+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
685+
then
686+
echo "height"
687+
fi )"
683688
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
684689
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
685690
done
686-
# End check for user custom geometry...
691+
# End check for user custom geometry (and let's remove icon option)...
687692
#########################################
688693
#
689694
num_secondi=4

src/easybashgui-debug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
#
7777
#
7878
###################################################################
79-
MODULE_VERSION="13.0.0"
79+
MODULE_VERSION="13.0.1"
8080
MODULE_NAME="easybashgui-debug"
8181
###################################################################
8282
#

0 commit comments

Comments
 (0)