LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 07-03-2011, 03:31 AM   #1
Jelloir
LQ Newbie
 
Registered: Nov 2008
Posts: 5

Rep: Reputation: 0
Openbox autostart.sh and setting alias on openbox start


I want run the following command to set an alias to use gvim when running an Openbox session and vim when on the console.

Code:
if which gvim > /dev/null ; then alias vi='gvim' ; else alias vi='vim' ; fi
If I add this to ~/.bashrc its fine but will set gvim as the the default all the time regardless of running X/Openbox, which is no good.

I tried adding it to ~/.xinitrc and ~/.config/openbox/autostart.sh but the alias does not get applied. I also tried:

Code:
x-terminal-emulator -e "if which gvim > /dev/null ; then alias vi='gvim' ; else alias vi='vim' ; fi"
Which doesn't work either.

How can I apply this alias when only running and openbox/X session?
 
Old 07-03-2011, 03:56 AM   #2
Jelloir
LQ Newbie
 
Registered: Nov 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Edit: The below previous post doesn't work OK as my tty was just set to /dev/pts/1..... any suggestions appreciated.

I ended up using the following in ~/.bashrc

Code:
if [[ "$(tty)" = "/dev/pts/0" ]] && [[ $(which gvim) ]] ; then 
    alias vi='gvim'
else
    alias vi='vim'
fi
This seems to be working ok.

Last edited by Jelloir; 07-03-2011 at 04:04 AM. Reason: problem not resolved.
 
  


Reply

Tags
alias, autostart, openbox



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Help setting up Slackware with openbox, slim etc cra1g321 Slackware 15 03-30-2012 02:17 AM
Cannot cp menu.xml, rc.xml, and autostart.sh (Openbox) oalicein Linux - Newbie 2 02-10-2011 05:52 PM
[SOLVED] Question, Openbox autostart on second desktop TobiSGD Linux - Desktop 1 09-15-2010 08:36 PM
[openbox] My autostart.sh file is not restoring things Removed44 Linux - Newbie 4 06-14-2010 09:31 PM
how to start openbox session with Numlock ON? frenchn00b Linux - Newbie 1 06-26-2007 06:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 04:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration