Material Icons.

This commit is contained in:
Bartek Stalewski 2021-07-26 15:56:06 +02:00
parent 9e0d48b35f
commit 4508f38520
13 changed files with 121 additions and 117 deletions

View File

@ -1,19 +1,17 @@
#!/bin/sh
#!/bin/bash
for battery in /sys/class/power_supply/BAT?*; do
# If non-first battery, print a space separator.
[ -n "${capacity+x}" ] && printf " "
# Sets up the status and capacity
case "$(cat "$battery/status")" in
"Full") status="" ;;
"Discharging") status="🔋" ;;
"Charging") status="🔌" ;;
"Not charging") status="🛑" ;;
"Unknown") status="♻️" ;;
"Full") status="\uea0b" ;;
"Discharging") status="\ue1a5" ;;
"Charging") status="\ue63c" ;;
"Not charging") status="\ue1a6" ;;
"Unknown") status="\ue1a3" ;;
esac
capacity=$(cat "$battery/capacity")
# Will make a warn variable if discharging and low
[ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
# Prints the info
printf "%s %s%d%%" "$status" "$warn" "$capacity"; unset warn
[ "$capacity" -le 20 ] && printf "\ue19c ^c#161616^^b#fd4285^${capacity}%%^d^" || printf "${status} ${capacity}%%"
done && exit 0

View File

@ -1,10 +1,8 @@
#!/bin/sh
#!/bin/bash
if [ "$1" != "mic" ]; then
vol="$(pamixer --get-volume)"
[ $(echo $vol | wc -c) -lt 4 ] && svol=" ${vol}%" || svol="${vol}%"
[ $(pamixer --get-mute) = true ] && echo "🔇 ^c#161616^^b#fd4285^mute^d^" || echo "🔊 ${svol}"
else
device=$(pamixer --list-sources | awk '/Raven/ {print $1}')
[ $(pamixer --source $device --get-mute) = true ] && echo "^c#161616^^b#fd4285^MM^d^" || echo "on"
fi
vol="$(pamixer --get-volume)"
[ $(echo $vol | wc -c) -lt 4 ] && svol=" ${vol}%%" || svol="${vol}%%"
[ $(pamixer --get-mute) = true ] && volinfo="\ue04f ^c#161616^^b#fd4285^mute^d^" || volinfo="\ue050 ${svol}"
device=$(pamixer --list-sources | awk '/Raven/ {print $1}')
[ $(pamixer --source $device --get-mute) = true ] && micinfo="\ue02b ^c#161616^^b#fd4285^MM^d^" || micinfo="\ue02a on"
printf "${volinfo} (${micinfo})"

View File

@ -139,7 +139,6 @@ static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },

View File

@ -13,7 +13,7 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display
static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "JetBrainsMono Nerd Font Mono:style=Medium:pixelsize=14", "JoyPixels:pixelsize=12" };
static const char *fonts[] = { "JetBrainsMono Nerd Font Mono:style=Medium:size=10", "Material Icons:size=12" };
static const char normfgcolor[] = "#bbbbbb";
static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444";
@ -39,7 +39,7 @@ static Sp scratchpads[] = {
};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "work" };
static const char *tags[] = {"\ue9ef", "\ue894", "\ue0c9", "\ue0e1", "\ue3fe", "\ue3ff", "\ue943", "\uea67" };
static const Rule rules[] = {
/* xprop(1):
@ -54,7 +54,7 @@ static const Rule rules[] = {
{ "Thunderbird", NULL, NULL, 1 << 3, 0, 0, 0, -1 },
{ "Wfica", NULL, NULL, 1 << 9, 0, 0, 0, -1 },
{ "Pavucontrol", NULL, NULL, 0, 1, 0, 0, -1 },
{ NULL, NULL, "Citrix Workspace", 1 << 8, 0, 0, 0, -1 },
{ NULL, NULL, "Citrix Workspace", 1 << 6, 0, 0, 0, -1 },
{ NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
{ NULL, "spterm", NULL, SPTAG(0), 1, 1, 0, -1 },
{ NULL, "spfile", NULL, SPTAG(1), 1, 1, 0, -1 },

View File

@ -94,8 +94,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
ClkRootWin, ClkLast }; /* clicks */
typedef union {
int i;
@ -554,7 +554,7 @@ unswallow(Client *c)
void
buttonpress(XEvent *e)
{
unsigned int i, x, click, occ = 0;
unsigned int i, x, click;
Arg arg = {0};
Client *c;
Monitor *m;
@ -569,23 +569,16 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
for (c = m->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
do {
/* do not reserve space for vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
do
x += TEXTW(tags[i]);
} while (ev->x >= x && ++i < LENGTH(tags));
while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth())
click = ClkStatusText;
else
click = ClkWinTitle;
click = ClkStatusText;
} else if ((c = wintoclient(ev->window))) {
focus(c);
restack(selmon);
@ -1010,11 +1003,12 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
void
drawbar(Monitor *m)
{
int x, w, tw = 0, stw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
Client *c;
int x, w, tw = 0, stw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
Client *c;
if(showsystray && m == systraytomon(m) && !systrayonleft)
stw = getsystraywidth();
@ -1026,19 +1020,19 @@ drawbar(Monitor *m)
resizebarwin(m);
for (c = m->clients; c; c = c->next) {
occ |= c->tags == 255 ? 0 : c->tags;
occ |= c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
/* do not draw vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
urg & 1 << i);
x += w;
}
w = blw = TEXTW(m->ltsymbol);
@ -1046,15 +1040,8 @@ drawbar(Monitor *m)
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
if ((w = m->ww - tw - stw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
}
}
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
}
@ -1604,11 +1591,8 @@ propertynotify(XEvent *e)
drawbars();
break;
}
if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
updatetitle(c);
if (c == c->mon->sel)
drawbar(c->mon);
}
if (ev->atom == netatom[NetWMWindowType])
updatewindowtype(c);
}

View File

@ -1,55 +0,0 @@
diff --git a/dwm.c b/dwm.c
index 4465af1..c4aa3de 100644
--- a/dwm.c
+++ b/dwm.c
@@ -416,7 +416,7 @@ attachstack(Client *c)
void
buttonpress(XEvent *e)
{
- unsigned int i, x, click;
+ unsigned int i, x, click, occ = 0;
Arg arg = {0};
Client *c;
Monitor *m;
@@ -431,9 +431,14 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
- do
+ for (c = m->clients; c; c = c->next)
+ occ |= c->tags == 255 ? 0 : c->tags;
+ do {
+ /* do not reserve space for vacant tags */
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
x += TEXTW(tags[i]);
- while (ev->x >= x && ++i < LENGTH(tags));
+ } while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -709,19 +714,19 @@ drawbar(Monitor *m)
}
for (c = m->clients; c; c = c->next) {
- occ |= c->tags;
+ occ |= c->tags == 255 ? 0 : c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
+ /* do not draw vacant tags */
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
+
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
- if (occ & 1 << i)
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- urg & 1 << i);
x += w;
}
w = blw = TEXTW(m->ltsymbol);

View File

@ -0,0 +1,81 @@
From 969dbbc548f16da5d94630e3d54e9c96c5296520 Mon Sep 17 00:00:00 2001
From: Ryan Kes <alrayyes@gmail.com>
Date: Thu, 28 Mar 2019 14:36:07 +0100
Subject: [PATCH] dwm-notitle-6.2
---
config.def.h | 1 -
dwm.c | 20 ++++----------------
2 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..19330cd 100644
--- a/config.def.h
+++ b/config.def.h
@@ -102,7 +102,6 @@ static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
- { ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
diff --git a/dwm.c b/dwm.c
index 4465af1..bcf5cb1 100644
--- a/dwm.c
+++ b/dwm.c
@@ -64,8 +64,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
- ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
+ ClkRootWin, ClkLast }; /* clicks */
typedef union {
int i;
@@ -439,10 +439,8 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
- else if (ev->x > selmon->ww - TEXTW(stext))
- click = ClkStatusText;
else
- click = ClkWinTitle;
+ click = ClkStatusText;
} else if ((c = wintoclient(ev->window))) {
focus(c);
restack(selmon);
@@ -729,15 +727,8 @@ drawbar(Monitor *m)
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
if ((w = m->ww - sw - x) > bh) {
- if (m->sel) {
- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
- if (m->sel->isfloating)
- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
- } else {
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
- }
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
}
@@ -1235,11 +1226,8 @@ propertynotify(XEvent *e)
drawbars();
break;
}
- if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
+ if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
updatetitle(c);
- if (c == c->mon->sel)
- drawbar(c->mon);
- }
if (ev->atom == netatom[NetWMWindowType])
updatewindowtype(c);
}
--
2.21.0

View File

@ -1,12 +1,11 @@
//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*/
{"📧 ", "sb-mail", 180, 16 },
{"", "sb-volume", 0, 12 },
{"🎙 ", "sb-volume mic", 0, 13 },
{"📶 ", "sb-network", 1, 0 },
{"", "sb-battery", 3, 0 },
{"📅 ", "date '+%F %T '", 1, 0 },
{" \ue158 ", "sb-mail", 180, 16 },
{"", "sb-volume", 0, 12 },
{"\ue63e ", "sb-network", 1, 0 },
{"", "sb-battery", 3, 0 },
{"\ue8b5 ", "date '+%F %T '", 1, 0 },
};
//sets delimeter between status commands. NULL character ('\0') means no delimeter.