Wednesday, December 9, 2015

New Cover Art - Rise Of The Supreme

In return for an honest review of this audiobook, Rise Of The Supreme, I have some promotional copies that I can give away. Just ask me either in the blog comments or Facebook.

I have been working with the widow of the author to get the cover art updated for an audiobook, Rise Of The Supreme, that I produced / narrated. Guess what, the widow painted this, on canvas! If you look closely, you can see the canvas texture. She said that this painting is in the style that the late author would have preferred. Sadly, the author died soon, months after the audiobook was published. The widow has informed me that he got alot of joy collaborating with me in the final year of his life to get this audiobook published.


It was based on another painting, a collaboration between my son Michael and myself. He did the original pencil sketch. Here is the painting that I did most of the work on.


Here is the aforementioned pencil sketch that my son Michael Witt did. He earned $10 out of my wallet for that. It's pretty good for a sketch based on some ideas I threw at him.


And here is the cover art that inspired it all! :)


Monday, October 26, 2015

i3wm xsession

 2080  while read file;do echo;echo;history|tail -1;echo Filename: "${file}";cat "${file}";echo;echo;echo;done
Filename: xsession
#!/usr/bin/env bash

# Do custom xrandr and i3 config conditional upon Work / Studio / Laptop
~/.i3/i3config.sh
exec /usr/bin/i3

#

i3wm Reboot.sh

 2080  while read file;do echo;echo;history|tail -1;echo Filename: "${file}";cat "${file}";echo;echo;echo;done
Filename: Reboot.sh
#!/bin/bash
# reboot without password

dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

#

i3wm Poweroff.sh

 2080  while read file;do echo;echo;history|tail -1;echo Filename: "${file}";cat "${file}";echo;echo;echo;done
Filename: Poweroff.sh
#!/bin/bash
# poweroff without password

dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

#

i3wm i3status.conf

 2080  while read file;do echo;echo;history|tail -1;echo Filename: "${file}";cat "${file}";echo;echo;echo;done
Filename: 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
        interval = 10
}

#order += "ipv6"
order += "disk /"
#order += "run_watch DHCP"
#order += "run_watch VPN"
order += "wireless wlan0"
order += "ethernet eth0"
order += "load"
order += "battery 0"
order += "tztime local"

wireless wlan0 {
        #format_up = "W: (%quality at %essid) %ip"
        format_up = "W:%essid:%ip"
        format_down = "W"
}

ethernet eth0 {
        # if you use %speed, i3status requires root privileges
        format_up = "E:%ip"
        format_down = "E"
}

battery 0 {
        format = "%status:%percentage %remaining"
}

run_watch DHCP {
        pidfile = "/var/run/dhclient*.pid"
}

run_watch VPN {
        pidfile = "/var/run/vpnc/pid"
}

tztime local {
        format = "%a %d%b%Y %H:%M"
}

load {
        format = "load:%1min"
}

disk "/" {
        format = "/:%avail"
}

i3wm i3GetWindowCriteria.sh

 2080  while read file;do echo;echo;history|tail -1;echo Filename: "${file}";cat "${file}";echo;echo;echo;done
Filename: i3GetWindowCriteria.sh
#!/bin/sh

# i3-get-window-criteria.sh - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [<name>=<value> <name>=<value> ...]

# Known problem: when WM_NAME is used as fallback for the 'title="<string>"' criterion,
# quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd > /dev/null 2>&1; then
        echo "$PROGNAME: $cmd: command not found" >&2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'

#

i3wm i3ExecAlways

 2080  while read file;do echo;echo;history|tail -1;echo Filename: "${file}";cat "${file}";echo;echo;echo;done
Filename: i3ExecAlways
#!/bin/bash
# double fork to avoid zombies
# see http://charlesweldonwitt.blogspot.com/2015/08/double-fork-to-avoid-zombies.html

# autokey for some automation stuff
(( sleep 3 && pgrep -f autokey || autokey 0<&- &>/dev/null &) &)

# nm-applet for wifi, ethernet, vpn
(( sleep 20 && pgrep -f 'nm-applet' || sudo /usr/bin/nm-applet 0<&- &>/dev/null &) &)

# duplicati does versioned backups
(( sleep 3 && pgrep -f duplicati || ~/bin/duplicati.sh 0<&- &>/dev/null &) &)

# insync syncs with Google Drive (most recent version only) - hence duplicati for versioning of some things
# insync notify applet seems to disappear upon i3wm restart, so always quit / pkill it and start it again
(( sleep 5;insync quit;sleep 10;pkill -f insync;insync start 0<&- &>/dev/null &) &)

#

i3wm i3config.sh

cwitt@cwittUbuntuDB:~/.i3$ echo;for file in i3config.sh;do echo;echo 'Filename: '"${file}";cat "${file}";echo;echo;done;echo


Filename: i3config.sh
#!/bin/bash
# xrandr and i3 config conditional upon Work / Studio / Laptop

theme='tango-jungle'

# grep -c returns 1 line then 1 aka true else 0 aka false
xrandr | grep ' connected '
Work="$( \
ifconfig | grep eth0 -A1 | tail -1 | grep -c 'inet addr:10.19.2.' \
&& \
xrandr | grep -c 'HDMI3 connected ' \
)"
echo Work:${Work}
echo Work:${Work} | grep 1 && Work=1 || Work=0
Studio="$( xrandr | grep -c 'VGA1 connected ' )"
Laptop="$( if [[ ${Work} = 0 && ${Studio} = 0 ]];then echo 1;else echo 0;fi )"
# output results for debugging
echo Work:${Work} Studio:${Studio} Laptop:${Laptop}

# being extra vigilant on condition checking to avoid unexpected results
if [[ ${Work} = 1 ]]
then
  location=Work
  echo ${location}
  ~/.i3/ScreenLayout/${location}.sh
  j4-make-config -a config.${location} ${theme}
  rm ~/.stalonetrayrc;ln -s ~/.i3/stalonetrayrc/stalonetrayrc.${location} ~/.stalonetrayrc
fi
if [[ ${Work} = 0 && ${Studio} = 1 && ${Laptop} = 0 ]]
then
  location=Studio
  echo ${location}
  ~/.i3/ScreenLayout/${location}.sh
  j4-make-config -a config.${location} ${theme}
  rm ~/.stalonetrayrc;ln -s ~/.i3/stalonetrayrc/stalonetrayrc.${location} ~/.stalonetrayrc
fi
if [[ ${Work} = 0 && ${Studio} = 0 && ${Laptop} = 1 ]]
then
  location=Studio
  echo ${location}
  ~/.i3/ScreenLayout/${location}.sh
  j4-make-config -a config.${location} ${theme}
  rm ~/.stalonetrayrc;ln -s ~/.i3/stalonetrayrc/stalonetrayrc.${location} ~/.stalonetrayrc
fi
# if above condtions do not match then do not do custom xrandr and do use most recent i3 config

#

i3wm config.Work.All_TR2Skinny1Big_BR1Big

cwitt@cwittUbuntuDB:~/.i3$ echo;for file in config.Work.All_TR2Skinny1Big_BR1Big;do echo;echo 'Filename: '"${file}";cat "${file}";echo;echo;done;echo


Filename: config.Work.All_TR2Skinny1Big_BR1Big
#
#
# BEGIN config.Work to be appended to config.base

# Left Monitor(VGA1) LEFT OF Big Monitor(HDMI3) AND aligned at TOP edge
# VGA1: 1600x900 All: thunderbird
# HDMI3: 1920x1080 Top Half: tiny pidgin, tiny keepassx, big pac Bottom Half: google-chrome
fake-outputs 1600x900+0+0,960x640+1600+440,960x640+2560+440,300x440+1600+0,1620x440+1900+0
# fake-outputs 1600x20+1900+0,1920x1040+1900+40,300x420+1600+20,1620x420+1900+20,960x600+1600+460,960x600+2560+460,1600x900+0+0
workspace hidden output fake-1

# END config.Work

i3wm config.Studio.Vertical

cwitt@cwittUbuntuDB:~/.i3$ echo;for file in config.Studio.Vertical;do echo;echo 'Filename: '"${file}";cat "${file}";echo;echo;done;echo


Filename: config.Studio.Vertical
#
# BEGIN config.Studio to be appended to config.base

# Laptop Monitor(LVDS1) logically RIGHT of Big Monitor(VGA1) AND aligned at TOP edge
# LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
# VGA1 connected 1050x1680+0+768 right (normal left inverted right x axis y axis) 480mm x 270mm
fake-outputs 1366x768+0+0,1050x1680+0+768
# fake-outputs 1050x768+0+0,1366x768+1050+0,1050x912+0+768

# END config.Studio
#

i3wm config.Laptop

cwitt@cwittUbuntuDB:~/.i3$ echo;for file in config.Laptop;do echo;echo 'Filename: '"${file}";cat "${file}";echo;echo;done;echo


Filename: config.Laptop
#
# BEGIN config.Laptop to be appended to config.base

# Laptop Monitor(LVDS1)
# LVDS1: skinny, big
# LVDS1 1366x768+0+0
fake-outputs 880x20+466+0,1366x728+0+40,466x768+0+0,900x748+466+20

# END config.Laptop
#

i3wm config.base

cwitt@cwittUbuntuDB:~/.i3$ echo;for file in config.base;do echo;echo 'Filename: '"${file}";cat "${file}";echo;echo;done;echo


Filename: config.base
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!

# Start blueman-applet for bluetooth
exec_always --no-startup-id blueman-applet

# Pulse Audio controls
exec_once --no-startup-id volumeicon
bindsym XF86AudioMute exec ~/bin/ToggleMute.sh # mute sound volume for sink aka output
bindsym $mod+XF86AudioMute exec ~/bin/AudioFullVolume.sh # full sound volume for sink aka output
bindsym XF86AudioRaiseVolume exec ~/bin/AudioRaiseVolume.sh #increase sound volume
bindsym XF86AudioLowerVolume exec ~/bin/AudioLowerVolume.sh #decrease sound volume
bindsym XF86AudioMicMute exec ~/bin/ToggleMuteMicrophone.sh # mute microphone aka sound source


# default border is too small :)
new_window pixel 5

# wallpaper
exec_always --no-startup-id feh --bg-max ~/.i3/wallpaper.jpg

# [class="Vncviewer" id=67108881 instance="vncviewer" title="TightVNC: nocmonitor1:0"]
assign [class="Vncviewer"] 10
for_window [class="Vncviewer"] focus

# various exec_always programs in ~/.i3/i3ExecAlways script to make startup easier and all in one place
exec_always --no-startup-id ~/.i3/i3ExecAlways

# /usr/NX/bin/: nxserver.bin nxd nxnode.bin nxclient.bin start w/o my help, so far so good
# manually start nxplayer if for some reason the applet is not showing

# natural scrolling for touchpad
exec --no-startup-id xinput set-prop 11 "Synaptics Scrolling Distance" -101, -101

# use Mod4 (Windows / Super) as mod
set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font pango:Ubuntu 16
font -schumacher-clean-bold-r-normal--16-160-75-75-c-80-iso646.1991-irv

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec i3-sensible-terminal

# kill focused window
bindsym $mod+Escape kill

# reName workspace
bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name: '

# start a file manager
bindsym $mod+Shift+F12 exec nautilus
# start dmenu (a program launcher)
bindsym $mod+F12 exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon 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
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon 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

# move focused workspace
bindsym $mod+Shift+Control+j move workspace to output left
bindsym $mod+Shift+Control+k move workspace to output down
bindsym $mod+Shift+Control+l move workspace to output up
bindsym $mod+Shift+Control+semicolon move workspace to output right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Control+Left move workspace to output left
bindsym $mod+Shift+Control+Down move workspace to output down
bindsym $mod+Shift+Control+Up move workspace to output up
bindsym $mod+Shift+Control+Right move workspace to output right

# split in horizontal orientation
bindsym $mod+h 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+Shift+s layout stacking
bindsym $mod+Shift+w layout tabbed
bindsym $mod+Shift+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

# New workspace in same output
bindsym $mod+Shift+n exec quickswitch.py -e

# workspace assignments and switching - fake-0 is for i3status - fake-1 is for hidden
workspace 1 output fake-1
bindsym $mod+1 workspace number 1
workspace 2 output fake-2
bindsym $mod+2 workspace number 2
workspace 3 output fake-3
bindsym $mod+3 workspace number 3
workspace 4 output fake-4
bindsym $mod+4 workspace number 4
workspace 5 output fake-5
bindsym $mod+5 workspace number 5
workspace 6 output fake-6
bindsym $mod+6 workspace number 6
workspace 7 output fake-7
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
workspace 10 output fake-0
bindsym $mod+0 workspace number 10
bindsym $mod+F1 workspace number 11
bindsym $mod+F2 workspace number 12
bindsym $mod+F3 workspace number 13
bindsym $mod+F4 workspace number 14
bindsym $mod+F5 workspace number 15
bindsym $mod+F6 workspace number 16
bindsym $mod+F7 workspace number 17
bindsym $mod+F8 workspace number 18
bindsym $mod+F9 workspace number 19
bindsym $mod+F10 workspace number 20

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
bindsym $mod+Shift+F1 move container to workspace number 11
bindsym $mod+Shift+F2 move container to workspace number 12
bindsym $mod+Shift+F3 move container to workspace number 13
bindsym $mod+Shift+F4 move container to workspace number 14, workspace number 14
bindsym $mod+Shift+F5 move container to workspace number 15, workspace number 15
bindsym $mod+Shift+F6 move container to workspace number 16
bindsym $mod+Shift+F7 move container to workspace number 17
bindsym $mod+Shift+F8 move container to workspace number 18
bindsym $mod+Shift+F9 move container to workspace number 19
bindsym $mod+Shift+F10 move container to workspace number 20

