From 40aba20b8c4d210678a9ccc784f0d883acb0f330 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Tue, 11 Oct 2016 09:23:33 +0530 Subject: [PATCH] Shell: Update old TERM code --- .shell.d/funs_rc | 2 +- .shell.d/main_rc | 40 ++++++++++++++++++++-------------------- .xprofile | 6 ++++-- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.shell.d/funs_rc b/.shell.d/funs_rc index e5bb4619..c2e74f6d 100644 --- a/.shell.d/funs_rc +++ b/.shell.d/funs_rc @@ -33,7 +33,7 @@ mkcd () { cd "$1" } -## Quick search. +## Quick search. More flexible alternative: 'ff -di'. search () { find . -iname "*$1*" } diff --git a/.shell.d/main_rc b/.shell.d/main_rc index 5f41e749..bfbf4f27 100644 --- a/.shell.d/main_rc +++ b/.shell.d/main_rc @@ -2,28 +2,18 @@ ## Shell configuration ## Terminal -## WARNING: this is often a bad idea! +## WARNING: This is often a bad idea! ## FreeBSD urxvt $TERM variable is not set properly for some reasons. -if [ ! "$(uname -o)" = "GNU/Linux" ]; then - case "$TERM" in - *rxvt*) export TERM="rxvt-unicode-256color";; - esac -fi +# if [ ! "$(uname -o)" = "GNU/Linux" ]; then +# case "$TERM" in +# *rxvt*) export TERM="rxvt-unicode-256color";; +# esac +# fi ## Most xterm-based terminals support 256 colors, so let's turn this on. -if [ "$TERM" = "xterm" ]; then - export TERM="xterm-256color" -fi - -## Enable color support of ls. -if [ "$TERM" != "dumb" ] && [ "$OSTYPE" = "linux-gnu" ]; then - eval "$(dircolors "$HOME/.shell.d/dircolorsdb")" -elif [ "$TERM" != "dumb" ]; then - export LSCOLORS="Ex" - # export LSCOLORS="ExfxcxDxCxdxdxCxCxECEh" -fi - -## Title -## If this is an xterm set the title to user@host:dir +# if [ "$TERM" = "xterm" ]; then +# export TERM="xterm-256color" +# fi +## Title: If this is an xterm set the title to user@host:dir #case "$TERM" in #xterm*|rxvt*) # PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' @@ -31,3 +21,13 @@ fi #*) # ;; #esac + +## Enable color support of ls. +if [ "$TERM" != "dumb" ]; then + if [ "$OSTYPE" = "linux-gnu" ]; then + eval "$(dircolors "$HOME/.shell.d/dircolorsdb")" + else + export LSCOLORS="Ex" + # export LSCOLORS="ExfxcxDxCxdxdxCxCxECEh" + fi +fi diff --git a/.xprofile b/.xprofile index 10819141..66e5fc02 100644 --- a/.xprofile +++ b/.xprofile @@ -1,7 +1,7 @@ #!/bin/sh ## This file is sourced by some DM and should not contain any desktop execution. -## Internet browsers. They need X to run. +## Internet browsers that need X to run. for i in qutebrowser dwb luakit chromium google-chrome; do command -v $i >/dev/null 2>&1 && export BROWSER=$i && break done @@ -29,7 +29,9 @@ fi ## This env variable is used by some programs (e.g. ranger, awesome) to get the ## terminal executable name. -export TERMCMD="urxvt" +for i in urxvt xterm; do + command -v $i >/dev/null 2>&1 && export TERMCMD=$i && break +done ## Hook. Should be sourced last. [ -f ~/.xprofile_hook ] && . ~/.xprofile_hook