diff --git a/.Xresources b/.Xresources index 881bc9bb..c253a6cc 100644 --- a/.Xresources +++ b/.Xresources @@ -1,6 +1,6 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! Xresources -!! 2012-07-12 +!! 2012-08-16 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! TODO: set up charclass. @@ -24,11 +24,13 @@ URxvt*scrollBar: false !! Plugins !! clipboard and keyboard-select are not provided by default. ! URxvt.perl-ext-common : default,matcher,keyboard-select -URxvt.perl-ext-common : matcher,keyboard-select +URxvt.perl-ext-common : matcher,keyboard-select,clipboard -! URxvt.keysym.M-v: perl:clipboard:paste -! URxvt.keysym.M-C-v: perl:clipboard:paste_escaped +URxvt.keysym.M-v: perl:clipboard:paste +URxvt.keysym.M-C-v: perl:clipboard:paste_escaped +! URxvt.clipboard.copycmd: xsel -ib +URxvt.clipboard.pastecmd: xsel -op !! Keyboard-Select URxvt.keysym.M-Escape: perl:keyboard-select:activate @@ -42,25 +44,34 @@ URxvt.urlLauncher : luakit URxvt.underlineURLs : true !! TODO: Does not work. -URxvt*keysym.M-Left: \033[1;3D +! URxvt*keysym.M-Left: \033[1;3D + !! Font -! URxvt*letterSpace: -1 - URxvt*font : xft:Monospace:pixelsize=14 -URxvt*boldFont : xft:Monospace:bold:pixelsize=14 -! URxvt.font : xft:Bitstream Vera Sans Mono:pixelsize=14 -! URxvt.font : -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1 + +! URxvt*boldFont : xft:Monospace:bold:pixelsize=14 +! URxvt*boldFont : xft:Monospace Bold:pixelsize=12 +! URxvt*letterSpace: -1 ! URxvt.font : -*-dina-medium-r-*-*-16-*-*-*-*-*-*-* +! URxvt.font : -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1 +! URxvt.font : xft:Bitstream Vera Sans Mono:pixelsize=14 +! URxvt.font : xft:DejaVu Sans Mono-10 ! URxvt.font : xft:DejaVu Sans Mono:pixelsize=12 ! URxvt.font : xft:Monospace 10:pixelsize=12 ! URxvt.font : xft:Monospace:pixelsize=12 ! URxvt.font : xft:monaco:size=10 -! URxvt*boldFont : xft:Monospace Bold:pixelsize=12 +! Xft.antialias: true +! Xft.hinting: true +! Xft.hintstyle: hintlight +! Xft.rgba: rgb !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! Styles !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! Find more styles on: +!! http://xcolors.net/ +!! https://bbs.archlinux.org/viewtopic.php?id=51818 !! Colors list !! color0 = black @@ -100,6 +111,27 @@ URxvt.color13 : #FF55FF URxvt.color14 : #55FFFF URxvt.color15 : #FFFFFF +!! Derp style +!! http://xcolors.net/dl/derp +! URxvt*background: black +! URxvt*foreground: #CCCCCC +! URxvt.color0: #111111 +! URxvt.color8: #666666 +! URxvt.color1: rgb:d3/62/65 +! URxvt.color9: rgb:ef/81/71 +! URxvt.color2: #aece91 +! URxvt.color10: #cfefb3 +! URxvt.color3: rgb:e7/e1/8c +! URxvt.color11: rgb:ff/f7/96 +! URxvt.color4: #5297cf +! URxvt.color12: #74b8ef +! URxvt.color5: #963c59 +! URxvt.color13: #b85e7b +! URxvt.color6: #5E7175 +! URxvt.color14: #A3BABF +! URxvt.color7: #bebebe +! URxvt.color15: #ffffff + !! Dark style ! urxvt.color0: rgb:00/00/00 ! urxvt.color1: rgb:9e/18/28 diff --git a/.cmus/autosave b/.cmus/autosave index b590d0d0..e2881e69 100644 --- a/.cmus/autosave +++ b/.cmus/autosave @@ -33,11 +33,11 @@ set continue=true set display_artist_sort_name=false set dsp.alsa.device=default set dsp.oss.device= -set format_current= %a - %y. %l -%3n. %t -set format_playlist= %-18%a %y. %-25%l %3n. %t%= %d +set format_current= %a - %y. %l -%n. %t +set format_playlist= %-18%a %4y. %-25%l %3n. %t%= %d set format_playlist_va= %-25%A %3n. %t (%a)%= %y %d -set format_title=%a - %y. %l -%3n. %t -set format_trackwin=%y %3n. %t%= %d [%{codec} %{bitrate} kbps] +set format_title=%a - %y. %l -%n. %t +set format_trackwin=%4y %3n. %t%= %d [%{codec} %{bitrate} kbps] set format_trackwin_va=%3n. %t (%a)%= %y %d set id3_default_charset=ISO-8859-1 set lib_sort=albumartist date album discnumber tracknumber title filename @@ -60,7 +60,7 @@ set resume=true set set_term_title=true set show_hidden=false set show_remaining_time=false -set shuffle=true +set shuffle=false set smart_artist_sort=true set softvol=false set softvol_state=0 0 diff --git a/.emacs.d/snippets/sh-mode/for b/.emacs.d/snippets/sh-mode/for index 41892c03..279d2285 100644 --- a/.emacs.d/snippets/sh-mode/for +++ b/.emacs.d/snippets/sh-mode/for @@ -1,6 +1,6 @@ # name: for i do done # key: for # -- -for i ; do +for i $1; do $0 done \ No newline at end of file diff --git a/.homeinit b/.homeinit index fb7edc0e..ef1dac47 100755 --- a/.homeinit +++ b/.homeinit @@ -36,6 +36,10 @@ if [ ! -e ${THEME_DEST} ]; then fi echo +## rtorrent +echo "==> Awesome" +mkdir -p "${HOME}/.session" + ## Luakit -- Fetch Adblock list. echo "==> Luakit" mkdir -p "$XDG_DATA_HOME/luakit" diff --git a/.shell.d/colors_bash b/.shell.d/colors_bash new file mode 100644 index 00000000..8c17cbab --- /dev/null +++ b/.shell.d/colors_bash @@ -0,0 +1,77 @@ +## -*- mode:sh -*- # +##============================================================================== +## Colors for universal support +##============================================================================== + +## Reset +Color_Off='\[\e[0m\]' # Text Reset + +## Regular Colors +Black='\[\e[0;30m\]' # Black +Red='\[\e[0;31m\]' # Red +Green='\[\e[0;32m\]' # Green +Yellow='\[\e[0;33m\]' # Yellow +Blue='\[\e[0;34m\]' # Blue +Purple='\[\e[0;35m\]' # Purple +Cyan='\[\e[0;36m\]' # Cyan +White='\[\e[0;37m\]' # White + +## Bold +BBlack='\[\e[1;30m\]' # Black +BRed='\[\e[1;31m\]' # Red +BGreen='\[\e[1;32m\]' # Green +BYellow='\[\e[1;33m\]' # Yellow +BBlue='\[\e[1;34m\]' # Blue +BPurple='\[\e[1;35m\]' # Purple +BCyan='\[\e[1;36m\]' # Cyan +BWhite='\[\e[1;37m\]' # White + +## Underline +UBlack='\[\e[4;30m\]' # Black +URed='\[\e[4;31m\]' # Red +UGreen='\[\e[4;32m\]' # Green +UYellow='\[\e[4;33m\]' # Yellow +UBlue='\[\e[4;34m\]' # Blue +UPurple='\[\e[4;35m\]' # Purple +UCyan='\[\e[4;36m\]' # Cyan +UWhite='\[\e[4;37m\]' # White + +## Background +On_Black='\[\e[40m\]' # Black +On_Red='\[\e[41m\]' # Red +On_Green='\[\e[42m\]' # Green +On_Yellow='\[\e[43m\]' # Yellow +On_Blue='\[\e[44m\]' # Blue +On_Purple='\[\e[45m\]' # Purple +On_Cyan='\[\e[46m\]' # Cyan +On_White='\[\e[47m\]' # White + +## High Intensty +IBlack='\[\e[0;90m\]' # Black +IRed='\[\e[0;91m\]' # Red +IGreen='\[\e[0;92m\]' # Green +IYellow='\[\e[0;93m\]' # Yellow +IBlue='\[\e[0;94m\]' # Blue +IPurple='\[\e[0;95m\]' # Purple +ICyan='\[\e[0;96m\]' # Cyan +IWhite='\[\e[0;97m\]' # White + +## Bold High Intensty +BIBlack='\[\e[1;90m\]' # Black +BIRed='\[\e[1;91m\]' # Red +BIGreen='\[\e[1;92m\]' # Green +BIYellow='\[\e[1;93m\]' # Yellow +BIBlue='\[\e[1;94m\]' # Blue +BIPurple='\[\e[1;95m\]' # Purple +BICyan='\[\e[1;96m\]' # Cyan +BIWhite='\[\e[1;97m\]' # White + +## High Intensty backgrounds +On_IBlack='\[\e[0;100m\]' # Black +On_IRed='\[\e[0;101m\]' # Red +On_IGreen='\[\e[0;102m\]' # Green +On_IYellow='\[\e[0;103m\]' # Yellow +On_IBlue='\[\e[0;104m\]' # Blue +On_IPurple='\[\e[10;95m\]' # Purple +On_ICyan='\[\e[0;106m\]' # Cyan +On_IWhite='\[\e[0;107m\]' # White diff --git a/.shell.d/colors_zsh b/.shell.d/colors_zsh new file mode 100644 index 00000000..fbe3d315 --- /dev/null +++ b/.shell.d/colors_zsh @@ -0,0 +1,77 @@ +## -*- mode:sh -*- # +##============================================================================== +## Colors for universal support +##============================================================================== + +## Reset +Color_Off='\e[0m' # Text Reset + +## Regular Colors +Black='\e[0;30m' # Black +Red='\e[0;31m' # Red +Green='\e[0;32m' # Green +Yellow='\e[0;33m' # Yellow +Blue='\e[0;34m' # Blue +Purple='\e[0;35m' # Purple +Cyan='\e[0;36m' # Cyan +White='\e[0;37m' # White + +## Bold +BBlack='\e[1;30m' # Black +BRed='\e[1;31m' # Red +BGreen='\e[1;32m' # Green +BYellow='\e[1;33m' # Yellow +BBlue='\e[1;34m' # Blue +BPurple='\e[1;35m' # Purple +BCyan='\e[1;36m' # Cyan +BWhite='\e[1;37m' # White + +## Underline +UBlack='\e[4;30m' # Black +URed='\e[4;31m' # Red +UGreen='\e[4;32m' # Green +UYellow='\e[4;33m' # Yellow +UBlue='\e[4;34m' # Blue +UPurple='\e[4;35m' # Purple +UCyan='\e[4;36m' # Cyan +UWhite='\e[4;37m' # White + +## Background +On_Black='\e[40m' # Black +On_Red='\e[41m' # Red +On_Green='\e[42m' # Green +On_Yellow='\e[43m' # Yellow +On_Blue='\e[44m' # Blue +On_Purple='\e[45m' # Purple +On_Cyan='\e[46m' # Cyan +On_White='\e[47m' # White + +## High Intensty +IBlack='\e[0;90m' # Black +IRed='\e[0;91m' # Red +IGreen='\e[0;92m' # Green +IYellow='\e[0;93m' # Yellow +IBlue='\e[0;94m' # Blue +IPurple='\e[0;95m' # Purple +ICyan='\e[0;96m' # Cyan +IWhite='\e[0;97m' # White + +## Bold High Intensty +BIBlack='\e[1;90m' # Black +BIRed='\e[1;91m' # Red +BIGreen='\e[1;92m' # Green +BIYellow='\e[1;93m' # Yellow +BIBlue='\e[1;94m' # Blue +BIPurple='\e[1;95m' # Purple +BICyan='\e[1;96m' # Cyan +BIWhite='\e[1;97m' # White + +## High Intensty backgrounds +On_IBlack='\e[0;100m' # Black +On_IRed='\e[0;101m' # Red +On_IGreen='\e[0;102m' # Green +On_IYellow='\e[0;103m' # Yellow +On_IBlue='\e[0;104m' # Blue +On_IPurple='\e[10;95m' # Purple +On_ICyan='\e[0;106m' # Cyan +On_IWhite='\e[0;107m' # White diff --git a/.shell.d/funs_pacman b/.shell.d/funs_pacman new file mode 100644 index 00000000..566cb774 --- /dev/null +++ b/.shell.d/funs_pacman @@ -0,0 +1,320 @@ +## -*- mode:sh -*- # +##============================================================================== +## Pacman Functions +##============================================================================== + +## TODO: completion does not work as is. It requires pacman arguments like -S or +## -Q. There should be a way to use it. + +# if [ "zsh" = "$SHELL_CURRENT" ]; then +# compdef _pacman pacman-deps +# if [ "bash" = "$SHELL_CURRENT" ]; then +# complete -o default -o nospace -F _pacman pacman-deps +# fi + +## This function gets the pacman variables when necessary. + +## Note: some functions uses pacman localized output. It should work in any +## case. + +## Note: you should always call _pacman_unset_vars in the end. +_pacman_set_vars() +{ + local pacman_var_list="$(pacman -Qi tzdata | cut -f1 -d':')" + if [ "$pacman_var_list" = "" ];then + echo "Could not get pacman's variables." + return 2 + fi + + pacman_name="$(echo "$pacman_var_list" | sed -n '1p')" + pacman_deps="$(echo "$pacman_var_list" | sed -n '7p')" + pacman_optdeps="$(echo "$pacman_var_list" | sed -n '8p')" + pacman_size="$(echo "$pacman_var_list" | sed -n '12p')" +} + +_pacman_unset_vars() +{ + unset pacman_name + unset pacman_deps + unset pacman_optdeps + unset pacman_size +} + +## Get detailed file size list for the specified packages. +pacman-files() +{ + printhelp() + { + echo "Synopsis:" + echo -e " $1 [-n] PACKAGES" + echo + echo "Usage:" + echo -e " default:\tDisplay file size of PACKAGES." + echo -e " -h:\t\tDisplay this help." + echo -e " -n:\t\tSort by size." + } + + local OPTION_SORT="cat" + + while getopts ":hn" opt; do + case $opt in + h) + printhelp "$0" + return 1 + ;; + n) + OPTION_SORT="sort -h" + ;; + ?) + printhelp "$0" + return 1 + ;; + :) + echo "Missing argument." + echo "Use $0 -h for help." + return 1 + ;; + esac + done + + shift $(($OPTIND - 1)) + + if [ $# -eq 0 ]; then + echo "Missing argument." + echo "Use $0 -h for help." + return 1 + fi + + local RESULT_HUMAN="$(du -bh $(pacman -Qlq "$@" | grep -v ".*/$" | sort -u) | eval ${OPTION_SORT})" + local RESULT="$(du -b $(pacman -Qlq "$@" | grep -v ".*/$" | sort -u))" + echo "${RESULT_HUMAN}" + + echo "$RESULT" | awk -F "[[:alpha:]]" '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL/1024)}' +} + +## Retrieve official packages list. +pacman-official() +{ +# Alternative 'diff' verision. +# diff <(pacman -Qq | sort) <(pacman -Qmq | sort) --new-line-format='' --unchanged-group-format='%>' + + comm -3 <(pacman -Qq | sort) <(pacman -Qmq | sort) +} + +## Compare installed packages with list. +pacman-diff() +{ + printhelp() + { + echo "Synopsis:" + echo -e " $1 [-m|-e] [-q] FILE" + echo + echo "Usage:" + echo -e " default:\tDisplay packages included in FILE but not installed." + echo -e " -e:\t\tCompare FILE to explicitly installed packages." + echo -e " -h:\t\tDisplay this help." + echo -e " -m:\t\tCompare FILE to foreign installed packages." + echo -e " -q:\t\tDisplay installed packages not included in FILE." + } + + local OPTION_EXPLICIT="" + local OPTION_FOREIGN="" + local OPTION_LOCAL="-1" + + while getopts ":hmqe" opt; do + case $opt in + e) + OPTION_EXPLICIT="e" + ;; + h) + printhelp "$0" + return 1 + ;; + m) + OPTION_FOREIGN="m" + ;; + q) + OPTION_LOCAL="-2" + ;; + ?) + printhelp "$0" + return 1 + ;; + :) + echo "Missing argument." + echo "Use $0 -h for help." + return 1 + ;; + esac + done + + shift $(($OPTIND - 1)) + + if [ $# -eq 0 ]; then + echo "Missing argument." + echo "Use $0 -h for help." + return 1 + fi + + comm -3 ${OPTION_LOCAL} <(pacman -Qq${OPTION_FOREIGN}${OPTION_EXPLICIT} | sort) <(sort "$*") + +} + +## Print specified package size and a grand total. +pacman-size() +{ + printhelp() + { + echo "Synopsis:" + echo -e " $1 [-a|-h|-n|-q] PACKAGES" + echo -e " Arguments MUST be set before package list." + echo + echo "Usage:" + echo -e " default:\tDisplay package size. Output contains no double and is alphabetically sorted. A grand total is printed at the end. It will only work for repos packages by default." + echo -e " -h:\t\tShow this help." + echo -e " -n:\t\tOutput is sorted by size." + echo -e " -q:\t\tUses installed packages database instead of repos database. It speeds up queries and allows displaying size of local packages not available in repos." + } + + local CMD="pacman -Si" + local SEP=": " + local TOTAL_SIZE=0 + local SORT="sort -u -k3" + local SORT_SIZE="cat" + + while getopts ":hnq" opt; do + case $opt in + h) + printhelp "$0" + return 1 + ;; + n) + SORT_SIZE="sort -n" + ;; + q) + CMD="pacman -Qi" + ;; + ?) + printhelp "$0" + return 1 + ;; + :) + echo "Missing argument." + echo "Use $0 -h for help." + return 1 + ;; + esac + done + + shift $(($OPTIND - 1)) + + if [ $# -eq 0 ]; then + echo "Missing argument." + echo "Use $0 -h for help." + return 1 + fi + + _pacman_set_vars + + local RESULT="$(eval "${CMD} $@" | awk -F "$SEP" -v filter="$pacman_size" -v pkg="$pacman_name" \ +'$0 ~ pkg {pkgname=$2} $0 ~ filter {gsub(/\..*/,"") ; printf("%6s KiB %s\n", $2, pkgname)}' | eval "$SORT" | eval "$SORT_SIZE")" + + echo "$RESULT" + +## Print total size. + echo "$RESULT" | awk '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL)}' + +## One line version. ~ same performance. +# eval "${CMD} $@ 2>/dev/null" | awk -F "$SEP" -v filter="$pacman_size" -v pkg="$pacman_name" \ +# '$0 ~ pkg {pkgname=$2} $0 ~ filter {gsub(/\..*/,"") ; printf("%6s KiB %s\n", $2, pkgname)}' | sort -u -k3 \ +# | tee >(awk '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL)}') + + _pacman_unset_vars +} + +## Print deps list. +pacman-deps() +{ + printhelp() + { + echo "Synopsis:" + echo -e " $1 [-a|-h|-q] PACKAGES" + echo -e " Arguments MUST be set before package list." + echo + echo "Usage:" + echo -e " default:\tDisplay package dependencies. Output contains no double and is alphabetically sorted. It will only work for repos packages by default." + echo -e " -a:\t\tUses Yaourt queries instead of repos database. It slows down query but allow displaying size of local any packages not available in repos." + echo -e " -h:\t\tShow this help." + echo -e " -q:\t\tUses installed packages database instead of repos database. It speeds up queries and allows displaying size of local packages not available in repos." + } + + local CMD="pacman -Si" + local SEP=": " + + while getopts ":ahq" opt; do + case $opt in + a) + CMD="yaourt -Si" + ;; + h) + printhelp "$0" + return 1 + ;; + q) + CMD="pacman -Qi" + ;; + ?) + printhelp "$0" + return 1 + ;; + :) + echo "Missing argument." + echo "Use $0 -h for help." + return 1 + ;; + esac + done + + shift $(($OPTIND - 1)) + + if [ $# -eq 0 ]; then + echo "Missing argument." + echo "Use $0 -h for help." + return 1 + fi + + _pacman_set_vars + eval "${CMD} $@ 2>/dev/null" | awk -F "$SEP" -v filter="$pacman_deps" '$0 ~ filter {gsub(/[>=<][^ ]*/,"",$2) ; gsub(/ +/,"\n",$2) ; print $2}' | sort -u + _pacman_unset_vars +} + +pacman-aur-rebuild () +{ + if [ ! -f /usr/bin/yaourt ]; then + echo "Yaourt needs to be installed." + return + fi + + # local PKG_LIST=() + # if [ $# -eq 1 ]; then + # for i in $(pacman -Qmq); do + # PKG_LIST= + # done + # fi + + # yaourt -G $(pacman -Qmq) + # for i in $(pacman -Qmq); do + # cd "$i" + # makepkg -s --nocheck --noconfirm + # rm -r $(ls | grep -v "\.pkg\.tar\.xz") + # cd .. + # done + + yaourt -G ncdu xsel + for i in ncdu xsel; do + cd "$i" + makepkg -s --nocheck --noconfirm + rm -r $(ls | grep -v "\.pkg\.tar\.xz") + cd .. + done +} diff --git a/.shell.d/funs_rc b/.shell.d/funs_rc index a51e5901..e58fd761 100644 --- a/.shell.d/funs_rc +++ b/.shell.d/funs_rc @@ -211,7 +211,8 @@ blind-append() } ## Term properties -termcolors(){ +termcolors256() +{ x=$(tput op) y=$(printf %76s) for i in {0..256}; do @@ -220,6 +221,27 @@ termcolors(){ done } +termcolors() +{ + # The test text. Must be 3 letters. + T='Doh' + + echo -e "\n 40m 41m 42m 43m\ + 44m 45m 46m 47m"; + + for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \ + '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \ + ' 36m' '1;36m' ' 37m' '1;37m'; + do FG=${FGs// /} + echo -en " $FGs \033[$FG $T " + for BG in 40m 41m 42m 43m 44m 45m 46m 47m; + do echo -en "$EINS \033[$FG\033[$BG $T \033[0m"; + done + echo; + done + echo +} + termprop() { infocmp -1 | sed -nu 's/^[ \000\t]*//;s/[ \000\t]*$//;/[^ \t\000]\{1,\}/!d;/acsc/d;s/=.*,//p'| column -c80