5 Commits

328 changed files with 5031 additions and 24087 deletions

3
.github/FUNDING.yml vendored
View File

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

1
.gitignore vendored
View File

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

View File

@ -17,7 +17,6 @@ MIT/X Consortium License
© 2015-2016 Quentin Rameau <quinq@fifth.space> © 2015-2016 Quentin Rameau <quinq@fifth.space>
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com> © 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de> © 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
© 2020-2022 Chris Down <chris@chrisdown.name>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),

View File

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

48
README Normal file
View File

@ -0,0 +1,48 @@
dwm - dynamic window manager
============================
dwm is an extremely fast, small, and dynamic window manager for X.
Requirements
------------
In order to build dwm you need the Xlib header files.
Installation
------------
Edit config.mk to match your local setup (dwm is installed into
the /usr/local namespace by default).
Afterwards enter the following command to build and install dwm (if
necessary as root):
make clean install
Running dwm
-----------
Add the following line to your .xinitrc to start dwm using startx:
exec dwm
In order to connect dwm to a specific display, make sure that
the DISPLAY environment variable is set correctly, e.g.:
DISPLAY=foo.bar:1 exec dwm
(This will start dwm on display :1 of the host foo.bar.)
In order to display status info in the bar, you can do something
like this in your .xinitrc:
while xsetroot -name "`date` `uptime | sed 's/.*,//'`"
do
sleep 1
done &
exec dwm
Configuration
-------------
The configuration of dwm is done by creating a custom config.h
and (re)compiling the source code.

588
README.md
View File

