Compare commits

...

2 commits

20 changed files with 299 additions and 159 deletions

View file

@ -564,10 +564,12 @@ static const BarRule barrules[] = {
/* monitor bar alignment widthfunc drawfunc clickfunc hoverfunc name */
#if BAR_STATUSBUTTON_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, NULL, "statusbutton" },
{ -1, 1, BAR_ALIGN_LEFT, width_stbutton2, draw_stbutton2, click_stbutton2, NULL, "statusbutton2" },
{ -1, 1, BAR_ALIGN_LEFT, width_stbutton3, draw_stbutton3, click_stbutton3, NULL, "statusbutton3" },
{ -1, 1, BAR_ALIGN_LEFT, width_stbutton4, draw_stbutton4, click_stbutton4, NULL, "statusbutton4" },
#endif // BAR_STATUSBUTTON_PATCH
#if BAR_DOCKBUTTONS_PATCH
{ -1, 1, BAR_ALIGN_LEFT, width_dcbutton, draw_dcbutton, click_dcbutton, NULL, "dockbutton" },
{ -1, 1, BAR_ALIGN_LEFT, width_dcbutton2, draw_dcbutton2, click_dcbutton2, NULL, "dockbutton2" },
{ -1, 1, BAR_ALIGN_LEFT, width_dcbutton3, draw_dcbutton3, click_dcbutton3, NULL, "dockbutton3" },
#endif // BAR_DOCKBUTTONS_PATCH
#if BAR_TAGGRID_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_taggrid, draw_taggrid, click_taggrid, NULL, "taggrid" },
#endif // BAR_TAGGRID_PATCH
@ -580,12 +582,14 @@ static const BarRule barrules[] = {
#if BAR_TAGLABELS_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_taglabels, draw_taglabels, click_taglabels, hover_taglabels, "taglabels" },
#endif // BAR_TAGLABELS_PATCH
#if BAR_STATUSBUTTON_PATCH
{ -1, 0, BAR_ALIGN_RIGHT, width_stbutton5, draw_stbutton5, click_stbutton5, NULL, "statusbutton5" },
{ -1, 1, BAR_ALIGN_RIGHT, width_stbutton6, draw_stbutton6, click_stbutton6, NULL, "statusbutton6" },
{ -1, 1, BAR_ALIGN_RIGHT, width_stbutton7, draw_stbutton7, click_stbutton7, NULL, "statusbutton7" },
{ -1, 1, BAR_ALIGN_RIGHT, width_stbutton8, draw_stbutton8, click_stbutton8, NULL, "statusbutton8" },
#endif // BAR_STATUSBUTTON_PATCH
#if BAR_POWERBUTTON_PATCH
{ -1, 0, BAR_ALIGN_RIGHT, width_powbutton, draw_powbutton, click_powbutton, NULL, "powerbutton" },
#endif // BAR_POWERBUTTON_PATCH
#if BAR_WINCONTROLBUTTONS_PATCH
{ -1, 1, BAR_ALIGN_RIGHT, width_winbutton, draw_winbutton, click_winbutton, NULL, "statusbutton6" },
{ -1, 1, BAR_ALIGN_RIGHT, width_winbutton2, draw_winbutton2, click_winbutton2, NULL, "statusbutton7" },
{ -1, 1, BAR_ALIGN_RIGHT, width_winbutton3, draw_winbutton3, click_winbutton3, NULL, "statusbutton8" },
#endif // BAR_WINCONTROLBUTTONS_PATCH
#if BAR_SYSTRAY_PATCH
{ 0, 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, NULL, "systray" },
#endif // BAR_SYSTRAY_PATCH
@ -1404,7 +1408,7 @@ static const Command commands[] = {
/* button definitions */
#if STATUSBUTTON_PATCH
/* click can be ClkButton, ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
/* click can be ClkButton*, ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
#else
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
#endif //
@ -1414,17 +1418,23 @@ static const Button buttons[] = {
{ ClkButton, 0, Button1, spawn, SHCMD("spmenu_run -d -a '-g 4 -l 10'") /* use spmenu instead of dmenu */ },
{ ClkButton, 0, Button2, spawn, {.v = dmenucmd } /* launch dmenu instead if middle-clicked*/ },
{ ClkButton, 0, Button3, spawn, SHCMD("jgmenu_run apps | jgmenu --simple --at-pointer") /* launch jgmenu on right click */ },
#endif // BAR_STATUSBUTTON_PATCH
#if BAR_DOCKBUTTONS_PATCH
{ ClkButton2, 0, Button1, spawn, {.v = termcmd } },
{ ClkButton2, 0, Button3, spawn, SHCMD("printf ' New tabbed session, tabbed -c -r 2 st -w \"\"\n New dvtm session, st -T dvtm abduco -c dvtm dvtm-status\n' | jgmenu --simple --at-pointer") },
{ ClkButton3, 0, Button1, spawn, SHCMD("firefox") },
{ ClkButton3, 0, Button3, spawn, SHCMD("printf ' New Window, firefox\n󱀣 New Private Window, firefox -private-window\n' | jgmenu --simple --at-pointer") },
{ ClkButton4, 0, Button1, spawn, SHCMD("st -T ncmpcpp ncmpcpp") },
{ ClkButton4, 0, Button3, spawn, SHCMD("printf '󰒮 Previous Song, mpc prev\n󰐊 Play, mpc play\n󰏤 Pause, mpc pause\n󰓛 Stop, mpc stop\n󰒭 Next Song, mpc next\n󰕾 Vol +5%%,mpc vol +5\n󰖀 Vol -5%%, mpc vol -5\n' | jgmenu --simple --at-pointer") },
#endif // BAR_DOCKBUTTONS_PATCH
#if BAR_POWERBUTTON_PATCH
{ ClkButton5, 0, Button1, spawn, SHCMD("shutdown") },
#endif // BAR_POWERBUTTON_PATCH
#if BAR_WINCONTROLBUTTONS_PATCH
{ ClkButton6, 0, Button1, killclient, {0} },
{ ClkButton7, 0, Button1, togglemax, {0} },
{ ClkButton8, 0, Button1, showhideclient, {0} },
#endif // BAR_STATUSBUTTON_PATCH
#endif // BAR_WINCONTROLBUTTONS_PATCH
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
#if BAR_LAYOUTMENU_PATCH
{ ClkLtSymbol, 0, Button3, layoutmenu, {0} },

View file

@ -232,14 +232,20 @@ enum {
enum {
#if BAR_STATUSBUTTON_PATCH
ClkButton,
#endif // BAR_STATUSBUTTON_PATCH
#if BAR_DOCKBUTTONS_PATCH
ClkButton2,
ClkButton3,
ClkButton4,
#endif // BAR_DOCKBUTTONS_PATCH
#if BAR_POWERBUTTON_PATCH
ClkButton5,
#endif // BAR_POWERBUTTON_PATCH
#if BAR_WINCONTROLBUTTONS_PATCH
ClkButton6,
ClkButton7,
ClkButton8,
#endif // BAR_STATUSBUTTON_PATCH
#endif // BAR_WINCONTROLBUTTONS_PATCH
#if TAB_PATCH
ClkTabBar,
#endif // TAB_PATCH

View file

@ -0,0 +1,51 @@
int
width_dcbutton(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar2);
}
int
draw_dcbutton(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar2, 0, False);
}
int
click_dcbutton(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton2;
}
int
width_dcbutton2(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar3);
}
int
draw_dcbutton2(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar3, 0, False);
}
int
click_dcbutton2(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton3;
}
int
width_dcbutton3(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar4);
}
int
draw_dcbutton3(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar4, 0, False);
}
int
click_dcbutton3(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton4;
}

