From 5e8b37ec69e5dbf9739294c47112efb012a6c646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Mon, 30 Sep 2013 01:30:28 +0200 Subject: [PATCH] Added parameter to i3bar_wrapper.bash and updated conkyrcs. i3bar_wrapper.bash now takes the conkyrc for the status line as the first argument so host specific conkyrcs can be used. Additionaly, the conkyrcs for virtualarch and netbook were updated. Virtualarch has hardly changed, but netbook now has a quite short statusline that fits the screen size. --- i3/i3/config.d/netbook.config | 3 +- i3/i3/config.d/virtualarch.config | 2 +- i3/i3/conky/netbook.conky | 16 --- i3/i3/conky/netbook.conkyrc | 131 ++++++++++++++++++ ...{virtualarch.conky => virtualarch.conkyrc} | 70 +++++++++- i3/i3/i3bar_wrapper.bash | 4 +- 6 files changed, 205 insertions(+), 21 deletions(-) delete mode 100644 i3/i3/conky/netbook.conky create mode 100644 i3/i3/conky/netbook.conkyrc rename i3/i3/conky/{virtualarch.conky => virtualarch.conkyrc} (69%) diff --git a/i3/i3/config.d/netbook.config b/i3/i3/config.d/netbook.config index cac6d16..d6c7b10 100644 --- a/i3/i3/config.d/netbook.config +++ b/i3/i3/config.d/netbook.config @@ -35,5 +35,6 @@ bar { } i3bar_command i3bar - status_command conky --config ~/.i3/conky/netbook.conky + #status_command i3status -c ~/.i3/i3status.d/netbook.conf + status_command bash ~/.i3/i3bar_wrapper.bash ~/.i3/conky/netbook.conkyrc } diff --git a/i3/i3/config.d/virtualarch.config b/i3/i3/config.d/virtualarch.config index 5c11e2a..8bbd1e9 100644 --- a/i3/i3/config.d/virtualarch.config +++ b/i3/i3/config.d/virtualarch.config @@ -35,7 +35,7 @@ bar { } i3bar_command i3bar - status_command bash ~/.i3/i3bar_wrapper.bash + status_command bash ~/.i3/i3bar_wrapper.bash ~/.i3/conky/virtualarch.conkyrc } bar { diff --git a/i3/i3/conky/netbook.conky b/i3/i3/conky/netbook.conky deleted file mode 100644 index e119930..0000000 --- a/i3/i3/conky/netbook.conky +++ /dev/null @@ -1,16 +0,0 @@ -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 - -xftfont Consolas - -TEXT -${if_up wlp2os0}W: ${addr wlp2s0} (${wireless_link_qual_perc wlp2s0}%)${else}W down$endif | \ -BAT: ${battery_short} (${battery_time}) | \ -${tztime} | diff --git a/i3/i3/conky/netbook.conkyrc b/i3/i3/conky/netbook.conkyrc new file mode 100644 index 0000000..366d6aa --- /dev/null +++ b/i3/i3/conky/netbook.conkyrc @@ -0,0 +1,131 @@ +# 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 +[ +${if_existing /sys/class/net/wlp2s0}\ +{ "full_text" : " \ +W: \ +${if_up wlp2s0}\ +${if_match "${addr wlp2s0}" != "No Address"}\ +${addr wlp2s0} @ ${wireless_essid wlp2s0} (${wireless_link_qual_perc wlp2s0}%)\ +${else}\ +No Address\ +${endif}\ +${else}\ +down\ +${endif}\ + " , "color" : "\ +${if_up wlp2s0}\ +${if_match "${addr wlp2s0}" != "No Address"}\ +${if_match ${wireless_link_qual_perc wlp2s0} <= 25}\ +\#FF0000\ +${else}${if_match ${wireless_link_qual_perc wlp2s0} <= 50}\ +\#FFFF00\ +${else}\ +\#00FF00\ +${endif}\ +${endif}\ +${else}\#FFFF00\ +${endif}\ +${else}\#FF0000\ +${endif}\ +" }, +${endif} +\ +\ +\ +${if_existing /sys/class/net/enp0s3} +{ "full_text" : " \ +E: \ +${if_up enp0s3}\ +${addr enp0s3}\ +${else}\ +down\ +${endif}\ + " , "color" : "\ +${if_up enp0s3}\ +${if_match "${addr enp0s3}" != "No Address"}\#00FF00\ +${else}\#FFFF00\ +${endif}\ +${else}\#FF0000\ +${endif}\ +" }, +${endif} +\ +\ +\ +${if_existing /sys/class/net/enp1s0} +{ "full_text" : " \ +E: \ +${if_up enp1s0}\ +${addr enp1s0}\ +${else}\ +down\ +${endif}\ + " , "color" : "\ +${if_up enp1s0}\ +${if_match "${addr enp1s0}" != "No Address"}\#00FF00\ +${else}\#FFFF00\ +${endif}\ +${else}\#FF0000\ +${endif}\ +" }, +${endif} +\ +\ +\ +${if_existing /sys/class/net/eth0} +{ "full_text" : " \ +E: \ +${if_up eth0}\ +${addr eth0}\ +${else}\ +down\ +${endif}\ + " , "color" : "\ +${if_up eth0}\ +${if_match "${addr eth0}" != "No Address"}\#00FF00\ +${else}\#FFFF00\ +${endif}\ +${else}\#FF0000\ +${endif}\ +" }, +${endif} +\ +\ +\ +{ "full_text" : " VOL: \ +${if_match ${mixer} == 0}\ +mute\ +${else}\ +${mixer}%\ +${endif}\ + " , "color" : "\#FFFFFF" }, +\ +\ +\ +${if_existing /sys/class/power_supply/BAT0}\ +{ "full_text" : " BAT: ${battery_short BAT0} " , "color" : "\#FFFFFF" }, +${endif}\ +\ +\ +\ +{ "full_text" : " ${time %a %F %T} " , "short_text" : " ${time %a %T} " , "color" : "\#FFFFFF" , "name" : "time" } +], + diff --git a/i3/i3/conky/virtualarch.conky b/i3/i3/conky/virtualarch.conkyrc similarity index 69% rename from i3/i3/conky/virtualarch.conky rename to i3/i3/conky/virtualarch.conkyrc index 5e40102..a25f5ad 100644 --- a/i3/i3/conky/virtualarch.conky +++ b/i3/i3/conky/virtualarch.conkyrc @@ -74,13 +74,59 @@ ${endif}\ \ \ \ +${if_mounted /home}\ +{ "full_text" : " \ +/home: ${fs_used /home}/${fs_size /home} (${fs_used_perc /home}%)\ + " , "color" : "\ +${if_match ${fs_used_perc /home} <= 70}\#00FF00\ +${else}${if_match ${fs_used_perc /home} <= 90}\#FFFF00\ +${else}\#FF0000\ +${endif}\ +${endif}\ +" }, +${endif}\ +\ +\ +\ +${if_existing /sys/class/net/wlp2s0}\ +{ "full_text" : " \ +wlp2s0: \ +${if_up wlp2s0}\ +${if_match "${addr wlp2s0}" != "No Address"}\ +${addr wlp2s0} @ ${wireless_essid wlp2s0} (${wireless_link_qual_perc wlp2s0}%)\ +${else}\ +No Address\ +${endif}\ +${else}\ +down\ +${endif}\ + " , "color" : "\ +${if_up wlp2s0}\ +${if_match "${addr wlp2s0}" != "No Address"}\ +${if_match ${wireless_link_qual_perc wlp2s0} <= 25}\ +\#FF0000\ +${else}${if_match ${wireless_link_qual_perc wlp2s0} <= 50}\ +\#FFFF00\ +${else}\ +\#00FF00\ +${endif}\ +${endif}\ +${else}\#FFFF00\ +${endif}\ +${else}\#FF0000\ +${endif}\ +" }, +${endif} +\ +\ +\ ${if_existing /sys/class/net/enp0s3} { "full_text" : " \ enp0s3: \ ${if_up enp0s3}\ ${addr enp0s3}\ ${else}\ -E: down\ +down\ ${endif}\ " , "color" : "\ ${if_up enp0s3}\ @@ -94,13 +140,33 @@ ${endif} \ \ \ +${if_existing /sys/class/net/enp1s0} +{ "full_text" : " \ +enp1s0: \ +${if_up enp1s0}\ +${addr enp1s0}\ +${else}\ +down\ +${endif}\ + " , "color" : "\ +${if_up enp1s0}\ +${if_match "${addr enp1s0}" != "No Address"}\#00FF00\ +${else}\#FFFF00\ +${endif}\ +${else}\#FF0000\ +${endif}\ +" }, +${endif} +\ +\ +\ ${if_existing /sys/class/net/eth0} { "full_text" : " \ eth0: \ ${if_up eth0}\ ${addr eth0}\ ${else}\ -E: down\ +down\ ${endif}\ " , "color" : "\ ${if_up eth0}\ diff --git a/i3/i3/i3bar_wrapper.bash b/i3/i3/i3bar_wrapper.bash index 9104f56..08eac95 100644 --- a/i3/i3/i3bar_wrapper.bash +++ b/i3/i3/i3bar_wrapper.bash @@ -1,6 +1,8 @@ #!/usr/bin/env bash # From http://i3wm.org/docs/user-contributed/conky-i3bar.html +path_conkyrc="$1" + # end the header so that i3bar knows we want to use JSON: echo '{ "version": 1 ,"stop_signal": 10, "cont_signal": 12, "click_events" : true }' @@ -11,7 +13,7 @@ echo '[' echo '[],' # Now send blocks with information forever: -conky -c $HOME/.i3/conky/virtualarch.conky & +conky -c "$path_conkyrc" while read input ; do bash ~/.i3/i3bar_clickparser.bash "$input"