Dexscreener MC
This commit is contained in:
@@ -51,7 +51,7 @@ cn ~/coding
|
||||
drk ~/coding/dark-sky
|
||||
ffx ~/linux-config/dot_config/fish/functions
|
||||
hbd ~/.habitctl
|
||||
ib ~/linux-config/dot_config/i3blocks/scripts
|
||||
ib ~/linux-config/dot_config/i3blocks
|
||||
mbd ~/coding/minikube
|
||||
pig ~/coding/pigallery
|
||||
mbk ~/coding/minikube-kompose
|
||||
|
||||
@@ -36,16 +36,17 @@ interval=2
|
||||
|
||||
# volume/spotify [[[ #
|
||||
|
||||
# [spotify]
|
||||
# # command=python ~/linux-config/configs/i3blocks-scripts/spotify.py
|
||||
# # label=
|
||||
# label=
|
||||
[spotify]
|
||||
#command=python ~/linux-config/configs/i3blocks-scripts/spotify.py
|
||||
command=/home/kevin/.config/i3blocks/scripts/spotify
|
||||
# label=
|
||||
label=
|
||||
# # label=🎧
|
||||
# # green
|
||||
# # color=#198c19
|
||||
# # aqua
|
||||
# # color=#2d7272
|
||||
# interval=5
|
||||
interval=5
|
||||
|
||||
# [spotify]
|
||||
# label=
|
||||
|
||||
@@ -65,6 +65,11 @@ label=PIXL
|
||||
command=/home/kevin/.config/i3blocks/scripts/dexscreener ethereum 0x31c0ba10e4e12be6cdceb612e5e829d977532bfc
|
||||
interval=30
|
||||
|
||||
[dexscreener-mc]
|
||||
label=TRUMP
|
||||
command=/home/kevin/.config/i3blocks/scripts/dexscreener-mc solana a8nphpcjqtqhdquk35uj9hy2ysgxfkczgunwvkd3k7vc
|
||||
interval=30
|
||||
|
||||
[kraken]
|
||||
label=ETH
|
||||
#TICKER=ETHUSDC
|
||||
@@ -78,11 +83,11 @@ label=PENGU
|
||||
command=/home/kevin/.config/i3blocks/scripts/dexscreener solana B4Vwozy1FGtp8SELXSXydWSzavPUGnJ77DURV2k4MhUV
|
||||
interval=5
|
||||
|
||||
[kraken]
|
||||
label=AVAX
|
||||
#TICKER=AVAXUSD
|
||||
command=/home/kevin/.config/i3blocks/scripts/kraken AVAXUSD
|
||||
interval=30
|
||||
#[kraken]
|
||||
#label=AVAX
|
||||
##TICKER=AVAXUSD
|
||||
#command=/home/kevin/.config/i3blocks/scripts/kraken AVAXUSD
|
||||
#interval=30
|
||||
|
||||
#[dexscreener]
|
||||
#label=LOCK
|
||||
|
||||
6
dot_config/i3blocks/scripts/executable_dexscreener-mc
Executable file
6
dot_config/i3blocks/scripts/executable_dexscreener-mc
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
. "/home/kevin/.cache/wal/colors.sh"
|
||||
#ticker=$(~/scripts/dexscreener $CHAIN $PAIR)
|
||||
ticker=$(~/scripts/dexscreener-mc $1 $2)
|
||||
printf "%s\n\n%s\n" "$ticker" "$color7"
|
||||
@@ -9,6 +9,8 @@ case "$BLOCK_BUTTON" in
|
||||
esac
|
||||
|
||||
. "/home/kevin/.cache/wal/colors.sh"
|
||||
long_title=$(spotify-now -i "$LONG_NAME" -p '' -e '' | sed 's/&/&/g')
|
||||
short_title=$(spotify-now -i "$SHORT_NAME" -p '' -e '' | sed 's/&/&/g')
|
||||
#long_title=$(spotify-now -i "$LONG_NAME" -p '' -e '' | sed 's/&/&/g')
|
||||
#short_title=$(spotify-now -i "$SHORT_NAME" -p '' -e '' | sed 's/&/&/g')
|
||||
long_title=$(spotify-now)
|
||||
short_title=$(spotify-now)
|
||||
printf "$long_title\n$short_title\n%s\n" "$color7"
|
||||
|
||||
24
scripts/executable_dexscreener-mc
Executable file
24
scripts/executable_dexscreener-mc
Executable file
@@ -0,0 +1,24 @@
|
||||
# /bin/bash
|
||||
|
||||
# curl -s https://api.dexscreener.com/latest/dex/pairs/$1/$2| jq -r '.pairs | .[] | .priceUsd'
|
||||
#raw=$(curl -s "https://api.dexscreener.com/latest/dex/pairs/$1/$2")
|
||||
#price=$(echo "$raw" | jq '.pairs[0].marketCap / 1000000000 | . as $marketCap | "\($marketCap | floor).$(($marketCap * 10 | floor % 10))"')
|
||||
#price=$(echo "$raw" | jq -r '.pairs[0].marketCap / 1000000000 | "\(floor).\( (. * 10 | floor % 10) )B"')
|
||||
#curl -s "https://api.dexscreener.com/latest/dex/pairs/$1/$2" | jq -r '.pairs[0].marketCap / 1000000000 | "\(floor).\( (. * 10 | floor % 10) )"'
|
||||
curl -s "https://api.dexscreener.com/latest/dex/pairs/$1/$2" | jq -r '.pairs[0].marketCap / 1000000000 | "\(floor).\( (. * 10 | floor % 10) )"' | jq -r 'tostring | gsub("\\.";"")'
|
||||
|
||||
# if (( $(echo "$price < .05" | bc -l) )); then
|
||||
# printf "%0.4f\n" "$price" | cut -c 4-
|
||||
# elif (( $(echo "$price < .1" | bc -l) )); then
|
||||
# printf "%0.3f\n" "$price" | cut -c 4-
|
||||
#if (( $(echo "$price < .09" | bc -l) )); then
|
||||
#printf "%0.4f\n" "$price" | cut -c 4-
|
||||
#elif (( $(echo "$price < .1" | bc -l) )); then
|
||||
#printf "%0.3f\n" "$price" | cut -c 4-
|
||||
#elif (( $(echo "$price < 1" | bc -l) )); then
|
||||
#printf "%0.3f\n" "$price" | cut -c 3-
|
||||
#elif (( $(echo "$price < 10" | bc -l) )); then
|
||||
#printf "%0.2f\n" "$price"
|
||||
#fi
|
||||
|
||||
|
||||
34
scripts/executable_spotify-now
Executable file
34
scripts/executable_spotify-now
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import dbus
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
try:
|
||||
bus = dbus.SessionBus()
|
||||
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
|
||||
|
||||
|
||||
if os.environ.get('BLOCK_BUTTON'):
|
||||
control_iface = dbus.Interface(spotify, 'org.mpris.MediaPlayer2.Player')
|
||||
if (os.environ['BLOCK_BUTTON'] == '1'):
|
||||
control_iface.Previous()
|
||||
elif (os.environ['BLOCK_BUTTON'] == '2'):
|
||||
control_iface.PlayPause()
|
||||
elif (os.environ['BLOCK_BUTTON'] == '3'):
|
||||
control_iface.Next()
|
||||
|
||||
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
|
||||
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
|
||||
|
||||
if (sys.version_info > (3, 0)):
|
||||
print(str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']))
|
||||
else:
|
||||
print(props['xesam:artist'][0] + " - " + props['xesam:title']).encode('utf-8')
|
||||
exit
|
||||
except dbus.exceptions.DBusException:
|
||||
exit
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user