View file

@ -0,0 +1,9 @@
static int width_dcbutton(Bar *bar, BarArg *a);
static int draw_dcbutton(Bar *bar, BarArg *a);
static int click_dcbutton(Bar *bar, Arg *arg, BarArg *a);
static int width_dcbutton2(Bar *bar, BarArg *a);
static int draw_dcbutton2(Bar *bar, BarArg *a);
static int click_dcbutton2(Bar *bar, Arg *arg, BarArg *a);
static int width_dcbutton3(Bar *bar, BarArg *a);
static int draw_dcbutton3(Bar *bar, BarArg *a);
static int click_dcbutton3(Bar *bar, Arg *arg, BarArg *a);

View file

@ -0,0 +1,17 @@
int
width_powbutton(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar5);
}
int
draw_powbutton(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 20, buttonbar5, 0, False);
}
int
click_powbutton(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton5;
}

View file

@ -0,0 +1,3 @@
static int width_powbutton(Bar *bar, BarArg *a);
static int draw_powbutton(Bar *bar, BarArg *a);
static int click_powbutton(Bar *bar, Arg *arg, BarArg *a);

View file

@ -15,123 +15,4 @@ click_stbutton(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton;
}
/* modification by Lucas-mother3 to add more buttons */
int
width_stbutton2(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar2);
}
int
draw_stbutton2(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar2, 0, False);
}
int
click_stbutton2(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton2;
}
int
width_stbutton3(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar3);
}
int
draw_stbutton3(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar3, 0, False);
}
int
click_stbutton3(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton3;
}
int
width_stbutton4(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar4);
}
int
draw_stbutton4(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar4, 0, False);
}
int
click_stbutton4(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton4;
}
int
width_stbutton5(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar5);
}
int
draw_stbutton5(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 20, buttonbar5, 0, False);
}
int
click_stbutton5(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton5;
}
int
width_stbutton6(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar6);
}
int
draw_stbutton6(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar6, 0, False);
}
int
click_stbutton6(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton6;
}
int
width_stbutton7(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar7);
}
int
draw_stbutton7(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar7, 0, False);
}
int
click_stbutton7(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton7;
}
int
width_stbutton8(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar8);
}
int
draw_stbutton8(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar8, 0, False);
}
int
click_stbutton8(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton8;
}

