Add xmobar to home-manager

This commit is contained in:
2022-04-03 16:15:09 +02:00
parent af5958d553
commit 003e91e8d6
6 changed files with 230 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
MPD_STATUS=$(mpc 2>/dev/null | sed -n '2{p;q}' | cut -d ' ' -f1)
case "$MPD_STATUS" in
"[playing]")
echo "<fn=2><fc=#00ff00>▶</fc></fn>"
# echo "[<fn=2><fc=#00ff00>行</fc></fn>]"
exit 0
;;
"[paused]")
echo "<fn=2><fc=#ff0000>⏸</fc></fn>"
# echo "[<fn=1><fc=#ff0000>止</fc></fn>]"
exit 0
;;
*)
echo "<fn=2><fc=#AA0000>⏼</fc></fn>"
# echo "[<fn=1><fc=#AA0000>無</fc></fn>]"
exit 0
;;
esac

View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python
import subprocess
USE_SYMBOLS = True
VOLUME_COMMAND = 'amixer get Master'.split(' ')
VOLUME_SYMBOLS = {
"0": "𝒫", # "∅"
"10": "",
"20": "=",
"30": "",
"40": "",
"50": "",
"60": "",
"70": "",
"80": "",
"90": "",
"100": "",
}
def get_volume():
volumeData = subprocess \
.check_output(VOLUME_COMMAND) \
.decode() \
.split('\n')[5] \
.strip() \
.split(' ')
volume_level = int(volumeData[-2][1:-2])
if USE_SYMBOLS:
volume = VOLUME_SYMBOLS[str((volume_level // 10) * 10)]
if volumeData[-1] == '[off]':
volume = 'Ψ'
else:
volume = f'{volume_level}%'
if volumeData[-1] == '[off]':
volume = 'M'
return volume
if __name__ == '__main__':
print(get_volume())

View File

@@ -0,0 +1,33 @@
#!/bin/sh
NETWORK_CARD=$(ip -br link | grep UP | grep -v lo | head -n 1 | awk '{print $1}')
iwconfig $NETWORK_CARD 2>&1 | grep -q no\ wireless\ extensions\. && {
echo wired
exit 0
}
essid=`iwconfig $NETWORK_CARD | awk -F '"' '/ESSID/ {print $2}'`
stngth=`iwconfig $NETWORK_CARD | awk -F '=' '/Quality/ {print $2}' | cut -d '/' -f 1`
bars=`expr $stngth / 20`
case $bars in
# 0) bar='[-----]' ;;
# 1) bar='[/----]' ;;
# 2) bar='[//---]' ;;
# 3) bar='[///--]' ;;
# 4) bar='[////-]' ;;
# 5) bar='[/////]' ;;
# *) bar='[--!--]' ;;
0) bar='[<fn=1></fn>]' ;;
1) bar='[<fn=1>壱</fn>]' ;;
2) bar='[<fn=1>弐</fn>]' ;;
3) bar='[<fn=1>参</fn>]' ;;
4) bar='[<fn=1>肆</fn>]' ;;
5) bar='[<fn=1>伍</fn>]' ;;
*) bar='[<fn=1>無</fn>]' ;;
esac
echo "$essid $bar"
exit 0