mirror of
https://github.com/pikami/dwm.git
synced 2026-06-14 16:27:26 +01:00
Compare commits
5 Commits
alpha
..
pikami-6.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 17a652ebec | |||
| 93d5de8248 | |||
| 926d23911c | |||
| db085c674b | |||
| 54db675f10 |
+4
-10
@@ -17,18 +17,11 @@ static const char col_gray2[] = "#444444";
|
|||||||
static const char col_gray3[] = "#bbbbbb";
|
static const char col_gray3[] = "#bbbbbb";
|
||||||
static const char col_gray4[] = "#eeeeee";
|
static const char col_gray4[] = "#eeeeee";
|
||||||
static const char col_cyan[] = "#005577";
|
static const char col_cyan[] = "#005577";
|
||||||
static const unsigned int baralpha = 0xd0;
|
|
||||||
static const unsigned int borderalpha = OPAQUE;
|
|
||||||
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_gray4, col_cyan, col_cyan },
|
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||||
};
|
};
|
||||||
static const unsigned int alphas[][3] = {
|
|
||||||
/* fg bg border */
|
|
||||||
[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
|
|
||||||
[SchemeSel] = { OPAQUE, baralpha, borderalpha },
|
|
||||||
};
|
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
@@ -38,9 +31,9 @@ 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 monitor */
|
/* class instance title tags mask isfloating isfakefullscreen monitor */
|
||||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
{ "Gimp", NULL, NULL, 0, 1, 0, -1 },
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
@@ -111,6 +104,7 @@ static Key keys[] = {
|
|||||||
TAGKEYS( XK_8, 7)
|
TAGKEYS( XK_8, 7)
|
||||||
TAGKEYS( XK_9, 8)
|
TAGKEYS( XK_9, 8)
|
||||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
{ MODKEY, XK_F11, togglefakefullscreen, {0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* button definitions */
|
/* button definitions */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 2; /* border pixel of windows */
|
static const unsigned int borderpx = 2; /* border pixel of windows */
|
||||||
static const unsigned int gappx = 4; /* gaps between windows */
|
static const unsigned int gappx = 2; /* gaps between 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 = 2; /* systray spacing */
|
static const unsigned int systrayspacing = 2; /* systray spacing */
|
||||||
@@ -10,37 +10,30 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display
|
|||||||
static const int showsystray = 1; /* 0 means no systray */
|
static const int showsystray = 1; /* 0 means no systray */
|
||||||
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[] = { "Noto Sans:size=9", "Noto Color Emoji:size=9", "fontawesome:size=9" };
|
static const char *fonts[] = { "Consolas:size=12" };
|
||||||
static const char dmenufont[] = "Noto Sans:size=9";
|
static const char dmenufont[] = "Consolas:size=12";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char col_gray1[] = "#2C2C2C";
|
||||||
static const char col_gray2[] = "#444444";
|
static const char col_gray2[] = "#444444";
|
||||||
static const char col_gray3[] = "#bbbbbb";
|
static const char col_gray3[] = "#DCDCDC";
|
||||||
static const char col_gray4[] = "#eeeeee";
|
static const char col_gray4[] = "#DCDCDC";
|
||||||
static const char col_cyan[] = "#005577";
|
static const char col_cyan[] = "#60B48A";
|
||||||
static const unsigned int baralpha = 0xd0;
|
|
||||||
static const unsigned int borderalpha = OPAQUE;
|
|
||||||
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_gray4, col_cyan, col_cyan },
|
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||||
};
|
};
|
||||||
static const unsigned int alphas[][3] = {
|
|
||||||
/* fg bg border */
|
|
||||||
[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
|
|
||||||
[SchemeSel] = { OPAQUE, baralpha, borderalpha },
|
|
||||||
};
|
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
static const char *tags[] = { "1", "2", "3", "4" };
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
/* xprop(1):
|
/* xprop(1):
|
||||||
* WM_CLASS(STRING) = instance, class
|
* WM_CLASS(STRING) = instance, class
|
||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
*/
|
*/
|
||||||
/* class instance title tags mask isfloating monitor */
|
/* class instance title tags mask isfloating isfakefullscreen monitor */
|
||||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
{ "Gimp", NULL, NULL, 0, 1, 0, -1 },
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
@@ -60,6 +53,7 @@ static const Layout layouts[] = {
|
|||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
|
#define SUPERKEY Mod4Mask
|
||||||
#define TAGKEYS(KEY,TAG) \
|
#define TAGKEYS(KEY,TAG) \
|
||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
@@ -72,12 +66,20 @@ 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", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
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 *termcmd[] = { "st", NULL };
|
static const char *termcmd[] = { "xfce4-terminal", NULL };
|
||||||
|
static const char *slockcmd[] = { "slock", NULL };
|
||||||
|
|
||||||
|
/* shell commands */
|
||||||
|
static const char maimselcmd[] = "maim -s ~/Pictures/screen-sel-$(date '+%y%m%d-%H%M-%S').png";
|
||||||
|
static const char maimfullcmd[] = "maim ~/Pictures/screen-full-$(date '+%y%m%d-%H%M-%S').png";
|
||||||
|
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||||
|
{ SUPERKEY, XK_l, spawn, {.v = slockcmd } },
|
||||||
|
{ SUPERKEY|ShiftMask, XK_s, spawn, SHCMD(maimselcmd) },
|
||||||
|
{ 0, XK_Print, spawn, SHCMD(maimfullcmd) },
|
||||||
{ MODKEY, XK_b, togglebar, {0} },
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
@@ -111,6 +113,7 @@ static Key keys[] = {
|
|||||||
TAGKEYS( XK_8, 7)
|
TAGKEYS( XK_8, 7)
|
||||||
TAGKEYS( XK_9, 8)
|
TAGKEYS( XK_9, 8)
|
||||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
{ MODKEY, XK_F11, togglefakefullscreen, {0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* button definitions */
|
/* button definitions */
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
|
|||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
|
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Drw *
|
Drw *
|
||||||
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
|
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
|
||||||
{
|
{
|
||||||
Drw *drw = ecalloc(1, sizeof(Drw));
|
Drw *drw = ecalloc(1, sizeof(Drw));
|
||||||
|
|
||||||
@@ -70,11 +70,8 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
|
|||||||
drw->root = root;
|
drw->root = root;
|
||||||
drw->w = w;
|
drw->w = w;
|
||||||
drw->h = h;
|
drw->h = h;
|
||||||
drw->visual = visual;
|
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
||||||
drw->depth = depth;
|
drw->gc = XCreateGC(dpy, root, 0, NULL);
|
||||||
drw->cmap = cmap;
|
|
||||||
drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
|
|
||||||
drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
|
|
||||||
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
|
||||||
return drw;
|
return drw;
|
||||||
@@ -90,7 +87,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
|||||||
drw->h = h;
|
drw->h = h;
|
||||||
if (drw->drawable)
|
if (drw->drawable)
|
||||||
XFreePixmap(drw->dpy, drw->drawable);
|
XFreePixmap(drw->dpy, drw->drawable);
|
||||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
|
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -197,22 +194,21 @@ drw_fontset_free(Fnt *font)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
|
drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
||||||
{
|
{
|
||||||
if (!drw || !dest || !clrname)
|
if (!drw || !dest || !clrname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
|
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
||||||
|
DefaultColormap(drw->dpy, drw->screen),
|
||||||
clrname, dest))
|
clrname, dest))
|
||||||
die("error, cannot allocate color '%s'", clrname);
|
die("error, cannot allocate color '%s'", clrname);
|
||||||
|
|
||||||
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||||
* returned color scheme when done using it. */
|
* returned color scheme when done using it. */
|
||||||
Clr *
|
Clr *
|
||||||
drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
|
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
Clr *ret;
|
Clr *ret;
|
||||||
@@ -222,7 +218,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], si
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < clrcount; i++)
|
for (i = 0; i < clrcount; i++)
|
||||||
drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
|
drw_clr_create(drw, &ret[i], clrnames[i]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +274,9 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||||||
} else {
|
} else {
|
||||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||||
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
|
d = XftDrawCreate(drw->dpy, drw->drawable,
|
||||||
|
DefaultVisual(drw->dpy, drw->screen),
|
||||||
|
DefaultColormap(drw->dpy, drw->screen));
|
||||||
x += lpad;
|
x += lpad;
|
||||||
w -= lpad;
|
w -= lpad;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ typedef struct {
|
|||||||
Display *dpy;
|
Display *dpy;
|
||||||
int screen;
|
int screen;
|
||||||
Window root;
|
Window root;
|
||||||
Visual *visual;
|
|
||||||
unsigned int depth;
|
|
||||||
Colormap cmap;
|
|
||||||
Drawable drawable;
|
Drawable drawable;
|
||||||
GC gc;
|
GC gc;
|
||||||
Clr *scheme;
|
Clr *scheme;
|
||||||
@@ -30,7 +27,7 @@ typedef struct {
|
|||||||
} Drw;
|
} Drw;
|
||||||
|
|
||||||
/* Drawable abstraction */
|
/* Drawable abstraction */
|
||||||
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
|
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
|
||||||
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
|
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
|
||||||
void drw_free(Drw *drw);
|
void drw_free(Drw *drw);
|
||||||
|
|
||||||
@@ -41,8 +38,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
|
|||||||
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
|
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
|
||||||
|
|
||||||
/* Colorscheme abstraction */
|
/* Colorscheme abstraction */
|
||||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
|
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
||||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
|
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
||||||
|
|
||||||
/* Cursor abstraction */
|
/* Cursor abstraction */
|
||||||
Cur *drw_cur_create(Drw *drw, int shape);
|
Cur *drw_cur_create(Drw *drw, int shape);
|
||||||
|
|||||||
@@ -56,7 +56,6 @@
|
|||||||
#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
|
#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
|
||||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||||
#define OPAQUE 0xffU
|
|
||||||
|
|
||||||
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ struct Client {
|
|||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
int bw, oldbw;
|
int bw, oldbw;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen;
|
||||||
Client *next;
|
Client *next;
|
||||||
Client *snext;
|
Client *snext;
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
@@ -157,6 +156,7 @@ typedef struct {
|
|||||||
const char *title;
|
const char *title;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
int isfloating;
|
int isfloating;
|
||||||
|
int isfakefullscreen;
|
||||||
int monitor;
|
int monitor;
|
||||||
} Rule;
|
} Rule;
|
||||||
|
|
||||||
@@ -242,6 +242,7 @@ static void tag(const Arg *arg);
|
|||||||
static void tagmon(const Arg *arg);
|
static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *);
|
static void tile(Monitor *);
|
||||||
static void togglebar(const Arg *arg);
|
static void togglebar(const Arg *arg);
|
||||||
|
static void togglefakefullscreen(const Arg *arg);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
static void toggletag(const Arg *arg);
|
static void toggletag(const Arg *arg);
|
||||||
static void toggleview(const Arg *arg);
|
static void toggleview(const Arg *arg);
|
||||||
@@ -268,7 +269,6 @@ static Client *wintosystrayicon(Window w);
|
|||||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
static void xinitvisual();
|
|
||||||
static void zoom(const Arg *arg);
|
static void zoom(const Arg *arg);
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
@@ -307,11 +307,6 @@ static Drw *drw;
|
|||||||
static Monitor *mons, *selmon;
|
static Monitor *mons, *selmon;
|
||||||
static Window root, wmcheckwin;
|
static Window root, wmcheckwin;
|
||||||
|
|
||||||
static int useargb = 0;
|
|
||||||
static Visual *visual;
|
|
||||||
static int depth;
|
|
||||||
static Colormap cmap;
|
|
||||||
|
|
||||||
/* configuration, allows nested code to access above variables */
|
/* configuration, allows nested code to access above variables */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@@ -342,6 +337,7 @@ applyrules(Client *c)
|
|||||||
&& (!r->instance || strstr(instance, r->instance)))
|
&& (!r->instance || strstr(instance, r->instance)))
|
||||||
{
|
{
|
||||||
c->isfloating = r->isfloating;
|
c->isfloating = r->isfloating;
|
||||||
|
c->isfakefullscreen = r->isfakefullscreen;
|
||||||
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);
|
||||||
if (m)
|
if (m)
|
||||||
@@ -618,7 +614,10 @@ clientmessage(XEvent *e)
|
|||||||
if (cme->data.l[1] == netatom[NetWMFullscreen]
|
if (cme->data.l[1] == netatom[NetWMFullscreen]
|
||||||
|| cme->data.l[2] == netatom[NetWMFullscreen])
|
|| cme->data.l[2] == netatom[NetWMFullscreen])
|
||||||
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|
||||||
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
|
// || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
|
||||||
|
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */
|
||||||
|
&& (!c->isfullscreen || c->isfakefullscreen))));
|
||||||
|
|
||||||
} else if (cme->message_type == netatom[NetActiveWindow]) {
|
} else if (cme->message_type == netatom[NetActiveWindow]) {
|
||||||
if (c != selmon->sel && !c->isurgent)
|
if (c != selmon->sel && !c->isurgent)
|
||||||
seturgent(c, 1);
|
seturgent(c, 1);
|
||||||
@@ -662,7 +661,7 @@ configurenotify(XEvent *e)
|
|||||||
updatebars();
|
updatebars();
|
||||||
for (m = mons; m; m = m->next) {
|
for (m = mons; m; m = m->next) {
|
||||||
for (c = m->clients; c; c = c->next)
|
for (c = m->clients; c; c = c->next)
|
||||||
if (c->isfullscreen)
|
if (c->isfullscreen && !c->isfakefullscreen)
|
||||||
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||||
resizebarwin(m);
|
resizebarwin(m);
|
||||||
}
|
}
|
||||||
@@ -1275,7 +1274,7 @@ movemouse(const Arg *arg)
|
|||||||
|
|
||||||
if (!(c = selmon->sel))
|
if (!(c = selmon->sel))
|
||||||
return;
|
return;
|
||||||
if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
|
if (c->isfullscreen && !c->isfakefullscreen) /* no support moving fullscreen windows by mouse */
|
||||||
return;
|
return;
|
||||||
restack(selmon);
|
restack(selmon);
|
||||||
ocx = c->x;
|
ocx = c->x;
|
||||||
@@ -1486,7 +1485,7 @@ resizemouse(const Arg *arg)
|
|||||||
|
|
||||||
if (!(c = selmon->sel))
|
if (!(c = selmon->sel))
|
||||||
return;
|
return;
|
||||||
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
if (c->isfullscreen && !c->isfakefullscreen) /* no support resizing fullscreen windows by mouse */
|
||||||
return;
|
return;
|
||||||
restack(selmon);
|
restack(selmon);
|
||||||
ocx = c->x;
|
ocx = c->x;
|
||||||
@@ -1693,6 +1692,8 @@ setfullscreen(Client *c, int fullscreen)
|
|||||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||||
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
|
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
|
||||||
c->isfullscreen = 1;
|
c->isfullscreen = 1;
|
||||||
|
if (c->isfakefullscreen)
|
||||||
|
return;
|
||||||
c->oldstate = c->isfloating;
|
c->oldstate = c->isfloating;
|
||||||
c->oldbw = c->bw;
|
c->oldbw = c->bw;
|
||||||
c->bw = 0;
|
c->bw = 0;
|
||||||
@@ -1703,6 +1704,8 @@ setfullscreen(Client *c, int fullscreen)
|
|||||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||||
PropModeReplace, (unsigned char*)0, 0);
|
PropModeReplace, (unsigned char*)0, 0);
|
||||||
c->isfullscreen = 0;
|
c->isfullscreen = 0;
|
||||||
|
if (c->isfakefullscreen)
|
||||||
|
return;
|
||||||
c->isfloating = c->oldstate;
|
c->isfloating = c->oldstate;
|
||||||
c->bw = c->oldbw;
|
c->bw = c->oldbw;
|
||||||
c->x = c->oldx;
|
c->x = c->oldx;
|
||||||
@@ -1758,8 +1761,7 @@ setup(void)
|
|||||||
sw = DisplayWidth(dpy, screen);
|
sw = DisplayWidth(dpy, screen);
|
||||||
sh = DisplayHeight(dpy, screen);
|
sh = DisplayHeight(dpy, screen);
|
||||||
root = RootWindow(dpy, screen);
|
root = RootWindow(dpy, screen);
|
||||||
xinitvisual();
|
drw = drw_create(dpy, screen, root, sw, sh);
|
||||||
drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
|
|
||||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||||
die("no fonts could be loaded.");
|
die("no fonts could be loaded.");
|
||||||
lrpad = drw->fonts->h;
|
lrpad = drw->fonts->h;
|
||||||
@@ -1794,7 +1796,7 @@ setup(void)
|
|||||||
/* init appearance */
|
/* init appearance */
|
||||||
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
||||||
for (i = 0; i < LENGTH(colors); i++)
|
for (i = 0; i < LENGTH(colors); i++)
|
||||||
scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
|
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
||||||
/* init system tray */
|
/* init system tray */
|
||||||
updatesystray();
|
updatesystray();
|
||||||
/* init bars */
|
/* init bars */
|
||||||
@@ -1845,7 +1847,8 @@ showhide(Client *c)
|
|||||||
if (ISVISIBLE(c)) {
|
if (ISVISIBLE(c)) {
|
||||||
/* show clients top down */
|
/* show clients top down */
|
||||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||||
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
|
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating)
|
||||||
|
&& (!c->isfullscreen || c->isfakefullscreen))
|
||||||
resize(c, c->x, c->y, c->w, c->h, 0);
|
resize(c, c->x, c->y, c->w, c->h, 0);
|
||||||
showhide(c->snext);
|
showhide(c->snext);
|
||||||
} else {
|
} else {
|
||||||
@@ -1945,12 +1948,22 @@ togglebar(const Arg *arg)
|
|||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
togglefakefullscreen(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (!selmon->sel)
|
||||||
|
return;
|
||||||
|
selmon->sel->isfakefullscreen = !selmon->sel->isfakefullscreen;
|
||||||
|
selmon->sel->isfloating = False;
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
togglefloating(const Arg *arg)
|
togglefloating(const Arg *arg)
|
||||||
{
|
{
|
||||||
if (!selmon->sel)
|
if (!selmon->sel)
|
||||||
return;
|
return;
|
||||||
if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
|
if (selmon->sel->isfullscreen && !selmon->sel->isfakefullscreen) /* no support for fullscreen windows */
|
||||||
return;
|
return;
|
||||||
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
|
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
|
||||||
if (selmon->sel->isfloating)
|
if (selmon->sel->isfloating)
|
||||||
@@ -2051,9 +2064,7 @@ updatebars(void)
|
|||||||
Monitor *m;
|
Monitor *m;
|
||||||
XSetWindowAttributes wa = {
|
XSetWindowAttributes wa = {
|
||||||
.override_redirect = True,
|
.override_redirect = True,
|
||||||
.background_pixel = 0,
|
.background_pixmap = ParentRelative,
|
||||||
.border_pixel = 0,
|
|
||||||
.colormap = cmap,
|
|
||||||
.event_mask = ButtonPressMask|ExposureMask
|
.event_mask = ButtonPressMask|ExposureMask
|
||||||
};
|
};
|
||||||
XClassHint ch = {"dwm", "dwm"};
|
XClassHint ch = {"dwm", "dwm"};
|
||||||
@@ -2063,9 +2074,9 @@ updatebars(void)
|
|||||||
w = m->ww;
|
w = m->ww;
|
||||||
if (showsystray && m == systraytomon(m))
|
if (showsystray && m == systraytomon(m))
|
||||||
w -= getsystraywidth();
|
w -= getsystraywidth();
|
||||||
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, depth,
|
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
|
||||||
InputOutput, visual,
|
CopyFromParent, DefaultVisual(dpy, screen),
|
||||||
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
||||||
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||||
if (showsystray && m == systraytomon(m))
|
if (showsystray && m == systraytomon(m))
|
||||||
XMapRaised(dpy, systray->win);
|
XMapRaised(dpy, systray->win);
|
||||||
@@ -2357,7 +2368,7 @@ updatesystray(void)
|
|||||||
XMapSubwindows(dpy, systray->win);
|
XMapSubwindows(dpy, systray->win);
|
||||||
/* redraw background */
|
/* redraw background */
|
||||||
XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
|
XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
|
||||||
XFillRectangle(dpy, systray->win, XCreateGC(dpy, root, 0, NULL), 0, 0, w, bh);
|
XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2505,43 +2516,6 @@ systraytomon(Monitor *m) {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
xinitvisual()
|
|
||||||
{
|
|
||||||
XVisualInfo *infos;
|
|
||||||
XRenderPictFormat *fmt;
|
|
||||||
int nitems;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
XVisualInfo tpl = {
|
|
||||||
.screen = screen,
|
|
||||||
.depth = 32,
|
|
||||||
.class = TrueColor
|
|
||||||
};
|
|
||||||
long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
|
|
||||||
|
|
||||||
infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
|
|
||||||
visual = NULL;
|
|
||||||
for(i = 0; i < nitems; i ++) {
|
|
||||||
fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
|
|
||||||
if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
|
|
||||||
visual = infos[i].visual;
|
|
||||||
depth = infos[i].depth;
|
|
||||||
cmap = XCreateColormap(dpy, root, visual, AllocNone);
|
|
||||||
useargb = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XFree(infos);
|
|
||||||
|
|
||||||
if (! visual) {
|
|
||||||
visual = DefaultVisual(dpy, screen);
|
|
||||||
depth = DefaultDepth(dpy, screen);
|
|
||||||
cmap = DefaultColormap(dpy, screen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
zoom(const Arg *arg)
|
zoom(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user