View file

@ -1,24 +1,3 @@
static int width_stbutton(Bar *bar, BarArg *a);
static int draw_stbutton(Bar *bar, BarArg *a);
static int click_stbutton(Bar *bar, Arg *arg, BarArg *a);
static int width_stbutton2(Bar *bar, BarArg *a);
static int draw_stbutton2(Bar *bar, BarArg *a);
static int click_stbutton2(Bar *bar, Arg *arg, BarArg *a);
static int width_stbutton3(Bar *bar, BarArg *a);
static int draw_stbutton3(Bar *bar, BarArg *a);
static int click_stbutton3(Bar *bar, Arg *arg, BarArg *a);
static int width_stbutton4(Bar *bar, BarArg *a);
static int draw_stbutton4(Bar *bar, BarArg *a);
static int click_stbutton4(Bar *bar, Arg *arg, BarArg *a);
static int width_stbutton5(Bar *bar, BarArg *a);
static int draw_stbutton5(Bar *bar, BarArg *a);
static int click_stbutton5(Bar *bar, Arg *arg, BarArg *a);
static int width_stbutton6(Bar *bar, BarArg *a);
static int draw_stbutton6(Bar *bar, BarArg *a);
static int click_stbutton6(Bar *bar, Arg *arg, BarArg *a);
static int width_stbutton7(Bar *bar, BarArg *a);
static int draw_stbutton7(Bar *bar, BarArg *a);
static int click_stbutton7(Bar *bar, Arg *arg, BarArg *a);
static int width_stbutton8(Bar *bar, BarArg *a);
static int draw_stbutton8(Bar *bar, BarArg *a);
static int click_stbutton8(Bar *bar, Arg *arg, BarArg *a);

View file

@ -0,0 +1,51 @@
int
width_winbutton(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar6);
}
int
draw_winbutton(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar6, 0, False);
}
int
click_winbutton(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton6;
}
int
width_winbutton2(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar7);
}
int
draw_winbutton2(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar7, 0, False);
}
int
click_winbutton2(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton7;
}
int
width_winbutton3(Bar *bar, BarArg *a)
{
return TEXTW(buttonbar8);
}
int
draw_winbutton3(Bar *bar, BarArg *a)
{
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, buttonbar8, 0, False);
}
int
click_winbutton3(Bar *bar, Arg *arg, BarArg *a)
{
return ClkButton8;
}

View file

@ -0,0 +1,9 @@
static int width_winbutton(Bar *bar, BarArg *a);
static int draw_winbutton(Bar *bar, BarArg *a);
static int click_winbutton(Bar *bar, Arg *arg, BarArg *a);
static int width_winbutton2(Bar *bar, BarArg *a);
static int draw_winbutton2(Bar *bar, BarArg *a);
static int click_winbutton2(Bar *bar, Arg *arg, BarArg *a);
static int width_winbutton3(Bar *bar, BarArg *a);
static int draw_winbutton3(Bar *bar, BarArg *a);
static int click_winbutton3(Bar *bar, Arg *arg, BarArg *a);

View file

@ -395,4 +395,12 @@
#if TILE_LAYOUT
#include "layout_tile.c"
#endif
#if BAR_DOCKBUTTONS_PATCH
#include "bar_dockbutton.c"
#endif
#if BAR_POWERBUTTON_PATCH
#include "bar_powerbutton.c"
#endif
#if BAR_WINCONTROLBUTTONS_PATCH
#include "bar_wincontrolbutton.c"
#endif

View file

@ -388,4 +388,12 @@
#if TILE_LAYOUT
#include "layout_tile.h"
#endif
#if BAR_DOCKBUTTONS_PATCH
#include "bar_dockbutton.h"
#endif
#if BAR_POWERBUTTON_PATCH
#include "bar_powerbutton.h"
#endif
#if BAR_WINCONTROLBUTTONS_PATCH
#include "bar_wincontrolbutton.h"
#endif

View file

@ -1469,3 +1469,25 @@
* This can be optionally disabled in favour of other layouts.
*/
#define MONOCLE_LAYOUT 1
/**
* Specific build patches
*/
/* Additional status buttons for the taskbar/bottom bar.
* This can be an alternative for dockbar programs.
*/
#define BAR_DOCKBUTTONS_PATCH 1
/* A simple power button for dwm.
* Uses jgmenu, and a script handling the commands.
*/
#define BAR_POWERBUTTON_PATCH 1
/* Decorative window control buttons for dwm.
* Depends on the MAXIMIZE patch.
*/
#define BAR_WINCONTROLBUTTONS_PATCH 1

View file

@ -18,6 +18,9 @@ static const int tabwidth = 200;
#endif // AWESOMEBAR_PATCH
static const Bool foreground = True;
static Bool urgentswitch = False;
#if SEPERATOR_PATCH
static const int separator = 1;
#endif // SEPERATOR_PATCH
#if BAR_HEIGHT_PATCH
static const int barheight = 0; /* 0 means derive by font (default), otherwise absolute height */

View file

@ -0,0 +1,34 @@
void
motionnotify(const XEvent *e)
{
const XMotionEvent *ev = &e->xmotion;
int i, fc;
Arg arg;
if (ev->y < 0 || ev->y > bh)
return;
if (! (ev->state & Button1Mask)) {
return;
}
if (((fc = getfirsttab()) > 0 && ev->x < TEXTW(before)) || ev->x < 0)
return;
if (sel < 0)
return;
for (i = fc; i < nclients; i++) {
if (clients[i]->tabx > ev->x) {
if (i == sel+1) {
arg.i = 1;
movetab(&arg);
}
if (i == sel-1) {
arg.i = -1;
movetab(&arg);
}
break;
}
}
}

View file

@ -0,0 +1 @@
static void motionnotify(const XEvent *e);

View file

