Compare commits

522 Commits

Author SHA1 Message Date
d8b91c7e8b Add window rule for heroic games launcher 2024-08-13 18:24:06 -04:00
d0f7c11925 Merge remote-tracking branch 'upstream/master' 2024-08-06 15:29:09 -04:00
36cbcf53a2 IPC: do not bail on events from unknown file descriptors ref. #433
The natural cycle for dwm-msg is that:
   - the client registers
   - the client sends a message
   - a response is sent back
   - the client deregisters

There is a race condition such that a new client may end up with the same
file descriptor as another command that is deregistering, resulting in a
message to come through from a file descriptor that is not registered.

The handling of this situation is that the IPC patch will log:

   Got event from unknown fd 7, ptr 0x7, u32 7, u64 7 with events 17

before gracefully stopping (exiting) dwm.

The consequence of the error itself seems benign and the proposal here is
to allow dwm to keep running despite not being able to process the dwm-msg
command successfully.
2024-08-01 14:56:48 +02:00
bbfe23ff81 Merge remote-tracking branch 'upstream/master' 2024-07-14 09:14:30 -04:00
f4258747be Swallow + noborder compatibility changes ref. #430 2024-07-14 14:27:11 +02:00
3bc91e187c Removing debug print statement 2024-07-14 14:26:45 +02:00
a10bfa96db Merge remote-tracking branch 'upstream/master' 2024-07-12 20:06:29 -04:00
f67b8be209 status2d: make sure to terminate the copied text with a NULL character 2024-07-12 19:22:24 +02:00
df75e113a9 launcher + status2d: correct spacing to be the same as when not using status2d 2024-07-12 16:28:46 +02:00
b4b19e3a4c Adding launcher patch 2024-07-11 22:38:58 +02:00
1ea3ac44ee Merge remote-tracking branch 'upstream/master' 2024-07-06 19:06:01 -04:00
8d754cd644 systray + xrdb compatibility issue ref. #429
When changing colour scheme during runtime using xrdb the systray and
icons would keep the original colours.

To work around that the systray icon windows need to be redrawn after
changing the background pixel value. Just calling XClearWindow for
each systray window results in the systray icons disappearing, they
do not automatically redraw. The solution is apparently to send an
Expose event to each window which should in principle trigger a redraw
from the application side.

One way to achieve this is to move the window out of the drawable area.
When the window is then brought back into view the X server will send
the Expose event for the window. The "easiest" way to do this is to
move the entire systray window out of view as part of the xrdb call.

It is possible to do this in the draw_systray function itself, but we
probably do not want to do this every single time the bar is drawn and
it may also cause some noticeable flickering.

This issue is isolated to using the systray without the alpha patch.
2024-07-01 09:53:43 +02:00
c9654817f8 Merge remote-tracking branch 'upstream/master' 2024-06-16 06:58:33 -04:00
c1e9e0b035 Add missing void to updateclientlist definition
Caught by -pedantic implying -Wstrict-prototypes for OpenBSD's 16.0.6 Clang.

