Dotfiles config update (2022-11-20)
This commit is contained in:
parent
315fdc4187
commit
42449f91ab
|
@ -17,6 +17,7 @@ MIT/X Consortium License
|
||||||
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
||||||
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
||||||
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
|
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
|
||||||
|
© 2020-2022 Chris Down <chris@chrisdown.name>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
48
.config/dwm/README
Normal file
48
.config/dwm/README
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
dwm - dynamic window manager
|
||||||
|
============================
|
||||||
|
dwm is an extremely fast, small, and dynamic window manager for X.
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
In order to build dwm you need the Xlib header files.
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
Edit config.mk to match your local setup (dwm is installed into
|
||||||
|
the /usr/local namespace by default).
|
||||||
|
|
||||||
|
Afterwards enter the following command to build and install dwm (if
|
||||||
|
necessary as root):
|
||||||
|
|
||||||
|
make clean install
|
||||||
|
|
||||||
|
|
||||||
|
Running dwm
|
||||||
|
-----------
|
||||||
|
Add the following line to your .xinitrc to start dwm using startx:
|
||||||
|
|
||||||
|
exec dwm
|
||||||
|
|
||||||
|
In order to connect dwm to a specific display, make sure that
|
||||||
|
the DISPLAY environment variable is set correctly, e.g.:
|
||||||
|
|
||||||
|
DISPLAY=foo.bar:1 exec dwm
|
||||||
|
|
||||||
|
(This will start dwm on display :1 of the host foo.bar.)
|
||||||
|
|
||||||
|
In order to display status info in the bar, you can do something
|
||||||
|
like this in your .xinitrc:
|
||||||
|
|
||||||
|
while xsetroot -name "`date` `uptime | sed 's/.*,//'`"
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
done &
|
||||||
|
exec dwm
|
||||||
|
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
The configuration of dwm is done by creating a custom config.h
|
||||||
|
and (re)compiling the source code.
|
240
.config/dwm/config.h.dmenu-version
Normal file
240
.config/dwm/config.h.dmenu-version
Normal file
|
@ -0,0 +1,240 @@
|
||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const unsigned int gappx = 6; /* gaps between windows */
|
||||||
|
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 systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
|
||||||
|
static const unsigned int systrayspacing = 2; /* systray spacing */
|
||||||
|
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
|
||||||
|
static const int showsystray = 1; /* 0 means no systray */
|
||||||
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
static const char *fonts[] = { "UbuntuMono Nerd Font:size=12" };
|
||||||
|
static const char dmenufont[] = "UbuntuMono Nerd Font:size=12";
|
||||||
|
//static const char col_gray1[] = "#222222"; // Default grey
|
||||||
|
//static const char col_gray1[] = "#2b303b"; // Grey Light
|
||||||
|
//static const char col_gray1[] = "#292d3e"; // Dracula Theme
|
||||||
|
static const char col_gray1[] = "#1f1f35"; // Blue dark
|
||||||
|
static const char col_gray2[] = "#444444";
|
||||||
|
static const char col_gray3[] = "#bbbbbb";
|
||||||
|
static const char col_gray4[] = "#eeeeee";
|
||||||
|
//static const char col_cyan[] = "#005577"; // Cyan
|
||||||
|
//static const char col_cyan[] = "#9341b0"; // Purple
|
||||||
|
static const char col_cyan[] = "#664477"; // Purple Light
|
||||||
|
static const char *colors[][3] = {
|
||||||
|
/* fg bg border */
|
||||||
|
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||||
|
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* tagging */
|
||||||
|
static const char *tags[] = { "term", "www", "chat", "files", "media", "game", "mail", "dev", "vm" };
|
||||||
|
|
||||||
|
static const Rule rules[] = {
|
||||||
|
/* xprop(1):
|
||||||
|
* WM_CLASS(STRING) = instance, class
|
||||||
|
* WM_NAME(STRING) = title
|
||||||
|
*/
|
||||||
|
/* class instance title tags mask isfloating monitor */
|
||||||
|
{ "mpv", NULL, NULL, 0, 1, -1 },
|
||||||
|
{ "Ristrettoy", NULL, NULL, 0, 1, -1 },
|
||||||
|
{ "VLC", NULL, NULL, 0, 1, -1 },
|
||||||
|
//{ "Firefox", 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 = 0; /* 1 means respect size hints in tiled resizals */
|
||||||
|
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
|
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
/* symbol arrange function */
|
||||||
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
//{ "[F]", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ NULL, NULL },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
#define MODKEY Mod4Mask
|
||||||
|
#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[] = { "rofi", "-show", "drun", NULL };
|
||||||
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
|
#include <X11/XF86keysym.h>
|
||||||
|
static Key keys[] = {
|
||||||
|
|
||||||
|
// ------------------ Windows ------------------
|
||||||
|
|
||||||
|
// Switch between windows
|
||||||
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
|
|
||||||
|
// Change window sizes
|
||||||
|
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_i, incnmaster, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.05} },
|
||||||
|
{ MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
|
||||||
|
// Toggle floating
|
||||||
|
{ MODKEY|ShiftMask, XK_f, togglefloating, {0} },
|
||||||
|
|
||||||
|
// Toggle bar
|
||||||
|
{ MODKEY|ShiftMask, XK_b, togglebar, {0} },
|
||||||
|
|
||||||
|
// Move windows in current stack
|
||||||
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
|
|
||||||
|
// Cycle layouts
|
||||||
|
{ MODKEY, XK_Tab, cyclelayout, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_Tab, cyclelayout, {.i = -1 } },
|
||||||
|
|
||||||
|
// Increase - decrease gaps
|
||||||
|
{ MODKEY, XK_g, setgaps, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_g, setgaps, {.i = +1 } },
|
||||||
|
|
||||||
|
// Focus next - prev monitor
|
||||||
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
|
||||||
|
// Send window to next - prev monitor
|
||||||
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
|
||||||
|
// Kill window
|
||||||
|
{ MODKEY|ShiftMask, XK_q, killclient, {0} },
|
||||||
|
|
||||||
|
// Restart dwm
|
||||||
|
{ MODKEY|ControlMask, XK_r, quit, {1} },
|
||||||
|
|
||||||
|
// Quit dwm
|
||||||
|
//{ MODKEY|ControlMask, XK_q, quit, {0} },
|
||||||
|
|
||||||
|
// ---------------- Workspaces -----------------
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
// ------------------- Apps --------------------
|
||||||
|
|
||||||
|
// dmenu
|
||||||
|
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = dmenucmd } },
|
||||||
|
|
||||||
|
{ MODKEY, XK_o, spawn, SHCMD("/usr/bin/dmenu_drun") },
|
||||||
|
{ MODKEY, XK_p, spawn, SHCMD("/usr/bin/dmenu_run") },
|
||||||
|
{ MODKEY|ShiftMask, XK_w, spawn, SHCMD("rofi -show") },
|
||||||
|
{ MODKEY|ShiftMask, XK_e, spawn, SHCMD("/usr/bin/dmenu_close") },
|
||||||
|
{ MODKEY|ControlMask, XK_q, spawn, SHCMD("/usr/bin/dmenu_close") },
|
||||||
|
{ MODKEY, XK_w, spawn, SHCMD("/usr/bin/dmenu_wrun") },
|
||||||
|
{ MODKEY|ShiftMask, XK_p, spawn, SHCMD("/usr/bin/dmenu_protonvpn") },
|
||||||
|
{ MODKEY, XK_Return, spawn, SHCMD("st") },
|
||||||
|
{ MODKEY, XK_n, spawn, SHCMD("pcmanfm") },
|
||||||
|
{ MODKEY, XK_f, spawn, SHCMD("/usr/bin/dmenu_fbrun") },
|
||||||
|
{ MODKEY, XK_b, spawn, SHCMD("firefox") },
|
||||||
|
{ MODKEY, XK_e, spawn, SHCMD("geany") },
|
||||||
|
{ MODKEY, XK_m, spawn, SHCMD("telegram") },
|
||||||
|
{ MODKEY, XK_z, spawn, SHCMD("nitrogen") },
|
||||||
|
{ MODKEY, XK_u, spawn, SHCMD("xterm") },
|
||||||
|
{ MODKEY|ShiftMask, XK_t, spawn, SHCMD("rofi-theme-selector") },
|
||||||
|
{ MODKEY, XK_t, spawn, SHCMD("/usr/bin/dmenu_themes") },
|
||||||
|
{ MODKEY, XK_c, spawn, SHCMD("/usr/bin/dmenu_cmd") },
|
||||||
|
{ MODKEY, XK_a, spawn, SHCMD("lxappearance") },
|
||||||
|
|
||||||
|
// Screenshot
|
||||||
|
{ MODKEY, XK_s, spawn, SHCMD("xfce4-screenshooter") },
|
||||||
|
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("scrot -s") },
|
||||||
|
|
||||||
|
// ----------------- Hardware ------------------
|
||||||
|
|
||||||
|
// Volume
|
||||||
|
{0, XF86XK_AudioLowerVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -5%")},
|
||||||
|
{0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +5%")},
|
||||||
|
{0, XF86XK_AudioMute, spawn, SHCMD("pactl set-sink-mute @DEFAULT_SINK@ toggle")},
|
||||||
|
|
||||||
|
// Brightness
|
||||||
|
{0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set +10%")},
|
||||||
|
{0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl set 10%-")},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Default config
|
||||||
|
//static 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|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
|
||||||
|
//{ MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },
|
||||||
|
//{ 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 } },
|
||||||
|
//{ MODKEY, XK_minus, setgaps, {.i = -1 } },
|
||||||
|
//{ MODKEY, XK_equal, setgaps, {.i = +1 } },
|
||||||
|
//{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||||
|
//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 Button buttons[] = {
|
||||||
|
/* click event mask button function argument */
|
||||||
|
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
|
{ 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,5 +1,5 @@
|
||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 6.3
|
VERSION = 6.4
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ FREETYPELIBS = -lfontconfig -lXft
|
||||||
FREETYPEINC = /usr/include/freetype2
|
FREETYPEINC = /usr/include/freetype2
|
||||||
# OpenBSD (uncomment)
|
# OpenBSD (uncomment)
|
||||||
#FREETYPEINC = ${X11INC}/freetype2
|
#FREETYPEINC = ${X11INC}/freetype2
|
||||||
|
#MANPREFIX = ${PREFIX}/man
|
||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
|
|
|
@ -133,19 +133,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
||||||
die("no font specified.");
|
die("no font specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not allow using color fonts. This is a workaround for a BadLength
|
|
||||||
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
|
||||||
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
|
||||||
* https://lists.suckless.org/dev/1701/30932.html
|
|
||||||
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
|
||||||
* and lots more all over the internet.
|
|
||||||
*/
|
|
||||||
FcBool iscol;
|
|
||||||
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
|
||||||
XftFontClose(drw->dpy, xfont);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
font = ecalloc(1, sizeof(Fnt));
|
font = ecalloc(1, sizeof(Fnt));
|
||||||
font->xfont = xfont;
|
font->xfont = xfont;
|
||||||
font->pattern = pattern;
|
font->pattern = pattern;
|
||||||
|
@ -251,12 +238,10 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
|
||||||
int
|
int
|
||||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
int i, ty, ellipsis_x = 0;
|
||||||
int ty;
|
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len;
|
||||||
unsigned int ew;
|
|
||||||
XftDraw *d = NULL;
|
XftDraw *d = NULL;
|
||||||
Fnt *usedfont, *curfont, *nextfont;
|
Fnt *usedfont, *curfont, *nextfont;
|
||||||
size_t i, len;
|
|
||||||
int utf8strlen, utf8charlen, render = x || y || w || h;
|
int utf8strlen, utf8charlen, render = x || y || w || h;
|
||||||
long utf8codepoint = 0;
|
long utf8codepoint = 0;
|
||||||
const char *utf8str;
|
const char *utf8str;
|
||||||
|
@ -264,13 +249,17 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
FcPattern *fcpattern;
|
FcPattern *fcpattern;
|
||||||
FcPattern *match;
|
FcPattern *match;
|
||||||
XftResult result;
|
XftResult result;
|
||||||
int charexists = 0;
|
int charexists = 0, overflow = 0;
|
||||||
|
/* keep track of a couple codepoints for which we have no match. */
|
||||||
|
enum { nomatches_len = 64 };
|
||||||
|
static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches;
|
||||||
|
static unsigned int ellipsis_width = 0;
|
||||||
|
|
||||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!render) {
|
if (!render) {
|
||||||
w = ~w;
|
w = invert ? invert : ~invert;
|
||||||
} 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);
|
||||||
|
@ -282,8 +271,10 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
}
|
}
|
||||||
|
|
||||||
usedfont = drw->fonts;
|
usedfont = drw->fonts;
|
||||||
|
if (!ellipsis_width && render)
|
||||||
|
ellipsis_width = drw_fontset_getwidth(drw, "...");
|
||||||
while (1) {
|
while (1) {
|
||||||
utf8strlen = 0;
|
ew = ellipsis_len = utf8strlen = 0;
|
||||||
utf8str = text;
|
utf8str = text;
|
||||||
nextfont = NULL;
|
nextfont = NULL;
|
||||||
while (*text) {
|
while (*text) {
|
||||||
|
@ -291,9 +282,27 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
|
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
|
||||||
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
||||||
if (charexists) {
|
if (charexists) {
|
||||||
if (curfont == usedfont) {
|
drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL);
|
||||||
|
if (ew + ellipsis_width <= w) {
|
||||||
|
/* keep track where the ellipsis still fits */
|
||||||
|
ellipsis_x = x + ew;
|
||||||
|
ellipsis_w = w - ew;
|
||||||
|
ellipsis_len = utf8strlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ew + tmpw > w) {
|
||||||
|
overflow = 1;
|
||||||
|
/* called from drw_fontset_getwidth_clamp():
|
||||||
|
* it wants the width AFTER the overflow
|
||||||
|
*/
|
||||||
|
if (!render)
|
||||||
|
x += tmpw;
|
||||||
|
else
|
||||||
|
utf8strlen = ellipsis_len;
|
||||||
|
} else if (curfont == usedfont) {
|
||||||
utf8strlen += utf8charlen;
|
utf8strlen += utf8charlen;
|
||||||
text += utf8charlen;
|
text += utf8charlen;
|
||||||
|
ew += tmpw;
|
||||||
} else {
|
} else {
|
||||||
nextfont = curfont;
|
nextfont = curfont;
|
||||||
}
|
}
|
||||||
|
@ -301,36 +310,25 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!charexists || nextfont)
|
if (overflow || !charexists || nextfont)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
charexists = 0;
|
charexists = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utf8strlen) {
|
if (utf8strlen) {
|
||||||
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
if (render) {
|
||||||
/* shorten text if necessary */
|
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
||||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
|
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
||||||
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
|
usedfont->xfont, x, ty, (XftChar8 *)utf8str, utf8strlen);
|
||||||
|
|
||||||
if (len) {
|
|
||||||
memcpy(buf, utf8str, len);
|
|
||||||
buf[len] = '\0';
|
|
||||||
if (len < utf8strlen)
|
|
||||||
for (i = len; i && i > len - 3; buf[--i] = '.')
|
|
||||||
; /* NOP */
|
|
||||||
|
|
||||||
if (render) {
|
|
||||||
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
|
||||||
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
|
||||||
usedfont->xfont, x, ty, (XftChar8 *)buf, len);
|
|
||||||
}
|
|
||||||
x += ew;
|
|
||||||
w -= ew;
|
|
||||||
}
|
}
|
||||||
|
x += ew;
|
||||||
|
w -= ew;
|
||||||
}
|
}
|
||||||
|
if (render && overflow)
|
||||||
|
drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert);
|
||||||
|
|
||||||
if (!*text) {
|
if (!*text || overflow) {
|
||||||
break;
|
break;
|
||||||
} else if (nextfont) {
|
} else if (nextfont) {
|
||||||
charexists = 0;
|
charexists = 0;
|
||||||
|
@ -340,6 +338,12 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
* character must be drawn. */
|
* character must be drawn. */
|
||||||
charexists = 1;
|
charexists = 1;
|
||||||
|
|
||||||
|
for (i = 0; i < nomatches_len; ++i) {
|
||||||
|
/* avoid calling XftFontMatch if we know we won't find a match */
|
||||||
|
if (utf8codepoint == nomatches.codepoint[i])
|
||||||
|
goto no_match;
|
||||||
|
}
|
||||||
|
|
||||||
fccharset = FcCharSetCreate();
|
fccharset = FcCharSetCreate();
|
||||||
FcCharSetAddChar(fccharset, utf8codepoint);
|
FcCharSetAddChar(fccharset, utf8codepoint);
|
||||||
|
|
||||||
|
@ -351,7 +355,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
||||||
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
||||||
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
||||||
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
|
||||||
|
|
||||||
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
||||||
FcDefaultSubstitute(fcpattern);
|
FcDefaultSubstitute(fcpattern);
|
||||||
|
@ -368,6 +371,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
curfont->next = usedfont;
|
curfont->next = usedfont;
|
||||||
} else {
|
} else {
|
||||||
xfont_free(usedfont);
|
xfont_free(usedfont);
|
||||||
|
nomatches.codepoint[++nomatches.idx % nomatches_len] = utf8codepoint;
|
||||||
|
no_match:
|
||||||
usedfont = drw->fonts;
|
usedfont = drw->fonts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,6 +402,15 @@ drw_fontset_getwidth(Drw *drw, const char *text)
|
||||||
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
|
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n)
|
||||||
|
{
|
||||||
|
unsigned int tmp = 0;
|
||||||
|
if (drw && drw->fonts && text && n)
|
||||||
|
tmp = drw_text(drw, 0, 0, 0, 0, 0, text, n);
|
||||||
|
return MIN(n, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,7 @@ void drw_free(Drw *drw);
|
||||||
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
|
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
|
||||||
void drw_fontset_free(Fnt* set);
|
void drw_fontset_free(Fnt* set);
|
||||||
unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
|
unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
|
||||||
|
unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n);
|
||||||
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 */
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct Client {
|
||||||
float mina, maxa;
|
float mina, maxa;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
int oldx, oldy, oldw, oldh;
|
int oldx, oldy, oldw, oldh;
|
||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
|
||||||
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;
|
||||||
|
@ -209,7 +209,7 @@ 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 *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *);
|
static void pop(Client *c);
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
|
@ -239,7 +239,7 @@ static void spawn(const Arg *arg);
|
||||||
static Monitor *systraytomon(Monitor *m);
|
static Monitor *systraytomon(Monitor *m);
|
||||||
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 *);
|
static void tile(Monitor *m);
|
||||||
static void togglebar(const Arg *arg);
|
static void togglebar(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);
|
||||||
|
@ -275,7 +275,7 @@ static const char broken[] = "broken";
|
||||||
static char stext[256];
|
static char stext[256];
|
||||||
static int screen;
|
static int screen;
|
||||||
static int sw, sh; /* X display screen geometry width, height */
|
static int sw, sh; /* X display screen geometry width, height */
|
||||||
static int bh, blw = 0; /* bar geometry */
|
static int bh; /* bar height */
|
||||||
static int lrpad; /* sum of left and right padding for text */
|
static int lrpad; /* sum of left and right padding for text */
|
||||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
static unsigned int numlockmask = 0;
|
static unsigned int numlockmask = 0;
|
||||||
|
@ -381,6 +381,8 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
||||||
if (*w < bh)
|
if (*w < bh)
|
||||||
*w = bh;
|
*w = bh;
|
||||||
if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
|
if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
|
||||||
|
if (!c->hintsvalid)
|
||||||
|
updatesizehints(c);
|
||||||
/* see last two sentences in ICCCM 4.1.2.3 */
|
/* see last two sentences in ICCCM 4.1.2.3 */
|
||||||
baseismin = c->basew == c->minw && c->baseh == c->minh;
|
baseismin = c->basew == c->minw && c->baseh == c->minh;
|
||||||
if (!baseismin) { /* temporarily remove base dimensions */
|
if (!baseismin) { /* temporarily remove base dimensions */
|
||||||
|
@ -474,7 +476,7 @@ buttonpress(XEvent *e)
|
||||||
if (i < LENGTH(tags)) {
|
if (i < LENGTH(tags)) {
|
||||||
click = ClkTagBar;
|
click = ClkTagBar;
|
||||||
arg.ui = 1 << i;
|
arg.ui = 1 << i;
|
||||||
} else if (ev->x < x + blw)
|
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
||||||
click = ClkLtSymbol;
|
click = ClkLtSymbol;
|
||||||
else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth())
|
else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth())
|
||||||
click = ClkStatusText;
|
click = ClkStatusText;
|
||||||
|
@ -530,6 +532,7 @@ cleanup(void)
|
||||||
drw_cur_free(drw, cursor[i]);
|
drw_cur_free(drw, cursor[i]);
|
||||||
for (i = 0; i < LENGTH(colors); i++)
|
for (i = 0; i < LENGTH(colors); i++)
|
||||||
free(scheme[i]);
|
free(scheme[i]);
|
||||||
|
free(scheme);
|
||||||
XDestroyWindow(dpy, wmcheckwin);
|
XDestroyWindow(dpy, wmcheckwin);
|
||||||
drw_free(drw);
|
drw_free(drw);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
@ -847,7 +850,7 @@ drawbar(Monitor *m)
|
||||||
urg & 1 << i);
|
urg & 1 << i);
|
||||||
x += w;
|
x += w;
|
||||||
}
|
}
|
||||||
w = blw = TEXTW(m->ltsymbol);
|
w = TEXTW(m->ltsymbol);
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
|
||||||
|
@ -1055,13 +1058,11 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size)
|
||||||
text[0] = '\0';
|
text[0] = '\0';
|
||||||
if (!XGetTextProperty(dpy, w, &name, atom) || !name.nitems)
|
if (!XGetTextProperty(dpy, w, &name, atom) || !name.nitems)
|
||||||
return 0;
|
return 0;
|
||||||
if (name.encoding == XA_STRING)
|
if (name.encoding == XA_STRING) {
|
||||||
strncpy(text, (char *)name.value, size - 1);
|
strncpy(text, (char *)name.value, size - 1);
|
||||||
else {
|
} else if (XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) {
|
||||||
if (XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) {
|
strncpy(text, *list, size - 1);
|
||||||
strncpy(text, *list, size - 1);
|
XFreeStringList(list);
|
||||||
XFreeStringList(list);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
text[size - 1] = '\0';
|
text[size - 1] = '\0';
|
||||||
XFree(name.value);
|
XFree(name.value);
|
||||||
|
@ -1184,14 +1185,12 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
applyrules(c);
|
applyrules(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
|
if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww)
|
||||||
c->x = c->mon->mx + c->mon->mw - WIDTH(c);
|
c->x = c->mon->wx + c->mon->ww - WIDTH(c);
|
||||||
if (c->y + HEIGHT(c) > c->mon->my + c->mon->mh)
|
if (c->y + HEIGHT(c) > c->mon->wy + c->mon->wh)
|
||||||
c->y = c->mon->my + c->mon->mh - HEIGHT(c);
|
c->y = c->mon->wy + c->mon->wh - HEIGHT(c);
|
||||||
c->x = MAX(c->x, c->mon->mx);
|
c->x = MAX(c->x, c->mon->wx);
|
||||||
/* only fix client y-offset, if the client center might cover the bar */
|
c->y = MAX(c->y, c->mon->wy);
|
||||||
c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
|
|
||||||
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
|
|
||||||
c->bw = borderpx;
|
c->bw = borderpx;
|
||||||
|
|
||||||
wc.border_width = c->bw;
|
wc.border_width = c->bw;
|
||||||
|
@ -1237,16 +1236,14 @@ maprequest(XEvent *e)
|
||||||
static XWindowAttributes wa;
|
static XWindowAttributes wa;
|
||||||
XMapRequestEvent *ev = &e->xmaprequest;
|
XMapRequestEvent *ev = &e->xmaprequest;
|
||||||
|
|
||||||
Client *i;
|
Client *i;
|
||||||
if ((i = wintosystrayicon(ev->window))) {
|
if ((i = wintosystrayicon(ev->window))) {
|
||||||
sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
|
sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
|
||||||
resizebarwin(selmon);
|
resizebarwin(selmon);
|
||||||
updatesystray();
|
updatesystray();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!XGetWindowAttributes(dpy, ev->window, &wa))
|
if (!XGetWindowAttributes(dpy, ev->window, &wa) || wa.override_redirect)
|
||||||
return;
|
|
||||||
if (wa.override_redirect)
|
|
||||||
return;
|
return;
|
||||||
if (!wintoclient(ev->window))
|
if (!wintoclient(ev->window))
|
||||||
manage(ev->window, &wa);
|
manage(ev->window, &wa);
|
||||||
|
@ -1391,7 +1388,7 @@ propertynotify(XEvent *e)
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
break;
|
break;
|
||||||
case XA_WM_NORMAL_HINTS:
|
case XA_WM_NORMAL_HINTS:
|
||||||
updatesizehints(c);
|
c->hintsvalid = 0;
|
||||||
break;
|
break;
|
||||||
case XA_WM_HINTS:
|
case XA_WM_HINTS:
|
||||||
updatewmhints(c);
|
updatewmhints(c);
|
||||||
|
@ -1829,7 +1826,6 @@ setup(void)
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
seturgent(Client *c, int urg)
|
seturgent(Client *c, int urg)
|
||||||
{
|
{
|
||||||
|
@ -1872,16 +1868,12 @@ sigchld(int unused)
|
||||||
void
|
void
|
||||||
spawn(const Arg *arg)
|
spawn(const Arg *arg)
|
||||||
{
|
{
|
||||||
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));
|
||||||
setsid();
|
setsid();
|
||||||
execvp(((char **)arg->v)[0], (char **)arg->v);
|
execvp(((char **)arg->v)[0], (char **)arg->v);
|
||||||
fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
|
die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
|
||||||
perror(" failed");
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2017,6 +2009,7 @@ unmanage(Client *c, int destroyed)
|
||||||
wc.border_width = c->oldbw;
|
wc.border_width = c->oldbw;
|
||||||
XGrabServer(dpy); /* avoid race conditions */
|
XGrabServer(dpy); /* avoid race conditions */
|
||||||
XSetErrorHandler(xerrordummy);
|
XSetErrorHandler(xerrordummy);
|
||||||
|
XSelectInput(dpy, c->win, NoEventMask);
|
||||||
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
|
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
setclientstate(c, WithdrawnState);
|
setclientstate(c, WithdrawnState);
|
||||||
|
@ -2126,42 +2119,42 @@ updategeom(void)
|
||||||
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
|
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
|
||||||
XFree(info);
|
XFree(info);
|
||||||
nn = j;
|
nn = j;
|
||||||
if (n <= nn) { /* new monitors available */
|
|
||||||
for (i = 0; i < (nn - n); i++) {
|
/* new monitors if nn > n */
|
||||||
for (m = mons; m && m->next; m = m->next);
|
for (i = n; i < nn; i++) {
|
||||||
if (m)
|
for (m = mons; m && m->next; m = m->next);
|
||||||
m->next = createmon();
|
if (m)
|
||||||
else
|
m->next = createmon();
|
||||||
mons = createmon();
|
else
|
||||||
|
mons = createmon();
|
||||||
|
}
|
||||||
|
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
|
||||||
|
if (i >= n
|
||||||
|
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|
||||||
|
|| unique[i].width != m->mw || unique[i].height != m->mh)
|
||||||
|
{
|
||||||
|
dirty = 1;
|
||||||
|
m->num = i;
|
||||||
|
m->mx = m->wx = unique[i].x_org;
|
||||||
|
m->my = m->wy = unique[i].y_org;
|
||||||
|
m->mw = m->ww = unique[i].width;
|
||||||
|
m->mh = m->wh = unique[i].height;
|
||||||
|
updatebarpos(m);
|
||||||
}
|
}
|
||||||
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
|
/* removed monitors if n > nn */
|
||||||
if (i >= n
|
for (i = nn; i < n; i++) {
|
||||||
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|
for (m = mons; m && m->next; m = m->next);
|
||||||
|| unique[i].width != m->mw || unique[i].height != m->mh)
|
while ((c = m->clients)) {
|
||||||
{
|
dirty = 1;
|
||||||
dirty = 1;
|
m->clients = c->next;
|
||||||
m->num = i;
|
detachstack(c);
|
||||||
m->mx = m->wx = unique[i].x_org;
|
c->mon = mons;
|
||||||
m->my = m->wy = unique[i].y_org;
|
attach(c);
|
||||||
m->mw = m->ww = unique[i].width;
|
attachstack(c);
|
||||||
m->mh = m->wh = unique[i].height;
|
|
||||||
updatebarpos(m);
|
|
||||||
}
|
|
||||||
} else { /* less monitors available nn < n */
|
|
||||||
for (i = nn; i < n; i++) {
|
|
||||||
for (m = mons; m && m->next; m = m->next);
|
|
||||||
while ((c = m->clients)) {
|
|
||||||
dirty = 1;
|
|
||||||
m->clients = c->next;
|
|
||||||
detachstack(c);
|
|
||||||
c->mon = mons;
|
|
||||||
attach(c);
|
|
||||||
attachstack(c);
|
|
||||||
}
|
|
||||||
if (m == selmon)
|
|
||||||
selmon = mons;
|
|
||||||
cleanupmon(m);
|
|
||||||
}
|
}
|
||||||
|
if (m == selmon)
|
||||||
|
selmon = mons;
|
||||||
|
cleanupmon(m);
|
||||||
}
|
}
|
||||||
free(unique);
|
free(unique);
|
||||||
} else
|
} else
|
||||||
|
@ -2240,14 +2233,14 @@ updatesizehints(Client *c)
|
||||||
} else
|
} else
|
||||||
c->maxa = c->mina = 0.0;
|
c->maxa = c->mina = 0.0;
|
||||||
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
||||||
|
c->hintsvalid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updatestatus(void)
|
updatestatus(void)
|
||||||
{
|
{
|
||||||
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||||
strcpy(stext, " Linux 6.3 >");
|
strcpy(stext, " Linux 6.4 >");
|
||||||
//strcpy(stext, "dwm-"VERSION);
|
|
||||||
drawbar(selmon);
|
drawbar(selmon);
|
||||||
updatesystray();
|
updatesystray();
|
||||||
}
|
}
|
||||||
|
@ -2519,12 +2512,10 @@ zoom(const Arg *arg)
|
||||||
{
|
{
|
||||||
Client *c = selmon->sel;
|
Client *c = selmon->sel;
|
||||||
|
|
||||||
if (!selmon->lt[selmon->sellt]->arrange
|
if (!selmon->lt[selmon->sellt]->arrange || !c || c->isfloating)
|
||||||
|| (selmon->sel && selmon->sel->isfloating))
|
return;
|
||||||
|
if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next)))
|
||||||
return;
|
return;
|
||||||
if (c == nexttiled(selmon->clients))
|
|
||||||
if (!c || !(c = nexttiled(c->next)))
|
|
||||||
return;
|
|
||||||
pop(c);
|
pop(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2532,8 +2523,7 @@ int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc == 2 && !strcmp("-v", argv[1]))
|
if (argc == 2 && !strcmp("-v", argv[1]))
|
||||||
//die("dwm-"VERSION);
|
die(" Linux 6.4 >");
|
||||||
die(" Linux 6.3 >");
|
|
||||||
else if (argc != 1)
|
else if (argc != 1)
|
||||||
die("usage: dwm [-v]");
|
die("usage: dwm [-v]");
|
||||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||||
|
|
|
@ -6,18 +6,9 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void *
|
|
||||||
ecalloc(size_t nmemb, size_t size)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
if (!(p = calloc(nmemb, size)))
|
|
||||||
die("calloc:");
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
die(const char *fmt, ...) {
|
die(const char *fmt, ...)
|
||||||
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
@ -33,3 +24,13 @@ die(const char *fmt, ...) {
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
ecalloc(size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
if (!(p = calloc(nmemb, size)))
|
||||||
|
die("calloc:");
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user