mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding fsignal patch and moved dwmc signal settings to config.def.h
This commit is contained in:
parent
8392323938
commit
4ddfdab30e
@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
### Changelog:
|
||||
|
||||
2020-02-02 - Added fsignal patch and moved dwmc signal settings to config.def.h
|
||||
|
||||
2020-01-29 - Added swapfocus and shiftview patches
|
||||
|
||||
2020-01-26 - Added transfer patch
|
||||
@ -186,6 +188,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
- [focusurgent](https://dwm.suckless.org/patches/focusurgent/)
|
||||
- adds a keyboard shortcut to select the next window having the urgent flag regardless of the tag it is on
|
||||
|
||||
- [fsignal](https://dwm.suckless.org/patches/fsignal/)
|
||||
- send "fake signals" to dwm for handling, using xsetroot
|
||||
- this will not conflict with the status bar, which also is managed using xsetroot
|
||||
|
||||
- [fullscreen](https://dwm.suckless.org/patches/fullscreen/)
|
||||
- applies the monocle layout with the focused client on top and hides the bar
|
||||
- when pressed again it shows the bar and restores the layout that was active before going fullscreen
|
||||
|
39
config.def.h
39
config.def.h
@ -340,6 +340,45 @@ static const MonitorRule monrules[] = {
|
||||
#endif // PERTAG_PATCH
|
||||
#endif // MONITOR_RULES_PATCH
|
||||
|
||||
#if DWMC_PATCH
|
||||
/* signal definitions */
|
||||
/* signum must be greater than 0 */
|
||||
/* trigger signals using `xsetroot -name "fsignal:<signame> [<type> <value>]"` */
|
||||
static Signal signals[] = {
|
||||
/* signum function */
|
||||
{ "focusstack", focusstack },
|
||||
{ "setmfact", setmfact },
|
||||
{ "togglebar", togglebar },
|
||||
{ "incnmaster", incnmaster },
|
||||
{ "togglefloating", togglefloating },
|
||||
{ "focusmon", focusmon },
|
||||
{ "tagmon", tagmon },
|
||||
{ "zoom", zoom },
|
||||
{ "view", view },
|
||||
{ "viewall", viewallex },
|
||||
{ "viewex", viewex },
|
||||
{ "toggleview", view },
|
||||
{ "toggleviewex", toggleviewex },
|
||||
{ "tag", tag },
|
||||
{ "tagall", tagallex },
|
||||
{ "tagex", tagex },
|
||||
{ "toggletag", tag },
|
||||
{ "toggletagex", toggletagex },
|
||||
{ "killclient", killclient },
|
||||
{ "quit", quit },
|
||||
{ "setlayout", setlayout },
|
||||
{ "setlayoutex", setlayoutex },
|
||||
};
|
||||
#elif FSIGNAL_PATCH
|
||||
/* signal definitions */
|
||||
/* signum must be greater than 0 */
|
||||
/* trigger signals using `xsetroot -name "fsignal:<signum>"` */
|
||||
static Signal signals[] = {
|
||||
/* signum function argument */
|
||||
{ 1, setlayout, {.v = 0} },
|
||||
};
|
||||
#endif // DWMC_PATCH
|
||||
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
|
6
dwm.c
6
dwm.c
@ -2260,10 +2260,12 @@ propertynotify(XEvent *e)
|
||||
#endif // SYSTRAY_PATCH
|
||||
|
||||
if ((ev->window == root) && (ev->atom == XA_WM_NAME)) {
|
||||
#if DWMC_PATCH
|
||||
#if DWMC_PATCH || FSIGNAL_PATCH
|
||||
if (!fake_signal())
|
||||
#endif // DWMC_PATCH
|
||||
updatestatus();
|
||||
#else
|
||||
updatestatus();
|
||||
#endif // DWMC_PATCH / FSIGNAL_PATCH
|
||||
} else if (ev->state == PropertyDelete) {
|
||||
return; /* ignore */
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
|
29
patch/dwmc.c
29
patch/dwmc.c
@ -40,35 +40,6 @@ tagallex(const Arg *arg)
|
||||
tag(&((Arg){.ui = ~0}));
|
||||
}
|
||||
|
||||
/* signal definitions */
|
||||
/* signum must be greater than 0 */
|
||||
/* trigger signals using `xsetroot -name "fsignal:<signame> [<type> <value>]"` */
|
||||
static Signal signals[] = {
|
||||
/* signum function */
|
||||
{ "focusstack", focusstack },
|
||||
{ "setmfact", setmfact },
|
||||
{ "togglebar", togglebar },
|
||||
{ "incnmaster", incnmaster },
|
||||
{ "togglefloating", togglefloating },
|
||||
{ "focusmon", focusmon },
|
||||
{ "tagmon", tagmon },
|
||||
{ "zoom", zoom },
|
||||
{ "view", view },
|
||||
{ "viewall", viewallex },
|
||||
{ "viewex", viewex },
|
||||
{ "toggleview", view },
|
||||
{ "toggleviewex", toggleviewex },
|
||||
{ "tag", tag },
|
||||
{ "tagall", tagallex },
|
||||
{ "tagex", tagex },
|
||||
{ "toggletag", tag },
|
||||
{ "toggletagex", toggletagex },
|
||||
{ "killclient", killclient },
|
||||
{ "quit", quit },
|
||||
{ "setlayout", setlayout },
|
||||
{ "setlayoutex", setlayoutex },
|
||||
};
|
||||
|
||||
int
|
||||
fake_signal(void)
|
||||
{
|
||||
|
40
patch/fsignal.c
Normal file
40
patch/fsignal.c
Normal file
@ -0,0 +1,40 @@
|
||||
int
|
||||
fake_signal(void)
|
||||
{
|
||||
char fsignal[256];
|
||||
char indicator[9] = "fsignal:";
|
||||
char str_signum[16];
|
||||
int i, v, signum;
|
||||
size_t len_fsignal, len_indicator = strlen(indicator);
|
||||
|
||||
// Get root name property
|
||||
if (gettextprop(root, XA_WM_NAME, fsignal, sizeof(fsignal))) {
|
||||
len_fsignal = strlen(fsignal);
|
||||
|
||||
// Check if this is indeed a fake signal
|
||||
if (len_indicator > len_fsignal ? 0 : strncmp(indicator, fsignal, len_indicator) == 0) {
|
||||
memcpy(str_signum, &fsignal[len_indicator], len_fsignal - len_indicator);
|
||||
str_signum[len_fsignal - len_indicator] = '\0';
|
||||
|
||||
// Convert string value into managable integer
|
||||
for (i = signum = 0; i < strlen(str_signum); i++) {
|
||||
v = str_signum[i] - '0';
|
||||
if (v >= 0 && v <= 9) {
|
||||
signum = signum * 10 + v;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if a signal was found, and if so handle it
|
||||
if (signum)
|
||||
for (i = 0; i < LENGTH(signals); i++)
|
||||
if (signum == signals[i].signum && signals[i].func)
|
||||
signals[i].func(&(signals[i].arg));
|
||||
|
||||
// A fake signal was sent
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// No fake signal was sent, so proceed with update
|
||||
return 0;
|
||||
}
|
7
patch/fsignal.h
Normal file
7
patch/fsignal.h
Normal file
@ -0,0 +1,7 @@
|
||||
typedef struct {
|
||||
unsigned int signum;
|
||||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
} Signal;
|
||||
|
||||
static int fake_signal(void);
|
@ -28,6 +28,8 @@
|
||||
#endif
|
||||
#if DWMC_PATCH
|
||||
#include "dwmc.c"
|
||||
#elif FSIGNAL_PATCH
|
||||
#include "fsignal.c"
|
||||
#endif
|
||||
#if EWMHTAGS_PATCH
|
||||
#include "ewmhtags.c"
|
||||
|
@ -28,6 +28,8 @@
|
||||
#endif
|
||||
#if DWMC_PATCH
|
||||
#include "dwmc.h"
|
||||
#elif FSIGNAL_PATCH
|
||||
#include "fsignal.h"
|
||||
#endif
|
||||
#if EWMHTAGS_PATCH
|
||||
#include "ewmhtags.h"
|
||||
|
@ -135,7 +135,8 @@
|
||||
|
||||
/* Simple dwmc client using a fork of fsignal to communicate with dwm.
|
||||
* To use this either copy the patch/dwmc shell script to somewhere in your path or
|
||||
* uncomment the following line in Makefile: #cp -f patch/dwmc ${DESTDIR}${PREFIX}/bin
|
||||
* uncomment the following line in Makefile:
|
||||
* #cp -f patch/dwmc ${DESTDIR}${PREFIX}/bin
|
||||
* http://dwm.suckless.org/patches/dwmc/
|
||||
*/
|
||||
#define DWMC_PATCH 0
|
||||
@ -190,6 +191,11 @@
|
||||
*/
|
||||
#define FANCYBAR_PATCH 0
|
||||
|
||||
/* This patch allows a different border color to be chosen for floating windows.
|
||||
* https://dwm.suckless.org/patches/float_border_color/
|
||||
*/
|
||||
#define FLOAT_BORDER_COLOR_PATCH 0
|
||||
|
||||
/* This patch provides the ability to focus the tag on the immediate left or right of the
|
||||
* currently focused tag. It also allows to send the focused window either on the left or
|
||||
* the right tag.
|
||||
@ -209,17 +215,19 @@
|
||||
*/
|
||||
#define FOCUSURGENT_PATCH 0
|
||||
|
||||
/* This patch allows a different border color to be chosen for floating windows.
|
||||
* https://dwm.suckless.org/patches/float_border_color/
|
||||
*/
|
||||
#define FLOAT_BORDER_COLOR_PATCH 0
|
||||
|
||||
/* By default, dwm responds to _NET_ACTIVE_WINDOW client messages by setting
|
||||
* the urgency bit on the named window. This patch activates the window instead.
|
||||
* https://dwm.suckless.org/patches/focusonnetactive/
|
||||
*/
|
||||
#define FOCUSONNETACTIVE_PATCH 0
|
||||
|
||||
/* Send "fake signals" to dwm for handling, using xsetroot. This will not conflict with the
|
||||
* status bar, which also is managed using xsetroot.
|
||||
* Also see the dwmc patch, which takes precedence over this patch.
|
||||
* https://dwm.suckless.org/patches/fsignal/
|
||||
*/
|
||||
#define FSIGNAL_PATCH 0
|
||||
|
||||
/* Applies the monocle layout with the focused client on top and hides the bar. When pressed
|
||||
* again it shows the bar and restores the layout that was active before going fullscreen.
|
||||
* NB: This patch assumes that the third layout is monocle and that the bar is shown.
|
||||
|
Loading…
Reference in New Issue
Block a user