change config for multi monitor

This commit is contained in:
Ray Andrew 2024-10-13 00:37:03 -05:00
parent c5c6a42c53
commit da55d1ecf3
3 changed files with 53 additions and 26 deletions

4
README.md Normal file
View file

@ -0,0 +1,4 @@
## TODO
- Multiple monitor font size: https://github.com/SILIZ4/dwm-fork/tree/customized

View file

@ -3,7 +3,7 @@
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
/* appearance */ /* 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 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 systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 4; /* systray spacing */ 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 showsystray = 1; /* 0 means no systray */
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ 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 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 gappih = 20; /* horiz inner gap between windows */
static const unsigned int gappiv = 20; /* vert 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 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 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 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 showbar = 1; /* 0 means no bar */
static const int topbar = 0; /* 0 means bottom 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 user_bh = 60; /* 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 = 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 int sidepad = 5; /* horizontal padding of bar */
static const float rel_fontsize = 0.02;
static const char *fonts[] = { static const char *fonts[] = {
"JetBrainsMonoNL Nerd Font:size=20", // "JetBrainsMonoNL Nerd Font:size=20",
"Iosevka Nerd Font:size=20" , // "Iosevka Nerd Font:size=20" ,
"monospace:size=8:antialias=true:autohint=true", // "monospace:size=20:antialias=true:autohint=true",
"DM Mono: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 dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#101010"; static const char col_gray1[] = "#101010";
@ -36,13 +45,17 @@ static const char col_borderbar[] = "#525252";
static const char *colors[][3] = { static const char *colors[][3] = {
/* fg bg border */ /* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [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[] = { static const char *const autostart[] = {
"dinitctl", "setenv", "DISPLAY", "DBUS_SESSION_BUS_ADDRESS", "XAUTHORITY", NULL, SHAUTOSTART("dinitctl setenv DISPLAY DBUS_SESSION_BUS_ADDRESS XAUTHORITY"), NULL,
"dbus-update-activation-environment", "DISPLAY", "XAUTHORITY", NULL, SHAUTOSTART("dbus-update-activation-environment DISPLAY XAUTHORITY"), NULL,
"dunst", NULL, // SHAUTOSTART("killall dunst; dunst"), NULL,
// "killall", "dunst", NULL,
// "dunst", NULL,
NULL /* terminate */ NULL /* terminate */
}; };
/* Select the font index for you statusbar /* Select the font index for you statusbar
@ -61,12 +74,13 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class * WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title * WM_NAME(STRING) = title
*/ */
/* class instance title tags mask isfloating isterminal noswallow monitor */ /* class instance title tags mask iscentered isfloating isterminal noswallow monitor */
{ "Gimp", NULL, NULL, 0, 1, 0, 0, -1 }, { "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1 },
// { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 }, { "st", NULL, "thesaurus-syn", 0, 1, 1, 1, 1, -1 },
{ "wezterm", NULL, NULL, 0, 0, 1, 0, -1 }, { "wezterm", NULL, NULL, 0, 0, 0, 1, 0, -1 },
{ "St", NULL, NULL, 0, 0, 1, 0, -1 }, { "st", NULL, NULL, 0, 0, 0, 1, 0, -1 },
{ NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */ { "Gcr-prompter", NULL, NULL, 0, 1, 1, 1, 0, -1 },
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */
}; };
/* layout(s) */ /* layout(s) */
@ -110,7 +124,8 @@ static const Layout layouts[] = {
#define STATUSBAR "dwmblocks" #define STATUSBAR "dwmblocks"
/* commands */ /* 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 } } #define TERM(cmd) { .v = (const char*[]){ TERM_CMD, cmd, NULL } }
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "rofi", "-dpi", "1", "-show", "drun", NULL }; static const char *dmenucmd[] = { "rofi", "-dpi", "1", "-show", "drun", NULL };

20
dwm.c
View file

@ -110,14 +110,14 @@ typedef struct {
typedef struct Monitor Monitor; typedef struct Monitor Monitor;
typedef struct Client Client; typedef struct Client Client;
struct Client { struct Client {
char name[256]; char name[128];
float mina, maxa; float mina, maxa;
int x, y, w, h; int x, y, w, h;
int oldx, oldy, oldw, oldh; int oldx, oldy, oldw, oldh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
int bw, oldbw; int bw, oldbw;
unsigned int tags; 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 fakefullscreen;
int ignorecfgreqpos, ignorecfgreqsize; int ignorecfgreqpos, ignorecfgreqsize;
pid_t pid; pid_t pid;
@ -172,6 +172,7 @@ typedef struct {
const char *instance; const char *instance;
const char *title; const char *title;
unsigned int tags; unsigned int tags;
int iscentered;
int isfloating; int isfloating;
int isterminal; int isterminal;
int noswallow; int noswallow;
@ -405,6 +406,7 @@ applyrules(Client *c)
XClassHint ch = { NULL, NULL }; XClassHint ch = { NULL, NULL };
/* rule matching */ /* rule matching */
c->iscentered = 0;
c->isfloating = 0; c->isfloating = 0;
c->tags = 0; c->tags = 0;
XGetClassHint(dpy, c->win, &ch); XGetClassHint(dpy, c->win, &ch);
@ -419,6 +421,7 @@ applyrules(Client *c)
{ {
c->isterminal = r->isterminal; c->isterminal = r->isterminal;
c->noswallow = r->noswallow; c->noswallow = r->noswallow;
c->iscentered = r->iscentered;
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
c->tags |= r->tags; c->tags |= r->tags;
for (m = mons; m && m->num != r->monitor; m = m->next); 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_setscheme(drw, scheme[LENGTH(colors)]);
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg]; 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++; x++;
/* process status text */ /* process status text */
@ -1108,8 +1111,7 @@ drawbar(Monitor *m)
if ((w = mw - tw - x) > th) { if ((w = mw - tw - x) > th) {
if (m->sel) { if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, y, w - sidepad, th, lrpad / 2, m->sel->name, 0, statusfontindex);
drw_text(drw, x, y, w - 1, th, lrpad / 2, m->sel->name, 0, statusfontindex);
if (m->sel->isfloating) if (m->sel->isfloating)
drw_rect(drw, x + boxs, y + boxs, boxw, boxw, m->sel->isfixed, 0); drw_rect(drw, x + boxs, y + boxs, boxw, boxw, m->sel->isfixed, 0);
} else { } else {
@ -1567,6 +1569,10 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c); updatewindowtype(c);
updatesizehints(c); updatesizehints(c);
updatewmhints(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; int format;
unsigned long *data, n, extra; unsigned long *data, n, extra;
@ -3153,8 +3159,10 @@ updatewindowtype(Client *c)
if (state == netatom[NetWMFullscreen]) if (state == netatom[NetWMFullscreen])
setfullscreen(c, 1); setfullscreen(c, 1);
if (wtype == netatom[NetWMWindowTypeDialog]) if (wtype == netatom[NetWMWindowTypeDialog]) {
c->iscentered = 1;
c->isfloating = 1; c->isfloating = 1;
}
} }
void void