mirror of
https://github.com/eRgo35/dots.git
synced 2025-12-16 15:36:11 +01:00
removed old dwm and changed theming for kvantum
This commit is contained in:
5
dwm/.dwm.old/.gitignore
vendored
5
dwm/.dwm.old/.gitignore
vendored
@@ -1,5 +0,0 @@
|
|||||||
*.o
|
|
||||||
dwm
|
|
||||||
dwm-msg
|
|
||||||
config.h
|
|
||||||
patches.h
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
MIT/X Consortium License
|
|
||||||
|
|
||||||
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
|
|
||||||
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
|
||||||
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
© 2007-2011 Peter Hartlich <sgkkr at hartlich dot com>
|
|
||||||
© 2007-2009 Szabolcs Nagy <nszabolcs at gmail dot com>
|
|
||||||
© 2007-2009 Christof Musik <christof at sendfax dot de>
|
|
||||||
© 2007-2009 Premysl Hruby <dfenze at gmail dot com>
|
|
||||||
© 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
|
|
||||||
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
|
||||||
© 2008 Neale Pickett <neale dot woozle dot org>
|
|
||||||
© 2009 Mate Nagy <mnagy at port70 dot net>
|
|
||||||
© 2010-2016 Hiltjo Posthuma <hiltjo@codemadness.org>
|
|
||||||
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
|
||||||
© 2011 Christoph Lohmann <20h@r-36.net>
|
|
||||||
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
|
||||||
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
|
||||||
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
|
|
||||||
© 2020-2022 Chris Down <chris@chrisdown.name>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
copy of this software and associated documentation files (the "Software"),
|
|
||||||
to deal in the Software without restriction, including without limitation
|
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
# dwm - dynamic window manager
|
|
||||||
# See LICENSE file for copyright and license details.
|
|
||||||
|
|
||||||
include config.mk
|
|
||||||
|
|
||||||
SRC = drw.c dwm.c util.c
|
|
||||||
OBJ = ${SRC:.c=.o}
|
|
||||||
|
|
||||||
# FreeBSD users, prefix all ifdef, else and endif statements with a . for this to work (e.g. .ifdef)
|
|
||||||
|
|
||||||
ifdef YAJLLIBS
|
|
||||||
all: options dwm dwm-msg
|
|
||||||
else
|
|
||||||
all: options dwm
|
|
||||||
endif
|
|
||||||
|
|
||||||
options:
|
|
||||||
@echo dwm build options:
|
|
||||||
@echo "CFLAGS = ${CFLAGS}"
|
|
||||||
@echo "LDFLAGS = ${LDFLAGS}"
|
|
||||||
@echo "CC = ${CC}"
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
${CC} -c ${CFLAGS} $<
|
|
||||||
|
|
||||||
${OBJ}: config.h config.mk patches.h
|
|
||||||
|
|
||||||
config.h:
|
|
||||||
cp config.def.h $@
|
|
||||||
|
|
||||||
patches.h:
|
|
||||||
cp patches.def.h $@
|
|
||||||
|
|
||||||
dwm: ${OBJ}
|
|
||||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
|
||||||
|
|
||||||
ifdef YAJLLIBS
|
|
||||||
dwm-msg:
|
|
||||||
${CC} -o $@ patch/ipc/dwm-msg.c ${LDFLAGS}
|
|
||||||
endif
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
|
||||||
rm -f dwm-msg
|
|
||||||
|
|
||||||
dist: clean
|
|
||||||
mkdir -p dwm-${VERSION}
|
|
||||||
cp -R LICENSE Makefile README config.def.h config.mk\
|
|
||||||
dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION}
|
|
||||||
tar -cf dwm-${VERSION}.tar dwm-${VERSION}
|
|
||||||
gzip dwm-${VERSION}.tar
|
|
||||||
rm -rf dwm-${VERSION}
|
|
||||||
|
|
||||||
install: all
|
|
||||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
|
||||||
cp -f dwm ${DESTDIR}${PREFIX}/bin
|
|
||||||
ifdef YAJLLIBS
|
|
||||||
cp -f dwm-msg ${DESTDIR}${PREFIX}/bin
|
|
||||||
endif
|
|
||||||
#cp -f patch/dwmc ${DESTDIR}${PREFIX}/bin
|
|
||||||
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
|
|
||||||
ifdef YAJLLIBS
|
|
||||||
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm-msg
|
|
||||||
endif
|
|
||||||
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
|
||||||
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
|
||||||
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
|
||||||
mkdir -p ${DESTDIR}${PREFIX}/share/xsessions
|
|
||||||
cp -n dwm.desktop ${DESTDIR}${PREFIX}/share/xsessions
|
|
||||||
chmod 644 ${DESTDIR}${PREFIX}/share/xsessions/dwm.desktop
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
|
||||||
${DESTDIR}${MANPREFIX}/man1/dwm.1\
|
|
||||||
${DESTDIR}${PREFIX}/share/xsessions/dwm.desktop
|
|
||||||
|
|
||||||
.PHONY: all options clean dist install uninstall
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
dwm - dynamic window manager
|
|
||||||
============================
|
|
||||||
dwm is an extremely fast, small, and dynamic window manager for X.
|
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
------------
|
|
||||||
In order to build dwm you need the Xlib header files.
|
|
||||||
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
Edit config.mk to match your local setup (dwm is installed into
|
|
||||||
the /usr/local namespace by default).
|
|
||||||
|
|
||||||
Afterwards enter the following command to build and install dwm (if
|
|
||||||
necessary as root):
|
|
||||||
|
|
||||||
make clean install
|
|
||||||
|
|
||||||
|
|
||||||
Running dwm
|
|
||||||
-----------
|
|
||||||
Add the following line to your .xinitrc to start dwm using startx:
|
|
||||||
|
|
||||||
exec dwm
|
|
||||||
|
|
||||||
In order to connect dwm to a specific display, make sure that
|
|
||||||
the DISPLAY environment variable is set correctly, e.g.:
|
|
||||||
|
|
||||||
DISPLAY=foo.bar:1 exec dwm
|
|
||||||
|
|
||||||
(This will start dwm on display :1 of the host foo.bar.)
|
|
||||||
|
|
||||||
In order to display status info in the bar, you can do something
|
|
||||||
like this in your .xinitrc:
|
|
||||||
|
|
||||||
while xsetroot -name "`date` `uptime | sed 's/.*,//'`"
|
|
||||||
do
|
|
||||||
sleep 1
|
|
||||||
done &
|
|
||||||
exec dwm
|
|
||||||
|
|
||||||
|
|
||||||
Configuration
|
|
||||||
-------------
|
|
||||||
The configuration of dwm is done by creating a custom config.h
|
|
||||||
and (re)compiling the source code.
|
|
||||||
@@ -1,894 +0,0 @@
|
|||||||
This dwm 6.4 (712d663, 2023-01-28) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0).
|
|
||||||
|
|
||||||
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/dwm-flexipatch/blob/master/patches.def.h):
|
|
||||||
```c
|
|
||||||
#define BAR_ALPHA_PATCH 1
|
|
||||||
```
|
|
||||||
|
|
||||||
So if you have ever been curious about trying out dwm, but have been discouraged by manual patching, then this may be a good starting point to see what a "fully fledged" dwm can look like. Want to try out the `pertag` patch? Just flip a config and recompile. Once you have found out what works for you and what doesn't then you should be in a better position to choose patches should you want to start patching from scratch.
|
|
||||||
|
|
||||||
Alternatively if you have found the patches you want, but don't want the rest of the flexipatch entanglement on your plate then you may want to have a look at [flexipatch-finalizer](https://github.com/bakkeby/flexipatch-finalizer); a custom pre-processor tool that removes all the unused flexipatch code leaving you with a build that contains the patches you selected.
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
2023-01-18 - Added the view history patch
|
|
||||||
|
|
||||||
2022-10-08 - Added the alt-tab patch
|
|
||||||
|
|
||||||
2022-08-12 - Added the nametag patch
|
|
||||||
|
|
||||||
2022-08-02 - Added the bidi patch
|
|
||||||
|
|
||||||
2022-07-05 - Added the tagpreview patch
|
|
||||||
|
|
||||||
2022-07-04 - Added the shift-tools patch(es) with individual toggles
|
|
||||||
|
|
||||||
2022-06-20 - Added the renamed scratchpads patch
|
|
||||||
|
|
||||||
2022-06-17 - Ported the seamless restart feature from dusk into dwm-flexipatch
|
|
||||||
|
|
||||||
2022-02-11 - Added the isfreesize version of the sizehints patch and the [tagsync](https://github.com/bakkeby/dwm-flexipatch/pull/219) patch (contributed by [Bagelli](https://github.com/Bagellll))
|
|
||||||
|
|
||||||
2021-11-23 - Added the taglabels and underlinetags patches
|
|
||||||
|
|
||||||
2021-09-08 - Added the alwayscenter patch
|
|
||||||
|
|
||||||
2021-07-27 - Added the winicon patch
|
|
||||||
|
|
||||||
2021-05-30 - Added togglelayout and toggletag patches
|
|
||||||
|
|
||||||
2021-04-16 - Vanitygaps: replaced smartgaps with smartgaps\_fact, allowing gaps to be disabled or increased when there is only one client.
|
|
||||||
|
|
||||||
2021-04-14 - Upgraded the dwmblocks patch for statuscmd which changes the signalling mechanism from SIGUSR1 to SIGRTMIN which is likely to cause issues for those that already have a working setup. A compatibility option has been added which changes this back to SIGUSR1. Note that configuration was also changed.
|
|
||||||
|
|
||||||
2021-04-07 - Added xkb patch
|
|
||||||
|
|
||||||
2021-04-06 - Added the distributetags patch
|
|
||||||
|
|
||||||
2021-04-04 - Added option for having different gaps on a per tag basis
|
|
||||||
|
|
||||||
2021-03-31 - Added tapresize patch (contributed by [verschmelzen](https://github.com/verschmelzen))
|
|
||||||
|
|
||||||
2021-03-29 - Removed alwaysfullscreen patch (merged into dwm 6.2)
|
|
||||||
|
|
||||||
2021-03-09 - Added the tab patch and the LG3D patch
|
|
||||||
|
|
||||||
2021-02-11 - Added the riodraw and focusdir patches
|
|
||||||
|
|
||||||
2021-01-22 - Added the placemouse patch
|
|
||||||
|
|
||||||
2021-01-02 - Added the Layoutmenu patch
|
|
||||||
|
|
||||||
2020-10-26 - Added the \_NET\_CLIENT\_LIST\_STACKING patch
|
|
||||||
|
|
||||||
2020-09-29 - Added the on\_empty\_keys patch (ported from InstantOS)
|
|
||||||
|
|
||||||
2020-09-28 - Added the \_IS\_FLOATING patch (embedded in the EWMHTAGS patch)
|
|
||||||
|
|
||||||
2020-09-18 - Added the nomodbuttons patch allowing for toggleable mouse button bindings that have no modifiers
|
|
||||||
|
|
||||||
2020-09-10 - Added the anybar patch (with experimental support for dwm bar(s) + anybar)
|
|
||||||
|
|
||||||
2020-09-09 - Added the bar border patch
|
|
||||||
|
|
||||||
2020-09-08 - Added ipc v1.5.5 patch
|
|
||||||
|
|
||||||
2020-09-07 - Scratchpads improvement (multi-monitor support)
|
|
||||||
|
|
||||||
2020-09-05 - Assortment of fullscreen improvements
|
|
||||||
|
|
||||||
2020-08-27 - Added aspectresize patch
|
|
||||||
|
|
||||||
2020-08-25 - Unified tag icon handling while adding support for different icons per monitor. Added alttagsdecoration patch.
|
|
||||||
|
|
||||||
2020-08-22 - Added logic to auto-hide bars if nothing is drawn on them (e.g. for standalone bars that only show certain clients). Added clientindicators patch and unified indicator code. Simplified Pango integration by settling on common function signatures.
|
|
||||||
|
|
||||||
2020-08-21 - Simplification of color configuration; settling on a set of color schemes that is shared between multiple patches (urgentborder, floatborder and titlecolor patches made non-optional)
|
|
||||||
|
|
||||||
2020-08-20 - Added experimental flexwintitle patch based on bartabgroups
|
|
||||||
|
|
||||||
2020-08-13 - Added bartabgroups patch
|
|
||||||
|
|
||||||
2020-08-11 - Added decoration hints and focusmaster patches
|
|
||||||
|
|
||||||
2020-08-10 - Added cool autostart, insets and steam patches
|
|
||||||
|
|
||||||
2020-08-02 - Added reorganizetags patch
|
|
||||||
|
|
||||||
2020-07-19 - Added barmodules patch - making extrabar, leftlayout, staticstatus and statusallmons patches redundant, added powerline patch
|
|
||||||
|
|
||||||
2020-07-18 - **Note**: Up until now building dwm-flexipath without any patches selected would have given you something more or less identical with mainstream dwm. In order to reduce complexity when it comes to maintainance future versions of dwm-flexipatch may diverge from this by making some patches non-optional. For the classic dwm-flexipatch and its many patch integration hints refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0) which will be subject to bug fixes and mainstream dwm updates as far as feasible.
|
|
||||||
|
|
||||||
2020-07-05 - Extrabar compatibility improvements (staticstatus, status2d, dwmblocks) and fix for systray randomly causing dwm to crash when first systray application starts
|
|
||||||
|
|
||||||
2020-06-24 - Added resizepoint, statusbutton and sendmon_keepfocus patches
|
|
||||||
|
|
||||||
2020-06-21 - Added floatpos and bar_height patches
|
|
||||||
|
|
||||||
2020-06-19 - Added tagothermonitor patch
|
|
||||||
|
|
||||||
2020-06-15 - Added sizehints patch
|
|
||||||
|
|
||||||
2020-06-14 - Added RULE macro to replace rules setup making the default config less of an abomination and making it simpler to include new rules based patches
|
|
||||||
|
|
||||||
2020-06-11 - Added the pango patch
|
|
||||||
|
|
||||||
2020-06-10 - Added the staticstatus patch
|
|
||||||
|
|
||||||
2020-05-31 - Added the keymodes patch
|
|
||||||
|
|
||||||
2020-05-29 - Added the color emoji patch
|
|
||||||
|
|
||||||
2020-05-26 - Added the status2d patch (with alpha, systray, statuspadding and dwmblocks compatibility, no statuscolors or extrabar compatibility)
|
|
||||||
|
|
||||||
2020-05-21 - Added the moveplace and moveresize patches
|
|
||||||
|
|
||||||
2020-05-03 - Added the shiftviewclients patch and the no transparent borders patch which removes opacity from window borders when the alpha patch is not used
|
|
||||||
|
|
||||||
2020-05-02 - Added dwmblocks patch
|
|
||||||
|
|
||||||
2020-04-27 - Upgraded the tagmonfixfs patch to better support moving fullscreen windows to adjacent monitors
|
|
||||||
|
|
||||||
2020-04-26 - Expanded monitor rules patch to include nmaster, showbar and topbar options
|
|
||||||
|
|
||||||
2020-04-23 - Improved swallow and switchtag compatibility
|
|
||||||
|
|
||||||
2020-04-16 - Upgraded the scratchpad patch to the multiple scratchpads patch \[[ref](https://lists.suckless.org/hackers/2004/17205.html)\]. Updated the statuscolors patch with the width computation fix \[[ref](https://lists.suckless.org/hackers/2004/17207.html)\].
|
|
||||||
|
|
||||||
2020-04-13 - Added statuscmd patch
|
|
||||||
|
|
||||||
2020-03-31 - Added the rounded corners patch
|
|
||||||
|
|
||||||
2020-03-27 - Revamped the dragmfact patch to support both horizontal and vertical layout splits as well as centered master variants
|
|
||||||
|
|
||||||
2020-03-25 - Added dragcfact patch
|
|
||||||
|
|
||||||
2020-03-23 - Added stacker patch
|
|
||||||
|
|
||||||
2020-03-21 - Reworked a series of layouts to re-allocate remaining pixels following an even (or cfacts) split with the aim of presenting a pixel perfect layout. This affects the following layouts: tile, bstack, bstackhoriz, centered master, centered floating master, columns, deck, and corresponding flextile-deluxe layouts
|
|
||||||
|
|
||||||
2020-02-11 - Added swaptags and vtcolor patches
|
|
||||||
|
|
||||||
2020-02-09 - Added alternative scratchpad patch
|
|
||||||
|
|
||||||
2020-02-02 - Added fsignal and transferall patches
|
|
||||||
|
|
||||||
2020-01-29 - Added swapfocus and shiftview patches
|
|
||||||
|
|
||||||
2020-01-26 - Added transfer patch
|
|
||||||
|
|
||||||
2020-01-24 - Added barpadding patch (incl. statusallmons, statuspadding, statuscolors, systray, alpha, holdbar and extrabar patch compatibility). Moved patches.h to patches.def.h to mimic the config pattern of having default and personal settings.
|
|
||||||
|
|
||||||
2020-01-17 - Added inplacerotate patch
|
|
||||||
|
|
||||||
2019-12-15 - Updated dragmfact patch to include fix patch to make it work with multiple monitors
|
|
||||||
|
|
||||||
2019-11-26 - Added dmenumatchtop patch, added improvements to the switchtag patch based on ideas from the switchtotag patch
|
|
||||||
|
|
||||||
2019-11-21 - Added fakefullscreenclient patch
|
|
||||||
|
|
||||||
2019-10-24 - Added dragmfact, extrabar, exresize and nodmenu patches
|
|
||||||
|
|
||||||
2019-10-22 - Added ispermanent and swallow patches
|
|
||||||
|
|
||||||
2019-10-16 - Introduced [flexipatch-finalizer](https://github.com/bakkeby/flexipatch-finalizer)
|
|
||||||
|
|
||||||
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-08 - Added columns layout and fakefullscreen patch
|
|
||||||
|
|
||||||
2019-10-07 - Added sortscreens and dwmc patches, fixed minor cross-compatibility issues for combo, holdbar, leftlayout, hidevacanttags, taggrid and activetagindicatorbar
|
|
||||||
|
|
||||||
2019-10-06 - Added statuscolors and statusallmons patches, fixed minor cross-compatibility issues for killunsel, fullscreen, noborder, tagintostack patches
|
|
||||||
|
|
||||||
2019-10-05 - Added killunsel, taggrid, hidevacanttags and cmdcustomize patches
|
|
||||||
|
|
||||||
2019-10-04 - Added maximize, movestack, monoclesymbol, noborder, tagall and tagintostack patches
|
|
||||||
|
|
||||||
2019-10-03 - Added onlyquitonempty and switchcol patches
|
|
||||||
|
|
||||||
2019-10-02 - Added restartsig, emptyview, focusurgent and focusadjacenttag patches
|
|
||||||
|
|
||||||
2019-10-01 - Added leftlayout, fullscreen, holdbar and unfloatvisible patches
|
|
||||||
|
|
||||||
2019-09-30 - Replaced flextile with flextile-deluxe, refactored monitor rules to support predetermined layouts per tag
|
|
||||||
|
|
||||||
2019-09-15 - Added focusonclick, xrdb, viewontag, urgentborder and winview patches
|
|
||||||
|
|
||||||
2019-09-14 - Added setborderpx, selfrestart and push (no master variant), sticky and warp patches
|
|
||||||
|
|
||||||
2019-09-13 - Added titlecolor and push patches
|
|
||||||
|
|
||||||
2019-09-12 - Added activetagindicatorbar, alwaysfullscreen and autoresize patches
|
|
||||||
|
|
||||||
2019-09-11 - Added monitor rules, combo and ewmhtags patches
|
|
||||||
|
|
||||||
2019-09-10 - Minor tweaks to awesomebar patch (incl. alpha and systray compatibility). Added floatbordercolor patch.
|
|
||||||
|
|
||||||
2019-09-09 - Added deck, fibonacci (dwindle and spiral), gridmode, gapplessgrid, horizgrid, nrowgrid, centeredmaster and flextile layouts. Added alternativetags and awesomebar patches.
|
|
||||||
|
|
||||||
2019-09-08 - Added cfacts and vanitygaps patches, added bstack and bstackhoriz layouts
|
|
||||||
|
|
||||||
2019-09-07 - Added cyclelayouts, resizecorners, rotatestack, savefloats, statuspadding, switchtag, center and windowrolerule patches
|
|
||||||
|
|
||||||
2019-09-06 - Added attachabove, attachaside, attachbelow, attachbottom, autostart, fancybar, focusonnetactive and losefullscreen patches
|
|
||||||
|
|
||||||
2019-09-05 - Alpha, systray, togglefullscreen, tagallmon, tagmonfixfs, tagswapmon, pertag and zoomswap patches added
|
|
||||||
|
|
||||||
### Patches included:
|
|
||||||
|
|
||||||
- [activetagindicatorbar](https://dwm.suckless.org/patches/activetagindicatorbar/)
|
|
||||||
- this patch changes the rectangle indicating if a tag is used by a client into a bar above
|
|
||||||
the tag name
|
|
||||||
|
|
||||||
- [alpha](https://dwm.suckless.org/patches/alpha/)
|
|
||||||
- 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/)
|
|
||||||
- adds alternative tags which can be toggled on the fly for the sole purpose of providing
|
|
||||||
visual aid
|
|
||||||
|
|
||||||
- [alttagsdecoration](https://dwm.suckless.org/patches/alttagsdecoration/)
|
|
||||||
- provides the ability to use alternative text for tags which contain at least one window
|
|
||||||
|
|
||||||
- [alwayscenter](https://dwm.suckless.org/patches/alwayscenter/)
|
|
||||||
- makes all floating windows centered, like the center patch, but without a rule
|
|
||||||
|
|
||||||
- [~alwaysfullscreen~](https://dwm.suckless.org/patches/alwaysfullscreen/)
|
|
||||||
- ~prevents the focus to drift from the active fullscreen client when using focusstack\(\)~
|
|
||||||
|
|
||||||
- [anybar](https://dwm.suckless.org/patches/anybar/)
|
|
||||||
- enables dwm to manage external status bars such as lemonbar and polybar
|
|
||||||
- dwm treats the external bar as it would its own, so all regular dwm commands such as
|
|
||||||
togglebar affect the external bar in the same way
|
|
||||||
|
|
||||||
- [aspectresize](https://dwm.suckless.org/patches/aspectresize/)
|
|
||||||
- allows windows to be resized with its aspect ratio remaining constant
|
|
||||||
|
|
||||||
- [attachabove](https://dwm.suckless.org/patches/attachabove/)
|
|
||||||
- new windows are placed above selected client
|
|
||||||
|
|
||||||
- [attachaside](https://dwm.suckless.org/patches/attachaside/)
|
|
||||||
- new windows are placed on top of the stack
|
|
||||||
|
|
||||||
- [attachbelow](https://dwm.suckless.org/patches/attachbelow/)
|
|
||||||
- new windows are placed below selected client
|
|
||||||
|
|
||||||
- [attachbottom](https://dwm.suckless.org/patches/attachbottom/)
|
|
||||||
- new windows are placed at the bottom of the stack
|
|
||||||
|
|
||||||
- [autoresize](https://dwm.suckless.org/patches/autoresize/)
|
|
||||||
- by default, windows that are not visible when requesting a resize/move will not get
|
|
||||||
resized/moved, with this patch, however, they will
|
|
||||||
|
|
||||||
- [autostart](https://dwm.suckless.org/patches/autostart/)
|
|
||||||
- makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup
|
|
||||||
|
|
||||||
- [awesomebar](https://dwm.suckless.org/patches/awesomebar/)
|
|
||||||
- enhanced taskbar that allows focus / hiding / unhiding of windows by clicking on the status
|
|
||||||
bar
|
|
||||||
|
|
||||||
- [bar_border](https://codemadness.org/paste/dwm-border-bar.patch)
|
|
||||||
- adds a border around the bar similarly to how client windows have borders
|
|
||||||
|
|
||||||
- [bar_height](https://dwm.suckless.org/patches/bar_height/)
|
|
||||||
- allows the bar height to be explicitly set rather than being derived from font
|
|
||||||
|
|
||||||
- [barmodules](https://github.com/bakkeby/patches/wiki/barmodules/)
|
|
||||||
- splits the dwm bar into modules allowing for re-arrangement of the bar and easier
|
|
||||||
integration for new features
|
|
||||||
|
|
||||||
- [barpadding](https://dwm.suckless.org/patches/barpadding/)
|
|
||||||
- adds vertical and horizontal space between the statusbar and the edge of the screen
|
|
||||||
|
|
||||||
- [bartabgroups](https://dwm.suckless.org/patches/bartabgroups/)
|
|
||||||
- turns the titlebar area into a mfact-respecting tab-bar showing each client's title
|
|
||||||
|
|
||||||
- [bidi](https://dwm.suckless.org/patches/bidi/)
|
|
||||||
- adds proper support for Right-To-Left (RTL) languages (such as Farsi, Arabic or Hebrew)
|
|
||||||
|
|
||||||
- [center](https://dwm.suckless.org/patches/center/)
|
|
||||||
- adds an iscentered rule to automatically center clients on the current monitor
|
|
||||||
|
|
||||||
- [cfacts](https://dwm.suckless.org/patches/cfacts/)
|
|
||||||
- the cfacts patch provides the ability to assign different weights to clients in their
|
|
||||||
respective stack in tiled layout
|
|
||||||
|
|
||||||
- [clientindicators](https://dwm.suckless.org/patches/clientindicators/)
|
|
||||||
- draws a dot indicator overlayed on each tag icon for each client
|
|
||||||
- the selected client is drawn as a larger horizontal line
|
|
||||||
|
|
||||||
- [cmdcustomize](https://dwm.suckless.org/patches/cmdcustomize/)
|
|
||||||
- allows color attributes to be set through the command line
|
|
||||||
|
|
||||||
- [colorbar](https://dwm.suckless.org/patches/colorbar/)
|
|
||||||
- lets you change the foreground and background color of every statusbar element
|
|
||||||
|
|
||||||
- ~color_emoji~
|
|
||||||
- ~enables color emoji in dmenu by removing a workaround for a BadLength error in the Xft~
|
|
||||||
~library when color glyphs are used~
|
|
||||||
- ~enabling this will crash dwm on encountering such glyphs unless you also have an updated~
|
|
||||||
~Xft library that can handle them~
|
|
||||||
|
|
||||||
- [combo](https://dwm.suckless.org/patches/combo/)
|
|
||||||
- allows you to select multiple tags by pressing all the right keys as a combo, e.g. hold MOD
|
|
||||||
and press and hold 1 and 3 together to view those two tags
|
|
||||||
|
|
||||||
- [cool_autostart](https://dwm.suckless.org/patches/cool_autostart/)
|
|
||||||
- allows dwm to execute commands from an array in the config.h file
|
|
||||||
- when dwm exits all processes from the autostart array will be killed automatically
|
|
||||||
|
|
||||||
- [cyclelayouts](https://dwm.suckless.org/patches/cyclelayouts/)
|
|
||||||
- lets you cycle through all your layouts
|
|
||||||
|
|
||||||
- [decoration_hints](https://dwm.suckless.org/patches/decoration_hints/)
|
|
||||||
- make dwm respect \_MOTIF\_WM\_HINTS property, and not draw borders around windows
|
|
||||||
requesting for it
|
|
||||||
- some applications use this property to notify window managers to not draw window
|
|
||||||
decorations
|
|
||||||
- not respecting this property leads to issues with applications that draw their own borders,
|
|
||||||
like chromium (with "Use system title bar and borders" turned off) or vlc in fullscreen mode
|
|
||||||
|
|
||||||
- [distributetags](https://dwm.suckless.org/patches/reorganizetags/)
|
|
||||||
- this reorganisetags variant re-distributes all clients on the current monitor evenly across
|
|
||||||
all tags
|
|
||||||
|
|
||||||
- [dmenumatchtop](https://dwm.suckless.org/patches/dmenumatchtop)
|
|
||||||
- updates the position of dmenu to match that of the bar
|
|
||||||
- i.e. if topbar is 0 then dmenu will appear at the bottom and if 1 then dmenu will appear at
|
|
||||||
the top
|
|
||||||
|
|
||||||
- [dragcfact](https://github.com/bakkeby/patches/wiki/dragcfact/)
|
|
||||||
- lets you resize clients' size (i.e. modify cfact) by holding modkey + shift + right-click
|
|
||||||
and dragging the mouse
|
|
||||||
|
|
||||||
- [dragmfact](https://github.com/bakkeby/patches/wiki/dragmfact/)
|
|
||||||
- lets you resize the split in layouts (i.e. modify mfact) by holding the modkey + shift
|
|
||||||
+ left-click and dragging the mouse
|
|
||||||
- this is a bespoke patch that supports vertical and horizontal layout splits as well as
|
|
||||||
centered master variants
|
|
||||||
|
|
||||||
- [dwmblocks](https://gist.github.com/danbyl/54f7c1d57fc6507242a95b71c3d8fdea)
|
|
||||||
- signal integration to use dwm with a patched [dwmblocks](https://github.com/torrinfail/dwmblocks)
|
|
||||||
- combined with the statuscmd patch this gives a clickable statusbar
|
|
||||||
|
|
||||||
- [dwmc](http://dwm.suckless.org/patches/dwmc/)
|
|
||||||
- a simple dwmc client using a fork of fsignal to communicate with dwm
|
|
||||||
|
|
||||||
- [emptyview](https://dwm.suckless.org/patches/emptyview/)
|
|
||||||
- allows no tag at all to be selected
|
|
||||||
- dwm will start with no tag selected and when a client with no tag rule is started and no
|
|
||||||
tag is selected then it will be opened on the first tag
|
|
||||||
|
|
||||||
- [ewmhtags](https://dwm.suckless.org/patches/ewmhtags/)
|
|
||||||
- adds EWMH support for \_NET_NUMBER_OF_DESKTOPS, \_NET_CURRENT_DESKTOP, \_NET_DESKTOP_NAMES
|
|
||||||
and \_NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs
|
|
||||||
that request workspace information, e.g. polybar's xworkspaces module
|
|
||||||
|
|
||||||
- [exresize](https://dwm.suckless.org/patches/exresize/)
|
|
||||||
- this patch allows the user to change size and placement of floating windows using only the
|
|
||||||
keyboard
|
|
||||||
- it also allows for temporary vertical and horizontal extension of windows similar to other
|
|
||||||
WMs fill command
|
|
||||||
|
|
||||||
- [~extrabar~](https://dwm.suckless.org/patches/extrabar/)
|
|
||||||
- ~enables an extra status bar in dwm in a similar manner to the dualstatus patch~
|
|
||||||
- ~if the primary status is at the top via topbar then the extra status bar will be placed at
|
|
||||||
the bottom and vice versa~
|
|
||||||
|
|
||||||
- extrastatus
|
|
||||||
- formerly extrabar - now only splits the status into to statuses by using a status separator
|
|
||||||
|
|
||||||
- [fakefullscreen](https://dwm.suckless.org/patches/fakefullscreen/)
|
|
||||||
- only allow clients to "fullscreen" into the space currently given to them
|
|
||||||
- as an example, this will allow you to view a fullscreen video in your browser on one half
|
|
||||||
of the screen, while having the other half available for other tasks
|
|
||||||
|
|
||||||
- [fakefullscreenclient](https://github.com/bakkeby/patches/wiki/fakefullscreenclient/)
|
|
||||||
- similarly to the fakefullscreen patch this patch only allows clients to "fullscreen" into
|
|
||||||
the space currently given to them
|
|
||||||
- as an example, this will allow you to view a fullscreen video in your browser on one half
|
|
||||||
of the screen, while having the other half available for other tasks
|
|
||||||
- the "twist" with this patch is that fake fullscreen can be toggled on a per client basis
|
|
||||||
rather than applying to all clients globally
|
|
||||||
|
|
||||||
- [fancybar](https://dwm.suckless.org/patches/fancybar/)
|
|
||||||
- shows the titles of all visible windows in the status bar
|
|
||||||
|
|
||||||
- flexwintitle
|
|
||||||
- based on the bartabgroups patch, this is a layout aware barmodules module for handling
|
|
||||||
window titles intended to be used with flextile-deluxe
|
|
||||||
|
|
||||||
- [~floatbordercolor~](https://dwm.suckless.org/patches/float_border_color/)
|
|
||||||
- ~this patch allows a different border color to be chosen for floating windows~
|
|
||||||
|
|
||||||
- [floatpos](https://github.com/bakkeby/patches/wiki/floatpos/)
|
|
||||||
- adds a float rule allowing the size and position of floating windows to be specified
|
|
||||||
- control the size and position of floating windows similar to exresize, moveresize,
|
|
||||||
moveplace patches
|
|
||||||
- specify size and position using absolute, relative or fixed co-ordinates or
|
|
||||||
- position floating windows in a grid-like manner
|
|
||||||
|
|
||||||
- [focusadjacenttag](https://dwm.suckless.org/patches/focusadjacenttag/)
|
|
||||||
- provides the ability to focus the tag on the immediate left or right of the currently
|
|
||||||
focused tag
|
|
||||||
- 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
|
|
||||||
|
|
||||||
- [focusmaster](https://dwm.suckless.org/patches/focusmaster/)
|
|
||||||
- a simple patch that just puts focus back to the master client
|
|
||||||
|
|
||||||
- [focusonclick](https://dwm.suckless.org/patches/focusonclick/)
|
|
||||||
- this patch makes you switch focus only by mouse click and not sloppy (focus follows mouse
|
|
||||||
pointer)
|
|
||||||
|
|
||||||
- [focusonnetactive](https://dwm.suckless.org/patches/focusonnetactive/)
|
|
||||||
- by default, dwm responds to \_NET_ACTIVE_WINDOW client messages by setting the urgency bit
|
|
||||||
on the named window
|
|
||||||
- this patch activates the window instead
|
|
||||||
|
|
||||||
- [focusurgent](https://dwm.suckless.org/patches/focusurgent/)
|
|
||||||
- adds a keyboard shortcut to select the next window having the urgent flag regardless of the
|
|
||||||
tag it is on
|
|
||||||
|
|
||||||
- [fsignal](https://dwm.suckless.org/patches/fsignal/)
|
|
||||||
- send "fake signals" to dwm for handling, using xsetroot
|
|
||||||
- this will not conflict with the status bar, which also is managed using xsetroot
|
|
||||||
|
|
||||||
- [fullscreen](https://dwm.suckless.org/patches/fullscreen/)
|
|
||||||
- applies the monocle layout with the focused client on top and hides the bar
|
|
||||||
- when pressed again it shows the bar and restores the layout that was active before going
|
|
||||||
fullscreen
|
|
||||||
|
|
||||||
- [hidevacanttags](https://dwm.suckless.org/patches/hide_vacant_tags/)
|
|
||||||
- prevents dwm from drawing tags with no clients (i.e. vacant) on the bar
|
|
||||||
|
|
||||||
- [holdbar](http://dwm.suckless.org/patches/holdbar/)
|
|
||||||
- with this patch dwm's built-in status bar is only shown when HOLDKEY is pressed
|
|
||||||
- additionally the bar will now overlay the display
|
|
||||||
|
|
||||||
- [ignore-xft-errors-when-drawing-text](https://groups.google.com/forum/m/#!topic/wmii/7bncCahYIww)
|
|
||||||
- sometimes dwm crashes when it cannot render some glyphs in window titles (usually emoji)
|
|
||||||
- this patch is essentially a hack to ignore any errors when drawing text on the status bar
|
|
||||||
and may be removed if a more appropriate solution comes up
|
|
||||||
|
|
||||||
- [inplacerotate](https://dwm.suckless.org/patches/inplacerotate/)
|
|
||||||
- allows rotation of all clients in the master or stack area without affecting the other area
|
|
||||||
|
|
||||||
- [insets](https://dwm.suckless.org/patches/insets/)
|
|
||||||
- lets custom insets from each edge of the screen to be defined
|
|
||||||
- an example use case would be to make space for an external bar
|
|
||||||
|
|
||||||
- [ipc](https://github.com/mihirlad55/dwm-ipc)
|
|
||||||
- implements inter-process communication through a UNIX socket for dwm
|
|
||||||
- allows for the window manager to be queried for information, e.g. listen for events such as
|
|
||||||
tag or layout changes, as well as send commands to control the window manager via other
|
|
||||||
programs
|
|
||||||
|
|
||||||
- [\_IS\_FLOATING](https://github.com/bakkeby/dwm-flexipatch/issues/50)
|
|
||||||
- adds the \_IS\_FLOATING xproperty for floating windows
|
|
||||||
- this can allow for a compositor to handle floating windows differently to tiled windows,
|
|
||||||
e.g. only show shadows on floating windows
|
|
||||||
- this patch is enabled via the ewmhtags patch
|
|
||||||
|
|
||||||
- [ispermanent](https://dwm.suckless.org/patches/ispermanent/)
|
|
||||||
- adds rule option for clients to avoid accidental termination by killclient for sticky
|
|
||||||
windows
|
|
||||||
|
|
||||||
- [keymodes](https://dwm.suckless.org/patches/keymodes/)
|
|
||||||
- this patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts can be
|
|
||||||
performed
|
|
||||||
|
|
||||||
- [killunsel](https://dwm.suckless.org/patches/killunsel/)
|
|
||||||
- kills all visible clients that are not selected (only the selected client will remain)
|
|
||||||
|
|
||||||
- [~leftlayout~](http://dwm.suckless.org/patches/leftlayout/)
|
|
||||||
- ~moves the layout symbol in the status bar to the left hand side~
|
|
||||||
|
|
||||||
- LG3D
|
|
||||||
- changes the window manager name to "LG3d" instead of "dwm" as a workaround for Java
|
|
||||||
applications that assume that the window manager is using window reparenting
|
|
||||||
- refer to the ISSUES secton of the dwm man page for more details
|
|
||||||
|
|
||||||
- [losefullscreen](https://github.com/bakkeby/patches/wiki/losefullscreen/)
|
|
||||||
- by default in dwm it is possible to make an application fullscreen, then use the focusstack
|
|
||||||
keybindings to focus on other windows beneath the current window
|
|
||||||
- it is also possible to spawn new windows (e.g. a terminal) that end up getting focus while
|
|
||||||
the previous window remains in fullscreen
|
|
||||||
- this patch ensures that in such scenarios the previous window loses fullscreen
|
|
||||||
|
|
||||||
- [maximize](https://dwm.suckless.org/patches/maximize/)
|
|
||||||
- adds helper functions for maximizing, horizontally and vertically, floating windows using
|
|
||||||
keybindings
|
|
||||||
|
|
||||||
- [mpdcontrol](https://dwm.suckless.org/patches/mpdcontrol/)
|
|
||||||
- adds keyboard bindings to control MDP (Music Player Daemon)
|
|
||||||
|
|
||||||
- [monitorrules](https://github.com/bakkeby/patches/wiki/monitorrules/)
|
|
||||||
- adds rules per monitor, e.g. have default layouts per monitor
|
|
||||||
- the use case for this is if the second monitor is vertical (i.e. rotated) then you may want
|
|
||||||
to use a different default layout for this monitor than what is used for the main monitor
|
|
||||||
(for example normal vertical split for main monitor and horizontal split for the second)
|
|
||||||
|
|
||||||
- [monoclesymbol](https://dwm.suckless.org/patches/monoclesymbol/)
|
|
||||||
- always display the the monocle-symbol as defined in config.h if the monocle-layout is
|
|
||||||
activated
|
|
||||||
- do not display the number of open clients in the current tag
|
|
||||||
|
|
||||||
- [moveresize](https://dwm.suckless.org/patches/moveresize/)
|
|
||||||
- allows you to move and resize dwm's clients using keyboard bindings
|
|
||||||
|
|
||||||
- [movestack](https://dwm.suckless.org/patches/movestack/)
|
|
||||||
- allows you to move clients around in the stack and swap them with the master
|
|
||||||
|
|
||||||
- [nametag](https://dwm.suckless.org/patches/nametag/)
|
|
||||||
- allows the names of tags to be changed during runtime
|
|
||||||
|
|
||||||
- [netclientliststacking](https://github.com/bakkeby/patches/wiki/netclientliststacking)
|
|
||||||
- adds support for the \_NET\_CLIENT\_LIST\_STACKING atom, needed by certain applications
|
|
||||||
like the Zoom video conferencing application
|
|
||||||
|
|
||||||
- [noborder](https://dwm.suckless.org/patches/noborder/)
|
|
||||||
- removes the border when there is only one window visible
|
|
||||||
|
|
||||||
- [nodmenu](https://git.suckless.org/sites/commit/ed68e3629de4ef2ca2d3f8893a79fb570b4c0cbc.html)
|
|
||||||
- enable modifying dmenu in config.def.h which resulted previously in a compilation error
|
|
||||||
because two lines of code hardcode dmenu into dwm
|
|
||||||
- allows complete removal of dmenu, should you want to do that
|
|
||||||
- NB: this patch was removed from the patches listing on the suckless page due to it's simplicity
|
|
||||||
|
|
||||||
- nomodbuttons
|
|
||||||
- allows for toggleable client button bindings that have no modifiers
|
|
||||||
- this can, for example, allow you to move or resize using the mouse alone without holding
|
|
||||||
down a modifier key, which can be practical if you have extra buttons on your mouse
|
|
||||||
|
|
||||||
- [no\_transparent\_borders](https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8)
|
|
||||||
- when terminals have transparency then their borders also become transparent
|
|
||||||
- this patch ensures that borders have no transparency
|
|
||||||
- note that this patch is only relevant if you are not using the alpha patch
|
|
||||||
|
|
||||||
- [on\_empty\_keys](https://github.com/bakkeby/dwm-flexipatch/issues/51)
|
|
||||||
- port of InstantVM's on_empty_keys functionality allowing keybindings that apply only when a
|
|
||||||
tag/view is empty
|
|
||||||
- an example use case is being able to launch applications with first hand keys like "f" to
|
|
||||||
launch firefox
|
|
||||||
|
|
||||||
- [onlyquitonempty](https://dwm.suckless.org/patches/onlyquitonempty/)
|
|
||||||
- makes it so dwm will only exit via quit() if no windows are open (in order to prevent
|
|
||||||
accidental loss of work)
|
|
||||||
|
|
||||||
- [pango](https://dwm.suckless.org/patches/pango/)
|
|
||||||
- adds simple markup for status messages using pango markup
|
|
||||||
|
|
||||||
- [pertag](https://dwm.suckless.org/patches/pertag/)
|
|
||||||
- adds nmaster, mfact, layouts and more per tag rather than per monitor
|
|
||||||
|
|
||||||
- [placemouse](https://github.com/bakkeby/patches/wiki/placemouse)
|
|
||||||
- lets the user change the position of a client in the stack using the mouse.
|
|
||||||
|
|
||||||
- [powerline](https://gitlab.com/udiboy1209-suckless/dwm/-/commit/071f5063e8ac4280666828179f92788d893eea40#4b1a539194be7467cefbda22f675a3b7c19ceca7)
|
|
||||||
- adds drawing of powerline arrows (and diagonal lines) for both the status bar and the tags
|
|
||||||
|
|
||||||
- [push](https://dwm.suckless.org/patches/push/)
|
|
||||||
- this patch provides a way to move clients up and down inside the client list
|
|
||||||
|
|
||||||
- [renamed_scratchpads](https://github.com/bakkeby/patches/wiki/renamedscratchpads)
|
|
||||||
- variant of the [named scratchpads](https://dwm.suckless.org/patches/namedscratchpads/) patch
|
|
||||||
|
|
||||||
- [reorganizetags](https://dwm.suckless.org/patches/reorganizetags/)
|
|
||||||
- shifts all clients per tag to leftmost unoccupied tags
|
|
||||||
- e.g. if clients A, B, C are tagged on tags 1, 5, 9 respectively, when reorganized they will
|
|
||||||
now be on tag 1, 2, and 3
|
|
||||||
|
|
||||||
- [resizecorners](https://dwm.suckless.org/patches/resizecorners/)
|
|
||||||
- by default, windows only resize from the bottom right corner
|
|
||||||
- with this patch the mouse is warped to the nearest corner and you resize from there
|
|
||||||
|
|
||||||
- [resizepoint](https://github.com/bakkeby/patches/wiki/resizepoint/)
|
|
||||||
- practically the same as resizecorners, but the cursor does not warp to any of the window
|
|
||||||
corners
|
|
||||||
|
|
||||||
- [restartsig](https://dwm.suckless.org/patches/restartsig/)
|
|
||||||
- adds a keyboard shortcut to restart dwm or alternatively by using kill -HUP dwmpid
|
|
||||||
- additionally dwm can quit cleanly by using kill -TERM dwmpid
|
|
||||||
|
|
||||||
- [riodraw](https://github.com/bakkeby/patches/wiki/riodraw/)
|
|
||||||
- adds rio-like drawing to spawn new windows or to resize the selected client (ported from
|
|
||||||
instantWM)
|
|
||||||
- depends on an external tool slop being installed
|
|
||||||
|
|
||||||
- [rotatestack](https://dwm.suckless.org/patches/rotatestack/)
|
|
||||||
- let's you rotate through the stack using keyboard shortcuts
|
|
||||||
|
|
||||||
- [roundedcorners](https://github.com/mitchweaver/suckless/blob/master/dwm/patches/mitch-06-rounded_corners-f04cac6d6e39cd9e3fc4fae526e3d1e8df5e34b2.patch)
|
|
||||||
- adds rounded corners to client windows
|
|
||||||
|
|
||||||
- [savefloats](https://dwm.suckless.org/patches/save_floats/)
|
|
||||||
- saves size and position of every floating window before it is forced into tiled mode
|
|
||||||
- if the window is made floating again then the old dimensions will be restored
|
|
||||||
|
|
||||||
- [scratchpad](https://dwm.suckless.org/patches/scratchpad/)
|
|
||||||
- the scratchpad patch allows you to spawn or restore a floating terminal window
|
|
||||||
|
|
||||||
- [scratchpad\_alt\_1](https://github.com/GasparVardanyan/dwm-scratchpad)
|
|
||||||
- this alternative patch enables a scratchpad feature in dwm similar to the scratchpad
|
|
||||||
feature in i3wm
|
|
||||||
|
|
||||||
- seamless\_restart
|
|
||||||
- allows for selected layout, assigned tags, etc. to be persisted across restarts
|
|
||||||
|
|
||||||
- [selfrestart](https://dwm.suckless.org/patches/selfrestart/)
|
|
||||||
- restart dwm without the unnecessary dependency of an external script
|
|
||||||
|
|
||||||
- [sendmon\_keepfocus](https://github.com/bakkeby/patches/wiki/sendmon_keepfocus/)
|
|
||||||
- minor patch that allow clients to keep focus when being sent to another monitor
|
|
||||||
|
|
||||||
- [setborderpx](https://dwm.suckless.org/patches/setborderpx/)
|
|
||||||
- this patch allows border pixels to be changed during runtime
|
|
||||||
|
|
||||||
- [shift-tools](https://dwm.suckless.org/patches/shift-tools/)
|
|
||||||
- a group of functions that shift clients or views left or right
|
|
||||||
|
|
||||||
- [shiftview](https://github.com/chau-bao-long/dotfiles/blob/master/suckless/dwm/shiftview.diff)
|
|
||||||
- adds keybindings for left and right circular shift through tags
|
|
||||||
- also see focusadjacenttag
|
|
||||||
|
|
||||||
- [shiftviewclients](https://github.com/bakkeby/patches/wiki/shiftviewclients/)
|
|
||||||
- variant of the shiftview patch which skips tags that have no clients
|
|
||||||
|
|
||||||
- [sizehints](https://dwm.suckless.org/patches/sizehints/)
|
|
||||||
- makes dwm obey even "soft" sizehints for new clients
|
|
||||||
|
|
||||||
- [sortscreens](https://www.mail-archive.com/hackers@suckless.org/msg09400.html)
|
|
||||||
- this patch aims to address some inconsistencies when it comes to focusmon, tagmon and
|
|
||||||
similar functionality by explicitly sorting screens left to right (or top to bottom in a
|
|
||||||
vertical layout)
|
|
||||||
|
|
||||||
- [spawn\_cwd](https://dwm.suckless.org/patches/spawn_cwd/)
|
|
||||||
- spawns programs from currently focused client's working directory
|
|
||||||
|
|
||||||
- [stacker](https://dwm.suckless.org/patches/stacker/)
|
|
||||||
- provides comprehensive utilities for managing the client stack
|
|
||||||
|
|
||||||
- [staticstatus](https://dwm.suckless.org/patches/staticstatus/)
|
|
||||||
- allows the status text to be fixed to the bar on a specific monitor rather than being
|
|
||||||
drawn on the focused monitor
|
|
||||||
|
|
||||||
- [status2d](https://dwm.suckless.org/patches/status2d/)
|
|
||||||
- allows colors and rectangle drawing in the dwm status bar
|
|
||||||
|
|
||||||
- [statusallmons](https://dwm.suckless.org/patches/statuspadding/)
|
|
||||||
- this patch draws and updates the statusbar on all monitors
|
|
||||||
|
|
||||||
- [statusbutton](https://dwm.suckless.org/patches/statusbutton/)
|
|
||||||
- adds a clickable button to the left hand side of the statusbar
|
|
||||||
|
|
||||||
- [statuscmd](https://dwm.suckless.org/patches/statuscmd/)
|
|
||||||
- adds the ability to execute shell commands based on the mouse button and position when
|
|
||||||
clicking the status bar
|
|
||||||
|
|
||||||
- [statuscolors](https://dwm.suckless.org/patches/statuscolors/)
|
|
||||||
- enables colored text in the status bar allowing multiple color combinations for use in the
|
|
||||||
status script
|
|
||||||
|
|
||||||
- [statuspadding](https://dwm.suckless.org/patches/statuspadding/)
|
|
||||||
- adds configuration options for horizontal and vertical padding in the status bar
|
|
||||||
|
|
||||||
- [steam](https://github.com/bakkeby/patches/wiki/steam)
|
|
||||||
- a minor patch that works around the issue of floating Steam windows jumping around the
|
|
||||||
screen when they receive focus
|
|
||||||
|
|
||||||
- [sticky](https://dwm.suckless.org/patches/sticky/)
|
|
||||||
- adds toggleable keyboard shortcut to make a client 'sticky', i.e. visible on all tags
|
|
||||||
|
|
||||||
- [swallow](https://dwm.suckless.org/patches/swallow/)
|
|
||||||
- this patch adds "window swallowing" to dwm as known from Plan 9's windowing system rio
|
|
||||||
- clients marked with isterminal in config.h swallow a window opened by any child process,
|
|
||||||
e.g. running xclock in a terminal
|
|
||||||
- closing the xclock window restores the terminal window in the current position
|
|
||||||
|
|
||||||
- [swapfocus](https://dwm.suckless.org/patches/swapfocus/)
|
|
||||||
- this patch depends on the pertag patch and makes it possible to switch focus with a single
|
|
||||||
shortcut (mod-s) instead of having to think if you should use mod-j or mod-k for reaching
|
|
||||||
the previously used window
|
|
||||||
|
|
||||||
- [swaptags](https://dwm.suckless.org/patches/swaptags/)
|
|
||||||
- allows swapping the contents of the currently selected tag with another tag by using
|
|
||||||
keyboard shortcuts
|
|
||||||
|
|
||||||
- [switchcol](https://dwm.suckless.org/patches/switchcol/)
|
|
||||||
- allows you to switch focus between the master and stack columns using a single keybinding
|
|
||||||
|
|
||||||
- [switchtag](https://github.com/bakkeby/patches/wiki/switchtag/)
|
|
||||||
- when an application opens on a specific tab this patch adds the option to also switch to
|
|
||||||
that tag when the application starts
|
|
||||||
- optionally, the previous view can also be restored when the client is closed
|
|
||||||
|
|
||||||
- [systray](https://dwm.suckless.org/patches/systray/)
|
|
||||||
- adds system tray in the status bar
|
|
||||||
|
|
||||||
- [tab](https://dwm.suckless.org/patches/tab/)
|
|
||||||
- transforms the monocle layout into a "tabbed" layout if more than one window is present on
|
|
||||||
the monocle view
|
|
||||||
- this is essentially just a specific bar
|
|
||||||
- the patch has been added for demonstration purposes only and has limited compatibility with
|
|
||||||
other patches
|
|
||||||
- it will conflict space-wise with a second bar
|
|
||||||
- note that fancybar, awesomebar, bartabgroups and similar patches make the tab patch
|
|
||||||
redundant
|
|
||||||
|
|
||||||
- [tagall](https://dwm.suckless.org/patches/tagall/)
|
|
||||||
- adds keyboard shortcuts to move all (or only floating) windows from one tag to another
|
|
||||||
|
|
||||||
- [tagallmon](https://github.com/bakkeby/patches/wiki/tagallmon/)
|
|
||||||
- move all visible windows to an adjacent monitor
|
|
||||||
|
|
||||||
- [tagintostack](https://dwm.suckless.org/patches/tagintostack/)
|
|
||||||
- makes new clients attach into the stack area when you toggle a new tag into view
|
|
||||||
- this means your master area will remain unchanged when toggling views
|
|
||||||
|
|
||||||
- [taggrid](https://dwm.suckless.org/patches/taggrid/)
|
|
||||||
- adds an option to place tags in rows like in many other window managers
|
|
||||||
|
|
||||||
- [taglabels](https://dwm.suckless.org/patches/taglabels/)
|
|
||||||
- shows tag + class of master client in the tags section of the bar
|
|
||||||
|
|
||||||
- [tagmonfixfs](https://github.com/bakkeby/patches/wiki/tagmonfixfs/)
|
|
||||||
- allows moving a fullscreen window to another monitor while remaining in fullscreen
|
|
||||||
|
|
||||||
- [tagothermonitor](https://dwm.suckless.org/patches/tagothermonitor/)
|
|
||||||
- adds functions and keybindings to tag a window to a desired tag on an adjacent monitor
|
|
||||||
|
|
||||||
- [tagpreview](https://dwm.suckless.org/patches/tag-previews/)
|
|
||||||
- shows a preview of a tag when hovering the tag icon using the mouse
|
|
||||||
|
|
||||||
- [tagswapmon](https://github.com/bakkeby/patches/wiki/tagswapmon/)
|
|
||||||
- swap all visible windows on one monitor with those of an adjacent monitor
|
|
||||||
|
|
||||||
- [tapresize](https://dwm.suckless.org/patches/tapresize/)
|
|
||||||
- allows resizing of windows using a touchpad
|
|
||||||
- uses vertical and horizontal scroll events allowing you to use one-finger tap for moving
|
|
||||||
windows and two-finger tap for resizing
|
|
||||||
|
|
||||||
- [~titlecolor~](https://dwm.suckless.org/patches/titlecolor/)
|
|
||||||
- ~adds a new color scheme used by the (selected) window title in the bar~
|
|
||||||
|
|
||||||
- [togglefullscreen](https://github.com/bakkeby/patches/wiki/togglefullscreen/)
|
|
||||||
- allows you to toggle fullscreen on and off using a single shortcut key
|
|
||||||
|
|
||||||
- [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
|
|
||||||
|
|
||||||
- [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
|
|
||||||
|
|
||||||
- [transfer](https://dwm.suckless.org/patches/transfer/)
|
|
||||||
- lets you transfer the currently focused client between the master and stack area while
|
|
||||||
increasing or decreasing the master area (nmaster) accordingly
|
|
||||||
|
|
||||||
- [transferall](https://dwm.suckless.org/patches/transfer/)
|
|
||||||
- lets you transfer all clients between the master and stack area while increasing or
|
|
||||||
decreasing the master area (nmaster) accordingly
|
|
||||||
|
|
||||||
- [underlinetags](https://dwm.suckless.org/patches/underlinetags/)
|
|
||||||
- underlines the selected tag, or optionally all tags
|
|
||||||
|
|
||||||
- [unfloatvisible](https://dwm.suckless.org/patches/unfloatvisible/)
|
|
||||||
- resets isfloating on any visible windows that have it set and optionally also applies a
|
|
||||||
layout
|
|
||||||
|
|
||||||
- [~urgentborder~](https://dwm.suckless.org/patches/urgentborder/)
|
|
||||||
- ~this patch makes "urgent" windows have different colors~
|
|
||||||
|
|
||||||
- [vanitygaps](https://github.com/bakkeby/patches/blob/master/dwm/dwm-vanitygaps-6.2.diff)
|
|
||||||
- adds configurable gaps between windows differentiating between outer, inner, horizontal and
|
|
||||||
vertical gaps
|
|
||||||
|
|
||||||
- viewhistory
|
|
||||||
- adds a tag change history that is longer than the default current and previous tag
|
|
||||||
- `MOD`+Tab (`view(0)`) can be pressed multiple times to go further back to earlier tag
|
|
||||||
selections
|
|
||||||
|
|
||||||
- [viewontag](https://dwm.suckless.org/patches/viewontag/)
|
|
||||||
- follow a window to the tag it is being moved to
|
|
||||||
|
|
||||||
- [vtcolor](https://dwm.suckless.org/patches/vtcolors/)
|
|
||||||
- this patch adds the ability for dwm to read colors from the linux virtual console
|
|
||||||
essentially allowing you to use the same color scheme as your regular tty
|
|
||||||
|
|
||||||
- [warp](https://dwm.suckless.org/patches/warp/)
|
|
||||||
- warps the mouse cursor to the center of the currently focused window or screen when the
|
|
||||||
mouse cursor is (a) on a different screen or (b) on top of a different window
|
|
||||||
|
|
||||||
- [winicon](https://dwm.suckless.org/patches/winicon/)
|
|
||||||
- adds the window icon next to the window title in the bar
|
|
||||||
|
|
||||||
- [windowrolerule](https://github.com/bakkeby/patches/wiki/windowrolerule/)
|
|
||||||
- sometimes a single application opens different windows depending on the task at hand and
|
|
||||||
this is often reflected in the WM_WINDOW_ROLE(STRING) x property
|
|
||||||
- this patch adds the role field to the rule configuration so that one can differentiate
|
|
||||||
between, say, Firefox "browser" vs "Preferences" vs "Manager" or Google-chrome "browser"
|
|
||||||
vs "pop-up".
|
|
||||||
|
|
||||||
- [winview](http://dwm.suckless.org/patches/winview/)
|
|
||||||
- allows switching the view to that of a given client from the all-window view (Mod-0) using
|
|
||||||
a keyboard shortcut
|
|
||||||
|
|
||||||
- [xkb](https://dwm.suckless.org/patches/xkb/)
|
|
||||||
- remembers keyboard layout per client
|
|
||||||
|
|
||||||
- [xrdb](http://dwm.suckless.org/patches/xrdb/)
|
|
||||||
- allows dwm to read colors from xrdb (.Xresources) during runtime
|
|
||||||
|
|
||||||
- [zoomfloating](https://www.reddit.com/r/suckless/comments/ie5fe3/zoomfloating_my_own_simple_original_patch/)
|
|
||||||
- a simple patch that allows floating windows to be zoomed into the master stack position
|
|
||||||
|
|
||||||
- [zoomswap](https://dwm.suckless.org/patches/zoomswap/)
|
|
||||||
- allows a master and a stack window to swap places rather than every window on the screen
|
|
||||||
changing position
|
|
||||||
|
|
||||||
### Layouts included:
|
|
||||||
|
|
||||||
- [bstack](https://dwm.suckless.org/patches/bottomstack/)
|
|
||||||
- bottomstack layout
|
|
||||||
|
|
||||||
- [bstackhoriz](https://dwm.suckless.org/patches/bottomstack/)
|
|
||||||
- bottomstack horizontal layout
|
|
||||||
|
|
||||||
- [centeredmaster](https://dwm.suckless.org/patches/centeredmaster/)
|
|
||||||
- centeredmaster layout
|
|
||||||
|
|
||||||
- [centeredfloatingmaster](https://dwm.suckless.org/patches/centeredmaster/)
|
|
||||||
- centeredfloatingmaster layout
|
|
||||||
|
|
||||||
- [columns](https://dwm.suckless.org/patches/columns/)
|
|
||||||
- same as the default tile layout except clients in the master area are arranged in columns
|
|
||||||
(i.e. left to right)
|
|
||||||
|
|
||||||
- [deck](https://dwm.suckless.org/patches/deck/)
|
|
||||||
- deck layout - clients in the stack area are arranged on top of each other (like monocle)
|
|
||||||
|
|
||||||
- [fibonacci](https://dwm.suckless.org/patches/fibonacci/)
|
|
||||||
- fibonacci (dwindle and spiral) layouts
|
|
||||||
|
|
||||||
- [flextile-deluxe](https://github.com/bakkeby/patches/wiki/flextile-deluxe/)
|
|
||||||
- a re-envisioned, flexible and over-the-top version of the original
|
|
||||||
[flextile](https://dwm.suckless.org/patches/flextile/) patch supporting
|
|
||||||
- multiple split layouts (horizontal, vertical, centered, floating, fixed)
|
|
||||||
- tile arrangement on a per split basis (stack horizontally, stack vertically, grids,
|
|
||||||
fibonacci)
|
|
||||||
- pertag, cfacts, rmaster, vanitygaps compatibility
|
|
||||||
- tile, deck, monocle, centeredmaster, bstack, bstackhoriz, gapplessgrid and more
|
|
||||||
- this gives you a lot of versatility in terms of layout
|
|
||||||
|
|
||||||
- [gapplessgrid](https://dwm.suckless.org/patches/gaplessgrid/)
|
|
||||||
- gappless grid layout
|
|
||||||
|
|
||||||
- [gridmode](https://dwm.suckless.org/patches/gridmode/)
|
|
||||||
- gridmode (grid) layout
|
|
||||||
|
|
||||||
- [horizgrid](https://dwm.suckless.org/patches/horizgrid/)
|
|
||||||
- horizontal grid layout
|
|
||||||
|
|
||||||
- [nrowgrid](https://dwm.suckless.org/patches/nrowgrid/)
|
|
||||||
- nrowgrid layout, number of rows in grid controlled by nmaster
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# ^c$var^ = fg color
|
|
||||||
# ^b$var^ = bg color
|
|
||||||
|
|
||||||
interval=0
|
|
||||||
|
|
||||||
# load colors
|
|
||||||
# . ~/.config/bar_themes/onedark
|
|
||||||
|
|
||||||
# colors
|
|
||||||
|
|
||||||
rosewater=#f4dbd6
|
|
||||||
flamingo=#f0c6c6
|
|
||||||
pink=#f5bde6
|
|
||||||
mauve=#c6a0f6
|
|
||||||
red=#ed8796
|
|
||||||
maroon=#ee99a0
|
|
||||||
peach=#f5a97f
|
|
||||||
yellow=#eed49f
|
|
||||||
green=#a6da95
|
|
||||||
teal=#8bd5ca
|
|
||||||
sky=#91d7e3
|
|
||||||
sapphire=#7dc4e4
|
|
||||||
blue=#8aadf4
|
|
||||||
lavender=#b7bdf8
|
|
||||||
text=#cad3f5
|
|
||||||
subtext1=#b8c0e0
|
|
||||||
subtext0=#a5adcb
|
|
||||||
overlay2=#939ab7
|
|
||||||
overlay1=#8087a2
|
|
||||||
overlay0=#6e738d
|
|
||||||
surface2=#5b6078
|
|
||||||
surface1=#494d64
|
|
||||||
surface0=#363a4f
|
|
||||||
base=#24273a
|
|
||||||
mantle=#1e2030
|
|
||||||
crust=#181926
|
|
||||||
|
|
||||||
pulse () {
|
|
||||||
VOL=$(pamixer --get-volume)
|
|
||||||
STATE=$(pamixer --get-mute)
|
|
||||||
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$STATE" = "true" ] || [ "$VOL" -eq 0 ]; then
|
|
||||||
printf "AMUT%%"
|
|
||||||
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
|
|
||||||
printf "A%s%%" "$VOL"
|
|
||||||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
|
|
||||||
printf "A%s%%" "$VOL"
|
|
||||||
else
|
|
||||||
printf "A%s%%" "$VOL"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
cpu() {
|
|
||||||
cpu_val=$(grep -o "^[^ ]*" /proc/loadavg)
|
|
||||||
|
|
||||||
printf "^c$crust^ ^b$yellow^ "
|
|
||||||
printf "^c$crust^ ^b$yellow^$cpu_val"
|
|
||||||
}
|
|
||||||
|
|
||||||
battery() {
|
|
||||||
capacity_0="$(cat /sys/class/power_supply/BAT0/capacity)"
|
|
||||||
capacity_1="$(cat /sys/class/power_supply/BAT1/capacity)"
|
|
||||||
|
|
||||||
capacity="$capacity_0+$capacity_1"
|
|
||||||
# capacity=$(((capacity_0 + capacity_1) / 2))
|
|
||||||
|
|
||||||
printf " B$capacity%% "
|
|
||||||
}
|
|
||||||
|
|
||||||
brightness() {
|
|
||||||
value=$(cat /sys/class/backlight/*/brightness)
|
|
||||||
percentage=$(echo "scale=2; $value / 8.54" | bc)
|
|
||||||
printf "L%.0f%%" "$percentage"
|
|
||||||
}
|
|
||||||
|
|
||||||
mem() {
|
|
||||||
printf "^c$crust^^b$green^ "
|
|
||||||
printf "^c$crust^^b$green^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
|
|
||||||
}
|
|
||||||
|
|
||||||
wlan() {
|
|
||||||
case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in
|
|
||||||
up) printf "^c$crust^ ^b$blue^ ^c$crust^ ^b$blue^Connected" ;;
|
|
||||||
down) printf "^c$crust^ ^b$blue^ ^c$crust^ ^b$blue^Disconnected" ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
clock() {
|
|
||||||
printf " $(date '+%I:%M %P') "
|
|
||||||
}
|
|
||||||
|
|
||||||
today() {
|
|
||||||
printf " $(date '+%b %e') "
|
|
||||||
}
|
|
||||||
|
|
||||||
net() {
|
|
||||||
if nc -zw1 google.com 443; then
|
|
||||||
printf "^c$crust^^b$green^ i "
|
|
||||||
else
|
|
||||||
printf "^c$crust^^b$red^ ! "
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
|
|
||||||
# [ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates)
|
|
||||||
# interval=$((interval + 1))
|
|
||||||
|
|
||||||
# sleep 1 && xsetroot -name "$updates $(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)"
|
|
||||||
# sleep 1 && xsetroot -name "$(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)"
|
|
||||||
if hash dockd 2>/dev/null; then
|
|
||||||
sleep 1 && xsetroot -name "^c$text^^b$surface0^ $(brightness) ^b$base^ $(battery) $(net)^c$text^^b$base^ $(today) ^b$surface0^ $(clock) ^b$surface1^ $(pulse) "
|
|
||||||
else
|
|
||||||
sleep 1 && xsetroot -name "^c$text^$(net)^c$text^^b$base^ $(today) ^b$surface0^ $(clock) ^b$surface1^ $(pulse) "
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# Contributing to dwm-bar
|
|
||||||
One goal of this project is to support as many (reasonable) plugins as possible which the user can enable or disable depending on their needs. This means that new plugins will almost always be a welcome addition.
|
|
||||||
To ensure that dwm-bar stays compatible, uniform, and efficient there are a few guidelines that should be followed.
|
|
||||||
|
|
||||||
The most important part of this project is to have fun using shell scripts. I created this project to learn, and learning only happens when mistakes are made, so don't worry too much.
|
|
||||||
## Making/editing a plugin
|
|
||||||
* Ensure that plugins are POSIX compliant (use ```#!/bin/sh``` instead of ```#!/bin/bash``` etc.). A good way to check this is by using [ShellCheck](https://www.shellcheck.net/) on your script and amending compatibility errors.
|
|
||||||
* Display plugin output in the terminal. This is easily done by wiriting the plugin in a function and calling the function at the end of the script. This helps with debugging and spotting errors.
|
|
||||||
* Include a dependencies section at the top of the script (```Dependencies: example1, example2```).
|
|
||||||
## Editing dwm_bar.sh
|
|
||||||
* Do not remove functions from the main script.
|
|
||||||
## Editing README.md
|
|
||||||
* When adding a plugin to README.md, follow this template:
|
|
||||||
```
|
|
||||||
### plugin_name
|
|
||||||
Description of the plugin
|
|
||||||
```
|
|
||||||
[❗ Plugin output on bar]
|
|
||||||
```
|
|
||||||
Dependencies: example1, example2
|
|
||||||
```
|
|
||||||
* Ensure additons are added to the table of contents:
|
|
||||||
```
|
|
||||||
- [Current Functions])(#current-functions)
|
|
||||||
-[plugin_name](#plugin_name)
|
|
||||||
```
|
|
||||||
## Edditing Dependency Listings
|
|
||||||
* When adding a plugin, please add your dependencies to the dependency listing file in dep folder.
|
|
||||||
@@ -1,674 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
||||||
@@ -1,265 +0,0 @@
|
|||||||
# dwm-bar
|
|
||||||
A modular statusbar for dwm
|
|
||||||

|
|
||||||
## Table of Contents
|
|
||||||
- [Installation](#installation)
|
|
||||||
- [Configuration](#configuration)
|
|
||||||
- [Enabling Functions](#enabling-functions)
|
|
||||||
- [Refresh Rate](#refresh-rate)
|
|
||||||
- [Configuring Functions](#configuring-functions)
|
|
||||||
- [Identifiers](#identifiers)
|
|
||||||
- [Current Functions](#current-functions)
|
|
||||||
- [dwm_alsa](#dwm_alsa)
|
|
||||||
- [dwm_pulse](#dwm_pulse)
|
|
||||||
- [dwm_battery](#dwm_battery)
|
|
||||||
- [dwm_countdown](#dwm_countdown)
|
|
||||||
- [dwm_alarm](#dwm_alarm)
|
|
||||||
- [dwm_keyboard](#dwm_keyboard)
|
|
||||||
- [dwm_resources](#dwm_resources)
|
|
||||||
- [dwm_cmus](#dwm_cmus)
|
|
||||||
- [dwm_mpc](#dwm_mpc)
|
|
||||||
- [dwm_spotify](#dwm_mpc)
|
|
||||||
- [dwm_date](#dwm_date)
|
|
||||||
- [dwm_mail](#dwm_mail)
|
|
||||||
- [dwm_weather](#dwm_weather)
|
|
||||||
- [dwm_networkmanager](#dwm_networkmanager)
|
|
||||||
- [dwm_wpa](#dwm_wpa)
|
|
||||||
- [dwm_vpn](#dwm_vpn)
|
|
||||||
- [dwm_ccurse](#dwm_ccurse)
|
|
||||||
- [dwm_transmission](#dwm_transmission)
|
|
||||||
- [dwm_backlight](#dwm_backlight)
|
|
||||||
- [dwm_connman](#dwm_connman)
|
|
||||||
- [dwm_loadavg](#dwm_loadavg)
|
|
||||||
- [dwm_currency](#dwm_currency)
|
|
||||||
- [dwm_solar_panel](#dwm_solar_panel)
|
|
||||||
- [dwm_network_speed](#dwm_network_speed)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
- [Acknowledgements](#acknowledgements)
|
|
||||||
> :warning: While I try to be as active as I can be, it may take me some time to resolve issues as I am much busier these days than when I started this project. I appreciate ALL contributions and will try my best to respond as soon as I am able to. Thank you for understanding :) - @joestandring
|
|
||||||
## Installation
|
|
||||||
1. Clone and enter the repository:
|
|
||||||
```
|
|
||||||
git clone https://github.com/joestandring/dwm-bar
|
|
||||||
cd dwm-bar
|
|
||||||
```
|
|
||||||
2. (Optional) Install Dependencies from ```dep/YourDisto.txt```. This will install dependencies for ALL functions so consider excluding ones you do not plan to use. These can be found at the top of each bar function.
|
|
||||||
```
|
|
||||||
sudo xbps-install -S $(cat dep/void.txt) # Void
|
|
||||||
sudo pacman -S $(cat dep/arch.txt) # Arch
|
|
||||||
sudo dnf install $(cat dep/fedora.txt) # Fedora
|
|
||||||
```
|
|
||||||
> :warning: There are no dnf packages for [spotifyd](https://github.com/Spotifyd/spotifyd), [pamixer](https://github.com/cdemoulins/pamixer) and [cmus](https://github.com/cmus/cmus). If you want to utilise these packages, please install them manually as shown in the corresponding gihub repos.
|
|
||||||
3. (Optional) If you plan to use unicode identifiers, you should install a font which includes these ([Nerd Fonts](https://github.com/ryanoasis/nerd-fonts), [siji](https://github.com/stark/siji))
|
|
||||||
4. Enable/disable desired functions (see [Configuration](#configuration)).
|
|
||||||
5. Run the script
|
|
||||||
```
|
|
||||||
./dwm_bar.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
dwm-bar will require some setup before it can be used.
|
|
||||||
### Enabling Functions
|
|
||||||
Functions can be enabled by adding them to the import and upperbar variable in dwm_bar.sh. By default, all available functions will be commented here. If you are using the [extrabar](https://dwm.suckless.org/patches/extrabar/) patch, functions can also be added to lowerbar to appear on the bottom of the screen. Some more intensive functions are parallelized to prevent the bar freezing. These are imported the same as regular functions but added to the ```parallelize()``` function first. These use different names to regular functions and are commented out by default in dwm_bar.sh.
|
|
||||||
|
|
||||||
To enable dwm_battery and dwm_backlight on the top bar and dwm_pulse and dwm_weather (parallelized) on the bottom bar, for example, you should use:
|
|
||||||
```
|
|
||||||
# Import the modules
|
|
||||||
. "$DIR/bar-functions/dwm_battery.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_backlight.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_pulse.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_weather.sh"
|
|
||||||
|
|
||||||
parallelize() {
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
printf "Running parallel processes\n"
|
|
||||||
dwm_weather &
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
}
|
|
||||||
parallelize &
|
|
||||||
|
|
||||||
# Update dwm status bar every second
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
# Append results of each func one by one to the upperbar string
|
|
||||||
upperbar=""
|
|
||||||
upperbar="$upperbar$(dwm_battery)"
|
|
||||||
upperbar="$upperbar$(dwm_backlight)"
|
|
||||||
|
|
||||||
# Append results of each func one by one to the lowerbar string
|
|
||||||
lowerbar=""
|
|
||||||
lowerbar="$lowerbar$(dwm_pulse)"
|
|
||||||
lowerbar="$lowerbar$(__DWM_BAR_WEATHER__)"
|
|
||||||
|
|
||||||
#xsetroot -name "$upperbar"
|
|
||||||
|
|
||||||
# Uncomment the line below to enable the lowerbar
|
|
||||||
xsetroot -name "$upperbar;$lowerbar"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
```
|
|
||||||
### Refresh rate
|
|
||||||
If updating the bar every second is an issue, you can change the ```sleep``` amount of both regular and parallelized functions in dwm_bar.sh.
|
|
||||||
### Configuring functions
|
|
||||||
Some functions, such as dwm_weather require additional setup and will be outlined with a comment where this is the case.
|
|
||||||
### Identifiers
|
|
||||||
Unicode or plaintext identifiers can be used by altering the ```$IDENTIFIER``` value in dwm_bar.sh. For example, when set to ```"unicode"```, dwm_mail will display:
|
|
||||||
```
|
|
||||||
[📫 0]
|
|
||||||
```
|
|
||||||
Otherwise, when not set it will display:
|
|
||||||
```
|
|
||||||
[MAIL 0]
|
|
||||||
```
|
|
||||||
## Current Functions
|
|
||||||
### dwm_alsa
|
|
||||||
Displays the current master volume of ALSA
|
|
||||||
```
|
|
||||||
[🔉 55%]
|
|
||||||
```
|
|
||||||
Dependencies: ```alsa-utils```
|
|
||||||
### dwm_pulse
|
|
||||||
Displays the current master volume of PulseAudio
|
|
||||||
```
|
|
||||||
[🔉 55%]
|
|
||||||
```
|
|
||||||
Dependencies: ```pamixer```
|
|
||||||
### dwm_battery
|
|
||||||
Displays battery level and status
|
|
||||||
```
|
|
||||||
[🔋 100% full]
|
|
||||||
```
|
|
||||||
### dwm_countdown
|
|
||||||
Displays the status of [countdown](https://github.com/joestandring/countdown)
|
|
||||||
```
|
|
||||||
[⏳ 00:10:00]
|
|
||||||
```
|
|
||||||
Dependencies: ```countdown.sh```
|
|
||||||
### dwm_alarm
|
|
||||||
Displays upcoming alarms from [alarm](https://github.com/joestandring/alarm)
|
|
||||||
```
|
|
||||||
[⏰ 22:30:00]
|
|
||||||
```
|
|
||||||
Dependencies: ```alarm.sh```
|
|
||||||
### dwm_keyboard
|
|
||||||
Displays the current keyboard layout
|
|
||||||
```
|
|
||||||
[⌨ gb]
|
|
||||||
```
|
|
||||||
Dependencies: ```xorg-setxkbmap```
|
|
||||||
### dwm_resources
|
|
||||||
Displays information regarding memory, CPU temperature, and storage
|
|
||||||
```
|
|
||||||
[🖥 MEM 1.3Gi/15Gi CPU 45C STO 2.3G/200G: 2%]
|
|
||||||
```
|
|
||||||
### dwm_cmus
|
|
||||||
Displays current cmus status, artist, track, position, duration, and shuffle
|
|
||||||
```
|
|
||||||
[▶ The Unicorns - Tuff Ghost 0:43/2:56 🔀]
|
|
||||||
```
|
|
||||||
Dependencies: ```cmus```
|
|
||||||
### dwm_mpc
|
|
||||||
Displays current mpc status, artist, track, position, duration, and shuffle
|
|
||||||
```
|
|
||||||
[▶ The Unicorns - Tuff Ghost 0:43/2:56 🔀]
|
|
||||||
```
|
|
||||||
Dependencies: ```mpc```
|
|
||||||
### dwm_spotify
|
|
||||||
Displays current Spotify status, artist, track, and duration
|
|
||||||
|
|
||||||
Either the official Spotify client or spotifyd can be used. Unfortunately, only spotifyd can provide track position and shuffle status
|
|
||||||
```
|
|
||||||
[▶ The Unicorns - Tuff Ghost 0:43/2:56 🔀]
|
|
||||||
```
|
|
||||||
Dependencies: ```spotify/spotifyd, playerctl```
|
|
||||||
|
|
||||||
### dwm_date
|
|
||||||
Displays the current date and time
|
|
||||||
```
|
|
||||||
[🕰 Mon 06-05-19 21:31:58]
|
|
||||||
```
|
|
||||||
### dwm_mail
|
|
||||||
Displays the current number of emails in an inbox
|
|
||||||
```
|
|
||||||
[📫 2]
|
|
||||||
```
|
|
||||||
### dwm_weather
|
|
||||||
Displays the current weather provided by [wttr.in](https://wttr.in)
|
|
||||||
|
|
||||||
Please remember wttr.in has a limited number of requests, so this module may occasionally not be able to recieve weather information when experiencing high traffic.
|
|
||||||
```
|
|
||||||
[☀ +20°C]
|
|
||||||
```
|
|
||||||
### dwm_networkmanager
|
|
||||||
Displays the current network connection, private IP, and public IP using NetworkManager
|
|
||||||
```
|
|
||||||
[🌐 enp7s0: 192.168.0.1/24 | 185.199.109.153]
|
|
||||||
```
|
|
||||||
Dependencies: ```NetworkManager, curl```
|
|
||||||
### dwm_wpa
|
|
||||||
Displays the current network connection and private IP using wpa_cli
|
|
||||||
```
|
|
||||||
[襤 My-Wifi 192.168.0.3]
|
|
||||||
```
|
|
||||||
Dependencies: ```wpa_cli```
|
|
||||||
### dwm_vpn
|
|
||||||
Displays the current VPN connections with OpenVPN or Wireguard
|
|
||||||
```
|
|
||||||
[🔒 Sweden - Stockholm]
|
|
||||||
```
|
|
||||||
Dependencies: ```NetworkManager, NetworkManager-openvpn (for OpenVPN connections)```
|
|
||||||
### dwm_ccurse
|
|
||||||
Displays the next appointment from calcurse
|
|
||||||
```
|
|
||||||
[💡 18/04/19 19:00 20:00 Upload dwm_ccurse]
|
|
||||||
```
|
|
||||||
Dependencies: ```calcurse```
|
|
||||||
### dwm_transmission
|
|
||||||
Displays the current status of a torrent with transmission-remote
|
|
||||||
```
|
|
||||||
[⏬ archlinux-2019.06.01... | 92% 1min ⬆3.4 ⬇1.5]
|
|
||||||
```
|
|
||||||
Dependencies: ```transmission-remote```
|
|
||||||
### dwm_backlight
|
|
||||||
Displays the current backlight level with xbacklight
|
|
||||||
```
|
|
||||||
[☀ 80]
|
|
||||||
```
|
|
||||||
Dependencies: ```xbacklight```
|
|
||||||
### dwm_connman
|
|
||||||
Shows network information IP, SSID, WLan strength (if connected to WLan) using connman.
|
|
||||||
```
|
|
||||||
[🌐 192.169.189.12 HomeNetworkName 53%]
|
|
||||||
```
|
|
||||||
Dependencies: ```connman```
|
|
||||||
### dwm_loadavg
|
|
||||||
Displays the average system load
|
|
||||||
```
|
|
||||||
[⏱ 0.14 0.17 0.18]
|
|
||||||
```
|
|
||||||
### dwm_solar_panel
|
|
||||||
Displays how much power is being produced from your solar panels
|
|
||||||
```
|
|
||||||
[💡 3.012 W ]
|
|
||||||
```
|
|
||||||
### dwm_currency
|
|
||||||
Displays the current rate of your currency in comparison to the USD provided by [rate.sx](http://rate.sx/)
|
|
||||||
```
|
|
||||||
[💡 1.225 ]
|
|
||||||
```
|
|
||||||
Dependencies: ```curl```
|
|
||||||
### dwm_network_speed
|
|
||||||
Displays the speed of download and upload.
|
|
||||||
```
|
|
||||||
[李 0KB/s 0KB/s]
|
|
||||||
```
|
|
||||||
## Contributing
|
|
||||||
See [CONTRIBUTING.md](CONTRIBUTING.md) before contributing.
|
|
||||||
## Acknowledgements
|
|
||||||
Code for some functions was modified from:
|
|
||||||
* [Klemens Nanni](https://notabug.org/kl3)
|
|
||||||
* [@boylemic](https://github.com/boylemic/configs/blob/master/dwm_status)
|
|
||||||
* [Parket Johnson](https://github.com/ronno/scripts/blob/master/xsetcmus)
|
|
||||||
* [suckless.org](https://dwm.suckless.org/status_monitor/)
|
|
||||||
* [@mcallistertyler95](https://github.com/mcallistertyler95/dwm-bar)
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_status function that displays upcoming alarms from alarm.sh
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: https://github.com/joestandring/alarm
|
|
||||||
|
|
||||||
dwm_alarm () {
|
|
||||||
for f in /tmp/alarm.*; do
|
|
||||||
if [ -e "$f" ]; then
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "⏰ %s" "$(cat /tmp/alarm.*)"
|
|
||||||
else
|
|
||||||
printf "ALM %s" "$(cat /tmp/alarm.*)"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_alarm
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to show the master volume of ALSA
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: alsa-utils
|
|
||||||
|
|
||||||
dwm_alsa () {
|
|
||||||
STATUS=$(amixer sget Master | tail -n1 | sed -r "s/.*\[(.*)\]/\1/")
|
|
||||||
VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
if [ "$STATUS" = "off" ]; then
|
|
||||||
printf "🔇"
|
|
||||||
else
|
|
||||||
#removed this line becuase it may get confusing
|
|
||||||
if [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
|
|
||||||
printf "🔈 %s%%" "$VOL"
|
|
||||||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
|
|
||||||
printf "🔉 %s%%" "$VOL"
|
|
||||||
else
|
|
||||||
printf "🔊 %s%%" "$VOL"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$STATUS" = "off" ]; then
|
|
||||||
printf "MUTE"
|
|
||||||
else
|
|
||||||
# removed this line because it may get confusing
|
|
||||||
if [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
|
|
||||||
printf "VOL %s%%" "$VOL"
|
|
||||||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
|
|
||||||
printf "VOL %s%%" "$VOL"
|
|
||||||
else
|
|
||||||
printf "VOL %s%%" "$VOL"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_alsa
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar module to display the current backlight brighness with xbacklight
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: xbacklight
|
|
||||||
|
|
||||||
dwm_backlight () {
|
|
||||||
printf "%s☀ %.0f%s\n" "$SEP1" "$(xbacklight)" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_backlight
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to read the battery level and status
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
dwm_battery () {
|
|
||||||
# Change BAT1 to whatever your battery is identified as. Typically BAT0 or BAT1
|
|
||||||
CHARGE=$(cat /sys/class/power_supply/BAT1/capacity)
|
|
||||||
STATUS=$(cat /sys/class/power_supply/BAT1/status)
|
|
||||||
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
if [ "$STATUS" = "Charging" ]; then
|
|
||||||
printf "🔌 %s%% %s" "$CHARGE" "$STATUS"
|
|
||||||
else
|
|
||||||
printf "🔋 %s%% %s" "$CHARGE" "$STATUS"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
printf "BAT %s%% %s" "$CHARGE" "$STATUS"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_battery
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to show the closest appointment in calcurse
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: calcurse
|
|
||||||
|
|
||||||
dwm_ccurse () {
|
|
||||||
APTSFILE="$HOME/.calcurse/apts"
|
|
||||||
APPOINTMENT=$(head -n 1 "$APTSFILE" | sed -r 's/\[1\] //')
|
|
||||||
|
|
||||||
if [ "$APPOINTMENT" != "" ]; then
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "💡 %s" "$APPOINTMENT"
|
|
||||||
else
|
|
||||||
printf "APT %s" "$APPOINTMENT"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_ccurse
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function that shows the current artist, track, position, duration, and status from cmus
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: cmus
|
|
||||||
|
|
||||||
dwm_cmus () {
|
|
||||||
if ps -C cmus > /dev/null; then
|
|
||||||
CMUSDATA=$(cmus-remote -Q)
|
|
||||||
ARTIST=$(echo "$CMUSDATA" | grep -w '^tag artist' | awk '{gsub("tag artist ", "");print}')
|
|
||||||
TRACK=$(echo "$CMUSDATA" | grep -w '^tag title' | awk '{gsub("tag title ", "");print}')
|
|
||||||
POSITION=$(echo "$CMUSDATA" | grep -w '^position' | awk '{gsub("position ", "");print}')
|
|
||||||
DURATION=$(echo "$CMUSDATA" | grep -w '^duration' | awk '{gsub("duration ", "");print}')
|
|
||||||
STATUS=$(echo "$CMUSDATA" | grep -w '^status' | awk '{gsub("status ", "");print}')
|
|
||||||
SHUFFLE=$(echo "$CMUSDATA" | grep -w '^set shuffle' | awk '{gsub("set shuffle ", "");print}')
|
|
||||||
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
if [ "$STATUS" = "playing" ]; then
|
|
||||||
STATUS="▶"
|
|
||||||
else
|
|
||||||
STATUS="⏸"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SHUFFLE" = "true" ]; then
|
|
||||||
SHUFFLE=" 🔀"
|
|
||||||
else
|
|
||||||
SHUFFLE=""
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$STATUS" = "playing" ]; then
|
|
||||||
STATUS="PLA"
|
|
||||||
else
|
|
||||||
STATUS="PAU"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SHUFFLE" = "true" ]; then
|
|
||||||
SHUFFLE=" S"
|
|
||||||
else
|
|
||||||
SHUFFLE=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "%s%s %s - %s " "$SEP1" "$STATUS" "$ARTIST" "$TRACK"
|
|
||||||
printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
|
|
||||||
printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
|
|
||||||
printf "%s%s\n" "$SHUFFLE" "$SEP2"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_cmus
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to show the current network connection/SSID, Wifi Strength, private IP using Connmanctl.
|
|
||||||
# procrastimax <heykeroth.dev@gmail.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: connman
|
|
||||||
|
|
||||||
dwm_connman () {
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "🌐 "
|
|
||||||
else
|
|
||||||
printf "NET "
|
|
||||||
fi
|
|
||||||
|
|
||||||
# get the connmanctl service name
|
|
||||||
# this is a UID starting with 'vpn_', 'wifi_', or 'ethernet_', we dont care for the vpn one
|
|
||||||
# if the servicename string is empty, there is no online connection
|
|
||||||
SERVICENAME=$(connmanctl services | grep -E "^\*AO|^\*O" | grep -Eo 'wifi_.*|ethernet_.*')
|
|
||||||
|
|
||||||
if [ ! "$SERVICENAME" ]; then
|
|
||||||
printf "OFFLINE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
return
|
|
||||||
else
|
|
||||||
STRENGTH=$(connmanctl services "$SERVICENAME" | sed -n -e 's/Strength =//p' | tr -d ' ')
|
|
||||||
CONNAME=$(connmanctl services "$SERVICENAME" | sed -n -e 's/Name =//p' | tr -d ' ')
|
|
||||||
IP=$(connmanctl services "$SERVICENAME" | grep 'IPv4 =' | awk '{print $5}' | sed -n -e 's/Address=//p' | tr -d ',')
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if STRENGTH is empty, we have a wired connection
|
|
||||||
if [ "$STRENGTH" ]; then
|
|
||||||
printf "%s %s %s%%" "$IP" "$CONNAME" "$STRENGTH"
|
|
||||||
else
|
|
||||||
printf "%s %s" "$IP" "$CONNAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_connman
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_status function that displays the status of countdown.sh
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: https://github.com/joestandring/countdown
|
|
||||||
|
|
||||||
dwm_countdown () {
|
|
||||||
for f in /tmp/countdown.*; do
|
|
||||||
if [ -e "$f" ]; then
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "⏳ %s" "$(tail -1 /tmp/countdown.*)"
|
|
||||||
else
|
|
||||||
printf "CDN %s" "$(tail -1 /tmp/countdown.*)"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_countdown
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to print the rate of CURRENCY/USD from rate.sx using rate.sx/1CURRENCY
|
|
||||||
# Creator of the project: Joe Standring <git@joestandring.com>
|
|
||||||
# Additional plugin added by Brayan de Albuquerque <brayandealbuquerque@gmail.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: curl
|
|
||||||
|
|
||||||
# Change the value of CURRENCY to match your currency code
|
|
||||||
dwm_currency() {
|
|
||||||
CURRENCY=EUR
|
|
||||||
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "%s" "$(curl -s rate.sx/1$CURRENCY)"
|
|
||||||
else
|
|
||||||
printf "%s %.5s" "$CURRENCY" "$(curl -s rate.sx/1$CURRENCY)"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_currency
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function that shows the current date and time
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Date is formatted like like this: "[Mon 01-01-00 00:00:00]"
|
|
||||||
dwm_date () {
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "📆 %s" "$(date "+%a %d-%m-%y %T")"
|
|
||||||
else
|
|
||||||
printf "DAT %s" "$(date "+%a %d-%m-%y %T")"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_date
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function that displays the current keyboard layout
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: xorg-setxkbmap
|
|
||||||
|
|
||||||
dwm_keyboard () {
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "⌨ %s" "$(setxkbmap -query | awk '/layout/{print $2}')"
|
|
||||||
else
|
|
||||||
printf "KEY %s" "$(setxkbmap -query | awk '/layout/{print $2}')"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_keyboard
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to read the average system load
|
|
||||||
# Alvar Penning <post@0x21.biz>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
dwm_loadavg () {
|
|
||||||
# LOAD_FIELDS specifies the load average values to be displayed. Values
|
|
||||||
# within 1-3 are allowed, passed as a range (-) or comma-separated.
|
|
||||||
# - 1: load average within the last minute
|
|
||||||
# - 2: load average within the last five minutes
|
|
||||||
# - 3: load average within the last fifteen minutes
|
|
||||||
LOAD_FIELDS=1,2,3
|
|
||||||
|
|
||||||
LOAD_AVG=$(cut -d " " -f ${LOAD_FIELDS} /proc/loadavg)
|
|
||||||
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "⏱ %s" "$LOAD_AVG"
|
|
||||||
else
|
|
||||||
printf "AVG %s" "$LOAD_AVG"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_loadavg
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to display the number of emails in an inbox
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# To count mail in an inbox, change "/path/to/inbox" below to the location of your inbox. For example, "/home/$USER/.mail/new"
|
|
||||||
|
|
||||||
dwm_mail () {
|
|
||||||
MAILBOX=$(ls /path/to/inbox | wc -l)
|
|
||||||
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
if [ "$MAILBOX" -eq 0 ]; then
|
|
||||||
printf "📪 %s" "$MAILBOX"
|
|
||||||
else
|
|
||||||
printf "📫 %s" "$MAILBOX"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
printf "MAI %s" "$MAILBOX"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_mail
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function that shows the current artist, track, position, duration, and status from mpc
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: mpc
|
|
||||||
|
|
||||||
dwm_mpc () {
|
|
||||||
if ps -C mpd > /dev/null; then
|
|
||||||
ARTIST=$(mpc current -f %artist%)
|
|
||||||
TRACK=$(mpc current -f %title%)
|
|
||||||
POSITION=$(mpc status | grep "%)" | awk '{ print $3 }' | awk -F/ '{ print $1 }')
|
|
||||||
DURATION=$(mpc current -f %time%)
|
|
||||||
STATUS=$(mpc status | sed -n 2p | awk '{print $1;}')
|
|
||||||
SHUFFLE=$(mpc status | tail -n 1 | awk '{print $6}')
|
|
||||||
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
if [ "$STATUS" = "[playing]" ]; then
|
|
||||||
STATUS="▶"
|
|
||||||
else
|
|
||||||
STATUS="⏸"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SHUFFLE" = "on" ]; then
|
|
||||||
SHUFFLE=" 🔀"
|
|
||||||
else
|
|
||||||
SHUFFLE=""
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$STATUS" = "[playing]" ]; then
|
|
||||||
STATUS="PLA"
|
|
||||||
else
|
|
||||||
STATUS="PAU"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SHUFFLE" = "on" ]; then
|
|
||||||
SHUFFLE=" S"
|
|
||||||
else
|
|
||||||
SHUFFLE=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "%s%s %s - %s %s/%s%s%s" "$SEP1" "$STATUS" "$ARTIST" "$TRACK" "$POSITION" "$DURATION" "$SHUFFLE" "$SEP2"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_mpc
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to show the speed of download and upload.
|
|
||||||
# Johan Chane <johanchanex@gmail.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies:
|
|
||||||
|
|
||||||
# This function parses /proc/net/dev file searching for a line containing $interface data.
|
|
||||||
# Within that line, the first and ninth numbers after ':' are respectively the received and transmited bytes.
|
|
||||||
# parameters: name_of_received_bytes, name_of_transmitted_bytes
|
|
||||||
function get_bytes {
|
|
||||||
# Find active network interface
|
|
||||||
#interface=$(ip route get 8.8.8.8 2>/dev/null | grep 'dev \S\+' -o | awk '{print $2}')
|
|
||||||
local interface=$(route | grep '^default' | grep -o '[^ ]*$')
|
|
||||||
local bytes_concat_args=$(grep ${interface:-lo} /proc/net/dev | cut -d ':' -f 2 | awk -v rb="$1" -v tb="$2" '{print rb"="$1, tb"="$9}')
|
|
||||||
eval $bytes_concat_args
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function which calculates the speed using actual and old byte number.
|
|
||||||
# Speed is shown in KByte per second when greater or equal than 1 KByte per second.
|
|
||||||
# This function should be called each second.
|
|
||||||
# parameters: value, old_value, now, old_time
|
|
||||||
function get_velocity {
|
|
||||||
local timediff=$(($3 - $4))
|
|
||||||
local vel_kb=$(echo "1000000000 * ($1 - $2) / 1024 / $timediff" | bc)
|
|
||||||
if test "$vel_kb" -gt 1024; then
|
|
||||||
echo $(echo "scale = 2; $vel_kb / 1024" | bc)MB/s
|
|
||||||
else
|
|
||||||
echo ${vel_kb}KB/s
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function dwm_network_speed_record {
|
|
||||||
get_bytes 'received_bytes' 'transmitted_bytes'
|
|
||||||
old_received_bytes=$received_bytes
|
|
||||||
old_transmitted_bytes=$transmitted_bytes
|
|
||||||
|
|
||||||
old_time=$(date +%s%N)
|
|
||||||
}
|
|
||||||
|
|
||||||
function download_speed {
|
|
||||||
get_velocity $received_bytes $old_received_bytes $now $old_time
|
|
||||||
}
|
|
||||||
|
|
||||||
function upload_speed {
|
|
||||||
get_velocity $transmitted_bytes $old_transmitted_bytes $now $old_time
|
|
||||||
}
|
|
||||||
|
|
||||||
# The greater interval ($now - $old_time) is, the be exacter the speed is.
|
|
||||||
function dwm_network_speed {
|
|
||||||
get_bytes 'received_bytes' 'transmitted_bytes'
|
|
||||||
now=$(date +%s%N)
|
|
||||||
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "李 %s %s" "$(download_speed)" "$(upload_speed)"
|
|
||||||
else
|
|
||||||
printf "Net %s %s" "$(download_speed)" "$(upload_speed)"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_network_speed_record
|
|
||||||
dwm_network_speed
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to show the current network connection/SSID, private IP, and public IP using NetworkManager
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: NetworkManager, curl
|
|
||||||
|
|
||||||
dwm_networkmanager () {
|
|
||||||
CONNAME=$(nmcli -a | grep 'Wired connection' | awk 'NR==1{print $1}')
|
|
||||||
if [ "$CONNAME" = "" ]; then
|
|
||||||
CONNAME=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -c 5-)
|
|
||||||
fi
|
|
||||||
|
|
||||||
PRIVATE=$(nmcli -a | grep 'inet4 192' | awk '{print $2}')
|
|
||||||
PUBLIC=$(curl -s https://ipinfo.io/ip)
|
|
||||||
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
export __DWM_BAR_NETWORKMANAGER__="${SEP1}🌐 ${CONNAME} ${PRIVATE} ${PUBLIC}${SEP2}"
|
|
||||||
else
|
|
||||||
export __DWM_BAR_NETWORKMANAGER__="${SEP1}NET ${CONNAME} ${PRIVATE} ${PUBLIC}${SEP2}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_networkmanager
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to show the master volume of PulseAudio
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: pamixer
|
|
||||||
|
|
||||||
dwm_pulse () {
|
|
||||||
VOL=$(pamixer --get-volume)
|
|
||||||
STATE=$(pamixer --get-mute)
|
|
||||||
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
if [ "$STATE" = "true" ] || [ "$VOL" -eq 0 ]; then
|
|
||||||
printf "🔇"
|
|
||||||
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
|
|
||||||
printf "🔈 %s%%" "$VOL"
|
|
||||||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
|
|
||||||
printf "🔉 %s%%" "$VOL"
|
|
||||||
else
|
|
||||||
printf "🔊 %s%%" "$VOL"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$STATE" = "true" ] || [ "$VOL" -eq 0 ]; then
|
|
||||||
printf "MUTE"
|
|
||||||
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
|
|
||||||
printf "VOL %s%%" "$VOL"
|
|
||||||
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
|
|
||||||
printf "VOL %s%%" "$VOL"
|
|
||||||
else
|
|
||||||
printf "VOL %s%%" "$VOL"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_pulse
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to display information regarding system memory, CPU temperature, and storage
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
df_check_location='/home'
|
|
||||||
|
|
||||||
dwm_resources () {
|
|
||||||
# get all the infos first to avoid high resources usage
|
|
||||||
free_output=$(free -h | grep Mem)
|
|
||||||
df_output=$(df -h $df_check_location | tail -n 1)
|
|
||||||
# Used and total memory
|
|
||||||
MEMUSED=$(echo $free_output | awk '{print $3}')
|
|
||||||
MEMTOT=$(echo $free_output | awk '{print $2}')
|
|
||||||
# CPU temperature
|
|
||||||
CPU=$(top -bn1 | grep Cpu | awk '{print $2}')%
|
|
||||||
#CPU=$(sysctl -n hw.sensors.cpu0.temp0 | cut -d. -f1)
|
|
||||||
# Used and total storage in /home (rounded to 1024B)
|
|
||||||
STOUSED=$(echo $df_output | awk '{print $3}')
|
|
||||||
STOTOT=$(echo $df_output | awk '{print $2}')
|
|
||||||
STOPER=$(echo $df_output | awk '{print $5}')
|
|
||||||
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "💻 MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
|
|
||||||
else
|
|
||||||
printf "STA | MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_resources
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# This module can get data from a SMA Inverter.
|
|
||||||
# Its purpose is to show you how much Watts are being produced
|
|
||||||
# To make it work change the INVERTER_IP variable and your User password
|
|
||||||
# Vincenzo Petrolo <vincenzo.petrolo99@gmail.com>
|
|
||||||
# For infos on how i made it, and help or bugs, you cant contact me or
|
|
||||||
# open an issue
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# P.s: Be careful when trying to modify urls, as they contains special
|
|
||||||
# characters that may change the behaviour of the query
|
|
||||||
|
|
||||||
dwm_solar_panel () {
|
|
||||||
|
|
||||||
INVERTER_IP="YOUR INVERTER IP"
|
|
||||||
PASSWORD="YOUR PASSWORD"
|
|
||||||
|
|
||||||
|
|
||||||
if [[ -f ~/.cache/solar_panel.cache ]];
|
|
||||||
then
|
|
||||||
read SID < ~/.cache/solar_panel.cache
|
|
||||||
if [ "$SID" == "null" ];
|
|
||||||
then
|
|
||||||
#Getting session id
|
|
||||||
SID=$( curl -s --location --request POST "http://$INVERTER_IP/dyn/login.json" \
|
|
||||||
--header 'Content-Type: text/plain' \
|
|
||||||
--data-raw "{\"right\":\"usr\",\"pass\":\""$PASSWORD\""}" | jq .result.sid)
|
|
||||||
SID=${SID//\"}
|
|
||||||
fi
|
|
||||||
#checks if it got a session token
|
|
||||||
|
|
||||||
if [ "$SID" != "" ] && [ "$SID" != "null" ];
|
|
||||||
then
|
|
||||||
echo $SID > ~/.cache/solar_panel.cache
|
|
||||||
WATTS=$(curl -s --location --request POST "http://$INVERTER_IP/dyn/getValues.json?sid=$SID" \
|
|
||||||
--header 'Content-Type: text/plain' \
|
|
||||||
--data-raw '{"destDev":[],"keys":["6100_00543100","6800_008AA200","6100_40263F00","6800_00832A00","6180_08214800","6180_08414900","6180_08522F00","6400_00543A00","6400_00260100","6800_08811F00","6400_00462E00"]}' | jq '.result."0156-76BC3EC6"."6100_40263F00"."1"[0].val')
|
|
||||||
|
|
||||||
if [ "$WATTS" == "" ] || [ "$WATTS" == "null" ];
|
|
||||||
then
|
|
||||||
echo "null" > ~/.cache/solar_panel.cache
|
|
||||||
else
|
|
||||||
printf "%s💡 $WATTS W %s" "$SEP1" "$SEP2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
touch ~/.cache/solar_panel.cache
|
|
||||||
|
|
||||||
echo "null" > ~/.cache/solar_panel.cache
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
dwm_solar_panel
|
|
||||||
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function that shows the current artist, track, duration, and status from Spotify using playerctl
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: spotify/spotifyd, playerctl
|
|
||||||
|
|
||||||
# NOTE: The official spotify client does not provide the track position or shuffle status through playerctl. This does work through spotifyd however.
|
|
||||||
|
|
||||||
dwm_spotify () {
|
|
||||||
if ps -C spotify > /dev/null; then
|
|
||||||
PLAYER="spotify"
|
|
||||||
elif ps -C spotifyd > /dev/null; then
|
|
||||||
PLAYER="spotifyd"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PLAYER" = "spotify" ] || [ "$PLAYER" = "spotifyd" ]; then
|
|
||||||
ARTIST=$(playerctl metadata artist)
|
|
||||||
TRACK=$(playerctl metadata title)
|
|
||||||
POSITION=$(playerctl position | sed 's/..\{6\}$//')
|
|
||||||
DURATION=$(playerctl metadata mpris:length | sed 's/.\{6\}$//')
|
|
||||||
STATUS=$(playerctl status)
|
|
||||||
SHUFFLE=$(playerctl shuffle)
|
|
||||||
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
if [ "$STATUS" = "Playing" ]; then
|
|
||||||
STATUS="▶"
|
|
||||||
else
|
|
||||||
STATUS="⏸"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SHUFFLE" = "On" ]; then
|
|
||||||
SHUFFLE=" 🔀"
|
|
||||||
else
|
|
||||||
SHUFFLE=""
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$STATUS" = "Playing" ]; then
|
|
||||||
STATUS="PLA"
|
|
||||||
else
|
|
||||||
STATUS="PAU"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SHUFFLE" = "On" ]; then
|
|
||||||
SHUFFLE=" S"
|
|
||||||
else
|
|
||||||
SHUFFLE=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PLAYER" = "spotify" ]; then
|
|
||||||
printf "%s%s %s - %s " "$SEP1" "$STATUS" "$ARTIST" "$TRACK"
|
|
||||||
printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
else
|
|
||||||
printf "%s%s %s - %s " "$SEP1" "$STATUS" "$ARTIST" "$TRACK"
|
|
||||||
printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
|
|
||||||
printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
|
|
||||||
printf "%s%s\n" "$SHUFFLE" "$SEP2"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_spotify
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to show the status of a torrent woth transmission-remote
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: transmission-remote
|
|
||||||
|
|
||||||
dwm_transmission () {
|
|
||||||
TORRENT=$(transmission-remote -l | sed '2q;d' | sed 's/\(.\) /\1/g')
|
|
||||||
ID=$(printf "%s" "$TORRENT" | awk '{print $1;}')
|
|
||||||
STATUS=$(printf "%s" "$TORRENT" | awk '{print $8;}')
|
|
||||||
ETA=$(printf "%s" "$TORRENT" | awk '{print $4;}')
|
|
||||||
NAME=$(printf "%s" "$TORRENT" | awk '{for(i=9;i<=NF;++i)print $i}' | tr -d "\n" | head -c 20; printf "...")
|
|
||||||
DONE=$(printf "%s" "$TORRENT" | awk '{print $2;}')
|
|
||||||
UP=$(printf "%s" "$TORRENT" | awk '{print $5;}')
|
|
||||||
DOWN=$(printf "%s" "$TORRENT" | awk '{print $5;}')
|
|
||||||
|
|
||||||
if [ "$ID" != "Sum:" ]; then
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
case "$STATUS" in
|
|
||||||
"Idle")
|
|
||||||
printf "🛑 %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
|
|
||||||
;;
|
|
||||||
"Seeding")
|
|
||||||
printf "🌱 %s | ⬆%s ⬇%s" "$NAME" "$UP" "$DOWN"
|
|
||||||
;;
|
|
||||||
"Downloading")
|
|
||||||
printf "⏬ %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
case "$STATUS" in
|
|
||||||
"Idle")
|
|
||||||
printf "IDLE %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
|
|
||||||
;;
|
|
||||||
"Seeding")
|
|
||||||
printf "SEEDING %s | ⬆%s ⬇%s" "$NAME" "$UP" "$DOWN"
|
|
||||||
;;
|
|
||||||
"Downloading")
|
|
||||||
printf "DOWNLOADING %s | %s %s ⬆%s ⬇%s" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_transmission
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to show VPN connections with OpenVPN or WireGuard (if any are active)
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: NetworkManager, NetworkManager-openvpn (for OpenVPN connections)
|
|
||||||
|
|
||||||
dwm_vpn () {
|
|
||||||
VPN=$(nmcli -a | grep 'VPN connection' | sed -e 's/\( VPN connection\)*$//g')
|
|
||||||
|
|
||||||
if [ "$VPN" = "" ]; then
|
|
||||||
VPN=$(nmcli connection | grep 'wireguard' | sed 's/\s.*$//')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$VPN" != "" ]; then
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
printf "🔒 %s" "$VPN"
|
|
||||||
else
|
|
||||||
printf "VPN %s" "$VPN"
|
|
||||||
fi
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dwm_vpn
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A dwm_bar function to print the weather from wttr.in
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: curl
|
|
||||||
|
|
||||||
# Change the value of LOCATION to match your city
|
|
||||||
dwm_weather() {
|
|
||||||
LOCATION=London
|
|
||||||
|
|
||||||
if [ "$IDENTIFIER" = "unicode" ]; then
|
|
||||||
DATA=$(curl -s wttr.in/$LOCATION?format=1)
|
|
||||||
export __DWM_BAR_WEATHER__="${SEP1} ${DATA} ${SEP2}"
|
|
||||||
else
|
|
||||||
DATA=$(curl -s wttr.in/$LOCATION?format=1 | grep -o ".[0-9].*")
|
|
||||||
export __DWM_BAR_WEATHER__="${SEP1} WEA ${DATA} ${SEP2}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_weather
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Dependancies: wpa_cli
|
|
||||||
|
|
||||||
dwm_wpa() {
|
|
||||||
CONSTATE=$(wpa_cli status | sed -n '/wpa_state/s/^.*=//p')
|
|
||||||
|
|
||||||
case $CONSTATE in
|
|
||||||
'COMPLETED')
|
|
||||||
CONSSID=$(wpa_cli status | sed -n '/\<ssid\>/s/^.*=//p')
|
|
||||||
CONIP=$(wpa_cli status | sed -n '/ip_address/s/^.*=//p')
|
|
||||||
CONRSSI=$(wpa_cli signal_poll | sed -n '/AVG_RSSI/s/^.*=//p')
|
|
||||||
if [ "$CONRSSI" -gt -35 ]; then
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF927 %s %s" "$CONSSID" "$CONIP"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
elif [ "$CONRSSI" -ge -55 ] && [ "$CONRSSI" -lt -35 ]; then
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF924 %s %s" "$CONSSID" "$CONIP"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
elif [ "$CONRSSI" -ge -75 ] && [ "$CONRSSI" -lt -55 ]; then
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF921 %s %s" "$CONSSID" "$CONIP"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
else
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF91E %s %s" "$CONSSID" "$CONIP"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
#======================================================================#
|
|
||||||
'DISCONNECTED')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92D %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
'INTERFACE_DISABLED')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92D %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
#======================================================================#
|
|
||||||
'SCANNING')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92A %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
'ASSOCIATING')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92A %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
'ASSOCIATED')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92A %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
'AUTHENTICATING')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92A %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
#======================================================================#
|
|
||||||
'4WAY_HANDSHAKE')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92B %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
'GROUP_HANDSHAKE')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92B %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
'INACTIVE')
|
|
||||||
printf "%s" "$SEP1"
|
|
||||||
printf "\uF92B %s" "$CONSTATE"
|
|
||||||
printf "%s\n" "$SEP2"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
dwm_wpa
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
alsa-utils
|
|
||||||
cmus
|
|
||||||
xorg-setxkbmap
|
|
||||||
extra/mpc
|
|
||||||
wpa_supplicant
|
|
||||||
networkmanager
|
|
||||||
networkmanager-openvpn
|
|
||||||
calcurse
|
|
||||||
transmission-remote-gtk
|
|
||||||
xorg-xbacklight
|
|
||||||
connman
|
|
||||||
curl
|
|
||||||
pamixer
|
|
||||||
spotifyd
|
|
||||||
playerctl
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
alsa-utils
|
|
||||||
setxkbmap
|
|
||||||
mpc
|
|
||||||
wpa_supplicant
|
|
||||||
NetworkManager
|
|
||||||
NetworkManager-openvpn
|
|
||||||
calcurse
|
|
||||||
transmission-remote-gtk
|
|
||||||
xbacklight
|
|
||||||
connman
|
|
||||||
connman-devel
|
|
||||||
curl
|
|
||||||
playerctl
|
|
||||||
playerctl-devel
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
alsa-utils
|
|
||||||
cmus
|
|
||||||
setxkbmap
|
|
||||||
mpc
|
|
||||||
wpa_supplicant
|
|
||||||
NetworkManager
|
|
||||||
NetworkManager-openvpn
|
|
||||||
calcurse
|
|
||||||
transmission-remote-gtk
|
|
||||||
xbacklight
|
|
||||||
connman
|
|
||||||
curl
|
|
||||||
pamixer
|
|
||||||
spotifyd
|
|
||||||
playerctl
|
|
||||||
xsetroot
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# A modular status bar for dwm
|
|
||||||
# Joe Standring <git@joestandring.com>
|
|
||||||
# GNU GPLv3
|
|
||||||
|
|
||||||
# Dependencies: xorg-xsetroot
|
|
||||||
|
|
||||||
# Import functions with "$include /route/to/module"
|
|
||||||
# It is recommended that you place functions in the subdirectory ./bar-functions and use: . "$DIR/bar-functions/dwm_example.sh"
|
|
||||||
|
|
||||||
# Store the directory the script is running from
|
|
||||||
LOC=$(readlink -f "$0")
|
|
||||||
DIR=$(dirname "$LOC")
|
|
||||||
|
|
||||||
# Change the appearance of the module identifier. if this is set to "unicode", then symbols will be used as identifiers instead of text. E.g. [📪 0] instead of [MAIL 0].
|
|
||||||
# Requires a font with adequate unicode character support
|
|
||||||
export IDENTIFIER="unicode"
|
|
||||||
|
|
||||||
# Change the charachter(s) used to seperate modules. If two are used, they will be placed at the start and end.
|
|
||||||
export SEP1="["
|
|
||||||
export SEP2="]"
|
|
||||||
|
|
||||||
# Import the modules
|
|
||||||
#. "$DIR/bar-functions/dwm_alarm.sh"
|
|
||||||
# . "$DIR/bar-functions/dwm_alsa.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_backlight.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_battery.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_ccurse.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_cmus.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_connman.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_countdown.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_currency.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_date.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_keyboard.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_loadavg.sh"
|
|
||||||
# . "$DIR/bar-functions/dwm_mail.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_mpc.sh"
|
|
||||||
# . "$DIR/bar-functions/dwm_networkmanager.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_pulse.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_resources.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_spotify.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_transmission.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_vpn.sh"
|
|
||||||
. "$DIR/bar-functions/dwm_weather.sh"
|
|
||||||
#. "$DIR/bar-functions/dwm_network_speed.sh"
|
|
||||||
|
|
||||||
parallelize() {
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
printf "Running parallel processes\n"
|
|
||||||
#dwm_networkmanager &
|
|
||||||
#dwm_weather &
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
}
|
|
||||||
parallelize &
|
|
||||||
|
|
||||||
# Update dwm status bar every second
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
# Append results of each func one by one to the upperbar string
|
|
||||||
upperbar=""
|
|
||||||
#upperbar="$upperbar$(dwm_alarm)"
|
|
||||||
#upperbar="$upperbar$(dwm_backlight)"
|
|
||||||
#upperbar="$upperbar$(dwm_battery)"
|
|
||||||
#upperbar="$upperbar$(dwm_ccurse)"
|
|
||||||
#upperbar="$upperbar$(dwm_cmus)"
|
|
||||||
#upperbar="$upperbar$(dwm_connman)"
|
|
||||||
#upperbar="$upperbar$(dwm_countdown)"
|
|
||||||
#upperbar="$upperbar$(dwm_currency)"
|
|
||||||
# upperbar="$upperbar$(dwm_keyboard)"
|
|
||||||
#upperbar="$upperbar$(dwm_loadavg)"
|
|
||||||
#upperbar="$upperbar$(dwm_mail)"
|
|
||||||
#upperbar="$upperbar$(dwm_mpc)"
|
|
||||||
upperbar="$upperbar$(dwm_pulse)"
|
|
||||||
# upperbar="$upperbar$(dwm_resources)"
|
|
||||||
upperbar="$upperbar$(dwm_spotify)"
|
|
||||||
#upperbar="$upperbar$(dwm_transmission)"
|
|
||||||
#upperbar="$upperbar$(dwm_vpn)"
|
|
||||||
#upperbar="$upperbar${__DWM_BAR_NETWORKMANAGER__}"
|
|
||||||
#upperbar="$upperbar${__DWM_BAR_WEATHER__}"
|
|
||||||
#upperbar="$upperbar$(dwm_network_speed)"; dwm_network_speed_record
|
|
||||||
# upperbar="$upperbar$(dwm_alsa)"
|
|
||||||
upperbar="$upperbar$(dwm_date)"
|
|
||||||
|
|
||||||
# Append results of each func one by one to the lowerbar string
|
|
||||||
lowerbar=""
|
|
||||||
|
|
||||||
xsetroot -name "$upperbar"
|
|
||||||
# Uncomment the line below to enable the lowerbar
|
|
||||||
#xsetroot -name "$upperbar;$lowerbar"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,73 +0,0 @@
|
|||||||
# dwm version
|
|
||||||
VERSION = 6.4
|
|
||||||
|
|
||||||
# Customize below to fit your system
|
|
||||||
|
|
||||||
# paths
|
|
||||||
PREFIX = /usr/local
|
|
||||||
MANPREFIX = ${PREFIX}/share/man
|
|
||||||
|
|
||||||
X11INC = /usr/X11R6/include
|
|
||||||
X11LIB = /usr/X11R6/lib
|
|
||||||
|
|
||||||
# FreeBSD (uncomment)
|
|
||||||
#X11INC = /usr/local/include
|
|
||||||
#X11LIB = /usr/local/lib
|
|
||||||
|
|
||||||
# Xinerama, comment if you don't want it
|
|
||||||
XINERAMALIBS = -lXinerama
|
|
||||||
XINERAMAFLAGS = -DXINERAMA
|
|
||||||
|
|
||||||
# freetype
|
|
||||||
FREETYPELIBS = -lfontconfig -lXft
|
|
||||||
FREETYPEINC = /usr/include/freetype2
|
|
||||||
# FreeBSD (uncomment)
|
|
||||||
#FREETYPEINC = /usr/local/include/freetype2
|
|
||||||
# OpenBSD (uncomment)
|
|
||||||
#FREETYPEINC = ${X11INC}/freetype2
|
|
||||||
# OpenBSD - Uncomment this for the swallow patch / SWALLOW_PATCH
|
|
||||||
#KVMLIB = -lkvm
|
|
||||||
|
|
||||||
# Uncomment this for the alpha patch and the winicon patch (BAR_ALPHA_PATCH, BAR_WINICON_PATCH)
|
|
||||||
XRENDER = -lXrender
|
|
||||||
|
|
||||||
# Uncomment this for the mdpcontrol patch / MDPCONTROL_PATCH
|
|
||||||
#MPDCLIENT = -lmpdclient
|
|
||||||
|
|
||||||
# Uncomment for the pango patch / BAR_PANGO_PATCH
|
|
||||||
#PANGOINC = `pkg-config --cflags xft pango pangoxft`
|
|
||||||
#PANGOLIB = `pkg-config --libs xft pango pangoxft`
|
|
||||||
|
|
||||||
# Uncomment for the ipc patch / IPC_PATCH
|
|
||||||
#YAJLLIBS = -lyajl
|
|
||||||
#YAJLINC = -I/usr/include/yajl
|
|
||||||
|
|
||||||
# Uncomment this for the rounded corners patch / ROUNDED_CORNERS_PATCH
|
|
||||||
#XEXTLIB = -lXext
|
|
||||||
|
|
||||||
# Uncomment this for the swallow patch / SWALLOW_PATCH
|
|
||||||
#XCBLIBS = -lX11-xcb -lxcb -lxcb-res
|
|
||||||
|
|
||||||
# This is needed for the winicon and tagpreview patches / BAR_WINICON_PATCH / BAR_TAGPREVIEW_PATCH
|
|
||||||
#IMLIB2LIBS = -lImlib2
|
|
||||||
|
|
||||||
# Uncomment for the bidi patch
|
|
||||||
#BDINC = -I/usr/include/fribidi
|
|
||||||
#BDLIBS = -lfribidi
|
|
||||||
|
|
||||||
# includes and libs
|
|
||||||
INCS = -I${X11INC} -I${FREETYPEINC} ${YAJLINC} ${PANGOINC} ${BDINC}
|
|
||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${XRENDER} ${MPDCLIENT} ${XEXTLIB} ${XCBLIBS} ${KVMLIB} ${PANGOLIB} ${YAJLLIBS} ${IMLIB2LIBS} $(BDLIBS)
|
|
||||||
|
|
||||||
# flags
|
|
||||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D__XSI_VISIBLE=1 -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
|
||||||
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
|
|
||||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-unused-function -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
|
||||||
LDFLAGS = ${LIBS}
|
|
||||||
|
|
||||||
# Solaris
|
|
||||||
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
|
|
||||||
#LDFLAGS = ${LIBS}
|
|
||||||
|
|
||||||
# compiler and linker
|
|
||||||
CC = cc
|
|
||||||
@@ -1,745 +0,0 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xft/Xft.h>
|
|
||||||
|
|
||||||
#include "patches.h"
|
|
||||||
#include "drw.h"
|
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
#if BIDI_PATCH
|
|
||||||
#include <fribidi.h>
|
|
||||||
|
|
||||||
static char fribidi_text[BUFSIZ] = "";
|
|
||||||
|
|
||||||
static void
|
|
||||||
apply_fribidi(const char *str)
|
|
||||||
{
|
|
||||||
FriBidiStrIndex len = strlen(str);
|
|
||||||
FriBidiChar logical[BUFSIZ];
|
|
||||||
FriBidiChar visual[BUFSIZ];
|
|
||||||
FriBidiParType base = FRIBIDI_PAR_ON;
|
|
||||||
FriBidiCharSet charset;
|
|
||||||
|
|
||||||
fribidi_text[0] = 0;
|
|
||||||
if (len > 0) {
|
|
||||||
charset = fribidi_parse_charset("UTF-8");
|
|
||||||
len = fribidi_charset_to_unicode(charset, str, len, logical);
|
|
||||||
fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL);
|
|
||||||
len = fribidi_unicode_to_charset(charset, visual, len, fribidi_text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !BAR_PANGO_PATCH
|
|
||||||
#define UTF_INVALID 0xFFFD
|
|
||||||
#define UTF_SIZ 4
|
|
||||||
|
|
||||||
static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
|
|
||||||
static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
|
|
||||||
static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
|
|
||||||
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
|
|
||||||
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
|
|
||||||
Clr transcheme[3];
|
|
||||||
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
|
|
||||||
|
|
||||||
#if !BAR_PANGO_PATCH
|
|
||||||
static long
|
|
||||||
utf8decodebyte(const char c, size_t *i)
|
|
||||||
{
|
|
||||||
for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
|
|
||||||
if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
|
|
||||||
return (unsigned char)c & ~utfmask[*i];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t
|
|
||||||
utf8validate(long *u, size_t i)
|
|
||||||
{
|
|
||||||
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
|
|
||||||
*u = UTF_INVALID;
|
|
||||||
for (i = 1; *u > utfmax[i]; ++i)
|
|
||||||
;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t
|
|
||||||
utf8decode(const char *c, long *u, size_t clen)
|
|
||||||
{
|
|
||||||
size_t i, j, len, type;
|
|
||||||
long udecoded;
|
|
||||||
|
|
||||||
*u = UTF_INVALID;
|
|
||||||
if (!clen)
|
|
||||||
return 0;
|
|
||||||
udecoded = utf8decodebyte(c[0], &len);
|
|
||||||
if (!BETWEEN(len, 1, UTF_SIZ))
|
|
||||||
return 1;
|
|
||||||
for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
|
|
||||||
udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
|
|
||||||
if (type)
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
if (j < len)
|
|
||||||
return 0;
|
|
||||||
*u = udecoded;
|
|
||||||
utf8validate(u, len);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
|
|
||||||
Drw *
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
|
|
||||||
#else
|
|
||||||
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
{
|
|
||||||
Drw *drw = ecalloc(1, sizeof(Drw));
|
|
||||||
|
|
||||||
drw->dpy = dpy;
|
|
||||||
drw->screen = screen;
|
|
||||||
drw->root = root;
|
|
||||||
drw->w = w;
|
|
||||||
drw->h = h;
|
|
||||||
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
drw->visual = visual;
|
|
||||||
drw->depth = depth;
|
|
||||||
drw->cmap = cmap;
|
|
||||||
drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
|
|
||||||
#if BAR_WINICON_PATCH
|
|
||||||
drw->picture = XRenderCreatePicture(dpy, drw->drawable, XRenderFindVisualFormat(dpy, visual), 0, NULL);
|
|
||||||
#endif // BAR_WINICON_PATCH
|
|
||||||
drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
|
|
||||||
#else
|
|
||||||
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
|
||||||
#if BAR_WINICON_PATCH
|
|
||||||
drw->picture = XRenderCreatePicture(dpy, drw->drawable, XRenderFindVisualFormat(dpy, DefaultVisual(dpy, screen)), 0, NULL);
|
|
||||||
#endif // BAR_WINICON_PATCH
|
|
||||||
drw->gc = XCreateGC(dpy, root, 0, NULL);
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
|
||||||
|
|
||||||
return drw;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
|
||||||
{
|
|
||||||
if (!drw)
|
|
||||||
return;
|
|
||||||
|
|
||||||
drw->w = w;
|
|
||||||
drw->h = h;
|
|
||||||
#if BAR_WINICON_PATCH
|
|
||||||
if (drw->picture)
|
|
||||||
XRenderFreePicture(drw->dpy, drw->picture);
|
|
||||||
#endif // BAR_WINICON_PATCH
|
|
||||||
if (drw->drawable)
|
|
||||||
XFreePixmap(drw->dpy, drw->drawable);
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
|
|
||||||
#if BAR_WINICON_PATCH
|
|
||||||
drw->picture = XRenderCreatePicture(drw->dpy, drw->drawable, XRenderFindVisualFormat(drw->dpy, drw->visual), 0, NULL);
|
|
||||||
#endif // BAR_WINICON_PATCH
|
|
||||||
#else // !BAR_ALPHA_PATCH
|
|
||||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
|
||||||
#if BAR_WINICON_PATCH
|
|
||||||
drw->picture = XRenderCreatePicture(drw->dpy, drw->drawable, XRenderFindVisualFormat(drw->dpy, DefaultVisual(drw->dpy, drw->screen)), 0, NULL);
|
|
||||||
#endif // BAR_WINICON_PATCH
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
drw_free(Drw *drw)
|
|
||||||
{
|
|
||||||
#if BAR_WINICON_PATCH
|
|
||||||
XRenderFreePicture(drw->dpy, drw->picture);
|
|
||||||
#endif // BAR_WINICON_PATCH
|
|
||||||
XFreePixmap(drw->dpy, drw->drawable);
|
|
||||||
XFreeGC(drw->dpy, drw->gc);
|
|
||||||
drw_fontset_free(drw->fonts);
|
|
||||||
free(drw);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BAR_PANGO_PATCH
|
|
||||||
/* This function is an implementation detail. Library users should use
|
|
||||||
* drw_font_create instead.
|
|
||||||
*/
|
|
||||||
static Fnt *
|
|
||||||
xfont_create(Drw *drw, const char *fontname)
|
|
||||||
{
|
|
||||||
Fnt *font;
|
|
||||||
PangoFontMap *fontmap;
|
|
||||||
PangoContext *context;
|
|
||||||
PangoFontDescription *desc;
|
|
||||||
PangoFontMetrics *metrics;
|
|
||||||
|
|
||||||
if (!fontname) {
|
|
||||||
die("no font specified.");
|
|
||||||
}
|
|
||||||
|
|
||||||
font = ecalloc(1, sizeof(Fnt));
|
|
||||||
font->dpy = drw->dpy;
|
|
||||||
|
|
||||||
fontmap = pango_xft_get_font_map(drw->dpy, drw->screen);
|
|
||||||
context = pango_font_map_create_context(fontmap);
|
|
||||||
desc = pango_font_description_from_string(fontname);
|
|
||||||
font->layout = pango_layout_new(context);
|
|
||||||
pango_layout_set_font_description(font->layout, desc);
|
|
||||||
|
|
||||||
metrics = pango_context_get_metrics(context, desc, pango_language_from_string ("en-us"));
|
|
||||||
font->h = pango_font_metrics_get_height(metrics) / PANGO_SCALE;
|
|
||||||
|
|
||||||
pango_font_metrics_unref(metrics);
|
|
||||||
g_object_unref(context);
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/* This function is an implementation detail. Library users should use
|
|
||||||
* drw_fontset_create instead.
|
|
||||||
*/
|
|
||||||
static Fnt *
|
|
||||||
xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
|
||||||
{
|
|
||||||
Fnt *font;
|
|
||||||
XftFont *xfont = NULL;
|
|
||||||
FcPattern *pattern = NULL;
|
|
||||||
|
|
||||||
if (fontname) {
|
|
||||||
/* Using the pattern found at font->xfont->pattern does not yield the
|
|
||||||
* same substitution results as using the pattern returned by
|
|
||||||
* FcNameParse; using the latter results in the desired fallback
|
|
||||||
* behaviour whereas the former just results in missing-character
|
|
||||||
* rectangles being drawn, at least with some fonts. */
|
|
||||||
if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) {
|
|
||||||
fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
|
|
||||||
fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname);
|
|
||||||
XftFontClose(drw->dpy, xfont);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
} else if (fontpattern) {
|
|
||||||
if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) {
|
|
||||||
fprintf(stderr, "error, cannot load font from pattern.\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
die("no font specified.");
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BAR_NO_COLOR_EMOJI_PATCH
|
|
||||||
/* Do not allow using color fonts. This is a workaround for a BadLength
|
|
||||||
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
|
||||||
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
|
||||||
* https://lists.suckless.org/dev/1701/30932.html
|
|
||||||
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
|
||||||
* and lots more all over the internet.
|
|
||||||
*/
|
|
||||||
FcBool iscol;
|
|
||||||
if (FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
|
||||||
XftFontClose(drw->dpy, xfont);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif // BAR_NO_COLOR_EMOJI_PATCH
|
|
||||||
|
|
||||||
font = ecalloc(1, sizeof(Fnt));
|
|
||||||
font->xfont = xfont;
|
|
||||||
font->pattern = pattern;
|
|
||||||
font->h = xfont->ascent + xfont->descent;
|
|
||||||
font->dpy = drw->dpy;
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
|
|
||||||
static void
|
|
||||||
xfont_free(Fnt *font)
|
|
||||||
{
|
|
||||||
if (!font)
|
|
||||||
return;
|
|
||||||
#if BAR_PANGO_PATCH
|
|
||||||
if (font->layout)
|
|
||||||
g_object_unref(font->layout);
|
|
||||||
#else
|
|
||||||
if (font->pattern)
|
|
||||||
FcPatternDestroy(font->pattern);
|
|
||||||
XftFontClose(font->dpy, font->xfont);
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
free(font);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BAR_PANGO_PATCH
|
|
||||||
Fnt*
|
|
||||||
drw_font_create(Drw* drw, const char font[])
|
|
||||||
{
|
|
||||||
Fnt *fnt = NULL;
|
|
||||||
|
|
||||||
if (!drw || !font)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
fnt = xfont_create(drw, font);
|
|
||||||
|
|
||||||
return (drw->fonts = fnt);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
Fnt*
|
|
||||||
drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
|
|
||||||
{
|
|
||||||
Fnt *cur, *ret = NULL;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (!drw || !fonts)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (i = 1; i <= fontcount; i++) {
|
|
||||||
if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) {
|
|
||||||
cur->next = ret;
|
|
||||||
ret = cur;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (drw->fonts = ret);
|
|
||||||
}
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
|
|
||||||
void
|
|
||||||
drw_fontset_free(Fnt *font)
|
|
||||||
{
|
|
||||||
if (font) {
|
|
||||||
#if !BAR_PANGO_PATCH
|
|
||||||
drw_fontset_free(font->next);
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
xfont_free(font);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
drw_clr_create(
|
|
||||||
Drw *drw,
|
|
||||||
Clr *dest,
|
|
||||||
const char *clrname
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
, unsigned int alpha
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
) {
|
|
||||||
if (!drw || !dest || !clrname)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
|
|
||||||
clrname, dest))
|
|
||||||
die("error, cannot allocate color '%s'", clrname);
|
|
||||||
|
|
||||||
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
|
|
||||||
#else
|
|
||||||
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
|
||||||
DefaultColormap(drw->dpy, drw->screen),
|
|
||||||
clrname, dest))
|
|
||||||
die("error, cannot allocate color '%s'", clrname);
|
|
||||||
|
|
||||||
#if NO_TRANSPARENT_BORDERS_PATCH
|
|
||||||
dest->pixel |= 0xff << 24;
|
|
||||||
#endif // NO_TRANSPARENT_BORDERS_PATCH
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
|
||||||
* returned color scheme when done using it. */
|
|
||||||
Clr *
|
|
||||||
drw_scm_create(
|
|
||||||
Drw *drw,
|
|
||||||
char *clrnames[],
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
const unsigned int alphas[],
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
size_t clrcount
|
|
||||||
) {
|
|
||||||
size_t i;
|
|
||||||
Clr *ret;
|
|
||||||
|
|
||||||
/* need at least two colors for a scheme */
|
|
||||||
if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor))))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < clrcount; i++)
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
|
|
||||||
#else
|
|
||||||
drw_clr_create(drw, &ret[i], clrnames[i]);
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !BAR_PANGO_PATCH
|
|
||||||
void
|
|
||||||
drw_setfontset(Drw *drw, Fnt *set)
|
|
||||||
{
|
|
||||||
if (drw)
|
|
||||||
drw->fonts = set;
|
|
||||||
}
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
|
|
||||||
void
|
|
||||||
drw_setscheme(Drw *drw, Clr *scm)
|
|
||||||
{
|
|
||||||
if (drw)
|
|
||||||
drw->scheme = scm;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
|
|
||||||
void
|
|
||||||
drw_settrans(Drw *drw, Clr *psc, Clr *nsc)
|
|
||||||
{
|
|
||||||
if (drw) {
|
|
||||||
transcheme[0] = psc[ColBg]; transcheme[1] = nsc[ColBg]; transcheme[2] = psc[ColBorder];
|
|
||||||
drw->scheme = transcheme;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
|
|
||||||
|
|
||||||
void
|
|
||||||
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
|
|
||||||
{
|
|
||||||
if (!drw || !drw->scheme)
|
|
||||||
return;
|
|
||||||
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
|
|
||||||
if (filled)
|
|
||||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
|
||||||
else
|
|
||||||
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BIDI_PATCH
|
|
||||||
int
|
|
||||||
_drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
|
|
||||||
#else
|
|
||||||
int
|
|
||||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
|
|
||||||
#endif // BIDI_PATCH
|
|
||||||
{
|
|
||||||
#if BAR_PANGO_PATCH
|
|
||||||
char buf[1024];
|
|
||||||
int ty;
|
|
||||||
unsigned int ew;
|
|
||||||
XftDraw *d = NULL;
|
|
||||||
size_t i, len;
|
|
||||||
int render = x || y || w || h;
|
|
||||||
|
|
||||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!render) {
|
|
||||||
w = ~w;
|
|
||||||
} else {
|
|
||||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
|
||||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
|
|
||||||
#else
|
|
||||||
d = XftDrawCreate(drw->dpy, drw->drawable,
|
|
||||||
DefaultVisual(drw->dpy, drw->screen),
|
|
||||||
DefaultColormap(drw->dpy, drw->screen));
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
x += lpad;
|
|
||||||
w -= lpad;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = strlen(text);
|
|
||||||
|
|
||||||
if (len) {
|
|
||||||
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup);
|
|
||||||
/* shorten text if necessary */
|
|
||||||
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--)
|
|
||||||
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup);
|
|
||||||
|
|
||||||
if (len) {
|
|
||||||
memcpy(buf, text, len);
|
|
||||||
buf[len] = '\0';
|
|
||||||
if (len < strlen(text))
|
|
||||||
for (i = len; i && i > len - 3; buf[--i] = '.')
|
|
||||||
; /* NOP */
|
|
||||||
|
|
||||||
if (render) {
|
|
||||||
ty = y + (h - drw->fonts->h) / 2;
|
|
||||||
if (markup)
|
|
||||||
pango_layout_set_markup(drw->fonts->layout, buf, len);
|
|
||||||
else
|
|
||||||
pango_layout_set_text(drw->fonts->layout, buf, len);
|
|
||||||
pango_xft_render_layout(d, &drw->scheme[invert ? ColBg : ColFg],
|
|
||||||
drw->fonts->layout, x * PANGO_SCALE, ty * PANGO_SCALE);
|
|
||||||
if (markup) /* clear markup attributes */
|
|
||||||
pango_layout_set_attributes(drw->fonts->layout, NULL);
|
|
||||||
}
|
|
||||||
x += ew;
|
|
||||||
w -= ew;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (d)
|
|
||||||
XftDrawDestroy(d);
|
|
||||||
|
|
||||||
return x + (render ? w : 0);
|
|
||||||
#else
|
|
||||||
char buf[1024];
|
|
||||||
int ty;
|
|
||||||
unsigned int ew;
|
|
||||||
XftDraw *d = NULL;
|
|
||||||
Fnt *usedfont, *curfont, *nextfont;
|
|
||||||
size_t i, len;
|
|
||||||
int utf8strlen, utf8charlen, render = x || y || w || h;
|
|
||||||
long utf8codepoint = 0;
|
|
||||||
const char *utf8str;
|
|
||||||
FcCharSet *fccharset;
|
|
||||||
FcPattern *fcpattern;
|
|
||||||
FcPattern *match;
|
|
||||||
XftResult result;
|
|
||||||
int charexists = 0;
|
|
||||||
|
|
||||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!render) {
|
|
||||||
w = ~w;
|
|
||||||
} else {
|
|
||||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
|
||||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
|
|
||||||
#else
|
|
||||||
d = XftDrawCreate(drw->dpy, drw->drawable,
|
|
||||||
DefaultVisual(drw->dpy, drw->screen),
|
|
||||||
DefaultColormap(drw->dpy, drw->screen));
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
x += lpad;
|
|
||||||
w -= lpad;
|
|
||||||
}
|
|
||||||
|
|
||||||
usedfont = drw->fonts;
|
|
||||||
while (1) {
|
|
||||||
utf8strlen = 0;
|
|
||||||
utf8str = text;
|
|
||||||
nextfont = NULL;
|
|
||||||
while (*text) {
|
|
||||||
utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
|
|
||||||
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
|
|
||||||
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
|
||||||
if (charexists) {
|
|
||||||
if (curfont == usedfont) {
|
|
||||||
utf8strlen += utf8charlen;
|
|
||||||
text += utf8charlen;
|
|
||||||
} else {
|
|
||||||
nextfont = curfont;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!charexists || nextfont)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
charexists = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (utf8strlen) {
|
|
||||||
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
|
||||||
/* shorten text if necessary */
|
|
||||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; drw_font_getexts(usedfont, utf8str, len, &ew, NULL))
|
|
||||||
len--;
|
|
||||||
|
|
||||||
if (len) {
|
|
||||||
memcpy(buf, utf8str, len);
|
|
||||||
buf[len] = '\0';
|
|
||||||
if (len < utf8strlen)
|
|
||||||
for (i = len; i && i > len - 3; buf[--i] = '.')
|
|
||||||
; /* NOP */
|
|
||||||
|
|
||||||
if (render) {
|
|
||||||
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
|
||||||
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
|
||||||
usedfont->xfont, x, ty, (XftChar8 *)buf, len);
|
|
||||||
}
|
|
||||||
x += ew;
|
|
||||||
w -= ew;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*text) {
|
|
||||||
break;
|
|
||||||
} else if (nextfont) {
|
|
||||||
charexists = 0;
|
|
||||||
usedfont = nextfont;
|
|
||||||
} else {
|
|
||||||
/* Regardless of whether or not a fallback font is found, the
|
|
||||||
* character must be drawn. */
|
|
||||||
charexists = 1;
|
|
||||||
|
|
||||||
fccharset = FcCharSetCreate();
|
|
||||||
FcCharSetAddChar(fccharset, utf8codepoint);
|
|
||||||
|
|
||||||
if (!drw->fonts->pattern) {
|
|
||||||
/* Refer to the comment in xfont_create for more information. */
|
|
||||||
die("the first font in the cache must be loaded from a font string.");
|
|
||||||
}
|
|
||||||
|
|
||||||
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
|
||||||
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
|
||||||
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
|
||||||
#if BAR_NO_COLOR_EMOJI_PATCH
|
|
||||||
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
|
||||||
#endif // BAR_NO_COLOR_EMOJI_PATCH
|
|
||||||
|
|
||||||
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
|
||||||
FcDefaultSubstitute(fcpattern);
|
|
||||||
match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result);
|
|
||||||
|
|
||||||
FcCharSetDestroy(fccharset);
|
|
||||||
FcPatternDestroy(fcpattern);
|
|
||||||
|
|
||||||
if (match) {
|
|
||||||
usedfont = xfont_create(drw, NULL, match);
|
|
||||||
if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) {
|
|
||||||
for (curfont = drw->fonts; curfont->next; curfont = curfont->next)
|
|
||||||
; /* NOP */
|
|
||||||
curfont->next = usedfont;
|
|
||||||
} else {
|
|
||||||
xfont_free(usedfont);
|
|
||||||
usedfont = drw->fonts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (d)
|
|
||||||
XftDrawDestroy(d);
|
|
||||||
|
|
||||||
return x + (render ? w : 0);
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BIDI_PATCH
|
|
||||||
int
|
|
||||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert, Bool markup)
|
|
||||||
{
|
|
||||||
apply_fribidi(text);
|
|
||||||
return _drw_text(drw, x, y, w, h, lpad, fribidi_text, invert, markup);
|
|
||||||
}
|
|
||||||
#endif // BIDI_PATCH
|
|
||||||
|
|
||||||
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
|
|
||||||
void
|
|
||||||
drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash)
|
|
||||||
{
|
|
||||||
if (!drw || !drw->scheme)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* direction=1 draws right arrow */
|
|
||||||
x = direction ? x : x + w;
|
|
||||||
w = direction ? w : -w;
|
|
||||||
/* slash=1 draws slash instead of arrow */
|
|
||||||
unsigned int hh = slash ? (direction ? 0 : h) : h/2;
|
|
||||||
|
|
||||||
XPoint points[] = {
|
|
||||||
{x , y },
|
|
||||||
{x + w, y + hh },
|
|
||||||
{x , y + h },
|
|
||||||
};
|
|
||||||
|
|
||||||
XPoint bg[] = {
|
|
||||||
{x , y },
|
|
||||||
{x + w, y },
|
|
||||||
{x + w, y + h},
|
|
||||||
{x , y + h},
|
|
||||||
};
|
|
||||||
|
|
||||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
|
|
||||||
XFillPolygon(drw->dpy, drw->drawable, drw->gc, bg, 4, Convex, CoordModeOrigin);
|
|
||||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColFg].pixel);
|
|
||||||
XFillPolygon(drw->dpy, drw->drawable, drw->gc, points, 3, Nonconvex, CoordModeOrigin);
|
|
||||||
}
|
|
||||||
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
|
|
||||||
|
|
||||||
void
|
|
||||||
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
|
|
||||||
{
|
|
||||||
if (!drw)
|
|
||||||
return;
|
|
||||||
|
|
||||||
XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
|
|
||||||
XSync(drw->dpy, False);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int
|
|
||||||
drw_fontset_getwidth(Drw *drw, const char *text, Bool markup)
|
|
||||||
{
|
|
||||||
if (!drw || !drw->fonts || !text)
|
|
||||||
return 0;
|
|
||||||
return drw_text(drw, 0, 0, 0, 0, 0, text, 0, markup);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BAR_PANGO_PATCH
|
|
||||||
void
|
|
||||||
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup)
|
|
||||||
{
|
|
||||||
if (!font || !text)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PangoRectangle r;
|
|
||||||
if (markup)
|
|
||||||
pango_layout_set_markup(font->layout, text, len);
|
|
||||||
else
|
|
||||||
pango_layout_set_text(font->layout, text, len);
|
|
||||||
pango_layout_get_extents(font->layout, 0, &r);
|
|
||||||
if (markup) /* clear markup attributes */
|
|
||||||
pango_layout_set_attributes(font->layout, NULL);
|
|
||||||
if (w)
|
|
||||||
*w = r.width / PANGO_SCALE;
|
|
||||||
if (h)
|
|
||||||
*h = font->h;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void
|
|
||||||
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
|
||||||
{
|
|
||||||
XGlyphInfo ext;
|
|
||||||
|
|
||||||
if (!font || !text)
|
|
||||||
return;
|
|
||||||
|
|
||||||
XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
|
|
||||||
if (w)
|
|
||||||
*w = ext.xOff;
|
|
||||||
if (h)
|
|
||||||
*h = font->h;
|
|
||||||
}
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
|
|
||||||
Cur *
|
|
||||||
drw_cur_create(Drw *drw, int shape)
|
|
||||||
{
|
|
||||||
Cur *cur;
|
|
||||||
|
|
||||||
if (!drw || !(cur = ecalloc(1, sizeof(Cur))))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
cur->cursor = XCreateFontCursor(drw->dpy, shape);
|
|
||||||
|
|
||||||
return cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
drw_cur_free(Drw *drw, Cur *cursor)
|
|
||||||
{
|
|
||||||
if (!cursor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
XFreeCursor(drw->dpy, cursor->cursor);
|
|
||||||
free(cursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
|
||||||
|
|
||||||
#if BAR_PANGO_PATCH
|
|
||||||
#include <pango/pango.h>
|
|
||||||
#include <pango/pangoxft.h>
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
Cursor cursor;
|
|
||||||
} Cur;
|
|
||||||
|
|
||||||
typedef struct Fnt {
|
|
||||||
Display *dpy;
|
|
||||||
unsigned int h;
|
|
||||||
#if BAR_PANGO_PATCH
|
|
||||||
PangoLayout *layout;
|
|
||||||
#else
|
|
||||||
XftFont *xfont;
|
|
||||||
FcPattern *pattern;
|
|
||||||
struct Fnt *next;
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
} Fnt;
|
|
||||||
|
|
||||||
enum { ColFg, ColBg, ColBorder, ColFloat, ColCount }; /* Clr scheme index */
|
|
||||||
typedef XftColor Clr;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int w, h;
|
|
||||||
Display *dpy;
|
|
||||||
int screen;
|
|
||||||
Window root;
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
Visual *visual;
|
|
||||||
unsigned int depth;
|
|
||||||
Colormap cmap;
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
Drawable drawable;
|
|
||||||
#if BAR_WINICON_PATCH
|
|
||||||
Picture picture;
|
|
||||||
#endif // BAR_WINICON_PATCH
|
|
||||||
GC gc;
|
|
||||||
Clr *scheme;
|
|
||||||
Fnt *fonts;
|
|
||||||
} Drw;
|
|
||||||
|
|
||||||
/* Drawable abstraction */
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
|
|
||||||
#else
|
|
||||||
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
|
|
||||||
void drw_free(Drw *drw);
|
|
||||||
|
|
||||||
/* Fnt abstraction */
|
|
||||||
#if BAR_PANGO_PATCH
|
|
||||||
Fnt *drw_font_create(Drw* drw, const char font[]);
|
|
||||||
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h, Bool markup);
|
|
||||||
#else
|
|
||||||
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
|
|
||||||
void drw_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);
|
|
||||||
unsigned int drw_fontset_getwidth(Drw *drw, const char *text, Bool markup);
|
|
||||||
|
|
||||||
/* Colorscheme abstraction */
|
|
||||||
void drw_clr_create(
|
|
||||||
Drw *drw,
|
|
||||||
Clr *dest,
|
|
||||||
const char *clrname
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
, unsigned int alpha
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
);
|
|
||||||
Clr *drw_scm_create(
|
|
||||||
Drw *drw,
|
|
||||||
char *clrnames[],
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
const unsigned int alphas[],
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
size_t clrcount
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Cursor abstraction */
|
|
||||||
Cur *drw_cur_create(Drw *drw, int shape);
|
|
||||||
void drw_cur_free(Drw *drw, Cur *cursor);
|
|
||||||
|
|
||||||
/* Drawing context manipulation */
|
|
||||||
#if !BAR_PANGO_PATCH
|
|
||||||
void drw_setfontset(Drw *drw, Fnt *set);
|
|
||||||
#endif // BAR_PANGO_PATCH
|
|
||||||
void drw_setscheme(Drw *drw, Clr *scm);
|
|
||||||
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
|
|
||||||
void drw_settrans(Drw *drw, Clr *psc, Clr *nsc);
|
|
||||||
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
|
|
||||||
|
|
||||||
/* Drawing functions */
|
|
||||||
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
|
|
||||||
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
|
|
||||||
void drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash);
|
|
||||||
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
|
|
||||||
|
|
||||||
/* Map functions */
|
|
||||||
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
|
|
||||||
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
.TH DWM 1 dwm\-VERSION
|
|
||||||
.SH NAME
|
|
||||||
dwm \- dynamic window manager
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B dwm
|
|
||||||
.RB [ \-v ]
|
|
||||||
.SH DESCRIPTION
|
|
||||||
dwm is a dynamic window manager for X. It manages windows in tiled, monocle
|
|
||||||
and floating layouts. Either layout can be applied dynamically, optimising the
|
|
||||||
environment for the application in use and the task performed.
|
|
||||||
.P
|
|
||||||
In tiled layouts windows are managed in a master and stacking area. The master
|
|
||||||
area on the left contains one window by default, and the stacking area on the
|
|
||||||
right contains all other windows. The number of master area windows can be
|
|
||||||
adjusted from zero to an arbitrary number. In monocle layout all windows are
|
|
||||||
maximised to the screen size. In floating layout windows can be resized and
|
|
||||||
moved freely. Dialog windows are always managed floating, regardless of the
|
|
||||||
layout applied.
|
|
||||||
.P
|
|
||||||
Windows are grouped by tags. Each window can be tagged with one or multiple
|
|
||||||
tags. Selecting certain tags displays all windows with these tags.
|
|
||||||
.P
|
|
||||||
Each screen contains a small status bar which displays all available tags, the
|
|
||||||
layout, the title of the focused window, and the text read from the root window
|
|
||||||
name property, if the screen is focused. A floating window is indicated with an
|
|
||||||
empty square and a maximised floating window is indicated with a filled square
|
|
||||||
before the windows title. The selected tags are indicated with a different
|
|
||||||
color. The tags of the focused window are indicated with a filled square in the
|
|
||||||
top left corner. The tags which are applied to one or more windows are
|
|
||||||
indicated with an empty square in the top left corner.
|
|
||||||
.P
|
|
||||||
dwm draws a small border around windows to indicate the focus state.
|
|
||||||
.SH OPTIONS
|
|
||||||
.TP
|
|
||||||
.B \-v
|
|
||||||
prints version information to stderr, then exits.
|
|
||||||
.SH USAGE
|
|
||||||
.SS Status bar
|
|
||||||
.TP
|
|
||||||
.B X root window name
|
|
||||||
is read and displayed in the status text area. It can be set with the
|
|
||||||
.BR xsetroot (1)
|
|
||||||
command.
|
|
||||||
.TP
|
|
||||||
.B Button1
|
|
||||||
click on a tag label to display all windows with that tag, click on the layout
|
|
||||||
label toggles between tiled and floating layout.
|
|
||||||
.TP
|
|
||||||
.B Button3
|
|
||||||
click on a tag label adds/removes all windows with that tag to/from the view.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Button1
|
|
||||||
click on a tag label applies that tag to the focused window.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Button3
|
|
||||||
click on a tag label adds/removes that tag to/from the focused window.
|
|
||||||
.SS Keyboard commands
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-Return
|
|
||||||
Start
|
|
||||||
.BR st(1).
|
|
||||||
.TP
|
|
||||||
.B Mod1\-p
|
|
||||||
Spawn
|
|
||||||
.BR dmenu(1)
|
|
||||||
for launching other programs.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-,
|
|
||||||
Focus previous screen, if any.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-.
|
|
||||||
Focus next screen, if any.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-,
|
|
||||||
Send focused window to previous screen, if any.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-.
|
|
||||||
Send focused window to next screen, if any.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-b
|
|
||||||
Toggles bar on and off.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-t
|
|
||||||
Sets tiled layout.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-f
|
|
||||||
Sets floating layout.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-m
|
|
||||||
Sets monocle layout.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-space
|
|
||||||
Toggles between current and previous layout.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-j
|
|
||||||
Focus next window.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-k
|
|
||||||
Focus previous window.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-i
|
|
||||||
Increase number of windows in master area.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-d
|
|
||||||
Decrease number of windows in master area.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-l
|
|
||||||
Increase master area size.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-h
|
|
||||||
Decrease master area size.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Return
|
|
||||||
Zooms/cycles focused window to/from master area (tiled layouts only).
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-c
|
|
||||||
Close focused window.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-space
|
|
||||||
Toggle focused window between tiled and floating state.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Tab
|
|
||||||
Toggles to the previously selected tags.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-[1..n]
|
|
||||||
Apply nth tag to focused window.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-0
|
|
||||||
Apply all tags to focused window.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Control\-Shift\-[1..n]
|
|
||||||
Add/remove nth tag to/from focused window.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-[1..n]
|
|
||||||
View all windows with nth tag.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-0
|
|
||||||
View all windows with any tag.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Control\-[1..n]
|
|
||||||
Add/remove all windows with nth tag to/from the view.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-q
|
|
||||||
Quit dwm.
|
|
||||||
.SS Mouse commands
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Button1
|
|
||||||
Move focused window while dragging. Tiled windows will be toggled to the floating state.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Button2
|
|
||||||
Toggles focused window between floating and tiled state.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Button3
|
|
||||||
Resize focused window while dragging. Tiled windows will be toggled to the floating state.
|
|
||||||
.SH CUSTOMIZATION
|
|
||||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
|
||||||
code. This keeps it fast, secure and simple.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR dmenu (1),
|
|
||||||
.BR st (1)
|
|
||||||
.SH ISSUES
|
|
||||||
Java applications which use the XToolkit/XAWT backend may draw grey windows
|
|
||||||
only. The XToolkit/XAWT backend breaks ICCCM-compliance in recent JDK 1.5 and early
|
|
||||||
JDK 1.6 versions, because it assumes a reparenting window manager. Possible workarounds
|
|
||||||
are using JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or setting the
|
|
||||||
environment variable
|
|
||||||
.BR AWT_TOOLKIT=MToolkit
|
|
||||||
(to use the older Motif backend instead) or running
|
|
||||||
.B xprop -root -f _NET_WM_NAME 32a -set _NET_WM_NAME LG3D
|
|
||||||
or
|
|
||||||
.B wmname LG3D
|
|
||||||
(to pretend that a non-reparenting window manager is running that the
|
|
||||||
XToolkit/XAWT backend can recognize) or when using OpenJDK setting the environment variable
|
|
||||||
.BR _JAVA_AWT_WM_NONREPARENTING=1 .
|
|
||||||
.SH BUGS
|
|
||||||
Send all bug reports with a patch to hackers@suckless.org.
|
|
||||||
5210
dwm/.dwm.old/dwm.c
5210
dwm/.dwm.old/dwm.c
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
Name=Dwm
|
|
||||||
Comment=Dynamic window manager
|
|
||||||
Exec=dwm
|
|
||||||
Icon=dwm
|
|
||||||
Type=XSession
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 373 B |
@@ -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);
|
|
||||||
drawtab(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
|
|
||||||
drawtab(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++;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawtab(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);
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#include <time.h>
|
|
||||||
|
|
||||||
static void drawtab(int nwins, int first, Monitor *m);
|
|
||||||
static void alttabstart(const Arg *arg);
|
|
||||||
static void alttabend();
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
static void aspectresize(const Arg *arg);
|
|
||||||
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
void
|
|
||||||
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 (!(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating)) {
|
|
||||||
for (at = c->mon->clients; at->next != c->mon->sel; at = at->next);
|
|
||||||
c->next = at->next;
|
|
||||||
at->next = c;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#elif ATTACHASIDE_PATCH
|
|
||||||
unsigned int n;
|
|
||||||
for (at = c->mon->clients, n = 0; at; at = at->next)
|
|
||||||
if (!at->isfloating && ISVISIBLEONTAG(at, c->tags))
|
|
||||||
if (++n >= c->mon->nmaster)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (at && c->mon->nmaster) {
|
|
||||||
c->next = at->next;
|
|
||||||
at->next = c;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#elif ATTACHBELOW_PATCH
|
|
||||||
if (!(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating)) {
|
|
||||||
c->next = c->mon->sel->next;
|
|
||||||
c->mon->sel->next = c;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#elif ATTACHBOTTOM_PATCH
|
|
||||||
for (at = c->mon->clients; at && at->next; at = at->next);
|
|
||||||
if (at) {
|
|
||||||
at->next = c;
|
|
||||||
c->next = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
attach(c); // master (default)
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
static void attachx(Client *c);
|
|
||||||
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
void
|
|
||||||
runautostart(void)
|
|
||||||
{
|
|
||||||
char *pathpfx;
|
|
||||||
char *path;
|
|
||||||
char *xdgdatahome;
|
|
||||||
char *home;
|
|
||||||
struct stat sb;
|
|
||||||
|
|
||||||
if ((home = getenv("HOME")) == NULL)
|
|
||||||
/* this is almost impossible */
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* if $XDG_DATA_HOME is set and not empty, use $XDG_DATA_HOME/dwm,
|
|
||||||
* otherwise use ~/.local/share/dwm as autostart script directory
|
|
||||||
*/
|
|
||||||
xdgdatahome = getenv("XDG_DATA_HOME");
|
|
||||||
if (xdgdatahome != NULL && *xdgdatahome != '\0') {
|
|
||||||
/* space for path segments, separators and nul */
|
|
||||||
pathpfx = ecalloc(1, strlen(xdgdatahome) + strlen(dwmdir) + 2);
|
|
||||||
|
|
||||||
if (sprintf(pathpfx, "%s/%s", xdgdatahome, dwmdir) <= 0) {
|
|
||||||
free(pathpfx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* space for path segments, separators and nul */
|
|
||||||
pathpfx = ecalloc(1, strlen(home) + strlen(localshare)
|
|
||||||
+ strlen(dwmdir) + 3);
|
|
||||||
|
|
||||||
if (sprintf(pathpfx, "%s/%s/%s", home, localshare, dwmdir) < 0) {
|
|
||||||
free(pathpfx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check if the autostart script directory exists */
|
|
||||||
if (! (stat(pathpfx, &sb) == 0 && S_ISDIR(sb.st_mode))) {
|
|
||||||
/* the XDG conformant path does not exist or is no directory
|
|
||||||
* so we try ~/.dwm instead
|
|
||||||
*/
|
|
||||||
char *pathpfx_new = realloc(pathpfx, strlen(home) + strlen(dwmdir) + 3);
|
|
||||||
if(pathpfx_new == NULL) {
|
|
||||||
free(pathpfx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pathpfx = pathpfx_new;
|
|
||||||
|
|
||||||
if (sprintf(pathpfx, "%s/.%s", home, dwmdir) <= 0) {
|
|
||||||
free(pathpfx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* try the blocking script first */
|
|
||||||
path = ecalloc(1, strlen(pathpfx) + strlen(autostartblocksh) + 2);
|
|
||||||
if (sprintf(path, "%s/%s", pathpfx, autostartblocksh) <= 0) {
|
|
||||||
free(path);
|
|
||||||
free(pathpfx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (access(path, X_OK) == 0)
|
|
||||||
system(path);
|
|
||||||
|
|
||||||
/* now the non-blocking script */
|
|
||||||
if (sprintf(path, "%s/%s", pathpfx, autostartsh) <= 0) {
|
|
||||||
free(path);
|
|
||||||
free(pathpfx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (access(path, X_OK) == 0)
|
|
||||||
system(strcat(path, " &"));
|
|
||||||
|
|
||||||
free(pathpfx);
|
|
||||||
free(path);
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
static void runautostart(void);
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
static void barhover(XEvent *e, Bar *bar);
|
|
||||||
static Bar *wintobar(Window win);
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
|
|
||||||
static int useargb = 0;
|
|
||||||
static Visual *visual;
|
|
||||||
static int depth;
|
|
||||||
static Colormap cmap;
|
|
||||||
|
|
||||||
void
|
|
||||||
xinitvisual()
|
|
||||||
{
|
|
||||||
XVisualInfo *infos;
|
|
||||||
XRenderPictFormat *fmt;
|
|
||||||
int nitems;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
XVisualInfo tpl = {
|
|
||||||
.screen = screen,
|
|
||||||
.depth = 32,
|
|
||||||
.class = TrueColor
|
|
||||||
};
|
|
||||||
long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
|
|
||||||
|
|
||||||
infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
|
|
||||||
visual = NULL;
|
|
||||||
for (i = 0; i < nitems; i ++) {
|
|
||||||
fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
|
|
||||||
if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
|
|
||||||
visual = infos[i].visual;
|
|
||||||
depth = infos[i].depth;
|
|
||||||
cmap = XCreateColormap(dpy, root, visual, AllocNone);
|
|
||||||
useargb = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XFree(infos);
|
|
||||||
|
|
||||||
if (!visual) {
|
|
||||||
visual = DefaultVisual(dpy, screen);
|
|
||||||
depth = DefaultDepth(dpy, screen);
|
|
||||||
cmap = DefaultColormap(dpy, screen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#define OPAQUE 0xffU
|
|
||||||
|
|
||||||
static void xinitvisual();
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
void
|
|
||||||
togglealttag()
|
|
||||||
{
|
|
||||||
selmon->alttag = !selmon->alttag;
|
|
||||||
drawbar(selmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
static void togglealttag();
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
static int getstatusbarpid();
|
|
||||||
static void sigstatusbar(const Arg *arg);
|
|
||||||
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
void
|
|
||||||
setcurrentdesktop(void)
|
|
||||||
{
|
|
||||||
long data[] = { 0 };
|
|
||||||
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
setdesktopnames(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
XTextProperty text;
|
|
||||||
char *tags[NUMTAGS];
|
|
||||||
for (i = 0; i < NUMTAGS; i++)
|
|
||||||
tags[i] = tagicon(selmon, i);
|
|
||||||
Xutf8TextListToTextProperty(dpy, tags, NUMTAGS, XUTF8StringStyle, &text);
|
|
||||||
XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
setfloatinghint(Client *c)
|
|
||||||
{
|
|
||||||
Atom target = XInternAtom(dpy, "_IS_FLOATING", 0);
|
|
||||||
unsigned int floating[1] = {c->isfloating};
|
|
||||||
XChangeProperty(dpy, c->win, target, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)floating, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
setnumdesktops(void)
|
|
||||||
{
|
|
||||||
long data[] = { NUMTAGS };
|
|
||||||
XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
setviewport(void)
|
|
||||||
{
|
|
||||||
long data[] = { 0, 0 };
|
|
||||||
XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
updatecurrentdesktop(void)
|
|
||||||
{
|
|
||||||
long rawdata[] = { selmon->tagset[selmon->seltags] };
|
|
||||||
int i = 0;
|
|
||||||
while (*rawdata >> (i + 1)) {
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
long data[] = { i };
|
|
||||||
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
static void setcurrentdesktop(void);
|
|
||||||
static void setdesktopnames(void);
|
|
||||||
static void setfloatinghint(Client *c);
|
|
||||||
static void setnumdesktops(void);
|
|
||||||
static void setviewport(void);
|
|
||||||
static void updatecurrentdesktop(void);
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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 == ¢eredmaster)
|
|
||||||
return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB);
|
|
||||||
#endif // CENTEREDMASTER_LAYOUT
|
|
||||||
#if CENTEREDFLOATINGMASTER_LAYOUT
|
|
||||||
if (m->lt[m->sellt]->arrange == ¢eredfloatingmaster)
|
|
||||||
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 == ¢eredmaster && (fixed || n - m->nmaster > 1))
|
|
||||||
center = 1;
|
|
||||||
#endif // CENTEREDMASTER_LAYOUT
|
|
||||||
#if CENTEREDFLOATINGMASTER_LAYOUT
|
|
||||||
else if (m->lt[m->sellt]->arrange == ¢eredfloatingmaster)
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
static void keyrelease(XEvent *e);
|
|
||||||
static void holdbar(const Arg *arg);
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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')
|
|
||||||
return;
|
|
||||||
|
|
||||||
i = atoi(c);
|
|
||||||
setlayout(&((Arg) { .v = &layouts[i] }));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
static void layoutmenu(const Arg *arg);
|
|
||||||
|
|
||||||
@@ -1,18 +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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,4 +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);
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -1,107 +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;
|
|
||||||
}
|
|
||||||
return ClkTagBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -1,268 +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
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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';
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -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);
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
static Systray *systray = NULL;
|
|
||||||
static unsigned long systrayorientation = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
|
|
||||||
|
|
||||||
int
|
|
||||||
width_systray(Bar *bar, BarArg *a)
|
|
||||||
{
|
|
||||||
unsigned int w = 0;
|
|
||||||
Client *i;
|
|
||||||
if (!systray)
|
|
||||||
return 1;
|
|
||||||
if (showsystray) {
|
|
||||||
for (i = systray->icons; i; w += i->w + systrayspacing, i = i->next);
|
|
||||||
if (!w)
|
|
||||||
XMoveWindow(dpy, systray->win, -systray->h, bar->by);
|
|
||||||
}
|
|
||||||
return w ? w + lrpad - systrayspacing : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
draw_systray(Bar *bar, BarArg *a)
|
|
||||||
{
|
|
||||||
if (!showsystray)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
XSetWindowAttributes wa;
|
|
||||||
XWindowChanges wc;
|
|
||||||
Client *i;
|
|
||||||
unsigned int w;
|
|
||||||
|
|
||||||
if (!systray) {
|
|
||||||
/* init systray */
|
|
||||||
if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
|
|
||||||
die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
|
|
||||||
|
|
||||||
wa.override_redirect = True;
|
|
||||||
wa.event_mask = ButtonPressMask|ExposureMask;
|
|
||||||
wa.border_pixel = 0;
|
|
||||||
systray->h = MIN(a->h, drw->fonts->h);
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
wa.background_pixel = 0;
|
|
||||||
wa.colormap = cmap;
|
|
||||||
systray->win = XCreateWindow(dpy, root, bar->bx + a->x + lrpad / 2, -systray->h, MAX(a->w + 40, 1), systray->h, 0, depth,
|
|
||||||
InputOutput, visual,
|
|
||||||
CWOverrideRedirect|CWBorderPixel|CWBackPixel|CWColormap|CWEventMask, &wa); // CWBackPixmap
|
|
||||||
#else
|
|
||||||
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
|
||||||
systray->win = XCreateSimpleWindow(dpy, root, bar->bx + a->x + lrpad / 2, -systray->h, MIN(a->w, 1), systray->h, 0, 0, scheme[SchemeNorm][ColBg].pixel);
|
|
||||||
XChangeWindowAttributes(dpy, systray->win, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &wa);
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
|
|
||||||
XSelectInput(dpy, systray->win, SubstructureNotifyMask);
|
|
||||||
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
|
|
||||||
PropModeReplace, (unsigned char *)&systrayorientation, 1);
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayVisual], XA_VISUALID, 32,
|
|
||||||
PropModeReplace, (unsigned char *)&visual->visualid, 1);
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
XChangeProperty(dpy, systray->win, netatom[NetWMWindowType], XA_ATOM, 32,
|
|
||||||
PropModeReplace, (unsigned char *)&netatom[NetWMWindowTypeDock], 1);
|
|
||||||
XMapRaised(dpy, systray->win);
|
|
||||||
XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime);
|
|
||||||
if (XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) {
|
|
||||||
sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0);
|
|
||||||
XSync(dpy, False);
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "dwm: unable to obtain system tray.\n");
|
|
||||||
free(systray);
|
|
||||||
systray = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
systray->bar = bar;
|
|
||||||
|
|
||||||
wc.stack_mode = Above;
|
|
||||||
wc.sibling = bar->win;
|
|
||||||
XConfigureWindow(dpy, systray->win, CWSibling|CWStackMode, &wc);
|
|
||||||
|
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
|
||||||
for (w = 0, i = systray->icons; i; i = i->next) {
|
|
||||||
#if BAR_ALPHA_PATCH
|
|
||||||
wa.background_pixel = 0;
|
|
||||||
#else
|
|
||||||
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
|
||||||
#endif // BAR_ALPHA_PATCH
|
|
||||||
XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
|
|
||||||
XMapRaised(dpy, i->win);
|
|
||||||
i->x = w;
|
|
||||||
XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
|
|
||||||
w += i->w;
|
|
||||||
if (i->next)
|
|
||||||
w += systrayspacing;
|
|
||||||
if (i->mon != bar->mon)
|
|
||||||
i->mon = bar->mon;
|
|
||||||
}
|
|
||||||
|
|
||||||
XMoveResizeWindow(dpy, systray->win, bar->bx + a->x + lrpad / 2, (w ? bar->by + a->y + (a->h - systray->h) / 2: -systray->h), MAX(w, 1), systray->h);
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
click_systray(Bar *bar, Arg *arg, BarArg *a)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
removesystrayicon(Client *i)
|
|
||||||
{
|
|
||||||
Client **ii;
|
|
||||||
|
|
||||||
if (!showsystray || !i)
|
|
||||||
return;
|
|
||||||
for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
|
|
||||||
if (ii)
|
|
||||||
*ii = i->next;
|
|
||||||
XReparentWindow(dpy, i->win, root, 0, 0);
|
|
||||||
free(i);
|
|
||||||
drawbarwin(systray->bar);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
resizerequest(XEvent *e)
|
|
||||||
{
|
|
||||||
XResizeRequestEvent *ev = &e->xresizerequest;
|
|
||||||
Client *i;
|
|
||||||
|
|
||||||
if ((i = wintosystrayicon(ev->window))) {
|
|
||||||
updatesystrayicongeom(i, ev->width, ev->height);
|
|
||||||
drawbarwin(systray->bar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
updatesystrayicongeom(Client *i, int w, int h)
|
|
||||||
{
|
|
||||||
if (!systray)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int icon_height = systray->h;
|
|
||||||
if (i) {
|
|
||||||
i->h = icon_height;
|
|
||||||
if (w == h)
|
|
||||||
i->w = icon_height;
|
|
||||||
else if (h == icon_height)
|
|
||||||
i->w = w;
|
|
||||||
else
|
|
||||||
i->w = (int) ((float)icon_height * ((float)w / (float)h));
|
|
||||||
applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False);
|
|
||||||
/* force icons into the systray dimensions if they don't want to */
|
|
||||||
if (i->h > icon_height) {
|
|
||||||
if (i->w == i->h)
|
|
||||||
i->w = icon_height;
|
|
||||||
else
|
|
||||||
i->w = (int) ((float)icon_height * ((float)i->w / (float)i->h));
|
|
||||||
i->h = icon_height;
|
|
||||||
}
|
|
||||||
if (i->w > 2 * icon_height)
|
|
||||||
i->w = icon_height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
updatesystrayiconstate(Client *i, XPropertyEvent *ev)
|
|
||||||
{
|
|
||||||
long flags;
|
|
||||||
int code = 0;
|
|
||||||
|
|
||||||
if (!showsystray || !systray || !i || ev->atom != xatom[XembedInfo] ||
|
|
||||||
!(flags = getatomprop(i, xatom[XembedInfo], xatom[XembedInfo])))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (flags & XEMBED_MAPPED && !i->tags) {
|
|
||||||
i->tags = 1;
|
|
||||||
code = XEMBED_WINDOW_ACTIVATE;
|
|
||||||
XMapRaised(dpy, i->win);
|
|
||||||
setclientstate(i, NormalState);
|
|
||||||
}
|
|
||||||
else if (!(flags & XEMBED_MAPPED) && i->tags) {
|
|
||||||
i->tags = 0;
|
|
||||||
code = XEMBED_WINDOW_DEACTIVATE;
|
|
||||||
XUnmapWindow(dpy, i->win);
|
|
||||||
setclientstate(i, WithdrawnState);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
sendevent(i->win, xatom[Xembed], StructureNotifyMask, CurrentTime, code, 0,
|
|
||||||
systray->win, XEMBED_EMBEDDED_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
Client *
|
|
||||||
wintosystrayicon(Window w)
|
|
||||||
{
|
|
||||||
if (!systray)
|
|
||||||
return NULL;
|
|
||||||
Client *i = NULL;
|
|
||||||
if (!showsystray || !w)
|
|
||||||
return i;
|
|
||||||
for (i = systray->icons; i && i->win != w; i = i->next);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
|
||||||
#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
|
|
||||||
|
|
||||||
/* XEMBED messages */
|
|
||||||
#define XEMBED_EMBEDDED_NOTIFY 0
|
|
||||||
#define XEMBED_WINDOW_ACTIVATE 1
|
|
||||||
#define XEMBED_FOCUS_IN 4
|
|
||||||
#define XEMBED_MODALITY_ON 10
|
|
||||||
|
|
||||||
#define XEMBED_MAPPED (1 << 0)
|
|
||||||
#define XEMBED_WINDOW_ACTIVATE 1
|
|
||||||
#define XEMBED_WINDOW_DEACTIVATE 2
|
|
||||||
|
|
||||||
#define VERSION_MAJOR 0
|
|
||||||
#define VERSION_MINOR 0
|
|
||||||
#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
|
|
||||||
|
|
||||||
/* enums */
|
|
||||||
enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
|
|
||||||
|
|
||||||
typedef struct Systray Systray;
|
|
||||||
struct Systray {
|
|
||||||
Window win;
|
|
||||||
Client *icons;
|
|
||||||
Bar *bar;
|
|
||||||
int h;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* bar integration */
|
|
||||||
static int width_systray(Bar *bar, BarArg *a);
|
|
||||||
static int draw_systray(Bar *bar, BarArg *a);
|
|
||||||
static int click_systray(Bar *bar, Arg *arg, BarArg *a);
|
|
||||||
|
|
||||||
/* function declarations */
|
|
||||||
static void removesystrayicon(Client *i);
|
|
||||||
static void resizerequest(XEvent *e);
|
|
||||||
static void updatesystrayicongeom(Client *i, int w, int h);
|
|
||||||
static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
|
|
||||||
static Client *wintosystrayicon(Window w);
|
|
||||||
|
|
||||||
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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);
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user