# HG changeset patch # User Yasuri # Date 1791072932 18000 # Node ID 84d6074a556604bb9202562cb327b428529da97c # Parent a2c891f7b91405d25f6a24ccce14d56386a11330 Fix: forgot to hg add diff -r a2c891f7b914 -r 84d6074a5566 config/dwm/patches/dwm-bardwmlogo-6.6.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/dwm/patches/dwm-bardwmlogo-6.6.diff Sat Oct 03 19:15:32 2026 -0500 @@ -0,0 +1,98 @@ +From c0e147bf031f9c2638e2c192a97e2d200e4b74be Mon Sep 17 00:00:00 2001 +From: Rizqi Nur Assyaufi +Date: Fri, 15 Aug 2025 20:49:26 +0800 +Subject: [PATCH] Add DWM logo on left bar before tags + +This patch adds a DWM logo to the left side of the status bar, positioned +before the tags, for aesthetic or branding purposes. + +Defines a fixed logo width (`dwmlogowdth = 54`) and adjusts tag rendering to +prevent overlap. + +Uses multiple `drw_rect()` calls to render a pixel-art style "dwm" logo using +rectangles. + +This patch is purely visual and does not impact DWM's core functionality or +performance. It may appeal to users who want a more personalized or distinctive +appearance for their window manager. + +--- + dwm.c | 34 +++++++++++++++++++++++++++++++++- + 1 file changed, 33 insertions(+), 1 deletion(-) + +diff --git a/dwm.c b/dwm.c +index 1443802..c9b2858 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -140,6 +140,10 @@ typedef struct { + int monitor; + } Rule; + ++typedef struct { ++ int x, y, w, h; ++} DwmLogo; ++ + /* function declarations */ + static void applyrules(Client *c); + static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); +@@ -240,6 +244,7 @@ static int screen; + static int sw, sh; /* X display screen geometry width, height */ + static int bh; /* bar height */ + static int lrpad; /* sum of left and right padding for text */ ++static int dwmlogowdth = 54; /* dwm logo width */ + static int (*xerrorxlib)(Display *, XErrorEvent *); + static unsigned int numlockmask = 0; + static void (*handler[LASTEvent]) (XEvent *) = { +@@ -432,6 +437,7 @@ buttonpress(XEvent *e) + } + if (ev->window == selmon->barwin) { + i = x = 0; ++ x = dwmlogowdth; /* dwm logo width */ + do + x += TEXTW(tags[i]); + while (ev->x >= x && ++i < LENGTH(tags)); +@@ -698,6 +704,7 @@ void + drawbar(Monitor *m) + { + int x, w, tw = 0; ++ int stroke = 4, letterHeight = bh - 4; + int boxs = drw->fonts->h / 9; + int boxw = drw->fonts->h / 6 + 2; + unsigned int i, occ = 0, urg = 0; +@@ -718,7 +725,32 @@ drawbar(Monitor *m) + if (c->isurgent) + urg |= c->tags; + } +- x = 0; ++ ++ /* use colored scheme for visibility */ ++ drw_setscheme(drw, scheme[SchemeNorm]); ++ ++ /* draw dark background for logo */ ++ drw_rect(drw, 0, 0, dwmlogowdth, bh, 1, 1); ++ ++ /* draw dwm logo */ ++ const DwmLogo dwmLogo[] = { ++ { 0, 9, stroke, letterHeight / 2 }, /* d: left vertical */ ++ { 0, 15, 35, stroke }, /* d: bottom horizontal */ ++ { 13, 1, stroke, letterHeight }, /* d: right vertical */ ++ { 0, 7, 15, stroke }, /* d: top horizontal */ ++ { 22, 7, stroke, letterHeight / 2 }, /* w: center vertical */ ++ { 31, 7, stroke, letterHeight / 2 }, /* w: right vertical */ ++ { 31, 7, 22, stroke }, /* m: top horizontal */ ++ { 40, 11, stroke, letterHeight / 2 }, /* m: center vertical */ ++ { 49, 11, stroke, letterHeight / 2 } /* m: right vertical */ ++ }; ++ ++ for (int i = 0; i < LENGTH(dwmLogo); i++) { ++ drw_rect(drw, dwmLogo[i].x, dwmLogo[i].y, dwmLogo[i].w, dwmLogo[i].h, 1, 0); ++ } ++ ++ /* start drawing tags after logo */ ++ x = dwmlogowdth; + for (i = 0; i < LENGTH(tags); i++) { + w = TEXTW(tags[i]); + drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); +-- +2.50.1 + diff -r a2c891f7b914 -r 84d6074a5566 modules/dwmbar.nix --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/dwmbar.nix Sat Oct 03 19:15:32 2026 -0500 @@ -0,0 +1,51 @@ +{ writeShellApplication, coreutils, gawk, xsetroot, wireplumber, playerctl }: + +writeShellApplication { + name = "dwmbar"; + runtimeInputs = [ coreutils gawk xsetroot wireplumber playerctl ]; + text = '' + while true; do + # volume + vol_raw=$(wpctl get-volume @DEFAULT_AUDIO_SINK@) + vol=$(echo "$vol_raw" | awk '{print int($2*100)}') + if [[ "$vol_raw" == *MUTED* ]]; then + vol_icon=$'\uf026' + else + vol_icon=$'\uf028' + fi + + music_icon=$'\uf001' + cal_icon=$'\uf073' + + # mpris + music="" + if [ "$(playerctl status 2>/dev/null)" = "Playing" ]; then + track=$(playerctl metadata --format '{{artist}} - {{title}}' 2>/dev/null) + music="$music_icon ''${track:0:50} " + fi + + # battery + cap=$(cat /sys/class/power_supply/BAT0/capacity) + status=$(cat /sys/class/power_supply/BAT0/status) + if [ "$status" = "Charging" ]; then + bat_icon=$'\uf0e7' + elif [ "$cap" -ge 88 ]; then + bat_icon=$'\uf240' + elif [ "$cap" -ge 63 ]; then + bat_icon=$'\uf241' + elif [ "$cap" -ge 38 ]; then + bat_icon=$'\uf242' + elif [ "$cap" -ge 13 ]; then + bat_icon=$'\uf243' + else + bat_icon=$'\uf244' + fi + + # date + now=$(date '+%m/%d/%Y %I:%M %p') + + xsetroot -name " $music$vol_icon $vol% $bat_icon $cap% $cal_icon $now " + sleep 2 + done + ''; +}