From db0be00c2a3ee8d46df7bc5ac18c8b11f60e31a4 Mon Sep 17 00:00:00 2001 From: ziro Date: Mon, 18 May 2020 13:56:42 +0700 Subject: [PATCH] + Tweaking rateUSD script --- .config/polybar/config | 33 ++++++++++++++++++++++++++++++--- .scripts/rateUSD.sh | 2 +- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.config/polybar/config b/.config/polybar/config index c70eefd..aa6e378 100755 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -104,7 +104,7 @@ font-6 = "Nimbus Sans:bold:size=16;2" font-7 = "Iosevka Nerd Font:bold:style=solid:size=6;2" font-8 = "Iosevka Nerd Font:bold:style=solid:size=8;2" ; ---------------------------------------------------------------------------------------- -modules-left = bspwm dividerS wirednetwork temp dividerS +modules-left = bspwm dividerS wirednetwork temp covPos covSem dividerS modules-center = date modules-right = dividerS disk player-mpris-tail player-mpris mpd volume battery dividerS prompt ; ---------------------------------------------------------------------------------------- @@ -322,7 +322,7 @@ interval = 1.0 ; See "http://en.cppreference.com/w/cpp/io/manip/put_time" for details on how to format the date string ; NOTE: if you want to use syntax tags here you need to use %%{...} -date = %A, %d %b %Y +date = %a, %d %b %Y ; Optional time format time = %H:%M @@ -613,10 +613,37 @@ ramp-foreground = ${colors.secondary1L2} [module/disk] type = custom/script exec = ~/.config/polybar/scripts/disk.sh +interval = 30 tail = true label-font = 3 label-foreground = ${colors.foreground} -format-prefix = " " +format-prefix = "  " +format-prefix-font = "5" +format-foreground = ${colors.secondary1} +format-background = ${colors.background} +format-padding = 1 + +[module/covPos] +type = custom/script +exec = ~/.config/polybar/scripts/covPos +interval = 16000 +tail = true +label-font = 3 +label-foreground = ${colors.foreground} +format-prefix = " " +format-prefix-font = "5" +format-foreground = ${colors.alert} +format-background = ${colors.background} +format-padding = 1 + +[module/covSem] +type = custom/script +exec = ~/.config/polybar/scripts/covSem +interval = 16000 +tail = true +label-font = 3 +label-foreground = ${colors.foreground} +format-prefix = " " format-prefix-font = "5" format-foreground = ${colors.spotgreen} format-background = ${colors.background} diff --git a/.scripts/rateUSD.sh b/.scripts/rateUSD.sh index 06e0282..15ba804 100755 --- a/.scripts/rateUSD.sh +++ b/.scripts/rateUSD.sh @@ -1,4 +1,4 @@ # get rate value from cnbcindonesia.com -curl -s "https://www.cnbcindonesia.com/market-data/currencies/IDR=/USD-IDR" | grep -A1 'class="mark_val"' | cut -d'"' -f2 | cut -d'<' -f2 | cut -d'>' -f2 > /tmp/rateUSD.txt +[ ! -f /tmp/rateUSD.txt ] && curl -s "https://www.cnbcindonesia.com/market-data/currencies/IDR=/USD-IDR" | grep -A1 'class="mark_val"' | cut -d'"' -f2 | cut -d'<' -f2 | cut -d'>' -f2 > /tmp/rateUSD.txt # if rateUSD.txt exist then display it while replace mark_val with Kurs USD -> IDR: [ -f /tmp/rateUSD.txt ] && sed 's/mark_val/Kurs USD -> IDR:/' /tmp/rateUSD.txt; echo "Sumber: CNBC Indonesia"