Browse Source

Dwm Always Center

main
Yigit Colakoglu 4 years ago
parent
commit
02b00575f1
4 changed files with 23 additions and 3 deletions
  1. +2
    -2
      .config/X11/xinitrc
  2. +7
    -0
      .local/src/dwm/dwm.c
  3. +12
    -0
      .local/src/dwm/patches/dwm-alwayscenter-20200625-f04cac6.diff
  4. +2
    -1
      .local/src/dwm/rules.h

+ 2
- 2
.config/X11/xinitrc View File

@ -64,7 +64,7 @@ xset dpms 600 600 600
--no-unmount --no-gui &
$BROWSER &
#$BROWSER &
#pass 2> /dev/null > /dev/null && qtpass &
redshift -x 2> /dev/null > /dev/null
@ -81,7 +81,7 @@ do
fi
dwmblocks > $XDG_RUNTIME_DIR/dwmblocks.out 2> $XDG_RUNTIME_DIR/dwmblocks.err &
exec dwm > $XDG_RUNTIME_DIR/dwm.log 2> $XDG_RUNTIME_DIR/dwm.err
dwm > $XDG_RUNTIME_DIR/dwm.log 2> $XDG_RUNTIME_DIR/dwm.err
sleep 0.5
done


+ 7
- 0
.local/src/dwm/dwm.c View File

@ -367,6 +367,13 @@ applyrules(Client *c)
c->mon = m;
if (c->isfloating && r->floatpos)
setfloatpos(c, r->floatpos);
else{
c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
}
}else{
c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
}
}
if (ch.res_class)


+ 12
- 0
.local/src/dwm/patches/dwm-alwayscenter-20200625-f04cac6.diff View File

@ -0,0 +1,12 @@
diff -up dwm/dwm.c dwmmod/dwm.c
--- dwm/dwm.c 2020-06-25 00:21:30.383692180 -0300
+++ dwmmod/dwm.c 2020-06-25 00:20:35.643692330 -0300
@@ -1057,6 +1057,8 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)

+ 2
- 1
.local/src/dwm/rules.h View File

@ -43,9 +43,10 @@ static const Rule rules[] = {
{ NULL , "spfile" , NULL , SPTAG(3) , 1 , NULL , 0 , 0 , -1 },
{ NULL , "spmusic" , NULL , SPTAG(4) , 1 , NULL , 0 , 0 , -1 },
{ NULL , "spcal" , NULL , SPTAG(5) , 1 , NULL , 0 , 0 , -1 },
{ NULL , "sxiv" , NULL , 0 , 1 , "100% 1% 600W 350H" , 0 , 0 , -1 },
{ NULL , "sxiv" , NULL , 0 , 1 , "100% 1% 600W 350H" , 1 , 0 , -1 },
{ NULL , "Kunst" , NULL , 0 , 1 , "100% 1% 150W 150H" , 0 , 0 , -1 },
{ NULL , NULL , "SimCrop" , 0 , 1 , "50% 50% 800W 500H" , 0 ,0 , -1 },
//{ NULL , NULL , NULL , 0 , 1 , NULL , 0 ,0 , -1 },
};
#endif /* rules_h */


Loading…
Cancel
Save