Skip to content

Commit

Permalink
Merge pull request #3 from GopherJ/main
Browse files Browse the repository at this point in the history
KSM Added
  • Loading branch information
Brutuski authored Apr 2, 2021
2 parents 4659a8e + 4759ef2 commit c284256
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 58 deletions.
135 changes: 77 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,51 @@
</p>

### Index
* [Getting Started](#getting-started)
* [Screenshots & Demo](#screenshots)
* [Requirements](#requirements)
* [Installation](#installation)
* [Usage](#usage)
* [Options](#options)
* [Example](#example)
* [Changelog](#changelog)
* [Issues](#issues)
* [License](#license)
* [Logo Credit](#logo-credit)

- [Getting Started](#getting-started)
- [Screenshots & Demo](#screenshots)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Options](#options)
- [Example](#example)
- [Changelog](#changelog)
- [Issues](#issues)
- [License](#license)
- [Logo Credit](#logo-credit)

#### Getting Started

Keep a tarck of crypto currencies right from tmux.
You can choose between the following fiat currencies:
- AUD → A$
- CAD → C$
- CHF → Fr
- DKK → kr
- EUR → €
- GBP → £
- NOK → kr
- SEK → kr
- USD → $

- AUD → A$
- CAD → C$
- CHF → Fr
- DKK → kr
- EUR → €
- GBP → £
- NOK → kr
- SEK → kr
- USD → $

Current supported crypto currencies are:
- Cardano → ADA
- Bitcoin → BTC
- Polkadot → DOT
- Ethereum → ETH
- Chainlink → LINK
- Litecoin → LTC
- Nano → NANO

- Cardano → ADA
- Bitcoin → BTC
- Polkadot → DOT
- Kusama → KSM
- Ethereum → ETH
- Chainlink → LINK
- Litecoin → LTC
- Nano → NANO

The data is fetched from [Kraken's API](https://www.kraken.com/features/api).
For some fiat currencies the data is fetched from [Exchange Rates API](https://github.com/exchangeratesapi/exchangeratesapi).
For more crypto currency requests, drop it [here](https://github.com/Brutuski/tmux-crypto/issues)

#### Screenshots

<p align="center"><img src="https://raw.githubusercontent.com/Brutuski/tmux-crypto/main/assets/demo.gif"><p>
<p align="center"><img src="https://raw.githubusercontent.com/Brutuski/tmux-crypto/main/assets/screenshot1.png"><p>
<p align="center"><img src="https://raw.githubusercontent.com/Brutuski/tmux-crypto/main/assets/screenshot2.png"><p>
Expand All @@ -56,65 +62,78 @@ Terminal and Tmux theme shown here is [Lighthaus](https://github.com/lighthaus-t
_Tmux Lighthaus theme coming soon_

#### Requirements
- [TPM](https://github.com/tmux-plugins/tpm) is the recommended method of installing this plugin
- [curl](https://curl.se/)
- [jq](https://stedolan.github.io/jq/)

- [TPM](https://github.com/tmux-plugins/tpm) is the recommended method of installing this plugin
- [curl](https://curl.se/)
- [jq](https://stedolan.github.io/jq/)

#### Installation

**Recommended method:**
- Add plugin to your [TPM](https://github.com/tmux-plugins/tpm) plugins in your `.tmux.conf`
* ``` vim
set -g @plugin 'Brutuski/tmux-crypto'
```
- While inside a tmux session press `prefix + I` to reload and install the plugin.
- Add the desired _format strings_ to your status as such
* ``` vim
#{eth_eur}
```
- Reload the tmux config and the changes should take effect.

- Add plugin to your [TPM](https://github.com/tmux-plugins/tpm) plugins in your `.tmux.conf`
- ```vim
set -g @plugin 'Brutuski/tmux-crypto'
```
- While inside a tmux session press `prefix + I` to reload and install the plugin.
- Add the desired _format strings_ to your status as such
- ```vim
#{eth_eur}
```
- Reload the tmux config and the changes should take effect.
**Manual Installation:**
- Clone this repo
* ``` vim
git clone https://github.com/Brutuski/tmux-crypto.git ~/.tmux/tmux-crypto
```
- Add the following line to the bottom of your tmux config
* ``` vim
run-shell ~/.tmux/tmux-crypto/crypto.tmux
```
- Save the file and reload your tmux session.
- Clone this repo
- ```vim
git clone https://github.com/Brutuski/tmux-crypto.git ~/.tmux/tmux-crypto
```
- Add the following line to the bottom of your tmux config
- ```vim
run-shell ~/.tmux/tmux-crypto/crypto.tmux
```
- Save the file and reload your tmux session.
#### Usage
- Add the desired _format strings_ to your status as such. All supported format strings listed below in [options](#options)
* ``` vim
#{eth_usd} #{btc_usd}
```
- Reload the tmux config and the changes should take effect.
- Add the desired _format strings_ to your status as such. All supported format strings listed below in [options](#options)
- ```vim
#{eth_usd} #{btc_usd}
```
- Reload the tmux config and the changes should take effect.
#### Options
All available format strings and options can be found in [OPTIONS](https://github.com/Brutuski/tmux-crypto/blob/main/OPTIONS.md).
#### Example
Format strings can be edited to what the user needs.
_fg_ and _bg_ colors can be defined by the user as well.
``` vim
```vim
set -g status-left "......#[fg=#21252D,bg=#5AD1AA] #{eth_eur} | #{ada_eur} "
```

#### Changelog
``` vim

```vim
v1.1.2
```

Changes can be tracked in the [CHANGELOG](https://github.com/Brutuski/tmux-crypto/blob/main/CHANGELOG.md)

#### Issues

Please report any bugs or issues [here](https://github.com/Brutuski/tmux-crypto/issues).

#### License

[MIT](https://github.com/Brutuski/tmux-crypto/blob/main/LICENSE)

_Copyright (c) 2021 Adhiraj Sirohi_
_Copyright (c) 2021 Adhiraj Sirohi_

#### Logo Credit
Logo was made by [Vasundhara Sharma](https://vasdesigns.de/)

Logo was made by [Vasundhara Sharma](https://vasdesigns.de/)
<a href="https://www.behance.net/vasundhsharma" target="blank"><img align="center" src="https://raw.githubusercontent.com/detain/svg-logos/780f25886640cef088af994181646db2f6b1a3f8/svg/behance-1.svg" alt="https://www.behance.net/vasundhsharma" height="40" width="40"/></a> <a href="https://keybase.io/vas_sharma" target="blank"><img align="center" src="https://www.vectorlogo.zone/logos/keybase/keybase-icon.svg" alt="https://keybase.io/vas_sharma" height="40" width="40"/></a>
18 changes: 18 additions & 0 deletions crypto.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ crypto_commands=(
"#($CURRENT_DIR/scripts/dot_gbp.sh)"
"#($CURRENT_DIR/scripts/dot_nok.sh)"
"#($CURRENT_DIR/scripts/dot_sek.sh)"
"#($CURRENT_DIR/scripts/ksm_usd.sh)"
"#($CURRENT_DIR/scripts/ksm_eur.sh)"
"#($CURRENT_DIR/scripts/ksm_aud.sh)"
"#($CURRENT_DIR/scripts/ksm_cad.sh)"
"#($CURRENT_DIR/scripts/ksm_chf.sh)"
"#($CURRENT_DIR/scripts/ksm_dkk.sh)"
"#($CURRENT_DIR/scripts/ksm_gbp.sh)"
"#($CURRENT_DIR/scripts/ksm_nok.sh)"
"#($CURRENT_DIR/scripts/ksm_sek.sh)"
"#($CURRENT_DIR/scripts/eth_usd.sh)"
"#($CURRENT_DIR/scripts/eth_eur.sh)"
"#($CURRENT_DIR/scripts/eth_aud.sh)"
Expand Down Expand Up @@ -97,6 +106,15 @@ crypto_interpolation=(
"\#{dot_gbp}"
"\#{dot_nok}"
"\#{dot_sek}"
"\#{ksm_usd}"
"\#{ksm_eur}"
"\#{ksm_aud}"
"\#{ksm_cad}"
"\#{ksm_chf}"
"\#{ksm_dkk}"
"\#{ksm_gbp}"
"\#{ksm_nok}"
"\#{ksm_sek}"
"\#{eth_usd}"
"\#{eth_eur}"
"\#{eth_aud}"
Expand Down
22 changes: 22 additions & 0 deletions scripts/ksm_aud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"

api_status=$(curl -s https://api.kraken.com/0/public/SystemStatus | jq '.result.status'| sed 's/\"//g')

get_price()
{
price=$(curl -s https://api.kraken.com/0/public/Ticker?pair=KSMAUD | jq '.result.KSMAUD.a[0]' | sed 's/\"//g')

if [[ $api_status == 'online' ]]; then
echo -e "$price" | bc -l | awk '{printf "KSM: A$%.2f", $1}'
elif [[ $api_status == 'offline' ]]; then
echo "API offline"
else
echo "Error, No internet"
fi
}

get_price

26 changes: 26 additions & 0 deletions scripts/ksm_cad.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"

api_status=$(curl -s https://api.kraken.com/0/public/SystemStatus | jq '.result.status'| sed 's/\"//g')

get_price()
{
price=$(curl -s https://api.kraken.com/0/public/Ticker?pair=KSMEUR | jq '.result.KSMEUR.a[0]' | sed 's/\"//g')

cad=$(curl -s https://api.exchangeratesapi.io/latest | jq .'rates'.'CAD')

price_cad=$(echo "$price * $cad" | bc)

if [[ $api_status == 'online' ]]; then
echo -e "$price_cad" | bc -l | awk '{printf "KSM: C$%.2f", $1}'
elif [[ $api_status == 'offline' ]]; then
echo "API offline"
else
echo "Error, No internet"
fi
}

get_price

26 changes: 26 additions & 0 deletions scripts/ksm_chf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"

api_status=$(curl -s https://api.kraken.com/0/public/SystemStatus | jq '.result.status'| sed 's/\"//g')

get_price()
{
price=$(curl -s https://api.kraken.com/0/public/Ticker?pair=KSMEUR | jq '.result.KSMEUR.a[0]' | sed 's/\"//g')

chf=$(curl -s https://api.exchangeratesapi.io/latest | jq .'rates'.'CHF')

price_chf=$(echo "$price * $chf" | bc)

if [[ $api_status == 'online' ]]; then
echo -e "$price_chf" | bc -l | awk '{printf "KSM: %.2fFr", $1}'
elif [[ $api_status == 'offline' ]]; then
echo "API offline"
else
echo "Error, No internet"
fi
}

get_price

26 changes: 26 additions & 0 deletions scripts/ksm_dkk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"

api_status=$(curl -s https://api.kraken.com/0/public/SystemStatus | jq '.result.status'| sed 's/\"//g')

get_price()
{
price=$(curl -s https://api.kraken.com/0/public/Ticker?pair=KSMEUR | jq '.result.KSMEUR.a[0]' | sed 's/\"//g')

dkk=$(curl -s https://api.exchangeratesapi.io/latest | jq .'rates'.'DKK')

price_dkk=$(echo "$price * $dkk" | bc)

if [[ $api_status == 'online' ]]; then
echo -e "$price_dkk" | bc -l | awk '{printf "KSM: %.2fkr", $1}'
elif [[ $api_status == 'offline' ]]; then
echo "API offline"
else
echo "Error, No internet"
fi
}

get_price

22 changes: 22 additions & 0 deletions scripts/ksm_eur.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"

api_status=$(curl -s https://api.kraken.com/0/public/SystemStatus | jq '.result.status'| sed 's/\"//g')

get_price()
{
price=$(curl -s https://api.kraken.com/0/public/Ticker?pair=KSMEUR| jq '.result.KSMEUR.a[0]' | sed 's/\"//g')

if [[ $api_status == 'online' ]]; then
echo -e "$price" | bc -l | awk '{printf "KSM: %.2f€", $1}'
elif [[ $api_status == 'offline' ]]; then
echo "API offline"
else
echo "Error, No internet"
fi
}

get_price

22 changes: 22 additions & 0 deletions scripts/ksm_gbp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"

api_status=$(curl -s https://api.kraken.com/0/public/SystemStatus | jq '.result.status'| sed 's/\"//g')

get_price()
{
price=$(curl -s https://api.kraken.com/0/public/Ticker?pair=KSMGBP | jq '.result.KSMGBP.a[0]' | sed 's/\"//g')

if [[ $api_status == 'online' ]]; then
echo -e "$price" | bc -l | awk '{printf "KSM: £%.2f", $1}'
elif [[ $api_status == 'offline' ]]; then
echo "API offline"
else
echo "Error, No internet"
fi
}

get_price

26 changes: 26 additions & 0 deletions scripts/ksm_nok.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"

api_status=$(curl -s https://api.kraken.com/0/public/SystemStatus | jq '.result.status'| sed 's/\"//g')

get_price()
{
price=$(curl -s https://api.kraken.com/0/public/Ticker?pair=KSMEUR | jq '.result.KSMEUR.a[0]' | sed 's/\"//g')

nok=$(curl -s https://api.exchangeratesapi.io/latest | jq .'rates'.'NOK')

price_nok=$(echo "$price * $nok" | bc)

if [[ $api_status == 'online' ]]; then
echo -e "$price_nok" | bc -l | awk '{printf "KSM: %.2fkr", $1}'
elif [[ $api_status == 'offline' ]]; then
echo "API offline"
else
echo "Error, No internet"
fi
}

get_price

Loading

0 comments on commit c284256

Please sign in to comment.