Browse Source

Dexscreener MC

ubuntu
Kevin Mok 4 days ago
parent
commit
720e104f55
Signed by: Kevin-Mok GPG Key ID: FB0DA56BEB5D98F3
  1. 2
      aliases/key_dirs.tmpl
  2. 11
      dot_config/i3blocks/i3blocks-secondary.conf.tmpl
  3. 15
      dot_config/i3blocks/i3blocks.conf.tmpl
  4. 6
      dot_config/i3blocks/scripts/executable_dexscreener-mc
  5. 6
      dot_config/i3blocks/scripts/executable_spotify
  6. 24
      scripts/executable_dexscreener-mc
  7. 34
      scripts/executable_spotify-now

2
aliases/key_dirs.tmpl

@ -51,7 +51,7 @@ cn ~/coding
drk ~/coding/dark-sky drk ~/coding/dark-sky
ffx ~/linux-config/dot_config/fish/functions ffx ~/linux-config/dot_config/fish/functions
hbd ~/.habitctl hbd ~/.habitctl
ib ~/linux-config/dot_config/i3blocks/scripts
ib ~/linux-config/dot_config/i3blocks
mbd ~/coding/minikube mbd ~/coding/minikube
pig ~/coding/pigallery pig ~/coding/pigallery
mbk ~/coding/minikube-kompose mbk ~/coding/minikube-kompose

11
dot_config/i3blocks/i3blocks-secondary.conf.tmpl

@ -36,16 +36,17 @@ interval=2
# volume/spotify [[[ # # 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=🎧 # # label=🎧
# # green # # green
# # color=#198c19 # # color=#198c19
# # aqua # # aqua
# # color=#2d7272 # # color=#2d7272
# interval=5
interval=5
# [spotify] # [spotify]
# label= # label=

15
dot_config/i3blocks/i3blocks.conf.tmpl

@ -65,6 +65,11 @@ label=PIXL
command=/home/kevin/.config/i3blocks/scripts/dexscreener ethereum 0x31c0ba10e4e12be6cdceb612e5e829d977532bfc command=/home/kevin/.config/i3blocks/scripts/dexscreener ethereum 0x31c0ba10e4e12be6cdceb612e5e829d977532bfc
interval=30 interval=30
[dexscreener-mc]
label=TRUMP
command=/home/kevin/.config/i3blocks/scripts/dexscreener-mc solana a8nphpcjqtqhdquk35uj9hy2ysgxfkczgunwvkd3k7vc
interval=30
[kraken] [kraken]
label=ETH label=ETH
#TICKER=ETHUSDC #TICKER=ETHUSDC
@ -78,11 +83,11 @@ label=PENGU
command=/home/kevin/.config/i3blocks/scripts/dexscreener solana B4Vwozy1FGtp8SELXSXydWSzavPUGnJ77DURV2k4MhUV command=/home/kevin/.config/i3blocks/scripts/dexscreener solana B4Vwozy1FGtp8SELXSXydWSzavPUGnJ77DURV2k4MhUV
interval=5 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] #[dexscreener]
#label=LOCK #label=LOCK

6
dot_config/i3blocks/scripts/executable_dexscreener-mc

@ -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"

6
dot_config/i3blocks/scripts/executable_spotify

@ -9,6 +9,8 @@ case "$BLOCK_BUTTON" in
esac esac
. "/home/kevin/.cache/wal/colors.sh" . "/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" printf "$long_title\n$short_title\n%s\n" "$color7"

24
scripts/executable_dexscreener-mc

@ -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

@ -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
Loading…
Cancel
Save