Completely reworked the status bar.
It's now conky -> i3bar. To enable colors, conky produces JSON output. The script i3bar_wrapper.bash handles the invocation of conky and redirects the output of i3bar to i3bar_clickparser.bash, in which click events can be handled (none implemented right now). conky/virtualarch.conky.dzen is a conky output suitable for dzen2, it should produce the same output as conky/virtualarch.conky does with i3bar and JSON.
This commit is contained in:
@@ -13,9 +13,9 @@ bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master %5-
|
|||||||
bar {
|
bar {
|
||||||
# always show at the bottom of the screen
|
# always show at the bottom of the screen
|
||||||
mode dock
|
mode dock
|
||||||
position bottom
|
position top
|
||||||
|
|
||||||
# show a tray area
|
output VBOX0
|
||||||
tray_output primary
|
tray_output primary
|
||||||
|
|
||||||
# show workspace buttons
|
# show workspace buttons
|
||||||
@@ -37,5 +37,6 @@ bar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i3bar_command i3bar
|
i3bar_command i3bar
|
||||||
status_command i3status --config $path_i3status_config
|
status_command bash ~/.i3/i3bar_wrapper.bash
|
||||||
|
#status_command i3status --config ~/.i3/i3status.d/virtualarch.conf
|
||||||
}
|
}
|
||||||
|
|||||||
135
i3/i3/conky/virtualarch.conky
Normal file
135
i3/i3/conky/virtualarch.conky
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
# vim:set filetype=conkyrc:
|
||||||
|
# TODO: coloring of LOAD should depend on number of cpus, as it scales accordingly
|
||||||
|
out_to_console yes
|
||||||
|
out_to_ncurses no
|
||||||
|
out_to_stderr no
|
||||||
|
out_to_x no
|
||||||
|
|
||||||
|
short_units yes
|
||||||
|
|
||||||
|
double_buffer yes
|
||||||
|
|
||||||
|
update_interval 1.0
|
||||||
|
update_interval_on_battery 1.0
|
||||||
|
|
||||||
|
# pad_percents is useless without use_spacer, but the latter leads to some ugly gaps
|
||||||
|
#pad_percents 2
|
||||||
|
#use_spacer left
|
||||||
|
|
||||||
|
#TEXT
|
||||||
|
#
|
||||||
|
#\
|
||||||
|
#\
|
||||||
|
#\
|
||||||
|
#\
|
||||||
|
TEXT
|
||||||
|
[
|
||||||
|
{ "full_text" : " \
|
||||||
|
CPU: ${cpu cpu0}%\
|
||||||
|
" , "color" : "\
|
||||||
|
${if_match ${cpu cpu0} <= 25}\#00FF00\
|
||||||
|
${else}${if_match ${cpu cpu0} <= 75}\#FFFF00\
|
||||||
|
${else}\#FF0000\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
" , "min_width" : "CPU 00%" },
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
{ "full_text" : " \
|
||||||
|
MEM: ${mem}/${memmax} (${memperc}%)\
|
||||||
|
" , "color" : "\
|
||||||
|
${if_match ${memperc} <= 50}\#00FF00\
|
||||||
|
${else}${if_match ${memperc} <= 75}\#FFFF00\
|
||||||
|
${else}\#FF0000\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
" },
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
{ "full_text" : " \
|
||||||
|
${if_match "${swapperc}" != "No swap"}\
|
||||||
|
SWAP: ${swap}/${swapmax} (${swapperc}%)\
|
||||||
|
${else}\
|
||||||
|
No swap\
|
||||||
|
${endif}\
|
||||||
|
" , "color" : "\
|
||||||
|
${if_match "${swapperc}" == "No swap"}\#FFFFFF\
|
||||||
|
${else}${if_match ${swapperc} <= 50}\#00FF00\
|
||||||
|
${else}${if_match ${swapperc} <= 75}\#FFFF00\
|
||||||
|
${else}\#FF0000\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
" },
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
${if_mounted /}\
|
||||||
|
{ "full_text" : " \
|
||||||
|
/: ${fs_used /}/${fs_size /} (${fs_used_perc /}%)\
|
||||||
|
" , "color" : "\
|
||||||
|
${if_match ${fs_used_perc /} <= 70}\#00FF00\
|
||||||
|
${else}${if_match ${fs_used_perc /} <= 90}\#FFFF00\
|
||||||
|
${else}\#FF0000\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
" },
|
||||||
|
${endif}\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
${if_existing /sys/class/net/enp0s3}
|
||||||
|
{ "full_text" : " \
|
||||||
|
enp0s3: \
|
||||||
|
${if_up enp0s3}\
|
||||||
|
${addr enp0s3}\
|
||||||
|
${else}\
|
||||||
|
E: down\
|
||||||
|
${endif}\
|
||||||
|
" , "color" : "\
|
||||||
|
${if_up enp0s3}\
|
||||||
|
${if_match "${addr enp0s3}" != "No Address"}\#00FF00\
|
||||||
|
${else}\#FFFF00\
|
||||||
|
${endif}\
|
||||||
|
${else}\#FF0000\
|
||||||
|
${endif}\
|
||||||
|
" },
|
||||||
|
${endif}
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
{ "full_text" : " \
|
||||||
|
LOAD: ${loadavg 2}\
|
||||||
|
" , "color" : "\
|
||||||
|
${if_match ${loadavg 2} <= 0.7}\#00FF00\
|
||||||
|
${else}${if_match ${loadavg 2} <= 1}\#FFFF00\
|
||||||
|
${else}\#FF0000)\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
" },
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
${if_existing /proc/acpi/battery/BATO}\
|
||||||
|
{ "full_text" : " BAT: ${battery_short} (${battery_time}) " , "color" : "\#FFFFFF" },
|
||||||
|
${endif}\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
{ "full_text" : " KERNEL: ${sysname} ${kernel} " , "color" : "\#FFFFFF" },
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
{ "full_text" : " HOST: $nodename " , "color" : "\#FFFFFF" },
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
{ "full_text" : " UP: $uptime_short " , "color" : "\#FFFFFF" },
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
{ "full_text" : " ${time %a %F %T} " , "color" : "\#FFFFFF" , "name" : "time" }
|
||||||
|
],
|
||||||
|
|
||||||
94
i3/i3/conky/virtualarch.conky.dzen
Normal file
94
i3/i3/conky/virtualarch.conky.dzen
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# TODO: coloring of LOAD should depend on number of cpus, as it scales accordingly
|
||||||
|
out_to_console yes
|
||||||
|
out_to_ncurses no
|
||||||
|
out_to_stderr no
|
||||||
|
out_to_x no
|
||||||
|
|
||||||
|
short_units yes
|
||||||
|
|
||||||
|
update_interval 1.0
|
||||||
|
update_interval_on_battery 1.0
|
||||||
|
|
||||||
|
# pad_percents is useless without use_spacer, but the latter leads to some ugly gaps
|
||||||
|
#pad_percents 2
|
||||||
|
#use_spacer left
|
||||||
|
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
${if_existing /sys/class/net/enp0s3}\
|
||||||
|
${if_up enp0s3}\
|
||||||
|
enp0s3: \
|
||||||
|
${if_match "${addr enp0s3}" != "No Address"}^fg(\#00FF00)\
|
||||||
|
${else}^fg(\#FFFF00)\
|
||||||
|
${endif}\
|
||||||
|
${addr enp0s3}\
|
||||||
|
${else}^fg(\#FF0000)E: down
|
||||||
|
${endif}^fg() | \
|
||||||
|
${endif}\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
${if_existing /proc/acpi/battery/BATO}BAT: ${battery_short} (${battery_time}) | ${endif}\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
${if_mounted /}\
|
||||||
|
/: \
|
||||||
|
${if_match ${fs_used_perc /} <= 70}^fg(\#00FF00)\
|
||||||
|
${else}${if_match ${fs_used_perc /} <= 90}^fg(\#FFFF00)\
|
||||||
|
${else}^fg(\#FF0000)\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
${fs_used /}/${fs_size /} (${fs_used_perc /}%)\
|
||||||
|
^fg() | ${endif}\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
MEM: \
|
||||||
|
${if_match ${memperc} <= 50}^fg(\#00FF00)\
|
||||||
|
${else}${if_match ${memperc} <= 75}^fg(\#FFFF00)\
|
||||||
|
${else}^fg(\#FF0000)\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
$mem/$memmax (${memperc}%)^fg() | \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
${if_match "${swapperc}" != "No swap"}\
|
||||||
|
SWAP: \
|
||||||
|
${if_match ${swapperc} <= 50}^fg(\#00FF00)\
|
||||||
|
${else}${if_match ${swapperc} <= 75}^fg(\#FFFF00)\
|
||||||
|
${else}^fg(\#FF0000)\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
${swap}/${swapmax} (${swapperc}%)\
|
||||||
|
${else}\
|
||||||
|
No swap\
|
||||||
|
${endif}\
|
||||||
|
^fg() | \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
CPU: \
|
||||||
|
${if_match ${cpu cpu0} <= 25}^fg(\#00FF00)\
|
||||||
|
${else}${if_match ${cpu cpu0} <= 75}fg(\#FFFF00)\
|
||||||
|
${else}fg(\#FF0000)\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
${cpu cpu0}%^fg() | \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
LOAD: \
|
||||||
|
${if_match ${loadavg 2} <= 0.7}^fg(\#00FF00)\
|
||||||
|
${else}${if_match ${loadavg 2} <= 1}fg(\#FFFF00)\
|
||||||
|
${else}fg(\#FF0000)\
|
||||||
|
${endif}\
|
||||||
|
${endif}\
|
||||||
|
${loadavg 2}^fg() | \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
KERNEL: ${sysname} ${kernel} | \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
HOST: $nodename | \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
UP: $uptime_short | \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
${time %a %F %T} #
|
||||||
27
i3/i3/i3bar_clickparser.bash
Normal file
27
i3/i3/i3bar_clickparser.bash
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
line="$1
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
log(){
|
||||||
|
echo $* >> ~/.i3/output_i3bar.log.2
|
||||||
|
}
|
||||||
|
|
||||||
|
# I'm sorry.
|
||||||
|
getval(){
|
||||||
|
echo $(echo "$1" | grep -Po "\"$2\":.*?," | awk -F ':' '{print $2}' | tr -d '",')
|
||||||
|
}
|
||||||
|
|
||||||
|
log $line
|
||||||
|
|
||||||
|
name="$(getval "$line" "name")"
|
||||||
|
log $name
|
||||||
|
|
||||||
|
case "$name" in
|
||||||
|
"time")
|
||||||
|
log "starting dzen with cal"
|
||||||
|
(echo "$(cal -1m)" ; sleep 15s) | dzen2 -w 100 -l 10 -x 1700 -y 20
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
6
i3/i3/i3bar_parser.bash
Normal file
6
i3/i3/i3bar_parser.bash
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
while read line; do
|
||||||
|
echo $line
|
||||||
|
echo $line >> ~/.i3/output_i3bar.log
|
||||||
|
done
|
||||||
19
i3/i3/i3bar_wrapper.bash
Normal file
19
i3/i3/i3bar_wrapper.bash
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# From http://i3wm.org/docs/user-contributed/conky-i3bar.html
|
||||||
|
|
||||||
|
# end the header so that i3bar knows we want to use JSON:
|
||||||
|
echo '{ "version": 1 ,"stop_signal": 10, "cont_signal": 12, "click_events" : true }'
|
||||||
|
|
||||||
|
# Begin the endless array.
|
||||||
|
echo '['
|
||||||
|
|
||||||
|
# We send an empty first array of blocks to make the loop simpler:
|
||||||
|
echo '[],'
|
||||||
|
|
||||||
|
# Now send blocks with information forever:
|
||||||
|
conky -c $HOME/.i3/conky/virtualarch.conky &
|
||||||
|
|
||||||
|
while read input ; do
|
||||||
|
bash ~/.i3/i3bar_clickparser.bash "$input"
|
||||||
|
done
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
[[default]]
|
[[default]]
|
||||||
scrollbar_position = hidden
|
scrollbar_position = hidden
|
||||||
palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
|
palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
|
||||||
font = Consolas 11
|
font = DejaVu Sans Mono 10
|
||||||
background_image = None
|
background_image = None
|
||||||
background_darkness = 0.9
|
background_darkness = 0.9
|
||||||
urgent_bell = True
|
urgent_bell = True
|
||||||
|
|||||||
Reference in New Issue
Block a user