You are not logged in.

#26 2016-11-29 16:51:24

LithoUser
Member
Registered: 2016-11-17
Posts: 139

Re: [SOLVED] Automatically open vim inside tmux inside urxvt in Openbox

OK, I've finally figured out why my bashrc is not sourced with woodape's script or with the command provided above.
I have the following code at the beginning of my .bashrc :

[[ $- != *i* ]] && return

So my bashrc is in fact sourced correctly, but the above code prevents it from being fully loaded in a non-login shell. So it also prevents me from being able to use my alias or functions defined in my bashrc as commands in vim (when launched from my openbox menu of course). It also prevents me from being able to easily toggle transparency on and off thanx to the transset-df tool.

Is it risky to delete this line of code ? What specifically should not be done in a non-login shell that this line tries to avoid ? I don't seem to be able to formulate a search correctly so that I can find some infos on it. Thanx for keeping helping me !

Last edited by LithoUser (2016-11-29 16:52:46)

Offline

#27 2016-11-29 16:54:10

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

Re: [SOLVED] Automatically open vim inside tmux inside urxvt in Openbox

If you need it to be a login shell, specify the login shell flag which I provided in one of the commands.


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

Offline

#28 2016-11-29 17:00:36

woodape
Member
Registered: 2015-03-25
Posts: 159

Re: [SOLVED] Automatically open vim inside tmux inside urxvt in Openbox

LithoUser wrote:

Thanx for the info. I've tried your quickkeep script, double checking that xdotool and wmctrl are installed, since they're used by the script.

Unfortunately, my .bashrc is not even sourced with it. All the rest is fine (urxvt opens correctly, and so does tmux). So I assume I have a problem with my .bashrc config. I have a .bash_profile with just the following line :

[[ -f ~/.bashrc ]] && . ~/.bashrc

What am I missing ?

I have the samin in my bash_profile, I believe it is the Arch default. Are you certain bashrc isn't sourced? Me and my brother use this script daily and it sources ours. Try putting something like

 alias test_time='echo "this is a test to see if bashrc is sourced"' 

at the bottom of your bashrc. Then run the quickkeep script like "quickkeep Test" (opens a blank terminal with tmux session named Test) and type "test_time" and see if it prints the message. If so, your bashrc is being sourced.

EDIT: I started writing this post before the last two in this thread. Why are you using bashrc aliases from within Vim? This sounds particularly weird. I also have

[[ $- != *i* ]] && return

in my bashrc and it sources just fine with my quickkeep script, whether I call it from a terminal or from somewhere else. Whatever is going on, its not likely to be because of that line.

Last edited by woodape (2016-11-29 17:20:09)

Offline

#29 2016-11-29 18:49:40

LithoUser
Member
Registered: 2016-11-17
Posts: 139

Re: [SOLVED] Automatically open vim inside tmux inside urxvt in Openbox

OK, I was wrong (once again !) The `[[ $- != *i* ]] && return` code doesn't prevent my bashrc from being read because it's a non-login shell, but because it's a non *interactive* shell. So I assume I could pass the interactive flag to bash, but as soon as I do it, urxvt is still opened with a tmux session in it, but vim doesn't open anymore (so basically I just have my prompt inside urxvt) :

urxvt -e bash -c -i 'tmux new-session vim /home/me/myfile.txt'

woodape > My bashrc is sourced, as I said in a previous post, but it's not read (when launched from your script or from my openbox menu with the above command) because of the `[[ $- != *i* ]] && return` instruction at the beginning of it. Therefore it's useless, and I don't get the point : why would I want it to be sourced if it can't be read ? That's why I've asked for some explanations :

Is it risky to delete this line of code ? What specifically should not be done in a non-login shell that this line tries to avoid ? I don't seem to be able to formulate a search correctly so that I can find some infos on it. Thanx for keeping helping me !

Edit : a detailed answer can be found here. Now that this point is clear too, I consider this post as solved. Thank you very much for your help everyone !

Last edited by LithoUser (2016-11-30 03:27:03)

Offline

Board footer

Powered by FluxBB