# cwwitt: create new ~/.i3/config
bindsym $mod+Shift+c exec ~/.i3/i3config.sh
# cwwitt: will restart and use current ~/.i3/config
bindsym $mod+Shift+r restart
# lock screen Ctrl-Alt-l
bindsym Control+mod1+l exec i3lock
# BEGIN Create Log out, Reboot, Poweroff bindings
set $mode_system (Enter) logout, (r) reboot, (Esc) poweroff
mode "$mode_system" {
    # Poweroff no password
    bindsym Escape exec ~/bin/Poweroff.sh
    # Logout
    bindsym Return exit
    # Reboot no password
    bindsym r exec ~/bin/Reboot.sh
    # back to normal: very rare, so do Shift+Escape
    bindsym Shift+Escape mode "default"
}
bindsym $mod+Shift+Escape mode "$mode_system"
# END Create Log out, Reboot, Poweroff bindings

# 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 j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym semicolon 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"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
        output fake-0
        position bottom
        status_command i3status
        # $i3-theme-bar
}

bar {
        output fake-1
        output fake-2
        output fake-3
        output fake-4
        output fake-5
        output fake-6
        output fake-7
        tray_output none
        position top
        status_command i3status
        # $i3-theme-bar
}

# $i3-theme-window

i3wm config

cwitt@cwittUbuntuDB:~/.i3$ echo;for file in config;do echo;echo 'Filename: '"${file}";cat "${file}";echo;echo;done;echo

Filename: config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!

# Start blueman-applet for bluetooth
exec_always --no-startup-id blueman-applet

# Pulse Audio controls
exec_once --no-startup-id volumeicon
bindsym XF86AudioMute exec ~/bin/ToggleMute.sh # mute sound volume for sink aka output
bindsym $mod+XF86AudioMute exec ~/bin/AudioFullVolume.sh # full sound volume for sink aka output
bindsym XF86AudioRaiseVolume exec ~/bin/AudioRaiseVolume.sh #increase sound volume
bindsym XF86AudioLowerVolume exec ~/bin/AudioLowerVolume.sh #decrease sound volume
bindsym XF86AudioMicMute exec ~/bin/ToggleMuteMicrophone.sh # mute microphone aka sound source


# default border is too small :)
new_window pixel 5

# wallpaper
exec_always --no-startup-id feh --bg-max ~/.i3/wallpaper.jpg

# [class="Vncviewer" id=67108881 instance="vncviewer" title="TightVNC: nocmonitor1:0"]
assign [class="Vncviewer"] 10
for_window [class="Vncviewer"] focus

# various exec_always programs in ~/.i3/i3ExecAlways script to make startup easier and all in one place
exec_always --no-startup-id ~/.i3/i3ExecAlways

# /usr/NX/bin/: nxserver.bin nxd nxnode.bin nxclient.bin start w/o my help, so far so good
# manually start nxplayer if for some reason the applet is not showing

# natural scrolling for touchpad
exec --no-startup-id xinput set-prop 11 "Synaptics Scrolling Distance" -101, -101

# use Mod4 (Windows / Super) as mod
set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font pango:Ubuntu 16
font -schumacher-clean-bold-r-normal--16-160-75-75-c-80-iso646.1991-irv

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec i3-sensible-terminal

# kill focused window
bindsym $mod+Escape kill

# reName workspace
bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name: '

# start a file manager
bindsym $mod+Shift+F12 exec nautilus
# start dmenu (a program launcher)
bindsym $mod+F12 exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon 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
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon 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

# move focused workspace
bindsym $mod+Shift+Control+j move workspace to output left
bindsym $mod+Shift+Control+k move workspace to output down
bindsym $mod+Shift+Control+l move workspace to output up
bindsym $mod+Shift+Control+semicolon move workspace to output right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Control+Left move workspace to output left
bindsym $mod+Shift+Control+Down move workspace to output down
bindsym $mod+Shift+Control+Up move workspace to output up
bindsym $mod+Shift+Control+Right move workspace to output right

# split in horizontal orientation
bindsym $mod+h 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+Shift+s layout stacking
bindsym $mod+Shift+w layout tabbed
bindsym $mod+Shift+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

# New workspace in same output
bindsym $mod+Shift+n exec quickswitch.py -e

# workspace assignments and switching - fake-0 is for i3status - fake-1 is for hidden
workspace 1 output fake-1
bindsym $mod+1 workspace number 1
workspace 2 output fake-2
bindsym $mod+2 workspace number 2
workspace 3 output fake-3
bindsym $mod+3 workspace number 3
workspace 4 output fake-4
bindsym $mod+4 workspace number 4
workspace 5 output fake-5
bindsym $mod+5 workspace number 5
workspace 6 output fake-6
bindsym $mod+6 workspace number 6
workspace 7 output fake-7
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
workspace 10 output fake-0
bindsym $mod+0 workspace number 10
bindsym $mod+F1 workspace number 11
bindsym $mod+F2 workspace number 12
bindsym $mod+F3 workspace number 13
bindsym $mod+F4 workspace number 14
bindsym $mod+F5 workspace number 15
bindsym $mod+F6 workspace number 16
bindsym $mod+F7 workspace number 17
bindsym $mod+F8 workspace number 18
bindsym $mod+F9 workspace number 19
bindsym $mod+F10 workspace number 20

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
bindsym $mod+Shift+F1 move container to workspace number 11
bindsym $mod+Shift+F2 move container to workspace number 12
bindsym $mod+Shift+F3 move container to workspace number 13
bindsym $mod+Shift+F4 move container to workspace number 14, workspace number 14
bindsym $mod+Shift+F5 move container to workspace number 15, workspace number 15
bindsym $mod+Shift+F6 move container to workspace number 16
bindsym $mod+Shift+F7 move container to workspace number 17
bindsym $mod+Shift+F8 move container to workspace number 18
bindsym $mod+Shift+F9 move container to workspace number 19
bindsym $mod+Shift+F10 move container to workspace number 20

# cwwitt: create new ~/.i3/config
bindsym $mod+Shift+c exec ~/.i3/i3config.sh
# cwwitt: will restart and use current ~/.i3/config
bindsym $mod+Shift+r restart
# lock screen Ctrl-Alt-l
bindsym Control+mod1+l exec i3lock
# BEGIN Create Log out, Reboot, Poweroff bindings
set $mode_system (Enter) logout, (r) reboot, (Esc) poweroff
mode "$mode_system" {
    # Poweroff no password
    bindsym Escape exec ~/bin/Poweroff.sh
    # Logout
    bindsym Return exit
    # Reboot no password
    bindsym r exec ~/bin/Reboot.sh
    # back to normal: very rare, so do Shift+Escape
    bindsym Shift+Escape mode "default"
}
bindsym $mod+Shift+Escape mode "$mode_system"
# END Create Log out, Reboot, Poweroff bindings

