1

After executing a command for a bash terminal application the window closes. This can happen when the terminal is opened by a automatism like a keybinding (e.g. in i3wm/i3) or invoked by a script.

E.g. Let's say I want to create a keybinding for xprop (terminal application which shows the window id). In i3wm (aka i3) this is usually done by:

bindsym $mod+F8 exec i3-sensible-terminal -e 'xprop'

However, I cannot read the output because after executing the command – and indicating/clicking on the desired window – the terminal-window closes immediately.

1
  • this suggests to put a ; bash after the command (i.e.: bindsym $mod+F8 exec i3-sensible-terminal -e 'xprop; bash') – it doesen't work.
    – alex
    Oct 10, 2019 at 11:53

2 Answers 2

1

Use:

bash -c '<YOUR-DESIRED-COMMAND> & read line'

In the case of a the i3 keybinding this translates to:

bindsym $mod+F8 exec i3-sensible-terminal -e bash -c 'xprop & read line'

Also – kinda workaround – also could be:

bindsym $mod+F8 exec i3-sensible-terminal -e bash -c 'xprop & sleep 60'

The terminal is kept awake – by sleeping (o; – for 60 seconds with the & sleep 60 command.

1
  • alex's answer worked for me only after adding quotes: bindsym $mod+F8 exec i3-sensible-terminal -e "bash -c 'xprop & read line'"
    – Shawn
    Aug 4, 2020 at 14:11
1

You can just chain bash onto the end. This works:

bindsym $mod+z exec --no-startup-id i3-sensible-terminal -e "bash -c 'xprop && bash'"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .