my dwmblocks setup
This commit is contained in:
parent
a933ce0d61
commit
1528bb5fc9
@ -1,9 +1,12 @@
|
||||
//Modify this file to change what commands output to your statusbar, and recompile using the make command.
|
||||
static const Block blocks[] = {
|
||||
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
|
||||
{"Mem:", "free -h | awk '/^Mem/ { print $3\"/\"$2 }' | sed s/i//g", 30, 0},
|
||||
|
||||
{"", "date '+%b %d (%a) %I:%M%p'", 5, 0},
|
||||
{ " 🌐 ", "/opt/dwmblocks_scripts/dwm_ipaddr", 30, 0 },
|
||||
{ " 🐧 ", "/opt/dwmblocks_scripts/dwm_kernel", 360, 2 },
|
||||
{ " 💻 ", "/opt/dwmblocks_scripts/dwm_memory", 30, 0 },
|
||||
{ "", "/opt/dwmblocks_scripts/dwm_volume withicon", 1, 10 },
|
||||
{ "", "/opt/dwmblocks_scripts/dwm_battery withicon", 1, 10 },
|
||||
{ "", "date '+%b %d (%a) %I:%M:%S %p'", 1, 0 },
|
||||
};
|
||||
|
||||
//sets delimeter between status commands. NULL character ('\0') means no delimeter.
|
||||
|
23
dwmblocks_scripts/dwm_battery
Executable file
23
dwmblocks_scripts/dwm_battery
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
prct=$(upower -d | grep percentage | sed -n "1p" | sed -e 's/^.* //')
|
||||
prctonly=$(upower -d | grep percentage | sed -n "1p" | sed -e 's/^.* //' | sed 's/%//')
|
||||
stat=$(upower -d | grep -m1 state | sed -e 's/^.* //')
|
||||
|
||||
## if any argument
|
||||
if [ $# -gt 0 ]; then
|
||||
if [[ $stat == "charging" ]]; then
|
||||
echo " ⚡ $prct"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $prctonly -gt 30 ]]; then
|
||||
echo " 🔋 $prct"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo " 🪫 $prct"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo $prct
|
11
dwmblocks_scripts/dwm_ipaddr
Executable file
11
dwmblocks_scripts/dwm_ipaddr
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
eth="$(ip -4 addr show enp8s0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
|
||||
wlp="$(ip -4 addr show wlp7s0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
|
||||
|
||||
if [[ $(echo $eth | wc -c) -gt 1 ]]
|
||||
then
|
||||
echo "$eth"
|
||||
exit;
|
||||
fi
|
||||
|
||||
echo "$wlp"
|
5
dwmblocks_scripts/dwm_kernel
Executable file
5
dwmblocks_scripts/dwm_kernel
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
kern="$(uname -r | sed -re 's/(^[0-9]*\.[0-9]*\.[0-9]*-[0-9]*)(.*)/\1/')"
|
||||
echo -e "$kern "
|
||||
|
5
dwmblocks_scripts/dwm_memory
Executable file
5
dwmblocks_scripts/dwm_memory
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
mem="$(free -h | awk '/^Mem:/ {print $3 "/" $2}')"
|
||||
echo -e "$mem"
|
||||
|
19
dwmblocks_scripts/dwm_volume
Executable file
19
dwmblocks_scripts/dwm_volume
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')"
|
||||
|
||||
## if any argument
|
||||
if [ $# -gt 0 ]; then
|
||||
stat="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)].*/\1/')"
|
||||
if [[ $(echo $stat) == "on" ]]; then
|
||||
echo " 🔊 $vol"
|
||||
exit
|
||||
fi
|
||||
echo " 🔇 $vol"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
## just returns volume %
|
||||
vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')"
|
||||
echo -e "$vol"
|
Loading…
Reference in New Issue
Block a user