BREAKING-CHANGE: fresh start; all mods removed; synced to master

This commit is contained in:
2024-12-23 12:25:39 +01:00
parent d4fed3cac6
commit 7d0264a0a0
56 changed files with 1163 additions and 611 deletions

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

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

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ dwm
dwm-msg
config.h
patches.h
.legacy/

View File

@@ -9,17 +9,11 @@ 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
all: dwm dwm-msg
else
all: options dwm
all: dwm
endif
options:
@echo dwm build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
.c.o:
${CC} -c ${CFLAGS} $<
@@ -74,4 +68,4 @@ uninstall:
${DESTDIR}${MANPREFIX}/man1/dwm.1\
${DESTDIR}${PREFIX}/share/xsessions/dwm.desktop
.PHONY: all options clean dist install uninstall
.PHONY: all clean dist install uninstall

View File

@@ -1,4 +1,4 @@
This dwm 6.4 (e81f17d, 2023-04-09) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0).
This dwm 6.5 (cfb8627, 2024-10-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
@@ -19,6 +19,22 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
### Changelog:
2024-10-30 - Added the border rule patch
2024-07-11 - Added variant of the launcher patch
2024-01-31 - Added the placedir patch
2023-12-22 - Added the do-not-die-on-color-allocation-failure patch
2023-12-01 - Added the sendmoncenter patch
2023-11-12 - Added the focusmaster-return patch variant
2023-06-27 - Added the focusfollowmouse and unmanaged patches
2023-06-25 - Added the toggletopbar patch
2023-01-18 - Added the view history patch
2022-10-08 - Added the alt-tab patch
@@ -300,6 +316,9 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [bidi](https://dwm.suckless.org/patches/bidi/)
- adds proper support for Right-To-Left (RTL) languages (such as Farsi, Arabic or Hebrew)
- [borderrule](https://dwm.suckless.org/patches/borderrule/)
- adds a client rule option to set border width on a per client basis
- [center](https://dwm.suckless.org/patches/center/)
- adds an iscentered rule to automatically center clients on the current monitor
@@ -351,6 +370,10 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- i.e. if topbar is 0 then dmenu will appear at the bottom and if 1 then dmenu will appear at
the top
- do-not-die-on-color-allocation-failure
- avoids dwm terminating (dying) on color allocation failures
- useful for the xrdb (xresources) and status2d patches
- [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
@@ -431,9 +454,17 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- allows focusing on clients based on direction (up, down, left, right) instead of client
order
- [focusfollowmouse](https://github.com/bakkeby/patches/wiki/focusfollowmouse)
- the window under the mouse cursor will receive focus when changing tags, closing windows or
moving client out of view (as opposed to the most recently focused client)
- [focusmaster](https://dwm.suckless.org/patches/focusmaster/)
- a simple patch that just puts focus back to the master client
- [focusmaster-return](https://dwm.suckless.org/patches/focusmaster/)
- a simple patch that just puts focus back to the master client
- additionally allows focus to be switched back to the previous client
- [focusonclick](https://dwm.suckless.org/patches/focusonclick/)
- this patch makes you switch focus only by mouse click and not sloppy (focus follows mouse
pointer)
@@ -498,6 +529,9 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [killunsel](https://dwm.suckless.org/patches/killunsel/)
- kills all visible clients that are not selected (only the selected client will remain)
- [launcher](https://dwm.suckless.org/patches/launcher/)
- adds buttons to the bar that can be used to launch applications
- [~leftlayout~](http://dwm.suckless.org/patches/leftlayout/)
- ~moves the layout symbol in the status bar to the left hand side~
@@ -579,6 +613,9 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [pertag](https://dwm.suckless.org/patches/pertag/)
- adds nmaster, mfact, layouts and more per tag rather than per monitor
- [placedir](https://github.com/bakkeby/patches/wiki/placedir)
- allows tiled windows to be moved in any direction (up, down, left, right)
- [placemouse](https://github.com/bakkeby/patches/wiki/placemouse)
- lets the user change the position of a client in the stack using the mouse.
@@ -616,7 +653,7 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [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)
- [roundedcorners](https://github.com/mitchweaver/suckless/blob/master/dwm/inactive/mitch-06-rounded_corners-f04cac6d6e39cd9e3fc4fae526e3d1e8df5e34b2.patch)
- adds rounded corners to client windows
- [savefloats](https://dwm.suckless.org/patches/save_floats/)
@@ -636,6 +673,9 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [selfrestart](https://dwm.suckless.org/patches/selfrestart/)
- restart dwm without the unnecessary dependency of an external script
- [sendmoncenter](https://dwm.suckless.org/patches/sendmoncenter/)
- floating windows being sent to another monitor will be centered
- [sendmon\_keepfocus](https://github.com/bakkeby/patches/wiki/sendmon_keepfocus/)
- minor patch that allow clients to keep focus when being sent to another monitor
@@ -772,15 +812,18 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- [togglefullscreen](https://github.com/bakkeby/patches/wiki/togglefullscreen/)
- allows you to toggle fullscreen on and off using a single shortcut key
- [togglelayout](https://github.com/bakkeby/patches/wiki/togglelayout)
- toggle layout using the same keyboard shortcuts to set the layout
- e.g. hitting `MOD+m` switches to monocle layout, hitting the same keybinding again brings
you back to the previous layout
- [toggletag](https://github.com/bakkeby/patches/wiki/toggletag)
- toggle tags using the same keyboard shortcuts to view tags
- e.g. hitting `MOD+4` lets you view tag 4 and hitting the keybinding a second time brings
you back to where you were before
- [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
- [toggletopbar](https://dwm.suckless.org/patches/toggletopbar/)
- allows for the bar position (top or bottom) to be toggled during runtime
- [transfer](https://dwm.suckless.org/patches/transfer/)
- lets you transfer the currently focused client between the master and stack area while
@@ -797,6 +840,10 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/X9IiSSM6
- resets isfloating on any visible windows that have it set and optionally also applies a
layout
- [unmanaged](https://github.com/bakkeby/patches/wiki/unmanaged)
- adds a client rule that allows for windows to not be managed by the window manager
- this can be useful for external bars, widgets, launchers, docks, desktop icons and more
- [~urgentborder~](https://dwm.suckless.org/patches/urgentborder/)
- ~this patch makes "urgent" windows have different colors~

179
bar.sh
View File

@@ -1,179 +0,0 @@
#!/bin/bash
function lighten_color() {
offset=20
hex_color=$1
hex_color=${hex_color:1}
red=${hex_color:0:2}
green=${hex_color:2:2}
blue=${hex_color:4:2}
red_dec=$(printf "%d" 0x$red)
green_dec=$(printf "%d" 0x$green)
blue_dec=$(printf "%d" 0x$blue)
if [[ $red_dec -lt 128 ]]; then
red_dec_l=$((red_dec+offset))
green_dec_l=$((green_dec+offset))
blue_dec_l=$((blue_dec+offset))
else
red_dec_l=$((red_dec-offset))
green_dec_l=$((green_dec-offset))
blue_dec_l=$((blue_dec-offset))
fi
red=$(printf "%02X" $red_dec_l)
green=$(printf "%02X" $green_dec_l)
blue=$(printf "%02X" $blue_dec_l)
echo "#$red$green$blue"
}
# ^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=#fb4934
maroon=#ee99a0
peach=#f5a97f
yellow=#eed49f
green=#b8bb26
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
# Special
background=#282828
foreground=#ebdbb2
cursor=#ebdbb2
# Colors
color0=#05090e
color1=#425965
color2=#016b86
color3=#1f7284
color4=#48717a
color5=#358292
color6=#79796b
color7=#828486
color8=#43464a
color9=#597787
color10=#028FB3
color11=#2A99B1
color12=#6097A3
color13=#47AEC3
color14=#A2A28F
color15=#c0c1c2
background0=$(lighten_color $background)
background1=$(lighten_color $background0)
background2=$(lighten_color $background1)
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$background^ ^b$yellow^ 󰇄 "
printf "^c$background^ ^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$background^^b$green^  "
printf "^c$background^^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$background^ ^b$blue^ 󰤨 ^c$background^ ^b$blue^Connected" ;;
down) printf "^c$background^ ^b$blue^ 󰤭 ^c$background^ ^b$blue^Disconnected" ;;
esac
}
clock() {
printf " $(date '+%I:%M %P') "
}
today() {
printf " $(date '+%b %e') "
}
net() {
if nc -zw1 c2yz.com 443; then
printf "^c$background^^b$green^ i "
else
printf "^c$background^^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$foreground^^b$background1^ $(brightness) ^b$background0^ $(battery) $(net)^c$foreground^^b$background0^ $(today) ^b$background1^ $(clock) ^b$background2^ $(pulse) "
else
sleep 1 && xsetroot -name "^c$foreground^$(net)^c$foreground^^b$background0^ $(today) ^b$background1^ $(clock) ^b$background2^ $(pulse) "
fi
done

View File

@@ -1,6 +1,8 @@
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* Helper macros for spawning commands */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
#define CMD(...) { .v = (const char*[]){ __VA_ARGS__, NULL } }
/* appearance */
#if ROUNDED_CORNERS_PATCH
@@ -9,7 +11,13 @@ static const int corner_radius = 10;
#else
static const unsigned int borderpx = 1; /* border pixel of windows */
#endif // ROUNDED_CORNERS_PATCH
static const unsigned int snap = 28; /* snap pixel */
#if BAR_BORDER_PATCH
/* This allows the bar border size to be explicitly set separately from borderpx.
* If left as 0 then it will default to the borderpx value of the monitor and will
* automatically update with setborderpx. */
static const unsigned int barborderpx = 0; /* border pixel of bar */
#endif // BAR_BORDER_PATCH
static const unsigned int snap = 32; /* snap pixel */
#if SWALLOW_PATCH
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
#endif // SWALLOW_PATCH
@@ -52,7 +60,7 @@ static const int showtab = showtab_auto; /* Default tab b
static const int toptab = False; /* False means bottom tab bar */
#endif // TAB_PATCH
#if BAR_HEIGHT_PATCH
static const int bar_height = 32; /* 0 means derive from font, >= 1 explicit height */
static const int bar_height = 0; /* 0 means derive from font, >= 1 explicit height */
#endif // BAR_HEIGHT_PATCH
#if BAR_PADDING_PATCH
static const int vertpad = 10; /* vertical padding of bar */
@@ -90,7 +98,7 @@ static const int horizpadbar = 2; /* horizontal padding for status
static const int vertpadbar = 0; /* vertical padding for statusbar */
#endif // BAR_STATUSPADDING_PATCH
#if BAR_STATUSBUTTON_PATCH
static const char buttonbar[] = "";
static const char buttonbar[] = "<O>";
#endif // BAR_STATUSBUTTON_PATCH
#if BAR_SYSTRAY_PATCH
static const unsigned int systrayspacing = 2; /* systray spacing */
@@ -103,7 +111,7 @@ static const int lcaselbl = 0; /* 1 means make tag label lowerc
#endif // BAR_TAGLABELS_PATCH
#if BAR_UNDERLINETAGS_PATCH
static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
static const unsigned int ulinestroke = 4; /* thickness / height of the underline */
static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
#endif // BAR_UNDERLINETAGS_PATCH
@@ -156,82 +164,53 @@ static void (*bartabmonfns[])(Monitor *) = { NULL /* , customlayoutfn */ };
#endif // MONOCLE_LAYOUT
#endif // BAR_TABGROUPS_PATCH
#if BAR_PANGO_PATCH
static const char font[] = "monospace 11";
static const char font[] = "monospace 10";
#else
static const char *fonts[] = { "FiraCode Mono Nerd Font:size=11:antialias=true", "monospace:size=11:antialias=true" };
static const char *fonts[] = { "monospace:size=10" };
#endif // BAR_PANGO_PATCH
static const char dmenufont[] = "FiraCode Mono Nerd Font:size=11:antialias=true";
static const char dmenufont[] = "monospace:size=10";
static char c000000[] = "#000000"; // placeholder value
static char normfgcolor[] = "#ebdbb2";
static char normbgcolor[] = "#282828";
static char normbordercolor[] = "#3c3836";
static char normfloatcolor[] = "#504945";
static char normfgcolor[] = "#bbbbbb";
static char normbgcolor[] = "#222222";
static char normbordercolor[] = "#444444";
static char normfloatcolor[] = "#db8fd9";
static char selfgcolor[] = "#181926";
static char selbgcolor[] = "#ed8796";
static char selbordercolor[] = "#ee99a0";
static char selfloatcolor[] = "#ee99a0";
static char selfgcolor[] = "#eeeeee";
static char selbgcolor[] = "#005577";
static char selbordercolor[] = "#005577";
static char selfloatcolor[] = "#005577";
static char titlenormfgcolor[] = "#ebdbb2";
static char titlenormbgcolor[] = "#282828";
static char titlenormbordercolor[] = "#3c3836";
static char titlenormfloatcolor[] = "#b16286";
static char titlenormfgcolor[] = "#bbbbbb";
static char titlenormbgcolor[] = "#222222";
static char titlenormbordercolor[] = "#444444";
static char titlenormfloatcolor[] = "#db8fd9";
static char titleselfgcolor[] = "#fabd2f";
static char titleselbgcolor[] = "#282828";
static char titleselbordercolor[] = "#3c3836";
static char titleselfloatcolor[] = "#b8bb26";
static char titleselfgcolor[] = "#eeeeee";
static char titleselbgcolor[] = "#005577";
static char titleselbordercolor[] = "#005577";
static char titleselfloatcolor[] = "#005577";
static char tagsnormfgcolor[] = "#ebdbb2";
static char tagsnormbgcolor[] = "#282828";
static char tagsnormbordercolor[] = "#3c3836";
static char tagsnormfloatcolor[] = "#3c3836";
static char tagsnormfgcolor[] = "#bbbbbb";
static char tagsnormbgcolor[] = "#222222";
static char tagsnormbordercolor[] = "#444444";
static char tagsnormfloatcolor[] = "#db8fd9";
static char tagsselfgcolor[] = "#fabd2f";
static char tagsselbgcolor[] = "#282828";
static char tagsselbordercolor[] = "#3c3836";
static char tagsselfloatcolor[] = "#b8bb26";
static char tagsselfgcolor[] = "#eeeeee";
static char tagsselbgcolor[] = "#005577";
static char tagsselbordercolor[] = "#005577";
static char tagsselfloatcolor[] = "#005577";
static char hidnormfgcolor[] = "#504945";
static char hidselfgcolor[] = "#504945";
static char hidnormbgcolor[] = "#1d2021";
static char hidselbgcolor[] = "#1d2021";
static char urgfgcolor[] = "#1d2021";
static char urgbgcolor[] = "#fb4934";
static char urgbordercolor[] = "#fb4934";
static char urgfloatcolor[] = "#fb4934";
static const char *mutevol[] = {"pactl", "set-sink-mute", "0", "toggle", NULL};
static const char *downvol[] = {"pactl", "set-sink-volume", "0", "-3%", NULL};
static const char *upvol[] = {"pactl", "set-sink-volume", "0", "+3%", NULL};
static const char *mutemic[] = {"pactl", "set-source-mute", "0", "toggle", NULL};
static const char *downbrt[] = {"brightnessctl", "s", "5%-", NULL};
static const char *upbrt[] = {"brightnessctl", "s", "5%+", NULL};
static const char *displ[] = {"arandr", NULL};
static const char *wlan[] = {"kitty", "-e", "nmtui", NULL};
static const char *tools[] = {"lxappearance"};
// static const char *search[] = {"rofi", "-show", "drun", NULL};
// static const char *launcha[] = {alttabstart};
static const char *nemo[] = {"nemo", NULL};
static const char *explorer[] = {"kitty", "-e", "lf", NULL};
static const char *editor[] = {"neovide", NULL};
static const char *mail[] = {"kitty", "-e", "neomutt", NULL};
static const char *music[] = {"kitty", "-e", "ncmpcpp", NULL};
static const char *spotify[] = {"kitty", "-e", "ncspot", NULL};
static const char *audio[] = {"kitty", "-e", "ncpamixer", NULL};
static const char *locksession[] = {"loginctl", "lock-session", NULL};
// static const char *websearch[] = {".config/rofi/scripts/websearch", NULL};
// static const char *emoji[] = {".config/rofi/scripts/emoji", NULL};
static const char *launcher[] = {"rofi", "-show", "drun", NULL};
// static const char *wallpaper[] = {".config/rofi/scripts/wallpaper", NULL};
// static const char *theme[] = {".config/rofi/scripts/theme", NULL};
// static const char *powermenu[] = {".config/rofi/scripts/powermenu", NULL};
static char hidnormfgcolor[] = "#005577";
static char hidselfgcolor[] = "#227799";
static char hidnormbgcolor[] = "#222222";
static char hidselbgcolor[] = "#222222";
static char urgfgcolor[] = "#bbbbbb";
static char urgbgcolor[] = "#222222";
static char urgbordercolor[] = "#ff0000";
static char urgfloatcolor[] = "#db8fd9";
#if RENAMED_SCRATCHPADS_PATCH
static char scratchselfgcolor[] = "#FFF7D4";
@@ -424,6 +403,13 @@ static char *statuscolors[][ColCount] = {
static const char *layoutmenu_cmd = "layoutmenu.sh";
#endif
#if BAR_LAUNCHER_PATCH
static const Launcher launchers[] = {
/* icon to display command */
{ "surf", CMD("surf", "duckduckgo.com") },
};
#endif // BAR_LAUNCHER_PATCH
#if COOL_AUTOSTART_PATCH
static const char *const autostart[] = {
"st", NULL,
@@ -434,8 +420,7 @@ static const char *const autostart[] = {
#if RENAMED_SCRATCHPADS_PATCH
static const char *scratchpadcmd[] = {"s", "st", "-n", "spterm", NULL};
#elif SCRATCHPADS_PATCH
// const char *spcmd1[] = {"alacritty", "-t", "scratchpad", "--option", "window.dimensions.columns=120", "--option", "window.dimensions.lines=34", NULL };
const char *spcmd1[] = {"kitty", "--name", "scratchpad", NULL };
const char *spcmd1[] = {"st", "-n", "spterm", "-g", "120x34", NULL };
static Sp scratchpads[] = {
/* name cmd */
{"spterm", spcmd1},
@@ -475,8 +460,7 @@ static char tagicons[][NUMTAGS][MAX_TAGLEN] =
static char *tagicons[][NUMTAGS] =
#endif // NAMETAG_PATCH
{
// [DEFAULT_TAGS] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" },
[DEFAULT_TAGS] = { "", "", "", "", "", "", "", "", "" },
[DEFAULT_TAGS] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" },
[ALTERNATIVE_TAGS] = { "A", "B", "C", "D", "E", "F", "G", "H", "I" },
[ALT_TAGS_DECORATION] = { "<1>", "<2>", "<3>", "<4>", "<5>", "<6>", "<7>", "<8>", "<9>" },
};
@@ -575,14 +559,17 @@ static const BarRule barrules[] = {
#if BAR_STATUSBUTTON_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, NULL, "statusbutton" },
#endif // BAR_STATUSBUTTON_PATCH
#if BAR_LAUNCHER_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_launcher, draw_launcher, click_launcher, NULL, "launcher" },
#endif // BAR_LAUNCHER_PATCH
#if BAR_POWERLINE_TAGS_PATCH
{ 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, NULL, "powerline_tags" },
{ 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, hover_pwrl_tags, "powerline_tags" },
#endif // BAR_POWERLINE_TAGS_PATCH
#if BAR_TAGS_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, hover_tags, "tags" },
#endif // BAR_TAGS_PATCH
#if BAR_TAGLABELS_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_taglabels, draw_taglabels, click_taglabels, NULL, "taglabels" },
{ -1, 0, BAR_ALIGN_LEFT, width_taglabels, draw_taglabels, click_taglabels, hover_taglabels, "taglabels" },
#endif // BAR_TAGLABELS_PATCH
#if BAR_TAGGRID_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_taggrid, draw_taggrid, click_taggrid, NULL, "taggrid" },
@@ -796,31 +783,31 @@ static const char *xkb_layouts[] = {
#endif // XKB_PATCH
/* key definitions */
#define MODKEY Mod4Mask
#define MODKEY Mod1Mask
#if COMBO_PATCH && SWAPTAGS_PATCH && TAGOTHERMONITOR_PATCH
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, comboview, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, combotag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask|ControlMask, KEY, tagprevmon, {.ui = 1 << TAG} },
{ MODKEY|Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} }, \
{ MODKEY|Mod4Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \
{ MODKEY|Mod4Mask|ControlMask, KEY, tagprevmon, {.ui = 1 << TAG} },
#elif COMBO_PATCH && SWAPTAGS_PATCH
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, comboview, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, combotag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
{ MODKEY|Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
#elif COMBO_PATCH && TAGOTHERMONITOR_PATCH
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, comboview, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, combotag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask|ControlMask, KEY, tagprevmon, {.ui = 1 << TAG} },
{ MODKEY|Mod4Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \
{ MODKEY|Mod4Mask|ControlMask, KEY, tagprevmon, {.ui = 1 << TAG} },
#elif COMBO_PATCH
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, comboview, {.ui = 1 << TAG} }, \
@@ -833,24 +820,24 @@ static const char *xkb_layouts[] = {
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask|ControlMask, KEY, tagprevmon, {.ui = 1 << TAG} },
{ MODKEY|Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} }, \
{ MODKEY|Mod4Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \
{ MODKEY|Mod4Mask|ControlMask, KEY, tagprevmon, {.ui = 1 << TAG} },
#elif SWAPTAGS_PATCH
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
{ MODKEY|Mod4Mask|ShiftMask, KEY, swaptags, {.ui = 1 << TAG} },
#elif TAGOTHERMONITOR_PATCH
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \
{ MODKEY|Mod1Mask|ControlMask, KEY, tagprevmon, {.ui = 1 << TAG} },
{ MODKEY|Mod4Mask, KEY, tagnextmon, {.ui = 1 << TAG} }, \
{ MODKEY|Mod4Mask|ControlMask, KEY, tagprevmon, {.ui = 1 << TAG} },
#else
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
@@ -874,14 +861,10 @@ static const char *xkb_layouts[] = {
#define HOLDKEY 0 // replace 0 with the keysym to activate holdbar
#endif // BAR_HOLDBAR_PATCH
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
#if !NODMENU_PATCH
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
#endif // NODMENU_PATCH
// static const char *rofidruncmd[] = {"rofi", "-show", "drun", "-modi", "drun,run,window,calc", "-no-show-match", "-no-sort", "-automatic-save-to-history", NULL};
static const char *dmenucmd[] = {
"dmenu_run",
#if !NODMENU_PATCH
@@ -897,8 +880,7 @@ static const char *dmenucmd[] = {
#endif // BAR_DMENUMATCHTOP_PATCH
NULL
};
static const char *termcmd[] = { "kitty", NULL };
static const char *prtscrcmd[] = { "flameshot", "gui", NULL };
static const char *termcmd[] = { "st", NULL };
#if BAR_STATUSCMD_PATCH
#if BAR_DWMBLOCKS_PATCH
@@ -926,36 +908,6 @@ static const Key on_empty_keys[] = {
static const Key keys[] = {
/* modifier key function argument */
{0, XF86XK_AudioMute, spawn, {.v = mutevol}},
{0, XF86XK_AudioLowerVolume, spawn, {.v = downvol}},
{0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol}},
{0, XF86XK_AudioMicMute, spawn, {.v = mutemic}},
{0, XF86XK_MonBrightnessDown, spawn, {.v = downbrt}},
{0, XF86XK_MonBrightnessUp, spawn, {.v = upbrt}},
{0, XF86XK_Display, spawn, {.v = displ}},
{0, XF86XK_WLAN, spawn, {.v = wlan}},
{0, XF86XK_Tools, spawn, {.v = tools}},
// {0, XF86XK_Search, spawn, {.v = search}},
{0, XF86XK_LaunchA, alttabstart, {0}},
{0, XF86XK_Explorer, spawn, {.v = explorer}},
{ MODKEY|Mod1Mask, XK_F1, spawn, {.v = upvol}},
{ MODKEY|Mod1Mask, XK_F3, spawn, {.v = downvol}},
{ MODKEY, XK_n, spawn, {.v = nemo} },
{ MODKEY, XK_w, spawn, {.v = editor} },
{ MODKEY, XK_e, spawn, {.v = explorer} },
{ MODKEY|ShiftMask, XK_l, spawn, {.v = locksession} },
{ 0, XK_Print, spawn, {.v = prtscrcmd} },
{ MODKEY|ShiftMask, XK_s, spawn, {.v = prtscrcmd} },
{ MODKEY, XK_a, spawn, {.v = spotify} },
{ MODKEY, XK_s, spawn, {.v = music} },
{ MODKEY, XK_d, spawn, {.v = audio} },
{ MODKEY, XK_x, spawn, {.v = mail} },
// { MODKEY, XK_z, spawn, {.v = websearch} },
// { MODKEY, XK_semicolon, spawn, {.v = emoji} },
{ MODKEY, XK_space, spawn, {.v = launcher} },
// { MODKEY, XK_w, spawn, {.v = wallpaper} },
// { MODKEY, XK_e, spawn, {.v = theme} },
// { MODKEY, XK_x, spawn, {.v = powermenu} },
#if KEYMODES_PATCH
{ MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE} },
#endif // KEYMODES_PATCH
@@ -967,12 +919,15 @@ static const Key keys[] = {
{ MODKEY, XK_s, rioresize, {0} },
#endif // RIODRAW_PATCH
{ MODKEY, XK_b, togglebar, {0} },
#if TOGGLETOPBAR_PATCH
{ MODKEY|ShiftMask, XK_b, toggletopbar, {0} },
#endif // TOGGLETOPBAR_PATCH
#if TAB_PATCH
{ MODKEY|ControlMask, XK_b, tabmode, {-1} },
#endif // TAB_PATCH
#if FOCUSMASTER_PATCH
#if FOCUSMASTER_PATCH || FOCUSMASTER_RETURN_PATCH
{ MODKEY|ControlMask, XK_space, focusmaster, {0} },
#endif // FOCUSMASTER_PATCH
#endif // FOCUSMASTER_PATCH / FOCUSMASTER_RETURN_PATCH
#if STACKER_PATCH
STACKKEYS(MODKEY, focus)
STACKKEYS(MODKEY|ShiftMask, push)
@@ -986,6 +941,12 @@ static const Key keys[] = {
{ MODKEY, XK_Up, focusdir, {.i = 2 } }, // up
{ MODKEY, XK_Down, focusdir, {.i = 3 } }, // down
#endif // FOCUSDIR_PATCH
#if PLACEDIR_PATCH
{ MODKEY|ControlMask, XK_Left, placedir, {.i = 0 } }, // left
{ MODKEY|ControlMask, XK_Right, placedir, {.i = 1 } }, // right
{ MODKEY|ControlMask, XK_Up, placedir, {.i = 2 } }, // up
{ MODKEY|ControlMask, XK_Down, placedir, {.i = 3 } }, // down
#endif // PLACEDIR_PATCH
#if SWAPFOCUS_PATCH && PERTAG_PATCH
{ MODKEY, XK_s, swapfocus, {.i = -1 } },
#endif // SWAPFOCUS_PATCH
@@ -993,21 +954,21 @@ static const Key keys[] = {
{ MODKEY, XK_v, switchcol, {0} },
#endif // SWITCHCOL_PATCH
#if ROTATESTACK_PATCH
{ MODKEY|Mod1Mask, XK_j, rotatestack, {.i = +1 } },
{ MODKEY|Mod1Mask, XK_k, rotatestack, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_j, rotatestack, {.i = +1 } },
{ MODKEY|Mod4Mask, XK_k, rotatestack, {.i = -1 } },
#endif // ROTATESTACK_PATCH
#if INPLACEROTATE_PATCH
{ MODKEY|Mod1Mask, XK_j, inplacerotate, {.i = +2 } }, // same as rotatestack
{ MODKEY|Mod1Mask, XK_k, inplacerotate, {.i = -2 } }, // same as reotatestack
{ MODKEY|Mod1Mask|ShiftMask, XK_j, inplacerotate, {.i = +1} },
{ MODKEY|Mod1Mask|ShiftMask, XK_k, inplacerotate, {.i = -1} },
{ MODKEY|Mod4Mask, XK_j, inplacerotate, {.i = +2 } }, // same as rotatestack
{ MODKEY|Mod4Mask, XK_k, inplacerotate, {.i = -2 } }, // same as reotatestack
{ MODKEY|Mod4Mask|ShiftMask, XK_j, inplacerotate, {.i = +1} },
{ MODKEY|Mod4Mask|ShiftMask, XK_k, inplacerotate, {.i = -1} },
#endif // INPLACEROTATE_PATCH
#if PUSH_PATCH || PUSH_NO_MASTER_PATCH
{ MODKEY|ControlMask, XK_j, pushdown, {0} },
{ MODKEY|ControlMask, XK_k, pushup, {0} },
#endif // PUSH_PATCH / PUSH_NO_MASTER_PATCH
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY|Mod1Mask, XK_i, incnmaster, {.i = -1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
#if FLEXTILE_DELUXE_LAYOUT
{ MODKEY|ControlMask, XK_i, incnstack, {.i = +1 } },
{ MODKEY|ControlMask, XK_u, incnstack, {.i = -1 } },
@@ -1024,14 +985,14 @@ static const Key keys[] = {
{ MODKEY|ControlMask|ShiftMask, XK_r, aspectresize, {.i = -24} },
#endif // ASPECTRESIZE_PATCH
#if MOVERESIZE_PATCH
{ MODKEY|Mod1Mask, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
{ MODKEY|Mod1Mask, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
{ MODKEY|Mod1Mask, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },
{ MODKEY|Mod1Mask, XK_Left, moveresize, {.v = "-25x 0y 0w 0h" } },
{ MODKEY|Mod1Mask|ShiftMask, XK_Down, moveresize, {.v = "0x 0y 0w 25h" } },
{ MODKEY|Mod1Mask|ShiftMask, XK_Up, moveresize, {.v = "0x 0y 0w -25h" } },
{ MODKEY|Mod1Mask|ShiftMask, XK_Right, moveresize, {.v = "0x 0y 25w 0h" } },
{ MODKEY|Mod1Mask|ShiftMask, XK_Left, moveresize, {.v = "0x 0y -25w 0h" } },
{ MODKEY|Mod4Mask, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
{ MODKEY|Mod4Mask, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
{ MODKEY|Mod4Mask, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },
{ MODKEY|Mod4Mask, XK_Left, moveresize, {.v = "-25x 0y 0w 0h" } },
{ MODKEY|Mod4Mask|ShiftMask, XK_Down, moveresize, {.v = "0x 0y 0w 25h" } },
{ MODKEY|Mod4Mask|ShiftMask, XK_Up, moveresize, {.v = "0x 0y 0w -25h" } },
{ MODKEY|Mod4Mask|ShiftMask, XK_Right, moveresize, {.v = "0x 0y 25w 0h" } },
{ MODKEY|Mod4Mask|ShiftMask, XK_Left, moveresize, {.v = "0x 0y -25w 0h" } },
#endif // MOVERESIZE_PATCH
#if MOVESTACK_PATCH
{ MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } },
@@ -1054,22 +1015,22 @@ static const Key keys[] = {
#endif // INSETS_PATCH
{ MODKEY, XK_Return, zoom, {0} },
#if VANITYGAPS_PATCH
{ MODKEY|Mod1Mask, XK_u, incrgaps, {.i = +1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_i, incrigaps, {.i = +1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_o, incrogaps, {.i = +1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_6, incrihgaps, {.i = +1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_7, incrivgaps, {.i = +1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_8, incrohgaps, {.i = +1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_9, incrovgaps, {.i = +1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_0, togglegaps, {0} },
{ MODKEY|Mod1Mask|ShiftMask, XK_0, defaultgaps, {0} },
{ MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_i, incrigaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_o, incrogaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_6, incrihgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_7, incrivgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_8, incrohgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_9, incrovgaps, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
{ MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
{ MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
#endif // VANITYGAPS_PATCH
#if ALT_TAB_PATCH
{ Mod1Mask, XK_Tab, alttabstart, {0} },
@@ -1089,22 +1050,21 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_backslash, shiftview, { .i = +1 } },
#endif // SHIFTVIEW_PATCH
#if SHIFTVIEW_CLIENTS_PATCH
{ MODKEY|Mod1Mask, XK_Tab, shiftviewclients, { .i = -1 } },
{ MODKEY|Mod1Mask, XK_backslash, shiftviewclients, { .i = +1 } },
{ MODKEY|Mod4Mask, XK_Tab, shiftviewclients, { .i = -1 } },
{ MODKEY|Mod4Mask, XK_backslash, shiftviewclients, { .i = +1 } },
#endif // SHIFTVIEW_CLIENTS_PATCH
#if SHIFTBOTH_PATCH
{ MODKEY|ControlMask, XK_Left, shiftboth, { .i = -1 } }, // note keybinding conflict with focusadjacenttag tagandviewtoleft
{ MODKEY|ControlMask, XK_Right, shiftboth, { .i = +1 } }, // note keybinding conflict with focusadjacenttag tagandviewtoright
{ MODKEY|ControlMask, XK_Left, shiftboth, { .i = -1 } }, // note keybinding conflict with focusadjacenttag tagandviewtoleft placedir
{ MODKEY|ControlMask, XK_Right, shiftboth, { .i = +1 } }, // note keybinding conflict with focusadjacenttag tagandviewtoright placedir
#endif // SHIFTBOTH_PATCH
#if SHIFTSWAPTAGS_PATCH && SWAPTAGS_PATCH
{ MODKEY|Mod1Mask|ShiftMask, XK_Left, shiftswaptags, { .i = -1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_Right, shiftswaptags, { .i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_Left, shiftswaptags, { .i = -1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_Right, shiftswaptags, { .i = +1 } },
#endif // SHIFTSWAPTAGS_PATCH
#if BAR_WINTITLEACTIONS_PATCH
{ MODKEY|ControlMask, XK_z, showhideclient, {0} },
#endif // BAR_WINTITLEACTIONS_PATCH
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_q, killclient, {0} },
#if KILLUNSEL_PATCH
{ MODKEY|ShiftMask, XK_x, killunsel, {0} },
#endif // KILLUNSEL_PATCH
@@ -1144,7 +1104,7 @@ static const Key keys[] = {
{ MODKEY|Mod5Mask|Mod1Mask, XK_Tab, rotatelayoutaxis, {.i = -4 } }, /* flextile, 4 = secondary stack axis */
{ MODKEY|ControlMask, XK_Return, mirrorlayout, {0} }, /* flextile, flip master and stack areas */
#endif // FLEXTILE_DELUXE_LAYOUT
// { MODKEY, XK_space, spawn, {.v = rofidruncmd}},
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
#if MAXIMIZE_PATCH
{ MODKEY|ControlMask|ShiftMask, XK_h, togglehorizontalmax, {0} },
@@ -1166,7 +1126,7 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_grave, removescratch, {.ui = 0 } },
#endif // SCRATCHPADS_PATCH | RENAMED_SCRATCHPADS_PATCH
#if UNFLOATVISIBLE_PATCH
{ MODKEY|Mod1Mask, XK_space, unfloatvisible, {0} },
{ MODKEY|Mod4Mask, XK_space, unfloatvisible, {0} },
{ MODKEY|ShiftMask, XK_t, unfloatvisible, {.v = &layouts[0]} },
#endif // UNFLOATVISIBLE_PATCH
#if TOGGLEFULLSCREEN_PATCH
@@ -1201,8 +1161,8 @@ static const Key keys[] = {
{ MODKEY, XK_Right, viewtoright, {0} }, // note keybinding conflict with focusdir
{ MODKEY|ShiftMask, XK_Left, tagtoleft, {0} }, // note keybinding conflict with shifttag
{ MODKEY|ShiftMask, XK_Right, tagtoright, {0} }, // note keybinding conflict with shifttag
{ MODKEY|ControlMask, XK_Left, tagandviewtoleft, {0} },
{ MODKEY|ControlMask, XK_Right, tagandviewtoright, {0} },
{ MODKEY|ControlMask, XK_Left, tagandviewtoleft, {0} }, // note keybinding conflict with placedir
{ MODKEY|ControlMask, XK_Right, tagandviewtoright, {0} }, // note keybinding conflict with placedir
#endif // FOCUSADJACENTTAG_PATCH
#if TAGALL_PATCH
{ MODKEY|ShiftMask, XK_F1, tagall, {.v = "F1"} },
@@ -1225,12 +1185,12 @@ static const Key keys[] = {
{ MODKEY|ControlMask, XK_F9, tagall, {.v = "9"} },
#endif // TAGALL_PATCH
#if TAGALLMON_PATCH
{ MODKEY|Mod1Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } },
{ MODKEY|Mod1Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } },
{ MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } },
#endif // TAGALLMON_PATCH
#if TAGSWAPMON_PATCH
{ MODKEY|Mod1Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } },
{ MODKEY|Mod1Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } },
{ MODKEY|Mod4Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } },
{ MODKEY|Mod4Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } },
#endif // TAGSWAPMON_PATCH
#if BAR_ALTERNATIVE_TAGS_PATCH
{ MODKEY, XK_n, togglealttag, {0} },
@@ -1241,12 +1201,12 @@ static const Key keys[] = {
#if BAR_TAGGRID_PATCH
{ MODKEY|ControlMask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_VIEW } },
{ MODKEY|ControlMask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } },
{ MODKEY|ControlMask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_VIEW } },
{ MODKEY|ControlMask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_VIEW } },
{ MODKEY|Mod1Mask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod1Mask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod1Mask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod1Mask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|ControlMask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_VIEW } }, // note keybinding conflict with placedir
{ MODKEY|ControlMask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_VIEW } }, // note keybinding conflict with placedir
{ MODKEY|Mod4Mask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod4Mask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod4Mask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod4Mask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
#endif // BAR_TAGGRID_PATCH
#if MOVEPLACE_PATCH
{ MODKEY, XK_KP_7, moveplace, {.ui = WIN_NW }}, /* XK_KP_Home, */
@@ -1460,6 +1420,9 @@ static const Signal signals[] = {
{ "focusstack", focusstack },
{ "setmfact", setmfact },
{ "togglebar", togglebar },
#if TOGGLETOPBAR_PATCH
{ "toggletopbar", toggletopbar },
#endif // TOGGLETOPBAR_PATCH
{ "incnmaster", incnmaster },
{ "togglefloating", togglefloating },
{ "focusmon", focusmon },
@@ -1658,6 +1621,9 @@ static IPCCommand ipccommands[] = {
IPCCOMMAND( tag, 1, {ARG_TYPE_UINT} ),
IPCCOMMAND( tagmon, 1, {ARG_TYPE_UINT} ),
IPCCOMMAND( togglebar, 1, {ARG_TYPE_NONE} ),
#if TOGGLETOPBAR_PATCH
IPCCOMMAND( toggletopbar, 1, {ARG_TYPE_NONE} ),
#endif // TOGGLETOPBAR_PATCH
IPCCOMMAND( togglefloating, 1, {ARG_TYPE_NONE} ),
IPCCOMMAND( toggletag, 1, {ARG_TYPE_UINT} ),
IPCCOMMAND( toggleview, 1, {ARG_TYPE_UINT} ),

View File

@@ -1,5 +1,5 @@
# dwm version
VERSION = 6.4
VERSION = 6.5
# Customize below to fit your system
@@ -29,7 +29,7 @@ FREETYPEINC = /usr/include/freetype2
#KVMLIB = -lkvm
# Uncomment this for the alpha patch and the winicon patch (BAR_ALPHA_PATCH, BAR_WINICON_PATCH)
XRENDER = -lXrender
#XRENDER = -lXrender
# Uncomment this for the mdpcontrol patch / MDPCONTROL_PATCH
#MPDCLIENT = -lmpdclient
@@ -52,15 +52,15 @@ XRENDER = -lXrender
#IMLIB2LIBS = -lImlib2
# Uncomment for the bidi patch
#BDINC = -I/usr/include/fribidi
#BDLIBS = -lfribidi
#BDINC = `pkg-config --cflags fribidi`
#BDLIBS = `pkg-config --libs fribidi`
# 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_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
CFLAGS = -std=c99 -pedantic -Wall -Wno-unused-function -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS}

198
drw.c
View File

@@ -35,12 +35,6 @@ apply_fribidi(const char *str)
#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
@@ -48,47 +42,39 @@ 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)
static int
utf8decode(const char *s_in, long *u, int *err)
{
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;
static const unsigned char lens[] = {
/* 0XXXX */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* 10XXX */ 0, 0, 0, 0, 0, 0, 0, 0, /* invalid */
/* 110XX */ 2, 2, 2, 2,
/* 1110X */ 3, 3,
/* 11110 */ 4,
/* 11111 */ 0, /* invalid */
};
static const unsigned char leading_mask[] = { 0x7F, 0x1F, 0x0F, 0x07 };
static const unsigned int overlong[] = { 0x0, 0x80, 0x0800, 0x10000 };
const unsigned char *s = (const unsigned char *)s_in;
int len = lens[*s >> 3];
*u = UTF_INVALID;
if (!clen)
return 0;
udecoded = utf8decodebyte(c[0], &len);
if (!BETWEEN(len, 1, UTF_SIZ))
*err = 1;
if (len == 0)
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);
long cp = s[0] & leading_mask[len - 1];
for (int i = 1; i < len; ++i) {
if (s[i] == '\0' || (s[i] & 0xC0) != 0x80)
return i;
cp = (cp << 6) | (s[i] & 0x3F);
}
/* out of range, surrogate, overlong encoding */
if (cp > 0x10FFFF || (cp >> 11) == 0x1B || cp < overlong[len - 1])
return len;
*err = 0;
*u = cp;
return len;
}
#endif // BAR_PANGO_PATCH
@@ -337,14 +323,22 @@ drw_clr_create(
#if BAR_ALPHA_PATCH
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
#if DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
fprintf(stderr, "warning, cannot allocate color '%s'", clrname);
#else
die("error, cannot allocate color '%s'", clrname);
#endif // DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
#else
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen),
clrname, dest))
#if DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
fprintf(stderr, "warning, cannot allocate color '%s'", clrname);
#else
die("error, cannot allocate color '%s'", clrname);
#endif // DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH
#if NO_TRANSPARENT_BORDERS_PATCH
dest->pixel |= 0xff << 24;
@@ -428,10 +422,10 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
{
#if BAR_PANGO_PATCH
char buf[1024];
int ty;
unsigned int ew;
int i, ty, th;
unsigned int ew, eh;
XftDraw *d = NULL;
size_t i, len;
size_t len;
int render = x || y || w || h;
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
@@ -442,6 +436,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
if (w < lpad)
return x + w;
#if BAR_ALPHA_PATCH
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
#else
@@ -456,10 +452,14 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
len = strlen(text);
if (len) {
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup);
drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup);
th = eh;
/* shorten text if necessary */
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--)
drw_font_getexts(drw->fonts, text, len, &ew, NULL, markup);
for (len = MIN(len, sizeof(buf) - 1); len && ew > w; len--) {
drw_font_getexts(drw->fonts, text, len, &ew, &eh, markup);
if (eh > th)
th = eh;
}
if (len) {
memcpy(buf, text, len);
@@ -469,7 +469,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
; /* NOP */
if (render) {
ty = y + (h - drw->fonts->h) / 2;
ty = y + (h - th) / 2;
if (markup)
pango_layout_set_markup(drw->fonts->layout, buf, len);
else
@@ -488,29 +488,32 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
return x + (render ? w : 0);
#else
char buf[1024];
int ty;
unsigned int ew;
int ty, ellipsis_x = 0;
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len, hash, h0, h1;
XftDraw *d = NULL;
Fnt *usedfont, *curfont, *nextfont;
size_t i, len;
int utf8strlen, utf8charlen, render = x || y || w || h;
int utf8strlen, utf8charlen, utf8err, render = x || y || w || h;
long utf8codepoint = 0;
const char *utf8str;
FcCharSet *fccharset;
FcPattern *fcpattern;
FcPattern *match;
XftResult result;
int charexists = 0;
int charexists = 0, overflow = 0;
/* keep track of a couple codepoints for which we have no match. */
static unsigned int nomatches[128], ellipsis_width, invalid_width;
static const char invalid[] = "<EFBFBD>";
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
return 0;
if (!render) {
w = ~w;
w = invert ? invert : ~invert;
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
if (w < lpad)
return x + w;
#if BAR_ALPHA_PATCH
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
#else
@@ -523,18 +526,40 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
}
usedfont = drw->fonts;
if (!ellipsis_width && render)
ellipsis_width = drw_fontset_getwidth(drw, "...", markup);
if (!invalid_width && render)
invalid_width = drw_fontset_getwidth(drw, invalid, markup);
while (1) {
utf8strlen = 0;
ew = ellipsis_len = utf8err = utf8charlen = utf8strlen = 0;
utf8str = text;
nextfont = NULL;
while (*text) {
utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
utf8charlen = utf8decode(text, &utf8codepoint, &utf8err);
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
if (charexists) {
if (curfont == usedfont) {
utf8strlen += utf8charlen;
drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL);
if (ew + ellipsis_width <= w) {
/* keep track where the ellipsis still fits */
ellipsis_x = x + ew;
ellipsis_w = w - ew;
ellipsis_len = utf8strlen;
}
if (ew + tmpw > w) {
overflow = 1;
/* called from drw_fontset_getwidth_clamp():
* it wants the width AFTER the overflow
*/
if (!render)
x += tmpw;
else
utf8strlen = ellipsis_len;
} else if (curfont == usedfont) {
text += utf8charlen;
utf8strlen += utf8err ? 0 : utf8charlen;
ew += utf8err ? 0 : tmpw;
} else {
nextfont = curfont;
}
@@ -542,36 +567,31 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
}
}
if (!charexists || nextfont)
if (overflow || !charexists || nextfont || utf8err)
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 (render) {
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
usedfont->xfont, x, ty, (XftChar8 *)utf8str, utf8strlen);
}
x += ew;
w -= ew;
}
if (utf8err && (!render || invalid_width < w)) {
if (render)
drw_text(drw, x, y, w, h, 0, invalid, invert, markup);
x += invalid_width;
w -= invalid_width;
}
if (render && overflow)
drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert, markup);
if (!*text) {
if (!*text || overflow) {
break;
} else if (nextfont) {
charexists = 0;
@@ -581,6 +601,15 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
* character must be drawn. */
charexists = 1;
hash = (unsigned int)utf8codepoint;
hash = ((hash >> 16) ^ hash) * 0x21F0AAAD;
hash = ((hash >> 15) ^ hash) * 0xD35A2D97;
h0 = ((hash >> 15) ^ hash) % LENGTH(nomatches);
h1 = (hash >> 17) % LENGTH(nomatches);
/* avoid expensive XftFontMatch call when we know we won't find a match */
if (nomatches[h0] == utf8codepoint || nomatches[h1] == utf8codepoint)
goto no_match;
fccharset = FcCharSetCreate();
FcCharSetAddChar(fccharset, utf8codepoint);
@@ -611,6 +640,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
curfont->next = usedfont;
} else {
xfont_free(usedfont);
nomatches[nomatches[h0] ? h1 : h0] = utf8codepoint;
no_match:
usedfont = drw->fonts;
}
}
@@ -701,7 +732,7 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w,
if (w)
*w = r.width / PANGO_SCALE;
if (h)
*h = font->h;
*h = r.height / PANGO_SCALE;
}
#else
void
@@ -742,4 +773,3 @@ drw_cur_free(Drw *drw, Cur *cursor)
XFreeCursor(drw->dpy, cursor->cursor);
free(cursor);
}

276
dwm.c
View File

@@ -101,7 +101,6 @@
#else
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
#endif // ATTACHASIDE_PATCH
#define LENGTH(X) (sizeof X / sizeof X[0])
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
@@ -482,9 +481,12 @@ struct Monitor {
int gappiv; /* vertical gap between windows */
int gappoh; /* horizontal outer gaps */
int gappov; /* vertical outer gaps */
#if PERMON_VANITYGAPS_PATCH
int enablegaps; /* whether gaps are enabled */
#endif // PERMON_VANITYGAPS_PATCH
#endif // VANITYGAPS_PATCH
#if SETBORDERPX_PATCH
unsigned int borderpx;
int borderpx;
#endif // SETBORDERPX_PATCH
unsigned int seltags;
unsigned int sellt;
@@ -504,6 +506,9 @@ struct Monitor {
Client *clients;
Client *sel;
Client *stack;
#if FOCUSMASTER_RETURN_PATCH
Client *tagmarked[32];
#endif // FOCUSMASTER_RETURN_PATCH
Monitor *next;
Bar *bar;
const Layout *lt[2];
@@ -568,13 +573,23 @@ typedef struct {
#if RENAMED_SCRATCHPADS_PATCH
const char scratchkey;
#endif // RENAMED_SCRATCHPADS_PATCH
#if UNMANAGED_PATCH
int unmanaged;
#endif // UNMANAGED_PATCH
#if XKB_PATCH
int xkb_layout;
#endif // XKB_PATCH
#if BORDER_RULE_PATCH
int bw;
#endif // BORDER_RULE_PATCH
} Rule;
#if XKB_PATCH
#if BORDER_RULE_PATCH && XKB_PATCH
#define RULE(...) { .monitor = -1, .xkb_layout = -1, .bw = -1, __VA_ARGS__ },
#elif XKB_PATCH
#define RULE(...) { .monitor = -1, .xkb_layout = -1, __VA_ARGS__ },
#elif BORDER_RULE_PATCH
#define RULE(...) { .monitor = -1, .bw = -1, __VA_ARGS__ },
#else
#define RULE(...) { .monitor = -1, __VA_ARGS__ },
#endif // XKB_PATCH
@@ -676,11 +691,12 @@ static void killclient(const Arg *arg);
static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
#if !FOCUSONCLICK_PATCH
static void motionnotify(XEvent *e);
#endif // FOCUSONCLICK_PATCH
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
#if NOBORDER_PATCH
static int noborder(Client *c);
#endif // NOBORDER_PATCH
#if !ZOOMSWAP_PATCH || TAGINTOSTACK_ALLMASTER_PATCH || TAGINTOSTACK_ONEMASTER_PATCH
static void pop(Client *c);
#endif // !ZOOMSWAP_PATCH / TAGINTOSTACK_ALLMASTER_PATCH / TAGINTOSTACK_ONEMASTER_PATCH
@@ -775,6 +791,9 @@ static int xkbEventType = 0;
static int screen;
static int sw, sh; /* X display screen geometry width, height */
static int bh; /* bar geometry */
#if UNMANAGED_PATCH
static int unmanaged = 0; /* whether the window manager should manage the new window or not */
#endif // UNMANAGED_PATCH
static int lrpad; /* sum of left and right padding for text */
/* Some clients (e.g. alacritty) helpfully send configure requests with a new size or position
* when they detect that they have been moved to another monitor. This can cause visual glitches
@@ -811,9 +830,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
#endif // COMBO_PATCH / BAR_HOLDBAR_PATCH
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
#if !FOCUSONCLICK_PATCH
[MotionNotify] = motionnotify,
#endif // FOCUSONCLICK_PATCH
[PropertyNotify] = propertynotify,
#if BAR_SYSTRAY_PATCH
[ResizeRequest] = resizerequest,
@@ -909,6 +926,10 @@ applyrules(Client *c)
#if CENTER_PATCH
c->iscentered = r->iscentered;
#endif // CENTER_PATCH
#if BORDER_RULE_PATCH
if (r->bw != -1)
c->bw = r->bw;
#endif // BORDER_RULE_PATCH
#if ISPERMANENT_PATCH
c->ispermanent = r->ispermanent;
#endif // ISPERMANENT_PATCH
@@ -932,6 +953,9 @@ applyrules(Client *c)
c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
}
#endif // SCRATCHPADS_PATCH
#if UNMANAGED_PATCH
unmanaged = r->unmanaged;
#endif // UNMANAGED_PATCH
for (m = mons; m && m->num != r->monitor; m = m->next);
if (m)
c->mon = m;
@@ -954,6 +978,7 @@ applyrules(Client *c)
if (r->switchtag)
#endif // SWALLOW_PATCH
{
unfocus(selmon->sel, 1, NULL);
selmon = c->mon;
if (r->switchtag == 2 || r->switchtag == 4)
newtagset = c->mon->tagset[c->mon->seltags] ^ c->tags;
@@ -965,12 +990,7 @@ applyrules(Client *c)
if (r->switchtag == 3 || r->switchtag == 4)
c->switchtag = c->mon->tagset[c->mon->seltags];
if (r->switchtag == 1 || r->switchtag == 3) {
#if PERTAG_PATCH
pertagview(&((Arg) { .ui = newtagset }));
arrange(c->mon);
#else
view(&((Arg) { .ui = newtagset }));
#endif // PERTAG_PATCH
} else {
#if TAGSYNC_PATCH
for (m = mons; m; m = m->next)
@@ -1102,6 +1122,11 @@ arrange(Monitor *m)
void
arrangemon(Monitor *m)
{
#if BAR_PADDING_SMART_PATCH
updatebarpos(selmon);
for (Bar *bar = selmon->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
#endif // BAR_PADDING_SMART_PATCH
#if TAB_PATCH
updatebarpos(m);
XMoveResizeWindow(dpy, m->tabwin, m->wx, m->ty, m->ww, th);
@@ -1455,6 +1480,15 @@ configure(Client *c)
ce.width = c->w;
ce.height = c->h;
ce.border_width = c->bw;
#if NOBORDER_PATCH
if (noborder(c)) {
ce.width += c->bw * 2;
ce.height += c->bw * 2;
ce.border_width = 0;
}
#endif // NOBORDER_PATCH
ce.above = None;
ce.override_redirect = False;
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
@@ -1494,8 +1528,8 @@ configurenotify(XEvent *e)
createpreview(m);
#endif // BAR_TAGPREVIEW_PATCH
}
focus(NULL);
arrange(NULL);
focus(NULL);
}
}
}
@@ -1681,7 +1715,7 @@ createmon(void)
bar->showbar = 1;
bar->external = 0;
#if BAR_BORDER_PATCH
bar->borderpx = borderpx;
bar->borderpx = (barborderpx ? barborderpx : borderpx);
#else
bar->borderpx = 0;
#endif // BAR_BORDER_PATCH
@@ -1766,6 +1800,10 @@ createmon(void)
}
#endif // PERTAG_PATCH
#if PERMON_VANITYGAPS_PATCH
m->enablegaps = 1;
#endif // PERMON_VANITYGAPS_PATCH
#if SEAMLESS_RESTART_PATCH
restoremonitorstate(m);
#endif // SEAMLESS_RESTART_PATCH
@@ -1818,6 +1856,11 @@ detach(Client *c)
#if SEAMLESS_RESTART_PATCH
c->idx = 0;
#endif // SEAMLESS_RESTART_PATCH
#if FOCUSMASTER_RETURN_PATCH
for (int i = 1; i < NUMTAGS; i++)
if (c == c->mon->tagmarked[i])
c->mon->tagmarked[i] = NULL;
#endif // FOCUSMASTER_RETURN_PATCH
for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next);
*tc = c->next;
@@ -2042,6 +2085,14 @@ expose(XEvent *e)
void
focus(Client *c)
{
#if FOCUSFOLLOWMOUSE_PATCH
if (!c || !ISVISIBLE(c))
c = getpointerclient();
#endif // FOCUSFOLLOWMOUSE_PATCH
#if STICKY_PATCH
if (!c || !ISVISIBLE(c))
for (c = selmon->stack; c && (!ISVISIBLE(c) || c->issticky); c = c->snext);
#endif // STICKY_PATCH
if (!c || !ISVISIBLE(c))
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
if (selmon->sel && selmon->sel != c)
@@ -2476,8 +2527,10 @@ manage(Window w, XWindowAttributes *wa)
#endif // CENTER_TRANSIENT_WINDOWS_PATCH | CENTER_TRANSIENT_WINDOWS_BY_PARENT_PATCH | CENTER_PATCH
} else {
#if SEAMLESS_RESTART_PATCH
if (!settings_restored)
if (!settings_restored || c->mon == NULL) {
c->mon = selmon;
settings_restored = 0;
}
#else
c->mon = selmon;
#endif // SEAMLESS_RESTART_PATCH
@@ -2503,6 +2556,29 @@ manage(Window w, XWindowAttributes *wa)
#endif // SWALLOW_PATCH
}
#if UNMANAGED_PATCH
if (unmanaged) {
XMapWindow(dpy, c->win);
if (unmanaged == 1)
XRaiseWindow(dpy, c->win);
else if (unmanaged == 2)
XLowerWindow(dpy, c->win);
updatewmhints(c);
if (!c->neverfocus)
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
#if BAR_SYSTRAY_PATCH
sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0);
#else
sendevent(c, wmatom[WMTakeFocus]);
#endif // BAR_SYSTRAY_PATCH
free(c);
unmanaged = 0;
return;
}
#endif // UNMANAGED_PATCH
if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww)
c->x = c->mon->wx + c->mon->ww - WIDTH(c);
if (c->y + HEIGHT(c) > c->mon->wy + c->mon->wh)
@@ -2671,16 +2747,17 @@ maprequest(XEvent *e)
manage(ev->window, &wa);
}
#if !FOCUSONCLICK_PATCH
void
motionnotify(XEvent *e)
{
#if !FOCUSONCLICK_PATCH
static Monitor *mon = NULL;
Monitor *m;
Bar *bar;
#if LOSEFULLSCREEN_PATCH
Client *sel;
#endif // LOSEFULLSCREEN_PATCH
#endif // FOCUSONCLICK_PATCH
Bar *bar;
XMotionEvent *ev = &e->xmotion;
if ((bar = wintobar(ev->window))) {
@@ -2693,6 +2770,7 @@ motionnotify(XEvent *e)
hidetagpreview(selmon);
#endif // BAR_TAGPREVIEW_PATCH
#if !FOCUSONCLICK_PATCH
if (ev->window != root)
return;
if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
@@ -2707,8 +2785,8 @@ motionnotify(XEvent *e)
focus(NULL);
}
mon = m;
#endif // FOCUSONCLICK_PATCH
}
#endif // FOCUSONCLICK_PATCH
void
movemouse(const Arg *arg)
@@ -2809,10 +2887,63 @@ nexttiled(Client *c)
return c;
}
#if NOBORDER_PATCH
int
noborder(Client *c)
{
int monocle_layout = 0;
#if MONOCLE_LAYOUT
if (&monocle == c->mon->lt[c->mon->sellt]->arrange)
monocle_layout = 1;
#endif // MONOCLE_LAYOUT
#if DECK_LAYOUT
if (&deck == c->mon->lt[c->mon->sellt]->arrange && c->mon->nmaster == 0)
monocle_layout = 1;
#endif // DECK_LAYOUT
#if FLEXTILE_DELUXE_LAYOUT
if (&flextile == c->mon->lt[c->mon->sellt]->arrange && (
(c->mon->ltaxis[LAYOUT] == NO_SPLIT && c->mon->ltaxis[MASTER] == MONOCLE) ||
(c->mon->ltaxis[STACK] == MONOCLE && c->mon->nmaster == 0)
)) {
monocle_layout = 1;
}
#endif //FLEXTILE_DELUXE_LAYOUT
if (!monocle_layout && (nexttiled(c->mon->clients) != c || nexttiled(c->next)))
return 0;
if (c->isfloating)
return 0;
if (!c->mon->lt[c->mon->sellt]->arrange)
return 0;
#if FAKEFULLSCREEN_CLIENT_PATCH && !FAKEFULLSCREEN_PATCH
if (c->fakefullscreen != 1 && c->isfullscreen)
return 0;
#elif !FAKEFULLSCREEN_PATCH
if (c->isfullscreen)
return 0;
#endif // FAKEFULLSCREEN_CLIENT_PATCH
return 1;
}
#endif // NOBORDER_PATCH
#if !ZOOMSWAP_PATCH || TAGINTOSTACK_ALLMASTER_PATCH || TAGINTOSTACK_ONEMASTER_PATCH
void
pop(Client *c)
{
#if FOCUSMASTER_RETURN_PATCH
int i;
for (i = 0; !(selmon->tagset[selmon->seltags] & 1 << i); i++);
i++;
c->mon->tagmarked[i] = nexttiled(c->mon->clients);
#endif // FOCUSMASTER_RETURN_PATCH
detach(c);
attach(c);
focus(c);
@@ -2956,31 +3087,9 @@ resizeclient(Client *c, int x, int y, int w, int h)
drawroundedcorners(c);
#endif // ROUNDED_CORNERS_PATCH
#if NOBORDER_PATCH
if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
#if MONOCLE_LAYOUT
|| &monocle == c->mon->lt[c->mon->sellt]->arrange
#endif // MONOCLE_LAYOUT
#if DECK_LAYOUT
|| (&deck == c->mon->lt[c->mon->sellt]->arrange &&
c->mon->nmaster == 0)
#endif // DECK_LAYOUT
#if FLEXTILE_DELUXE_LAYOUT
|| (&flextile == c->mon->lt[c->mon->sellt]->arrange && (
(c->mon->ltaxis[LAYOUT] == NO_SPLIT &&
c->mon->ltaxis[MASTER] == MONOCLE) ||
(c->mon->ltaxis[STACK] == MONOCLE &&
c->mon->nmaster == 0)))
#endif //FLEXTILE_DELUXE_LAYOUT
)
#if FAKEFULLSCREEN_CLIENT_PATCH && !FAKEFULLSCREEN_PATCH
&& (c->fakefullscreen == 1 || !c->isfullscreen)
#else
&& !c->isfullscreen
#endif // FAKEFULLSCREEN_CLIENT_PATCH
&& !c->isfloating
&& c->mon->lt[c->mon->sellt]->arrange) {
c->w = wc.width += c->bw * 2;
c->h = wc.height += c->bw * 2;
if (noborder(c)) {
wc.width += c->bw * 2;
wc.height += c->bw * 2;
wc.border_width = 0;
}
#endif // NOBORDER_PATCH
@@ -3214,7 +3323,6 @@ run(void)
event_fd, events[i].data.ptr, events[i].data.u32,
events[i].data.u64);
fprintf(stderr, " with events %d\n", events[i].events);
return;
}
}
}
@@ -3335,6 +3443,14 @@ sendmon(Client *c, Monitor *m)
#else
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
#endif // EMPTYVIEW_PATCH
#if SENDMON_CENTER_PATCH
c->x = m->mx + (m->mw - WIDTH(c)) / 2;
c->y = m->my + (m->mh - HEIGHT(c)) / 2;
#if SAVEFLOATS_PATCH
c->sfx = m->mx + (m->mw - c->sfw - 2 * c->bw) / 2;
c->sfy = m->my + (m->mh - c->sfh - 2 * c->bw) / 2;
#endif // SAVEFLOATS_PATCH
#endif // SENDMON_CENTER_PATCH
#if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH
attachx(c);
#else
@@ -3352,11 +3468,12 @@ sendmon(Client *c, Monitor *m)
if (hadfocus) {
focus(c);
restack(m);
} else
} else {
focus(NULL);
}
#else
focus(NULL);
arrange(NULL);
focus(NULL);
#endif // EXRESIZE_PATCH / SENDMON_KEEPFOCUS_PATCH
#if SWITCHTAG_PATCH
if (c->switchtag)
@@ -4079,6 +4196,7 @@ tag(const Arg *arg)
if (selmon->sel->switchtag)
selmon->sel->switchtag = 0;
#endif // SWITCHTAG_PATCH
arrange(selmon);
focus(NULL);
#if SWAPFOCUS_PATCH && PERTAG_PATCH
selmon->pertag->prevclient[selmon->pertag->curtag] = NULL;
@@ -4086,7 +4204,6 @@ tag(const Arg *arg)
if (tagmask & 1)
selmon->pertag->prevclient[tagindex] = NULL;
#endif // SWAPFOCUS_PATCH
arrange(selmon);
#if VIEWONTAG_PATCH
if ((arg->ui & TAGMASK) != selmon->tagset[selmon->seltags])
view(arg);
@@ -4176,10 +4293,21 @@ togglefloating(const Arg *arg)
#endif // !FAKEFULLSCREEN_PATCH
c->isfloating = !c->isfloating || c->isfixed;
#if !BAR_FLEXWINTITLE_PATCH
#if RENAMED_SCRATCHPADS_PATCH
if (c->scratchkey != 0 && c->isfloating)
XSetWindowBorder(dpy, c->win, scheme[SchemeScratchSel][ColFloat].pixel);
else if (c->scratchkey != 0)
XSetWindowBorder(dpy, c->win, scheme[SchemeScratchSel][ColBorder].pixel);
else if (c->isfloating)
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel);
else
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
#else
if (c->isfloating)
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColFloat].pixel);
else
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
#endif // RENAMED_SCRATCHPADS_PATCH
#endif // BAR_FLEXWINTITLE_PATCH
if (c->isfloating) {
#if SAVEFLOATS_PATCH || EXRESIZE_PATCH
@@ -4218,13 +4346,13 @@ toggletag(const Arg *arg)
newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
if (newtags) {
selmon->sel->tags = newtags;
arrange(selmon);
focus(NULL);
#if SWAPFOCUS_PATCH && PERTAG_PATCH
for (tagmask = arg->ui & TAGMASK, tagindex = 1; tagmask!=0; tagmask >>= 1, tagindex++)
if (tagmask & 1)
selmon->pertag->prevclient[tagindex] = NULL;
#endif // SWAPFOCUS_PATCH
arrange(selmon);
}
#if BAR_EWMHTAGS_PATCH
updatecurrentdesktop();
@@ -4311,8 +4439,8 @@ toggleview(const Arg *arg)
#endif // PERTAGBAR_PATCH
#endif // PERTAG_PATCH
#if !TAGSYNC_PATCH
focus(NULL);
arrange(selmon);
focus(NULL);
#endif // TAGSYNC_PATCH
#if !EMPTYVIEW_PATCH
}
@@ -4323,8 +4451,8 @@ toggleview(const Arg *arg)
#if !EMPTYVIEW_PATCH
if (newtagset) {
#endif // EMPTYVIEW_PATCH
focus(NULL);
arrange(NULL);
focus(NULL);
#if !EMPTYVIEW_PATCH
}
#endif // EMPTYVIEW_PATCH
@@ -4343,13 +4471,24 @@ unfocus(Client *c, int setfocus, Client *nextfocus)
selmon->pertag->prevclient[selmon->pertag->curtag] = c;
#endif // SWAPFOCUS_PATCH
#if LOSEFULLSCREEN_PATCH
if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon && nextfocus && !nextfocus->isfloating)
if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon && nextfocus && !nextfocus->isfloating) {
#if RENAMED_SCRATCHPADS_PATCH && RENAMED_SCRATCHPADS_AUTO_HIDE_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->scratchkey != 0 && c->fakefullscreen != 1)
togglescratch(&((Arg) {.v = (const char*[]){ &c->scratchkey, NULL } }));
#else
if (c->scratchkey != 0)
togglescratch(&((Arg) {.v = (const char*[]){ &c->scratchkey, NULL } }));
#endif // FAKEFULLSCREEN_CLIENT_PATCH
else
#endif // RENAMED_SCRATCHPADS_AUTO_HIDE_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->fakefullscreen != 1)
setfullscreen(c, 0);
#else
setfullscreen(c, 0);
#endif // #if FAKEFULLSCREEN_CLIENT_PATCH
}
#endif // LOSEFULLSCREEN_PATCH
grabbuttons(c, 0);
#if !BAR_FLEXWINTITLE_PATCH
@@ -4461,9 +4600,9 @@ unmanage(Client *c, int destroyed)
if (s)
return;
#endif // SWALLOW_PATCH
arrange(m);
focus(NULL);
updateclientlist();
arrange(m);
#if SWITCHTAG_PATCH
if (switchtag && ((switchtag & TAGMASK) != selmon->tagset[selmon->seltags]))
view(&((Arg) { .ui = switchtag }));
@@ -4583,16 +4722,36 @@ updatebarpos(Monitor *m)
#if BAR_PADDING_VANITYGAPS_PATCH && VANITYGAPS_PATCH
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
if (!selmon || selmon->pertag->enablegaps[selmon->pertag->curtag])
#elif PERMON_VANITYGAPS_PATCH
if (!selmon || selmon->enablegaps)
#else
if (enablegaps)
#endif // PERTAG_VANITYGAPS_PATCH
{
#if BAR_PADDING_SMART_PATCH
unsigned int n; Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n > 1) {
y_pad = gappoh;
x_pad = gappov;
}
#else
y_pad = gappoh;
x_pad = gappov;
#endif // BAR_PADDING_SMART_PATCH
}
#elif BAR_PADDING_PATCH
#if BAR_PADDING_SMART_PATCH
unsigned int n; Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n > 1) {
y_pad = vertpad;
x_pad = sidepad;
}
#else
y_pad = vertpad;
x_pad = sidepad;
#endif // BAR_PADDING_SMART_PATCH
#endif // BAR_PADDING_PATCH | BAR_PADDING_VANITYGAPS_PATCH
#if INSETS_PATCH
@@ -4647,7 +4806,7 @@ updatebarpos(Monitor *m)
}
void
updateclientlist()
updateclientlist(void)
{
Client *c;
Monitor *m;
@@ -4958,12 +5117,12 @@ view(const Arg *arg)
}
selmon = origselmon;
#endif // TAGSYNC_PATCH
focus(NULL);
#if TAGSYNC_PATCH
arrange(NULL);
#else
arrange(selmon);
#endif // TAGSYNC_PATCH
focus(NULL);
#if BAR_EWMHTAGS_PATCH
updatecurrentdesktop();
#endif // BAR_EWMHTAGS_PATCH
@@ -5041,6 +5200,9 @@ void
zoom(const Arg *arg)
{
Client *c = selmon->sel;
#if FOCUSMASTER_RETURN_PATCH && ZOOMSWAP_PATCH
int i;
#endif // FOCUSMASTER_RETURN_PATCH
if (arg && arg->v)
c = (Client*)arg->v;
if (!c)
@@ -5094,6 +5256,12 @@ zoom(const Arg *arg)
cold = nexttiled(c->mon->clients);
if (c != cold && !at)
at = findbefore(c);
#if FOCUSMASTER_RETURN_PATCH
for (i = 0; !(selmon->tagset[selmon->seltags] & 1 << i); i++);
i++;
c->mon->tagmarked[i] = cold;
#endif // FOCUSMASTER_RETURN_PATCH
detach(c);
attach(c);
/* swap windows instead of pushing the previous one down */

View File

@@ -21,7 +21,7 @@ alttab()
/* redraw tab */
XRaiseWindow(dpy, alttabwin);
drawtab(ntabs, 0, m);
drawalttab(ntabs, 0, m);
}
void
@@ -66,7 +66,7 @@ alttabend()
}
void
drawtab(int nwins, int first, Monitor *m)
drawalttab(int nwins, int first, Monitor *m)
{
Client *c;
int i, h;
@@ -178,7 +178,7 @@ alttabstart(const Arg *arg)
i++;
}
drawtab(ntabs, 1, m);
drawalttab(ntabs, 1, m);
struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000000 };

View File

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

81
patch/bar_launcher.c Normal file
View File

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

8
patch/bar_launcher.h Normal file
View File

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

View File

@@ -9,7 +9,7 @@ layoutmenu(const Arg *arg) {
s = fgets(c, sizeof(c), p);
pclose(p);
if (!s || *s == '\0' || c == '\0')
if (!s || *s == '\0' || c[0] == '\0')
return;
i = atoi(c);

View File

@@ -15,4 +15,3 @@ click_ltsymbol(Bar *bar, Arg *arg, BarArg *a)
{
return ClkLtSymbol;
}

View File

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

View File

@@ -102,6 +102,65 @@ click_pwrl_tags(Bar *bar, Arg *arg, BarArg *a)
if (i < NUMTAGS) {
arg->ui = 1 << i;
}
#if BAR_TAGPREVIEW_PATCH
if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return ClkTagBar;
}
int
hover_pwrl_tags(Bar *bar, BarArg *a, XMotionEvent *ev)
{
#if BAR_TAGPREVIEW_PATCH
int i = 0, x = lrpad / 2;
int px, py;
int plw = drw->fonts->h / 2 + 1;
Monitor *m = bar->mon;
#if VANITYGAPS_PATCH
int ov = gappov;
int oh = gappoh;
#else
int ov = 0;
int oh = 0;
#endif // VANITYGAPS_PATCH
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
x += TEXTW(tagicon(bar->mon, i)) + plw;
} while (a->x >= x && ++i < NUMTAGS);
if (i < NUMTAGS) {
if ((i + 1) != selmon->previewshow && !(selmon->tagset[selmon->seltags] & 1 << i)) {
if (bar->by > m->my + m->mh / 2) // bottom bar
py = bar->by - m->mh / scalepreview - oh;
else // top bar
py = bar->by + bar->bh + oh;
px = bar->bx + ev->x - m->mw / scalepreview / 2;
if (px + m->mw / scalepreview > m->mx + m->mw)
px = m->wx + m->ww - m->mw / scalepreview - ov;
else if (px < bar->bx)
px = m->wx + ov;
selmon->previewshow = i + 1;
showtagpreview(i, px, py);
} else if (selmon->tagset[selmon->seltags] & 1 << i) {
hidetagpreview(selmon);
}
} else if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return 1;
}

View File

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

View File

@@ -96,6 +96,7 @@ drawstatusbar(BarArg *a, char* stext)
#else
memcpy(text, stext, len);
#endif // BAR_STATUSCMD_PATCH
text[len] = '\0';
x += lrpad / 2;
drw_setscheme(drw, scheme[LENGTH(colors)]);

View File

@@ -94,6 +94,12 @@ draw_systray(Bar *bar, BarArg *a)
i->mon = bar->mon;
}
#if !BAR_ALPHA_PATCH
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
XChangeWindowAttributes(dpy, systray->win, CWBackPixel, &wa);
XClearWindow(dpy, systray->win);
#endif // BAR_ALPHA_PATCH
XMoveResizeWindow(dpy, systray->win, bar->bx + a->x + lrpad / 2, (w ? bar->by + a->y + (a->h - systray->h) / 2: -systray->h), MAX(w, 1), systray->h);
return w;
}

View File

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

View File

@@ -2,4 +2,5 @@
static int width_taglabels(Bar *bar, BarArg *a);
static int draw_taglabels(Bar *bar, BarArg *a);
static int click_taglabels(Bar *bar, Arg *arg, BarArg *a);
static int click_taglabels(Bar *bar, Arg *arg, BarArg *a);
static int hover_taglabels(Bar *bar, BarArg *a, XMotionEvent *ev);

View File

@@ -88,6 +88,11 @@ click_tags(Bar *bar, Arg *arg, BarArg *a)
if (i < NUMTAGS) {
arg->ui = 1 << i;
}
#if BAR_TAGPREVIEW_PATCH
if (selmon->previewshow != 0) {
hidetagpreview(selmon);
}
#endif // BAR_TAGPREVIEW_PATCH
return ClkTagBar;
}

View File

@@ -51,7 +51,7 @@ togglewin(const Arg *arg)
Client *c = (Client*)arg->v;
if (!c)
return;
if (c == selmon->sel)
if (!HIDDEN(c) && c == selmon->sel)
hide(c);
else {
if (HIDDEN(c))

View File

@@ -22,8 +22,8 @@ combotag(const Arg *arg)
combo = 1;
selmon->sel->tags = arg->ui & TAGMASK;
}
focus(NULL);
arrange(selmon);
focus(NULL);
}
}

View File

@@ -22,10 +22,10 @@ distributetags(const Arg *arg)
#if TAGSYNC_PATCH
}
selmon = origselmon;
focus(NULL);
arrange(NULL);
#else
focus(NULL);
#else
arrange(selmon);
focus(NULL);
#endif // TAGSYNC_PATCH
}

View File

@@ -30,6 +30,7 @@ case $# in
transferall) ;&
togglealttag) ;&
togglebar) ;&
toggletopbar) ;&
togglefloating) ;&
togglefullscreen) ;&
fullscreen) ;&

View File

@@ -6,8 +6,8 @@ tagtoleft(const Arg *arg)
&& __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1;
focus(NULL);
arrange(selmon);
focus(NULL);
}
}
@@ -19,8 +19,8 @@ tagtoright(const Arg *arg)
&& __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
&& selmon->tagset[selmon->seltags] & (MASK >> 1)) {
selmon->sel->tags <<= 1;
focus(NULL);
arrange(selmon);
focus(NULL);
}
}

9
patch/focusfollowmouse.c Normal file
View File

@@ -0,0 +1,9 @@
Client *
getpointerclient(void)
{
Window dummy, win;
int di;
unsigned int dui;
XQueryPointer(dpy, root, &dummy, &win, &di, &di, &di, &di, &dui);
return wintoclient(win);
}

1
patch/focusfollowmouse.h Normal file
View File

@@ -0,0 +1 @@
static Client *getpointerclient(void);

View File

@@ -1,14 +1,42 @@
void
focusmaster(const Arg *arg)
{
Client *c;
Client *master;
Monitor *m = selmon;
#if FOCUSMASTER_RETURN_PATCH
int i;
#endif // FOCUSMASTER_RETURN_PATCH
if (selmon->nmaster < 1)
if (m->nmaster < 1)
return;
#if !FAKEFULLSCREEN_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (!m->sel || (m->sel->isfullscreen && m->sel->fakefullscreen != 1 && lockfullscreen))
return;
#else
if (!m->sel || (m->sel->isfullscreen && lockfullscreen))
return;
#endif // FAKEFULLSCREEN_CLIENT_PATCH
#endif // FAKEFULLSCREEN_PATCH
master = nexttiled(m->clients);
if (!master)
return;
c = nexttiled(selmon->clients);
#if FOCUSMASTER_RETURN_PATCH
for (i = 0; !(m->tagset[m->seltags] & 1 << i); i++);
i++;
if (c)
focus(c);
if (m->sel == master) {
if (m->tagmarked[i] && ISVISIBLE(m->tagmarked[i]))
focus(m->tagmarked[i]);
} else {
m->tagmarked[i] = m->sel;
focus(master);
}
#else
focus(master);
#endif // FOCUSMASTER_RETURN_PATCH
restack(m);
}

View File

@@ -21,6 +21,9 @@
#if COMBO_PATCH
#include "combo.c"
#endif
#if BAR_LAUNCHER_PATCH
#include "bar_launcher.c"
#endif
#if BAR_LTSYMBOL_PATCH
#include "bar_ltsymbol.c"
#endif
@@ -151,7 +154,10 @@
#if FOCUSDIR_PATCH
#include "focusdir.c"
#endif
#if FOCUSMASTER_PATCH
#if FOCUSFOLLOWMOUSE_PATCH
#include "focusfollowmouse.c"
#endif
#if FOCUSMASTER_PATCH || FOCUSMASTER_RETURN_PATCH
#include "focusmaster.c"
#endif
#if FOCUSURGENT_PATCH
@@ -205,6 +211,9 @@
#if PERTAG_PATCH
#include "pertag.c"
#endif
#if PLACEDIR_PATCH
#include "placedir.c"
#endif
#if PLACEMOUSE_PATCH
#include "placemouse.c"
#endif
@@ -310,6 +319,9 @@
#if TOGGLEFULLSCREEN_PATCH
#include "togglefullscreen.c"
#endif
#if TOGGLETOPBAR_PATCH
#include "toggletopbar.c"
#endif
#if TRANSFER_PATCH
#include "transfer.c"
#endif

View File

@@ -24,6 +24,9 @@
#if BAR_HOLDBAR_PATCH
#include "bar_holdbar.h"
#endif
#if BAR_LAUNCHER_PATCH
#include "bar_launcher.h"
#endif
#if BAR_LTSYMBOL_PATCH
#include "bar_ltsymbol.h"
#endif
@@ -154,7 +157,10 @@
#if FOCUSADJACENTTAG_PATCH
#include "focusadjacenttag.h"
#endif
#if FOCUSMASTER_PATCH
#if FOCUSFOLLOWMOUSE_PATCH
#include "focusfollowmouse.h"
#endif
#if FOCUSMASTER_PATCH || FOCUSMASTER_RETURN_PATCH
#include "focusmaster.h"
#endif
#if FOCUSURGENT_PATCH
@@ -204,6 +210,9 @@
#if PERTAG_PATCH
#include "pertag.h"
#endif
#if PLACEDIR_PATCH
#include "placedir.h"
#endif
#if PLACEMOUSE_PATCH
#include "placemouse.h"
#endif
@@ -312,6 +321,9 @@
#if TOGGLEFULLSCREEN_PATCH
#include "togglefullscreen.h"
#endif
#if TOGGLETOPBAR_PATCH
#include "toggletopbar.h"
#endif
#if TRANSFER_PATCH
#include "transfer.h"
#endif

View File

@@ -643,7 +643,7 @@ arrange_tatami(Monitor *m, int x, int y, int h, int w, int ih, int iv, int n, in
if (j < ai + cats) {
/* Arrange cats (all excess clients that can't be tiled as mats). Cats sleep on mats. */
switch (cats) {
switch (cats) {
case 1: // fill
break;
case 2: // up and down

View File

@@ -21,7 +21,7 @@ struct Pertag {
#endif // ZOOMSWAP_PATCH
#if PERTAG_VANITYGAPS_PATCH && VANITYGAPS_PATCH
int enablegaps[NUMTAGS + 1];
unsigned int gaps[NUMTAGS + 1];
int gaps[NUMTAGS + 1];
#endif // PERTAG_VANITYGAPS_PATCH | VANITYGAPS_PATCH
};

96
patch/placedir.c Normal file
View File

@@ -0,0 +1,96 @@
void
placedir(const Arg *arg)
{
Client *s = selmon->sel, *f = NULL, *c, *next, *fprior, *sprior;
if (!s || s->isfloating)
return;
unsigned int score = -1;
unsigned int client_score;
int dist;
int dirweight = 20;
next = s->next;
if (!next)
next = s->mon->clients;
for (c = next; c != s; c = next) {
next = c->next;
if (!next)
next = s->mon->clients;
if (!ISVISIBLE(c)) // || HIDDEN(c)
continue;
switch (arg->i) {
case 0: // left
dist = s->x - c->x - c->w;
client_score =
dirweight * MIN(abs(dist), abs(dist + s->mon->ww)) +
abs(s->y - c->y);
break;
case 1: // right
dist = c->x - s->x - s->w;
client_score =
dirweight * MIN(abs(dist), abs(dist + s->mon->ww)) +
abs(c->y - s->y);
break;
case 2: // up
dist = s->y - c->y - c->h;
client_score =
dirweight * MIN(abs(dist), abs(dist + s->mon->wh)) +
abs(s->x - c->x);
break;
default:
case 3: // down
dist = c->y - s->y - s->h;
client_score =
dirweight * MIN(abs(dist), abs(dist + s->mon->wh)) +
abs(c->x - s->x);
break;
}
if (((arg->i == 0 || arg->i == 2) && client_score <= score) || client_score < score) {
score = client_score;
f = c;
}
}
if (f && f != s) {
for (fprior = f->mon->clients; fprior && fprior->next != f; fprior = fprior->next);
for (sprior = s->mon->clients; sprior && sprior->next != s; sprior = sprior->next);
if (s == fprior) {
next = f->next;
if (sprior)
sprior->next = f;
else
f->mon->clients = f;
f->next = s;
s->next = next;
} else if (f == sprior) {
next = s->next;
if (fprior)
fprior->next = s;
else
s->mon->clients = s;
s->next = f;
f->next = next;
} else { // clients are not adjacent to each other
next = f->next;
f->next = s->next;
s->next = next;
if (fprior)
fprior->next = s;
else
s->mon->clients = s;
if (sprior)
sprior->next = f;
else
f->mon->clients = f;
}
arrange(f->mon);
}
}

1
patch/placedir.h Normal file
View File

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

View File

@@ -66,12 +66,13 @@ togglescratch(const Arg *arg)
if (c->scratchkey != ((char**)arg->v)[0][0])
continue;
/* awesomebar / wintitleactions compatibility, unhide scratchpad if hidden
#if BAR_WINTITLEACTIONS_PATCH
/* unhide scratchpad if hidden */
if (HIDDEN(c)) {
XMapWindow(dpy, c->win);
setclientstate(c, NormalState);
}
*/
#endif // BAR_WINTITLEACTIONS_PATCH
/* Record the first found scratchpad client for focus purposes, but prioritise the
scratchpad on the current monitor if one exists */

View File

@@ -62,8 +62,8 @@ togglescratch(const Arg *arg)
if (found) {
if (newtagset) {
selmon->tagset[selmon->seltags] = newtagset;
focus(NULL);
arrange(selmon);
focus(NULL);
}
if (ISVISIBLE(found)) {
focus(found);

View File

@@ -6,8 +6,8 @@ scratchpad_hide()
if (selmon->sel) {
selmon->sel->tags = SCRATCHPAD_MASK;
selmon->sel->isfloating = 1;
focus(NULL);
arrange(selmon);
focus(NULL);
}
}
@@ -36,8 +36,8 @@ scratchpad_show()
if (scratchpad_last_showed->tags != SCRATCHPAD_MASK) {
scratchpad_last_showed->tags = SCRATCHPAD_MASK;
focus(NULL);
arrange(selmon);
focus(NULL);
return;
}

View File

@@ -39,12 +39,12 @@ persistclientstate(Client *c)
int
restoreclientstate(Client *c)
{
return getclienttags(c)
| getclientfields(c)
#if SAVEFLOATS_PATCH
| restorewindowfloatposition(c, c->mon ? c->mon : selmon)
#endif // SAVEFLOATS_PATCH
;
int restored = getclientfields(c);
getclienttags(c);
#if SAVEFLOATS_PATCH
restorewindowfloatposition(c, c->mon ? c->mon : selmon);
#endif // SAVEFLOATS_PATCH
return restored;
}
void setmonitorfields(Monitor *m)

View File

@@ -15,13 +15,15 @@ setborderpx(const Arg *arg)
int delta = 2 * (m->borderpx - prev_borderpx);
#if BAR_BORDER_PATCH
for (bar = m->bar; bar; bar = bar->next) {
bar->bh = bar->bh - 2 * bar->borderpx + 2 * m->borderpx;
bar->borderpx = m->borderpx;
if (!barborderpx) {
for (bar = m->bar; bar; bar = bar->next) {
bar->bh = bar->bh - 2 * bar->borderpx + 2 * m->borderpx;
bar->borderpx = m->borderpx;
}
updatebarpos(m);
for (bar = m->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
}
updatebarpos(m);
for (bar = m->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
#endif // BAR_BORDER_PATCH
for (c = m->clients; c; c = c->next) {

View File

@@ -6,7 +6,7 @@ shift(const Arg *arg, int clients)
unsigned int tagmask = 0;
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
shifted.ui = selmon->tagset[selmon->seltags];
shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
#else
shifted.ui = selmon->tagset[selmon->seltags];
#endif // SCRATCHPADS_PATCH
@@ -18,6 +18,10 @@ shift(const Arg *arg, int clients)
for (c = selmon->clients; c && clients; c = c->next) {
if (c == selmon->sel)
continue;
#if STICKY_PATCH
if (c->issticky)
continue;
#endif // STICKY_PATCH
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
if (!(c->tags & SPTAGMASK))
tagmask |= c->tags;

View File

@@ -13,6 +13,9 @@ swallow(Client *p, Client *c)
{
Client *s;
XWindowChanges wc;
#if NOBORDER_PATCH
int border_padding = 0;
#endif // NOBORDER_PATCH
if (c->noswallow > 0 || c->isterminal)
return 0;
@@ -46,9 +49,21 @@ swallow(Client *p, Client *c)
setfloatinghint(s);
#endif // BAR_EWMHTAGS_PATCH
#if NOBORDER_PATCH
wc.border_width = p->bw;
if (noborder(p)) {
wc.border_width = 0;
border_padding = p->bw * 2;
}
XConfigureWindow(dpy, p->win, CWBorderWidth, &wc);
XMoveResizeWindow(dpy, p->win, s->x, s->y, s->w + border_padding, s->h + border_padding);
#else
wc.border_width = p->bw;
XConfigureWindow(dpy, p->win, CWBorderWidth, &wc);
XMoveResizeWindow(dpy, p->win, s->x, s->y, s->w, s->h);
#endif // NOBORDER_PATCH
#if !BAR_FLEXWINTITLE_PATCH
XSetWindowBorder(dpy, p->win, scheme[SchemeNorm][ColBorder].pixel);
#endif // BAR_FLEXWINTITLE_PATCH
@@ -65,6 +80,9 @@ unswallow(Client *c)
{
XWindowChanges wc;
c->win = c->swallowing->win;
#if NOBORDER_PATCH
int border_padding = 0;
#endif // NOBORDER_PATCH
free(c->swallowing);
c->swallowing = NULL;
@@ -80,9 +98,20 @@ unswallow(Client *c)
arrange(c->mon);
XMapWindow(dpy, c->win);
#if NOBORDER_PATCH
wc.border_width = c->bw;
if (noborder(c)) {
wc.border_width = 0;
border_padding = c->bw * 2;
}
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc);
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w + border_padding, c->h + border_padding);
#else
wc.border_width = c->bw;
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc);
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
#endif // NOBORDER_PATCH
#if !BAR_FLEXWINTITLE_PATCH
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
#endif // BAR_FLEXWINTITLE_PATCH
@@ -91,8 +120,8 @@ unswallow(Client *c)
setfloatinghint(c);
#endif // BAR_EWMHTAGS_PATCH
setclientstate(c, NormalState);
focus(NULL);
arrange(c->mon);
focus(NULL);
}
pid_t

View File

@@ -43,7 +43,7 @@ tagallmon(const Arg *arg)
}
}
focus(NULL);
arrange(NULL);
focus(NULL);
}

View File

@@ -37,8 +37,8 @@ tagothermon(const Arg *arg, int dir)
sendmon(sel, newmon);
if (arg->ui & TAGMASK) {
sel->tags = arg->ui & TAGMASK;
focus(NULL);
arrange(newmon);
focus(NULL);
}
}

View File

@@ -69,7 +69,7 @@ tagswapmon(const Arg *arg)
}
}
focus(NULL);
arrange(NULL);
focus(NULL);
}

View File

@@ -10,8 +10,15 @@ resizemousescroll(const Arg *arg)
if (!(c = selmon->sel))
return;
#if !FAKEFULLSCREEN_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->isfullscreen && c->fakefullscreen != 1) /* no support resizing fullscreen windows by mouse */
return;
#else
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
return;
#endif // FAKEFULLSCREEN_CLIENT_PATCH
#endif // !FAKEFULLSCREEN_PATCH
restack(selmon);
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)

20
patch/toggletopbar.c Normal file
View File

@@ -0,0 +1,20 @@
void
toggletopbar(const Arg *arg)
{
Bar *bar;
Monitor *m = selmon;
for (bar = m->bar; bar; bar = bar->next)
bar->topbar = !bar->topbar;
if (!m->showbar) {
togglebar(NULL);
return;
}
updatebarpos(m);
for (bar = m->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
arrange(m);
}

1
patch/toggletopbar.h Normal file
View File

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

View File

@@ -1,5 +1,5 @@
/* Settings */
#if !PERTAG_VANITYGAPS_PATCH
#if !(PERTAG_VANITYGAPS_PATCH || PERMON_VANITYGAPS_PATCH)
static int enablegaps = 1;
#endif // PERTAG_VANITYGAPS_PATCH
@@ -69,10 +69,12 @@ setgapsex(const Arg *arg)
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
if (!selmon->pertag->enablegaps[selmon->pertag->curtag])
selmon->pertag->enablegaps[selmon->pertag->curtag] = 1;
#elif PERMON_VANITYGAPS_PATCH
selmon->enablegaps = 1;
#else
if (!enablegaps)
enablegaps = 1;
#endif // PERTAG_VANITYGAPS_PATCH
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
setgaps(oh, ov, ih, iv);
}
@@ -83,24 +85,35 @@ togglegaps(const Arg *arg)
{
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
selmon->pertag->enablegaps[selmon->pertag->curtag] = !selmon->pertag->enablegaps[selmon->pertag->curtag];
#elif PERMON_VANITYGAPS_PATCH
selmon->enablegaps = !selmon->enablegaps;
#else
enablegaps = !enablegaps;
#endif // PERTAG_VANITYGAPS_PATCH
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
#if BAR_PADDING_VANITYGAPS_PATCH
#if PERMON_VANITYGAPS_PATCH
updatebarpos(selmon);
for (Bar *bar = selmon->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
#else
for (Monitor *m = mons; m; m = m->next) {
updatebarpos(m);
for (Bar *bar = m->bar; bar; bar = bar->next)
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
}
#endif // PERMON_VANITYGAPS_PATCH
#if BAR_SYSTRAY_PATCH
drawbarwin(systray->bar);
#endif // BAR_SYSTRAY_PATCH
#endif // BAR_PADDING_VANITYGAPS_PATCH
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
#if (PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH) || PERMON_VANITYGAPS_PATCH
arrange(selmon);
#else
arrange(NULL);
#endif // PERTAG_VANITYGAPS_PATCH
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
}
static void
@@ -193,9 +206,11 @@ getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
unsigned int n, oe, ie;
#if PERTAG_VANITYGAPS_PATCH && PERTAG_PATCH
oe = ie = m->pertag->enablegaps[m->pertag->curtag];
#elif PERMON_VANITYGAPS_PATCH
oe = ie = m->enablegaps;
#else
oe = ie = enablegaps;
#endif // PERTAG_VANITYGAPS_PATCH
#endif // PERTAG_VANITYGAPS_PATCH | PERMON_VANITYGAPS_PATCH
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);

View File

@@ -132,7 +132,11 @@ xrdb(const Arg *arg)
#endif // BAR_ALPHA_PATCH
ColCount
);
focus(NULL);
#if BAR_SYSTRAY_PATCH && !BAR_ALPHA_PATCH
if (systray) {
XMoveWindow(dpy, systray->win, -32000, -32000);
}
#endif // BAR_SYSTRAY_PATCH
arrange(NULL);
focus(NULL);
}

View File

@@ -19,7 +19,7 @@
* Awesomebar takes precedence over fancybar.
* https://dwm.suckless.org/patches/awesomebar/
*/
#define BAR_AWESOMEBAR_PATCH 1
#define BAR_AWESOMEBAR_PATCH 0
/* This patch depends on statuscmd patch and adds integration with a (patched)
* dwmblocks instance to give a clickable status bar. One must not necessarily
@@ -67,6 +67,11 @@
*/
#define BAR_FLEXWINTITLE_PATCH 0
/* Adds buttons to the bar that can be used to launch applications.
* https://dwm.suckless.org/patches/launcher/
*/
#define BAR_LAUNCHER_PATCH 0
/* This patch adds a context menu for layout switching.
* - xmenu needs to be installed.
* - Edit layoutmenu.sh with the installed layouts and with correct indexes.
@@ -151,7 +156,7 @@
* This patch is incompatible with the extrabar patch.
* https://dwm.suckless.org/patches/status2d/
*/
#define BAR_STATUS2D_PATCH 1
#define BAR_STATUS2D_PATCH 0
/* Supplementary patch should you want to disable alpha for the status2d section */
#define BAR_STATUS2D_NO_ALPHA_PATCH 0
@@ -167,7 +172,7 @@
/* The systray patch adds systray for the status bar.
* https://dwm.suckless.org/patches/systray/
*/
#define BAR_SYSTRAY_PATCH 1
#define BAR_SYSTRAY_PATCH 0
/* Show tag symbols in the bar. */
#define BAR_TAGS_PATCH 1
@@ -180,7 +185,7 @@
/* This patch underlines the selected tag, or optionally all tags.
* https://dwm.suckless.org/patches/underlinetags/
*/
#define BAR_UNDERLINETAGS_PATCH 1
#define BAR_UNDERLINETAGS_PATCH 0
/* This patch adds the window icon next to the window title in the bar.
*
@@ -290,7 +295,7 @@
* modules.
* https://dwm.suckless.org/patches/centeredwindowname/
*/
#define BAR_CENTEREDWINDOWNAME_PATCH 1
#define BAR_CENTEREDWINDOWNAME_PATCH 0
/* Draws a dot indicator overlayed on each tag icon for each client. The selected client
* is drawn as a larger horizontal line.
@@ -331,7 +336,7 @@
/* Allows the bar height to be explicitly set rather than being derived from font.
* https://dwm.suckless.org/patches/bar_height/
*/
#define BAR_HEIGHT_PATCH 1
#define BAR_HEIGHT_PATCH 0
/* This patch prevents dwm from drawing tags with no clients (i.e. vacant) on the bar.
* https://dwm.suckless.org/patches/hide_vacant_tags/
@@ -367,7 +372,13 @@
* toggled in unison when vanitygaps are toggled. Increasing or decreasing gaps during runtime
* will not affect the bar padding.
*/
#define BAR_PADDING_VANITYGAPS_PATCH 1
#define BAR_PADDING_VANITYGAPS_PATCH 0
/* Smart bar padding patch that automatically adjusts the padding when there is
* only one client on the monitor. Works well with vanitygaps and barpadding
* patches.
*/
#define BAR_PADDING_SMART_PATCH 0
/* This patch adds simple markup for status messages using pango markup.
* This depends on the pango library v1.44 or greater.
@@ -400,7 +411,7 @@
/* This patch draws and updates the statusbar on all monitors.
* https://dwm.suckless.org/patches/statusallmons/
*/
#define BAR_STATUSALLMONS_PATCH 1
#define BAR_STATUSALLMONS_PATCH 0
/* This patch enables colored text in the status bar. It changes the way colors are defined
* in config.h allowing multiple color combinations for use in the status script.
@@ -441,7 +452,7 @@
/* Adds a window task switcher toggled using alt-tab.
* https://dwm.suckless.org/patches/alt-tab/
*/
#define ALT_TAB_PATCH 1
#define ALT_TAB_PATCH 0
/* All floating windows are centered, like the center patch, but without a rule.
* The center patch takes precedence over this patch.
@@ -466,13 +477,13 @@
* This patch takes precedence over ATTACHBELOW_PATCH.
* https://dwm.suckless.org/patches/attachaside/
*/
#define ATTACHASIDE_PATCH 1
#define ATTACHASIDE_PATCH 0
/* This patch adds new clients below the selected client.
* This patch takes precedence over ATTACHBOTTOM_PATCH.
* https://dwm.suckless.org/patches/attachbelow/
*/
#define ATTACHBELOW_PATCH 1
#define ATTACHBELOW_PATCH 0
/* This patch adds new clients at the bottom of the stack.
* https://dwm.suckless.org/patches/attachbottom/
@@ -505,11 +516,21 @@
*/
#define BIDI_PATCH 0
/* This patch adds a client rule option to allow the border width to be specified on a per
* client basis.
*
* Example rule:
* RULE(.class = "Gimp", .bw = 0)
*
* https://dwm.suckless.org/patches/borderrule/
*/
#define BORDER_RULE_PATCH 0
/* This patch adds an iscentered rule to automatically center clients on the current monitor.
* This patch takes precedence over centeredwindowname, alwayscenter and fancybar patches.
* https://dwm.suckless.org/patches/center/
*/
#define CENTER_PATCH 1
#define CENTER_PATCH 0
/* A transient window is one that is meant to be short lived and is usually raised by a
* parent window. Such windows are typically dialog boxes and the like.
@@ -555,7 +576,7 @@
/* The cyclelayouts patch lets you cycle through all your layouts.
* https://dwm.suckless.org/patches/cyclelayouts/
*/
#define CYCLELAYOUTS_PATCH 1
#define CYCLELAYOUTS_PATCH 0
/* 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
@@ -564,7 +585,7 @@
* like chromium (with "Use system title bar and borders" turned off) or vlc in fullscreen mode.
* https://dwm.suckless.org/patches/decoration_hints/
*/
#define DECORATION_HINTS_PATCH 1
#define DECORATION_HINTS_PATCH 0
/* This feature distributes all clients on the current monitor evenly across all tags.
* It is a variant of the reorganizetags patch.
@@ -572,6 +593,18 @@
*/
#define DISTRIBUTETAGS_PATCH 0
/* By default dwm will terminate on color allocation failure and the behaviour is intended to
* catch and inform the user of color configuration issues.
*
* Some patches like status2d and xresources / xrdb can change colours during runtime, which
* means that if a color can't be allocated at this time then the window manager will abruptly
* terminate.
*
* This patch will ignore color allocation failures and continue on as normal. The effect of
* this is that the existing color, that was supposed to be replaced, will remain as-is.
*/
#define DO_NOT_DIE_ON_COLOR_ALLOCATION_FAILURE_PATCH 0
/* Similarly to the dragmfact patch this allows you to click and drag clients to change the
* cfact to adjust the client's size in the stack. This patch depends on the cfacts patch.
*/
@@ -590,7 +623,7 @@
* #cp -f patch/dwmc ${DESTDIR}${PREFIX}/bin
* http://dwm.suckless.org/patches/dwmc/
*/
#define DWMC_PATCH 1
#define DWMC_PATCH 0
/* This patch allows no tag at all to be selected. The result is that dwm will start with
* no tag selected and when you start a client with no tag rule and no tag selected then
@@ -621,7 +654,7 @@
* Also see the selectivefakefullscreen option that adds a rule option to enabled this on client
* startup.
*/
#define FAKEFULLSCREEN_CLIENT_PATCH 1
#define FAKEFULLSCREEN_CLIENT_PATCH 0
/* This patch adds a float rule allowing the size and position of floating windows to be specified
* It also allows the size and position of floating windows to be controlled similar to the
@@ -646,11 +679,23 @@
*/
#define FOCUSDIR_PATCH 0
/* When changing tags, closing windows or moving clients out of view then focus will revert to the
* client window that remains under the mouse cursor rather than the most recently focused window.
* https://github.com/bakkeby/patches/wiki/focusfollowmouse
*/
#define FOCUSFOLLOWMOUSE_PATCH 0
/* A simple patch that just puts focus back to the master client.
* https://dwm.suckless.org/patches/focusmaster/
*/
#define FOCUSMASTER_PATCH 0
/* A variant of the focusmaster patch that additionally allows the focus to be returned to the
* previously focused client
* https://dwm.suckless.org/patches/focusmaster/
*/
#define FOCUSMASTER_RETURN_PATCH 0
/* Switch focus only by mouse click and not sloppy (focus follows mouse pointer).
* https://dwm.suckless.org/patches/focusonclick/
*/
@@ -680,7 +725,7 @@
* again it shows the bar and restores the layout that was active before going fullscreen.
* https://dwm.suckless.org/patches/fullscreen/
*/
#define FULLSCREEN_PATCH 1
#define FULLSCREEN_PATCH 0
/* This patch provides a keybinding to rotate all clients in the currently selected
* area (master or stack) without affecting the other area.
@@ -737,7 +782,7 @@
* in such scenarios the previous window loses fullscreen.
* https://github.com/bakkeby/patches/blob/master/dwm/dwm-losefullscreen-6.2.diff
*/
#define LOSEFULLSCREEN_PATCH 1
#define LOSEFULLSCREEN_PATCH 0
/* This patch adds helper functions for maximizing, horizontally and vertically, floating
* windows using keybindings.
@@ -820,7 +865,7 @@
/* Removes the border when there is only one window visible.
* https://dwm.suckless.org/patches/noborder/
*/
#define NOBORDER_PATCH 1
#define NOBORDER_PATCH 0
/* Enable modifying or removing dmenu in config.def.h which resulted previously in a
* compilation error because two lines of code hardcode dmenu into dwm.
@@ -879,11 +924,22 @@
*/
#define PERTAG_VANITYGAPS_PATCH 0
/* This patch allows configuring vanity gaps on a per-monitor basis rather than
* all monitors (default).
*/
#define PERMON_VANITYGAPS_PATCH 0
/* This controls whether or not to also store bar position on a per
* tag basis, or leave it as one bar per monitor.
*/
#define PERTAGBAR_PATCH 0
/* Similar to the focusdir patch this patch allow users to move a window in any direction
* in the tiled stack (up, down, left, right).
* https://github.com/bakkeby/patches/wiki/placedir
*/
#define PLACEDIR_PATCH 0
/* This patch lets you change the position of a client in the stack using the mouse.
* https://github.com/bakkeby/patches/wiki/placemouse
*/
@@ -942,7 +998,7 @@
* Additionally dwm can quit cleanly by using kill -TERM dwmpid.
* https://dwm.suckless.org/patches/restartsig/
*/
#define RESTARTSIG_PATCH 1
#define RESTARTSIG_PATCH 0
/* Adds rio-like drawing to resize the selected client.
* This depends on an external tool slop being installed.
@@ -981,10 +1037,10 @@
* https://lists.suckless.org/hackers/2004/17205.html
* https://dwm.suckless.org/patches/scratchpads/
*/
#define SCRATCHPADS_PATCH 1
#define SCRATCHPADS_PATCH 0
/* Minor alteration of the above allowing clients to keep their size and position when shown */
#define SCRATCHPADS_KEEP_POSITION_AND_SIZE_PATCH 1
#define SCRATCHPADS_KEEP_POSITION_AND_SIZE_PATCH 0
/* This alternative patch enables a scratchpad feature in dwm similar to the scratchpad
* feature in i3wm.
@@ -1002,7 +1058,7 @@
*
* The above is not persisted across reboots, however.
*/
#define SEAMLESS_RESTART_PATCH 1
#define SEAMLESS_RESTART_PATCH 0
/* As opposed to the original patch this only adds a rule option allowing fake fullscreen
* to be enabled for applications when they start. This is intended to be used in combination
@@ -1016,6 +1072,11 @@
*/
#define SELFRESTART_PATCH 0
/* Floating windows being sent to another monitor will be centered.
* https://dwm.suckless.org/patches/sendmoncenter/
*/
#define SENDMON_CENTER_PATCH 0
/* This patch allow clients to keep focus when being sent to another monitor.
* https://github.com/bakkeby/patches/blob/master/dwm/dwm-sendmon_keepfocus-6.2.diff
*/
@@ -1122,7 +1183,7 @@
*
* https://github.com/bakkeby/patches/wiki/steam
*/
#define STEAM_PATCH 1
#define STEAM_PATCH 0
/* Adds toggleable keyboard shortcut to make a client 'sticky', i.e. visible on all tags.
* https://dwm.suckless.org/patches/sticky/
@@ -1234,7 +1295,7 @@
* adjacent monitor.
* https://github.com/bakkeby/patches/blob/master/dwm/dwm-tagswapmon-6.2.diff
*/
#define TAGSWAPMON_PATCH 1
#define TAGSWAPMON_PATCH 0
/* Sync tag actions across all monitors.
* This is comparable to a sort of pseudo-desktop environment.
@@ -1255,6 +1316,11 @@
*/
#define TOGGLEFULLSCREEN_PATCH 0
/* This patch allows for the bar position (top or bottom) to be toggled during runtime.
* https://dwm.suckless.org/patches/toggletopbar/
*/
#define TOGGLETOPBAR_PATCH 0
/* Minor patch that lets you use the same keyboard shortcut to toggle to the previous layout if the
* designated layout is already active.
*
@@ -1298,12 +1364,19 @@
*/
#define UNFLOATVISIBLE_PATCH 0
/* This patch adds a client rule that allows for windows that do not specify the override-redirect
* to not be managed by the window manager. This can be useful for external bars, widgets,
* launchers, docks, desktop icons and more.
* https://github.com/bakkeby/patches/wiki/unmanaged
*/
#define UNMANAGED_PATCH 0
/* This patch adds configurable gaps between windows differentiating between outer, inner,
* horizontal and vertical gaps.
* https://github.com/bakkeby/patches/blob/master/dwm/dwm-vanitygaps-6.2.diff
* https://github.com/bakkeby/patches/blob/master/dwm/dwm-cfacts-vanitygaps-6.2.diff
*/
#define VANITYGAPS_PATCH 1
#define VANITYGAPS_PATCH 0
/* This patch adds outer gaps for the monocle layout.
* Most gaps patches tries to avoid gaps on the monocle layout, as it is often used as a
@@ -1358,7 +1431,7 @@
* the float border color, awesomebar, urgentborder and titlecolor patches.
* https://dwm.suckless.org/patches/xrdb/
*/
#define XRDB_PATCH 1
#define XRDB_PATCH 0
/* Simple patch that allows floating windows to be zoomed into the master stack position.
* https://www.reddit.com/r/suckless/comments/ie5fe3/zoomfloating_my_own_simple_original_patch/
@@ -1378,7 +1451,7 @@
/* Bottomstack layout.
* https://dwm.suckless.org/patches/bottomstack/
*/
#define BSTACK_LAYOUT 1
#define BSTACK_LAYOUT 0
/* Bottomstack horizontal layout.
* https://dwm.suckless.org/patches/bottomstack/
@@ -1388,7 +1461,7 @@
/* Centered master layout.
* https://dwm.suckless.org/patches/centeredmaster/
*/
#define CENTEREDMASTER_LAYOUT 1
#define CENTEREDMASTER_LAYOUT 0
/* Centered floating master layout.
* https://dwm.suckless.org/patches/centeredmaster/
@@ -1409,7 +1482,7 @@
/* Fibonacci dwindle layout.
* https://dwm.suckless.org/patches/fibonacci/
*/
#define FIBONACCI_DWINDLE_LAYOUT 1
#define FIBONACCI_DWINDLE_LAYOUT 0
/* Fibonacci spiral layout.
* https://dwm.suckless.org/patches/fibonacci/
@@ -1430,7 +1503,7 @@
/* Gridmode (grid) layout.
* https://dwm.suckless.org/patches/gridmode/
*/
#define GRIDMODE_LAYOUT 1
#define GRIDMODE_LAYOUT 0
/* Horizontal grid (horizgrid) layout.
* https://dwm.suckless.org/patches/horizgrid/

View File

@@ -1,4 +0,0 @@
#!/bin/bash
rm -f ./config.h ./patches.h
sudo make clean install

12
util.c
View File

@@ -1,4 +1,5 @@
/* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -10,17 +11,16 @@ void
die(const char *fmt, ...)
{
va_list ap;
int saved_errno;
saved_errno = errno;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
fputc(' ', stderr);
perror(NULL);
} else {
fputc('\n', stderr);
}
if (fmt[0] && fmt[strlen(fmt)-1] == ':')
fprintf(stderr, " %s", strerror(saved_errno));
fputc('\n', stderr);
exit(1);
}

1
util.h
View File

@@ -7,6 +7,7 @@
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
#define LENGTH(X) (sizeof (X) / sizeof (X)[0])
#ifdef _DEBUG
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)