@ -1,8 +1,8 @@
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). This dwm 6.2 (bb2e72, 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.
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): 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 ```c
#define BAR_ALPHA_PATCH 1 #define 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. 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,116 +11,10 @@ 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. 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: ### 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-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 2020-06-24 - Added resizepoint, statusbutton and sendmon_keepfocus patches
@ -197,7 +91,7 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
2019-10-11 - Added the patch to ignore Xft errors when drawing text in the status bar 2019-10-11 - Added the patch to ignore Xft errors when drawing text in the status bar
2019-10-10 - Added mpdcontrol, scratchpad and spawn_cwd cpatches 2019-10-10 - Added mdpcontrol, scratchpad and spawn_cwd cpatches
2019-10-08 - Added columns layout and fakefullscreen patch 2019-10-08 - Added columns layout and fakefullscreen patch
@ -242,35 +136,16 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
### Patches included: ### Patches included:
- [activetagindicatorbar](https://dwm.suckless.org/patches/activetagindicatorbar/) - [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 - this patch changes the rectangle indicating if a tag is used by a client into a bar above the tag name
the tag name
- [alpha](https://dwm.suckless.org/patches/alpha/) - [alpha](https://dwm.suckless.org/patches/alpha/)
- adds transparency for the status bar - adds transparency for the status bar
- [alt-tab](https://dwm.suckless.org/patches/alt-tab/)
- adds a window task switcher toggled using alt-tab
- [alternativetags](https://dwm.suckless.org/patches/alternativetags/) - [alternativetags](https://dwm.suckless.org/patches/alternativetags/)
- adds alternative tags which can be toggled on the fly for the sole purpose of providing - adds alternative tags which can be toggled on the fly for the sole purpose of providing visual aid
visual aid
- [alttagsdecoration](https://dwm.suckless.org/patches/alttagsdecoration/) - [alwaysfullscreen](https://dwm.suckless.org/patches/alwaysfullscreen/)
- provides the ability to use alternative text for tags which contain at least one window - prevents the focus to drift from the active fullscreen client when using focusstack\(\)
- [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/) - [attachabove](https://dwm.suckless.org/patches/attachabove/)
- new windows are placed above selected client - new windows are placed above selected client
@ -285,99 +160,49 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- new windows are placed at the bottom of the stack - new windows are placed at the bottom of the stack
- [autoresize](https://dwm.suckless.org/patches/autoresize/) - [autoresize](https://dwm.suckless.org/patches/autoresize/)
- by default, windows that are not visible when requesting a resize/move will not get - by default, windows that are not visible when requesting a resize/move will not get resized/moved, with this patch, however, they will
resized/moved, with this patch, however, they will
- [autostart](https://dwm.suckless.org/patches/autostart/) - [autostart](https://dwm.suckless.org/patches/autostart/)
- makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup - makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup
- [awesomebar](https://dwm.suckless.org/patches/awesomebar/) - [awesomebar](https://dwm.suckless.org/patches/awesomebar/)
- enhanced taskbar that allows focus / hiding / unhiding of windows by clicking on the status - enhanced taskbar that allows focus / hiding / unhiding of windows by clicking on the status bar
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/) - [bar_height](https://dwm.suckless.org/patches/bar_height/)
- allows the bar height to be explicitly set rather than being derived from font - 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/) - [barpadding](https://dwm.suckless.org/patches/barpadding/)
- adds vertical and horizontal space between the statusbar and the edge of the screen - 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/) - [center](https://dwm.suckless.org/patches/center/)
- adds an iscentered rule to automatically center clients on the current monitor - adds an iscentered rule to automatically center clients on the current monitor
- [cfacts](https://dwm.suckless.org/patches/cfacts/) - [cfacts](https://dwm.suckless.org/patches/cfacts/)
- the cfacts patch provides the ability to assign different weights to clients in their - the cfacts patch provides the ability to assign different weights to clients in their respective stack in tiled layout
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/) - [cmdcustomize](https://dwm.suckless.org/patches/cmdcustomize/)
- allows color attributes to be set through the command line - allows color attributes to be set through the command line
- [colorbar](https://dwm.suckless.org/patches/colorbar/) - color_emoji
- lets you change the foreground and background color of every statusbar element - 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
- ~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/) - [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 - 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
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/) - [cyclelayouts](https://dwm.suckless.org/patches/cyclelayouts/)
- lets you cycle through all your layouts - 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) - [dmenumatchtop](https://dwm.suckless.org/patches/dmenumatchtop)
- updates the position of dmenu to match that of the bar - 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 - i.e. if topbar is 0 then dmenu will appear at the bottom and if 1 then dmenu will appear at the top
the top
- do-not-die-on-color-allocation-failure - [dragcfact](https://github.com/bakkeby/patches/blob/master/dwm/dwm-cfacts-dragcfact-6.2.diff)
- avoids dwm terminating (dying) on color allocation failures - lets you resize clients' size (i.e. modify cfact) by holding modkey + shift + right-click and dragging the mouse
- useful for the xrdb (xresources) and status2d patches
- [dragcfact](https://github.com/bakkeby/patches/wiki/dragcfact/) - [dragmfact](https://github.com/bakkeby/patches/blob/master/dwm/dwm-dragmfact-6.2.diff)
- lets you resize clients' size (i.e. modify cfact) by holding modkey + shift + right-click - lets you resize the split in layouts (i.e. modify mfact) by holding the modkey + shift + left-click and dragging the mouse
and dragging the mouse - this is a bespoke patch that supports vertical and horizontal layout splits as well as centered master variants
- [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) - [dwmblocks](https://gist.github.com/danbyl/54f7c1d57fc6507242a95b71c3d8fdea)
- signal integration to use dwm with a patched [dwmblocks](https://github.com/torrinfail/dwmblocks) - signal integration to use dwm with a patched [dwmblocks](https://github.com/torrinfail/dwmblocks)
@ -388,90 +213,53 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [emptyview](https://dwm.suckless.org/patches/emptyview/) - [emptyview](https://dwm.suckless.org/patches/emptyview/)
- allows no tag at all to be selected - 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 - 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
tag is selected then it will be opened on the first tag
- [ewmhtags](https://dwm.suckless.org/patches/ewmhtags/) - [ewmhtags](https://dwm.suckless.org/patches/ewmhtags/)
- adds EWMH support for \_NET_NUMBER_OF_DESKTOPS, \_NET_CURRENT_DESKTOP, \_NET_DESKTOP_NAMES - 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
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/) - [exresize](https://dwm.suckless.org/patches/exresize/)
- this patch allows the user to change size and placement of floating windows using only the - this patch allows the user to change size and placement of floating windows using only the keyboard
keyboard - it also allows for temporary vertical and horizontal extension of windows similar to other WMs fill command
- it also allows for temporary vertical and horizontal extension of windows similar to other
WMs fill command
- [~extrabar~](https://dwm.suckless.org/patches/extrabar/) - [extrabar](https://dwm.suckless.org/patches/extrabar/)
- ~enables an extra status bar in dwm in a similar manner to the dualstatus patch~ - 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 - if the primary status is at the top via topbar then the extra status bar will be placed at the bottom and vice versa
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/) - [fakefullscreen](https://dwm.suckless.org/patches/fakefullscreen/)
- only allow clients to "fullscreen" into the space currently given to them - 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 - 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
of the screen, while having the other half available for other tasks
- [fakefullscreenclient](https://github.com/bakkeby/patches/wiki/fakefullscreenclient/) - [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 - similarly to the fakefullscreen patch this patch only allows clients to "fullscreen" into the space currently given to them
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 - the "twist" with this patch is that fake fullscreen can be toggled on a per client basis rather than applying to all clients globally
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/) - [fancybar](https://dwm.suckless.org/patches/fancybar/)
- shows the titles of all visible windows in the status bar - shows the titles of all visible windows in the status bar
- flexwintitle - [floatbordercolor](https://dwm.suckless.org/patches/float_border_color/)
- based on the bartabgroups patch, this is a layout aware barmodules module for handling - this patch allows a different border color to be chosen for floating windows
window titles intended to be used with flextile-deluxe
- [~floatbordercolor~](https://dwm.suckless.org/patches/float_border_color/) - [floatpos](https://github.com/bakkeby/patches/wiki/floatpos)
- ~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 - 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, - control the size and position of floating windows similar to exresize, moveresize, moveplace patches
moveplace patches
- specify size and position using absolute, relative or fixed co-ordinates or - specify size and position using absolute, relative or fixed co-ordinates or
- position floating windows in a grid-like manner - position floating windows in a grid-like manner
- [focusadjacenttag](https://dwm.suckless.org/patches/focusadjacenttag/) - [focusadjacenttag](https://dwm.suckless.org/patches/focusadjacenttag/)
- provides the ability to focus the tag on the immediate left or right of the currently - provides the ability to focus the tag on the immediate left or right of the currently focused tag
focused tag
- it also allows to send the focused window either on the left or the right 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/) - [focusonclick](https://dwm.suckless.org/patches/focusonclick/)
- this patch makes you switch focus only by mouse click and not sloppy (focus follows mouse - this patch makes you switch focus only by mouse click and not sloppy (focus follows mouse pointer)
pointer)
- [focusonnetactive](https://dwm.suckless.org/patches/focusonnetactive/) - [focusonnetactive](https://dwm.suckless.org/patches/focusonnetactive/)
- by default, dwm responds to \_NET_ACTIVE_WINDOW client messages by setting the urgency bit - by default, dwm responds to \_NET_ACTIVE_WINDOW client messages by setting the urgency bit on the named window
on the named window
- this patch activates the window instead - this patch activates the window instead
- [focusurgent](https://dwm.suckless.org/patches/focusurgent/) - [focusurgent](https://dwm.suckless.org/patches/focusurgent/)
- adds a keyboard shortcut to select the next window having the urgent flag regardless of the - adds a keyboard shortcut to select the next window having the urgent flag regardless of the tag it is on
tag it is on
- [fsignal](https://dwm.suckless.org/patches/fsignal/) - [fsignal](https://dwm.suckless.org/patches/fsignal/)
- send "fake signals" to dwm for handling, using xsetroot - send "fake signals" to dwm for handling, using xsetroot
@ -479,8 +267,7 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [fullscreen](https://dwm.suckless.org/patches/fullscreen/) - [fullscreen](https://dwm.suckless.org/patches/fullscreen/)
- applies the monocle layout with the focused client on top and hides the bar - 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 - when pressed again it shows the bar and restores the layout that was active before going fullscreen
fullscreen
- [hidevacanttags](https://dwm.suckless.org/patches/hide_vacant_tags/) - [hidevacanttags](https://dwm.suckless.org/patches/hide_vacant_tags/)
- prevents dwm from drawing tags with no clients (i.e. vacant) on the bar - prevents dwm from drawing tags with no clients (i.e. vacant) on the bar
@ -491,73 +278,37 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [ignore-xft-errors-when-drawing-text](https://groups.google.com/forum/m/#!topic/wmii/7bncCahYIww) - [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) - 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 - 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
and may be removed if a more appropriate solution comes up
- [inplacerotate](https://dwm.suckless.org/patches/inplacerotate/) - [inplacerotate](https://dwm.suckless.org/patches/inplacerotate/)
- allows rotation of all clients in the master or stack area without affecting the other area - 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/) - [ispermanent](https://dwm.suckless.org/patches/ispermanent/)
- adds rule option for clients to avoid accidental termination by killclient for sticky - adds rule option for clients to avoid accidental termination by killclient for sticky windows
windows
- [keymodes](https://dwm.suckless.org/patches/keymodes/) - [keymodes](https://dwm.suckless.org/patches/keymodes/)
- this patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts can be - this patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts can be performed
performed
- [killunsel](https://dwm.suckless.org/patches/killunsel/) - [leftlayout](http://dwm.suckless.org/patches/leftlayout/)
- kills all visible clients that are not selected (only the selected client will remain) - moves the layout symbol in the status bar to the left hand side
- [launcher](https://dwm.suckless.org/patches/launcher/) - [losefullscreen](https://github.com/bakkeby/patches/tree/master/dwm/dwm-losefullscreen-6.2.diff)
- adds buttons to the bar that can be used to launch applications - 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
- [~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 - this patch ensures that in such scenarios the previous window loses fullscreen
- [maximize](https://dwm.suckless.org/patches/maximize/) - [maximize](https://dwm.suckless.org/patches/maximize/)
- adds helper functions for maximizing, horizontally and vertically, floating windows using - adds helper functions for maximizing, horizontally and vertically, floating windows using keybindings
keybindings
- [mpdcontrol](https://dwm.suckless.org/patches/mpdcontrol/) - [mdpcontrol](https://dwm.suckless.org/patches/mpdcontrol/)
- adds keyboard bindings to control MDP (Music Player Daemon) - adds keyboard bindings to control MDP (Music Player Daemon)
- [monitorrules](https://github.com/bakkeby/patches/wiki/monitorrules/) - [monitorrules](https://github.com/bakkeby/patches/blob/master/dwm/dwm-monitorrules-6.2.diff)
- adds rules per monitor, e.g. have default layouts per monitor - 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 - 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)
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/) - [monoclesymbol](https://dwm.suckless.org/patches/monoclesymbol/)
- always display the the monocle-symbol as defined in config.h if the monocle-layout is - always display the the monocle-symbol as defined in config.h if the monocle-layout is activated
activated
- do not display the number of open clients in the current tag - do not display the number of open clients in the current tag
- [moveresize](https://dwm.suckless.org/patches/moveresize/) - [moveresize](https://dwm.suckless.org/patches/moveresize/)
@ -566,41 +317,20 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [movestack](https://dwm.suckless.org/patches/movestack/) - [movestack](https://dwm.suckless.org/patches/movestack/)
- allows you to move clients around in the stack and swap them with the master - 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/) - [noborder](https://dwm.suckless.org/patches/noborder/)
- removes the border when there is only one window visible - removes the border when there is only one window visible
- [nodmenu](https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html) - [nodmenu](https://dwm.suckless.org/patches/nodmenu/)
- enable modifying dmenu in config.def.h which resulted previously in a compilation error - enable modifying dmenu in config.def.h which resulted previously in a compilation error because two lines of code hardcode dmenu into dwm
because two lines of code hardcode dmenu into dwm
- allows complete removal of dmenu, should you want to do that - 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
- nomodbuttons - [no_transparent_borders](https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8)
- 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 - when terminals have transparency then their borders also become transparent
- this patch ensures that borders have no transparency - this patch ensures that borders have no transparency
- note that this patch is only relevant if you are not using the alpha patch - 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/) - [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 - makes it so dwm will only exit via quit() if no windows are open (in order to prevent accidental loss of work)
accidental loss of work)
- [pango](https://dwm.suckless.org/patches/pango/) - [pango](https://dwm.suckless.org/patches/pango/)
- adds simple markup for status messages using pango markup - adds simple markup for status messages using pango markup
@ -608,47 +338,24 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [pertag](https://dwm.suckless.org/patches/pertag/) - [pertag](https://dwm.suckless.org/patches/pertag/)
- adds nmaster, mfact, layouts and more per tag rather than per monitor - 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/) - [push](https://dwm.suckless.org/patches/push/)
- this patch provides a way to move clients up and down inside the client list - 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/) - [resizecorners](https://dwm.suckless.org/patches/resizecorners/)
- by default, windows only resize from the bottom right corner - 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 - with this patch the mouse is warped to the nearest corner and you resize from there
- [resizepoint](https://github.com/bakkeby/patches/wiki/resizepoint/) - [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 - practically the same as resizecorners, but the cursor does not warp to any of the window corners
corners
- [restartsig](https://dwm.suckless.org/patches/restartsig/) - [restartsig](https://dwm.suckless.org/patches/restartsig/)
- adds a keyboard shortcut to restart dwm or alternatively by using kill -HUP dwmpid - adds a keyboard shortcut to restart dwm or alternatively by using kill -HUP dwmpid
- additionally dwm can quit cleanly by using kill -TERM 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/) - [rotatestack](https://dwm.suckless.org/patches/rotatestack/)
- let's you rotate through the stack using keyboard shortcuts - let's you rotate through the stack using keyboard shortcuts
- [roundedcorners](https://github.com/mitchweaver/suckless/blob/master/dwm/inactive/mitch-06-rounded_corners-f04cac6d6e39cd9e3fc4fae526e3d1e8df5e34b2.patch) - [roundedcorners](https://github.com/mitchweaver/suckless/blob/master/dwm/patches_mitch/mitch-06-rounded_corners-db6093f6ec1bb884f7540f2512935b5254750b30.patch)
- adds rounded corners to client windows - adds rounded corners to client windows
- [savefloats](https://dwm.suckless.org/patches/save_floats/) - [savefloats](https://dwm.suckless.org/patches/save_floats/)
@ -658,52 +365,39 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [scratchpad](https://dwm.suckless.org/patches/scratchpad/) - [scratchpad](https://dwm.suckless.org/patches/scratchpad/)
- the scratchpad patch allows you to spawn or restore a floating terminal window - the scratchpad patch allows you to spawn or restore a floating terminal window
- [scratchpad\_alt\_1](https://github.com/GasparVardanyan/dwm-scratchpad) - [scratchpad_alt_1](https://github.com/GasparVardanyan/dwm-scratchpad)
- this alternative patch enables a scratchpad feature in dwm similar to the scratchpad - this alternative patch enables a scratchpad feature in dwm similar to the scratchpad feature in i3wm
feature in i3wm
- seamless\_restart
- allows for selected layout, assigned tags, etc. to be persisted across restarts
- [selfrestart](https://dwm.suckless.org/patches/selfrestart/) - [selfrestart](https://dwm.suckless.org/patches/selfrestart/)
- restart dwm without the unnecessary dependency of an external script - restart dwm without the unnecessary dependency of an external script
- [sendmoncenter](https://dwm.suckless.org/patches/sendmoncenter/) - [sendmon_keepfocus](https://github.com/bakkeby/patches/blob/master/dwm/dwm-sendmon_keepfocus-6.2.diff)
- 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 - minor patch that allow clients to keep focus when being sent to another monitor
- [setborderpx](https://dwm.suckless.org/patches/setborderpx/) - [setborderpx](https://dwm.suckless.org/patches/statuspadding/)
- this patch allows border pixels to be changed during runtime - 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) - [shiftview](https://github.com/chau-bao-long/dotfiles/blob/master/suckless/dwm/shiftview.diff)
- adds keybindings for left and right circular shift through tags - adds keybindings for left and right circular shift through tags
- also see focusadjacenttag - also see focusadjacenttag
- [shiftviewclients](https://github.com/bakkeby/patches/wiki/shiftviewclients/) - [shiftviewclients](https://github.com/bakkeby/patches/blob/master/dwm/dwm-shiftviewclients-6.2.diff)
- variant of the shiftview patch which skips tags that have no clients - variant of the shiftview patch which skips tags that has no clients
- [sizehints](https://dwm.suckless.org/patches/sizehints/) - [sizehints](https://dwm.suckless.org/patches/sizehints/)
- makes dwm obey even "soft" sizehints for new clients - makes dwm obey even "soft" sizehints for new clients
- [sortscreens](https://www.mail-archive.com/hackers@suckless.org/msg09400.html) - [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 - 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)
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 - spawns programs from currently focused client's working directory
- [stacker](https://dwm.suckless.org/patches/stacker/) - [stacker](https://dwm.suckless.org/patches/stacker/)
- provides comprehensive utilities for managing the client stack - provides comprehensive utilities for managing the client stack
- [staticstatus](https://dwm.suckless.org/patches/staticstatus/) - [staticstatus](https://dwm.suckless.org/patches/staticstatus/)
- allows the status text to be fixed to the bar on a specific monitor rather than being - allows the status text to be fixed to the bar on a specific monitor rather than being drawn on the focused monitor
drawn on the focused monitor
- [status2d](https://dwm.suckless.org/patches/status2d/) - [status2d](https://dwm.suckless.org/patches/status2d/)
- allows colors and rectangle drawing in the dwm status bar - allows colors and rectangle drawing in the dwm status bar
@ -715,63 +409,41 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- adds a clickable button to the left hand side of the statusbar - adds a clickable button to the left hand side of the statusbar
- [statuscmd](https://dwm.suckless.org/patches/statuscmd/) - [statuscmd](https://dwm.suckless.org/patches/statuscmd/)
- adds the ability to execute shell commands based on the mouse button and position when - adds the ability to execute shell commands based on the mouse button and position when clicking the status bar
clicking the status bar
- [statuscolors](https://dwm.suckless.org/patches/statuscolors/) - [statuscolors](https://dwm.suckless.org/patches/statuscolors/)
- enables colored text in the status bar allowing multiple color combinations for use in the - enables colored text in the status bar allowing multiple color combinations for use in the status script
status script
- [statuspadding](https://dwm.suckless.org/patches/statuspadding/) - [statuspadding](https://dwm.suckless.org/patches/statuspadding/)
- adds configuration options for horizontal and vertical padding in the status bar - 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/) - [sticky](https://dwm.suckless.org/patches/sticky/)
- adds toggleable keyboard shortcut to make a client 'sticky', i.e. visible on all tags - adds toggleable keyboard shortcut to make a client 'sticky', i.e. visible on all tags
- [swallow](https://dwm.suckless.org/patches/swallow/) - [swallow](https://dwm.suckless.org/patches/swallow/)
- this patch adds "window swallowing" to dwm as known from Plan 9's windowing system rio - 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, - clients marked with isterminal in config.h swallow a window opened by any child process, e.g. running xclock in a terminal
e.g. running xclock in a terminal
- closing the xclock window restores the terminal window in the current position - closing the xclock window restores the terminal window in the current position
- [swapfocus](https://dwm.suckless.org/patches/swapfocus/) - [swapfocus](https://dwm.suckless.org/patches/swapfocus/)
- this patch depends on the pertag patch and makes it possible to switch focus with a single - 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
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/) - [swaptags](https://dwm.suckless.org/patches/swaptags/)
- allows swapping the contents of the currently selected tag with another tag by using - allows swapping the contents of the currently selected tag with another tag by using keyboard shortcuts
keyboard shortcuts
- [switchcol](https://dwm.suckless.org/patches/switchcol/) - [switchcol](https://dwm.suckless.org/patches/switchcol/)
- allows you to switch focus between the master and stack columns using a single keybinding - allows you to switch focus between the master and stack columns using a single keybinding
- [switchtag](https://github.com/bakkeby/patches/wiki/switchtag/) - [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 - when an application opens on a specific tab this patch adds the option to also switch to that tag when the application starts
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/) - [systray](https://dwm.suckless.org/patches/systray/)
- adds system tray in the status bar - 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/) - [tagall](https://dwm.suckless.org/patches/tagall/)
- adds keyboard shortcuts to move all (or only floating) windows from one tag to another - adds keyboard shortcuts to move all (or only floating) windows from one tag to another
- [tagallmon](https://github.com/bakkeby/patches/wiki/tagallmon/) - [tagallmon](https://github.com/bakkeby/patches/tree/master/dwm/dwm-tagallmon-6.2.diff)
- move all visible windows to an adjacent monitor - move all visible windows to an adjacent monitor
- [tagintostack](https://dwm.suckless.org/patches/tagintostack/) - [tagintostack](https://dwm.suckless.org/patches/tagintostack/)
@ -781,113 +453,60 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [taggrid](https://dwm.suckless.org/patches/taggrid/) - [taggrid](https://dwm.suckless.org/patches/taggrid/)
- adds an option to place tags in rows like in many other window managers - adds an option to place tags in rows like in many other window managers
- [taglabels](https://dwm.suckless.org/patches/taglabels/) - [tagmonfixfs](https://github.com/bakkeby/patches/tree/master/dwm/dwm-tagmonfixfs-6.2.diff)
- 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 - allows moving a fullscreen window to another monitor while remaining in fullscreen
- [tagothermonitor](https://dwm.suckless.org/patches/tagothermonitor/) - [tagothermonitor](https://dwm.suckless.org/patches/tagothermonitor/)
- adds functions and keybindings to tag a window to a desired tag on an adjacent monitor - adds functions and keybindings to tag a window to a desired tag on an adjacent monitor
- [tagpreview](https://dwm.suckless.org/patches/tag-previews/) - [tagswapmon](https://github.com/bakkeby/patches/tree/master/dwm/dwm-tagswapmon-6.2.diff)
- 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 - swap all visible windows on one monitor with those of an adjacent monitor
- [tapresize](https://dwm.suckless.org/patches/tapresize/) - [titlecolor](https://dwm.suckless.org/patches/titlecolor/)
- allows resizing of windows using a touchpad - adds a new color scheme used by the (selected) window title in the bar
- uses vertical and horizontal scroll events allowing you to use one-finger tap for moving
windows and two-finger tap for resizing
- [~titlecolor~](https://dwm.suckless.org/patches/titlecolor/) - [togglefullscreen](https://github.com/bakkeby/patches/tree/master/dwm/dwm-togglefullscreen-6.2.diff)
- ~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 - 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/) - [transfer](https://dwm.suckless.org/patches/transfer/)
- lets you transfer the currently focused client between the master and stack area while - lets you transfer the currently focused client between the master and stack area while increasing or decreasing the master area (nmaster) accordingly
increasing or decreasing the master area (nmaster) accordingly
- [transferall](https://dwm.suckless.org/patches/transfer/) - [transferall](https://dwm.suckless.org/patches/transfer/)
- lets you transfer all clients between the master and stack area while increasing or - lets you transfer all clients between the master and stack area while increasing or decreasing the master area (nmaster) accordingly
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/) - [unfloatvisible](https://dwm.suckless.org/patches/unfloatvisible/)
- resets isfloating on any visible windows that have it set and optionally also applies a - resets isfloating on any visible windows that have it set and optionally also applies a layout
layout
- [unmanaged](https://github.com/bakkeby/patches/wiki/unmanaged) - [killunsel](https://dwm.suckless.org/patches/killunsel/)
- adds a client rule that allows for windows to not be managed by the window manager - kills all visible clients that are not selected (only the selected client will remain)
- this can be useful for external bars, widgets, launchers, docks, desktop icons and more
- [~urgentborder~](https://dwm.suckless.org/patches/urgentborder/) - [urgentborder](https://dwm.suckless.org/patches/urgentborder/)
- ~this patch makes "urgent" windows have different colors~ - this patch makes "urgent" windows have different colors
- [vanitygaps](https://github.com/bakkeby/patches/blob/master/dwm/dwm-vanitygaps-6.2.diff) - [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 - adds configurable gaps between windows differentiating between outer, inner, horizontal and vertical gaps
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/) - [viewontag](https://dwm.suckless.org/patches/viewontag/)
- follow a window to the tag it is being moved to - follow a window to the tag it is being moved to
- [vtcolor](https://dwm.suckless.org/patches/vtcolors/) - [vtcolor](https://dwm.suckless.org/patches/vtcolors/)
- this patch adds the ability for dwm to read colors from the linux virtual console - 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
essentially allowing you to use the same color scheme as your regular tty
- [warp](https://dwm.suckless.org/patches/warp/) - [warp](https://dwm.suckless.org/patches/warp/)
- warps the mouse cursor to the center of the currently focused window or screen when the - 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
mouse cursor is (a) on a different screen or (b) on top of a different window
- [winicon](https://dwm.suckless.org/patches/winicon/) - [windowrolerule](https://github.com/bakkeby/patches/tree/master/dwm/dwm-windowrolerule-6.2.diff)
- adds the window icon next to the window title in the bar - 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".
- [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/) - [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 - allows switching the view to that of a given client from the all-window view (Mod-0) using a keyboard shortcut
a keyboard shortcut
- [xkb](https://dwm.suckless.org/patches/xkb/)
- remembers keyboard layout per client
- [xrdb](http://dwm.suckless.org/patches/xrdb/) - [xrdb](http://dwm.suckless.org/patches/xrdb/)
- allows dwm to read colors from xrdb (.Xresources) during runtime - 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/) - [zoomswap](https://dwm.suckless.org/patches/zoomswap/)
- allows a master and a stack window to swap places rather than every window on the screen - allows a master and a stack window to swap places rather than every window on the screen changing position
changing position
### Layouts included: ### Layouts included:
@ -904,8 +523,7 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- centeredfloatingmaster layout - centeredfloatingmaster layout
- [columns](https://dwm.suckless.org/patches/columns/) - [columns](https://dwm.suckless.org/patches/columns/)
- same as the default tile layout except clients in the master area are arranged in columns - same as the default tile layout except clients in the master area are arranged in columns (i.e. left to right)
(i.e. left to right)
- [deck](https://dwm.suckless.org/patches/deck/) - [deck](https://dwm.suckless.org/patches/deck/)
- deck layout - clients in the stack area are arranged on top of each other (like monocle) - deck layout - clients in the stack area are arranged on top of each other (like monocle)
@ -913,12 +531,10 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [fibonacci](https://dwm.suckless.org/patches/fibonacci/) - [fibonacci](https://dwm.suckless.org/patches/fibonacci/)
- fibonacci (dwindle and spiral) layouts - fibonacci (dwindle and spiral) layouts
- [flextile-deluxe](https://github.com/bakkeby/patches/wiki/flextile-deluxe/) - [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 - a re-envisioned, flexible and over-the-top version of the original [flextile](https://dwm.suckless.org/patches/flextile/) patch supporting
[flextile](https://dwm.suckless.org/patches/flextile/) patch supporting
- multiple split layouts (horizontal, vertical, centered, floating, fixed) - multiple split layouts (horizontal, vertical, centered, floating, fixed)
- tile arrangement on a per split basis (stack horizontally, stack vertically, grids, - tile arrangement on a per split basis (stack horizontally, stack vertically, grids, fibonacci)
fibonacci)
- pertag, cfacts, rmaster, vanitygaps compatibility - pertag, cfacts, rmaster, vanitygaps compatibility
- tile, deck, monocle, centeredmaster, bstack, bstackhoriz, gapplessgrid and more - tile, deck, monocle, centeredmaster, bstack, bstackhoriz, gapplessgrid and more
- this gives you a lot of versatility in terms of layout - this gives you a lot of versatility in terms of layout

7494
README.org

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 # dwm version
VERSION = 6.5 VERSION = 6.2
# Customize below to fit your system # Customize below to fit your system
@ -10,10 +10,6 @@ MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
# FreeBSD (uncomment)
#X11INC = /usr/local/include
#X11LIB = /usr/local/lib
# Xinerama, comment if you don't want it # Xinerama, comment if you don't want it
XINERAMALIBS = -lXinerama XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA XINERAMAFLAGS = -DXINERAMA
@ -21,47 +17,33 @@ XINERAMAFLAGS = -DXINERAMA
# freetype # freetype
FREETYPELIBS = -lfontconfig -lXft FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2 FREETYPEINC = /usr/include/freetype2
# FreeBSD (uncomment)
#FREETYPEINC = /usr/local/include/freetype2
# OpenBSD (uncomment) # OpenBSD (uncomment)
#FREETYPEINC = ${X11INC}/freetype2 #FREETYPEINC = ${X11INC}/freetype2
# OpenBSD - Uncomment this for the swallow patch / SWALLOW_PATCH
#KVMLIB = -lkvm
# Uncomment this for the alpha patch and the winicon patch (BAR_ALPHA_PATCH, BAR_WINICON_PATCH) # Uncomment this for the alpha patch / ALPHA_PATCH
#XRENDER = -lXrender #XRENDER = -lXrender
# Uncomment this for the mdpcontrol patch / MDPCONTROL_PATCH # Uncomment this for the mdpcontrol patch / MDPCONTROL_PATCH
#MPDCLIENT = -lmpdclient #MPDCLIENT = -lmpdclient
# Uncomment for the pango patch / BAR_PANGO_PATCH # Uncomment for the pango patch / PANGO_PATCH
#PANGOINC = `pkg-config --cflags xft pango pangoxft` #PANGOINC = `pkg-config --cflags xft pango pangoxft`
#PANGOLIB = `pkg-config --libs 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 # Uncomment this for the rounded corners patch / ROUNDED_CORNERS_PATCH
#XEXTLIB = -lXext #XEXTLIB = -lXext
# Uncomment this for the swallow patch / SWALLOW_PATCH # 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 # includes and libs
INCS = -I${X11INC} -I${FREETYPEINC} ${YAJLINC} ${PANGOINC} ${BDINC} INCS = -I${X11INC} -I${FREETYPEINC} ${PANGOINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XRENDER} ${MPDCLIENT} ${XEXTLIB} ${XCBLIBS} ${KVMLIB} ${PANGOLIB} ${YAJLLIBS} ${IMLIB2LIBS} $(BDLIBS) LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XRENDER} ${MPDCLIENT} ${XEXTLIB} ${XCBLIBS} ${PANGOLIB}
# flags # flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
CFLAGS = -std=c99 -pedantic -Wall -Wno-unused-function -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS} LDFLAGS = ${LIBS}
# Solaris # Solaris

