Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 89 lines (74 sloc) 1.39 KB
#!/bin/bash
function is_running
{
PID=$(pidof -s $1)
if [[ $PID != "" ]]
then
return 0
else
return 1
fi
}
function launch_firefox
{
if is_running 'firefox';
then
ratpoison -c "select firefox"
else
ratpoison -c "echo Started"
firefox&
fi
}
function launch_terminal
{
if is_running 'urxvt';
then
ratpoison -c "select urxvt"
else
urxvt -e bash -c "tmux -2 -q has-session &>/dev/null && exec tmux \
attach-session -d || exec tmux new-session -n$USER \
-s$USER@$HOSTNAME weechat\; new-window"&
fi
}
function launch_bare_terminal
{
if is_running 'urxvt';
then
ratpoison -c "select urxvt"
else
urxvt -e bash -c "tmux -2 -q has-session &>/dev/null && exec tmux \
attach-session -d || exec tmux new-session -n$USER \
-s$USER@$HOSTNAME"&
fi
}
function launch_zathura
{
if is_running 'zathura';
then
ratpoison -c "select zathura"
else
zathura&
fi
}
function launch_weechat
{
launch_terminal
tmux select-window -t 0
}
case "$1" in
'firefox')
launch_firefox
;;
'terminal')
launch_terminal
;;
'bare-terminal')
launch_bare_terminal
;;
'zathura')
launch_zathura
;;
'weechat')
launch_weechat
;;
esac