You are not logged in.

#1 2018-12-04 14:24:55

felixdatboi
Member
Registered: 2018-11-01
Posts: 26

i3, command to launch another urxvt instance with same path.

I want to be able to press mod+shift+enter to open another terminal with the same path.

I read that u can do this in bash by: `urxvt &`.

So I tried with putting this into my i3 config:

`# Start a new terminal (urxvt) with same path
bindsym $mod+Shift+Return exec "/bin/bash | echo $(urxvt &)"`

But nothing happens when I execute it.

What can I do instead?

Offline

#2 2018-12-04 14:58:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,525
Website

Re: i3, command to launch another urxvt instance with same path.

There seem to be two levels of confusion here.  First, `urxvt &` works from an interactive shell in the way you want because it is a child process of that shell and thus inherits the environment including PWD.  If `urxvt &` is not launched from that shell, it cannot inherit the environment.  If you run urxvt, or `urxvt &` from a keybinding there may already be several terminals open each in a different working directory - how could the new one know which directory to use?

Second, what you put in your i3 config is nothing like `urxvt &`.  Where on earth did you get the idea to pipe bash to the return value of a backgrounded terminal?  That is complete giberish.

What you are attempting is not possible (at least not without extensive coding to create an entirely new tool that might detect the focused window, determine if it is a terminal, and if so dig through procfs to find it's environment and/or PWD and 'steal' it for the new process).  However, using screen or tmux will make this trivially easy: you can open a new screen/tmux window or pane with a keybinding and it can keep the current working directory of the active window/pane that it was launched from.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-12-04 16:11:20

felixdatboi
Member
Registered: 2018-11-01
Posts: 26

Re: i3, command to launch another urxvt instance with same path.

Haha alright, still tinkering..

Thanks, now i might finally have a real reason to install tmux

Offline

Board footer

Powered by FluxBB