267
drw.c
View File

@ -9,31 +9,7 @@
#include "drw.h" #include "drw.h"
#include "util.h" #include "util.h"
#if BIDI_PATCH #if !PANGO_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_INVALID 0xFFFD
#define UTF_SIZ 4 #define UTF_SIZ 4
@ -41,13 +17,7 @@ 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 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 utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; 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 static long
utf8decodebyte(const char c, size_t *i) utf8decodebyte(const char c, size_t *i)
{ {
@ -91,14 +61,14 @@ utf8decode(const char *c, long *u, size_t clen)
return len; return len;
} }
#endif // BAR_PANGO_PATCH #endif // PANGO_PATCH
Drw * Drw *
#if BAR_ALPHA_PATCH #if ALPHA_PATCH
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap) drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
#else #else
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
#endif // BAR_ALPHA_PATCH #endif // ALPHA_PATCH
{ {
Drw *drw = ecalloc(1, sizeof(Drw)); Drw *drw = ecalloc(1, sizeof(Drw));
@ -108,22 +78,16 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->w = w; drw->w = w;
drw->h = h; drw->h = h;
#if BAR_ALPHA_PATCH #if ALPHA_PATCH
drw->visual = visual; drw->visual = visual;
drw->depth = depth; drw->depth = depth;
drw->cmap = cmap; drw->cmap = cmap;
drw->drawable = XCreatePixmap(dpy, root, w, h, depth); 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); drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
#else #else
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); 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); drw->gc = XCreateGC(dpy, root, 0, NULL);
#endif // BAR_ALPHA_PATCH #endif // ALPHA_PATCH
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw; return drw;
@ -137,38 +101,29 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
drw->w = w; drw->w = w;
drw->h = h; drw->h = h;
#if BAR_WINICON_PATCH
if (drw->picture)
XRenderFreePicture(drw->dpy, drw->picture);
#endif // BAR_WINICON_PATCH
if (drw->drawable) if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable); XFreePixmap(drw->dpy, drw->drawable);
#if BAR_ALPHA_PATCH #if ALPHA_PATCH
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth); drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
#if BAR_WINICON_PATCH #else
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)); drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
#if BAR_WINICON_PATCH #endif // ALPHA_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 void
drw_free(Drw *drw) drw_free(Drw *drw)
{ {
#if BAR_WINICON_PATCH
XRenderFreePicture(drw->dpy, drw->picture);
#endif // BAR_WINICON_PATCH
XFreePixmap(drw->dpy, drw->drawable); XFreePixmap(drw->dpy, drw->drawable);
XFreeGC(drw->dpy, drw->gc); XFreeGC(drw->dpy, drw->gc);
#if PANGO_PATCH
drw_font_free(drw->font);
#else
drw_fontset_free(drw->fonts); drw_fontset_free(drw->fonts);
#endif // PANGO_PATCH
free(drw); free(drw);
} }
#if BAR_PANGO_PATCH #if PANGO_PATCH
/* This function is an implementation detail. Library users should use /* This function is an implementation detail. Library users should use
* drw_font_create instead. * drw_font_create instead.
*/ */
@ -237,7 +192,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
die("no font specified."); die("no font specified.");
} }
#if BAR_NO_COLOR_EMOJI_PATCH #if !COLOR_EMOJI_PATCH
/* Do not allow using color fonts. This is a workaround for a BadLength /* 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 * error from Xft with color glyphs. Modelled on the Xterm workaround. See
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269 * https://bugzilla.redhat.com/show_bug.cgi?id=1498269
@ -250,7 +205,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
XftFontClose(drw->dpy, xfont); XftFontClose(drw->dpy, xfont);
return NULL; return NULL;
} }
#endif // BAR_NO_COLOR_EMOJI_PATCH #endif // COLOR_EMOJI_PATCH
font = ecalloc(1, sizeof(Fnt)); font = ecalloc(1, sizeof(Fnt));
font->xfont = xfont; font->xfont = xfont;
@ -260,25 +215,25 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
return font; return font;
} }
#endif // BAR_PANGO_PATCH #endif // PANGO_PATCH
static void static void
xfont_free(Fnt *font) xfont_free(Fnt *font)
{ {
if (!font) if (!font)
return; return;
#if BAR_PANGO_PATCH #if PANGO_PATCH
if (font->layout) if (font->layout)
g_object_unref(font->layout); g_object_unref(font->layout);
#else #else
if (font->pattern) if (font->pattern)
FcPatternDestroy(font->pattern); FcPatternDestroy(font->pattern);
XftFontClose(font->dpy, font->xfont); XftFontClose(font->dpy, font->xfont);
#endif // BAR_PANGO_PATCH #endif // PANGO_PATCH
free(font); free(font);
} }
#if BAR_PANGO_PATCH #if PANGO_PATCH
Fnt* Fnt*
drw_font_create(Drw* drw, const char font[]) drw_font_create(Drw* drw, const char font[])
{ {
@ -289,7 +244,7 @@ drw_font_create(Drw* drw, const char font[])
fnt = xfont_create(drw, font); fnt = xfont_create(drw, font);
return (drw->fonts = fnt); return (drw->font = fnt);
} }
#else #else
Fnt* Fnt*
@ -309,55 +264,58 @@ drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
} }
return (drw->fonts = ret); return (drw->fonts = ret);
} }
#endif // BAR_PANGO_PATCH #endif // PANGO_PATCH
#if PANGO_PATCH
void
drw_font_free(Fnt *font)
{
if (font)
xfont_free(font);
}
#else
void void
drw_fontset_free(Fnt *font) drw_fontset_free(Fnt *font)
{ {
if (font) { if (font) {
#if !BAR_PANGO_PATCH
drw_fontset_free(font->next); drw_fontset_free(font->next);
#endif // BAR_PANGO_PATCH
xfont_free(font); xfont_free(font);
} }
} }
#endif // PANGO_PATCH
void void
drw_clr_create( drw_clr_create(
Drw *drw, Drw *drw,
Clr *dest, Clr *dest,
#if VTCOLORS_PATCH
const char clrname[]
#else
const char *clrname const char *clrname
#if BAR_ALPHA_PATCH #endif // VTCOLORS_PATCH
#if ALPHA_PATCH
, unsigned int alpha , unsigned int alpha
#endif // BAR_ALPHA_PATCH #endif // ALPHA_PATCH
) { ) {
if (!drw || !dest || !clrname) if (!drw || !dest || !clrname)
return; return;
#if BAR_ALPHA_PATCH #if ALPHA_PATCH
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap, if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest)) 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); die("error, cannot allocate color '%s'", clrname);
#endif // DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24); dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
#else #else
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen), DefaultColormap(drw->dpy, drw->screen),
clrname, dest)) 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); die("error, cannot allocate color '%s'", clrname);
#endif // DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
#if NO_TRANSPARENT_BORDERS_PATCH #if NO_TRANSPARENT_BORDERS_PATCH
dest->pixel |= 0xff << 24; dest->pixel |= 0xff << 24;
#endif // NO_TRANSPARENT_BORDERS_PATCH #endif // NO_TRANSPARENT_BORDERS_PATCH
#endif // BAR_ALPHA_PATCH #endif // ALPHA_PATCH
} }
/* Wrapper to create color schemes. The caller has to call free(3) on the /* Wrapper to create color schemes. The caller has to call free(3) on the
@ -365,10 +323,16 @@ drw_clr_create(
Clr * Clr *
drw_scm_create( drw_scm_create(
Drw *drw, Drw *drw,
#if VTCOLORS_PATCH
char clrnames[][8],
#elif XRDB_PATCH
char *clrnames[], char *clrnames[],
#if BAR_ALPHA_PATCH #else
const char *clrnames[],
#endif // VTCOLORS_PATCH / XRDB_PATCH
#if ALPHA_PATCH
const unsigned int alphas[], const unsigned int alphas[],
#endif // BAR_ALPHA_PATCH #endif // ALPHA_PATCH
size_t clrcount size_t clrcount
) { ) {
size_t i; size_t i;
@ -379,22 +343,22 @@ drw_scm_create(
return NULL; return NULL;
for (i = 0; i < clrcount; i++) for (i = 0; i < clrcount; i++)
#if BAR_ALPHA_PATCH #if ALPHA_PATCH
drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]); drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
#else #else
drw_clr_create(drw, &ret[i], clrnames[i]); drw_clr_create(drw, &ret[i], clrnames[i]);
#endif // BAR_ALPHA_PATCH #endif // ALPHA_PATCH
return ret; return ret;
} }
#if !BAR_PANGO_PATCH #if !PANGO_PATCH
void void
drw_setfontset(Drw *drw, Fnt *set) drw_setfontset(Drw *drw, Fnt *set)
{ {
if (drw) if (drw)
drw->fonts = set; drw->fonts = set;
} }
#endif // BAR_PANGO_PATCH #endif // PANGO_PATCH
void void
drw_setscheme(Drw *drw, Clr *scm) drw_setscheme(Drw *drw, Clr *scm)
@ -403,17 +367,6 @@ drw_setscheme(Drw *drw, Clr *scm)
drw->scheme = 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 void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
{ {
@ -426,23 +379,18 @@ 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); XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
} }
#if BIDI_PATCH #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 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) 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]; char buf[1024];
int i, ty, th; int ty;
unsigned int ew, eh; unsigned int ew;
XftDraw *d = NULL; XftDraw *d = NULL;
size_t len; size_t i, len;
int render = x || y || w || h; int render = x || y || w || h;
if (!drw || (render && !drw->scheme) || !text || !drw->fonts) if (!drw || (render && !drw->scheme) || !text || !drw->font)
return 0; return 0;
if (!render) { if (!render) {
@ -450,13 +398,13 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else { } else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
#if BAR_ALPHA_PATCH #if ALPHA_PATCH
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap); d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
#else #else
d = XftDrawCreate(drw->dpy, drw->drawable, d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen), DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen)); DefaultColormap(drw->dpy, drw->screen));
#endif // BAR_ALPHA_PATCH #endif // ALPHA_PATCH
x += lpad; x += lpad;
w -= lpad; w -= lpad;
} }
@ -464,14 +412,10 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
len = strlen(text); len = strlen(text);
if (len) { if (len) {
drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup); drw_font_getexts(drw->font, text, len, &ew, NULL, markup);
th = eh;
/* shorten text if necessary */ /* shorten text if necessary */
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--) { for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--)
drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup); drw_font_getexts(drw->font, text, len, &ew, NULL, markup);
if (eh > th)
th = eh;
}
if (len) { if (len) {
memcpy(buf, text, len); memcpy(buf, text, len);
@ -481,15 +425,15 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
; /* NOP */ ; /* NOP */
if (render) { if (render) {
ty = y + (h - th) / 2; ty = y + (h - drw->font->h) / 2;
if (markup) if (markup)
pango_layout_set_markup(drw->fonts->layout, buf, len); pango_layout_set_markup(drw->font->layout, buf, len);
else else
pango_layout_set_text(drw->fonts->layout, buf, len); pango_layout_set_text(drw->font->layout, buf, len);
pango_xft_render_layout(d, &drw->scheme[invert ? ColBg : ColFg], pango_xft_render_layout(d, &drw->scheme[invert ? ColBg : ColFg],
drw->fonts->layout, x * PANGO_SCALE, ty * PANGO_SCALE); drw->font->layout, x * PANGO_SCALE, ty * PANGO_SCALE);
if (markup) /* clear markup attributes */ if (markup) /* clear markup attributes */
pango_layout_set_attributes(drw->fonts->layout, NULL); pango_layout_set_attributes(drw->font->layout, NULL);
} }
x += ew; x += ew;
w -= ew; w -= ew;
@ -499,7 +443,11 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
XftDrawDestroy(d); XftDrawDestroy(d);
return x + (render ? w : 0); return x + (render ? w : 0);
}
#else #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]; char buf[1024];
int ty; int ty;
unsigned int ew; unsigned int ew;
@ -523,13 +471,13 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else { } else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
#if BAR_ALPHA_PATCH #if ALPHA_PATCH
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap); d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
#else #else
d = XftDrawCreate(drw->dpy, drw->drawable, d = XftDrawCreate(drw->dpy, drw->drawable,
DefaultVisual(drw->dpy, drw->screen), DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen)); DefaultColormap(drw->dpy, drw->screen));
#endif // BAR_ALPHA_PATCH #endif // ALPHA_PATCH
x += lpad; x += lpad;
w -= lpad; w -= lpad;
} }
@ -563,8 +511,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
if (utf8strlen) { if (utf8strlen) {
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL); drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
/* shorten text if necessary */ /* shorten text if necessary */
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; drw_font_getexts(usedfont, utf8str, len, &ew, NULL)) for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
len--; drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
if (len) { if (len) {
memcpy(buf, utf8str, len); memcpy(buf, utf8str, len);
@ -604,9 +552,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
fcpattern = FcPatternDuplicate(drw->fonts->pattern); fcpattern = FcPatternDuplicate(drw->fonts->pattern);
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
#if BAR_NO_COLOR_EMOJI_PATCH
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
#endif // BAR_NO_COLOR_EMOJI_PATCH
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
FcDefaultSubstitute(fcpattern); FcDefaultSubstitute(fcpattern);
@ -632,50 +578,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
XftDrawDestroy(d); XftDrawDestroy(d);
return x + (render ? w : 0); 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 void
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
@ -687,15 +591,25 @@ drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
XSync(drw->dpy, False); XSync(drw->dpy, False);
} }
#if PANGO_PATCH
unsigned int unsigned int
drw_fontset_getwidth(Drw *drw, const char *text, Bool markup) drw_font_getwidth(Drw *drw, const char *text, Bool markup)
{ {
if (!drw || !drw->fonts || !text) if (!drw || !drw->font || !text)
return 0; return 0;
return drw_text(drw, 0, 0, 0, 0, 0, text, 0, markup); return drw_text(drw, 0, 0, 0, 0, 0, text, 0, markup);
} }
#else
unsigned int
drw_fontset_getwidth(Drw *drw, const char *text)
{
if (!drw || !drw->fonts || !text)
return 0;
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
}
#endif // PANGO_PATCH
#if BAR_PANGO_PATCH #if PANGO_PATCH
void void
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup) drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup)
{ {
@ -713,7 +627,7 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w,
if (w) if (w)
*w = r.width / PANGO_SCALE; *w = r.width / PANGO_SCALE;
if (h) if (h)
*h = r.height / PANGO_SCALE; *h = font->h;
} }
#else #else
void void
@ -730,7 +644,7 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w,
if (h) if (h)
*h = font->h; *h = font->h;
} }
#endif // BAR_PANGO_PATCH #endif // PANGO_PATCH
Cur * Cur *
drw_cur_create(Drw *drw, int shape) drw_cur_create(Drw *drw, int shape)
@ -754,4 +668,3 @@ drw_cur_free(Drw *drw, Cur *cursor)
XFreeCursor(drw->dpy, cursor->cursor); XFreeCursor(drw->dpy, cursor->cursor);
free(cursor); free(cursor);
} }

