From 74e553965db2cbc769566837eefa13739f31f926 Mon Sep 17 00:00:00 2001
From: xero <x@xero.nu>
Date: Tue, 5 Aug 2014 13:08:34 -0400
Subject: add terminal image viewer (thanx z3bra!) and added zsh alias for it.

---
 sys/code/sys/img | 32 ++++++++++++++++++++++++++++++++
 zsh/.zshrc       |  7 +++----
 2 files changed, 35 insertions(+), 4 deletions(-)
 create mode 100644 sys/code/sys/img

diff --git a/sys/code/sys/img b/sys/code/sys/img
new file mode 100644
index 0000000..ba58ac0
--- /dev/null
+++ b/sys/code/sys/img
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# z3bra -- 2014-01-21
+# requires `w3m` package
+
+test -z "$1" && exit
+
+W3MIMGDISPLAY="/usr/lib/w3m/w3mimgdisplay"
+FILENAME=$1
+FONTH=14 # Size of one terminal row
+FONTW=8  # Size of one terminal column
+COLUMNS=`tput cols`
+LINES=`tput lines`
+
+read width height <<< `echo -e "5;$FILENAME" | $W3MIMGDISPLAY`
+
+max_width=$(($FONTW * $COLUMNS))
+max_height=$(($FONTH * $(($LINES - 2)))) # substract one line for prompt
+
+if test $width -gt $max_width; then
+height=$(($height * $max_width / $width))
+width=$max_width
+fi
+if test $height -gt $max_height; then
+width=$(($width * $max_height / $height))
+height=$max_height
+fi
+
+w3m_command="0;1;0;0;$width;$height;;;;;$FILENAME\n4;\n3;"
+
+tput cup $(($height/$FONTH)) 0
+echo -e $w3m_command|$W3MIMGDISPLAY
\ No newline at end of file
diff --git a/zsh/.zshrc b/zsh/.zshrc
index f0a834c..e369329 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -18,7 +18,7 @@
 # HIST_STAMPS="mm/dd/yyyy"
 
 #█▓▒░ exports
-export PATH=$HOME/bin:/usr/local/bin:$PATH
+export PATH=$HOME/bin:/usr/local/bin:/home/xero/.gem/ruby/2.1.0/bin:$PATH
 # export MANPATH="/usr/local/man:$MANPATH"
 
 #█▓▒░ preferred editor for local and remote sessions
@@ -40,11 +40,12 @@ alias matrix="cmatrix -b -s"
 alias pipes="bash ~/code/fun/pipes"
 alias pipesx="bash ~/code/fun/pipesx"
 alias rain="bash ~/code/fun/rain"
-alias screenfetch="~/code/fun/screenfetch"
+alias screenfetch="~/code/sys/info"
 alias hashcompare='bash ~/code/sys/hash-compare '
 alias tempwatch="while :; do sensors; sleep 1 && clear; done;"
 alias term='urxvtc -hold -e ' #used for awesomewm run menu
 alias fixcursor='xsetroot -cursor_name left_ptr'
+alias img='bash ~/code/sys/img'
 dirlist() {
 	ls -la "$1" && echo -e '' &&  tree -a "$1"
 }
@@ -57,8 +58,6 @@ dirlist() {
 alias pacman="sudo pacman"
 alias apachereload='sudo systemctl restart httpd.service'
 alias disks="ncdu"
-#█▓▒░ work aliases
-alias workscreen='xrandr --output HDMI1 --left-of LVDS1 --mode 1366x768'
 
 #█▓▒░ ssh
 export SSH_KEY_PATH="~/.ssh/id_rsa"
-- 
cgit v1.2.1