v1cont / yad

Yet Another Dialog
GNU General Public License v3.0
657 stars 58 forks source link

Bash for Yad 0.42.1 Doesn't Work With 11.0 #162

Open 0pLuS0 opened 2 years ago

0pLuS0 commented 2 years ago

Hello,

I have been using yad 0.42.1 with these scripts I'm attaching, and I compiled 11.0 and neither of scripts now works with 11.0, and I didn't think anything in the way of the bash scripting would of changed.

I really don't know what to change on these scripts to make them work with 11.0? Any help to get them working would be appreciated.

THANKS

P.S. I changed the .sh extensions to .txt to upload them here...

exit.txt

openvpn.txt

folknor commented 2 years ago

openvpn.txt

#!/bin/bash

function confirm_close () {
    yad --title="OpenVPN Shutdown" --window-icon="/home/foo/.icons/AwOken/clear/128x128/apps/openvpn.png" \
    --center --width="360" --height="100" --image="dialog-question" \
    --text="Click 'OK' To Shutdown OpenVPN\nClick 'Cancel' to Keep OpenVPN Running"
    [[ $? -eq 0 ]] && kill -USR1 $YAD_PID
}
export -f confirm_close

    sudo -b openvpn --config /etc/openvpn/jp.protonvpn.conf| \
    yad --fontname="Aller 10" --text-info --wrap --fore="#c1c1c1" --back="#1f4b64" --button="Close:bash -c confirm_close" \
    --center --width="700" --height="450" --title="OpenVPN" \
    --window-icon="/home/foo/.icons/AwOken/clear/128x128/apps/openvpn.png"

[[ $? -eq 0 ]] && sudo killall openvpn 2>/dev/null

exit.txt

#! /bin/bash

action=$(yad --center --width 300 --entry --title "System Logout" \
    --window-icon=system-shutdown \
    --image=system-shutdown \
    --button="gtk-close:1" --button="gtk-ok:0" \
    --text "Choose action:" \
    --entry-text \
    "Logout" "Reboot" "Power Off")
ret=$?

[[ $ret -eq 1 ]] && exit 0

case $action in
    Logout*) cmd="killall openbox" ;;
    Reboot*) cmd="sudo /sbin/reboot" ;;
    Power*) cmd="sudo /sbin/poweroff" ;;
            *) exit 1 ;;
        esac

eval exec $cmd
v1cont commented 2 years ago

can you describe more thoroughly how it doesn't work? i cannot check openvpn script, but in logout all wrongs that i see is a missing images on buttons. the last can be simply fixed by replacing gtk-ok/gtk-close to yad-ok/yad-close

0pLuS0 commented 2 years ago

Sorry I didn't describe in detail.

I meant to say, when I try to run both scripts nothing happens.

I'll test this again for openvpn, and I'll replace gtk-ok/gtk-close to yad-ok/yad-close

I'll get back to you...

THANKS

0pLuS0 commented 2 years ago

Sorry for gettting back so late.

When I try to run the newer versions of Yad, I now get this at the terminal and yad won't run;

(yad:32136): GLib-GIO-ERROR **: 14:42:00.209: Settings schema 'yad.settings' is not installed

0pLuS0 commented 1 year ago

can you describe more thoroughly how it doesn't work? i cannot check openvpn script, but in logout all wrongs that i see is a missing images on buttons. the last can be simply fixed by replacing gtk-ok/gtk-close to yad-ok/yad-close

I'm using Yad 12.0

The OpenVPN script works and yad-ok/yad-close works on the Exit script.

I just forgot to update the schema, so everything is all good now.

I just wanted to come back and say THANKS!

Keep up the great work, I love YAD!