# 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 j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym semicolon 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"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
        output fake-0
        position bottom
        status_command i3status
colors {
    # tango jungle <workclass> <border> <backg> <text>
    focused_workspace $green $darkgreen $white
    active_workspace $brown $darkbrown $grey
    inactive_workspace $black $darkblack $grey
    urgent_workspace $yellow $darkyellow $white
  background black
separator  #444444
statusline $darkgrey
}
}

bar {
        output fake-1
        output fake-2
        output fake-3
        output fake-4
        output fake-5
        output fake-6
        output fake-7
        tray_output none
        position top
        status_command i3status
colors {
    # tango jungle <workclass> <border> <backg> <text>
    focused_workspace $green $darkgreen $white
    active_workspace $brown $darkbrown $grey
    inactive_workspace $black $darkblack $grey
    urgent_workspace $yellow $darkyellow $white
  background black
separator  #444444
statusline $darkgrey
}
}

# tango dark
set $darkblue #204A87
set $darkbrown #8F5902
set $darkgreen #4E9A06
set $darkmagenta #5C3566
set $darkred #A40000
set $darkyellow #C4A000
set $darkorange #CE5C00

# tango light
set $lightblue #729FCF
set $lightbrown #E9B96E
set $lightgreen #8AE234
set $lightmagenta #AD7FA8
set $lightred #EF2929
set $lightyellow #FCE94F
set $lightorange #FCAF3E

# tango normal
set $blue #3465A4
set $brown #C17D11
set $green #73D216
set $magenta #75507B
set $red #CC0000
set $yellow #EDD400
set $orange #F57900

# tango mono
set $black #555753
set $grey #BABDB6
set $white #EEEEEC
set $darkblack #2E3436
set $darkgrey #888A85
set $darkwhite #D3D7CF

# $i3-background
exec_always --no-startup-id xsetroot -solid '#2E3436'

# tango jungle <clientclass> <border> <backg> <text> <indicator>
client.focused          $green $darkgreen $white $lightgreen
client.focused_inactive black black $grey black
client.unfocused        black black $grey black
client.urgent           $yellow $darkyellow $white $lightyellow

#
# BEGIN config.Studio to be appended to config.base

# Laptop Monitor(LVDS1) logically RIGHT of Big Monitor(VGA1) AND aligned at TOP edge
# LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
# VGA1 connected 1050x1680+0+768 right (normal left inverted right x axis y axis) 480mm x 270mm
fake-outputs 1366x768+0+0,1050x1680+0+768
# fake-outputs 1050x768+0+0,1366x768+1050+0,1050x912+0+768

# END config.Studio
#

autokey data

cwitt@cwittUbuntuDB:~/.i3/autokey_data$ find
./cwitt/Shift-Right.py
./cwitt/.Shift-Right.json
./cwitt/Super-V.py
./cwitt/.Super-V.json
./cwitt/Super-C.py
./cwitt/.Super-C.json
./My Phrases/CRM Note WEB.txt
./My Phrases/.CRM Note WEB.json

cwitt@cwittUbuntuDB:~/.i3/autokey_data$ echo;for file in ./cwitt/Super-C.py ./cwitt/.Super-C.json ./cwitt/Shift-Right.py ./cwitt/.Shift-Right.json ./cwitt/Super-V.py ./cwitt/.Super-V.json './My Phrases/CRM Note WEB.txt' './My Phrases/.CRM Note WEB.json';do echo;echo 'Filename: '"${file}";cat "${file}";echo;echo;done;echo


Filename: ./cwitt/Super-C.py
# "<ctrl>+<super>+c" also sends "<ctrl>+<c>" 
keyboard.send_keys("<shift>+<ctrl>+c")


Filename: ./cwitt/.Super-C.json
{
    "usageCount": 18, 
    "omitTrigger": false, 
    "prompt": false, 
    "description": "Super-C", 
    "abbreviation": {
        "wordChars": "[\\w]", 
        "abbreviations": [], 
        "immediate": false, 
        "ignoreCase": false, 
        "backspace": true, 
        "triggerInside": false
    }, 
    "hotkey": {
        "hotKey": "c", 
        "modifiers": [
            "<ctrl>"
        ]
    }, 
    "modes": [
        3
    ], 
    "showInTrayMenu": false, 
    "filter": {
        "regex": ".*Pac|.*terminal", 
        "isRecursive": false
    }, 
    "type": "script", 
    "store": {}
}


Filename: ./cwitt/Shift-Right.py
keyboard.send_keys("<shift>+<right>")
keyboard.send_keys("<shift>+<right>")
keyboard.send_keys("<shift>+<right>")
keyboard.send_keys("<shift>+<right>")



Filename: ./cwitt/.Shift-Right.json
{
    "usageCount": 0, 
    "omitTrigger": false, 
    "prompt": false, 
    "description": "Shift-Right", 
    "abbreviation": {
        "wordChars": "[\\w]", 
        "abbreviations": [], 
        "immediate": false, 
        "ignoreCase": false, 
        "backspace": true, 
        "triggerInside": false
    }, 
    "hotkey": {
        "hotKey": "<right>", 
        "modifiers": [
            "<shift>"
        ]
    }, 
    "modes": [
        3
    ], 
    "showInTrayMenu": false, 
    "filter": {
        "regex": "Audacity.Audacity", 
        "isRecursive": false
    }, 
    "type": "script", 
    "store": {}
}


Filename: ./cwitt/Super-V.py
keyboard.send_keys("<shift>+<ctrl>+v")


Filename: ./cwitt/.Super-V.json
{
    "usageCount": 12, 
    "omitTrigger": false, 
    "prompt": false, 
    "description": "Super-V", 
    "abbreviation": {
        "wordChars": "[\\w]", 
        "abbreviations": [], 
        "immediate": false, 
        "ignoreCase": false, 
        "backspace": true, 
        "triggerInside": false
    }, 
    "hotkey": {
        "hotKey": "v", 
        "modifiers": [
            "<ctrl>"
        ]
    }, 
    "modes": [
        3
    ], 
    "showInTrayMenu": false, 
    "filter": {
        "regex": ".*Pac|.*terminal", 
        "isRecursive": false
    }, 
    "type": "script", 
    "store": {}
}


Filename: ./My Phrases/CRM Note WEB.txt
*WEB* 


Filename: ./My Phrases/.CRM Note WEB.json
{
    "usageCount": 0, 
    "omitTrigger": false, 
    "prompt": false, 
    "description": "CRM Note *WEB*", 
    "abbreviation": {
        "wordChars": "[\\w]", 
        "abbreviations": [], 
        "immediate": false, 
        "ignoreCase": false, 
        "backspace": true, 
        "triggerInside": false
    }, 
    "hotkey": {
        "hotKey": "w", 
        "modifiers": [
            "<super>"
        ]
    }, 
    "modes": [
        3
    ], 
    "showInTrayMenu": false, 
    "matchCase": false, 
    "filter": {
        "regex": "gedit.Gedit|Google-chrome.Google-chrome", 
        "isRecursive": false
    }, 
    "type": "phrase", 
    "sendMode": "kb"
}

i3wm

These are my related configuration files for i3wm known by some as simply i3. i3wm is a tiling window manager for Linux lubbers by the way. See my previous post Adventures In Tiling. :)

For my reference here is a list of ~/.i3 with some irrelevant results excluded:
cwitt@cwittUbuntuDB:~/.i3$ ll
total 92
drwxr-xr-x   4 cwitt cwitt  4096 Oct 26 14:33 ./
drwxr-xr-x 138 cwitt cwitt 12288 Oct 26 13:41 ../
lrwxrwxrwx   1 cwitt cwitt    32 Feb 19  2015 autokey_data -> /home/cwitt/.config/autokey/data/
-rw-rw-r--   1 cwitt cwitt 10879 Oct 26 13:41 config
-rw-rw-r--   1 cwitt cwitt  8798 Oct 26 13:41 config.base
-rw-rw-rw-   1 cwitt cwitt  5188 Jan 31  2015 config.default
-rw-rw-rw-   1 cwitt cwitt   211 Mar  2  2015 config.Laptop
lrwxrwxrwx   1 cwitt cwitt    38 Mar  3  2015 config.Studio -> /home/cwitt/.i3/config.Studio.Vertical
-rw-rw-r--   1 cwitt cwitt   449 Mar  2  2015 config.Studio.Horizontal
-rw-rw-r--   1 cwitt cwitt   456 Mar  3  2015 config.Studio.Vertical
lrwxrwxrwx   1 cwitt cwitt    36 Feb  9  2015 config.Work -> config.Work.All_TR2Skinny1Big_BR1Big
-rw-rw-rw-   1 cwitt cwitt   523 Mar  2  2015 config.Work.All_TR2Skinny1Big_BR1Big
-rw-rw-rw-   1 cwitt cwitt   275 Feb  9  2015 config.Work.BigSkinnySkinnyBig
-rwxr-x---   1 cwitt cwitt  1547 Mar  2  2015 i3config.sh*
-rwxr-x---   1 cwitt cwitt   770 Aug 28 23:39 i3ExecAlways*
-rwxr-x---   1 cwitt cwitt  1526 Feb 10  2015 i3GetWindowCriteria.sh*
lrwxrwxrwx   1 cwitt cwitt    26 Feb 10  2015 i3status.conf -> /home/cwitt/.i3status.conf
lrwxrwxrwx   1 cwitt cwitt    30 Feb 16  2015 j4-make-config -> /home/cwitt/bin/j4-make-config*
lrwxrwxrwx   1 cwitt cwitt    27 Feb 16  2015 Poweroff.sh -> /home/cwitt/bin/Poweroff.sh*
lrwxrwxrwx   1 cwitt cwitt    25 Feb 16  2015 Reboot.sh -> /home/cwitt/bin/Reboot.sh*
drwxrwxr-x   2 cwitt cwitt  4096 Mar  3  2015 ScreenLayout/
drwx------   2 cwitt cwitt  4096 Feb 19  2015 themes/
lrwxrwxrwx   1 cwitt cwitt    56 Feb  6  2015 wallpaper.jpg -> /usr/share/backgrounds/salcantayperu_by_Life_Nomadic.jpg
lrwxrwxrwx   1 cwitt cwitt    21 Feb 11  2015 xsession -> /home/cwitt/.xsession*

Monday, August 17, 2015

double fork to avoid zombies

No, I'm not talking about our favorite villains. I am talking about orphaned computer processes that could end up as "zombie" processes when you look at "top" command results.

This is for IT aka nerdy types who do shell scripting in BASH or other major shells.

I initially found this method of avoiding process zombies somewhere on the internet. However, I just now searched for it and with small, but too much effort, I did not easily locate it again. --- Update --- I realized upon creating this post, that I had an unexplained example of this in my previous post "self-healing cron job".

So, here it is for future reference.

We wish to prevent creation of a zombie process, and we also wish our newly spawned process to be independent, in case we decide to close our shell.

This can be done in BASH using either nohup ... &, or ... Ctrl-z, disown.
A decent reference for this is here.

nohup YourCommandHere &

OR

YourCommandHere
Press Ctrl-z
disown

I don't recall all the advantages / disadvantages of the above methods. However, some day you may find yourself in a shell that is not BASH, that may not have the nohup and disown commands available.

This should work in all the major shells. It redirects all output to the "ether" commonly known as /dev/null by using 0<&- &>/dev/null. It also double forks and "disowns" using (( &) &). If I understand correctly, the reason for double instead of single fork is to make the newly created process 100% completely independent AND (this is important) force process id 1 to adopt the newly minted process. Process id 1 is god of everything on that computer, and will do all necessary management / clean up. That way, you can leave and go live on some beautiful island and forget about all your children. :) ----- (Please don't do this in your real life!)

(( YourCommandHere 0<&- &>/dev/null &) &)

Hope that helps somebody out there! It will help me, the next time I'm searching for it on Google.

Sunday, August 16, 2015

self-healing cron job

I have been working on some automation. I recently broke it. At least the first iterations broke. Within a couple of minutes, retries do work. Now I should debug and figure out why. But for now my head hurts, I simply want it to work - even the "first time" the cron daemon attempts to run it, even if delayed.

Here follows the magic.

As an example the cronjob entry is something similar to:
# run every 30 minutes at top and bottom of every hour of every day
0,30 * * * * bash -l -c 'WittCron01' >> /dev/null 2>&1

cat WittCron01 
#!/bin/bash

# top priority cron job - kill any already running Automate scripts - start Automate

# kill any instances of Automate
pkill -f Automate

(( DISPLAY=:0 Automate 0<&- &>/dev/null &) &)

# give that instance of Automate some time to prove it can stay alive :)
sleep 10

# if Automate is still running after the above sleep 10
# then kill this and all instances of WittCron01
# else start a new instance of WittCron01
pgrep -f Automate && pkill -f WittCron01 || WittCron01


There you go.

Saturday, August 1, 2015

multi-line comments in shell script

The standard and the general practice of newcomers and veteran shell scripters alike is to use the '#' to indicate a comment in shell script. For example:
# this is a comment

and if done carefully, it can be done at end of a line like:
echo yada yada yada # this is a comment

For multiple lines of comments, every line of the comment needs its own '#' at the beginning, like:
# a comment
# more comment stuff
# tedium ... comments yada

If, for whatever your reasons, you don't wish to do a '#' at beginning of every line, then you can do something like this:

#!/bin/bash

echo See http://unix.stackexchange.com/questions/37411/multiline-shell-script-comments-how-does-this-work
echo
echo My example ignores the multi-line comments in the middle of a loop
for thing in one two three
do
  echo Step ${thing}
: <<'<COMMENT'

This is an abuse of the null command ':' and the here-document syntax
to achieve a "multi-line comment".  According to the POSIX spec linked
above, if any character in the delimiter word ("end_long_comment" in
this case) above is quoted, the here-document will not be expanded in
any way.  This is **critical**, as failing to quote the "end_long_comment"
will result in the problems with unintended expansions described above.
All of this text in this here-doc goes to the standard input of :, which
does nothing with it, hence the effect is like a comment.  There is very
little point to doing this besides throwing people off.  Just use '#'.

# just in case previous line escapes the end of line
<COMMENT
  date
  echo
  sleep 1
done
echo after multi line comments

#

This will produce results of:
See http://unix.stackexchange.com/questions/37411/multiline-shell-script-comments-how-does-this-work

My example ignores the multi-line comments in the middle of a loop
Step one
Sat Aug  1 22:18:54 CDT 2015

Step two
Sat Aug  1 22:18:55 CDT 2015

Step three
Sat Aug  1 22:18:56 CDT 2015

after multi line comments

Thursday, February 26, 2015

To Room Tone Or Not To Room Tone

... Or Is Silence Better?

Done - Section One CHAPTER FIVE

It sounds good. This is however, an attempt on my part to use actual room tone instead of silence in the speech gaps. There appears to be a consensus in the audiobook community that room tone is better than silence and that the brain is distracted by silence. I find the intro at the very beginning a little distracting. However, I may be overly critical because using the room tone is a new method for me.

In other news, Monty Witt (our new dog, a chihuahua) is getting along swimmingly with Sunshine Witt, who is an older dog, a mixed breed.

Back to audiobook stuff in general. I recently started listening to Brandon Sanderson's audiobook series The Stormlight Archive. It is quite good! He appears to be a prolific writer. I tremble at the thought of narrating / producing audiobooks that long, a whopping 45 hours each book! Beeswax! That would need to be my only job in order to finish it in a reasonable time.

Saturday, January 31, 2015

Adventures In Tiling

Alternate title: "Love Affair With i3wm - a tiling window manager" :)

