diff options
80 files changed, 12155 insertions, 0 deletions
diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..cb05930 --- /dev/null +++ b/.Xresources @@ -0,0 +1,315 @@ +! --------------------------------------------------------- +! $HOME/.Xresources +! +! Weitian LI <liweitianux@gmail.com> +! 2014/05/10 +! +! Syntax: +! name.Class.resource: value +! +! Ref: https://wiki.archlinux.org/index.php/X_resources +! --------------------------------------------------------- + +!!! xft settings {{{ +Xft.dpi: 96 +Xft.antialias: true +Xft.rgba: rgb +Xft.hinting: true +Xft.hintstyle: hintmedium +!!! xft settings }}} + +!!! color scheme {{{ +!! foreground & background +! XXX: NOT set background and foreground globally +! to avoid conflicts with Tcl/Tk applications. (e.g. ds9) +!*background: #1b1b1b +!*foreground: #e0e0e0 +!! other colors +*cursorColor: #eeeeee +*colorBD: #cfcfcf +*colorUL: #969696 +*colorIT: #969696 +! +!! zenburn: http://xcolors.net/dl/zenburn {{{ +! Black +*color0: #1e2320 +*color8: #709080 +! Red +*color1: #705050 +*color9: #dca3a3 +! Green +*color2: #60b48a +*color10: #c3bf9f +! Yellow +*color3: #dfaf8f +*color11: #f0dfaf +! Blue +*color4: #506070 +*color12: #94bff3 +! Magenta +*color5: #dc8cc3 +*color13: #ec93d3 +! Cyan +*color6: #8cd0d3 +*color14: #93e0e3 +! White +*color7: #dcdccc +*color15: #ffffff +! zenburn }}} +! +!! clound: http://xcolors.net/dl/cloud {{{ +!!black +!*color0: #222827 +!*color8: #5D6F74 +!!red +!*color1: #D5A8E3 +!*color9: #CD749C +!!green +!*color2: #9C75DD +!*color10: #63B0B0 +!!yellow +!*color3: #9898AE +!*color11: #C0C0DD +!!blue +!*color4: #654A96 +!*color12: #5786BC +!!magenta +!*color5: #625566 +!*color13: #3F3442 +!!cyan +!*color6: #A9D1DF +!*color14: #849DA2 +!!white +!*color7: #E6EBE5 +!*color15: #D9D6CF +!! clound }}} +! +!! kori colorscheme: http://dotshare.it/dots/659/ {{{ +!!Black +!*color0: #3D3D3D +!*color8: #4D4D4D +!!Red +!*color1: #6673BF +!*color9: #899AFF +!!Green +!*color2: #3EA290 +!*color10: #52AD91 +!!Yellow +!*color3: #B0EAD9 +!*color11: #98C9BB +!!Blue +!*color4: #31658C +!*color12: #477AB3 +!!Magenta +!*color5: #596196 +!*color13: #7882BF +!!Cyan +!*color6: #8292B2 +!*color14: #95A7CC +!!White +!*color7: #C8CACC +!*color15: #EDEFF2 +!! }}} +! +!! unknown {{{ +!*color0: #353535 +!*color8: #666666 +!!red +!*color1: #D81860 +!*color9: #F00060 +!!green +!*color2: #B7CE42 +!*color10: #BDE077 +!!brown/yellow +!*color3: #FEA63C +!*color11: #FFE863 +!!blue +!*color4: #6F99B4 +!*color12: #7C96B0 +!!magenta +!*color5: #8B7B8B +!*color13: #D8BFD8 +!!cyan +!*color6: #A7A15E +!*color14: #F0E68C +!!white +!*color7: #DDDDDD +!*color15: #FFFFFF +!! }}} +! +!!! color scheme }}} + +!!! rxvt-unicode settings {{{ +!! urxvt background true transparent +! set to 32-bit for real transparency (compositing required [see xcompmgr]) +! xdpyinfo | grep Composite +URxvt.depth: 32 +! transparent=0000, opaque=ffff +URxvt.background: rgba:1111/1111/1111/dddd +! foreground +URxvt.foreground: #e0e0e0 +! +!! urxvt font settings +!URxvt.font: xft:DejaVu Sans Mono:pixelsize=16,xft:WenQuanYi Micro Hei Mono:pixelsize=16 +URxvt.font: xft:Terminus:size=12,xft:WenQuanYi Bitmap Song:size=10 +URxvt.xftAntialias: true +! +!! urxvt settings +!URxvt.termName: rxvt-256color +!URxvt.title: aly rxvt +URxvt.geometry: 92x26 +URxvt.cursorBlink: true +URxvt.underlineColor: green +URxvt.buffered: true +URxvt.jumpScroll: false +URxvt.secondaryScroll: true +URxvt.saveLines: 4000 +URxvt.scrollBar: true +URxvt.scrollBar_right: true +URxvt.scrollstyle: plain +URxvt.scrollTtyKeypress: true +URxvt.scrollTtyOutput: false +! scroll with scrollback buffer +URxvt.scrollWithBuffer: true +!URxvt.scrollColor: AntiqueWhite +! +!! urxvt keysym +! M: Meta S; Shift C: Control +! Mod4: Win +! \002: Control-B +! \015: Enter +! +!! urxvt perl extension settings +URxvt.perl-lib: ~/.urxvt/ext/ +URxvt.perl-ext-common: default,tabbed,clipboard,keyboard-select,url-select +!! tabbed color +URxvt.tabbed.tabbar-fg: 5 +URxvt.tabbed.tabbar-bg: 0 +URxvt.tabbed.tab-fg: 14 +URxvt.tabbed.tab-bg: 0 +!! copy/paste +URxvt.keysym.Mod4-c: perl:clipboard:copy +URxvt.keysym.Mod4-v: perl:clipboard:paste +URxvt.keysym.Mod4-S-v: perl:clipboard:paste_escaped +URxvt.clipboard.copycmd: xclip -i -selection clipboard +URxvt.clipboard.pastecmd: xclip -o -selection clipboard +!! keyboard-select +URxvt.keysym.Mod4-Escape: perl:keyboard-select:activate +URxvt.keysym.Mod4-s: perl:keyboard-select:search +!! url-select +URxvt.keysym.Mod4-u: perl:url-select:select_next +URxvt.url-select.underline: true +URxvt.url-select.button: 1 +URxvt.url-select.launcher: firefox -new-tab +! +!! urxvt misc settings +!URxvt.loginShell: true +URxvt.mapAlert: true +URxvt.pointerBlank: true +URxvt.urgentOnBell: true +URxvt.utmpInhibit: true +! preeditType: OverTheSpot, OffTheSpot, Root +URxvt.preeditType: root +! reduce the distance between characters +!URxvt.letterSpace: -1 +URxvt.inputMethod: fcitx +!!! rxvt-unicdoe settings }}} + +!!! xterm settings {{{ +XTerm.background: #1b1b1b +XTerm.foreground: #e0e0e0 +!XTerm.geometry: 80x25 +!XTerm.faceName: xft:Dejavu Sans Mono:pixelsize=16:antialias=true +XTerm.faceName: xft:Terminus:pixelsize=18 +XTerm.dynamicColors: true +XTerm.utf8: 2 +XTerm.eightBitInput: true +XTerm.saveLines: 4000 +XTerm.scrollTtyOutput: false +XTerm.scrollKey: true +XTerm.scrollBar: true +XTerm.rightScrollBar: true +!XTerm.loginShell: true +XTerm.jumpScroll: false +XTerm.multiScroll: true +XTerm.toolBar: true +!!! xterm settings }}} + +!!! Xcursor {{{ +! Vanilla-DMZ: white +! Vanilla-DMZ-AA: black +!Xcursor.theme: Vanilla-DMZ-AA +Xcursor.theme: Vanilla-DMZ +Xcursor.size: 32 +!!! Xcursor }}} + +!!! xfontsel {{{ +XFontSel.background: #1b1b1b +XFontSel.foreground: #e0e0e0 +!!! xfontsel }}} + +!!! x11-ssh-askpass {{{ +x11-ssh-askpass*font: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-* +x11-ssh-askpass*background: #000000 +x11-ssh-askpass*foreground: #ffffff +x11-ssh-askpass.Button*background: #000000 +x11-ssh-askpass.Indicator*foreground: #ff9900 +x11-ssh-askpass.Indicator*background: #090909 +x11-ssh-askpass*topShadowColor: #000000 +x11-ssh-askpass*bottomShadowColor: #000000 +x11-ssh-askpass.*borderWidth: 1 +!!! x11-ssh-askpass }}} + +!!! xscreensaver settings {{{ +!! font settings +xscreensaver.Dialog.headingFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-* +xscreensaver.Dialog.bodyFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-* +xscreensaver.Dialog.labelFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-* +xscreensaver.Dialog.unameFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-* +xscreensaver.Dialog.buttonFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-* +xscreensaver.Dialog.dateFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-* +xscreensaver.passwd.passwdFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-* +!! general dialog box (affects main hostname, username, password text) +xscreensaver.Dialog.foreground: #ffffff +xscreensaver.Dialog.background: #111111 +xscreensaver.Dialog.topShadowColor: #111111 +xscreensaver.Dialog.bottomShadowColor: #111111 +xscreensaver.Dialog.Button.foreground: #666666 +xscreensaver.Dialog.Button.background: #ffffff +!! username/password input box and date text colour +xscreensaver.Dialog.text.foreground: #666666 +xscreensaver.Dialog.text.background: #ffffff +xscreensaver.Dialog.internalBorderWidth: 24 +xscreensaver.Dialog.borderWidth: 20 +xscreensaver.Dialog.shadowThickness: 2 +!! timeout bar (background is actually determined by Dialog.text.background) +xscreensaver.passwd.thermometer.foreground: #ff0000 +xscreensaver.passwd.thermometer.background: #000000 +xscreensaver.passwd.thermometer.width: 8 +!! datestamp format - see strftime(3) manual page for details +xscreensaver.dateFormat: %I:%M%P %a %b %d, %Y +!! preferences +xscreensaver.mode: blank +xscreensaver.timeout: 0:10:00 +xscreensaver.cycle: 0:10:00 +xscreensaver.lock: True +xscreensaver.lockTimeout: 0:01:00 +xscreensaver.passwdTimeout: 0:00:30 +xscreensaver.dpmsEnabled: True +xscreensaver.dpmsQuickoff: True +xscreensaver.dpmsStandby: 0:10:00 +xscreensaver.dpmsSuspend: 0:10:00 +xscreensaver.dpmsOff: 0:15:00 +xscreensaver.fade: True +xscreensaver.unfade: False +xscreensaver.fadeSeconds: 0:00:03 +xscreensaver.fadeTicks: 20 +!! user switching from lock screen +! Lightdm: dm-tool switch-to-greeter +! LXDM: lxdm -c USER_SWITCH +! GDM: gdmflexiserver -ls +! KDM: kdmctl reverse +xscreensaver.newLoginCommand: dm-tool switch-to-greeter +!!! xscreensaver }}} + +! vim: set ts=8 sw=4 tw=78 ft=xdefaults: ! diff --git a/.bash_aliases b/.bash_aliases new file mode 100644 index 0000000..7d25ed6 --- /dev/null +++ b/.bash_aliases @@ -0,0 +1,9 @@ +# ~/.bash_aliases +# + +### sbcl ### +#export CL_BREAK_CHARS="\"#'(),;\`\\|!?[]{}" +#alias sbcl="rlwrap -b \${CL_BREAK_CHARS} sbcl" +alias sbcl='sbcl --no-inform' + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=sh: # diff --git a/.bash_completion.d/gentoo b/.bash_completion.d/gentoo new file mode 120000 index 0000000..98ef469 --- /dev/null +++ b/.bash_completion.d/gentoo @@ -0,0 +1 @@ +../../../usr/share/bash-completion/gentoo
\ No newline at end of file diff --git a/.bash_logout b/.bash_logout new file mode 100644 index 0000000..44b6f79 --- /dev/null +++ b/.bash_logout @@ -0,0 +1,6 @@ +# /etc/skel/.bash_logout + +# This file is sourced when a login shell terminates. + +# Clear the screen for security's sake. +clear diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..94a6622 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,5 @@ +# /etc/skel/.bash_profile + +# This file is sourced by bash for login shells. The following line +# runs your .bashrc and is recommended by the bash info pages. +[[ -f ~/.bashrc ]] && . ~/.bashrc @@ -0,0 +1,56 @@ +# ~/.bashrc +# /etc/skel/.bashrc +# +# This file is sourced by all *interactive* bash shells on startup, +# including some apparently interactive shells such as scp and rcp +# that can't tolerate any output. So make sure this doesn't display +# anything or bad things will happen ! + +# Test for an interactive shell. There is no need to set anything +# past this point for scp and rcp, and it's important to refrain from +# outputting anything in those cases. +if [[ $- != *i* ]] ; then + # Shell is non-interactive. Be done now! + return +fi + + +### bash settings {{{ +# no double entries in the shell history +export HISTCONTROL="$HISTCONTROL erasedups:ignoreboth" + +# prompt +export PS1="\[\033[01;33m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] " +### bash settings }}} + + +### bash completion {{{ +# bash-completion +if [ -f /etc/profile.d/bash-completion.sh ]; then + . /etc/profile.d/bash-completion.sh +fi +### bash completion }}} + + +### environment variables {{{ +export EDITOR=vim + +### }}} + + +### aliases {{{ +alias ll='ls -l' +alias lf='ls -F' +alias la='ls -A' + +# ~/.bash_aliases +[ -f ~/.bash_aliases ] && . ~/.bash_aliases +### aliases }}} + + +### run applications {{{ +# music player daemon (mpd) +[ ! -s ~/.mpd/pid ] && mpd >/dev/null 2>&1 +### run applications }}} + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=sh: # diff --git a/.conky/cronograph/accuweather/accuweather.sh b/.conky/cronograph/accuweather/accuweather.sh new file mode 100755 index 0000000..fe6a407 --- /dev/null +++ b/.conky/cronograph/accuweather/accuweather.sh @@ -0,0 +1,172 @@ +#!/bin/sh + +## get the directory of this script +SCRIPT_PATH=`readlink -f $0` +SCRIPT_DIR=`dirname ${SCRIPT_PATH}` + +## address (Accuweather url) +address="http://www.accuweather.com/en/cn/shanghai/106577/weather-forecast/106577" # Shanghai + + +## function: test_image() +test_image() { + case $1 in + 1) + echo a + ;; + 2|3) + echo b + ;; + 4|5) + echo c + ;; + 6) + echo d + ;; + 7) + echo e + ;; + 8) + echo f + ;; + 11) + echo 0 + ;; + 12) + echo h + ;; + 13|14) + echo g + ;; + 15) + echo m + ;; + 16|17) + echo k + ;; + 18) + echo i + ;; + 19) + echo q + ;; + 20|21|23) + echo o + ;; + 22) + echo r + ;; + 24|31) + echo E + ;; + 25) + echo v + ;; + 26) + echo x + ;; + 29) + echo y + ;; + 30) + echo 5 + ;; + 32) + echo 6 + ;; + 33) + echo A + ;; + 34|35) + echo B + ;; + 36|37) + echo C + ;; + 38) + echo D + ;; + 39|40) + echo G + ;; + 41|42) + echo K + ;; + 43|44) + echo O + ;; + *) + echo - + ;; + esac +} + + +#kill -STOP $(pidof conky) +#killall wget + +## urls and wget weather data +loc_id=$(echo ${address} | sed 's/\/weather-forecast.*$//' | sed 's/^.*\///') +last_number=$(echo ${address} | sed 's/^.*\///') + +curr_addr="$(echo ${address} | sed 's/weather-forecast.*$//')current-weather/${last_number}" +wget -O ${SCRIPT_DIR}/curr_cond_raw "${curr_addr}" + +addr1="$(echo ${address} | sed 's/weather-forecast.*$//')daily-weather-forecast/${last_number}" +wget -O ${SCRIPT_DIR}/tod_ton_raw "${addr1}" + +addr2="${addr1}?day=6" +wget -O ${SCRIPT_DIR}/last_days_raw "${addr2}" + +## current conditions +if [ -s ${SCRIPT_DIR}/curr_cond_raw ]; then + sed -i '/detail-now/,/#details/!d' ${SCRIPT_DIR}/curr_cond_raw + egrep -i '"cond"|icon i-|detail-tab-panel' ${SCRIPT_DIR}/curr_cond_raw > ${SCRIPT_DIR}/curr_cond + sed -i -e 's/^.*detail-tab-panel //g' -e 's/^.*icon i-//g' -e 's/"><\/div>.*$//g' ${SCRIPT_DIR}/curr_cond + sed -i -e 's/^.*"cond">//g' -e 's/°/\n/g' -e 's/<\/span>.*"temp">/\n/g' -e 's/<.*>//g' ${SCRIPT_DIR}/curr_cond + sed -i -e 's/">//g' -e 's/-->//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' -e 's/-[a-z].*$//g' ${SCRIPT_DIR}/curr_cond + image=$(sed -n 2p ${SCRIPT_DIR}/curr_cond) + sed -i 2s/${image}/$(test_image ${image})/ ${SCRIPT_DIR}/curr_cond +fi + +## First 5 days +if [ -s ${SCRIPT_DIR}/tod_ton_raw ]; then + sed -i '/feed-tabs/,/\.feed-tabs/!d' ${SCRIPT_DIR}/tod_ton_raw + egrep -i 'Early AM|Today|Tonight|Overnight|icon i-|cond|temp|Mon|Tue|Wed|Thu|Fri|Sat|Sun' ${SCRIPT_DIR}/tod_ton_raw > ${SCRIPT_DIR}/tod_ton + sed -i -e 's/^.*#">//g' -e 's/^.*icon i-//g' -e 's/^.*cond">//g' -e 's/^.*temp">//g' ${SCRIPT_DIR}/tod_ton + sed -i -e 's/Lo<\/span> /\n/g' -e 's/<\/a>.*$//g' -e 's/ "><.*$//g' -e 's/&#.*$//g' -e 's/teo//g' ${SCRIPT_DIR}/tod_ton + sed -i -e 's/<span>.*$//g' -e 's/<\/span>//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' ${SCRIPT_DIR}/tod_ton + sed -i -e 's/Early AM/EARLY AM/' -e 's/Today/TODAY/' -e 's/Tonight/TONIGHT/' -e 's/Overnight/OVERNIGHT/' -e 's/Mon/MON/' -e 's/Tue/TUE/' -e 's/Wed/WED/' -e 's/Thu/THU/' -e 's/Fri/FRI/' -e 's/Sat/SAT/' -e 's/Sun/SUN/' -e 's/-[a-z]*$//g' ${SCRIPT_DIR}/tod_ton + time=$(sed -n 1p ${SCRIPT_DIR}/tod_ton) + image=$(sed -n 2p ${SCRIPT_DIR}/tod_ton) + # + if [ "${time}" = "TODAY" ]; then + sed -i 2s/${image}/$(test_image ${image})/ ${SCRIPT_DIR}/tod_ton + elif [ "${time}" = "TONIGHT" -o "${time}" = "OVERNIGHT" -o "${time}" = "EARLY AM" ]; then + sed -i 2s/${image}/$(test_image ${image})/ ${SCRIPT_DIR}/tod_ton + sed -i 3a- ${SCRIPT_DIR}/tod_ton + fi + # + for i in $(seq 7 5 22); do + image=$(sed -n "${i}"p ${SCRIPT_DIR}/tod_ton) + sed -i ${i}s/${image}/$(test_image ${image})/ ${SCRIPT_DIR}/tod_ton + done +fi + +## Next 5 days +if [ -s ${SCRIPT_DIR}/last_days_raw ]; then + sed -i '/feed-tabs/,/\.feed-tabs/!d' ${SCRIPT_DIR}/last_days_raw + egrep -i 'icon i-|cond|temp|Mon|Tue|Wed|Thu|Fri|Sat|Sun' ${SCRIPT_DIR}/last_days_raw > ${SCRIPT_DIR}/last_days + sed -i -e 's/^.*#">//g' -e 's/^.*icon i-//g' -e 's/^.*cond">//g' -e 's/^.*temp">//g' ${SCRIPT_DIR}/last_days + sed -i -e 's/Lo<\/span> /\n/g' -e 's/<\/a>.*$//g' -e 's/ "><.*$//g' -e 's/&#.*$//g' -e 's/teo//g' ${SCRIPT_DIR}/last_days + sed -i -e 's/<span>.*$//g' -e 's/<\/span>//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' ${SCRIPT_DIR}/last_days + sed -i -e 's/Mon/MON/' -e 's/Tue/TUE/' -e 's/Wed/WED/' -e 's/Thu/THU/' -e 's/Fri/FRI/' -e 's/Sat/SAT/' -e 's/Sun/SUN/' -e 's/-[a-z]*$//g' ${SCRIPT_DIR}/last_days + # + for i in $(seq 7 5 22); do + image=$(sed -n "${i}"p ${SCRIPT_DIR}/last_days) + sed -i ${i}s/${image}/$(test_image ${image})/ ${SCRIPT_DIR}/last_days + done +fi + +#kill -CONT $(pidof conky) + diff --git a/.conky/cronograph/accuweather/curr_cond b/.conky/cronograph/accuweather/curr_cond new file mode 100644 index 0000000..f5d92e6 --- /dev/null +++ b/.conky/cronograph/accuweather/curr_cond @@ -0,0 +1,5 @@ +night +A +Clear +18 + diff --git a/.conky/cronograph/accuweather/curr_cond_raw b/.conky/cronograph/accuweather/curr_cond_raw new file mode 100644 index 0000000..9f2b26c --- /dev/null +++ b/.conky/cronograph/accuweather/curr_cond_raw @@ -0,0 +1,1646 @@ +<!DOCTYPE html>
+<html>
+<head>
+ <title>Shanghai Current Weather - AccuWeather Forecast for Shanghai China</title>
+ <script type="text/javascript">window.NREUM||(NREUM={});NREUM.info = {"beacon":"beacon-3.newrelic.com","errorBeacon":"jserror.newrelic.com","licenseKey":"a690b21e9f","applicationID":"599479","transactionName":"NV0GYUFWCEUDBkNQDAwXIFpHeQNCIQpZTRENVAhQQRggWRAAVFgQFhcnQEFFA1gWJlhXBwtMDVpdRA==","queueTime":0,"applicationTime":48,"ttGuid":"BB8C9D8BB020BC9B","agent":"js-agent.newrelic.com/nr-411.min.js"}</script><script type="text/javascript">(window.NREUM||(NREUM={})).loader_config={xpid:"VQUFVl5UGwYJXVVVDg=="};window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var o=e[n]={exports:{}};t[n][0].call(o.exports,function(e){var o=t[n][1][e];return r(o?o:e)},o,o.exports)}return e[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,e){function n(t,e,n){n||(n={});for(var r=o[t],a=r&&r.length||0,s=n[i]||(n[i]={}),u=0;a>u;u++)r[u].apply(s,e);return s}function r(t,e){var n=o[t]||(o[t]=[]);n.push(e)}var o={},i="nr@context";e.exports={on:r,emit:n}},{}],2:[function(t){function e(t,e,n,i,s){return u?u-=1:r("err",[s||new UncaughtException(t,e,n)]),"function"==typeof a?a.apply(this,o(arguments)):!1}function UncaughtException(t,e,n){this.message=t||"Uncaught error with no additional information",this.sourceURL=e,this.line=n}function n(t){r("err",[t,(new Date).getTime()])}var r=t("handle"),o=t(6),i=t(5),a=window.onerror,s=!1,u=0;t("loader").features.push("err"),window.onerror=e,NREUM.noticeError=n;try{throw new Error}catch(d){"stack"in d&&(t(1),t(2),"addEventListener"in window&&t(3),window.XMLHttpRequest&&XMLHttpRequest.prototype&&XMLHttpRequest.prototype.addEventListener&&t(4),s=!0)}i.on("fn-start",function(){s&&(u+=1)}),i.on("fn-err",function(t,e,r){s&&(this.thrown=!0,n(r))}),i.on("fn-end",function(){s&&!this.thrown&&u>0&&(u-=1)}),i.on("internal-error",function(t){r("ierr",[t,(new Date).getTime(),!0])})},{1:5,2:4,3:3,4:6,5:1,6:14,handle:"D5DuLP",loader:"G9z0Bl"}],3:[function(t){function e(t){r.inPlace(t,["addEventListener","removeEventListener"],"-",n)}function n(t){return t[1]}var r=t(1),o=(t(3),t(2));if(e(window),"getPrototypeOf"in Object){for(var i=document;i&&!i.hasOwnProperty("addEventListener");)i=Object.getPrototypeOf(i);i&&e(i);for(var a=XMLHttpRequest.prototype;a&&!a.hasOwnProperty("addEventListener");)a=Object.getPrototypeOf(a);a&&e(a)}else XMLHttpRequest.prototype.hasOwnProperty("addEventListener")&&e(XMLHttpRequest.prototype);o.on("addEventListener-start",function(t){if(t[1]){var e=t[1];"function"==typeof e?this.wrapped=e["nr@wrapped"]?t[1]=e["nr@wrapped"]:e["nr@wrapped"]=t[1]=r(e,"fn-"):"function"==typeof e.handleEvent&&r.inPlace(e,["handleEvent"],"fn-")}}),o.on("removeEventListener-start",function(t){var e=this.wrapped;e&&(t[1]=e)})},{1:15,2:1,3:14}],4:[function(t){var e=(t(3),t(1)),n=t(2);e.inPlace(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame"],"raf-"),n.on("raf-start",function(t){t[0]=e(t[0],"fn-")})},{1:15,2:1,3:14}],5:[function(t){function e(t){var e=t[0];"string"==typeof e&&(e=new Function(e)),t[0]=n(e,"fn-")}var n=(t(3),t(1)),r=t(2);n.inPlace(window,["setTimeout","setInterval","setImmediate"],"setTimer-"),r.on("setTimer-start",e)},{1:15,2:1,3:14}],6:[function(t){function e(){o.inPlace(this,s,"fn-")}function n(t,e){o.inPlace(e,["onreadystatechange"],"fn-")}function r(t,e){return e}var o=t(1),i=t(2),a=window.XMLHttpRequest,s=["onload","onerror","onabort","onloadstart","onloadend","onprogress","ontimeout"];window.XMLHttpRequest=function(t){var n=new a(t);try{i.emit("new-xhr",[],n),o.inPlace(n,["addEventListener","removeEventListener"],"-",function(t,e){return e}),n.addEventListener("readystatechange",e,!1)}catch(r){try{i.emit("internal-error",r)}catch(s){}}return n},window.XMLHttpRequest.prototype=a.prototype,o.inPlace(XMLHttpRequest.prototype,["open","send"],"-xhr-",r),i.on("send-xhr-start",n),i.on("open-xhr-start",n)},{1:15,2:1}],7:[function(t){function e(){function e(t){if("string"==typeof t&&t.length)return t.length;if("object"!=typeof t)return void 0;if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer&&t.byteLength)return t.byteLength;if("undefined"!=typeof Blob&&t instanceof Blob&&t.size)return t.size;if("undefined"!=typeof FormData&&t instanceof FormData)return void 0;try{return JSON.stringify(t).length}catch(e){return void 0}}function n(t){var n=this.params,r=this.metrics;if(!this.ended){this.ended=!0;for(var i=0;u>i;i++)t.removeEventListener(s[i],this.listener,!1);if(!n.aborted){if(r.duration=(new Date).getTime()-this.startTime,4===t.readyState){n.status=t.status;var a=t.responseType,d="arraybuffer"===a||"blob"===a||"json"===a?t.response:t.responseText,f=e(d);if(f&&(r.rxSize=f),this.sameOrigin){var c=t.getResponseHeader("X-NewRelic-App-Data");c&&(n.cat=c.split(", ").pop())}}else n.status=0;r.cbTime=this.cbTime,o("xhr",[n,r])}}}function r(t,e){var n=i(e),r=t.params;r.host=n.hostname+":"+n.port,r.pathname=n.pathname,t.sameOrigin=n.sameOrigin}t("loader").features.push("xhr");var o=t("handle"),i=t(1),a=t(5),s=["load","error","abort","timeout"],u=s.length,d=t(2);t(3),t(4),a.on("new-xhr",function(){this.totalCbs=0,this.called=0,this.cbTime=0,this.end=n,this.ended=!1,this.xhrGuids={}}),a.on("open-xhr-start",function(t){this.params={method:t[0]},r(this,t[1]),this.metrics={}}),a.on("open-xhr-end",function(t,e){"loader_config"in NREUM&&"xpid"in NREUM.loader_config&&this.sameOrigin&&e.setRequestHeader("X-NewRelic-ID",NREUM.loader_config.xpid)}),a.on("send-xhr-start",function(t,n){var r=this.metrics,o=t[0],i=this;if(r&&o){var d=e(o);d&&(r.txSize=d)}this.startTime=(new Date).getTime(),this.listener=function(t){try{"abort"===t.type&&(i.params.aborted=!0),("load"!==t.type||i.called===i.totalCbs&&(i.onloadCalled||"function"!=typeof n.onload))&&i.end(n)}catch(e){try{a.emit("internal-error",e)}catch(r){}}};for(var f=0;u>f;f++)n.addEventListener(s[f],this.listener,!1)}),a.on("xhr-cb-time",function(t,e,n){this.cbTime+=t,e?this.onloadCalled=!0:this.called+=1,this.called!==this.totalCbs||!this.onloadCalled&&"function"==typeof n.onload||this.end(n)}),a.on("xhr-load-added",function(t,e){var n=""+d(t)+!!e;this.xhrGuids&&!this.xhrGuids[n]&&(this.xhrGuids[n]=!0,this.totalCbs+=1)}),a.on("xhr-load-removed",function(t,e){var n=""+d(t)+!!e;this.xhrGuids&&this.xhrGuids[n]&&(delete this.xhrGuids[n],this.totalCbs-=1)}),a.on("addEventListener-end",function(t,e){e instanceof XMLHttpRequest&&"load"===t[0]&&a.emit("xhr-load-added",[t[1],t[2]],e)}),a.on("removeEventListener-end",function(t,e){e instanceof XMLHttpRequest&&"load"===t[0]&&a.emit("xhr-load-removed",[t[1],t[2]],e)}),a.on("fn-start",function(t,e,n){e instanceof XMLHttpRequest&&("onload"===n&&(this.onload=!0),("load"===(t[0]&&t[0].type)||this.onload)&&(this.xhrCbStart=(new Date).getTime()))}),a.on("fn-end",function(t,e){this.xhrCbStart&&a.emit("xhr-cb-time",[(new Date).getTime()-this.xhrCbStart,this.onload,e],e)})}window.XMLHttpRequest&&XMLHttpRequest.prototype&&XMLHttpRequest.prototype.addEventListener&&!/CriOS/.test(navigator.userAgent)&&e()},{1:8,2:11,3:3,4:6,5:1,handle:"D5DuLP",loader:"G9z0Bl"}],8:[function(t,e){e.exports=function(t){var e=document.createElement("a"),n=window.location,r={};e.href=t,r.port=e.port;var o=e.href.split("://");return!r.port&&o[1]&&(r.port=o[1].split("/")[0].split(":")[1]),r.port&&"0"!==r.port||(r.port="https"===o[0]?"443":"80"),r.hostname=e.hostname||n.hostname,r.pathname=e.pathname,"/"!==r.pathname.charAt(0)&&(r.pathname="/"+r.pathname),r.sameOrigin=!e.hostname||e.hostname===document.domain&&e.port===n.port&&e.protocol===n.protocol,r}},{}],handle:[function(t,e){e.exports=t("D5DuLP")},{}],D5DuLP:[function(t,e){function n(t,e){var n=r[t];return n?n.apply(this,e):(o[t]||(o[t]=[]),void o[t].push(e))}var r={},o={};e.exports=n,n.queues=o,n.handlers=r},{}],11:[function(t,e){function n(t){if(!t||"object"!=typeof t&&"function"!=typeof t)return-1;if(t===window)return 0;if(o.call(t,"__nr"))return t.__nr;try{return Object.defineProperty(t,"__nr",{value:r,writable:!0,enumerable:!1}),r}catch(e){return t.__nr=r,r}finally{r+=1}}var r=1,o=Object.prototype.hasOwnProperty;e.exports=n},{}],loader:[function(t,e){e.exports=t("G9z0Bl")},{}],G9z0Bl:[function(t,e){function n(){var t=p.info=NREUM.info;if(t&&t.agent&&t.licenseKey&&t.applicationID&&u&&u.body){p.proto="https"===c.split(":")[0]||t.sslForHttp?"https://":"http://",a("mark",["onload",i()]);var e=u.createElement("script");e.src=p.proto+t.agent,u.body.appendChild(e)}}function r(){"complete"===u.readyState&&o()}function o(){a("mark",["domContent",i()])}function i(){return(new Date).getTime()}var a=t("handle"),s=window,u=s.document,d="addEventListener",f="attachEvent",c=(""+location).split("?")[0],p=e.exports={offset:i(),origin:c,features:[]};u[d]?(u[d]("DOMContentLoaded",o,!1),s[d]("load",n,!1)):(u[f]("onreadystatechange",r),s[f]("onload",n)),a("mark",["firstbyte",i()])},{handle:"D5DuLP"}],14:[function(t,e){function n(t,e,n){e||(e=0),"undefined"==typeof n&&(n=t?t.length:0);for(var r=-1,o=n-e||0,i=Array(0>o?0:o);++r<o;)i[r]=t[e+r];return i}e.exports=n},{}],15:[function(t,e){function n(t,e,r,s){function nrWrapper(){try{var n,a=u(arguments),d=this,f=r&&r(a,d)||{}}catch(c){i([c,"",[a,d,s],f])}o(e+"start",[a,d,s],f);try{return n=t.apply(d,a)}catch(p){throw o(e+"err",[a,d,p],f),p}finally{o(e+"end",[a,d,n],f)}}return a(t)?t:(e||(e=""),nrWrapper[n.flag]=!0,nrWrapper)}function r(t,e,r,o){r||(r="");var i,s,u,d="-"===r.charAt(0);for(u=0;u<e.length;u++)s=e[u],i=t[s],a(i)||(t[s]=n(i,d?s+r:r,o,s,t))}function o(t,e,n){try{s.emit(t,e,n)}catch(r){i([r,t,e,n])}}function i(t){try{s.emit("internal-error",t)}catch(e){}}function a(t){return!(t&&"function"==typeof t&&t.apply&&!t[n.flag])}var s=t(1),u=t(2);e.exports=n,n.inPlace=r,n.flag="nr@wrapper"},{1:1,2:14}]},{},["G9z0Bl",2,7]);</script>
+
+ <meta name="description" content="Get Shanghai, China current weather reports and conditions including temperature, RealFeel and precipitation from AccuWeather.com" />
+<link rel="canonical" href="http://www.accuweather.com/en/cn/shanghai/106577/current-weather/106577" />
+<meta name="keywords" content="Shanghai China, current weather, weather report" />
+<link rel="alternate" media="only screen and (max-width: 640px)" href="http://m.accuweather.com/en/cn/shanghai/106577/current-weather/106577" />
+<link rel="alternate" media="handheld" href="http://m.accuweather.com/en/cn/shanghai/106577/current-weather/106577" />
+
+ <meta name="viewport" content="width=988"/>
+ <link rel="stylesheet" href="http://vortex.accuweather.com/adc2010/stylesheets/site.min-20140501.css" type="text/css" media="all" />
+
+ <style type="text/css">
+ @media print{#header-davek,#header-links,#header-davek-2,#ad-prestitial-panel,#footer-nav,#offers,div.logo-ad,div.panel-ad-mr,div.ad-lr,#ad-links,#wrap-s .bt,.margusity,.column-2-r,.addthis_toolbox,body#news-news .column-2,body#news-news #news,body#news-news .panel-head-tabs-rt,#extras{display:none}body,#wrap,#wrap-content,.column-1,#panel-main,.strong .panel-body,.strong .panel-body-lt,.strong .panel-body-rt,.strong .panel-foot,.strong .panel-foot-lt,.strong .panel-foot-rt,.strong .panel-head,.strong .panel-head-lt,.strong .panel-head-rt{background:0}.clearfix{position:static;display:block}body#news-news .column-1{width:980px;float:none;}}
+ </style>
+
+ <link rel="shortcut icon" href="http://vortex.accuweather.com/adc2010/images/favicons/awx-2013-master.ico" />
+
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+
+ <style type="text/css">
+.flag-CN { background-image: url(http://vortex.accuweather.com/adc2010/images/flags/CN.png) !important;} +.flag-US { background-image: url(http://vortex.accuweather.com/adc2010/images/flags/US.png) !important;} +.flag-GB { background-image: url(http://vortex.accuweather.com/adc2010/images/flags/GB.png) !important;} + .i-11-header {background-image: url(http://vortex.accuweather.com/adc2010/images/header-bg-day/11-header.jpg);}
+ </style>
+
+<link rel="stylesheet" href="http://vortex.accuweather.com/adc2010/stylesheets/pages/forecast-extended.min-20111207.css" type="text/css" media="all" />
+<style type="text/css">
+.detail-tab-buttons li a span {
+padding: 6px 15px 0 18px;
+}
+</style>
+<style type="text/css">
+.i-11-xl{background-image:url(http://vortex.accuweather.com/adc2010/images/icons-numbered/11-xl.png)}
+.i-12-l{background-image:url(http://vortex.accuweather.com/adc2010/images/icons-numbered/12-l.png)} .i-18-l{background-image:url(http://vortex.accuweather.com/adc2010/images/icons-numbered/18-l.png)} .i-12-s{background-image:url(http://vortex.accuweather.com/adc2010/images/icons-numbered/12-s.png)} .i-18-s{background-image:url(http://vortex.accuweather.com/adc2010/images/icons-numbered/18-s.png)} .i-1-s{background-image:url(http://vortex.accuweather.com/adc2010/images/icons-numbered/01-s.png)} .i-6-s{background-image:url(http://vortex.accuweather.com/adc2010/images/icons-numbered/06-s.png)}
+</style>
+
+
+ <!--[if lte IE 6]>
+ <link rel="stylesheet" href="http://vortex.accuweather.com/adc2010/stylesheets/ie6.css" type="text/css" media="all" />
+ <script type="text/javascript" src="http://vortex.accuweather.com/adc2010/javascripts/ie6.js"></script>
+ <![endif]-->
+ <!--[if lt IE 7]>
+ <script defer type="text/javascript" src="http://vortex.accuweather.com/adc2010/javascripts/ie6_png_fix.js"></script>
+ <![endif]-->
+ <!--[if IE 7]><link rel="stylesheet" href="http://vortex.accuweather.com/adc2010/stylesheets/ie7.min-20130423.css" type="text/css" media="all" /><![endif]-->
+ <!--[if IE 8]><link rel="stylesheet" href="http://vortex.accuweather.com/adc2010/stylesheets/ie8.min-20130423.css" type="text/css" media="all" /><![endif]-->
+ <!--[if gte IE 9]><link rel="stylesheet" href="http://vortex.accuweather.com/adc2010/stylesheets/ie9.min-20121129.css" type="text/css" media="all" /><![endif]-->
+
+ <script type="text/javascript">
+ var apgUserInfoObj = {
+ country: 'CN',
+ city: 'Shanghai',
+ state: '31',
+ metro: '',
+ zip: '',
+ fcode: 'ZA80',
+ partner: 'accuweather',
+ sessionPartner: 'accuweather',
+ referer: '',
+ lang: 'en-us',
+ langid: '1',
+ lat: '31.23',
+ lon: '121.44',
+ dma: '',
+ ip: '202.120.52.45',
+ geo_dma: '',
+ geo_city: 'Shanghai',
+ geo_state: '31',
+ geo_zip: '',
+ geo_country: 'CN',
+ gmtOffset: '8',
+ locationKey: '106577'
+ };
+ var apgWxInfoObj = { nwsalrt: '', alerts: { source: '', category: '', typeid: '' }, isday: '1', lfs: { day: '1', category: '', severity: '2' }, hdln: '2', ut: '1', cu: { wx: '11', hi: '18', wd: '', hd: '', uv: '' }, fc: [{ wx: '', hi: '', lo: '' }, { wx: '', hi: '', lo: '' }, { wx: '', hi: '', lo: '' }], ix: {arthritis:'2',asthma:'2',bbq:'3',cold:'2',flu:'',lawnmowing:'4',migraine:'1',outdoor:'4',schoolclosing:'',sinus:'2',soil:'',field:'',beach:'1',biking:'4',concert:'2',construction:'3',composting:'2',dust:'1',fishing:'4',fueleconomy:'3',golf:'3',heart:'5',hiking:'4',hvac:'1',mosq:'1',sailing:'4',running:'4',schoolbus:'4',skiing:'1',star:'1',frizz:'0',pollen:'1',uvindex:'2',hunting:'4', driving:'2', travel:'4', airq:'0', pgrass:'1', pmold:'1', pweed:'1', ptree:'1' } };
+var aadCustomKeyValuePairs = {}; + var apgConfigObj = {};
+ apgConfigObj.prompts = {};
+ </script>
+
+ <script type="text/javascript">
+ var acm_RecentLocationsCarousel= new Array();
+
+acm_RecentLocationsCarousel.push({name:'Shanghai, China', daypart:'day', href:'/en/cn/shanghai/106577/weather-forecast/106577', icon:'http://vortex.accuweather.com/adc2010/images/icons-numbered/11-m.png', bg:'f', temp:'18', realfeel:'20', text:'Light fog'}); +acm_RecentLocationsCarousel.push({name:'New York, NY', daypart:'night', href:'/en/us/new-york-ny/10017/weather-forecast/349727', icon:'http://vortex.accuweather.com/adc2010/images/icons-numbered/11-m.png', bg:'s', temp:'16', realfeel:'18', text:'Light fog'}); +acm_RecentLocationsCarousel.push({name:'Miami, FL', daypart:'night', href:'/en/us/miami-fl/33128/weather-forecast/347936', icon:'http://vortex.accuweather.com/adc2010/images/icons-numbered/38-m.png', bg:'s', temp:'26', realfeel:'26', text:'Mostly cloudy'}); +acm_RecentLocationsCarousel.push({name:'Los Angeles, CA', daypart:'night', href:'/en/us/los-angeles-ca/90012/weather-forecast/347625', icon:'http://vortex.accuweather.com/adc2010/images/icons-numbered/33-m.png', bg:'cl', temp:'17', realfeel:'18', text:'Clear'}); +
+ </script>
+
+ <script type="text/javascript">
+ var acm_InterestLayers = [
+{group:'1.1', name:'Cold & Flu', code:'10302', icon: 'cold-flu', href:'http://www.accuweather.com/en/cn/shanghai/106577/cold-flu-weather/106577', alarm:[3,4,5]},
+{group:'1.1', name:'Allergies', code:'10201', icon: 'allergies', href:'http://www.accuweather.com/en/cn/shanghai/106577/allergies-weather/106577', alarm:[3,4,5]},
+{group:'1.1', name:'Respiratory', code:'10301', icon: 'respiratory', href:'http://www.accuweather.com/en/cn/shanghai/106577/asthma-weather/106577', alarm:[3,4,5]},
+{group:'1.1', name:'Arthritis', code:'10102', icon: 'arthritis', href:'http://www.accuweather.com/en/cn/shanghai/106577/arthritis-weather/106577', alarm:[3,4,5]},
+{group:'1.1', name:'Migraine', code:'10101', icon: 'migraine', href:'http://www.accuweather.com/en/cn/shanghai/106577/migraine-weather/106577', alarm:[3,4,5]},
+{group:'1.1', name:'Sinus', code:'10103', icon: 'sinus', href:'http://www.accuweather.com/en/cn/shanghai/106577/sinus-weather/106577', alarm:[3,4,5]},
+{group:'1.2', name:'Travel', code:'20501', icon: 'travel', href:'http://www.accuweather.com/en/cn/shanghai/106577/air-travel-weather/106577', alarm:[1]},
+{group:'1.2', name:'Astronomy', code:'40501', icon: 'astro', href:'http://www.accuweather.com/en/cn/shanghai/106577/astronomy-weather/106577', alarm:[1]},
+{group:'1.2', name:'Events', code:'41001', icon: 'events', href:'http://www.accuweather.com/en/cn/shanghai/106577/events-weather/106577', alarm:[1]},
+{group:'2.1', name:'Driving', code:'20401', icon: 'driving', href:'http://www.accuweather.com/en/cn/shanghai/106577/driving-weather/106577', alarm:[1]},
+{group:'2.1', name:'School Day', code:'30401', icon: 'school', href:'http://www.accuweather.com/en/cn/shanghai/106577/school-day-weather/106577', alarm:[1]},
+{group:'2.1', name:'Hair Day', code:'30301', icon: 'hair', href:'http://www.accuweather.com/en/cn/shanghai/106577/hair-day-weather/106577', alarm:[3,4,5]},
+{group:'2.1', name:'Snow Days', code:'30402', icon: 'snow', href:'http://www.accuweather.com/en/cn/shanghai/106577/snow-day-weather/106577', alarm:[4,5]},
+{group:'2.2', name:'D.I.Y.', code:'30101', icon: 'diy', href:'http://www.accuweather.com/en/cn/shanghai/106577/diy-weather/106577', alarm:[1]},
+{group:'2.2', name:'Lawn & Garden', code:'30201', icon: 'lawn-garden', href:'http://www.accuweather.com/en/cn/shanghai/106577/lawn-garden-weather/106577', alarm:[1]},
+{group:'2.2', name:'Home Energy', code:'30501', icon: 'home-energy', href:'http://www.accuweather.com/en/cn/shanghai/106577/home-energy-weather/106577', alarm:[1]},
+{group:'2.2', name:'Entertaining', code:'40102', icon: 'entertaining', href:'http://www.accuweather.com/en/cn/shanghai/106577/outdoor-entertaining-weather/106577', alarm:[1]},
+{group:'3.1', name:'Golf', code:'40201', icon: 'golf', href:'http://www.accuweather.com/en/cn/shanghai/106577/golf-weather/106577', alarm:[1]},
+{group:'3.1', name:'Ski', code:'40301', icon: 'ski', href:'http://www.accuweather.com/en/cn/shanghai/106577/ski-weather/106577', alarm:[1]},
+{group:'3.1', name:'Hunting', code:'40601', icon: 'hunting', href:'http://www.accuweather.com/en/cn/shanghai/106577/hunting-weather/106577', alarm:[1]},
+{group:'3.1', name:'Fishing', code:'40602', icon: 'fishing', href:'http://www.accuweather.com/en/cn/shanghai/106577/fishing-weather/106577', alarm:[1]},
+{group:'3.1', name:'Running', code:'40901', icon: 'running', href:'http://www.accuweather.com/en/cn/shanghai/106577/running-weather/106577', alarm:[1]},
+{group:'3.1', name:'Hiking', code:'40903', icon: 'hiking', href:'http://www.accuweather.com/en/cn/shanghai/106577/hiking-weather/106577', alarm:[1]},
+{group:'3.1', name:'Biking', code:'40902', icon: 'biking', href:'http://www.accuweather.com/en/cn/shanghai/106577/biking-weather/106577', alarm:[1]},
+{group:'3.1', name:'Sun & Sand', code:'40401', icon: 'sun-sand', href:'http://www.accuweather.com/en/cn/shanghai/106577/sun-sand-weather/106577', alarm:[1]},
+{group:'3.1', name:'Sailing', code:'40402', icon: 'sailing', href:'http://www.accuweather.com/en/cn/shanghai/106577/sailing-weather/106577', alarm:[1]}];
+ </script>
+
+ <script type="text/javascript" src="http://vortex.accuweather.com/adc2010/javascripts/lib.min-20121129.js"></script>
+
+<script type="text/javascript">
+ var apgPageInfoObj = { ad_site: 'world',
+ section: 'forecast',
+ ad_section: 'forecast',
+ page: 'forecast-current-conditions',
+ ad_page: 'current-conditions',
+ page_code: '',
+ crumb_trail: ['Forecast', 'CurrentConditions', 'CN', 'Shanghai', 'Shanghai'],
+ pageType: 'forecast',
+ pageExt: '', adPos: { atf728: true, atfPencil: true, atf300: true, atf160: false, btf728: true, btf300: true, popunder: true, prestitial: true, links: true, ptoSkin: true } };
+
+apgWxInfoObj.cu.wx = '11';apgWxInfoObj.cu.hi = '19';apgWxInfoObj.cu.wd = '17';apgWxInfoObj.cu.hd = '88';apgWxInfoObj.cu.uv = '4'; apgWxInfoObj.fc = [{ wx: '12', hi: '22', lo: '19' },
+ { wx: '18', hi: '23', lo: '17' },
+ { wx: '1', hi: '26', lo: '16' }];
+</script>
+
+ <script type="text/javascript" src="http://vortex.accuweather.com/adc2010/javascripts/site.min-20140417.js"></script>
+ <!--[if lte IE 8]>
+ <script>acm.isOldIE = true;</script>
+ <![endif]-->
+ <script type="text/javascript" src="http://vortex.accuweather.com/adc2010/javascripts/ads.min-20140331.js"></script>
+
+
+ <script type="text/javascript">
+ var settingsCke = "acm";
+ sj_SelectCountry = "Select a Country";
+
+ function acmCitySubmit(key) {
+
+ var s_value = document.getElementById('s').value;
+ if (s_value == "Enter postal code or city...") {
+ return false;
+ }
+
+ if (s_value === "") {
+ return false;
+ }
+ var isKeyPress = (key) ? 'EnterKey' : 'ButtonClick';
+
+ if (s_value == "Shanghai, China") {
+ _gaq.push(['_trackEvent', 'LocationBox', 'DefaultLocation', s_value.toLowerCase()]);
+ setTimeout(function () {
+ window.location.href = 'http://www.accuweather.com/en/cn/shanghai/106577/weather-forecast/106577';
+ }, 50);
+ } else {
+ _gaq.push(['_trackEvent', 'LocationBox', 'SearchLocation', s_value.toLowerCase()]);
+ //setTimeout(function () {
+ // document.forms["findcity"].submit();
+ //}, 50);
+ // Execute it right away to prevent double-submit.
+ document.forms["findcity"].submit();
+ }
+ }
+
+
+ </script>
+
+ <script type="text/javascript">
+ _gaq.push(['_setCustomVar', 10, 'SkyMotion', '1', 3]);
+ </script>
+
+ <!-- Begin comScore Tag -->
+ <script>
+ var _comscore = _comscore || [];
+ _comscore.push({ c1: "2", c2: "6005068" });
+ (function () {
+ var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
+ s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
+ el.parentNode.insertBefore(s, el);
+ })();
+ </script>
+ <!-- End comScore Tag -->
+
+ <script type="text/javascript">
+ (function () {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })()
+ </script>
+ <script>
+ if (typeof (aadObj) == 'undefined') {
+ _gaq.push(['_setCustomVar', 47, 'Ads_JS_Not_Loaded', apgUserInfoObj.sessionPartner, 3]);
+ }
+
+ _gaq.push(['_trackPageview']);
+ </script>
+</head>
+<body id="forecast-extended" class="forecast">
+ <style type="text/css">
+ #cobrand-banner-wrap-head{border-bottom:#D1D4D9 2px solid;}
+ #cobrand-banner-head{width:900px;margin:0px auto;height:40px;overflow:hidden;}
+ </style>
+ <div id="cobrand-banner-wrap-head">
+ <div id="cobrand-banner-head">
+ <style>#cobrand-banner-wrap-head{background:#ffffff !important}.cobrand-header{background:#FFF;width:100%;height:40px;}.cobrand-header .cobrand-header-container{width:90%;height:40px;margin:0 auto;clear:both}.cobrand-header .cobrand-header-container .logo{width:20%;float:left;height:40px;background-image:url(http://vortex.accuweather.com/adc2010/images/cobrand-partners/ARC-logo.jpg);background-size:contain;background-repeat:no-repeat}.cobrand-header .cobrand-header-container p{width:60%;padding-top:10px;margin:0 auto;text-align:center;display:inline-block;float:left;color:#d2341d;font-size: 16px;}.cobrand-header .cobrand-header-container span{width:20%;height:27px;padding-top:13px;display:inline-block;text-align:center;font-size:12px;color:#000;background: url(http://vortex.accuweather.com/adc2010/images/cobrand-partners/ACR-cta-btn.png) no-repeat 10px center}.lt-728 .cobrand-header .cobrand-header-container p{font-size:14px}.cobrand-header a{text-decoration:none;margin:0;padding:0;}.lt-728 .cobrand-header .cobrand-header-container span{background:red;color:#fff}.lt-623 .cobrand-header .cobrand-header-container .logo{width:10%;background-image:url(http://vortex.accuweather.com/adc2010/images/cobrand-partners/ARC-logo-sm.jpg)}.lt-623 .cobrand-header .cobrand-header-container p{width:70%;font-size:13px;line-height:12px}.lt-479 .cobrand-header .cobrand-header-container p{font-size:12px;line-height:12px;padding:10px 5% 0 5%;width:60%}</style><div class="cobrand-header"><a href="http://www.redcross.org/cm/accuweather-pub" target="_blank"><div class="cobrand-header-container"><div class="logo"></div><p>Help The Arkansas Tornado Relief Effort</p><span>Donate Now</span></div></a></div>
+ </div>
+ </div>
+
+<span id="dynamic-menu-container"></span>
+<div id="menu-cities" class="menu menu-list add-interest-menu">
+ <div class="menu-head-lt">
+ <div class="menu-head-rt">
+ <div class="menu-head"></div>
+ </div>
+ </div>
+ <!-- /.menu-head-lt -->
+ <div class="menu-body-lt">
+ <div class="menu-body-rt">
+ <div class="menu-body">
+ <ul class="menu-items">
+ <li><a href="http://www.accuweather.com/en/cn/shanghai/106577/weather-forecast/106577">Shanghai, China</a></li>
+ <li><a href="http://www.accuweather.com/en/us/new-york-ny/10017/weather-forecast/349727">New York, NY</a></li>
+ <li><a href="http://www.accuweather.com/en/us/miami-fl/33128/weather-forecast/347936">Miami, FL</a></li>
+ <li><a href="http://www.accuweather.com/en/us/los-angeles-ca/90012/weather-forecast/347625">Los Angeles, CA</a></li>
+ <li><a href="http://www.accuweather.com/en/browse-locations">Browse for your location</a></li>
+ </ul>
+ <span class="arrow"></span><span class="arrow-border"></span>
+ </div>
+ </div>
+ </div>
+ <!-- /.menu-body-lt -->
+ <div class="menu-foot-lt">
+ <div class="menu-foot-rt">
+ <div class="menu-foot"></div>
+ </div>
+ </div>
+ <!-- /.menu-foot-lt -->
+</div>
+
+<!-- NEW! menu -->
+<div id="current-city-menu" class="menu menu-list add-interest-menu">
+ <div class="menu-head-lt"><div class="menu-head-rt"><div class="menu-head"></div></div></div><!-- /.menu-head-lt -->
+ <div class="menu-body-lt">
+ <div class="menu-body-rt">
+ <div class="menu-body">
+ <ul>
+ <li><a href="http://www.accuweather.com/en/cn/shanghai/106577/weather-forecast/106577">Today's Weather</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/shanghai/106577/hourly-weather-forecast/106577">Hourly Forecast</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577">Extended</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/shanghai/106577/weekend-weather/106577">Weekend</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/shanghai/106577/may-weather/106577">Month Outlook</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/shanghai/106577/current-weather/106577">Current Weather</a></li>
+ </ul>
+ <span class="arrow"></span>
+ <span class="arrow-border"></span>
+ </div>
+ </div>
+ </div>
+ <!-- /.menu-body-lt -->
+ <div class="menu-foot-lt"><div class="menu-foot-rt"><div class="menu-foot"></div></div></div><!-- /.menu-foot-lt -->
+
+</div>
+<!-- #/current-city-menu -->
<div id="current-country-menu" class="menu menu-list add-interest-menu">
+ <div class="menu-head-lt">
+ <div class="menu-head-rt">
+ <div class="menu-head"></div>
+ </div>
+ </div>
+ <!-- /.menu-head-lt -->
+ <div class="menu-body-lt">
+ <div class="menu-body-rt">
+ <div class="menu-body">
+ <ul>
+ <li class="first"><a href="http://www.accuweather.com/en/cn/china-weather">Home</a></li>
+ </ul>
+ <ul>
+ <li class="first"><a href="http://www.accuweather.com/en/cn/national/satellite">Maps</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/national/satellite">Satellite</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/national/weather-forecast-maps">Weather Forecast Maps</a></li>
+ </ul>
+ <ul>
+ <li class="first"><a href="http://www.accuweather.com/en/weather-news">News & Video</a></li>
+ <li><a href="http://www.accuweather.com/en/weather-news">Weather News</a></li>
+ <li><a href="http://www.accuweather.com/en/weather-video">Weather Video</a></li>
+ <li><a href="http://www.accuweather.com/en/weather-blogs">Weather Blogs</a></li>
+ <li><a href="http://www.accuweather.com/en/personalities">Personalities</a></li>
+ </ul>
+ <ul>
+ <li class="first"><a href="http://www.accuweather.com/en/climate-change">Extreme Weather</a></li>
+ <li><a href="http://www.accuweather.com/en/climate-change">Climate Change</a></li>
+ </ul>
+ <ul>
+ <li class="first"><a href="http://www.accuweather.com/en/social">Social</a></li>
+ <li><a href="http://www.accuweather.com/en/social">Social Media</a></li>
+ <li><a href="http://www.accuweather.com/en/downloads">Apps & Downloads</a></li>
+ <li><a href="http://photo.accuweather.com">Weather Photos</a></li>
+ <li><a href="http://forums.accuweather.com">Weather Forums</a></li>
+ </ul>
+ <div class="clearfix"></div>
+ <span class="arrow"></span> <span class="arrow-border"></span> </div>
+ </div>
+ </div>
+ <!-- /.menu-body-lt -->
+ <div class="menu-foot-lt">
+ <div class="menu-foot-rt">
+ <div class="menu-foot"></div>
+ </div>
+ </div>
+ <!-- /.menu-foot-lt -->
+</div>
+<!-- #/current-country-menu -->
<div id="menu-premium" class="menu menu-with-title">
+ <h3 class="menu-title"><span>Login</span></h3>
+ <div class="menu-head-lt">
+ <div class="menu-head-rt">
+ <div class="menu-head"></div>
+ </div>
+ </div>
+ <!-- /.menu-head-lt -->
+ <div class="menu-body-lt">
+ <div class="menu-body-rt">
+ <div class="menu-body">
+ <ul class="menu-items">
+ <li><a href="https://wwwl.AccuWeather.com/premium_login.php" target="_blank">AccuWeather.com Premium</a></li>
+
+ <li><a href="https://wwwl.AccuWeather.com/pro_login.php" target="_blank">AccuWeather.com Professional</a></li>
+ <li><a href="http://radarplus.accuweather.com/" target="_blank">AccuWeather.com RadarPlus</a></li>
+ <li><a href="http://www.accuweather.com/adcbin/public/LightningPlus_Benefits.asp" target="_blank">AccuWeather.com LightningPlus</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <!-- /.menu-body-lt -->
+ <div class="menu-foot-lt">
+ <div class="menu-foot-rt">
+ <div class="menu-foot"></div>
+ </div>
+ </div>
+ <!-- /.menu-foot-lt -->
+</div>
+
+
+<div id="menu-settings" class="menu menu-with-title">
+
+ <h3 class="menu-title"><span></span></h3>
+
+ <div class="menu-head-lt">
+ <div class="menu-head-rt">
+ <div class="menu-head"></div>
+ </div>
+ </div>
+ <!-- /.menu-head-lt -->
+ <div class="menu-body-lt">
+ <div class="menu-body-rt">
+ <div class="menu-body">
+
+ <h4>My Settings</h4>
+
+ <div class="control-wrap">
+
+ <form action="" method="post" autocomplete="false">
+
+ <label for="settings-language"></label>
+ <select id="settings-language" name="language" class="match-toggle" onchange="acm_updateLanguage(this.options[this.selectedIndex].value, (this.selectedIndex+1));">
+ <option value="en-us">English (US)</option>
+<option value="es">Español</option>
+<option value="fr">Français</option>
+<option value="da">Dansk</option>
+<option value="pt">Português</option>
+<option value="nl">Nederlands</option>
+<option value="no">Norsk</option>
+<option value="it">Italiano</option>
+<option value="de">Deutsch</option>
+<option value="sv">Svenska</option>
+<option value="fi">Suomi</option>
+<option value="zh-hk">中文 (HK)</option>
+<option value="zh-cn">中文 (SIM)</option>
+<option value="zh-tw">中文 (Taiwan)</option>
+<option value="es-ar">Español (Argentina)</option>
+<option value="es-mx">Español (Latin America)</option>
+<option value="sk">Slovenčinu</option>
+<option value="ro">Romana</option>
+<option value="cs">Čeština</option>
+<option value="hu">Magyar</option>
+<option value="pl">Polski</option>
+<option value="ca">Català</option>
+<option value="pt-br">Português (Brazil)</option>
+<option value="hi">हिन्दी</option>
+<option value="ru">русский</option>
+<option value="ar">عربي</option>
+<option value="el">Ελληνικά</option>
+<option value="en-gb">English (UK)</option>
+<option value="ja">日本語</option>
+<option value="ko">한국어</option>
+<option value="tr">TÜRKÇE</option>
+<option value="fr-ca">Français (Canada)</option>
+<option value="he">עברית</option>
+<option value="sl">Slovenski</option>
+<option value="uk">Українське</option>
+<option value="id">Bahasa Indonesia</option>
+<option value="bg">български</option>
+<option value="et">Eesti keeles</option>
+<option value="hr">Hrvatski</option>
+<option value="kk">Қазақша</option>
+<option value="lt">Lietuvių</option>
+<option value="lv">Latviski</option>
+<option value="mk">Македонски</option>
+<option value="ms">Bahasa Melayu</option>
+<option value="tl">Tagalog</option>
+<option value="sr">Srpski</option>
+<option value="th">ไทย</option>
+<option value="vi">Tiếng Việt</option>
+
+ </select>
+
+ </div>
+ <!-- /.control-wrap -->
+
+ <div id="radio-toggle-temp-unit" class="radio-toggle">
+ <label for="settings-temp-unit-farenheit" class="first">
+ <span>°F</span>
+ <input id="settings-temp-unit-farenheit" name="temp_unit" type="radio" value="farenheit" onclick="acm_updateUnits('0');"/>
+ </label>
+
+ <label for="settings-temp-unit-celsius" class="last">
+ <span>°C</span>
+ <input id="settings-temp-unit-celsius" name="temp_unit" type="radio" checked="checked" value="celsius" onclick="acm_updateUnits('1');"/>
+ </label>
+ </div>
+ <!-- /.radio-toggle -->
+
+ </form>
+
+ </div>
+ </div>
+ </div>
+ <!-- /.menu-body-lt -->
+
+ <div class="menu-foot-lt">
+ <div class="menu-foot-rt">
+ <div class="menu-foot"></div>
+ </div>
+ </div>
+ <!-- /.menu-foot-lt -->
+
+</div>
+<!-- /#settings-menu -->
<div id="menu-country" class="menu menu-with-title">
+
+ <h3 class="menu-title"><span><span class="flag-CN">China</span></span></h3>
+
+ <div class="menu-head-lt">
+ <div class="menu-head-rt">
+ <div class="menu-head"></div>
+ </div>
+ </div>
+ <!-- /.menu-head-lt -->
+ <div class="menu-body-lt">
+ <div class="menu-body-rt">
+ <div class="menu-body">
+
+ <h4>My Recent Countries</h4>
+
+ <ul class="menu-items">
+ <li><a href="http://www.accuweather.com/en/cn/china-weather" class="flag-CN">China</a></li>
+ <li><a href="http://www.accuweather.com/en/us/united-states-weather" class="flag-US">United States</a></li>
+ <li><a href="http://www.accuweather.com/en/gb/united-kingdom-weather" class="flag-GB">United Kingdom</a></li>
+ </ul>
+
+ <a href="#country-selector" id="bt-more-countries">More Countries</a>
+
+ </div>
+ </div>
+ </div>
+ <!-- /.menu-body-lt -->
+
+ <div class="menu-foot-lt">
+ <div class="menu-foot-rt">
+ <div class="menu-foot"></div>
+ </div>
+ </div>
+ <!-- /.menu-foot-lt -->
+
+</div>
+<!-- /#menu-country -->
+<!-- add interest dropdown -->
+<div id="add-interest-dropdown" class="clearfix">
+
+ <div id="inner-content" class="clearfix">
+ </div><!-- end add-interest-inner-content -->
+
+ <!-- icons -->
+ <span class="arrow"></span>
+ <span class="arrow-border"></span>
+ <!-- end icons -->
+
+</div><!-- end id="add-interest-dropdown" -->
+
+<div id="wrap" class="spring h-f">
+ <div id="wrap-header-nav" class="day">
+ <div id="header-nav" class="i-11-header">
+
+
+<div id="header">
+
+ <div id="header-davek">
+ <div id="header-davek-ps"></div>
+ <script type="text/javascript">
+ acm.loadAd(aadTags, 'tile1', '#header-davek-ps', '90px');
+ </script>
+ </div>
+
+ <!-- /#header-ad -->
+ <style type="text/css">
+ #header-nav{overflow:visible;position:static;height:auto;}
+ #header-davek{margin-top:0px;padding-top:4px;}
+ </style>
+
+<div id="wrap-country-settings">
+ <div id="country-settings">
+ <a href="#menu-country" id="bt-menu-country" class="menu-arrow tmenu { el:'#menu-country', affix: { from: 'nw', to: 'nw', offset: [ -6, -8 ] } }"><strong><span class="ir flag-CN">China</span></strong></a>
+ <ul id="country-breadcrumbs">
+
+ <li class="first"><a href="http://www.accuweather.com/en/world-weather">World</a></li>
+ <li><a href="http://www.accuweather.com/en/asia-weather">Asia</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/china-weather">China</a></li>
+ <li><a href="http://www.accuweather.com/en/cn/31/shanghai-weather">Shanghai</a></li>
+ <li class="last"><a href="http://www.accuweather.com/en/cn/shanghai/106577/weather-forecast/106577">Shanghai</a></li>
+ </ul>
+ <!-- /#country-breadcrumbs -->
+ </div>
+ <!-- /#nav-country -->
+</div>
+<!-- /#wrap-nav-country -->
+
+<div id="country-selector" class="strong panel">
+
+ <div class="panel-head-lt"><div class="panel-head-rt"><div class="panel-head"></div></div></div>
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div class="panel-body">
+ <div class="title">
+ <button class="bt bt-panel-close">Close</button>
+ <div id="country-selector-recent">
+ <h3>My Recent Countries</h3>
+ <ul>
+ <li class="first"><a href="http://www.accuweather.com/en/cn/china-weather" class="flag-CN">China</a></li>
+ <li class=""><a href="http://www.accuweather.com/en/us/united-states-weather" class="flag-US">United States</a></li>
+ <li class=""><a href="http://www.accuweather.com/en/gb/united-kingdom-weather" class="flag-GB">United Kingdom</a></li>
+ </ul>
+ </div>
+ <!-- /#country-selector-recent -->
+ </div>
+ <!-- /.title -->
+
+ <div id="country-selector-region" class="panel-content">
+
+ <div class="title">
+ <h3>Select a Region</h3>
+ </div>
+
+ <div class="content">
+
+ <ul id="country-selector-region-list" class="menu-items">
+ <li><a class="link-region" id="link-region-afr" href="#region-afr">Africa</a></li>
+ <li><a class="link-region" id="link-region-ant" href="#region-ant">Antarctica</a></li>
+ <li><a class="link-region" id="link-region-arc" href="#region-arc">Arctic</a></li>
+ <li><a class="link-region" id="link-region-asi" href="#region-asi">Asia</a></li>
+ <li><a class="link-region" id="link-region-cac" href="#region-cac">Central America</a></li>
+ <li><a class="link-region" id="link-region-eur" href="#region-eur">Europe</a></li>
+ <li><a class="link-region" id="link-region-mea" href="#region-mea">Middle East</a></li>
+ <li><a class="link-region" id="link-region-nam" href="#region-nam">North America</a></li>
+ <li><a class="link-region" id="link-region-ocn" href="#region-ocn">Oceania</a></li>
+ <li><a class="link-region" id="link-region-sam" href="#region-sam">South America</a></li>
+ </ul>
+ <!-- /#country-selector-region-list -->
+
+ <div id="country-selector-region-map">
+ </div>
+ <!-- /#country-selector-region-map -->
+ </div>
+ <!-- /.content -->
+ </div>
+ <!-- /#country-selector-region -->
+
+
+ <div id="country-selector-country" class="panel-content">
+ <div id="region-afr" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /africa-->
+ <div id="region-eur" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /europe-->
+ <div id="region-nam" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /north america-->
+ <div id="region-sam" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /south america-->
+ <div id="region-cac" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /central america-->
+ <div id="region-ocn" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /oceania-->
+ <div id="region-mea" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /middle east-->
+ <div id="region-ant" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /antarctica-->
+ <div id="region-arc" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /arctic-->
+ <div id="region-asi" class="region">
+ <div class="title"> <a href="#country-selector-region" class="world"><span>World</span></a>
+ <h3></h3>
+ </div>
+ <div class="items"> </div>
+ </div>
+ <!-- /asia-->
+ </div>
+ <!-- /#country-selector-country -->
+
+
+ <div id="country-selector-notes">
+ <p class="first">
+ Note: Select a region before finding a country.
+ </p>
+
+ <p></p>
+
+ </div>
+ <!-- /#country-selector-notes -->
+
+
+ </div>
+ </div>
+ </div>
+ <!-- /.panel-body-lt -->
+
+ <div class="panel-foot-lt"><div class="panel-foot-rt"><div class="panel-foot"></div></div></div>
+
+</div>
+<!-- / #country-selector -->
+
+
+ <div id="header-logo-search" class="clearfix">
+ <div id="header-logo" class="ir huafeng"><span>Shanghai Current Weather<span class="huafeng"></span></span></div>
+ <label for="s">for</label>
+
+ <div id="wrap-s-rt">
+ <div id="wrap-s-lt">
+ <div id="wrap-s" class="tmenu { affix: {offset: [ 0, 7 ], to: 'sw', from: 'nw'},el: '#menu-cities' }">
+ <form id="findcity" action="http://www.accuweather.com/en/search-locations" method="post">
+ <input onkeypress="acmCheckEnter(event);" id="s" name="s" type="text" autocomplete="off"
+ class="text hint { help: 'Shanghai, China',className:'hintedLoc' }" />
+ <input type="hidden" name="rn" value="3day" />
+ <button onclick="acmCitySubmit()" type="button" class="bt bt-go">
+ <div></div>
+ </button>
+ </form>
+ <script type="text/javascript">
+ (function ($) {
+ $('input.hint').hint();
+ })(jQuery);
+ </script>
+ </div>
+ </div>
+ </div>
+ <!-- /#wrap-s-rt -->
+
+ <!-- NEW! Removed widgets to accommodate login -->
+ <!-- NEW! Login menu -->
+ <a id="bt-menu-login" class="tmenu { el:'#menu-premium', affix: { to: 'ne', from: 'ne', offset: [ 0,-6 ] } }"><span class="menu-arrow"><span>Login</span></span></a>
+ <!-- NEW! moving menu settings here, which affects css -->
+ <a id="bt-menu-settings" class="tmenu { el:'#menu-settings', affix: { from: 'ne', to: 'ne', offset: [ 0,-6 ] } }"><span class="menu-arrow"><span> </span>, °C</span></a>
+
+
+ </div>
+ <!-- /#header-logo-search -->
+</div>
+<!-- /#header -->
+
+ </div>
+ <!-- /#header-nav -->
+ </div>
+ <!-- /#wrap-header-nav -->
+
+
+ <div id="wrap-content">
+ <div id="content">
+
+<!-- NEW! adding add-interest tab -->
+<div id="nav-main-add-interests" class="clearfix">
+
+ <div id="nav-main-background"></div>
+
+ <ul id="nav-current-location" class="sub-nav">
+ <li id="current-country-tab" class=" tmenu { affix: {offset: [ 0, 5 ], to: 'sw', from: 'nw' }, el: '#current-country-menu' }">
+ <a href="http://www.accuweather.com/en/cn/china-weather" class="tab">
+ <span class="current-country">China</span>
+ <span class="title">Weather</span>
+ </a>
+ <span class="bottom-line"></span>
+ </li>
+ <li id="current-city-tab" class="selected tmenu { affix: {offset: [ 0, 5 ], to: 'sw', from: 'nw'}, el: '#current-city-menu' }">
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/weather-forecast/106577" class="tab">
+ <span class="current-city"><h1>Shanghai, CN</h1></span>
+ <span class="title"><h2>Local Weather</h2></span>
+ <span class="divider"></span>
+ <span class="more-info-arrow"></span>
+ <div class="more-info-content">
+ </div><!-- end more-info-content -->
+ </a>
+ </li>
+ <li id="locations-dropdown-tab" class="location-menu { el: '#locations-dropdown-menu' }">
+ <a href="#" class="tab">
+ <span class="arrow"></span>
+ <span class="divider"></span>
+ </a>
+ <span class="cover-line"></span>
+ </li>
+ </ul><!-- end nav-current-location -->
+
+
+ <!-- New! locations dropdown menu -->
+ <div id="locations-dropdown-menu" class="menu">
+ <div class="outer-border">
+ <div id="locations-carousel" class="locations-carousel">
+ <button class="carousel-button carousel-left disabled">
+ <span class="inner-button">
+ <span class="arrow"></span>
+ </span><!-- end inner-button-->
+ </button>
+ <button class="carousel-button carousel-right">
+ <span class="inner-button">
+ <span class="arrow"></span>
+ </span><!-- end inner-button-->
+ </button>
+ <div class="outer-carousel">
+ <div class="inner-carousel clearfix">
+
+ <div class="my-recent-locations clearfix">
+ <h3>My Recent Locations</h3>
+ <ul>
+
+ </ul>
+ </div><!-- end my recent locations -->
+
+ </div><!-- end inner-carousel-->
+ </div><!-- end outer-carousel -->
+ </div><!-- end carousel -->
+ </div><!-- outer-border -->
+ </div><!-- end locations-dropdown-menu -->
+
+</div><!-- end nav-main-add-interests-->
+
+<script type="text/javascript">
+ acm.setupMenus();
+</script>
+
+
+
+
+<div class="subnav-head-tabs-rt clearfix">
+ <div class="subnav-head-tabs-lt clearfix">
+ <ul class="subnav-tab-buttons">
+
+
+ <li ><a href="http://www.accuweather.com/en/cn/shanghai/106577/weather-forecast/106577"><span>Now</span></a></li>
+ <li ><a href="http://www.accuweather.com/en/cn/shanghai/106577/weekend-weather/106577"><span>Weekend</span></a></li>
+ <li class="current"><a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577"><span><strong>Extended</strong></span></a><div class="nub"></div></li>
+ <li ><a href="http://www.accuweather.com/en/cn/shanghai/106577/may-weather/106577"><span>Month</span></a></li>
+ <li class="last"><a href="http://www.accuweather.com/en/cn/shanghai/106577/satellite/106577"><span>Satellite</span></a></li>
+
+
+ </ul>
+ </div>
+</div>
+<!-- /.panel-head-rt -->
+
+<div class="column-1 clearfix">
+ <div id="panel-main" class="strong panel">
+ <!-- NOTE: The left and right ordering is swapped for this one, since it's a two element stretch! -->
+ <div class="panel-head-rt">
+ <div class="panel-head-lt">
+ </div>
+ </div>
+ <!-- /.panel-head-rt -->
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div class="panel-body">
+
+
+<div class="feed-controls clearfix">
+ <span class="lt">1 - 5 of 45 days | <a href="http://www.accuweather.com/en/cn/shanghai/106577/month/106577?view=table">All 45 days</a></span>
+ <ul class="g g-nav rt">
+ <li class="first"><a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=6">Next 5 ></a></li>
+ </ul>
+</div>
+<!-- /.feed-controls -->
+
+<div id="feed-tabs">
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=6" class="arrow-right">Next 5 Days<span></span></a>
+
+ <ul>
+ <li class="day current first cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=1' }">
+ <div class="frame"></div>
+ <div class="bg bg-c">
+ <h3><a href="#">Today</a></h3>
+ <h4>May 10</h4>
+ <div class="icon i-12-s "></div>
+ <div class="info">
+ <span class="cond">Rain and drizzle this morning</span>
+ <strong class="temp">22<span>°</span></strong><span class="low"><span>Lo</span> 19<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=2' }">
+ <div class="frame"></div>
+ <div class="bg bg-r">
+ <h3><a href="#">Sun</a></h3>
+ <h4>May 11</h4>
+ <div class="icon i-18-s "></div>
+ <div class="info">
+ <span class="cond">Humid with heavy rain</span>
+ <strong class="temp">23<span>°</span></strong><span class="low"><span>Lo</span> 17<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=2" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=3' }">
+ <div class="frame"></div>
+ <div class="bg bg-su">
+ <h3><a href="#">Mon</a></h3>
+ <h4>May 12</h4>
+ <div class="icon i-1-s "></div>
+ <div class="info">
+ <span class="cond">Nice and warm with sunshine</span>
+ <strong class="temp">26<span>°</span></strong><span class="low"><span>Lo</span> 16<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=3" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=4' }">
+ <div class="frame"></div>
+ <div class="bg bg-c">
+ <h3><a href="#">Tue</a></h3>
+ <h4>May 13</h4>
+ <div class="icon i-6-s "></div>
+ <div class="info">
+ <span class="cond">Rather cloudy and warm</span>
+ <strong class="temp">26<span>°</span></strong><span class="low"><span>Lo</span> 18<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=4" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv last cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=5' }">
+ <div class="frame"></div>
+ <div class="bg bg-c">
+ <h3><a href="#">Wed</a></h3>
+ <h4>May 14</h4>
+ <div class="icon i-12-s "></div>
+ <div class="info">
+ <span class="cond">Showers around in the morning</span>
+ <strong class="temp">25<span>°</span></strong><span class="low"><span>Lo</span> 18<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=5" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ </ul>
+</div>
+<!-- /.feed-tabs -->
+
+
+
+ <div id="details">
+ <ul id="detail-tab-buttons" class="detail-tab-buttons">
+ <li class="first current { target: '#detail-now' }"><a href="http://www.accuweather.com/en/cn/shanghai/106577/current-weather/106577" class=""><span>Now</span></a>
+ <div class="nub"></div>
+ </li>
+ <li class="{ target: '#detail-day-night' }"><a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577"><span>Daily</span></a></li>
+ <li class="last { target: '#detail-hourly' }"><a href="http://www.accuweather.com/en/cn/shanghai/106577/hourly-weather-forecast/106577"><span>Hourly</span></a></li>
+ <li class="{ target: '#detail-morning' }"><a href="http://www.accuweather.com/en/cn/shanghai/106577/morning-weather-forecast/106577"><span>Morning</span></a></li>
+ <li class="{ target: '#detail-afternoon' }"><a href="http://www.accuweather.com/en/cn/shanghai/106577/afternoon-weather-forecast/106577"><span>Afternoon</span></a></li>
+ <li class="{ target: '#detail-evening' }"><a href="http://www.accuweather.com/en/cn/shanghai/106577/evening-weather-forecast/106577"><span>Evening</span></a></li>
+ <li class="last { target: '#detail-overnight' }"><a href="http://www.accuweather.com/en/cn/shanghai/106577/overnight-weather-forecast/106577"><span>Overnight</span></a></li>
+ </ul>
+ <!-- /#detail-tab-buttons.detail-tab-buttons -->
+ <div id="detail-now" class="detail-tab-panel day">
+ <div class="bg bg-f">
+ <div class="forecast">
+ <div class="icon i-11-xl"></div>
+ <div class="info"> <span class="cond">Light fog</span> <span class="temp">19<span>°</span></span> <span class="realfeel">RealFeel® 20<span>°</span></span> </div>
+ <!-- /.info -->
+ </div>
+ <!-- /.forecast -->
+ <div class="more-info">
+ <!--
+ <img src="http://vortex.accuweather.com/adc2010/images/icons-wind/SE.gif" width="260" height="138" alt="" />
+ -->
+ <div class="wind-box-lg">
+ <div id="wind-arm-day" class="wind-arm"></div>
+ <p class="n">N</p>
+ <p class="e">E</p>
+ <p class="s">S</p>
+ <p class="w">W</p>
+ <script type="text/javascript">
+ (function () {
+ var d = 'SE';
+ var s = '17km/h';
+ $('#wind-arm-day').flash({ 'wmode': 'transparent', 'allowScriptAccess': 'always', 'src': 'http://vortex.accuweather.com/adc2010/flash/wind-arm-large.swf?speed=' + s + '&direction=' + d.toLowerCase() + '&units=km/h', 'width': '260', 'height': '138' });
+ if (typeof (acm_hasFlash) != 'undefined' && !acm_hasFlash) {
+ $('#wind-arm-day').html('<img src="http://vortex.accuweather.com/adc2010/images/icons-wind/arrow-lg-' + d + '.png" />');
+ }
+ })();
+ </script>
+ </div>
+
+
+ <ul class="stats">
+ <li>Humidity: <strong>88%</strong></li>
+ <li>Pressure: <strong>1014.00 mb </strong></li>
+ <li>UV Index: <strong>4</strong></li>
+ <li>Cloud Cover: <strong>20%</strong></li>
+ <li>Ceiling: <strong>549 m</strong></li>
+ <li>Dew Point: <strong>17° C</strong></li>
+ <li>Visibility: <strong>3 km</strong></li>
+ </ul>
+ <!-- /.stats -->
+ </div>
+ <!-- /.more-info -->
+
+ <div style="position:absolute;top:124px;left:427px;height:20px;font-weight:bold;font-size:10px;text-align:center;">17 km/h</div>
+
+ </div>
+ <!-- /.bg -->
+ </div>
+ <!-- /.detail-tab-panel -->
+ </div>
+ <!-- /#details -->
+
+ <script>acm.setupLifestylePromoLinks(jQuery);</script>
+
+ <div id="feature-sun" class="feature feature-first">
+ <div class="feature-title">
+ <h3 class="lt">Sunrise/Sunset</h3>
+ </div>
+ <!-- /.feature-title -->
+
+ <img src="http://vortex.accuweather.com/adc2010/images/features/sun.jpg" width="289" height="108" alt="Sunrise / Sunset Illustration" />
+
+ <p class="time-period">
+ <span class="ac">Rises at</span>
+ <span class="start">5:03 AM</span>
+ <span class="ac">with</span>
+
+ <span class="time">13:36</span>
+
+ <span class="ac">of sunlight, then sets at</span>
+ <span class="finish">6:39 PM</span>
+ </p>
+ <!-- /.content -->
+ </div>
+ <!-- /.feature -->
+
+ <div id="feature-moon" class="feature">
+ <div class="feature-title">
+ <h3 class="lt">Moonrise/Moonset</h3>
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/astronomy-weather/106577" class="more rt">Astronomy ></a>
+ </div>
+ <!-- /.feature-title -->
+
+ <img src="http://vortex.accuweather.com/adc2010/images/features/moon.jpg" width="289" height="108" alt="Moonrise / Moonset Illustration" />
+
+ <p class="time-period">
+ <span class="ac">Rises at</span>
+ <span class="start">2:18 PM</span>
+ <span class="ac">with</span>
+ <span class="time">12:14</span>
+ <span class="ac">of moolight, then sets at</span>
+ <span class="finish">2:32 AM</span>
+ </p>
+ <!-- /.content -->
+ </div>
+
+ <!-- /.feature -->
+
+ <div class="panel-body-content">
+ <div class="feature-stats">
+ <h3>Temperature Summary - 10:58 AM</h3>
+ <div class="clearfix">
+ <div class="lt" style="width:290px;">
+ <table cellspacing="0" class="stats">
+ <thead>
+ <tr>
+ <th> </th>
+ <th>Temp (°C)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="pre">
+ <th scope="row">Now</th>
+ <td>19°</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">Yesterday</th>
+ <td>21°</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">RealFeel®</th>
+ <td>20°</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">RealFeel® Shade</th>
+ <td>18°</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">Wind Chill</th>
+ <td>19°</td>
+ </tr>
+ <tr class="last pre">
+ <th scope="row">Dew Point</th>
+ <td>17°</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="rt" style="width:290px;">
+ <table cellspacing="0" class="stats">
+ <thead>
+ <tr>
+ <th> </th>
+ <th>Hi / Lo</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="hi">
+ <th scope="row" style="border-bottom:2px solid transparent;">Previous 6 Hours</th>
+ <td>20°</td>
+ </tr>
+ <tr class="lo">
+ <th scope="row"> </th>
+ <td>18°</td>
+ </tr>
+ <tr class="hi">
+ <th scope="row" style="border-bottom:2px solid transparent;">Previous 12 Hours</th>
+ <td>20°</td>
+ </tr>
+ <tr class="lo">
+ <th scope="row"> </th>
+ <td>17°</td>
+ </tr>
+ <tr class="hi">
+ <th scope="row" style="border-bottom:2px solid transparent;">Previous 24 Hours</th>
+ <td>22°</td>
+ </tr>
+ <tr class="lo">
+ <th scope="row"> </th>
+ <td>17°</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div id="feature-history">
+ <div class="clearfix">
+ <h3 class="lt">Temperature History - May 10</h3>
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/month/106577?view=table" class="more rt">more Historical Weather Data ></a>
+ <!-- /.rt -->
+ </div>
+
+ <table cellspacing="0" class="stats">
+ <thead>
+ <tr>
+ <th> </th>
+ <th>Today</th>
+ <th>Normal</th>
+ <th>Record</th>
+ <th>5/10/2013</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="hi">
+ <th scope="row">High</th>
+ <td>22°</td>
+
+ <td class="high">23°</td>
+
+ <td>N/A</td>
+
+ <td>24°</td>
+ </tr>
+
+ <tr class="last lo">
+ <th scope="row">Low</th>
+ <td>19°</td>
+
+ <td class="high">16°</td>
+
+ <td>N/A</td>
+
+ <td>18°</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <!-- /#feature-history -->
+
+ <div class="panel-body-content">
+ <div class="feature-stats">
+ <h3>Precipitation Summary - 10:58 AM</h3>
+ <table cellspacing="0" class="stats">
+ <thead>
+ <tr>
+ <th> </th>
+ <th>Amount (mm)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr class="pre">
+ <th scope="row">Previous 1 Hour</th>
+ <td>0</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">Previous 3 Hours</th>
+ <td>0</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">Previous 6 Hours</th>
+ <td>1</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">Previous 9 Hours</th>
+ <td>1</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">Previous 12 Hours</th>
+ <td>1</td>
+ </tr>
+ <tr class="pre">
+ <th scope="row">Previous 18 Hours</th>
+ <td>1</td>
+ </tr>
+ <tr class="last pre">
+ <th scope="row">Previous 24 Hours</th>
+ <td>1</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ <!-- /.panel-body-lt -->
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"></div>
+ </div>
+ </div>
+ </div>
+
+ <!-- /#panel-main -->
+
+ <div class="panel panel-top-story">
+ <div class="panel-head-lt">
+ <div class="panel-head-rt">
+ <div class="panel-head"></div>
+ </div>
+ </div>
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div class="panel-body">
+ <div class="article-wrap">
+ <span>Top Story</span>
+ <h3>Shanghai Weather Report</h3>
+ <div id="article" class="article">
+ <a href="http://www.accuweather.com/en/weather-news/hong-kong-flooding-rain/26703868" class="wrap">
+ <img src="http://vortex.accuweather.com/adc2004/pub/includes/columns/newsstory/2014/237x145_05091356_weekendthumb.jpg" width="237" height="145" alt="" />
+ </a>
+ <div class="info">
+ <h4><a href="http://www.accuweather.com/en/weather-news/hong-kong-flooding-rain/26703868">Rainfall Tops 400 mm Near Hong Kong, More to Come</a></h4>
+ <h5>May 9, 2014; 10:05 PM ET</h5>
+ <p>Hong Kong has already endured flooding rain, and more is on the way for this weekend. <a href="http://www.accuweather.com/en/weather-news/hong-kong-flooding-rain/26703868" class="more">more ></a></p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"></div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+
+ <!-- /.column-1 -->
+
+
+
+<div class="column-2 clearfix">
+
+
+
+<div id="aadTop300" class="panel">
+ <div class="panel-head-lt">
+ <div class="panel-head-rt">
+ <div class="panel-head"></div>
+ </div>
+ </div>
+
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div id="top-panel-body-rt-body" class="ad-lr panel-body">
+ <div id="top-panel-body-rt-body-ps" ></div>
+ <script type="text/javascript">
+ acm.loadAd(aadTags, 'tile2', '#top-panel-body-rt-body-ps', '250px');
+ </script>
+ </div>
+ </div>
+ </div>
+
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"></div>
+ </div>
+ </div>
+</div><div class="panel">
+ <div class="panel-head-rt">
+ <div class="panel-head-lt">
+ <div class="panel-head"></div>
+ </div>
+ </div>
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div class="panel-body">
+ <div class="panel-body-content">
+ <a href="http://www.accuweatherglobal.com/demo.php" target="_blank"><img src="http://vortex.accuweather.com/adc2010/images/misc/Ad_Weather_Data_Portal_Final.png" /></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"></div>
+ </div>
+ </div>
+</div>
+<div id="ad-links" class="panel">
+ <div class="panel-head-lt">
+ <div class="panel-head-rt">
+ <div class="panel-head"></div>
+ </div>
+ </div>
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div class="panel-body">
+ <div class="panel-body-content" id="ad-links-content">
+ <div id="ad-links-content-x">
+ <div id="ad-links-content-x-ps"></div>
+ <script>
+ acm.loadTextAd("#ad-links-content-x");
+ </script>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"></div>
+ </div>
+ </div>
+</div>
+
+
+<div id="aadBot300" class="panel panel-ad-mr">
+ <div class="panel-head-lt">
+ <div class="panel-head-rt">
+ <div class="panel-head"></div>
+ </div>
+ </div>
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div id="bottom-panel-body" class="panel-body">
+ <div id="bottom-panel-body-ps" ></div>
+ <script type="text/javascript">
+ acm.loadAd(aadTags, 'tile3', '#bottom-panel-body-ps', '250px');
+ </script>
+ </div>
+ </div>
+ </div>
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"> </div>
+ </div>
+ </div>
+</div>
+
+ </div>
+
+ <!-- /.column-2 -->
+
+
+
+<div id="offers" class="offers-extras">
+ <div class="panel">
+ <div class="panel-head-lt">
+ <div class="panel-head-rt">
+ <div class="panel-head"></div>
+ </div>
+ </div>
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div class="panel-body">
+ <div class="panel-body-content">
+ <a class="{type:'Image',label:'AccuWeather Premium'}" href="https://wwwl.accuweather.com/premium_login.php?&utm_source=adc&utm_medium=ExtraAd&utm_campaign=MoreWeather" target="_blank"><img src="http://vortex.accuweather.com/adc2010/images/features/en/extra_adc_premium.png" width="300" height="140" alt="AccuWeather Premium" /></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"></div>
+ </div>
+ </div>
+ </div>
+ <!-- /extra 1 -->
+ <div class="panel">
+ <div class="panel-head-lt">
+ <div class="panel-head-rt">
+ <div class="panel-head"></div>
+ </div>
+ </div>
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div class="panel-body">
+ <div class="panel-body-content">
+ <a class="{type:'Image',label:'Weather Data Portal'}" href="http://www.accuweatherglobal.com/default.php" target="_blank"><img src="http://vortex.accuweather.com/adc2004/pub/includes/columns/monthlyfeature/2013/300x140_08141931_ad_weather-data-portal_final.png" width="300" height="140" alt="Weather Data Portal" /></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"></div>
+ </div>
+ </div>
+ </div>
+ <!-- /extra 2 -->
+
+ <div class="panel scroll-panel">
+ <div class="panel-head-lt">
+ <div class="panel-head-rt">
+ <div class="panel-head"></div>
+ </div>
+ </div>
+ <div class="panel-body-lt">
+ <div class="panel-body-rt">
+ <div class="panel-body">
+ <div class="panel-body-content">
+ <h3></h3>
+ <ul class="scroll-area scrollbar">
+ <li><a class="{type:'Text',label:'AccuWeather Shines on U'}" href="http://getu.com/accuweather/?srl=1000668" target="_blank">AccuWeather Shines on U</a></li>
+ <li><a class="{type:'Text',label:'AccuWeather's Superior Accuracy'}" href="http://enterprisesolutions.accuweather.com/success-stories?utm_source=adc&utm_medium=ExtraAd&utm_content=accuweatheradvantage&utm_campaign=SuccessStories" target="_blank">AccuWeather's Superior Accuracy</a></li>
+ <li><a class="{type:'Text',label:'Free Weather For Your Site'}" href="http://www.accuweather.com/en/free-weather-widgets?utm_source=adc&utm_medium=ExtraAd&utm_campaign=FreeWidget" target="_blank">Free Weather For Your Site</a></li>
+ <li><a class="{type:'Text',label:'Forensic Weather'}" href="http://enterprisesolutions.accuweather.com/legal-forensics?utm_source=adc&utm_medium=ExtraAd&utm_campaign=forensics" target="_blank">Forensic Weather</a></li>
+ <li><a class="{type:'Text',label:'AccuWeather Premium'}" href="https://wwwl.accuweather.com/premium_login.php?&utm_source=adc&utm_medium=ExtraAd&utm_campaign=MoreWeather" target="_blank">AccuWeather Premium</a></li>
+ <li><a class="{type:'Text',label:'AccuWeather for iPad'}" href="http://itunes.apple.com/us/app/accu-weather-free-for-ipad/id364616869?mt=8" target="_blank">AccuWeather for iPad</a></li>
+ <li><a class="{type:'Text',label:'AccuWeather Professional'}" href="https://wwwl.accuweather.com/pro_login.php#&panel1-2?&utm_source=adc&utm_medium=ExtraAd&utm_campaign=Professional" target="_blank">AccuWeather Professional</a></li>
+ <li><a class="{type:'Text',label:'SkyGuard Warnings'}" href="http://enterprisesolutions.accuweather.com/skyguard?utm_source=adc&utm_medium=ExtraAd&utm_campaign=SkyGuard" target="_blank">SkyGuard Warnings</a></li>
+ <li><a class="{type:'Text',label:'AccuWeather for iPhone'}" href="http://itunes.apple.com/us/app/accuweather-for-iphone/id300048137?mt=8" target="_blank">AccuWeather for iPhone</a></li>
+ <li><a class="{type:'Text',label:'SkyGuard Online'}" href="http://enterprisesolutions.accuweather.com/skyguard-online?utm_source=adc&utm_medium=ExtraAd&utm_content=skyguardonline&utm_campaign=SkyGuard" target="_blank">SkyGuard Online</a></li>
+ <li><a class="{type:'Text',label:'SkyGuard Long-Range'}" href="http://enterprisesolutions.accuweather.com/forecasts?utm_source=adc&utm_medium=ExtraAd&utm_content=longrangeforecasts&utm_campaign=SkyGuard" target="_blank">SkyGuard Long-Range</a></li>
+ <li><a class="{type:'Text',label:'AccuWeather Toolbar'}" href="http://downloadmytoolbar.com/Accuweather/" target="_blank">AccuWeather Toolbar</a></li>
+ <li><a class="{type:'Text',label:'Weather Data Portal'}" href="http://www.accuweatherglobal.com/default.php" target="_blank">Weather Data Portal</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="panel-foot-lt">
+ <div class="panel-foot-rt">
+ <div class="panel-foot"></div>
+ </div>
+ </div>
+ </div>
+ <!-- /everything else -->
+</div>
+<script>
+ (function ($) {
+ $('#offers.offers-extras a').click(function () {
+ var l = $(this).metadata().label;
+ var t = $(this).metadata().type;
+ if (l && t) {
+ _gaq.push(['_trackEvent', 'AccuWeatherExtras2012', t, l]);
+ }
+ });
+ })(jQuery);
+</script>
+ </div>
+ <!-- /#content -->
+ </div>
+ <!-- /#wrap-content -->
+
+ <div id="footer">
+ <div id="footer-content-wrapper">
+ <div class="logo-ad">
+ <h5 class="logo">AccuWeather.com</h5>
+ <div id="footer-stevem">
+ <div id="footer-stevem-ps" ></div>
+ <script type="text/javascript">
+ acm.loadAd(aadTags, 'tile4', '#footer-stevem-ps', '90px');
+ </script>
+ </div>
+ </div>
+
+ <div id="custom-goog-search">
+ <style type="text/css">
+ @import url(http://www.google.com/cse/api/branding.css);
+ </style>
+ <div class="cse-branding-right" style="color:#000000">
+ <div class="cse-branding-form">
+ <form action="http://www.google.com" id="cse-search-box" target="_blank">
+ <div>
+ <input type="hidden" name="cx" value="partner-pub-5771594739411148:7839492073" />
+ <input type="hidden" name="ie" value="UTF-8" />
+ <input id="goog-cse-input" type="text" name="q" size="100" />
+ <input id="goog-cse-submit" type="submit" name="sa" value="" />
+ </div>
+ </form>
+ </div>
+ <div class="cse-branding-logo">
+ <img src="http://vortex.accuweather.com/adc2010/images/misc/googlelogo.png" alt="Google" />
+ </div>
+ <div class="cse-branding-text">
+ Custom Search
+ </div>
+ </div>
+
+ </div>
+ <div id="footer-nav-main" class="clearfix">
+ <div class="first">
+ <ul class="footer-nav-cols">
+ <li class="head">Company</li>
+ <li><a href="http://www.accuweather.com/en/about">About Us</a></li>
+ <li><a href="http://www.accuweather.com/media-kit">Advertise With Us</a></li>
+ <li><a href="http://www.accuweather.com/en/self-service-advertising">Self-Serve Advertising</a></li>
+ <li><a href="http://accuweathercareers.silkroad.com/" target="_blank">Careers</a></li>
+ <li><a href="http://www.accuweather.com/en/press">Press</a></li>
+
+ <li><a href="http://www.accuweather.com/en/contact">Contact Us</a></li>
+ </ul>
+ </div>
+ <div>
+ <ul class="footer-nav-cols">
+ <li class="head">Enterprise Solutions</li>
+ <li><a href="http://www.accuweather.com/adc2004/pub/products_services/media.asp" target="_blank">Media</a></li>
+ <li><a href="http://enterprisesolutions.accuweather.com/manufacturing" target="_blank">Manufacturing</a></li>
+ <li><a href="http://enterprisesolutions.accuweather.com/retail" target="_blank">Retail</a></li>
+ <li><a href="http://enterprisesolutions.accuweather.com/finance-banking" target="_blank">Finance & Banking</a></li>
+ <li><a href="http://enterprisesolutions.accuweather.com/energy" target="_blank">Energy</a></li>
+ <li><a href="http://enterprisesolutions.accuweather.com" target="_blank">All Enterprise Solutions</a></li>
+ </ul>
+ </div>
+ <div>
+ <ul class="footer-nav-cols">
+ <li class="head">Subscription Services</li>
+ <li><a href="https://wwwl.accuweather.com/premium_login.php" target="_blank">AccuWeather Premium</a></li>
+ <li><a href="https://wwwl.accuweather.com/pro_login.php" target="_blank">AccuWeather Professional</a></li>
+ <li><a href="http://radarplus.accuweather.com/" target="_blank">AccuWeather RadarPlus</a></li>
+ <li><a href="http://www.accuweather.com/adcbin/public/LightningPlus_Benefits.asp" target="_blank">Lightning Plus</a></li>
+ </ul>
+ </div>
+ <div class="last">
+ <ul class="footer-nav-cols">
+ <li class="head">Partners</li>
+ <li class="img"><a href="http://www.adci.com/html/worldmap/adc_worldmap_digital_atlas.php" target="_blank" class="adci-world-map"></a></li>
+ <!--<li><a href="" target="_blank">Mobium GPS / GeoMicro</a></li>-->
+ </ul>
+ </div>
+ </div>
+ <div id="footer-tm"> © 2014 AccuWeather, Inc. All Rights Reserved.<br />
+ AccuWeather.com is a registered trademark of AccuWeather, Inc.<br />
+ <a href="http://www.accuweather.com/en/legal">Terms of usage</a> under which this service is provided<br />
+ <a href="http://www.accuweather.com/en/privacy">Privacy Statement</a> | <a href="http://www.accuweather.com/en/privacy#adChoices">Ad Choices</a> </div>
+ <div id="footer-social">
+ <ul>
+ <li class="apps"><a href="http://www.accuweather.com/en/downloads">Apps & Downloads</a></li>
+ <li class="fb"><a href="http://www.facebook.com/AccuWeather" target="_blank">Like Us</a></li>
+ <li class="twt"><a href="http://twitter.com/BreakingWeather" target="_blank">Follow Us</a></li>
+ <li class="utube"><a href="http://www.youtube.com/accuweather" target="_blank">Watch Us</a></li>
+ </ul>
+ </div>
+ <!-- /#footer-info -->
+ </div>
+ <!-- /#footer-content-wrapper -->
+ </div>
+<!-- /#footer -->
+
+ <script>
+ if (acm && acm.isUsePostscribe() === false) {
+ // Only make this call if we are not using postscribe
+ // (otherwise the call was already made in PostScribe's done event)
+ if (typeof (aad_getCustomSponsors) == 'function') {
+ aadTags.tile1Done = true;
+ aadTags.tile2Done = true;
+ aadTags.tile3Done = true;
+ aadTags.tile4Done = true;
+ aad_getCustomSponsors(aadTags);
+ }
+ }
+ </script>
+ <script>
+ if (typeof (aadSponsoredLinksObj) != 'undefined' && aadSponsoredLinksObj.type == 'google' && aadSponsoredLinksObj.show_links == true) {
+ document.write('<scr' + 'ipt src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></scr' + 'ipt>');
+ } else if (typeof (aadSponsoredLinksObj) == 'undefined') {
+ jQuery('#ad-links').remove();
+ }
+ </script>
+<div id="tracking-pixels"></div>
+
+</div>
+<!-- /#wrap -->
+
+ <div class="vcard">
+ <span class="adr">
+ <span class="locality">
+ <span class="value-title" title="Shanghai" ></span>
+ </span>
+ <abbr class="region" title="Shanghai">
+ <span class="value-title" title="31" ></span>
+ </abbr>
+ <abbr class="country-name" title="China">
+ <span class="value-title" title="CN" ></span>
+ </abbr>
+ </span>
+ <span class="geo">
+ <span class="latitude">
+ <span class="value-title" title="31.23" ></span>
+ </span>
+ <span class="longitude">
+ <span class="value-title" title="121.44"></span>
+ </span>
+ </span>
+ </div>
+
+ <script type="text/javascript">
+ var _qoptions = { qacct: 'p-4b4gl_1fWISuU' };
+ if (typeof (apgPageInfoObj) != 'undefined' && apgPageInfoObj.crumb_trail) {
+ _qoptions.labels = apgPageInfoObj.crumb_trail.join('.');
+ }
+ </script>
+ <script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script>
+ <noscript>
+ <a href="http://www.quantcast.com/p-4b4gl_1fWISuU" target="_blank"><img src="http://pixel.quantserve.com/pixel/p-4b4gl_1fWISuU.gif" style="display: none" border="0" height="1" width="1" alt="Quantcast"/></a>
+ </noscript> <script type="text/javascript">
+ (function () {
+ var d = new Image(1, 1);
+ d.onerror = d.onload = function () {
+ d.onerror = d.onload = null;
+ };
+ d.src = ["//secure-us.imrworldwide.com/cgi-bin/m?ci=us-accuweather&cg=0&cc=1&si=", escape(window.location.href), "&rp=", escape(document.referrer), "&ts=compact&rnd=", (new Date()).getTime()].join('');
+ })();
+ </script>
+ <noscript>
+ <img style="display:none;" src="//secure-us.imrworldwide.com/cgi-bin/m?ci=us-accuweather&cg=0&cc=1&ts=noscript" width="1" height="1" alt="" />
+ </noscript>
+ <noscript>
+ <img src="http://b.scorecardresearch.com/p?c1=2&c2=6005068&cv=2.0&cj=1" />
+ </noscript>
+ <!-- Migraine/migraine -->
+
+
+</body>
+</html>
diff --git a/.conky/cronograph/accuweather/last_days b/.conky/cronograph/accuweather/last_days new file mode 100644 index 0000000..75a56d9 --- /dev/null +++ b/.conky/cronograph/accuweather/last_days @@ -0,0 +1,25 @@ +WED +12 +Showers around in the morning +25 +17 +THU +d +Mostly cloudy +26 +18 +FRI +b +Partly sunny +23 +15 +SAT +i +Cooler with rain +17 +16 +SUN +i +Periods of rain +21 +17 diff --git a/.conky/cronograph/accuweather/last_days_raw b/.conky/cronograph/accuweather/last_days_raw new file mode 100644 index 0000000..6ac7def --- /dev/null +++ b/.conky/cronograph/accuweather/last_days_raw @@ -0,0 +1,82 @@ +<div id="feed-tabs">
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577" class="arrow-left">Previous 5 Days<span></span></a>
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=11" class="arrow-right">Next 5 Days<span></span></a>
+
+ <ul>
+ <li class="day current first cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=6' }">
+ <div class="frame"></div>
+ <div class="bg bg-c">
+ <h3><a href="#">Wed</a></h3>
+ <h4>May 14</h4>
+ <div class="icon i-12-s "></div>
+ <div class="info">
+ <span class="cond">Showers around in the morning</span>
+ <strong class="temp">25<span>°</span></strong><span class="low"><span>Lo</span> 17<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=7' }">
+ <div class="frame"></div>
+ <div class="bg bg-c">
+ <h3><a href="#">Thu</a></h3>
+ <h4>May 15</h4>
+ <div class="icon i-6-s "></div>
+ <div class="info">
+ <span class="cond">Mostly cloudy</span>
+ <strong class="temp">26<span>°</span></strong><span class="low"><span>Lo</span> 18<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=7" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=8' }">
+ <div class="frame"></div>
+ <div class="bg bg-su">
+ <h3><a href="#">Fri</a></h3>
+ <h4>May 16</h4>
+ <div class="icon i-3-s "></div>
+ <div class="info">
+ <span class="cond">Partly sunny</span>
+ <strong class="temp">23<span>°</span></strong><span class="low"><span>Lo</span> 15<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=8" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=9' }">
+ <div class="frame"></div>
+ <div class="bg bg-r">
+ <h3><a href="#">Sat</a></h3>
+ <h4>May 17</h4>
+ <div class="icon i-18-s "></div>
+ <div class="info">
+ <span class="cond">Cooler with rain</span>
+ <strong class="temp">17<span>°</span></strong><span class="low"><span>Lo</span> 16<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=9" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv last cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=10' }">
+ <div class="frame"></div>
+ <div class="bg bg-r">
+ <h3><a href="#">Sun</a></h3>
+ <h4>May 18</h4>
+ <div class="icon i-18-s "></div>
+ <div class="info">
+ <span class="cond">Periods of rain</span>
+ <strong class="temp">21<span>°</span></strong><span class="low"><span>Lo</span> 17<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=10" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ </ul>
+</div>
+<!-- /.feed-tabs -->
diff --git a/.conky/cronograph/accuweather/tod_ton b/.conky/cronograph/accuweather/tod_ton new file mode 100644 index 0000000..a839d7e --- /dev/null +++ b/.conky/cronograph/accuweather/tod_ton @@ -0,0 +1,25 @@ +TONIGHT +h +Rain and drizzle late +- +17 +SAT +e +Cloudy and breezy +21 +18 +SUN +i +Humid with heavy rain +23 +16 +MON +a +Nice and warm with sunshine +26 +16 +TUE +d +Rather cloudy and warm +26 +17 diff --git a/.conky/cronograph/accuweather/tod_ton_raw b/.conky/cronograph/accuweather/tod_ton_raw new file mode 100644 index 0000000..2976b86 --- /dev/null +++ b/.conky/cronograph/accuweather/tod_ton_raw @@ -0,0 +1,81 @@ +<div id="feed-tabs">
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=6" class="arrow-right">Next 5 Days<span></span></a>
+
+ <ul>
+ <li class="night current first cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=1' }">
+ <div class="frame"></div>
+ <div class="bg bg-s">
+ <h3><a href="#">Tonight</a></h3>
+ <h4>May 9</h4>
+ <div class="icon i-12-s "></div>
+ <div class="info">
+ <span class="cond">Rain and drizzle late</span>
+ <span class="low" style="color:#ffffff;">Lo </span><strong class="temp">17<span>°</span></strong>
+ </div>
+ <!-- /.info -->
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=2' }">
+ <div class="frame"></div>
+ <div class="bg bg-c">
+ <h3><a href="#">Sat</a></h3>
+ <h4>May 10</h4>
+ <div class="icon i-7-s "></div>
+ <div class="info">
+ <span class="cond">Cloudy and breezy</span>
+ <strong class="temp">21<span>°</span></strong><span class="low"><span>Lo</span> 18<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=2" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=3' }">
+ <div class="frame"></div>
+ <div class="bg bg-r">
+ <h3><a href="#">Sun</a></h3>
+ <h4>May 11</h4>
+ <div class="icon i-18-s "></div>
+ <div class="info">
+ <span class="cond">Humid with heavy rain</span>
+ <strong class="temp">23<span>°</span></strong><span class="low"><span>Lo</span> 16<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=3" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=4' }">
+ <div class="frame"></div>
+ <div class="bg bg-su">
+ <h3><a href="#">Mon</a></h3>
+ <h4>May 12</h4>
+ <div class="icon i-1-s "></div>
+ <div class="info">
+ <span class="cond">Nice and warm with sunshine</span>
+ <strong class="temp">26<span>°</span></strong><span class="low"><span>Lo</span> 16<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=4" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ <li class="day hv last cl { href: 'http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=5' }">
+ <div class="frame"></div>
+ <div class="bg bg-c">
+ <h3><a href="#">Tue</a></h3>
+ <h4>May 13</h4>
+ <div class="icon i-6-s "></div>
+ <div class="info">
+ <span class="cond">Rather cloudy and warm</span>
+ <strong class="temp">26<span>°</span></strong><span class="low"><span>Lo</span> 17<span>°</span></span>
+ </div>
+ <!-- /.info -->
+ <a href="http://www.accuweather.com/en/cn/shanghai/106577/daily-weather-forecast/106577?day=5" class="bt-more">more</a>
+ </div>
+ <!-- /.bg -->
+ </li>
+ </ul>
+</div>
+<!-- /.feed-tabs -->
diff --git a/.conky/cronograph/conky_start.sh b/.conky/cronograph/conky_start.sh new file mode 100755 index 0000000..98dbb27 --- /dev/null +++ b/.conky/cronograph/conky_start.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +CONKYRC="$HOME/.conky/cronograph/conkyrc" + +sleep 5 + +conky -d -c ${CONKYRC} "$@" + +exit 0 + diff --git a/.conky/cronograph/conkyrc b/.conky/cronograph/conkyrc new file mode 100644 index 0000000..3a54030 --- /dev/null +++ b/.conky/cronograph/conkyrc @@ -0,0 +1,89 @@ +# — Conky settings — # + +background yes + +update_interval 1 +total_run_times 0 +net_avg_samples 2 + +override_utf8_locale yes + +double_buffer yes +no_buffers yes + +text_buffer_size 2048 +imlib_cache_size 0 + +temperature_unit celsius + +# — Window specifications — # + +own_window_class Conky +own_window yes +own_window_type desktop +own_window_transparent yes +own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager + +border_inner_margin 0 +border_outer_margin 0 + +minimum_size 300 330 +maximum_width 300 + +alignment top_right + +gap_x 30 +gap_y 75 + + +# — Graphics settings — # +draw_shades no +draw_outline no +draw_borders no +draw_graph_borders no + +# — Text settings — # +use_xft yes +xftfont hooge 05_53:size=6 +xftalpha 0.5 + +default_color FFFFFF + +uppercase no +use_spacer right + +color0 white +color1 orange +color2 green + +# — Lua Load — # + +lua_load $HOME/.conky/cronograph/scripts/clock_rings.lua +lua_draw_hook_pre clock_rings +lua_load $HOME/.conky/cronograph/scripts/multi_rings.lua +lua_draw_hook_post main + +TEXT +${execi 600 sh $HOME/.conky/cronograph/accuweather/accuweather.sh} +#${voffset 29}${offset 120}BAT: +${voffset 29}${goto 109}GENTOO${goto 157}Linux +${voffset 17}${goto 65}${font hooge 05_53:size=12}${time %H:%M}${font}${goto 185}UPTIME: +${voffset 2}${goto 65}${time %a %d %b}${goto 185}${uptime} +${voffset 2}${goto 65}${time %Y} +${voffset -6}${goto 145}HD +${voffset 12}${alignc}${fs_free}/${fs_size} +${voffset 36}${goto 91}${cpu cpu0}%${goto 221}${memperc}% +${voffset 10}${goto 76}CPU${goto 205}MEM +${voffset 16}${goto 82}${font hooge 05_53:size=12}${execpi 600 sed -n '4p' $HOME/.conky/cronograph/accuweather/curr_cond}°C${font}${voffset -30}${goto 125}${font ConkyWeather:size=40}${execpi 600 sed -n '2p' $HOME/.conky/cronograph/accuweather/curr_cond}${font}${voffset -16}${goto 185}${execpi 600 sed -n '3p' $HOME/.conky/cronograph/accuweather/curr_cond}${voffset 12}${goto 185}${font ConkyWeather:size=20}${voffset 1}${goto 80}${execpi 600 sed -n '7p' $HOME/.conky/cronograph/accuweather/tod_ton}${goto 135}${execpi 600 sed -n '12p' $HOME/.conky/cronograph/accuweather/tod_ton}${goto 185}${execpi 600 sed -n '17p' $HOME/.conky/cronograph/accuweather/tod_ton}${font}${voffset 6}${goto 84}${execpi 600 sed -n '9p' $HOME/.conky/cronograph/accuweather/tod_ton}°/${execpi 600 sed -n '10p' $HOME/.conky/cronograph/accuweather/tod_ton}°${goto 140}${execpi 600 sed -n '14p' $HOME/.conky/cronograph/accuweather/tod_ton}°/${execpi 600 sed -n '15p' $HOME/.conky/cronograph/accuweather/tod_ton}°${goto 190}${execpi 600 sed -n '19p' $HOME/.conky/cronograph/accuweather/tod_ton}°/${execpi 600 sed -n '20p' $HOME/.conky/cronograph/accuweather/tod_ton}°${voffset 7}${goto 85}${execpi 600 sed -n '6p' $HOME/.conky/cronograph/accuweather/tod_ton}${goto 140}${execpi 600 sed -n '11p' $HOME/.conky/cronograph/accuweather/tod_ton}${goto 190}${execpi 600 sed -n '16p' $HOME/.conky/cronograph/accuweather/tod_ton} +${if_match ${battery_percent BAT0}>0}${if_match ${battery_percent BAT0}<=15}${image $HOME/.conky/cronograph/images/Red.png -p 129,18 -s 40x40}${endif}${endif} +${if_match ${battery_percent BAT0}>15}${if_match ${battery_percent BAT0}<=20}${image $HOME/.conky/cronograph/images/Orange.png -p 129,18 -s 40x40}${endif}${endif} +${if_match ${battery_percent BAT0}>20}${if_match ${battery_percent BAT0}<=35}${image $HOME/.conky/cronograph/images/Yellow.png -p 129,18 -s 40x40}${endif}${endif} +${if_match ${battery_percent BAT0}>35}${if_match ${battery_percent BAT0}<=100}${image $HOME/.conky/cronograph/images/Dark_Green.png -p 129,18 -s 40x40}${endif}${endif} +${execpi 30 cat $HOME/.conky/cronograph/scripts/blinkingLED} +## mpd ## +${if_mpd_playing}${voffset 6}${goto 10}${font Sans:size=8:bold}${mpd_artist}${font}${voffset -5}${font Sans:size=8} - ${mpd_title}${font} +${voffset 4}${goto 10}${mpd_bar 5,220}${alignr 10}${mpd_elapsed}/${mpd_length} +${else}${voffset 6}${goto 10}${font hooge 05_53:size=8}MPD: stopped${font} +${endif} + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=conkyrc: # diff --git a/.conky/cronograph/images/Blank.png b/.conky/cronograph/images/Blank.png Binary files differnew file mode 100644 index 0000000..a8adf65 --- /dev/null +++ b/.conky/cronograph/images/Blank.png diff --git a/.conky/cronograph/images/Blue.png b/.conky/cronograph/images/Blue.png Binary files differnew file mode 100644 index 0000000..2407cbe --- /dev/null +++ b/.conky/cronograph/images/Blue.png diff --git a/.conky/cronograph/images/Dark_Green.png b/.conky/cronograph/images/Dark_Green.png Binary files differnew file mode 100644 index 0000000..d40bcc4 --- /dev/null +++ b/.conky/cronograph/images/Dark_Green.png diff --git a/.conky/cronograph/images/Dark_Purple.png b/.conky/cronograph/images/Dark_Purple.png Binary files differnew file mode 100644 index 0000000..bb5da19 --- /dev/null +++ b/.conky/cronograph/images/Dark_Purple.png diff --git a/.conky/cronograph/images/Green.png b/.conky/cronograph/images/Green.png Binary files differnew file mode 100644 index 0000000..602ad43 --- /dev/null +++ b/.conky/cronograph/images/Green.png diff --git a/.conky/cronograph/images/Orange.png b/.conky/cronograph/images/Orange.png Binary files differnew file mode 100644 index 0000000..7574f9c --- /dev/null +++ b/.conky/cronograph/images/Orange.png diff --git a/.conky/cronograph/images/Pink.png b/.conky/cronograph/images/Pink.png Binary files differnew file mode 100644 index 0000000..6d2d973 --- /dev/null +++ b/.conky/cronograph/images/Pink.png diff --git a/.conky/cronograph/images/Purple.png b/.conky/cronograph/images/Purple.png Binary files differnew file mode 100644 index 0000000..e8c58e7 --- /dev/null +++ b/.conky/cronograph/images/Purple.png diff --git a/.conky/cronograph/images/Red.png b/.conky/cronograph/images/Red.png Binary files differnew file mode 100644 index 0000000..d2673e6 --- /dev/null +++ b/.conky/cronograph/images/Red.png diff --git a/.conky/cronograph/images/Yellow.png b/.conky/cronograph/images/Yellow.png Binary files differnew file mode 100644 index 0000000..8e2f62c --- /dev/null +++ b/.conky/cronograph/images/Yellow.png diff --git a/.conky/cronograph/scripts/blinkingLED b/.conky/cronograph/scripts/blinkingLED new file mode 100755 index 0000000..3f4c814 --- /dev/null +++ b/.conky/cronograph/scripts/blinkingLED @@ -0,0 +1,3 @@ +${image $HOME/.conky/cronograph/images/Blank.png -p 129, 241 -s 40x40}${if_match ${execi 1 num=$(date +%-S);rem=$(( num % 2 ));if [ $rem -eq 0 ] ; then echo 0 ; else echo 1 ; fi}==0}${image $HOME/.conky/cronograph/images/Blue.png -p 129, 241 -s 40x40}${endif} +${image $HOME/.conky/cronograph/images/Blank.png -p 19, 129 -s 40x40}${if_match ${execi 1 num=$(date +%-S);rem=$(( num % 2 ));if [ $rem -eq 0 ] ; then echo 0 ; else echo 1 ; fi}==0}${image $HOME/.conky/cronograph/images/Blue.png -p 19, 129 -s 40x40}${endif} +${image $HOME/.conky/cronograph/images/Blank.png -p 240, 129 -s 40x40}${if_match ${execi 1 num=$(date +%-S);rem=$(( num % 2 ));if [ $rem -eq 0 ] ; then echo 0 ; else echo 1 ; fi}==0}${image $HOME/.conky/cronograph/images/Blue.png -p 240, 129 -s 40x40}${endif} diff --git a/.conky/cronograph/scripts/clock_rings.lua b/.conky/cronograph/scripts/clock_rings.lua new file mode 100755 index 0000000..fb6a838 --- /dev/null +++ b/.conky/cronograph/scripts/clock_rings.lua @@ -0,0 +1,358 @@ +--[[ +Clock Rings by londonali1010 (2009) + +This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script. + +IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement near the end of the script uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error. + +To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua): + lua_load ~/scripts/clock_rings-v1.1.1.lua + lua_draw_hook_pre clock_rings + +Changelog: ++ v1.1.1 -- Fixed minor bug that caused the script to crash if conky_parse() returns a nil value (20.10.2009) ++ v1.1 -- Added colour option for clock hands (07.10.2009) ++ v1.0 -- Original release (30.09.2009) +]] + +settings_table = { + { + -- Edit this table to customise your rings. + -- You can create more rings simply by adding more elements to settings_table. + -- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'. + name='time', + -- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''. + arg='%I.%M', + -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100. + max=12, + -- "bg_colour" is the colour of the base ring. + bg_colour=0xFFFFFF, + -- "bg_alpha" is the alpha value of the base ring. + bg_alpha=0.1, + -- "fg_colour" is the colour of the indicator part of the ring. + fg_colour=0xFFFFFF, + -- "fg_alpha" is the alpha value of the indicator part of the ring. + fg_alpha=0.5, + -- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window. + x=150, y=150, + -- "radius" is the radius of the ring. + radius=135, + -- "thickness" is the thickness of the ring, centred around the radius. + thickness=4, + -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative. + start_angle=0, + -- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle. + end_angle=360 + }, + { + name='time', + arg='%M.%S', + max=60, + bg_colour=0xFFFFFF, + bg_alpha=0.1, + fg_colour=0xFFFFFF, + fg_alpha=0.5, + x=150, y=150, + radius=140, + thickness=4, + start_angle=0, + end_angle=360 + }, + { + name='time', + arg='%S', + max=60, + bg_colour=0xFFFFFF, + bg_alpha=0.1, + fg_colour=0xFFFFFF, + fg_alpha=0.5, + x=150, y=150, + radius=145, + thickness=4, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0x000000, + bg_alpha=0.1, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=150, y=150, + radius=66, + thickness=130, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0xFFFFFF, + bg_alpha=1.0, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=150, y=150, + radius=1, + thickness=10, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0xFFFFFF, + bg_alpha=1.0, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=85, y=150, + radius=30, + thickness=1, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0x000000, + bg_alpha=0.3, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=85, y=150, + radius=15, + thickness=27, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0xFFFFFF, + bg_alpha=1.0, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=85, y=150, + radius=1, + thickness=2, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0xFFFFFF, + bg_alpha=1.0, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=215, y=150, + radius=30, + thickness=1, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0x000000, + bg_alpha=0.3, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=215, y=150, + radius=15, + thickness=27, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0xFFFFFF, + bg_alpha=1.0, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=215, y=150, + radius=1, + thickness=2, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0xFFFFFF, + bg_alpha=1.0, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=150, y=75, + radius=25, + thickness=1, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0x000000, + bg_alpha=0.3, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=150, y=75, + radius=13, + thickness=22, + start_angle=0, + end_angle=360 + }, + { + name='', + arg='', + max=100, + bg_colour=0xFFFFFF, + bg_alpha=1.0, + fg_colour=0xFFFFFF, + fg_alpha=0.0, + x=150, y=75, + radius=1, + thickness=2, + start_angle=0, + end_angle=360 + }, + } + +-- Use these settings to define the origin and extent of your clock. + +clock_r=127 + +-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window. + +clock_x=150 +clock_y=150 + +-- Colour & alpha of the clock hands + +clock_colour=0xFFFFFF +clock_alpha=1 + +-- Do you want to show the seconds hand? + +show_seconds=true + +require 'cairo' + +function rgb_to_r_g_b(colour,alpha) + return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha +end + +function draw_ring(cr,t,pt) + local w,h=conky_window.width,conky_window.height + + local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle'] + local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha'] + + local angle_0=sa*(2*math.pi/360)-math.pi/2 + local angle_f=ea*(2*math.pi/360)-math.pi/2 + local t_arc=t*(angle_f-angle_0) + + -- Draw background ring + + cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f) + cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga)) + cairo_set_line_width(cr,ring_w) + cairo_stroke(cr) + + -- Draw indicator ring + + cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc) + cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga)) + cairo_stroke(cr) +end + +function draw_clock_hands(cr,xc,yc) + local secs,mins,hours,secs_arc,mins_arc,hours_arc + local xh,yh,xm,ym,xs,ys + + secs=os.date("%S") + mins=os.date("%M") + hours=os.date("%I") + + secs_arc=(2*math.pi/60)*secs + mins_arc=(2*math.pi/60)*mins+secs_arc/60 + hours_arc=(2*math.pi/12)*hours+mins_arc/12 + + -- Draw hour hand + + xh=xc+0.7*clock_r*math.sin(hours_arc) + yh=yc-0.7*clock_r*math.cos(hours_arc) + cairo_move_to(cr,xc,yc) + cairo_line_to(cr,xh,yh) + + cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND) + cairo_set_line_width(cr,5) + cairo_set_source_rgba(cr,rgb_to_r_g_b(clock_colour,clock_alpha)) + cairo_stroke(cr) + + -- Draw minute hand + + xm=xc+clock_r*math.sin(mins_arc) + ym=yc-clock_r*math.cos(mins_arc) + cairo_move_to(cr,xc,yc) + cairo_line_to(cr,xm,ym) + + cairo_set_line_width(cr,3) + cairo_stroke(cr) + + -- Draw seconds hand + + if show_seconds then + xs=xc+clock_r*math.sin(secs_arc) + ys=yc-clock_r*math.cos(secs_arc) + cairo_move_to(cr,xc,yc) + cairo_line_to(cr,xs,ys) + + cairo_set_line_width(cr,1) + cairo_stroke(cr) + end +end + +function conky_clock_rings() + local function setup_rings(cr,pt) + local str='' + local value=0 + + str=string.format('${%s %s}',pt['name'],pt['arg']) + str=conky_parse(str) + + value=tonumber(str) + if value == nil then value = 0 end + pct=value/pt['max'] + + draw_ring(cr,pct,pt) + end + + -- Check that Conky has been running for at least 5s + + if conky_window==nil then return end + local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height) + + local cr=cairo_create(cs) + + local updates=conky_parse('${updates}') + update_num=tonumber(updates) + + if update_num>5 then + for i in pairs(settings_table) do + setup_rings(cr,settings_table[i]) + end + end + + draw_clock_hands(cr,clock_x,clock_y) +end diff --git a/.conky/cronograph/scripts/multi_rings.lua b/.conky/cronograph/scripts/multi_rings.lua new file mode 100755 index 0000000..b9735b2 --- /dev/null +++ b/.conky/cronograph/scripts/multi_rings.lua @@ -0,0 +1,375 @@ +--============================================================================== +-- multi_rings.lua +-- +-- author : SLK +-- version : v2011011601 +-- license : Distributed under the terms of GNU GPL version 2 or later +-- +--============================================================================== + +require 'cairo' + +-------------------------------------------------------------------------------- +-- clock DATA +-- HOURS +clock_h = { + { + name='time', arg='%H', max_value=12, + x=150, y=150, + graph_radius=140, + graph_thickness=3, + graph_unit_angle=30, graph_unit_thickness=5, + graph_bg_colour=0xffffff, graph_bg_alpha=0.0, + graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.0, + txt_radius=100, + txt_weight=1, txt_size=10.0, + txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.0, + graduation_radius=125, + graduation_thickness=10, graduation_mark_thickness=2, + graduation_unit_angle=30, + graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1.0, + }, +} +-- MINUTES +clock_m = { + { + name='time', arg='%M', max_value=60, + x=150, y=150, + graph_radius=100, + graph_thickness=3, + graph_unit_angle=6, graph_unit_thickness=3, + graph_bg_colour=0xffffff, graph_bg_alpha=0.0, + graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.0, + txt_radius=100, + txt_weight=0, txt_size=9.0, + txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.0, + graduation_radius=57, + graduation_thickness=0, graduation_mark_thickness=2, + graduation_unit_angle=30, + graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0, + }, +} +-- SECONDS +clock_s = { + { + name='time', arg='%S', max_value=60, + x=150, y=150, + graph_radius=50, + graph_thickness=3, + graph_unit_angle=6, graph_unit_thickness=3, + graph_bg_colour=0xffffff, graph_bg_alpha=0.0, + graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.0, + txt_radius=100, + txt_weight=0, txt_size=12.0, + txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.0, + graduation_radius=0, + graduation_thickness=0, graduation_mark_thickness=0, + graduation_unit_angle=0, + graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0, + }, +} + +-------------------------------------------------------------------------------- +-- gauge DATA +gauge = { +{ + name='cpu', arg='cpu0', max_value=100, + x=85, y=150, + graph_radius=14, + graph_thickness=27, + graph_start_angle=0, + graph_unit_angle=3.5, graph_unit_thickness=3.0, + graph_bg_colour=0xFFFFFF, graph_bg_alpha=0.0, + graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.0, + hand_fg_colour=0xFFFFFF, hand_fg_alpha=1.0, + txt_radius=1, + txt_weight=0, txt_size=8.0, + txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.0, + graduation_radius=27, + graduation_thickness=4, graduation_mark_thickness=4, + graduation_unit_angle=30, + graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1.0, + caption='', + caption_weight=1, caption_size=8.0, + caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.0, +}, +{ + name='memperc', arg='', max_value=100, + x=215, y=150, + graph_radius=14, + graph_thickness=27, + graph_start_angle=0, + graph_unit_angle=3.5, graph_unit_thickness=3.0, + graph_bg_colour=0xFFFFFF, graph_bg_alpha=0.0, + graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.0, + hand_fg_colour=0xFFFFFF, hand_fg_alpha=1.0, + txt_radius=1, + txt_weight=0, txt_size=8.0, + txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.0, + graduation_radius=27, + graduation_thickness=4, graduation_mark_thickness=4, + graduation_unit_angle=30, + graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1.0, + caption='', + caption_weight=1, caption_size=8.0, + caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.0, +}, +{ + name='fs_used_perc', arg='/', max_value=100, + x=150, y=75, + graph_radius=10, + graph_thickness=23, + graph_start_angle=0, + graph_unit_angle=3.5, graph_unit_thickness=3.0, + graph_bg_colour=0xFFFFFF, graph_bg_alpha=0.0, + graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.0, + hand_fg_colour=0xFFFFFF, hand_fg_alpha=1.0, + txt_radius=1, + txt_weight=0, txt_size=8.0, + txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.0, + graduation_radius=22, + graduation_thickness=4, graduation_mark_thickness=4, + graduation_unit_angle=30, + graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1.0, + caption='', + caption_weight=1, caption_size=8.0, + caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.0, +}, +} + +------------------------------------------------------------------------------- +-- rgb_to_r_g_b +-- converts color in hexa to decimal +-- +function rgb_to_r_g_b(colour, alpha) + return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha +end + +------------------------------------------------------------------------------- +-- angle_to_position +-- convert degree to rad and rotate (0 degree is top/north) +-- +function angle_to_position(start_angle, current_angle) + local pos = current_angle + start_angle + return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) ) +end + +------------------------------------------------------------------------------- +-- draw_clock_ring +-- displays clock +-- +function draw_clock_ring(display, data, value) + local max_value = data['max_value'] + local x, y = data['x'], data['y'] + local graph_radius = data['graph_radius'] + local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness'] + local graph_unit_angle = data['graph_unit_angle'] + local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha'] + local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha'] + + -- background ring + cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi) + cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha)) + cairo_set_line_width(display, graph_thickness) + cairo_stroke(display) + + -- arc of value + local val = (value % max_value) + local i = 1 + while i <= val do + cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2)) + cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha)) + cairo_stroke(display) + i = i + 1 + end + local angle = (graph_unit_angle * i) - graph_unit_thickness + + -- graduations marks + local graduation_radius = data['graduation_radius'] + local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness'] + local graduation_unit_angle = data['graduation_unit_angle'] + local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha'] + if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then + local nb_graduation = 360 / graduation_unit_angle + local i = 1 + while i <= nb_graduation do + cairo_set_line_width(display, graduation_thickness) + cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2)) + cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha)) + cairo_stroke(display) + cairo_set_line_width(display, graph_thickness) + i = i + 1 + end + end + + -- text + local txt_radius = data['txt_radius'] + local txt_weight, txt_size = data['txt_weight'], data['txt_size'] + local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha'] + local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2))) + local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2))) + cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight); + cairo_set_font_size (display, txt_size); + cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha)); + cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3); + cairo_show_text (display, value); + cairo_stroke (display); +end + +------------------------------------------------------------------------------- +-- draw_gauge_ring +-- displays gauges +-- +function draw_gauge_ring(display, data, value) + local max_value = data['max_value'] + local x, y = data['x'], data['y'] + local graph_radius = data['graph_radius'] + local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness'] + local graph_start_angle = data['graph_start_angle'] + local graph_unit_angle = data['graph_unit_angle'] + local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha'] + local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha'] + local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha'] + local graph_end_angle = (max_value * graph_unit_angle) % 360 + + -- background ring + cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle)) + cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha)) + cairo_set_line_width(display, graph_thickness) + cairo_stroke(display) + + -- arc of value + local val = value % (max_value + 1) + local start_arc = 0 + local stop_arc = 0 + local i = 1 + while i <= val do + start_arc = (graph_unit_angle * i) - graph_unit_thickness + stop_arc = (graph_unit_angle * i) + cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc)) + cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha)) + cairo_stroke(display) + i = i + 1 + end + local angle = start_arc + + -- hand + start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2) + stop_arc = (graph_unit_angle * val) + cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc)) + cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha)) + cairo_stroke(display) + + -- graduations marks + local graduation_radius = data['graduation_radius'] + local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness'] + local graduation_unit_angle = data['graduation_unit_angle'] + local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha'] + if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then + local nb_graduation = graph_end_angle / graduation_unit_angle + local i = 0 + while i < nb_graduation do + cairo_set_line_width(display, graduation_thickness) + start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2) + stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2) + cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc)) + cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha)) + cairo_stroke(display) + cairo_set_line_width(display, graph_thickness) + i = i + 1 + end + end + + -- text + local txt_radius = data['txt_radius'] + local txt_weight, txt_size = data['txt_weight'], data['txt_size'] + local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha'] + local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle)) + local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle)) + cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight) + cairo_set_font_size (display, txt_size) + cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha)) + cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3) + cairo_show_text (display, value) + cairo_stroke (display) + + -- caption + local caption = data['caption'] + local caption_weight, caption_size = data['caption_weight'], data['caption_size'] + local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha'] + local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2))) + local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2))) + cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight); + cairo_set_font_size (display, caption_size) + cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha)) + cairo_move_to (display, x + tox + 5, y + toy + 1) + -- bad hack but not enough time ! + if graph_start_angle < 105 then + cairo_move_to (display, x + tox - 30, y + toy + 1) + end + cairo_show_text (display, caption) + cairo_stroke (display) +end + +------------------------------------------------------------------------------- +-- go_clock_rings +-- loads data and displays clock +-- +function go_clock_rings(display) + local function load_clock_rings(display, data) + local str, value = '', 0 + str = string.format('${%s %s}',data['name'], data['arg']) + str = conky_parse(str) + value = tonumber(str) + draw_clock_ring(display, data, value) + end + + for i in pairs(clock_h) do + load_clock_rings(display, clock_h[i]) + end + for i in pairs(clock_m) do + load_clock_rings(display, clock_m[i]) + end + for i in pairs(clock_s) do + load_clock_rings(display, clock_s[i]) + end +end + +------------------------------------------------------------------------------- +-- go_gauge_rings +-- loads data and displays gauges +-- +function go_gauge_rings(display) + local function load_gauge_rings(display, data) + local str, value = '', 0 + str = string.format('${%s %s}',data['name'], data['arg']) + str = conky_parse(str) + value = tonumber(str) + draw_gauge_ring(display, data, value) + end + + for i in pairs(gauge) do + load_gauge_rings(display, gauge[i]) + end +end + +------------------------------------------------------------------------------- +-- MAIN +function conky_main() + if conky_window == nil then + return + end + + local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height) + local display = cairo_create(cs) + + local updates = conky_parse('${updates}') + update_num = tonumber(updates) + + if update_num > 5 then + go_clock_rings(display) + go_gauge_rings(display) + end + +end + diff --git a/.conkyrc b/.conkyrc new file mode 100644 index 0000000..3a54030 --- /dev/null +++ b/.conkyrc @@ -0,0 +1,89 @@ +# — Conky settings — # + +background yes + +update_interval 1 +total_run_times 0 +net_avg_samples 2 + +override_utf8_locale yes + +double_buffer yes +no_buffers yes + +text_buffer_size 2048 +imlib_cache_size 0 + +temperature_unit celsius + +# — Window specifications — # + +own_window_class Conky +own_window yes +own_window_type desktop +own_window_transparent yes +own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager + +border_inner_margin 0 +border_outer_margin 0 + +minimum_size 300 330 +maximum_width 300 + +alignment top_right + +gap_x 30 +gap_y 75 + + +# — Graphics settings — # +draw_shades no +draw_outline no +draw_borders no +draw_graph_borders no + +# — Text settings — # +use_xft yes +xftfont hooge 05_53:size=6 +xftalpha 0.5 + +default_color FFFFFF + +uppercase no +use_spacer right + +color0 white +color1 orange +color2 green + +# — Lua Load — # + +lua_load $HOME/.conky/cronograph/scripts/clock_rings.lua +lua_draw_hook_pre clock_rings +lua_load $HOME/.conky/cronograph/scripts/multi_rings.lua +lua_draw_hook_post main + +TEXT +${execi 600 sh $HOME/.conky/cronograph/accuweather/accuweather.sh} +#${voffset 29}${offset 120}BAT: +${voffset 29}${goto 109}GENTOO${goto 157}Linux +${voffset 17}${goto 65}${font hooge 05_53:size=12}${time %H:%M}${font}${goto 185}UPTIME: +${voffset 2}${goto 65}${time %a %d %b}${goto 185}${uptime} +${voffset 2}${goto 65}${time %Y} +${voffset -6}${goto 145}HD +${voffset 12}${alignc}${fs_free}/${fs_size} +${voffset 36}${goto 91}${cpu cpu0}%${goto 221}${memperc}% +${voffset 10}${goto 76}CPU${goto 205}MEM +${voffset 16}${goto 82}${font hooge 05_53:size=12}${execpi 600 sed -n '4p' $HOME/.conky/cronograph/accuweather/curr_cond}°C${font}${voffset -30}${goto 125}${font ConkyWeather:size=40}${execpi 600 sed -n '2p' $HOME/.conky/cronograph/accuweather/curr_cond}${font}${voffset -16}${goto 185}${execpi 600 sed -n '3p' $HOME/.conky/cronograph/accuweather/curr_cond}${voffset 12}${goto 185}${font ConkyWeather:size=20}${voffset 1}${goto 80}${execpi 600 sed -n '7p' $HOME/.conky/cronograph/accuweather/tod_ton}${goto 135}${execpi 600 sed -n '12p' $HOME/.conky/cronograph/accuweather/tod_ton}${goto 185}${execpi 600 sed -n '17p' $HOME/.conky/cronograph/accuweather/tod_ton}${font}${voffset 6}${goto 84}${execpi 600 sed -n '9p' $HOME/.conky/cronograph/accuweather/tod_ton}°/${execpi 600 sed -n '10p' $HOME/.conky/cronograph/accuweather/tod_ton}°${goto 140}${execpi 600 sed -n '14p' $HOME/.conky/cronograph/accuweather/tod_ton}°/${execpi 600 sed -n '15p' $HOME/.conky/cronograph/accuweather/tod_ton}°${goto 190}${execpi 600 sed -n '19p' $HOME/.conky/cronograph/accuweather/tod_ton}°/${execpi 600 sed -n '20p' $HOME/.conky/cronograph/accuweather/tod_ton}°${voffset 7}${goto 85}${execpi 600 sed -n '6p' $HOME/.conky/cronograph/accuweather/tod_ton}${goto 140}${execpi 600 sed -n '11p' $HOME/.conky/cronograph/accuweather/tod_ton}${goto 190}${execpi 600 sed -n '16p' $HOME/.conky/cronograph/accuweather/tod_ton} +${if_match ${battery_percent BAT0}>0}${if_match ${battery_percent BAT0}<=15}${image $HOME/.conky/cronograph/images/Red.png -p 129,18 -s 40x40}${endif}${endif} +${if_match ${battery_percent BAT0}>15}${if_match ${battery_percent BAT0}<=20}${image $HOME/.conky/cronograph/images/Orange.png -p 129,18 -s 40x40}${endif}${endif} +${if_match ${battery_percent BAT0}>20}${if_match ${battery_percent BAT0}<=35}${image $HOME/.conky/cronograph/images/Yellow.png -p 129,18 -s 40x40}${endif}${endif} +${if_match ${battery_percent BAT0}>35}${if_match ${battery_percent BAT0}<=100}${image $HOME/.conky/cronograph/images/Dark_Green.png -p 129,18 -s 40x40}${endif}${endif} +${execpi 30 cat $HOME/.conky/cronograph/scripts/blinkingLED} +## mpd ## +${if_mpd_playing}${voffset 6}${goto 10}${font Sans:size=8:bold}${mpd_artist}${font}${voffset -5}${font Sans:size=8} - ${mpd_title}${font} +${voffset 4}${goto 10}${mpd_bar 5,220}${alignr 10}${mpd_elapsed}/${mpd_length} +${else}${voffset 6}${goto 10}${font hooge 05_53:size=8}MPD: stopped${font} +${endif} + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=conkyrc: # diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..2ca776e --- /dev/null +++ b/.gitconfig @@ -0,0 +1,5 @@ +[user] + name = Weitian LI + email = liweitianux@gmail.com +[push] + default = simple diff --git a/.gtk-bookmarks b/.gtk-bookmarks new file mode 100644 index 0000000..8af8f6f --- /dev/null +++ b/.gtk-bookmarks @@ -0,0 +1,5 @@ +file:///home/aly/Documents +file:///home/aly/Music +file:///home/aly/Pictures +file:///home/aly/Videos +file:///home/aly/Downloads diff --git a/.gtkrc-2.0 b/.gtkrc-2.0 new file mode 100644 index 0000000..dc786c3 --- /dev/null +++ b/.gtkrc-2.0 @@ -0,0 +1,8 @@ +## +## ~/.gtkrc-2.0 +## + +## NOTE: cannot use `~' and `$HOME' here + +include "/home/aly/.gtkrc.mine" + diff --git a/.gtkrc.mine b/.gtkrc.mine new file mode 100644 index 0000000..7652fa4 --- /dev/null +++ b/.gtkrc.mine @@ -0,0 +1,25 @@ +## +## ~/.gtkrc.mine +## + +## font +gtk-font-name = "Sans 10" + +## theme +#gtk-theme-name = "Clearlooks" +#gtk-theme-name = "FlatStudioLight" +#gtk-theme-name = "FlatStudioGray" +gtk-theme-name = "FlatStudioDark" + +## icon +#gtk-icon-theme-name = "AwOken" +gtk-icon-theme-name = "AwOkenWhite" +#gtk-icon-theme-name = "AwOkenDark" + +## toolbar +# GTK_TOOLBAR_ICONS: only icons +# GTK_TOOLBAR_TEXT: only text +# GTK_TOOLBAR_BOTH: both icon and text +# GTK_TOOLBAR_BOTH_HORIZ: icon and text next to the icon +gtk-toolbar-style = GTK_TOOLBAR_ICONS + diff --git a/.i3/config b/.i3/config new file mode 100644 index 0000000..3388538 --- /dev/null +++ b/.i3/config @@ -0,0 +1,362 @@ +########################################################### +## ~/.i3/config +## +## i3 config file (v4) +## Ref: http://i3wm.org/docs/userguide.html +## +## Weitian LI <liweitianux@gmail.com> +## 2014/05/10 +########################################################### + +###### NOTES ###### {{{ +# To get a config file with the same key positions, but for your current +# layout, use the `i3-config-wizard' +###### NOTES ###### }}} + +###### variables ###### {{{ +## modifier +# Mod1: Alt +# Mod4: Win +set $mod Mod1 +set $sup Mod4 + +# variables used in this config +set $i3_scripts ~/.i3/scripts +set $i3_images ~/.i3/images + +# screenshots directory +set $shots_dir ~/pictures/screenshots +###### variables ###### }}} + +###### settings ###### {{{ +# Font for window titles. (also for bar if not specified) +# ISO 10646: Unicode +# Use pango to choose FreeType fonts +#font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +#font pango:DejaVu Sans Mono 10 +font pango:Terminus, WenQuanYi Bitmap Song, Icons, FontAwesome, 10 + +# use `Mouse+$mod' to drag floating windows +floating_modifier $mod + +# focus follows mouse (default yes) +#focus_follows_mouse no + +# timeout of urgency hint on workspace change (default 500ms) +force_display_urgency_hint 1000 ms + +# ipc (`i3-msg' to run i3 commands) +ipc-socket ~/.i3/i3-ipc.sock +###### settings ###### }}} + +###### appearance ###### {{{ +# border style +#new_window 1pixel +bindsym $mod+t border normal +bindsym $mod+y border 1pixel +bindsym $mod+u border none + +# orientation for new workspaces +default_orientation auto + +# hide vertical borders adjacent to the screen edge +#hide_edge_borders vertical + +### colors +## solarized colorscheme (customized) {{{ +client.background #1e2320 +# colorclass border background text indicator +client.focused #859900 #859900 #fdf6e3 #2e9ef4 +client.focused_inactive #268bd2 #268bd2 #fdf6e3 #484e50 +client.unfocused #93a1a1 #93a1a1 #fdf6e3 #292d2e +client.urgent #cb4b16 #cb4b16 #fdf6e3 #2e9ef4 +## colorscheme }}} +# +###### appearance ###### }}} + +###### workspace ###### {{{ +# name workspace +set $ws1 1gentoo +set $ws2 2term +set $ws3 3vim +set $ws4 4web +set $ws5 5work +set $ws6 6media +set $ws7 7game +set $ws8 8sys +set $ws9 9misc +set $ws0 0float + +# switch to workspace +bindsym $mod+1 workspace $ws1 +bindsym $mod+2 workspace $ws2 +bindsym $mod+3 workspace $ws3 +bindsym $mod+4 workspace $ws4 +bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 +bindsym $mod+7 workspace $ws7 +bindsym $mod+8 workspace $ws8 +bindsym $mod+9 workspace $ws9 +bindsym $mod+0 workspace $ws0 +# auto back-and-forth when switched to the current workspace +workspace_auto_back_and_forth yes + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8 +bindsym $mod+Shift+9 move container to workspace $ws9 +bindsym $mod+Shift+0 move container to workspace $ws0 +# move to provided workspace +bindsym $mod+Shift+m exec i3-input -F 'move container to workspace "%s"' -P 'move to workspace: ' + +# assign workspace for applications +assign [class="Gvim"] $ws3 +assign [class="Firefox" instance="Navigator"] $ws4 +assign [class="Vlc"] $ws6 + +# switch workspace +bindsym $mod+Tab workspace back_and_forth +bindsym $mod+Ctrl+Left workspace prev +bindsym $mod+Ctrl+Right workspace next +# also bind ThinkPad 'XF86Back' and 'XF86Forward' keys +#bindsym XF86Back workspace prev +#bindsym XF86Forward workspace next +###### workspace ###### }}} + +###### key bindings ###### {{{ +# start a terminal +bindsym $mod+Return exec urxvtc || i3-sensible-terminal + +# kill focused window +bindsym $mod+Shift+q kill +bindsym $mod+F4 kill + +# change focus (h/j/k/l) +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window (h/j/k/l) +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+Shift+v split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +bindsym $mod+c focus child + +## scratchpad +# move the currently focused window to the scratchpad +bindsym $mod+Shift+minus move scratchpad +# Show the next scratchpad window or hide the focused scratchpad window. +# If there are multiple scratchpad windows, this command cycles through them. +bindsym $mod+minus scratchpad show + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" +###### key bindings ###### }}} + +###### i3 modes ###### {{{ +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + # Pressing left will shrink the window's width. + # Pressing right will grow the window's width. + # Pressing up will shrink the window's height. + # Pressing down will grow the window's height. + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +# mode_system: prompt for lock, logout, suspend, shutdown, etc. +set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown +mode "$mode_system" { + bindsym l exec --no-startup-id $i3_scripts/i3exit.sh lock, mode "default" + bindsym e exec --no-startup-id $i3_scripts/i3exit.sh logout, mode "default" + bindsym s exec --no-startup-id $i3_scripts/i3exit.sh suspend, mode "default" + bindsym h exec --no-startup-id $i3_scripts/i3exit.sh hibernate, mode "default" + bindsym r exec --no-startup-id $i3_scripts/i3exit.sh reboot, mode "default" + bindsym Shift+s exec --no-startup-id $i3_scripts/i3exit.sh shutdown, mode "default" + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+Ctrl+Delete mode "$mode_system" +###### i3 modes ###### }}} + +###### applications bindings ###### {{{ +## NOTE: (Mod4: Win) +## Some Mod4-keys binded for urxvt (~/.Xresources) +## Mod4-c, Mod4-v, Mod4-Shift-v +## Mod4-Escape, Mode4-s, Mod4-u + +# dmenu & i3-dmenu-desktop +bindsym $mod+d exec --no-startup-id dmenu_run +bindsym $mod+F2 exec --no-startup-id dmenu_run +# `i3-dmenu-desktop' only displays applications with a .desktop file +bindsym $mod+p exec --no-startup-id i3-dmenu-desktop + +# lock screen (i3lock) +bindsym $mod+Ctrl+l exec --no-startup-id $i3_scripts/i3exit.sh lock +# turn off display +bindsym $mod+Ctrl+b exec --no-startup-id sleep 1 && xset dpms force off + +# screenshots +bindsym Print exec --no-startup-id scrot -e 'mv $f $shots_dir/$f' +bindsym $mod+Print exec --no-startup-id scrot -s -e 'mv $f $shots_dir/$f' + +# terminal +bindsym $sup+t exec urxvtc || urxvt || i3-sensible-terminal +# file manager +bindsym $sup+f exec thunar +# web browser +bindsym $sup+w exec ~/bin/firefox || firefox + +## dropdown terminal +# auto start urxvt if closed +exec --no-startup-id "while true; do urxvt -name 'dropdown_term'; done" +#for_window [instance="dropdown_term"] floating enable, border 1pixel +#for_window [instance="dropdown_term"] move scratchpad; [instance="dropdown_term"] scratchpad show; resize shrink height 100px; resize grow width 626px; move position 1px 20px; move scratchpad +for_window [instance="dropdown_term"] floating enable, border 1pixel, resize shrink height 100px, resize grow width 626px, move position 1px 20px +for_window [instance="dropdown_term"] move scratchpad +bindsym $mod+backslash [instance="dropdown_term"] scratchpad show +###### applications bindings ###### }}} + +###### window control ###### {{{ +## floating +for_window [window_role="pop-up"] floating enable +for_window [class="Feh"] floating enable +for_window [class="XFontSel"] floating enable +for_window [class="Arandr"] floating enable +for_window [class="Xfce4-notifyd"] floating enable +for_window [class="Xscreensaver-demo"] floating enable +for_window [class="Pinentry-gtk-2"] floating enable +for_window [class="Ds9"] floating enable +for_window [class="Toplevel"] floating enable +for_window [class="Firefox" instance="Places"] floating enable +for_window [class="Firefox" instance="Browser"] floating enable +for_window [class="Firefox" instance="Update"] floating enable +## floating by title +# xbindkeys +for_window [title="^XBindKey:.*Hit.*"] floating enable +# xev +for_window [title="^Event Tester$"] floating enable +# thunar copy files +for_window [title="^File Operation Progress$"] floating enable + +## adjust window border +for_window [class="URxvt"] border 1pixel +for_window [class="Firefox"] border 1pixel +for_window [class="Xfce4-notifyd"] border none +###### window control ###### }}} + +###### i3bar ###### {{{ +# i3bar (plus the system information i3status finds out, if available) +bar { + #status_command py3status -c ~/.i3/py3status.conf + status_command py3status -s -c ~/.i3/py3status.conf + position top + # whether show the current binding mode indicator (default yes) + #binding_mode_indicator no + + ## color theme + colors { + ## zenburn colorscheme (customized) {{{ + background #1e2320 + statusline #dcdccc + separator #94bff3 + # colorclass border background text + focused_workspace #506070 #506070 #ffffff + active_workspace #dcdccc #506070 #ffffff + inactive_workspace #dcdccc #1e2320 #dcdccc + urgent_workspace #dcdccc #cb4b16 #dcdccc + ## colorscheme }}} + # + ## solarized colorscheme {{{ + #background #073642 + #statusline #eee8d5 + #focused_workspace #cb4b16 #cb4b16 #eee8d5 + #active_workspace #cb4b16 #cb4b16 #eee8d5 + #inactive_workspace #b58900 #b58900 #eee8d5 + ## solarized }}} + } +} +###### i3bar ###### }}} + +###### autostart ###### {{{ +## run applications on startup +## if need to run command when restarting i3, use `exec_always' +# disable bell +exec --no-startup-id xset b off +exec --no-startup-id xrdb -load ~/.Xresources +exec --no-startup-id sh ~/.fehbg +exec --no-startup-id xcompmgr +exec --no-startup-id xbindkeys +exec --no-startup-id urxvtd -q -o -f +exec --no-startup-id parcellite +exec --no-startup-id fcitx +exec --no-startup-id nm-applet +exec --no-startup-id xbacklight -set 80 +exec --no-startup-id xscreensaver -no-splash +exec --no-startup-id xfce4-power-manager +exec --no-startup-id mpd +###### autostart ###### }}} + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=conf: # diff --git a/.i3/images/wallpaper.png b/.i3/images/wallpaper.png Binary files differnew file mode 100644 index 0000000..468b1a9 --- /dev/null +++ b/.i3/images/wallpaper.png diff --git a/.i3/py3status.conf b/.i3/py3status.conf new file mode 100644 index 0000000..d19b4b8 --- /dev/null +++ b/.i3/py3status.conf @@ -0,0 +1,78 @@ +## ~/.i3/py3status.conf +## +## py3status configuration file +## same syntax as 'i3status.conf' (man i3status) +## + +# It is important that this file is edited as *UTF-8*. +# The following line should contain a sharp s: +# ß +# If the above line is not correctly displayed, fix your editor first! + +general { + colors = true + color_good = '#dcdccc' + color_degraded = '#8cd0d3' + color_bad = '#dc8cc3' + interval = 3 + # output format (i3bar|dzen2|xmobar|none) + output_format = 'i3bar' +} + +#order += "volume master" +#order += "ipv6" +#order += "disk /" +#order += "run_watch DHCP" +#order += "run_watch VPN" +#order += "wireless wlp3s0" +#order += "ethernet enp0s25" +order += "battery 0" +order += "load" +#order += "tztime local" + +volume master { + format = "%volume" + device = "default" + mixer = "Master" + mixer_idx = 0 +} + +wireless wlp3s0 { + #format_up = "W: (%quality at %essid) %ip" + format_up = "%essid(%ip)" + format_down = "down" +} + +ethernet enp0s25 { + # if you use %speed, i3status requires root privileges + format_up = "E: %ip" + format_down = "E: down" +} + +battery 0 { + format = "%status %percentage %remaining" +} + +run_watch DHCP { + #pidfile = "/var/run/dhclient*.pid" + pidfile = "/var/run/dhcpd*.pid" +} + +run_watch VPN { + pidfile = "/var/run/vpnc/pid" +} + +tztime local { + #format = "%Y-%m-%d %H:%M:%S" + format = "%m-%d|%H:%M" +} + +load { + format = "%1min" +} + +disk "/" { + format = "%free" +} + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=conf: # diff --git a/.i3/py3status/10-mpd.py b/.i3/py3status/10-mpd.py new file mode 100644 index 0000000..95b7b4f --- /dev/null +++ b/.i3/py3status/10-mpd.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Weitian LI <liweitianux@gmail.com> +# 2014/05/14 + +""" +mpd module for py3status +""" + +## Get output of shell command: +## python 3.x: +## >>> subprocess.getoutput(cmd) +## >>> subprocess.getstatusoutput(cmd) +## python 2.7.x: +## >>> subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) + +import os +import re +import subprocess +import time + + +POSITION = 0 +# regex to match the status string of 'mpc status' output +mpd_status_p = re.compile(r'.*\n^\[([a-z]+)\]', re.M) # multiline + +class Py3status: + """ + MPD module to show mpd status and play info. + + This module also handle click events: + left button: mpc toggle + middle button: mpc stop + right button: mpc next + """ + + def mpd(self, i3status_output_json, i3status_config): + """ + Display MPD status and song info. + """ + response = { + 'full_text': '', + 'name': 'mpd', + 'instance': 'first', + } + # update response fields + self._update_response(i3status_config) + if self.color: + response['color'] = self.color + response['full_text'] = self.full_text + # cache status for 5 seconds + response['cached_until'] = time.time() + 5 + return (POSITION, response) + + def on_click(self, i3status_output_json, i3status_config, event): + """ + Handle click events. + """ + if event['button'] == 1: + # left button click + cmd = 'mpc toggle' + cmd_output = subprocess.getoutput(cmd) + elif event['button'] == 2: + # middle button click + cmd = 'mpc stop' + cmd_output = subprocess.getoutput(cmd) + elif event['button'] == 3: + # right button click + cmd = 'mpc next' + cmd_output = subprocess.getoutput(cmd) + # + self._update_response(i3status_config) + os.system('killall -USR1 py3status') + + def _update_response(self, i3status_config=None): + ## get mpd status + cmd = 'mpc status' + cmd_out = subprocess.getstatusoutput(cmd) + if cmd_out[0] == 0: + # mpd is running + mpd_status_m = mpd_status_p.match(cmd_out[1]) + if mpd_status_m: + self.status = mpd_status_m.group(1) + else: + self.status = 'stopped' + else: + # mpd not running (N/A) + self.status = 'na' + ## set full_text and color + prompt = '' # Icons: uF198 (music) + if self.status == 'playing': + status_text = ' ' # Icons: uF04B (play) + cmd = 'mpc status -f "%artist%-%title%" | head -n 1' + song_text = subprocess.getoutput(cmd) + if i3status_config: + self.color = i3status_config['color_good'] + elif self.status == 'paused': + status_text = ' ' # Icons: uF04C (pause) + cmd = 'mpc status -f "%title%" | head -n 1' + song_text = subprocess.getoutput(cmd) + if i3status_config: + self.color = i3status_config['color_degraded'] + elif self.status == 'stopped': + status_text = '' # Icons: uF04D (stop) + song_text = '' + if i3status_config: + self.color = i3status_config['color_bad'] + else: + # mpd not running (N/A) + status_text = '' # Icons: uF00D (X) + song_text = '' + if i3status_config: + self.color = i3status_config['color_bad'] + # full_text + self.full_text = '{0} {1}{2}'.format(prompt, status_text, song_text) + diff --git a/.i3/py3status/20-volume.py b/.i3/py3status/20-volume.py new file mode 100644 index 0000000..467764c --- /dev/null +++ b/.i3/py3status/20-volume.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Weitian LI <liweitianux@gmail.com> +# 2014/05/15 + +""" +volume module for py3status +""" + +## Get output of shell command: +## python 3.x: +## >>> subprocess.getoutput(cmd) +## >>> subprocess.getstatusoutput(cmd) +## python 2.7.x: +## >>> subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) + +import os +import re +import subprocess +import time + + +POSITION = 0 +DEVICE = 'default' +MIXER = 'Master' +# regex compile to match amixer output volume info +amixer_rep = re.compile(r'.*\[(\d+)%\]\s*\[(on|off)\]') + + +class Py3status: + """ + Volume module to show volume info. + + This module also handle click events: + left button: decrease volume + middle button: mute/unmute toggle + right button: increase volume + """ + + def myvolume(self, i3status_output_json, i3status_config): + """ + Display volume info. + + XXX: cannot use name 'volume' ?? + """ + response = { + 'full_text': '', + 'name': 'myvolume', + 'instance': 'first', + } + # update response fields + self._update_response(i3status_config) + if self.color: + response['color'] = self.color + response['full_text'] = self.full_text + # cache status for 5 seconds + response['cached_until'] = time.time() + 5 + return (POSITION, response) + + def on_click(self, i3status_output_json, i3status_config, event): + """ + Handle click events. + """ + if event['button'] == 1: + # left button click + cmd = 'amixer -D "{0}" sset "{1}" "5%-" unmute'.format(DEVICE, MIXER) + cmd_output = subprocess.getoutput(cmd) + elif event['button'] == 2: + # middle button click + cmd = 'amixer -D "{0}" sset "{1}" toggle'.format(DEVICE, MIXER) + cmd_output = subprocess.getoutput(cmd) + elif event['button'] == 3: + # right button click + cmd = 'amixer -D "{0}" sset "{1}" "5%+" unmute'.format(DEVICE, MIXER) + cmd_output = subprocess.getoutput(cmd) + # + self._update_response(i3status_config) + os.system('killall -USR1 py3status') + + def _update_response(self, i3status_config=None): + """ + update self.full_text + """ + # get volume info + cmd = 'amixer -D "{0}" sget "{1}" | tail -n 1'.format(DEVICE, MIXER) + cmd_output = subprocess.getoutput(cmd) + m = amixer_rep.match(cmd_output) + self.volume, self.status = m.group(1, 2) + if int(self.volume) > 60: + self.level = 'high' + prompt = '' # Icons: uF357 (volume-high) + if i3status_config: + self.color = i3status_config['color_degraded'] + elif int(self.volume) > 30: + self.level = 'medium' + prompt = '' # Icons: uF359 (volume-medium) + if i3status_config: + self.color = i3status_config['color_good'] + else: + self.level = 'low' + prompt = '' # Icons: uF358 (volume-low) + if i3status_config: + self.color = i3status_config['color_good'] + # determine icon + if self.status == 'off': + prompt = '' # Icons: uF35A (volume-off) + if i3status_config: + self.color = i3status_config['color_bad'] + # determine display info + self.full_text = '{0} {1}%'.format(prompt, self.volume) + diff --git a/.i3/py3status/25-microphone.py b/.i3/py3status/25-microphone.py new file mode 100644 index 0000000..379a44c --- /dev/null +++ b/.i3/py3status/25-microphone.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Weitian LI <liweitianux@gmail.com> +# 2014/05/15 + +""" +microphone module for py3status +""" + +## Get output of shell command: +## python 3.x: +## >>> subprocess.getoutput(cmd) +## >>> subprocess.getstatusoutput(cmd) +## python 2.7.x: +## >>> subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) + +import os +import re +import subprocess + + +POSITION = 0 +DEVICE = 'default' +MIXER = 'Capture' # Microphone +# regex compile to match amixer output volume info +amixer_rep = re.compile(r'.*\[(\d+)%\]\s*\[(on|off)\]') + + +class Py3status: + """ + Microphone module to show microphone info. + + This module also handle click events: + left button: decrease volume + middle button: mute/unmute toggle + right button: increase volume + """ + + def microphone(self, i3status_output_json, i3status_config): + """ + Display microphone info. + """ + response = { + 'full_text': '', + 'name': 'microphone', + 'instance': 'first', + } + # update response fields + self._update_response(i3status_config) + response['full_text'] = self.full_text + if self.color: + response['color'] = self.color + return (POSITION, response) + + def on_click(self, i3status_output_json, i3status_config, event): + """ + Handle click events. + """ + if event['button'] == 1: + # left button click + cmd = 'amixer -D "{0}" sset "{1}" "5%-" unmute'.format(DEVICE, MIXER) + cmd_output = subprocess.getoutput(cmd) + elif event['button'] == 2: + # middle button click + cmd = 'amixer -D "{0}" sset "{1}" toggle'.format(DEVICE, MIXER) + cmd_output = subprocess.getoutput(cmd) + elif event['button'] == 3: + # right button click + cmd = 'amixer -D "{0}" sset "{1}" "5%+" unmute'.format(DEVICE, MIXER) + cmd_output = subprocess.getoutput(cmd) + # + self._update_response(i3status_config) + os.system('killall -USR1 py3status') + + def _update_response(self, i3status_config=None): + """ + update self.full_text + """ + # get volume info + cmd = 'amixer -D "{0}" sget "{1}" | tail -n 1'.format(DEVICE, MIXER) + cmd_output = subprocess.getoutput(cmd) + m = amixer_rep.match(cmd_output) + self.volume, self.status = m.group(1, 2) + prompt = '' # Icons: uF130 (mic-on) + if int(self.volume) > 60: + self.level = 'high' + if i3status_config: + self.color = i3status_config['color_degraded'] + elif int(self.volume) > 30: + self.level = 'medium' + if i3status_config: + self.color = i3status_config['color_good'] + else: + self.level = 'low' + if i3status_config: + self.color = i3status_config['color_good'] + # determine icon + if self.status == 'off': + prompt = '' # Icons: uF131 (mic-off) + if i3status_config: + self.color = i3status_config['color_bad'] + # determine display info + self.full_text = '{0} {1}%'.format(prompt, self.volume) + diff --git a/.i3/py3status/30-touchpad.py b/.i3/py3status/30-touchpad.py new file mode 100644 index 0000000..195d6b1 --- /dev/null +++ b/.i3/py3status/30-touchpad.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Weitian LI <liweitianux@gmail.com> +# 2014/05/15 + +""" +touchpad module for py3status +""" + +## Get output of shell command: +## python 3.x: +## >>> subprocess.getoutput(cmd) +## >>> subprocess.getstatusoutput(cmd) +## python 2.7.x: +## >>> subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) + +import os +import re +import subprocess + + +POSITION = 0 + + +class Py3status: + """ + Touchpad module to show the status of touchpad. + + Click events: + left button: enable touchpad + middle button: toggle touchpad + """ + + def __init__(self): + """ + get touchpad status + """ + cmd = 'synclient -l | grep -c "TouchpadOff.*=.*0"' + touchpad_status = subprocess.getoutput(cmd) + if int(touchpad_status) == 1: + self.status = 'on' + else: + self.status = 'off' + + def touchpad(self, i3status_output_json, i3status_config): + """ + Display touchpad status. + """ + #prompt = '' # Icons: uF10A (ipad) + prompt = '' # Icons: uF3E3 (palm) + response = { + 'full_text': '', + 'name': 'touchpad', + 'instance': 'first', + } + if self.status == 'on': + response['color'] = i3status_config['color_good'] + status_text = '' # Icons: uF00C (check) + else: + response['color'] = i3status_config['color_bad'] + status_text = '' # Icons: uF00D (cross) + response['full_text'] = '{0} {1}'.format(prompt, status_text) + return (POSITION, response) + + def on_click(self, i3status_output_json, i3status_config, event): + """ + Handle click events. + """ + if event['button'] == 1: + # left button click + cmd = 'synclient TouchpadOff=0' + cmd_output = subprocess.getoutput(cmd) + self.status = 'on' + elif event['button'] == 2: + # middle button click + if self.status == 'on': + cmd = 'synclient TouchpadOff=1' + self.status = 'off' + else: + cmd = 'synclient TouchpadOff=0' + self.status = 'on' + cmd_output = subprocess.getoutput(cmd) + # + os.system('killall -USR1 py3status') + diff --git a/.i3/py3status/40-power.py b/.i3/py3status/40-power.py new file mode 100644 index 0000000..96b8ce5 --- /dev/null +++ b/.i3/py3status/40-power.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Weitian LI <liweitianux@gmail.com> +# 2014/05/15 + +""" +power module for py3status +""" + +## Get output of shell command: +## python 3.x: +## >>> subprocess.getoutput(cmd) +## >>> subprocess.getstatusoutput(cmd) +## python 2.7.x: +## >>> subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) + +import re +import subprocess +import time + + +POSITION = 0 + +BAT_PRESENT = '/sys/class/power_supply/BAT0/present' +# regex to match the '1' at the beginning +one_p = re.compile(r'(^1).*') + + +class Py3status: + """ + Power module to show whether AC/battery is online. + + ac_status: online, offline + bat_status: present, na + """ + + def power(self, i3status_output_json, i3status_config): + """ + Display power status. + """ + response = { + 'full_text': '', + 'name': 'power', + 'instance': 'first', + } + # AC online + ac_cmd = 'on_ac_power' + ac_cmd_out = subprocess.getstatusoutput(ac_cmd) + if ac_cmd_out[0] == 0: + ac_text = '' # Icons: uF237 (ac-online) + self.ac_status = 'online' + response['color'] = i3status_config['color_good'] + else: + ac_text = '' # Icons: uF236 (ac-offline) + self.ac_status = 'offline' + response['color'] = i3status_config['color_bad'] + # Battery present + with open(BAT_PRESENT, 'r') as bat_present_f: + bat_present_c = bat_present_f.read() + bat_m = one_p.match(bat_present_c) + if bat_m.group(1): + bat_text = ' ' # Icons: uF3CF (battery-vertical) + self.bat_status = 'present' + else: + bat_text = '' + self.bat_status = 'na' + # + response['full_text'] = '{0} {1}'.format(ac_text, bat_text) + # cache status for 5 seconds + response['cached_until'] = time.time() + 5 + return (POSITION, response) + diff --git a/.i3/py3status/50-battery.py b/.i3/py3status/50-battery.py new file mode 100644 index 0000000..5e88125 --- /dev/null +++ b/.i3/py3status/50-battery.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Weitian LI <liweitianux@gmail.com> +# 2014/05/17 + +""" +battery module for py3status +""" + +## Get output of shell command: +## python 3.x: +## >>> subprocess.getoutput(cmd) +## >>> subprocess.getstatusoutput(cmd) +## python 2.7.x: +## >>> subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) + +import re +import subprocess +import time + + +POSITION = 0 + +BAT_ID = 0 +## uevent: +## ENERGY_NOW: energy that battery has now +## POWER_NOW: battery current discharging/charing rate +BAT_UEVENT = '/sys/class/power_supply/BAT{0}/uevent'.format(BAT_ID) + +# regex to match pattern in 'uevent' contents' +status_p = re.compile(r'.*STATUS=(\w+)', re.S) +present_p = re.compile(r'.*PRESENT=(\d)', re.S) +capacity_p = re.compile(r'.*CAPACITY=(\d+)', re.S) +energynow_p = re.compile(r'.*ENERGY_NOW=(\d+)', re.S) +powernow_p = re.compile(r'.*POWER_NOW=(\d+)', re.S) + + +class Py3status: + """ + Battery module to show battery information. + + battery status: Full, Discharging, Charging, Unknown + """ + + def mybattery(self, i3status_output_json, i3status_config): + """ + Display battery information. + """ + response = { + 'full_text': '', + 'name': 'mybattery', + 'instance': 'first', + } + # open battery uevent file + with open(BAT_UEVENT, 'r') as bat_f: + bat_info = bat_f.read() + status_m = status_p.match(bat_info) + capacity_m = capacity_p.match(bat_info) + energynow_m = energynow_p.match(bat_info) + powernow_m = powernow_p.match(bat_info) + self.status = status_m.group(1) + self.capacity = int(capacity_m.group(1)) + energynow = int(energynow_m.group(1)) + powernow = int(powernow_m.group(1)) + # + bat_text = '{0}%'.format(self.capacity) + if self.status == 'Full': + prompt = '' # Icons: uF213 (battery-full) + color = i3status_config['color_good'] + elif self.status == 'Charging': + prompt = '' # Icons: uF211 (battery-charing) + color = i3status_config['color_degraded'] + elif self.status == 'Discharging': + if self.capacity > 80: + prompt = '' # Icons: uF213 (battery-full) + color = i3status_config['color_good'] + elif self.capacity > 60: + prompt = '' # Icons: uF214 (battery-high) + color = i3status_config['color_degraded'] + elif self.capacity > 30: + prompt = '' # Icons: uF215 (battery-low) + color = i3status_config['color_degraded'] + else: + prompt = '' # Icons: uF212 (battery-empty) + color = i3status_config['color_bad'] + # calc remaining time + remaining_h = energynow // powernow + remaining_m = int((energynow % powernow) / powernow * 60) + if remaining_h: + remaining = '{0}h{1:02d}m'.format(remaining_h, remaining_m) + else: + remaining = '{0:02d}m'.format(remaining_m) + bat_text = '{0} {1}'.format(bat_text, remaining) + else: + # unknown battery status + prompt = '' # Icons: uF215 (battery-low) + prompt = prompt + ' ' # Icons: uF243 (question-sign) + color = i3status_config['color_bad'] + # + response['full_text'] = '{0} {1}'.format(prompt, bat_text) + response['color'] = color + # cache status for 5 seconds + response['cached_until'] = time.time() + 5 + return (POSITION, response) + diff --git a/.i3/py3status/80-datetime.py b/.i3/py3status/80-datetime.py new file mode 100644 index 0000000..5d578a0 --- /dev/null +++ b/.i3/py3status/80-datetime.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Weitian LI <liweitianux@gmail.com> +# 2014/05/15 + +""" +datetime module for py3status +""" + +## Get output of shell command: +## python 3.x: +## >>> subprocess.getoutput(cmd) +## >>> subprocess.getstatusoutput(cmd) +## python 2.7.x: +## >>> subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) + +import re +import subprocess +import time + + +# regext to match date and time from output of 'date' +datetime_p = re.compile(r'(^\d+/\d+)\s*(\d+:\d+)') + + +class Py3status: + """ + Datetime module to show current date and time. + """ + + def mydate(self, i3status_output_json, i3status_config): + """ + Display current date. + """ + POSITION = 0 + response = { + 'full_text': '', + 'name': 'mydate', + 'instance': 'first', + } + prompt = '' # Icons: uF073 (calendar) + # update datetime + self._get_datetime() + response['full_text'] = '{0} {1}'.format(prompt, self.date) + # cache status for 5 seconds + response['cached_until'] = time.time() + 5 + return (POSITION, response) + + def mytime(self, i3status_output_json, i3status_config): + """ + Display current time. + """ + POSITION = 1 + response = { + 'full_text': '', + 'name': 'mytime', + 'instance': 'first', + } + prompt = '' # Icons: uF017 (clock) + # update datetime + self._get_datetime() + response['full_text'] = '{0} {1}'.format(prompt, self.time) + # cache status for 5 seconds + response['cached_until'] = time.time() + 5 + return (POSITION, response) + + def _get_datetime(self): + """ + Get current date and time + """ + cmd = 'date "+%m/%d %H:%M"' + datetime = subprocess.getoutput(cmd) + dt_m = datetime_p.match(datetime) + self.date, self.time = dt_m.group(1, 2) + diff --git a/.i3/py3status/backup/dpms.py b/.i3/py3status/backup/dpms.py new file mode 100644 index 0000000..783c53c --- /dev/null +++ b/.i3/py3status/backup/dpms.py @@ -0,0 +1,44 @@ +from os import system + + +class Py3status: + """ + This module allows activation and deactivation + of DPMS (Display Power Management Signaling) + by clicking on 'DPMS' in the status bar. + + Written and contributed by @tasse: + Andre Doser <dosera AT tf.uni-freiburg.de> + """ + def __init__(self): + """ + Detect current state on start. + """ + self.run = system('xset -q | grep -iq "DPMS is enabled"') == 0 + + def dpms(self, i3status_output_json, i3status_config): + """ + Display a colorful state of DPMS. + """ + result = { + 'full_text': 'DPMS', + 'name': 'dpms' + } + if self.run: + result['color'] = i3status_config['color_good'] + else: + result['color'] = i3status_config['color_bad'] + return (0, result) + + def on_click(self, json, i3status_config, event): + """ + Enable/Disable DPMS on left click. + """ + if event['button'] == 1: + if self.run: + self.run = False + system("xset -dpms") + else: + self.run = True + system("xset +dpms") + system("killall -USR1 py3status") diff --git a/.i3/py3status/backup/empty_class.py b/.i3/py3status/backup/empty_class.py new file mode 100644 index 0000000..077269c --- /dev/null +++ b/.i3/py3status/backup/empty_class.py @@ -0,0 +1,41 @@ +class Py3status: + """ + Empty and basic py3status class. + + NOTE: py3status will NOT execute: + - methods starting with '_' + - methods decorated by @property and @staticmethod + + NOTE: reserved method names: + - 'kill' method for py3status exit notification + - 'on_click' method for click events from i3bar + """ + def kill(self, i3status_output_json, i3status_config): + """ + This method will be called upon py3status exit. + """ + pass + + def on_click(self, i3status_output_json, i3status_config, event): + """ + This method will be called when a click event occurs on this module's + output on the i3bar. + + Example 'event' json object: + {'y': 13, 'x': 1737, 'button': 1, 'name': 'empty', 'instance': 'first'} + """ + pass + + def empty(self, i3status_output_json, i3status_config): + """ + This method will return an empty text message + so it will NOT be displayed on your i3bar. + + If you want something displayed you should write something + in the 'full_text' key of your response. + + See the i3bar protocol spec for more information: + http://i3wm.org/docs/i3bar-protocol.html + """ + response = {'full_text': '', 'name': 'empty', 'instance': 'first'} + return (0, response) diff --git a/.i3/py3status/backup/glpi.py b/.i3/py3status/backup/glpi.py new file mode 100644 index 0000000..929749d --- /dev/null +++ b/.i3/py3status/backup/glpi.py @@ -0,0 +1,52 @@ +# You need MySQL-python from http://pypi.python.org/pypi/MySQL-python +import MySQLdb + + +class Py3status: + """ + This example class demonstrates how to display the current total number of + open tickets from GLPI in your i3bar. + + It features thresholds to colorize the output and forces a low timeout to + limit the impact of a server connectivity problem on your i3bar freshness. + + Note that we don't have to implement a cache layer as it is handled by + py3status automagically. + """ + def count_glpi_open_tickets(self, json, i3status_config): + response = {'full_text': '', 'name': 'glpi_tickets'} + + # user-defined variables + CRIT_THRESHOLD = 20 + WARN_THRESHOLD = 15 + MYSQL_DB = '' + MYSQL_HOST = '' + MYSQL_PASSWD = '' + MYSQL_USER = '' + POSITION = 0 + + mydb = MySQLdb.connect( + host=MYSQL_HOST, + user=MYSQL_USER, + passwd=MYSQL_PASSWD, + db=MYSQL_DB, + connect_timeout=5, + ) + mycr = mydb.cursor() + mycr.execute('''select count(*) + from glpi_tickets + where closedate is NULL and solvedate is NULL;''') + row = mycr.fetchone() + if row: + open_tickets = int(row[0]) + if i3status_config['colors']: + if open_tickets > CRIT_THRESHOLD: + response.update({'color': i3status_config['color_bad']}) + elif open_tickets > WARN_THRESHOLD: + response.update( + {'color': i3status_config['color_degraded']} + ) + response['full_text'] = '%s tickets' % open_tickets + mydb.close() + + return (POSITION, response) diff --git a/.i3/py3status/backup/i3bar_click_events.py b/.i3/py3status/backup/i3bar_click_events.py new file mode 100644 index 0000000..792965c --- /dev/null +++ b/.i3/py3status/backup/i3bar_click_events.py @@ -0,0 +1,127 @@ +from subprocess import Popen +from time import time + + +class Py3status: + """ + This module allows you to take actions based on click events made on + the i3status modules. For example, thanks to this module you could + launch the wicd GUI when clicking on the ethernet or wireless module + of your i3status output ! + + IMPORTANT: + This module file name is reserved and should NOT be changed if you + want py3status to handle your i3status modules click events ! + + The behavior described above will only work if this file is named + 'i3bar_click_events.py' ! + """ + def __init__(self): + """ + This is where you setup your actions based on your i3status config. + + Configuration: + -------------- + self.actions = { + "<module name and instance>": { + <button number>: [<function to run>, <arg1>, <arg2>], + } + } + + Variables: + ---------- + <button number> is an integer from 1 to 3: + 1 : left click + 2 : middle click + 3 : right click + + <function to run> is a python function written in this module. + The 'external_command' function is provided for convenience if + you want to call an external program from this module. + You can of course write your own functions and have them executed + on a click event at will with possible arguments <arg1>, <arg2>... + + <module name and instance> is a string made from the module + attribute 'name' and 'instance' using a space as separator: + For i3status modules, it's simply the name of the module as it + appears in the 'order' instruction of your i3status.conf. + Example: + in i3status.conf -> order += "wireless wlan0" + self.actions key -> "wireless wlan0" + + Usage example: + -------------- + - Open the wicd-gtk GUI when we LEFT click on the ethernet + module of i3status. + - Open emelfm2 to /home when we LEFT click on + the /home instance of disk_info + - Open emelfm2 to / when we LEFT click on + the / instance of disk_info + + The related i3status.conf looks like: + order += "disk /home" + order += "disk /" + order += "ethernet eth0" + + The resulting self.actions should be: + self.actions = { + "ethernet eth0": { + 1: [external_command, 'wicd-gtk', '-n'], + }, + "disk_info /home": { + 1: [external_command, 'emelfm2', '-1', '~'], + }, + "disk_info /": { + 1: [external_command, 'emelfm2', '-1', '/'], + }, + } + """ + # CONFIGURE ME PLEASE, LOVE YOU BIG TIME ! + self.actions = { + } + + def on_click(self, i3status_output_json, i3status_config, event): + """ + If an action is configured for the given i3status module 'name' and + 'instance' (if present), then we'll execute the given function with + its arguments (if present). + + Usually you SHOULD NOT modify this part of the code. + """ + button = event['button'] + key_name = '{} {}'.format( + event['name'], + event.get('instance', '') + ).strip() + if key_name in self.actions and button in self.actions[key_name]: + # get the function to run + func = self.actions[key_name][button][0] + assert hasattr(func, '__call__'), \ + 'first element of the action list must be a function' + + # run the function with the possibly given arguments + func(*self.actions[key_name][button][1:]) + + def i3bar_click_events(self, i3status_output_json, i3status_config): + """ + Cached empty output, this module doesn't show anything. + """ + response = {'full_text': '', 'name': 'i3bar_click_events'} + response['cached_until'] = time() + 3600 + return (-1, response) + + +def external_command(*cmd): + """ + This convenience function lets you call an external program at will. + + NOTE: + The stdout and stderr MUST be suppressed as shown here to avoid any + output from being caught by the i3bar (this would freeze it). + See issue #20 for more info. + """ + Popen( + cmd, + stdout=open('/dev/null', 'w'), + stderr=open('/dev/null', 'w') + ) diff --git a/.i3/py3status/backup/netdata.py b/.i3/py3status/backup/netdata.py new file mode 100644 index 0000000..729983b --- /dev/null +++ b/.i3/py3status/backup/netdata.py @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- + +# netdata + +# Netdata is a module uses great Py3status (i3status wrapper) to +# display network information (Linux systems) in i3bar. +# For more information read: +# i3wm homepage: http://i3wm.org +# py3status homepage: https://github.com/ultrabug/py3status + +# Copyright (C) <2013> <Shahin Azad [ishahinism at Gmail]> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# ----------------------------------------------------------------- # +# Notes: +# 1. netdata will check 'eth0' interface by default. You can +# change it by changing 'self.net_interface' variable in 'GetData' +# class. +# 2. Colors are depended on strict specification in traffic/netspeed methods. +# You can change them by manipulating conditions. + +import subprocess +from time import time + +# Method 'netSpeed' will use this variables to calculate downloaded +# bytes in last second. Initializing this variables globally is +# necessary since we can't use __init__ method in Py3Status class. +old_transmitted, old_received = 0, 0 + + +class GetData: + """Get system status + + """ + def __init__(self): + # You can change it to another interface. + # It'll be used for grabbing net interface data. + self.net_interface = 'eth0' + + def execCMD(self, cmd, arg): + """Take a system command and its argument, then return the result. + + Arguments: + - `cmd`: system command. + - `arg`: argument. + """ + result = subprocess.check_output([cmd, arg]) + return result + + def netBytes(self): + """Execute 'cat /proc/net/dev', find the interface line (Default + 'eth0') and grab received/transmitted bytes. + + """ + net_data = self.execCMD('cat', '/proc/net/dev').decode('utf-8').split() + interface_index = net_data.index(self.net_interface + ':') + received_bytes = int(net_data[interface_index + 1]) + transmitted_bytes = int(net_data[interface_index + 9]) + + return received_bytes, transmitted_bytes + + +class Py3status: + """ + System status in i3bar + """ + def netSpeed(self, json, i3status_config): + """Calculate network speed ('eth0' interface) and return it. You can + change the interface using 'self.net_interface' variable in + 'GetData' class. + + """ + data = GetData() + response = {'full_text': '', 'name': 'net_speed'} + + global old_received + global old_transmitted + + received_bytes, transmitted_bytes = data.netBytes() + dl_speed = (received_bytes - old_received) / 1024. + up_speed = (transmitted_bytes - old_transmitted) / 1024. + + if dl_speed < 30: + response['color'] = i3status_config['color_bad'] + elif dl_speed < 60: + response['color'] = i3status_config['color_degraded'] + else: + response['color'] = i3status_config['color_good'] + + response['full_text'] = "LAN(Kb): {:5.1f}↓ {:5.1f}↑"\ + .format(dl_speed, up_speed) + response['cached_until'] = time() + + old_received, old_transmitted = received_bytes, transmitted_bytes + return (0, response) + + def traffic(self, json, i3status_config): + """Calculate networks used traffic. Same as 'netSpeed' method you can + change the interface. + + """ + data = GetData() + response = {'full_text': '', 'name': 'traffic'} + + received_bytes, transmitted_bytes = data.netBytes() + download = received_bytes / 1024 / 1024. + upload = transmitted_bytes / 1024 / 1024. + total = download + upload + + if total < 400: + response['color'] = i3status_config['color_good'] + elif total < 700: + response['color'] = i3status_config['color_degraded'] + else: + response['color'] = i3status_config['color_bad'] + + response['full_text'] = "T(Mb): {:3.0f}↓ {:3.0f}↑ {:3.0f}↕"\ + .format(download, upload, total) + + return (1, response) diff --git a/.i3/py3status/backup/ns_checker.py b/.i3/py3status/backup/ns_checker.py new file mode 100644 index 0000000..4a332b1 --- /dev/null +++ b/.i3/py3status/backup/ns_checker.py @@ -0,0 +1,57 @@ +import dns.resolver +import socket + + +class Py3status: + """ + This module launch a simple query on each nameservers for the specified domain. + Nameservers are dynamically retrieved. The FQDN is the only one mandatory parameter. + It's also possible to add additional nameservers by appending them in nameservers list. + + The default resolver can be overwritten with my_resolver.nameservers parameter. + + Written and contributed by @nawadanp + """ + def __init__(self): + self.domain = 'google.com' + self.lifetime = 0.3 + self.resolver = [] + self.nameservers = [] + + def ns_checker(self, i3status_output_json, i3status_config): + response = {'full_text': '', 'name': 'ns_checker'} + position = 0 + counter = 0 + error = False + nameservers = [] + + my_resolver = dns.resolver.Resolver() + my_resolver.lifetime = self.lifetime + if self.resolver: + my_resolver.nameservers = self.resolver + + my_ns = my_resolver.query(self.domain, 'NS') + + # Insert each NS ip address in nameservers + for ns in my_ns: + nameservers.append(str(socket.gethostbyname(str(ns)))) + for ns in self.nameservers: + nameservers.append(str(ns)) + + # Perform a simple DNS query, for each NS servers + for ns in nameservers: + my_resolver.nameservers = [ns] + counter += 1 + try: + my_resolver.query(self.domain, 'A') + except: + error = True + + if error: + response['full_text'] = str(counter) + ' NS NOK' + response['color'] = i3status_config['color_bad'] + else: + response['full_text'] = str(counter) + ' NS OK' + response['color'] = i3status_config['color_good'] + + return (position, response) diff --git a/.i3/py3status/backup/pingdom.py b/.i3/py3status/backup/pingdom.py new file mode 100644 index 0000000..cddf1a9 --- /dev/null +++ b/.i3/py3status/backup/pingdom.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +import requests +from time import time + + +class Py3status: + """ + Dynamically display the latest response time of the configured checks using + the Pingdom API. + We also verify the status of the checks and colorize if needed. + Pingdom API doc : https://www.pingdom.com/services/api-documentation-rest/ + + #NOTE: This module needs the 'requests' python module from pypi + https://pypi.python.org/pypi/requests + """ + def pingdom_checks(self, json, i3status_config): + response = {'full_text': '', 'name': 'pingdom_checks'} + + #NOTE: configure me ! + APP_KEY = '' # create an APP KEY on pingdom first + CACHE_TIMEOUT = 600 # recheck every 10 mins + CHECKS = [] # checks' names you want added to your bar + LATENCY_THRESHOLD = 500 # when to colorize the output + LOGIN = '' # pingdom login + PASSWORD = '' # pingdom password + TIMEOUT = 15 + POSITION = 0 + + r = requests.get( + 'https://api.pingdom.com/api/2.0/checks', + auth=(LOGIN, PASSWORD), + headers={'App-Key': APP_KEY}, + timeout=TIMEOUT, + ) + result = r.json() + if 'checks' in result: + for check in [ + ck for ck in result['checks'] if ck['name'] in CHECKS + ]: + if check['status'] == 'up': + response['full_text'] += '{}: {}ms, '.format( + check['name'], + check['lastresponsetime'] + ) + if check['lastresponsetime'] > LATENCY_THRESHOLD: + response.update( + {'color': i3status_config['color_degraded']} + ) + else: + response['full_text'] += '{}: DOWN'.format( + check['name'], + check['lastresponsetime'] + ) + response.update({'color': i3status_config['color_bad']}) + response['full_text'] = response['full_text'].strip(', ') + response['cached_until'] = time() + CACHE_TIMEOUT + + return (POSITION, response) diff --git a/.i3/py3status/backup/pomodoro.py b/.i3/py3status/backup/pomodoro.py new file mode 100644 index 0000000..28b5ea1 --- /dev/null +++ b/.i3/py3status/backup/pomodoro.py @@ -0,0 +1,123 @@ +""" +Pomodoro countdown on i3bar originally written by @Fandekasp (Adrien Lemaire) +""" +from subprocess import call +from time import time + +MAX_BREAKS = 4 +POSITION = 0 +TIMER_POMODORO = 25 * 60 +TIMER_BREAK = 5 * 60 +TIMER_LONG_BREAK = 15 * 60 + + +class Py3status: + """ + """ + def __init__(self): + self.__setup('stop') + self.alert = False + self.run = False + + def on_click(self, json, i3status_config, event): + """ + Handles click events + """ + if event['button'] == 1: + if self.status == 'stop': + self.status = 'start' + self.run = True + + elif event['button'] == 2: + self.__setup('stop') + self.run = False + + elif event['button'] == 3: + self.__setup('pause') + self.run = False + + @property + def response(self): + """ + Return the response full_text string + """ + return { + 'full_text': '{} ({})'.format(self.prefix, self.timer), + 'name': 'pomodoro' + } + + def __setup(self, status): + """ + Setup a step + """ + self.status = status + if status == 'stop': + self.prefix = 'Pomodoro' + self.status = 'stop' + self.timer = TIMER_POMODORO + self.breaks = 1 + + elif status == 'start': + self.prefix = 'Pomodoro' + self.timer = TIMER_POMODORO + + elif status == 'pause': + self.prefix = 'Break #%d' % self.breaks + if self.breaks > MAX_BREAKS: + self.timer = TIMER_LONG_BREAK + self.breaks = 1 + else: + self.breaks += 1 + self.timer = TIMER_BREAK + + def __decrement(self): + """ + Countdown handler + """ + self.timer -= 1 + if self.timer < 0: + self.alert = True + self.run = False + self.__i3_nagbar() + if self.status == 'start': + self.__setup('pause') + self.status = 'pause' + elif self.status == 'pause': + self.__setup('start') + self.status = 'start' + + def __i3_nagbar(self, level='warning'): + """ + Make use of i3-nagbar to display warnings to the user. + """ + msg = '{} time is up !'.format(self.prefix) + try: + call( + ['i3-nagbar', '-m', msg, '-t', level], + stdout=open('/dev/null', 'w'), + stderr=open('/dev/null', 'w') + ) + except: + pass + + def pomodoro(self, json, i3status_config): + """ + Pomodoro response handling and countdown + """ + if self.run: + self.__decrement() + + response = self.response + if self.alert: + response['urgent'] = True + self.alert = False + + if self.status == 'start': + response['color'] = i3status_config['color_good'] + elif self.status == 'pause': + response['color'] = i3status_config['color_degraded'] + else: + response['color'] = i3status_config['color_bad'] + + response['cached_until'] = time() + return (POSITION, response) diff --git a/.i3/py3status/backup/sysdata.py b/.i3/py3status/backup/sysdata.py new file mode 100644 index 0000000..14aefb3 --- /dev/null +++ b/.i3/py3status/backup/sysdata.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +# sysdata + +# Sysdata is a module uses great Py3status (i3status wrapper) to +# display system information (RAM usage) in i3bar (Linux systems). +# For more information read: +# i3wm homepage: http://i3wm.org +# py3status homepage: https://github.com/ultrabug/py3status + +# Copyright (C) <2013> <Shahin Azad [ishahinism at Gmail]> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import subprocess +from time import time + + +class GetData: + """Get system status + + """ + def execCMD(self, cmd, arg): + """Take a system command and its argument, then return the result. + + Arguments: + - `cmd`: system command. + - `arg`: argument. + """ + result = subprocess.check_output([cmd, arg]) + return result + + def cpu(self): + """Get the cpu usage data from /proc/stat : + cpu 2255 34 2290 22625563 6290 127 456 0 0 + - user: normal processes executing in user mode + - nice: niced processes executing in user mode + - system: processes executing in kernel mode + - idle: twiddling thumbs + - iowait: waiting for I/O to complete + - irq: servicing interrupts + - softirq: servicing softirqs + - steal: involuntary wait + - guest: running a normal guest + - guest_nice: running a niced guest + These numbers identify the amount of time the CPU has spent performing + different kinds of work. Time units are in USER_HZ (typically hundredths of a + second) + """ + with open('/proc/stat', 'r') as fd: + line = fd.readline() + cpu_data = line.split() + total_cpu_time = sum(map(int, cpu_data[1:])) + cpu_idle_time = int(cpu_data[4]) + + #return the cpu total&idle time + return total_cpu_time, cpu_idle_time + + def memory(self): + """Execute 'free -m' command, grab the memory capacity and used size + then return; Memory size 'total_mem', Used_mem, and percentage + of used memory. + + """ + # Run 'free -m' command and make a list from output. + mem_data = self.execCMD('free', '-m').split() + total_mem = int(mem_data[7]) / 1024. + used_mem = int(mem_data[15]) / 1024. + # Caculate percentage + used_mem_percent = int(used_mem / (total_mem / 100)) + + # Results are in kilobyte. + return total_mem, used_mem, used_mem_percent + + +class Py3status: + """ + System status in i3bar + """ + def __init__(self): + self.data = GetData() + self.cpu_total = 0 + self.cpu_idle = 0 + + def cpuInfo(self, json, i3status_config): + """calculate the CPU status and return it. + + """ + response = {'full_text': '', 'name': 'cpu_usage'} + cpu_total, cpu_idle = self.data.cpu() + used_cpu_percent = 1 - float(cpu_idle-self.cpu_idle)/float(cpu_total-self.cpu_total) + self.cpu_total = cpu_total + self.cpu_idle = cpu_idle + + if used_cpu_percent <= 40: + response['color'] = i3status_config['color_good'] + elif used_cpu_percent <= 75: + response['color'] = i3status_config['color_degraded'] + else: + response['color'] = i3status_config['color_bad'] + + response['full_text'] = "CPU: %.2f%%" % (used_cpu_percent*100) + #cache the status for 10 seconds + response['cached_until'] = time() + 10 + + return (0, response) + + def ramInfo(self, json, i3status_config): + """calculate the memory (RAM) status and return it. + + """ + response = {'full_text': '', 'name': 'ram_info'} + total_mem, used_mem, used_mem_percent = self.data.memory() + + if used_mem_percent <= 40: + response['color'] = i3status_config['color_good'] + elif used_mem_percent <= 75: + response['color'] = i3status_config['color_degraded'] + else: + response['color'] = i3status_config['color_bad'] + + response['full_text'] = "RAM: %.2f/%.2f GB (%d%%)" % \ + (used_mem, total_mem, used_mem_percent) + response['cached_until'] = time() + + return (0, response) diff --git a/.i3/py3status/backup/weather_yahoo.py b/.i3/py3status/backup/weather_yahoo.py new file mode 100644 index 0000000..6b91b04 --- /dev/null +++ b/.i3/py3status/backup/weather_yahoo.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +from time import time +import requests + + +class Py3status: + """ + Display current day + 3 days weather forecast as icons on your i3bar + Based on Yahoo! Weather. forecast, thanks guys ! + See: http://developer.yahoo.com/weather/ + """ + def __init__(self): + """ + Basic configuration + Find your city code using: + http://answers.yahoo.com/question/index?qid=20091216132708AAf7o0g + The city_code in this example is for Paris, France + """ + self.cache_timeout = 1800 + self.city_code = 'FRXX0076' + self.request_timeout = 10 + + def _get_forecast(self): + """ + Ask Yahoo! Weather. for a forecast + """ + r = requests.get( + 'http://query.yahooapis.com/v1/public/yql?q=select item from weather.forecast where location="%s"&format=json' % self.city_code, + timeout=self.request_timeout + ) + + result = r.json() + status = r.status_code + forecasts = [] + + if status == 200: + forecasts = result['query']['results']['channel']['item']['forecast'] + # reset today + forecasts[0] = result['query']['results']['channel']['item']['condition'] + else: + raise Exception('got status {}'.format(status)) + + # return current today + 3 days forecast + return forecasts[:4] + + def _get_icon(self, forecast): + """ + Return an unicode icon based on the forecast code and text + See: http://developer.yahoo.com/weather/#codes + """ + icons = ['☀', '☁', '☂', '☃', '?'] + code = int(forecast['code']) + text = forecast['text'].lower() + + # sun + if 'sun' in text or code in [31, 32, 33, 34, 36]: + code = 0 + + # cloud / early rain + elif 'cloud' in text or code in [ + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 44 + ]: + code = 1 + + # rain + elif 'rain' in text or code in [ + 0, 1, 2, 3, 4, 5, 6, 9, + 11, 12, + 37, 38, 39, + 40, 45, 47 + ]: + code = 2 + + # snow + elif 'snow' in text or code in [ + 7, 8, + 10, 13, 14, 15, 16, 17, 18, + 35, + 41, 42, 43, 46 + ]: + code = 3 + + # dunno + else: + code = -1 + + return icons[code] + + def weather_yahoo(self, json, i3status_config): + """ + This method gets executed by py3status + """ + response = { + 'cached_until': time() + self.cache_timeout, + 'full_text': '', + 'name': 'weather_yahoo' + } + + forecasts = self._get_forecast() + for forecast in forecasts: + icon = self._get_icon(forecast) + response['full_text'] += '{} '.format(icon) + response['full_text'] = response['full_text'].strip() + + return (0, response) diff --git a/.i3/py3status/backup/whoami.py b/.i3/py3status/backup/whoami.py new file mode 100644 index 0000000..f930991 --- /dev/null +++ b/.i3/py3status/backup/whoami.py @@ -0,0 +1,26 @@ +from getpass import getuser +from time import time + + +class Py3status: + """ + Simply output the currently logged in user in i3bar. + + Inspired by i3 FAQ: + https://faq.i3wm.org/question/1618/add-user-name-to-status-bar/ + """ + def whoami(self, i3status_output_json, i3status_config): + """ + We use the getpass module to get the current user. + """ + # the current user doesnt change so much, cache it good + CACHE_TIMEOUT = 600 + + # here you can change the format of the output + # default is just to show the username + username = '{}'.format(getuser()) + + # set, cache and return the output + response = {'full_text': username, 'name': 'whoami'} + response['cached_until'] = time() + CACHE_TIMEOUT + return (0, response) diff --git a/.i3/scripts/i3exit.sh b/.i3/scripts/i3exit.sh new file mode 100755 index 0000000..3616139 --- /dev/null +++ b/.i3/scripts/i3exit.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# +# exit script used in i3 wm +# + +PNG_IMAGE="~/.i3/images/wallpaper.png" + +lock() { + if [ -f ${PNG_IMAGE} ]; then + i3lock -d -ti "${PNG_IMAGE}" + else + i3lock -d -c 000000 + fi +} + +case "$1" in + lock) + lock + ;; + logout) + i3-msg exit + ;; + suspend) + lock + dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend + ;; + hibernate) + lock + dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate + ;; + reboot) + dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart + ;; + shutdown) + dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop + ;; + *) + echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}" + exit 2 +esac + +exit 0 + diff --git a/.i3status.conf b/.i3status.conf new file mode 100644 index 0000000..972032b --- /dev/null +++ b/.i3status.conf @@ -0,0 +1,76 @@ +# ~/.i3status.conf +# i3status configuration file. +# see "man i3status" for documentation. + +# It is important that this file is edited as UTF-8. +# The following line should contain a sharp s: +# ß +# If the above line is not correctly displayed, fix your editor first! + +general { + colors = true + color_good = '#88b090' + color_degraded = '#ccdc90' + color_bad = '#e89393' + interval = 3 + # output format (i3bar|dzen2|xmobar|none) + output_format = 'i3bar' +} + +order += "volume master" +#order += "ipv6" +order += "disk /" +#order += "run_watch DHCP" +#order += "run_watch VPN" +order += "wireless wlp3s0" +order += "ethernet enp0s25" +order += "battery 0" +order += "load" +order += "tztime local" + +volume master { + format = "%volume" + device = "default" + mixer = "Master" + mixer_idx = 0 +} + +wireless wlp3s0 { + #format_up = "W: (%quality at %essid) %ip" + format_up = "%essid(%ip)" + format_down = "down" +} + +ethernet enp0s25 { + # if you use %speed, i3status requires root privileges + format_up = "E: %ip" + format_down = "E: down" +} + +battery 0 { + format = "%status %percentage %remaining" +} + +run_watch DHCP { + #pidfile = "/var/run/dhclient*.pid" + pidfile = "/var/run/dhcpd*.pid" +} + +run_watch VPN { + pidfile = "/var/run/vpnc/pid" +} + +tztime local { + #format = "%Y-%m-%d %H:%M:%S" + format = "%m-%d|%H:%M" +} + +load { + format = "%1min" +} + +disk "/" { + format = "%free" +} + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=conf: # diff --git a/.lftp/rc b/.lftp/rc new file mode 100644 index 0000000..f70b0c6 --- /dev/null +++ b/.lftp/rc @@ -0,0 +1,21 @@ +# ~/.lftp/rc +# ~/.lftprc +# +# lftp configurations +# +# Weitian LI <liweitianux@gmail.com> +# 2014/05/17 +# + +### character set {{{ +set file:charset "utf-8" +set ftp:charset "gbk" +### charset }}} + +### ssl {{{ +# fix certificate verification not trusted +set ssl:verify-certificate no +### ssl }}} + + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=lftp: # diff --git a/.mpdconf b/.mpdconf new file mode 100644 index 0000000..0f119be --- /dev/null +++ b/.mpdconf @@ -0,0 +1,493 @@ +# An example configuration file for MPD +# See the mpd.conf man page for a more detailed description of each parameter. + + +# Files and directories ####################################################### +# +# This setting controls the top directory which MPD will search to discover the +# available audio files and add them to the daemon's online database. This +# setting defaults to the XDG directory, otherwise the music directory will be +# be disabled and audio files will only be accepted over ipc socket (using +# file:// protocol) or streaming files over an accepted protocol. +# +music_directory "~/music" +# +# This setting sets the MPD internal playlist directory. The purpose of this +# directory is storage for playlists created by MPD. The server will use +# playlist files not created by the server but only if they are in the MPD +# format. This setting defaults to playlist saving being disabled. +# +playlist_directory "~/.mpd/playlists" +# +# This setting sets the location of the MPD database. This file is used to +# load the database at server start up and store the database while the +# server is not up. This setting defaults to disabled which will allow +# MPD to accept files over ipc socket (using file:// protocol) or streaming +# files over an accepted protocol. +# +db_file "~/.mpd/database" +# +# These settings are the locations for the daemon log files for the daemon. +# These logs are great for troubleshooting, depending on your log_level +# settings. +# +# The special value "syslog" makes MPD use the local syslog daemon. This +# setting defaults to logging to syslog, otherwise logging is disabled. +# +log_file "~/.mpd/log" +# +# This setting sets the location of the file which stores the process ID +# for use of mpd --kill and some init scripts. This setting is disabled by +# default and the pid file will not be stored. +# +pid_file "~/.mpd/pid" +# +# This setting sets the location of the file which contains information about +# most variables to get MPD back into the same general shape it was in before +# it was brought down. This setting is disabled by default and the server +# state will be reset on server start up. +# +state_file "~/.mpd/state" +# +# The location of the sticker database. This is a database which +# manages dynamic information attached to songs. +# +sticker_file "~/.mpd/sticker.sql" +# +############################################################################### + + +# General music daemon options ################################################ +# +# This setting specifies the user that MPD will run as. MPD should never run as +# root and you may use this setting to make MPD change its user ID after +# initialization. This setting is disabled by default and MPD is run as the +# current user. +# +#user "nobody" +# +# This setting specifies the group that MPD will run as. If not specified +# primary group of user specified with "user" setting will be used (if set). +# This is useful if MPD needs to be a member of group such as "audio" to +# have permission to use sound card. +# +#group "nogroup" +# +# This setting sets the address for the daemon to listen on. Careful attention +# should be paid if this is assigned to anything other then the default, any. +# This setting can deny access to control of the daemon. +# +# For network +#bind_to_address "any" +bind_to_address "localhost" +# +# And for Unix Socket +#bind_to_address "~/.mpd/socket" +# +# This setting is the TCP port that is desired for the daemon to get assigned +# to. +# +#port "6600" +# +# This setting controls the type of information which is logged. Available +# setting arguments are "default", "secure" or "verbose". The "verbose" setting +# argument is recommended for troubleshooting, though can quickly stretch +# available resources on limited hardware storage. +# +#log_level "default" +# +# If you have a problem with your MP3s ending abruptly it is recommended that +# you set this argument to "no" to attempt to fix the problem. If this solves +# the problem, it is highly recommended to fix the MP3 files with vbrfix +# (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which +# point gapless MP3 playback can be enabled. +# +#gapless_mp3_playback "yes" +# +# Setting "restore_paused" to "yes" puts MPD into pause mode instead +# of starting playback after startup. +# +#restore_paused "no" +restore_paused "yes" +# +# This setting enables MPD to create playlists in a format usable by other +# music players. +# +#save_absolute_paths_in_playlists "no" +# +# This setting defines a list of tag types that will be extracted during the +# audio file discovery process. The complete list of possible values can be +# found in the mpd.conf man page. +metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc" +# +# This setting enables automatic update of MPD's database when files in +# music_directory are changed. +# +auto_update "yes" +# +# Limit the depth of the directories being watched, 0 means only watch +# the music directory itself. There is no limit by default. +# +#auto_update_depth "3" +# +############################################################################### + + +# Symbolic link behavior ###################################################### +# +# If this setting is set to "yes", MPD will discover audio files by following +# symbolic links outside of the configured music_directory. +# +follow_outside_symlinks "yes" +# +# If this setting is set to "yes", MPD will discover audio files by following +# symbolic links inside of the configured music_directory. +# +follow_inside_symlinks "yes" +# +############################################################################### + + +# Zeroconf / Avahi Service Discovery ########################################## +# +# If this setting is set to "yes", service information will be published with +# Zeroconf / Avahi. +# +#zeroconf_enabled "yes" +# +# The argument to this setting will be the Zeroconf / Avahi unique name for +# this MPD server on the network. +# +#zeroconf_name "Music Player" +# +############################################################################### + + +# Permissions ################################################################# +# +# If this setting is set, MPD will require password authorization. The password +# can setting can be specified multiple times for different password profiles. +# +#password "password@read,add,control,admin" +# +# This setting specifies the permissions a user has who has not yet logged in. +# +#default_permissions "read,add,control,admin" +# +############################################################################### + + +# Input ####################################################################### +# + +input { + plugin "curl" +# proxy "proxy.isp.com:8080" +# proxy_user "user" +# proxy_password "password" +} + +# +############################################################################### + +# Audio Output ################################################################ +# +# MPD supports various audio output types, as well as playing through multiple +# audio outputs at the same time, through multiple audio_output settings +# blocks. Setting this block is optional, though the server will only attempt +# autodetection for one sound card. +# +# See <http://mpd.wikia.com/wiki/Configuration#Audio_Outputs> for examples of +# other audio outputs. +# +# An example of an ALSA output: +# +audio_output { + type "alsa" + name "My ALSA Device" +## device "hw:0,0" # optional +## format "44100:16:2" # optional +## mixer_type "hardware" # optional + mixer_type "software" # optional +## mixer_device "default" # optional +## mixer_control "PCM" # optional +## mixer_index "0" # optional +} +# +# An example of an OSS output: +# +#audio_output { +# type "oss" +# name "My OSS Device" +## device "/dev/dsp" # optional +## format "44100:16:2" # optional +## mixer_type "hardware" # optional +## mixer_device "/dev/mixer" # optional +## mixer_control "PCM" # optional +#} +# +# An example of a shout output (for streaming to Icecast): +# +#audio_output { +# type "shout" +# encoding "ogg" # optional +# name "My Shout Stream" +# host "localhost" +# port "8000" +# mount "/mpd.ogg" +# password "hackme" +# quality "5.0" +# bitrate "128" +# format "44100:16:1" +## protocol "icecast2" # optional +## user "source" # optional +## description "My Stream Description" # optional +## url "http://example.com" # optional +## genre "jazz" # optional +## public "no" # optional +## timeout "2" # optional +## mixer_type "software" # optional +#} +# +# An example of a recorder output: +# +#audio_output { +# type "recorder" +# name "My recorder" +# encoder "vorbis" # optional, vorbis or lame +# path "/var/lib/mpd/recorder/mpd.ogg" +## quality "5.0" # do not define if bitrate is defined +# bitrate "128" # do not define if quality is defined +# format "44100:16:1" +#} +# +# An example of a httpd output (built-in HTTP streaming server): +# +#audio_output { +# type "httpd" +# name "My HTTP Stream" +# encoder "vorbis" # optional, vorbis or lame +# port "8000" +# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6 +## quality "5.0" # do not define if bitrate is defined +# bitrate "128" # do not define if quality is defined +# format "44100:16:1" +# max_clients "0" # optional 0=no limit +#} +# +# An example of a pulseaudio output (streaming to a remote pulseaudio server) +# +audio_output { + type "pulse" + name "My Pulse Output" +## server "remote_server" # optional +## sink "remote_server_sink" # optional +} +# +# An example of a winmm output (Windows multimedia API). +# +#audio_output { +# type "winmm" +# name "My WinMM output" +## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional +# or +## device "0" # optional +## mixer_type "hardware" # optional +#} +# +# An example of an openal output. +# +#audio_output { +# type "openal" +# name "My OpenAL output" +## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional +#} +# +## Example "pipe" output: +# +#audio_output { +# type "pipe" +# name "my pipe" +# command "aplay -f cd 2>/dev/null" +## Or if you're want to use AudioCompress +# command "AudioCompress -m | aplay -f cd 2>/dev/null" +## Or to send raw PCM stream through PCM: +# command "nc example.org 8765" +# format "44100:16:2" +#} +# +## An example of a null output (for no audio output): +# +#audio_output { +# type "null" +# name "My Null Output" +# mixer_type "none" # optional +#} +# +##### ncmpcpp -- music visualizer ##### +## Note: In order to make music visualizer work you'll +## need to use mpd fifo output, whose format parameter +## has to be set to 44100:16:1 for mono visualization +## or 44100:16:2 for stereo visualization. Example +## configuration (it has to be put into mpd.conf): +audio_output { + type "fifo" + name "My FIFO" + path "/tmp/mpd.fifo" + format "44100:16:2" +} +# +# This setting will change all decoded audio to be converted to the specified +# format before being passed to the audio outputs. By default, this setting is +# disabled. +# +#audio_output_format "44100:16:2" +# +# If MPD has been compiled with libsamplerate support, this setting specifies +# the sample rate converter to use. Possible values can be found in the +# mpd.conf man page or the libsamplerate documentation. By default, this is +# setting is disabled. +# +#samplerate_converter "Fastest Sinc Interpolator" +# +############################################################################### + + +# Normalization automatic volume adjustments ################################## +# +# This setting specifies the type of ReplayGain to use. This setting can have +# the argument "off", "album", "track" or "auto". "auto" is a special mode that +# chooses between "track" and "album" depending on the current state of +# random playback. If random playback is enabled then "track" mode is used. +# See <http://www.replaygain.org> for more details about ReplayGain. +# This setting is off by default. +# +#replaygain "album" +# +# This setting sets the pre-amp used for files that have ReplayGain tags. By +# default this setting is disabled. +# +#replaygain_preamp "0" +# +# This setting sets the pre-amp used for files that do NOT have ReplayGain tags. +# By default this setting is disabled. +# +#replaygain_missing_preamp "0" +# +# This setting enables or disables ReplayGain limiting. +# MPD calculates actual amplification based on the ReplayGain tags +# and replaygain_preamp / replaygain_missing_preamp setting. +# If replaygain_limit is enabled MPD will never amplify audio signal +# above its original level. If replaygain_limit is disabled such amplification +# might occur. By default this setting is enabled. +# +#replaygain_limit "yes" +# +# This setting enables on-the-fly normalization volume adjustment. This will +# result in the volume of all playing audio to be adjusted so the output has +# equal "loudness". This setting is disabled by default. +# +#volume_normalization "no" +# +############################################################################### + + +# MPD Internal Buffering ###################################################### +# +# This setting adjusts the size of internal decoded audio buffering. Changing +# this may have undesired effects. Don't change this if you don't know what you +# are doing. +# +#audio_buffer_size "2048" +# +# This setting controls the percentage of the buffer which is filled before +# beginning to play. Increasing this reduces the chance of audio file skipping, +# at the cost of increased time prior to audio playback. +# +#buffer_before_play "10%" +# +############################################################################### + + +# Resource Limitations ######################################################## +# +# These settings are various limitations to prevent MPD from using too many +# resources. Generally, these settings should be minimized to prevent security +# risks, depending on the operating resources. +# +#connection_timeout "60" +#max_connections "10" +#max_playlist_length "16384" +#max_command_list_size "2048" +#max_output_buffer_size "8192" +# +############################################################################### + +# Client TCP keep alive ####################################################### +# +# For clients connected by TCP on supported platforms. +# Allows detection of dangling connections due to clients disappearing from +# the network without closing their connections. +# +# This is not usually necessary but can be useful in cases such as wifi connectected +# clients that go in and out of network range or turn off wifi without closing their +# connections. Combined with low max_connections this can soon cause clients to not +# be able to connect. +# +# +# Enable tcp keepalive on new client connections (default is "no") +# +#tcp_keep_alive "no" +# +# Time in seconds since the last communication on the connection and before +# the keepalive probing is started. (default is 7200 seconds) +#tcp_keep_alive_idle "7200" +# +# Interval in seconds between keepalive probes, once a probe started. +# (default is 75 seconds) +#tcp_keep_alive_interval "75" +# +# Number of failed probes before the connection is pronounced dead and +# the connection is closed. (default is 9 times) +#tcp_keep_alive_count "9" +# +############################################################################### + +# Character Encoding ########################################################## +# +# If file or directory names do not display correctly for your locale then you +# may need to modify this setting. +# +#filesystem_charset "UTF-8" +# +# This setting controls the encoding that ID3v1 tags should be converted from. +# +#id3v1_encoding "ISO-8859-1" +# +############################################################################### + + +# SIDPlay decoder ############################################################# +# +# songlength_database: +# Location of your songlengths file, as distributed with the HVSC. +# The sidplay plugin checks this for matching MD5 fingerprints. +# See http://www.c64.org/HVSC/DOCUMENTS/Songlengths.faq +# +# default_songlength: +# This is the default playing time in seconds for songs not in the +# songlength database, or in case you're not using a database. +# A value of 0 means play indefinitely. +# +# filter: +# Turns the SID filter emulation on or off. +# +#decoder { +# plugin "sidplay" +# songlength_database "/media/C64Music/DOCUMENTS/Songlengths.txt" +# default_songlength "120" +# filter "true" +#} +# +############################################################################### + diff --git a/.ncmpcpp/config b/.ncmpcpp/config new file mode 100644 index 0000000..5d49d70 --- /dev/null +++ b/.ncmpcpp/config @@ -0,0 +1,510 @@ +#################################################### +## this is example configuration file, copy it to ## +## ~/.ncmpcpp/config and set up your preferences ## +#################################################### +# +##### directories ###### +## +## Directory for storing ncmpcpp related files. +## Changing it is useful if you want to store +## everything somewhere else and provide command +## line setting for alternative location to config +## file which defines that while launching ncmpcpp. +## +# +#ncmpcpp_directory = "~/.ncmpcpp" +# +## +## Directory for storing downloaded lyrics. It +## defaults to ~/.lyrics since other MPD clients +## (eg. ncmpc) also use that location. +## +# +lyrics_directory = "~/.lyrics" +# +##### connection settings ##### +# +## set it in order to make tag editor and renaming files work properly +# +#mpd_host = "localhost" +# +#mpd_port = "6600" +# +mpd_music_dir = "~/music" +# +#mpd_connection_timeout = "5" +# +mpd_crossfade_time = "5" +# +#mpd_communication_mode = "notifications" (polling/notifications) +# +##### music visualizer ##### +## +## Note: In order to make music visualizer work you'll +## need to use mpd fifo output, whose format parameter +## has to be set to 44100:16:1 for mono visualization +## or 44100:16:2 for stereo visualization. Example +## configuration (it has to be put into mpd.conf): +## +## audio_output { +## type "fifo" +## name "My FIFO" +## path "/tmp/mpd.fifo" +## format "44100:16:2" +## } +## +# +## +## If you set format to 44100:16:2, make it 'yes'. +## +# +#visualizer_in_stereo = "no" +visualizer_in_stereo = "yes" +# +visualizer_fifo_path = "/tmp/mpd.fifo" +# +## +## Note: Below parameter is needed for ncmpcpp +## to determine which output provides data for +## visualizer and thus allow syncing between +## visualization and sound as currently there +## are some problems with it. +## +# +visualizer_output_name = "My FIFO" +# +## +## Note: Below parameter defines how often ncmpcpp +## has to "synchronize" visualizer and audio outputs. +## 30 seconds is optimal value, but if you experience +## synchronization problems, set it to lower value. +## Keep in mind that sane values start with >=10. +## +# +visualizer_sync_interval = "30" +# +## +## Note: To enable spectrum frequency visualization +## you need to compile ncmpcpp with fftw3 support. +## +# +#visualizer_type = "wave" (spectrum/wave) +visualizer_type = "spectrum" (spectrum/wave) +# +#visualizer_look = "◆│" +visualizer_look = "◆▋" +# +##### system encoding ##### +## +## ncmpcpp should detect your charset encoding +## but if it failed to do so, you can specify +## charset encoding you are using here. +## +## Note: You can see whether your ncmpcpp build +## supports charset detection by checking output +## of `ncmpcpp --version`. +## +## Note: Since MPD uses utf8 by default, setting +## this option makes sense only if your encoding +## is different. +## +# +#system_encoding = "" +# +##### delays ##### +# +## delay after playlist highlighting will be disabled (0 = don't disable) +# +#playlist_disable_highlight_delay = "5" +# +## defines how long various messages are supposed to be visible +# +#message_delay_time = "4" +# +##### song format ##### +## +## for song format you can use: +## +## %l - length +## %f - filename +## %D - directory +## %a - artist +## %A - album artist +## %t - title +## %b - album +## %y - year +## %n - track number (01/12 -> 01) +## %N - full track info (01/12 -> 01/12) +## %g - genre +## %c - composer +## %p - performer +## %d - disc +## %C - comment +## $R - begin right alignment +## +## you can also put them in { } and then it will be displayed +## only if all requested values are available and/or define alternate +## value with { }|{ } eg. {%a - %t}|{%f} +## +## Note: If you want to set limit on maximal length of a tag, just +## put the appropriate number between % and character that defines +## tag type, e.g. to make album take max. 20 terminal cells, use '%20b'. +## +## Note: Format that is similar to "%a - %t" (i.e. without any additional +## braces) is equal to "{%a - %t}", so if one of the tags is missing, +## you'll get nothing. +## +## text can also have different color than the main window has, +## eg. if you want length to be green, write $3%l$9 +## +## available values: +## +## - 0 - default window color (discards all other colors) +## - 1 - black +## - 2 - red +## - 3 - green +## - 4 - yellow +## - 5 - blue +## - 6 - magenta +## - 7 - cyan +## - 8 - white +## - 9 - end of current color +## +## Note: colors can be nested. +## +# +#song_list_format = "{%a - }{%t}|{$8%f$9}$R{$3(%l)$9}" +# +#song_status_format = "{{%a{ \"%b\"{ (%y)}} - }{%t}}|{%f}" +# +#song_library_format = "{%n - }{%t}|{%f}" +# +#tag_editor_album_format = "{(%y) }%b" +# +## +## Note: Below variables are for alternative version of user's interface. +## Their syntax supports all tags and colors listed above plus some extra +## markers used for text attributes. They are followed by character '$'. +## After that you can put: +## +## - b - bold text +## - u - underline text +## - r - reverse colors +## - a - use alternative character set +## +## If you don't want to use an attribute anymore, just put it again, but +## this time insert character '/' between '$' and attribute character, +## e.g. {$b%t$/b}|{$r%f$/r} will display bolded title tag or filename +## with reversed colors. +## +# +#alternative_header_first_line_format = "$b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b" +# +#alternative_header_second_line_format = "{{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}" +# +## +## Note: Below variables also supports +## text attributes listed above. +## +# +#now_playing_prefix = "$b" +# +#now_playing_suffix = "$/b" +# +#browser_playlist_prefix = "$2playlist$9 " +# +#selected_item_prefix = "$6" +# +#selected_item_suffix = "$9" +# +## colors are not supported for below variable +# +#song_window_title_format = "{%a - }{%t}|{%f}" +song_window_title_format = "{%a - }{%t}|{%f}" +# +##### columns settings ##### +## +## syntax of song columns list format is "column column etc." +## +## - syntax for each column is: +## +## (width of column)[column's color]{displayed tag} +## +## Note: Width is by default in %, if you want a column to +## have fixed size, add 'f' after the value, e.g. (10)[white]{a} +## will be the column that take 10% of screen (so the real column's +## width will depend on actual screen size), whereas (10f)[white]{a} +## will take 10 terminal cells, no matter how wide the screen is. +## +## - color is optional (if you want the default one, type []) +## +## Note: You can give a column additional attributes by putting appropriate +## character after displayed tag character. Available attributes are: +## +## - r - column will be right aligned +## - E - if tag is empty, empty tag marker won't be displayed +## +## You can also: +## +## - give a column custom name by putting it after attributes, +## separated with character ':', e.g. {lr:Length} gives you +## right aligned column of lengths named "Length". +## +## - define sequence of tags, that have to be displayed in case +## predecessor is empty in a way similar to the one in classic +## song format, i.e. using '|' character, e.g. {a|c|p:Owner} +## creates column named "Owner" that tries to display artist +## tag and then composer and performer if previous ones are +## not available. +## +# +#song_columns_list_format = "(7f)[green]{l} (25)[cyan]{a} (40)[]{t|f} (30)[red]{b}" +song_columns_list_format = "(7f)[green]{l} (25)[cyan]{a} (40)[]{t|f} (30)[magenta]{b}" +# +##### various settings ##### +# +## +## Note: Custom command that will be executed each +## time song changes. Useful for notifications etc. +## +## Attention: It doesn't support song format anymore. +## Use `ncmpcpp --now-playing SONG_FORMAT` instead. +## +#execute_on_song_change = "" +# +#playlist_show_remaining_time = "no" +# +#playlist_shorten_total_times = "no" +# +#playlist_separate_albums = "no" +# +#playlist_display_mode = "classic" (classic/columns) +playlist_display_mode = "columns" (classic/columns) +# +#browser_display_mode = "classic" (classic/columns) +browser_display_mode = "columns" (classic/columns) +# +#search_engine_display_mode = "classic" (classic/columns) +search_engine_display_mode = "columns" (classic/columns) +# +#playlist_editor_display_mode = "classic" (classic/columns) +playlist_editor_display_mode = "columns" (classic/columns) +# +#discard_colors_if_item_is_selected = "yes" +# +#incremental_seeking = "yes" +# +#seek_time = "1" +# +#autocenter_mode = "no" +autocenter_mode = "yes" +# +#centered_cursor = "no" +# +## +## Note: You can specify third character which will +## be used to build 'empty' part of progressbar. +## +#progressbar_look = "=>" +#progressbar_look = "■■□" +progressbar_look = "♪♪ " +# +#default_place_to_search_in = "database" (database/playlist) +# +#user_interface = "classic" (classic/alternative) +user_interface = "alternative" (classic/alternative) +# +#media_library_left_column = "a" (possible values: a,y,g,c,p, legend above) +# +#default_find_mode = "wrapped" (wrapped/normal) +# +#default_space_mode = "add" (add/select) +# +#default_tag_editor_left_col = "albums" (albums/dirs) +# +#default_tag_editor_pattern = "%n - %t" +# +#header_visibility = "yes" +# +#statusbar_visibility = "yes" +# +#titles_visibility = "yes" +titles_visibility = "no" +# +#header_text_scrolling = "yes" +# +#fancy_scrolling = "yes" +# +#cyclic_scrolling = "no" +# +#lines_scrolled = "2" +# +#follow_now_playing_lyrics = "no" +follow_now_playing_lyrics = "yes" +# +#fetch_lyrics_for_current_song_in_background = "no" +# +#store_lyrics_in_song_dir = "no" +# +## +## Note: If you set this variable, ncmpcpp will try to +## get info from last.fm in language you set and if it +## fails, it will fall back to english. Otherwise it will +## use english the first time. +## +## Note: Language has to be expressed as an ISO 639 alpha-2 code. +## +#lastfm_preferred_language = "" +# +#ncmpc_like_songs_adding = "no" (enabled - add/remove, disabled - always add) +# +#show_hidden_files_in_local_browser = "no" +# +#display_screens_numbers_on_start = "yes" +# +## +## How shall key_screen_switcher work? +## +## - "previous" - switch between current and last used screen +## - "sequence: 2 -> 9 -> 5" - switch between given sequence of screens. +## +## Screen numbers you can use after 'sequence' keyword are: +## +## - 1 - help +## - 2 - playlist +## - 3 - browser +## - 4 - search engine +## - 5 - media library +## - 6 - playlist editor +## - 7 - tag editor +## - 8 - outputs +## - 9 - visualizer +## - 10 - clock +## +## As you can see, above example will switch between +## playlist, visualizer and media library screens. +## +#screen_switcher_mode = "sequence: 2 -> 3" +# +## +## Default width of locked screen (in %). +## Acceptable values are from 20 to 80. +## +# +#locked_screen_width_part = "50" +# +#ask_for_locked_screen_width_part = "yes" +# +## +## Note: You can define startup screen for ncmpcpp +## by choosing screen number from the list above. +## +#startup_screen = "2" +# +#jump_to_now_playing_song_at_start = "yes" +# +#ask_before_clearing_main_playlist = "no" +# +#clock_display_seconds = "no" +# +#display_volume_level = "yes" +# +#display_bitrate = "no" +display_bitrate = "yes" +# +#display_remaining_time = "no" +# +#regular_expressions = "basic" (basic/extended) +# +## +## Note: If below is enabled, ncmpcpp will ignore leading +## "The" word while sorting items in browser, tags in +## media library, etc. +## +#ignore_leading_the = "no" +ignore_leading_the = "yes" +# +#block_search_constraints_change_if_items_found = "yes" +# +#mouse_support = "yes" +# +#mouse_list_scroll_whole_page = "yes" +# +#empty_tag_marker = "<empty>" +# +#tag_editor_extended_numeration = "no" +# +#media_library_display_date = "yes" +# +#media_library_display_empty_tag = "yes" +# +#media_library_disable_two_column_mode = "no" +# +#enable_window_title = "yes" +# +## +## Note: You can choose default search mode for search +## engine. Available modes are: +## +## - 1 - use mpd built-in searching (no regexes, pattern matching) +## - 2 - use ncmpcpp searching (pattern matching with support for regexes, +## but if your mpd is on a remote machine, downloading big database +## to process it can take a while +## - 3 - match only exact values (this mode uses mpd function for searching +## in database and local one for searching in current playlist) +## +# +#search_engine_default_search_mode = "1" +# +## +## Note: Below variables can allow you to physically +## remove files and directories from your hdd using +## ncmpcpp's browser screen. +## +# +#allow_physical_files_deletion = "no" +# +#allow_physical_directories_deletion = "no" +# +#external_editor = "" +external_editor = "vim" +# +#use_console_editor = "no" (set to yes, if your editor is console app) +use_console_editor = "yes" +# +##### colors definitions ##### +# +#colors_enabled = "yes" +# +#empty_tag_color = "cyan" +# +#header_window_color = "default" +# +#volume_color = "default" +# +#state_line_color = "default" +# +#state_flags_color = "default" +# +#main_window_color = "yellow" +# +#color1 = "white" +# +#color2 = "green" +# +#main_window_highlight_color = "yellow" +# +#progressbar_color = "default" +# +#statusbar_color = "default" +# +#alternative_ui_separator_color = "black" +# +#active_column_color = "red" +# +#visualizer_color = "yellow" +# +#window_border_color = "green" +# +#active_window_border = "red" +# diff --git a/.ncmpcpp/keys b/.ncmpcpp/keys new file mode 100644 index 0000000..a88498f --- /dev/null +++ b/.ncmpcpp/keys @@ -0,0 +1,188 @@ +##################################################### +## this is example key configuration file, copy it ## +## to ~/.ncmpcpp/keys and set up your preferences ## +##################################################### +## +## Tips: +## - it's possible to bind maximum two keys to a command +## - keys can be defined with a character or a decimal value +## - a command can be disabled by binding it to 0 +## +## Note: First bind of volume_up/down +## will be used to switch between columns. +## +# +#key_up = 259 'k' +# +#key_down = 258 'j' +# +#key_up_album = '[' +# +#key_down_album = ']' +# +#key_up_artist = '{' +# +#key_down_artist = '}' +# +#key_page_up = 339 +# +#key_page_down = 338 +# +#key_home = 262 +# +#key_end = 360 +# +#key_space = 32 +# +#key_enter = 10 +# +#key_delete = 330 'd' +# +#key_volume_up = 261 '+' +# +#key_volume_down = 260 '-' +# +#key_prev_column = 260 +# +#key_next_column = 261 +# +#key_toggle_space_mode = 't' +# +#key_toggle_add_mode = 'T' +# +#key_toggle_mouse = '|' +# +#key_toggle_bitrate_visibility = '#' +# +#key_screen_switcher = 9 +# +#key_backward_screen_switcher = 353 +# +#key_help = '1' 265 +# +#key_playlist = '2' 266 +# +#key_browser = '3' 267 +# +#key_search_engine = '4' 268 +# +#key_media_library = '5' 269 +# +#key_playlist_editor = '6' 270 +# +#key_tag_editor = '7' 271 +# +#key_outputs = '8' 272 +# +#key_music_visualizer = '9' 273 +# +#key_clock = '0' 274 +# +#key_server_info = '@' +# +#key_stop = 's' +# +#key_pause = 'P' +key_pause = 'p' +# +#key_next = '>' +# +#key_prev = '<' +# +#key_replay = 263 127 +# +#key_seek_forward = 'f' +# +#key_seek_backward = 'b' +# +#key_toggle_repeat = 'r' +# +#key_toggle_random = 'z' +# +#key_toggle_single = 'y' +# +#key_toggle_consume = 'R' +# +#key_toggle_replay_gain_mode = 'Y' +# +#key_shuffle = 'Z' +# +#key_toggle_crossfade = 'x' +# +#key_set_crossfade = 'X' +# +#key_update_db = 'u' +# +#key_sort_playlist = 22 +# +#key_apply_filter = 6 +# +#key_find_forward = '/' +# +#key_find_backward = '?' +# +#key_next_found_position = '.' +# +#key_prev_found_position = ',' +# +#key_toggle_find_mode = 'w' +# +#key_edit_tags = 'e' +# +#key_go_to_position = 'g' +# +#key_song_info = 'i' +# +#key_artist_info = 'I' +# +#key_lyrics = 'l' +# +#key_reverse_selection = 'v' +# +#key_deselect_all = 'V' +# +#key_select_album = 'B' +# +#key_add_selected_items = 'A' +# +#key_clear = 'c' +# +#key_crop = 'C' +# +#key_move_song_up = 'm' +# +#key_move_song_down = 'n' +# +#key_move_to = 'M' +# +#key_move_before = 0 +# +#key_move_after = 0 +# +#key_add = 'a' +# +#key_save_playlist = 'S' +# +#key_go_to_now_playing = 'o' +# +#key_toggle_auto_center = 'U' +# +#key_toggle_display_mode = 'p' +key_toggle_display_mode = 'P' +# +#key_toggle_separators_in_playlist = '!' +# +#key_toggle_lyrics_db = 'L' +# +#key_toggle_fetching_lyrics_for_current_song_in_background = 'F' +# +#key_go_to_containing_directory = 'G' +# +#key_go_to_media_library = '~' +# +#key_go_to_parent_dir = 263 127 +# +#key_switch_tag_type_list = '`' +# +#key_quit = 'q' 'Q' +# diff --git a/.profile b/.profile new file mode 100644 index 0000000..09bef4a --- /dev/null +++ b/.profile @@ -0,0 +1,34 @@ +########################################################### +# ~/.profile +# +########################################################### + +###### locale ###### +export LANG="en_US.utf8" +export LC_CTYPE="zh_CN.utf8" +export LC_COLLATE="C" + +###### input method ###### +export XMODIFIERS="@im=fcitx" +export INPUT_METHOD="fcitx" +export GTK_IM_MODULE="fcitx" +export GTK3_IM_MODULE="fcitx" +export QT_IM_MODULE="fcitx" +export QT4_IM_MODULE="fcitx" + +###### PATH ###### +# $HOME/bin +export PATH=$HOME/bin:$PATH +# TeXlive +export PATH=$PATH:/usr/local/texlive/bin/x86_64-linux +# admin +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin + +###### gpg agent ###### +eval "$(gpg-agent --daemon)" + +# This file is sourced by bash for login shells. The following line +# runs your .bashrc and is recommended by the bash info pages. +[ -f ~/.bashrc ] && . ~/.bashrc + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=sh: # @@ -0,0 +1,23 @@ +;;; ~/.sbclrc + +;;; The following lines added by ql:add-to-init-file: +#-quicklisp +(let ((quicklisp-init (merge-pathnames "~/.quicklisp/setup.lisp" + (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) + +;;; http://common-lisp.net/project/linedit/ +;;; Check for --no-linedit command-line option. +(if (member "--no-linedit" sb-ext:*posix-argv* :test 'equal) + (setf sb-ext:*posix-argv* + (remove "--no-linedit" sb-ext:*posix-argv* :test 'equal)) + (when (interactive-stream-p *terminal-io*) + (require :sb-aclrepl) + (require :linedit) + (funcall (intern "INSTALL-REPL" :linedit) :wrap-current t))) + +;;; https://gist.github.com/bdsatish/5403002 +;; Don't break into debugger, but just display error message and return to top-level loop (REPL) +(setf *debugger-hook* #'(lambda (c h) (declare (ignore h)) (print c) (abort))) + diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..8a7d291 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,91 @@ +## +## tmux config file +## +## LY4ever +## 3/15/2011 +## + +######################################################################### +## BINDINGS ## +######################################################################### +## change escape to c-a +#set-option -g prefix C-a +#unbind-key C-b +#bind-key C-a send-prefix + +## switch between windows +bind-key -n C-p previous-window +bind-key -n C-n next-window + +## C-c also create new window, like in screen +bind-key C-c new-window + +## More straight forward key bindings for splitting +unbind % +bind | split-window -h +unbind '"' +bind - split-window -v + +## Move between the split windows +bind k selectp -U +bind j selectp -D +bind h selectp -L +bind l selectp -R + +## resize the windows +bind C-k resizep -U 10 +bind C-j resizep -D 10 +bind C-h resizep -L 10 +bind C-l resizep -R 10 + +## extra bindings +bind m command-prompt "splitw -h 'exec man %%'" +bind @ command-prompt "splitw -h 'exec perldoc -f %%'" +######################################################################### + +######################################################################### +## SETTINGS ## +######################################################################### +## Use Vi mode +set-window-option -g mode-keys vi +set-option -g status-keys vi + +## use xterm function key sequence +set-window-option -g xterm-keys on + +## Notifying if other windows has activities +set-option -g visual-activity on +set-window-option -g monitor-activity off + +## Terminal emulator window title +## set it to off so that we can use zsh to operate it +#setw -g automatic-rename off + +## utf8 +set-window-option -g utf8 on + +## altscreen +set-window-option -g alternate-screen on + +## terminal overrides +#set-option -g terminal-overrides "*88col*:colors=88,*256col*:colors=256,xterm*:colors=256" +#set -g default-terminal "rxvt-256color" + +## start index from 1 +set-option -g base-index 1 + +## Set status bar +set-option -g display-time 3000 +set-option -g repeat-time 1000 +set-option -g status-utf8 on +set-option -g status-justify centre +set-option -g status-bg default +set-option -g status-left "#[fg=white,bold]:: #[fg=red][ #[fg=colour227]#H #[fg=red]]#[default]" +set-option -g status-left-length 25 +set-option -g status-right-length 25 +set-option -g status-right "#[fg=red][ #[fg=colour154]%H:%M #[fg=colour183]%a %m/%d #[fg=red]] #[fg=white,bold]::#[default]" +set-window-option -g window-status-format '#[fg=blue,bold]#I #T#[default] ' +set-window-option -g window-status-current-format '#[fg=blue,bold,reverse]#I #T#[default] ' +######################################################################### + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=conf: # diff --git a/.urxvt/ext/LICENSE b/.urxvt/ext/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/.urxvt/ext/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/.urxvt/ext/README.md b/.urxvt/ext/README.md new file mode 100644 index 0000000..b800ed3 --- /dev/null +++ b/.urxvt/ext/README.md @@ -0,0 +1,107 @@ +A small collection of perl extensions for the rxvt-unicode terminal emulator. + +Installation +------------ +Simply place the scripts you want to install in /usr/lib/urxvt/perl/ for +system-wide availability or in ~/.urxvt/ext/ for user-only availability. +You can also put them in a folder of your choice, but then you have to add this +line to your .Xdefaults/.Xresources: + + URxvt.perl-lib: /your/folder/ + +See the following sections for information on how to enable the scripts or set +script-specific options and keyboard mappings in your .Xdefaults/.Xresources. + + +keyboard-select +--------------- +Use keyboard shortcuts to select and copy text. + +After installing, put the following lines in your .Xdefaults/.Xresources: + + URxvt.perl-ext-common: ...,keyboard-select + URxvt.keysym.M-Escape: perl:keyboard-select:activate + +The following line overwrites the default Meta-s binding and allows to activate +keyboard-select directly in backward search mode: + + URxvt.keysym.M-s: perl:keyboard-select:search + +Use Meta-Escape to activate selection mode, then use the following keys: + + h/j/k/l: Move cursor left/down/up/right (also with arrow keys) + g/G/0/^/$/H/M/L/f/F/;/,/w/W/b/B/e/E: More vi-like cursor movement keys + '/'/?: Start forward/backward search + n/N: Repeat last search, N: in reverse direction + Ctrl-f/b: Scroll down/up one screen + Ctrl-d/u: Scroll down/up half a screen + v/V/Ctrl-v: Toggle normal/linewise/blockwise selection + y/Return: Copy selection to primary buffer, Return: deactivate afterwards + q/Escape: Deactivate keyboard selection mode + + +url-select +---------- +Use keyboard shortcuts to select URLs. + +This should be used as a replacement for the default matcher extension, it also +makes URLs clickable with the middle mouse button. + +After installing, put the following lines in your .Xdefaults/.Xresources: + + URxvt.perl-ext-common: ...,url-select + URxvt.keysym.M-u: perl:url-select:select_next + +Use Meta-u to activate URL selection mode, then use the following keys: + + j/k: Select next downward/upward URL (also with arrow keys) + g/G: Select first/last URL (also with home/end key) + o/Return: Open selected URL in browser, Return: deactivate afterwards + y: Copy (yank) selected URL and deactivate selection mode + q/Escape: Deactivate URL selection mode + +Options: + + URxvt.url-select.autocopy: if set to true, selected URLs are automatically + copied to the PRIMARY buffer + URxvt.url-select.button: mouse button to click-open URLs (default: 2) + URxvt.url-select.launcher: browser/command to open selected URL with + URxvt.url-select.underline: if set to true, all URLs get underlined + +For compatibility reasons, url-select will also use any patterns defined for +the matcher extension by reading all `URxvt.matcher.pattern.[0-9]` resources. + + +clipboard +--------- +Use keyboard shortcuts to copy the selection to the clipboard and to paste the +clipboard contents (optionally escaping all special characters). + +After installing, put the following lines in your .Xdefaults/.Xresources: + + URxvt.perl-ext-common: ...,clipboard + URxvt.keysym.M-c: perl:clipboard:copy + URxvt.keysym.M-v: perl:clipboard:paste + URxvt.keysym.M-C-v: perl:clipboard:paste_escaped + +Options: + URxvt.clipboard.autocopy: if set to true, the clipboard is automatically + updated whenever the PRIMARY selection changes + +You can also overwrite the system commands to use for copying/pasting. +The default ones are: + + URxvt.clipboard.copycmd: xsel -ib + URxvt.clipboard.pastecmd: xsel -ob + +If you prefer xclip, then put these lines in your .Xdefaults/.Xresources: + + URxvt.clipboard.copycmd: xclip -i -selection clipboard + URxvt.clipboard.pastecmd: xclip -o -selection clipboard + +On Mac OS X, put these lines in your .Xdefaults/.Xresources: + + URxvt.clipboard.copycmd: pbcopy + URxvt.clipboard.pastecmd: pbpaste + +The use of the functions should be self-explanatory! diff --git a/.urxvt/ext/clipboard b/.urxvt/ext/clipboard new file mode 100644 index 0000000..8e71792 --- /dev/null +++ b/.urxvt/ext/clipboard @@ -0,0 +1,109 @@ +#! perl -w +# Author: Bert Muennich +# Website: http://www.github.com/muennich/urxvt-perls +# License: GPLv2 + +# Use keyboard shortcuts to copy the selection to the clipboard and to paste +# the clipboard contents (optionally escaping all special characters). +# Requires xsel to be installed! + +# Usage: put the following lines in your .Xdefaults/.Xresources: +# URxvt.perl-ext-common: ...,clipboard +# URxvt.keysym.M-c: perl:clipboard:copy +# URxvt.keysym.M-v: perl:clipboard:paste +# URxvt.keysym.M-C-v: perl:clipboard:paste_escaped + +# Options: +# URxvt.clipboard.autocopy: If true, PRIMARY overwrites clipboard + +# You can also overwrite the system commands to use for copying/pasting. +# The default ones are: +# URxvt.clipboard.copycmd: xsel -ib +# URxvt.clipboard.pastecmd: xsel -ob +# If you prefer xclip, then put these lines in your .Xdefaults/.Xresources: +# URxvt.clipboard.copycmd: xclip -i -selection clipboard +# URxvt.clipboard.pastecmd: xclip -o -selection clipboard +# On Mac OS X, put these lines in your .Xdefaults/.Xresources: +# URxvt.clipboard.copycmd: pbcopy +# URxvt.clipboard.pastecmd: pbpaste + +# The use of the functions should be self-explanatory! + +use strict; + +sub on_start { + my ($self) = @_; + + $self->{copy_cmd} = $self->x_resource('clipboard.copycmd') || 'xsel -ib'; + $self->{paste_cmd} = $self->x_resource('clipboard.pastecmd') || 'xsel -ob'; + + if ($self->x_resource('clipboard.autocopy') eq 'true') { + $self->enable(sel_grab => \&sel_grab); + } + + () +} + +sub copy { + my ($self) = @_; + + if (open(CLIPBOARD, "| $self->{copy_cmd}")) { + my $sel = $self->selection(); + utf8::encode($sel); + print CLIPBOARD $sel; + close(CLIPBOARD); + } else { + print STDERR "error running '$self->{copy_cmd}': $!\n"; + } + + () +} + +sub paste { + my ($self) = @_; + + my $str = `$self->{paste_cmd}`; + if ($? == 0) { + $self->tt_paste($str); + } else { + print STDERR "error running '$self->{paste_cmd}': $!\n"; + } + + () +} + +sub paste_escaped { + my ($self) = @_; + + my $str = `$self->{paste_cmd}`; + if ($? == 0) { + $str =~ s/([!#\$%&\*\(\) ='"\\\|\[\]`~,<>\?])/\\\1/g; + $self->tt_paste($str); + } else { + print STDERR "error running '$self->{paste_cmd}': $!\n"; + } + + () +} + +sub on_user_command { + my ($self, $cmd) = @_; + + if ($cmd eq "clipboard:copy") { + $self->copy; + } elsif ($cmd eq "clipboard:paste") { + $self->paste; + } elsif ($cmd eq "clipboard:paste_escaped") { + $self->paste_escaped; + } + + () +} + +sub sel_grab { + my ($self) = @_; + + $self->copy; + + () +} diff --git a/.urxvt/ext/keyboard-select b/.urxvt/ext/keyboard-select new file mode 100644 index 0000000..d9f16bf --- /dev/null +++ b/.urxvt/ext/keyboard-select @@ -0,0 +1,567 @@ +#! perl -w +# Author: Bert Muennich +# Website: http://www.github.com/muennich/urxvt-perls +# License: GPLv2 + +# Use keyboard shortcuts to select and copy text. + +# Usage: put the following lines in your .Xdefaults/.Xresources: +# URxvt.perl-ext-common: ...,keyboard-select +# URxvt.keysym.M-Escape: perl:keyboard-select:activate +# The following line overwrites the default Meta-s binding and allows to +# activate keyboard-select directly in backward search mode: +# URxvt.keysym.M-s: perl:keyboard-select:search + +# Use Meta-Escape to activate selection mode, then use the following keys: +# h/j/k/l: Move cursor left/down/up/right (also with arrow keys) +# g/G/0/^/$/H/M/L/f/F/;/,/w/W/b/B/e/E: More vi-like cursor movement keys +# '/'/?: Start forward/backward search +# n/N: Repeat last search, N: in reverse direction +# Ctrl-f/b: Scroll down/up one screen +# Ctrl-d/u: Scroll down/up half a screen +# v/V/Ctrl-v: Toggle normal/linewise/blockwise selection +# y/Return: Copy selection to primary buffer, Return: deactivate afterwards +# q/Escape: Deactivate keyboard selection mode + + +use strict; + +sub on_start{ + my ($self) = @_; + + $self->{patterns}{'w'} = qr/\w[^\w\s]|\W\w|\s\S/; + $self->{patterns}{'W'} = qr/\s\S/; + $self->{patterns}{'b'} = qr/.*(?:\w[^\w\s]|\W\w|\s\S)/; + $self->{patterns}{'B'} = qr/.*\s\S/; + $self->{patterns}{'e'} = qr/[^\w\s](?=\w)|\w(?=\W)|\S(?=\s|$)/; + $self->{patterns}{'E'} = qr/\S(?=\s|$)/; + + () +} + + +sub on_user_command { + my ($self, $cmd) = @_; + + if (not $self->{active}) { + if ($cmd eq 'keyboard-select:activate') { + activate($self); + } elsif ($cmd eq 'keyboard-select:search') { + activate($self, 1); + } + } + + () +} + + +sub key_press { + my ($self, $event, $keysym, $char) = @_; + my $key = chr($keysym); + + if (lc($key) eq 'c' && $event->{state} & urxvt::ControlMask) { + deactivate($self); + } elsif ($self->{search}) { + if ($keysym == 0xff1b) { + if ($self->{search_mode}) { + deactivate($self); + } else { + $self->{search} = ''; + status_area($self); + } + } elsif ($keysym == 0xff08) { + $self->{search} = substr($self->{search}, 0, -1); + if (not $self->{search} and $self->{search_mode}) { + deactivate($self); + } else { + status_area($self); + } + } elsif ($keysym == 0xff0d) { + my $txt = substr($self->{search}, 1); + if ($txt) { + $self->{pattern} = ($txt =~ m/[[:upper:]]/) ? qr/\Q$txt\E/ : + qr/\Q$txt\E/i; + } elsif ($self->{pattern}) { + delete $self->{pattern}; + } + $self->{search} = ''; + if (not find_next($self)) { + if ($self->{search_mode}) { + deactivate($self); + } else { + status_area($self); + } + } + } elsif (length($char) > 0) { + $self->{search} .= $self->locale_decode($char); + status_area($self); + } + } elsif ($self->{move_to}) { + if ($keysym == 0xff1b) { + $self->{move_to} = 0; + status_area($self); + } elsif (length($char) > 0) { + $self->{move_to} = 0; + $self->{patterns}{'f-1'} = qr/^.*\Q$key\E/; + $self->{patterns}{'f+1'} = qr/^.+?\Q$key\E/; + move_to($self, ';'); + status_area($self); + } + } elsif ($keysym == 0xff1b || lc($key) eq 'q') { + deactivate($self); + } elsif ($key eq 'y' || $keysym == 0xff0d) { + if ($self->{select}) { + if ($self->{select} eq 'b') { + $self->selection($self->{selection}); + $self->selection_grab($event->{time}); + } else { + my ($br, $bc, $er, $ec) = calc_span($self); + $ec = $self->line($er)->l if $self->{select} eq 'l'; + $self->selection_beg($br, $bc); + $self->selection_end($er, $ec); + $self->selection_make($event->{time}); + } + if ($key eq 'y') { + if ($self->{select} ne 'b') { + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + } + $self->{select} = ''; + status_area($self); + $self->want_refresh(); + } else { + deactivate($self); + } + } + } elsif ($key eq 'V') { + toggle_select($self, 'l'); + } elsif ($key eq 'v') { + if ($event->{state} & urxvt::ControlMask) { + toggle_select($self, 'b'); + } else { + toggle_select($self, 'n'); + } + } elsif ($key eq 'k' || $keysym == 0xff52) { + move_cursor($self, 'k'); + } elsif ($key eq 'j' || $keysym == 0xff54) { + move_cursor($self, 'j'); + } elsif ($key eq 'h' || $keysym == 0xff51) { + move_cursor($self, 'h'); + } elsif ($key eq 'l' || $keysym == 0xff53) { + move_cursor($self, 'l'); + } elsif ('gG0^$HML' =~ m/\Q$key\E/ || + ('fbdu' =~ m/\Q$key\E/ && $event->{state} & urxvt::ControlMask)) { + move_cursor($self, $key); + } elsif (lc($key) eq 'f') { + $self->{move_to} = 1; + $self->{move_dir} = $key eq 'F' ? -1 : 1; + status_area($self, $key); + } elsif (';,wWbBeE' =~ m/\Q$key\E/) { + move_to($self, $key); + } elsif ($key eq '/' || $key eq '?') { + $self->{search} = $key; + $self->{search_dir} = $key eq '?' ? -1 : 1; + status_area($self); + } elsif (lc($key) eq 'n') { + find_next($self, $self->{search_dir} * ($key eq 'N' ? -1 : 1)); + } + + return 1; +} + + +sub move_cursor { + my ($self, $key) = @_; + my ($cr, $cc) = $self->screen_cur(); + my $line = $self->line($cr); + + if ($key eq 'k' && $line->beg > $self->top_row) { + $cr = $line->beg - 1; + } elsif ($key eq 'j' && $line->end < $self->nrow - 1) { + $cr = $line->end + 1; + } elsif ($key eq 'h' && $self->{offset} > 0) { + $self->{offset} = $line->offset_of($cr, $cc) - 1; + $self->{dollar} = 0; + } elsif ($key eq 'l' && $self->{offset} < $line->l - 1) { + ++$self->{offset}; + } elsif ($key eq 'f' || $key eq 'd') { + my $vs = $self->view_start() + + ($key eq 'd' ? $self->nrow / 2 : $self->nrow - 1); + $vs = 0 if $vs > 0; + $cr += $vs - $self->view_start($vs); + } elsif ($key eq 'b' || $key eq 'u') { + my $vs = $self->view_start() - + ($key eq 'u' ? $self->nrow / 2 : $self->nrow - 1); + $vs = $self->top_row if $vs < $self->top_row; + $cr += $vs - $self->view_start($vs); + } elsif ($key eq 'g') { + ($cr, $self->{offset}) = ($self->top_row, 0); + $self->{dollar} = 0; + } elsif ($key eq 'G') { + ($cr, $self->{offset}) = ($self->nrow - 1, 0); + $self->{dollar} = 0; + } elsif ($key eq '0') { + $self->{offset} = 0; + $self->{dollar} = 0; + } elsif ($key eq '^') { + my $ltxt = $self->special_decode($line->t); + while ($ltxt =~ s/^( *)\t/$1 . " " x (8 - length($1) % 8)/e) {} + $self->{offset} = $ltxt =~ m/^ +/ ? $+[0] : 0; + $self->{dollar} = 0; + } elsif ($key eq '$') { + my $co = $line->offset_of($cr, $cc); + $self->{dollar} = $co + 1; + $self->{offset} = $line->l - 1; + } elsif ($key eq 'H') { + $cr = $self->view_start(); + } elsif ($key eq 'M') { + $cr = $self->view_start() + $self->nrow / 2; + } elsif ($key eq 'L') { + $cr = $self->view_start() + $self->nrow - 1; + } + + $line = $self->line($cr); + $cc = $self->{dollar} || $self->{offset} >= $line->l ? $line->l - 1 : + $self->{offset}; + $self->screen_cur($line->coord_of($cc)); + + status_area($self); + $self->want_refresh(); + + () +} + + +sub move_to { + my ($self, $key) = @_; + my ($cr, $cc) = $self->screen_cur(); + my $line = $self->line($cr); + my $offset = $self->{offset}; + my ($dir, $pattern); + my ($wrap, $found) = (0, 0); + + if ($key eq ';' || $key eq ',') { + $dir = $self->{move_dir} * ($key eq ',' ? -1 : 1); + $pattern = $self->{patterns}{sprintf('f%+d', $dir)}; + return if not $pattern; + } else { + if (lc($key) eq 'b') { + $dir = -1; + } else { + $dir = 1; + ++$offset if lc($key) eq 'e'; + } + $pattern = $self->{patterns}{$key}; + $wrap = 1; + } + + if ($dir > 0) { + NEXTDOWN: my $text = substr($line->t, $offset); + if ($text =~ m/$pattern/) { + $offset += $+[0] - 1; + $found = 1; + } elsif ($wrap && $line->end + 1 < $self->nrow) { + $cr = $line->end + 1; + $line = $self->line($cr); + $offset = 0; + if (lc($key) eq 'e') { + goto NEXTDOWN; + } else { + $found = 1; + } + } + } elsif ($dir < 0) { + NEXTUP: my $text = substr($line->t, 0, $offset); + if ($text =~ m/$pattern/) { + $offset += $+[0] - length($text) - 1; + $found = 1; + } elsif ($wrap) { + if ($offset > 0) { + $offset = 0; + $found = 1; + } elsif ($line->beg > $self->top_row) { + $cr = $line->beg - 1; + $line = $self->line($cr); + $offset = $line->l; + goto NEXTUP; + } + } + } + + if ($found) { + $self->{dollar} = 0; + $self->{offset} = $offset; + $self->screen_cur($line->coord_of($offset)); + $self->want_refresh(); + } + + () +} + + +sub find_next { + my ($self, $dir) = @_; + + return if not $self->{pattern}; + $dir = $self->{search_dir} if not $dir; + + my ($cr, $cc) = $self->screen_cur(); + my $line = $self->line($cr); + my $offset = $line->offset_of($cr, $cc); + my $text; + my $found = 0; + + ++$offset if $dir > 0; + + while (not $found) { + if ($dir > 0) { + $text = substr($line->t, $offset); + if ($text =~ m/$self->{pattern}/) { + $found = 1; + $offset += $-[0]; + } else { + last if $line->end >= $self->nrow; + $line = $self->line($line->end + 1); + $offset = 0; + } + } else { + $text = substr($line->t, 0, $offset); + if ($text =~ m/$self->{pattern}/) { + $found = 1; + $offset = $-[0] while $text =~ m/$self->{pattern}/g; + } else { + last if $line->beg <= $self->top_row; + $line = $self->line($line->beg - 1); + $offset = $line->l; + } + } + } + + if ($found) { + $self->{dollar} = 0; + $self->{offset} = $offset; + $self->screen_cur($line->coord_of($offset)); + status_area($self); + $self->want_refresh(); + } + + return $found; +} + + +sub tt_write { + return 1; +} + + +sub refresh { + my ($self) = @_; + my $reverse_cursor = $self->{select} ne 'l'; + my ($cr, $cc) = $self->screen_cur(); + + if ($self->{select}) { + my ($br, $bc, $er, $ec) = calc_span($self); + + if ($self->{select} eq 'b') { + delete $self->{selection} if $self->{selection}; + my $co = $self->line($cr)->offset_of($cr, $cc); + my $dollar = $self->{dollar} && $co >= $self->{dollar} - 1; + + my $r = $br; + while ($r <= $er) { + my $line = $self->line($r); + if ($bc < $line->l) { + $ec = $line->l if $dollar; + $self->{selection} .= substr($line->t, $bc, $ec - $bc); + my ($br, $bc) = $line->coord_of($bc); + my ($er, $ec) = $line->coord_of($ec <= $line->l ? $ec : $line->l); + $self->scr_xor_span($br, $bc, $er, $ec, urxvt::RS_RVid); + } elsif ($r == $cr) { + $reverse_cursor = 0; + } + $self->{selection} .= "\n" if $line->end < $er; + $r = $line->end + 1; + } + } else { + $self->scr_xor_span($br, $bc, $er, $ec, urxvt::RS_RVid); + } + + if ($reverse_cursor) { + # make the cursor visible again + $self->scr_xor_span($cr, $cc, $cr, $cc + 1, urxvt::RS_RVid); + } + } + + # scroll the current cursor position into visible area + if ($cr < $self->view_start()) { + $self->view_start($cr); + } elsif ($cr >= $self->view_start() + $self->nrow) { + $self->view_start($cr - $self->nrow + 1); + } + + () +} + + +sub activate { + my ($self, $search) = @_; + + $self->{active} = 1; + + $self->{select} = ''; + $self->{dollar} = 0; + $self->{move_to} = 0; + + if ($search) { + $self->{search} = '?'; + $self->{search_dir} = -1; + $self->{search_mode} = 1; + } else { + $self->{search} = ''; + $self->{search_mode} = 0; + } + + ($self->{oldcr}, $self->{oldcc}) = $self->screen_cur(); + $self->{old_view_start} = $self->view_start(); + $self->{old_pty_ev_events} = $self->pty_ev_events(urxvt::EV_NONE); + + my $line = $self->line($self->{oldcr}); + $self->{offset} = $line->offset_of($self->{oldcr}, $self->{oldcc}); + + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + + $self->enable( + key_press => \&key_press, + refresh_begin => \&refresh, + refresh_end => \&refresh, + tt_write => \&tt_write, + ); + + if ($self->{offset} >= $line->l) { + $self->{offset} = $line->l > 0 ? $line->l - 1 : 0; + $self->screen_cur($line->coord_of($self->{offset})); + $self->want_refresh(); + } + + $self->{overlay_len} = 0; + status_area($self); + + () +} + + +sub deactivate { + my ($self) = @_; + + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + + delete $self->{overlay} if $self->{overlay}; + delete $self->{selection} if $self->{selection}; + + $self->disable("key_press", "refresh_begin", "refresh_end", "tt_write"); + $self->screen_cur($self->{oldcr}, $self->{oldcc}); + $self->view_start($self->{old_view_start}); + $self->pty_ev_events($self->{old_pty_ev_events}); + + $self->want_refresh(); + + $self->{active} = 0; + + () +} + + +sub status_area { + my ($self, $extra) = @_; + my ($stat, $stat_len); + + if ($self->{search}) { + $stat_len = $self->ncol; + $stat = $self->{search} . ' ' x ($stat_len - length($self->{search})); + } else { + if ($self->{select}) { + $stat = "-V" . ($self->{select} ne 'n' ? uc($self->{select}) : "") . "- "; + } + + if ($self->top_row == 0) { + $stat .= "All"; + } elsif ($self->view_start() == $self->top_row) { + $stat .= "Top"; + } elsif ($self->view_start() == 0) { + $stat .= "Bot"; + } else { + $stat .= sprintf("%2d%%", + ($self->top_row - $self->view_start) * 100 / $self->top_row); + } + + $stat = "$extra $stat" if $extra; + $stat_len = length($stat); + } + + if (!$self->{overlay} || $self->{overlay_len} != $stat_len) { + delete $self->{overlay} if $self->{overlay}; + $self->{overlay} = $self->overlay(-1, -1, $stat_len, 1, + urxvt::OVERLAY_RSTYLE, 0); + $self->{overlay_len} = $stat_len; + } + + $self->{overlay}->set(0, 0, $self->special_encode($stat)); + $self->{overlay}->show(); + + () +} + + +sub toggle_select { + my ($self, $mode) = @_; + + if ($self->{select} eq $mode) { + $self->{select} = ''; + } else { + if (not $self->{select}) { + ($self->{ar}, $self->{ac}) = $self->screen_cur(); + } + $self->{select} = $mode; + } + + status_area($self); + $self->want_refresh(); + + () +} + + +sub calc_span { + my ($self) = @_; + my ($cr, $cc) = $self->screen_cur(); + my ($br, $bc, $er, $ec); + + if ($self->{select} eq 'b') { + $br = $self->line($cr)->beg; + $bc = $self->line($cr)->offset_of($cr, $cc); + $er = $self->line($self->{ar})->beg; + $ec = $self->line($self->{ar})->offset_of($self->{ar}, $self->{ac}); + ($br, $er) = ($er, $br) if $br > $er; + ($bc, $ec) = ($ec, $bc) if $bc > $ec; + } else { + if ($cr < $self->{ar}) { + ($br, $bc, $er, $ec) = ($cr, $cc, $self->{ar}, $self->{ac}); + } elsif ($cr > $self->{ar}) { + ($br, $bc, $er, $ec) = ($self->{ar}, $self->{ac}, $cr, $cc); + } else { + ($br, $er) = ($cr, $cr); + ($bc, $ec) = $cc < $self->{ac} ? ($cc, $self->{ac}) : ($self->{ac}, $cc); + } + } + + if ($self->{select} eq 'l') { + ($br, $er) = ($self->line($br)->beg, $self->line($er)->end); + ($bc, $ec) = (0, $self->ncol); + } else { + ++$ec; + } + + return ($br, $bc, $er, $ec); +} diff --git a/.urxvt/ext/url-select b/.urxvt/ext/url-select new file mode 100644 index 0000000..f4ddda8 --- /dev/null +++ b/.urxvt/ext/url-select @@ -0,0 +1,375 @@ +#! perl -w +# Author: Bert Muennich +# Website: http://www.github.com/muennich/urxvt-perls +# Based on: http://www.jukie.net/~bart/blog/urxvt-url-yank +# License: GPLv2 + +# Use keyboard shortcuts to select URLs. +# This should be used as a replacement for the default matcher extension, +# it also makes URLs clickable with the middle mouse button. + +# Usage: put the following lines in your .Xdefaults/.Xresources: +# URxvt.perl-ext-common: ...,url-select +# URxvt.keysym.M-u: perl:url-select:select_next + +# Use Meta-u to activate URL selection mode, then use the following keys: +# j/k: Select next downward/upward URL (also with arrow keys) +# g/G: Select first/last URL (also with home/end key) +# o/Return: Open selected URL in browser, Return: deactivate afterwards +# y: Copy (yank) selected URL and deactivate selection mode +# q/Escape: Deactivate URL selection mode + +# Options: +# URxvt.url-select.autocopy: If true, selected URLs are copied to PRIMARY +# URvxt.url-select.button: Mouse button to click-open URLs (default: 2) +# URxvt.url-select.launcher: Browser/command to open selected URL with +# URxvt.url-select.underline: If set to true, all URLs get underlined + +use strict; + +sub on_start { + my ($self) = @_; + + # read resource settings + if ($self->x_resource('url-select.launcher')) { + @{$self->{browser}} = split /\s+/, $self->x_resource('url-select.launcher'); + } else { + @{$self->{browser}} = ('x-www-browser'); + } + if ($self->x_resource('url-select.underline') eq 'true') { + $self->enable(line_update => \&line_update); + } + if ($self->x_resource('url-select.autocopy') eq 'true') { + $self->{autocopy} = 1; + } + + $self->{state} = 0; + + for my $mod (split '', $self->x_resource("url-select.button") || + $self->x_resource("matcher.button") || 2) { + if ($mod =~ /^\d+$/) { + $self->{button} = $mod; + } elsif ($mod eq "C") { + $self->{state} |= urxvt::ControlMask; + } elsif ($mod eq "S") { + $self->{state} |= urxvt::ShiftMask; + } elsif ($mod eq "M") { + $self->{state} |= $self->ModMetaMask; + } elsif ($mod ne "-" && $mod ne " ") { + warn("invalid button/modifier in $self->{_name}<$self->{argv}[0]>: $mod\n"); + } + } + + if ($self->x_resource('matcher.pattern')) { + @{$self->{pattern}} = ($self->x_resource('matcher.pattern')); + } elsif ($self->x_resource('matcher.pattern.1')) { + my $current = 1; + + while ($self->x_resource("matcher.pattern.$current")) { + push @{$self->{pattern}}, $self->x_resource("matcher.pattern.$current"); + $current++; + } + } else { + @{$self->{pattern}} = qr{ + (?:https?://|ftp://|news://|mailto:|file://|\bwww\.) + [\w\-\@;\/?:&=%\$.+!*\x27,~#]* + ( + \([\w\-\@;\/?:&=%\$.+!*\x27,~#]*\) # Allow a pair of matched parentheses + | # + [\w\-\@;\/?:&=%\$+*~] # exclude some trailing characters (heuristic) + )+ + }x; + } + + () +} + + +sub line_update { + my ($self, $row) = @_; + + my $line = $self->line($row); + my $text = $line->t; + my $rend = $line->r; + + for my $pattern (@{$self->{pattern}}) { + while ($text =~ /$pattern/g) { + my $url = $&; + my ($beg, $end) = ($-[0], $+[0] - 1); + + for (@{$rend}[$beg .. $end]) { + $_ |= urxvt::RS_Uline; + } + $line->r($rend); + } + } + + () +} + + +sub on_user_command { + my ($self, $cmd) = @_; + + if ($cmd eq 'url-select:select_next') { + if (not $self->{active}) { + activate($self); + } + select_next($self, -1); + } + + () +} + + +sub key_press { + my ($self, $event, $keysym) = @_; + my $char = chr($keysym); + + if ($keysym == 0xff1b || lc($char) eq 'q' || + (lc($char) eq 'c' && $event->{state} & urxvt::ControlMask)) { + deactivate($self); + } elsif ($keysym == 0xff0d || $char eq 'o') { + $self->exec_async(@{$self->{browser}}, ${$self->{found}[$self->{n}]}[4]); + deactivate($self) unless $char eq 'o'; + } elsif ($char eq 'y') { + my $found = $self->{found}[$self->{n}]; + $self->selection_beg(${$found}[0], ${$found}[1]); + $self->selection_end(${$found}[2], ${$found}[3]); + $self->selection_make($event->{time}); + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + deactivate($self); + } elsif ($char eq 'k' || $keysym == 0xff52 || $keysym == 0xff51) { + select_next($self, -1, $event); + } elsif ($char eq 'j' || $keysym == 0xff54 || $keysym == 0xff53) { + select_next($self, 1, $event); + } elsif ($char eq 'g' || $keysym == 0xff50) { + $self->{row} = $self->top_row - 1; + delete $self->{found}; + select_next($self, 1, $event); + } elsif ($char eq 'G' || $keysym == 0xff57) { + $self->{row} = $self->nrow; + delete $self->{found}; + select_next($self, -1, $event); + } + + return 1; +} + + +sub on_button_press { + my ($self, $event) = @_; + + my $mask = $self->ModLevel3Mask | $self->ModMetaMask | + urxvt::ShiftMask | urxvt::ControlMask; + + if ($event->{button} == $self->{button} && ($event->{state} & $mask) == $self->{state}) { + $self->{button_pressed} = 1; + $self->{button_col} = $event->{col}; + $self->{button_row} = $event->{row}; + } + + () +} + +sub on_button_release { + my ($self, $event) = @_; + + if ($self->{button_pressed} && $event->{button} == $self->{button}) { + my $col = $event->{col}; + my $row = $event->{row}; + + $self->{button_pressed} = 0; + + if ($col == $self->{button_col} && $row == $self->{button_row}) { + my $line = $self->line($row); + my $text = $line->t; + + for my $pattern (@{$self->{pattern}}) { + while ($text =~ /$pattern/g) { + my ($url, $beg, $end) = ($&, $-[0], $+[0]); + --$end if $url =~ s/["')]$//; + + if ($col >= $beg && $col <= $end) { + $self->exec_async(@{$self->{browser}}, $url); + return 1; + } + } + } + } + } + + () +} + + +sub select_next { + # $dir < 0: up, > 0: down + my ($self, $dir, $event) = @_; + my $row = $self->{row}; + + if (($dir < 0 && $self->{n} > 0) || + ($dir > 0 && $self->{n} < $#{ $self->{found} })) { + # another url on current line + $self->{n} += $dir; + hilight($self); + if ($self->{autocopy}) { + my $found = $self->{found}[$self->{n}]; + $self->selection_beg(${$found}[0], ${$found}[1]); + $self->selection_end(${$found}[2], ${$found}[3]); + $self->selection_make($event->{time}); + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + } + return; + } + + while (($dir < 0 && $row > $self->top_row) || + ($dir > 0 && $row < $self->nrow - 1)) { + my $line = $self->line($row); + $row = ($dir < 0 ? $line->beg : $line->end) + $dir; + $line = $self->line($row); + my $text = $line->t; + + for my $pattern (@{$self->{pattern}}) { + if ($text =~ /$pattern/g) { + delete $self->{found}; + + do { + my ($beg, $end) = ($-[0], $+[0]); + push @{$self->{found}}, [$line->coord_of($beg), + $line->coord_of($end), substr($text, $beg, $end - $beg)]; + } while ($text =~ /$pattern/g); + + $self->{row} = $row; + $self->{n} = $dir < 0 ? $#{$self->{found}} : 0; + hilight($self); + if ($self->{autocopy}) { + my $found = $self->{found}[$self->{n}]; + $self->selection_beg(${$found}[0], ${$found}[1]); + $self->selection_end(${$found}[2], ${$found}[3]); + $self->selection_make($event->{time}); + $self->selection_beg(1, 0); + $self->selection_end(1, 0); + } + return; + } + } + } + + deactivate($self) unless $self->{found}; + + () +} + + +sub hilight { + my ($self) = @_; + + if ($self->{found}) { + if ($self->{row} < $self->view_start() || + $self->{row} >= $self->view_start() + $self->nrow) { + # scroll selected url into visible area + my $top = $self->{row} - ($self->nrow >> 1); + $self->view_start($top < 0 ? $top : 0); + } + + status_area($self); + $self->want_refresh(); + } + + () +} + + +sub refresh { + my ($self) = @_; + + if ($self->{found}) { + $self->scr_xor_span(@{$self->{found}[$self->{n}]}[0 .. 3], urxvt::RS_RVid); + } + + () +} + + +sub status_area { + my ($self) = @_; + + my $row = $self->{row} < 0 ? + $self->{row} - $self->top_row : abs($self->top_row) + $self->{row}; + my $text = sprintf("%d,%d ", $row + 1, $self->{n} + 1); + + if ($self->top_row == 0) { + $text .= "All"; + } elsif ($self->view_start() == $self->top_row) { + $text .= "Top"; + } elsif ($self->view_start() == 0) { + $text .= "Bot"; + } else { + $text .= sprintf("%2d%", + ($self->top_row - $self->view_start) * 100 / $self->top_row); + } + + my $text_len = length($text); + + if ($self->{overlay_len} != $text_len) { + delete $self->{overlay} if $self->{overlay}; + $self->{overlay} = $self->overlay(-1, -1, $text_len, 1, + urxvt::OVERLAY_RSTYLE, 0); + $self->{overlay_len} = $text_len; + } + + $self->{overlay}->set(0, 0, $self->special_encode($text)); + $self->{overlay}->show(); + + () +} + + +sub tt_write { + return 1; +} + + +sub activate { + my ($self) = @_; + + $self->{active} = 1; + + $self->{row} = $self->view_start() + $self->nrow; + $self->{n} = 0; + $self->{overlay_len} = 0; + $self->{button_pressed} = 0; + + $self->{view_start} = $self->view_start(); + $self->{pty_ev_events} = $self->pty_ev_events(urxvt::EV_NONE); + + $self->enable( + key_press => \&key_press, + refresh_begin => \&refresh, + refresh_end => \&refresh, + tt_write => \&tt_write, + ); + + () +} + + +sub deactivate { + my ($self) = @_; + + $self->disable("key_press", "refresh_begin", "refresh_end", "tt_write"); + $self->view_start($self->{view_start}); + $self->pty_ev_events($self->{pty_ev_events}); + + delete $self->{overlay} if $self->{overlay}; + delete $self->{found} if $self->{found}; + + $self->want_refresh(); + + $self->{active} = 0; + + () +} diff --git a/.vifm/colors/Default b/.vifm/colors/Default new file mode 100644 index 0000000..c3c72dd --- /dev/null +++ b/.vifm/colors/Default @@ -0,0 +1,52 @@ +" You can edit this file by hand. +" The " character at the beginning of a line comments out the line. +" Blank lines are ignored. + +" The Default color scheme is used for any directory that does not have +" a specified scheme and for parts of user interface like menus. A +" color scheme set for a base directory will also +" be used for the sub directories. + +" The standard ncurses colors are: +" Default = -1 = None, can be used for transparency or default color +" Black = 0 +" Red = 1 +" Green = 2 +" Yellow = 3 +" Blue = 4 +" Magenta = 5 +" Cyan = 6 +" White = 7 + +" Available style values (some of them can be combined): +" bold +" underline +" reverse or inverse +" standout +" none + +" Vifm supports 256 colors you can use color numbers 0-255 +" (requires properly set up terminal: set your TERM environment variable +" (directly or using resources) to some color terminal name (e.g. +" xterm-256color) from /usr/lib/terminfo/; you can check current number +" of colors in your terminal with tput colors command) + +" highlight group cterm=style ctermfg=foreground_color ctermbg=background_color + +highlight Win cterm=none ctermfg=white ctermbg=black +highlight Directory cterm=bold ctermfg=cyan ctermbg=default +highlight Link cterm=bold ctermfg=yellow ctermbg=default +highlight BrokenLink cterm=bold ctermfg=red ctermbg=default +highlight Socket cterm=bold ctermfg=magenta ctermbg=default +highlight Device cterm=bold ctermfg=red ctermbg=default +highlight Fifo cterm=bold ctermfg=cyan ctermbg=default +highlight Executable cterm=bold ctermfg=green ctermbg=default +highlight Selected cterm=bold ctermfg=magenta ctermbg=default +highlight CurrLine cterm=bold ctermfg=default ctermbg=blue +highlight TopLine cterm=none ctermfg=black ctermbg=white +highlight TopLineSel cterm=bold ctermfg=black ctermbg=default +highlight StatusLine cterm=bold ctermfg=black ctermbg=white +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black +highlight Border cterm=none ctermfg=black ctermbg=white diff --git a/.vifm/colors/alycolors b/.vifm/colors/alycolors new file mode 100644 index 0000000..ddaacd6 --- /dev/null +++ b/.vifm/colors/alycolors @@ -0,0 +1,60 @@ +"" +"" vifm colorscheme +"" based on 'Default' & 'istib-solarized-dark' & 'juef-zenburn' +"" +"" Weitian LI <liweitianux@gmail.com> +"" 2014/05/12 +"" + + +"" The standard ncurses colors are: +" Default = -1 = None (can be used for transparency or default color) +" Black = 0 +" Red = 1 +" Green = 2 +" Yellow = 3 +" Blue = 4 +" Magenta = 5 +" Cyan = 6 +" White = 7 + +"" Available style values (some of them can be combined): +" bold +" underline +" reverse/inverse +" standout +" none + +"" Vifm supports 256 colors you can use color numbers 0-255 +" (requires properly set up terminal: set your TERM environment variable +" (directly or using resources) to some color terminal name (e.g. +" xterm-256color) from /usr/lib/terminfo/; you can check current number +" of colors in your terminal with tput colors command) + +"" Syntax: +" highlight group cterm=style ctermfg=fg_color ctermbg=bg_color + + +highlight Win cterm=none ctermfg=default ctermbg=none + +highlight TopLine cterm=none ctermfg=yellow ctermbg=none +highlight TopLineSel cterm=bold ctermfg=magenta ctermbg=none +highlight StatusLine cterm=bold ctermfg=yellow ctermbg=none +highlight Border cterm=none ctermfg=default ctermbg=none + +highlight Selected cterm=bold ctermfg=magenta ctermbg=black +highlight CurrLine cterm=bold ctermfg=yellow ctermbg=blue + +highlight WildMenu cterm=bold,reverse ctermfg=yellow ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=bold ctermfg=magenta ctermbg=black + +highlight Directory cterm=bold ctermfg=blue ctermbg=default +highlight Executable cterm=bold ctermfg=green ctermbg=default +highlight Link cterm=bold ctermfg=cyan ctermbg=default +highlight BrokenLink cterm=bold ctermfg=yellow ctermbg=red +highlight Device cterm=bold ctermfg=yellow ctermbg=default +highlight Socket cterm=bold ctermfg=magenta ctermbg=default +highlight Fifo cterm=none ctermfg=red ctermbg=default + +" vim: set ts=8 sw=4 tw=78 fenc=utf-8 ft=vifm: " diff --git a/.vifm/colors/dmilith-root b/.vifm/colors/dmilith-root new file mode 100644 index 0000000..393d02a --- /dev/null +++ b/.vifm/colors/dmilith-root @@ -0,0 +1,21 @@ +" vim: filetype=vifm : + +" Author: Daniel Dettlaff (a.k.a. dmilith) + +highlight Win cterm=none ctermfg=white ctermbg=black +highlight Directory cterm=bold ctermfg=cyan ctermbg=black +highlight Link cterm=bold ctermfg=yellow ctermbg=black +highlight BrokenLink cterm=bold ctermfg=red ctermbg=none +highlight Socket cterm=bold ctermfg=magenta ctermbg=black +highlight Device cterm=bold ctermfg=red ctermbg=black +highlight Fifo cterm=bold ctermfg=cyan ctermbg=none +highlight Executable cterm=bold ctermfg=green ctermbg=black +highlight Selected cterm=bold ctermfg=magenta ctermbg=black +highlight CurrLine cterm=bold ctermfg=white ctermbg=30 +highlight TopLine cterm=bold ctermfg=white ctermbg=red +highlight TopLineSel cterm=bold ctermfg=yellow ctermbg=red +highlight StatusLine cterm=bold ctermfg=white ctermbg=red +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black +highlight Border cterm=none ctermfg=black ctermbg=red diff --git a/.vifm/colors/dmilith-user b/.vifm/colors/dmilith-user new file mode 100644 index 0000000..06473fc --- /dev/null +++ b/.vifm/colors/dmilith-user @@ -0,0 +1,21 @@ +" vim: filetype=vifm : + +" Author: Daniel Dettlaff (a.k.a. dmilith) + +highlight Win cterm=none ctermfg=white ctermbg=black +highlight Directory cterm=bold ctermfg=cyan ctermbg=black +highlight Link cterm=bold ctermfg=yellow ctermbg=black +highlight BrokenLink cterm=bold ctermfg=red ctermbg=none +highlight Socket cterm=bold ctermfg=magenta ctermbg=black +highlight Device cterm=bold ctermfg=red ctermbg=black +highlight Fifo cterm=bold ctermfg=cyan ctermbg=none +highlight Executable cterm=bold ctermfg=green ctermbg=black +highlight Selected cterm=bold ctermfg=magenta ctermbg=black +highlight CurrLine cterm=bold ctermfg=white ctermbg=30 +highlight TopLine cterm=bold ctermfg=white ctermbg=blue +highlight TopLineSel cterm=bold ctermfg=yellow ctermbg=blue +highlight StatusLine cterm=bold ctermfg=white ctermbg=blue +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black +highlight Border cterm=none ctermfg=black ctermbg=blue diff --git a/.vifm/colors/istib-solarized-dark b/.vifm/colors/istib-solarized-dark new file mode 100644 index 0000000..b81415f --- /dev/null +++ b/.vifm/colors/istib-solarized-dark @@ -0,0 +1,25 @@ +" vim: filetype=vifm : + +" Author: Stéphane (a.k.a. istib) + +highlight Win cterm=none ctermfg=default ctermbg=none + +highlight TopLine cterm=none ctermfg=blue ctermbg=none +highlight TopLineSel cterm=none ctermfg=blue ctermbg=none +highlight StatusLine cterm=none ctermfg=blue ctermbg=none +highlight Border cterm=none ctermfg=blue ctermbg=none + +highlight Selected cterm=bold ctermfg=magenta ctermbg=default +highlight CurrLine cterm=bold ctermfg=default ctermbg=blue + +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black + +highlight Directory cterm=none ctermfg=cyan ctermbg=default +highlight Link cterm=none ctermfg=yellow ctermbg=default +highlight BrokenLink cterm=none ctermfg=red ctermbg=default +highlight Socket cterm=none ctermfg=magenta ctermbg=default +highlight Device cterm=none ctermfg=red ctermbg=default +highlight Fifo cterm=none ctermfg=cyan ctermbg=default +highlight Executable cterm=none ctermfg=green ctermbg=default diff --git a/.vifm/colors/juef-zenburn b/.vifm/colors/juef-zenburn new file mode 100644 index 0000000..d777c10 --- /dev/null +++ b/.vifm/colors/juef-zenburn @@ -0,0 +1,21 @@ +" vim: filetype=vifm : + +" Author: Svyatoslav Mishyn (a.k.a. juef) + +highlight Win cterm=none ctermfg=188 ctermbg=237 +highlight Directory cterm=none ctermfg=108 ctermbg=default +highlight CmdLine cterm=none ctermfg=188 ctermbg=237 +highlight ErrorMsg cterm=bold ctermfg=115 ctermbg=default +highlight TopLine cterm=none ctermfg=174 ctermbg=235 +highlight TopLineSel cterm=bold ctermfg=174 ctermbg=235 +highlight StatusLine cterm=bold ctermfg=144 ctermbg=235 +highlight Executable cterm=none ctermfg=172 ctermbg=default +highlight Selected cterm=none ctermfg=116 ctermbg=238 +highlight Border cterm=none ctermfg=default ctermbg=235 +highlight CurrLine cterm=none ctermfg=223 ctermbg=235 +highlight WildMenu cterm=bold,reverse ctermfg=144 ctermbg=235 +highlight Link cterm=none ctermfg=142 ctermbg=default +highlight BrokenLink cterm=none ctermfg=181 ctermbg=default +highlight Device cterm=none ctermfg=174 ctermbg=default +highlight Fifo cterm=none ctermfg=109 ctermbg=default +highlight Socket cterm=none ctermfg=magenta ctermbg=default diff --git a/.vifm/colors/reicheltd-light b/.vifm/colors/reicheltd-light new file mode 100644 index 0000000..6d633ff --- /dev/null +++ b/.vifm/colors/reicheltd-light @@ -0,0 +1,26 @@ +" vim: filetype=vifm : + +" Author: Daniel R. (a.k.a. reicheltd) + +highlight Win cterm=none ctermfg=236 ctermbg=255 +highlight Directory cterm=bold ctermfg=21 ctermbg=255 +highlight Link cterm=bold ctermfg=39 ctermbg=default + +highlight BrokenLink cterm=bold ctermfg=red ctermbg=default +highlight Socket cterm=bold ctermfg=magenta ctermbg=default +highlight Device cterm=bold ctermfg=blue ctermbg=default + +highlight Fifo cterm=bold ctermfg=cyan ctermbg=default +highlight Executable cterm=bold ctermfg=red ctermbg=default +highlight Selected cterm=bold ctermfg=200 ctermbg=default + +highlight CurrLine cterm=bold ctermfg=255 ctermbg=27 +highlight TopLine cterm=none ctermfg=236 ctermbg=255 +highlight TopLineSel cterm=bold ctermfg=236 ctermbg=255 + +highlight StatusLine cterm=bold ctermfg=236 ctermbg=255 +highlight WildMenu cterm=underline,reverse ctermfg=236 ctermbg=255 +highlight CmdLine cterm=none ctermfg=236 ctermbg=255 + +highlight ErrorMsg cterm=none ctermfg=red ctermbg=236 +highlight Border cterm=none ctermfg=236 ctermbg=255 diff --git a/.vifm/vifm-help.txt b/.vifm/vifm-help.txt new file mode 100644 index 0000000..61b50aa --- /dev/null +++ b/.vifm/vifm-help.txt @@ -0,0 +1,3099 @@ +vifm(1) Vifm vifm(1) + + + +NAME + vifm - vi file manager + +SYNOPSIS + vifm [OPTION]... + vifm [OPTION]... LWIN_DIR + vifm [OPTION]... LWIN_DIR RWIN_DIR + +DESCRIPTION + Vifm is a ncurses based file manager with vi like keybindings. If you + use vi, vifm gives you complete keyboard control over your files with‐ + out having to learn a new set of commands. + +OPTIONS + The vifm executable will start vifm in the current directory unless it + is given a different directory on the command line. + + <lwinpath> + Starts Vifm in the specified path. + + <lwinpath> <rwinpath> + Starts Vifm in the specified paths. + + Specifying two directories triggers split view even when vifm was in + single-view mode on finishing previous session. To suppress this be‐ + haviour :only command can be put in the vifmrc file. + + When only one path argument is found on command-line, the left/top pane + is automatically set as the current view. + + Paths to files are also allowed in case you want vifm to start with + some archive opened. If you want to select file, prepend its path with + --select. + + -f only used from the vifm.vim script. The selected files are + written to $VIFM/vimfiles and vifm exits. + + --logging + Log some errors to $VIFM/log. Also /var/log/vifm-startup-log + (on *nix) and startup-log in the directory of executable (on + Windows) is used to log startup process (when configuration + directory isn't determined). + + --remote + Sends the rest of command line to the active vifm server (one of + already running instances if any). When there is no server, + quits silently. There is no limit on how many arguments can be + processed. One can combine --remote with -c <command> or +<com‐ + mand> to execute command in already running instance of vifm. + See also "Client-Server" section below. + + -c <command> or +<command> + Run command-line mode <command> on startup. Commands in such + arguments are executed in the order they appear in command line. + Commands with spaces or special symbols must be enclosed in dou‐ + ble or single quotes or all special symbols should be escaped + (the exact syntax strongly depends on shell). + + --help, -h + Show an overview of the commandline options. + + --version, -v + Show version information and quit. + + --no-configs + Don't read vifmrc and vifminfo. + + + See Startup section below for the explanations on $VIFM. + +General keys + Ctrl-C or Escape + cancel most operations. + + Ctrl-C or Escape + clear all selected files. + + Ctrl-L clear and redraw the screen. + +Basic Movement + The basic vi key bindings are used to move through the files and popup + windows. + + k, gk, or Ctrl-P + moves cursor up one line. + + j, gj or Ctrl-N + moves cursor down one line. + + h when 'lsview' is off moves up one directory, otherwise moves + left one file. + + l when 'lsview' is off moves into a directory or launches a file, + otherwise moves left one file. + + gg move to the top of the file list. + + gh moves up one directory. + + gl or Enter + moves into a directory or launches a file. + + G move to the bottom of the file list. + + H move to the first file in the window. + + M move to the file in the middle of the window. + + L move to the last file in the window. + + Ctrl-F or Page Down + move forward one page. + + Ctrl-B or Page Up + move back one page. + + Ctrl-D jump back one half page. + + Ctrl-U jump forward one half page. + + n% move to the file that is n percent from the top of the list (for + example 25%). + + 0 or ^ move cursor to the first column. See 'lsview' option descrip‐ + tion. + + $ move cursor to the last column. See 'lsview' option descrip‐ + tion. + + Space Bar + toggles between the two file lists. + +Movement with Count + Most movement commands also accept a count, 12j would move down 12 + files. + + [count]% + move to percent of the file list. + + [count]j + move down count files. + + [count]k + move up count files. + + [count]G or [count]gg + move to list position count. + +Scrolling panes + zt redraw pane with file in top of list. + + zz redraw pane with file in center of list. + + zb redraw pane with file in bottom of list. + + Ctrl-E scroll pane one line down. + + Ctrl-Y scroll pane one line up. + +Pane manipulation + Second character can be entered with or without Control key. + + Ctrl-W H + move the pane to the far left. + + Ctrl-W J + move the pane to the very bottom. + + Ctrl-W K + move the pane to the very top. + + Ctrl-W L + move the pane to the far right. + + Ctrl-W b + switch to bottom-right window. + + Ctrl-W h + switch to the left pane. + + Ctrl-W j + switch to the pane below. + + Ctrl-W k + switch to the pane above. + + Ctrl-W l + switch to the right pane. + + Ctrl-W o + shortcut for :only + + Ctrl-W p + switch to previous window. + + Ctrl-W s + shortcut for :split + + Ctrl-W t + switch to top-left window. + + Ctrl-W v + shortcut for :vsplit + + Ctrl-W w + switch to other pane. + + Ctrl-W x + exchange panes. + + [count1]Ctrl-W[count2]+ + increase size of the view by count1*count2. + + [count1]Ctrl-W[count2]- + decrease size of the view by count1*count2.. + + [count1]Ctrl-W[count2]< + increase size of the view by count1*count2.. + + [count1]Ctrl-W[count2]> + decrease size of the view by count1*count2.. + + Ctrl-W | + maximize current view. + + Ctrl-W _ + maximize current view. + + Ctrl-W = + make size of two views equal. + +Marks + Marks are set the same way as they are in vi. + + You can use this characters for marks [a-z][A-Z][0-9]. + + m[a-z][A-Z][0-9] + to set a mark for the current file. + + '[a-z][A-Z][0-9] + moves to the file set for the mark. + +Searching + /regular expression pattern[Return] + will highlight all files matching the pattern and go to the next + match. + + ?regular expression pattern[Return] + will highlight all files matching the pattern and go to the pre‐ + vious match. + + [count]n + find the next match of / or ?. + + [count]N + find the previous match of / or ?. + + If 'hlsearch' option is set, hitting n/N to perform search and go to + the first matching item resets current selection in normal mode. It is + not the case if search was already performed on files in the directory, + thus selection is not reset after clearing selection with escape key + and hitting n/N key again. + + [count]f[character] + search forward for file with [character] as first character in + name. Search wraps around the end of the list. + + [count]F[character] + search backward for file with [character] as first character in + name. Search wraps around the end of the list. + + [count]; + find the next match of f or F. + + [count], + find the previous match of f or F. + + Note: f, F, ; and , wrap around list beginning and end when they are + used alone and they don't wrap when they are used as selectors. + +File Filters + There are three basic file filters: + + - dot files filter (excluding "." and ".." special directories, which + appearance is controlled by the 'dotdirs' option) + + - manual filter for file names + + - automatic filter for file names + + - local filter for file names (see description of the "=" normal mode + command) + + Performing operations on manual filter for file names automatically + does the same on automatic one. The file name filter is separated + mainly for convenience purpose and to get more deterministic behaviour. + + The basic vim folding key bindings are used for filtering files. + + Each file list has its own copy of each filter. + + Filtered files are not checked in / search or :commands. + + Files and directories are filtered separately. For this a slash is + appended to a directory name before testing whether it matches the fil‐ + ter. Examples: + + " filter directories which names end with '.files' + :filter /^.*\.files\/$/ + + " filter files which names end with '.d' + :filter /^.*\.d$/ + + " filter files and directories which names end with '.o' + :filter /^.*\.o\/?$/ + + zo Show all of the dot files. + + zf Filter all of the selected files. + + za Toggle the showing and hiding of dot files. + + zm Filter all of the dot files. + + zO Show the files filtered out by filename filter. + + zM Filter the files matching the filename filter. + + zR Remove all filters. + + =regular expression pattern[Return] + filter out files that don't match regular expression. This kind + of filter is automatically reset when directory is changed. + +Other Normal Mode Keys + [count]: + enter command line mode. Count will add range. + + q: open external editor to prompt for command-line command. See + "Command line editing" section for details. + + q/ open external editor to prompt for search pattern to be searched + in forward direction. See "Command line editing" section for + details. + + q? open external editor to prompt for search pattern to be searched + in backward direction. See "Command line editing" section for + details. + + q= open external editor to prompt for filter pattern. See "Command + line editing" section for details. Unlike other q{x} commands + this one doesn't work in Visual mode. + + [count]!! and [count]!<selector> + enter command line mode with entered ! command. Count will mod‐ + ify range. + + Ctrl-O go backward through history. + + Ctrl-I if 'cpoptions' contains "t" flag, <tab> and <c-i> switch active + pane just like <space> does, otherwise it goes forward through + directory history of the current view. + + Ctrl-G creates a window showing detailed information about the current + file. + + Shift-Tab + enters view mode (works only after activating view pane with + :view command). + + ga calculate directory size. + + gA like ga, but force update. + + gf find link destination (like l with 'followlinks' off, but also + finds directories). + + gr only for MS-Windows + same as l key, but tries to run program with administrative + privileges. + + gv go to visual mode restoring last selection. + + gs restore last t selection, like gv for visual mode selection. + + gu<selector> + make names of selected files lowercase. + + [count]guu and [count]gugu + make names of [count] files starting from the current one lower‐ + case. Without [count] only current file is affected. + + gU<selector> + make names of selected files uppercase. + + [count]gUU and [count]gUgU + make names of [count] files starting from the current one upper‐ + case. Without [count] only current file is affected. + + e explore file in the current pane. + + i opens file with associated program even if it's an executable. + + cw rename a file or files. + + cW change only name of file (without extension). + + cl change link target. + + co only for *nix + change file owner. + + cg only for *nix + change file group. + + cp change file attributes (permission on *nix and properties on + Windows). + + [count]C + clone file [count] times. + + [count]dd or d[count]selector + moves the selected files to trash directory (if 'trash' option + is set, otherwise delete). See "Trash directory" section below. + + [count]DD or D[count]selector + removes the selected files. + + Y, [count]yy or y[count]selector + yanks the selected files. + + Y same as yy. + + p will copy the yanked files to the current directory or move the + files to the current directory if they were deleted with dd or + :d[elete] or if the files were yanked from trash directory. See + "Trash directory" section below. + + P moves the last yanked files. The advantage of using P instead + of d followed by p is that P moves files only once. This isn't + important in case you're moving files in the same file system + where your home directory is, but using P to move files on some + other file system (or file systems, in case you want to move + files from fs1 to fs2 and your home is on fs3) can save your + time. + + al puts symbolic links with absolute paths. + + rl puts symbolic links with relative paths. + + t select or unselect (tag) the current file. + + u undo last change. + + Ctrl-R redo last change. + + v enter visual mode. + + V enter visual mode. + + [count]Ctrl-A + increment first number in file name by count (1 by default). + + [count]Ctrl-X + decrement first number in file name by count (1 by default). + + ZQ same as :quit! + + ZZ same as :quit + + . repeat last command line command (not normal mode command) of + this session (does nothing right after startup or :restart com‐ + mand). The command doesn't depend on command-line history and + can be used with completely disabled history. + + ( goto previous group. Groups are defined by primary sorting key. + For name and iname members of each group have same first letter, + for all other sorting keys vifm uses size, uid, ... + + ) goto next group. See ( key description above. + +Using Count + You can use count with commands like yy. + + [count]yy + yank count files starting from current cursor position downward. + + Or you can use count with motions passed to y, d or D. + + d[count]j + delete (count + 1) files starting from current cursor position + upward. + +Registers + vifm supports multiple registers for temporary storing list of yanked + or deleted files. + + Registers should be specified with hitting double quite key followed by + a register name. Count is specified after register name. By default + commands use unnamed register, which has double quote as its name. + + Though all commands accept registers, most of commands ignores them + (for example H or Ctrl-U). Other commands can fill register or append + new files to it. + + Presently vifm supports ", _, a-z and A-Z characters as register names. + + As mentioned above " is unnamed register and has special meaning of the + default register. Every time when you use named registers (a-z and A- + Z) unnamed register is updated to contain same list of files as the + last used register. + + _ is black hole register. It can be used for writing, but its list is + always empty. + + Registers with names from a to z and from A to Z are named ones. Low‐ + ercase registers are cleared before adding new files, while uppercase + aren't and should be used to append new files to the existing file list + of appropriate lowercase register (A for a, B for b, ...). + + Registers can be changed on :empty command if they contain files under + trash directory (see "Trash directory" section below). + + Registers do not contain one file more than once. + + Example: + + "a2yy + + will put names of two files to register a (and to the unnamed regis‐ + ter), + + "Ad + + will remove one file and append its name to register a (and to the + unnamed register), + + p or "ap or "Ap + + will insert previously yanked and deleted files into current directory. + +Selectors + y, d, D, !, gu and gU commands accept selectors. You can combine them + with any of selectors below to quickly remove or yank several files. + + Most of selectors are like vi motions: j, k, gg, G, H, L, M, %, f, F, + ;, comma, ', ^, 0 and $. But there are some additional ones. + + a all files in current view. + + s selected files. + + S all files except selected. + + Examples: + dj - delete file under cursor and one below. + d2j - delete file under cursor and two below. + y6gg - yank all files from cursor position to 6th file in the list. + + When you pass a count to whole command and its selector they are multi‐ + plied. So: + 2d2j - delete file under cursor and four below. + 2dj - delete file under cursor and two below. + 2y6gg - yank all files from cursor position to 12th file in the list. + +Visual Mode + In visual mode work almost all normal mode keys, but they do not accept + selectors. + + Enter save selection and go back to normal mode. + + gv restore previous visual selection. + + v leave visual mode. + + V leave visual mode. + + : enter command line mode. When you leave it selection will be + cleared. + + o switch active selection bound. + + O switch active selection bound. + + gu, u make names of selected files lowercase. + + gU, U make names of selected files uppercase. + +View Mode + This mode tries to imitate the less program. List of builtin shortcuts + can be found below. Shortcuts can be customized using :qmap, :qnoremap + and :qunmap command-line commands. + + Shift-Tab, Tab, q, Q, ZZ + go back to normal mode. + + [count]e, [count]Ctrl-E, [count]j, [count]Ctrl-N, [count]Enter + forward one line (or [count] lines). + + [count]y, [count]Ctrl-Y, [count]k, [count]Ctrl-K, [count]Ctrl-P + backward one line (or [count] lines). + + [count]f, [count]Ctrl-F, [count]Ctrl-V, [count]Space Bar + forward one window (or [count] lines). + + [count]b, [count]Ctrl-B, [count]Alt-V + backward one window (or [count] lines). + + [count]z + forward one window (and set window to [count]). + + [count]w + backward one window (and set window to [count]). + + [count]Alt-Space + forward one window, but don't stop at end-of-file. + + [count]d, [count]Ctrl-D + forward one half-window (and set half-window to [count]). + + [count]u, [count]Ctrl-U + backward one half-window (and set half-window to [count]). + + r, Ctrl-R, Ctrl-L + repaint screen. + + R reload view preserving scroll position. + + [count]/pattern + search forward for ([count]‐th) matching line. + + [count]?pattern + search backward for ([count]‐th) matching line. + + [count]n + repeat previous search (for [count]‐th occurrence). + + [count]N + repeat previous search in reverse direction. + + [count]g, [count]<, [count]Alt-< + go to first line in file (or line [count]). + + [count]G, [count]>, [count]Alt-> + go to last line in file (or line [count]). + + [count]p, [count]% + go to beginning of file (or N percent into file). + + v edit the current file with vim. + + + Ctrl-W H + move the pane to the far left. + + Ctrl-W J + move the pane to the very bottom. + + Ctrl-W K + move the pane to the very top. + + Ctrl-W L + move the pane to the far right. + + + Ctrl-W h + switch to left pane. + + Ctrl-W j + switch to pane below. + + Ctrl-W k + switch to pane above. + + Ctrl-W l + switch to right pane. + + + Ctrl-W b + switch to bottom-right window. + + Ctrl-W t + switch to top-left window. + + + Ctrl-W p + switch to previous window. + + Ctrl-W w + switch to other pane. + + + Ctrl-W o + leave only one pane. + + Ctrl-W s + split window horizontally. + + Ctrl-W v + split window vertically. + + + Ctrl-W x + exchange panes. + + + Ctrl-W + + increase size of the view. + + Ctrl-W - + decrease size of the view. + + Ctrl-W < + increase size of the view. + + Ctrl-W > + decrease size of the view. + + Ctrl-W | + maximize current view. + + Ctrl-W _ + maximize current view. + + Ctrl-W = + make size of two views equal. + + + In general, all "Ctrl-W x" keys above work the same was as in Normal + mode. Active mode is automatically changed on navigating among win‐ + dows. When less-like mode activated on file preview is left using one + by "Ctrl-W x" keys, its state is stored until another file is showed + using preview (it's possible to leave the mode, hide preview pane, do + something else, then get back to the file and show preview pane again + with previously stored state in it). + +Command line Mode + This keys apply to all submodes of the command line mode: command, + prompt and search. + + Down, Up, Left, Right, Home, End and Delete are extended keys and they + are not available if vifm is compiled with --disable-extended-keys + option. + + Esc, Ctrl-C + leave command line mode, cancels input. Cancelled input is + saved into appropriate history and can be recalled later. + + Ctrl-M, Enter + execute command and leave command line mode. + + Ctrl-I, Tab + complete command or its argument. + + Shift-Tab + complete in reverse order. + + Ctrl-_ stop completion and return original input. + + Ctrl-K remove characters from cursor position till the end of line. + + Ctrl-U remove characters from cursor position till the beginning of + line. + + Ctrl-H, Backspace + remove character before the cursor. + + Ctrl-D, Delete + remove character under the cursor. + + Ctrl-B, Left + move cursor to the left. + + Ctrl-F, Right + move cursor to the right. + + Ctrl-A, Home + go to line beginning. + + Ctrl-E, End + go to line end + + Alt-B go to the beginning of previous word. + + Alt-F go to the end of next word. + + Ctrl-W remove characters from cursor position till the beginning of + previous word. + + Alt-D remove characters from cursor position till the beginning of + next word. + + Ctrl-T swap the order of current and previous character and move cursor + forward or, if cursor past the end of line, swap the order of + two last characters in the line. + + Alt-. insert last part of previous command to current cursor position. + Each next call will insert last part of older command. + + Ctrl-G edit command-line content in external editor. See "Command line + editing" section for details. + + Ctrl-N recall more recent command-line from history. + + Ctrl-P recall older command-line from history. + + Up recall more recent command-line from history, that begins as the + current command-line. + + Down recall older command-line from history, that begins as the cur‐ + rent command-line. + +Command line editing + vifm provides a facility to edit several kinds of data, that is usually + edited in command-line mode, in external editor (using command speci‐ + fied by ´vicmd' or 'vixcmd' option). This has at least two advantages + over built-in command-line mode: + - one can use full power of Vim to edit text; + - finding and reusing history entries becomes possible. + + The facility is supported by four input submodes of the command-line: + - command; + - forward search; + - backward search; + - file rename (see description of cw and cW normal mode keys). + + Editing command-line using external editor is activated by the c_CTRL-G + shortcut. It's also possible to do almost the same from Normal and + Visual modes using q:, q/ and q? commands. + + Temporary file created for the purpose of editing the line has the fol‐ + lowing structure: + + 1. First line, which is either empty or contains text already entered + in command-line. + + 2. 2nd and all other lines with history items starting with the most + recent one. Altering this lines in any way won't change history + items stored by vifm. + + After editing application is finished the first line of the file is + taken as the result of operation, when the application returns zero + exit code. If the application returns an error (see :cquit command in + Vim), all the edits made to the file are ignored, but the initial value + of the first line is saved in appropriate history. + +Commands + Commands are executed with :command_name<Return> + + Commented out lines should start with the double quote symbol, which + may be preceded by whitespace characters. + + ´|' can be used to separate commands, so you can give multiple commands + in one line. If you want to use '|' in an argument, precede it with + '\'. + + These commands see '|' as part of their arguments even when it's + escaped: + + :[range]! + :cmap + :cnoremap + :command + :filetype + :fileviewer + :filextype + :map + :mmap + :mnoremap + :nmap + :nnoremap + :noremap + :normal + :qmap + :qnoremap + :vmap + :vnoremap + :windo + :winrun + + To be able to use another command after one of these, wrap it with the + :execute command. An example: + if filetype('.') == 'reg' | execute '!!echo regular file' | endif + + :[count] + + :number + move to the file number. + :12 would move to the 12th file in the list. + :0 move to the top of the list. + :$ move to the bottom of the list. + + :[count]command + The only builtin :[count]command are :[count]d[elete] and + :[count]y[ank]. + + :d3 would delete three files starting at the current file position + moving down. + + :3d would delete one file at the third line in the list. + + :command [args] + + :[range]!program + will execute the program in a shell + + :[range]!command & + + will run the process in the background using vifm's means. + + Programs that write to stdout like ls will create an error message + showing partial output of the command. + + Take note of the space before ampersand symbol, if you omit it, command + will be run in the background using job control of your shell. + + Accepts macros. + + :[range]!! <program> + is the same as :! but will pause the screen before returning to + Vifm. + + :!! will execute the last command. + + :[range]alink[!?] + creates absolute symbolic links of files in directory of other + view. With "?" vifm will open vi to edit filenames. "!" + forces overwrite. + + :[range]alink[!] path + creates absolute symbolic links of files in directory specified + with the path (absolute or relative to directory of other view). + "!" forces overwrite. + + :[range]alink[!] name1 name2... + creates absolute symbolic links of files in directory of other + view giving each next link a corresponding name from the argu‐ + ment list. "!" forces overwrite. + + :apropos manpage + will create a menu of items returned by the apropos command. + Selecting an item in the menu will open the corresponding man‐ + page. By default the command relies on the external "apropos" + utility, which can be customized by altering value of the 'apro‐ + posprg' option. + + :apropos + repeats last :apropos command. + + :cd or :cd ~ or :cd $HOME + change to your home directory. + + :cd - go to previous directory. + + :cd ~/dir + change directory to ~/dir. + + :cd /curr/dir /other/dir + change directory of the current pane to /curr/dir and directory + of the other pane to /other/dir. When using relative paths vifm + assumes that both of them are relative to current directory of + current view. Command will not fail if one of directories is + invalid. Accepts macros. + + :cd! /dir + same as :cd /dir /dir. + + :c[hange] + create a menu window to alter a files properties. + + :[range]chmod + shows file attributes (permission on *nix and properties on Win‐ + dows) change dialog. + + :[range]chmod[!] arg... + only for *nix + changes permissions for files. See 'man chmod' for arg format. + "!" means set permissions recursively. + + :[range]chown + only for *nix + same as co key in normal mode. + + :[range]chown [user][:][group] + only for *nix + changes owner and/or group of files. Operates on directories + recursively. + + :[range]clone[!?] + clones files in current directory. With "?" vifm will open vi + to edit filenames. "!" forces overwrite. Macros are expanded. + + :[range]clone[!] path + clones files to directory specified with the path (absolute or + relative to current directory). "!" forces overwrite. Macros + are expanded. + + :[range]clone[!] name1 name2... + clones files in current directory giving each next clone a cor‐ + responding name from the argument list. "!" forces overwrite. + Macros are expanded. + + :colo[rscheme]? + prints current color scheme name in the status bar. + + :colo[rscheme] + gives a menu with a list of available color schemes. You can + choose default color scheme here. It will be used for view if + no DIRECTORY in colorscheme file fits current path. It's also + used to set border color (except view titles) and colors in the + menus and dialogs. + + :colo[rscheme] color_scheme_name + changes default color scheme to color_scheme_name. + + :colo[rscheme] color_scheme_name directory + associates directory with the color scheme. The directory argu‐ + ment can be both absolute or relative path when :colorscheme + command is executed from command line, but mandatory should be + an absolute path when the command is executed in scripts loaded + at startup (until vifm is completely loaded). + + :comc[lear] + removes all user defined commands. + + :com[mand] + gives a menu of user commands. + + :com[mand] beginning + shows user defined commands that start with the beginning. + + :com[mand] name action + sets a new user command. + Trying to use a reserved command name will result in an error + message. + Use :com[mand]! to overwrite a previously set command. + Unlike vim user commands do not have to start with a capital + letter. User commands are run in a shell by default. To run a + command in the background you must set it as a background com‐ + mand with & at the end of the commands action (:com rm rm %f &). + Command name cannot contain numbers or special symbols (except + '?' and '!'). + + :com[mand] name /pattern + will set search pattern. + + :com[mand] name filter pattern + will set file name filter. + + :com[mand] cmd :commands + will set kind of alias for internal command (like in a shell). + Will pass range given to alias to an aliased command, so running + :%cp after + :command cp :copy %a + equals + :%copy + + :[range]co[py][!?][ &] + copies files to directory of other view. With "?" vifm will + open vi to edit filenames. "!" forces overwrite. + + :[range]co[py][!] path[ &] + copies files to directory specified with the path (absolute or + relative to directory of other view). "!" forces overwrite. + + :[range]co[py][!] name1 name2...[ &] + copies files to directory of other view giving each next file a + corresponding name from the argument list. "!" forces over‐ + write. + + :[range]d[elete][!][ &] + delete selected file or files. "!" means completely remove + file. + + :[range]d[elete][!] [reg] [count][ &] + will delete files to the reg register. "!" means completely + remove file. + + :delc[ommand] command_name + will remove the command_name user command. + + :delm[arks]! + will delete all marks. + + :delm[arks] marks ... + will delete specified marks, each argument is treated as a set + of marks. + + :di[splay] + popup menu with registers content. + + :di[splay] list ... + display the contents of the numbered and named registers that + are mentioned in list (for example "az to display "", "a and "z + content). + + :dirs display directory stack. + + :ec[ho] [<expr>...] + evaluates each argument as an expression and outputs them sepa‐ + rated by a space. See help on :let command for a definition of + <expr>. + + :[range]e[dit] [file...] + will load the selected or passed file or files into vi. Accepts + macros. + + :el[se] + executes commands until next matching :endif if they previously + were not being executed. See also help on :if and :endif com‐ + mands. + + :empty will permanently remove 'rm -fr' files from trash directory. It + will also remove all operations from undolist that have no sense + after :empty and remove all records about files in trash direc‐ + tory from all registers. See "Trash directory" section below. + + :en[dif] + ends conditional block. See also help on :if and :else com‐ + mands. + + :exe[cute] [<expr>...] + evaluates each argument as an expression and joins results sepa‐ + rated by a space to get a single string, which is then executed + as a command-line command. See help on :let command for a defi‐ + nition of <expr>. + + :exi[t][!] + same as :quit. + + :f[ile] + popup menu of programs set for the file type of the current + file. Add ' &' at the end of command to run program in back‐ + ground. + + :f[ile] arg + run associated command that begins with the arg without opening + menu. + + :filet[ype] pat1,pat2,... [{descr}]def_prog[ &],[{descr}]prog2[ &],... + will associate given program list to each of the patterns. + Associated program (command) is used by handlers of l and Enter + keys (and also in the :file menu). If you need to insert comma + into command just double it (",,"). Space followed by an amper‐ + sand as two last characters of a command means running of the + command in the background. Optional description can be given to + each command to ease understanding of what command will do in + the :file menu. Vifm will try the rest of the programs for an + association when the default isn't found. When program entry + doesn't contain any of vifm macros, name of current file is + appended as if program entry ended with %c macro. On Windows + path to executables containing spaces can (and should be for + correct work with such paths) be double quoted. See "Globs" + section below for pattern definition. See also "Automatic FUSE + mounts" section below. Example for zip archives and several + actions: + + filetype *.zip,*.jar,*.war,*.ear + \ {Mount with fuse-zip} + \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, + \ {View contents} + \ zip -sf %c | less, + \ {Extract here} + \ tar -xf %c, + + :filex[type] pat1,pat2,... [{ description }] def_program,program2,... + same as :filetype, but vifm will ignore this command if it's not running in X. + In X :filextype is equal to :filetype. See "Globs" section below for pattern + definition. See also "Automatic FUSE mounts" section below. + + :filev[iewer] pat1,pat2,... command + will associate given command as a viewer to each of the patterns. Viewer is a + command which output is captured and showed in the second pane of vifm after + running :view command. When the command doesn't contain any of vifm macros, + name of current file is appended as if command ended with %c macro. See + "Globs" section below for pattern definition. Example for zip archives: + + fileviewer *.zip,*.jar,*.war,*.ear zip -sf %c + + :filter[!] regular_expression_pattern + :filter[!] /regular_expression_pattern/ + will filter all the files out of the directory listing that match the regular + expression. Using second variant you can use the bar ('|') symbol without + escaping. Empty regular expression (specified by //, "" or '') means using of + the last search pattern. Use '!' to control state of filter inversion after + updating filter value (also see 'cpoptions' description). Filter is matched + case sensitively on *nix and case insensitively on Windows. + :filter /.o$ would filter all files ending in .o from the filelist. + Note: vifm uses extended regular expressions. + + :filter + reset filter (set it to empty string) and show all files. + + :filter! + same as :invert. + + :filter? + show current value of name and auto filters. + + :[range]fin[d] pattern + will show results of find command in the menu. Searches among selected files if + any. Accepts macros. By default the command relies on the external "find" + utility, which can be customized by altering value of the 'findprg' option. + + :[range]fin[d] -opt... + same as :find above, but user defines all find arguments. Searches among + selected files if any. + + :[range]fin[d] path -opt... + same as :find above, but user defines all find arguments. Ignores selection and + range. + + :[range]fin[d] + repeats last :find command. + + :fini[sh] + Stop sourcing a script. Can only be used in a vifm script file. This is a quick + way to skip the rest of the file. + + :[range]gr[ep][!] pattern + will show results of grep command in the menu. Add "!" to request inversion of + search (look for lines that do not match pattern). Searches among selected + files if any and no range given. Ignores binary files by default. By default + the command relies on the external "grep" utility, which can be customized by + altering value of the 'grepprg' option. + + :[range]gr[ep][!] -opt... + same as :grep above, but user defines all find arguments, which are not escaped. + Searches among selected files if any. + + :[range]gr[ep][!] + repeats last :grep command. "!" of this command inverts "!" in repeated + command. + + :h[elp] + show the help file. + + :h[elp] argument + is the same as using ':h argument' in vim. Use vifm-<something> to get help + on vifm (tab completion works). This form of the command doesn't work when + ´vimhelp' option is off. + + :hi[ghlight] + will show information about all highlight groups in the current directory. + + :hi[ghlight] group-name + will show information on given highlight group of the default color scheme. + + :hi[ghlight] group-name cterm=style | ctermfg=color | ctermbg=color + sets style (cterm), foreground (ctermfg) or/and background (ctermbg) parameters + of highlight groups of the current default color scheme. + + Available style values (some of them can be combined): + - bold + - underline + - reverse or inverse + - standout + - none + + Available group-name values: + - Win - color of all windows (views, dialogs, menus) + - Border - color of vertical parts of the border + - TopLineSel - top line color of the current pane + - TopLine - top line color of the other pane + - CmdLine - the command line/status bar color + - ErrorMsg - color of error messages in the status bar + - StatusLine - color of the line above the status bar + - WildMenu - color of the wild menu items + - CurrLine - line at cursor position in the view + - Selected - color of selected files + - Directory - color of directories + - Link - color of symbolic links in the views + - BrokenLink - color of broken symbolic links + - Socket - color of sockets + - Device - color of block and character devices + - Executable - color of executable files + - Fifo - color of fifo pipes + + Available colors: + - -1 or default or none - default or transparent + - black + - red + - green + - yellow + - blue + - magenta + - cyan + - white + + Light versions of colors are regular colors with bold attribute set. So order + of arguments of :highlight command is important and it's better to put "cterm" + in front of others to prevent it from overwriting attributes set by "ctermfg" or + "ctermbg" arguments. + + Since there are two colors and only one bold attribute it affects both colors + when "reverse" attribute is used when running vifm in terminal emulator. While + linux native console can handle boldness of foreground and background colors + independently, which is for consistency with terminal emulators accessible from + vifm only implicitly by using light versions of colors. + + Here is the hierarchy of highlight groups, which you need to know for using + transparency: + StatusLine + WildMenu + Border + CmdLine + ErrorMsg + Win + Directory + Link + BrokenLink + Socket + Device + Fifo + Executable + Selected + CurrLine + TopLine + TopLineSel + + "none" means default terminal color for highlight groups at the first level of + the hierarchy and transparency for all others. + + :his[tory] + creates a popup menu of directories visited. + + :his[tory] x + x can be: + d[ir] or . show directory history. + c[md] or : show command line history. + s[earch] or / show search history and search forward on l key. + f[search] or / show search history and search forward on l key. + b[search] or ? show search history and search backward on l key. + i[nput] or @ show prompt history (e.g. on one file renaming). + fi[lter] or = show filter history (see description of the "=" normal mode command). + + :if {expr1} + starts conditional block. Commands are executed until next matching :else of + :endif command if {expr1} evaluates to non-zero, otherwise they are ignored. + See also help on :else and :endif commands. + + :invert [f] + invert file name filter. + + :invert? [f] + show current filter state. + + :invert s + invert selection. + + :invert o + invert sorting order of the primary sorting key. + + :invert? o + show sorting order of the primary sorting key. + + :jobs shows menu of current backgrounded processes. + + :let $ENV_VAR = <expr> + sets environment variable. Warning: setting environment variable to an empty + string on Windows removes it. + + :let $ENV_VAR .= <expr> + append value to environment variable. + + Where <expr> could be a single-quoted string, double-quoted string, an environment variable, function call or a concatanation of any of them in any order using the '.' operator. Any whitespace is ignored. + + :locate filename + uses the locate command to create a menu of filenames + Selecting a file from the menu will reload the current file list in vifm + to show the selected file. By default the command relies on the external + "locate" utility (it's assumed that its database is already built), which can be + customized by altering value of the 'locateprg' option. + + :locate + repeats last :locate command. + + :[range]ma[rk][?] x [/full/path] [filename] + Set mark x (a-zA-Z0-9) at /full/path and filename. By default current directory + is being used. If no filename was given and /full/path is current directory + then last file in [range] is used. Using of macros is allowed. Question mark + will stop command from overwriting existing marks. + + :marks create a popup menu of bookmarks. + + :marks list ... + display the contents of the marks that are mentioned in list. + + :mes[sages] + shows previously given messages (up to 50). + + :mkdir[!] dir ... + creates directories with given names. "!" means make parent directories as + needed. Macros are expanded. + + :[range]m[ove][!?][ &] + moves files to directory of other view. With "?" vifm will open vi to edit + filenames. "!" forces overwrite. + + :[range]m[ove][!] path[ &] + moves files to directory specified with the path (absolute or relative to + directory of other view). "!" forces overwrite. + + :[range]m[ove][!] name1 name2...[ &] + moves files to directory of other view giving each next file a corresponding + name from the argument list. "!" forces overwrite. + + :noh[lsearch] + clear selection in current pane. + + :norm[al][!] commands + executes normal mode commands. If "!" is used, mappings will not be used. If + the last command is unfinished it will be aborted as if <esc> or <c-c> was + typed. A ":" should be completed as well. Commands can't start with a space, + so put a count of 1 (one) before it. + + :on[ly] + changes the window to show only the current file directory. + + :popd remove pane directories from stack. + + :pushd[!] /curr/dir [/other/dir] + add pane directories to stack and process arguments like :cd command. + + :pushd exchanges the top two items of the directory stack. + + :pw[d] show the present working directory. + + :q[uit][!] + will exit vifm (add ! if you don't want to save changes or check if there are + any of backgrounded commands still running). + + :[range]y[ank] [reg] [count] + will yank files to the reg register. + + :ls lists windows of active terminal multiplexer (only when terminal multiplexer is + used). This is achieved by issuing proper command for active terminal + multiplexer, thus the list is not handled by vifm. + + :reg[isters] + popup menu with registers content. + + :reg[isters] list ... + display the contents of the numbered and named registers that are mentioned in + list (for example "az to display "", "a and "z content). + + :[range]rename[!] + rename files using vi to edit names. ! means go recursively through directories. + + :[range]rename name1 name2... + rename each of selected files to a corresponding name. + + :restart + will free a lot of things (histories, commands, etc.), reread vifminfo and + vifmrc files and run startup commands passed in the argument list, thus losing + all unsaved changes (e.g. recent history or keys mapped in current session). + + :[range]restore + will restore file from trash directory, doesn't work in any other directory. + See "Trash directory" section below. + + :[range]rlink[!?] + creates relative symbolic links of files in directory of other view. With "?" + vifm will open vi to edit filenames. "!" forces overwrite. + + :[range]rlink[!] path + creates relative symbolic links of files in directory specified with the path + (absolute or relative to directory of other view). "!" forces overwrite. + + :[range]rlink[!] name1 name2... + creates relative symbolic links of files in directory of other view giving each + next link a corresponding name from the argument list. "!" forces overwrite. + + :screen + toggles whether to use the terminal multiplexer or not. + A terminal multiplexer uses pseudo terminals to allow multiple windows to be + used in the console or in a single xterm. Starting vifm from terminal + multiplexer with appropriate support turned on will cause vifm to open a new + terminal multiplexer window for each new file edited or program launched from + vifm. + This requires screen version 3.9.9 or newer for the screen -X argument or tmux + (version or newer 1.8 is recommented). + + :screen? + shows whether integration with terminal multiplexers is enabled. + + Note: the command is called screen for historical reasons (when tmux wasn't yet + supported) and might be changed in future releases, or get an alias. + + :se[t] shows all options that differ from their default value. + + :se[t] all + shows all options. + + :se[t] opt1=val1 opt2='val2' opt3="val3" ... + will set options to given values. + You can use following syntax: + - for all options - option, option? and option& + - for boolean options - nooption, invoption and option! + - for integer options - option=x, option+=x and option-=x + - for string options - option=x + - for string list options - option=x, option+=x and option-=x + - for enumeration options - option=x, option+=x and option-=x + - for enumeration options - option=x + - for set options - option=x, option+=x and option-=x + - for charset options - option=x, option+=x and option-=x + + the meaning: + - option - turn option on (for boolean) or print its value (for all others) + - nooption - turn option off + - invoption - invert option state + - option! - invert option state + - option? - print option value + - option& - reset option to its default value + - option=x or option:x - set option to x + - option+=x - add x to option + - option-=x - remove (or subtract) x from option + + Option name can be prepended and appended by any number of whitespace + characters. + + :sh[ell] + will start a shell. + + :sor[t] + creates a popup menu of different sorting methods, when one can select primary + sorting key. When 'viewcolumns' options is empty and 'lsview' is off, changing + primary sorting key will also affect view look (in particular the second column + of the view will be changed). + + :so[urce] file + reads command-line commands from the file. + + :sp[lit] + switch to a two window horizontal view. + + :sp[lit]! + toggles window horizontal splitting. + + :sp[lit] path + splits the window horizontally to show both file directories. And changes other + pane to path (absolute or relative to current directory of active pane). + + :[range]s[ubstitite]/pattern/string/[flags] + for each file in range replace a match of pattern with string. + + String can contain \0...\9 to link to capture groups (\0 - all match, \1 - + first group, etc.). + + Available flags: + + - i - ignore case (the 'ignorecase' and 'smartcase' options are not used) + + - I - don't ignore case (the 'ignorecase' and 'smartcase' options are not used) + + - g - substitute all matches in each file name (each g toggles this) + + :[range]s[ubstitute]//string/[flags] + will use previous pattern. + + :[range]s[ubstitute] + will repeat previous substitution command. + + :sync [relative path] + change the other panel to the current panel directory or to some path relative + to the current directory. Using macros is allowed. + + :sync! + change the other panel to the current panel directory and synchronize cursor + position. + + :touch file... + will create files. Aborts on errors and won't update time of existing files. + Macros are expanded. + + :[range]tr/pattern/string/ + for each file in range transliterate the characters which appear in pattern to + the corresponding character in string. When string is shorter than pattern, + it's padded with its last character. + + String can contain ...9 to link to capture groups (0 - all match, 1 - first + group, etc.). + + :undol[ist] + show list of latest changes. Add ! to see commands. + + :unl[et][!] $ENV_VAR1 $ENV_VAR2 ... + remove environment variables. Add ! to omit displaying of warnings about + nonexistent variables. + + :ve[rsion] + show menu with version information. + + :vifm same as :version. + + :vie[w] + toggle on and off the quick file view. + + :vie[w]! + turns on quick file view if it's off. + + :volumes + only for MS-Windows + will popup menu with volume list. Hitting l (or Enter) key will open + appropriate volume in the current pane. + + :vs[plit] + switch to a two window vertical view. + + :vs[plit]! + toggles window vertical splitting. + + :vs[plit] path + splits the window vertically to show both file directories. And changes other + pane to path (absolute or relative to current directory of active pane). + + :windo [command...] + Execute command for each pane (same as :winrun % command). + + :winrun type [command...] + Execute command for pane(s), which is determined by type argument: + - ^ - top-left pane + - $ - bottom-right pane + - % - all panes + - . - current pane + - , - other pane + + :w[rite] + write vifminfo file (add ! to force write even if settings weren't changed). + + :wq[!] same as :quit, but ! only disables check of backgrounded commands. + + :x[it][!] + will exit Vifm (add ! if you don't want to save changes). + + + :map lhs rhs + map lhs key sequence to rhs in normal and visual modes. + + :map! lhs rhs + map lhs key sequence to rhs in command line mode. + + + :cm[ap] lhs rhs + map lhs to rhs in command line mode. + + :mm[ap] lhs rhs + map lhs to rhs in menu mode. + + :nm[ap] lhs rhs + map lhs to rhs in normal mode. + + :qm[ap] lhs rhs + map lhs to rhs in view mode. + + :vm[ap] lhs rhs + map lhs to rhs in visual mode. + + + :cm[ap] + lists all maps in command line mode. + + :mm[ap] + lists all maps in menu mode. + + :nm[ap] + lists all maps in normal mode. + + :qm[ap] + lists all maps in view mode. + + :vm[ap] + lists all maps in visual mode. + + + :cm[ap] beginning + lists all maps in command line mode that start with the beginning. + + :mm[ap] beginning + lists all maps in menu mode that start with the beginning. + + :nm[ap] beginning + lists all maps in normal mode that start with the beginning. + + :qm[ap] beginning + lists all maps in view mode that start with the beginning. + + :vm[ap] beginning + lists all maps in visual mode that start with the beginning. + + + :no[remap] lhs rhs + map the key sequence lhs to {rhs} for normal and visual modes, but disallow + mapping of rhs. + + :no[remap]! lhs rhs + map the key sequence lhs to {rhs} for command line mode, but disallow mapping of + rhs. + + + :cno[remap] lhs rhs + map the key sequence lhs to {rhs} for command line mode, but disallow mapping of + rhs. + + :mn[oremap] lhs rhs + map the key sequence lhs to {rhs} for menu mode, but disallow mapping of rhs. + + :nn[oremap] lhs rhs + map the key sequence lhs to {rhs} for normal mode, but disallow mapping of rhs. + + :qn[oremap] lhs rhs + map the key sequence lhs to {rhs} for view mode, but disallow mapping of rhs. + + :vn[oremap] lhs rhs + map the key sequence lhs to {rhs} for visual mode, but disallow mapping of rhs. + + + :unm[ap] lhs + remove the mapping of lhs from normal and visual modes. + + :unm[ap]! lhs + remove the mapping of lhs from command line mode. + + + :cu[nmap] lhs + remove the mapping of lhs from command line mode. + + :mu[nmap] lhs + remove the mapping of lhs from menu mode. + + :nun[map] lhs + remove the mapping of lhs from normal mode. + + :qun[map] lhs + remove the mapping of lhs from view mode. + + :vu[nmap] lhs + remove the mapping of lhs from visual mode. + +Ranges + The ranges implemented include: + 2,3 - from second to third file in the list (including it) + % - the entire directory. + . - the current position in the filelist. + $ - the end of the filelist. + 't - the mark position t. + + Examples: + + :%delete + + would delete all files in the directory. + + :2,4delete + + would delete the files in the list positions 2 through 4. + + :.,$delete + + would delete the files from the current position to the end of the + filelist. + + :3delete4 + + would delete the files in the list positions 3, 4, 5, 6. + + If a backward range is given :4,2delete - an query message is given and + user can chose what to do next. + + The builtin commands that accept a range are :d[elete] and :y[ank]. + +Command macros + The command macros may be used in user commands. + + %a User arguments. When user arguments contain macros, they are + expanded before preforming substitution of %a. + + %c %"c The current file under the cursor. + + %C %"C The current file under the cursor in the other directory. + + %f %"f All of the selected files. + + %F %"F All of the selected files in the other directory list. + + %b %"b Same as %f %F. + + %d %"d Full path to current directory. + + %D %"D Full path to other file list directory. + + %rx %"rx + Full paths to files in the register {x}. In case of invalid + symbol in place of {x}, it's processed with the rest of the line + and default register is used. + + %m Show command output in a menu. + + %M Same as %m, but l (or Enter) key is handled like for :locate and + :find commands. + + %S Show command output in the status bar. + + %s Execute command in split window of active terminal multiplexer + (ignored if not running inside one). + + %i Completely ignore command output. + + Use %% if you need to put a percent sign in your command. + + Note that %m, %M, %s, %S and %i macros are mutually exclusive. Only the + last one of them in the command will take effect. + + You can use filename modifiers after %c, %C, %f, %F, %b, %d and %D + macros. Supported modifiers are: + + - :p - full path + + - :u - UNC name of path (e.g. "\\server" in + "\\server\share"), Windows only. Expands to current computer name + for not UNC paths. + + - :~ - relative to the home directory + + - :. - relative to current directory + + - :h - head of the filename + + - :t - tail of the filename + + - :r - root of the filename (without last extension) + + - :e - extension of the filename (last one) + + - :s?pat?sub? - substitute the first occurrence of pat with sub. You + can use any character for '?', but it must not occur in pat or sub. + + - :gs?pat?sub? - like :s, but substitutes all occurrences of pat with + sub. + + See ':h filename-modifiers' in Vim's documentation for the detailed + description. + + Using %x means expand corresponding macro escaping all characters + that have special meaning. And %"x means using of double quotes and + escape only backslash and double quote characters, which is more use‐ + ful on Windows systems. + + Position and quantity (if there is any) of %m, %M, %S or %s macros in + the command is unimportant. All their occurrences will be removed + from the resulting command. + + %c and %f macros are expanded to file names only, when %C and %F are + expanded to full paths. %f and %F follow this in %b too. + + :com move mv %f %D + would set the :move command to move all of the files selected in the + current directory to the other directory. + + The %a macro will substitute any arguments given in a command into the + command. All arguments are considered optional. ":com lsl !!ls -l %a" + will set the lsl command to execute ls -l with or without an argument. + + :lsl<Return> + will list the directory contents of the current directory. + + :lsl filename<Return> + will list only the given filename. + + The macros can also be used in directly executing commands. ":!mv %f + %D" would move the current directory selected files to the other direc‐ + tory. + + Appending & to the end of a command will cause it to be executed in the + background.Typically you want to run two kinds of external commands in + thebackground: + - GUI applications that doesn't fork thus block vifm (:!sxiv %f &); + - console tools that do not work with terminal (:!mv %f %D &). + + You don't want to run terminal commands, which require terminal input + oroutput something because they will mess up vifm's TUI. Anyway, if you + did runsuch a command, you can use Ctrl-L key to update vifm's TUI. + + Rewriting the example command with macros given above with background‐ + ing: + + :!mv %f %D & + + Note that %m, %M, %s, %S and %i macros have bigger priority than &. So + command containing at least one of them can't be backgrounded and " &" + at the end will be just silently ignored. + +Command backgrounding + Copy and move operation can take a lot of time to proceed. That's why + vifm supports backgrounding of this two operations. To run :copy, + :move or :delete command in the background just add " &" at the end of + a command. + + For each background operation a new thread will be created. Currently + job cannot be stopped or paused. + + You can see if command is still running in the :jobs menu. Back‐ + grounded commands have progress instead of process id at the line + beginning. + + Background operations cannot be undone. + +Globs + :filetype, :filextype and :fileviewer commands support globs to match + file names. Here is a short overview of globs and some important + points that one needs to know about them. + + Only names of files are matched by the globs, not full paths. E.g. + :filetype Makefile make %c + will match files with name "Makefile" regardless whether it's in root + or home directory. + + *, ?, [ and ] are treated as special symbols in the pattern. E.g. + :filetype * less %c + matches all files. One can use character classes for escaping, so + :filetype [*] less %c + matches only one file name, the one which contains only asterisk sym‐ + bol. + + * means any number of any characters (possibly an empty substring), + with one exception: asterisk at the pattern beginning doesn't match dot + in the first position. E.g. + :fileviewer *.zip,*.jar zip -sf %c + associates using of zip program to preview all files with zip or jar + extensions as listing of their content. + + ? means any character at this position. E.g. + :fileviewer ?.out file %c + calls file tool for all files which has exactly one character before + their extension (e.g. a.out, b.out). + + Square brackets designate character class, which means that whole char‐ + acter class matches against any of characters listed in it. For exam‐ + ple + :fileviewer *.[ch] highlight -O xterm256 -s dante --syntax c %c + makes vifm call highlight program to colorize source and header files + in C language for a 256-color terminal. Equal command would be + :fileviewer *.c,*.h highlight -O xterm256 -s dante --syntax c %c + + Inside square brackets ^ or ! can be used for symbol class negotiation + and the - symbol to set a range. ^ and ! should appear right after the + opening square bracket. For example + :filetype *.[!d]/ inspect_dir + associates inspect_dir as additional handler for all directories that + have one character extension unless it's "d" letter. And + :filetype [0-9].jpg sxiv + associates sxiv picture viewer only for JPEG-files that contain single + digit in their name. + +:set options + Local options + These are kind of options that are local to a specific view. So + you can set ascending sorting order for left pane and descending + order for right pane. + + aproposprg + type: string + default: "apropos %a" + Specifies format for an external command to be invoked by the + :apropos command. The format supports expanding of macros, spe‐ + cific for a particular *prg option, and %% sequence for insert‐ + ing percent sign literally. This option should include the %a + macro to specify placement of arguments passed to the :apropos + command. If the macro is not used, it will be implicitly added + after a space to the value of this option. + + autochpos + type: boolean + default: true + When disabled vifm will set cursor to the first line in the view + after :cd and :pushd commands instead of saved cursor position. + Disabling this will also make vifm clear information about cur‐ + sor position in the view history on :cd and :pushd commands (and + on startup if autochpos is disabled in the vifmrc). l key in + the :history . menu is treated like :cd command. This option + affects bookmarks, file position will not preserved. + + columns co + type: int + default: terminal width on startup + Terminal width in characters. + + classify + type: string list + default: ":dir:/" + Specifies file name prefixes and suffixes depending on file + types. The format is: [{prefix}]:{filetype}:[{suffix}]. Either + {prefix} or {suffix} or both of them can be omitted (which is + the default for all unspecified file types), this means empty + {prefix} and/or {suffix}. {prefix} and {suffix} should consist + exactly of one character. Elements are separated by commas. + Neither prefixes nor suffixes are part of file names, so they + don't affect commands which operate on file names in any way. + Comma (',') character should not be used. List of file type + names can be found in the description of filetype() function. + + confirm cf + type: boolean + default: true + Ask about permanent deletion of files (on D or :delete! command + or on undo/redo operation). + + cpoptions cpo + type: charset + default: "fst" + Contains a sequence of single-character flags. Each flag + enables behaviour of older versions of vifm. Flags: + f - when included, running :filter command results in not + inverted (matching files are filtered out) and :filter! in + inverted (matching files are left) filter, when omitted, meaning + of the exclamation mark changes to the opposite; + s - when included, yy, dd and DD normal mode commands act on + selection, otherwise they operate on current file only; + t - when included, <tab> (thus <c-i>) behave as <space> and + switch active pane, otherwise <tab> and <c-i> go forward in the + view history. + + dotdirs + type: set + default: nonrootparent + Controls displaying of dot directories. The following values + are possible: + - rootparent - show "../" in root directory of file system + - nonrootparent - show "../" in non-root directories of file + system + Note that empty directories will always contain "../" entry + regardless of value of this option. "../" will disappear at the + moment at least one file is created inside the directory. + + fastrun + type: boolean + default: false + With this option turned on you can run partially entered com‐ + mands with unambiguous beginning using :! (e.g. :!Te instead of + :!Terminal or :!Te<tab>). + + findprg + type: string + default: "find %s %a -print , -type d \( ! -readable -o ! -exe‐ + cutable \) -prune" + Specifies format for an external command to be invoked by the + :find command. The format supports expanding of macros, spe‐ + cific for a particular *prg option, and %% sequence for insert‐ + ing percent sign literally. This option should include the %s + macro to specify placement of list of paths to search in and the + %a macro to specify placement of arguments passed to the :find + command. If some of the macros are not used, they will be + implicitly added after a space to the value of the option in the + following order: %s, %a. + + %s and %a macro can slightly change their meaning depending on + :find command arguments. When the first argument points to an + existing directory, %s is assigned all arguments and %a is left + empty. Otherwise, %s is assigned a dot (".") meaning current + directory or list of selected filenames if any. %a is assigned + arguments when first argument starts with a dash ("-"), other‐ + wise an escaped version of arguments, prepended by "-name" (on + *nix) or "-iname" (on Windows) predicate. + + followlinks + type: boolean + default: true + Follow links on l or Enter. + + fusehome + type: string + default: "($TMPDIR | $TEMP | $TEMPDIR | $TMP)/vifm_FUSE/" + Directory to be used as a root dir for FUSE mounts. Value of + the option can contain environment variables (in form + "$envname"), which will be expanded (prepend it with a slash to + prevent expansion). The value should expand to an absolute + path. + + If you change this option, vifm won't remount anything. It + affects future mounts only. See "Automatic FUSE mounts" section + below for more information. + + gdefault gd + type: boolean + default: false + When on, 'g' flag is on for :substitute by default. + + grepprg + type: string + default: "grep -n -H -I -r %i %a %s" + Specifies format for an external command to be invoked by the + :grep command. The format supports expanding of macros, spe‐ + cific for a particular *prg option, and %% sequence for insert‐ + ing percent sign literally. This option should include the %i + macro to specify placement of "-v" string when inversion of + results is requested, the %a macro to specify placement of argu‐ + ments passed to the :grep command and the %s macro to specify + placement of list of files to search in. If some of the macros + are not used, they will be implicitly added after a space to the + value of the 'grepprg' option in the following order: %i, %a, + %s. + + Example of setup to use ack (http://beyondgrep.com/) instead of + grep: + set grepprg=ack\ -H\ -r\ %i\ %a\ %s + or The Silver Searcher (https://github.com/ggreer/the_sil‐ + ver_searcher): + set grepprg=ag\ --line-numbers\ %i\ %a\ %s + + + history hi + type: integer + default: 15 + Maximum number of directories in the view history and lines in + the prompt, command line and search histories. + + hlsearch hls + type: bool + default: true + Highlight all matches of search pattern. + + iec type: boolean + default: false + Use KiB, MiB, ... instead of KB, MB, ... + + ignorecase ic + type: boolean + default: false + Ignore case in search patterns (:substitute, / and ? commands) + and characters after f and F commands. It doesn't affect file + filtering. + + incsearch is + type: boolean + default: false + When this option is set, search will be performed starting from + initial cursor position each time search pattern is changed. + + laststatus ls + type: boolean + default: true + Controls if status bar is visible. + + lines type: int + default: terminal height on startup + Terminal height in lines. + + locateprg + type: string + default: "locate %a" + Specifies format for an external command to be invoked by the + :locate command. The format supports expanding of macros, spe‐ + cific for a particular *prg option, and %% sequence for insert‐ + ing percent sign literally. This option should include the %a + macro to specify placement of arguments passed to the :locate + command. If the macro is not used, it will be implicitly added + after a space to the value of this option. + + lsview type: boolean + default: false + type: local + When this option is set, directory view will be displayed in + multiple columns with filenames similar to output of `ls -x` + command. See ls-like view section below for format description. + + rulerformat ruf + type: string + default: "%=%l-%S " + Determines the content of the ruler. Its width is 13 characters + and it's right aligned. Following macros are supported: + %l - file number + %L - total number of files in view (including filtered) + %- - number of filtered files + %S - number of showed files + %= - separation point between left and right align items + %% - percent sign + + Percent sign can be followed by optional minimum field width. + Add '-' before minimum field width if you want field to be right + aligned. Example: + + set rulerformat="%=%2l-%S [%L] " + + runexec + type: boolean + default: false + Run executable file on Enter or l. + + scrollbind scb + type: boolean + default: false + When this option is set, vifm will try to keep difference of + scrolling positions of two windows constant. + + scrolloff so + type: int + default: 0 + Minimal number of screen lines to keep above and below the cur‐ + sor. If you want cursor line to always be in the middle of the + view (except at the beginning or end of the file list), set this + option to some large value (e.g. 999). + + shell sh + type: string + default: $SHELL or "sh" or "cmd" (on MS-Windows) + Full path to the shell to use to run external commands. + + shortmess shm + type: charset + default: "" + Contains a sequence of single-character flags. Each flag + enables shortening of some message displayed by vifm in the TUI. + Flags: + T - truncate status-bar messages in the middle if they are too + long to fit on the command line. "..." will appear in the mid‐ + dle. + + slowfs type: string list + default: "" + only for *nix + A list of mounter fs name beginnings (first column in /etc/mtab + or /proc/mounts) that work too slow for you. This option can be + used to stop vifm from making some requests to particular kinds + of file systems that can slow down file browsing. Currently + this means don't check if directory has changed and do not check + if target of symbolic links exists. + + smartcase scs + type: boolean + default: false + Overrides the ignorecase option if the search pattern contains + at least one upper case character. Only used when ignorecase + option is enabled. It doesn't affect file filtering. + + sort type: string list + default: +name on *nix and +iname on Windows + type: local + Sets list of sorting keys (first item is primary key, second is + secondary key, etc.): + [+-]ext - sort by extension + [+-]name - sort by name (including extension) + [+-]iname - sort by name (including extension, ignores case) + [+-]gid - sort by group id (*nix only) + [+-]gname - sort by group name (*nix only) + [+-]mode - sort by mode (*nix only) + [+-]perms - sort by permissions string (*nix only) + [+-]uid - sort by owner id (*nix only) + [+-]uname - sort by owner name (*nix only) + [+-]size - sort by size + [+-]atime - sort by time accessed + [+-]ctime - sort by time changed + [+-]mtime - sort by time modified + + ´+' means ascending sort for this key, and '-' means descending sort. + + In case name (iname on Windoes) is skipped, it will be added at the end + automatically. + + This option also changes view columns according to primary sorting key + set, unless 'viewcolumns' option is not empty. + + sortnumbers + type: boolean + default: false + type: local + Natural sort of (version) numbers within text. + + statusline stl + type: string + default: "" + Determines the content of the status line (the line right above + command-line). Empty string means use same format like in pre‐ + vious versions. Following macros are supported: + + - %t - file name (considering value of the 'classify' option) + + - %A - file attributes (permissions on *nix or properties on + Windows) + + - %u - user name or uid (if it cannot be resolved) + + - %g - group name or gid (if it cannot be resolved) + + - %s - file size in human readable format + + - %E - size of selected files in human readable format, same as + %s when no files are selected, except that it will never + show size of ../ in visual mode, since it cannot be + selected + + - %d - file modification date (uses 'timefmt' option) + + - all 'rulerformat' macros + + Percent sign can be followed by optional minimum field width. + Add '-' before minimum field width if you want field to be right + aligned. Example: + + set statusline=" %t%= %A %10u:%-7g %15s %20d " + + On Windows file properties include next flags (upper case means + flag is on): + A - archive + H - hidden + I - content isn't indexed + R - readonly + S - system + C - compressed + D - directory + E - encrypted + P - reparse point (e.g. symbolic link) + Z - sparse file + + sortorder + type: enumeration + default: ascending + Sets sort order for primary key: ascending, descending. + + tabstop ts + type: integer + default: value from curses library + Number of spaces that a Tab in the file counts for. + + timefmt + type: string + default: " %m/%d %H:%M" + Format of time in file list. See man date or man strf‐ + time for details. + + timeoutlen tm + type: integer + default: 1000 + The time in milliseconds that is waited for a mapped key + in case of already typed key sequence is ambiguous. + + trash type: boolean + default: true + Use trash directory. See "Trash directory" section + below. + + trashdir + type: string + default: "$HOME/.vifm/Trash" + Sets path to trash directory. Value of the option can + contain environment variables (in form "$envname"), which + will be expanded (prepend it with a slash to prevent + expansion). The value should expand to an absolute path. + + Will attempt to create the directory if it does not + exist. See "Trash directory" section below. + + undolevels ul + type: integer + default: 100 + Maximum number of changes that can be undone. + + vicmd type: string + default: "vim" + The actual command used to start vi. Ampersand sign at + the end (regardless whether it's preceded by space or + not) means backgrounding of command. + + viewcolumns + type: string + default: "" + type: local + Format string containing list of columns in the view. + When this option is empty view columns to show are chosen + automatically using sorting keys (see 'sort') as a base. + Value of this option is ignored if 'lsview' is set. See + Column view section below for format description. + + An example of setting the options for both panes (note + vifm-windo command): + windo set viewcolumns=-{name}..,6{size},11{perms} + + vixcmd type: string + default: value of vicmd + The command used to start vi when in X. Ampersand sign + at the end (regardless whether it's preceded by space or + not) means backgrounding of command. + + vifminfo + type: set + default: bookmarks + + Controls what will be saved in the $VIFM/vifminfo file. + options - all options that can be set with the :set command + filetypes - associated programs and viewers + commands - user defined commands (see :command description) + bookmarks - bookmarks, except special ones like '< and '> + tui - state of the user interface (sorting, number of + windows, quick + view state, active view) + dhistory - directory history + state - file name and dot filters and terminal multiplex‐ + ers integration + state + cs - default color scheme + savedirs - save last visited directory (needs dhistory) + chistory - command line history + shistory - search history (/ and ? commands) + phistory - prompt history + fhistory - filter history (see description of the "=" normal + mode command) + dirstack - directory stack overwrites previous stack, unless + stack of + current session is empty + registers - registers content + + vimhelp + type: boolean + default: false + Use vim help format. + + wildmenu wmnu + type: boolean + default: false + Controls whether possible matches of completion will be + shown above the command line. + + wrap type: boolean + default: true + Controls whether to wrap text in quick view. + + wrapscan ws + type: boolean + default: true + Searches wrap around end of the list. + +Mappings + Since it's not easy to enter special characters there are several spe‐ + cial sequences that can be used in place of them. They are: + + <cr> Enter key + + <bs> Backspace key + + <tab> <s-tab> + Tabulation and Shift+Tabulation keys + + <esc> <space> <home> <end> <left> <right> <up> <down> <pageup> <page‐ + down> + Keys with obvious names. + + <del> <delete> + Delete key. <del> and <delete> mean different codes, but + <delete> is more common. + + <c-a>,<c-b>,...,<c-z>,<c-[>,<c->,<c-]>,<c-^>,<c-_> + Control + some key. + + <a-a>,<a-b>,...,<a-z> + <m-a>,<m-b>,...,<m-z> Alt + some key. + + <a-c-a>,<a-c-b>,...,<a-c-z> + <m-c-a>,<m-c-b>,...,<m-c-z> only for *nix + Alt + Ctrl + some key. + + <f0> - <f63> + Functional keys + + <c-f1> - <c-f12> + only for MS-Windows + Functional keys with Control key pressed. + + <a-f1> - <a-f12> + only for MS-Windows + Functional keys with Alt key pressed. + + <s-f1> - <s-f12> + only for MS-Windows + Functional keys with Shift key pressed. + + vifm removes whitespace characters at the beginning and end of com‐ + mands. That's why you may want to use <space> at the end of rhs in + mappings. For example: + + cmap <f1> man<space> + + will put "man " in line when you hit the <f1> key in the command line + mode. + +Expression syntax + Supported expressions is a subset of what VimL provides. + + Expression syntax summary, from least to most significant: + + vifm-expr1 expr2 == expr2 equal + expr2 != expr2 not equal + + vifm-expr2 expr3 . expr3 .. string concatenation + + vifm-expr3 "string" string constant, \ is special + 'string' string constant, ' is doubled + $VAR environment variable + function(expr1, ...) function call + + ".." indicates that the operations in this level can be concatenated. + + expr1 + ----- + expr2 {cmp} expr2 + + Compare two expr2 expressions, resulting in a 0 if it evaluates to + false or 1 if it evaluates to true. + + equal == + notequal != + + Examples: + 'a' == 'a' evaluates to 1 + 'a' == 'b' evaluates to 0 + + expr2 + ----- + expr3 . expr3 .. string concatenation + + Examples: + 'a' . 'b' = 'ab' + 'aaa' . '' . 'c' = 'aaac' + + expr3 + ----- + + string + ------ + "string" string constant + + Note that double quotes are used. + + A string constant accepts these special characters: + \b backspace <bs> + \e escape <esc> + \n newline + \r return <cr> + \t tab <tab> + \\ backslash + \" double quote + + Examples: + "\"Hello,\tWorld!\"" + "Hi,\nthere!" + + literal-string + -------------- + ´string' string constant + + Note that single quotes are used. + + This string is taken as it is. No backslashes are removed or have a + special meaning. The only exception is that two quotes stand for one + quote. + + Examples: + 'All\slashes\are\saved.' + 'This string contains doubled single quotes ''here''' + + environment variable + -------------------- + $VAR environment variable + + The String value of any environment variable. When it is not defined, + the result is an empty string. + + Examples: + 'This is my $PATH env: ' . $PATH + 'vifmrc at ' . $MYVIFMRC . ' is used.' + + function call + ------------- + function(expr1, ...) function call + + See Functions section below. + + Examples: + "'" . filetype('.') . "'" + filetype('.') == 'reg' + +Functions + USAGE RESULT DESCRIPTION + + expand({expr}) String Expand macros in {expr}. + filetype({fnum}) String Returns file type from position. + + expand({expr}) + Expands macros in {expr} just like it's done for command-line commands. + Returns a string. See "Command macros" section above. Examples: + " percent sign + :echo expand('%%') + " the last part of directory name of the other pane + :echo expand('%D:t') + + filetype({fnum}) + The result is a string, which represents file type and is one of the + list: + exe executables + reg regular files + link symbolic links + dir directories + char character devices + block block devices + fifo pipes + sock *nix domain sockets + ? unknown file type (should never appear) + Parameter {fnum} can have following values: + - '.' to get type of file under the cursor in the active pane + +Menus and dialogs + General + + j, k - move. + <Escape>, Ctrl-C, ZZ, ZQ - quit. + <Return>, l - select and exit the menu. + Ctrl-L - redraw the menu. + + Escape, Ctrl-C, ZZ, ZQ, q - quit. + + In all menus + + Ctrl-B/Ctrl-F + Ctrl-D/Ctrl-U + Ctrl-E/Ctrl-Y + / and ?, n/N + [num]G/[num]gg + H/M/L + zb/zt/zz + zh - scroll menu items [count] characters to the right. + zl - scroll menu items [count] characters to the left. + zH - scroll menu items half of screen width characters to the right. + zL - scroll menu items half of screen width characters to the left. + + All these keys have the same meaning as in normal mode (but not L in + filetype menu). + + : - enter command line mode for menus (currently only :exi[t], :q[uit], + :x[it] and :{range} are supported). + + Apropos menu + + l key won't close the menu allowing user to pick another man page, use + :q to close the menu. + + Commands menu + + dd on a command to remove. + + Bookmarks menu + + Escape or Ctrl-C to abort j and k to move through. + dd on a bookmark to remove. + + Directory stack menu + + Pressing l or Enter on directory name will rotate stack to place + selected directory pair at the top of the stack. + + Filetype menu + + Commands from vifmrc or typed in command-line are displayed above empty + line. All commands below empty line are from .desktop files. + + Fileinfo dialog + + Enter - close dialog + q - close dialog + + Sort dialog + + h - switch ascending/descending. + Space - switch ascending/descending. + q - close dialog + + Attributes (permissions or properties) dialog + + h - check/uncheck. + Space - check/uncheck. + q - close dialog + + Item states: + + - * - checked flag. + + - X - means that it has different value for files in selection. + + - d (*nix only) - (only for execute flags) means u-x+X, g-x+X or o-x+X + argument for the chmod program. If you want to remove execute right + from all files, but preserve it for directories, set all execute + flags to 'd' and check ´Set Recursively' flag. + +Startup + On startup vifm determines several variables that are used during the + session. They are determined in the order they appear below. + + On *nix systems $HOME is normally present and used as is. On Windows + systems vifm tries to find correct home directory in the following + order: + - $HOME variable; + - $USERPROFILE variable; + - a combination of $HOMEDRIVE and $HOMEPATH variables. + + vifm tries to find correct configuration directory by checking the fol‐ + lowing places: + - $VIFM variable; + - parent directory of the executable file (on Windows only); + - $HOME/.vifm directory; + - $APPDATA/Vifm directory (on Windows only). + + vifm tries to find correct configuration file by checking the following + places: + - $MYVIFMRC variable; + - vifmrc in parent directory of the executable file (on Windows only); + - $VIFM/vifmrc file. + +Configure + See Startup section above for the explanations on $VIFM and $MYVIFMRC. + + The vifmrc file contains commands that will be executed on vifm + startup. See $MYVIFMRC variable description for search algorithm used + to find vifmrc. Use it to set settings, mappings, filetypes etc. To + use multi line commands precede each next line with a slash (whitespace + before slash is ignored, but all spaces at the end of the lines are + saved). For example: + set + \smartcase + equals "setsmartcase". When + set<space here> + \ smartcase + equals "set smartcase". + + The $VIFM/vifminfo file contains session settings. You may edit it by + hand to change the settings, but it's not recommended to do that, edit + vifmrc instead. You can control what settings will be saved in + vifminfo by setting ´vifminfo' option. Vifm always writes this file on + exit unless 'vifminfo' option is empty. Bookmarks, commands, directory + history, filetypes, fileviewers and registers in the file are merged + with vifm configuration (which has bigger priority). + + The $VIFM/scripts directory can contain shell scripts. vifm modifies + it's PATH environment variable to let user run those scripts without + specifying full path. All subdirectories of the $VIFM/scripts will be + added to PATH too. Script in a subdirectory overlaps script with the + same name in all its parent directories. + + The $VIFM/colors directory contains color schemes. + +Automatic FUSE mounts + vifm has a builtin support of automated FUSE file system mounts. It is + implemented using file associations mechanism. To enable automated + mounts, one needs to use a specially formated program line in filetype + or filextype commands. Currently two formats are supported: + + 1) FUSE_MOUNT This format should be used in case when all information + needed for mounting all files of a particular type is the same. E.g. + mounting of tar files don't require any file specific options. + + Format line: + FUSE_MOUNT|mounter %SOURCE_FILE %DESTINATION_DIR [%CLEAR] + + Example filetype command: + :filetype FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR + + 2) FUSE_MOUNT2 This format allows one to use specially formatted files + to perform mounting and is useful for mounting remotes, for example + remote file systems over ftp or ssh. + + Format line: + FUSE_MOUNT2|mounter %PARAM %DESTINATION_DIR [%CLEAR] + + Example filetype command: + :filetype FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR + + Example file content: + root@127.0.0.1:/ + + All % macros are expanded by vifm at runtime and have the following + meaning: + - %SOURCE_FILE is replaced by full path to selected file + - %DESTINATION_DIR is replaced by full path to mount directory, which + is created by vifm basing on the value of 'fusehome' option. + - %PARAM value is filled from the first line of file (whole line), + though in the future it can be changed to whole file content + - %CLEAR means that you want to clear screen before running mount + command. + + %CLEAR is an optional macro. Other macros are not mandatory, but mount + commands likely won't work without them. + + The mounted FUSE file systems will be automatically unmounted in two + cases: + + - when vifm quits (with ZZ, :q, etc. or when killed by signal) + + - when you explicitly leave mount point going up to its parent direc‐ + tory (with h, Enter on "../" or ":cd ..") and other pane is not in + the same directory or its child directories. + +View look + vifm supports displaying of file list view in two different ways: + + - in a table mode, when multiple columns can be set using 'viewcolumns' + option (see Column view section below for details); + + - in a multicolumn list manner which looks almost like `ls -x` command + output (see ls-like view section below for details). + + The look is local for each view and can be chosen by changing value of + the ´lsview' boolean option. + + Depending on view look some of keys change their meaning to allow more + natural cursor moving. This concerns mainly h, j, k, l and other simi‐ + lar navigation keys. + + Also some of options can be ignored if they don't affect view display‐ + ing in selected look. For example value of 'viewcolumns' when 'lsview' + is set. + +ls-like view + When this view look is enabled by setting 'lsview' option on, vifm will + display files in multiple columns. Number of columns depends on the + length of the longest file name present in current directory of the + view. Whole file list is automatically reflowed on directory change, + terminal or view resize. + + View looks close to output of `ls -x` command, so files are listed left + to right in rows. + + In this mode file manipulation commands (e.g. d) don't work line-wise + like they do in Vim, since such operations would be uncommon for file + manipulating tasks. Thus, for example, dd will remove only current + file. + +Column view + View columns are described by a comma-separated list of column descrip‐ + tions, each of which has the following format + [ '-' ] [ fw ( [ '.' tw ] | '%' ) ] '{' type '}' '.'{0,3} + where fw stands for full width and tw stands for text width. + + So it basically consists of four parts: + 1. Optional alignment specifier + 2. Optional width specifier + 3. Mandatory column name + 4. Optional cropping specifier + + Alignment specifier + + It's an optional minus sign as the first symbol of the string. + + Specifies type of text alignment within a column. Two types are sup‐ + ported: + + - left align + set viewcolumns=-{name} + + - right align (default) + set viewcolumns={name} + + Width specifier + + It's a number followed by a percent sign, two numbers (second one + should be less than or equal to the first one) separated with a dot or + a single number. + + Specifies column width and its units. There are tree size types: + + - absolute size - column width is specified in characters + set viewcolumns=-100{name},20.15{ext} + results in two columns with lengths of 100 and 20 and a reserved + space of five characters on the left of second column. + + - relative (percent) size - column width is specified in percents of + view width + set viewcolumns=-80%{name},15%{ext},5%{mtime} + results in three columns with lengths of 80/100, 15/100 and 5/100 of + view width. + + - auto size (default) - column width is automatically determined + set viewcolumns=-{name},{ext},{mtime} + results in three columns with length of one third of view width. + There is no size adjustment to content, since it will slow down ren‐ + dering. + + Columns of different sizing types can be freely mixed in one view. + Though sometimes some of columns can be seen partly or be completely + invisible if there is not enough space to display them. + + Column name + + This is just a sort key surrounded with curly braces, e.g. + {name},{ext},{mtime} + {name} and {iname} keys are the same and present both for consistency + with ´sort' option. + + Empty curly braces ({}) are replaced with the default secondary column + for primary sort key. So after the next command view will be displayed + almost as if 'viewcolumns' is empty, but adding ellipsis for long file + names: + set viewcolumns=-{name}..,6{}. + + Cropping specifier + + It's from one to three dots after closing curly brace in column format. + + Specifies type of text truncation if it doesn't fix in the column. Cur‐ + rently tree types are supported: + + - truncation - text is truncated + set viewcolumns=-{name}. + results in truncation of names that are too long too fit in the view. + + - adding of ellipsis - ellipsis on the left or right are added when + needed + set viewcolumns=-{name}.. + results in that ellipsis are added at the end of too long file names. + + - none (default) - text can pass column boundaries + set viewcolumns=-{name}...,{ext} + results in that long file names can partially be written on the ext + column. + +Color schemes + The color schemes in vifm can be applied in two different ways: + + - as the default (or main) color scheme + + - as local to a panel color scheme + + Both types are set using |vifm-:colorscheme| command, but of different + forms: + + - :colorscheme color_scheme_name - for the default color scheme + + - :colorscheme color_scheme_name directory - for local color schemes + + Look of different parts of the TUI (Text User Interface) is determined + in this way: + + - Border, TopLineSel, TopLine, CmdLine, ErrorMsg, StatusLine and Wild‐ + Menu are always determined by the default color scheme + + - CurrLine, Selected, Directory, Link, BrokenLink, Socket, Device, Exe‐ + cutable, Fifo and Win are determined by default color scheme and a + set of local colorschemes, which can be empty + + There might be a set of local color schemes because they are structured + hierarchically according to file system structure. For example, having + the following piece of file system: + + ~ + `-- bin + | + `-- my + + Two color schemes: + + # ~/.vifm/colors/for_bin + highlight Win cterm=none ctermfg=white ctermbg=red + highlight CurrLine cterm=none ctermfg=red ctermbg=black + + # ~/.vifm/colors/for_bin_my + highlight CurrLine cterm=none ctermfg=green ctermbg=black + + And these three commands in the vifmrc file: + + colorscheme Default + colorscheme for_bin ~/bin + colorscheme for_bin_my ~/bin/my + + File list will look in the following way for each level: + + - ~/ - Default color scheme + black background + cursor with blue background + + - ~/bin/ - mix of Default and for_bin color schemes + red background + cursor with black background and red foreground + + - ~/bin/my/ - mix of Default, for_bin and for_bin_my color schemes + red background + cursor with black background and green foreground + +Trash directory + vifm has support of trash directory, which is used as temporary storage + for deleted files or files that were cut. Using trash is controlled by + the ´trash' option, and exact path to the trash can be set with + 'trashdir' option. Trash directory in vifm differs from the system- + wide one by default, because of possible incompatibilities of storing + deleted files among different file managers. But one can set + 'trashdir' to "~/.local/share/Trash" to use a "standard" trash direc‐ + tory. + + There are two scenarios of using trash in vifm: + + 1. As a place for storing files that were cut by "d" and may be + inserted to some other place in file system. + + 2. As a storage of files, that are deleted but not purged yet. + + The first scenario uses deletion ("d") operations to put files to trash + and put ("p") operations to restore files from trash directory. Note + that such operations move files to and from trash directory, which can + be long term operations in case of different partitions or remote + drives mounted locally. + + The second scenario uses deletion ("d") operations for moving files to + trash directory and :empty command-line command to purge all previously + deleted files. + + Deletion and put operations depend on registers, which can point to + files in trash directory. Normally, there are no nonexistent files in + registers, but vifm doesn't keep track of modifications under trash + directory, so one shouldn't expect value of registers to be absolutely + correct if trash directory was modified not by operation that are meant + for it. But this won't lead to any issues with operations, since they + ignore nonexistent files. + +Client-Server + vifm supports remote execution of command-line mode commands as well as + remote changing of directories. This is possible using --remote com‐ + mand-line argument. + + To execute a command remotely combine --remote argument with -c <com‐ + mand> or +<command>. For example: + vifm --remote -c 'cd /' + vifm --remote '+cd /' + + To change directory not using command-line mode commands one can spec‐ + ify paths right after --remote argument, like this: + vifm --remote / + vifm --remote ~ + vifm --remote /usr/bin /tmp + + At the moment there is no way of specifying, which instance of vifm + should arguments be sent. The main purpose of --remote argument is to + provide support of using vifm as a single-instance application. + +Plugin + Plugin for using vifm in vim as a file selector. + + Commands: + + :EditVifm select a file or files to open in the current buffer. + :SplitVifm split buffer and select a file or files to open. + :VsplitVifm vertically split buffer and select a file or files to + open. + :DiffVifm select a file or files to compare to the current file + with + :vert diffsplit. + :TabVifm select a file or files to open in tabs. + + Each command accepts up to two arguments: left pane directory and right + pane directory. After arguments are checked, vifm process is spawned + in a special "file-picker" mode. To pick files just open them either + by pressing l, i or Enter keys, or by running :edit command. If no + files are selected, file under the cursor is opened, otherwise whole + selection is passed to the plugin and opened in vim. + + The plugin have only two settings. It's a string variable named + g:vifm_term to let user specify command to run gui terminal. By + default it's equal to ´xterm -e'. And another string variable named + g:vifm_exec, which equals "vifm" by default and specifies path to + vifm's executable. To pass arguments to vifm use g:vifm_exec_args, + which is empty by default. + + To use the plugin copy the vifm.vim file to either the system wide + vim/plugin directory or into ~/.vim/plugin. + + If you would prefer not to use the plugin and it is in the system wide + plugin directory add + + let loaded_vifm=1 + + to your ~/.vimrc file. + +Reserved + The following command names are reserved and shouldn't be used for user + commands. + + g[lobal] + v[global] + +SEE ALSO + Website: http://vifm.sourceforge.net/ + + Esperanto translation of the documentation by Sebastian Cyprych: + http://cyprych.neostrada.pl/tekstoj/komputiloj/vifm-help.eo.html + +AUTHOR + Vifm was written by ksteen <ksteen@users.sourceforge.net> + And currently is developed by xaizek <xaizek@openmailbox.org> + + + + Oct 19, 2013 vifm(1) diff --git a/.vifm/vifmrc b/.vifm/vifmrc new file mode 100644 index 0000000..3b4a1be --- /dev/null +++ b/.vifm/vifmrc @@ -0,0 +1,314 @@ +"" +"" ~/.vifm/vifmrc +"" +"" Weitian LI <liweitianux@gmail.com> +"" 2014/05/12 +"" + +""" general settings {{{ +" This is the actual command used to start vi. The default is vim. +" If you would like to use another vi clone such Elvis or Vile +" you will need to change this setting. +set vicmd=vim +" set vicmd=elvis\ -G\ termcap +" set vicmd=vile + +" Trash Directory +" The default is to move files that are deleted with dd or :d to +" the trash directory. If you change this you will not be able to move +" files by deleting them and then using p to put the file in the new location. +" I recommend not changing this until you are familiar with vifm. +" This probably shouldn't be an option. +set trash + +" This is how many directories to store in the directory history. +set history=100 + +" Follow links on l or Enter. +set followlinks + +" With this option turned on you can run partially entered commands with +" unambiguous beginning using :! (e.g. :!Te instead of :!Terminal or :!Te<tab>). +set fastrun + +" Natural sort of (version) numbers within text. +set sortnumbers + +" Maximum number of changes that can be undone. +set undolevels=100 + +" If you installed the vifm.txt help file set vimhelp. +" If would rather use a plain text help file set novimhelp. +set novimhelp + +" If you would like to run an executable file when you +" press return on the file name set this. +set norunexec + +" Use KiB, MiB, ... instead of KB, MB, ... +set iec + +" Selected color scheme +"colorscheme Default +colorscheme alycolors + +" The FUSE_HOME directory will be used as a root dir for all FUSE mounts. +" Unless it exists with write/exec permissions set, vifm will attempt to +" create it. +set fusehome=/tmp/vifm_FUSE + +" Format for displaying time in file list. For example: +" TIME_STAMP_FORMAT=%m/%d-%H:%M +" See man date or man strftime for details. +set timefmt=%m/%d\ %H:%M + +" Show list of matches on tab complition in command-line mode +set wildmenu + +" Ignore case search unless it contains at least one uppercase letter +set ignorecase +set smartcase + +" Use increment searching (search while typing) +set incsearch + +" Don't highlight search results automatically +"set nohlsearch + +" Try to leave some space from cursor to upper/lower border in lists +set scrolloff=4 + +" Don't do to much requests to slow file systems +set slowfs=curlftpfs + +" Set custom status line look +set statusline=" %t%= %A %10u:%-7g %15s %20d " + +" What should be saved automatically between vifm runs +" Like in previous versions of vifm +" set vifminfo=options,filetypes,commands,bookmarks,dhistory,state,cs +" Like in vi +set vifminfo=dhistory,savedirs,chistory,state,tui,shistory, + \phistory,fhistory,dirstack,registers,bookmarks +""" settings }}} + +""" marks {{{ +" :mark mark /full/directory/path [filename] +mark h ~/ +mark b ~/bin/ +mark d ~/documents/ +mark m ~/music/ +mark o ~/office/ +mark p ~/pictures/ +mark u ~/unix/ +mark x ~/private/ +""" marks }}} + +""" mappings {{{ +" to speed up +nmap ; : + +nmap s :shell<cr> +nmap S :sort<cr> +nmap w :view<cr> +nmap o :!gvim --remote-tab-silent %f<cr> +nmap O :!gvim %f<cr> +" open file in the background using its default program +nmap gb :file &<cr>l + +" Yank current directory path into the clipboard +nmap yd :!echo %d | xclip %i<cr> + +" Yank current file path into the clipboard +nmap yf :!echo %c:p | xclip %i<cr> + +" Mappings for faster renaming +nmap I cw<c-a> +nmap cc cw<c-u> +nmap A cw<c-w> + +" Opening console in current directory +nmap ,t :!xterm &<cr> + +" Opening vim to edit .vifmrc +nmap ,c :execute ':!vim $MYVIFMRC' | restart<cr> +" Opening gvim to edit .vifmrc +nmap ,C :!gvim --remote-tab-silent $MYVIFMRC &<cr> + +" Toggle wrap setting on ,w key +nmap ,w :set wrap!<cr> + +nmap <f3> :!less %f<cr> +nmap <f4> :edit<cr> +nmap <f5> :copy<cr> +nmap <f6> :move<cr> +nmap <f7> :mkdir<space> +nmap <f8> :delete<cr> +""" mappings }}} + +""" command {{{ +" :com[mand] command_name action +" The following macros can be used in a command +" %a is replaced with the user arguments. +" %c the current file under the cursor. +" %C the current file under the cursor in the other directory. +" %f the current selected file, or files. +" %F the current selected file, or files in the other directory. +" %b same as %f %F. +" %d the current directory name. +" %D the other window directory name. +" %m run the command in a menu window +command df df -h %m 2> /dev/null +command diff vim -d %f %F +command zip zip -r %f.zip %f +command run !! ./%f +command make !!make +command vgrep vim "+grep %a" +""" command }}} + +""" filetype & fileview {{{ +" The file type is for the default programs to be used with +" a file extension. +" :filetype pattern1,pattern2 [{desc}]defaultprogram[ &],[{desc}]program2 +" :fileviewer pattern1,pattern2 consoleviewer +" The other programs for the file type can be accessed with the :file command +" The command macros %f, %F, %d, %F may be used in the commands. +" The % macro is ignored. To use a % you must put %%. + +" For automated FUSE mounts, you must register an extension with :file[x]type +" in one of following formats: +" +" :filetype extensions FUSE_MOUNT|some_mount_command using %SOURCE_FILE and %DESTINATION_DIR variables +" %SOURCE_FILE and %DESTINATION_DIR are filled in by vifm at runtime. +" A sample line might look like this: +" :filetype *.zip,*.jar,*.war,*.ear FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR +" +" :filetype extensions FUSE_MOUNT2|some_mount_command using %PARAM and %DESTINATION_DIR variables +" %PARAM and %DESTINATION_DIR are filled in by vifm at runtime. +" A sample line might look like this: +" :filetype *.ssh FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR +" %PARAM value is filled from the first line of file (whole line). +" Example first line for SshMount filetype: root@127.0.0.1:/ +" +" You can also add %CLEAR if you want to clear screen before running FUSE +" program. + +" Pdf +filetype *.pdf zathura %f,apvlv %f,xpdf %f +fileview *.pdf pdftotext -nopgbrk %c - + +" PostScript +filextype *.ps,*.ps.gz gv %c %i & + +" Djvu +filextype *.djvu apvlv %f + +" Audio +filetype *.wav,*.mp3,*.flac,*.ogg,*.m4a + \ {Play using ffplay} + \ ffplay %c, + \ {Play using MPlayer} + \ mplayer %f, +fileviewer *.mp3 mp3info + +" Video +filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.vob,*.flv + \ {View using ffplay} + \ ffplay -fs %c, + \ {View using Dragon} + \ dragon %f, + \ {View using mplayer} + \ mplayer %f, +fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.vob + \ ffprobe -pretty %c 2>&1 + +" Web +filetype *.html,*.htm links,mozilla,uzbl-browser %f %i & + +" Object +filetype *.o nm %f | less + +" Image +filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm + \ {View in feh} + \ feh -FZ %d --start-at %d/%c 2>/dev/null &, + \ {View in sxiv} + \ sxiv, + \ {View in gpicview} + \ gpicview %c, +fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm + \ convert -identify %f -verbose /dev/null + +" MD5 +filetype *.md5 + \ {Check MD5 hash sum} + \ md5sum -c %f, + +" FuseZipMount +filetype *.zip,*.jar,*.war,*.ear + \ {Mount with fuse-zip} + \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, + \ {View contents} + \ zip -sf %c | less, + \ tar -xf %c, +fileviewer *.zip,*.jar,*.war,*.ear zip -sf %c + +" ArchiveMount +filetype *.tar.bz2,*.tbz2,*.tgz,*.tar.gz + \ {Mount with archivemount} + \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, +fileviewer *.tgz,*.tar.gz tar -tzf %c +fileviewer *.tar.bz2,*.tbz2 tar -tjf %c + +" Rar2FsMount +filetype *.rar + \ {Mount with rar2fs} + \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, + +" IsoMount +filetype *.iso + \ {Mount with fuseiso} + \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR, + +" SshMount +filetype *.ssh + \ {Mount with sshfs} + \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR, + +" FtpMount +filetype *.ftp + \ {Mount with curlftpfs} + \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR, + +" Fuse7z +filetype *.7z + \ {Mount with fuse-7z} + \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR, + +" Office files +filextype *.doc,*.docx,*.xls,*.xlsx libreoffice %f & +fileview *.docx, docx2txt.pl %f - + +" Qt projects +filextype *.pro qtcreator %f & + +" Directories +filextype */ + \ {View in thunar} + \ Thunar %f &, +fileview .*/,*/ tree %f + +" Open all other files with default system programs (you can also remove all +" :file[x]type commands above to ensure they don't interfere with system-wide +" settings). By default all unknown files are opened with 'vi[x]cmd' +" uncommenting one of lines below will result in ignoring 'vi[x]cmd' option +" for unknown file types. +" For *nix: +" filetype * xdg-open +" For OS X: +" filetype * open +" For Windows: +" filetype * start, explorer +""" filetype & fileview }}} + +" vim: set ts=8 sw=4 tw=78 fenc=utf-8 ft=vifm: " diff --git a/.xbindkeysrc b/.xbindkeysrc new file mode 100644 index 0000000..ef89ab1 --- /dev/null +++ b/.xbindkeysrc @@ -0,0 +1,104 @@ +# For the benefit of emacs users: -*- shell-script -*- +########################### +# xbindkeys configuration # +########################### +# +# Version: 1.8.4 +# +# If you edit this file, do not forget to uncomment any lines +# that you change. +# The pound(#) symbol may be used anywhere for comments. +# +# To specify a key, you can use 'xbindkeys --key' or +# 'xbindkeys --multikey' and put one of the two lines in this file. +# +# The format of a command line is: +# "command to start" +# associated key +# +# +# A list of keys is in /usr/include/X11/keysym.h and in +# /usr/include/X11/keysymdef.h +# The XK_ is not needed. +# +# List of modifier: +# Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), +# Mod3 (CapsLock), Mod4, Mod5 (Scroll). +# + +# The release modifier is not a standard X modifier, but you can +# use it if you want to catch release events instead of press events + +# By defaults, xbindkeys does not pay attention with the modifiers +# NumLock, CapsLock and ScrollLock. +# Uncomment the lines above if you want to pay attention to them. + +#keystate_numlock = enable +#keystate_capslock = enable +#keystate_scrolllock= enable + +#"xbindkeys_show" +# control+shift + q + +###### music control ###### {{{ +"mpc toggle" + m:0x0 + c:172 + XF86AudioPlay + +"mpc stop" + m:0x0 + c:174 + XF86AudioStop + +"mpc prev" + m:0x0 + c:173 + XF86AudioPrev + +"mpc next" + m:0x0 + c:171 + XF86AudioNext +###### music }}} + +###### volume control ###### {{{ +"amixer sset Master '5%+' unmute" + m:0x0 + c:123 + XF86AudioRaiseVolume + +"amixer sset Master '5%-' unmute" + m:0x0 + c:122 + XF86AudioLowerVolume + +"amixer sset Master toggle" + m:0x0 + c:121 + XF86AudioMute +###### volume }}} + +###### thinkpad ###### {{{ +## thinkpad special keys require 'thinkpad_acpi' module + +# ThinkVantage button +"dmenu_run" + m:0x0 + c:156 + XF86Launch1 + +"~/bin/i3lock_exit.sh lock" + m:0x10 + c:160 + Mod2 + XF86ScreenSaver + +#"(Scheme function)" +# m:0x10 + c:220 +# Mod2 + XF86WebCam + +"arandr" + m:0x10 + c:235 + Mod2 + XF86Display + +# TouchPadToggle +"synclient TouchpadOff=`synclient -l | grep -c 'TouchpadOff.*=.*0'`" + m:0x10 + c:199 + Mod2 + XF86TouchpadToggle + +###### thinkpad ###### }}} + +################################## +# End of xbindkeys configuration # +################################## diff --git a/.xinitrc b/.xinitrc new file mode 100644 index 0000000..bfeb0a2 --- /dev/null +++ b/.xinitrc @@ -0,0 +1,15 @@ +#!/bin/sh + +# Run all system xinitrc shell scripts. +xinitdir="/etc/X11/xinit/xinitrc.d" +if [ -d "$xinitdir" ]; then + for script in $xinitdir/*; do + echo "Loading xinit script $script" + if [ -x "$script" -a ! -d "$script" ]; then + . "$script" + fi + done +fi + +[ -f ~/.Xresources ] && xrdb -merge ~/.Xresources + diff --git a/.xprofile b/.xprofile new file mode 100644 index 0000000..de18e9a --- /dev/null +++ b/.xprofile @@ -0,0 +1,7 @@ +# +# ~/.xprofile +# + +[ -f ~/.profile ] && . ~/.profile + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=sh: # |