From da55d1ecf3a3c532f47b053303c7160104c20439 Mon Sep 17 00:00:00 2001 From: Ray Andrew <4437323+rayandrew@users.noreply.github.com> Date: Sun, 13 Oct 2024 00:37:03 -0500 Subject: [PATCH] change config for multi monitor --- README.md | 4 ++++ config.def.h | 55 +++++++++++++++++++++++++++++++++------------------- dwm.c | 20 +++++++++++++------ 3 files changed, 53 insertions(+), 26 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..64d144f --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ + +## TODO + +- Multiple monitor font size: https://github.com/SILIZ4/dwm-fork/tree/customized diff --git a/config.def.h b/config.def.h index 050e351..c6f8cd5 100644 --- a/config.def.h +++ b/config.def.h @@ -3,7 +3,7 @@ #include /* appearance */ -static const unsigned int borderpx = 3; /* border pixel of windows */ +static const unsigned int borderpx = 2; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ static const unsigned int systrayspacing = 4; /* systray spacing */ @@ -11,21 +11,30 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, dis static const int showsystray = 1; /* 0 means no systray */ static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ static const int swterminheritfs = 1; /* 1 terminal inherits fullscreen on unswallow, 0 otherwise */ -static const unsigned int gappih = 20; /* horiz inner gap between windows */ -static const unsigned int gappiv = 20; /* vert inner gap between windows */ +// static const unsigned int gappih = 20; /* horiz inner gap between windows */ +// static const unsigned int gappiv = 20; /* vert inner gap between windows */ +// static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ +static const unsigned int gappih = 15; /* horiz inner gap between windows */ +static const unsigned int gappiv = 10; /* vert inner gap between windows */ static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ static const unsigned int gappov = 5; /* vert outer gap between windows and screen edge */ static int smartgaps = 0; /* 1 means no outer gap when there is only one window */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 0; /* 0 means bottom bar */ -static const int user_bh = 50; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ -static const int vertpad = 8; /* vertical padding of bar */ +// static const int user_bh = 60; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ +static const int user_bh = 30; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ +static const int vertpad = 2; /* vertical padding of bar */ static const int sidepad = 5; /* horizontal padding of bar */ +static const float rel_fontsize = 0.02; static const char *fonts[] = { - "JetBrainsMonoNL Nerd Font:size=20", - "Iosevka Nerd Font:size=20" , - "monospace:size=8:antialias=true:autohint=true", - "DM Mono:size=20:antialias=true:autohint=true" + // "JetBrainsMonoNL Nerd Font:size=20", + // "Iosevka Nerd Font:size=20" , + // "monospace:size=20:antialias=true:autohint=true", + // "DM Mono:size=20:antialias=true:autohint=true" + "JetBrainsMonoNL Nerd Font:size=10:antialias=true:autohint=true", + "Iosevka Nerd Font:size=10:antialias=true:autohint=true", + "monospace:size=10:antialias=true:autohint=true", + "DM Mono:size=10:antialias=true:autohint=true" }; static const char dmenufont[] = "monospace:size=10"; static const char col_gray1[] = "#101010"; @@ -36,13 +45,17 @@ static const char col_borderbar[] = "#525252"; static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray3, col_gray1, col_gray4 }, + [SchemeSel] = { col_gray3, col_gray1, col_gray4 }, }; + +#define SHAUTOSTART(cmd) "/bin/sh", "-c", cmd static const char *const autostart[] = { - "dinitctl", "setenv", "DISPLAY", "DBUS_SESSION_BUS_ADDRESS", "XAUTHORITY", NULL, - "dbus-update-activation-environment", "DISPLAY", "XAUTHORITY", NULL, - "dunst", NULL, + SHAUTOSTART("dinitctl setenv DISPLAY DBUS_SESSION_BUS_ADDRESS XAUTHORITY"), NULL, + SHAUTOSTART("dbus-update-activation-environment DISPLAY XAUTHORITY"), NULL, + // SHAUTOSTART("killall dunst; dunst"), NULL, + // "killall", "dunst", NULL, + // "dunst", NULL, NULL /* terminate */ }; /* Select the font index for you statusbar @@ -61,12 +74,13 @@ static const Rule rules[] = { * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ - /* class instance title tags mask isfloating isterminal noswallow monitor */ - { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, - // { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, - { "wezterm", NULL, NULL, 0, 0, 1, 0, -1 }, - { "St", NULL, NULL, 0, 0, 1, 0, -1 }, - { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */ + /* class instance title tags mask iscentered isfloating isterminal noswallow monitor */ + { "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1 }, + { "st", NULL, "thesaurus-syn", 0, 1, 1, 1, 1, -1 }, + { "wezterm", NULL, NULL, 0, 0, 0, 1, 0, -1 }, + { "st", NULL, NULL, 0, 0, 0, 1, 0, -1 }, + { "Gcr-prompter", NULL, NULL, 0, 1, 1, 1, 0, -1 }, + { NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */ }; /* layout(s) */ @@ -110,7 +124,8 @@ static const Layout layouts[] = { #define STATUSBAR "dwmblocks" /* commands */ -#define TERM_CMD "wezterm" +// #define TERM_CMD "wezterm", "-e" +#define TERM_CMD "/home/rayandrew/Code/st-flexipatch/st" #define TERM(cmd) { .v = (const char*[]){ TERM_CMD, cmd, NULL } } static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "rofi", "-dpi", "1", "-show", "drun", NULL }; diff --git a/dwm.c b/dwm.c index 36f2d24..a60dc9b 100644 --- a/dwm.c +++ b/dwm.c @@ -110,14 +110,14 @@ typedef struct { typedef struct Monitor Monitor; typedef struct Client Client; struct Client { - char name[256]; + char name[128]; float mina, maxa; int x, y, w, h; int oldx, oldy, oldw, oldh; int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; int bw, oldbw; unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow; + int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow; int fakefullscreen; int ignorecfgreqpos, ignorecfgreqsize; pid_t pid; @@ -172,6 +172,7 @@ typedef struct { const char *instance; const char *title; unsigned int tags; + int iscentered; int isfloating; int isterminal; int noswallow; @@ -405,6 +406,7 @@ applyrules(Client *c) XClassHint ch = { NULL, NULL }; /* rule matching */ + c->iscentered = 0; c->isfloating = 0; c->tags = 0; XGetClassHint(dpy, c->win, &ch); @@ -419,6 +421,7 @@ applyrules(Client *c) { c->isterminal = r->isterminal; c->noswallow = r->noswallow; + c->iscentered = r->iscentered; c->isfloating = r->isfloating; c->tags |= r->tags; for (m = mons; m && m->num != r->monitor; m = m->next); @@ -992,7 +995,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) { drw_setscheme(drw, scheme[LENGTH(colors)]); drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; drw->scheme[ColBg] = scheme[SchemeNorm][ColBg]; - drw_rect(drw, x, borderpx, w + borderpx - sp * 2, th, 1, 1); + drw_rect(drw, x - 2 * sp, borderpx, w + borderpx - sp * 2, th, 1, 1); x++; /* process status text */ @@ -1108,8 +1111,7 @@ drawbar(Monitor *m) if ((w = mw - tw - x) > th) { if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); - - drw_text(drw, x, y, w - 1, th, lrpad / 2, m->sel->name, 0, statusfontindex); + drw_text(drw, x, y, w - sidepad, th, lrpad / 2, m->sel->name, 0, statusfontindex); if (m->sel->isfloating) drw_rect(drw, x + boxs, y + boxs, boxw, boxw, m->sel->isfixed, 0); } else { @@ -1567,6 +1569,10 @@ manage(Window w, XWindowAttributes *wa) updatewindowtype(c); updatesizehints(c); updatewmhints(c); + if (c->iscentered) { + c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2; + c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; + } { int format; unsigned long *data, n, extra; @@ -3153,8 +3159,10 @@ updatewindowtype(Client *c) if (state == netatom[NetWMFullscreen]) setfullscreen(c, 1); - if (wtype == netatom[NetWMWindowTypeDialog]) + if (wtype == netatom[NetWMWindowTypeDialog]) { + c->iscentered = 1; c->isfloating = 1; + } } void