Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-06-26 13:48:00

va9iff
Member
From: Baku
Registered: 2024-04-23
Posts: 18

`xfce4-terminal -e` problem with `&`

it's probably my lack of knowledge, but I couldn't find a way so posting here. what's the problem with those?

I have a keyboard shortcut with command `xfce4-terminal -e /path/to/file` and that's the `file`

#!/usr/bin/env bash
cat $0
read -n1 c
case $c in

	1) gnome-calculator ;;
	# open terminal + working app. fair enought.

	2) gnome-calculator & ;;
	# no open terminal. good. but why don't work?

	3) setsid gnome-calculator;;
	# again open terminal + working app.

	4) setsid gnome-calculator &;;
	# and again & creating problems. why don't it let it run???

	5) setsid gnome-calculator & sleep 1;;
	# okay I got it. it needs some time but I don't wanna hardcode a delay.

	# how can I make it run independently from the xfce4-terminal ? 
esac

exit

I can't figure out a way to launch an independent command that's not gonna get terminated when its terminal window is closed (which is invoked as xfce4-terminal -e /path/to/file)

Offline

#2 2024-06-26 15:14:18

gogogadget
Member
Registered: 2023-03-19
Posts: 28

Re: `xfce4-terminal -e` problem with `&`

# how can I make it run independently from the xfce4-terminal ?

If you want your command to not be a child process of the terminal, use the nohup command.

nohup gnome-calculator &

EndeavourOS
Xfce+gtk3-classic (no CSD)+Picom

Offline

#3 2024-06-26 15:54:09

va9iff
Member
From: Baku
Registered: 2024-04-23
Posts: 18

Re: `xfce4-terminal -e` problem with `&`

gogogadget wrote:

se the nohup command.

I know this. but my point is not just "doing something" I want to do it with xfce4-terminal -e flag. here's the code with your solution included, please just bind a keyboard shortcut it to

xfce4-terminal e- "/path/to/file"

and check if your solution works either.

#!/usr/bin/env bash
cat $0
read -n1 c
case $c in

	# ...

	6) nohup gnome-calculator & ;;
	# doesn't work

	7) nohup gnome-calculator & sleep 1
	# works

esac
exit

Last edited by va9iff (2024-06-26 15:55:24)

Offline

#4 2024-06-26 16:23:06

Tamaranch
Member
Registered: 2020-12-31
Posts: 321

Re: `xfce4-terminal -e` problem with `&`

You need to add

set -m

in your script.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 523.39 KiB (Peak: 529.78 KiB) ]