Customization

This commit is contained in:
2023-02-25 13:06:12 +01:00
parent 0460885e55
commit fbdd9fb39a
7 changed files with 115 additions and 43 deletions

View File

@@ -6,37 +6,40 @@ static const unsigned int gappx = 6; /* 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 */
static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ static const int user_bh = 32; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */
/* Display modes of the tab bar: never shown, always shown, shown only in */ /* Display modes of the tab bar: never shown, always shown, shown only in */
/* monocle mode in the presence of several windows. */ /* monocle mode in the presence of several windows. */
/* Modes after showtab_nmodes are disabled. */ /* Modes after showtab_nmodes are disabled. */
enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always}; enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always};
static const int showtab = showtab_auto; /* Default tab bar show mode */ static const int showtab = showtab_never; /* Default tab bar show mode */
static const int toptab = False; /* False means bottom tab bar */ static const int toptab = True; /* False means bottom tab bar */
static const char *fonts[] = { "monospace:size=10" }; static const char *fonts[] = {
static const char dmenufont[] = "monospace:size=10"; "SauceCodePro Nerd Font Mono:size=12:antialias=true:autohint=true",
static char normbgcolor[] = "#222222"; "monospace:size=12:antialias=true:autohint=true",
static char normbordercolor[] = "#444444"; };
static char normfgcolor[] = "#bbbbbb"; static const char dmenufont[] = "SauceCodePro Nerd Font Mono:size=12:antialias=true:autohint=true";
static char selfgcolor[] = "#eeeeee"; static char termcol0[] = "#181926"; /* black */
static char selbordercolor[] = "#005577"; static char termcol1[] = "#ed8796"; /* red */
static char selbgcolor[] = "#005577"; static char termcol2[] = "#a6da95"; /* green */
static char termcol0[] = "#000000"; /* black */ static char termcol3[] = "#eed49f"; /* yellow */
static char termcol1[] = "#ff0000"; /* red */ static char termcol4[] = "#8aadf4"; /* blue */
static char termcol2[] = "#33ff00"; /* green */ static char termcol5[] = "#f5bde6"; /* magenta */
static char termcol3[] = "#ff0099"; /* yellow */ static char termcol6[] = "#8bd5ca"; /* cyan */
static char termcol4[] = "#0066ff"; /* blue */ static char termcol7[] = "#cad3f5"; /* white */
static char termcol5[] = "#cc00ff"; /* magenta */ static char termcol8[] = "#1e2030"; /* black */
static char termcol6[] = "#00ffff"; /* cyan */ static char termcol9[] = "#ee99a0"; /* red */
static char termcol7[] = "#d0d0d0"; /* white */ static char termcol10[] = "#a6da95"; /* green */
static char termcol8[] = "#808080"; /* black */ static char termcol11[] = "#eed49f"; /* yellow */
static char termcol9[] = "#ff0000"; /* red */ static char termcol12[] = "#8aadf4"; /* blue */
static char termcol10[] = "#33ff00"; /* green */ static char termcol13[] = "#f5bde6"; /* magenta */
static char termcol11[] = "#ff0099"; /* yellow */ static char termcol14[] = "#8bd5ca"; /* cyan */
static char termcol12[] = "#0066ff"; /* blue */ static char termcol15[] = "#f4dbd6"; /* white */
static char termcol13[] = "#cc00ff"; /* magenta */ static char normbgcolor[] = "#24273a";
static char termcol14[] = "#00ffff"; /* cyan */ static char normbordercolor[] = "#363a4f";
static char termcol15[] = "#ffffff"; /* white */ static char normfgcolor[] = "#cad3f5";
static char selfgcolor[] = "#ed8796";
static char selbordercolor[] = "#7dc4e4";
static char selbgcolor[] = "#24273a";
static char *termcolor[] = { static char *termcolor[] = {
termcol0, termcol0,
termcol1, termcol1,
@@ -85,9 +88,9 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen win
static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol arrange function */ /* symbol arrange function */
{ "[]=", tile }, /* first entry is default */ { "[]=", tile }, /* first entry is default */
{ "HHH", grid },
{ "><>", NULL }, /* no layout function means floating behavior */ { "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle }, { "[M]", monocle },
{ "HHH", grid },
{ "TTT", bstack }, { "TTT", bstack },
{ "===", bstackhoriz }, { "===", bstackhoriz },
}; };
@@ -105,10 +108,10 @@ static const Layout layouts[] = {
/* commands */ /* commands */
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[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", normbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[] = { "alacritty", NULL }; static const char *termcmd[] = { "alacritty", NULL };
static const char scratchpadname[] = "scratchpad"; static const char scratchpadname[] = "scratchpad";
static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; static const char *scratchpadcmd[] = { "alacritty", "-t", scratchpadname, "--option", "window.dimensions.columns=120", "--option", "window.dimensions.lines=34", NULL };
static const Key keys[] = { static const Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */

View File

@@ -82,7 +82,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */ enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck, enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkTabBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, enum { ClkTagBar, ClkTabBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -243,6 +243,7 @@ static void scan(void);
static int sendevent(Client *c, Atom proto); static int sendevent(Client *c, Atom proto);
static void sendmon(Client *c, Monitor *m); static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state); static void setclientstate(Client *c, long state);
static void setclienttagprop(Client *c);
static void setfocus(Client *c); static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen); static void setfullscreen(Client *c, int fullscreen);
static void fullscreen(const Arg *arg); static void fullscreen(const Arg *arg);
@@ -1597,6 +1598,26 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c); updatewindowtype(c);
updatesizehints(c); updatesizehints(c);
updatewmhints(c); updatewmhints(c);
{
int format;
unsigned long *data, n, extra;
Monitor *m;
Atom atom;
if (XGetWindowProperty(dpy, c->win, netatom[NetClientInfo], 0L, 2L, False, XA_CARDINAL,
&atom, &format, &n, &extra, (unsigned char **)&data) == Success && n == 2) {
c->tags = *data;
for (m = mons; m; m = m->next) {
if (m->num == *(data+1)) {
c->mon = m;
break;
}
}
}
if (n > 0)
XFree(data);
}
setclienttagprop(c);
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0); grabbuttons(c, 0);
if (!c->isfloating) if (!c->isfloating)
@@ -2085,6 +2106,7 @@ sendmon(Client *c, Monitor *m)
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attachBelow(c); attachBelow(c);
attachstack(c); attachstack(c);
setclienttagprop(c);
focus(NULL); focus(NULL);
arrange(NULL); arrange(NULL);
} }
@@ -2252,6 +2274,7 @@ setup(void)
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
netatom[NetClientInfo] = XInternAtom(dpy, "_NET_CLIENT_INFO", False);
/* init cursors */ /* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurResize] = drw_cur_create(drw, XC_sizing);
@@ -2276,6 +2299,7 @@ setup(void)
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
PropModeReplace, (unsigned char *) netatom, NetLast); PropModeReplace, (unsigned char *) netatom, NetLast);
XDeleteProperty(dpy, root, netatom[NetClientList]); XDeleteProperty(dpy, root, netatom[NetClientList]);
XDeleteProperty(dpy, root, netatom[NetClientInfo]);
/* select events */ /* select events */
wa.cursor = cursor[CurNormal]->cursor; wa.cursor = cursor[CurNormal]->cursor;
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
@@ -2383,11 +2407,22 @@ spawn(const Arg *arg)
} }
} }
void
setclienttagprop(Client *c)
{
long data[] = { (long) c->tags, (long) c->mon->num };
XChangeProperty(dpy, c->win, netatom[NetClientInfo], XA_CARDINAL, 32,
PropModeReplace, (unsigned char *) data, 2);
}
void void
tag(const Arg *arg) tag(const Arg *arg)
{ {
Client *c;
if (selmon->sel && arg->ui & TAGMASK) { if (selmon->sel && arg->ui & TAGMASK) {
c = selmon->sel;
selmon->sel->tags = arg->ui & TAGMASK; selmon->sel->tags = arg->ui & TAGMASK;
setclienttagprop(c);
focus(NULL); focus(NULL);
arrange(selmon); arrange(selmon);
} }
@@ -2495,6 +2530,7 @@ toggletag(const Arg *arg)
newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
if (newtags) { if (newtags) {
selmon->sel->tags = newtags; selmon->sel->tags = newtags;
setclienttagprop(selmon->sel);
focus(NULL); focus(NULL);
arrange(selmon); arrange(selmon);
} }

View File

@@ -52,7 +52,8 @@
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) #define ISVISIBLEONTAG(C, T) ((C->tags & T))
#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
#define HIDDEN(C) ((getstate(C->win) == IconicState)) #define HIDDEN(C) ((getstate(C->win) == IconicState))
#define LENGTH(X) (sizeof X / sizeof X[0]) #define LENGTH(X) (sizeof X / sizeof X[0])
#define MOUSEMASK (BUTTONMASK|PointerMotionMask) #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
@@ -178,6 +179,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
static void arrange(Monitor *m); static void arrange(Monitor *m);
static void arrangemon(Monitor *m); static void arrangemon(Monitor *m);
static void attach(Client *c); static void attach(Client *c);
static void attachBelow(Client *c);
static void attachstack(Client *c); static void attachstack(Client *c);
static void buttonpress(XEvent *e); static void buttonpress(XEvent *e);
static void compileregexes(void); static void compileregexes(void);
@@ -225,6 +227,7 @@ static void maprequest(XEvent *e);
static void monocle(Monitor *m); static void monocle(Monitor *m);
static void motionnotify(XEvent *e); static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg); static void movemouse(const Arg *arg);
static Client *nexttagged(Client *c);
static Client *nexttiled(Client *c); static Client *nexttiled(Client *c);
static void pop(Client *c); static void pop(Client *c);
static void propertynotify(XEvent *e); static void propertynotify(XEvent *e);
@@ -475,6 +478,27 @@ attach(Client *c)
c->next = c->mon->clients; c->next = c->mon->clients;
c->mon->clients = c; c->mon->clients = c;
} }
void
attachBelow(Client *c)
{
//If there is nothing on the monitor or the selected client is floating, attach as normal
if(c->mon->sel == NULL || c->mon->sel->isfloating) {
Client *at = nexttagged(c);
if(!at) {
attach(c);
return;
}
c->next = at->next;
at->next = c;
return;
}
//Set the new client's next property to the same as the currently selected clients next
c->next = c->mon->sel->next;
//Set the currently selected clients next property to the new client
c->mon->sel->next = c;
}
void void
attachstack(Client *c) attachstack(Client *c)
@@ -1579,7 +1603,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed; c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating) if (c->isfloating)
XRaiseWindow(dpy, c->win); XRaiseWindow(dpy, c->win);
attach(c); attachBelow(c);
attachstack(c); attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1); (unsigned char *) &(c->win), 1);
@@ -1709,6 +1733,16 @@ movemouse(const Arg *arg)
} }
} }
Client *
nexttagged(Client *c) {
Client *walked = c->mon->clients;
for(;
walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags));
walked = walked->next
);
return walked;
}
Client * Client *
nexttiled(Client *c) nexttiled(Client *c)
{ {
@@ -2049,7 +2083,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c); detachstack(c);
c->mon = m; c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attach(c); attachBelow(c);
attachstack(c); attachstack(c);
focus(NULL); focus(NULL);
arrange(NULL); arrange(NULL);
@@ -2673,6 +2707,7 @@ updategeom(void)
detachstack(c); detachstack(c);
c->mon = mons; c->mon = mons;
attach(c); attach(c);
attachBelow(c);
attachstack(c); attachstack(c);
} }
if (m == selmon) if (m == selmon)

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
rm -f ./config.h rm -f ./config.h
doas make clean install sudo make clean install

View File

@@ -1,8 +1,8 @@
[geometry] [geometry]
posx=1920 posx=3334
posy=22 posy=38
sizex=1406 sizex=1138
sizey=1416 sizey=1394
[nitrogen] [nitrogen]
view=icon view=icon

View File

@@ -132,7 +132,7 @@ focus-exclude = [ "class_g = 'Cairo-clock'" ];
# Sets the radius of rounded window corners. When > 0, the compositor will # Sets the radius of rounded window corners. When > 0, the compositor will
# round the corners of windows. Does not interact well with # round the corners of windows. Does not interact well with
# `transparent-clipping`. # `transparent-clipping`.
corner-radius = 3 corner-radius = 8
# Exclude conditions for rounded corners. # Exclude conditions for rounded corners.
rounded-corners-exclude = [ rounded-corners-exclude = [

View File

@@ -29,9 +29,7 @@ alias du="du -ach | sort -h"
alias ps="ps auxf" alias ps="ps auxf"
# Enable aliases to be sudoed # Enable aliases to be sudoed
alias sudo='doas ' alias sudo='sudo '
alias sudo="doas"
# Get week number # Get week number
alias week='date +%V' alias week='date +%V'