# Usefull commands:
alias setBG='fbsetbg -f '
alias takeRegionShot='scrot -b -s '
alias takeFullShot='scrot -b -c -d 5 '
alias takeWinShot='scrot -b -c -d 5 -u '

# KDE 
alias saveKDESession='qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.saveCurrentSession'

# For trustworthy copies. Be aware of SRC/ DST/ x SRC DST/ 
alias rsyncNoDelete='rsync --archive --perms --owner --group --copy-devices --specials --times --atimes --open-noatime --links --verbose --recursive --update --progress '
alias rsyncWithDeleteTest='rsync --dry-run --itemize-changes --archive --perms --owner --group --copy-devices --specials --times --atimes --open-noatime --links --verbose --recursive --delete --delete-excluded --update --progress '
alias rsyncWithDelete='rsync --archive --perms --owner --group --copy-devices --specials --times --atimes --open-noatime --links --verbose --recursive --delete --delete-excluded --update --progress '

# Fixes:
alias ps1fix='cd ~ > /dev/null && . .profile && cd - > /dev/null'

# Command tunnings:
if [ -x $(which alsamixer) ]; then
    alias alsamixer='alsamixer -c0 '
fi

if [ -x $(which htop) ]; then
    alias top='htop '
fi

if [ -x $(which vim) ]; then
    alias vi='vim '
fi

if [ -x $(which colortail) ]; then
    alias tail='colortail '
fi

if [ -x $(which most) ]; then
    export MANPAGER="$(which most) -s"
fi 

if [ -x $(which batcat) ]; then
    alias cat='batcat -p'
fi

if [ -x "$(which exa)" ]; then
    alias ls='exa --icons --git --group '
    alias l='ls -l -H'
    alias ll='ls -la -H'

    #alias tree='exa --tree --icons --git'
    function mytree () {
        if [[ $1 =~ '^[0-9]+$' ]]; then
            lvl="$1"
            shift
        else
            lvl="1"
        fi
        #echo "Level: $lvl"
        exa --tree --level=$lvl --icons --git $@
    }
    alias tree='mytree'
fi

alias gitlog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit "

