kalterfive's i3 config (scrot) (+1 likes)
kalterfive Aug 27, 2015 (wms/i3)
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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | ##
## i3 config
##
##
## Autostart
##
exec ~/.config/i3/autostart.sh
##
## Variables
##
## Mod-keys ##
set $alt Mod1
set $super Mod4
## Terminal ##
set $tmx uxterm -e ~/bin/tmx
set $term uxterm
## Navigation ##
set $left h
set $down j
set $up k
set $right l
## Workspaces ##
set $WS0 0:
set $WS1 1:
set $WS2 2:
set $WS3 3:
set $WS4 4:
set $WS5 5:
set $WS6 6:
set $WS7 7:
set $WS8 8:
##
## Borders, and titles
##
font pango:DejaVu Sans 8
for_window [class="Obshutdown"] floating enable
## Hide titles ##
for_window [class="Firefox" instance="Navigator"] border none
for_window [class="utox" instance="utox"] border none
for_window [class="Deadbeef" instance="deadbeef"] border none
for_window [class="Gimp" instance="gimp"] border none
for_window [class="NetBeans IDE 8.0.2" instance="sun-awt-X11-XFramePeer"] border none
for_window [class="Geeqie" instance="geeqie"] border none
## Size of border ##
new_window pixel 1
##
## Colors
##
## Default ##
# client.focused #4c7899 #285577 #ffffff #2e9ef4
# client.focused_inactive #333333 #5f676a #ffffff #484e50
# client.unfocused #333333 #222222 #888888 #292d2e
# client.urgent #2f343a #900000 #ffffff #900000
# class border backgr. text indicator
client.focused #cecece #cecece #2b2b2b #cecece
client.focused_inactive #5f676a #5f676a #cecece #5f676a
client.unfocused #222222 #222222 #888888 #222222
client.urgent #2f343a #900000 #ffffff #900000
##
## Keys
##
## Use Controlouse ##
floating_modifier $super
## Functional keys ##
bindsym XF86MonBrightnessUp exec xbacklight +10
bindsym XF86MonBrightnessDown exec xbacklight -10
bindsym XF86AudioMute exec ~/.config/i3/togglesound.sh
## Screenshot ##
bindsym Print exec import -window root ~/pic/scr/`date +%d%m%y%H%M%S`.png
## Start a terminal ##
bindsym $super+Return exec $term
bindsym $super+t exec $tmx
## Start dmenu (a program launcher) ##
bindsym $super+d exec ~/bin/dmenu
##
## MPD integration
##
bindsym F10 exec mpc toggle
bindsym F11 exec mpc prev
bindsym F12 exec mpc next
##
## WND mode
##
bindsym $super+r mode "WND"
mode "WND" {
bindsym $left resize shrink width 1 px or 1 ppt
bindsym $down resize shrink height 1 px or 1 ppt
bindsym $up resize grow height 1 px or 1 ppt
bindsym $right resize grow width 1 px or 1 ppt
## Title / show / hide border ##
bindsym o border toggle
## Back to normal ##
bindsym r mode "default"
}
##
## Tiles
##
## Kill focused window ##
bindsym $alt+q kill
## Focus tile ##
bindsym $super+$left focus left
bindsym $super+$down focus down
bindsym $super+$up focus up
bindsym $super+$right focus right
## Move focused window ##
bindsym $alt+$left move left
bindsym $alt+$up move up
bindsym $alt+$down move down
bindsym $alt+$right move right
## Split in horizontal orientation ##
bindsym $super+g split h
## Split in vertical orientation ##
bindsym $super+v split v
## Enter fullscreen mode for the focused container ##
bindsym $super+f fullscreen toggle
## Change container layout (stacked, tabbed, toggle split) ##
bindsym $super+s layout stacking
bindsym $super+w layout tabbed
# bindsym $super+e layout toggle split
## Toggle tiling / floating ##
bindsym $alt+space floating toggle
## Change focus between tiling / floating windows ##
bindsym $super+space focus mode_toggle
## Focus the parent container ##
bindsym $super+a focus parent
##
## Power control buttons
##
## Reload the configuration file ##
bindsym $alt+c reload
## Restart i3 inplace ##
bindsym $alt+r restart
## Obshutdown ##
bindsym $alt+o exec obshutdown -c ~/.config/obshutdown.rc
## i3shutdown ##
bindsym $alt+i exec ~/bin/i3shutdown
## Exit in i3 ##
# bindsym $alt+e exit
##
## Workspaces
##
## Support NumPad with code-keys ##
# [+] [-] | [86] [82]
# [7] [8] [9] | [79] [80] [81]
# [4] [5] [6] | [83] [84] [85]
# [1] [2] [3] | [87] [88] [89]
# [0] | [90]
## Terminal with administrator permisions ##
workspace $WS0 output PRIMARY_OUTPUT
bindsym $super+0 workspace $WS0
bindsym $alt+0 move container to workspace $WS0
bindcode $super+90 workspace $WS0
bindcode $alt+90 move container to workspace $WS0
## Tmux ##
workspace $WS1 output PRIMARY_OUTPUT
bindsym $super+1 workspace $WS1
bindsym $alt+1 move container to workspace $WS1
bindcode $super+87 workspace $WS1
bindcode $alt+87 move container to workspace $WS1
## Firefox or any other web browser ##
workspace $WS2 output PRIMARY_OUTPUT
bindsym $super+2 workspace $WS2
bindsym $alt+2 move container to workspace $WS2
bindcode $super+88 workspace $WS2
bindcode $alt+88 move container to workspace $WS2
## IRC, TOX, etc... ##
workspace $WS3 output PRIMARY_OUTPUT
bindsym $super+3 workspace $WS3
bindsym $alt+3 move container to workspace $WS3
bindcode $super+89 workspace $WS3
bindcode $alt+89 move container to workspace $WS3
## View films or listen music ##
workspace $WS4 output PRIMARY_OUTPUT
bindsym $super+4 workspace $WS4
bindsym $alt+4 move container to workspace $WS4
bindcode $super+83 workspace $WS4
bindcode $alt+83 move container to workspace $WS4
## NetBeans / IDEA or pseudo IDE ##
workspace $WS5 output PRIMARY_OUTPUT
bindsym $super+5 workspace $WS5
bindsym $alt+5 move container to workspace $WS5
bindcode $super+84 workspace $WS5
bindcode $alt+84 move container to workspace $WS5
## Usualy GIMP ##
workspace $WS6 output PRIMARY_OUTPUT
bindsym $super+6 workspace $WS6
bindsym $alt+6 move container to workspace $WS6
bindcode $super+85 workspace $WS6
bindcode $alt+85 move container to workspace $WS6
## Files ##
workspace $WS7 output PRIMARY_OUTPUT
bindsym $super+7 workspace $WS7
bindsym $alt+7 move container to workspace $WS7
bindcode $super+79 workspace $WS7
bindcode $alt+79 move container to workspace $WS7
## Misc ##
workspace $WS8 output PRIMARY_OUTPUT
bindsym $super+8 workspace $WS8
bindsym $alt+8 move container to workspace $WS8
bindcode $super+80 workspace $WS8
bindcode $alt+80 move container to workspace $WS8
## Do sth ##
#workspace 9 output PRIMARY_OUTPUT
#bindsym $super+9 workspace 9
#bindcode $super+81 workspace 9
#bindsym $alt+9 move container to workspace 9
#bindcode $alt+81 move container to workspace 9
## Navigation of workspaces (go to, move to) ##
bindcode $super+86 workspace next
bindsym $super+Right workspace next
bindcode $alt+86 move container to workspace next
bindsym $alt+Right move container to workspace next
bindcode $super+82 workspace prev
bindsym $super+Left workspace prev
bindcode $alt+82 move container to workspace prev
bindsym $alt+Left move container to workspace prev
## Workspaces for applications ##
assign [class="Firefox"] $WS2
assign [class="utox"] $WS3
assign [class="Deadbeef"] $WS4
assign [class="Netbeans"] $WS5
assign [class="Gimp"] $WS6
assign [class="Pcmanfm"] $WS7
assign [class="Engrampa"] $WS7
assign [class="Geeqie"] $WS7
assign [class="Deluge"] $WS7
##
## Bar
##
bar {
strip_workspace_numbers yes
font pango:dejavu sans 9
status_command ~/.config/i3/bar.sh
workspace_buttons yes
tray_output none
separator_symbol " "
i3bar_command /usr/bin/i3bar-icons
colors {
background #1b1b1b
statusline #999999
# border backgr text
focused_workspace #cccccc #444444 #cccccc
active_workspace #cccccc #444444 #cccccc
inactive_workspace #444444 #1b1b1b #cccccc
urgent_workspace #cccccc #bf3939 #cccccc
}
}
|
x
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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | #!/usr/bin/env bash
##
## Generate JSON for i3bar
## A replacement for i3status written in bash
## kalterfive
##
## Dependencies:
## mpd, mpc, deadbeef
## skb -- get language
## sensors -- get heating cpu
## acpi -- get battery state
##
# {{{ Error codes
E_UE=6 # unhandeled event
# }}}
# {{{ Colors
color_white='#FFFFFF'
color_green='#00CC00'
color_std='#CCCCCC'
color_waring='#CCCC00'
color_danger='#CC0000'
icon_color='"icon_color":"'$color_white'"'
# }}}
function iconbyname() {
local icon=$1
echo '"icon":"'$HOME/.config/i3/icons/$icon'.xbm"'
}
##
## Fattest processes
##
#function init_topmem() {
#}
function toJson() {
for process in "$@"; do
echo '{"full_text":"'$process'","color":"'$color_std'"},'
done
}
function get_topmem() {
local count=5
local proc=(`ps -eo pmem,cmd\
| sort -k 1 -nr\
| awk '{print($2);}'\
| head -$count\
| sed 's/\/.*\/.*\///g'`)
topmem=`toJson ${proc[@]}`
}
##
## Kernel version
##
function init_kernel() {
## JSON output
local full_text='"full_text":"'`uname -r`'"'
local color='"color":"'$color_std'"'
local icon_kernel=`iconbyname arch`
kernel='{'$full_text','$color','$icon_kernel','$icon_color'},'
}
#function get_kernel() {
#}
##
## State of MPD || DeaDBeeF
##
function init_music() {
icon_play=`iconbyname play`
icon_pause=`iconbyname pause`
icon_stop=`iconbyname stop`
}
function get_music() {
local color='"color":"'$color_std'"'
local full_text
local icon
state=`deadbeef --nowplaying "%e" | grep ":"`
if [[ ! "$state" ]]; then
state=`mpc | grep "-"`
if [[ ! "$state" ]]; then
# full_text='"full_text":"OFF"'
# icon=$icon_stop
unset music
return
else
state=`mpc | grep "\[..*\]"`
elapsed=`echo "$state" | awk -F\/ '{print($2);}' | sed 's/.* //'`
full_text='"full_text":"'$elapsed'"'
state=`echo "$state" | sed 's/\].*//;s/\[//'`
case "$state" in
playing)
icon=$icon_play
;;
paused)
icon=$icon_pause
;;
esac
fi
else
full_text='"full_text":"'$state'"'
icon=$icon_play
fi
music='{'$full_text','$color','$icon','$icon_color'},'
}
##
## Keyboard
##
function init_language() {
icon_language=`iconbyname kbd`
}
function get_language() {
language=`skb noloop\
| head -c 2\
| tr a-z A-Z`
## JSON output
local full_text='"full_text":"'$language'"'
local color='"color":"'$color_std'"'
language='{'$full_text','$color','$icon_language','$icon_color'},'
}
##
## Signal Strength
##
function init_csq() {
# csqd, yes...
sudo killall csqd
sudo $HOME/bin/csqd "/dev/ttyUSB2" &
icon_csq=`iconbyname csq`
}
function get_csq() {
csq=`cat /tmp/csq.txt`
## JSON output
local full_text='"full_text":"'$csq'%"'
local color='"color":"'$color_std'"'
csq='{'$full_text','$color','$icon_csq','$icon_color'},'
}
##
## Num Lock state
##
function init_numlock() {
icon_numlock=`iconbyname numlock`
}
function get_numlock() {
numlock=`xset q\
| grep "Num Lock:"\
| awk '{print($8)}'\
| tr a-z A-Z`
## JSON output
local full_text='"full_text":"'$numlock'"'
local color='"color":"'$color_std'"'
numlock='{'$full_text','$color','$icon_numlock','$icon_color'},'
}
##
## Caps Lock state
##
function init_capslock() {
icon_capslock=`iconbyname capslock`
}
function get_capslock_color() {
local capslock=$1
local color0
local color1
case "$capslock" in
"ON")
color0='"color":"'$color_waring'"' # text
color1='"icon_color":"'$color_waring'"' # icon
;;
"OFF")
color0='"color":"'$color_std'"'
color1='"icon_color":"'$color_white'"'
;;
*)
exit $E_UE
;;
esac
echo "$color0,$color1"
}
function get_capslock() {
capslock=`xset q\
| grep "Caps Lock:"\
| awk '{print($4)}'\
| tr a-z A-Z`
## JSON output
local full_text='"full_text":"'$capslock'"'
local color=`get_capslock_color $capslock`
capslock='{'$full_text','$color','$icon_capslock'},'
}
##
## Heating CPU
##
function init_heating_cpu() {
icon_cpu=`iconbyname cpu`
}
function get_heating() {
local sensors=`sensors\
| grep Core\
| sed 's/\..*//g;s/.*+//g'`
local heating_cpu=0
local kernels=0
for core in $sensors; do
$((heating_cpu += core))
$((kernels++))
done
$((heating_cpu /= kernels))
echo "$heating_cpu"
}
function get_heating_color() {
local heating_cpu=$1
local color0
local color1
case "$heating_cpu" in
7[0-9])
color0='"color":"'$color_waring'"' # text
color1='"icon_color":"'$color_waring'"' # icon
;;
8[0-9] | 9[0-9] | 10[0-5])
color0='"color":"'$color_danger'"'
color1='"icon_color":"'$color_danger'"'
;;
*)
color0='"color":"'$color_std'"'
color1='"icon_color":"'$color_white'"'
;;
esac
echo "$color0,$color1"
}
function get_heating_cpu() {
heating_cpu=`get_heating`
## JSON output
local full_text='"full_text":"'$heating_cpu'°C"'
local color=`get_heating_color $heating_cpu`
heating_cpu='{'$full_text','$color','$icon_cpu'},'
}
##
## Brightness level
##
function init_brightness() {
icon_brightness=`iconbyname sun`
brightness_path="/sys/class/backlight/intel_backlight"
}
function get_brightness() {
local brg=`cat $brightness_path/brightness`
local max_brg=`cat $brightness_path/max_brightness`
local brightness_level=`echo "scale = 2; $brg * 100 / $max_brg"\
| bc`
## JSON output
local full_text='"full_text":"'$brightness_level'%"'
local color='"color":"'$color_std'"'
brightness='{'$full_text','$color','$icon_brightness','$icon_color'},'
}
##
## Sound state (level and mute)
##
function init_sound() {
icon_sound_on=`iconbyname sound_on`
icon_sound_off=`iconbyname sound_off`
}
function get_sound_icon() {
local sound_state=`amixer get Master\
| grep 'Mono:'\
| awk '{print($6);}'`
case "$sound_state" in
"[on]")
echo "$icon_sound_on"
;;
"[off]")
echo "$icon_sound_off"
;;
*)
exit $E_UE
;;
esac
}
function get_sound() {
local sound_level=`amixer get Master\
| grep 'Mono:'\
| sed 's/\].*//;s/.*\[//'`
## JSON output
local full_text='"full_text":"'$sound_level'"'
local color='"color":"'$color_std'"'
local icon=`get_sound_icon`
sound='{'$full_text','$color','$icon','$icon_color'},'
}
##
## Battery level
##
function init_battery_level() {
icon_battery_charging=`iconbyname "battery/battery_charging"`
for ((i=0; i <= 100; i++)); do
local var="icon_battery_$i"
local full_path=`iconbyname "battery/battery_$i"`
declare -g "$var=$full_path"
done
}
function get_battery_color() {
local battery_level=$1
local color0
local color1
case "$battery_level" in
[0-9] | 10)
color0='"color":"'$color_danger'"' # text
color1='"icon_color":"'$color_danger'"' # icon
;;
1[1-9] | 2[0-5])
color0='"color":"'$color_waring'"'
color1='"icon_color":"'$color_waring'"'
;;
9[5-9] | 100)
local state=`cat /sys/class/power_supply/BAT0/status`
if [[ "$state" == "Charging" ]]; then
color0='"color":"'$color_green'"'
color1='"icon_color":"'$color_green'"'
else
color0='"color":"'$color_std'"'
color1='"icon_color":"'$color_white'"'
fi
;;
*)
color0='"color":"'$color_std'"'
color1='"icon_color":"'$color_white'"'
;;
esac
echo "$color0,$color1"
}
function get_battery_icon() {
local battery_level=$1
local state=`acpi\
| awk '{print($3);}'\
| sed 's/,//g'`
case "$state" in
Discharging)
case "$battery_level" in
[0-5]) echo "$icon_battery_0" ;;
[6-9] | 1[0-5]) echo "$icon_battery_10" ;;
1[6-9] | 2[0-5]) echo "$icon_battery_20" ;;
2[6-9] | 3[0-5]) echo "$icon_battery_30" ;;
3[6-9] | 4[0-5]) echo "$icon_battery_40" ;;
4[6-9] | 5[0-5]) echo "$icon_battery_50" ;;
5[6-9] | 6[0-5]) echo "$icon_battery_60" ;;
6[6-9] | 7[0-5]) echo "$icon_battery_70" ;;
7[6-9] | 8[0-5]) echo "$icon_battery_80" ;;
8[6-9] | 9[0-5]) echo "$icon_battery_90" ;;
9[6-9] | 100) echo "$icon_battery_100" ;;
esac
;;
Charging)
echo "$icon_battery_charging"
;;
*)
exit $E_UE
;;
esac
}
function get_battery_level() {
# battery_level=`cat /sys/class/power_supply/BAT0/capacity`
battery_level=`acpi\
| sed 's/%,.*//g;s/.*\s//g'`
## JSON output
local full_text='"full_text":"'$battery_level'%"'
local color=`get_battery_color $battery_level`
local icon_battery=`get_battery_icon $battery_level`
battery_level='{'$full_text','$color','$icon_battery'},'
}
##
## Date and time
##
function init_date() {
icon_date=`iconbyname cal`
}
function get_date() {
date=`date +%a\ %d.%m.%Y\
| tr a-z A-Z`
## JSON output
local full_text='"full_text":"'$date'"'
local color='"color":"'$color_std'"'
date='{'$full_text','$color','$icon_date','$icon_color'},'
}
## The last block
function get_time() {
time=`date +%H:%M:%S`
# JSON output
local full_text='"full_text":"'$time' "'
local color='"color":"'$color_std'"'
time='{'$full_text','$color'}'
}
blocks=(
# [0]=topmem
[10]=kernel
[20]=music
[30]=language
[40]=numlock
# [50]=capslock
# [60]=csq
[70]=heating_cpu
# [80]=brightness
[90]=sound
[100]=battery_level
[110]=date
[120]=time
)
unset func_list
bar='['
for block in ${blocks[@]}; do
init_$block 2> /dev/null
func_list+=" get_$block"
bar+='${'$block':-}'
done
bar+="],"
echo '{"version":1}['
while [ 1 ]; do
for func in $func_list; do
$func 2> /dev/null
done
eval echo -e \"${bar//\\/\\\\}\" || exit
sleep 0.5
done
|
x
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 | #!/usr/bin/env bash
##
## Autostart-script
##
# Default workspace
i3-msg "workspace 1:TMUX"
# Set brightness
# 2343,5 == 30%
brightness='/sys/class/backlight/intel_backlight/brightness'
echo 2344 | sudo tee "$brightness" > /dev/null
# Keyboard daemon
kbdd
# X-resources
xrdb -merge $HOME/.config/xres
# Switch keyboard
setxkbmap "us,ru" ",winkeys" "grp:caps_toggle"
# Composer
compton --config $HOME/.config/compton.conf &
# Set background image
feh --no-fehbg --bg-fill $HOME/.config/i3/wall.jpg
# Music player daemon
mpd .config/mpd/mpd.conf
# Point-To-Point daemon
$HOME/bin/diald -1 &
# Notifications
$HOME/bin/dunst &
|
x