0

Basically, I'd like to use a launcher to open a new tab with a program running in it when I already have a terminal open (obviously). To do this I use

xfce4-terminal --tab --drop-down -x

You'll notice I'm also using the

--drop-down

Which is essential to my ideal set up but am unsure if it matters to my question, but I included it just in case.

Anyway, what is bothering me is that when I have no terminal open at all and I use the above command/click launcher, what essentially amounts to a useless empty tab opens as well as the desired tab with the program running in it. Is there any way to prevent this empty tab?

1 Answer 1

1

A simple script like this can be used to prevent the empty tab:

#!/bin/bash

c=$(ps -e | grep -c xfce4-terminal)

if [ $c -gt 0 ]
    then
        xfce4-terminal --tab --drop-down -x $1
    else
        xfce4-terminal --drop-down -x $1
fi

Assuming the script is named xfce4termtab, the launcher command would be either

xfce4termtab program

or, with an argument

xfce4termtab 'program arg'

Notes:

  • The script's permissions need to be set to make it executable.
  • If the script isn't located in a directory on your PATH, you'll need to provide the full path to the script in the launcher command.
1
  • Thank you so much! I ment to check this solved a long time ago but life got in the way and well, I plum forgot. But seriously, this was EXACTLY what I was looking for! Thanks again! May 25, 2021 at 7:38

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.