From fbdd9fb39a9eb713f966a8acdb81fe6efe8722ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Czy=C5=BC?= Date: Sat, 25 Feb 2023 13:06:12 +0100 Subject: [PATCH] Customization --- dwm/.dwm/config.def.h | 63 ++++++++++++++------------ dwm/.dwm/dwm.c | 38 +++++++++++++++- dwm/.dwm/dwm.c.orig | 41 +++++++++++++++-- dwm/.dwm/recompile | 2 +- nitrogen/.config/nitrogen/nitrogen.cfg | 8 ++-- picom/.config/picom.conf | 2 +- zsh/.aliases | 4 +- 7 files changed, 115 insertions(+), 43 deletions(-) diff --git a/dwm/.dwm/config.def.h b/dwm/.dwm/config.def.h index c0258c0..09924cf 100644 --- a/dwm/.dwm/config.def.h +++ b/dwm/.dwm/config.def.h @@ -6,37 +6,40 @@ static const unsigned int gappx = 6; /* gaps between windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no 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 */ /* monocle mode in the presence of several windows. */ /* Modes after showtab_nmodes are disabled. */ 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 toptab = False; /* False means bottom tab bar */ -static const char *fonts[] = { "monospace:size=10" }; -static const char dmenufont[] = "monospace:size=10"; -static char normbgcolor[] = "#222222"; -static char normbordercolor[] = "#444444"; -static char normfgcolor[] = "#bbbbbb"; -static char selfgcolor[] = "#eeeeee"; -static char selbordercolor[] = "#005577"; -static char selbgcolor[] = "#005577"; -static char termcol0[] = "#000000"; /* black */ -static char termcol1[] = "#ff0000"; /* red */ -static char termcol2[] = "#33ff00"; /* green */ -static char termcol3[] = "#ff0099"; /* yellow */ -static char termcol4[] = "#0066ff"; /* blue */ -static char termcol5[] = "#cc00ff"; /* magenta */ -static char termcol6[] = "#00ffff"; /* cyan */ -static char termcol7[] = "#d0d0d0"; /* white */ -static char termcol8[] = "#808080"; /* black */ -static char termcol9[] = "#ff0000"; /* red */ -static char termcol10[] = "#33ff00"; /* green */ -static char termcol11[] = "#ff0099"; /* yellow */ -static char termcol12[] = "#0066ff"; /* blue */ -static char termcol13[] = "#cc00ff"; /* magenta */ -static char termcol14[] = "#00ffff"; /* cyan */ -static char termcol15[] = "#ffffff"; /* white */ +static const int showtab = showtab_never; /* Default tab bar show mode */ +static const int toptab = True; /* False means bottom tab bar */ +static const char *fonts[] = { + "SauceCodePro Nerd Font Mono:size=12:antialias=true:autohint=true", + "monospace:size=12:antialias=true:autohint=true", +}; +static const char dmenufont[] = "SauceCodePro Nerd Font Mono:size=12:antialias=true:autohint=true"; +static char termcol0[] = "#181926"; /* black */ +static char termcol1[] = "#ed8796"; /* red */ +static char termcol2[] = "#a6da95"; /* green */ +static char termcol3[] = "#eed49f"; /* yellow */ +static char termcol4[] = "#8aadf4"; /* blue */ +static char termcol5[] = "#f5bde6"; /* magenta */ +static char termcol6[] = "#8bd5ca"; /* cyan */ +static char termcol7[] = "#cad3f5"; /* white */ +static char termcol8[] = "#1e2030"; /* black */ +static char termcol9[] = "#ee99a0"; /* red */ +static char termcol10[] = "#a6da95"; /* green */ +static char termcol11[] = "#eed49f"; /* yellow */ +static char termcol12[] = "#8aadf4"; /* blue */ +static char termcol13[] = "#f5bde6"; /* magenta */ +static char termcol14[] = "#8bd5ca"; /* cyan */ +static char termcol15[] = "#f4dbd6"; /* white */ +static char normbgcolor[] = "#24273a"; +static char normbordercolor[] = "#363a4f"; +static char normfgcolor[] = "#cad3f5"; +static char selfgcolor[] = "#ed8796"; +static char selbordercolor[] = "#7dc4e4"; +static char selbgcolor[] = "#24273a"; static char *termcolor[] = { termcol0, termcol1, @@ -85,9 +88,9 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen win static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ + { "HHH", grid }, { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, - { "HHH", grid }, { "TTT", bstack }, { "===", bstackhoriz }, }; @@ -105,10 +108,10 @@ static const Layout layouts[] = { /* commands */ 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 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[] = { /* modifier key function argument */ diff --git a/dwm/.dwm/dwm.c b/dwm/.dwm/dwm.c index b05fe33..4507e27 100644 --- a/dwm/.dwm/dwm.c +++ b/dwm/.dwm/dwm.c @@ -82,7 +82,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMFullscreen, NetActiveWindow, NetWMWindowType, - NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ + NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { ClkTagBar, ClkTabBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ @@ -243,6 +243,7 @@ static void scan(void); static int sendevent(Client *c, Atom proto); static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); +static void setclienttagprop(Client *c); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); static void fullscreen(const Arg *arg); @@ -1597,6 +1598,26 @@ manage(Window w, XWindowAttributes *wa) updatewindowtype(c); updatesizehints(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); grabbuttons(c, 0); if (!c->isfloating) @@ -2085,6 +2106,7 @@ sendmon(Client *c, Monitor *m) c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ attachBelow(c); attachstack(c); + setclienttagprop(c); focus(NULL); arrange(NULL); } @@ -2252,6 +2274,7 @@ setup(void) netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); + netatom[NetClientInfo] = XInternAtom(dpy, "_NET_CLIENT_INFO", False); /* init cursors */ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); cursor[CurResize] = drw_cur_create(drw, XC_sizing); @@ -2276,6 +2299,7 @@ setup(void) XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast); XDeleteProperty(dpy, root, netatom[NetClientList]); + XDeleteProperty(dpy, root, netatom[NetClientInfo]); /* select events */ wa.cursor = cursor[CurNormal]->cursor; 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 tag(const Arg *arg) { + Client *c; if (selmon->sel && arg->ui & TAGMASK) { + c = selmon->sel; selmon->sel->tags = arg->ui & TAGMASK; + setclienttagprop(c); focus(NULL); arrange(selmon); } @@ -2495,6 +2530,7 @@ toggletag(const Arg *arg) newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); if (newtags) { selmon->sel->tags = newtags; + setclienttagprop(selmon->sel); focus(NULL); arrange(selmon); } diff --git a/dwm/.dwm/dwm.c.orig b/dwm/.dwm/dwm.c.orig index 9c41ed1..b05fe33 100644 --- a/dwm/.dwm/dwm.c.orig +++ b/dwm/.dwm/dwm.c.orig @@ -52,7 +52,8 @@ #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)) \ * 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 LENGTH(X) (sizeof X / sizeof X[0]) #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 arrangemon(Monitor *m); static void attach(Client *c); +static void attachBelow(Client *c); static void attachstack(Client *c); static void buttonpress(XEvent *e); static void compileregexes(void); @@ -225,6 +227,7 @@ static void maprequest(XEvent *e); static void monocle(Monitor *m); static void motionnotify(XEvent *e); static void movemouse(const Arg *arg); +static Client *nexttagged(Client *c); static Client *nexttiled(Client *c); static void pop(Client *c); static void propertynotify(XEvent *e); @@ -475,6 +478,27 @@ attach(Client *c) c->next = c->mon->clients; 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 attachstack(Client *c) @@ -1579,7 +1603,7 @@ manage(Window w, XWindowAttributes *wa) c->isfloating = c->oldstate = trans != None || c->isfixed; if (c->isfloating) XRaiseWindow(dpy, c->win); - attach(c); + attachBelow(c); attachstack(c); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (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 * nexttiled(Client *c) { @@ -2049,7 +2083,7 @@ sendmon(Client *c, Monitor *m) detachstack(c); c->mon = m; c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ - attach(c); + attachBelow(c); attachstack(c); focus(NULL); arrange(NULL); @@ -2673,6 +2707,7 @@ updategeom(void) detachstack(c); c->mon = mons; attach(c); + attachBelow(c); attachstack(c); } if (m == selmon) diff --git a/dwm/.dwm/recompile b/dwm/.dwm/recompile index 2659372..102ea03 100755 --- a/dwm/.dwm/recompile +++ b/dwm/.dwm/recompile @@ -1,4 +1,4 @@ #!/bin/bash rm -f ./config.h -doas make clean install +sudo make clean install diff --git a/nitrogen/.config/nitrogen/nitrogen.cfg b/nitrogen/.config/nitrogen/nitrogen.cfg index c7baa15..7f24ac5 100644 --- a/nitrogen/.config/nitrogen/nitrogen.cfg +++ b/nitrogen/.config/nitrogen/nitrogen.cfg @@ -1,8 +1,8 @@ [geometry] -posx=1920 -posy=22 -sizex=1406 -sizey=1416 +posx=3334 +posy=38 +sizex=1138 +sizey=1394 [nitrogen] view=icon diff --git a/picom/.config/picom.conf b/picom/.config/picom.conf index e755992..fadcdfb 100644 --- a/picom/.config/picom.conf +++ b/picom/.config/picom.conf @@ -132,7 +132,7 @@ focus-exclude = [ "class_g = 'Cairo-clock'" ]; # Sets the radius of rounded window corners. When > 0, the compositor will # round the corners of windows. Does not interact well with # `transparent-clipping`. -corner-radius = 3 +corner-radius = 8 # Exclude conditions for rounded corners. rounded-corners-exclude = [ diff --git a/zsh/.aliases b/zsh/.aliases index 6c96ddf..22c36de 100644 --- a/zsh/.aliases +++ b/zsh/.aliases @@ -29,9 +29,7 @@ alias du="du -ach | sort -h" alias ps="ps auxf" # Enable aliases to be sudo’ed -alias sudo='doas ' - -alias sudo="doas" +alias sudo='sudo ' # Get week number alias week='date +%V'