Switch from i3status+conky to i3blocks.
This commit is contained in:
@@ -367,5 +367,5 @@ bar {
|
||||
}
|
||||
|
||||
i3bar_command i3bar
|
||||
status_command bash ~/.i3/scripts/i3bar_wrapper.bash ~/.i3/conky/statusbar.conkyrc
|
||||
status_command i3blocks -c ~/.i3/i3blocks.conf
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
# vim:set filetype=conkyrc:
|
||||
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
|
||||
|
||||
#${mpd_artist} - ${mpd_title} ${mpd_elapsed}/${mpd_length}\
|
||||
TEXT
|
||||
[\
|
||||
{ "full_text" : " \
|
||||
${texeci 5 bash $HOME/.i3/scripts/pa-volume.bash status} " , "color" : "\#FFFFFF" , "name" : "volume" },\
|
||||
\
|
||||
\
|
||||
\
|
||||
${texeci 10 bash $HOME/.i3/scripts/battery.bash conky}\
|
||||
\
|
||||
\
|
||||
\
|
||||
{ "full_text" : " ${kernel} " , "color" : "\#FFFFFF" , "name" : "sysinfo" },\
|
||||
\
|
||||
\
|
||||
\
|
||||
{ "full_text" : " $uptime_short " , "color" : "\#FFFFFF" , "name" : "sysinfo" },\
|
||||
\
|
||||
\
|
||||
\
|
||||
{ "full_text" : " ${time %a %F %T} " , "color" : "\#FFFFFF" , "name" : "time" },\
|
||||
\
|
||||
\
|
||||
\
|
||||
{ "full_text" : "" }\
|
||||
],
|
||||
|
||||
29
i3/i3/i3blocks.conf
Normal file
29
i3/i3/i3blocks.conf
Normal file
@@ -0,0 +1,29 @@
|
||||
separator_block_width=33
|
||||
|
||||
[volume]
|
||||
command=$HOME/.i3/scripts/pa-volume.bash status
|
||||
signal=1
|
||||
label=
|
||||
interval=once
|
||||
|
||||
[battery]
|
||||
command=$HOME/.i3/scripts/battery.bash i3blocks
|
||||
label=
|
||||
interval=30
|
||||
|
||||
[kernel]
|
||||
command=uname -r
|
||||
label=
|
||||
interval=once
|
||||
|
||||
[time]
|
||||
command=date "+%a %d.%m.%Y %H:%M:%S"
|
||||
label=
|
||||
interval=1
|
||||
separator=false
|
||||
separator_block_width=12
|
||||
|
||||
[empty]
|
||||
full_text=
|
||||
color=#e16b40
|
||||
separator=false
|
||||
@@ -18,13 +18,12 @@ THRESHOLD2=5
|
||||
acpi_output=$(acpi -b)
|
||||
if [[ -n "$acpi_output" ]] ; then
|
||||
has_battery=1
|
||||
percent="$(echo "$acpi_output" | cut -d "," -f 2 | cut -d " " -f 2 | cut -d "%" -f 1)"
|
||||
percent="$(echo "$acpi_output" | grep -oP '\d+(?=%)')"
|
||||
if [[ $percent == 100 ]] ; then
|
||||
status="Full"
|
||||
else
|
||||
status="$(echo "$acpi_output" | cut -d "," -f 1 | cut -d " " -f 3)"
|
||||
status="$(echo "$acpi_output" | grep -oP '(?<=: )\w+(?=,)' )"
|
||||
fi
|
||||
time="$(echo "$acpi_output" | cut -d "," -f 3 | cut -d " " -f 2)"
|
||||
shortstatus="$(echo $status | cut -c 1)"
|
||||
else
|
||||
has_battery=0
|
||||
@@ -34,19 +33,6 @@ log() {
|
||||
echo [$(date +%FT%T)] "$*" >> $logfile
|
||||
}
|
||||
|
||||
|
||||
pretty() {
|
||||
if (( has_battery )) ; then
|
||||
(
|
||||
echo "Status:|$status"
|
||||
echo "Charge:|${percent}%"
|
||||
if [[ $percent != 100 ]] ; then
|
||||
echo "Time left:|$time"
|
||||
fi
|
||||
) | column -t --separator="|"
|
||||
fi
|
||||
}
|
||||
|
||||
charging() {
|
||||
[[ "$shortstatus" == "C" ]]
|
||||
}
|
||||
@@ -56,14 +42,14 @@ discharging() {
|
||||
}
|
||||
|
||||
threshold1() {
|
||||
[[ $percent -le $THRESHOLD1 ]]
|
||||
(( $percent <= $THRESHOLD1 ))
|
||||
}
|
||||
|
||||
threshold2() {
|
||||
[[ $percent -le $THRESHOLD2 ]]
|
||||
(( $percent <= $THRESHOLD2 ))
|
||||
}
|
||||
|
||||
conky() {
|
||||
short() {
|
||||
if (( has_battery )) ; then
|
||||
if discharging ; then
|
||||
if threshold2 ; then
|
||||
@@ -87,34 +73,27 @@ conky() {
|
||||
rm "$PATH_WARN_1"
|
||||
fi
|
||||
[[ -f "$PATH_WARN_2" ]] && rm "$PATH_WARN_2"
|
||||
#if [[ $percent -gt 25 ]] ; then
|
||||
# [[ -f "$PATH_WARN_1" ]] && rm "$PATH_WARN_1"
|
||||
#elif [[ $percent -gt 5 ]] ; then
|
||||
# [[ -f "$PATH_WARN_2" ]] && rm "$PATH_WARN_2"
|
||||
#fi
|
||||
|
||||
fi
|
||||
|
||||
if threshold2 ; then
|
||||
color="#FF0000" # red
|
||||
urgent=1
|
||||
elif threshold1 ; then
|
||||
color="#FFFF00" # yellow
|
||||
urgent=0
|
||||
else
|
||||
color="#FFFFFF" # white
|
||||
urgent=0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "{ \"full_text\" : \" ${shortstatus} ${percent}% \" , \"color\" : \"$color\" , \"name\" : \"battery\" },"
|
||||
echo "${shortstatus} ${percent}%"
|
||||
echo
|
||||
echo $color
|
||||
(( $urgent )) && exit 33
|
||||
exit 0
|
||||
else
|
||||
echo "{ \"full_text\" : \" no battery \" , \"color\" : \"#FFFFFF\" , \"name\" : \"battery\" },"
|
||||
echo "no battery"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$1" == "conky" ]] ; then
|
||||
conky
|
||||
else
|
||||
pretty
|
||||
fi
|
||||
|
||||
|
||||
short
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# paths to scripts used.
|
||||
path_conkyrc="$1"
|
||||
|
||||
_PIDFILE="$RUNDIR/i3/conky.pid"
|
||||
|
||||
|
||||
# end the header so that i3bar knows we want to use JSON:
|
||||
echo '{ "version" : 1 , "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 "$path_conkyrc" &
|
||||
|
||||
pid=$!
|
||||
|
||||
printf '%s' $pid > "$_PIDFILE"
|
||||
|
||||
wait $pid
|
||||
@@ -1 +1,2 @@
|
||||
kill -USR1 $(cat $RUNDIR/i3/conky.pid)
|
||||
#!/usr/bin/env bash
|
||||
pkill --signal SIGRTMIN+1 i3blocks
|
||||
|
||||
Reference in New Issue
Block a user