@ -1,4 +1,7 @@
/* Patches */
#if DRAG_PATCH
#include "drag.c"
#endif
#if HIDETABS_PATCH
#include "hidebar.c"
#endif
@ -10,4 +13,4 @@
#endif
#if XRESOURCES_PATCH
#include "xresources.c"
#endif
#endif

View file

@ -1,4 +1,7 @@
/* Patches */
#if DRAG_PATCH
#include "drag.h"
#endif
#if HIDETABS_PATCH
#include "hidebar.h"
#endif
@ -10,4 +13,4 @@
#endif
#if XRESOURCES_PATCH
#include "xresources.h"
#endif
#endif

View file

@ -42,11 +42,22 @@
*/
#define CENTER_PATCH 1
/* With this patch, tabbed interprets large position numbers as the largest known position.
* This allows Ctrl-9, for example, to always select the rightmost tab, even if there are only 4 tabs.
* https://tools.suckless.org/tabbed/patches/move-clamped/
*/
#define CLAMPEDMOVE_PATCH 1
/* This patch prints the position number of the client before the window title.
* https://tools.suckless.org/tabbed/patches/clientnumber/
*/
#define CLIENTNUMBER_PATCH 1
/* Support dragging tabs left and right with the mouse.
* https://tools.suckless.org/tabbed/patches/drag/
*/
#define DRAG_PATCH 1
/* This patch hides all the tabs and only shows them when Mod+Shift is pressed. All functions
* with switching, rotating, and creating tabs involve Mod+Shift. When not doing one of these
* functions, visibility of the tabs is not needed.
@ -85,6 +96,12 @@
*/
#define REPARENT_PATCH 1
/* Add a decorative separator bar to the beginning of each tab.
* Configure the width via the separator property in config.h.
* https://tools.suckless.org/tabbed/patches/separator/
*/
#define SEPERATOR_PATCH 0
/* This patch allows tabbed colors to be defined via Xresources.
* https://tools.suckless.org/tabbed/patches/xresources/
*/

View file

@ -172,6 +172,9 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
#endif // KEYRELEASE_PATCH
[MapRequest] = maprequest,
[PropertyNotify] = propertynotify,
#if DRAG_PATCH
[MotionNotify] = motionnotify,
#endif // DRAG_PATCH
};
static int bh, obh, wx, wy, ww, wh;
#if AUTOHIDE_PATCH || HIDETABS_PATCH
@ -476,10 +479,20 @@ drawtext(const char *text, XftColor col[ColLast])
int i, j, x, y, h, len, olen;
char buf[256];
XftDraw *d;
#if SEPERATOR_PATCH
XRectangle tab = { dc.x+separator, dc.y, dc.w-separator, dc.h };
XRectangle sep = { dc.x, dc.y, separator, dc.h };
#else
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
#endif // SEPERATOR_PATCH
XSetForeground(dpy, dc.gc, col[ColBG].pixel);
#if SEPERATOR_PATCH
XFillRectangles(dpy, dc.drawable, dc.gc, &tab, 1);
#else
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
#endif // SEPERATOR_PATCH
if (!text)
return;
@ -928,8 +941,15 @@ maprequest(const XEvent *e)
void
move(const Arg *arg)
{
if (arg->i >= 0 && arg->i < nclients)
focus(arg->i);
#if CLAMPEDMOVE_PATCH
int i;
i = arg->i < nclients ? arg->i : nclients - 1;
if (i >= 0)
focus(i);
#else
if (arg->i >= 0 && arg->i < nclients)
focus(arg->i);
#endif // CLAMPEDMOVE_PATCH
}
void
@ -1264,7 +1284,12 @@ setup(void)
KeyReleaseMask |
#endif // KEYRELEASE_PATCH
PropertyChangeMask | StructureNotifyMask |
SubstructureRedirectMask);
#if DRAG_PATCH
SubstructureRedirectMask | ButtonMotionMask
#else
SubstructureRedirectMask
#endif // DRAG_PATCH
);
xerrorxlib = XSetErrorHandler(xerror);
class_hint.res_name = wmname;