No more xsetroot dependency, we can now set the status using speedwm -s

directly
This commit is contained in:
speediegq 2022-10-15 02:22:19 +02:00
parent 5a6d5df243
commit 7380b60dfb
11 changed files with 44 additions and 68 deletions

View file

@ -25,7 +25,6 @@
- xrdb (Install if you want .Xresources support)
- pywal (Install if you want pywal support. Requires swal aka the default way to set wallpapers)
- wmctrl (Needed for proper window management)
- xsetroot (Needed for most scripts including Pywal support)
- slock (Required for screen locking)
- If you want to display a message, you need the text patch.
- If you have the background image patch, you can set the image to ~/.config/speedwm-de/swal/CurrentWallpaper. It is a symlink to the current wallpaper.

View file

@ -23,7 +23,6 @@ It can be found in the speedwm source code directory. It is just a shell script
You can edit the status bar simply by editing 'status' and running 'make clean install'.
You can also configure it by editing '~/.config/speedwm-de/status/config'.
Please note that most status bars including the built in 'status' depends on xsetroot which must be installed. speedwm-compatcheck is going to tell you about this when compiling.
If you want to change status bar, edit options.h and set 'static char status' to your status bar binary (must be in $PATH).
Alternatively, you can also set "speedwm.status: <statusbar>" in .Xresources (See .Xresources and Pywal).

View file

@ -3,7 +3,7 @@ This fork of speedwm has .Xresources support thanks to the .Xresources patch. It
Colors can be reloaded on-the-fly using the built in wallpaper utility. In order to implement speedwm reloading support to your own wallpaper utility, run shell command (/bin/sh) 'speedwm_run -r' to reload colors automatically.
Note that the 'xrdb' dependency is required for both pywal and .Xresources support and 'xsetroot' is required for automatic reloading of colors, the built in status bar, and more so you should install this.
Note that the 'xrdb' dependency is required for both pywal and .Xresources support.
Below is a list of all .Xresources values you can define. The .Xresources file should be placed in ~ or ~/.config by the user.
If it is not or you want it somewhere else, you can edit 'autostart.h' and 'make clean install'.

View file

@ -2,8 +2,7 @@
Thanks to the 'fsignal' patch available on suckless.org's website, we can easily write shell scripts to interact with dwm and therefore speedwm.
I made some changes to this patch, because it has some.. questionable behaviour in my opinion.
In order to use 'fsignal', your system must have 'xsetroot' installed.
Then simply use the dwm-utils script. Syntax is dwm-utils -exec <signum>
To use signals, simply use the speedwm-utils script. Syntax is speedwm-utils -exec <signum>
Below is a list of all signums and what they do.

View file

@ -18,13 +18,6 @@ else
printf "Warning: ${BINDIR}wmctrl was not found\n"
fi
# Check if xsetroot exists
if [ -e "${BINDIR}xsetroot" ]; then
xsetroot_exists=true
else
printf "Warning: ${BINDIR}xsetroot was not found\n"
fi
# Check if xwallpaper exists
if [ -e "${BINDIR}xwallpaper" ]; then
xwallpaper_exists=true
@ -44,4 +37,3 @@ command -v dmenu > /dev/null || printf "\nWARNING: dmenu was not found. This mea
# Check if slock exists
command -v slock > /dev/null || printf "\nWARNING: slock was not found. This means the shutdown menu can't lock your screen."
result="$(echo "$xrdb_exists$wmctrl_exists$xsetroot_exists$xwallpaper_exists$xmodmap_exists")"

View file

