Created
February 10, 2018 01:25
-
-
Save TRSGuy/fa24af2a198272b0b2393be6e10d2fdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
color() { | |
echo -n "%{F#222}" | |
} | |
nocolor() { | |
echo -n "%{F#000}" | |
} | |
host_is_up() { | |
if ping -c 1 $1 &> /dev/null | |
then | |
echo -n "%{F#FFF}${2^^}%{F#000}" | |
else | |
echo -n "%{F#222}${2^^}%{F#000}" | |
fi | |
} | |
clock() { | |
DATETIME=$(date "+%a %b %d %T") | |
echo -n "%{r}$DATETIME" | |
} | |
song() { | |
SPOT_SONG=$(python /home/vorap/Scripts/get_now_playing_spotify_linux.py) | |
echo -n $SPOT_SONG | |
} | |
battery() { | |
echo $(acpi | awk '{print(substr($3, 1, 1))}')$(acpi | awk '{print(substr($4, 1, length($4)-2))}') | |
} | |
while true; do | |
echo "%{F#000}%{B#90999999} \ | |
$(python /home/vorap/Scripts/get_workspace.py) | \ | |
$(color)$(song)$(nocolor) | \ | |
$(color)$(ip address | grep -v "inet6" | grep "global" | awk '{print $2}' | awk -F "/" '{print $1}')$(nocolor) | \ | |
$(host_is_up voraschem.tk V) | \ | |
$(color)$(clock)$(nocolor) | \ | |
$(color)$(battery)$(nocolor) " | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import sys
import json
import os
js = os.popen("i3-msg -t get_workspaces").read()
j = json.loads(js)
s = []
s.append("%{l}")
for i in j:
if(i["focused"]):
s.append("%{F#FFF} " + str(i["num"]) + "%{F#000}")
else:
s.append("%{F#000} " + str(i["num"]))
s.append("%{c}")
print("".join(s))