apply setstatus patch

This commit is contained in:
Elizabeth Hunt 2024-09-01 20:06:33 -07:00
parent 9a51d0912b
commit 29bfe5688a
3 changed files with 56 additions and 1 deletions

View File

@ -2,6 +2,7 @@
/* appearance */ /* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int gappx = 5; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */

7
dwm.c
View File

@ -2279,12 +2279,17 @@ main(int argc, char *argv[])
{ {
if (argc == 2 && !strcmp("-v", argv[1])) if (argc == 2 && !strcmp("-v", argv[1]))
die("dwm-"VERSION); die("dwm-"VERSION);
else if (argc != 1) else if (argc != 1 && strcmp("-s", argv[1]))
die("usage: dwm [-v]"); die("usage: dwm [-v]");
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr); fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL))) if (!(dpy = XOpenDisplay(NULL)))
die("dwm: cannot open display"); die("dwm: cannot open display");
if (argc > 1 && !strcmp("-s", argv[1])) {
XStoreName(dpy, RootWindow(dpy, DefaultScreen(dpy)), argv[2]);
XCloseDisplay(dpy);
return 0;
}
checkotherwm(); checkotherwm();
setup(); setup();
#ifdef __OpenBSD__ #ifdef __OpenBSD__

View File

@ -0,0 +1,49 @@
From dbfb346a86c79b50bfa27c75547b42e34cb54715 Mon Sep 17 00:00:00 2001
From: aleks <aleks.stier@icloud.com>
Date: Fri, 11 Sep 2020 17:42:50 +0200
Subject: [PATCH] Apply setstatus-6.2
Enables to set the status with dwm itself. No more xsetroot bloat!
To change the status to `foo bar` execute:
dwm -s "foo bar"
Piping into `dwm -s` is currently not supported but you can set the
status to the output of any command by doing something like:
dwm -s "$(run_command_which_outputs_the_status)"
For example to set the status to the current date run:
dwm -s "$(date)"
---
dwm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c
index 4465af1..b3c8f71 100644
--- a/dwm.c
+++ b/dwm.c
@@ -2129,12 +2129,17 @@ main(int argc, char *argv[])
{
if (argc == 2 && !strcmp("-v", argv[1]))
die("dwm-"VERSION);
- else if (argc != 1)
+ else if (argc != 1 && strcmp("-s", argv[1]))
die("usage: dwm [-v]");
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
die("dwm: cannot open display");
+ if (argc > 1 && !strcmp("-s", argv[1])) {
+ XStoreName(dpy, RootWindow(dpy, DefaultScreen(dpy)), argv[2]);
+ XCloseDisplay(dpy);
+ return 0;
+ }
checkotherwm();
setup();
#ifdef __OpenBSD__
--
2.28.0