@ -100,23 +100,6 @@ SWAL_MKCONFIG() {
printf "\nSWAL_RANDOMIZE=$SWAL_RANDOMIZE" >> $SWAL_EXPORTDIR/config
}
# use a solid color
SWAL_SOLIDCOLOR() {
ISCOL="$(printf "#000000\n#bbbbbb" | $RUNLAUNCHER -l 2 $GRIDARG $GRIDNUM -p "Enter a hex color:")"
echo $ISCOL | grep -q "#" || exit 1
xwallpaper --clear
xsetroot -solid "$ISCOL"
rm -f $SWAL_EXPORTDIR/swal_wm
xrdb -remove
xsetroot -name "#cmd:65"
printf "#!/bin/sh\nxsetroot -solid "$ISCOL"" > $SWAL_EXPORTDIR/swal_wm
command -v notify-send > /dev/null && notify-send " Solid color $ISCOL set as wallpaper."
exit 0
}
# Binary directory
BINDIR="$(dirname $(command -v status))/"
SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR
@ -162,7 +145,7 @@ SWAL_USAGE() {
SWAL_SELWALLPAPER()
{
if [ "$ARG1" = "" ]; then
SWAL_SELWALLPAPER="$(printf "$(ls "$SWAL_WALLPAPERDIR")\n------\n..\nPreview\nPrevious\nSolid Color\nRandom\nFavorites\nAdd used wallpaper to favorites\nOptions\nHelp\nExit" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 100 -p "What wallpaper would you like to set?")"
SWAL_SELWALLPAPER="$(printf "$(ls "$SWAL_WALLPAPERDIR")\n------\n..\nPreview\nPrevious\nRandom\nFavorites\nAdd used wallpaper to favorites\nOptions\nHelp\nExit" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 100 -p "What wallpaper would you like to set?")"
fi
}
@ -184,7 +167,6 @@ SWAL_SETTYPE()
"Random") SWAL_FULL="$(find $SWAL_WALLPAPERDIR/* -type f | shuf -n 1)" ; SWAL_WALLPAPERDIR="$(dirname "$SWAL_FULL")" ; SWAL_SELWALLPAPER="$(basename "$SWAL_FULL")" ; SWAL_SELWAL=$SWAL_SELWALLPAPER ;;
"Previous") SWAL_PREVWAL=$(readlink $SWAL_EXPORTDIR/CurrentWallpaper_prev) ; SWAL_WALLPAPERDIR="$(dirname "$SWAL_PREVWAL")" ; SWAL_SELWALLPAPER="$(basename "$SWAL_PREVWAL")" ;;
"Exit") exit 0 ;;
"Solid Color") SWAL_SOLIDCOLOR ;;
"Help") SWAL_USAGE | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 50 -p "How to use" && $0 && exit 0 ;;
"------") $0 && exit 0 ;;
esac

View file

@ -32,13 +32,13 @@ VARS
GENERAL() {
GENERALOPTS=$(printf "mfact +\nmfact -\nToggle Sticky\nToggle Bar\nToggle Fullscreen\nReset Layout/mfact\nReorganize Tags" | $RUNLAUNCHER -l 20 -p 'What do you want to do?')
case "$GENERALOPTS" in
"mfact +") xsetroot -name "#cmd:18" ;;
"mfact -") xsetroot -name "#cmd:19" ;;
"Toggle Sticky") xsetroot -name "#cmd:20" ;;
"Toggle Bar") xsetroot -name "#cmd:21" ;;
"Toggle Fullscreen") xsetroot -name "#cmd:22" ;;
"Reorganize Tags") xsetroot -name "#cmd:25" ;;
"Reset Layout/mfact") xsetroot -name "#cmd:59" ;;
"mfact +") speedwm -s "#cmd:18" ;;
"mfact -") speedwm -s "#cmd:19" ;;
"Toggle Sticky") speedwm -s "#cmd:20" ;;
"Toggle Bar") speedwm -s "#cmd:21" ;;
"Toggle Fullscreen") speedwm -s "#cmd:22" ;;
"Reorganize Tags") speedwm -s "#cmd:25" ;;
"Reset Layout/mfact") speedwm -s "#cmd:59" ;;
esac
}
@ -79,14 +79,14 @@ L14="$(printf "L14: Custom\n")"
case "$1" in
"layout") SEL_LAYOUT=$(printf "${L1}\n${L2}\n${L3}\n${L4}\n${L5}\n${L6}\n${L7}\n${L8}\n${L9}\n${L10}\n${L11}\n${L12}\n${L13}\n${L14}\nPrevious Layout\nNext Layout\nEnter S expression" | $RUNLAUNCHER -l 21 -p "Pick a layout: ") ;;
"reloadcolors") xsetroot -name "#cmd:65" ;;
"list") sed 's|xsetroot -name "#cmd:||g; s|"||g; s| - ||g; s@|@-@g' /usr/share/speedwm/example.fsignal | head -n "$(expr "$(cat /usr/share/speedwm/example.fsignal | wc -l)" - 1)" ;;
"reloadcolors") speedwm -s "#cmd:65" ;;
"list") sed 's|speedwm -s "#cmd:||g; s|"||g; s| - ||g; s@|@-@g' /usr/share/speedwm/example.fsignal | head -n "$(expr "$(cat /usr/share/speedwm/example.fsignal | wc -l)" - 1)" ;;
"-help") HELP ;;
"exec")
if [ "$2" = "" ]; then
exit 0
else
xsetroot -name "#cmd:$2"
speedwm -s "#cmd:$2"
fi ;;
"-h") HELP ;;
"-general") GENERAL ;;
@ -95,21 +95,21 @@ esac
case "$SEL_LAYOUT" in
"Exit") exit 0 ;;
"Previous Layout") xsetroot -name "#cmd:16" ;;
"Next Layout") xsetroot -name "#cmd:17" ;;
"L1: Tiling") xsetroot -name "#cmd:1" ;;
"L2: Floating") xsetroot -name "#cmd:2" ;;
"L3: Monocle") xsetroot -name "#cmd:3" ;;
"L4: Grid") xsetroot -name "#cmd:4" ;;
"L5: Deck") xsetroot -name "#cmd:5" ;;
"L6: Centered Master") xsetroot -name "#cmd:6" ;;
"L7: Centered Floating Master") xsetroot -name "#cmd:7" ;;
"L8: Dwindle") xsetroot -name "#cmd:8" ;;
"L9: Spiral") xsetroot -name "#cmd:9" ;;
"L10: Bottom Stack (Vertical)") xsetroot -name "#cmd:10" ;;
"L11: Bottom Stack (Horizontal)") xsetroot -name "#cmd:11" ;;
"L12: Grid (Horizontal)") xsetroot -name "#cmd:12" ;;
"L13: Dynamic Grid") xsetroot -name "#cmd:13" ;;
"L14: Custom") xsetroot -name "#cmd:1" && xsetroot -name "#cmd:17" ;;
"Enter S expression") xsetroot -name "#cmd:15" ;;
"Previous Layout") speedwm -s "#cmd:16" ;;
"Next Layout") speedwm -s "#cmd:17" ;;
"L1: Tiling") speedwm -s "#cmd:1" ;;
"L2: Floating") speedwm -s "#cmd:2" ;;
"L3: Monocle") speedwm -s "#cmd:3" ;;
"L4: Grid") speedwm -s "#cmd:4" ;;
"L5: Deck") speedwm -s "#cmd:5" ;;
"L6: Centered Master") speedwm -s "#cmd:6" ;;
"L7: Centered Floating Master") speedwm -s "#cmd:7" ;;
"L8: Dwindle") speedwm -s "#cmd:8" ;;
"L9: Spiral") speedwm -s "#cmd:9" ;;
"L10: Bottom Stack (Vertical)") speedwm -s "#cmd:10" ;;
"L11: Bottom Stack (Horizontal)") speedwm -s "#cmd:11" ;;
"L12: Grid (Horizontal)") speedwm -s "#cmd:12" ;;
"L13: Dynamic Grid") speedwm -s "#cmd:13" ;;
"L14: Custom") speedwm -s "#cmd:1" && speedwm -s "#cmd:17" ;;
"Enter S expression") speedwm -s "#cmd:15" ;;
esac