70
drw.h
View File

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

3809
dwm.c

File diff suppressed because it is too large Load Diff

View File

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

View File

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

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

View File

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

View File

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

1
patch/alternativetags.h Normal file
View File

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

View File

@ -1,223 +0,0 @@
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);
}

View File

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

View File

@ -1,25 +0,0 @@
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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,39 +0,0 @@
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;
}

View File

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

View File

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

View File

@ -1,94 +0,0 @@
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;
}

View File

@ -1,5 +0,0 @@
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);

View File

@ -1,123 +0,0 @@
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;
}

View File

@ -1,4 +0,0 @@
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);

View File

@ -1,51 +0,0 @@
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
}

View File

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

View File

@ -1,103 +0,0 @@
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;
}

View File

@ -1,4 +0,0 @@
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);

View File

@ -1,482 +0,0 @@
/* 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;
}

View File

@ -1,11 +0,0 @@
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);

View File

@ -1,43 +0,0 @@
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,111 +0,0 @@
/* 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);
}

View File

@ -1,21 +0,0 @@
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);

View File

@ -1,81 +0,0 @@
#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

View File

@ -1,8 +0,0 @@
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);

View File

@ -1,18 +0,0 @@
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] }));
}

View File

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

View File

@ -1,17 +0,0 @@
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;
}

View File

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

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

@ -1,12 +0,0 @@
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);

View File

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

@ -1,4 +0,0 @@
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);

View File

@ -1,34 +0,0 @@
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;
}

View File

@ -1,10 +0,0 @@
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);

View File

@ -1,269 +0,0 @@
#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;
}

View File

@ -1,14 +0,0 @@
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);

View File

@ -1,18 +0,0 @@
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;
}

View File

@ -1,4 +0,0 @@
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);

View File

@ -1,79 +0,0 @@
#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';
}

View File

@ -1,12 +0,0 @@
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;

View File

@ -1,102 +0,0 @@
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;
}

View File

@ -1,13 +0,0 @@
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,258 +0,0 @@
/* 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;
}

View File

@ -1,8 +0,0 @@
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);

View File

@ -1,150 +0,0 @@
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);
}
}

View File

@ -1,5 +0,0 @@
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);

View File

@ -1,21 +0,0 @@
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];
}

View File

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

View File

@ -1,141 +0,0 @@
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;
}

View File

@ -1,6 +0,0 @@
#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);

View File

@ -1,112 +0,0 @@
#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();
}
}
}
}

View File

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

View File

@ -1,151 +0,0 @@
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;
}

View File

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

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

View File

@ -1,145 +0,0 @@
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);
}

View File

@ -1,9 +0,0 @@
#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);

View File

@ -1,88 +0,0 @@
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;
}

View File

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

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

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

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

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

@ -71,5 +71,4 @@ bstack(Monitor *m)
#endif #endif
} }
} }
} }

1
patch/bstack.h Normal file
View File

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

View File

@ -73,5 +73,4 @@ bstackhoriz(Monitor *m)
#endif #endif
} }
} }
} }

1
patch/bstackhoriz.h Normal file
View File

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

View File

@ -92,4 +92,3 @@ centeredfloatingmaster(Monitor *m)
#endif #endif
} }
} }

View File

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

View File

@ -156,5 +156,4 @@ centeredmaster(Monitor *m)
} }
} }
} }
} }

1
patch/centeredmaster.h Normal file
View File

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

View File

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

View File

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

View File

@ -2,5 +2,4 @@ char*
help(void) 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"; 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,2 +1 @@
static char* help(); static char* help();

View File

@ -70,5 +70,4 @@ col(Monitor *m)
sy += HEIGHT(c); sy += HEIGHT(c);
#endif #endif
} }
} }

1
patch/columns.h Normal file
View File

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

View File

@ -1,12 +1,12 @@
static int combo = 0; static int combo = 0;
#if !BAR_HOLDBAR_PATCH #if !HOLDBAR_PATCH
void void
keyrelease(XEvent *e) keyrelease(XEvent *e)
{ {
combo = 0; combo = 0;
} }
#endif // !BAR_HOLDBAR_PATCH #endif // !HOLDBAR_PATCH
void void
combotag(const Arg *arg) combotag(const Arg *arg)
@ -22,18 +22,28 @@ combotag(const Arg *arg)
combo = 1; combo = 1;
selmon->sel->tags = arg->ui & TAGMASK; selmon->sel->tags = arg->ui & TAGMASK;
} }
arrange(selmon);
focus(NULL); focus(NULL);
arrange(selmon);
} }
} }
void void
comboview(const Arg *arg) comboview(const Arg *arg)
{ {
unsigned newtags = arg->ui & TAGMASK;
if (combo) { if (combo) {
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] | (arg->ui & TAGMASK) })); selmon->tagset[selmon->seltags] |= newtags;
} else { } else {
selmon->seltags ^= 1; /*toggle tagset*/
combo = 1; combo = 1;
view(arg); if (newtags) {
#if PERTAG_PATCH
pertagview(&((Arg) { .ui = newtags }));
#else
selmon->tagset[selmon->seltags] = newtags;
#endif // PERTAG_PATCH
}
} }
} focus(NULL);
arrange(selmon);
}

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