Update statusbar scripts
This commit is contained in:
parent
32638c5030
commit
c57bbb9c94
@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
import json
|
||||
|
||||
|
||||
def __LBC():
|
||||
try:
|
||||
data = subprocess.run(
|
||||
["lbrynet", "account", "list"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
if data.stderr != b"":
|
||||
return None
|
||||
data = json.loads(data.stdout)
|
||||
balance: float = 0
|
||||
for i in range(len(data["items"])):
|
||||
d = data["items"][i]["coins"]
|
||||
balance += float(d)
|
||||
return round(balance, 1)
|
||||
except json.decoder.JSONDecodeError:
|
||||
return None
|
||||
|
||||
|
||||
def __DOGE():
|
||||
try:
|
||||
data = subprocess.run(
|
||||
["dogecoin-cli", "getbalance"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
if data.stderr != b"":
|
||||
return None
|
||||
balance = json.loads(data.stdout)
|
||||
return round(balance, 1)
|
||||
except json.decoder.JSONDecodeError:
|
||||
return None
|
||||
|
||||
|
||||
def __BTC():
|
||||
try:
|
||||
data = subprocess.run(
|
||||
["bitcoin-cli", "getbalance"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
if data.stderr != b"":
|
||||
return None
|
||||
balance = json.loads(data.stdout)
|
||||
return round(balance, 1)
|
||||
except json.decoder.JSONDecodeError:
|
||||
return None
|
||||
|
||||
|
||||
def main():
|
||||
print(f" LBC: {__LBC()}, DOGE: {__DOGE()}, BTC: {__BTC()}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$(cat /etc/hostname)" = "pc" ]; then
|
||||
ip="$(eth-ip)"
|
||||
echo ""
|
||||
elif [ "$(cat /etc/hostname)" = "laptop" ]; then
|
||||
ip="$(wifi-ip)"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
ping -q -c 1 1.1.1.1 >/dev/null || { echo "dis" && exit 1; }
|
||||
|
||||
echo "$ip"
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
status=$(curl -s 192.168.1.201/status.php)
|
||||
|
||||
echo ""
|
||||
[ "$status" = 1 ] && echo "" || echo ""
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
icon="$(cat "/tmp/newsupdate" 2>/dev/null)"
|
||||
|
||||
unread="$(cat "$HOME/.cache/news_unread" 2>/dev/null)"
|
||||
|
||||
printf ""
|
||||
[ "$unread" ] && printf " %s" "$unread"
|
||||
echo "$icon"
|
@ -13,11 +13,11 @@ v2=""
|
||||
v3=""
|
||||
|
||||
if [ "$revel" -lt 35 ]; then
|
||||
echo "$v1"
|
||||
printf "$v1 "
|
||||
elif [ "$revel" -lt 60 ]; then
|
||||
echo "$v2"
|
||||
printf "$v2 "
|
||||
elif [ "$revel" -lt 100 ]; then
|
||||
echo "$v3"
|
||||
printf "$v3 "
|
||||
fi
|
||||
|
||||
echo "$level"
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
echo ""
|
||||
date "+%H:%M"
|
@ -1,4 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo ""
|
||||
date "+%a, %d-%m"
|
@ -7,5 +7,4 @@ used() {
|
||||
root="$(used /)"
|
||||
home="$(used /home)"
|
||||
|
||||
echo ""
|
||||
echo "/ $root, $home"
|
5
.local/bin/scripts/statusbar/sb-internet
Executable file
5
.local/bin/scripts/statusbar/sb-internet
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
ping -q -c 1 1.1.1.1 >/dev/null || { echo "dis" && exit 1; }
|
||||
|
||||
eth-ip
|
62
.local/bin/scripts/statusbar/sb-minexmr
Executable file
62
.local/bin/scripts/statusbar/sb-minexmr
Executable file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
API = "https://beta.minexmr.com/api"
|
||||
|
||||
|
||||
class ctx(object):
|
||||
addr = "47XzeAyPKPBevVHZucf8vYZjZqtf7322hRP3VrwQf3cnP9HvLf9Qh12H9sZxcA7BnHBmnmJVvH13rjH5Ggadysji162m4do"
|
||||
|
||||
|
||||
def get_balance():
|
||||
resp = requests.get(f"{API}/main/user/stats?address={ctx.addr}")
|
||||
bal = int(json.loads(resp.text)["balance"]) * 0.000000000001
|
||||
return round(bal, 6)
|
||||
|
||||
|
||||
def get_PLN():
|
||||
price = json.loads(
|
||||
requests.get(
|
||||
"https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=pln"
|
||||
).text
|
||||
)["monero"]["pln"]
|
||||
|
||||
return round(price * get_balance(), 2)
|
||||
|
||||
|
||||
def get_workers():
|
||||
resp = requests.get(f"{API}/main/user/workers?address={ctx.addr}")
|
||||
data = json.loads(resp.text)
|
||||
workers = []
|
||||
for i in data:
|
||||
if i["hashrate"] > 0:
|
||||
workers.append([i["name"], i["hashrate"]])
|
||||
return workers
|
||||
|
||||
|
||||
def get_hashrate(worker: str = False) -> int:
|
||||
workers = get_workers()
|
||||
if worker:
|
||||
for i in workers:
|
||||
if i[0] == worker:
|
||||
return int(i[1])
|
||||
return None
|
||||
else:
|
||||
sum_ = 0
|
||||
for i in workers:
|
||||
sum_ += int(i[1])
|
||||
return sum_ # h/s
|
||||
|
||||
|
||||
def main():
|
||||
bal = get_balance()
|
||||
pln = get_PLN()
|
||||
hashrate = get_hashrate()
|
||||
workers = len(get_workers())
|
||||
print(f"{bal} XMR ({pln} PLN), HR: {hashrate} h/s, {workers}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,11 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if playerctl metadata --format={{playerName}} | grep -q "spotifyd"; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# if mpc status | grep -q "playing"; then
|
||||
# mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[playing\\].*//g"
|
||||
# elif mpc status | grep -q "paused"; then
|
||||
@ -14,9 +8,9 @@ fi
|
||||
# echo ""
|
||||
# fi
|
||||
|
||||
if playerctl --player=spotifyd status | grep -q "Playing"; then
|
||||
if playerctl --player=spotify status | grep -q "Playing"; then
|
||||
playerctl metadata --format "{{ artist }} - {{ title }}"
|
||||
elif playerctl --player=spotifyd status | grep -q "Paused"; then
|
||||
elif playerctl --player=spotify status | grep -q "Paused"; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
icon="$(cat /tmp/packagesupdate 2>/dev/null)"
|
||||
echo " $(pacman -Qu | wc -l)$icon"
|
||||
echo "$(pacman -Qu | wc -l)$icon"
|
Loading…
x
Reference in New Issue
Block a user