The last couple of weeks I've been in ecstasy experimenting with i3wm, which is a tiling window manager. You Linux nerds will likely know what I'm talking about.

One tiny personal experience. When I have two bordering windows, why can't I resize both of them at the same time? I actually had those thoughts a few days ago using Ubuntu's default Unity desktop. There it requires resizing each window. In other words, doing it just once cannot be done. Enter i3wm. Now it can be done!

I prefer "natural scrolling", so I implemented that as well.

I have multiple environments with varying monitors that I use dependant on Laptop, Work, or Studio. So I use j4-make-config to allow for automatic custom config of i3wm including the theme / colors. Related to the color / theme stuff, I use GNOME Color Chooser because I really love green. I also love black as a contrast to green / grey etc. So I am using tango-jungo theme, customized with every $black and every $darkgrey replaced with just "black". The effect is beautiful. My active window is surrounded by bright green while all other windows are surrounded by jet black. Sorry no screenshots. Sensitive information on these screens. Use your creative mind to imagine the beauty of it!

I prefer the behavior of the following commands which do not require root password while still doing clean poweroff and reboot.
lrwxrwxrwx   1 cwitt cwitt   27 Feb 16 13:00 Poweroff.sh -> /home/cwitt/bin/Poweroff.sh
lrwxrwxrwx   1 cwitt cwitt   25 Feb 16 13:00 Reboot.sh -> /home/cwitt/bin/Reboot.sh
cwitt@cwittUbuntuDB:~/.i3$ cat Poweroff.sh Reboot.sh 
#!/bin/bash
# poweroff without password

dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

#
#!/bin/bash
# reboot without password

dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

#

I like nm-applet for Network Manager ethernet / wifi / vpn stuff. So I added a file in /etc/sudoers.d like this. It needs to run as root to be able to do everything you want to do.
sudo visudo -f /etc/sudoers.d/custom
cwitt@cwittUbuntuDB:~/.i3$ sudo cat /etc/sudoers.d/custom 
cwitt cwittUbuntuDB = NOPASSWD: /usr/bin/nm-applet
#

In my i3wm config, you will see that I use F12 for typing commands using dmenu, $mod+F12 for rofi window switcher, and $mod+Shift+F12 for file manager (in my case nautilus). Nautilus by the way required and alias to avoid Nautilus controlling my desktop, just want the file manager please.
alias nautilus='nautilus --no-desktop --new-window'

Ok, here is my i3wm config for Studio which is where I am at the moment.
cwitt@cwittUbuntuDB:~/.i3$ cat config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!

# default border is 1pixel - too small :)
new_window normal

# wallpaper
exec_always --no-startup-id feh --bg-max ~/.i3/wallpaper.jpg

# [class="Google-chrome" id=58720604 instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" title="Tabs Outliner" window_role="pop-up"]
assign [class="Google-chrome" instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" window_role="pop-up"] 1
for_window [class="Google-chrome" instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" window_role="pop-up"] focus

# [class="Vncviewer" id=67108881 instance="vncviewer" title="TightVNC: nocmonitor1:0"]
assign [class="Vncviewer"] 10
for_window [class="Vncviewer"] focus

# Rdio Pause
# bindsym $mod+control+space exec xdotool search --name Rdio && xdotool key --window $(xdotool search --name Rdio) space
# bindsym F1 exec xdotool search --name Google-chrome && xdotool key --window $(xdotool search --name Google-chrome) alt+t

# nm-applet for wifi, ethernet, vpn
exec_always --no-startup-id "sleep 20 && pgrep nm-applet || sudo /usr/bin/nm-applet"
# duplicati does versioned backups
exec_always --no-startup-id "sleep 3 && pgrep duplicati || ~/bin/duplicati.sh"
# insync syncs with Google Drive (most recent version only) - hence duplicati for versioning of some things
# insync notify applet seems to disappear upon i3wm restart, so always quit and start it
exec_always --no-startup-id "sleep 3 && insync quit && insync start"
# /usr/NX/bin/: nxserver.bin nxd nxnode.bin nxclient.bin start w/o my help, so far so good

# natural scrolling for touchpad
exec --no-startup-id xinput set-prop 11 "Synaptics Scrolling Distance" -101, -101

# use Mod4 (Windows / Super) as mod
set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:Ubuntu 16

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec i3-sensible-terminal

# kill focused window
bindsym $mod+Escape kill

# reName workspace
bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name: '

# start a file manager
bindsym $mod+Shift+F12 exec nautilus
# start dmenu (a program launcher)
bindsym F12 exec dmenu_run
# rofi is good window switcher and also alternative to dmenu
exec_always --no-startup-id "killall rofi;rofi -key $mod+F12"
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon 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
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon 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+h 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+Shift+s layout stacking
bindsym $mod+Shift+w layout tabbed
bindsym $mod+Shift+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

# switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10

# cwwitt: create new ~/.i3/config
bindsym $mod+Shift+c exec ~/.i3/i3config.sh
# cwwitt: will restart and use current ~/.i3/config
bindsym $mod+Shift+r restart
# lock screen Ctrl-Alt-l
bindsym Control+mod1+l exec i3lock
# BEGIN Create Log out, Reboot, Poweroff bindings
set $mode_system (Enter) logout, (r) reboot, (Esc) poweroff
mode "$mode_system" {
    # Poweroff no password
    bindsym Escape exec ~/bin/Poweroff.sh
    # Logout
    bindsym Return exit
    # Reboot no password
    bindsym r exec ~/bin/Reboot.sh
    # back to normal: very rare, so do Shift+Escape
    bindsym Shift+Escape mode "default"
}
bindsym $mod+Shift+Escape mode "$mode_system"
# END Create Log out, Reboot, Poweroff bindings

# 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 j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym semicolon 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"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
exec_always "pgrep stalonetray && sleep 5 && killall stalonetray && sleep 5 && stalonetray || stalonetray"
bar {
        tray_output none
        position top
        status_command i3status
colors {
    # tango jungle <workclass> <border> <backg> <text>
    focused_workspace $green $darkgreen $white
    active_workspace $brown $darkbrown $grey
    inactive_workspace $black $darkblack $grey
    urgent_workspace $yellow $darkyellow $white
  background #222222
separator  #444444
statusline $darkgrey
}
}

# tango dark
set $darkblue #204A87
set $darkbrown #8F5902
set $darkgreen #4E9A06
set $darkmagenta #5C3566
set $darkred #A40000
set $darkyellow #C4A000
set $darkorange #CE5C00

# tango light
set $lightblue #729FCF
set $lightbrown #E9B96E
set $lightgreen #8AE234
set $lightmagenta #AD7FA8
set $lightred #EF2929
set $lightyellow #FCE94F
set $lightorange #FCAF3E

# tango normal
set $blue #3465A4
set $brown #C17D11
set $green #73D216
set $magenta #75507B
set $red #CC0000
set $yellow #EDD400
set $orange #F57900

# tango mono
set $black #555753
set $grey #BABDB6
set $white #EEEEEC
set $darkblack #2E3436
set $darkgrey #888A85
set $darkwhite #D3D7CF

# $i3-background
exec_always --no-startup-id xsetroot -solid '#2E3436'

# tango jungle <clientclass> <border> <backg> <text> <indicator>
client.focused          $green $darkgreen $white $lightgreen
client.focused_inactive $darkgrey $black $grey $darkgrey
client.unfocused        $black $darkblack $grey $darkgrey
client.urgent           $yellow $darkyellow $white $lightyellow

#
# BEGIN config.Studio to be appended to config.base

# Laptop Monitor(LVDS1) logically ABOVE Big Monitor(VGA1) AND aligned at LEFT edge
# fake-outputs 
# Top: LVDS1: skinny, big
# Bottom: VGA1: big, skinny
fake-outputs 466x768+0+0,900x768+466+0,1000x1050+0+768,680x1050+1000+768

# END config.Studio
#

Following are some key files.
This one helps to gather info for application specific window / workspace behavior.
cwitt@cwittUbuntuDB:~/.i3$ cat i3GetWindowCriteria.sh 
#!/bin/sh

# i3-get-window-criteria.sh - Get criteria for use with i3 config commands

# To use, run this script, then click on a window.
# Output is in the format: [<name>=<value> <name>=<value> ...]

# Known problem: when WM_NAME is used as fallback for the 'title="<string>"' criterion,
# quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`,
# reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807

PROGNAME=`basename "$0"`

# Check for xwininfo and xprop
for cmd in xwininfo xprop; do
    if ! which $cmd > /dev/null 2>&1; then
        echo "$PROGNAME: $cmd: command not found" >&2
        exit 1
    fi
done

match_int='[0-9][0-9]*'
match_string='".*"'
match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference

{
    # Run xwininfo, get window id
    window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"`
    echo "id=$window_id"

    # Run xprop, transform its output into i3 criteria. Handle fallback to
    # WM_NAME when _NET_WM_NAME isn't set
    xprop -id $window_id |
        sed -nr \
            -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \
            -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \
            -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \
            -e "/^_NET_WM_NAME\(UTF8_STRING\) = ($match_qstring)$/{s//title=\1/; h}" \
            -e '${g; p}'
} | sort | tr "\n" " " | sed -r 's/^(.*) $/[\1]\n/'

#

These are my config.base and Laptop / Work / Studio config files.
cwitt@cwittUbuntuDB:~/.i3$ for file in config.base config.Laptop config.Work config.Studio;do echo ${file};cat ${file};echo;done
config.base
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!

# default border is 1pixel - too small :)
new_window normal

# wallpaper
exec_always --no-startup-id feh --bg-max ~/.i3/wallpaper.jpg

# [class="Google-chrome" id=58720604 instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" title="Tabs Outliner" window_role="pop-up"]
assign [class="Google-chrome" instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" window_role="pop-up"] 1
for_window [class="Google-chrome" instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" window_role="pop-up"] focus

# [class="Vncviewer" id=67108881 instance="vncviewer" title="TightVNC: nocmonitor1:0"]
assign [class="Vncviewer"] 10
for_window [class="Vncviewer"] focus

# Rdio Pause
# bindsym $mod+control+space exec xdotool search --name Rdio && xdotool key --window $(xdotool search --name Rdio) space
# bindsym F1 exec xdotool search --name Google-chrome && xdotool key --window $(xdotool search --name Google-chrome) alt+t

# nm-applet for wifi, ethernet, vpn
exec_always --no-startup-id "sleep 20 && pgrep nm-applet || sudo /usr/bin/nm-applet"
# duplicati does versioned backups
exec_always --no-startup-id "sleep 3 && pgrep duplicati || ~/bin/duplicati.sh"
# insync syncs with Google Drive (most recent version only) - hence duplicati for versioning of some things
# insync notify applet seems to disappear upon i3wm restart, so always quit and start it
exec_always --no-startup-id "sleep 3 && insync quit && insync start"
# /usr/NX/bin/: nxserver.bin nxd nxnode.bin nxclient.bin start w/o my help, so far so good

# natural scrolling for touchpad
exec --no-startup-id xinput set-prop 11 "Synaptics Scrolling Distance" -101, -101

# use Mod4 (Windows / Super) as mod
set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:Ubuntu 16

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec i3-sensible-terminal

# kill focused window
bindsym $mod+Escape kill

# reName workspace
bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name: '

# start a file manager
bindsym $mod+Shift+F12 exec nautilus
# start dmenu (a program launcher)
bindsym F12 exec dmenu_run
# rofi is good window switcher and also alternative to dmenu
exec_always --no-startup-id "killall rofi;rofi -key $mod+F12"
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon 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
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon 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+h 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+Shift+s layout stacking
bindsym $mod+Shift+w layout tabbed
bindsym $mod+Shift+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

# switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10

# cwwitt: create new ~/.i3/config
bindsym $mod+Shift+c exec ~/.i3/i3config.sh
# cwwitt: will restart and use current ~/.i3/config
bindsym $mod+Shift+r restart
# lock screen Ctrl-Alt-l
bindsym Control+mod1+l exec i3lock
# BEGIN Create Log out, Reboot, Poweroff bindings
set $mode_system (Enter) logout, (r) reboot, (Esc) poweroff
mode "$mode_system" {
    # Poweroff no password
    bindsym Escape exec ~/bin/Poweroff.sh
    # Logout
    bindsym Return exit
    # Reboot no password
    bindsym r exec ~/bin/Reboot.sh
    # back to normal: very rare, so do Shift+Escape
    bindsym Shift+Escape mode "default"
}
bindsym $mod+Shift+Escape mode "$mode_system"
# END Create Log out, Reboot, Poweroff bindings

# 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 j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym semicolon 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"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
exec_always "pgrep stalonetray && sleep 5 && killall stalonetray && sleep 5 && stalonetray || stalonetray"
bar {
        tray_output none
        position top
        status_command i3status
        # $i3-theme-bar
}

# $i3-theme-window

config.Laptop
#
# BEGIN config.Laptop to be appended to config.base

# Laptop Monitor(LVDS1)
# fake-outputs: LVDS1: skinny, big
fake-outputs 466x768+0+0,900x768+466+0

# END config.Laptop
#

config.Work
#
#
# BEGIN config.Work to be appended to config.base

# Left Monitor(VGA1) LEFT OF Big Monitor(HDMI3) AND aligned at TOP edge
# fake-outputs: 
# VGA1: All: thunderbird 
# HDMI3: Top Half: tiny pidgin, tiny keepassx, big pac Bottom Half: google-chrome
# fake-outputs 1600x900+0+0,1920x1080+0+0
# fake-outputs 1600x900+0+0,500x540+1600+0,500x540+2100+0,920x540+2600+0,1920x540+1600+540
# fake-outputs 1600x900+0+0,300x440+1600+0,300x440+1900+0,1320x440+2200+0,1920x640+1600+640
# fake-outputs 1600x900+0+0,1920x640+1600+440,300x440+1600+0,300x440+1900+0,1320x440+2200+0
# fake-outputs 1600x900+0+0,960x640+1600+440,960x640+2560+440,300x440+1600+0,300x440+1900+0,1320x440+2200+0
# fake-outputs 960x640+1600+440,960x640+2560+440,300x440+1600+0,300x440+1900+0,1320x440+2200+0,1600x900+0+0
fake-outputs 1600x900+0+0,960x640+1600+440,960x640+2560+440,300x440+1600+0,300x440+1900+0,1320x440+2200+0

# [class="Google-chrome" id=58720509 instance="Google-chrome" title="Case: New - Microsoft Dynamics CRM - Google Chrome" window_role="pop-up"]
assign [class="Google-chrome" instance="Google-chrome" window_role="pop-up"] 3
for_window [class="Google-chrome" instance="Google-chrome" window_role="pop-up"] focus
# [class="Google-chrome" id=58720605 instance="Google-chrome" title="Pentaho Stats for NOC - Google Chrome" window_role="browser"]
assign [class="Google-chrome" instance="Google-chrome" window_role="browser"] 3
for_window [class="Google-chrome" instance="Google-chrome" window_role="browser"] focus
# [class="Google-chrome" id=58720604 instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" title="Tabs Outliner" window_role="pop-up"]
# assign [class="Google-chrome" instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" window_role="pop-up"] 1
# for_window [class="Google-chrome" instance="crx_eggkanocgddhmamlbiijnphhppkpkmkl" window_role="pop-up"] focus

# END config.Work
#

config.Studio
#
# BEGIN config.Studio to be appended to config.base

# Laptop Monitor(LVDS1) logically ABOVE Big Monitor(VGA1) AND aligned at LEFT edge
# fake-outputs 
# Top: LVDS1: skinny, big
# Bottom: VGA1: big, skinny
fake-outputs 466x768+0+0,900x768+466+0,1000x1050+0+768,680x1050+1000+768

# END config.Studio
#

Remember j4-make-config makes this easy dynamic customization possible.
cwitt@cwittUbuntuDB:~/.i3$ which j4-make-config 
/home/cwitt/bin/j4-make-config

The fake-outputs in the config is awesome. That allows a physical monitor to be subdivided into smaller fake monitors that i3wm will automatically configure as individual workspaces.

Well, I got other things to do. But this should help some of you that might be interested.
By the way xrandr / arandr will help you figure out your monitors for fake-outputs and j4-make-config use. Happy tiling!

Update: This is so cool! You can move a workspace left, right, up, or down to another monitor or fake-output in my case.

# move focused workspace
bindsym $mod+Shift+Control+j move workspace to output left
bindsym $mod+Shift+Control+k move workspace to output down
bindsym $mod+Shift+Control+l move workspace to output up
bindsym $mod+Shift+Control+semicolon move workspace to output right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Control+Left move workspace to output left
bindsym $mod+Shift+Control+Down move workspace to output down
bindsym $mod+Shift+Control+Up move workspace to output up
bindsym $mod+Shift+Control+Right move workspace to output right

This may be useful. My mute button already works. But these two enabled the volume up / down.
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -- -5% #decrease sound volume

Update: Again, cooool! In terminals I often copy paste. Unfortunately Ctrl-c is already used to break / stop software. So terminals instead make you do Shift-Ctrl-c and Shift-Ctrl-v to copy paste. It turns out that Ctrl-Super-c also will break / stop software. So, using Autokey, I remapped Ctrl-c and Ctrl-v to do copy / paste.

Super-C.py
# "<ctrl>+<super>+c" also sends "<ctrl>+<c>" 
keyboard.send_keys("<shift>+<ctrl>+c")
Window Filter: .*Pac|.*terminal

Super-V.py
keyboard.send_keys("<shift>+<ctrl>+v")
Window Filter: .*Pac|.*terminal

So, :), I always can use Ctrl-c / Ctrl-v for copy / paste.
I do Ctrl-Super-c to break / stop software.

Update: I only want the i3status and stalonetrayrc stuff on the first workspace. So I changed the bar sections to:
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
exec_always "pgrep stalonetray && sleep 5 && killall stalonetray && sleep 5 && stalonetray || stalonetray"
bar {
        output fake-0
        tray_output none
        position top
        status_command i3status
}

bar {
        output fake-1
        output fake-2
        output fake-3
        output fake-4
        output fake-5
        output fake-6
        output fake-7
        tray_output none
        position top
        # $i3-theme-bar
}

Update: See i3wm for an up-to-date list and copy of related configuration files