-
-
Save tucq88/9e63f65585c48c36f0706ba3eac086ef to your computer and use it in GitHub Desktop.
Revisions
-
tucq88 revised this gist
Oct 17, 2018 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,8 @@ empty_char="▁" # bitbar parameters # use a monospace font if you want the percentages to be right-aligned # bitbar="size=10 color=#ffffff font='Fantasque Sans Mono'" bitbar="" ## See Font Book.app's Fixed Width collection for what you can use ## you can also download this font for free and drag it into Font Book.app. ## https://github.com/belluzj/fantasque-sans/releases/latest @@ -74,16 +75,16 @@ progress() { # output to bitbar # first line # echo "$Y-$m-$d: $(round $d_progress)% | $bitbar size=12" # echo --- # day + progress bar echo "$Y-$m-$d $padding $(round $d_progress)% | $bitbar" echo "$(progress $d_progress) " # | $bitbar" echo --- # month + progress bar echo "$Y-$m $padding $(round $m_progress)% | $bitbar" echo "$(progress $m_progress) " # | $bitbar" echo --- # year + progress bar echo "$Y $padding $(round $Y_progress)% | $bitbar" echo "$(progress $Y_progress) " # | $bitbar" -
aurorabbit renamed this gist
Apr 23, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
aurorabbit revised this gist
Apr 23, 2018 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,16 @@ fill_char="█" empty_char="▁" # bitbar parameters # use a monospace font if you want the percentages to be right-aligned bitbar="size=10 color=#ffffff font='Fantasque Sans Mono'" ## See Font Book.app's Fixed Width collection for what you can use ## you can also download this font for free and drag it into Font Book.app. ## https://github.com/belluzj/fantasque-sans/releases/latest # all of the calculations are done using unix timestamps from date(1) # mac uses bsd's date(1) @@ -62,14 +72,6 @@ progress() { } # output to bitbar # first line echo "$Y-$m-$d: $(round $d_progress)% | $bitbar size=12" -
aurorabbit revised this gist
Apr 23, 2018 . 1 changed file with 9 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,9 +3,11 @@ # don't forget to chmod +x # width and characters for the progress bars # feel free to configure these width=30 fill_char="█" empty_char="▁" # all of the calculations are done using unix timestamps from date(1) @@ -51,8 +53,6 @@ padding=$(printf %$((width-15))s "") round() { printf %.0f "$1"; } # progress bar display function progress() { filled=$(round $(echo "$1 * $width / 100" | bc -l)) empty=$((width - filled)) @@ -69,14 +69,19 @@ progress() { ## https://github.com/belluzj/fantasque-sans/releases/latest bitbar="size=10 color=#ffffff font='Fantasque Sans Mono'" # output to bitbar # first line echo "$Y-$m-$d: $(round $d_progress)% | $bitbar size=12" echo --- # day + progress bar echo "$Y-$m-$d $padding $(round $d_progress)% | $bitbar" echo "$(progress $d_progress) | $bitbar" echo --- # month + progress bar echo "$Y-$m $padding $(round $m_progress)% | $bitbar" echo "$(progress $m_progress) | $bitbar" echo --- # year + progress bar echo "$Y $padding $(round $Y_progress)% | $bitbar" echo "$(progress $Y_progress) | $bitbar" -
aurorabbit revised this gist
Apr 23, 2018 . 1 changed file with 10 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ width=30 # whenever we set a date, make sure to add -j so it doesn't change the clock # we use `date -j %m%d0000 +%s` to get the start timestamp, %Y is implied # then we use `date -jr $start -v +1y/+1m/+1d +%s` to get the ending timestamp # then we calculate the percentage with (now - start) / (end - start) now=$(date +%s) @@ -42,8 +42,8 @@ d_progress=$( # padding to align progress bar and text # Y-m-d = 10 + 2 spaces + 2 digits + percent sign = 15 # progress bar width - 15 = padding padding=$(printf %$((width-15))s "") @@ -56,13 +56,20 @@ empty_char="▁" progress() { filled=$(round $(echo "$1 * $width / 100" | bc -l)) empty=$((width - filled)) # repeat the characters using printf printf "$fill_char%0.s" $(seq $filled) printf "$empty_char%0.s" $(seq $empty) } # bitbar parameters ## if you don't have this font (it's free), use another monospace font ## See Font Book.app's Fixed Width collection for what you can use ## you can also download this font for free and drag it into Font Book.app. ## https://github.com/belluzj/fantasque-sans/releases/latest bitbar="size=10 color=#ffffff font='Fantasque Sans Mono'" # first line echo "$Y-$m-$d: $(round $d_progress)% | $bitbar size=12" echo --- echo "$Y-$m-$d $padding $(round $d_progress)% | $bitbar" -
aurorabbit created this gist
Apr 23, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,75 @@ #!/bin/sh # add this to your bitbar directory # don't forget to chmod +x # width of the progress bars width=30 # all of the calculations are done using unix timestamps from date(1) # mac uses bsd's date(1) # whenever we set a date, make sure to add -j so it doesn't change the clock # we use `date -j %m%d0000 +%s` to get the start timestamp, %Y is implied # then we use `date -jr $start -v +1y/+1m +%s` to get the ending timestamp # then we calculate the percentage with (now - start) / (end - start) now=$(date +%s) Y=$(date +%Y) Y_start=$(date -j 01010000 +%s) Y_end=$(date -jr $Y_start -v +1y +%s) Y_progress=$( echo "($now - $Y_start) * 100 / ($Y_end - $Y_start)" | bc -l ) m=$(date +%m) m_start=$(date -j $(date +%m)010000 +%s) m_end=$(date -jr $m_start -v +1m +%s) m_progress=$( echo "($now - $m_start) * 100 / ($m_end - $m_start)" | bc -l ) d=$(date +%d) d_start=$(date -j $(date +%m%d)0000 +%s) d_end=$(date -jr $d_start -v +1d +%s) d_progress=$( echo "($now - $d_start) * 100 / ($d_end - $d_start)" | bc -l ) # padding to align progress bar and text # Y-m-d = 10 + 2 spaces + 2 digits + percent sign # width-15 padding=$(printf %$((width-15))s "") # round function round() { printf %.0f "$1"; } # progress bar display function fill_char="█" empty_char="▁" progress() { filled=$(round $(echo "$1 * $width / 100" | bc -l)) empty=$((width - filled)) printf "$fill_char%0.s" $(seq $filled) printf "$empty_char%0.s" $(seq $empty) } bitbar="size=10 color=#ffffff font='Fantasque Sans Mono'" echo "$Y-$m-$d: $(round $d_progress)% | $bitbar size=12" echo --- echo "$Y-$m-$d $padding $(round $d_progress)% | $bitbar" echo "$(progress $d_progress) | $bitbar" echo --- echo "$Y-$m $padding $(round $m_progress)% | $bitbar" echo "$(progress $m_progress) | $bitbar" echo --- echo "$Y $padding $(round $Y_progress)% | $bitbar" echo "$(progress $Y_progress) | $bitbar"