Created
March 3, 2019 00:30
-
-
Save mrf345/9facf0525f912c2eab4865bd146d9409 to your computer and use it in GitHub Desktop.
My bash configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ~/.bashrc | |
# | |
source ~/.bash_prompt | |
export VISUAL="emacs -nw" | |
export EDITOR="emacs -nw" | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
alias ls='ls --color=auto' | |
# Aliasing emacs | |
function e() { | |
emacs -nw "$1" | |
} | |
# Function to change title | |
function title() { | |
if [[ -z "$ORIG" ]]; then | |
ORIG=$PS1 | |
fi | |
TITLE="\[\e]2;$*\a\]" | |
PS1=${ORIG}${TITLE} | |
} | |
# Function to lunch new app in new workspace | |
function lunch() { | |
fluxbox-remote addworkspace | |
fluxbox-remote "workspace 0" | |
$1 && fluxbox-remote removelastworkspace | |
} | |
# read the note | |
function notes() { | |
if [ "$1" == "default" ];then | |
echo "$2" > ~/.notes/default | |
elif [ -f ~/.notes/"$1".md ];then | |
mdv -t 696.6153 ~/.notes/"$1".md | |
else | |
[ -f ~/.notes/"$todo".md ] && d="$todo" || d=$(cat ~/.notes/default) | |
mdv -t 696.6153 ~/.notes/"$d".md | |
fi | |
} | |
# activate default virtualenv if not | |
if [ "$(whereis open | grep .venv2.7)" == "" ];then | |
source ~/.venv2.7/bin/activate | |
fi | |
# start X if not already started | |
if [ "$(ps -u $(whoami) | grep fluxbox)" == "" ];then | |
startx | |
else | |
# After entering WM | |
read -p " What will you do ? " todo | |
if [ "$todo" != "" ];then title "$todo"; fi | |
clear | |
notes | |
# try to execute the title regardless, simpler workaround for dev terminal | |
$todo > /dev/null 2>&1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment