guest@dotshare [~/groups/wms/i3] $ ls neat-o/ | cat

neat-o (scrot)

destaat Jan 04, 2016 (wms/i3)

config(raw, dl)

SCROT

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# vim:filetype=i3
# mod
set $mod Mod1

# thin borders
hide_edge_borders none

# Fonts
font pango:Terminus, IcoMoon-Free 9

# drag windows
floating_modifier $mod

# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right

# split in horizontal orientation
bindsym $mod+b 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
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

set $w1 "1"
set $w2 "2"
set $w3 "3"
set $w4 "4"
set $w5 "5"
set $w6 "6"
set $w7 "7"
set $w8 "8"
set $w9 "9"
set $w10 "10"

# move focused container to w
bindsym $mod+Shift+1 move container to workspace $w1
bindsym $mod+Shift+2 move container to workspace $w2
bindsym $mod+Shift+3 move container to workspace $w3
bindsym $mod+Shift+4 move container to workspace $w4
bindsym $mod+Shift+5 move container to workspace $w5
bindsym $mod+Shift+6 move container to workspace $w6
bindsym $mod+Shift+7 move container to workspace $w7
bindsym $mod+Shift+8 move container to workspace $w8
bindsym $mod+Shift+9 move container to workspace $w9
bindsym $mod+Shift+0 move container to workspace $w10

# switch to workspace
bindsym $mod+1 workspace $w1
bindsym $mod+2 workspace $w2
bindsym $mod+3 workspace $w3
bindsym $mod+4 workspace $w4
bindsym $mod+5 workspace $w5
bindsym $mod+6 workspace $w6
bindsym $mod+7 workspace $w7
bindsym $mod+8 workspace $w8
bindsym $mod+9 workspace $w9
bindsym $mod+0 workspace $w10

# reload the configuration file
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart

# resize window (you can also use the mouse for that)
mode "resize" {
  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

    bindsym Return mode "default"
    bindsym Escape mode "default"
}

# resize mode
bindsym $mod+r mode "resize"

### THEME ###

# Colors
set        $fg #d6d1cc
set        $bg #2b2b2b
set     $black #282a2e
set       $red #cb555a
set     $green #85cb55
set    $yellow #e6cc63
set      $blue #53a5ad
set   $magenta #a84466
set      $cyan #7bc3bd
set     $white #e6e1dc

set   $primary #CB555A
set $secondary #a84466
set    $bar_bg #00000000

# Border      Background      Text        Indicator
client.focused          $black      $primary        $bg         $primary
client.focused_inactive $black      $bg             $fg         $bg
client.unfocused        $black      $black          $fg         $black
client.urgent           $black      $white          $fg         $white

### Borders ###
new_window pixel 1
new_float pixel 2

focus_follows_mouse no

for_window [class="^.*"] border pixel 1

# remove border for notification
for_window [class="notify"] border none

# bar
bar {
    status_command i3status
    tray_output none
}

# sticky window
bindsym $mod+Shift+s sticky toggle

# music keys
bindsym $mod+Insert exec --no-startup-id mpc toggle
bindsym $mod+Delete exec --no-startup-id mpc stop
bindsym $mod+Home exec --no-startup-id mpc next
bindsym $mod+End exec --no-startup-id mpc prev
bindsym $mod+Prior exec --no-startup-id mpc volume $(($(mpc volume | grep -o -P "\d+") + 2))
bindsym $mod+Next exec --no-startup-id mpc volume $(($(mpc volume | grep -o -P "\d+") - 2))

# default workspaces
assign [class="Pavucontrol"] $w4
assign [class="Steam"] $w8
assign [class="Transmission"] $w5
assign [class="Vlc"] $w3

# gives focus to new windows
for_window [urgent=latest] focus

bindsym XF86AudioRaiseVolume exec --no-startup-id amixer set Master 5%+
bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master 5%-
bindsym XF86AudioMute exec --no-startup-id amixer -D pulse set Master 1+ toggle

bindsym $mod+Shift+f exec chromium-browser

# start terminal
bindsym $mod+Return exec urxvt256c -ls

# kill window
bindsym $mod+Shift+q kill

# Screenshot
bindsym Print exec scrot -e 'mv $f ~/Screenshots' && exec notify-send 'Screenshot has been saved to ~/Screenshots'

#bindsym $mod+d exec rofi -show run
bindsym $mod+d exec i3-dmenu-desktop

# AUTOSTART #
exec xset -dpms
exec compton --config ~/.config/compton.conf -b

CLICK TO VIEW

x

i3blocks.conf(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
command=$SCRIPT_DIR/$BLOCK_NAME
color=#E0E0E0

separator=false
separator_block_width=15
markup=none
border_top=0
border_right=0
border_left=0
border_bottom=1
border=#e6e1dc

[mopidy]
command=~/.i3/scripts/mopidy
interval=1

[ip]
command=~/.i3/scripts/ip
interval=3600
label=

[load]
command=~/.i3/scripts/load_average
interval=1
label=

[disk]
command=~/.i3/scripts/disk
interval=1
label=

[volume]
command=~/.i3/scripts/volume
label=
instance=Master
#instance=PCM
interval=once
signal=10

[date]
command=date '+%b %d %H:%M'
interval=1
color=#95a5a6
label=
 

x

disk(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>

# 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/>.

DIR="${BLOCK_INSTANCE:-$HOME}"
ALERT_LOW="${1:-10}" # color will turn red under this value (default: 10%)

df -h -P -l "$DIR" | awk -v alert_low=$ALERT_LOW '
/\/.*/ {
	# full text
	print $4

	# short text
	print $4

	use=$5

	# no need to continue parsing
	exit 0
}


END {
gsub(/%$/,"",use)
if (100 - use < alert_low) {
  # color
  print "#cc241d"
} else {
  print "#d3869b"                                                                                         
}
}
'
 

x

load_average(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>

# 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/>.

load="$(cut -d ' ' -f1 /proc/loadavg)"
cpus="$(nproc)"

# full text
echo "$load"

# short text
echo "$load"

# color if load is too high
awk -v cpus=$cpus -v cpuload=$load '
BEGIN {
if (cpus <= cpuload) {
  print "cc241d";
  exit 33;
}
}'
echo "#8ec07c"
 

x

volume(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>

# 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/>.

CARD="${1:-0}"
MIXER="${2:-default}" # use pulse for pulseaudio, default is alsa
SCONTROL="${3:-Master}"

case $BLOCK_BUTTON in
  3) amixer -D pulse set Master 1+ toggle > /dev/null ;; # right click, mute/unmute
  4) amixer -q sset $SCONTROL 5%+ ;;    # scroll up, increase
  5) amixer -q sset $SCONTROL 5%- ;;    # scroll down, decrease
esac

volume () {
    if [ `amixer sget Master | grep -o '\[off\]'` ]; then
        echo "MUTED"
    else
        awk -F"[][]" '/dB/ { print $2 }' <(amixer sget Master)
    fi
}

echo `volume`
echo
echo "#348588"
 

x

mopidy(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# Author: Raphael P. Ribeiro <raphaelpr01@gmail.com> 

MPCSTAT=$(mpc | grep -v '^volume:')
if [ -z "${MPCSTAT}" ]; then # if not playing, exit
  echo "Mopidy not running"
  echo 
  echo "#cc241d"
  exit 1
else
  STAT=""
  MPCSTAT2=`echo "${MPCSTAT}" | sed 's,  *, ,g; 1h;1d;2G' | head -n1 | cut -d ']' -f 1 | tr -d [`
  PLAY=""
  PAUSE=""
  if [ "$MPCSTAT2" = "playing" ]; then
    STAT=$PLAY
  else
    STAT=$PAUSE
  fi
  PLAYING=$(echo "${MPCSTAT}" | sed 's,  *, ,g; 1h;1d;2G' | paste -d' ' -s - | cut -d ')' -f2)
  TIME=`echo "${MPCSTAT}" | sed 's,  *, ,g; 1h;1d;2G' | paste -d' ' -s - | head -n1 | cut -d ' ' -f3`
  VOLUME=$(mpc volume | grep -o -P "\d+")
  echo "$STAT$PLAYING [$TIME - $VOLUME%]"
  echo
  if [ "$MPCSTAT2" = "playing" ]; then
    echo "#fabd2f"
  else
    echo "#fb4934"
  fi
fi

case $BLOCK_BUTTON in
  1) mpc toggle ;; # play/pause
  3) mpc next ;; # next song
  4) mpc volume $(($(mpc volume | grep -o -P "\d+") + 2)) ;; # inc vol 2
  5) mpc volume $(($(mpc volume | grep -o -P "\d+") - 2)) ;; # dec vol 2
esac
 

x

ip(raw, dl)

1
2
3
4
5
#!/bin/bash
echo `ifconfig | grep -o -P '(?<=inet addr:)[\d\.]+(?=\s+Bcast)'`
echo 
echo "#83a598"
exit 0
 

x

Notes

i3-gaps + i3blocks

Remember to chmod +x all of the scripts

File structure:

.i3
config
i3blocks.conf
scripts/
disk
load_average
volume