----- Changes: lfrc, polybar, rateUSD
+ Rework lfrc + Integrated rateUSD to Polybar + Added lang option
This commit is contained in:
parent
1b9fe5b22f
commit
8622acb8d9
3 changed files with 21 additions and 6 deletions
|
@ -21,7 +21,7 @@ cmd open ${{
|
|||
esac
|
||||
}}
|
||||
|
||||
cmd open_with ${{ [ -z "$1" ] && echo "$f" || $1 "$f" }}
|
||||
cmd open_with $[ -z "$1" ] && echo "$f" || $1 "$f"
|
||||
|
||||
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')"
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ font-8 = "Iosevka Nerd Font:bold:style=solid:size=8;2"
|
|||
; ----------------------------------------------------------------------------------------
|
||||
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
|
||||
modules-right = dividerS currency disk player-mpris-tail player-mpris mpd volume battery dividerS prompt
|
||||
; ----------------------------------------------------------------------------------------
|
||||
|
||||
tray-detached = false
|
||||
|
@ -648,3 +648,17 @@ format-prefix-font = "5"
|
|||
format-foreground = ${colors.spotgreen}
|
||||
format-background = ${colors.background}
|
||||
format-padding = 1
|
||||
|
||||
[module/currency]
|
||||
type = custom/script
|
||||
exec = "rateUSD -"
|
||||
interval = 16000
|
||||
tail = true
|
||||
label = "$1 = Rp.%output%"
|
||||
label-font = 3
|
||||
label-foreground = ${colors.foreground}
|
||||
format-prefix = " "
|
||||
format-prefix-font = "5"
|
||||
format-foreground = ${colors.spotgreen}
|
||||
format-background = ${colors.background}
|
||||
format-padding = 1
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#!/bin/sh
|
||||
# get rate value from cnbcindonesia.com
|
||||
[ ! "$(stat -c %y ~/.cache/rateUSD.txt 2> /dev/null | cut -d' ' -f1)" = "$(date "+Y-%m-%d")" ] &&
|
||||
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 > ~/.cache/rateUSD.txt
|
||||
|
||||
[ ! "$(stat -c %y ~/.cache/rateUSD.txt 2> /dev/null | cut -d' ' -f1)" = "$(date "+Y-%m-%d")" ] && 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 > ~/.cache/rateUSD.txt
|
||||
enUS='Rate'
|
||||
idID='Kurs'
|
||||
lang=$idID
|
||||
# display rateUSD.txt while replace mark_val with Kurs USD -> IDR:
|
||||
sed 's/mark_val/Kurs USD -> IDR:/' ~/.cache/rateUSD.txt; echo "Sumber: CNBC Indonesia"
|
||||
[ -z $1 ] && sed "s/mark_val/$lang USD -> IDR:/;2 s/^/Rp./" ~/.cache/rateUSD.txt && echo "Sumber: CNBC Indonesia" || grep -A1 "mark" ~/.cache/rateUSD.txt | grep -v "mark"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue