Add new MUCH faster reload function and use it instead when possible

This commit is contained in:
speediegq 2022-10-03 16:49:24 +02:00
parent e436379d53
commit f5115d1b1e
6 changed files with 31 additions and 6 deletions

View file

@ -196,7 +196,7 @@ Please let me know if any keybinds are missing as these have been manually added
- Music button | Open your defined music player
- WLAN button | Disconnect from WLAN
-- Mouse --
### Mouse
These binds can be activated using your mouse

View file

@ -63,4 +63,5 @@
- 63 | Reset layout/mfact
- 64 | Reset nmaster
- 65 | Show/Hide systray
- 66 | Reload .Xresources on the fly

View file

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

View file

@ -315,11 +315,11 @@ SWAL_EXPORT_SCRIPT_WAL()
rm -f $SWAL_EXPORTDIR/CurrentWallpaper ; ln -s "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" $SWAL_EXPORTDIR/CurrentWallpaper
command -v wal > /dev/null && wal -nqi "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER"
command -v speedwm_run > /dev/null && speedwm_run -loadconfig # For speedie.gq/speedwm
command -v speedwm_run > /dev/null && speedwm_run -rnoload # For speedie.gq/speedwm
#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
pgrep -x status && pkill -x status ; status & # For speedie.gq/speedwm
pgrep -x stellar && pkill -x stellar ; stellar & # For speedie.gq/stellar
pgrep -x speedwm_status > /dev/null && pkill speedwm_status ; speedwm_status &
}
# Send notification

View file

@ -75,6 +75,17 @@ LOADSWAL() {
fi
}
# Load colors
LOADCOLS() {
if [ "$DONOTLOADCONFIG" = "true" ]; then
DONOTLOADCONFIG=true
else
xsetroot -name "fsignal:66" # reload colors
xsetroot -name "Loading" # hide the ugly fsignal
echo "Loaded colors"
fi
}
# Autostart
AUTOSTART() {
if [ -e "$HOME/.config/speedwm-de/autostart_once.sh" ]; then
@ -186,6 +197,7 @@ case "$ARGS" in
"-s") ISSFLAG=true ; CHECKEXISTINGWM ; XRESOURCES ; AUTOSTART ; LOADSWAL ; LOADCONFIG ; RESET ; START_SPEEDWM ; exit 0 ;;
"-configure") CONFIGURE ; exit 0 ;;
"-r") XRESOURCES ; LOADSWAL ; LOADCONFIG ; RESET ; echo "Restarted speedwm." ; exit 0 ;;
"-rcolors") XRESOURCES ; 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 ;;
@ -193,7 +205,7 @@ case "$ARGS" in
"-unloadconfig") UNLOADCONFIG ; RESET ; exit 0 ;;
"-deleteconfig") DELETECONFIG ; RESET ; exit 0 ;;
"-noxrdb") START_SPEEDWM ; exit 0 ;;
"-stop") pgrep -x speedwm && pkill -x speedwm ; echo "speedwm has been stopped." ; exit 0
"-stop") pgrep -x speedwm && pkill -x speedwm && echo "speedwm has been stopped." ; exit
echo "speedwm is not running, cannot stop it." ; exit 1 ;;
"-nomkconfig") CHECKEXISTINGWM ; XRESOURCES ; AUTOSTART ; LOADSWAL ; RESET ; START_SPEEDWM ; exit 0 ;;
esac

View file

@ -562,6 +562,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void xinitvisual();
static void zoom(const Arg *arg);
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);
static pid_t getparentprocess(pid_t p);
static int isdescprocess(pid_t p, pid_t c);
@ -4584,6 +4585,16 @@ showtagpreview(unsigned int i)
}
#endif
void
reloadcolors(const Arg *arg)
{
// reload colors
load_xresources();
setup();
focus(NULL);
arrange(NULL);
}
void
sigchld(int unused)
{