1
#!/bin/sh
xfce4-terminal
zenity --info
exit

Expected behavior on my Xfce4 desktop when the script is run (via a keyboard shortcut) is that the Terminal window appears. Only when I close same should the Zenity window then appear.

Normally, this is exactly what happens. However, if I first open an Xfce4 Terminal window on the desktop, then command the subject script (again, via a keyboard shortcut), another terminal window appears (as expected), but, simultaneously, so does the Zenity window. This is undesired behavior.

I have tried many things, including the wait command and appending the terminal line with &&. Nothing is working for me.

What is causing this to happen and how can I remedy it?

2
  • Do you want to open a xfc4-terminal, do stuff maybe into it, and when you manually close it, the zenity to popup?
    – thanasisp
    Nov 9, 2020 at 23:48
  • @thanasisp Yes, that is exactly what I want to do...
    – Digger
    Nov 9, 2020 at 23:59

1 Answer 1

1

Give a try to this, I tested and looks good.

xfce4-terminal -x bash -c 'trap "zenity --info" EXIT; bash'

When executed, it opens a new xfce4-terminal, and executes the command following. This command is a shell trap. That means when this same process, the new-opened terminal, gets the signal to EXIT, will execute the quoted command. The last bash is to give a prompt, after the trap is set, like in this post. I also tried -H but didn't work as expected.

1
  • If you want to include any other commands into this, to run in the new terminal before you do anything manually, you can add them into there: -c 'trap "zenity --info" EXIT; command1; command2; bash'. Also if you run a GUI program, maybe try also to send it to the background, like jedit &, this will open the program, but also free the terminal for use. Anything else you run outside this command, is not directly relevant to when the zenity popup appears.
    – thanasisp
    Nov 10, 2020 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.