Merge remote-tracking branch 'upstream/master'
This commit is contained in:
1
LICENSE
1
LICENSE
@@ -17,6 +17,7 @@ MIT/X Consortium License
|
||||
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
||||
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
||||
© 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
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
|
20
README.md
20
README.md
@@ -1,4 +1,4 @@
|
||||
This dwm 6.2 (67d76bd, 2021-03-29) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0).
|
||||
This dwm 6.3 (8b48e30, 2022-04-26) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0).
|
||||
|
||||
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/dwm-flexipatch/blob/master/patches.def.h):
|
||||
```c
|
||||
@@ -13,10 +13,16 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
If you are experiencing issues then you may want to check out the [Known Issues](https://github.com/bakkeby/dwm-flexipatch/discussions/categories/known-issues) discussion category.
|
||||
|
||||
Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6PTWOM9Wz) diagram which tries to organise patches into categories.
|
||||
|
||||
---
|
||||
|
||||
### Changelog:
|
||||
|
||||
2022-02-11 - Added the isfreesize version of the sizehints patch and the [tagsync](https://github.com/bakkeby/dwm-flexipatch/pull/219) patch (contributed by [Bagelli](https://github.com/Bagellll))
|
||||
|
||||
2021-11-23 - Added the taglabels and underlinetags patches
|
||||
|
||||
2021-09-08 - Added the alwayscenter patch
|
||||
|
||||
2021-07-27 - Added the winicon patch
|
||||
@@ -467,6 +473,9 @@ If you are experiencing issues then you may want to check out the [Known Issues]
|
||||
- this patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts can be
|
||||
performed
|
||||
|
||||
- [killunsel](https://dwm.suckless.org/patches/killunsel/)
|
||||
- kills all visible clients that are not selected (only the selected client will remain)
|
||||
|
||||
- [~leftlayout~](http://dwm.suckless.org/patches/leftlayout/)
|
||||
- ~moves the layout symbol in the status bar to the left hand side~
|
||||
|
||||
@@ -703,6 +712,9 @@ If you are experiencing issues then you may want to check out the [Known Issues]
|
||||
- [taggrid](https://dwm.suckless.org/patches/taggrid/)
|
||||
- adds an option to place tags in rows like in many other window managers
|
||||
|
||||
- [taglabels](https://dwm.suckless.org/patches/taglabels/)
|
||||
- shows tag + class of master client in the tags section of the bar
|
||||
|
||||
- [tagmonfixfs](https://github.com/bakkeby/patches/wiki/tagmonfixfs/)
|
||||
- allows moving a fullscreen window to another monitor while remaining in fullscreen
|
||||
|
||||
@@ -741,13 +753,13 @@ If you are experiencing issues then you may want to check out the [Known Issues]
|
||||
- lets you transfer all clients between the master and stack area while increasing or
|
||||
decreasing the master area (nmaster) accordingly
|
||||
|
||||
- [underlinetags](https://dwm.suckless.org/patches/underlinetags/)
|
||||
- underlines the selected tag, or optionally all tags
|
||||
|
||||
- [unfloatvisible](https://dwm.suckless.org/patches/unfloatvisible/)
|
||||
- resets isfloating on any visible windows that have it set and optionally also applies a
|
||||
layout
|
||||
|
||||
- [killunsel](https://dwm.suckless.org/patches/killunsel/)
|
||||
- kills all visible clients that are not selected (only the selected client will remain)
|
||||
|
||||
- [~urgentborder~](https://dwm.suckless.org/patches/urgentborder/)
|
||||
- ~this patch makes "urgent" windows have different colors~
|
||||
|
||||
|
1061
README.org
1061
README.org
File diff suppressed because it is too large
Load Diff
169
config.def.h
169
config.def.h
@@ -108,6 +108,19 @@ static const unsigned int systrayspacing = 2; /* systray spacing */
|
||||
static const int showsystray = 1; /* 0 means no systray */
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
|
||||
#if BAR_TAGLABELS_PATCH
|
||||
static const char ptagf[] = "[%s %s]"; /* format of a tag label */
|
||||
static const char etagf[] = "[%s]"; /* format of an empty tag */
|
||||
static const int lcaselbl = 0; /* 1 means make tag label lowercase */
|
||||
#endif // BAR_TAGLABELS_PATCH
|
||||
|
||||
#if BAR_UNDERLINETAGS_PATCH
|
||||
static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
|
||||
static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
|
||||
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
|
||||
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
|
||||
#endif // BAR_UNDERLINETAGS_PATCH
|
||||
|
||||
static int tagindicatortype = INDICATOR_TOP_LEFT_SQUARE;
|
||||
static int tiledindicatortype = INDICATOR_NONE;
|
||||
static int floatindicatortype = INDICATOR_TOP_LEFT_SQUARE;
|
||||
@@ -118,7 +131,7 @@ static int floatfakefsindicatortype = INDICATOR_PLUS_AND_LARGER_SQUARE;
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
|
||||
#if ONLYQUITONEMPTY_PATCH
|
||||
static const int quit_empty_window_count = 2; /* only allow dwm to quit if no windows are open, value here represents number of deamons */
|
||||
static const int quit_empty_window_count = 0; /* only allow dwm to quit if no (<= count) windows are open */
|
||||
#endif // ONLYQUITONEMPTY_PATCH
|
||||
|
||||
#if BAR_EXTRASTATUS_PATCH
|
||||
@@ -143,9 +156,6 @@ static const char dmenufont[] = "monospace:size=10";
|
||||
|
||||
static char c000000[] = "#000000"; // placeholder value
|
||||
|
||||
#if BAR_FLEXWINTITLE_PATCH
|
||||
#endif // BAR_FLEXWINTITLE_PATCH
|
||||
|
||||
static char normfgcolor[] = "#F8F8F2";
|
||||
static char normbgcolor[] = "#282A36";
|
||||
static char normbordercolor[] = "#4D4D4D";
|
||||
@@ -453,80 +463,82 @@ static const Inset default_inset = {
|
||||
#endif // INSETS_PATCH
|
||||
|
||||
static const BarRule barrules[] = {
|
||||
/* monitor bar alignment widthfunc drawfunc clickfunc name */
|
||||
{ -2 },
|
||||
#if BAR_STATUSBUTTON_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, "statusbutton" },
|
||||
#endif // BAR_STATUSBUTTON_PATCH
|
||||
#if BAR_POWERLINE_TAGS_PATCH
|
||||
{ 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, "powerline_tags" },
|
||||
#endif // BAR_POWERLINE_TAGS_PATCH
|
||||
#if BAR_TAGS_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" },
|
||||
#endif // BAR_TAGS_PATCH
|
||||
#if BAR_TAGGRID_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_taggrid, draw_taggrid, click_taggrid, "taggrid" },
|
||||
#endif // BAR_TAGGRID_PATCH
|
||||
#if BAR_SYSTRAY_PATCH
|
||||
{ 0, 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" },
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
#if BAR_LTSYMBOL_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" },
|
||||
#endif // BAR_LTSYMBOL_PATCH
|
||||
#if BAR_STATUSCOLORS_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_statuscolors, draw_statuscolors, click_statuscmd, "statuscolors" },
|
||||
#elif BAR_STATUSCOLORS_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_statuscolors, draw_statuscolors, click_statuscolors, "statuscolors" },
|
||||
#elif BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_statuscmd, "status2d" },
|
||||
#elif BAR_STATUS2D_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_status2d, "status2d" },
|
||||
#elif BAR_POWERLINE_STATUS_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_pwrl_status, draw_pwrl_status, click_pwrl_status, "powerline_status" },
|
||||
#elif BAR_STATUS_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_statuscmd, "status" },
|
||||
#elif BAR_STATUS_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "status" },
|
||||
#endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH
|
||||
#if XKB_PATCH
|
||||
{ 0, 0, BAR_ALIGN_RIGHT, width_xkb, draw_xkb, click_xkb, "xkb" },
|
||||
#endif // XKB_PATCH
|
||||
#if BAR_FLEXWINTITLE_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_flexwintitle, draw_flexwintitle, click_flexwintitle, "flexwintitle" },
|
||||
#elif BAR_TABGROUPS_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_bartabgroups, draw_bartabgroups, click_bartabgroups, "bartabgroups" },
|
||||
#elif BAR_AWESOMEBAR_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_awesomebar, draw_awesomebar, click_awesomebar, "awesomebar" },
|
||||
#elif BAR_FANCYBAR_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_fancybar, draw_fancybar, click_fancybar, "fancybar" },
|
||||
#elif BAR_WINTITLE_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" },
|
||||
#endif // BAR_TABGROUPS_PATCH | BAR_AWESOMEBAR_PATCH | BAR_FANCYBAR_PATCH | BAR_WINTITLE_PATCH
|
||||
#if BAR_EXTRASTATUS_PATCH
|
||||
#if BAR_STATUSCOLORS_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_statuscolors_es, draw_statuscolors_es, click_statuscmd_es, "statuscolors_es" },
|
||||
#elif BAR_STATUSCOLORS_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_statuscolors_es, draw_statuscolors_es, click_statuscolors, "statuscolors_es" },
|
||||
#elif BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_statuscmd_es, "status2d_es" },
|
||||
#elif BAR_STATUS2D_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_status2d, "status2d_es" },
|
||||
#elif BAR_POWERLINE_STATUS_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_RIGHT, width_pwrl_status_es, draw_pwrl_status_es, click_pwrl_status, "powerline_status" },
|
||||
#elif BAR_STATUSCMD_PATCH && BAR_STATUS_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_statuscmd_es, "status_es" },
|
||||
#elif BAR_STATUS_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_status, "status_es" },
|
||||
#endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH
|
||||
#endif // BAR_EXTRASTATUS_PATCH
|
||||
#if BAR_FLEXWINTITLE_PATCH
|
||||
#if BAR_WINTITLE_HIDDEN_PATCH
|
||||
{ -1, 1, BAR_ALIGN_RIGHT_RIGHT, width_wintitle_hidden, draw_wintitle_hidden, click_wintitle_hidden, "wintitle_hidden" },
|
||||
#endif
|
||||
#if BAR_WINTITLE_FLOATING_PATCH
|
||||
{ -1, 1, BAR_ALIGN_LEFT, width_wintitle_floating, draw_wintitle_floating, click_wintitle_floating, "wintitle_floating" },
|
||||
#endif // BAR_WINTITLE_FLOATING_PATCH
|
||||
#endif // BAR_FLEXWINTITLE_PATCH
|
||||
/* monitor bar alignment widthfunc drawfunc clickfunc name */
|
||||
#if BAR_STATUSBUTTON_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, "statusbutton" },
|
||||
#endif // BAR_STATUSBUTTON_PATCH
|
||||
#if BAR_POWERLINE_TAGS_PATCH
|
||||
{ 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, "powerline_tags" },
|
||||
#endif // BAR_POWERLINE_TAGS_PATCH
|
||||
#if BAR_TAGS_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" },
|
||||
#endif // BAR_TAGS_PATCH
|
||||
#if BAR_TAGLABELS_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_taglabels, draw_taglabels, click_taglabels, "taglabels" },
|
||||
#endif // BAR_TAGLABELS_PATCH
|
||||
#if BAR_TAGGRID_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_taggrid, draw_taggrid, click_taggrid, "taggrid" },
|
||||
#endif // BAR_TAGGRID_PATCH
|
||||
#if BAR_SYSTRAY_PATCH
|
||||
{ 0, 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" },
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
#if BAR_LTSYMBOL_PATCH
|
||||
{ -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" },
|
||||
#endif // BAR_LTSYMBOL_PATCH
|
||||
#if BAR_STATUSCOLORS_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_statuscolors, draw_statuscolors, click_statuscmd, "statuscolors" },
|
||||
#elif BAR_STATUSCOLORS_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_statuscolors, draw_statuscolors, click_statuscolors, "statuscolors" },
|
||||
#elif BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_statuscmd, "status2d" },
|
||||
#elif BAR_STATUS2D_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_status2d, "status2d" },
|
||||
#elif BAR_POWERLINE_STATUS_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_pwrl_status, draw_pwrl_status, click_pwrl_status, "powerline_status" },
|
||||
#elif BAR_STATUS_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_statuscmd, "status" },
|
||||
#elif BAR_STATUS_PATCH
|
||||
{ statusmon, 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "status" },
|
||||
#endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH
|
||||
#if XKB_PATCH
|
||||
{ 0, 0, BAR_ALIGN_RIGHT, width_xkb, draw_xkb, click_xkb, "xkb" },
|
||||
#endif // XKB_PATCH
|
||||
#if BAR_FLEXWINTITLE_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_flexwintitle, draw_flexwintitle, click_flexwintitle, "flexwintitle" },
|
||||
#elif BAR_TABGROUPS_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_bartabgroups, draw_bartabgroups, click_bartabgroups, "bartabgroups" },
|
||||
#elif BAR_AWESOMEBAR_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_awesomebar, draw_awesomebar, click_awesomebar, "awesomebar" },
|
||||
#elif BAR_FANCYBAR_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_fancybar, draw_fancybar, click_fancybar, "fancybar" },
|
||||
#elif BAR_WINTITLE_PATCH
|
||||
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" },
|
||||
#endif // BAR_TABGROUPS_PATCH | BAR_AWESOMEBAR_PATCH | BAR_FANCYBAR_PATCH | BAR_WINTITLE_PATCH
|
||||
#if BAR_EXTRASTATUS_PATCH
|
||||
#if BAR_STATUSCOLORS_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_statuscolors_es, draw_statuscolors_es, click_statuscmd_es, "statuscolors_es" },
|
||||
#elif BAR_STATUSCOLORS_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_statuscolors_es, draw_statuscolors_es, click_statuscolors, "statuscolors_es" },
|
||||
#elif BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_statuscmd_es, "status2d_es" },
|
||||
#elif BAR_STATUS2D_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_status2d, "status2d_es" },
|
||||
#elif BAR_POWERLINE_STATUS_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_RIGHT, width_pwrl_status_es, draw_pwrl_status_es, click_pwrl_status, "powerline_status" },
|
||||
#elif BAR_STATUSCMD_PATCH && BAR_STATUS_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_statuscmd_es, "status_es" },
|
||||
#elif BAR_STATUS_PATCH
|
||||
{ statusmon, 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_status, "status_es" },
|
||||
#endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH
|
||||
#endif // BAR_EXTRASTATUS_PATCH
|
||||
#if BAR_FLEXWINTITLE_PATCH
|
||||
#if BAR_WINTITLE_HIDDEN_PATCH
|
||||
{ -1, 1, BAR_ALIGN_RIGHT_RIGHT, width_wintitle_hidden, draw_wintitle_hidden, click_wintitle_hidden, "wintitle_hidden" },
|
||||
#endif
|
||||
#if BAR_WINTITLE_FLOATING_PATCH
|
||||
{ -1, 1, BAR_ALIGN_LEFT, width_wintitle_floating, draw_wintitle_floating, click_wintitle_floating, "wintitle_floating" },
|
||||
#endif // BAR_WINTITLE_FLOATING_PATCH
|
||||
#endif // BAR_FLEXWINTITLE_PATCH
|
||||
};
|
||||
|
||||
static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
|
||||
@@ -537,6 +549,7 @@ static const int nstack = 0; /* number of clients in primary stack area
|
||||
#endif // FLEXTILE_DELUXE_LAYOUT
|
||||
|
||||
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 */
|
||||
|
||||
#if DECORATION_HINTS_PATCH
|
||||
static const int decorhints = 1; /* 1 means respect decoration hints */
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# dwm version
|
||||
VERSION = 6.2
|
||||
VERSION = 6.3
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
@@ -28,7 +28,7 @@ FREETYPEINC = /usr/include/freetype2
|
||||
# OpenBSD - Uncomment this for the swallow patch / SWALLOW_PATCH
|
||||
#KVMLIB = -lkvm
|
||||
|
||||
# Uncomment this for the alpha patch / BAR_ALPHA_PATCH
|
||||
# Uncomment this for the alpha patch and the winicon patch (BAR_ALPHA_PATCH, BAR_WINICON_PATCH)
|
||||
#XRENDER = -lXrender
|
||||
|
||||
# Uncomment this for the mdpcontrol patch / MDPCONTROL_PATCH
|
||||
@@ -58,7 +58,7 @@ LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XRENDER} ${MPDCLIENT
|
||||
# flags
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-unused-function -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
||||
LDFLAGS = ${LIBS}
|
||||
|
||||
# Solaris
|
||||
|
25
drw.c
25
drw.c
@@ -89,9 +89,15 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
|
||||
drw->depth = depth;
|
||||
drw->cmap = cmap;
|
||||
drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
|
||||
#if BAR_WINICON_PATCH
|
||||
drw->picture = XRenderCreatePicture(dpy, drw->drawable, XRenderFindVisualFormat(dpy, visual), 0, NULL);
|
||||
#endif // BAR_WINICON_PATCH
|
||||
drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
|
||||
#else
|
||||
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
||||
#if BAR_WINICON_PATCH
|
||||
drw->picture = XRenderCreatePicture(dpy, drw->drawable, XRenderFindVisualFormat(dpy, DefaultVisual(dpy, screen)), 0, NULL);
|
||||
#endif // BAR_WINICON_PATCH
|
||||
drw->gc = XCreateGC(dpy, root, 0, NULL);
|
||||
#endif // BAR_ALPHA_PATCH
|
||||
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||
@@ -107,18 +113,31 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
||||
|
||||
drw->w = w;
|
||||
drw->h = h;
|
||||
#if BAR_WINICON_PATCH
|
||||
if (drw->picture)
|
||||
XRenderFreePicture(drw->dpy, drw->picture);
|
||||
#endif // BAR_WINICON_PATCH
|
||||
if (drw->drawable)
|
||||
XFreePixmap(drw->dpy, drw->drawable);
|
||||
#if BAR_ALPHA_PATCH
|
||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
|
||||
#else
|
||||
#if BAR_WINICON_PATCH
|
||||
drw->picture = XRenderCreatePicture(drw->dpy, drw->drawable, XRenderFindVisualFormat(drw->dpy, drw->visual), 0, NULL);
|
||||
#endif // BAR_WINICON_PATCH
|
||||
#else // !BAR_ALPHA_PATCH
|
||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
||||
#if BAR_WINICON_PATCH
|
||||
drw->picture = XRenderCreatePicture(drw->dpy, drw->drawable, XRenderFindVisualFormat(drw->dpy, DefaultVisual(drw->dpy, drw->screen)), 0, NULL);
|
||||
#endif // BAR_WINICON_PATCH
|
||||
#endif // BAR_ALPHA_PATCH
|
||||
}
|
||||
|
||||
void
|
||||
drw_free(Drw *drw)
|
||||
{
|
||||
#if BAR_WINICON_PATCH
|
||||
XRenderFreePicture(drw->dpy, drw->picture);
|
||||
#endif // BAR_WINICON_PATCH
|
||||
XFreePixmap(drw->dpy, drw->drawable);
|
||||
XFreeGC(drw->dpy, drw->gc);
|
||||
drw_fontset_free(drw->fonts);
|
||||
@@ -507,8 +526,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||
if (utf8strlen) {
|
||||
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
||||
/* shorten text if necessary */
|
||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
|
||||
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
|
||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; drw_font_getexts(usedfont, utf8str, len, &ew, NULL))
|
||||
len--;
|
||||
|
||||
if (len) {
|
||||
memcpy(buf, utf8str, len);
|
||||
|
3
drw.h
3
drw.h
@@ -35,6 +35,9 @@ typedef struct {
|
||||
Colormap cmap;
|
||||
#endif // BAR_ALPHA_PATCH
|
||||
Drawable drawable;
|
||||
#if BAR_WINICON_PATCH
|
||||
Picture picture;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
GC gc;
|
||||
Clr *scheme;
|
||||
Fnt *fonts;
|
||||
|
256
dwm.c
256
dwm.c
@@ -336,7 +336,7 @@ struct Client {
|
||||
int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
|
||||
#endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH
|
||||
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;
|
||||
unsigned int tags;
|
||||
#if SWITCHTAG_PATCH
|
||||
@@ -368,6 +368,9 @@ struct Client {
|
||||
#if PLACEMOUSE_PATCH
|
||||
int beingmoved;
|
||||
#endif // PLACEMOUSE_PATCH
|
||||
#if SIZEHINTS_ISFREESIZE_PATCH
|
||||
int isfreesize;
|
||||
#endif // SIZEHINTS_ISFREESIZE_PATCH
|
||||
#if SWALLOW_PATCH
|
||||
int isterminal, noswallow;
|
||||
pid_t pid;
|
||||
@@ -392,7 +395,8 @@ struct Client {
|
||||
XkbInfo *xkb;
|
||||
#endif // XKB_PATCH
|
||||
#if BAR_WINICON_PATCH
|
||||
XImage *icon;
|
||||
unsigned int icw, ich;
|
||||
Picture icon;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
};
|
||||
|
||||
@@ -436,7 +440,6 @@ typedef struct {
|
||||
typedef struct Pertag Pertag;
|
||||
#endif // PERTAG_PATCH
|
||||
struct Monitor {
|
||||
int index;
|
||||
char ltsymbol[16];
|
||||
float mfact;
|
||||
#if FLEXTILE_DELUXE_LAYOUT
|
||||
@@ -485,6 +488,9 @@ struct Monitor {
|
||||
#if INSETS_PATCH
|
||||
Inset inset;
|
||||
#endif // INSETS_PATCH
|
||||
#if BAR_TAGLABELS_PATCH
|
||||
char taglabel[NUMTAGS][64];
|
||||
#endif // BAR_TAGLABELS_PATCH
|
||||
#if IPC_PATCH
|
||||
char lastltsymbol[16];
|
||||
TagState tagstate;
|
||||
@@ -512,6 +518,9 @@ typedef struct {
|
||||
#if SELECTIVEFAKEFULLSCREEN_PATCH && FAKEFULLSCREEN_CLIENT_PATCH && !FAKEFULLSCREEN_PATCH
|
||||
int isfakefullscreen;
|
||||
#endif // SELECTIVEFAKEFULLSCREEN_PATCH
|
||||
#if SIZEHINTS_ISFREESIZE_PATCH
|
||||
int isfreesize;
|
||||
#endif // SIZEHINTS_ISFREESIZE_PATCH
|
||||
#if ISPERMANENT_PATCH
|
||||
int ispermanent;
|
||||
#endif // ISPERMANENT_PATCH
|
||||
@@ -822,6 +831,9 @@ applyrules(Client *c)
|
||||
#if SWALLOW_PATCH
|
||||
c->noswallow = -1;
|
||||
#endif // SWALLOW_PATCH
|
||||
#if SIZEHINTS_ISFREESIZE_PATCH
|
||||
c->isfreesize = 1;
|
||||
#endif // SIZEHINTS_ISFREESIZE_PATCH
|
||||
c->isfloating = 0;
|
||||
c->tags = 0;
|
||||
XGetClassHint(dpy, c->win, &ch);
|
||||
@@ -860,6 +872,9 @@ applyrules(Client *c)
|
||||
c->isterminal = r->isterminal;
|
||||
c->noswallow = r->noswallow;
|
||||
#endif // SWALLOW_PATCH
|
||||
#if SIZEHINTS_ISFREESIZE_PATCH
|
||||
c->isfreesize = r->isfreesize;
|
||||
#endif // SIZEHINTS_ISFREESIZE_PATCH
|
||||
c->isfloating = r->isfloating;
|
||||
c->tags |= r->tags;
|
||||
#if SCRATCHPADS_PATCH
|
||||
@@ -908,8 +923,14 @@ applyrules(Client *c)
|
||||
view(&((Arg) { .ui = newtagset }));
|
||||
#endif // PERTAG_PATCH
|
||||
} else {
|
||||
#if TAGSYNC_PATCH
|
||||
for (m = mons; m; m = m->next)
|
||||
m->tagset[m->seltags] = newtagset;
|
||||
arrange(NULL);
|
||||
#else
|
||||
c->mon->tagset[c->mon->seltags] = newtagset;
|
||||
arrange(c->mon);
|
||||
#endif // TAGSYNC_PATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -980,6 +1001,8 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
||||
if (*w < bh)
|
||||
*w = bh;
|
||||
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 */
|
||||
baseismin = c->basew == c->minw && c->baseh == c->minh;
|
||||
if (!baseismin) { /* temporarily remove base dimensions */
|
||||
@@ -1095,7 +1118,7 @@ buttonpress(XEvent *e)
|
||||
br = &barrules[r];
|
||||
if (br->bar != bar->idx || (br->monitor == 'A' && m != selmon) || br->clickfunc == NULL)
|
||||
continue;
|
||||
if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->index)
|
||||
if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->num)
|
||||
continue;
|
||||
if (bar->x[r] <= ev->x && ev->x <= bar->x[r] + bar->w[r]) {
|
||||
carg.x = ev->x - bar->x[r];
|
||||
@@ -1532,11 +1555,11 @@ createmon(void)
|
||||
m->gappov = gappov;
|
||||
#endif // VANITYGAPS_PATCH
|
||||
for (mi = 0, mon = mons; mon; mon = mon->next, mi++); // monitor index
|
||||
m->index = mi;
|
||||
m->num = mi;
|
||||
#if MONITOR_RULES_PATCH
|
||||
for (j = 0; j < LENGTH(monrules); j++) {
|
||||
mr = &monrules[j];
|
||||
if ((mr->monitor == -1 || mr->monitor == mi)
|
||||
if ((mr->monitor == -1 || mr->monitor == m->num)
|
||||
#if PERTAG_PATCH
|
||||
&& (mr->tag <= 0 || (m->tagset[0] & (1 << (mr->tag - 1))))
|
||||
#endif // PERTAG_PATCH
|
||||
@@ -1567,7 +1590,7 @@ createmon(void)
|
||||
/* Derive the number of bars for this monitor based on bar rules */
|
||||
for (n = -1, i = 0; i < LENGTH(barrules); i++) {
|
||||
br = &barrules[i];
|
||||
if (br->monitor == 'A' || br->monitor == -1 || br->monitor == mi)
|
||||
if (br->monitor == 'A' || br->monitor == -1 || br->monitor == m->num)
|
||||
n = MAX(br->bar, n);
|
||||
}
|
||||
|
||||
@@ -1628,7 +1651,7 @@ createmon(void)
|
||||
#if MONITOR_RULES_PATCH
|
||||
for (j = 0; j < LENGTH(monrules); j++) {
|
||||
mr = &monrules[j];
|
||||
if ((mr->monitor == -1 || mr->monitor == mi) && (mr->tag == -1 || mr->tag == i)) {
|
||||
if ((mr->monitor == -1 || mr->monitor == m->num) && (mr->tag == -1 || mr->tag == i)) {
|
||||
layout = MAX(mr->layout, 0);
|
||||
layout = MIN(layout, LENGTH(layouts) - 1);
|
||||
m->pertag->ltidxs[i][0] = &layouts[layout];
|
||||
@@ -1750,8 +1773,12 @@ void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
Bar *bar;
|
||||
for (bar = m->bar; bar; bar = bar->next)
|
||||
drawbarwin(bar);
|
||||
|
||||
#if !BAR_FLEXWINTITLE_PATCH
|
||||
if (m->showbar)
|
||||
#endif // BAR_FLEXWINTITLE_PATCH
|
||||
for (bar = m->bar; bar; bar = bar->next)
|
||||
drawbarwin(bar);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1789,7 +1816,7 @@ drawbarwin(Bar *bar)
|
||||
br = &barrules[r];
|
||||
if (br->bar != bar->idx || !br->widthfunc || (br->monitor == 'A' && bar->mon != selmon))
|
||||
continue;
|
||||
if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->index)
|
||||
if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->num)
|
||||
continue;
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
warg.w = (br->alignment < BAR_ALIGN_RIGHT_LEFT ? lw : rw);
|
||||
@@ -2013,7 +2040,7 @@ focusstack(const Arg *arg)
|
||||
if (!selmon->sel || (selmon->sel->isfullscreen && !selmon->sel->fakefullscreen))
|
||||
return;
|
||||
#else
|
||||
if (!selmon->sel || selmon->sel->isfullscreen)
|
||||
if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
|
||||
return;
|
||||
#endif // LOSEFULLSCREEN_PATCH
|
||||
#if BAR_WINTITLEACTIONS_PATCH
|
||||
@@ -2301,7 +2328,6 @@ manage(Window w, XWindowAttributes *wa)
|
||||
c->cfact = 1.0;
|
||||
#endif // CFACTS_PATCH
|
||||
#if BAR_WINICON_PATCH
|
||||
c->icon = NULL;
|
||||
updateicon(c);
|
||||
#endif // BAR_WINICON_PATCH
|
||||
updatetitle(c);
|
||||
@@ -2705,7 +2731,7 @@ propertynotify(XEvent *e)
|
||||
arrange(c->mon);
|
||||
break;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
updatesizehints(c);
|
||||
c->hintsvalid = 0;
|
||||
break;
|
||||
case XA_WM_HINTS:
|
||||
updatewmhints(c);
|
||||
@@ -2744,27 +2770,27 @@ quit(const Arg *arg)
|
||||
#if COOL_AUTOSTART_PATCH
|
||||
size_t i;
|
||||
#endif // COOL_AUTOSTART_PATCH
|
||||
#if ONLYQUITONEMPTY_PATCH
|
||||
unsigned int n;
|
||||
Window *junk = malloc(1);
|
||||
|
||||
XQueryTree(dpy, root, junk, junk, &junk, &n);
|
||||
|
||||
if (n <= quit_empty_window_count)
|
||||
{
|
||||
#if RESTARTSIG_PATCH
|
||||
restart = arg->i;
|
||||
#endif // RESTARTSIG_PATCH
|
||||
running = 0;
|
||||
}
|
||||
else
|
||||
printf("[dwm] not exiting (n=%d)\n", n);
|
||||
|
||||
free(junk);
|
||||
#else // !ONLYQUITONEMPTY_PATCH
|
||||
#if RESTARTSIG_PATCH
|
||||
restart = arg->i;
|
||||
#endif // RESTARTSIG_PATCH
|
||||
#if ONLYQUITONEMPTY_PATCH
|
||||
Monitor *m;
|
||||
Client *c;
|
||||
unsigned int n = 0;
|
||||
|
||||
for (m = mons; m; m = m->next)
|
||||
for (c = m->clients; c; c = c->next, n++);
|
||||
|
||||
#if RESTARTSIG_PATCH
|
||||
if (restart || n <= quit_empty_window_count)
|
||||
#else
|
||||
if (n <= quit_empty_window_count)
|
||||
#endif // RESTARTSIG_PATCH
|
||||
running = 0;
|
||||
else
|
||||
fprintf(stderr, "[dwm] not exiting (n=%d)\n", n);
|
||||
|
||||
#else // !ONLYQUITONEMPTY_PATCH
|
||||
running = 0;
|
||||
#endif // ONLYQUITONEMPTY_PATCH
|
||||
|
||||
@@ -2995,7 +3021,7 @@ resizemouse(const Arg *arg)
|
||||
void
|
||||
restack(Monitor *m)
|
||||
{
|
||||
Client *c;
|
||||
Client *c, *f = NULL;
|
||||
XEvent ev;
|
||||
XWindowChanges wc;
|
||||
#if WARP_PATCH && FLEXTILE_DELUXE_LAYOUT
|
||||
@@ -3010,11 +3036,17 @@ restack(Monitor *m)
|
||||
return;
|
||||
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
|
||||
XRaiseWindow(dpy, m->sel->win);
|
||||
if (m->lt[m->sellt]->arrange && m->bar) {
|
||||
if (m->lt[m->sellt]->arrange) {
|
||||
wc.stack_mode = Below;
|
||||
wc.sibling = m->bar->win;
|
||||
if (m->bar) {
|
||||
wc.sibling = m->bar->win;
|
||||
} else {
|
||||
for (f = m->stack; f && (f->isfloating || !ISVISIBLE(f)); f = f->snext); // find first tiled stack client
|
||||
if (f)
|
||||
wc.sibling = f->win;
|
||||
}
|
||||
for (c = m->stack; c; c = c->snext)
|
||||
if (!c->isfloating && ISVISIBLE(c)) {
|
||||
if (!c->isfloating && ISVISIBLE(c) && c != f) {
|
||||
XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
|
||||
wc.sibling = c->win;
|
||||
}
|
||||
@@ -3492,6 +3524,9 @@ setup(void)
|
||||
signal(SIGTERM, sigterm);
|
||||
#endif // RESTARTSIG_PATCH
|
||||
|
||||
/* the one line of bloat that would have saved a lot of time for a lot of people */
|
||||
putenv("_JAVA_AWT_WM_NONREPARENTING=1");
|
||||
|
||||
/* init screen */
|
||||
screen = DefaultScreen(dpy);
|
||||
sw = DisplayWidth(dpy, screen);
|
||||
@@ -3942,6 +3977,10 @@ togglebar(const Arg *arg)
|
||||
updatebarpos(selmon);
|
||||
for (bar = selmon->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
#if BAR_SYSTRAY_PATCH
|
||||
if (!selmon->showbar && systray)
|
||||
XMoveWindow(dpy, systray->win, -32000, -32000);
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -4022,7 +4061,11 @@ toggletag(const Arg *arg)
|
||||
void
|
||||
toggleview(const Arg *arg)
|
||||
{
|
||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
|
||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);;
|
||||
#if TAGSYNC_PATCH
|
||||
Monitor *origselmon = selmon;
|
||||
for (selmon = mons; selmon; selmon = selmon->next) {
|
||||
#endif // TAGSYNC_PATCH
|
||||
#if PERTAG_PATCH
|
||||
int i;
|
||||
#endif // PERTAG_PATCH
|
||||
@@ -4093,11 +4136,25 @@ toggleview(const Arg *arg)
|
||||
togglebar(NULL);
|
||||
#endif // PERTAGBAR_PATCH
|
||||
#endif // PERTAG_PATCH
|
||||
#if !TAGSYNC_PATCH
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
#endif // TAGSYNC_PATCH
|
||||
#if !EMPTYVIEW_PATCH
|
||||
}
|
||||
#endif // EMPTYVIEW_PATCH
|
||||
#if TAGSYNC_PATCH
|
||||
}
|
||||
selmon = origselmon;
|
||||
#if !EMPTYVIEW_PATCH
|
||||
if (newtagset) {
|
||||
#endif // EMPTYVIEW_PATCH
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
#if !EMPTYVIEW_PATCH
|
||||
}
|
||||
#endif // EMPTYVIEW_PATCH
|
||||
#endif // TAGSYNC_PATCH
|
||||
#if BAR_EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // BAR_EWMHTAGS_PATCH
|
||||
@@ -4313,13 +4370,22 @@ updatebarpos(Monitor *m)
|
||||
m->ww = m->mw;
|
||||
m->wh = m->mh;
|
||||
Bar *bar;
|
||||
#if BAR_PADDING_PATCH
|
||||
int y_pad = vertpad;
|
||||
int x_pad = sidepad;
|
||||
#else
|
||||
int y_pad = 0;
|
||||
int x_pad = 0;
|
||||
#endif // BAR_PADDING_PATCH
|
||||
#if BAR_PADDING_VANITYGAPS_PATCH && VANITYGAPS_PATCH
|
||||
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
|
||||
if (!selmon || selmon->pertag->enablegaps[selmon->pertag->curtag])
|
||||
#else
|
||||
if (enablegaps)
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
{
|
||||
y_pad = gappoh;
|
||||
x_pad = gappov;
|
||||
}
|
||||
#elif BAR_PADDING_PATCH
|
||||
y_pad = vertpad;
|
||||
x_pad = sidepad;
|
||||
#endif // BAR_PADDING_PATCH | BAR_PADDING_VANITYGAPS_PATCH
|
||||
|
||||
#if INSETS_PATCH
|
||||
// Custom insets
|
||||
@@ -4419,46 +4485,42 @@ updategeom(void)
|
||||
#if SORTSCREENS_PATCH
|
||||
sortscreens(unique, nn);
|
||||
#endif // SORTSCREENS_PATCH
|
||||
if (n <= nn) { /* new monitors available */
|
||||
for (i = 0; i < (nn - n); i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
if (m)
|
||||
m->next = 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);
|
||||
}
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
/* new monitors if nn > n */
|
||||
for (i = n; i < nn; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
if (m)
|
||||
m->next = 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);
|
||||
}
|
||||
/* removed monitors if n > nn */
|
||||
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);
|
||||
}
|
||||
for (i = 0, m = mons; m; m = m->next, i++)
|
||||
m->index = i;
|
||||
free(unique);
|
||||
} else
|
||||
#endif /* XINERAMA */
|
||||
@@ -4503,11 +4565,11 @@ updatesizehints(Client *c)
|
||||
|
||||
if (!XGetWMNormalHints(dpy, c->win, &size, &msize))
|
||||
/* size is uninitialized, ensure that size.flags aren't used */
|
||||
#if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH
|
||||
#if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH || SIZEHINTS_ISFREESIZE_PATCH
|
||||
size.flags = 0;
|
||||
#else
|
||||
size.flags = PSize;
|
||||
#endif // SIZEHINTS_PATCH | SIZEHINTS_RULED_PATCH
|
||||
#endif // SIZEHINTS_PATCH | SIZEHINTS_RULED_PATCH | SIZEHINTS_ISFREESIZE_PATCH
|
||||
if (size.flags & PBaseSize) {
|
||||
c->basew = size.base_width;
|
||||
c->baseh = size.base_height;
|
||||
@@ -4539,8 +4601,13 @@ updatesizehints(Client *c)
|
||||
c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
|
||||
} else
|
||||
c->maxa = c->mina = 0.0;
|
||||
#if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH
|
||||
if (size.flags & PSize) {
|
||||
#if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH || SIZEHINTS_ISFREESIZE_PATCH
|
||||
#if SIZEHINTS_ISFREESIZE_PATCH
|
||||
if ((size.flags & PSize) && c->isfreesize)
|
||||
#else
|
||||
if (size.flags & PSize)
|
||||
#endif // SIZEHINTS_ISFREESIZE_PATCH
|
||||
{
|
||||
c->basew = size.base_width;
|
||||
c->baseh = size.base_height;
|
||||
c->isfloating = 1;
|
||||
@@ -4550,6 +4617,7 @@ updatesizehints(Client *c)
|
||||
#endif // SIZEHINTS_RULED_PATCH
|
||||
#endif // SIZEHINTS_PATCH
|
||||
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
||||
c->hintsvalid = 1;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -4641,6 +4709,10 @@ updatewmhints(Client *c)
|
||||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
#if TAGSYNC_PATCH
|
||||
Monitor *origselmon = selmon;
|
||||
for (selmon = mons; selmon; selmon = selmon->next) {
|
||||
#endif // TAGSYNC_PATCH
|
||||
#if EMPTYVIEW_PATCH
|
||||
if (arg->ui && (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
#else
|
||||
@@ -4655,18 +4727,20 @@ view(const Arg *arg)
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
#if PERTAG_PATCH
|
||||
pertagview(arg);
|
||||
#if SWAPFOCUS_PATCH
|
||||
Client *unmodified = selmon->pertag->prevclient[selmon->pertag->curtag];
|
||||
#endif // SWAPFOCUS_PATCH
|
||||
#else
|
||||
if (arg->ui & TAGMASK)
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
#endif // PERTAG_PATCH
|
||||
#if TAGSYNC_PATCH
|
||||
}
|
||||
selmon = origselmon;
|
||||
#endif // TAGSYNC_PATCH
|
||||
focus(NULL);
|
||||
#if SWAPFOCUS_PATCH && PERTAG_PATCH
|
||||
selmon->pertag->prevclient[selmon->pertag->curtag] = unmodified;
|
||||
#endif // SWAPFOCUS_PATCH
|
||||
#if TAGSYNC_PATCH
|
||||
arrange(NULL);
|
||||
#else
|
||||
arrange(selmon);
|
||||
#endif // TAGSYNC_PATCH
|
||||
#if BAR_EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // BAR_EWMHTAGS_PATCH
|
||||
|
@@ -7,8 +7,14 @@ width_awesomebar(Bar *bar, BarArg *a)
|
||||
int
|
||||
draw_awesomebar(Bar *bar, BarArg *a)
|
||||
{
|
||||
int n = 0, scm, remainder = 0, tabw, pad;
|
||||
int n = 0, scm, remainder = 0, tabw, tpad, tx, tw;
|
||||
unsigned int i;
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int cpad;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
#if BAR_WINICON_PATCH
|
||||
int ipad;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
#if BAR_TITLE_LEFT_PAD_PATCH && BAR_TITLE_RIGHT_PAD_PATCH
|
||||
int x = a->x + lrpad / 2, w = a->w - lrpad;
|
||||
#elif BAR_TITLE_LEFT_PAD_PATCH
|
||||
@@ -39,22 +45,49 @@ draw_awesomebar(Bar *bar, BarArg *a)
|
||||
else
|
||||
scm = SchemeTitleNorm;
|
||||
|
||||
pad = lrpad / 2;
|
||||
tpad = lrpad / 2;
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
cpad = 0;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
#if BAR_WINICON_PATCH
|
||||
ipad = c->icon ? c->icw + ICONSPACING : 0;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
|
||||
tx = x;
|
||||
tw = tabw;
|
||||
|
||||
#if BAR_WINICON_PATCH && BAR_CENTEREDWINDOWNAME_PATCH
|
||||
if (TEXTW(c->name) + ipad < tabw)
|
||||
cpad = (tabw - TEXTW(c->name) - ipad) / 2;
|
||||
#elif BAR_CENTEREDWINDOWNAME_PATCH
|
||||
if (TEXTW(c->name) < tabw)
|
||||
pad = (tabw - TEXTW(c->name) + lrpad) / 2;
|
||||
cpad = (tabw - TEXTW(c->name)) / 2;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
drw_setscheme(drw, scheme[scm]);
|
||||
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, tx, a->y, tw, a->h);
|
||||
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
/* Apply center padding, if any */
|
||||
tx += cpad;
|
||||
tw -= cpad;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
tx += tpad;
|
||||
tw -= lrpad;
|
||||
|
||||
#if BAR_WINICON_PATCH
|
||||
drw_text(drw, x, a->y, tabw + (i < remainder ? 1 : 0), a->h, pad + (c->icon ? c->icon->width + ICONSPACING : 0), c->name, 0, False);
|
||||
if (c->icon)
|
||||
drw_img(drw, x + pad, a->y + (a->h - c->icon->height) / 2, c->icon, tmpicon);
|
||||
#else
|
||||
drw_text(drw, x, a->y, tabw + (i < remainder ? 1 : 0), a->h, pad, c->name, 0, False);
|
||||
if (ipad) {
|
||||
drw_pic(drw, tx, a->y + (a->h - c->ich) / 2, c->icw, c->ich, c->icon);
|
||||
tx += ipad;
|
||||
tw -= ipad;
|
||||
}
|
||||
#endif // BAR_WINICON_PATCH
|
||||
|
||||
drw_text(drw, tx, a->y, tw, a->h, 0, c->name, 0, False);
|
||||
|
||||
drawstateindicator(c->mon, c, 1, x, a->y, tabw + (i < remainder ? 1 : 0), a->h, 0, 0, c->isfixed);
|
||||
x += tabw + (i < remainder ? 1 : 0);
|
||||
}
|
||||
|
@@ -50,4 +50,3 @@ updatecurrentdesktop(void)
|
||||
long data[] = { i };
|
||||
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,10 @@ width_fancybar(Bar *bar, BarArg *a)
|
||||
int
|
||||
draw_fancybar(Bar *bar, BarArg *a)
|
||||
{
|
||||
int ftw, mw, ew = 0, n = 0;
|
||||
int tabw, mw, ew = 0, n = 0, tx, tw;
|
||||
#if BAR_WINICON_PATCH
|
||||
int ipad;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
unsigned int i;
|
||||
Client *c;
|
||||
Monitor *m = bar->mon;
|
||||
@@ -28,25 +31,25 @@ draw_fancybar(Bar *bar, BarArg *a)
|
||||
}
|
||||
|
||||
if (n > 0) {
|
||||
ftw = TEXTW(m->sel->name);
|
||||
tabw = TEXTW(m->sel->name);
|
||||
#if BAR_WINICON_PATCH
|
||||
if (m->sel->icon)
|
||||
ftw += m->sel->icon->width + ICONSPACING;
|
||||
tabw += m->sel->icw + ICONSPACING;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
mw = (ftw >= w || n == 1) ? 0 : (w - ftw) / (n - 1);
|
||||
mw = (tabw >= w || n == 1) ? 0 : (w - tabw) / (n - 1);
|
||||
|
||||
i = 0;
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
if (!ISVISIBLE(c) || c == m->sel)
|
||||
continue;
|
||||
ftw = TEXTW(c->name);
|
||||
tabw = TEXTW(c->name);
|
||||
#if BAR_WINICON_PATCH
|
||||
if (c->icon)
|
||||
ftw += c->icon->width + ICONSPACING;
|
||||
tabw += c->icw + ICONSPACING;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
if (ftw < mw)
|
||||
ew += (mw - ftw);
|
||||
if (tabw < mw)
|
||||
ew += (mw - tabw);
|
||||
else
|
||||
i++;
|
||||
}
|
||||
@@ -57,24 +60,36 @@ draw_fancybar(Bar *bar, BarArg *a)
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
if (!ISVISIBLE(c))
|
||||
continue;
|
||||
ftw = MIN(m->sel == c ? w : mw, TEXTW(c->name));
|
||||
tabw = MIN(m->sel == c ? w : mw, TEXTW(c->name));
|
||||
#if BAR_WINICON_PATCH
|
||||
ipad = c->icon ? c->icw + ICONSPACING : 0;
|
||||
tabw += ipad;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
tx = x;
|
||||
tw = tabw;
|
||||
drw_setscheme(drw, scheme[m->sel == c ? SchemeTitleSel : SchemeTitleNorm]);
|
||||
if (ftw > 0) { /* trap special handling of 0 in drw_text */
|
||||
|
||||
drw_text(drw, x, a->y, ftw, a->h, lrpad / 2, c->name, 0, False);
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, tx, a->y, tw, a->h);
|
||||
|
||||
#if BAR_WINICON_PATCH
|
||||
drw_text(drw, x, a->y, ftw, a->h, lrpad / 2 + (c->icon ? c->icon->width + ICONSPACING : 0), c->name, 0, False);
|
||||
if (c->icon)
|
||||
drw_img(drw, x + lrpad / 2, a->y + (a->h - c->icon->height) / 2, c->icon, tmpicon);
|
||||
#else
|
||||
drw_text(drw, x, a->y, ftw, a->h, lrpad / 2, c->name, 0, False);
|
||||
#endif // BAR_WINICON_PATCH
|
||||
if (tabw <= 0) /* trap special handling of 0 in drw_text */
|
||||
continue;
|
||||
|
||||
tx += lrpad / 2;
|
||||
tw -= lrpad;
|
||||
|
||||
#if BAR_WINICON_PATCH
|
||||
if (ipad) {
|
||||
drw_pic(drw, tx, a->y + (a->h - c->ich) / 2, c->icw, c->ich, c->icon);
|
||||
tx += ipad;
|
||||
tw -= ipad;
|
||||
}
|
||||
drawstateindicator(c->mon, c, 1, x, a->y, ftw, a->h, 0, 0, c->isfixed);
|
||||
x += ftw;
|
||||
w -= ftw;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
|
||||
drw_text(drw, tx, a->y, tw, a->h, 0, c->name, 0, False);
|
||||
drawstateindicator(c->mon, c, 1, x, a->y, tabw, a->h, 0, 0, c->isfixed);
|
||||
x += tabw;
|
||||
w -= tabw;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
|
@@ -166,11 +166,21 @@ getselschemefor(int scheme)
|
||||
}
|
||||
|
||||
void
|
||||
flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Arg *arg, BarArg *barg)
|
||||
flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Arg *arg, BarArg *a)
|
||||
{
|
||||
if (!c)
|
||||
return;
|
||||
int i, nclienttags = 0, nviewtags = 0, pad = lrpad / 2;
|
||||
int i, nclienttags = 0, nviewtags = 0;
|
||||
int tpad = lrpad / 2;
|
||||
#if BAR_WINICON_PATCH
|
||||
int ipad = c->icon ? c->icw + ICONSPACING : 0;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int cpad = 0;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int tx = x;
|
||||
int tw = w;
|
||||
|
||||
int clientscheme = (
|
||||
c == selmon->sel && HIDDEN(c)
|
||||
? SchemeHidSel
|
||||
@@ -182,30 +192,49 @@ flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Ar
|
||||
? SchemeUrg
|
||||
: tabscheme
|
||||
);
|
||||
|
||||
drw_setscheme(drw, scheme[clientscheme]);
|
||||
XSetWindowBorder(dpy, c->win, scheme[clientscheme][ColBorder].pixel);
|
||||
if (w <= TEXTW("A") - lrpad + pad) // reduce text padding if wintitle is too small
|
||||
pad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2);
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
if (w <= TEXTW("A") - lrpad + tpad) // reduce text padding if wintitle is too small
|
||||
tpad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2);
|
||||
#if BAR_WINICON_PATCH && BAR_CENTEREDWINDOWNAME_PATCH
|
||||
else if (TEXTW(c->name) + ipad < w)
|
||||
cpad = (w - TEXTW(c->name) - ipad) / 2;
|
||||
#elif BAR_CENTEREDWINDOWNAME_PATCH
|
||||
else if (TEXTW(c->name) < w)
|
||||
pad = (w - TEXTW(c->name) + lrpad) / 2;
|
||||
cpad = (w - TEXTW(c->name)) / 2;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, a->y, w, a->h);
|
||||
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
/* Apply center padding, if any */
|
||||
tx += cpad;
|
||||
tw -= cpad;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
tx += tpad;
|
||||
tw -= lrpad;
|
||||
|
||||
#if BAR_WINICON_PATCH
|
||||
drw_text(drw, x, barg->y, w, barg->h, pad + (c->icon ? c->icon->width + ICONSPACING : 0), c->name, 0, False);
|
||||
if (c->icon)
|
||||
drw_img(drw, x + pad, barg->y + (barg->h - c->icon->height) / 2, c->icon, tmpicon);
|
||||
#else
|
||||
drw_text(drw, x, barg->y, w, barg->h, pad, c->name, 0, False);
|
||||
if (ipad) {
|
||||
drw_pic(drw, tx, a->y + (a->h - c->ich) / 2, c->icw, c->ich, c->icon);
|
||||
tx += ipad;
|
||||
tw -= ipad;
|
||||
}
|
||||
#endif // BAR_WINICON_PATCH
|
||||
|
||||
drawstateindicator(m, c, 1, x + 2, barg->y, w, barg->h, 0, 0, 0);
|
||||
drw_text(drw, tx, a->y, tw, a->h, 0, c->name, 0, False);
|
||||
drawstateindicator(m, c, 1, x + 2, a->y, w, a->h, 0, 0, 0);
|
||||
|
||||
if (FLEXWINTITLE_BORDERS) {
|
||||
XSetForeground(drw->dpy, drw->gc, scheme[SchemeSel][ColBorder].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, barg->y, 1, barg->h);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w - (x + w >= barg->w ? 1 : 0), barg->y, 1, barg->h);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, a->y, 1, a->h);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w - (x + w >= a->w ? 1 : 0), a->y, 1, a->h);
|
||||
}
|
||||
|
||||
/* Optional tags icons */
|
||||
for (i = 0; i < NUMTAGS; i++) {
|
||||
if ((m->tagset[m->seltags] >> i) & 1)
|
||||
@@ -215,7 +244,7 @@ flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Ar
|
||||
}
|
||||
|
||||
if (TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1)
|
||||
drawindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, 0, INDICATOR_RIGHT_TAGS);
|
||||
drawindicator(m, c, 1, x, a->y, w, a->h, 0, 0, 0, INDICATOR_RIGHT_TAGS);
|
||||
}
|
||||
|
||||
#ifndef HIDDEN
|
||||
|
@@ -8,6 +8,7 @@ holdbar(const Arg *arg)
|
||||
updatebarpos(selmon);
|
||||
for (bar = selmon->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
drawbar(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -29,6 +30,10 @@ keyrelease(XEvent *e)
|
||||
updatebarpos(selmon);
|
||||
for (bar = selmon->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
#if BAR_SYSTRAY_PATCH
|
||||
if (!selmon->showbar && systray)
|
||||
XMoveWindow(dpy, systray->win, -32000, -32000);
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
arrange(selmon);
|
||||
}
|
||||
#if COMBO_PATCH
|
||||
|
@@ -36,11 +36,21 @@ click_bartabgroups(Bar *bar, Arg *arg, BarArg *a)
|
||||
}
|
||||
|
||||
void
|
||||
bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg)
|
||||
bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *a)
|
||||
{
|
||||
if (!c)
|
||||
return;
|
||||
int i, nclienttags = 0, nviewtags = 0, pad = lrpad / 2;
|
||||
int i, nclienttags = 0, nviewtags = 0;
|
||||
int tpad = lrpad / 2;
|
||||
#if BAR_WINICON_PATCH
|
||||
int ipad = c->icon ? c->icw + ICONSPACING : 0;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int cpad = 0;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int tx = x;
|
||||
int tw = w;
|
||||
|
||||
drw_setscheme(drw, scheme[
|
||||
m->sel == c
|
||||
#ifdef HIDDEN
|
||||
@@ -55,27 +65,44 @@ bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg
|
||||
? SchemeTitleSel
|
||||
: SchemeTitleNorm
|
||||
]);
|
||||
if (w <= TEXTW("A") - lrpad + pad) // reduce text padding if wintitle is too small
|
||||
pad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2);
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
if (w <= TEXTW("A") - lrpad + tpad) // reduce text padding if wintitle is too small
|
||||
tpad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2);
|
||||
#if BAR_WINICON_PATCH && BAR_CENTEREDWINDOWNAME_PATCH
|
||||
else if (TEXTW(c->name) + ipad < w)
|
||||
cpad = (w - TEXTW(c->name) - ipad) / 2;
|
||||
#elif BAR_CENTEREDWINDOWNAME_PATCH
|
||||
else if (TEXTW(c->name) < w)
|
||||
pad = (w - TEXTW(c->name) + lrpad) / 2;
|
||||
cpad = (w - TEXTW(c->name)) / 2;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, a->y, w, a->h);
|
||||
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
/* Apply center padding, if any */
|
||||
tx += cpad;
|
||||
tw -= cpad;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
tx += tpad;
|
||||
tw -= lrpad;
|
||||
|
||||
#if BAR_WINICON_PATCH
|
||||
drw_text(drw, x, barg->y, w, barg->h, pad + (c->icon ? c->icon->width + ICONSPACING : 0), c->name, 0, False);
|
||||
if (c->icon)
|
||||
drw_img(drw, x + pad, barg->y + (barg->h - c->icon->height) / 2, c->icon, tmpicon);
|
||||
#else
|
||||
drw_text(drw, x, barg->y, w, barg->h, pad, c->name, 0, False);
|
||||
if (ipad) {
|
||||
drw_pic(drw, tx, a->y + (a->h - c->ich) / 2, c->icw, c->ich, c->icon);
|
||||
tx += ipad;
|
||||
tw -= ipad;
|
||||
}
|
||||
#endif // BAR_WINICON_PATCH
|
||||
|
||||
drawstateindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, c->isfixed);
|
||||
drw_text(drw, tx, a->y, tw, a->h, 0, c->name, 0, False);
|
||||
|
||||
drawstateindicator(m, c, 1, x, a->y, w, a->h, 0, 0, c->isfixed);
|
||||
|
||||
if (BARTAB_BORDERS) {
|
||||
XSetForeground(drw->dpy, drw->gc, scheme[SchemeSel][ColBorder].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, barg->y, 1, barg->h);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w - (x + w >= barg->w ? 1 : 0), barg->y, 1, barg->h);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, a->y, 1, a->h);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w - (x + w >= a->w ? 1 : 0), a->y, 1, a->h);
|
||||
}
|
||||
/* Optional tags icons */
|
||||
for (i = 0; i < NUMTAGS; i++) {
|
||||
@@ -86,7 +113,7 @@ bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg
|
||||
}
|
||||
|
||||
if (TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1)
|
||||
drawindicator(m, c, 1, x, barg->y, w, barg->h, 0, 0, 0, INDICATOR_RIGHT_TAGS);
|
||||
drawindicator(m, c, 1, x, a->y, w, a->h, 0, 0, 0, INDICATOR_RIGHT_TAGS);
|
||||
}
|
||||
|
||||
#ifndef HIDDEN
|
||||
|
@@ -4,7 +4,7 @@ tagicon(Monitor *m, int tag)
|
||||
#if BAR_ALTTAGSDECORATION_PATCH
|
||||
Client *c;
|
||||
#endif // BAR_ALTTAGSDECORATION_PATCH
|
||||
int tagindex = tag + NUMTAGS * m->index;
|
||||
int tagindex = tag + NUMTAGS * m->num;
|
||||
if (tagindex >= LENGTH(tagicons[DEFAULT_TAGS]))
|
||||
tagindex = tagindex % LENGTH(tagicons[DEFAULT_TAGS]);
|
||||
#if BAR_ALTTAGSDECORATION_PATCH
|
||||
|
91
patch/bar_taglabels.c
Normal file
91
patch/bar_taglabels.c
Normal file
@@ -0,0 +1,91 @@
|
||||
int
|
||||
width_taglabels(Bar *bar, BarArg *a)
|
||||
{
|
||||
int w, i;
|
||||
Client *c;
|
||||
Monitor *m = bar->mon;
|
||||
char *icon;
|
||||
unsigned int occ = 0;
|
||||
|
||||
for (c = m->clients; c; c = c->next)
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
|
||||
for (w = 0, i = 0; i < NUMTAGS; i++) {
|
||||
m->taglabel[i][0] = '\0';
|
||||
#if BAR_HIDEVACANTTAGS_PATCH
|
||||
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
continue;
|
||||
#endif // BAR_HIDEVACANTTAGS_PATCH
|
||||
icon = tagicon(m, i);
|
||||
XClassHint ch = { NULL, NULL };
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
if (c->tags & (1 << i)) {
|
||||
XGetClassHint(dpy, c->win, &ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ch.res_class) {
|
||||
if (lcaselbl)
|
||||
ch.res_class[0] = tolower(ch.res_class[0]);
|
||||
snprintf(m->taglabel[i], 64, ptagf, icon, ch.res_class);
|
||||
} else
|
||||
snprintf(m->taglabel[i], 64, etagf, icon);
|
||||
|
||||
w += TEXTW(m->taglabel[i]);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
int
|
||||
draw_taglabels(Bar *bar, BarArg *a)
|
||||
{
|
||||
int invert = 0;
|
||||
int w, x = a->x;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
Client *c;
|
||||
Monitor *m = bar->mon;
|
||||
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
|
||||
for (i = 0; i < NUMTAGS; i++) {
|
||||
/* do not draw vacant tags */
|
||||
if (!m->taglabel[i][0])
|
||||
continue;
|
||||
drw_setscheme(drw, scheme[
|
||||
m->tagset[m->seltags] & 1 << i
|
||||
? SchemeTagsSel
|
||||
: urg & 1 << i
|
||||
? SchemeUrg
|
||||
: SchemeTagsNorm
|
||||
]);
|
||||
w = TEXTW(m->taglabel[i]);
|
||||
drw_text(drw, x, a->y, w, a->h, lrpad / 2, m->taglabel[i], invert, False);
|
||||
drawindicator(m, NULL, occ, x, a->y, w, a->h, i, -1, invert, tagindicatortype);
|
||||
#if BAR_UNDERLINETAGS_PATCH
|
||||
if (ulineall || m->tagset[m->seltags] & 1 << i)
|
||||
drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
|
||||
#endif // BAR_UNDERLINETAGS_PATCH
|
||||
x += w;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
click_taglabels(Bar *bar, Arg *arg, BarArg *a)
|
||||
{
|
||||
int i = 0, x = lrpad / 2;
|
||||
Monitor *m = bar->mon;
|
||||
|
||||
do {
|
||||
if (!m->taglabel[i][0])
|
||||
continue;
|
||||
x += TEXTW(m->taglabel[i]);
|
||||
} while (a->x >= x && ++i < NUMTAGS);
|
||||
if (i < NUMTAGS) {
|
||||
arg->ui = 1 << i;
|
||||
}
|
||||
return ClkTagBar;
|
||||
}
|
5
patch/bar_taglabels.h
Normal file
5
patch/bar_taglabels.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <ctype.h> /* for making tab label lowercase, very tiny standard library */
|
||||
|
||||
static int width_taglabels(Bar *bar, BarArg *a);
|
||||
static int draw_taglabels(Bar *bar, BarArg *a);
|
||||
static int click_taglabels(Bar *bar, Arg *arg, BarArg *a);
|
@@ -57,6 +57,10 @@ draw_tags(Bar *bar, BarArg *a)
|
||||
]);
|
||||
drw_text(drw, x, a->y, w, a->h, lrpad / 2, icon, invert, False);
|
||||
drawindicator(m, NULL, occ, x, a->y, w, a->h, i, -1, invert, tagindicatortype);
|
||||
#if BAR_UNDERLINETAGS_PATCH
|
||||
if (ulineall || m->tagset[m->seltags] & 1 << i)
|
||||
drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
|
||||
#endif // BAR_UNDERLINETAGS_PATCH
|
||||
x += w;
|
||||
}
|
||||
|
||||
@@ -66,7 +70,7 @@ draw_tags(Bar *bar, BarArg *a)
|
||||
int
|
||||
click_tags(Bar *bar, Arg *arg, BarArg *a)
|
||||
{
|
||||
int i = 0, x = lrpad / 2;
|
||||
int i = 0, x = 0;
|
||||
#if BAR_HIDEVACANTTAGS_PATCH
|
||||
Client *c;
|
||||
unsigned int occ = 0;
|
||||
|
@@ -1,60 +1,12 @@
|
||||
static uint32_t tmpicon[ICONSIZE * ICONSIZE];
|
||||
|
||||
static uint32_t prealpha(uint32_t p) {
|
||||
uint8_t a = p >> 24u;
|
||||
uint32_t rb = (a * (p & 0xFF00FFu)) >> 8u;
|
||||
uint32_t g = (a * (p & 0x00FF00u)) >> 8u;
|
||||
return (rb & 0xFF00FFu) | (g & 0x00FF00u) | ((~a) << 24u);
|
||||
return (rb & 0xFF00FFu) | (g & 0x00FF00u) | (a << 24u);
|
||||
}
|
||||
|
||||
#if BAR_ALPHA_PATCH
|
||||
static uint8_t div255(uint16_t x) { return (x*0x8081u) >> 23u; }
|
||||
static uint32_t blend(uint32_t p1rb, uint32_t p1g, uint8_t p1a, uint32_t p2) {
|
||||
uint8_t a = p2 >> 24u;
|
||||
uint32_t rb = (p2 & 0xFF00FFu) + ( (a * p1rb) >> 8u );
|
||||
uint32_t g = (p2 & 0x00FF00u) + ( (a * p1g) >> 8u );
|
||||
return (rb & 0xFF00FFu) | (g & 0x00FF00u) | div255(~a * 255u + a * p1a) << 24u;
|
||||
}
|
||||
|
||||
void
|
||||
drw_img(Drw *drw, int x, int y, XImage *img, uint32_t *tmp)
|
||||
{
|
||||
if (!drw || !drw->scheme)
|
||||
return;
|
||||
uint32_t *data = (uint32_t *)img->data, p = drw->scheme[ColBg].pixel,
|
||||
prb = p & 0xFF00FFu, pg = p & 0x00FF00u;
|
||||
uint8_t pa = p >> 24u;
|
||||
int icsz = img->width * img->height, i;
|
||||
for (i = 0; i < icsz; ++i) tmp[i] = blend(prb, pg, pa, data[i]);
|
||||
|
||||
img->data = (char *) tmp;
|
||||
XPutImage(drw->dpy, drw->drawable, drw->gc, img, 0, 0, x, y, img->width, img->height);
|
||||
img->data = (char *) data;
|
||||
}
|
||||
#else
|
||||
static uint32_t blend(uint32_t p1rb, uint32_t p1g, uint32_t p2) {
|
||||
uint8_t a = p2 >> 24u;
|
||||
uint32_t rb = (p2 & 0xFF00FFu) + ( (a * p1rb) >> 8u );
|
||||
uint32_t g = (p2 & 0x00FF00u) + ( (a * p1g) >> 8u );
|
||||
return (rb & 0xFF00FFu) | (g & 0x00FF00u) | ((~a) << 24u);
|
||||
}
|
||||
|
||||
void
|
||||
drw_img(Drw *drw, int x, int y, XImage *img, uint32_t *tmp)
|
||||
{
|
||||
if (!drw || !drw->scheme)
|
||||
return;
|
||||
uint32_t *data = (uint32_t *)img->data, p = drw->scheme[ColBg].pixel, prb = p & 0xFF00FFu, pg = p & 0x00FF00u;
|
||||
int icsz = img->width * img->height, i;
|
||||
for (i = 0; i < icsz; ++i) tmp[i] = blend(prb, pg, data[i]);
|
||||
img->data = (char *) tmp;
|
||||
XPutImage(drw->dpy, drw->drawable, drw->gc, img, 0, 0, x, y, img->width, img->height);
|
||||
img->data = (char *) data;
|
||||
}
|
||||
#endif // BAR_ALPHA_PATCH
|
||||
|
||||
XImage *
|
||||
geticonprop(Window win)
|
||||
Picture
|
||||
geticonprop(Window win, unsigned int *picw, unsigned int *pich)
|
||||
{
|
||||
int format;
|
||||
unsigned long n, extra, *p = NULL;
|
||||
@@ -62,34 +14,32 @@ geticonprop(Window win)
|
||||
|
||||
if (XGetWindowProperty(dpy, win, netatom[NetWMIcon], 0L, LONG_MAX, False, AnyPropertyType,
|
||||
&real, &format, &n, &extra, (unsigned char **)&p) != Success)
|
||||
return NULL;
|
||||
if (n == 0 || format != 32) { XFree(p); return NULL; }
|
||||
return None;
|
||||
if (n == 0 || format != 32) { XFree(p); return None; }
|
||||
|
||||
unsigned long *bstp = NULL;
|
||||
uint32_t w, h, sz;
|
||||
|
||||
{
|
||||
const unsigned long *end = p + n;
|
||||
unsigned long *i;
|
||||
unsigned long *i; const unsigned long *end = p + n;
|
||||
uint32_t bstd = UINT32_MAX, d, m;
|
||||
for (i = p; i < end - 1; i += sz) {
|
||||
if ((w = *i++) > UINT16_MAX || (h = *i++) > UINT16_MAX) { XFree(p); return NULL; }
|
||||
if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; }
|
||||
if ((sz = w * h) > end - i) break;
|
||||
if ((m = w > h ? w : h) >= ICONSIZE && (d = m - ICONSIZE) < bstd) { bstd = d; bstp = i; }
|
||||
}
|
||||
if (!bstp) {
|
||||
for (i = p; i < end - 1; i += sz) {
|
||||
if ((w = *i++) > UINT16_MAX || (h = *i++) > UINT16_MAX) { XFree(p); return NULL; }
|
||||
if ((w = *i++) >= 16384 || (h = *i++) >= 16384) { XFree(p); return None; }
|
||||
if ((sz = w * h) > end - i) break;
|
||||
if ((d = ICONSIZE - (w > h ? w : h)) < bstd) { bstd = d; bstp = i; }
|
||||
}
|
||||
}
|
||||
if (!bstp) { XFree(p); return NULL; }
|
||||
if (!bstp) { XFree(p); return None; }
|
||||
}
|
||||
|
||||
if ((w = *(bstp - 2)) == 0 || (h = *(bstp - 1)) == 0) { XFree(p); return NULL; }
|
||||
if ((w = *(bstp - 2)) == 0 || (h = *(bstp - 1)) == 0) { XFree(p); return None; }
|
||||
|
||||
uint32_t icw, ich, icsz;
|
||||
uint32_t icw, ich;
|
||||
if (w <= h) {
|
||||
ich = ICONSIZE; icw = w * ICONSIZE / h;
|
||||
if (icw == 0) icw = 1;
|
||||
@@ -98,43 +48,92 @@ geticonprop(Window win)
|
||||
icw = ICONSIZE; ich = h * ICONSIZE / w;
|
||||
if (ich == 0) ich = 1;
|
||||
}
|
||||
icsz = icw * ich;
|
||||
*picw = icw; *pich = ich;
|
||||
|
||||
uint32_t i;
|
||||
#if ULONG_MAX > UINT32_MAX
|
||||
uint32_t *bstp32 = (uint32_t *)bstp;
|
||||
for (sz = w * h, i = 0; i < sz; ++i) bstp32[i] = bstp[i];
|
||||
#endif
|
||||
uint32_t *icbuf = malloc(icsz << 2); if(!icbuf) { XFree(p); return NULL; }
|
||||
if (w == icw && h == ich) memcpy(icbuf, bstp, icsz << 2);
|
||||
else {
|
||||
Imlib_Image origin = imlib_create_image_using_data(w, h, (DATA32 *)bstp);
|
||||
if (!origin) { XFree(p); free(icbuf); return NULL; }
|
||||
uint32_t i, *bstp32 = (uint32_t *)bstp;
|
||||
for (sz = w * h, i = 0; i < sz; ++i) bstp32[i] = prealpha(bstp[i]);
|
||||
|
||||
Picture ret = drw_picture_create_resized(drw, (char *)bstp, w, h, icw, ich);
|
||||
XFree(p);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Picture
|
||||
drw_picture_create_resized(Drw *drw, char *src, unsigned int srcw, unsigned int srch, unsigned int dstw, unsigned int dsth) {
|
||||
Pixmap pm;
|
||||
Picture pic;
|
||||
GC gc;
|
||||
|
||||
if (srcw <= (dstw << 1u) && srch <= (dsth << 1u)) {
|
||||
XImage img = {
|
||||
srcw, srch, 0, ZPixmap, src,
|
||||
ImageByteOrder(drw->dpy), BitmapUnit(drw->dpy), BitmapBitOrder(drw->dpy), 32,
|
||||
32, 0, 32,
|
||||
0, 0, 0
|
||||
};
|
||||
XInitImage(&img);
|
||||
|
||||
pm = XCreatePixmap(drw->dpy, drw->root, srcw, srch, 32);
|
||||
gc = XCreateGC(drw->dpy, pm, 0, NULL);
|
||||
XPutImage(drw->dpy, pm, gc, &img, 0, 0, 0, 0, srcw, srch);
|
||||
XFreeGC(drw->dpy, gc);
|
||||
|
||||
pic = XRenderCreatePicture(drw->dpy, pm, XRenderFindStandardFormat(drw->dpy, PictStandardARGB32), 0, NULL);
|
||||
XFreePixmap(drw->dpy, pm);
|
||||
|
||||
XRenderSetPictureFilter(drw->dpy, pic, FilterBilinear, NULL, 0);
|
||||
XTransform xf;
|
||||
xf.matrix[0][0] = (srcw << 16u) / dstw; xf.matrix[0][1] = 0; xf.matrix[0][2] = 0;
|
||||
xf.matrix[1][0] = 0; xf.matrix[1][1] = (srch << 16u) / dsth; xf.matrix[1][2] = 0;
|
||||
xf.matrix[2][0] = 0; xf.matrix[2][1] = 0; xf.matrix[2][2] = 65536;
|
||||
XRenderSetPictureTransform(drw->dpy, pic, &xf);
|
||||
} else {
|
||||
Imlib_Image origin = imlib_create_image_using_data(srcw, srch, (DATA32 *)src);
|
||||
if (!origin) return None;
|
||||
imlib_context_set_image(origin);
|
||||
imlib_image_set_has_alpha(1);
|
||||
Imlib_Image scaled = imlib_create_cropped_scaled_image(0, 0, w, h, icw, ich);
|
||||
Imlib_Image scaled = imlib_create_cropped_scaled_image(0, 0, srcw, srch, dstw, dsth);
|
||||
imlib_free_image_and_decache();
|
||||
if (!scaled) { XFree(p); free(icbuf); return NULL; }
|
||||
if (!scaled) return None;
|
||||
imlib_context_set_image(scaled);
|
||||
imlib_image_set_has_alpha(1);
|
||||
memcpy(icbuf, imlib_image_get_data_for_reading_only(), icsz << 2);
|
||||
|
||||
XImage img = {
|
||||
dstw, dsth, 0, ZPixmap, (char *)imlib_image_get_data_for_reading_only(),
|
||||
ImageByteOrder(drw->dpy), BitmapUnit(drw->dpy), BitmapBitOrder(drw->dpy), 32,
|
||||
32, 0, 32,
|
||||
0, 0, 0
|
||||
};
|
||||
XInitImage(&img);
|
||||
|
||||
pm = XCreatePixmap(drw->dpy, drw->root, dstw, dsth, 32);
|
||||
gc = XCreateGC(drw->dpy, pm, 0, NULL);
|
||||
XPutImage(drw->dpy, pm, gc, &img, 0, 0, 0, 0, dstw, dsth);
|
||||
imlib_free_image_and_decache();
|
||||
XFreeGC(drw->dpy, gc);
|
||||
|
||||
pic = XRenderCreatePicture(drw->dpy, pm, XRenderFindStandardFormat(drw->dpy, PictStandardARGB32), 0, NULL);
|
||||
XFreePixmap(drw->dpy, pm);
|
||||
}
|
||||
XFree(p);
|
||||
for (i = 0; i < icsz; ++i) icbuf[i] = prealpha(icbuf[i]);
|
||||
#if BAR_ALPHA_PATCH
|
||||
return XCreateImage(dpy, drw->visual, drw->depth, ZPixmap, 0, (char *)icbuf, icw, ich, 32, 0);
|
||||
#else
|
||||
return XCreateImage(dpy, DefaultVisual(dpy, screen), DefaultDepth(dpy, screen), ZPixmap, 0, (char *)icbuf, icw, ich, 32, 0);
|
||||
#endif // BAR_ALPHA_PATCH
|
||||
|
||||
return pic;
|
||||
}
|
||||
|
||||
void
|
||||
drw_pic(Drw *drw, int x, int y, unsigned int w, unsigned int h, Picture pic)
|
||||
{
|
||||
if (!drw)
|
||||
return;
|
||||
XRenderComposite(drw->dpy, PictOpOver, pic, None, drw->picture, 0, 0, 0, 0, x, y, w, h);
|
||||
}
|
||||
|
||||
void
|
||||
freeicon(Client *c)
|
||||
{
|
||||
if (c->icon) {
|
||||
XDestroyImage(c->icon);
|
||||
c->icon = NULL;
|
||||
XRenderFreePicture(dpy, c->icon);
|
||||
c->icon = None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,5 +141,5 @@ void
|
||||
updateicon(Client *c)
|
||||
{
|
||||
freeicon(c);
|
||||
c->icon = geticonprop(c->win);
|
||||
}
|
||||
c->icon = geticonprop(c->win, &c->icw, &c->ich);
|
||||
}
|
||||
|
@@ -2,7 +2,8 @@
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void drw_img(Drw *drw, int x, int y, XImage *img, uint32_t *tmp);
|
||||
static XImage *geticonprop(Window win);
|
||||
static Picture drw_picture_create_resized(Drw *drw, char *src, unsigned int src_w, unsigned int src_h, unsigned int dst_w, unsigned int dst_h);
|
||||
static void drw_pic(Drw *drw, int x, int y, unsigned int w, unsigned int h, Picture pic);
|
||||
static Picture geticonprop(Window w, unsigned int *icw, unsigned int *ich);
|
||||
static void freeicon(Client *c);
|
||||
static void updateicon(Client *c);
|
||||
static void updateicon(Client *c);
|
||||
|
@@ -18,7 +18,6 @@ draw_wintitle(Bar *bar, BarArg *a)
|
||||
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
|
||||
Monitor *m = bar->mon;
|
||||
Client *c = m->sel;
|
||||
int pad = lrpad / 2;
|
||||
|
||||
if (!c) {
|
||||
drw_setscheme(drw, scheme[SchemeTitleNorm]);
|
||||
@@ -26,23 +25,53 @@ draw_wintitle(Bar *bar, BarArg *a)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tpad = lrpad / 2;
|
||||
#if BAR_WINICON_PATCH
|
||||
int ipad = c->icon ? c->icw + ICONSPACING : 0;
|
||||
#endif // BAR_WINICON_PATCH
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int cpad = 0;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
int tx = x;
|
||||
int tw = w;
|
||||
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeTitleSel : SchemeTitleNorm]);
|
||||
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
XSetErrorHandler(xerrordummy);
|
||||
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
if (TEXTW(c->name) < w)
|
||||
pad = (w - TEXTW(c->name) + lrpad) / 2;
|
||||
|
||||
if (w <= TEXTW("A") - lrpad + tpad) // reduce text padding if wintitle is too small
|
||||
tpad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2);
|
||||
#if BAR_WINICON_PATCH && BAR_CENTEREDWINDOWNAME_PATCH
|
||||
else if (TEXTW(c->name) + ipad < w)
|
||||
cpad = (w - TEXTW(c->name) - ipad) / 2;
|
||||
#elif BAR_CENTEREDWINDOWNAME_PATCH
|
||||
else if (TEXTW(c->name) < w)
|
||||
cpad = (w - TEXTW(c->name)) / 2;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, a->y, w, a->h);
|
||||
|
||||
#if BAR_CENTEREDWINDOWNAME_PATCH
|
||||
/* Apply center padding, if any */
|
||||
tx += cpad;
|
||||
tw -= cpad;
|
||||
#endif // BAR_CENTEREDWINDOWNAME_PATCH
|
||||
|
||||
tx += tpad;
|
||||
tw -= lrpad;
|
||||
|
||||
#if BAR_WINICON_PATCH
|
||||
drw_text(drw, x, a->y, w, a->h, pad + (c->icon ? c->icon->width + ICONSPACING : 0), c->name, 0, False);
|
||||
if (c->icon)
|
||||
drw_img(drw, x + pad, a->y + (a->h - c->icon->height) / 2, c->icon, tmpicon);
|
||||
#else
|
||||
drw_text(drw, x, a->y, w, a->h, pad, c->name, 0, False);
|
||||
if (ipad) {
|
||||
drw_pic(drw, tx, a->y + (a->h - c->ich) / 2, c->icw, c->ich, c->icon);
|
||||
tx += ipad;
|
||||
tw -= ipad;
|
||||
}
|
||||
#endif // BAR_WINICON_PATCH
|
||||
|
||||
drw_text(drw, tx, a->y, tw, a->h, 0, c->name, 0, False);
|
||||
|
||||
#if BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(xerror);
|
||||
|
@@ -30,21 +30,10 @@ combotag(const Arg *arg)
|
||||
void
|
||||
comboview(const Arg *arg)
|
||||
{
|
||||
unsigned newtags = arg->ui & TAGMASK;
|
||||
if (combo) {
|
||||
selmon->tagset[selmon->seltags] |= newtags;
|
||||
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] | (arg->ui & TAGMASK) }));
|
||||
} else {
|
||||
selmon->seltags ^= 1; /*toggle tagset*/
|
||||
combo = 1;
|
||||
if (newtags) {
|
||||
#if PERTAG_PATCH
|
||||
pertagview(&((Arg) { .ui = newtags }));
|
||||
#else
|
||||
selmon->tagset[selmon->seltags] = newtags;
|
||||
#endif // PERTAG_PATCH
|
||||
}
|
||||
view(arg);
|
||||
}
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,16 @@
|
||||
void
|
||||
distributetags(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
unsigned int ui = 1;
|
||||
int i = 0;
|
||||
for (Client *c = selmon->clients; c; c = c->next) {
|
||||
|
||||
#if TAGSYNC_PATCH
|
||||
Monitor *origselmon = selmon;
|
||||
for (selmon = mons; selmon; selmon = selmon->next) {
|
||||
#endif // TAGSYNC_PATCH
|
||||
|
||||
for (c = selmon->clients; c; c = c->next) {
|
||||
if (HIDDEN(c))
|
||||
continue;
|
||||
if (!(c->tags & TAGMASK))
|
||||
@@ -11,7 +18,14 @@ distributetags(const Arg *arg)
|
||||
c->tags = (ui << i) & TAGMASK;
|
||||
i = (i + 1) % NUMTAGS;
|
||||
}
|
||||
|
||||
#if TAGSYNC_PATCH
|
||||
}
|
||||
selmon = origselmon;
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
#else
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
#endif // TAGSYNC_PATCH
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,9 @@
|
||||
void
|
||||
tagtoleft(const Arg *arg)
|
||||
{
|
||||
unsigned int MASK = (1 << NUMTAGS) - 1;
|
||||
if (selmon->sel != NULL
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] > 1) {
|
||||
selmon->sel->tags >>= 1;
|
||||
focus(NULL);
|
||||
@@ -13,9 +14,10 @@ tagtoleft(const Arg *arg)
|
||||
void
|
||||
tagtoright(const Arg *arg)
|
||||
{
|
||||
unsigned int MASK = (1 << NUMTAGS) - 1;
|
||||
if (selmon->sel != NULL
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] & (MASK >> 1)) {
|
||||
selmon->sel->tags <<= 1;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
@@ -25,80 +27,43 @@ tagtoright(const Arg *arg)
|
||||
void
|
||||
viewtoleft(const Arg *arg)
|
||||
{
|
||||
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
unsigned int MASK = (1 << NUMTAGS) - 1;
|
||||
if (__builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] > 1) {
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
#if PERTAG_PATCH
|
||||
pertagview(&((Arg) { .ui = selmon->tagset[selmon->seltags ^ 1] >> 1 }));
|
||||
#else
|
||||
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
|
||||
#endif // pertagview
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
#if BAR_EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // BAR_EWMHTAGS_PATCH
|
||||
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 }));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
viewtoright(const Arg *arg)
|
||||
{
|
||||
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
#if PERTAG_PATCH
|
||||
pertagview(&((Arg) { .ui = selmon->tagset[selmon->seltags ^ 1] << 1 }));
|
||||
#else
|
||||
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
|
||||
#endif // pertagview
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
#if BAR_EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // BAR_EWMHTAGS_PATCH
|
||||
unsigned int MASK = (1 << NUMTAGS) - 1;
|
||||
if (__builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] & (MASK >> 1)) {
|
||||
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 }));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tagandviewtoleft(const Arg *arg)
|
||||
{
|
||||
unsigned int MASK = (1 << NUMTAGS) - 1;
|
||||
if (selmon->sel != NULL
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] > 1) {
|
||||
selmon->sel->tags >>= 1;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
#if PERTAG_PATCH
|
||||
pertagview(&((Arg) { .ui = selmon->tagset[selmon->seltags ^ 1] >> 1 }));
|
||||
#else
|
||||
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
|
||||
#endif // pertagview
|
||||
focus(selmon->sel);
|
||||
arrange(selmon);
|
||||
#if BAR_EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // BAR_EWMHTAGS_PATCH
|
||||
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 }));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tagandviewtoright(const Arg *arg)
|
||||
{
|
||||
unsigned int MASK = (1 << NUMTAGS) - 1;
|
||||
if (selmon->sel != NULL
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] & (MASK >> 1)) {
|
||||
selmon->sel->tags <<= 1;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
#if PERTAG_PATCH
|
||||
pertagview(&((Arg) { .ui = selmon->tagset[selmon->seltags ^ 1] << 1 }));
|
||||
#else
|
||||
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
|
||||
#endif // pertagview
|
||||
focus(selmon->sel);
|
||||
arrange(selmon);
|
||||
#if BAR_EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // BAR_EWMHTAGS_PATCH
|
||||
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 }));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,9 +20,6 @@
|
||||
#if COMBO_PATCH
|
||||
#include "combo.c"
|
||||
#endif
|
||||
#if BAR_HOLDBAR_PATCH
|
||||
#include "bar_holdbar.c"
|
||||
#endif
|
||||
#if BAR_LTSYMBOL_PATCH
|
||||
#include "bar_ltsymbol.c"
|
||||
#endif
|
||||
@@ -56,6 +53,9 @@
|
||||
#if BAR_TAGS_PATCH
|
||||
#include "bar_tags.c"
|
||||
#endif
|
||||
#if BAR_TAGLABELS_PATCH
|
||||
#include "bar_taglabels.c"
|
||||
#endif
|
||||
#if BAR_TAGGRID_PATCH
|
||||
#include "bar_taggrid.c"
|
||||
#endif
|
||||
@@ -80,6 +80,9 @@
|
||||
#if BAR_SYSTRAY_PATCH
|
||||
#include "bar_systray.c"
|
||||
#endif
|
||||
#if BAR_HOLDBAR_PATCH
|
||||
#include "bar_holdbar.c"
|
||||
#endif
|
||||
#if BAR_VTCOLORS_PATCH
|
||||
#include "bar_vtcolors.c"
|
||||
#endif
|
||||
|
@@ -56,6 +56,9 @@
|
||||
#if BAR_TAGS_PATCH
|
||||
#include "bar_tags.h"
|
||||
#endif
|
||||
#if BAR_TAGLABELS_PATCH
|
||||
#include "bar_taglabels.h"
|
||||
#endif
|
||||
#if BAR_TAGGRID_PATCH
|
||||
#include "bar_taggrid.h"
|
||||
#endif
|
||||
|
@@ -88,8 +88,10 @@ placemouse(const Arg *arg)
|
||||
if ((r && r != prevr) || (attachmode != prevattachmode)) {
|
||||
detachstack(c);
|
||||
detach(c);
|
||||
if (c->mon != r->mon)
|
||||
if (c->mon != r->mon) {
|
||||
arrangemon(c->mon);
|
||||
c->tags = r->mon->tagset[r->mon->seltags];
|
||||
}
|
||||
|
||||
c->mon = r->mon;
|
||||
r->mon->sel = r;
|
||||
|
@@ -40,9 +40,11 @@ pushup(const Arg *arg)
|
||||
} else {
|
||||
/* move to the end */
|
||||
for (c = sel; c->next; c = c->next);
|
||||
detach(sel);
|
||||
sel->next = NULL;
|
||||
c->next = sel;
|
||||
if (sel != c) {
|
||||
detach(sel);
|
||||
sel->next = NULL;
|
||||
c->next = sel;
|
||||
}
|
||||
}
|
||||
focus(sel);
|
||||
arrange(selmon);
|
||||
|
@@ -1,28 +1,42 @@
|
||||
void
|
||||
reorganizetags(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
unsigned int occ, unocc, i;
|
||||
unsigned int tagdest[NUMTAGS];
|
||||
Client *c;
|
||||
unsigned int occ, unocc, i;
|
||||
unsigned int tagdest[NUMTAGS];
|
||||
|
||||
occ = 0;
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
occ |= (1 << (ffs(c->tags)-1));
|
||||
unocc = 0;
|
||||
for (i = 0; i < NUMTAGS; ++i) {
|
||||
while (unocc < i && (occ & (1 << unocc)))
|
||||
unocc++;
|
||||
if (occ & (1 << i)) {
|
||||
tagdest[i] = unocc;
|
||||
occ &= ~(1 << i);
|
||||
occ |= 1 << unocc;
|
||||
}
|
||||
}
|
||||
#if TAGSYNC_PATCH
|
||||
Monitor *origselmon = selmon;
|
||||
for (selmon = mons; selmon; selmon = selmon->next) {
|
||||
#endif // TAGSYNC_PATCH
|
||||
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
c->tags = 1 << tagdest[ffs(c->tags)-1];
|
||||
if (selmon->sel)
|
||||
selmon->tagset[selmon->seltags] = selmon->sel->tags;
|
||||
arrange(selmon);
|
||||
occ = 0;
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
occ |= (1 << (ffs(c->tags)-1));
|
||||
unocc = 0;
|
||||
for (i = 0; i < NUMTAGS; ++i) {
|
||||
while (unocc < i && (occ & (1 << unocc)))
|
||||
unocc++;
|
||||
if (occ & (1 << i)) {
|
||||
tagdest[i] = unocc;
|
||||
occ &= ~(1 << i);
|
||||
occ |= 1 << unocc;
|
||||
}
|
||||
}
|
||||
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
c->tags = 1 << tagdest[ffs(c->tags)-1];
|
||||
#if TAGSYNC_PATCH
|
||||
}
|
||||
selmon = origselmon;
|
||||
#endif // TAGSYNC_PATCH
|
||||
|
||||
if (selmon->sel)
|
||||
view(&((Arg) { .ui = selmon->sel->tags }));
|
||||
else
|
||||
#if TAGSYNC_PATCH
|
||||
arrange(NULL);
|
||||
#else
|
||||
arrange(selmon);
|
||||
#endif // TAGSYNC_PATCH
|
||||
}
|
||||
|
||||
|
@@ -2,44 +2,55 @@ void
|
||||
setborderpx(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
int prev_borderpx = selmon->borderpx;
|
||||
|
||||
if (arg->i == 0)
|
||||
selmon->borderpx = borderpx;
|
||||
else if (selmon->borderpx + arg->i < 0)
|
||||
selmon->borderpx = 0;
|
||||
else
|
||||
selmon->borderpx += arg->i;
|
||||
Monitor *m = selmon;
|
||||
#if BAR_BORDER_PATCH
|
||||
Bar *bar;
|
||||
#endif // BAR_BORDER_PATCH
|
||||
int prev_borderpx = m->borderpx;
|
||||
m->borderpx = arg->i
|
||||
? MAX(m->borderpx + arg->i, 0)
|
||||
: m->borderpx == borderpx
|
||||
? 0
|
||||
: borderpx;
|
||||
int delta = 2 * (m->borderpx - prev_borderpx);
|
||||
|
||||
#if BAR_BORDER_PATCH
|
||||
for (bar = selmon->bar; bar; bar = bar->next) {
|
||||
bar->bh = bar->bh - 2 * bar->borderpx + 2 * selmon->borderpx;
|
||||
bar->borderpx = selmon->borderpx;
|
||||
for (bar = m->bar; bar; bar = bar->next) {
|
||||
bar->bh = bar->bh - 2 * bar->borderpx + 2 * m->borderpx;
|
||||
bar->borderpx = m->borderpx;
|
||||
}
|
||||
updatebarpos(selmon);
|
||||
for (bar = selmon->bar; bar; bar = bar->next)
|
||||
updatebarpos(m);
|
||||
for (bar = m->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
#endif // BAR_BORDER_PATCH
|
||||
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
{
|
||||
if (c->bw + arg->i < 0)
|
||||
c->bw = 0;
|
||||
else
|
||||
c->bw = selmon->borderpx;
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
c->bw = m->borderpx;
|
||||
#if !FAKEFULLSCREEN_PATCH
|
||||
#if FAKEFULLSCREEN_CLIENT_PATCH
|
||||
if (c->isfullscreen && !c->fakefullscreen)
|
||||
continue;
|
||||
#else
|
||||
if (c->isfullscreen)
|
||||
continue;
|
||||
#endif // FAKEFULLSCREEN_CLIENT_PATCH
|
||||
#endif // FAKEFULLSCREEN_PATCH
|
||||
#if BAR_WINTITLEACTIONS_PATCH
|
||||
if (HIDDEN(c))
|
||||
continue;
|
||||
#endif // BAR_WINTITLEACTIONS_PATCH
|
||||
#if SCRATCHPADS_PATCH
|
||||
if ((c->tags & SPTAGMASK) && !ISVISIBLE(c))
|
||||
continue;
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
#if SCRATCHPAD_ALT_1_PATCH
|
||||
if ((c->tags & SCRATCHPAD_MASK))
|
||||
continue;
|
||||
#endif // SCRATCHPAD_ALT_1_PATCH
|
||||
if (!c->isfloating && m->lt[m->sellt]->arrange)
|
||||
continue;
|
||||
|
||||
if (c->isfloating || !selmon->lt[selmon->sellt]->arrange)
|
||||
{
|
||||
if (arg->i != 0 && prev_borderpx + arg->i >= 0)
|
||||
resize(c, c->x, c->y, c->w-(arg->i*2), c->h-(arg->i*2), 0);
|
||||
else if (arg->i != 0)
|
||||
resizeclient(c, c->x, c->y, c->w, c->h);
|
||||
else if (prev_borderpx > borderpx)
|
||||
resize(c, c->x, c->y, c->w + 2*(prev_borderpx - borderpx), c->h + 2*(prev_borderpx - borderpx), 0);
|
||||
else if (prev_borderpx < borderpx)
|
||||
resize(c, c->x, c->y, c->w - 2*(borderpx - prev_borderpx), c->h - 2*(borderpx - prev_borderpx), 0);
|
||||
}
|
||||
resizeclient(c, c->x, c->y, c->w - delta, c->h - delta);
|
||||
}
|
||||
arrange(selmon);
|
||||
arrange(m);
|
||||
}
|
||||
|
||||
|
@@ -8,12 +8,12 @@ shiftview(const Arg *arg)
|
||||
unsigned int seltagset = selmon->tagset[selmon->seltags];
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
if (arg->i > 0) // left circular shift
|
||||
shifted.ui = (seltagset << arg->i)
|
||||
| (seltagset >> (NUMTAGS - arg->i));
|
||||
shifted.ui = (seltagset << arg->i) | (seltagset >> (NUMTAGS - arg->i));
|
||||
else // right circular shift
|
||||
shifted.ui = seltagset >> -arg->i
|
||||
| seltagset << (NUMTAGS + arg->i);
|
||||
shifted.ui = (seltagset >> -arg->i) | (seltagset << (NUMTAGS + arg->i));
|
||||
#if SCRATCHPADS_PATCH
|
||||
shifted.ui &= ~SPTAGMASK;
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
|
||||
view(&shifted);
|
||||
}
|
||||
|
||||
|
@@ -1,2 +1 @@
|
||||
static void shiftview(const Arg *arg);
|
||||
|
||||
|
@@ -5,7 +5,11 @@ shiftviewclients(const Arg *arg)
|
||||
Client *c;
|
||||
unsigned int tagmask = 0;
|
||||
|
||||
for (c = selmon->clients; c; c = c->next)
|
||||
#if TAGSYNC_PATCH
|
||||
Monitor *origselmon = selmon;
|
||||
for (selmon = mons; selmon; selmon = selmon->next)
|
||||
#endif // TAGSYNC_PATCH
|
||||
for (c = selmon->clients; c; c = c->next) {
|
||||
#if SCRATCHPADS_PATCH
|
||||
if (!(c->tags & SPTAGMASK))
|
||||
tagmask = tagmask | c->tags;
|
||||
@@ -15,28 +19,28 @@ shiftviewclients(const Arg *arg)
|
||||
#else
|
||||
tagmask = tagmask | c->tags;
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
}
|
||||
#if TAGSYNC_PATCH
|
||||
selmon = origselmon;
|
||||
#endif // TAGSYNC_PATCH
|
||||
|
||||
#if SCRATCHPADS_PATCH
|
||||
shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
|
||||
#else
|
||||
shifted.ui = selmon->tagset[selmon->seltags];
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
if (arg->i > 0) // left circular shift
|
||||
do {
|
||||
|
||||
do {
|
||||
if (arg->i > 0) // left circular shift
|
||||
shifted.ui = (shifted.ui << arg->i)
|
||||
| (shifted.ui >> (NUMTAGS - arg->i));
|
||||
#if SCRATCHPADS_PATCH
|
||||
shifted.ui &= ~SPTAGMASK;
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
} while (tagmask && !(shifted.ui & tagmask));
|
||||
else // right circular shift
|
||||
do {
|
||||
shifted.ui = (shifted.ui >> (- arg->i)
|
||||
| shifted.ui << (NUMTAGS + arg->i));
|
||||
#if SCRATCHPADS_PATCH
|
||||
shifted.ui &= ~SPTAGMASK;
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
} while (tagmask && !(shifted.ui & tagmask));
|
||||
else // right circular shift
|
||||
shifted.ui = (shifted.ui >> -arg->i)
|
||||
| (shifted.ui << (NUMTAGS + arg->i));
|
||||
#if SCRATCHPADS_PATCH
|
||||
shifted.ui &= ~SPTAGMASK;
|
||||
#endif // SCRATCHPADS_PATCH
|
||||
} while (tagmask && !(shifted.ui & tagmask));
|
||||
|
||||
view(&shifted);
|
||||
}
|
||||
|
@@ -1,2 +1 @@
|
||||
static void shiftviewclients(const Arg *arg);
|
||||
|
||||
|
@@ -2,6 +2,10 @@ void
|
||||
checkfloatingrules(Client *c)
|
||||
{
|
||||
const char *class, *instance;
|
||||
Atom wintype;
|
||||
#if WINDOWROLERULE_PATCH
|
||||
char role[64];
|
||||
#endif // WINDOWROLERULE_PATCH
|
||||
unsigned int i;
|
||||
const Rule *r;
|
||||
XClassHint ch = { NULL, NULL };
|
||||
@@ -9,13 +13,23 @@ checkfloatingrules(Client *c)
|
||||
XGetClassHint(dpy, c->win, &ch);
|
||||
class = ch.res_class ? ch.res_class : broken;
|
||||
instance = ch.res_name ? ch.res_name : broken;
|
||||
wintype = getatomprop(c, netatom[NetWMWindowType]);
|
||||
#if WINDOWROLERULE_PATCH
|
||||
gettextprop(c->win, wmatom[WMWindowRole], role, sizeof(role));
|
||||
#endif // WINDOWROLERULE_PATCH
|
||||
|
||||
for (i = 0; i < LENGTH(rules); i++) {
|
||||
r = &rules[i];
|
||||
if ((!r->title || strstr(c->name, r->title))
|
||||
&& (!r->class || strstr(class, r->class))
|
||||
&& (!r->instance || strstr(instance, r->instance)))
|
||||
#if WINDOWROLERULE_PATCH
|
||||
&& (!r->role || strstr(role, r->role))
|
||||
#endif // WINDOWROLERULE_PATCH
|
||||
&& (!r->instance || strstr(instance, r->instance))
|
||||
&& (!r->wintype || wintype == XInternAtom(dpy, r->wintype, False)))
|
||||
{
|
||||
c->isfloating = r->isfloating;
|
||||
}
|
||||
}
|
||||
if (ch.res_class)
|
||||
XFree(ch.res_class);
|
||||
|
@@ -1,23 +1,31 @@
|
||||
void
|
||||
swaptags(const Arg *arg)
|
||||
{
|
||||
unsigned int newtag = arg->ui & TAGMASK;
|
||||
unsigned int curtag = selmon->tagset[selmon->seltags];
|
||||
Client *c;
|
||||
unsigned int newtag = arg->ui & TAGMASK;
|
||||
unsigned int curtag = selmon->tagset[selmon->seltags];
|
||||
|
||||
if (newtag == curtag || !curtag || (curtag & (curtag-1)))
|
||||
return;
|
||||
if (newtag == curtag || !curtag || (curtag & (curtag-1)))
|
||||
return;
|
||||
|
||||
for (Client *c = selmon->clients; c != NULL; c = c->next) {
|
||||
if ((c->tags & newtag) || (c->tags & curtag))
|
||||
c->tags ^= curtag ^ newtag;
|
||||
#if TAGSYNC_PATCH
|
||||
Monitor *origselmon = selmon;
|
||||
for (selmon = mons; selmon; selmon = selmon->next) {
|
||||
#endif // TAGSYNC_PATCH
|
||||
|
||||
if (!c->tags)
|
||||
c->tags = newtag;
|
||||
}
|
||||
for (c = selmon->clients; c != NULL; c = c->next) {
|
||||
if ((c->tags & newtag) || (c->tags & curtag))
|
||||
c->tags ^= curtag ^ newtag;
|
||||
|
||||
selmon->tagset[selmon->seltags] = newtag;
|
||||
if (!c->tags)
|
||||
c->tags = newtag;
|
||||
}
|
||||
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
#if TAGSYNC_PATCH
|
||||
}
|
||||
selmon = origselmon;
|
||||
#endif // TAGSYNC_PATCH
|
||||
|
||||
view(&((Arg) { .ui = newtag }));
|
||||
}
|
||||
|
||||
|
@@ -86,6 +86,16 @@ togglegaps(const Arg *arg)
|
||||
#else
|
||||
enablegaps = !enablegaps;
|
||||
#endif // PERTAG_VANITYGAPS_PATCH
|
||||
|
||||
#if BAR_PADDING_VANITYGAPS_PATCH
|
||||
updatebarpos(selmon);
|
||||
for (Bar *bar = selmon->bar; bar; bar = bar->next)
|
||||
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||
|
||||
#if BAR_SYSTRAY_PATCH
|
||||
drawbarwin(systray->bar);
|
||||
#endif // BAR_SYSTRAY_PATCH
|
||||
#endif // BAR_PADDING_VANITYGAPS_PATCH
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user