View file

@ -113,6 +113,6 @@ esac
wmctrl -a "$target" && echo "Switched focus"
# show hidden window
command -v xsetroot > /dev/null && xsetroot -name "#cmd:28"
speedwm -s "#cmd:28"
RESTORE

View file

@ -79,8 +79,8 @@ LOADCOLS() {
if [ "$DONOTLOADCONFIG" = "true" ]; then
DONOTLOADCONFIG=true
else
xsetroot -name "#cmd:65" # reload colors
xsetroot -name "Loading" # hide ugly signal
speedwm -s "#cmd:65" # reload colors
speedwm -s "Loading" # hide ugly signal
echo "Loaded colors"
fi
}
@ -97,9 +97,9 @@ RESET() {
if [ "$DONOTRELOAD" = "true" ]; then
DONOTRELOAD=true
else
xsetroot -name "Loading" # To hide the ugly fsignal status
xsetroot -name "#cmd:27" # Send fsignal to restart speedwm
xsetroot -name "Loading" # To hide the ugly fsignal status
speedwm -s "Loading" # To hide the ugly fsignal status
speedwm -s "#cmd:27" # Send fsignal to restart speedwm
speedwm -s "Loading" # To hide the ugly fsignal status
fi
}

View file

@ -6348,12 +6348,17 @@ main(int argc, char *argv[])
{
if (argc == 2 && !strcmp("-v", argv[1]))
die("speedwm-"VERSION);
else if (argc != 1)
die("usage: speedwm [-v]");
else if (argc != 1 && strcmp("-s", argv[1]))
die("usage: speedwm [-v] [-s]");
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
die("speedwm: cannot open display");
if (argc > 1 && !strcmp("-s", argv[1])) {
XStoreName(dpy, RootWindow(dpy, DefaultScreen(dpy)), argv[2]);
XCloseDisplay(dpy);
return 0;
}
if (!(xcon = XGetXCBConnection(dpy)))
die("speedwm: cannot get xcb connection\n");
checkotherwm();

2
status
View file

@ -18,7 +18,7 @@
# General settings
REFRESHDELAY=1 # How long delay in seconds between each reload (num)
DATEBINDIR="/bin/" # Directory where your 'date' binary is. Default should be fine for most people
SETMETHOD="xsetroot -name" # Method used to set the status bar
SETMETHOD="speedwm -s" # Method used to set the status bar
SEPARATOR="❰" # Separator to use. Alternative separators: "❰", "<", "|"
COLORFG=true # Color foreground (true/false)
COLORBG=false # Color background (true/false)