You are not logged in.

#1 2021-12-18 21:28:25

peonerovv
Member
Registered: 2021-08-11
Posts: 34

[SOLVED] St closes after executing a script from shortcut/dmenu

Hi,
I want to execute a command (in my case

 curl wttr.in 

) that would be displayed in st and would be launched as a shortcut.
So for example I press a shortcut which executes st with the command I mentioned and then leaves it in interactive mode. I have figured out how to launch st, but it closes immediately after finishing the command. How do I fix it?
Thanks.

Last edited by peonerovv (2021-12-19 09:04:11)

Offline

#2 2021-12-18 22:41:40

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,096

Re: [SOLVED] St closes after executing a script from shortcut/dmenu

I don't see an equivalent of the "-hold" switch, so you'll have to stall the subprocess

st -e bash -c 'curl wttr.in/NY; read'

Offline

#3 2021-12-18 23:03:00

peonerovv
Member
Registered: 2021-08-11
Posts: 34

Re: [SOLVED] St closes after executing a script from shortcut/dmenu

That seems to work, although I'd also like to be able to interact with it after I get the output. Maybe if I somehow could add the command to .bashrc, launch st and put it back into the previous state?

Offline

#4 2021-12-19 07:42:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,096

Re: [SOLVED] St closes after executing a script from shortcut/dmenu

st -e bash --rcfile <(cat ~/.bashrc; echo 'curl wttr.in/NY')

nb. that the calling context must support bash syntax!

Offline

#5 2021-12-19 09:03:47

peonerovv
Member
Registered: 2021-08-11
Posts: 34

Re: [SOLVED] St closes after executing a script from shortcut/dmenu

Thanks! That works perfectly. I see how it works: you give bash the rcfile with echo attached on top of the output, but the file itself doesn't change.

Offline

Board footer

Powered by FluxBB