ref.
https://git.suckless.org/dwm/commit/5687f4696472ba6029bbba18e293e3e8b9e154ea.html
2024-06-13 10:22:29 +02:00
ce57068ced Merge remote-tracking branch 'upstream/master' 2024-06-07 08:06:20 -04:00
edb36a3a14 togglefloating RENAMED_SCRATCHPADS_PATCH colour fix (#428)
Co-authored-by: Ampnbsp <Ampnbsp@email.org>
2024-06-06 21:23:07 +02:00
50df892d62 Merge remote-tracking branch 'upstream/master' 2024-05-22 07:21:56 -04:00
66770cfbcc pango: upgrade to 0230520-e81f17d
Missed this line from drw_font_getexts.
2024-05-17 11:06:30 +02:00
018bb8eb18 pango: upgrade to 0230520-e81f17d
This upgrades the pango patch to:
https://dwm.suckless.org/patches/pango/dwm-pango-20230520-e81f17d.diff

The changes are fixes for some vertical alignment issues that were obvious only for CJK fonts.

The implementation in dwm-flexipatch is still simplified compared to the original patch, e.g.
avoiding changes like drw->fonts to drw->font and many similar function signatures.
2024-05-17 09:33:13 +02:00
dcd6287f78 Update window rules 2024-05-13 08:11:22 -04:00
8dee563611 Rename graphics module to system76-power
- Display current graphics mode rather than nvidia driver version
2024-05-11 12:43:16 -04:00
d88c08a666 Merge remote-tracking branch 'upstream/master' 2024-05-08 09:56:23 -04:00
22f2f25a50 Unmanage steam notification toasts 2024-05-06 08:45:33 -04:00
f0c6bd28a0 Add NotoSans fonts to polybar
- Mainly to fix Millenium Parade in Spotify
2024-05-04 22:45:35 -04:00
dd1e34dbd6 switchtag: make sure to unfocus the selected client (if any) when triggering switchtag and potentially moving to another monitor ref. #425 2024-05-04 22:23:24 +02:00
f925b6c896 Update dunst click actions to use dunst script 2024-05-04 09:17:55 -04:00
0089c14d6e Add graphics module to show nvidia driver version 2024-05-04 09:02:08 -04:00
510b15c7b8 Kernel Module Click Action Fix
- Run fastfetch and nvidia-smi when kernel module is clicked
- Wait 15 seconds after commands are run so terminal doesn't
  exit prematurely
2024-05-03 19:42:26 -04:00
31c5ea9f26 Dunst Clear Notifications Module
- Add module to clear open notifications
- Change `/home/sravan` to `~/` in polybar
2024-05-03 19:31:04 -04:00
1fbc9b35d8 Add click action to kernel module to display fastfetch 2024-05-03 19:10:42 -04:00
33a8f5bb9a Update dunst module to include more buttons and history count
- Change filesystem module interval to 10 minutes
- Add more modules for dunst
- Change power menu module icon
- Change some media module components from scripts to text
2024-05-03 18:59:48 -04:00
fff5a42a45 Merge remote-tracking branch 'upstream/master' 2024-05-03 17:50:10 -04:00
79404e419f Fix for dwm crashing following unmapping of systray window that had been moved to another monitor ref. #423 2024-05-02 22:08:16 +02:00
d50575e707 Switch from xfce4-notifyd to dunst 2024-05-02 08:25:24 -04:00
15db2c6298 Attempt to fix unmanaged window rule not working 2024-05-01 20:39:15 -04:00
d298f3da81 xfce4-notifyd unmanage windows and polybar module
- Enable unmanaged patch
- Make xfce4-notifyd windows unmanaged instead of floating
- Change notification command to xfce4-notifyd
- Update polybar config to use xfce4-notifyd for notification module
2024-05-01 20:13:55 -04:00
3268ba4179 Add xfce4-notifyd as a floating window 2024-05-01 19:58:24 -04:00
20ae00286d Merge remote-tracking branch 'upstream/master' 2024-04-19 08:19:43 -04:00
a18f3ef370 noborder: refactoring implementation and adding same logic to configure function 2024-04-16 16:04:43 +02:00
be122437ed Add Bar Transparency and Remove Over/Under Lines 2024-04-13 13:56:07 -04:00
3797d8fda2 Invert polybar background and foreground colors for modules 2024-04-12 17:31:26 -04:00
3a886c7dc2 Update Tags & Window Rules
- Combine spotify and podcast tags into single audio tag
- Create new media/video tag
- Add window rules / update tag for bunch of applications
2024-04-12 17:14:08 -04:00
b2ffb9f2c1 Add Obsidian Window Rule 2024-04-05 08:17:13 -04:00
36b574eff6 Add bar padding smart patch (#419) 2024-04-04 16:51:13 +02:00
d24d567eb7 Replace Filelight with QDirStat 2024-03-31 08:33:53 -04:00
b0eb54e8cd Replace killall with pkill 2024-03-30 21:10:50 -04:00
92cff92b6b Make shebang more portable to NixOS 2024-03-30 20:03:08 -04:00
d565b6360f Add window rule for anytype 2024-03-30 09:43:26 -04:00
abf9b0ce09 Merge remote-tracking branch 'upstream/master' 2024-03-28 15:11:53 -04:00
23b55eaf9c Merge remote-tracking branch 'upstream/master' 2024-03-27 07:51:28 -04:00
82c3366317 tagpreview: proposed change to force hide preview window when changing tags ref. #415 2024-03-27 09:04:55 +01:00
cfabf03f62 bump version to 6.5
ref.
https://git.suckless.org/dwm/commit/061e9fe9a7db396c0c4f3d996c3908fb43a6d50c.html
2024-03-20 08:02:37 +01:00
e284bd7404 Change preprocessor directive values from N/A to 0 2024-03-17 20:17:51 -04:00
24e80c4eed Make tray background a configurable color 2024-03-15 14:08:28 -04:00
477a1c1202 Add a justfile for common commands 2024-03-15 13:35:37 -04:00
4ca6571a05 Merge remote-tracking branch 'upstream/master' 2024-03-15 13:30:29 -04:00
d2ba136896 Remove window rules for Ferdium and Notion 2024-03-15 13:25:54 -04:00
58b58dc44e Add PERMON_VANITYGAPS_PATCH (#343) 2024-03-14 09:38:21 +01:00
f4f7069cae Merge remote-tracking branch 'upstream/master' 2024-02-27 20:16:22 -05:00
5e85bc8b5c tab + alttab compatibility fix (conflicting function name drawtab) 2024-02-01 21:29:25 +01:00
01244cc1b9 Adding placedir patch ref. #407 2024-01-31 22:38:41 +01:00
597a30207a Merge remote-tracking branch 'upstream/master' 2023-12-24 11:45:12 -05:00
5a0c5e617f Adding the do-not-die-on-color-allocation-failure patch ref. #404 2023-12-22 10:42:16 +01:00
9869c22cb2 Adding sendmoncenter patch ref. #402 2023-12-01 09:38:22 +01:00
cbc88fc67e Change FiraCode to Monaspice Neon 2023-11-23 12:57:53 -05:00
3f62ec4e0d Update Window Rules
- Add automatic tagging for Logseq, Gamescope, Syncthing, Nyrna, and OpenRGB
- Remove auto tagging for specific gaming related apps since they
  should be running inside gamescope anyways
2023-11-21 15:11:17 -05:00
b1cae0ce5e Merge remote-tracking branch 'upstream/master' 2023-11-14 19:05:02 -05:00
03ede82d5c focusmaster: adding restack to address stack issues when using monocle or deck layouts ref. #398 2023-11-13 21:20:37 +01:00
bd29edf9c0 Merge remote-tracking branch 'upstream/master' 2023-11-12 12:18:09 -05:00
817db8c3ca Adding focusmaster-return patch variant ref. #398 2023-11-12 09:41:31 +01:00
d86ea2de25 Fix patch compatibility issue in the resizemousescroll function of TAPRESIZE_PATCH. (#393) 2023-11-08 21:34:43 +01:00
ad9664fa01 shift: skip sticky clients when working out which tags are occupied ref. #387 2023-11-08 21:09:27 +01:00
332c90049d sticky: prioritise non-sticky windows on focus(NULL) correction ref. #387 2023-11-07 21:44:39 +01:00
63bab1aa8a sticky: prioritise non-sticky windows on focus(NULL) ref. #387 2023-11-07 17:58:45 +01:00
4a22fd046c Fix when only one client in a tag and click it to hide it, then click it one more time, the client will not show as expected. (#385) 2023-11-05 22:07:43 +01:00
83a047aca7 shift: filter out scratchpad tags ref. #382 2023-11-04 21:38:38 +01:00
1b5a58f231 Fix space before tab in indent 2023-10-20 10:53:10 +02:00
d807d3da3e renamed scratchpads: allow a fullscreen scratchpad auto-hide when focus is lost if combined with both the losefullscreen patch and the auto-hide patch for renamed scratchpads 2023-10-03 21:25:10 +02:00
dd1660b1ed renamed scratchpads: auto-unhide a minimised (icon state) scratchpad when toggled 2023-10-02 09:51:34 +02:00
ddb2e833a4 tagpreview: adding compatibility with powerline tags and taglabels 2023-10-01 21:07:58 +02:00
8191c0739a focusonclick: not skipping motionnotify events as to avoid interferring with tagpreview and other on hover patches 2023-10-01 20:51:16 +02:00
3e97a1d25c Makefile: remove the options target
The Makefile used to suppress output (by using @), so this target made sense at
the time.

But the Makefile should be simple and make debugging with less abstractions or
fancy printing.  The Makefile was made verbose and doesn't hide the build
output, so remove this target.

Prompted by a question on the mailing list about the options target.

ref.
https://git.suckless.org/dwm/commit/9f8855343c881bdc01b9fff5b956537ba1106b76.html
2023-09-22 18:08:42 +02:00
5865c68c0e systray + unmanaged: fixed compatibility issue 2023-09-22 18:05:25 +02:00
7849eaa08b Use pkg-config to locate fribidi library's files (#369) 2023-08-24 18:18:03 +02:00
74abea7c70 Adding unmanaged patch ref. #365 2023-06-27 17:24:36 +02:00
ab7d28ff0f bar border - allow for the border size to be explicitly set ref. #364 2023-06-27 16:31:02 +02:00
99f6f1b52c Adding focusfollowmouse patch ref. #364 2023-06-27 16:07:57 +02:00
1a1ce47917 layoutmenu: fixing warning from original patch 2023-06-27 14:59:48 +02:00
91ded7cbaa Merge remote-tracking branch 'upstream/master' 2023-06-26 19:03:41 -04:00
10a6640732 Adding the toggletopbar patch ref. #363 2023-06-25 22:52:50 +02:00
9104d89a94 Add Window Rule for Beeper 2023-05-31 20:37:55 -04:00
ea2de713dd Merge remote-tracking branch 'upstream/master' 2023-05-27 09:28:05 -04:00
3881ad4ad1 config.mk - dropping __XSI_VISIBLE from CPPFLAGS, should no longer be necessary 2023-05-24 15:27:12 +02:00
ff1f901743 Updating link to rounded corners patch 2023-05-22 10:03:06 +02:00
f2ea04aca0 Fix Media Playing Music Icon 2023-05-21 14:28:16 -04:00
206cef01e4 Merge remote-tracking branch 'upstream/master' 2023-05-20 13:51:40 -04:00
6ef80c09ff switchtag + pertag conflict: the view would not actually change ref. #355 2023-05-20 16:21:55 +02:00
eca757eeea pertag + vanitygaps: store signed ints rather than unsigned in case negative gap values are used 2023-05-14 22:28:15 +02:00
b2f22c6205 Fix Rule Matching for Steam 2023-05-07 20:24:50 -04:00
88767e1741 Polybar Media Module Update
- Remove extra unused echo command
- Add icon for YouTube TV
2023-05-07 20:03:10 -04:00
11e7bd9e90 Nerd Font v3.0 Fix 2023-05-07 10:05:08 -04:00
34d674a3f8 Nerd Fonts v3 Update Icon Fix
- Fix nerd font icons for v3
2023-05-01 08:56:59 -04:00
dfb0318727 Swallow Patch & Window Rules
- Enable swallow patch
- Set kitty as `isterminal` for swallow
- Remove MATLAB rule with GNU Octave
- Add rules for Ubisoft Connect and Prism Launcher
- Remove rule for motrix (no longer using it)
2023-04-30 12:24:35 -04:00
f797d8d865 Increase Polybar Tray Maxsize
- Fixes missing ubisoft connect system
  tray icon
2023-04-30 12:01:43 -04:00
624a879ef2 Support for IPC Command to Quit/Restart 2023-04-30 11:47:29 -04:00
fa788244b1 Merge remote-tracking branch 'upstream/master' 2023-04-30 11:21:59 -04:00
5fefbfee64 cool autostart: restore SIGCHLD sighandler to default before spawning a program 2023-04-09 22:08:41 +02:00
ace6f1cd88 Bump to e81f17d.
restore SIGCHLD sighandler to default before spawning a program

From sigaction(2):
A child created via fork(2) inherits a copy of its parent's signal dispositions.
During an execve(2), the dispositions of handled signals are reset to the default;
the dispositions of ignored signals are left unchanged.

This refused to start directly some programs from configuring in config.h:

static Key keys[] = {
	MODKEY,                       XK_o,      spawn,          {.v = cmd } },
};

Some reported programs that didn't start were: mpv, anki, dmenu_extended.

Reported by pfx.
Initial patch suggestion by Storkman.

Ref.
https://git.suckless.org/dwm/commit/e81f17d4c196aaed6893fd4beed49991caa3e2a4.html
2023-04-09 21:53:05 +02:00
5498fed42b Bump to 348f655.
config.mk: update to _XOPEN_SOURCE=700L

SA_NOCLDWAIT is marked as XSI in the posix spec [0] and FreeBSD and NetBSD
seems to more be strict about the feature test macro [1].

so update the macro to use _XOPEN_SOURCE=700L instead, which is equivalent to
_POSIX_C_SOURCE=200809L except that it also unlocks the X/Open System
Interfaces.

[0]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html#tag_13_42
[1]: https://lists.suckless.org/dev/2302/35111.html

Tested on:
* NetBSD 9.3 (fixed).
* FreeBSD 13 (fixed).
* Void Linux musl.
* Void Linux glibc.
* OpenBSD 7.2 (stable).
* Slackware 11.

Reported-by: beastie <pufferfish@riseup.net>

Ref.
https://git.suckless.org/dwm/commit/348f6559ab0d4793db196ffa56ba96ab95a594a6.html
2023-04-09 21:51:26 +02:00
816487f4bb Adding workaround for gnu core utils treating cp -n as an error ref. #347
Changes to core utils had the side effect of treating the no-clobber option
as an error if the file was not copied if it already exists, thus causing
make to error as well.

Adding this workaround until that issue is addressed.

Alternative solutions:
   - always overwrite the file using the -f / --force option
   - prefix the cp command with a hyphen which will cause make to ignore
     the error, but still report it
   - never copy dwm.desktop during the installation process
2023-03-26 13:00:54 +02:00
fcbe686ff2 pertag vanitygaps patch - adjust description ref. #342 2023-02-18 10:31:32 +01:00
c613917d6b config.mk - passing __XSI_VISIBLE=1 via CPPFLAGS as needed for compilation on BSD systems ref. #340 2023-02-16 10:10:02 +01:00
e206d65f1e Add swallow/window icon compatibility (#336)
* Add swallow/window icon compatibility. Without this, after a client is
swallowed the old icon (usually from the terminal emulator) is
preserved. This is noticeable if you, say run `mpv` from a terminal
emulator which is a common use case.

---------

Co-authored-by: speedie <speedie@duck.com>
2023-02-03 20:04:00 +00:00
e424e87c40 Patch toggle BAR_TITLE_LEFT_PAD_PATCH to be disabled by default ref. #335 2023-02-02 21:14:42 +01:00
91551329e9 Bump to 712d663.
Use sigaction(SA_NOCLDWAIT) for SIGCHLD handling

signal() semantics are pretty unclearly specified. For example, depending on OS
kernel and libc, the handler may be returned to SIG_DFL (hence the inner call
to read the signal handler). Moving to sigaction() means the behaviour is
consistently defined.

Using SA_NOCLDWAIT also allows us to avoid calling the non-reentrant function
die() in the handler.

Some addditional notes for archival purposes:

* NRK pointed out errno of waitpid could also theoretically get clobbered.
* The original patch was iterated on and modified by NRK and Hiltjo:
  * SIG_DFL was changed to SIG_IGN, this is required, atleast on older systems
    such as tested on Slackware 11.
  * signals are not blocked using sigprocmask, because in theory it would
    briefly for example also ignore a SIGTERM signal. It is OK if waitpid() is (in
    theory interrupted).

POSIX reference:
"Consequences of Process Termination":
https://pubs.opengroup.org/onlinepubs/9699919799/functions/_Exit.html#tag_16_01_03_01

Ref. https://git.suckless.org/dwm/commit/712d6639ff8e863560328131bbb92b248dc9cde7.html

NB: Cool autostart patch to use prior logic for now
2023-01-30 09:45:51 +01:00
f713ddee39 cyclelayouts: reimplementing patch to not require the NULL layout, addresses #331 2023-01-29 22:13:50 +01:00
954e60b735 Adding proposed view history patch ref. #327 2023-01-18 21:58:32 +01:00
40e2cac4e9 pertag: simplifying implementation by removing prevtag 2023-01-18 21:18:14 +01:00
6c822cbfce emptyview: initialising arrays to 0 is redundant 2023-01-18 21:01:35 +01:00
b60fad590c Merge remote-tracking branch 'upstream/master' 2023-01-14 09:57:17 -05:00
6b7246cb90 zoomswap: proposed changes to ensure that previous zooms references are cleared when unmanaging a client ref. #324 2023-01-13 16:19:33 +01:00
2a8e68c5df Correcting path to /usr/local/share/xsessions/ ref. #317 2023-01-08 10:22:37 +01:00
3b72e139ec Revert "Hardcoding xsessions directory to /usr/share/xsessions as suggested in #317"
This reverts commit f0ad1117ba.
2023-01-08 10:20:34 +01:00
f0ad1117ba Hardcoding xsessions directory to /usr/share/xsessions as suggested in #317 2023-01-06 08:43:55 +01:00
746f9212bf Update dwm commit version in README 2022-12-22 19:33:51 -05:00
30f61c2e9e Merge remote-tracking branch 'upstream/master' 2022-12-22 19:31:13 -05:00
668e18fddf seamless restart: Fix positioning of hidden scratchpad windows following restart ref. #315 2022-12-14 17:56:50 +01:00
4c32f6f52d Bump to 89f9905.
grabkeys: Avoid missing events when a keysym maps to multiple keycodes

It's not uncommon for one keysym to map to multiple keycodes. For
example, the "play" button on my keyboard sends keycode 172, but my
bluetooth headphones send keycode 208, both of which map back to
XF86AudioPlay:

    % xmodmap -pke | grep XF86AudioPlay
    keycode 172 = XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause
    keycode 208 = XF86AudioPlay NoSymbol XF86AudioPlay
    keycode 215 = XF86AudioPlay NoSymbol XF86AudioPlay

This is a problem because the current code only grabs a single one of
these keycodes, which means that events for any other keycode also
mapping to the bound keysym will not be handled by dwm. In my case, this
means that binding XF86AudioPlay does the right thing and correctly
handles my keyboard's keys, but does nothing on my headphones. I'm not
the only person affected by this, there are other reports[0].

In order to fix this, we look at the mappings between keycodes and
keysyms at grabkeys() time and pick out all matching keycodes rather
than just the first one. The keypress() side of this doesn't need any
changes because the keycode gets converted back to a canonical keysym
before any action is taken.

0: https://github.com/cdown/dwm/issues/11

Ref.
https://git.suckless.org/dwm/commit/89f9905714c1c1b2e8b09986dfbeca15b68d8af8.html
2022-12-08 10:45:52 +01:00
dc4e535b25 tagpreview: make sure that tagwin is created following configure notify requests ref. #308 2022-11-15 10:31:15 +01:00
26123bff08 Merge remote-tracking branch 'upstream/master' 2022-11-05 11:00:05 -04:00
b4ae62d21a fakefullscreen: fix for mis-sized fullscreen applications
An example problematic situation would be to open a YouTube video
in Google Chrome and making that video fullscreen. Without this fix
the window will go into fullscreen within its tiled dimension, but
the size of the video will match that of the screen (and it will
be cropped).

With this fix the window will be resized which nudges the
application to adjust the fullscreen size accordingly.
2022-11-01 09:22:00 +01:00
319e414e85 Merge remote-tracking branch 'upstream/master' 2022-10-30 18:54:42 -04:00
ad56835713 Bump to ba56fe9.
Revert "Remove dmenumon variable"

This reverts commit c2b748e7931e5f28984efc236f9b1a212dbc65e8.

Revert back this change. It seems to not be an edge-case anymore since
multiple users have asked about this new behaviour now.

Ref.
https://git.suckless.org/dwm/commit/ba56fe9fea0a28d8184a727a987836a0903e2682.html
2022-10-30 10:32:43 +01:00
66e9847fd8 Merge remote-tracking branch 'upstream/master' 2022-10-21 08:20:09 -04:00
e6a74ad3ea roundedcorners: moving drawroundedcorners logic to resizeclient ref. #304 2022-10-16 21:32:01 +02:00
04410cb6a9 Merge remote-tracking branch 'upstream/master' 2022-10-15 10:20:39 -04:00
b732821f7b alttab: fixing crash when clients are on other tags 2022-10-13 12:34:09 +02:00
9a5378440c rounded rectangles: fullscreen compatibility fix ref. #304 2022-10-10 22:58:35 +02:00
cc58ad2ef4 Adding alt-tab patch ref. #303 2022-10-08 22:35:04 +02:00
4912e3129a Bump to 50ad171.
remove workaround for a crash with color emojis on some systems, now fixed in libXft 2.3.5

https://gitlab.freedesktop.org/xorg/lib/libxft/-/blob/libXft-2.3.5/NEWS

bump version to 6.4

Ref.
https://git.suckless.org/dwm/commit/970f37697358574e127019eb0ee2f5725ec05ce0.html
https://git.suckless.org/dwm/commit/50ad171eea9db5ccb36fce2592e047c3282975ff.html

Consequently the color emoji patch has been inverted into no color emoji, keeping the workaround in the code base for those that are on systems with older versions of the Xft library.
2022-10-06 14:44:11 +02:00
1ac17a4937 Add dwm.desktop file (#301) 2022-09-26 10:03:12 +02:00
82a127630d fullscreen: don't let the (always) center patch interfere with windows that start fullscreen 2022-09-18 20:39:31 +02:00
a7c292b7c3 Merge remote-tracking branch 'upstream/master' 2022-09-01 21:18:41 -04:00
2c180b8d9c Bump to c2b748e.
Remove dmenumon variable

Reasoning: Since 2011 dmenu has been capable of working out which
monitor currently has focus in a Xinerama setup, making the use
of the -m flag more or less redundant.

This is easily demonstrated by using dmenu in any other window
manager.

There used to be a nodmenu patch that provided these changes:
https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html

but this was removed on the basis that it was very easy to work
out and apply manually if needed.

The proposal here is to remove this dependency from dwm. The
mechanism of the dmenumon variable could be provided via a patch
if need be.

The edge case scenario that dmenu does not handle on its own, and
the effect of removing this mechanism, is that if the user trigger
focusmon via keybindings to change focus to another monitor that
has no clients, then dmenu will open on the monitor containing the
window with input focus (or the monitor with the mouse cursor if
no windows have input focus).

If this edge case is important to cover then this can be addressed
by setting input focus to selmon->barwin in the focus function if
there is no client to give focus to (rather than giving focus back
to the root window).

Ref.
https://git.suckless.org/dwm/commit/c2b748e7931e5f28984efc236f9b1a212dbc65e8.html
2022-08-29 21:49:41 +02:00
88eb89ab0d Roll back const change for IPCCommands 2022-08-29 21:37:43 +02:00
0f36ba5408 restartsig: call XNextEvent only when there is data to be read ref. #295 2022-08-29 21:37:03 +02:00
2624516bde Merge remote-tracking branch 'upstream/master' 2022-08-28 15:54:58 -04:00
90f9b2d982 Bump to 84d7322.
config.def.h: make keys and buttons const

Pretty much all other variables are declared as const when they're not
modified.

Ref.
https://git.suckless.org/dwm/commit/84d7322113c2bf023f5eaa8537fb0e72d4105046.html
2022-08-21 10:33:53 +02:00
b93a5de558 Expose showhideclient to external tools (fsignal, IPC) ref #287 2022-08-13 16:24:55 +02:00
ed439ddee4 Merge remote-tracking branch 'upstream/master' 2022-08-12 17:17:10 -04:00
2d34596ad0 Bump to 44adafe.
Make floating windows spawn within the monitor's window area

This is a follow-up on this thread:
https://lists.suckless.org/hackers/2208/18462.html

The orginal code had constraints such that if a window's starting
attributes (position and size) were to place the window outside of
the edges of the monitor, then the window would be moved into view
at the closest monitor edge.

There was an exception to this where if a top bar is used then the
window should not obscure the bar if present, which meant to place
the window within the window area instead.

The proposed change here makes it the general rule that floating
windows should spawn within the window area rather than within the
monitor area. This makes it simple and consistent with no
exceptions and it makes the intention of the code clear.

This has the benefit of making the behaviour consistent regardless
of whether the user is using a top bar or a bottom bar.

Additionally this will have an effect on patches that modify the
size of the window area. For example if the insets patch is used to
reserve space on the left hand side of the monitor for a dock or a
vertical bar then new floating clients will not obscure that area.

Ref.
https://git.suckless.org/dwm/commit/44adafe0069e73aa03a3829d7bb39591cd8b3f1d.html
2022-08-12 15:02:25 +02:00
c438eabdc2 Adding nametag patch 2022-08-12 13:47:25 +02:00
e55861f8a2 Merge remote-tracking branch 'upstream/master' 2022-08-11 16:22:16 -04:00
91cb32c3ed Bump to e0dee91.
sync code-style patch from libsl

Ref.
https://git.suckless.org/dwm/commit/e0dee911455cee739a5b05a994828f4a37a2764d.html
2022-08-08 14:41:21 +02:00
05175768cc Add more icons for media playing
- Netflix icon
- Hulu icon
- Amazon (prime video) icon
2022-08-07 19:38:24 -04:00
de6e519b9a Merge remote-tracking branch 'upstream/master' 2022-08-07 13:54:43 -04:00
d6205e3e89 autostart: upgrading to dwm-autostart-20210120-cb3f58a.diff 2022-08-07 10:50:25 +02:00
6a0e5b884e Bump to 5e76e7e.
code-style: simplify some checks

main change here is making the `zoom()` logic saner. the rest of the
changes are just small stuff which accumulated on my local branch.

pop() must not be called with NULL. and `zoom()` achieves this, but in a
very (unnecessarily) complicated way:

if c == NULL then nexttiled() will return NULL as well, so we enter this
branch:

	if (c == nexttiled(selmon->clients))

in here the !c check fails and the function returns before calling pop()

		if (!c || !(c = nexttiled(c->next)))
			return;

however, none of this was needed. we can simply return early if c was NULL.
Also `c` is set to `selmon->sel` so we can use `c` in the first check
instead which makes things shorter.

Ref.
https://git.suckless.org/dwm/commit/5e76e7e21da042c493c59235ca82d7275f20a7e4.html
2022-08-07 10:41:01 +02:00
10aa27171f Bump to 5b2e5e7.
spawn: reduce 2 lines, change fprintf() + perror() + exit() to die("... :")

when calling die and the last character of the string corresponds to
':', die() will call perror(). See util.c

Also change EXIT_SUCCESS to EXIT_FAILURE

Ref.
https://git.suckless.org/dwm/commit/5b2e5e7a4001479e4dc3e245f96e49f7ea0da658.html
2022-08-03 11:20:09 +02:00
4b20c92b4c Adding bidi patch ref. #285 2022-08-02 10:58:10 +02:00
2e496ed931 dwmc: adding string support ref. #284 2022-08-01 10:37:19 +02:00
d6393f1f36 Volume Polybar Module
- Add pulseaudio volume module
2022-07-31 17:57:58 -04:00
60a43475a9 Media Playing Module with Buttons
- Replace clicks and scroll actions with dedicated buttons
  for media playing module
- Add media-playing-change module to display current media
  source and left-click to change
- Add media-playing-prev/next to play previous or next
  track
- Add media-playing-play-pause to display pause button
  when media is playing and play button when media is
  paused
- Update media-playing to use Zscroll to scroll through
  artist and title text when over limit
- Add some extra helper scripts
2022-07-31 17:30:50 -04:00
6e15a7f4ea Merge remote-tracking branch 'upstream/master' 2022-07-29 07:50:41 -04:00
d9f79bea73 Bump to 9bffa84: use named parameter for func prototype
Ref. https://git.suckless.org/dwm/commit/9bffa845faa181fb3afe05f3dc86ad79c80736be.html
2022-07-28 11:29:50 +02:00
703e192fb4 Merge remote-tracking branch 'upstream/master' 2022-07-17 07:50:23 -04:00
df5eba3f8f cleanup: getting rid of unused argument a 2022-07-11 14:35:32 +02:00
d4ab4400ac restartsig and cool autostart: moving functionality to the cleanup function ref. #276 2022-07-11 11:04:01 +02:00
239be5e070 Merge remote-tracking branch 'upstream/master' 2022-07-05 20:40:31 -04:00
5f7df0b0dc Adding tagpreview patch (#271) 2022-07-05 14:55:42 +02:00
20692bea01 Refactoring shift functions ref. #270 2022-07-05 13:51:27 +02:00
782b5650b2 Merge remote-tracking branch 'upstream/master' 2022-07-04 14:10:42 -04:00
274602fa7a Updating readme to refer to shift-tools 2022-07-04 14:07:17 +02:00
197c218304 Adding shiftswaptags patch ref. #270 2022-07-04 13:56:39 +02:00
d3ab291944 Adding shiftboth patch ref. #270 2022-07-04 13:45:06 +02:00
279c571986 Adding shifttagclients patch ref. #270 2022-07-04 13:07:36 +02:00
a15a259926 Adding shifttag patch ref. #270 2022-07-04 11:28:23 +02:00
9b997a8dc3 Whitespace & Table of Contents Update 2022-07-02 11:05:31 -04:00
2cad32e265 Polybar Rounded Corners & Color Changes
- Update module colors
- Add overline color for modules
- Change default margin and padding to 0
- Add radius of 10.0 to bar
- Set line size to 4
- Switch `NotoSansDisplay Nerd Font` with `Ubuntu Nerd Font`
- Add text modules to add "rounded" effect
- Change powermenu symbol to arch logo
- Remove dunst notification status module
2022-07-01 18:51:30 -04:00
9706cb9cf7 Merge remote-tracking branch 'upstream/master'
- Add renamed scratchpads patch
- hide systray when there are no systray icons to show
2022-07-01 16:38:19 -04:00
404401622b systray: hide systray when there are no systray icons to show ref. #268 2022-06-27 11:07:26 +02:00
2f70c42aab Adding renamed scratchpads patch 2022-06-20 14:00:09 +02:00
3eddc34482 Replace Self Restart with Restart Sig
- Disable self restart patch
- Enable restart sig patch again
- Replace "Ferdi" window rule with "Ferdium"
2022-06-18 08:07:15 -04:00
e2d61fe154 Merge remote-tracking branch 'upstream/master' 2022-06-18 08:01:42 -04:00
d7456b235a systray: removing redundant getatomprop declaration in bar_systray.h, ref. #260 2022-06-18 11:04:03 +02:00
5053183365 Enable Seamless & Self Restart Patches
- Disable restart signal patch (external method of controlling dwm)
- Enable seamless restart patch (preserve wm settings across restart)
- Enable self restart patch (internal method of controlling dwm)
- Update self restart keybinding to be same as restart sig
2022-06-17 14:14:55 -04:00
95137984ea Merge remote-tracking branch 'upstream/master'
- Seamless restart patch
2022-06-17 14:07:10 -04:00
39fde74dfd systray: allow systray icons to survive a restart by handing systray icons over to the root window before destroying the systray window 2022-06-17 16:58:47 +02:00
82c72835f6 restartsig + systray: allow systray icons to survive a restart by not destroying the systray window 2022-06-17 16:13:10 +02:00
440c4a6efa Porting the seamless restart feature from dusk into dwm-flexipatch 2022-06-17 14:36:20 +02:00
cadf3a896a Merge remote-tracking branch 'upstream/master' 2022-06-12 11:17:23 -04:00
6f7d9b1bdf unmanage: stop listening for events for unmanaged windows
This is in particular to avoid flickering in dwm (and high CPU usage)
when hovering the mouse over a tabbed window that was previously
managed by dwm.

Consider the following two scenarios:

1)

We start tabbed (window 0xc000003), tabbed is managed by the
window manager.
We start st being embedded into tabbed.

$ st -w 0xc000003

What happens here is that:
   - tabbed gets a MapRequest for the st window
   - tabbed reparents the st window
   - tabbed will receive X events for the window

The window manager will have no awareness of the st window and the
X server will not send X events to the window manager relating to
the st window.

There is no flickering or any other issues relating to focus.

2)

We start tabbed (window 0xc000003), tabbed is managed by the
window manager.
We start st as normal (window 0xd400005).

What happens here is that:
   - the window manager gets a MapRequest for the st window
   - dwm manages the st window as a normal client
   - dwm will receive X events for the window

Now we use xdotool to trigger a reparenting of the st window into
tabbed.

$ xdotool windowreparent 0xd400005 0xc000003

What happens here is that:
   - tabbed gets a MapRequest for the st window
   - tabbed reparents the st window
   - the window manager gets an UnmapNotify
   - the window manager no longer manages the st window
   - both the window manager and tabbed will receive X events
     for the st window

In dwm move the mouse cursor over the tabbed window.

What happens now is that:
   - dwm will receive a FocusIn event for the tabbed window
   - dwm will set input focus for the tabbed window
   - tabbed will receive a FocusIn event for the main window
   - tabbed will give focus to the window on the currently selected
     tab
   - which again triggers a FocusIn event which dwm receives
   - dwm determines that the window that the FocusIn event is for
     (0xd400005) is not the currently selected client (tabbed)
   - dwm sets input focus for the tabbed window
   - this causes an infinite loop as long as the mouse cursor hovers
     the tabbed window, resulting in flickering and high CPU usage

The fix here is to tell the X server that we are no longer interested
in receiving events for this window when the window manager stops
managing the window.
2022-06-12 12:29:04 +02:00
67455908f2 Merge remote-tracking branch 'upstream/master' 2022-06-10 08:12:33 -04:00
54070d7e51 vanitygaps + pertag: enablegaps should be retrieved from the current monitor, not the selected monitor ref. #258 2022-06-10 13:25:21 +02:00
11a81c6b50 Fix typo
- Change `config.jk` to `config.mk` in README.org
- Add changes to `config.jk` in README.org to reflect current config.mk
  from merge
2022-05-21 12:33:59 -04:00
8b40395af8 Fix missing line in barrules 2022-05-21 12:03:27 -04:00
fb5b3c421c Merge remote-tracking branch 'upstream/master' 2022-05-21 11:42:06 -04:00
46abde8de4 Trackma-gtk Auto-Assign Tag
- Add window rule for trackma-gtk to move to tag 9
2022-05-18 18:00:22 -04:00
bc90dd0107 Small Fixes
- Fix spacing issue with TAGMONFIXFS_PATCH in README.org
- Remove `-e` option from kitty commands in polybar
2022-05-18 17:47:31 -04:00
c553f93b52 shiftview + scrachpads compatibility 2022-05-08 21:43:57 +02:00
4f61dab020 Adjust Media Module Order
- Title then artist
- Replace blank title/artist with "N/A"
2022-05-01 16:44:50 -04:00
2ecc15a2ef manage: Make sure c->isfixed is applied before floating checks
Commit 8806b6e23793 ("manage: propertynotify: Reduce cost of unused size
hints") mistakenly removed an early size hints update that's needed to
populate c->isfixed for floating checks at manage() time. This resulted
in fixed (size hint min dimensions == max dimensions) subset of windows
not floating when they should.

See https://lists.suckless.org/dev/2204/34730.html for discussion.

Ref.
https://git.suckless.org/dwm/commit/8b48e309735f5fe49d35f86e967f4b5dea2a2f2d.html
2022-04-26 17:26:35 +02:00
f2b37c411c LICENSE: add Chris Down
Ref.
https://git.suckless.org/dwm/commit/a83dc2031050d786ddf5f329b57d658a931c94b7.html
2022-04-26 17:23:19 +02:00
38f709fea5 Revert "manage: For isfloating/oldstate check/set, ensure trans client actually exists"
This reverts commit bece862a0fc4fc18ef9065b18cd28e2032d0d975.

It caused a regression, for example:
https://lists.suckless.org/hackers/2203/18220.html

Ref.
https://git.suckless.org/dwm/commit/a4771de5ba54a38b062a7d748635f21c141b5c7e.html
2022-04-26 17:22:11 +02:00
49fc922f0d For all intensive purposes the monitor index is the same as monitor num, thus refactoring to use the latter 2022-04-17 10:33:26 +02:00
b2fbf08d3c Update monitor positions also on removal
When monitors are removed, the coordinates of existing monitors may
change, if the removed monitors had smaller coordinates than the
remaining ones.

Remove special case handling so that the same update-if-necessary loop
is run also in the case when monitors are removed.

ref.
https://git.suckless.org/dwm/commit/d93ff48803f04f1363bf303af1d7e6ccc5cb8d3f.html#h0-0-21
2022-04-17 10:24:02 +02:00
53d71de38d manage: propertynotify: Reduce cost of unused size hints
This patch defers all size hint calculations until they are actually
needed, drastically reducing the number of calls to updatesizehints(),
which can be expensive when called repeatedly (as it currently is during
resizes).

In my unscientific testing this reduces calls to updatesizehints() by
over 90% during a typical work session. There are no functional changes
for users other than an increase in responsiveness after resizes and
a reduction in CPU time.

In slower environments or X servers, this patch also offers an
improvement in responsiveness that is often tangible after resizing a
client that changes hints during resizes.

There are two main motivations to defer this work to the time of hint
application:

1. Some clients, especially terminals using incremental size hints,
   resend XA_WM_NORMAL_HINTS events on resize to avoid fighting with the
   WM or mouse resizing. For example, some terminals like urxvt clear
   PBaseSize and PResizeInc during XResizeWindow and restore them
   afterwards.

   For this reason, after the resize is concluded, we typically receive
   a backlogged XA_WM_NORMAL_HINTS message for each update period with
   movement, which is useless. In some cases one may get hundreds or
   thousands of XA_WM_NORMAL_HINTS messages on large resizes, and
   currently all of these result in a separate updatesizehints() call,
   of which all but the final one are immediately outdated.

   (We can't just blindly discard these messages during resizes like we
   do for EnterNotify, because some of them might actually be for other
   windows, and may not be XA_WM_NORMAL_HINTS events.)

2. For users which use resizehints=0 most of these updates are unused
   anyway -- in the normal case where the client is not floating these
   values won't be used, so there's no need to calculate them up front.

A synthetic test using the mouse to resize a floating terminal window
from roughly 256x256 to 1024x1024 and back again shows that the number
of calls to updatesizehints() goes from over 500 before this patch (one
for each update interval with movement) to 2 after this patch (one for
each hint application), with no change in user visible behaviour.

This also reduces the delay before dwm is ready to process new events
again after a large resize on such a client, as it avoids the thundering
herd of updatesizehints() calls when hundreds of backlogged
XA_WM_NORMAL_HINTS messages appear at once after a resize is finished.

ref.
https://git.suckless.org/dwm/commit/8806b6e2379372900e3d9e0bf6604bc7f727350b.html#h0-0-4
2022-04-17 10:15:22 +02:00
6a0f5b4250 setborderpx: refactoring patch 2022-03-30 14:20:27 +02:00
93f9d97e84 Adding link to map of patches 2022-03-20 16:31:16 +01:00
8f93bb8931 manage: For isfloating/oldstate check/set, ensure trans client actually exists
In certain instances trans may be set to a window that doesn't actually
map to a client via wintoclient; in this case it doesn't make sense
to set isfloating/oldstate since trans is essentially invalid in that
case / correlates to the above condition check where trans is set /
XGetTransientForHint is called.

Ref.
https://git.suckless.org/dwm/commit/bece862a0fc4fc18ef9065b18cd28e2032d0d975.html
2022-03-14 09:41:32 +01:00
da5e69c4a7 holdbar + systray compatibility - make systray follow the bar when being revealed and hidden ref. #239 2022-03-10 09:35:12 +01:00
adc05c2332 Upgrading winicon patch to v2.1 ref. #238 2022-03-06 11:38:22 +01:00
5c321794f1 Fixed moving window tag issue (#237)
+ when moving window from monitor with different tags selected the moved
  window would not get the tags set properly if multiple windows are
  already on that monitor
2022-02-24 12:49:52 +01:00
55592623f5 focusadjacenttags + scratchpad compatibility issue ref. #236 2022-02-20 13:24:52 +01:00
96820b2d51 tagsync: adding reference in README.md 2022-02-11 17:02:45 +01:00
ae67378b20 Tag-Sync patch (for syncing tags across all monitors) (#219)
* Tag-Sync patch
* Major compatibility updates
* SWITCHTAG/TAGSYNC compatibility
* tagsync: refactoring

Co-authored-by: bakkeby <bakkeby@gmail.com>
2022-02-11 16:57:53 +01:00
8f986a4e3b Merge branch 'UtkarshVerma-bar-gaps' ref. #208 2022-02-11 11:48:27 +01:00
282dc2ad22 barpadding: adding vanitygaps variant 2022-02-11 11:43:36 +01:00
90e4dfc0cf Adding the isfreesize version of the sizehints patch ref. #229 2022-02-11 11:43:36 +01:00
a0751271bc sizehints ruled: have rule checks take window type and role into account ref. #229 2022-02-11 11:43:36 +01:00
8e36c36bcf Fix for drw_text cropping one characters too many when the text is too long and replacing with ... ref. #216 2022-02-11 11:43:36 +01:00
d1662b6636 Ignoring unused functions warnings.
This is achieved by adding the -Wno-unused-function flag to the compiler.
The warnings are suppressed to avoid confusion for users new to dwm.

Removing the static declaration from the header files works too, but adds
unnecessary data into the compiled object.
2022-02-11 11:43:35 +01:00
5c80a54b62 Refactoring restack to allow it to work without having the bar as a reference ref. #214 2022-02-11 11:43:35 +01:00
b17ea8e2de Refactoring window title drawing with regards to icons ref. #216 2022-02-11 11:43:35 +01:00
a0d5ba9369 tags bar module: fix for wrong click offset ref. #215 2022-02-11 11:43:35 +01:00
2771f3d1c9 bump version to 6.3 2022-02-11 11:43:35 +01:00
094c8ff363 Add a configuration option for fullscreen locking
Some people are annoyed to have this new behaviour forced for some
application which use fake fullscreen.

Ref. https://git.suckless.org/dwm/commit/138b405f0c8aa24d8a040cc1a1cf6e3eb5a0ebc7.html
2022-02-11 11:43:34 +01:00
1920595795 drawbar: Don't expend effort drawing bar if it is occluded
I noticed that a non-trivial amount of dwm's work on my machine was from
drw_text, which seemed weird, because I have the bar disabled and we
only use drw_text as part of bar drawing.

Looking more closely, I realised that while we use m->showbar when
updating the monitor bar margins, but don't skip actually drawing the
bar if it is hidden. This patch skips drawing it entirely if that is the
case.

On my machine, this takes 10% of dwm's on-CPU time, primarily from
restack() and focus().

When the bar is toggled on again, the X server will generate an Expose
event, and we'll redraw the bar as normal as part of expose().

Ref. https://git.suckless.org/dwm/commit/8657affa2a61e85ca8df76b62e43cb02897d1d80.html
2022-02-11 11:43:34 +01:00
aa1a7ff708 Fix for infinite loop when there is only one client and pushup is run twice 2022-02-11 11:43:34 +01:00
065c17de4c Adding the isfreesize version of the sizehints patch ref. #229 2022-02-11 10:10:28 +01:00
24ca9b4243 sizehints ruled: have rule checks take window type and role into account ref. #229 2022-02-11 09:44:40 +01:00
4366f72390 Fix for drw_text cropping one characters too many when the text is too long and replacing with ... ref. #216 2022-01-20 22:21:55 +01:00
2c5f877bd2 Ignoring unused functions warnings.
This is achieved by adding the -Wno-unused-function flag to the compiler.
The warnings are suppressed to avoid confusion for users new to dwm.

Removing the static declaration from the header files works too, but adds
unnecessary data into the compiled object.
2022-01-18 14:29:11 +01:00
e6dc6a3016 Refactoring restack to allow it to work without having the bar as a reference ref. #214 2022-01-18 11:08:34 +01:00
489ac30092 Refactoring window title drawing with regards to icons ref. #216 2022-01-18 11:04:35 +01:00
406faa9cc3 tags bar module: fix for wrong click offset ref. #215 2022-01-14 21:12:36 +01:00
b91974c9e6 Brightness Control Script + Keybinding
- Add keybinding for brightness control script
2022-01-11 12:06:25 -05:00
0404e12dba bump version to 6.3 2022-01-10 17:24:12 +01:00
0a4e6de597 Add a configuration option for fullscreen locking
Some people are annoyed to have this new behaviour forced for some
application which use fake fullscreen.

Ref. https://git.suckless.org/dwm/commit/138b405f0c8aa24d8a040cc1a1cf6e3eb5a0ebc7.html
2022-01-10 17:18:45 +01:00
0350db1b39 drawbar: Don't expend effort drawing bar if it is occluded
I noticed that a non-trivial amount of dwm's work on my machine was from
drw_text, which seemed weird, because I have the bar disabled and we
only use drw_text as part of bar drawing.

Looking more closely, I realised that while we use m->showbar when
updating the monitor bar margins, but don't skip actually drawing the
bar if it is hidden. This patch skips drawing it entirely if that is the
case.

On my machine, this takes 10% of dwm's on-CPU time, primarily from
restack() and focus().

When the bar is toggled on again, the X server will generate an Expose
event, and we'll redraw the bar as normal as part of expose().

Ref. https://git.suckless.org/dwm/commit/8657affa2a61e85ca8df76b62e43cb02897d1d80.html
2022-01-10 17:16:09 +01:00
9ea0cb6c7c Fix for infinite loop when there is only one client and pushup is run twice 2022-01-07 22:27:08 +01:00
6667f1030b Make sure it plays well with pertag patch 2021-12-26 21:26:32 +05:30
3d081ef5f9 Loop through all bars 2021-12-26 19:30:01 +05:30
0cd25db5af Fix resizing of bar 2021-12-26 18:53:53 +05:30
8f401e1d81 Add a new patch to integrate vanity gaps with bar padding 2021-12-26 18:30:37 +05:30
57c2add016 Polybar Margin & Padding Adjustments
- Make padding & margins consistent for polybar modules
- Add padding to left and right of bar
- Add new environment variable for dwm module padding
2021-12-05 12:10:25 -05:00
9a85c4983a Center Systray, Asian Fonts, Module Color Changes
- Add all module color settings to colors section
- Add korean & japanese fonts as backup
- Remove center aligned modules
- Move systray to center
- Change powermenu icon
2021-12-02 16:07:44 -05:00
bbdf799f43 Undo Some of Previous Polybar Changes
- Remove extra dwm module features that caused
  module to crash (layout, title, floating)
- Re-add kernel module
- Change some colors
- Move modules around again
2021-12-01 12:47:26 -05:00
c9b718761b Enable More DWM Polybar Module Features
- Change polybar colors
- Remove kernel module
- Enable more dwm module features like layout, title, and floating
- Add deadd notification center module to toggle center
- Change CPU, RAM, and Disk modules to open relevant applications on
  left click instead of right click
2021-12-01 11:30:27 -05:00
40d30e5d1b Adding the one line of bloat that would have saved a lot of time for a lot of people 2021-11-25 09:15:27 +01:00
a9078fdb4d Adding underlinetags patch ref. #199 2021-11-23 22:49:27 +01:00
63fed59d19 Adding taglabels patch ref. #199 2021-11-23 22:36:53 +01:00
c7af5c6b67 winicon: Fix potential integer overflow 2021-11-20 22:48:46 +01:00
efb9cc721e onlyquitonempty: fix for compilation error when not using the restart sig patch ref. #196 2021-11-11 09:21:58 +01:00
67fc80803d onlyquitonempty: refactoring patch to only take client windows into
consideration when deciding whether or not to allow dwm to quit

As per the original patch
https://dwm.suckless.org/patches/onlyquitonempty/

it used XQueryTree to get a count of the number of windows open to
determine whether to allow the window manager to exit.

This meant that the empty quit count variable would have to take
into account background windows such as the bar, which has side
effects like plugging in another monitor could mean that you would
not longer be allowed to quit dwm until the monitor is removed.

Likewise a systray and each systray icon would give a +1 to the
number of windows in the system.

This is unintuitive to understand and convoluted to explain, hence
the refactoring here to use the more sane approach of only counting
the number of client windows that the window manager manages.

This is an old idea which was intentionally not added to
dwm-flexipatch due to the aim of staying true to the original patch
(as in if you were to patch that manually you would get the same
experience as you had when trying the patch out in dwm-flexipatch).

This is ref. discussion in #194.
2021-10-31 13:45:18 +01:00
5210734ec6 Merge remote-tracking branch 'upstream/master'
- upstream/master onlyquitonempty + cool_autostart: adding proposed compatibility improvements ref. #194
- noborder: addressing issue reported in #193
- fodcusadjacenttag: Add selmon->sel guards for tagandviewtoleft/right to prevent segmentation faults ref. #191
- Use 'pgrep -o' instead of 'pidof -s' to get the PID of status bar
- Add a statusallmons and staticstatus easily toggleable in patches.h ref. #188
2021-10-30 09:52:22 -04:00
ec6a64a64f onlyquitonempty + cool_autostart: adding proposed compatibility improvements ref. #194 2021-10-25 15:43:14 +02:00
297412adf4 noborder: addressing issue reported in #193 2021-10-25 10:02:51 +02:00
84355a6d90 fodcusadjacenttag: Add selmon->sel guards for tagandviewtoleft/right to prevent segmentation faults ref. #191 2021-10-20 08:59:47 +02:00
ce270a320e Merge pull request #190 from UtkarshVerma/dwmblocks
Use 'pgrep -o' instead of 'pidof -s' to get the PID of status bar
2021-10-15 18:34:41 +02:00
e39062e543 Use 'pgrep -o' instead of 'pidof -s' to get the PID of status bar 2021-10-15 10:11:57 +05:30
e68f434944 Add a statusallmons and staticstatus easily toggleable in patches.h ref. #188 2021-10-07 11:46:31 +02:00
7f854ae1c7 Enable Warp Patch 2021-10-05 10:33:38 -04:00
2907b9eefe Enable Deck Layout
- Enable deck layout patch
- Add keybinding to switch to deck layout and unfloat to deck layout
- Update grid layout index
2021-09-25 14:02:06 -04:00
8d2a133926 README Org Comment Capitalization & ToC
- Capitalize org comments
- Add table of contents
2021-09-21 14:55:10 -04:00
6f14a0a9f9 Enable Sort Screens Patch 2021-09-21 13:06:29 -04:00
8180ee30c4 Switch from bpytop to btop
- Change system monitor when clicking on polybar modules
2021-09-21 10:20:04 -04:00
c6b3bf4830 Switch to Always Center Patch
- Disable center and center transient windows patches
- Enable always center patch
2021-09-19 09:30:51 -04:00
d94db1a658 Clean-Up README.org
- Remove leading whitespaces from README.org source code blocks
- Remove extra blank lines
- Fix typos
2021-09-19 09:24:57 -04:00
f11543b791 Add Window Tag Rules
- Add rules so certain windows appear on certain tags when initially launched
2021-09-19 09:24:06 -04:00
c7dade7403 Polybar Module Underline
- Add underlines to polybar modules for extra visual flair
- Replace Arch icon with hamburger icon and "menu" text
2021-09-19 09:24:06 -04:00
7e400024de Trackpad Toggle Keybinding
- Add keybinding to toggle touchpad
2021-09-19 09:24:06 -04:00
7691a25c19 Polybar Color & Order Updates
- Move date, time, and media-playing modules to left
- Move dwm module to center
- Change dwm module colors to use common background color,
  but adjust text color
- Change module colors
- Remove layout label from dwm module
2021-09-19 09:24:05 -04:00
6fb86d382f Polybar Adjustments & Remove Swallow Patch
- Disable unused swallow patch
- Re-comment swallow patch dependencies in config.mk
- Adjust polybar module colors
- Add quick reference table for converting between seconds,
  minutes, and hours in polybar interval section
- Change polybar main font to NotoSansDisplay Nerd Font
- Move media-playing module to center
- Move date & time modules to right
- Change separator from space to none
- Add program title to dwm module
- Disable reverse scroll options in dwm module
- Disable layout scrolling in dwm module due to crashes
- Slightly shorten date module
2021-09-19 09:24:05 -04:00
1dc5722b99 Kitty Terminal & Polybar Font Change
- Change dwm terminal from alacritty to kitty
- Change polybar terminal from alacritty to kitty
- Change polybar font from NotoSans Nerd Font to Ubuntu Nerd Font
2021-09-19 09:24:05 -04:00
5f2b977c1e Grid Mode Layout & Rule Changes
- Enable grid mode layout patch
- Add keybinding to switch to grid mode w/ and w/o floating window flattening
- Remove Gimp and Firefox tag rules
- Add Picture in picture floating rule
2021-09-19 09:24:05 -04:00
eb144c8789 Switch from Dunst to Deadd Notifications
- Switch rofi script keybinding
- Remove dunst polybar module
2021-09-19 09:24:05 -04:00
56537aa159 Patched DWM Flexipatch Build
- Wrote entire dwm-flexipatch build as org document
- Moved README and README.md into README.org
- Setup keybindings, colors, etc. for dwm-flexipatch
2021-09-19 09:24:00 -04:00
a42a81a711 Expanding directives ref. #182 2021-09-09 08:50:17 +02:00
7de6ee8375 savefloats: save centered float position for tiled windows when centered or alwayscentered patches are used ref. #182 2021-09-08 17:20:46 +02:00
22bbf1cb13 Adding alwayscenter patch ref. #182 2021-09-08 09:42:47 +02:00
036421845f Adding separate statuscolors bar module ref. #180 2021-08-25 12:18:01 +02:00
c2e4fed918 swallow: new window to respect border of parent terminal 2021-08-07 12:31:43 +02:00
f8ae6714db Adding winicon patch 2021-07-27 13:40:53 +02:00
d72bc90cdc rioresize: apply an arrange if changing monitors 2021-07-24 16:56:51 +02:00
73a29521e4 Correcting short hash 2021-06-21 13:44:14 +02:00
59eb825b7a Merge pull request #161 from Ultrahalf/master
Fix typo
2021-06-21 13:42:58 +02:00
65724b211a Fix typo 2021-06-21 16:06:44 +05:30
9b3cdeb929 Merge pull request #158 from pepper-jelly/master
portability(gcc and clang agnostic)
2021-06-14 15:11:12 +02:00
b0070eac02 use portable macro 2021-06-14 12:09:22 +03:00
0733c39e0c sed source files to end with 1 new line 2021-06-14 08:54:23 +03:00
c968fd9aae Renaming VIEW_SAME_TAG_GIVES_PREVIOUS_TAG_PATCH to TOGGLETAG_PATCH 2021-05-30 19:31:25 +02:00
246f8f7260 Adding togglelayout patch 2021-05-30 19:22:00 +02:00
a76fb54d79 focusadjacenttag: for correctness should probably also update current desktop when EWMH patch is enabled 2021-05-28 14:39:46 +02:00
75b0c4f86b focusadjacenttag: adding pertag compatibiltiy ref. #152 2021-05-28 14:33:56 +02:00
9072ef28a4 Splitting SchemeHid to SchemeHidNorm and SchemeHidSel given that a hidden client may still be the selected client ref. #148 2021-05-21 10:18:41 +02:00
9a0fb6c83b vanitygaps: PERTAG_VANITYGAPS_PATCH to control both gaps and whether gaps are enabled per tag ref. #147 2021-05-19 17:41:25 +02:00
e1f28aae25 vanitygaps: fix for gaps not being enabled by default when pertag is used ref. #147 2021-05-19 12:33:14 +02:00
28c4d0eab2 Adding note about the Known Issues discussion category 2021-05-13 17:13:13 +02:00
cde98665a2 Updating the link for Mitch Weaver's rounded corners patch 2021-05-13 15:21:02 +02:00
7fe81a6280 fakefullscreen vs fakefullscreenclient compatibility, let fakefullscreen take precedence 2021-05-13 14:25:26 +02:00
0b5bc76eef toggelfullscreen: addressing focus change issue when exiting fullscreen properly 2021-05-12 15:04:43 +02:00
ef89eb7c71 nodmenu: updating link 2021-05-09 20:04:13 +02:00
2938bf448c config.mk: added build options for FreeBSD 2021-05-09 20:03:23 +02:00
fd958dc631 floatpos: allowing window size hints to be updated (this may interfere with window float positions) 2021-05-06 12:08:27 +02:00
9edce6b606 scratchpad_alt_1: upgrading and simplifying patch ref. #124 2021-05-06 11:05:48 +02:00
df9533f1eb ipc: get_tags - do not dump tag if the tag is null 2021-05-05 18:47:45 +02:00
579f8f892b ipc: get_tags - do not dump tag if the tag is null ref. #123 2021-05-05 08:32:47 +02:00
3bf6eeca75 Create FUNDING.yml 2021-05-04 13:36:05 +02:00
e4c92733f2 IPC: dump_monitor - do not dump bar if there is no bar ref. #118 2021-05-01 11:49:37 +02:00
7b9460e770 fakefullscreenclient + stacker: fix for allowing focusstack when client is in fake fullscreen (issue introduced by alwaysfullscreen being merged upstream 2021-04-29 09:05:32 +02:00
77c45afe48 Addressing various memory leak issues ref. https://github.com/bakkeby/patches/issues/30 2021-04-28 13:35:22 +02:00
4bfda0327c anybar: misc improvements ref. #118 2021-04-28 10:52:59 +02:00
eb66da79ca anybar: make sure to free the bar when unmanaging an external bar plus misc improvements ref. #118 2021-04-27 14:01:11 +02:00
a7dfcc17d5 status2d: improving cut status line protection, dwm will still exit if an invalid color code comes through (there is an explicit die call in drw_clr_create) 2021-04-27 09:55:04 +02:00
23c76d13b5 vanitygaps: replaced smartgaps with smartgaps_fact, allowing gaps to be increased when there is only one client. 2021-04-16 10:16:04 +02:00
4a45f23643 placemouse: fix for crash when moving between monitors with different tags and there is no selected client on that monitor / tag
This is ref. https://github.com/bakkeby/patches/issues/27
2021-04-14 17:16:05 +02:00
6e80cb5f36 Upgrading statuscmd patch.
The original statuscmd patch has been renamed to statuscmd-nosignal
to separate the logic from the dwmblocks integration that involves
signals. I assume as the latter has become more popular it has replaced
the statuscmd in name.
2021-04-14 11:23:18 +02:00
7efb64d685 Upgraded the dwmblocks patch for statuscmd which changes the signalling
mechanism from SIGUSR1 to SIGRTMIN which is likely to cause issues for
those that already have a working setup. A compatibility option has been
added which changes this back to SIGUSR1. Note that configuration was
also changed.

This was ref. reported issue #114.
2021-04-14 10:42:52 +02:00
bd5f5608a3 Adding README changes for xkb patch 2021-04-08 11:58:24 +02:00
d554f1d818 Merge pull request #112 from bakkeby/xkb
Adding xkb patch as per request #111
2021-04-08 11:57:09 +02:00
ac737f9dfc Adding xkb patch as per request #111 2021-04-07 15:35:56 +02:00
0c88a49e27 Adding distributetags patch 2021-04-06 12:47:38 +02:00
905dc4d7af Updating inplacerotate to include rotatestack feature ref. #108 2021-04-06 11:25:45 +02:00
39df1ca4ad Initialise gaps for pertag arrays when monitor is created ref. #106 2021-04-05 08:14:27 +02:00
521f87af13 Adding proposed changes to have different gaps on a per tag basis ref. #106 2021-04-04 10:49:31 +02:00
4b22fdc0c3 Incomplete status2d fragments protection 2021-03-31 19:41:46 +02:00
647c5935b3 Adding tapresize notes to README.md 2021-03-31 09:18:58 +02:00
6b1225d3b3 Merge pull request #105 from verschmelzen/master
Add tapresize patch
2021-03-31 09:10:02 +02:00
07277cc460 Add tapresize patch 2021-03-30 22:49:59 +03:00
4751d7388d Proposed fix to address behaviour when resizing clients using the -1Z anchor ref. #103 2021-03-30 13:13:24 +02:00
199b363c23 Comment out non-default libraries from config.mk 2021-03-29 19:36:53 +02:00
012d1f7639 Upgrading to 67d76b and removing alwaysfullscreen patch as it has been merged into mainstream dwm 6.2 2021-03-29 19:33:05 +02:00
72564eb394 Adding LG3D patch 2021-03-09 13:47:21 +01:00
0f9104285b Adding tab patch 2021-03-09 13:23:39 +01:00
27185a74c4 Merge pull request #96 from dislabled/master
powerline tags: change to urgentcolor when a client is urgent
2021-02-20 16:08:17 +01:00
570ef2469b powerline tags: change to urgentcolor when a client is urgent 2021-02-20 12:05:55 +01:00
0f14ffade1 Adding tatami layout option for flextile 2021-02-18 14:30:20 +01:00
15895c42b9 stacker: addressing wintitleactions (awesomebar hidden clients) compatibility issue ref. #94 2021-02-17 14:37:20 +01:00
7f256e2d3c riodraw: upgrading patch to include rio-spawning of windows 2021-02-16 10:31:04 +01:00
8e9130080c riodraw: upgrading patch to include rio-spawning of windows 2021-02-16 10:29:20 +01:00
f5bbd9b4c3 riodraw: upgrading patch to include rio-spawning of windows 2021-02-16 10:26:49 +01:00
009b84cbdc placemouse: upgrade to include moveorplace function 2021-02-16 09:43:44 +01:00
9fcfa8d6ce Adding focusdir patch 2021-02-11 12:29:48 +01:00
1d092253e3 Adding riodraw patch 2021-02-11 12:01:08 +01:00
b4758c388d placemouse: adding options for tiled position being relative to client center 2021-01-23 16:58:44 +01:00
0f28402305 Adding placemouse patch 2021-01-22 11:28:55 +01:00
49839cf6f1 Proposed change to address overly large fake fullscreen 2021-01-22 11:16:41 +01:00
53c183a542 Indentation correction ref. #89 2021-01-22 11:14:58 +01:00
1b3a348d5d Merge pull request #89 from gx2b/master
Layoutmenu patch
2021-01-22 11:12:04 +01:00
5fd83cb76b added the layoutmenu patch 2021-01-02 01:26:21 +01:00
44ea8f5cce added layoutmenu patch 2021-01-02 01:24:03 +01:00
acbf2de1c2 systray: hotplugging issues, keep systray window on top of bar window ref. #84 2020-11-28 10:58:08 +01:00
93e2544040 flextile: adding centeredmaster horiz example 2020-11-28 10:57:16 +01:00
e23b16e533 noborder: add support for 0 nmaster deck layout ref. #82 2020-11-24 17:37:49 +01:00
e26d50c110 flextile: allow nmaster of 0 to fall back to stack arrangement rather than master, ref. #81 2020-11-23 15:07:20 +01:00
9a760f3ea2 IPC: Bumping verison number to 1.5.7 2020-11-23 09:24:14 +01:00
e350e4d93d NetActiveWindow: make sure to unfocus previously selected window if moving to another monitor 2020-11-22 12:52:02 +01:00
7db8bb0ce9 noborder: Adding partial support for flextile-deluxe monocole layout, ref. #74 2020-11-20 14:48:57 +01:00
bd5db9e63f Adding symbol func to flextile-deluxe column description 2020-11-18 13:12:13 +01:00
5b849ddcee Adding note for the swallow patch to uncomment relevant line in config.mk when taking the patch, ref. #72 2020-11-15 16:24:31 +01:00
1b9e0d9a88 Rolling back workaround for systray not displaying when designated monitor is removed (ref. hotplugging issues) 2020-11-14 08:40:31 +01:00
3e3afde993 flexwintitle: potential for scheme discrepancy between stack and stack2 2020-11-08 17:41:15 +01:00
a947f8d667 systray: avoid dwm crashing when removing the monitor where the systray is running (fix ref. #70) 2020-11-06 19:46:52 +01:00
558849940b ipc patch: avoid segmentation fault running dwm-msg without any arguments 2020-11-06 13:29:43 +01:00
8b43316e96 indicators: too wide (full) indicators when using awesombar and fancybar, ref. #69 2020-11-05 13:47:13 +01:00
251e3a23de Adding tiled indicators as suggested in #68 2020-11-05 12:16:38 +01:00
f662f6e749 systray: avoid dwm crashing when removing the monitor where the systray is running (hotplugging issues) 2020-11-05 12:08:18 +01:00
7bfcd388f6 shiftviewclients: fix for another scratchpads edge case ref. https://github.com/bakkeby/patches/issues/12 2020-10-29 14:23:58 +01:00
45d05c6c48 Adding the _NET_CLIENT_LIST_STACKING patch 2020-10-26 11:10:14 +01:00
5edf4bab17 Proposed changes to ensure that systray icons are sized according to font size rather than bar height, ref. #62 2020-10-24 10:01:19 +02:00
c6c2f0109f noborder: the recorded height and width of the client should most likely not be changed when noborder is in effect 2020-10-19 13:08:26 +02:00
ff78e407a5 transfer: Fix null pointer exception when no focused client 2020-10-18 14:27:46 +02:00
6696eadf74 Adding _PATCH prefixes (fix for https://github.com/bakkeby/flexipatch-finalizer/issues/6) 2020-10-18 14:26:57 +02:00
f9a3c2f88c savefloats: disable restoring float position when using movemouse and resizemouse functions for a more intuitive behaviour 2020-10-11 11:59:11 +02:00
81ae102bb9 savefloats: set the _IS_FLOATING property also when restoring float position 2020-10-11 11:55:15 +02:00
1266f49707 swallow: set the _IS_FLOATING property for the floating window if EWMH patch is enabled 2020-10-11 11:53:43 +02:00
21fd715afa swallow / arrange mismatch: swallow needs XMapWindow for the window being called beforehand, whereas arrange needs it called afterwards 2020-10-10 15:25:35 +02:00
016cdf3857 for new clients trigger arrange before XMapWindow to avoid visual glitches 2020-10-10 15:04:36 +02:00
b25b92b5f4 warp: do not warp if force_warp = 1 and mouse cursor is on a bar 2020-10-06 12:45:09 +02:00
56c81ddbfa warp: dragmfact + dragcfact compatibility
These set of changes introduce:
   a) a flag to ignore warp from happening while dragmfact or
      dragcfact is being used and
   b) a flag to force warp when killclient or showhideclient
      is used, to make for a more intuitive experience

ref. https://github.com/bakkeby/patches/issues/11
2020-10-06 08:45:17 +02:00
c47f61387d mpdcontrol: fixing typo, mpd (music player daemon), not mdp 2020-10-04 21:19:54 +02:00
ac4845bcde Removing dud RESETLAYOUT_PATCH from patches.def.h, actual patch was never taken 2020-10-04 21:11:31 +02:00
f08883883a setborderpx: add support for updating bar borderpx 2020-10-04 21:02:56 +02:00
45f763b837 shiftview: fixed bug when scratchpad is enabled 2020-10-04 11:46:23 +02:00
3b5f3f66ce shiftviewclients: fixed bug when scratchpad is enabled 2020-10-04 11:36:51 +02:00
5132e3a289 bar indicators: fixed alignment when bar border is used 2020-10-04 11:33:01 +02:00
21bafa5e69 on_empty_keys: global isempty rather than per-monitor 2020-09-29 15:49:51 +02:00
6742783b87 center: minor nitpick for transient windows 2020-09-29 15:28:57 +02:00
37c212ad55 Adding on_empty_keys patch ref. #51 2020-09-29 15:24:44 +02:00
fbacf17346 center: center windows by default if they are placed in the top right corner, ref. #52 2020-09-29 13:26:05 +02:00
b6cf350098 Added note about ~SPTAGMASK in patches.def.h ref. #53 2020-09-28 18:00:37 +02:00
795fcc3b51 scratchpads: when the scratchpad patch is added, the tagmask is altered, so to get a window onto all tags you have to do ~SPTAGSMASK instead of ~0 as otherwise it will interfere with the scratchpads, ref. #53 2020-09-28 17:48:49 +02:00
8726ae0aa9 Adding _IS_FLOATING xproperty patch for floating windows ref. #50 2020-09-28 14:39:17 +02:00
8536aa52c4 Merge pull request #49 into master (fix warp patch) 2020-09-27 11:18:26 +02:00
fcf96c0920 warp: do not warp if mouse cursor is on top of any of the bars 2020-09-27 11:15:45 +02:00
74c9528c38 fixed warp patch for other monitor 2020-09-27 09:54:14 +02:00
efeb5fcbf4 fixed warp patch for local monitor 2020-09-27 09:54:14 +02:00
6f5b1582d6 scratchpads: enhancing scratchpad by allowing arbitrary clients to be added to (and removed from) each scratchpad area 2020-09-27 09:54:14 +02:00
76292ba325 scratchpads: enhancing scratchpad by allowing arbitrary clients to be added to (and removed from) each scratchpad area 2020-09-26 12:42:56 +02:00
d906aa7a24 Merge pull request #46 from Schueni1/master
minor floating mode fix for setborderpx patch
2020-09-21 14:14:45 +02:00
da05d567a1 setborderpx fix link in changelog 2020-09-21 01:14:34 +02:00
216c95d86e minor floating mode fix for setborderpx patch 2020-09-21 01:08:19 +02:00
6eeb5ad13b bartabgroups + monocle change to default configuration 2020-09-20 08:45:37 +02:00
00320fb842 Adding nomodbuttons patch 2020-09-18 10:53:07 +02:00
8aa21b0311 XKeycodeToKeysym --> XGetKeyboardMapping (XKeycodeToKeysym is allegedly deprecated) 2020-09-18 10:39:07 +02:00
7275ca47ff Experimenting with having more status indicators than just whether the client is floating or not 2020-09-16 11:07:23 +02:00
b8dc848918 Adding fakefullscreen client rule 2020-09-16 11:00:31 +02:00
b3cb874ff5 scratchpads: allow a hidden scratchpad to be revealed when toggling scratch and reduce size of window if too large to be displayed when switching monitors 2020-09-14 13:23:59 +02:00
01464c584e ignoreconfigurenotifyrequests --> ignoreconfigurerequests 2020-09-14 10:08:47 +02:00
a7da48ca3d Add logic to ignore ConfigureNotify requests while a window is being moved or resized 2020-09-13 14:35:30 +02:00
32f9a73c0d scratchtags: allow moving / resizing scratchtag window to another monitor + minor comment 2020-09-13 14:22:31 +02:00
fada5790a2 fakefullscreenclient: setfullscreen logic overhaul 2020-09-13 13:35:15 +02:00
819d06c5c9 swallow: arrange monitor if window is not swallowed 2020-09-12 14:21:51 +02:00
7b477bc7db fakefullscreen: fullscreen --> fake fullscreen can make the tiled window display on top of floating window 2020-09-12 13:33:02 +02:00
c3e5910080 swallow: no good reason to call arrange if a client window is being swallowed 2020-09-11 17:33:15 +02:00
9f64260f0a ipc: config.mk corrections 2020-09-11 17:24:43 +02:00
dc9e57a6b6 swallow: upgrading to latest version with OpenBSD support 2020-09-11 17:21:38 +02:00
4a35cd2704 fakefullscreen: do not interfere with client message 2020-09-11 11:49:21 +02:00
104c9909b5 swallow: upgrading patch + fixing glitches 2020-09-11 11:47:57 +02:00
95c3014bd5 fakefullscreen: prevent focus from drifting away from client when going from fullscreen to fake fullscreen 2020-09-10 16:55:28 +02:00
d91db5cd65 anybar: adding experimental support for having both anybar + dwm bar(s) in play 2020-09-10 15:24:51 +02:00
8994f375e8 anybar: initial commit 2020-09-10 13:32:28 +02:00
f4a6866e8c barmodules: skip if widthfunc is NULL 2020-09-10 11:57:01 +02:00
4fd42ec164 Adding FreeBSD note 2020-09-10 11:18:20 +02:00
ed0e503a6b barmodules: skip if widthfunc is NULL 2020-09-10 09:52:46 +02:00
c257e2e390 fakefullscreen: prevent focus from drifting away from client when going from fullscreen to fake fullscreen 2020-09-10 09:41:00 +02:00
2e314578ed Removing NULL value from barrules 2020-09-10 09:40:05 +02:00
ff9811f73d Just some minor changes adding bar border patch ref. #41 2020-09-09 17:24:02 +02:00
b3e6e3531b ipc: adding function/signal bindings 2020-09-08 16:57:31 +02:00
95611ca0bd Adding IPC v1.5.5 patch 2020-09-08 13:34:58 +02:00
4379517c25 Adding IPC v1.5.5 patch 2020-09-07 17:48:58 +02:00
260bd11a53 systray may not always exist 2020-09-07 12:43:37 +02:00
018721ca76 systray may not exist when a clientmessage is received, resulting in dwm crash 2020-09-07 12:07:51 +02:00
f4f5ecab75 Scratchpads improvement (multi-monitor support) 2020-09-07 09:50:42 +02:00
fce55dadcb showhideclient: focus on client after coming out of hidden/iconic state 2020-09-05 15:59:38 +02:00
c14f40190e Assortment of fullscreen improvements 2020-09-05 14:20:53 +02:00
dc277e6c8f Assortment of fullscreen improvements 2020-09-05 12:06:19 +02:00
cb42097c22 Assortment of fullscreen improvements 2020-09-05 11:51:18 +02:00
5f5dc7ab9c Assortment of fullscreen improvements (togglefullscreen / fakefullscreenclient / tagallmon / tagswapmon) 2020-09-05 11:38:09 +02:00
dcf7b049ba Adding view same tag gives previous tag patch 2020-09-05 09:11:12 +02:00
69277ea1a8 awesomebar: correct centeredwindowname check 2020-09-04 11:33:52 +02:00
5acfb55a9c Silly addendum: adding box indicator just to inspire some ideas 2020-08-30 11:22:07 +02:00
b3f078abfb Silly addendum: adding box indicator just to inspire some ideas 2020-08-30 11:14:12 +02:00
ff7fbd2410 indicator bottom bar should probably be filled depending on whether the tag is selected or not 2020-08-30 10:03:27 +02:00
85c99ae8d4 Added slim variants for the bar indicators 2020-08-30 10:00:30 +02:00
1d19f4d309 Making warp preprocessor directive easier for flexipatch-finalizer to understand 2020-08-30 05:17:16 +02:00
4c8362b726 taggrid: remove unused configuration options 2020-08-29 11:44:20 +02:00
8ff0adeabd indicators: Adding the NONE indicator to disable e.g. indicators for tags 2020-08-28 19:48:30 +02:00
b714329d87 floatpos: Adding m option to spawn floating clients where the mouse pointer is 2020-08-28 18:17:09 +02:00
82c3984b2d Adding tdukv's addition to the status2d patch - allowing pywal to control the status colours via terminal colors 2020-08-28 07:17:52 +02:00
0d743eddff flexwintitle: allow flexwintitle to control window borders 2020-08-27 21:37:19 +02:00
d8ebab4f75 Adding colorbar (implicit integration) 2020-08-27 21:05:59 +02:00
c44b14e3dd setborderpx compatibility improvements 2020-08-27 21:05:34 +02:00
b3d336322e Adding aspectresize patch 2020-08-27 07:34:21 +02:00
376b48e4d2 Add the following tags for the status2d patch: ^w^ -
Swaps bg/fg color.     ^v^ - Saves the current fg/bg color.    ^t^ - Restores
the previously saved bg/fg color.

As proposed by tdu to hackers@suckless.org.
2020-08-27 06:30:48 +02:00
e952cc9a81 Minor refactoring of warp and fullscreen patches, getting rid of MONOCLE_LAYOUT_POS setting 2020-08-27 06:26:48 +02:00
f45acf8795 Added alttagsdecoration patch.
Unified tag icon handling while adding support for different icons per monitor.

In general LENGTH(tags) has been replaced with a NUMTAGS macro (defaulting to 9)
and the tags[] array has been replaced with a tagicons[][] array, access to which
is done through a single function tagicon.

This allows one central place where alternative tags, alttagsdecoration, or other
future tags logic is handled. This also gives a consistent display of tags
regardless of the module that presents tags.

Additionally the monitor index has been integrated into dwm for easier access.
2020-08-25 16:27:14 +02:00
df57bdeb64 Identified and fixed a few more cross-compilation issues 2020-08-24 15:03:55 +02:00
7ce66bf122 Identified and fixed a few more cross-compilation issues related to prior refactoring / simplification 2020-08-24 00:26:26 +02:00
939a407e25 Fixing wintitle and a few warning messages ref. #37 2020-08-23 18:18:05 +02:00
8ec80be756 Fixing warp barmodules compatibility ref. #37 2020-08-23 14:32:59 +02:00
e4e3a4463d Simplified Pango integration by settling on common function signatures. 2020-08-22 20:34:17 +02:00
8bf898eab5 Simplified Pango integration by settling on common function signatures. 2020-08-22 20:32:49 +02:00
81f44b036c Simplified Pango integration by settling on common function signatures. 2020-08-22 20:31:17 +02:00
46ebaea58f Added clientindicators patch and unified and simplified indicator code. Enabled centeredwindowname option for awesomebar and bartabgroups patches. 2020-08-22 20:30:51 +02:00
32819a48f3 Added clientindicators patch and unified and simplified indicator code. Enabled centeredwindowname option for awesomebar and bartabgroups patches. 2020-08-22 16:25:56 +02:00
512a656ddd Added logic to auto-hide bars if nothing is drawn on them (e.g. for standalone bars that only show certain clients) 2020-08-22 09:26:56 +02:00
eb782ae920 Added zoomfloating patch. Changed zoom and togglefloating functions to use c rather than selmon->sel. 2020-08-22 09:26:30 +02:00
91b6671981 Added zoomfloating patch. Changed zoom and togglefloating functions to use c rather than selmon->sel. 2020-08-22 09:21:23 +02:00
110cc7d240 Added logic to auto-hide bars if nothing is drawn on them (e.g. for standalone bars that only show certain clients) 2020-08-22 08:43:07 +02:00
81488b4862 Simplification of color configuration; settling on a set of color schemes that is shared between multiple patches (urgentborder, floatborder and titlecolor patches made non-optional) 2020-08-21 15:49:15 +02:00
6b9c484b78 Refactoring and simplifying color configuration in config.h
This involves always having configuration for floating border, regardless of
whether it is used or not. Also permanently dropping the const expectation
for color configuration in dwm, so that vtcolors and xrdb patches can change
color configuration.
2020-08-20 17:42:30 +02:00
ef287c46cd losefullscreen: minor improvements to keep fullscreen while moving focus to another monitor 2020-08-20 15:31:09 +02:00
a085c788e3 Adding experimental flexwintitle patch based on bartabgroups 2020-08-20 13:30:12 +02:00
c7b84ec738 dragmfact: minor if / else if correction if one is not using the flextile deluxe layout 2020-08-20 13:03:33 +02:00
cc495a80dc bartabgroups: adding guard for missing wintitleactions patch, just to align with patch 2020-08-15 11:18:54 +02:00
2632f112a8 bartabgroups: grouped floating and hidden windows, added stack, float and hidden group weights 2020-08-15 10:58:33 +02:00
ed2b8c27c8 bartabgroups: show title for hidden floating windows, added option to show always show title for floating windows 2020-08-15 07:44:41 +02:00
de47bd8839 Adding bartabgroups patch 2020-08-13 15:42:49 +02:00
57e727b498 Adding focusmaster patch 2020-08-11 10:25:19 +02:00
10f4d513ec Adding decoration hints patch 2020-08-11 10:17:02 +02:00
14e148be2a Adding steam patch 2020-08-10 17:09:20 +02:00
1dd4ec5bc4 Adding insets patch 2020-08-10 13:16:12 +02:00
e5ea493d32 systray: systray window may always not exist depending on configuration and number of monitors available, causing segfault in cleanup. Fixing double free on freeing fonts. 2020-08-10 11:36:10 +02:00
dfe1c40563 Adding cool autostart patch 2020-08-10 10:24:16 +02:00
85dd49a6a4 autostart: moving configs to config.def.h 2020-08-10 09:42:43 +02:00
3f4f88c142 awesomebar: use previously tiled when hiding client and the hidden client was the last tiled client 2020-08-04 13:40:26 +02:00
12527f00d9 zoomswap: renamed prevtiled back to findbefore as per original patch 2020-08-04 13:40:09 +02:00
ed7a43edf1 Adding reorganizetags patch 2020-08-02 15:18:18 +02:00
f067db87aa awesomebar: when hiding a client make the next focused client the next tiled client 2020-08-02 12:33:24 +02:00
f87bd6c86e Fix for focustack not being able to focus past hidden windows.
Also focusstack +2/-2 allow hidden windows to be selected using
keyboard shortcuts in order to unhide them via showhideclient.

Ref.
https://www.reddit.com/r/suckless/comments/i1c66t/how_to_make_awesomebar_patch_more_keyboard_centric/
2020-08-01 16:58:43 +02:00
d85dc0404f systray: add / override class hints for the systray clients (allows for compositors to exlude them from shadows) 2020-07-31 10:31:20 +02:00
68d9a1d7cc status2d: set the correct scheme before updating colours 2020-07-31 10:24:54 +02:00
55c9570681 Fix for monitor rules not applying for tag 1 specific rule 2020-07-27 10:45:13 +02:00
2cf37aa492 status2d: rawstext may not exist if neither statuscmd nor the extrabar patch is used 2020-07-24 11:15:44 +02:00
6eb24902f2 Adding statuscolors default config for powerline status patch 2020-07-24 08:41:34 +02:00
56ad78e7d2 Adding link to flextile-deluxe wiki page 2020-07-23 19:41:18 +02:00
0f74a8ff03 README.md: wiki page link updates 2020-07-22 18:53:15 +02:00
d7a58a3c88 README.md: wiki page link updates 2020-07-22 18:38:56 +02:00
b5165a1c8f barmodules: refactoring updatebarpos 2020-07-21 11:49:59 +02:00
ff72f80029 barmodules: refactoring updatebarpos 2020-07-21 11:35:26 +02:00
d7a7ac67ee barmodules: removing tags padding 2020-07-20 11:58:21 +02:00
3acae9e67d Adding link to barmodules patch 2020-07-19 19:32:41 +02:00
2065014161 BAR_TITLE_RIGHT_PAD --> BAR_TITLE_RIGHT_PAD_PATCH 2020-07-19 19:30:02 +02:00
d0c077a102 Removing unnecessary .h file 2020-07-19 19:29:10 +02:00
e9b6d35cac Strikethrough correction 2020-07-19 17:01:52 +02:00
023aa218e4 Adding powerline patch 2020-07-19 16:57:30 +02:00
23c0e9450f hidevacanttags: width and buttonpress fix 2020-07-19 09:38:06 +02:00
a7d1663571 Adding bar modules which splits the dwm bar into modules allowing for re-arrangement of the bar and easier integration for new features 2020-07-19 05:01:38 +02:00
e57fa18a48 Adding note about dwm-flexipatch-1.0 branch 2020-07-18 21:36:56 +02:00
6961418d63 Extrabar --> extrastatus 2020-07-18 21:12:30 +02:00
250fbbd2c7 holdbar: changes for new bar 2020-07-18 18:59:03 +02:00
346d7f6b1d Making bars list into linked list 2020-07-18 18:58:39 +02:00
aff7c0d8b8 Revert config.mk uncommenting 2020-07-18 13:04:39 +02:00
664484d572 Refinement 2020-07-18 13:03:30 +02:00
ad09397ad9 status2d: hide click_status2d if dwmblocks is used 2020-07-15 17:15:35 +02:00
06c4122e07 Movestack can cause dwm to crash if there are no selections on the monitor 2020-07-15 17:14:29 +02:00
e780c5078f taggrid: fix for invalid highlighting for the last tag when columns have an uneven number of clients 2020-07-15 17:14:14 +02:00
aa70728d00 Adding BarWidthArg, BarDrawArg, BarClickArg to keep the method signatures static 2020-07-15 14:10:47 +02:00
f2da4d20d9 Further bar renaming 2020-07-15 09:26:16 +02:00
903b32ac8b Major refactoring in preparation for bar modules 2020-07-15 08:57:30 +02:00
328 changed files with 24102 additions and 5033 deletions

3
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,3 @@
# These are supported funding model platforms
custom: ["https://suckless.org/donations/", "https://paypal.me/dwmflexipatch"]

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.o
dwm
dwm-msg
config.h
patches.h

View File

@ -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"),

View File

@ -6,13 +6,13 @@ include config.mk
SRC = drw.c dwm.c util.c
OBJ = ${SRC:.c=.o}
all: options dwm
# FreeBSD users, prefix all ifdef, else and endif statements with a . for this to work (e.g. .ifdef)
options:
@echo dwm build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
ifdef YAJLLIBS
all: dwm dwm-msg
else
all: dwm
endif
.c.o:
${CC} -c ${CFLAGS} $<
@ -28,8 +28,16 @@ patches.h:
dwm: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
ifdef YAJLLIBS
dwm-msg:
${CC} -o $@ patch/ipc/dwm-msg.c ${LDFLAGS}
endif
clean:
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
rm -f dwm-msg
rm -f config.h
rm -f patches.h
dist: clean
mkdir -p dwm-${VERSION}
@ -42,14 +50,24 @@ dist: clean
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f dwm ${DESTDIR}${PREFIX}/bin
#cp -f patch/dwmc ${DESTDIR}${PREFIX}/bin
ifdef YAJLLIBS
cp -f dwm-msg ${DESTDIR}${PREFIX}/bin
endif
cp -f patch/dwmc ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
ifdef YAJLLIBS
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm-msg
endif
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
mkdir -p ${DESTDIR}${PREFIX}/share/xsessions
test -f ${DESTDIR}${PREFIX}/share/xsessions/dwm.desktop || cp -n dwm.desktop ${DESTDIR}${PREFIX}/share/xsessions
chmod 644 ${DESTDIR}${PREFIX}/share/xsessions/dwm.desktop
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
${DESTDIR}${MANPREFIX}/man1/dwm.1
${DESTDIR}${MANPREFIX}/man1/dwm.1\
${DESTDIR}${PREFIX}/share/xsessions/dwm.desktop
.PHONY: all options clean dist install uninstall
.PHONY: all clean dist install uninstall

48
README
View File

@ -1,48 +0,0 @@
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.

590
README.md
View File

@ -1,8 +1,8 @@
This dwm 6.2 (aaad5f, 2020-07-08) 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.
This dwm 6.5 (5687f46, 2024-06-08) 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
#define ALPHA_PATCH 1
#define BAR_ALPHA_PATCH 1
```
So if you have ever been curious about trying out dwm, but have been discouraged by manual patching, then this may be a good starting point to see what a "fully fledged" dwm can look like. Want to try out the `pertag` patch? Just flip a config and recompile. Once you have found out what works for you and what doesn't then you should be in a better position to choose patches should you want to start patching from scratch.
@ -11,10 +11,116 @@ Alternatively if you have found the patches you want, but don't want the rest of
Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on the dwm window manager, how to install it and how it works.
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:
2024-07-11 - Added variant of the launcher patch
2024-01-31 - Added the placedir patch
2023-12-22 - Added the do-not-die-on-color-allocation-failure patch
2023-12-01 - Added the sendmoncenter patch
2023-11-12 - Added the focusmaster-return patch variant
2023-06-27 - Added the focusfollowmouse and unmanaged patches
2023-06-25 - Added the toggletopbar patch
2023-01-18 - Added the view history patch
2022-10-08 - Added the alt-tab patch
2022-08-12 - Added the nametag patch
2022-08-02 - Added the bidi patch
2022-07-05 - Added the tagpreview patch
2022-07-04 - Added the shift-tools patch(es) with individual toggles
2022-06-20 - Added the renamed scratchpads patch
2022-06-17 - Ported the seamless restart feature from dusk into dwm-flexipatch
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
2021-05-30 - Added togglelayout and toggletag patches
2021-04-16 - Vanitygaps: replaced smartgaps with smartgaps\_fact, allowing gaps to be disabled or increased when there is only one client.
2021-04-14 - Upgraded the dwmblocks patch for statuscmd which changes the signalling mechanism from SIGUSR1 to SIGRTMIN which is likely to cause issues for those that already have a working setup. A compatibility option has been added which changes this back to SIGUSR1. Note that configuration was also changed.
2021-04-07 - Added xkb patch
2021-04-06 - Added the distributetags patch
2021-04-04 - Added option for having different gaps on a per tag basis
2021-03-31 - Added tapresize patch (contributed by [verschmelzen](https://github.com/verschmelzen))
2021-03-29 - Removed alwaysfullscreen patch (merged into dwm 6.2)
2021-03-09 - Added the tab patch and the LG3D patch
2021-02-11 - Added the riodraw and focusdir patches
2021-01-22 - Added the placemouse patch
2021-01-02 - Added the Layoutmenu patch
2020-10-26 - Added the \_NET\_CLIENT\_LIST\_STACKING patch
2020-09-29 - Added the on\_empty\_keys patch (ported from InstantOS)
2020-09-28 - Added the \_IS\_FLOATING patch (embedded in the EWMHTAGS patch)
2020-09-18 - Added the nomodbuttons patch allowing for toggleable mouse button bindings that have no modifiers
2020-09-10 - Added the anybar patch (with experimental support for dwm bar(s) + anybar)
2020-09-09 - Added the bar border patch
2020-09-08 - Added ipc v1.5.5 patch
2020-09-07 - Scratchpads improvement (multi-monitor support)
2020-09-05 - Assortment of fullscreen improvements
2020-08-27 - Added aspectresize patch
2020-08-25 - Unified tag icon handling while adding support for different icons per monitor. Added alttagsdecoration patch.
2020-08-22 - Added logic to auto-hide bars if nothing is drawn on them (e.g. for standalone bars that only show certain clients). Added clientindicators patch and unified indicator code. Simplified Pango integration by settling on common function signatures.
2020-08-21 - Simplification of color configuration; settling on a set of color schemes that is shared between multiple patches (urgentborder, floatborder and titlecolor patches made non-optional)
2020-08-20 - Added experimental flexwintitle patch based on bartabgroups
2020-08-13 - Added bartabgroups patch
2020-08-11 - Added decoration hints and focusmaster patches
2020-08-10 - Added cool autostart, insets and steam patches
2020-08-02 - Added reorganizetags patch
2020-07-19 - Added barmodules patch - making extrabar, leftlayout, staticstatus and statusallmons patches redundant, added powerline patch
2020-07-18 - **Note**: Up until now building dwm-flexipath without any patches selected would have given you something more or less identical with mainstream dwm. In order to reduce complexity when it comes to maintainance future versions of dwm-flexipatch may diverge from this by making some patches non-optional. For the classic dwm-flexipatch and its many patch integration hints refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0) which will be subject to bug fixes and mainstream dwm updates as far as feasible.
2020-07-05 - Extrabar compatibility improvements (staticstatus, status2d, dwmblocks) and fix for systray randomly causing dwm to crash when first systray application starts
2020-06-24 - Added resizepoint, statusbutton and sendmon_keepfocus patches
@ -91,7 +197,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
2019-10-11 - Added the patch to ignore Xft errors when drawing text in the status bar
2019-10-10 - Added mdpcontrol, scratchpad and spawn_cwd cpatches
2019-10-10 - Added mpdcontrol, scratchpad and spawn_cwd cpatches
2019-10-08 - Added columns layout and fakefullscreen patch
@ -136,16 +242,35 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Patches included:
- [activetagindicatorbar](https://dwm.suckless.org/patches/activetagindicatorbar/)
- this patch changes the rectangle indicating if a tag is used by a client into a bar above the tag name
- this patch changes the rectangle indicating if a tag is used by a client into a bar above
the tag name
- [alpha](https://dwm.suckless.org/patches/alpha/)
- adds transparency for the status bar
- [alternativetags](https://dwm.suckless.org/patches/alternativetags/)
- adds alternative tags which can be toggled on the fly for the sole purpose of providing visual aid
- [alt-tab](https://dwm.suckless.org/patches/alt-tab/)
- adds a window task switcher toggled using alt-tab
- [alwaysfullscreen](https://dwm.suckless.org/patches/alwaysfullscreen/)
- prevents the focus to drift from the active fullscreen client when using focusstack\(\)
- [alternativetags](https://dwm.suckless.org/patches/alternativetags/)
- adds alternative tags which can be toggled on the fly for the sole purpose of providing
visual aid
- [alttagsdecoration](https://dwm.suckless.org/patches/alttagsdecoration/)
- provides the ability to use alternative text for tags which contain at least one window
- [alwayscenter](https://dwm.suckless.org/patches/alwayscenter/)
- makes all floating windows centered, like the center patch, but without a rule
- [~alwaysfullscreen~](https://dwm.suckless.org/patches/alwaysfullscreen/)
- ~prevents the focus to drift from the active fullscreen client when using focusstack\(\)~
- [anybar](https://dwm.suckless.org/patches/anybar/)
- enables dwm to manage external status bars such as lemonbar and polybar
- dwm treats the external bar as it would its own, so all regular dwm commands such as
togglebar affect the external bar in the same way
- [aspectresize](https://dwm.suckless.org/patches/aspectresize/)
- allows windows to be resized with its aspect ratio remaining constant
- [attachabove](https://dwm.suckless.org/patches/attachabove/)
- new windows are placed above selected client
@ -160,49 +285,99 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- new windows are placed at the bottom of the stack
- [autoresize](https://dwm.suckless.org/patches/autoresize/)
- by default, windows that are not visible when requesting a resize/move will not get resized/moved, with this patch, however, they will
- by default, windows that are not visible when requesting a resize/move will not get
resized/moved, with this patch, however, they will
- [autostart](https://dwm.suckless.org/patches/autostart/)
- makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup
- [awesomebar](https://dwm.suckless.org/patches/awesomebar/)
- enhanced taskbar that allows focus / hiding / unhiding of windows by clicking on the status bar
- enhanced taskbar that allows focus / hiding / unhiding of windows by clicking on the status
bar
- [bar_border](https://codemadness.org/paste/dwm-border-bar.patch)
- adds a border around the bar similarly to how client windows have borders
- [bar_height](https://dwm.suckless.org/patches/bar_height/)
- allows the bar height to be explicitly set rather than being derived from font
- [barmodules](https://github.com/bakkeby/patches/wiki/barmodules/)
- splits the dwm bar into modules allowing for re-arrangement of the bar and easier
integration for new features
- [barpadding](https://dwm.suckless.org/patches/barpadding/)
- adds vertical and horizontal space between the statusbar and the edge of the screen
- [bartabgroups](https://dwm.suckless.org/patches/bartabgroups/)
- turns the titlebar area into a mfact-respecting tab-bar showing each client's title
- [bidi](https://dwm.suckless.org/patches/bidi/)
- adds proper support for Right-To-Left (RTL) languages (such as Farsi, Arabic or Hebrew)
- [center](https://dwm.suckless.org/patches/center/)
- adds an iscentered rule to automatically center clients on the current monitor
- [cfacts](https://dwm.suckless.org/patches/cfacts/)
- the cfacts patch provides the ability to assign different weights to clients in their respective stack in tiled layout
- the cfacts patch provides the ability to assign different weights to clients in their
respective stack in tiled layout
- [clientindicators](https://dwm.suckless.org/patches/clientindicators/)
- draws a dot indicator overlayed on each tag icon for each client
- the selected client is drawn as a larger horizontal line
- [cmdcustomize](https://dwm.suckless.org/patches/cmdcustomize/)
- allows color attributes to be set through the command line
- color_emoji
- enables color emoji in dmenu by removing a workaround for a BadLength error in the Xft library when color glyphs are used
- enabling this will crash dwm on encountering such glyphs unless you also have an updated Xft library that can handle them
- [colorbar](https://dwm.suckless.org/patches/colorbar/)
- lets you change the foreground and background color of every statusbar element
- ~color_emoji~
- ~enables color emoji in dmenu by removing a workaround for a BadLength error in the Xft~
~library when color glyphs are used~
- ~enabling this will crash dwm on encountering such glyphs unless you also have an updated~
~Xft library that can handle them~
- [combo](https://dwm.suckless.org/patches/combo/)
- allows you to select multiple tags by pressing all the right keys as a combo, e.g. hold MOD and press and hold 1 and 3 together to view those two tags
- allows you to select multiple tags by pressing all the right keys as a combo, e.g. hold MOD
and press and hold 1 and 3 together to view those two tags
- [cool_autostart](https://dwm.suckless.org/patches/cool_autostart/)
- allows dwm to execute commands from an array in the config.h file
- when dwm exits all processes from the autostart array will be killed automatically
- [cyclelayouts](https://dwm.suckless.org/patches/cyclelayouts/)
- lets you cycle through all your layouts
- [decoration_hints](https://dwm.suckless.org/patches/decoration_hints/)
- make dwm respect \_MOTIF\_WM\_HINTS property, and not draw borders around windows
requesting for it
- some applications use this property to notify window managers to not draw window
decorations
- not respecting this property leads to issues with applications that draw their own borders,
like chromium (with "Use system title bar and borders" turned off) or vlc in fullscreen mode
- [distributetags](https://dwm.suckless.org/patches/reorganizetags/)
- this reorganisetags variant re-distributes all clients on the current monitor evenly across
all tags
- [dmenumatchtop](https://dwm.suckless.org/patches/dmenumatchtop)
- updates the position of dmenu to match that of the bar
- i.e. if topbar is 0 then dmenu will appear at the bottom and if 1 then dmenu will appear at the top
- i.e. if topbar is 0 then dmenu will appear at the bottom and if 1 then dmenu will appear at
the top
- [dragcfact](https://github.com/bakkeby/patches/blob/master/dwm/dwm-cfacts-dragcfact-6.2.diff)
- lets you resize clients' size (i.e. modify cfact) by holding modkey + shift + right-click and dragging the mouse
- do-not-die-on-color-allocation-failure
- avoids dwm terminating (dying) on color allocation failures
- useful for the xrdb (xresources) and status2d patches
- [dragmfact](https://github.com/bakkeby/patches/blob/master/dwm/dwm-dragmfact-6.2.diff)
- lets you resize the split in layouts (i.e. modify mfact) by holding the modkey + shift + left-click and dragging the mouse
- this is a bespoke patch that supports vertical and horizontal layout splits as well as centered master variants
- [dragcfact](https://github.com/bakkeby/patches/wiki/dragcfact/)
- lets you resize clients' size (i.e. modify cfact) by holding modkey + shift + right-click
and dragging the mouse
- [dragmfact](https://github.com/bakkeby/patches/wiki/dragmfact/)
- lets you resize the split in layouts (i.e. modify mfact) by holding the modkey + shift
+ left-click and dragging the mouse
- this is a bespoke patch that supports vertical and horizontal layout splits as well as
centered master variants
- [dwmblocks](https://gist.github.com/danbyl/54f7c1d57fc6507242a95b71c3d8fdea)
- signal integration to use dwm with a patched [dwmblocks](https://github.com/torrinfail/dwmblocks)
@ -213,53 +388,90 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [emptyview](https://dwm.suckless.org/patches/emptyview/)
- allows no tag at all to be selected
- dwm will start with no tag selected and when a client with no tag rule is started and no tag is selected then it will be opened on the first tag
- dwm will start with no tag selected and when a client with no tag rule is started and no
tag is selected then it will be opened on the first tag
- [ewmhtags](https://dwm.suckless.org/patches/ewmhtags/)
- adds EWMH support for \_NET_NUMBER_OF_DESKTOPS, \_NET_CURRENT_DESKTOP, \_NET_DESKTOP_NAMES and \_NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs that request workspace information, e.g. polybar's xworkspaces module
- adds EWMH support for \_NET_NUMBER_OF_DESKTOPS, \_NET_CURRENT_DESKTOP, \_NET_DESKTOP_NAMES
and \_NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs
that request workspace information, e.g. polybar's xworkspaces module
- [exresize](https://dwm.suckless.org/patches/exresize/)
- this patch allows the user to change size and placement of floating windows using only the keyboard
- it also allows for temporary vertical and horizontal extension of windows similar to other WMs fill command
- this patch allows the user to change size and placement of floating windows using only the
keyboard
- it also allows for temporary vertical and horizontal extension of windows similar to other
WMs fill command
- [extrabar](https://dwm.suckless.org/patches/extrabar/)
- enables an extra status bar in dwm in a similar manner to the dualstatus patch
- if the primary status is at the top via topbar then the extra status bar will be placed at the bottom and vice versa
- [~extrabar~](https://dwm.suckless.org/patches/extrabar/)
- ~enables an extra status bar in dwm in a similar manner to the dualstatus patch~
- ~if the primary status is at the top via topbar then the extra status bar will be placed at
the bottom and vice versa~
- extrastatus
- formerly extrabar - now only splits the status into to statuses by using a status separator
- [fakefullscreen](https://dwm.suckless.org/patches/fakefullscreen/)
- only allow clients to "fullscreen" into the space currently given to them
- as an example, this will allow you to view a fullscreen video in your browser on one half of the screen, while having the other half available for other tasks
- as an example, this will allow you to view a fullscreen video in your browser on one half
of the screen, while having the other half available for other tasks
- [fakefullscreenclient](https://github.com/bakkeby/patches/blob/master/dwm/dwm-fakefullscreenclient-6.2.diff)
- similarly to the fakefullscreen patch this patch only allows clients to "fullscreen" into the space currently given to them
- as an example, this will allow you to view a fullscreen video in your browser on one half of the screen, while having the other half available for other tasks
- the "twist" with this patch is that fake fullscreen can be toggled on a per client basis rather than applying to all clients globally
- [fakefullscreenclient](https://github.com/bakkeby/patches/wiki/fakefullscreenclient/)
- similarly to the fakefullscreen patch this patch only allows clients to "fullscreen" into
the space currently given to them
- as an example, this will allow you to view a fullscreen video in your browser on one half
of the screen, while having the other half available for other tasks
- the "twist" with this patch is that fake fullscreen can be toggled on a per client basis
rather than applying to all clients globally
- [fancybar](https://dwm.suckless.org/patches/fancybar/)
- shows the titles of all visible windows in the status bar
- [floatbordercolor](https://dwm.suckless.org/patches/float_border_color/)
- this patch allows a different border color to be chosen for floating windows
- flexwintitle
- based on the bartabgroups patch, this is a layout aware barmodules module for handling
window titles intended to be used with flextile-deluxe
- [floatpos](https://github.com/bakkeby/patches/wiki/floatpos)
- [~floatbordercolor~](https://dwm.suckless.org/patches/float_border_color/)
- ~this patch allows a different border color to be chosen for floating windows~
- [floatpos](https://github.com/bakkeby/patches/wiki/floatpos/)
- adds a float rule allowing the size and position of floating windows to be specified
- control the size and position of floating windows similar to exresize, moveresize, moveplace patches
- control the size and position of floating windows similar to exresize, moveresize,
moveplace patches
- specify size and position using absolute, relative or fixed co-ordinates or
- position floating windows in a grid-like manner
- [focusadjacenttag](https://dwm.suckless.org/patches/focusadjacenttag/)
- provides the ability to focus the tag on the immediate left or right of the currently focused tag
- provides the ability to focus the tag on the immediate left or right of the currently
focused tag
- it also allows to send the focused window either on the left or the right tag
- [focusdir](https://github.com/bakkeby/patches/wiki/focusdir)
- allows focusing on clients based on direction (up, down, left, right) instead of client
order
- [focusfollowmouse](https://github.com/bakkeby/patches/wiki/focusfollowmouse)
- the window under the mouse cursor will receive focus when changing tags, closing windows or
moving client out of view (as opposed to the most recently focused client)
- [focusmaster](https://dwm.suckless.org/patches/focusmaster/)
- a simple patch that just puts focus back to the master client
- [focusmaster-return](https://dwm.suckless.org/patches/focusmaster/)
- a simple patch that just puts focus back to the master client
- additionally allows focus to be switched back to the previous client
- [focusonclick](https://dwm.suckless.org/patches/focusonclick/)
- this patch makes you switch focus only by mouse click and not sloppy (focus follows mouse pointer)
- this patch makes you switch focus only by mouse click and not sloppy (focus follows mouse
pointer)
- [focusonnetactive](https://dwm.suckless.org/patches/focusonnetactive/)
- by default, dwm responds to \_NET_ACTIVE_WINDOW client messages by setting the urgency bit on the named window
- by default, dwm responds to \_NET_ACTIVE_WINDOW client messages by setting the urgency bit
on the named window
- this patch activates the window instead
- [focusurgent](https://dwm.suckless.org/patches/focusurgent/)
- adds a keyboard shortcut to select the next window having the urgent flag regardless of the tag it is on
- adds a keyboard shortcut to select the next window having the urgent flag regardless of the
tag it is on
- [fsignal](https://dwm.suckless.org/patches/fsignal/)
- send "fake signals" to dwm for handling, using xsetroot
@ -267,7 +479,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [fullscreen](https://dwm.suckless.org/patches/fullscreen/)
- applies the monocle layout with the focused client on top and hides the bar
- when pressed again it shows the bar and restores the layout that was active before going fullscreen
- when pressed again it shows the bar and restores the layout that was active before going
fullscreen
- [hidevacanttags](https://dwm.suckless.org/patches/hide_vacant_tags/)
- prevents dwm from drawing tags with no clients (i.e. vacant) on the bar
@ -278,37 +491,73 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [ignore-xft-errors-when-drawing-text](https://groups.google.com/forum/m/#!topic/wmii/7bncCahYIww)
- sometimes dwm crashes when it cannot render some glyphs in window titles (usually emoji)
- this patch is essentially a hack to ignore any errors when drawing text on the status bar and may be removed if a more appropriate solution comes up
- this patch is essentially a hack to ignore any errors when drawing text on the status bar
and may be removed if a more appropriate solution comes up
- [inplacerotate](https://dwm.suckless.org/patches/inplacerotate/)
- allows rotation of all clients in the master or stack area without affecting the other area
- [insets](https://dwm.suckless.org/patches/insets/)
- lets custom insets from each edge of the screen to be defined
- an example use case would be to make space for an external bar
- [ipc](https://github.com/mihirlad55/dwm-ipc)
- implements inter-process communication through a UNIX socket for dwm
- allows for the window manager to be queried for information, e.g. listen for events such as
tag or layout changes, as well as send commands to control the window manager via other
programs
- [\_IS\_FLOATING](https://github.com/bakkeby/dwm-flexipatch/issues/50)
- adds the \_IS\_FLOATING xproperty for floating windows
- this can allow for a compositor to handle floating windows differently to tiled windows,
e.g. only show shadows on floating windows
- this patch is enabled via the ewmhtags patch
- [ispermanent](https://dwm.suckless.org/patches/ispermanent/)
- adds rule option for clients to avoid accidental termination by killclient for sticky windows
- adds rule option for clients to avoid accidental termination by killclient for sticky
windows
- [keymodes](https://dwm.suckless.org/patches/keymodes/)
- this patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts can be performed
- this patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts can be
performed
- [leftlayout](http://dwm.suckless.org/patches/leftlayout/)
- moves the layout symbol in the status bar to the left hand side
- [killunsel](https://dwm.suckless.org/patches/killunsel/)
- kills all visible clients that are not selected (only the selected client will remain)
- [losefullscreen](https://github.com/bakkeby/patches/tree/master/dwm/dwm-losefullscreen-6.2.diff)
- by default in dwm it is possible to make an application fullscreen, then use the focusstack keybindings to focus on other windows beneath the current window
- it is also possible to spawn new windows (e.g. a terminal) that end up getting focus while the previous window remains in fullscreen
- [launcher](https://dwm.suckless.org/patches/launcher/)
- adds buttons to the bar that can be used to launch applications
- [~leftlayout~](http://dwm.suckless.org/patches/leftlayout/)
- ~moves the layout symbol in the status bar to the left hand side~
- LG3D
- changes the window manager name to "LG3d" instead of "dwm" as a workaround for Java
applications that assume that the window manager is using window reparenting
- refer to the ISSUES secton of the dwm man page for more details
- [losefullscreen](https://github.com/bakkeby/patches/wiki/losefullscreen/)
- by default in dwm it is possible to make an application fullscreen, then use the focusstack
keybindings to focus on other windows beneath the current window
- it is also possible to spawn new windows (e.g. a terminal) that end up getting focus while
the previous window remains in fullscreen
- this patch ensures that in such scenarios the previous window loses fullscreen
- [maximize](https://dwm.suckless.org/patches/maximize/)
- adds helper functions for maximizing, horizontally and vertically, floating windows using keybindings
- adds helper functions for maximizing, horizontally and vertically, floating windows using
keybindings
- [mdpcontrol](https://dwm.suckless.org/patches/mpdcontrol/)
- [mpdcontrol](https://dwm.suckless.org/patches/mpdcontrol/)
- adds keyboard bindings to control MDP (Music Player Daemon)
- [monitorrules](https://github.com/bakkeby/patches/blob/master/dwm/dwm-monitorrules-6.2.diff)
- [monitorrules](https://github.com/bakkeby/patches/wiki/monitorrules/)
- adds rules per monitor, e.g. have default layouts per monitor
- the use case for this is if the second monitor is vertical (i.e. rotated) then you may want to use a different default layout for this monitor than what is used for the main monitor (for example normal vertical split for main monitor and horizontal split for the second)
- the use case for this is if the second monitor is vertical (i.e. rotated) then you may want
to use a different default layout for this monitor than what is used for the main monitor
(for example normal vertical split for main monitor and horizontal split for the second)
- [monoclesymbol](https://dwm.suckless.org/patches/monoclesymbol/)
- always display the the monocle-symbol as defined in config.h if the monocle-layout is activated
- always display the the monocle-symbol as defined in config.h if the monocle-layout is
activated
- do not display the number of open clients in the current tag
- [moveresize](https://dwm.suckless.org/patches/moveresize/)
@ -317,20 +566,41 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [movestack](https://dwm.suckless.org/patches/movestack/)
- allows you to move clients around in the stack and swap them with the master
- [nametag](https://dwm.suckless.org/patches/nametag/)
- allows the names of tags to be changed during runtime
- [netclientliststacking](https://github.com/bakkeby/patches/wiki/netclientliststacking)
- adds support for the \_NET\_CLIENT\_LIST\_STACKING atom, needed by certain applications
like the Zoom video conferencing application
- [noborder](https://dwm.suckless.org/patches/noborder/)
- removes the border when there is only one window visible
- [nodmenu](https://dwm.suckless.org/patches/nodmenu/)
- enable modifying dmenu in config.def.h which resulted previously in a compilation error because two lines of code hardcode dmenu into dwm
- [nodmenu](https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html)
- enable modifying dmenu in config.def.h which resulted previously in a compilation error
because two lines of code hardcode dmenu into dwm
- allows complete removal of dmenu, should you want to do that
- NB: this patch was removed from the patches listing on the suckless page due to it's simplicity
- [no_transparent_borders](https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8)
- nomodbuttons
- allows for toggleable client button bindings that have no modifiers
- this can, for example, allow you to move or resize using the mouse alone without holding
down a modifier key, which can be practical if you have extra buttons on your mouse
- [no\_transparent\_borders](https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8)
- when terminals have transparency then their borders also become transparent
- this patch ensures that borders have no transparency
- note that this patch is only relevant if you are not using the alpha patch
- [on\_empty\_keys](https://github.com/bakkeby/dwm-flexipatch/issues/51)
- port of InstantVM's on_empty_keys functionality allowing keybindings that apply only when a
tag/view is empty
- an example use case is being able to launch applications with first hand keys like "f" to
launch firefox
- [onlyquitonempty](https://dwm.suckless.org/patches/onlyquitonempty/)
- makes it so dwm will only exit via quit() if no windows are open (in order to prevent accidental loss of work)
- makes it so dwm will only exit via quit() if no windows are open (in order to prevent
accidental loss of work)
- [pango](https://dwm.suckless.org/patches/pango/)
- adds simple markup for status messages using pango markup
@ -338,24 +608,47 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [pertag](https://dwm.suckless.org/patches/pertag/)
- adds nmaster, mfact, layouts and more per tag rather than per monitor
- [placedir](https://github.com/bakkeby/patches/wiki/placedir)
- allows tiled windows to be moved in any direction (up, down, left, right)
- [placemouse](https://github.com/bakkeby/patches/wiki/placemouse)
- lets the user change the position of a client in the stack using the mouse.
- [powerline](https://gitlab.com/udiboy1209-suckless/dwm/-/commit/071f5063e8ac4280666828179f92788d893eea40#4b1a539194be7467cefbda22f675a3b7c19ceca7)
- adds drawing of powerline arrows (and diagonal lines) for both the status bar and the tags
- [push](https://dwm.suckless.org/patches/push/)
- this patch provides a way to move clients up and down inside the client list
- [renamed_scratchpads](https://github.com/bakkeby/patches/wiki/renamedscratchpads)
- variant of the [named scratchpads](https://dwm.suckless.org/patches/namedscratchpads/) patch
- [reorganizetags](https://dwm.suckless.org/patches/reorganizetags/)
- shifts all clients per tag to leftmost unoccupied tags
- e.g. if clients A, B, C are tagged on tags 1, 5, 9 respectively, when reorganized they will
now be on tag 1, 2, and 3
- [resizecorners](https://dwm.suckless.org/patches/resizecorners/)
- by default, windows only resize from the bottom right corner
- with this patch the mouse is warped to the nearest corner and you resize from there
- [resizepoint](https://github.com/bakkeby/patches/blob/master/dwm/dwm-resizepoint-6.2.diff)
- practically the same as resizecorners, but the cursor does not warp to any of the window corners
- [resizepoint](https://github.com/bakkeby/patches/wiki/resizepoint/)
- practically the same as resizecorners, but the cursor does not warp to any of the window
corners
- [restartsig](https://dwm.suckless.org/patches/restartsig/)
- adds a keyboard shortcut to restart dwm or alternatively by using kill -HUP dwmpid
- additionally dwm can quit cleanly by using kill -TERM dwmpid
- [riodraw](https://github.com/bakkeby/patches/wiki/riodraw/)
- adds rio-like drawing to spawn new windows or to resize the selected client (ported from
instantWM)
- depends on an external tool slop being installed
- [rotatestack](https://dwm.suckless.org/patches/rotatestack/)
- let's you rotate through the stack using keyboard shortcuts
- [roundedcorners](https://github.com/mitchweaver/suckless/blob/master/dwm/patches_mitch/mitch-06-rounded_corners-db6093f6ec1bb884f7540f2512935b5254750b30.patch)
- [roundedcorners](https://github.com/mitchweaver/suckless/blob/master/dwm/inactive/mitch-06-rounded_corners-f04cac6d6e39cd9e3fc4fae526e3d1e8df5e34b2.patch)
- adds rounded corners to client windows
- [savefloats](https://dwm.suckless.org/patches/save_floats/)
@ -365,39 +658,52 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [scratchpad](https://dwm.suckless.org/patches/scratchpad/)
- the scratchpad patch allows you to spawn or restore a floating terminal window
- [scratchpad_alt_1](https://github.com/GasparVardanyan/dwm-scratchpad)
- this alternative patch enables a scratchpad feature in dwm similar to the scratchpad feature in i3wm
- [scratchpad\_alt\_1](https://github.com/GasparVardanyan/dwm-scratchpad)
- this alternative patch enables a scratchpad feature in dwm similar to the scratchpad
feature in i3wm
- seamless\_restart
- allows for selected layout, assigned tags, etc. to be persisted across restarts
- [selfrestart](https://dwm.suckless.org/patches/selfrestart/)
- restart dwm without the unnecessary dependency of an external script
- [sendmon_keepfocus](https://github.com/bakkeby/patches/blob/master/dwm/dwm-sendmon_keepfocus-6.2.diff)
- [sendmoncenter](https://dwm.suckless.org/patches/sendmoncenter/)
- floating windows being sent to another monitor will be centered
- [sendmon\_keepfocus](https://github.com/bakkeby/patches/wiki/sendmon_keepfocus/)
- minor patch that allow clients to keep focus when being sent to another monitor
- [setborderpx](https://dwm.suckless.org/patches/statuspadding/)
- [setborderpx](https://dwm.suckless.org/patches/setborderpx/)
- this patch allows border pixels to be changed during runtime
- [shift-tools](https://dwm.suckless.org/patches/shift-tools/)
- a group of functions that shift clients or views left or right
- [shiftview](https://github.com/chau-bao-long/dotfiles/blob/master/suckless/dwm/shiftview.diff)
- adds keybindings for left and right circular shift through tags
- also see focusadjacenttag
- [shiftviewclients](https://github.com/bakkeby/patches/blob/master/dwm/dwm-shiftviewclients-6.2.diff)
- variant of the shiftview patch which skips tags that has no clients
- [shiftviewclients](https://github.com/bakkeby/patches/wiki/shiftviewclients/)
- variant of the shiftview patch which skips tags that have no clients
- [sizehints](https://dwm.suckless.org/patches/sizehints/)
- makes dwm obey even "soft" sizehints for new clients
- [sortscreens](https://www.mail-archive.com/hackers@suckless.org/msg09400.html)
- this patch aims to address some inconsistencies when it comes to focusmon, tagmon and similar functionality by explicitly sorting screens left to right (or top to bottom in a vertical layout)
- this patch aims to address some inconsistencies when it comes to focusmon, tagmon and
similar functionality by explicitly sorting screens left to right (or top to bottom in a
vertical layout)
- [spawn_cwd](https://dwm.suckless.org/patches/spawn_cwd/)
- [spawn\_cwd](https://dwm.suckless.org/patches/spawn_cwd/)
- spawns programs from currently focused client's working directory
- [stacker](https://dwm.suckless.org/patches/stacker/)
- provides comprehensive utilities for managing the client stack
- [staticstatus](https://dwm.suckless.org/patches/staticstatus/)
- allows the status text to be fixed to the bar on a specific monitor rather than being drawn on the focused monitor
- allows the status text to be fixed to the bar on a specific monitor rather than being
drawn on the focused monitor
- [status2d](https://dwm.suckless.org/patches/status2d/)
- allows colors and rectangle drawing in the dwm status bar
@ -409,41 +715,63 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- adds a clickable button to the left hand side of the statusbar
- [statuscmd](https://dwm.suckless.org/patches/statuscmd/)
- adds the ability to execute shell commands based on the mouse button and position when clicking the status bar
- adds the ability to execute shell commands based on the mouse button and position when
clicking the status bar
- [statuscolors](https://dwm.suckless.org/patches/statuscolors/)
- enables colored text in the status bar allowing multiple color combinations for use in the status script
- enables colored text in the status bar allowing multiple color combinations for use in the
status script
- [statuspadding](https://dwm.suckless.org/patches/statuspadding/)
- adds configuration options for horizontal and vertical padding in the status bar
- [steam](https://github.com/bakkeby/patches/wiki/steam)
- a minor patch that works around the issue of floating Steam windows jumping around the
screen when they receive focus
- [sticky](https://dwm.suckless.org/patches/sticky/)
- adds toggleable keyboard shortcut to make a client 'sticky', i.e. visible on all tags
- [swallow](https://dwm.suckless.org/patches/swallow/)
- this patch adds "window swallowing" to dwm as known from Plan 9's windowing system rio
- clients marked with isterminal in config.h swallow a window opened by any child process, e.g. running xclock in a terminal
- clients marked with isterminal in config.h swallow a window opened by any child process,
e.g. running xclock in a terminal
- closing the xclock window restores the terminal window in the current position
- [swapfocus](https://dwm.suckless.org/patches/swapfocus/)
- this patch depends on the pertag patch and makes it possible to switch focus with a single shortcut (mod-s) instead of having to think if you should use mod-j or mod-k for reaching the previously used window
- this patch depends on the pertag patch and makes it possible to switch focus with a single
shortcut (mod-s) instead of having to think if you should use mod-j or mod-k for reaching
the previously used window
- [swaptags](https://dwm.suckless.org/patches/swaptags/)
- allows swapping the contents of the currently selected tag with another tag by using keyboard shortcuts
- allows swapping the contents of the currently selected tag with another tag by using
keyboard shortcuts
- [switchcol](https://dwm.suckless.org/patches/switchcol/)
- allows you to switch focus between the master and stack columns using a single keybinding
- [switchtag](https://github.com/bakkeby/patches/tree/master/dwm/dwm-switchtag-6.2.diff)
- when an application opens on a specific tab this patch adds the option to also switch to that tag when the application starts
- [switchtag](https://github.com/bakkeby/patches/wiki/switchtag/)
- when an application opens on a specific tab this patch adds the option to also switch to
that tag when the application starts
- optionally, the previous view can also be restored when the client is closed
- [systray](https://dwm.suckless.org/patches/systray/)
- adds system tray in the status bar
- [tab](https://dwm.suckless.org/patches/tab/)
- transforms the monocle layout into a "tabbed" layout if more than one window is present on
the monocle view
- this is essentially just a specific bar
- the patch has been added for demonstration purposes only and has limited compatibility with
other patches
- it will conflict space-wise with a second bar
- note that fancybar, awesomebar, bartabgroups and similar patches make the tab patch
redundant
- [tagall](https://dwm.suckless.org/patches/tagall/)
- adds keyboard shortcuts to move all (or only floating) windows from one tag to another
- [tagallmon](https://github.com/bakkeby/patches/tree/master/dwm/dwm-tagallmon-6.2.diff)
- [tagallmon](https://github.com/bakkeby/patches/wiki/tagallmon/)
- move all visible windows to an adjacent monitor
- [tagintostack](https://dwm.suckless.org/patches/tagintostack/)
@ -453,60 +781,113 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [taggrid](https://dwm.suckless.org/patches/taggrid/)
- adds an option to place tags in rows like in many other window managers
- [tagmonfixfs](https://github.com/bakkeby/patches/tree/master/dwm/dwm-tagmonfixfs-6.2.diff)
- [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
- [tagothermonitor](https://dwm.suckless.org/patches/tagothermonitor/)
- adds functions and keybindings to tag a window to a desired tag on an adjacent monitor
- [tagswapmon](https://github.com/bakkeby/patches/tree/master/dwm/dwm-tagswapmon-6.2.diff)
- [tagpreview](https://dwm.suckless.org/patches/tag-previews/)
- shows a preview of a tag when hovering the tag icon using the mouse
- [tagswapmon](https://github.com/bakkeby/patches/wiki/tagswapmon/)
- swap all visible windows on one monitor with those of an adjacent monitor
- [titlecolor](https://dwm.suckless.org/patches/titlecolor/)
- adds a new color scheme used by the (selected) window title in the bar
- [tapresize](https://dwm.suckless.org/patches/tapresize/)
- allows resizing of windows using a touchpad
- uses vertical and horizontal scroll events allowing you to use one-finger tap for moving
windows and two-finger tap for resizing
- [togglefullscreen](https://github.com/bakkeby/patches/tree/master/dwm/dwm-togglefullscreen-6.2.diff)
- [~titlecolor~](https://dwm.suckless.org/patches/titlecolor/)
- ~adds a new color scheme used by the (selected) window title in the bar~
- [togglefullscreen](https://github.com/bakkeby/patches/wiki/togglefullscreen/)
- allows you to toggle fullscreen on and off using a single shortcut key
- [togglelayout](https://github.com/bakkeby/patches/wiki/togglelayout)
- toggle layout using the same keyboard shortcuts to set the layout
- e.g. hitting `MOD+m` switches to monocle layout, hitting the same keybinding again brings
you back to the previous layout
- [toggletag](https://github.com/bakkeby/patches/wiki/toggletag)
- toggle tags using the same keyboard shortcuts to view tags
- e.g. hitting `MOD+4` lets you view tag 4 and hitting the keybinding a second time brings
you back to where you were before
- [toggletopbar](https://dwm.suckless.org/patches/toggletopbar/)
- allows for the bar position (top or bottom) to be toggled during runtime
- [transfer](https://dwm.suckless.org/patches/transfer/)
- lets you transfer the currently focused client between the master and stack area while increasing or decreasing the master area (nmaster) accordingly
- lets you transfer the currently focused client between the master and stack area while
increasing or decreasing the master area (nmaster) accordingly
- [transferall](https://dwm.suckless.org/patches/transfer/)
- lets you transfer all clients between the master and stack area while increasing or decreasing the master area (nmaster) accordingly
- 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
- 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)
- [unmanaged](https://github.com/bakkeby/patches/wiki/unmanaged)
- adds a client rule that allows for windows to not be managed by the window manager
- this can be useful for external bars, widgets, launchers, docks, desktop icons and more
- [urgentborder](https://dwm.suckless.org/patches/urgentborder/)
- this patch makes "urgent" windows have different colors
- [~urgentborder~](https://dwm.suckless.org/patches/urgentborder/)
- ~this patch makes "urgent" windows have different colors~
- [vanitygaps](https://github.com/bakkeby/patches/blob/master/dwm/dwm-vanitygaps-6.2.diff)
- adds configurable gaps between windows differentiating between outer, inner, horizontal and vertical gaps
- adds configurable gaps between windows differentiating between outer, inner, horizontal and
vertical gaps
- viewhistory
- adds a tag change history that is longer than the default current and previous tag
- `MOD`+Tab (`view(0)`) can be pressed multiple times to go further back to earlier tag
selections
- [viewontag](https://dwm.suckless.org/patches/viewontag/)
- follow a window to the tag it is being moved to
- [vtcolor](https://dwm.suckless.org/patches/vtcolors/)
- this patch adds the ability for dwm to read colors from the linux virtual console essentially allowing you to use the same color scheme as your regular tty
- this patch adds the ability for dwm to read colors from the linux virtual console
essentially allowing you to use the same color scheme as your regular tty
- [warp](https://dwm.suckless.org/patches/warp/)
- warps the mouse cursor to the center of the currently focused window or screen when the mouse cursor is (a) on a different screen or (b) on top of a different window
- warps the mouse cursor to the center of the currently focused window or screen when the
mouse cursor is (a) on a different screen or (b) on top of a different window
- [windowrolerule](https://github.com/bakkeby/patches/tree/master/dwm/dwm-windowrolerule-6.2.diff)
- sometimes a single application opens different windows depending on the task at hand and this is often reflected in the WM_WINDOW_ROLE(STRING) x property
- this patch adds the role field to the rule configuration so that one can differentiate between, say, Firefox "browser" vs "Preferences" vs "Manager" or Google-chrome "browser" vs "pop-up".
- [winicon](https://dwm.suckless.org/patches/winicon/)
- adds the window icon next to the window title in the bar
- [windowrolerule](https://github.com/bakkeby/patches/wiki/windowrolerule/)
- sometimes a single application opens different windows depending on the task at hand and
this is often reflected in the WM_WINDOW_ROLE(STRING) x property
- this patch adds the role field to the rule configuration so that one can differentiate
between, say, Firefox "browser" vs "Preferences" vs "Manager" or Google-chrome "browser"
vs "pop-up".
- [winview](http://dwm.suckless.org/patches/winview/)
- allows switching the view to that of a given client from the all-window view (Mod-0) using a keyboard shortcut
- allows switching the view to that of a given client from the all-window view (Mod-0) using
a keyboard shortcut
- [xkb](https://dwm.suckless.org/patches/xkb/)
- remembers keyboard layout per client
- [xrdb](http://dwm.suckless.org/patches/xrdb/)
- allows dwm to read colors from xrdb (.Xresources) during runtime
- [zoomfloating](https://www.reddit.com/r/suckless/comments/ie5fe3/zoomfloating_my_own_simple_original_patch/)
- a simple patch that allows floating windows to be zoomed into the master stack position
- [zoomswap](https://dwm.suckless.org/patches/zoomswap/)
- allows a master and a stack window to swap places rather than every window on the screen changing position
- allows a master and a stack window to swap places rather than every window on the screen
changing position
### Layouts included:
@ -523,7 +904,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- centeredfloatingmaster layout
- [columns](https://dwm.suckless.org/patches/columns/)
- same as the default tile layout except clients in the master area are arranged in columns (i.e. left to right)
- same as the default tile layout except clients in the master area are arranged in columns
(i.e. left to right)
- [deck](https://dwm.suckless.org/patches/deck/)
- deck layout - clients in the stack area are arranged on top of each other (like monocle)
@ -531,10 +913,12 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [fibonacci](https://dwm.suckless.org/patches/fibonacci/)
- fibonacci (dwindle and spiral) layouts
- [flextile-deluxe](https://github.com/bakkeby/patches/blob/master/dwm/dwm-pertag-flextile_deluxe-6.2.diff)
- a re-envisioned, flexible and over-the-top version of the original [flextile](https://dwm.suckless.org/patches/flextile/) patch supporting
- [flextile-deluxe](https://github.com/bakkeby/patches/wiki/flextile-deluxe/)
- a re-envisioned, flexible and over-the-top version of the original
[flextile](https://dwm.suckless.org/patches/flextile/) patch supporting
- multiple split layouts (horizontal, vertical, centered, floating, fixed)
- tile arrangement on a per split basis (stack horizontally, stack vertically, grids, fibonacci)
- tile arrangement on a per split basis (stack horizontally, stack vertically, grids,
fibonacci)
- pertag, cfacts, rmaster, vanitygaps compatibility
- tile, deck, monocle, centeredmaster, bstack, bstackhoriz, gapplessgrid and more
- this gives you a lot of versatility in terms of layout

7494
README.org Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
# dwm version
VERSION = 6.2
VERSION = 6.5
# Customize below to fit your system
@ -10,6 +10,10 @@ MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
# FreeBSD (uncomment)
#X11INC = /usr/local/include
#X11LIB = /usr/local/lib
# Xinerama, comment if you don't want it
XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA
@ -17,33 +21,47 @@ XINERAMAFLAGS = -DXINERAMA
# freetype
FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2
# FreeBSD (uncomment)
#FREETYPEINC = /usr/local/include/freetype2
# OpenBSD (uncomment)
#FREETYPEINC = ${X11INC}/freetype2
# OpenBSD - Uncomment this for the swallow patch / SWALLOW_PATCH
#KVMLIB = -lkvm
# Uncomment this for the alpha patch / 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
#MPDCLIENT = -lmpdclient
# Uncomment for the pango patch / PANGO_PATCH
# Uncomment for the pango patch / BAR_PANGO_PATCH
#PANGOINC = `pkg-config --cflags xft pango pangoxft`
#PANGOLIB = `pkg-config --libs xft pango pangoxft`
# Uncomment for the ipc patch / IPC_PATCH
YAJLLIBS = -lyajl
YAJLINC = -I/usr/include/yajl
# Uncomment this for the rounded corners patch / ROUNDED_CORNERS_PATCH
#XEXTLIB = -lXext
# Uncomment this for the swallow patch / SWALLOW_PATCH
#XCBLIBS = -lX11-xcb -lxcb -lxcb-res
XCBLIBS = -lX11-xcb -lxcb -lxcb-res
# This is needed for the winicon and tagpreview patches / BAR_WINICON_PATCH / BAR_TAGPREVIEW_PATCH
#IMLIB2LIBS = -lImlib2
# Uncomment for the bidi patch
#BDINC = `pkg-config --cflags fribidi`
#BDLIBS = `pkg-config --libs fribidi`
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC} ${PANGOINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XRENDER} ${MPDCLIENT} ${XEXTLIB} ${XCBLIBS} ${PANGOLIB}
INCS = -I${X11INC} -I${FREETYPEINC} ${YAJLINC} ${PANGOINC} ${BDINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XRENDER} ${MPDCLIENT} ${XEXTLIB} ${XCBLIBS} ${KVMLIB} ${PANGOLIB} ${YAJLLIBS} ${IMLIB2LIBS} $(BDLIBS)
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -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

267
drw.c
View File

@ -9,7 +9,31 @@
#include "drw.h"
#include "util.h"
#if !PANGO_PATCH
#if BIDI_PATCH
#include <fribidi.h>
static char fribidi_text[BUFSIZ] = "";
static void
apply_fribidi(const char *str)
{
FriBidiStrIndex len = strlen(str);
FriBidiChar logical[BUFSIZ];
FriBidiChar visual[BUFSIZ];
FriBidiParType base = FRIBIDI_PAR_ON;
FriBidiCharSet charset;
fribidi_text[0] = 0;
if (len > 0) {
charset = fribidi_parse_charset("UTF-8");
len = fribidi_charset_to_unicode(charset, str, len, logical);
fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL);
len = fribidi_unicode_to_charset(charset, visual, len, fribidi_text);
}
}
#endif
#if !BAR_PANGO_PATCH
#define UTF_INVALID 0xFFFD
#define UTF_SIZ 4
@ -17,7 +41,13 @@ static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}
static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
#endif // BAR_PANGO_PATCH
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
Clr transcheme[3];
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
#if !BAR_PANGO_PATCH
static long
utf8decodebyte(const char c, size_t *i)
{
@ -61,14 +91,14 @@ utf8decode(const char *c, long *u, size_t clen)
return len;
}
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
Drw *
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
#else
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
{
Drw *drw = ecalloc(1, sizeof(Drw));
@ -78,16 +108,22 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->w = w;
drw->h = h;
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
drw->visual = visual;
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 // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
@ -101,29 +137,38 @@ 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 ALPHA_PATCH
#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));
#endif // ALPHA_PATCH
#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);
#if PANGO_PATCH
drw_font_free(drw->font);
#else
drw_fontset_free(drw->fonts);
#endif // PANGO_PATCH
free(drw);
}
#if PANGO_PATCH
#if BAR_PANGO_PATCH
/* This function is an implementation detail. Library users should use
* drw_font_create instead.
*/
@ -192,7 +237,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
die("no font specified.");
}
#if !COLOR_EMOJI_PATCH
#if BAR_NO_COLOR_EMOJI_PATCH
/* 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
@ -205,7 +250,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
XftFontClose(drw->dpy, xfont);
return NULL;
}
#endif // COLOR_EMOJI_PATCH
#endif // BAR_NO_COLOR_EMOJI_PATCH
font = ecalloc(1, sizeof(Fnt));
font->xfont = xfont;
@ -215,25 +260,25 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
return font;
}
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
static void
xfont_free(Fnt *font)
{
if (!font)
return;
#if PANGO_PATCH
#if BAR_PANGO_PATCH
if (font->layout)
g_object_unref(font->layout);
#else
if (font->pattern)
FcPatternDestroy(font->pattern);
XftFontClose(font->dpy, font->xfont);
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
free(font);
}
#if PANGO_PATCH
#if BAR_PANGO_PATCH
Fnt*
drw_font_create(Drw* drw, const char font[])
{
@ -244,7 +289,7 @@ drw_font_create(Drw* drw, const char font[])
fnt = xfont_create(drw, font);
return (drw->font = fnt);
return (drw->fonts = fnt);
}
#else
Fnt*
@ -264,58 +309,55 @@ drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
}
return (drw->fonts = ret);
}
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
#if PANGO_PATCH
void
drw_font_free(Fnt *font)
{
if (font)
xfont_free(font);
}
#else
void
drw_fontset_free(Fnt *font)
{
if (font) {
#if !BAR_PANGO_PATCH
drw_fontset_free(font->next);
#endif // BAR_PANGO_PATCH
xfont_free(font);
}
}
#endif // PANGO_PATCH
void
drw_clr_create(
Drw *drw,
Clr *dest,
#if VTCOLORS_PATCH
const char clrname[]
#else
const char *clrname
#endif // VTCOLORS_PATCH
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
, unsigned int alpha
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
) {
if (!drw || !dest || !clrname)
return;
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
#if DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
fprintf(stderr, "warning, cannot allocate color '%s'", clrname);
#else
die("error, cannot allocate color '%s'", clrname);
#endif // DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
#else
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen),
clrname, dest))
#if DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
fprintf(stderr, "warning, cannot allocate color '%s'", clrname);
#else
die("error, cannot allocate color '%s'", clrname);
#endif // DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
#if NO_TRANSPARENT_BORDERS_PATCH
dest->pixel |= 0xff << 24;
#endif // NO_TRANSPARENT_BORDERS_PATCH
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
@ -323,16 +365,10 @@ drw_clr_create(
Clr *
drw_scm_create(
Drw *drw,
#if VTCOLORS_PATCH
char clrnames[][8],
#elif XRDB_PATCH
char *clrnames[],
#else
const char *clrnames[],
#endif // VTCOLORS_PATCH / XRDB_PATCH
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
const unsigned int alphas[],
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
size_t clrcount
) {
size_t i;
@ -343,22 +379,22 @@ drw_scm_create(
return NULL;
for (i = 0; i < clrcount; i++)
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
#else
drw_clr_create(drw, &ret[i], clrnames[i]);
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
return ret;
}
#if !PANGO_PATCH
#if !BAR_PANGO_PATCH
void
drw_setfontset(Drw *drw, Fnt *set)
{
if (drw)
drw->fonts = set;
}
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
void
drw_setscheme(Drw *drw, Clr *scm)
@ -367,6 +403,17 @@ drw_setscheme(Drw *drw, Clr *scm)
drw->scheme = scm;
}
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void
drw_settrans(Drw *drw, Clr *psc, Clr *nsc)
{
if (drw) {
transcheme[0] = psc[ColBg]; transcheme[1] = nsc[ColBg]; transcheme[2] = psc[ColBorder];
drw->scheme = transcheme;
}
}
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
{
@ -379,18 +426,23 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
}
#if PANGO_PATCH
#if BIDI_PATCH
int
_drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
#else
int
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
#endif // BIDI_PATCH
{
#if BAR_PANGO_PATCH
char buf[1024];
int ty;
unsigned int ew;
int i, ty, th;
unsigned int ew, eh;
XftDraw *d = NULL;
size_t i, len;
size_t len;
int render = x || y || w || h;
if (!drw || (render && !drw->scheme) || !text || !drw->font)
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
return 0;
if (!render) {
@ -398,13 +450,13 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
#else
d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen));
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
x += lpad;
w -= lpad;
}
@ -412,10 +464,14 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
len = strlen(text);
if (len) {
drw_font_getexts(drw->font, text, len, &ew, NULL, markup);
drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup);
th = eh;
/* shorten text if necessary */
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--)
drw_font_getexts(drw->font, text, len, &ew, NULL, markup);
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--) {
drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup);
if (eh > th)
th = eh;
}
if (len) {
memcpy(buf, text, len);
@ -425,15 +481,15 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
; /* NOP */
if (render) {
ty = y + (h - drw->font->h) / 2;
ty = y + (h - th) / 2;
if (markup)
pango_layout_set_markup(drw->font->layout, buf, len);
pango_layout_set_markup(drw->fonts->layout, buf, len);
else
pango_layout_set_text(drw->font->layout, buf, len);
pango_layout_set_text(drw->fonts->layout, buf, len);
pango_xft_render_layout(d, &drw->scheme[invert ? ColBg : ColFg],
drw->font->layout, x * PANGO_SCALE, ty * PANGO_SCALE);
drw->fonts->layout, x * PANGO_SCALE, ty * PANGO_SCALE);
if (markup) /* clear markup attributes */
pango_layout_set_attributes(drw->font->layout, NULL);
pango_layout_set_attributes(drw->fonts->layout, NULL);
}
x += ew;
w -= ew;
@ -443,11 +499,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
XftDrawDestroy(d);
return x + (render ? w : 0);
}
#else
int
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 ty;
unsigned int ew;
@ -471,13 +523,13 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
#else
d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen));
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
x += lpad;
w -= lpad;
}
@ -511,8 +563,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);
@ -552,7 +604,9 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
#if BAR_NO_COLOR_EMOJI_PATCH
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
#endif // BAR_NO_COLOR_EMOJI_PATCH
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
FcDefaultSubstitute(fcpattern);
@ -578,8 +632,50 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
XftDrawDestroy(d);
return x + (render ? w : 0);
#endif // BAR_PANGO_PATCH
}
#endif // PANGO_PATCH
#if BIDI_PATCH
int
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
{
apply_fribidi(text);
return _drw_text(drw, x, y, w, h, lpad, fribidi_text, invert, markup);
}
#endif // BIDI_PATCH
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void
drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash)
{
if (!drw || !drw->scheme)
return;
/* direction=1 draws right arrow */
x = direction ? x : x + w;
w = direction ? w : -w;
/* slash=1 draws slash instead of arrow */
unsigned int hh = slash ? (direction ? 0 : h) : h/2;
XPoint points[] = {
{x , y },
{x + w, y + hh },
{x , y + h },
};
XPoint bg[] = {
{x , y },
{x + w, y },
{x + w, y + h},
{x , y + h},
};
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
XFillPolygon(drw->dpy, drw->drawable, drw->gc, bg, 4, Convex, CoordModeOrigin);
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColFg].pixel);
XFillPolygon(drw->dpy, drw->drawable, drw->gc, points, 3, Nonconvex, CoordModeOrigin);
}
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
void
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
@ -591,25 +687,15 @@ drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
XSync(drw->dpy, False);
}
#if PANGO_PATCH
unsigned int
drw_font_getwidth(Drw *drw, const char *text, Bool markup)
{
if (!drw || !drw->font || !text)
return 0;
return drw_text(drw, 0, 0, 0, 0, 0, text, 0, markup);
}
#else
unsigned int
drw_fontset_getwidth(Drw *drw, const char *text)
drw_fontset_getwidth(Drw *drw, const char *text, Bool markup)
{
if (!drw || !drw->fonts || !text)
return 0;
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
return drw_text(drw, 0, 0, 0, 0, 0, text, 0, markup);
}
#endif // PANGO_PATCH
#if PANGO_PATCH
#if BAR_PANGO_PATCH
void
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup)
{
@ -627,7 +713,7 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w,
if (w)
*w = r.width / PANGO_SCALE;
if (h)
*h = font->h;
*h = r.height / PANGO_SCALE;
}
#else
void
@ -644,7 +730,7 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w,
if (h)
*h = font->h;
}
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
Cur *
drw_cur_create(Drw *drw, int shape)
@ -668,3 +754,4 @@ drw_cur_free(Drw *drw, Cur *cursor)
XFreeCursor(drw->dpy, cursor->cursor);
free(cursor);
}

70
drw.h
View File

@ -1,9 +1,9 @@
/* See LICENSE file for copyright and license details. */
#if PANGO_PATCH
#if BAR_PANGO_PATCH
#include <pango/pango.h>
#include <pango/pangoxft.h>
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
typedef struct {
Cursor cursor;
@ -12,20 +12,16 @@ typedef struct {
typedef struct Fnt {
Display *dpy;
unsigned int h;
#if PANGO_PATCH
#if BAR_PANGO_PATCH
PangoLayout *layout;
#else
XftFont *xfont;
FcPattern *pattern;
struct Fnt *next;
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
} Fnt;
#if FLOAT_BORDER_COLOR_PATCH
enum { ColFg, ColBg, ColBorder, ColFloat, ColCount }; /* Clr scheme index */
#else
enum { ColFg, ColBg, ColBorder, ColCount }; /* Clr scheme index */
#endif // FLOAT_BORDER_COLOR_PATCH
typedef XftColor Clr;
typedef struct {
@ -33,68 +29,55 @@ typedef struct {
Display *dpy;
int screen;
Window root;
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
Visual *visual;
unsigned int depth;
Colormap cmap;
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
Drawable drawable;
#if BAR_WINICON_PATCH
Picture picture;
#endif // BAR_WINICON_PATCH
GC gc;
Clr *scheme;
#if PANGO_PATCH
Fnt *font;
#else
Fnt *fonts;
#endif // PANGO_PATCH
} Drw;
/* Drawable abstraction */
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
#else
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
/* Fnt abstraction */
#if PANGO_PATCH
#if BAR_PANGO_PATCH
Fnt *drw_font_create(Drw* drw, const char font[]);
void drw_font_free(Fnt* set);
unsigned int drw_font_getwidth(Drw *drw, const char *text, Bool markup);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup);
#else
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
void drw_fontset_free(Fnt* set);
unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
void drw_fontset_free(Fnt* set);
unsigned int drw_fontset_getwidth(Drw *drw, const char *text, Bool markup);
/* Colorscheme abstraction */
void drw_clr_create(
Drw *drw,
Clr *dest,
#if VTCOLORS_PATCH
const char clrname[]
#else
const char *clrname
#endif // VTCOLORS_PATCH
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
, unsigned int alpha
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
);
Clr *drw_scm_create(
Drw *drw,
#if VTCOLORS_PATCH
char clrnames[][8],
#elif XRDB_PATCH
char *clrnames[],
#else
const char *clrnames[],
#endif // VTCOLORS_PATCH / XRDB_PATCH
#if ALPHA_PATCH
#if BAR_ALPHA_PATCH
const unsigned int alphas[],
#endif // ALPHA_PATCH
#endif // BAR_ALPHA_PATCH
size_t clrcount
);
@ -103,18 +86,21 @@ Cur *drw_cur_create(Drw *drw, int shape);
void drw_cur_free(Drw *drw, Cur *cursor);
/* Drawing context manipulation */
#if !PANGO_PATCH
#if !BAR_PANGO_PATCH
void drw_setfontset(Drw *drw, Fnt *set);
#endif // PANGO_PATCH
#endif // BAR_PANGO_PATCH
void drw_setscheme(Drw *drw, Clr *scm);
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void drw_settrans(Drw *drw, Clr *psc, Clr *nsc);
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
#if PANGO_PATCH
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup);
#else
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
#endif // PANGO_PATCH
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash);
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
/* Map functions */
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);

3815
dwm.c

File diff suppressed because it is too large Load Diff

7
dwm.desktop Normal file
View File

@ -0,0 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Name=Dwm
Comment=Dynamic window manager
Exec=dwm
Icon=dwm
Type=XSession

13
justfile Normal file
View File

@ -0,0 +1,13 @@
set shell := ["bash", "-c"]
# List just commands by default
default:
@just --list
# Update doom emacs and sync config
dwm-rebuild:
sudo make clean install
# Run polybar launch script
dwm-launch-polybar:
./polybar/launch.sh

View File

@ -1 +0,0 @@
static void togglealttag();

223
patch/alttab.c Normal file
View File

@ -0,0 +1,223 @@
int alttabn; /* move that many clients forward */
int ntabs; /* number of active clients in tag */
int isalt;
Client **altsnext; /* array of all clients in the tag */
Window alttabwin;
void
alttab()
{
Monitor *m = selmon;
/* move to next window */
if (m->sel && m->sel->snext) {
alttabn++;
if (alttabn >= ntabs)
alttabn = 0; /* reset alttabn */
focus(altsnext[alttabn]);
restack(m);
}
/* redraw tab */
XRaiseWindow(dpy, alttabwin);
drawalttab(ntabs, 0, m);
}
void
alttabend()
{
Monitor *m = selmon;
Client *buff;
int i;
if (!isalt)
return;
/* Move all clients between first and choosen position,
* one down in stack and put choosen client to the first position
* so they remain in right order for the next time that alt-tab is used
*/
if (ntabs > 1) {
if (alttabn != 0) { /* if user picked original client do nothing */
buff = altsnext[alttabn];
if (alttabn > 1)
for (i = alttabn; i > 0; i--)
altsnext[i] = altsnext[i - 1];
else /* swap them if there are just 2 clients */
altsnext[alttabn] = altsnext[0];
altsnext[0] = buff;
}
/* restack clients */
for (i = ntabs - 1; i >= 0; i--) {
focus(altsnext[i]);
restack(m);
}
free(altsnext); /* free list of clients */
}
/* destroy the window */
isalt = 0;
ntabs = 0;
XUnmapWindow(dpy, alttabwin);
XDestroyWindow(dpy, alttabwin);
}
void
drawalttab(int nwins, int first, Monitor *m)
{
Client *c;
int i, h;
int y = 0;
int px = m->mx;
int py = m->my;
if (first) {
XSetWindowAttributes wa = {
.override_redirect = True,
#if BAR_ALPHA_PATCH
.background_pixel = 0,
.border_pixel = 0,
.colormap = cmap,
#else
.background_pixmap = ParentRelative,
#endif // BAR_ALPHA_PATCH
.event_mask = ButtonPressMask|ExposureMask
};
/* decide position of tabwin */
if (tabposx == 1)
px = m->mx + (m->mw / 2) - (maxwtab / 2);
else if (tabposx == 2)
px = m->mx + m->mw - maxwtab;
if (tabposy == 1)
py = m->my + (m->mh / 2) - (maxhtab / 2);
else if (tabposy == 2)
py = m->my + m->mh - maxhtab;
h = maxhtab;
#if BAR_ALPHA_PATCH
alttabwin = XCreateWindow(dpy, root, px, py, maxwtab, maxhtab, 2, depth,
InputOutput, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
#else
alttabwin = XCreateWindow(dpy, root, px, py, maxwtab, maxhtab, 2, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
#endif // BAR_ALPHA_PATCH
XDefineCursor(dpy, alttabwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, alttabwin);
}
h = maxhtab / ntabs;
for (i = 0; i < ntabs; i++) { /* draw all clients into tabwin */
c = altsnext[i];
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c))
continue;
drw_setscheme(drw, scheme[c == m->sel ? SchemeSel : SchemeNorm]);
drw_text(drw, 0, y, maxwtab, h, 0, c->name, 0, 0);
y += h;
}
drw_setscheme(drw, scheme[SchemeNorm]);
drw_map(drw, alttabwin, 0, 0, maxwtab, maxhtab);
}
void
alttabstart(const Arg *arg)
{
Client *c;
Monitor *m = selmon;
int grabbed;
int i;
altsnext = NULL;
if (alttabwin)
alttabend();
if (isalt == 1) {
alttabend();
return;
}
isalt = 1;
alttabn = 0;
ntabs = 0;
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c))
continue;
++ntabs;
}
if (!ntabs) {
alttabend();
return;
}
altsnext = (Client **) malloc(ntabs * sizeof(Client *));
for (i = 0, c = m->stack; c; c = c->snext) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c))
continue;
altsnext[i] = c;
i++;
}
drawalttab(ntabs, 1, m);
struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000000 };
/* grab keyboard (take all input from keyboard) */
grabbed = 1;
for (i = 0; i < 1000; i++) {
if (XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess)
break;
nanosleep(&ts, NULL);
if (i == 1000 - 1)
grabbed = 0;
}
XEvent event;
alttab();
if (grabbed == 0) {
alttabend();
return;
}
while (grabbed) {
XNextEvent(dpy, &event);
if (event.type == KeyPress || event.type == KeyRelease) {
if (event.type == KeyRelease && event.xkey.keycode == tabmodkey) /* if mod key is released break cycle */
break;
if (event.type == KeyPress) {
if (event.xkey.keycode == tabcyclekey) { /* if tab is pressed move to the next window */
alttab();
}
}
}
}
c = m->sel;
alttabend();
XUngrabKeyboard(dpy, CurrentTime);
focus(c);
restack(m);
}

5
patch/alttab.h Normal file
View File

@ -0,0 +1,5 @@
#include <time.h>
static void drawalttab(int nwins, int first, Monitor *m);
static void alttabstart(const Arg *arg);
static void alttabend();

25
patch/aspectresize.c Normal file
View File

@ -0,0 +1,25 @@
void
aspectresize(const Arg *arg)
{
/* only floating windows can be moved */
Client *c;
c = selmon->sel;
float ratio;
int w, h,nw, nh;
if (!c || !arg)
return;
if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
return;
ratio = (float)c->w / (float)c->h;
h = arg->i;
w = (int)(ratio * h);
nw = c->w + w;
nh = c->h + h;
XRaiseWindow(dpy, c->win);
resize(c, c->x, c->y, nw, nh, True);
}

2
patch/aspectresize.h Normal file
View File

@ -0,0 +1,2 @@
static void aspectresize(const Arg *arg);

View File

@ -1,8 +1,27 @@
void
attachx(Client *c)
{
#if ATTACHABOVE_PATCH
#if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBOTTOM_PATCH || SEAMLESS_RESTART_PATCH
Client *at;
#endif // ATTACHABOVE_PATCH | ATTACHASIDE_PATCH | ATTACHBOTTOM_PATCH | SEAMLESS_RESTART_PATCH
#if SEAMLESS_RESTART_PATCH
if (c->idx > 0) { /* then the client has a designated position in the client list */
for (at = c->mon->clients; at; at = at->next) {
if (c->idx < at->idx) {
c->next = at;
c->mon->clients = c;
return;
} else if (at->idx <= c->idx && (!at->next || c->idx <= at->next->idx)) {
c->next = at->next;
at->next = c;
return;
}
}
}
#endif // SEAMLESS_RESTART_PATCH
#if ATTACHABOVE_PATCH
if (!(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating)) {
for (at = c->mon->clients; at->next != c->mon->sel; at = at->next);
c->next = at->next;
@ -10,9 +29,7 @@ attachx(Client *c)
return;
}
#elif ATTACHASIDE_PATCH
Client *at;
unsigned int n;
for (at = c->mon->clients, n = 0; at; at = at->next)
if (!at->isfloating && ISVISIBLEONTAG(at, c->tags))
if (++n >= c->mon->nmaster)
@ -30,7 +47,6 @@ attachx(Client *c)
return;
}
#elif ATTACHBOTTOM_PATCH
Client *at;
for (at = c->mon->clients; at && at->next; at = at->next);
if (at) {
at->next = c;
@ -40,3 +56,4 @@ attachx(Client *c)
#endif
attach(c); // master (default)
}

View File

@ -1 +1,2 @@
static void attachx(Client *c);
static void attachx(Client *c);

View File

@ -1,8 +1,3 @@
static const char autostartblocksh[] = "autostart_blocking.sh";
static const char autostartsh[] = "autostart.sh";
static const char dwmdir[] = "dwm";
static const char localshare[] = ".local/share";
void
runautostart(void)
{
@ -10,18 +5,19 @@ runautostart(void)
char *path;
char *xdgdatahome;
char *home;
struct stat sb;
if ((home = getenv("HOME")) == NULL)
/* this is almost impossible */
return;
/* if $XDG_DATA_HOME is defined, use $XDG_DATA_HOME/dwm,
/* if $XDG_DATA_HOME is set and not empty, use $XDG_DATA_HOME/dwm,
* otherwise use ~/.local/share/dwm as autostart script directory
*/
if ((xdgdatahome = getenv("XDG_DATA_HOME")) != NULL) {
xdgdatahome = getenv("XDG_DATA_HOME");
if (xdgdatahome != NULL && *xdgdatahome != '\0') {
/* space for path segments, separators and nul */
if ((pathpfx = malloc(strlen(xdgdatahome) + strlen(dwmdir) + 2)) == NULL)
return;
pathpfx = ecalloc(1, strlen(xdgdatahome) + strlen(dwmdir) + 2);
if (sprintf(pathpfx, "%s/%s", xdgdatahome, dwmdir) <= 0) {
free(pathpfx);
@ -29,8 +25,8 @@ runautostart(void)
}
} else {
/* space for path segments, separators and nul */
if ((pathpfx = malloc(strlen(home) + strlen(localshare) + strlen(dwmdir) + 3)) == NULL)
return;
pathpfx = ecalloc(1, strlen(home) + strlen(localshare)
+ strlen(dwmdir) + 3);
if (sprintf(pathpfx, "%s/%s/%s", home, localshare, dwmdir) < 0) {
free(pathpfx);
@ -39,16 +35,16 @@ runautostart(void)
}
/* check if the autostart script directory exists */
struct stat sb;
if (! (stat(pathpfx, &sb) == 0 && S_ISDIR(sb.st_mode))) {
/* the XDG conformant path does not exist or are not directories
/* the XDG conformant path does not exist or is no directory
* so we try ~/.dwm instead
*/
if (realloc(pathpfx, strlen(home) + strlen(dwmdir) + 3) == NULL) {
char *pathpfx_new = realloc(pathpfx, strlen(home) + strlen(dwmdir) + 3);
if(pathpfx_new == NULL) {
free(pathpfx);
return;
}
pathpfx = pathpfx_new;
if (sprintf(pathpfx, "%s/.%s", home, dwmdir) <= 0) {
free(pathpfx);
@ -57,32 +53,24 @@ runautostart(void)
}
/* try the blocking script first */
if ((path = malloc(strlen(pathpfx) + strlen(autostartblocksh) + 2)) == NULL) {
path = ecalloc(1, strlen(pathpfx) + strlen(autostartblocksh) + 2);
if (sprintf(path, "%s/%s", pathpfx, autostartblocksh) <= 0) {
free(path);
free(pathpfx);
return;
} else
if (sprintf(path, "%s/%s", pathpfx, autostartblocksh) <= 0) {
free(path);
free(pathpfx);
}
}
if (access(path, X_OK) == 0)
system(path);
/* now the non-blocking script */
if ((path = realloc(path, strlen(pathpfx) + strlen(autostartsh) + 4)) == NULL) {
free(pathpfx);
if (sprintf(path, "%s/%s", pathpfx, autostartsh) <= 0) {
free(path);
return;
} else
if (sprintf(path, "%s/%s", pathpfx, autostartsh) <= 0) {
free(path);
free(pathpfx);
}
if (access(path, X_OK) == 0) {
system(strcat(path, " &"));
free(pathpfx);
free(path);
}
}
if (access(path, X_OK) == 0)
system(strcat(path, " &"));
free(pathpfx);
free(path);
}

View File

@ -1 +1,2 @@
static void runautostart(void);
static void runautostart(void);

39
patch/bar.c Normal file
View File

@ -0,0 +1,39 @@
void
barhover(XEvent *e, Bar *bar)
{
const BarRule *br;
Monitor *m = bar->mon;
XMotionEvent *ev = &e->xmotion;
BarArg barg = { 0, 0, 0, 0 };
int r;
for (r = 0; r < LENGTH(barrules); r++) {
br = &barrules[r];
if (br->bar != bar->idx || (br->monitor == 'A' && m != selmon) || br->hoverfunc == NULL)
continue;
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])
continue;
barg.x = ev->x - bar->x[r];
barg.y = ev->y - bar->borderpx;
barg.w = bar->w[r];
barg.h = bar->bh - 2 * bar->borderpx;
br->hoverfunc(bar, &barg, ev);
break;
}
}
Bar *
wintobar(Window win)
{
Monitor *m;
Bar *bar;
for (m = mons; m; m = m->next)
for (bar = m->bar; bar; bar = bar->next)
if (bar->win == win)
return bar;
return NULL;
}

2
patch/bar.h Normal file
View File

@ -0,0 +1,2 @@
static void barhover(XEvent *e, Bar *bar);
static Bar *wintobar(Window win);

View File

@ -34,9 +34,10 @@ xinitvisual()
XFree(infos);
if (! visual) {
if (!visual) {
visual = DefaultVisual(dpy, screen);
depth = DefaultDepth(dpy, screen);
cmap = DefaultColormap(dpy, screen);
}
}

View File

@ -1,3 +1,4 @@
#define OPAQUE 0xffU
static void xinitvisual();

View File

@ -3,4 +3,5 @@ togglealttag()
{
selmon->alttag = !selmon->alttag;
drawbar(selmon);
}
}

View File

@ -0,0 +1,2 @@
static void togglealttag();

94
patch/bar_anybar.c Normal file
View File

@ -0,0 +1,94 @@
void
managealtbar(Window win, XWindowAttributes *wa)
{
Monitor *m;
Bar *bar;
int i = 0;
if (!(m = recttomon(wa->x, wa->y, wa->width, wa->height)))
return;
for (bar = m->bar; bar && bar->win && bar->next; bar = bar->next); // find last bar
if (!bar) {
bar = m->bar = ecalloc(1, sizeof(Bar));
bar->topbar = topbar;
} else if (bar && bar->win) {
i = bar->idx + 1;
bar->next = ecalloc(1, sizeof(Bar));
#if BAR_ANYBAR_TOP_AND_BOTTOM_BARS_PATCH
bar->next->topbar = !bar->topbar;
#else
bar->next->topbar = topbar;
#endif // BAR_ANYBAR_TOP_AND_BOTTOM_BARS_PATCH
bar = bar->next;
}
bar->external = 1;
bar->showbar = 1;
bar->mon = m;
bar->idx = i;
bar->borderpx = 0;
bar->win = win;
bar->bw = wa->width;
bar->bh = wa->height;
updatebarpos(m);
arrange(m);
XSelectInput(dpy, win, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
XMapWindow(dpy, win);
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
arrange(selmon);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &win, 1);
}
void
spawnbar()
{
if (*altbarcmd)
system(altbarcmd);
}
void
unmanagealtbar(Window w)
{
Monitor *m = wintomon(w);
Bar *bar, *next, *prev = NULL;
if (!m)
return;
for (bar = m->bar; bar && bar->win; bar = next) {
next = bar->next;
if (bar->win == w) {
if (prev)
prev->next = next;
else
m->bar = next;
free(bar);
break;
}
prev = bar;
}
updatebarpos(m);
arrange(m);
}
int
wmclasscontains(Window win, const char *class, const char *name)
{
XClassHint ch = { NULL, NULL };
int res = 1;
if (XGetClassHint(dpy, win, &ch)) {
if (ch.res_name && strstr(ch.res_name, name) == NULL)
res = 0;
if (ch.res_class && strstr(ch.res_class, class) == NULL)
res = 0;
} else
res = 0;
if (ch.res_class)
XFree(ch.res_class);
if (ch.res_name)
XFree(ch.res_name);
return res;
}

5
patch/bar_anybar.h Normal file
View File

@ -0,0 +1,5 @@
static void managealtbar(Window win, XWindowAttributes *wa);
static void spawnbar();
static void unmanagealtbar(Window w);
static int wmclasscontains(Window win, const char *class, const char *name);

123
patch/bar_awesomebar.c Normal file
View File

@ -0,0 +1,123 @@
int
width_awesomebar(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_awesomebar(Bar *bar, BarArg *a)
{
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
int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
#elif BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x, w = a->w - lrpad / 2;
#else
int x = a->x, w = a->w;
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
Client *c;
for (c = bar->mon->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
if (n > 0) {
remainder = w % n;
tabw = w / n;
for (i = 0, c = bar->mon->clients; c; c = c->next, i++) {
if (!ISVISIBLE(c))
continue;
if (bar->mon->sel == c && HIDDEN(c))
scm = SchemeHidSel;
else if (HIDDEN(c))
scm = SchemeHidNorm;
else if (bar->mon->sel == c)
scm = SchemeTitleSel;
else
scm = SchemeTitleNorm;
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)
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
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);
}
}
return n;
}
int
click_awesomebar(Bar *bar, Arg *arg, BarArg *a)
{
int x = 0, n = 0;
Client *c;
for (c = bar->mon->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
c = bar->mon->clients;
do {
if (!c || !ISVISIBLE(c))
continue;
else
x += (1.0 / (double)n) * a->w;
} while (c && a->x > x && (c = c->next));
if (c) {
arg->v = c;
return ClkWinTitle;
}
return -1;
}

4
patch/bar_awesomebar.h Normal file
View File

@ -0,0 +1,4 @@
static int width_awesomebar(Bar *bar, BarArg *a);
static int draw_awesomebar(Bar *bar, BarArg *a);
static int click_awesomebar(Bar *bar, Arg *arg, BarArg *a);

51
patch/bar_dwmblocks.c Normal file
View File

@ -0,0 +1,51 @@
static int statussig;
pid_t statuspid = -1;
pid_t
getstatusbarpid()
{
char buf[32], *str = buf, *c;
FILE *fp;
if (statuspid > 0) {
snprintf(buf, sizeof(buf), "/proc/%u/cmdline", statuspid);
if ((fp = fopen(buf, "r"))) {
fgets(buf, sizeof(buf), fp);
while ((c = strchr(str, '/')))
str = c + 1;
fclose(fp);
if (!strcmp(str, STATUSBAR))
return statuspid;
}
}
if (!(fp = popen("pgrep -o "STATUSBAR, "r")))
return -1;
fgets(buf, sizeof(buf), fp);
pclose(fp);
return strtol(buf, NULL, 10);
}
void
sigstatusbar(const Arg *arg)
{
union sigval sv;
if (!statussig)
return;
if ((statuspid = getstatusbarpid()) <= 0)
return;
#if BAR_DWMBLOCKS_SIGUSR1_PATCH
sv.sival_int = (statussig << 8) | arg->i;
if (sigqueue(statuspid, SIGUSR1, sv) == -1) {
if (errno == ESRCH) {
if (!getstatusbarpid())
sigqueue(statuspid, SIGUSR1, sv);
}
}
#else
sv.sival_int = arg->i;
sigqueue(statuspid, SIGRTMIN+statussig, sv);
#endif // BAR_DWMBLOCKS_SIGUSR1_PATCH
}

3
patch/bar_dwmblocks.h Normal file
View File

@ -0,0 +1,3 @@
static int getstatusbarpid();
static void sigstatusbar(const Arg *arg);

View File

@ -8,15 +8,27 @@ setcurrentdesktop(void)
void
setdesktopnames(void)
{
int i;
XTextProperty text;
Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, &text);
char *tags[NUMTAGS];
for (i = 0; i < NUMTAGS; i++)
tags[i] = tagicon(selmon, i);
Xutf8TextListToTextProperty(dpy, tags, NUMTAGS, XUTF8StringStyle, &text);
XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
}
void
setfloatinghint(Client *c)
{
Atom target = XInternAtom(dpy, "_IS_FLOATING", 0);
unsigned int floating[1] = {c->isfloating};
XChangeProperty(dpy, c->win, target, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)floating, 1);
}
void
setnumdesktops(void)
{
long data[] = { TAGSLENGTH };
long data[] = { NUMTAGS };
XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}
@ -37,4 +49,4 @@ updatecurrentdesktop(void)
}
long data[] = { i };
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}
}

View File

@ -1,7 +1,7 @@
#define TAGSLENGTH (LENGTH(tags))
static void setcurrentdesktop(void);
static void setdesktopnames(void);
static void setfloatinghint(Client *c);
static void setnumdesktops(void);
static void setviewport(void);
static void updatecurrentdesktop(void);
static void updatecurrentdesktop(void);

103
patch/bar_fancybar.c Normal file
View File

@ -0,0 +1,103 @@
int
width_fancybar(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_fancybar(Bar *bar, BarArg *a)
{
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;
#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
int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
#elif BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x, w = a->w - lrpad / 2;
#else
int x = a->x, w = a->w;
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
for (c = m->clients; c; c = c->next) {
if (ISVISIBLE(c))
n++;
}
if (n > 0) {
tabw = TEXTW(m->sel->name);
#if BAR_WINICON_PATCH
if (m->sel->icon)
tabw += m->sel->icw + ICONSPACING;
#endif // BAR_WINICON_PATCH
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;
tabw = TEXTW(c->name);
#if BAR_WINICON_PATCH
if (c->icon)
tabw += c->icw + ICONSPACING;
#endif // BAR_WINICON_PATCH
if (tabw < mw)
ew += (mw - tabw);
else
i++;
}
if (i > 0)
mw += ew / i;
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
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]);
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, tx, a->y, tw, a->h);
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;
}
#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;
}
int
click_fancybar(Bar *bar, Arg *arg, BarArg *a)
{
return ClkWinTitle;
}

4
patch/bar_fancybar.h Normal file
View File

@ -0,0 +1,4 @@
static int width_fancybar(Bar *bar, BarArg *a);
static int draw_fancybar(Bar *bar, BarArg *a);
static int click_fancybar(Bar *bar, Arg *arg, BarArg *a);

482
patch/bar_flexwintitle.c Normal file
View File

@ -0,0 +1,482 @@
/* Flexwintitle properties, you can override these in your config.h if you want. */
#ifndef FLEXWINTITLE_BORDERS
#define FLEXWINTITLE_BORDERS 1 // 0 = off, 1 = on
#endif
#ifndef FLEXWINTITLE_SHOWFLOATING
#define FLEXWINTITLE_SHOWFLOATING 0 // whether to show titles for floating windows, hidden clients are always shown
#endif
#ifndef FLEXWINTITLE_MASTERWEIGHT
#define FLEXWINTITLE_MASTERWEIGHT 9 // master weight compared to stack, hidden and floating window titles
#endif
#ifndef FLEXWINTITLE_STACKWEIGHT
#define FLEXWINTITLE_STACKWEIGHT 3 // stack weight compared to master, hidden and floating window titles
#endif
#ifndef FLEXWINTITLE_HIDDENWEIGHT
#define FLEXWINTITLE_HIDDENWEIGHT 1 // hidden window title weight
#endif
#ifndef FLEXWINTITLE_FLOATWEIGHT
#define FLEXWINTITLE_FLOATWEIGHT 1 // floating window title weight, set to 0 to not show floating windows
#endif
#define SCHEMEFOR(c) getschemefor(m, c, groupactive == c)
enum { GRP_NOSELECTION, GRP_MASTER, GRP_STACK1, GRP_STACK2, GRP_FLOAT, GRP_HIDDEN };
int
width_flexwintitle(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_flexwintitle(Bar *bar, BarArg *a)
{
drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1);
return flextitlecalculate(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a);
}
int
click_flexwintitle(Bar *bar, Arg *arg, BarArg *a)
{
flextitlecalculate(bar->mon, 0, a->w, a->x, flextitleclick, arg, a);
return ClkWinTitle;
}
Client *
flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int scheme, int draw_tiled, int draw_hidden, int draw_floating,
int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg)
{
int i;
for (i = 0; c && i < max_clients; c = c->next) {
if (
ISVISIBLE(c) &&
(
(draw_tiled && !c->isfloating && !HIDDEN(c)) ||
(draw_floating && c->isfloating && !HIDDEN(c)) ||
(draw_hidden && HIDDEN(c))
)
) {
tabfn(m, c, passx, x, w + (i < r ? 1 : 0), scheme, arg, barg);
x += w + (i < r ? 1 : 0);
i++;
}
}
return c;
}
int
getschemefor(Monitor *m, int group, int activegroup)
{
switch (group) {
case GRP_NOSELECTION:
case GRP_MASTER:
case GRP_STACK1:
case GRP_STACK2:
#if BSTACK_LAYOUT
if (m->lt[m->sellt]->arrange == &bstack)
return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR);
#endif // BSTACK_LAYOUT
#if BSTACKHORIZ_LAYOUT
if (m->lt[m->sellt]->arrange == &bstackhoriz) {
if (group == GRP_MASTER)
return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR);
else
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
}
#endif // BSTACKHORIZ_LAYOUT
#if CENTEREDMASTER_LAYOUT
if (m->lt[m->sellt]->arrange == &centeredmaster)
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
#endif // CENTEREDMASTER_LAYOUT
#if CENTEREDFLOATINGMASTER_LAYOUT
if (m->lt[m->sellt]->arrange == &centeredfloatingmaster)
return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR);
#endif // CENTEREDFLOATINGMASTER_LAYOUT
#if COLUMNS_LAYOUT
if (m->lt[m->sellt]->arrange == &col) {
if (group == GRP_MASTER)
return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR);
else
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
}
#endif // COLUMNS_LAYOUT
#if DECK_LAYOUT
if (m->lt[m->sellt]->arrange == &deck) {
if (group == GRP_MASTER)
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
else
return (activegroup ? SchemeFlexActMONO : SchemeFlexInaMONO);
}
#endif // DECK_LAYOUT
#if FIBONACCI_DWINDLE_LAYOUT
if (m->lt[m->sellt]->arrange == &dwindle)
return (activegroup ? SchemeFlexActDWDL : SchemeFlexInaDWDL);
#endif // FIBONACCI_DWINDLE_LAYOUT
#if FIBONACCI_SPIRAL_LAYOUT
if (m->lt[m->sellt]->arrange == &spiral)
return (activegroup ? SchemeFlexActSPRL : SchemeFlexInaSPRL);
#endif // FIBONACCI_SPIRAL_LAYOUT
#if FLEXTILE_DELUXE_LAYOUT
if (m->lt[m->sellt]->arrange == &flextile)
return (activegroup ? SchemeFlexActTTB + m->ltaxis[group] : SchemeFlexInaTTB + m->ltaxis[group]);
#endif // FLEXTILE_DELUXE_LAYOUT
#if GAPPLESSGRID_LAYOUT
if (m->lt[m->sellt]->arrange == &gaplessgrid)
return (activegroup ? SchemeFlexActGRID : SchemeFlexInaGRID);
#endif // GAPPLESSGRID_LAYOUT
#if GRIDMODE_LAYOUT
if (m->lt[m->sellt]->arrange == &grid)
return (activegroup ? SchemeFlexActGRDM : SchemeFlexInaGRDM);
#endif // GRIDMODE_LAYOUT
#if HORIZGRID_LAYOUT
if (m->lt[m->sellt]->arrange == &horizgrid)
return (activegroup ? SchemeFlexActHGRD : SchemeFlexInaHGRD);
#endif // HORIZGRID_LAYOUT
#if NROWGRID_LAYOUT
if (m->lt[m->sellt]->arrange == &nrowgrid)
return (activegroup ? SchemeFlexActGRD1 : SchemeFlexInaGRD1);
#endif // NROWGRID_LAYOUT
#if TILE_LAYOUT
if (m->lt[m->sellt]->arrange == &tile)
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
#endif // TILE_LAYOUT
#if MONOCLE_LAYOUT
if (m->lt[m->sellt]->arrange == &monocle)
return (activegroup ? SchemeFlexActMONO : SchemeFlexInaMONO);
#endif // MONOCLE_LAYOUT
return SchemeTitleNorm;
case GRP_HIDDEN:
return SchemeHidNorm;
case GRP_FLOAT:
return (activegroup ? SchemeFlexActFloat : SchemeFlexInaFloat);
}
return SchemeTitleNorm;
}
int
getselschemefor(int scheme)
{
if (scheme == SchemeFlexActFloat || scheme == SchemeFlexInaFloat)
return SchemeFlexSelFloat;
if (scheme >= SchemeFlexInaTTB)
return scheme + SchemeFlexInaTTB - SchemeFlexActTTB;
if (scheme >= SchemeFlexActTTB)
return scheme + SchemeFlexSelTTB - SchemeFlexActTTB;
return SchemeTitleSel;
}
void
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;
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 = (
#if RENAMED_SCRATCHPADS_PATCH
c->scratchkey != 0 && c == selmon->sel
? SchemeScratchSel
: c->scratchkey != 0
? SchemeScratchNorm
:
#endif // RENAMED_SCRATCHPADS_PATCH
c == selmon->sel && HIDDEN(c)
? SchemeHidSel
: HIDDEN(c)
? SchemeHidNorm
: c == selmon->sel
? getselschemefor(tabscheme)
: c->isurgent
? SchemeUrg
: tabscheme
);
drw_setscheme(drw, scheme[clientscheme]);
XSetWindowBorder(dpy, c->win, scheme[clientscheme][ColBorder].pixel);
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
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(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, 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)
nviewtags++;
if ((c->tags >> i) & 1)
nclienttags++;
}
if (TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1)
drawindicator(m, c, 1, x, a->y, w, a->h, 0, 0, 0, INDICATOR_RIGHT_TAGS);
}
#ifndef HIDDEN
#define HIDDEN(C) 0
#endif
void
flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg)
{
if (passx >= x && passx <= x + w)
arg->v = c;
}
int
flextitlecalculate(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
) {
Client *c;
int n, center = 0, mirror = 0, fixed = 0; // layout configuration
int clientsnmaster = 0, clientsnstack = 0, clientsnfloating = 0, clientsnhidden = 0;
int i, w, r, num = 0, den, fulllayout = 0;
int clientsnstack2 = 0;
int groupactive = 0;
int selidx = 0;
int dualstack = 0;
int rw, rr;
int mas_x = offx, st1_x = offx, st2_x = offx, hid_x = offx, flt_x = offx;
int mas_w, st1_w, st2_w, hid_w;
for (i = 0, c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c)) {
if (FLEXWINTITLE_HIDDENWEIGHT)
clientsnhidden++;
continue;
}
if (c->isfloating) {
if (FLEXWINTITLE_FLOATWEIGHT)
clientsnfloating++;
continue;
}
if (m->sel == c)
selidx = i;
if (i < m->nmaster)
clientsnmaster++;
#if FLEXTILE_DELUXE_LAYOUT
else if (m->nstack) {
if (clientsnstack < m->nstack)
clientsnstack++;
else
clientsnstack2++;
}
#endif // FLEXTILE_DELUXE_LAYOUT
else if ((i - m->nmaster) % 2)
clientsnstack2++;
else
clientsnstack++;
i++;
}
if (!m->sel)
groupactive = GRP_NOSELECTION;
else if (HIDDEN(m->sel))
groupactive = GRP_HIDDEN;
else if (m->sel->isfloating)
groupactive = GRP_FLOAT;
else if (selidx < clientsnmaster)
groupactive = GRP_MASTER;
else if (selidx < clientsnmaster + clientsnstack)
groupactive = GRP_STACK1;
else if (selidx < clientsnmaster + clientsnstack + clientsnstack2)
groupactive = GRP_STACK2;
n = clientsnmaster + clientsnstack + clientsnstack2 + clientsnfloating + clientsnhidden;
if (n == 0)
return 0;
#if FLEXTILE_DELUXE_LAYOUT
else if (m->lt[m->sellt]->arrange == &flextile) {
int layout = m->ltaxis[LAYOUT];
if (layout < 0) {
mirror = 1;
layout *= -1;
}
if (layout > FLOATING_MASTER) {
layout -= FLOATING_MASTER;
fixed = 1;
}
if (layout == SPLIT_HORIZONTAL_DUAL_STACK || layout == SPLIT_HORIZONTAL_DUAL_STACK_FIXED)
dualstack = 1;
else if (layout == SPLIT_CENTERED_VERTICAL && (fixed || n - m->nmaster > 1))
center = 1;
else if (layout == FLOATING_MASTER)
center = 1;
else if (layout == SPLIT_CENTERED_HORIZONTAL) {
if (fixed || n - m->nmaster > 1)
center = 1;
}
}
#endif // FLEXTILE_DELUXE_LAYOUT
#if CENTEREDMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredmaster && (fixed || n - m->nmaster > 1))
center = 1;
#endif // CENTEREDMASTER_LAYOUT
#if CENTEREDFLOATINGMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredfloatingmaster)
center = 1;
#endif // CENTEREDFLOATINGMASTER_LAYOUT
/* Certain layouts have no master / stack areas */
if (!m->lt[m->sellt]->arrange // floating layout
|| (!n || (!fixed && m->nmaster && n <= m->nmaster)) // no master
#if MONOCLE_LAYOUT
|| m->lt[m->sellt]->arrange == &monocle
#endif // MONOCLE_LAYOUT
#if GRIDMODE_LAYOUT
|| m->lt[m->sellt]->arrange == &grid
#endif // GRIDMODE_LAYOUT
#if HORIZGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &horizgrid
#endif // HORIZGRID_LAYOUT
#if GAPPLESSGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &gaplessgrid
#endif // GAPPLESSGRID_LAYOUT
#if NROWGRID_LAYOUT
|| m->lt[m->sellt]->arrange == &nrowgrid
#endif // NROWGRID_LAYOUT
#if FLEXTILE_DELUXE_LAYOUT
|| (m->lt[m->sellt]->arrange == &flextile && m->ltaxis[LAYOUT] == NO_SPLIT)
#endif // FLEXTILE_DELUXE_LAYOUT
)
fulllayout = 1;
num = tabw;
c = m->clients;
/* floating mode */
if ((fulllayout && FLEXWINTITLE_FLOATWEIGHT > 0) || clientsnmaster + clientsnstack == 0 || !m->lt[m->sellt]->arrange) {
den = clientsnmaster + clientsnstack + clientsnstack2 + clientsnfloating + clientsnhidden;
w = num / den;
r = num % den; // rest
c = flextitledrawarea(m, c, mas_x, r, w, den, !m->lt[m->sellt]->arrange ? SchemeFlexActFloat : SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, FLEXWINTITLE_FLOATWEIGHT, passx, tabfn, arg, barg); // floating
/* no master and stack mode, e.g. monocole, grid layouts, fibonacci */
} else if (fulllayout) {
den = clientsnmaster + clientsnstack + clientsnstack2 + clientsnhidden;
w = num / den;
r = num % den; // rest
c = flextitledrawarea(m, c, mas_x, r, w, den, SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, 0, passx, tabfn, arg, barg); // full
/* tiled mode */
} else {
den = clientsnmaster * FLEXWINTITLE_MASTERWEIGHT + (clientsnstack + clientsnstack2) * FLEXWINTITLE_STACKWEIGHT + clientsnfloating * FLEXWINTITLE_FLOATWEIGHT + clientsnhidden * FLEXWINTITLE_HIDDENWEIGHT;
w = num / den; // weight width per client
r = num % den; // weight rest width
rw = r / n; // rest incr per client
rr = r % n; // rest rest
#if FLEXTILE_DELUXE_LAYOUT
if ((!center && !dualstack) || (center && n <= m->nmaster + (m->nstack ? m->nstack : 1)))
#else
if ((!center && !dualstack) || (center && n <= m->nmaster + 1))
#endif // FLEXTILE_DELUXE_LAYOUT
{
clientsnstack += clientsnstack2;
clientsnstack2 = 0;
if (groupactive == GRP_STACK2)
groupactive = GRP_STACK1;
}
mas_w = clientsnmaster * rw + w * clientsnmaster * FLEXWINTITLE_MASTERWEIGHT + (rr > 0 ? MIN(rr, clientsnmaster) : 0);
rr -= clientsnmaster;
st1_w = clientsnstack * (rw + w * FLEXWINTITLE_STACKWEIGHT) + (rr > 0 ? MIN(rr, clientsnstack) : 0);
rr -= clientsnstack;
st2_w = clientsnstack2 * (rw + w * FLEXWINTITLE_STACKWEIGHT) + (rr > 0 ? MIN(rr, clientsnstack2) : 0);
rr -= clientsnstack2;
hid_w = clientsnhidden * (rw + w * FLEXWINTITLE_HIDDENWEIGHT) + (rr > 0 ? MIN(rr, clientsnhidden) : 0);
rr -= clientsnhidden;
rr = r % n;
if (mirror) {
if (center && clientsnstack2) {
mas_x = st1_x + st1_w;
st2_x = mas_x + mas_w;
hid_x = st2_x + st2_w;
} else {
if (clientsnstack2) {
st2_x = st1_x + st1_w;
mas_x = st2_x + st2_w;
} else
mas_x = st1_x + st1_w;
hid_x = mas_x + mas_w;
}
} else {
if (center && clientsnstack2) {
mas_x = st2_x + st2_w;
st1_x = mas_x + mas_w;
hid_x = st1_x + st1_w;
} else {
st1_x = mas_x + mas_w;
if (clientsnstack2) {
st2_x = st1_x + st1_w;
hid_x = st2_x + st2_w;
} else
hid_x = st1_x + st1_w;
}
}
flt_x = hid_x + hid_w;
c = flextitledrawarea(m, c, mas_x, rr, w * FLEXWINTITLE_MASTERWEIGHT + rw, clientsnmaster, SCHEMEFOR(GRP_MASTER), 1, 0, 0, passx, tabfn, arg, barg); // master
rr -= clientsnmaster;
c = flextitledrawarea(m, c, st1_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack, SCHEMEFOR(GRP_STACK1), 1, 0, 0, passx, tabfn, arg, barg); // stack1
rr -= clientsnstack;
if (clientsnstack2) {
c = flextitledrawarea(m, c, st2_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack2, SCHEMEFOR(GRP_STACK2), 1, 0, 0, passx, tabfn, arg, barg); // stack2
rr -= clientsnstack2;
}
c = flextitledrawarea(m, m->clients, hid_x, rr, w * FLEXWINTITLE_HIDDENWEIGHT + rw, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg, barg); // hidden
rr -= clientsnhidden;
c = flextitledrawarea(m, m->clients, flt_x, rr, w * FLEXWINTITLE_FLOATWEIGHT + rw, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg, barg); // floating
}
return 1;
}

11
patch/bar_flexwintitle.h Normal file
View File

@ -0,0 +1,11 @@
static int width_flexwintitle(Bar *bar, BarArg *a);
static int draw_flexwintitle(Bar *bar, BarArg *a);
static int click_flexwintitle(Bar *bar, Arg *arg, BarArg *a);
static void flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg);
static void flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg);
static int flextitlecalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg);
static int getschemefor(Monitor *m, int group, int activegroup);
static int getselschemefor(int scheme);
static Client *flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int tabscheme, int draw_tiled, int draw_hidden, int draw_floating, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg);

43
patch/bar_holdbar.c Normal file
View File

@ -0,0 +1,43 @@
void
holdbar(const Arg *arg)
{
if (selmon->showbar)
return;
Bar *bar;
selmon->showbar = 2;
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
keyrelease(XEvent *e)
{
Bar *bar;
if (XEventsQueued(dpy, QueuedAfterReading)) {
XEvent ne;
XPeekEvent(dpy, &ne);
if (ne.type == KeyPress && ne.xkey.time == e->xkey.time &&
ne.xkey.keycode == e->xkey.keycode) {
XNextEvent(dpy, &ne);
return;
}
}
if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY) && selmon->showbar == 2) {
selmon->showbar = 0;
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
combo = 0;
#endif // COMBO_PATCH
}

View File

@ -1,3 +1,3 @@
static void keyrelease(XEvent *e);
static void holdbar(const Arg *arg);
static void updateholdbarpos(Monitor *m);

111
patch/bar_indicators.c Normal file
View File

@ -0,0 +1,111 @@
/* Indicator properties, you can override these in your config.h if you want. */
#ifndef TAGSINDICATOR
#define TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on
#endif
#ifndef TAGSPX
#define TAGSPX 5 // # pixels for tag grid boxes
#endif
#ifndef TAGSROWS
#define TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3)
#endif
void
drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert, int type)
{
int i, boxw, boxs, indn = 0;
if (!(occ & 1 << tag) || type == INDICATOR_NONE)
return;
boxs = drw->fonts->h / 9;
boxw = drw->fonts->h / 6 + 2;
if (filled == -1)
filled = m == selmon && m->sel && m->sel->tags & 1 << tag;
switch (type) {
default:
case INDICATOR_TOP_LEFT_SQUARE:
drw_rect(drw, x + boxs, y + boxs, boxw, boxw, filled, invert);
break;
case INDICATOR_TOP_LEFT_LARGER_SQUARE:
drw_rect(drw, x + boxs + 2, y + boxs+1, boxw+1, boxw+1, filled, invert);
break;
case INDICATOR_TOP_BAR:
drw_rect(drw, x + boxw, y, w - ( 2 * boxw + 1), boxw/2, filled, invert);
break;
case INDICATOR_TOP_BAR_SLIM:
drw_rect(drw, x + boxw, y, w - ( 2 * boxw + 1), 1, 0, invert);
break;
case INDICATOR_BOTTOM_BAR:
drw_rect(drw, x + boxw, y + h - boxw/2, w - ( 2 * boxw + 1), boxw/2, filled, invert);
break;
case INDICATOR_BOTTOM_BAR_SLIM:
drw_rect(drw, x + boxw, y + h - 1, w - ( 2 * boxw + 1), 1, 0, invert);
break;
case INDICATOR_BOX:
drw_rect(drw, x + boxw, y, w - 2 * boxw, h, 0, invert);
break;
case INDICATOR_BOX_WIDER:
drw_rect(drw, x + boxw/2, y, w - boxw, h, 0, invert);
break;
case INDICATOR_BOX_FULL:
drw_rect(drw, x, y, w - 2, h, 0, invert);
break;
case INDICATOR_CLIENT_DOTS:
for (c = m->clients; c; c = c->next) {
if (c->tags & (1 << tag)) {
drw_rect(drw, x, 1 + (indn * 2), m->sel == c ? 6 : 1, 1, 1, invert);
indn++;
}
if (h <= 1 + (indn * 2)) {
indn = 0;
x += 2;
}
}
break;
case INDICATOR_RIGHT_TAGS:
if (!c)
break;
for (i = 0; i < NUMTAGS; i++) {
drw_rect(drw,
( x + w - 2 - ((NUMTAGS / TAGSROWS) * TAGSPX)
- (i % (NUMTAGS/TAGSROWS)) + ((i % (NUMTAGS / TAGSROWS)) * TAGSPX)
),
( y + 2 + ((i / (NUMTAGS/TAGSROWS)) * TAGSPX)
- ((i / (NUMTAGS/TAGSROWS)))
),
TAGSPX, TAGSPX, (c->tags >> i) & 1, 0
);
}
break;
case INDICATOR_PLUS_AND_LARGER_SQUARE:
boxs += 2;
boxw += 2;
/* falls through */
case INDICATOR_PLUS_AND_SQUARE:
drw_rect(drw, x + boxs, y + boxs, boxw % 2 ? boxw : boxw + 1, boxw % 2 ? boxw : boxw + 1, filled, invert);
/* falls through */
case INDICATOR_PLUS:
if (!(boxw % 2))
boxw += 1;
drw_rect(drw, x + boxs + boxw / 2, y + boxs, 1, boxw, filled, invert); // |
drw_rect(drw, x + boxs, y + boxs + boxw / 2, boxw + 1, 1, filled, invert); //
break;
}
}
void
drawstateindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert)
{
#if FAKEFULLSCREEN_CLIENT_PATCH && !FAKEFULLSCREEN_PATCH
if (c->fakefullscreen && c->isfloating)
drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, floatfakefsindicatortype);
else if (c->fakefullscreen)
drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, fakefsindicatortype);
else
#endif // FAKEFULLSCREEN_CLIENT_PATCH
if (c->isfloating)
drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, floatindicatortype);
else
drawindicator(m, c, occ, x, y, w, h, tag, filled, invert, tiledindicatortype);
}

21
patch/bar_indicators.h Normal file
View File

@ -0,0 +1,21 @@
enum {
INDICATOR_NONE,
INDICATOR_TOP_LEFT_SQUARE,
INDICATOR_TOP_LEFT_LARGER_SQUARE,
INDICATOR_TOP_BAR,
INDICATOR_TOP_BAR_SLIM,
INDICATOR_BOTTOM_BAR,
INDICATOR_BOTTOM_BAR_SLIM,
INDICATOR_BOX,
INDICATOR_BOX_WIDER,
INDICATOR_BOX_FULL,
INDICATOR_CLIENT_DOTS,
INDICATOR_RIGHT_TAGS,
INDICATOR_PLUS,
INDICATOR_PLUS_AND_SQUARE,
INDICATOR_PLUS_AND_LARGER_SQUARE,
};
static void drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert, int type);
static void drawstateindicator(Monitor *m, Client *c, unsigned int occ, int x, int y, int w, int h, unsigned int tag, int filled, int invert);

81
patch/bar_launcher.c Normal file
View File

@ -0,0 +1,81 @@
#if BAR_STATUS2D_PATCH
int
width_launcher(Bar *bar, BarArg *a)
{
int i, x = 0;
for (i = 0; i < LENGTH(launchers); i++) {
x += status2dtextlength(launchers[i].name) + lrpad;
}
return x;
}
int
draw_launcher(Bar *bar, BarArg *a)
{
int i, w = 0;;
for (i = 0; i < LENGTH(launchers); i++) {
w = status2dtextlength(launchers[i].name);
drawstatusbar(a, launchers[i].name);
a->x += w + lrpad;
}
return a->x ;
}
int
click_launcher(Bar *bar, Arg *arg, BarArg *a)
{
int i, x = 0;
for (i = 0; i < LENGTH(launchers); i++) {
x += status2dtextlength(launchers[i].name) + lrpad;
if (a->x < x) {
spawn(&launchers[i].command);
break;
}
}
return -1;
}
#else
int
width_launcher(Bar *bar, BarArg *a)
{
int i, x = 0;
for (i = 0; i < LENGTH(launchers); i++) {
x += TEXTW(launchers[i].name);
}
return x;
}
int
draw_launcher(Bar *bar, BarArg *a)
{
int i, x = 0, w = 0;;
for (i = 0; i < LENGTH(launchers); i++) {
w = TEXTW(launchers[i].name);
drw_text(drw, x, 0, w, bh, lrpad / 2, launchers[i].name, 0, True);
x += w;
}
return x;
}
int
click_launcher(Bar *bar, Arg *arg, BarArg *a)
{
int i, x = 0;
for (i = 0; i < LENGTH(launchers); i++) {
x += TEXTW(launchers[i].name);
if (a->x < x) {
spawn(&launchers[i].command);
break;
}
}
return -1;
}
#endif // BAR_STATUS2D_PATCH

8
patch/bar_launcher.h Normal file
View File

@ -0,0 +1,8 @@
typedef struct {
char* name;
const Arg command;
} Launcher;
static int width_launcher(Bar *bar, BarArg *a);
static int draw_launcher(Bar *bar, BarArg *a);
static int click_launcher(Bar *bar, Arg *arg, BarArg *a);

18
patch/bar_layoutmenu.c Normal file
View File

@ -0,0 +1,18 @@
void
layoutmenu(const Arg *arg) {
FILE *p;
char c[3], *s;
int i;
if (!(p = popen(layoutmenu_cmd, "r")))
return;
s = fgets(c, sizeof(c), p);
pclose(p);
if (!s || *s == '\0' || c[0] == '\0')
return;
i = atoi(c);
setlayout(&((Arg) { .v = &layouts[i] }));
}

2
patch/bar_layoutmenu.h Normal file
View File

@ -0,0 +1,2 @@
static void layoutmenu(const Arg *arg);

17
patch/bar_ltsymbol.c Normal file
View File

@ -0,0 +1,17 @@
int
width_ltsymbol(Bar *bar, BarArg *a)
{
return TEXTW(bar->mon->ltsymbol);
}
int
draw_ltsymbol(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, bar->mon->ltsymbol, 0, False);
}
int
click_ltsymbol(Bar *bar, Arg *arg, BarArg *a)
{
return ClkLtSymbol;
}

3
patch/bar_ltsymbol.h Normal file
View File

@ -0,0 +1,3 @@
static int width_ltsymbol(Bar *bar, BarArg *a);
static int draw_ltsymbol(Bar *bar, BarArg *a);
static int click_ltsymbol(Bar *bar, Arg *arg, BarArg *a);

View File

@ -0,0 +1,122 @@
static Clr **statusscheme;
int
width_pwrl_status(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return widthpowerlinestatus(rawstext);
#else
return widthpowerlinestatus(stext);
#endif // BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
width_pwrl_status_es(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return widthpowerlinestatus(rawestext);
#else
return widthpowerlinestatus(estext);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
int
draw_pwrl_status(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return drawpowerlinestatus(a->x + a->w, rawstext, a);
#else
return drawpowerlinestatus(a->x + a->w, stext, a);
#endif // BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
draw_pwrl_status_es(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return drawpowerlinestatus(a->x + a->w, rawestext, a);
#else
return drawpowerlinestatus(a->x + a->w, estext, a);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
int
click_pwrl_status(Bar *bar, Arg *arg, BarArg *a)
{
return ClkStatusText;
}
int
widthpowerlinestatus(char *stext)
{
char status[512];
int w = 0, i, n = strlen(stext);
int plw = drw->fonts->h / 2 + 1;
char *bs, bp = '|';
strcpy(status, stext);
for (i = n, bs = &status[n-1]; i >= 0; i--, bs--) {
if (*bs == '<' || *bs == '/' || *bs == '\\' || *bs == '>' || *bs == '|') { /* block start */
if (bp != '|')
w += plw;
w += TEXTW(bs+2);
bp = *bs;
*bs = 0;
}
}
if (bp != '|')
w += plw * 2;
return w;
}
int
drawpowerlinestatus(int xpos, char *stext, BarArg *barg)
{
char status[512];
int i, n = strlen(stext), cn = 0;
int x = xpos, w = 0;
int plw = drw->fonts->h / 2 + 1;
char *bs, bp = '|';
Clr *prevscheme = statusscheme[0], *nxtscheme;
strcpy(status, stext);
for (i = n, bs = &status[n-1]; i >= 0; i--, bs--) {
if (*bs == '<' || *bs == '/' || *bs == '\\' || *bs == '>' || *bs == '|') { /* block start */
cn = ((int) *(bs+1)) - 1;
if (cn < LENGTH(statuscolors)) {
drw_settrans(drw, prevscheme, (nxtscheme = statusscheme[cn]));
} else {
drw_settrans(drw, prevscheme, (nxtscheme = statusscheme[0]));
}
if (bp != '|') {
drw_arrow(drw, x - plw, barg->y, plw, barg->h, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1);
x -= plw;
}
drw_setscheme(drw, nxtscheme);
w = TEXTW(bs+2);
drw_text(drw, x - w, barg->y, w, barg->h, lrpad / 2, bs+2, 0, False);
x -= w;
bp = *bs;
*bs = 0;
prevscheme = nxtscheme;
}
}
if (bp != '|') {
drw_settrans(drw, prevscheme, scheme[SchemeNorm]);
drw_arrow(drw, x - plw, barg->y, plw, barg->h, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1);
drw_rect(drw, x - 2 * plw, barg->y, plw, barg->h, 1, 1);
x -= plw * 2;
}
return xpos - x;
}

View File

@ -0,0 +1,12 @@
static int width_pwrl_status(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int width_pwrl_status_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int draw_pwrl_status(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int draw_pwrl_status_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int click_pwrl_status(Bar *bar, Arg *arg, BarArg *a);
static int drawpowerlinestatus(int x, char *stext, BarArg *a);
static int widthpowerlinestatus(char *stext);

166
patch/bar_powerline_tags.c Normal file
View File

@ -0,0 +1,166 @@
int
width_pwrl_tags(Bar *bar, BarArg *a)
{
int w, i;
int plw = drw->fonts->h / 2 + 1;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
for (w = 0, i = 0; i < NUMTAGS; i++) {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
w += TEXTW(tagicon(bar->mon, i)) + plw;
}
return w + lrpad;
}
int
draw_pwrl_tags(Bar *bar, BarArg *a)
{
int x, w;
int invert;
int plw = drw->fonts->h / 2 + 1;
unsigned int i, occ = 0, urg = 0;
char *icon;
Client *c;
Clr *prevscheme, *nxtscheme;
for (c = bar->mon->clients; c; c = c->next) {
#if BAR_HIDEVACANTTAGS_PATCH
occ |= c->tags == 255 ? 0 : c->tags;
#else
occ |= c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
if (c->isurgent)
urg |= c->tags;
}
x = a->x;
prevscheme = scheme[SchemeNorm];
for (i = 0; i < NUMTAGS; i++) {
#if BAR_HIDEVACANTTAGS_PATCH
/* do not draw vacant tags */
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
icon = tagicon(bar->mon, i);
invert = 0;
w = TEXTW(icon);
if (urg & 1 << i) {
drw_settrans(drw, prevscheme, (nxtscheme = scheme[bar->mon->tagset[bar->mon->seltags] & 1 << i ? SchemeSel : SchemeUrg]));
} else {
drw_settrans(drw, prevscheme, (nxtscheme = scheme[bar->mon->tagset[bar->mon->seltags] & 1 << i ? SchemeSel : SchemeNorm]));
}
#if BAR_POWERLINE_TAGS_SLASH_PATCH
drw_arrow(drw, x, a->y, plw, a->h, 1, 1);
#else
drw_arrow(drw, x, a->y, plw, a->h, 1, 0);
#endif // BAR_POWERLINE_TAGS_SLASH_PATCH
x += plw;
drw_setscheme(drw, nxtscheme);
drw_text(drw, x, a->y, w, a->h, lrpad / 2, icon, invert, False);
drawindicator(bar->mon, NULL, occ, x, a->y, w, a->h, i, -1, invert, tagindicatortype);
x += w;
prevscheme = nxtscheme;
}
nxtscheme = scheme[SchemeNorm];
drw_settrans(drw, prevscheme, nxtscheme);
#if BAR_POWERLINE_TAGS_SLASH_PATCH
drw_arrow(drw, x, a->y, plw, a->h, 1, 1);
#else
drw_arrow(drw, x, a->y, plw, a->h, 1, 0);
#endif // BAR_POWERLINE_TAGS_SLASH_PATCH
return 1;
}
int
click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a)
{
int i = 0, x = lrpad / 2;
int plw = drw->fonts->h / 2 + 1;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(tagicon(bar->mon, i)) + plw;
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {
arg->ui = 1 << i;
}
#if BAR_TAGPREVIEW_PATCH
if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return ClkTagBar;
}
int
hover_pwrl_tags(Bar *bar, BarArg *a, XMotionEvent *ev)
{
#if BAR_TAGPREVIEW_PATCH
int i = 0, x = lrpad / 2;
int px, py;
int plw = drw->fonts->h / 2 + 1;
Monitor *m = bar->mon;
#if VANITYGAPS_PATCH
int ov = gappov;
int oh = gappoh;
#else
int ov = 0;
int oh = 0;
#endif // VANITYGAPS_PATCH
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(tagicon(bar->mon, i)) + plw;
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {
if ((i + 1) != selmon->previewshow && !(selmon->tagset[selmon->seltags] & 1 << i)) {
if (bar->by > m->my + m->mh / 2) // bottom bar
py = bar->by - m->mh / scalepreview - oh;
else // top bar
py = bar->by + bar->bh + oh;
px = bar->bx + ev->x - m->mw / scalepreview / 2;
if (px + m->mw / scalepreview > m->mx + m->mw)
px = m->wx + m->ww - m->mw / scalepreview - ov;
else if (px < bar->bx)
px = m->wx + ov;
selmon->previewshow = i + 1;
showtagpreview(i, px, py);
} else if (selmon->tagset[selmon->seltags] & 1 << i) {
hidetagpreview(selmon);
}
} else if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return 1;
}

View File

@ -0,0 +1,4 @@
static int width_pwrl_tags(Bar *bar, BarArg *a);
static int draw_pwrl_tags(Bar *bar, BarArg *a);
static int click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a);
static int hover_pwrl_tags(Bar *bar, BarArg *a, XMotionEvent *ev);

34
patch/bar_status.c Normal file
View File

@ -0,0 +1,34 @@
int
width_status(Bar *bar, BarArg *a)
{
return TEXTWM(stext);
}
#if BAR_EXTRASTATUS_PATCH
int
width_status_es(Bar *bar, BarArg *a)
{
return TEXTWM(estext) - lrpad;
}
#endif // BAR_EXTRASTATUS_PATCH
int
draw_status(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, stext, 0, True);
}
#if BAR_EXTRASTATUS_PATCH
int
draw_status_es(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, 0, estext, 0, True);
}
#endif // BAR_EXTRASTATUS_PATCH
int
click_status(Bar *bar, Arg *arg, BarArg *a)
{
return ClkStatusText;
}

10
patch/bar_status.h Normal file
View File

@ -0,0 +1,10 @@
static int width_status(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int width_status_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int draw_status(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int draw_status_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int click_status(Bar *bar, Arg *arg, BarArg *a);

269
patch/bar_status2d.c Normal file
View File

@ -0,0 +1,269 @@
#if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
static char termcol0[] = "#000000"; /* black */
static char termcol1[] = "#ff0000"; /* red */
static char termcol2[] = "#33ff00"; /* green */
static char termcol3[] = "#ff0099"; /* yellow */
static char termcol4[] = "#0066ff"; /* blue */
static char termcol5[] = "#cc00ff"; /* magenta */
static char termcol6[] = "#00ffff"; /* cyan */
static char termcol7[] = "#d0d0d0"; /* white */
static char termcol8[] = "#808080"; /* black */
static char termcol9[] = "#ff0000"; /* red */
static char termcol10[] = "#33ff00"; /* green */
static char termcol11[] = "#ff0099"; /* yellow */
static char termcol12[] = "#0066ff"; /* blue */
static char termcol13[] = "#cc00ff"; /* magenta */
static char termcol14[] = "#00ffff"; /* cyan */
static char termcol15[] = "#ffffff"; /* white */
static char *termcolor[] = {
termcol0, termcol1, termcol2, termcol3, termcol4, termcol5, termcol6, termcol7,
termcol8, termcol9, termcol10, termcol11, termcol12, termcol13, termcol14, termcol15,
};
#endif // BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
int
width_status2d(Bar *bar, BarArg *a)
{
int width;
#if BAR_EXTRASTATUS_PATCH || BAR_STATUSCMD_PATCH
width = status2dtextlength(rawstext);
#else
width = status2dtextlength(stext);
#endif // #if BAR_EXTRASTATUS_PATCH | BAR_STATUSCMD_PATCH
return width ? width + lrpad : 0;
}
#if BAR_EXTRASTATUS_PATCH
int
width_status2d_es(Bar *bar, BarArg *a)
{
int width;
#if BAR_STATUSCMD_PATCH
width = status2dtextlength(rawestext);
#else
width = status2dtextlength(estext);
#endif // BAR_STATUSCMD_PATCH
return width ? width + lrpad : 0;
}
#endif // BAR_EXTRASTATUS_PATCH
int
draw_status2d(Bar *bar, BarArg *a)
{
#if BAR_EXTRASTATUS_PATCH || BAR_STATUSCMD_PATCH
return drawstatusbar(a, rawstext);
#else
return drawstatusbar(a, stext);
#endif // #if BAR_EXTRASTATUS_PATCH | BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
draw_status2d_es(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return drawstatusbar(a, rawestext);
#else
return drawstatusbar(a, estext);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
#if !BAR_STATUSCMD_PATCH
int
click_status2d(Bar *bar, Arg *arg, BarArg *a)
{
return ClkStatusText;
}
#endif // BAR_STATUSCMD_PATCH
int
drawstatusbar(BarArg *a, char* stext)
{
int i, w, len;
int x = a->x;
int y = a->y;
short isCode = 0;
char *text;
char *p;
Clr oldbg, oldfg;
len = strlen(stext);
if (!(text = (char*) malloc(sizeof(char)*(len + 1))))
die("malloc");
p = text;
#if BAR_STATUSCMD_PATCH
copyvalidchars(text, stext);
#else
memcpy(text, stext, len);
#endif // BAR_STATUSCMD_PATCH
text[len] = '\0';
x += lrpad / 2;
drw_setscheme(drw, scheme[LENGTH(colors)]);
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
/* process status text */
i = -1;
while (text[++i]) {
if (text[i] == '^' && !isCode) {
isCode = 1;
text[i] = '\0';
w = TEXTWM(text) - lrpad;
drw_text(drw, x, y, w, bh, 0, text, 0, True);
x += w;
/* process code */
while (text[++i] != '^') {
if (text[i] == 'c') {
char buf[8];
if (i + 7 >= len) {
i += 7;
len = 0;
break;
}
memcpy(buf, (char*)text+i+1, 7);
buf[7] = '\0';
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], buf, 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], buf, alphas[SchemeNorm][ColFg]);
#else
drw_clr_create(drw, &drw->scheme[ColFg], buf);
#endif // BAR_ALPHA_PATCH
i += 7;
} else if (text[i] == 'b') {
char buf[8];
if (i + 7 >= len) {
i += 7;
len = 0;
break;
}
memcpy(buf, (char*)text+i+1, 7);
buf[7] = '\0';
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], buf, 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], buf, alphas[SchemeNorm][ColBg]);
#else
drw_clr_create(drw, &drw->scheme[ColBg], buf);
#endif // BAR_ALPHA_PATCH
i += 7;
#if BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
} else if (text[i] == 'C') {
int c = atoi(text + ++i) % 16;
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c], 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c], alphas[SchemeNorm][ColBg]);
#else
drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c]);
#endif // BAR_ALPHA_PATCH
} else if (text[i] == 'B') {
int c = atoi(text + ++i) % 16;
#if BAR_ALPHA_PATCH && BAR_STATUS2D_NO_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c], 0xff);
#elif BAR_ALPHA_PATCH
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c], alphas[SchemeNorm][ColBg]);
#else
drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c]);
#endif // BAR_ALPHA_PATCH
#endif // BAR_STATUS2D_XRDB_TERMCOLORS_PATCH
} else if (text[i] == 'd') {
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
} else if (text[i] == 'w') {
Clr swp;
swp = drw->scheme[ColFg];
drw->scheme[ColFg] = drw->scheme[ColBg];
drw->scheme[ColBg] = swp;
} else if (text[i] == 'v') {
oldfg = drw->scheme[ColFg];
oldbg = drw->scheme[ColBg];
} else if (text[i] == 't') {
drw->scheme[ColFg] = oldfg;
drw->scheme[ColBg] = oldbg;
} else if (text[i] == 'r') {
int rx = atoi(text + ++i);
while (text[++i] != ',');
int ry = atoi(text + ++i);
while (text[++i] != ',');
int rw = atoi(text + ++i);
while (text[++i] != ',');
int rh = atoi(text + ++i);
if (ry < 0)
ry = 0;
if (rx < 0)
rx = 0;
drw_rect(drw, rx + x, y + ry, rw, rh, 1, 0);
} else if (text[i] == 'f') {
x += atoi(text + ++i);
}
}
text = text + i + 1;
len -= i + 1;
i = -1;
isCode = 0;
if (len <= 0)
break;
}
}
if (!isCode && len > 0) {
w = TEXTWM(text) - lrpad;
drw_text(drw, x, y, w, bh, 0, text, 0, True);
x += w;
}
free(p);
drw_setscheme(drw, scheme[SchemeNorm]);
return 1;
}
int
status2dtextlength(char* stext)
{
int i, w, len;
short isCode = 0;
char *text;
char *p;
len = strlen(stext) + 1;
if (!(text = (char*) malloc(sizeof(char)*len)))
die("malloc");
p = text;
#if BAR_STATUSCMD_PATCH
copyvalidchars(text, stext);
#else
memcpy(text, stext, len);
#endif // BAR_STATUSCMD_PATCH
/* compute width of the status text */
w = 0;
i = -1;
while (text[++i]) {
if (text[i] == '^') {
if (!isCode) {
isCode = 1;
text[i] = '\0';
w += TEXTWM(text) - lrpad;
text[i] = '^';
if (text[++i] == 'f')
w += atoi(text + ++i);
} else {
isCode = 0;
text = text + i + 1;
i = -1;
}
}
}
if (!isCode)
w += TEXTWM(text) - lrpad;
free(p);
return w;
}

14
patch/bar_status2d.h Normal file
View File

@ -0,0 +1,14 @@
static int width_status2d(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int width_status2d_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int draw_status2d(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int draw_status2d_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
#if !BAR_STATUSCMD_PATCH
static int click_status2d(Bar *bar, Arg *arg, BarArg *a);
#endif // BAR_STATUSCMD_PATCH
static int drawstatusbar(BarArg *a, char *text);
static int status2dtextlength(char *stext);

18
patch/bar_statusbutton.c Normal file
View File

@ -0,0 +1,18 @@
int
width_stbutton(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar);
}
int
draw_stbutton(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar, 0, False);
}
int
click_stbutton(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton;
}

4
patch/bar_statusbutton.h Normal file
View File

@ -0,0 +1,4 @@
static int width_stbutton(Bar *bar, BarArg *a);
static int draw_stbutton(Bar *bar, BarArg *a);
static int click_stbutton(Bar *bar, Arg *arg, BarArg *a);

79
patch/bar_statuscmd.c Normal file
View File

@ -0,0 +1,79 @@
#if !BAR_DWMBLOCKS_PATCH
static const char statusexport[] = "export BUTTON=-;";
static int statuscmdn;
static char lastbutton[] = "-";
#endif // BAR_DWMBLOCKS_PATCH
int
click_statuscmd(Bar *bar, Arg *arg, BarArg *a)
{
return click_statuscmd_text(arg, a->x, rawstext);
}
#if BAR_EXTRASTATUS_PATCH
int
click_statuscmd_es(Bar *bar, Arg *arg, BarArg *a)
{
return click_statuscmd_text(arg, a->x, rawestext);
}
#endif // BAR_EXTRASTATUS_PATCH
int
click_statuscmd_text(Arg *arg, int rel_x, char *text)
{
int i = -1;
int x = 0;
char ch;
#if BAR_DWMBLOCKS_PATCH
statussig = -1;
#else
statuscmdn = 0;
#endif // BAR_DWMBLOCKS_PATCH
while (text[++i]) {
if ((unsigned char)text[i] < ' ') {
#if BAR_STATUSCOLORS_PATCH
if (text[i] < 17)
continue;
#endif // BAR_STATUSCOLORS_PATCH
ch = text[i];
text[i] = '\0';
#if BAR_STATUS2D_PATCH && !BAR_STATUSCOLORS_PATCH
x += status2dtextlength(text);
#else
x += TEXTWM(text) - lrpad;
#endif // BAR_STATUS2D_PATCH
text[i] = ch;
text += i+1;
i = -1;
#if BAR_DWMBLOCKS_PATCH
if (x >= rel_x && statussig != -1)
break;
statussig = ch;
#else
if (x >= rel_x)
break;
if (ch <= LENGTH(statuscmds))
statuscmdn = ch;
#endif // BAR_DWMBLOCKS_PATCH
}
}
#if BAR_DWMBLOCKS_PATCH
if (statussig == -1)
statussig = 0;
#endif // BAR_DWMBLOCKS_PATCH
return ClkStatusText;
}
void
copyvalidchars(char *text, char *rawtext)
{
int i = -1, j = 0;
while (rawtext[++i]) {
if ((unsigned char)rawtext[i] >= ' ') {
text[j++] = rawtext[i];
}
}
text[j] = '\0';
}

12
patch/bar_statuscmd.h Normal file
View File

@ -0,0 +1,12 @@
static int click_statuscmd(Bar *bar, Arg *arg, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int click_statuscmd_es(Bar *bar, Arg *arg, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int click_statuscmd_text(Arg *arg, int rel_x, char *text);
static void copyvalidchars(char *text, char *rawtext);
typedef struct {
const char *cmd;
int id;
} StatusCmd;

102
patch/bar_statuscolors.c Normal file
View File

@ -0,0 +1,102 @@
int
width_statuscolors(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return textw_wosc(rawstext);
#else
return textw_wosc(stext);
#endif // BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
width_statuscolors_es(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return textw_wosc(rawestext);
#else
return textw_wosc(estext);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
int
draw_statuscolors(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return draw_wosc(bar, a, rawstext);
#else
return draw_wosc(bar, a, stext);
#endif // BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
draw_statuscolors_es(Bar *bar, BarArg *a)
{
#if BAR_STATUSCMD_PATCH
return draw_wosc(bar, a, rawestext);
#else
return draw_wosc(bar, a, estext);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
#if !BAR_STATUSCMD_PATCH
int
click_statuscolors(Bar *bar, Arg *arg, BarArg *a)
{
return ClkStatusText;
}
#endif // BAR_STATUSCMD_PATCH
int
textw_wosc(char *s)
{
char *ts = s;
char *tp = s;
int sw = 0;
char ctmp;
while (1) {
if ((unsigned int)*ts > LENGTH(colors)) {
ts++;
continue;
}
ctmp = *ts;
*ts = '\0';
sw += drw_fontset_getwidth(drw, tp, True);
*ts = ctmp;
if (ctmp == '\0')
break;
tp = ++ts;
}
return sw;
}
int
draw_wosc(Bar *bar, BarArg *a, char *s)
{
char *ts = s;
char *tp = s;
int tx = 0;
char ctmp;
while (1) {
if ((unsigned int)*ts > LENGTH(colors)) {
ts++;
continue;
}
ctmp = *ts;
*ts = '\0';
drw_text(drw, a->x + tx, a->y, a->w - tx, a->h, 0, tp, 0, True);
tx += TEXTW(tp) - lrpad;
if (ctmp == '\0')
break;
drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
*ts = ctmp;
tp = ++ts;
}
return 1;
}

13
patch/bar_statuscolors.h Normal file
View File

@ -0,0 +1,13 @@
static int width_statuscolors(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int width_statuscolors_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int draw_statuscolors(Bar *bar, BarArg *a);
#if BAR_EXTRASTATUS_PATCH
static int draw_statuscolors_es(Bar *bar, BarArg *a);
#endif // BAR_EXTRASTATUS_PATCH
#if !BAR_STATUSCMD_PATCH
static int click_statuscolors(Bar *bar, Arg *arg, BarArg *a);
#endif // BAR_STATUSCMD_PATCH
static int textw_wosc(char *s);
static int draw_wosc(Bar *bar, BarArg *a, char *s);

View File

@ -1,15 +1,113 @@
static Systray *systray = NULL;
static unsigned long systrayorientation = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
unsigned int
getsystraywidth()
int
width_systray(Bar *bar, BarArg *a)
{
unsigned int w = 0;
Client *i;
if (showsystray)
if (!systray)
return 1;
if (showsystray) {
for (i = systray->icons; i; w += i->w + systrayspacing, i = i->next);
return w ? w + systrayspacing : 0;
if (!w)
XMoveWindow(dpy, systray->win, -systray->h, bar->by);
}
return w ? w + lrpad - systrayspacing : 0;
}
int
draw_systray(Bar *bar, BarArg *a)
{
if (!showsystray)
return 0;
XSetWindowAttributes wa;
XWindowChanges wc;
Client *i;
unsigned int w;
if (!systray) {
/* init systray */
if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
wa.override_redirect = True;
wa.event_mask = ButtonPressMask|ExposureMask;
wa.border_pixel = 0;
systray->h = MIN(a->h, drw->fonts->h);
#if BAR_ALPHA_PATCH
wa.background_pixel = 0;
wa.colormap = cmap;
systray->win = XCreateWindow(dpy, root, bar->bx + a->x + lrpad / 2, -systray->h, MAX(a->w + 40, 1), systray->h, 0, depth,
InputOutput, visual,
CWOverrideRedirect|CWBorderPixel|CWBackPixel|CWColormap|CWEventMask, &wa); // CWBackPixmap
#else
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
systray->win = XCreateSimpleWindow(dpy, root, bar->bx + a->x + lrpad / 2, -systray->h, MIN(a->w, 1), systray->h, 0, 0, scheme[SchemeNorm][ColBg].pixel);
XChangeWindowAttributes(dpy, systray->win, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &wa);
#endif // BAR_ALPHA_PATCH
XSelectInput(dpy, systray->win, SubstructureNotifyMask);
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)&systrayorientation, 1);
#if BAR_ALPHA_PATCH
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayVisual], XA_VISUALID, 32,
PropModeReplace, (unsigned char *)&visual->visualid, 1);
#endif // BAR_ALPHA_PATCH
XChangeProperty(dpy, systray->win, netatom[NetWMWindowType], XA_ATOM, 32,
PropModeReplace, (unsigned char *)&netatom[NetWMWindowTypeDock], 1);
XMapRaised(dpy, systray->win);
XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime);
if (XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) {
sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0);
XSync(dpy, False);
} else {
fprintf(stderr, "dwm: unable to obtain system tray.\n");
free(systray);
systray = NULL;
return 0;
}
}
systray->bar = bar;
wc.stack_mode = Above;
wc.sibling = bar->win;
XConfigureWindow(dpy, systray->win, CWSibling|CWStackMode, &wc);
drw_setscheme(drw, scheme[SchemeNorm]);
for (w = 0, i = systray->icons; i; i = i->next) {
#if BAR_ALPHA_PATCH
wa.background_pixel = 0;
#else
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
#endif // BAR_ALPHA_PATCH
XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
XMapRaised(dpy, i->win);
i->x = w;
XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
w += i->w;
if (i->next)
w += systrayspacing;
if (i->mon != bar->mon)
i->mon = bar->mon;
}
#if !BAR_ALPHA_PATCH
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
XChangeWindowAttributes(dpy, systray->win, CWBackPixel, &wa);
XClearWindow(dpy, systray->win);
#endif // BAR_ALPHA_PATCH
XMoveResizeWindow(dpy, systray->win, bar->bx + a->x + lrpad / 2, (w ? bar->by + a->y + (a->h - systray->h) / 2: -systray->h), MAX(w, 1), systray->h);
return w;
}
int
click_systray(Bar *bar, Arg *arg, BarArg *a)
{
return -1;
}
void
@ -22,7 +120,9 @@ removesystrayicon(Client *i)
for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
if (ii)
*ii = i->next;
XReparentWindow(dpy, i->win, root, 0, 0);
free(i);
drawbarwin(systray->bar);
}
void
@ -33,136 +133,36 @@ resizerequest(XEvent *e)
if ((i = wintosystrayicon(ev->window))) {
updatesystrayicongeom(i, ev->width, ev->height);
updatesystray();
drawbarwin(systray->bar);
}
}
Monitor *
systraytomon(Monitor *m)
{
Monitor *t;
int i, n;
if (!systraypinning) {
if (!m)
return selmon;
return m == selmon ? m : NULL;
}
for (n = 1, t = mons; t && t->next; n++, t = t->next);
for (i = 1, t = mons; t && t->next && i < systraypinning; i++, t = t->next);
if (systraypinningfailfirst && n < systraypinning)
return mons;
return t;
}
void
updatesystray(void)
{
XSetWindowAttributes wa;
XWindowChanges wc;
Client *i;
Monitor *m = systraytomon(NULL);
unsigned int x = m->mx + m->mw;
unsigned int w = 1, xpad = 0, ypad = 0;
#if BARPADDING_PATCH
xpad = sp;
ypad = vp;
#endif // BARPADDING_PATCH
if (!showsystray)
return;
if (!systray) {
/* init systray */
if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
wa.override_redirect = True;
wa.event_mask = ButtonPressMask|ExposureMask;
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
wa.border_pixel = 0;
#if ALPHA_PATCH
wa.colormap = cmap;
systray->win = XCreateWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, depth,
InputOutput, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
#else
systray->win = XCreateSimpleWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, 0, scheme[SchemeNorm][ColBg].pixel);
XChangeWindowAttributes(dpy, systray->win, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &wa);
#endif // ALPHA_PATCH
XSelectInput(dpy, systray->win, SubstructureNotifyMask);
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)&systrayorientation, 1);
#if ALPHA_PATCH
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayVisual], XA_VISUALID, 32,
PropModeReplace, (unsigned char *)&visual->visualid, 1);
#endif // ALPHA_PATCH
XChangeProperty(dpy, systray->win, netatom[NetWMWindowType], XA_ATOM, 32,
PropModeReplace, (unsigned char *)&netatom[NetWMWindowTypeDock], 1);
XMapRaised(dpy, systray->win);
XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime);
if (XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) {
sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0);
XSync(dpy, False);
}
else {
fprintf(stderr, "dwm: unable to obtain system tray.\n");
free(systray);
systray = NULL;
return;
}
}
drw_setscheme(drw, scheme[SchemeNorm]);
for (w = 0, i = systray->icons; i; i = i->next) {
/* make sure the background color stays the same */
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
XMapRaised(dpy, i->win);
w += systrayspacing;
i->x = w;
XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
w += i->w;
if (i->mon != m)
i->mon = m;
}
w = w ? w + systrayspacing : 1;
x -= w;
XMoveResizeWindow(dpy, systray->win, x - xpad, m->by + ypad, w, bh);
wc.x = x - xpad;
wc.y = m->by + ypad;
wc.width = w;
wc.height = bh;
wc.stack_mode = Above; wc.sibling = m->barwin;
XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);
XMapWindow(dpy, systray->win);
XMapSubwindows(dpy, systray->win);
/* redraw background */
XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
XSync(dpy, False);
}
void
updatesystrayicongeom(Client *i, int w, int h)
{
if (!systray)
return;
int icon_height = systray->h;
if (i) {
i->h = bh;
i->h = icon_height;
if (w == h)
i->w = bh;
else if (h == bh)
i->w = icon_height;
else if (h == icon_height)
i->w = w;
else
i->w = (int) ((float)bh * ((float)w / (float)h));
i->w = (int) ((float)icon_height * ((float)w / (float)h));
applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False);
/* force icons into the systray dimensions if they don't want to */
if (i->h > bh) {
if (i->h > icon_height) {
if (i->w == i->h)
i->w = bh;
i->w = icon_height;
else
i->w = (int) ((float)bh * ((float)i->w / (float)i->h));
i->h = bh;
i->w = (int) ((float)icon_height * ((float)i->w / (float)i->h));
i->h = icon_height;
}
if (i->w > 2*bh)
i->w = bh;
if (i->w > 2 * icon_height)
i->w = icon_height;
}
}
@ -172,8 +172,8 @@ updatesystrayiconstate(Client *i, XPropertyEvent *ev)
long flags;
int code = 0;
if (!showsystray || !i || ev->atom != xatom[XembedInfo] ||
!(flags = getatomprop(i, xatom[XembedInfo])))
if (!showsystray || !systray || !i || ev->atom != xatom[XembedInfo] ||
!(flags = getatomprop(i, xatom[XembedInfo], xatom[XembedInfo])))
return;
if (flags & XEMBED_MAPPED && !i->tags) {
@ -197,10 +197,12 @@ updatesystrayiconstate(Client *i, XPropertyEvent *ev)
Client *
wintosystrayicon(Window w)
{
if (!systray)
return NULL;
Client *i = NULL;
if (!showsystray || !w)
return i;
for (i = systray->icons; i && i->win != w; i = i->next);
return i;
}
}

View File

@ -22,16 +22,20 @@ typedef struct Systray Systray;
struct Systray {
Window win;
Client *icons;
Bar *bar;
int h;
};
/* bar integration */
static int width_systray(Bar *bar, BarArg *a);
static int draw_systray(Bar *bar, BarArg *a);
static int click_systray(Bar *bar, Arg *arg, BarArg *a);
/* function declarations */
static Atom getatomprop(Client *c, Atom prop);
static unsigned int getsystraywidth();
static void removesystrayicon(Client *i);
static void resizerequest(XEvent *e);
static Monitor *systraytomon(Monitor *m);
static void updatesystray(void);
static void updatesystrayicongeom(Client *i, int w, int h);
static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
static Client *wintosystrayicon(Window w);

258
patch/bar_tabgroups.c Normal file
View File

@ -0,0 +1,258 @@
/* Bartabgroups properties, you can override these in your config.h if you want. */
#ifndef BARTAB_BORDERS
#define BARTAB_BORDERS 1 // 0 = off, 1 = on
#endif
#ifndef BARTAB_SHOWFLOATING
#define BARTAB_SHOWFLOATING 0 // whether to show titles for floating windows, hidden clients are always shown
#endif
#ifndef BARTAB_STACKWEIGHT
#define BARTAB_STACKWEIGHT 1 // stack weight compared to hidden and floating window titles
#endif
#ifndef BARTAB_HIDDENWEIGHT
#define BARTAB_HIDDENWEIGHT 1 // hidden window title weight
#endif
#ifndef BARTAB_FLOATWEIGHT
#define BARTAB_FLOATWEIGHT 1 // floating window title weight, set to 0 to not show floating windows
#endif
int
width_bartabgroups(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_bartabgroups(Bar *bar, BarArg *a)
{
drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1);
return bartabcalculate(bar->mon, a->x, a->w, -1, bartabdraw, NULL, a);
}
int
click_bartabgroups(Bar *bar, Arg *arg, BarArg *a)
{
bartabcalculate(bar->mon, 0, a->w, a->x, bartabclick, arg, a);
return ClkWinTitle;
}
void
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;
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
&& HIDDEN(c)
? SchemeHidSel
: HIDDEN(c)
? SchemeHidNorm
: m->sel == c
#endif
? SchemeSel
: groupactive
? SchemeTitleSel
: SchemeTitleNorm
]);
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
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(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, 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)
nviewtags++;
if ((c->tags >> i) & 1)
nclienttags++;
}
if (TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1)
drawindicator(m, c, 1, x, a->y, w, a->h, 0, 0, 0, INDICATOR_RIGHT_TAGS);
}
#ifndef HIDDEN
#define HIDDEN(C) 0
#endif
void
bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg)
{
if (passx >= x && passx <= x + w)
arg->v = c;
}
int
bartabcalculate(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
) {
Client *c;
int
i, clientsnmaster = 0, clientsnstack = 0, clientsnfloating = 0, clientsnhidden = 0,
masteractive = 0, fulllayout = 0,
x = offx, w, r, num = 0, den, tgactive;
for (i = 0; i < LENGTH(bartabmonfns); i++)
if (m ->lt[m->sellt]->arrange == bartabmonfns[i]) {
fulllayout = 1;
break;
}
for (i = 0, c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c)) {
clientsnhidden++;
continue;
}
if (c->isfloating) {
clientsnfloating++;
continue;
}
if (m->sel == c)
masteractive = i < m->nmaster;
if (i < m->nmaster)
clientsnmaster++;
else
clientsnstack++;
i++;
}
if (clientsnmaster + clientsnstack + clientsnfloating + clientsnhidden == 0)
return 0;
tgactive = 1;
num = tabw;
/* floating mode */
if ((fulllayout && BARTAB_FLOATWEIGHT) || clientsnmaster + clientsnstack == 0 || !m->lt[m->sellt]->arrange) {
den = clientsnmaster + clientsnstack + clientsnfloating + clientsnhidden;
r = num % den;
w = num / den;
for (c = m->clients, i = 0; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg);
x += w + (i < r ? 1 : 0);
i++;
}
/* no master and stack mode, e.g. monocole, grid layouts, fibonacci */
} else if (fulllayout) {
den = clientsnmaster + clientsnstack + clientsnhidden;
r = num % den;
w = num / den;
for (c = m->clients, i = 0; c; c = c->next) {
if (!ISVISIBLE(c) || (c->isfloating && !HIDDEN(c)))
continue;
tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg);
x += w + (i < r ? 1 : 0);
i++;
}
/* tiled mode */
} else {
den = clientsnmaster;
c = m->clients;
i = 0;
if (den) {
if (clientsnstack + clientsnfloating * BARTAB_FLOATWEIGHT + clientsnhidden) {
tgactive = masteractive;
num = tabw * m->mfact;
}
r = num % den;
w = num / den;
for (; c && i < m->nmaster; c = c->next) { // tiled master
if (!ISVISIBLE(c) || c->isfloating || HIDDEN(c))
continue;
tabfn(m, c, passx, x, w + (i < r ? 1 : 0), tgactive, arg, barg);
x += w + (i < r ? 1 : 0);
i++;
}
tgactive = !tgactive;
num = tabw - num;
}
den = clientsnstack * BARTAB_STACKWEIGHT + clientsnfloating * BARTAB_FLOATWEIGHT + clientsnhidden * BARTAB_HIDDENWEIGHT;
if (!den)
return 1;
r = num % den;
w = num / den;
#if BARTAB_STACKWEIGHT
for (; c; c = c->next) { // tiled stack
if (!ISVISIBLE(c) || HIDDEN(c) || c->isfloating)
continue;
tabfn(m, c, passx, x, w * BARTAB_STACKWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg);
x += w * BARTAB_STACKWEIGHT + (i - m->nmaster < r ? 1 : 0);
i++;
}
#endif // BARTAB_STACKWEIGHT
#if BARTAB_HIDDENWEIGHT
for (c = m->clients; c; c = c->next) { // hidden windows
if (!ISVISIBLE(c) || !HIDDEN(c))
continue;
tabfn(m, c, passx, x, w * BARTAB_HIDDENWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg);
x += w * BARTAB_HIDDENWEIGHT + (i - m->nmaster < r ? 1 : 0);
i++;
}
#endif // BARTAB_HIDDENWEIGHT
#if BARTAB_FLOATWEIGHT
for (c = m->clients; c; c = c->next) { // floating windows
if (!ISVISIBLE(c) || HIDDEN(c) || !c->isfloating)
continue;
tabfn(m, c, passx, x, w * BARTAB_FLOATWEIGHT + (i - m->nmaster < r ? 1 : 0), tgactive, arg, barg);
x += w * BARTAB_FLOATWEIGHT + (i - m->nmaster < r ? 1 : 0);
i++;
}
#endif // BARTAB_FLOATWEIGHT
}
return 1;
}

8
patch/bar_tabgroups.h Normal file
View File

@ -0,0 +1,8 @@
static int width_bartabgroups(Bar *bar, BarArg *a);
static int draw_bartabgroups(Bar *bar, BarArg *a);
static int click_bartabgroups(Bar *bar, Arg *arg, BarArg *a);
static void bartabdraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg, BarArg *barg);
static void bartabclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg, BarArg *barg);
static int bartabcalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg), Arg *arg, BarArg *barg);

150
patch/bar_taggrid.c Normal file
View File

@ -0,0 +1,150 @@
int
width_taggrid(Bar *bar, BarArg *a)
{
return (a->h / 2) * (NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0)) + lrpad;
}
int
draw_taggrid(Bar *bar, BarArg *a)
{
unsigned int x, y, h, max_x = 0, columns, occ = 0;
int invert, i,j, k;
Client *c;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags;
max_x = x = a->x + lrpad / 2;
h = a->h / tagrows - 1;
y = a->y;
columns = NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0);
/* Firstly we will fill the borders of squares */
XSetForeground(drw->dpy, drw->gc, scheme[SchemeTagsNorm][ColBg].pixel);
XFillRectangle(dpy, drw->drawable, drw->gc, x, y, h*columns + 1, a->h);
/* We will draw NUMTAGS squares in tagraws raws. */
for (j = 0, i = 0; j < tagrows; j++) {
x = a->x + lrpad / 2;
for (k = 0; k < columns; k++, i++) {
if (i < NUMTAGS) {
invert = bar->mon->tagset[bar->mon->seltags] & 1 << i ? 0 : 1;
/* Select active color for current square */
XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeTagsSel][ColBg].pixel :
scheme[SchemeTagsNorm][ColFg].pixel);
XFillRectangle(dpy, drw->drawable, drw->gc, x+1, y+1, h-1, h-1);
/* Mark square if tag has client */
if (occ & 1 << i) {
XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeTagsSel][ColFg].pixel :
scheme[SchemeTagsNorm][ColBg].pixel);
XFillRectangle(dpy, drw->drawable, drw->gc, x + 1, y + 1,
h / 2, h / 2);
}
} else {
XSetForeground(drw->dpy, drw->gc, scheme[SchemeTagsNorm][ColBg].pixel);
XFillRectangle(dpy, drw->drawable, drw->gc, x+1, y+1, h-1, h);
}
x += h;
if (x > max_x) {
max_x = x;
}
}
y += h;
}
return 1;
}
int
click_taggrid(Bar *bar, Arg *arg, BarArg *a)
{
unsigned int i, h, columns;
h = a->h / tagrows - 1;
columns = NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0);
i = (a->x - lrpad / 2) / h + columns * (a->y / h);
if (i >= NUMTAGS) {
i = NUMTAGS - 1;
}
arg->ui = 1 << i;
return ClkTagBar;
}
void
switchtag(const Arg *arg)
{
unsigned int columns;
unsigned int new_tagset = 0;
unsigned int pos, i;
int col, row;
Arg new_arg;
columns = NUMTAGS / tagrows + ((NUMTAGS % tagrows > 0) ? 1 : 0);
for (i = 0; i < NUMTAGS; ++i) {
if (!(selmon->tagset[selmon->seltags] & 1 << i)) {
continue;
}
pos = i;
row = pos / columns;
col = pos % columns;
if (arg->ui & SWITCHTAG_UP) { /* UP */
row --;
if (row < 0) {
row = tagrows - 1;
}
do {
pos = row * columns + col;
row --;
} while (pos >= NUMTAGS);
}
if (arg->ui & SWITCHTAG_DOWN) { /* DOWN */
row ++;
if (row >= tagrows) {
row = 0;
}
pos = row * columns + col;
if (pos >= NUMTAGS) {
row = 0;
}
pos = row * columns + col;
}
if (arg->ui & SWITCHTAG_LEFT) { /* LEFT */
col --;
if (col < 0) {
col = columns - 1;
}
do {
pos = row * columns + col;
col --;
} while (pos >= NUMTAGS);
}
if (arg->ui & SWITCHTAG_RIGHT) { /* RIGHT */
col ++;
if (col >= columns) {
col = 0;
}
pos = row * columns + col;
if (pos >= NUMTAGS) {
col = 0;
pos = row * columns + col;
}
}
new_tagset |= 1 << pos;
}
new_arg.ui = new_tagset;
if (arg->ui & SWITCHTAG_TOGGLETAG) {
toggletag(&new_arg);
}
if (arg->ui & SWITCHTAG_TAG) {
tag(&new_arg);
}
if (arg->ui & SWITCHTAG_VIEW) {
view (&new_arg);
}
if (arg->ui & SWITCHTAG_TOGGLEVIEW) {
toggleview (&new_arg);
}
}

5
patch/bar_taggrid.h Normal file
View File

@ -0,0 +1,5 @@
static int width_taggrid(Bar *bar, BarArg *a);
static int draw_taggrid(Bar *bar, BarArg *a);
static int click_taggrid(Bar *bar, Arg *arg, BarArg *a);
static void switchtag(const Arg *arg);

21
patch/bar_tagicons.c Normal file
View File

@ -0,0 +1,21 @@
char *
tagicon(Monitor *m, int tag)
{
#if BAR_ALTTAGSDECORATION_PATCH
Client *c;
#endif // BAR_ALTTAGSDECORATION_PATCH
int tagindex = tag + NUMTAGS * m->num;
if (tagindex >= LENGTH(tagicons[DEFAULT_TAGS]))
tagindex = tagindex % LENGTH(tagicons[DEFAULT_TAGS]);
#if BAR_ALTTAGSDECORATION_PATCH
for (c = m->clients; c && (!(c->tags & 1 << tag) || HIDDEN(c)); c = c->next);
if (c)
return tagicons[ALT_TAGS_DECORATION][tagindex];
#endif // BAR_ALTTAGSDECORATION_PATCH
#if BAR_ALTERNATIVE_TAGS_PATCH
if (m->alttag)
return tagicons[ALTERNATIVE_TAGS][tagindex];
#endif // BAR_ALTERNATIVE_TAGS_PATCH
return tagicons[DEFAULT_TAGS][tagindex];
}

8
patch/bar_tagicons.h Normal file
View File

@ -0,0 +1,8 @@
enum {
DEFAULT_TAGS,
ALTERNATIVE_TAGS,
ALT_TAGS_DECORATION,
};
static char * tagicon(Monitor *m, int tag);

141
patch/bar_taglabels.c Normal file
View File

@ -0,0 +1,141 @@
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;
}
#if BAR_TAGPREVIEW_PATCH
if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return ClkTagBar;
}
int
hover_taglabels(Bar *bar, BarArg *a, XMotionEvent *ev)
{
#if BAR_TAGPREVIEW_PATCH
int i = 0, x = lrpad / 2;
int px, py;
Monitor *m = bar->mon;
#if VANITYGAPS_PATCH
int ov = gappov;
int oh = gappoh;
#else
int ov = 0;
int oh = 0;
#endif // VANITYGAPS_PATCH
do {
if (!m->taglabel[i][0])
continue;
x += TEXTW(m->taglabel[i]);
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {
if ((i + 1) != selmon->previewshow && !(selmon->tagset[selmon->seltags] & 1 << i)) {
if (bar->by > m->my + m->mh / 2) // bottom bar
py = bar->by - m->mh / scalepreview - oh;
else // top bar
py = bar->by + bar->bh + oh;
px = bar->bx + ev->x - m->mw / scalepreview / 2;
if (px + m->mw / scalepreview > m->mx + m->mw)
px = m->wx + m->ww - m->mw / scalepreview - ov;
else if (px < bar->bx)
px = m->wx + ov;
selmon->previewshow = i + 1;
showtagpreview(i, px, py);
} else if (selmon->tagset[selmon->seltags] & 1 << i) {
hidetagpreview(selmon);
}
} else if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return 1;
}

6
patch/bar_taglabels.h Normal file
View File

@ -0,0 +1,6 @@
#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);
static int hover_taglabels(Bar *bar, BarArg *a, XMotionEvent *ev);

112
patch/bar_tagpreview.c Normal file
View File

@ -0,0 +1,112 @@
#include <Imlib2.h>
void
createpreview(Monitor *m)
{
if (m->tagwin) {
XMoveResizeWindow(
dpy, m->tagwin,
m->mx,
m->bar->by + bh,
m->mw / scalepreview,
m->mh / scalepreview
);
return;
}
XSetWindowAttributes wa = {
.override_redirect = True,
#if BAR_ALPHA_PATCH
.background_pixel = 0,
.border_pixel = 0,
.colormap = cmap,
#else
.background_pixmap = ParentRelative,
#endif // BAR_ALPHA_PATCH
.event_mask = ButtonPressMask|ExposureMask
};
m->tagwin = XCreateWindow(dpy, root, m->wx, m->bar->by + bh, m->mw / scalepreview, m->mh / scalepreview, 0,
#if BAR_ALPHA_PATCH
depth, CopyFromParent, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa
#else
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa
#endif // BAR_ALPHA_PATCH
);
XDefineCursor(dpy, m->tagwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->tagwin);
XUnmapWindow(dpy, m->tagwin);
}
void
hidetagpreview(Monitor *m)
{
m->previewshow = 0;
XUnmapWindow(dpy, m->tagwin);
}
void
showtagpreview(int tag, int x, int y)
{
Monitor *m = selmon;
if (!m->tagwin)
return;
if (m->tagmap[tag]) {
XSetWindowBackgroundPixmap(dpy, m->tagwin, m->tagmap[tag]);
XCopyArea(dpy, m->tagmap[tag], m->tagwin, drw->gc, 0, 0, m->mw / scalepreview, m->mh / scalepreview, 0, 0);
XMoveWindow(dpy, m->tagwin, x, y);
XSync(dpy, False);
XMapWindow(dpy, m->tagwin);
} else
XUnmapWindow(dpy, m->tagwin);
}
void
tagpreviewswitchtag(void)
{
int i;
unsigned int occ = 0;
Client *c;
Imlib_Image image;
Monitor *m = selmon;
if (!m->tagwin)
createpreview(m);
for (c = m->clients; c; c = c->next)
occ |= c->tags;
for (i = 0; i < NUMTAGS; i++) {
if (m->tagset[m->seltags] & 1 << i) {
if (m->tagmap[i] != 0) {
XFreePixmap(dpy, m->tagmap[i]);
m->tagmap[i] = 0;
}
if (occ & 1 << i) {
image = imlib_create_image(sw, sh);
imlib_context_set_image(image);
imlib_context_set_display(dpy);
#if BAR_ALPHA_PATCH
imlib_image_set_has_alpha(1);
imlib_context_set_blend(0);
imlib_context_set_visual(visual);
#else
imlib_context_set_visual(DefaultVisual(dpy, screen));
#endif // BAR_ALPHA_PATCH
imlib_context_set_drawable(root);
imlib_copy_drawable_to_image(0, m->mx, m->my, m->mw ,m->mh, 0, 0, 1);
#if BAR_ALPHA_PATCH
m->tagmap[i] = XCreatePixmap(dpy, m->tagwin, m->mw / scalepreview, m->mh / scalepreview, depth);
#else
m->tagmap[i] = XCreatePixmap(dpy, m->tagwin, m->mw / scalepreview, m->mh / scalepreview, DefaultDepth(dpy, screen));
#endif // BAR_ALPHA_PATCH
imlib_context_set_drawable(m->tagmap[i]);
imlib_render_image_part_on_drawable_at_size(0, 0, m->mw, m->mh, 0, 0, m->mw / scalepreview, m->mh / scalepreview);
imlib_free_image();
}
}
}
}

4
patch/bar_tagpreview.h Normal file
View File

@ -0,0 +1,4 @@
static void createpreview(Monitor *m);
static void hidetagpreview(Monitor *m);
static void showtagpreview(int tag, int x, int y);
static void tagpreviewswitchtag(void);

151
patch/bar_tags.c Normal file
View File

@ -0,0 +1,151 @@
int
width_tags(Bar *bar, BarArg *a)
{
int w, i;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
for (w = 0, i = 0; i < NUMTAGS; i++) {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
w += TEXTW(tagicon(bar->mon, i));
}
return w;
}
int
draw_tags(Bar *bar, BarArg *a)
{
int invert;
int w, x = a->x;
unsigned int i, occ = 0, urg = 0;
char *icon;
Client *c;
Monitor *m = bar->mon;
for (c = m->clients; c; c = c->next) {
#if BAR_HIDEVACANTTAGS_PATCH
occ |= c->tags == 255 ? 0 : c->tags;
#else
occ |= c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
if (c->isurgent)
urg |= c->tags;
}
for (i = 0; i < NUMTAGS; i++) {
#if BAR_HIDEVACANTTAGS_PATCH
/* do not draw vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
icon = tagicon(bar->mon, i);
invert = 0;
w = TEXTW(icon);
drw_setscheme(drw, scheme[
m->tagset[m->seltags] & 1 << i
? SchemeTagsSel
: urg & 1 << i
? SchemeUrg
: SchemeTagsNorm
]);
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;
}
return 1;
}
int
click_tags(Bar *bar, Arg *arg, BarArg *a)
{
int i = 0, x = 0;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(tagicon(bar->mon, i));
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {
arg->ui = 1 << i;
}
#if BAR_TAGPREVIEW_PATCH
if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return ClkTagBar;
}
int
hover_tags(Bar *bar, BarArg *a, XMotionEvent *ev)
{
#if BAR_TAGPREVIEW_PATCH
int i = 0, x = lrpad / 2;
int px, py;
Monitor *m = bar->mon;
#if VANITYGAPS_PATCH
int ov = gappov;
int oh = gappoh;
#else
int ov = 0;
int oh = 0;
#endif // VANITYGAPS_PATCH
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(tagicon(bar->mon, i));
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {
if ((i + 1) != selmon->previewshow && !(selmon->tagset[selmon->seltags] & 1 << i)) {
if (bar->by > m->my + m->mh / 2) // bottom bar
py = bar->by - m->mh / scalepreview - oh;
else // top bar
py = bar->by + bar->bh + oh;
px = bar->bx + ev->x - m->mw / scalepreview / 2;
if (px + m->mw / scalepreview > m->mx + m->mw)
px = m->wx + m->ww - m->mw / scalepreview - ov;
else if (px < bar->bx)
px = m->wx + ov;
selmon->previewshow = i + 1;
showtagpreview(i, px, py);
} else if (selmon->tagset[selmon->seltags] & 1 << i) {
hidetagpreview(selmon);
}
} else if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return 1;
}

4
patch/bar_tags.h Normal file
View File

@ -0,0 +1,4 @@
static int width_tags(Bar *bar, BarArg *a);
static int draw_tags(Bar *bar, BarArg *a);
static int click_tags(Bar *bar, Arg *arg, BarArg *a);
static int hover_tags(Bar *bar, BarArg *a, XMotionEvent *ev);

View File

@ -12,8 +12,7 @@ get_vt_colors(void)
char *tp = NULL;
FILE *fp;
size_t r;
int i, c, n;
int i, c, n, len;
for (i = 0; i < 16; i++)
strcpy(vtcs[i], "#000000");
@ -33,13 +32,12 @@ get_vt_colors(void)
}
fclose(fp);
}
for (i = 0; i < LENGTH(colors); i++) {
#if FLOAT_BORDER_COLOR_PATCH
for (c = 0; c < 4; c++)
#else
for (c = 0; c < 3; c++)
#endif // FLOAT_BORDER_COLOR_PATCH
{
len = LENGTH(colors);
if (len > LENGTH(color_ptrs))
len = LENGTH(color_ptrs);
for (i = 0; i < len; i++) {
for (c = 0; c < ColCount; c++) {
n = color_ptrs[i][c];
if (n > -1 && strlen(colors[i][c]) >= strlen(vtcs[n]))
memcpy(colors[i][c], vtcs[n], 7);
@ -67,4 +65,5 @@ int get_luminance(char *r)
}
return (0.299 * n[0] + 0.587 * n[1] + 0.114 * n[2]) / 2.55;
}
}

3
patch/bar_vtcolors.h Normal file
View File

@ -0,0 +1,3 @@
static void get_vt_colors(void);
static int get_luminance(char *rgb);

145
patch/bar_winicon.c Normal file
View File

@ -0,0 +1,145 @@
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);
}
Picture
geticonprop(Window win, unsigned int *picw, unsigned int *pich)
{
int format;
unsigned long n, extra, *p = NULL;
Atom real;
if (XGetWindowProperty(dpy, win, netatom[NetWMIcon], 0L, LONG_MAX, False, AnyPropertyType,
&real, &format, &n, &extra, (unsigned char **)&p) != Success)
return None;
if (n == 0 || format != 32) { XFree(p); return None; }
unsigned long *bstp = NULL;
uint32_t w, h, sz;
{
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++) >= 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++) >= 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 None; }
}
if ((w = *(bstp - 2)) == 0 || (h = *(bstp - 1)) == 0) { XFree(p); return None; }
uint32_t icw, ich;
if (w <= h) {
ich = ICONSIZE; icw = w * ICONSIZE / h;
if (icw == 0) icw = 1;
}
else {
icw = ICONSIZE; ich = h * ICONSIZE / w;
if (ich == 0) ich = 1;
}
*picw = icw; *pich = ich;
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, srcw, srch, dstw, dsth);
imlib_free_image_and_decache();
if (!scaled) return None;
imlib_context_set_image(scaled);
imlib_image_set_has_alpha(1);
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);
}
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) {
XRenderFreePicture(dpy, c->icon);
c->icon = None;
}
}
void
updateicon(Client *c)
{
freeicon(c);
c->icon = geticonprop(c->win, &c->icw, &c->ich);
}

9
patch/bar_winicon.h Normal file
View File

@ -0,0 +1,9 @@
#include <Imlib2.h>
#include <limits.h>
#include <stdint.h>
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);

88
patch/bar_wintitle.c Normal file
View File

@ -0,0 +1,88 @@
int
width_wintitle(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_wintitle(Bar *bar, BarArg *a)
{
#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
int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
#elif BAR_TITLE_RIGHT_PAD_PATCH
int x = a->x, w = a->w - lrpad / 2;
#else
int x = a->x, w = a->w;
#endif // BAR_TITLE_LEFT_PAD_PATCH | BAR_TITLE_RIGHT_PAD_PATCH
Monitor *m = bar->mon;
Client *c = m->sel;
if (!c) {
drw_setscheme(drw, scheme[SchemeTitleNorm]);
drw_rect(drw, x, a->y, w, a->h, 1, 1);
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 (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
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);
#endif // BAR_IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH
drawstateindicator(m, c, 1, x, a->y, w, a->h, 0, 0, c->isfixed);
return 1;
}
int
click_wintitle(Bar *bar, Arg *arg, BarArg *a)
{
return ClkWinTitle;
}

4
patch/bar_wintitle.h Normal file
View File

@ -0,0 +1,4 @@
static int width_wintitle(Bar *bar, BarArg *a);
static int draw_wintitle(Bar *bar, BarArg *a);
static int click_wintitle(Bar *bar, Arg *arg, BarArg *a);

View File

@ -0,0 +1,46 @@
int
width_wintitle_floating(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_wintitle_floating(Bar *bar, BarArg *a)
{
drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1);
return calc_wintitle_floating(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a);
}
int
click_wintitle_floating(Bar *bar, Arg *arg, BarArg *a)
{
calc_wintitle_floating(bar->mon, 0, a->w, a->x, flextitleclick, arg, a);
return ClkWinTitle;
}
int
calc_wintitle_floating(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
) {
Client *c;
int clientsnfloating = 0, w, r;
int groupactive = GRP_FLOAT;
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c) || HIDDEN(c))
continue;
if (c->isfloating)
clientsnfloating++;
}
if (!clientsnfloating)
return 0;
w = tabw / clientsnfloating;
r = tabw % clientsnfloating;
c = flextitledrawarea(m, m->clients, offx, r, w, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg, barg);
return 1;
}

View File

@ -0,0 +1,9 @@
static int width_wintitle_floating(Bar *bar, BarArg *a);
static int draw_wintitle_floating(Bar *bar, BarArg *a);
static int click_wintitle_floating(Bar *bar, Arg *arg, BarArg *a);
static int calc_wintitle_floating(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
);

View File

@ -0,0 +1,46 @@
int
width_wintitle_hidden(Bar *bar, BarArg *a)
{
return a->w;
}
int
draw_wintitle_hidden(Bar *bar, BarArg *a)
{
drw_rect(drw, a->x, a->y, a->w, a->h, 1, 1);
return calc_wintitle_hidden(bar->mon, a->x, a->w, -1, flextitledraw, NULL, a);
}
int
click_wintitle_hidden(Bar *bar, Arg *arg, BarArg *a)
{
calc_wintitle_hidden(bar->mon, 0, a->w, a->x, flextitleclick, arg, a);
return ClkWinTitle;
}
int
calc_wintitle_hidden(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
) {
Client *c;
int clientsnhidden = 0, w, r;
int groupactive = GRP_HIDDEN;
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c))
clientsnhidden++;
}
if (!clientsnhidden)
return 0;
w = tabw / clientsnhidden;
r = tabw % clientsnhidden;
c = flextitledrawarea(m, m->clients, offx, r, w, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg, barg);
return 1;
}

View File

@ -0,0 +1,9 @@
static int width_wintitle_hidden(Bar *bar, BarArg *a);
static int draw_wintitle_hidden(Bar *bar, BarArg *a);
static int click_wintitle_hidden(Bar *bar, Arg *arg, BarArg *a);
static int calc_wintitle_hidden(
Monitor *m, int offx, int tabw, int passx,
void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg, BarArg *barg),
Arg *arg, BarArg *barg
);

View File

@ -1,6 +1,7 @@
void
hide(Client *c) {
Client *n;
if (!c || HIDDEN(c))
return;
@ -20,7 +21,16 @@ hide(Client *c) {
XSelectInput(dpy, w, ca.your_event_mask);
XUngrabServer(dpy);
focus(c->snext);
if (c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
for (n = c->snext; n && (!ISVISIBLE(n) || HIDDEN(n)); n = n->snext);
if (!n)
for (n = c->mon->stack; n && (!ISVISIBLE(n) || HIDDEN(n)); n = n->snext);
} else {
n = nexttiled(c);
if (!n)
n = prevtiled(c);
}
focus(n);
arrange(c->mon);
}
@ -39,16 +49,28 @@ void
togglewin(const Arg *arg)
{
Client *c = (Client*)arg->v;
if (c == selmon->sel)
if (!c)
return;
if (!HIDDEN(c) && c == selmon->sel)
hide(c);
else {
if (HIDDEN(c))
show(c);
focus(c);
restack(selmon);
restack(c->mon);
}
}
Client *
prevtiled(Client *c)
{
Client *p, *i;
for (p = NULL, i = c->mon->clients; c && i != c; i = i->next)
if (ISVISIBLE(i) && !HIDDEN(i))
p = i;
return p;
}
void
showhideclient(const Arg *arg)
{
@ -58,10 +80,15 @@ showhideclient(const Arg *arg)
if (!c)
return;
#if WARP_PATCH
force_warp = 1;
#endif // WARP_PATCH
if (HIDDEN(c)) {
show(c);
restack(selmon);
focus(c);
restack(c->mon);
} else {
hide(c);
}
}
}

View File

@ -1,4 +1,6 @@
static void hide(Client *c);
static void show(Client *c);
static void togglewin(const Arg *arg);
static void showhideclient(const Arg *arg);
static Client * prevtiled(Client *c);
static void showhideclient(const Arg *arg);

View File

@ -1 +0,0 @@
static void bstack(Monitor *m);

View File

@ -1 +0,0 @@
static void bstackhoriz(Monitor *m);

View File

@ -1 +0,0 @@
static void centeredfloatingmaster(Monitor *m);

View File

@ -1 +0,0 @@
static void centeredmaster(Monitor *m);

View File

@ -20,4 +20,5 @@ setcfact(const Arg *arg)
f = 4.0;
c->cfact = f;
arrange(selmon);
}
}

View File

@ -1 +1,2 @@
static void setcfact(const Arg *arg);
static void setcfact(const Arg *arg);

View File

@ -2,4 +2,5 @@ char*
help(void)
{
return "usage: dwm [-hv] [-fn font] [-nb color] [-nf color] [-sb color] [-sf color]\n[-df font] [-dnf color] [-dnb color] [-dsf color] [-dsb color]\n";
}
}

View File

@ -1 +1,2 @@
static char* help();
static char* help();

View File

@ -1 +0,0 @@
static void col(Monitor *);

Some files were not shown because too many files have changed in this diff Show More