+ Tweaking rateUSD script

This commit is contained in:
ziro 2020-05-18 13:56:42 +07:00
parent 1d2c406697
commit db0be00c2a
2 changed files with 31 additions and 4 deletions

View file

@ -104,7 +104,7 @@ font-6 = "Nimbus Sans:bold:size=16;2"
font-7 = "Iosevka Nerd Font:bold:style=solid:size=6;2" font-7 = "Iosevka Nerd Font:bold:style=solid:size=6;2"
font-8 = "Iosevka Nerd Font:bold:style=solid:size=8;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-center = date
modules-right = dividerS disk player-mpris-tail player-mpris mpd volume battery dividerS prompt 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 ; 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 %%{...} ; 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 ; Optional time format
time = %H:%M time = %H:%M
@ -613,11 +613,38 @@ ramp-foreground = ${colors.secondary1L2}
[module/disk] [module/disk]
type = custom/script type = custom/script
exec = ~/.config/polybar/scripts/disk.sh exec = ~/.config/polybar/scripts/disk.sh
interval = 30
tail = true tail = true
label-font = 3 label-font = 3
label-foreground = ${colors.foreground} label-foreground = ${colors.foreground}
format-prefix = "  " format-prefix = "  "
format-prefix-font = "5" 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-foreground = ${colors.spotgreen}
format-background = ${colors.background} format-background = ${colors.background}
format-padding = 1 format-padding = 1

View file

@ -1,4 +1,4 @@
# get rate value from cnbcindonesia.com # 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: # 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" [ -f /tmp/rateUSD.txt ] && sed 's/mark_val/Kurs USD -> IDR:/' /tmp/rateUSD.txt; echo "Sumber: CNBC Indonesia"