Add .Xresources toggle, fix wallpapers reloading twice

This commit is contained in:
speediegq 2022-10-05 13:42:45 +02:00
parent 2adbd2b126
commit 99b32b1002
5 changed files with 15 additions and 2 deletions

View file

@ -51,8 +51,9 @@ static Signal signals[] = {
{ 63, reset_layout, {0} },
{ 64, resetnmaster, {0} },
{ 65, togglesystray, {0} },
#if USEXRESOURCES
{ 66, reloadcolors, {0} },
#endif
#if LAYOUT_TILE
{ 1, setlayout, {.v = &layouts[0]} }, /* Tiling layout */
#endif

View file

@ -317,7 +317,7 @@ SWAL_EXPORT_SCRIPT_WAL()
command -v wal > /dev/null && wal -nqi "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER"
#command -v speedwm_run > /dev/null && speedwm_run -loadconfig # uncomment if you're having issues with this
#command -v speedwm_run > /dev/null && speedwm_run -rnoload # uncomment if you're having issues with this
command -v speedwm_run > /dev/null && speedwm_run -rcolors
command -v speedwm_run > /dev/null && speedwm_run -rnoloadcolors
pgrep -x speedwm_status > /dev/null && pkill speedwm_status ; speedwm_status &
}

View file

@ -198,6 +198,7 @@ case "$ARGS" in
"-configure") CONFIGURE ; exit 0 ;;
"-r") XRESOURCES ; LOADSWAL ; LOADCONFIG ; RESET ; echo "Restarted speedwm." ; exit 0 ;;
"-rcolors") XRESOURCES ; LOADSWAL ; LOADCONFIG ; LOADCOLS ; echo "Restarted speedwm." ; exit 0 ;;
"-rnoloadcolors") LOADCONFIG ; LOADCOLS ; echo "Restarted speedwm." ; exit 0 ;;
"-rnoload") RESET ; echo "Restarted speedwm." ; exit 0 ;;
"-h") HELP ; exit 0 ;;
"-f") CARG="force" ; XRESOURCES ; AUTOSTART ; LOADSWAL ; LOADCONFIG ; RESET ; START_SPEEDWM ; exit 0 ;;

View file

@ -557,9 +557,11 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void xinitvisual();
static void zoom(const Arg *arg);
#if USEXRESOURCES
static void load_xresources(void);
static void reloadcolors(const Arg *arg);
static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst);
#endif
static pid_t getparentprocess(pid_t p);
static int isdescprocess(pid_t p, pid_t c);
static Client *swallowingclient(Window w);
@ -689,7 +691,9 @@ static int systraypinningfailfirst = 1;
#include "colors.h" /* Include colors */
#include "rules.h" /* Include rules */
#include "layouts.h" /* Include layout list */
#if USEXRESOURCES
#include "xresources.h" /* Include .Xresources/Pywal support */
#endif
#include "keybinds.h" /* Include keybinds */
/* IPC support */
@ -4652,6 +4656,7 @@ showtagpreview(unsigned int i)
}
#endif
#if USEXRESOURCES
void
reloadcolors(const Arg *arg)
{
@ -4661,6 +4666,7 @@ reloadcolors(const Arg *arg)
focus(NULL);
arrange(NULL);
}
#endif
void
sigchld(int unused)
@ -6019,6 +6025,7 @@ zoom(const Arg *arg)
pop(c);
}
#if USEXRESOURCES
void
resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
{
@ -6072,6 +6079,7 @@ load_xresources(void)
resource_load(db, p->name, p->type, p->dst);
XCloseDisplay(display);
}
#endif
/* Thanks to https://codeberg.org/explosion-mental/demwm for this! */
void
@ -6116,7 +6124,9 @@ main(int argc, char *argv[])
checkotherwm();
autostart_exec();
XrmInitialize();
#if USEXRESOURCES
load_xresources();
#endif
setup();
#ifdef __OpenBSD__
if (pledge("stdio rpath proc exec ps", NULL) == -1)

View file

@ -23,6 +23,7 @@ Not compatible with BSDs so for those, set this to 0. */
#define USEROUNDCORNERS 1 /* Whether or not to include rounded corners */
#define USEMEDIA 1 /* Whether or not to include media keys */
#define USEMOUSE 1 /* Whether or not to include mouse binds */
#define USEXRESOURCES 1 /* Whether or not to include .Xresources support. By disabling this, you're also disabling the speedwmrc config file. It is recommended that you keep this enabled. */
#define USEXFTWORKAROUND 0 /* Whether or not to include the libXft emoji workaround.
This is usually not necessary so only enable it if you find that you need it. */