Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f95e729c48 | |||
| 44dbc6809d | |||
| 2bb919e634 | |||
| c3dd6a829b | |||
| 5c9f30300b | |||
| 397d618f1c | |||
| f63cde9354 | |||
| 02bd09ff29 | |||
| a9aa0d8ffb | |||
| 0a93955264 | |||
| 5bbe65082c | |||
| b14af08e9e | |||
| 4537c87ba0 | |||
| 85fe518c1a | |||
| 244fa852fe | |||
| 2c260c333d | |||
| 96a91904a5 | |||
| 018d1f362f | |||
| 7c3abae4e6 | |||
| 93f26863d1 | |||
| 74edc27caa |
@@ -0,0 +1,31 @@
|
|||||||
|
name: Sync Upstream
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * 0"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout fork
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: master
|
||||||
|
|
||||||
|
- name: Add upstream remote
|
||||||
|
run: |
|
||||||
|
git remote add upstream https://git.suckless.org/dwm || true
|
||||||
|
git fetch upstream
|
||||||
|
|
||||||
|
- name: Merge upstream into master
|
||||||
|
run: |
|
||||||
|
git config user.name "gitea-runner[bot]"
|
||||||
|
git config user.email "gitea-runner[bot]@noreply.erickahmed.com"
|
||||||
|
git merge upstream/master --strategy-option ours --no-edit || true
|
||||||
|
|
||||||
|
- name: Push merged branch
|
||||||
|
run: |
|
||||||
|
git push origin master
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
MIT/X Consortium License
|
MIT/X Consortium License
|
||||||
|
|
||||||
|
© 2010-2026 Hiltjo Posthuma <hiltjo@codemadness.org>
|
||||||
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
|
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
|
||||||
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
||||||
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
||||||
@@ -11,7 +12,6 @@ MIT/X Consortium License
|
|||||||
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
||||||
© 2008 Neale Pickett <neale dot woozle dot org>
|
© 2008 Neale Pickett <neale dot woozle dot org>
|
||||||
© 2009 Mate Nagy <mnagy at port70 dot net>
|
© 2009 Mate Nagy <mnagy at port70 dot net>
|
||||||
© 2010-2016 Hiltjo Posthuma <hiltjo@codemadness.org>
|
|
||||||
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
||||||
© 2011 Christoph Lohmann <20h@r-36.net>
|
© 2011 Christoph Lohmann <20h@r-36.net>
|
||||||
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
||||||
|
|||||||
+34
-17
@@ -1,21 +1,36 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
/* appearance */
|
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
#define FONT "FiraCodeNerdFont:size=11:antialias=true:autohint=true"
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 3; /* border pixel of 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 char *fonts[] = { "monospace:size=10" };
|
static const char *fonts[] = { FONT };
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static const char dmenufont[] = FONT;
|
||||||
static const char col_gray1[] = "#222222";
|
// Dark colors
|
||||||
static const char col_gray2[] = "#444444";
|
static const char col_dark1[] = "#11111b";
|
||||||
static const char col_gray3[] = "#bbbbbb";
|
static const char col_dark2[] = "#45475a";
|
||||||
static const char col_gray4[] = "#eeeeee";
|
static const char col_dark3[] = "#7f849c";
|
||||||
static const char col_cyan[] = "#005577";
|
static const char col_dark4[] = "#cdd6f4"; //text
|
||||||
static const char *colors[][3] = {
|
static const char col_lavender_dark[] = "#b4befe";
|
||||||
|
// Light colors
|
||||||
|
static const char col_light1[] = "#dce0e8";
|
||||||
|
static const char col_light2[] = "#bcc0cc";
|
||||||
|
static const char col_light3[] = "#8c8fa1";
|
||||||
|
static const char col_light4[] = "#4c4f69"; //text
|
||||||
|
static const char col_lavender_light[] = "#7287fd";
|
||||||
|
static const char *colorslight[][3] = {
|
||||||
/* fg bg border */
|
/* fg bg border */
|
||||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
[SchemeNorm] = { col_light3, col_light1, col_light2 },
|
||||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
[SchemeSel] = { col_light4, col_light2, col_lavender_light },
|
||||||
|
};
|
||||||
|
static const char *colorsdark[][3] = {
|
||||||
|
/* fg bg border */
|
||||||
|
[SchemeNorm] = { col_dark1, col_dark3, col_dark2 },
|
||||||
|
[SchemeSel] = { col_dark4, col_dark2, col_lavender_dark },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
@@ -27,8 +42,8 @@ static const Rule rules[] = {
|
|||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
*/
|
*/
|
||||||
/* class instance title tags mask isfloating monitor */
|
/* class instance title tags mask isfloating monitor */
|
||||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
{ "Terminal", NULL, NULL, 0, 1, -1 },
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
{ "Reader", NULL, NULL, 1 << 8, 0, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
@@ -36,6 +51,7 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95]
|
|||||||
static const int nmaster = 1; /* number of clients in master area */
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
|
static const int refreshrate = 60; /* refresh rate (per second) for client move/resize */
|
||||||
|
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
@@ -56,13 +72,14 @@ static const Layout layouts[] = {
|
|||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
static char dmenumon[2] = "0"; /* component of dmenu{dark,light}, manipulated in spawndmenu() */
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
static const char *dmenudark[] = { "dmenu_run", "-m", dmenumon, "-i", "-fn", dmenufont, "-nb", col_dark1, "-nf", col_dark3, "-sb", col_lavender_dark, "-sf", col_dark4, NULL };
|
||||||
|
static const char *dmenulight[] = { "dmenu_run", "-m", dmenumon, "-i", "-fn", dmenufont, "-nb", col_light1, "-nf", col_light3, "-sb", col_lavender_light, "-sf", col_light4, NULL };
|
||||||
static const char *termcmd[] = { "st", NULL };
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawndmenu, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||||
{ MODKEY, XK_b, togglebar, {0} },
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
|
||||||
|
#define FONT "FiraCodeNerdFont:size=11:antialias=true:autohint=true"
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 3; /* border pixel of 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 char *fonts[] = { FONT };
|
||||||
|
static const char dmenufont[] = FONT;
|
||||||
|
static const char col_gray1[] = "#1e1e2e";
|
||||||
|
static const char col_gray2[] = "#45475a";
|
||||||
|
static const char col_gray3[] = "#6c7086";
|
||||||
|
static const char col_gray4[] = "#a6adc8";
|
||||||
|
static const char col_lavender[] = "#b4befe";
|
||||||
|
static const char *colors[][3] = {
|
||||||
|
/* fg bg border */
|
||||||
|
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||||
|
[SchemeSel] = { col_gray1, col_lavender, col_lavender },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* tagging */
|
||||||
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
|
||||||
|
static const Rule rules[] = {
|
||||||
|
/* xprop(1):
|
||||||
|
* WM_CLASS(STRING) = instance, class
|
||||||
|
* WM_NAME(STRING) = title
|
||||||
|
*/
|
||||||
|
/* class instance title tags mask isfloating monitor */
|
||||||
|
{ "Terminal", NULL, NULL, 0, 1, -1 },
|
||||||
|
{ "Reader", NULL, NULL, 1 << 8, 0, -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
|
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
|
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
|
static const int refreshrate = 60; /* refresh rate (per second) for client move/resize */
|
||||||
|
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
#define MODKEY Mod1Mask
|
||||||
|
#define TAGKEYS(KEY,TAG) \
|
||||||
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||||
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||||
|
|
||||||
|
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||||
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
|
||||||
|
/* commands */
|
||||||
|
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||||
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_lavender, "-sf", col_gray4, NULL };
|
||||||
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
|
static const Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||||
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||||
|
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||||
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
TAGKEYS( XK_1, 0)
|
||||||
|
TAGKEYS( XK_2, 1)
|
||||||
|
TAGKEYS( XK_3, 2)
|
||||||
|
TAGKEYS( XK_4, 3)
|
||||||
|
TAGKEYS( XK_5, 4)
|
||||||
|
TAGKEYS( XK_6, 5)
|
||||||
|
TAGKEYS( XK_7, 6)
|
||||||
|
TAGKEYS( XK_8, 7)
|
||||||
|
TAGKEYS( XK_9, 8)
|
||||||
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* button definitions */
|
||||||
|
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||||
|
static const Button buttons[] = {
|
||||||
|
/* click event mask button function argument */
|
||||||
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||||
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
|
{ ClkTagBar, 0, Button1, view, {0} },
|
||||||
|
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 6.6
|
VERSION = 6.8
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr
|
||||||
MANPREFIX = ${PREFIX}/share/man
|
MANPREFIX = ${PREFIX}/share/man
|
||||||
|
|
||||||
X11INC = /usr/X11R6/include
|
X11INC = /usr/X11R6/include
|
||||||
|
|||||||
@@ -178,8 +178,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
|||||||
die("error, cannot allocate color '%s'", clrname);
|
die("error, cannot allocate color '%s'", clrname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
/* Create color schemes. */
|
||||||
* returned color scheme when done using it. */
|
|
||||||
Clr *
|
Clr *
|
||||||
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
||||||
{
|
{
|
||||||
@@ -187,7 +186,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
|||||||
Clr *ret;
|
Clr *ret;
|
||||||
|
|
||||||
/* need at least two colors for a scheme */
|
/* need at least two colors for a scheme */
|
||||||
if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor))))
|
if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(Clr))))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < clrcount; i++)
|
for (i = 0; i < clrcount; i++)
|
||||||
@@ -195,6 +194,30 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_clr_free(Drw *drw, Clr *c)
|
||||||
|
{
|
||||||
|
if (!drw || !c)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* c is typedef XftColor Clr */
|
||||||
|
XftColorFree(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
||||||
|
DefaultColormap(drw->dpy, drw->screen), c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_scm_free(Drw *drw, Clr *scm, size_t clrcount)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!drw || !scm)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < clrcount; i++)
|
||||||
|
drw_clr_free(drw, &scm[i]);
|
||||||
|
free(scm);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_setfontset(Drw *drw, Fnt *set)
|
drw_setfontset(Drw *drw, Fnt *set)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned in
|
|||||||
|
|
||||||
/* Colorscheme abstraction */
|
/* Colorscheme abstraction */
|
||||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
||||||
|
void drw_clr_free(Drw *drw, Clr *c);
|
||||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
||||||
|
void drw_scm_free(Drw *drw, Clr *scm, size_t clrcount);
|
||||||
|
|
||||||
/* Cursor abstraction */
|
/* Cursor abstraction */
|
||||||
Cur *drw_cur_create(Drw *drw, int shape);
|
Cur *drw_cur_create(Drw *drw, int shape);
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ static void checkotherwm(void);
|
|||||||
static void cleanup(void);
|
static void cleanup(void);
|
||||||
static void cleanupmon(Monitor *mon);
|
static void cleanupmon(Monitor *mon);
|
||||||
static void clientmessage(XEvent *e);
|
static void clientmessage(XEvent *e);
|
||||||
|
static void colormodehandler(int sig);
|
||||||
static void configure(Client *c);
|
static void configure(Client *c);
|
||||||
static void configurenotify(XEvent *e);
|
static void configurenotify(XEvent *e);
|
||||||
static void configurerequest(XEvent *e);
|
static void configurerequest(XEvent *e);
|
||||||
@@ -197,6 +198,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 setcolormode(void);
|
||||||
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 setlayout(const Arg *arg);
|
static void setlayout(const Arg *arg);
|
||||||
@@ -205,6 +207,7 @@ static void setup(void);
|
|||||||
static void seturgent(Client *c, int urg);
|
static void seturgent(Client *c, int urg);
|
||||||
static void showhide(Client *c);
|
static void showhide(Client *c);
|
||||||
static void spawn(const Arg *arg);
|
static void spawn(const Arg *arg);
|
||||||
|
static void spawndmenu(const Arg *arg);
|
||||||
static void tag(const Arg *arg);
|
static void tag(const Arg *arg);
|
||||||
static void tagmon(const Arg *arg);
|
static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *m);
|
static void tile(Monitor *m);
|
||||||
@@ -261,11 +264,13 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|||||||
static Atom wmatom[WMLast], netatom[NetLast];
|
static Atom wmatom[WMLast], netatom[NetLast];
|
||||||
static int running = 1;
|
static int running = 1;
|
||||||
static Cur *cursor[CurLast];
|
static Cur *cursor[CurLast];
|
||||||
static Clr **scheme;
|
static Clr **scheme, **schemedark, **schemelight;
|
||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
static Drw *drw;
|
static Drw *drw;
|
||||||
static Monitor *mons, *selmon;
|
static Monitor *mons, *selmon;
|
||||||
static Window root, wmcheckwin;
|
static Window root, wmcheckwin;
|
||||||
|
static const char **dmenucmd;
|
||||||
|
static int colormodechanged;
|
||||||
|
|
||||||
/* configuration, allows nested code to access above variables */
|
/* configuration, allows nested code to access above variables */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -440,7 +445,7 @@ buttonpress(XEvent *e)
|
|||||||
arg.ui = 1 << i;
|
arg.ui = 1 << i;
|
||||||
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
||||||
click = ClkLtSymbol;
|
click = ClkLtSymbol;
|
||||||
else if (ev->x > selmon->ww - (int)TEXTW(stext))
|
else if (ev->x > selmon->ww - (int)TEXTW(stext) + lrpad - 2)
|
||||||
click = ClkStatusText;
|
click = ClkStatusText;
|
||||||
else
|
else
|
||||||
click = ClkWinTitle;
|
click = ClkWinTitle;
|
||||||
@@ -485,9 +490,12 @@ cleanup(void)
|
|||||||
cleanupmon(mons);
|
cleanupmon(mons);
|
||||||
for (i = 0; i < CurLast; i++)
|
for (i = 0; i < CurLast; i++)
|
||||||
drw_cur_free(drw, cursor[i]);
|
drw_cur_free(drw, cursor[i]);
|
||||||
for (i = 0; i < LENGTH(colors); i++)
|
for (i = 0; i < LENGTH(colorsdark); i++) {
|
||||||
free(scheme[i]);
|
free(schemedark[i]);
|
||||||
free(scheme);
|
free(schemelight[i]);
|
||||||
|
}
|
||||||
|
free(schemedark);
|
||||||
|
free(schemelight);
|
||||||
XDestroyWindow(dpy, wmcheckwin);
|
XDestroyWindow(dpy, wmcheckwin);
|
||||||
drw_free(drw);
|
drw_free(drw);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
@@ -530,6 +538,12 @@ clientmessage(XEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
colormodehandler(int sig)
|
||||||
|
{
|
||||||
|
colormodechanged = 1;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
configure(Client *c)
|
configure(Client *c)
|
||||||
{
|
{
|
||||||
@@ -863,14 +877,15 @@ focusstack(const Arg *arg)
|
|||||||
Atom
|
Atom
|
||||||
getatomprop(Client *c, Atom prop)
|
getatomprop(Client *c, Atom prop)
|
||||||
{
|
{
|
||||||
int di;
|
int format;
|
||||||
unsigned long dl;
|
unsigned long nitems, dl;
|
||||||
unsigned char *p = NULL;
|
unsigned char *p = NULL;
|
||||||
Atom da, atom = None;
|
Atom da, atom = None;
|
||||||
|
|
||||||
if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
||||||
&da, &di, &dl, &dl, &p) == Success && p) {
|
&da, &format, &nitems, &dl, &p) == Success && p) {
|
||||||
atom = *(Atom *)p;
|
if (nitems > 0 && format == 32)
|
||||||
|
atom = *(long *)p;
|
||||||
XFree(p);
|
XFree(p);
|
||||||
}
|
}
|
||||||
return atom;
|
return atom;
|
||||||
@@ -896,10 +911,10 @@ getstate(Window w)
|
|||||||
Atom real;
|
Atom real;
|
||||||
|
|
||||||
if (XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState],
|
if (XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState],
|
||||||
&real, &format, &n, &extra, (unsigned char **)&p) != Success)
|
&real, &format, &n, &extra, &p) != Success)
|
||||||
return -1;
|
return -1;
|
||||||
if (n != 0)
|
if (n != 0 && format == 32)
|
||||||
result = *p;
|
result = *(long *)p;
|
||||||
XFree(p);
|
XFree(p);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1171,7 +1186,7 @@ movemouse(const Arg *arg)
|
|||||||
handler[ev.type](&ev);
|
handler[ev.type](&ev);
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
if ((ev.xmotion.time - lasttime) <= (1000 / 60))
|
if ((ev.xmotion.time - lasttime) <= (1000 / refreshrate))
|
||||||
continue;
|
continue;
|
||||||
lasttime = ev.xmotion.time;
|
lasttime = ev.xmotion.time;
|
||||||
|
|
||||||
@@ -1224,6 +1239,10 @@ propertynotify(XEvent *e)
|
|||||||
Window trans;
|
Window trans;
|
||||||
XPropertyEvent *ev = &e->xproperty;
|
XPropertyEvent *ev = &e->xproperty;
|
||||||
|
|
||||||
|
if (colormodechanged) {
|
||||||
|
setcolormode();
|
||||||
|
colormodechanged = 0;
|
||||||
|
}
|
||||||
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
|
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
|
||||||
updatestatus();
|
updatestatus();
|
||||||
else if (ev->state == PropertyDelete)
|
else if (ev->state == PropertyDelete)
|
||||||
@@ -1325,7 +1344,7 @@ resizemouse(const Arg *arg)
|
|||||||
handler[ev.type](&ev);
|
handler[ev.type](&ev);
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
if ((ev.xmotion.time - lasttime) <= (1000 / 60))
|
if ((ev.xmotion.time - lasttime) <= (1000 / refreshrate))
|
||||||
continue;
|
continue;
|
||||||
lasttime = ev.xmotion.time;
|
lasttime = ev.xmotion.time;
|
||||||
|
|
||||||
@@ -1428,6 +1447,8 @@ 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 */
|
||||||
attach(c);
|
attach(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
|
if (c->isfullscreen)
|
||||||
|
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
@@ -1441,6 +1462,32 @@ setclientstate(Client *c, long state)
|
|||||||
PropModeReplace, (unsigned char *)data, 2);
|
PropModeReplace, (unsigned char *)data, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setcolormode(void)
|
||||||
|
{
|
||||||
|
static const char *file = ".lightmode";
|
||||||
|
static char *path = NULL;
|
||||||
|
const char *home;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
if (!path && (home = getenv("HOME"))) {
|
||||||
|
size = strlen(home) + 1 + strlen(file) + 1;
|
||||||
|
path = malloc(size);
|
||||||
|
if (!path)
|
||||||
|
die("dwm: malloc failed");
|
||||||
|
|
||||||
|
snprintf(path, size, "%s/%s", home, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access(path, F_OK) == 0) {
|
||||||
|
scheme = schemelight;
|
||||||
|
dmenucmd = dmenulight;
|
||||||
|
} else {
|
||||||
|
scheme = schemedark;
|
||||||
|
dmenucmd = dmenudark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
sendevent(Client *c, Atom proto)
|
sendevent(Client *c, Atom proto)
|
||||||
{
|
{
|
||||||
@@ -1469,12 +1516,10 @@ sendevent(Client *c, Atom proto)
|
|||||||
void
|
void
|
||||||
setfocus(Client *c)
|
setfocus(Client *c)
|
||||||
{
|
{
|
||||||
if (!c->neverfocus) {
|
if (!c->neverfocus)
|
||||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||||
XChangeProperty(dpy, root, netatom[NetActiveWindow],
|
XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32,
|
||||||
XA_WINDOW, 32, PropModeReplace,
|
PropModeReplace, (unsigned char *)&c->win, 1);
|
||||||
(unsigned char *) &(c->win), 1);
|
|
||||||
}
|
|
||||||
sendevent(c, wmatom[WMTakeFocus]);
|
sendevent(c, wmatom[WMTakeFocus]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1549,6 +1594,11 @@ setup(void)
|
|||||||
sa.sa_handler = SIG_IGN;
|
sa.sa_handler = SIG_IGN;
|
||||||
sigaction(SIGCHLD, &sa, NULL);
|
sigaction(SIGCHLD, &sa, NULL);
|
||||||
|
|
||||||
|
/* set color mode on SIGHUP */
|
||||||
|
sigemptyset(&sa.sa_mask);
|
||||||
|
sa.sa_handler = colormodehandler;
|
||||||
|
sigaction(SIGHUP, &sa, NULL);
|
||||||
|
|
||||||
/* clean up any zombies (inherited from .xinitrc etc) immediately */
|
/* clean up any zombies (inherited from .xinitrc etc) immediately */
|
||||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||||
|
|
||||||
@@ -1583,9 +1633,13 @@ setup(void)
|
|||||||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||||
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
||||||
/* init appearance */
|
/* init appearance */
|
||||||
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
schemedark = ecalloc(LENGTH(colorsdark), sizeof(Clr *));
|
||||||
for (i = 0; i < LENGTH(colors); i++)
|
schemelight = ecalloc(LENGTH(colorslight), sizeof(Clr *));
|
||||||
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
for (i = 0; i < LENGTH(colorsdark); i++) {
|
||||||
|
schemedark[i] = drw_scm_create(drw, colorsdark[i], 3);
|
||||||
|
schemelight[i] = drw_scm_create(drw, colorslight[i], 3);
|
||||||
|
}
|
||||||
|
setcolormode();
|
||||||
/* init bars */
|
/* init bars */
|
||||||
updatebars();
|
updatebars();
|
||||||
updatestatus();
|
updatestatus();
|
||||||
@@ -1648,8 +1702,6 @@ spawn(const Arg *arg)
|
|||||||
{
|
{
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
if (arg->v == dmenucmd)
|
|
||||||
dmenumon[0] = '0' + selmon->num;
|
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
if (dpy)
|
if (dpy)
|
||||||
close(ConnectionNumber(dpy));
|
close(ConnectionNumber(dpy));
|
||||||
@@ -1665,6 +1717,13 @@ spawn(const Arg *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spawndmenu(const Arg *arg)
|
||||||
|
{
|
||||||
|
dmenumon[0] = '0' + selmon->num;
|
||||||
|
spawn(&(const Arg){.v = dmenucmd});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tag(const Arg *arg)
|
tag(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user