Several fixes, patched dwmblocks so it shows spaces around the bar
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
# Custom blocks file
|
# Custom blocks file
|
||||||
blocks.h
|
#blocks.h
|
||||||
|
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
12
blocks.def.h
12
blocks.def.h
@@ -1,14 +1,12 @@
|
|||||||
//Modify this file to change what commands output to your statusbar, and recompile using the make command.
|
//Modify this file to change what commands output to your statusbar, and recompile using the make command.
|
||||||
static const Block blocks[] = {
|
static const Block blocks[] = {
|
||||||
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
|
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
|
||||||
{ " SSID ", "/opt/dwmblocks_scripts/dwm_ssid", 1, 0 },
|
{"Mem:", "free -h | awk '/^Mem/ { print $3\"/\"$2 }' | sed s/i//g", 30, 0},
|
||||||
{ "NET ", "/opt/dwmblocks_scripts/dwm_ipaddr", 1, 0 },
|
|
||||||
{ "MEM ", "/opt/dwmblocks_scripts/dwm_memory", 30, 0 },
|
{"", "date '+%b %d (%a) %I:%M%p'", 5, 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.
|
//sets delimiter between status commands. NULL character ('\0') means no delimiter.
|
||||||
static char delim[] = " | ";
|
static char delim[] = " | ";
|
||||||
static unsigned int delimLen = 5;
|
static unsigned int delimLen = 5;
|
||||||
|
|
||||||
|
14
blocks.h
Normal file
14
blocks.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
//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*/
|
||||||
|
{ "", "/opt/dwmblocks_scripts/dwm_ssid withicon", 1, 0 },
|
||||||
|
{ "NET ", "/opt/dwmblocks_scripts/dwm_ipaddr", 1, 0 },
|
||||||
|
{ "MEM ", "/opt/dwmblocks_scripts/dwm_memory", 10, 0 },
|
||||||
|
{ "", "/opt/dwmblocks_scripts/dwm_volume withicon", 1, 10 },
|
||||||
|
{ "", "/opt/dwmblocks_scripts/dwm_battery withicon", 1, 10 },
|
||||||
|
{ "", "/opt/dwmblocks_scripts/dwm_date", 1, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
//sets delimeter between status commands. NULL character ('\0') means no delimeter.
|
||||||
|
static char delim[] = " | ";
|
||||||
|
static unsigned int delimLen = 5;
|
@@ -130,7 +130,11 @@ void setroot()
|
|||||||
{
|
{
|
||||||
if (!getstatus(statusstr[0], statusstr[1])) // Only set root if text has changed.
|
if (!getstatus(statusstr[0], statusstr[1])) // Only set root if text has changed.
|
||||||
return;
|
return;
|
||||||
XStoreName(dpy, root, statusstr[0]);
|
|
||||||
|
char outstr[STATUSLENGTH + 4];
|
||||||
|
snprintf(outstr, sizeof(outstr), " %s ", statusstr[0]);
|
||||||
|
|
||||||
|
XStoreName(dpy, root, outstr);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,6 +155,7 @@ void pstdout()
|
|||||||
{
|
{
|
||||||
if (!getstatus(statusstr[0], statusstr[1])) // Only write out if text has changed.
|
if (!getstatus(statusstr[0], statusstr[1])) // Only write out if text has changed.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf(" %s \n", statusstr[0]);
|
printf(" %s \n", statusstr[0]);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
6
dwmblocks_scripts/battery_notify
Executable file
6
dwmblocks_scripts/battery_notify
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PRCT=$(acpi | awk -F, '{ print $2 }' | sed 's/%//g' | xargs)
|
||||||
|
if [[ $PRCT -lt 20 ]]; then
|
||||||
|
notify-send -u critical "Battery level is CRITICAL!" "$PRCT"
|
||||||
|
fi
|
@@ -1,7 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
prct=$(acpi | grep 'Discharging' | awk '{print $4}' | sed 's/,//')
|
prct=$(acpi 2>/dev/null | grep 'Discharging' | awk '{print $4}' | sed 's/,//')
|
||||||
batid=$(acpi | grep 'Discharging' | awk '{print $2}' | sed 's/://')
|
batid=$(acpi 2>/dev/null | grep 'Discharging' | awk '{print $2}' | sed 's/://')
|
||||||
|
|
||||||
|
# If not supported
|
||||||
|
if [[ $(acpi 2>&1 | grep 'No support') ]]; then
|
||||||
|
echo "No battery" >&2;
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# If charged
|
# If charged
|
||||||
if [[ $(acpi | grep 'Discharging' | wc -c) -eq $(acpi | grep 'Charging' | wc -c) ]]; then
|
if [[ $(acpi | grep 'Discharging' | wc -c) -eq $(acpi | grep 'Charging' | wc -c) ]]; then
|
||||||
|
4
dwmblocks_scripts/dwm_date
Executable file
4
dwmblocks_scripts/dwm_date
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DATE=$(date '+%b %d (%a) %I:%M:%S %p')
|
||||||
|
echo "$DATE"
|
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
eth="$(ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
|
eth="$(ip -4 addr show eth0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
|
||||||
wlp="$(ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
|
wlp="$(ip -4 addr show wlan0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
|
||||||
|
|
||||||
if [[ $(echo $eth | wc -c) -gt 1 ]]
|
if [[ $(echo $eth | wc -c) -gt 1 ]]
|
||||||
then
|
then
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# This works just with wpa_supplicant
|
||||||
|
|
||||||
ssid="$(wpa_cli status | grep ssid | sed -n '2p' | awk -F '=' '{print $2}')"
|
ssid="$(wpa_cli status 2>/dev/null | grep ssid | sed -n '2p' | awk -F '=' '{print $2}')"
|
||||||
|
|
||||||
if [[ $(echo $ssid | wc -c) -gt 1 ]]
|
if [[ $(echo $ssid | wc -c) -gt 1 ]]
|
||||||
then
|
then
|
||||||
echo "$ssid"
|
echo "SSID $ssid"
|
||||||
exit;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo "No SSID available" >&2
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
33
patches/space-padding.patch
Normal file
33
patches/space-padding.patch
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
diff --git a/dwmblocks.c b/dwmblocks.c
|
||||||
|
index 3f7a1c2..f7a7c2e 100644
|
||||||
|
--- a/dwmblocks.c
|
||||||
|
+++ b/dwmblocks.c
|
||||||
|
@@ -165,10 +165,15 @@ void setroot()
|
||||||
|
{
|
||||||
|
- if (!getstatus(statusstr[0], statusstr[1]))//Only set root if text has changed.
|
||||||
|
- return;
|
||||||
|
- XStoreName(dpy, root, statusstr[0]);
|
||||||
|
- XFlush(dpy);
|
||||||
|
+ if (!getstatus(statusstr[0], statusstr[1])) // Only set root if text has changed.
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ char outstr[STATUSLENGTH + 4];
|
||||||
|
+ snprintf(outstr, sizeof(outstr), " %s ", statusstr[0]);
|
||||||
|
+
|
||||||
|
+ XStoreName(dpy, root, outstr);
|
||||||
|
+ XFlush(dpy);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setupX()
|
||||||
|
@@ -187,9 +192,13 @@ void pstdout()
|
||||||
|
{
|
||||||
|
- if (!getstatus(statusstr[0], statusstr[1]))//Only write out if text has changed.
|
||||||
|
- return;
|
||||||
|
- printf("%s\n",statusstr[0]);
|
||||||
|
- fflush(stdout);
|
||||||
|
+ if (!getstatus(statusstr[0], statusstr[1])) // Only write out if text has changed.
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ printf(" %s \n", statusstr[0]);
|
||||||
|
+ fflush(stdout);
|
||||||
|
}
|
Reference in New Issue
Block a user