Add qr script, crypto bar module and fix linkhandler

This commit is contained in:
Wiktor Zykubek 2020-07-28 21:47:55 +02:00
parent b666132530
commit 838bc6ee1f
4 changed files with 69 additions and 2 deletions

View File

@ -0,0 +1,56 @@
#!/usr/bin/env python3
import subprocess
import json
def __LBC():
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)
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()

11
.local/bin/scripts/qr Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# Generate QR code from text. Useful for crypto wallet addresses.
m() { rofi -dmenu -p "QR" -i ;}
input="$(m)"
qrencode "$input" -o /tmp/qr -s 7 && sxiv -b /tmp/qr
rm /tmp/qr

View File

@ -2,4 +2,4 @@
# Run RSS Feeder.
st -e "newsboat"
/bin/sh -c "LANG=en_US.UTF-8 st -e \"newsboat\""

View File

@ -1,4 +1,4 @@
[Desktop Entry]
Type=Application
Name=Torrent
Name=Link Handler
Exec=/home/samedamci/.local/bin/scripts/linkhandler %u