Go through with an issue, separate scripts and cleanup

This commit is contained in:
speedie 2022-10-27 17:41:42 +02:00
parent 12ef8122c0
commit 2abe20bcaa
52 changed files with 270 additions and 4398 deletions

View file

@ -10,7 +10,7 @@ SRC = draw.c speedwm.c main.c
OBJ = ${SRC:.c=.o} OBJ = ${SRC:.c=.o}
ifdef USEIPC ifdef USEIPC
all: options speedwm speedwm-msg all: options speedwm speedwm-ipc
else else
all: options speedwm all: options speedwm
endif endif
@ -31,13 +31,13 @@ speedwm: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS} ${CC} -o $@ ${OBJ} ${LDFLAGS}
ifdef USEIPC ifdef USEIPC
speedwm-msg: toggle/ipc-speedwm-msg.o speedwm-ipc: toggle/ipc-speedwm-msg.o
${CC} -o $@ toggle/ipc-speedwm-msg.c ${LDFLAGS} ; rm -f ipc-speedwm-msg.o ${CC} -o $@ toggle/ipc-speedwm-msg.c ${LDFLAGS} ; rm -f ipc-speedwm-msg.o
endif endif
clean: clean:
rm -f speedwm *.o speedwm-${VERSION}.tar.gz rm -f speedwm *.o speedwm-${VERSION}.tar.gz
rm -f speedwm-msg rm -f speedwm-ipc
echo "Cleaned!" echo "Cleaned!"
dist: clean dist: clean
@ -48,7 +48,7 @@ dist: clean
tar -cf speedwm-${VERSION}.tar speedwm-${VERSION} tar -cf speedwm-${VERSION}.tar speedwm-${VERSION}
gzip speedwm-${VERSION}.tar gzip speedwm-${VERSION}.tar
rm -rf speedwm-${VERSION} speedwm rm -rf speedwm-${VERSION} speedwm
rm -rf speedwm-${VERSION} speedwm-msg rm -rf speedwm-${VERSION} speedwm-ipc
[ -f .speedwm/options.h_settings.patch ] && mv .speedwm/*.patch .. && mv .speedwm/*.def* ../docs/ && rm -rf .speedwm || : [ -f .speedwm/options.h_settings.patch ] && mv .speedwm/*.patch .. && mv .speedwm/*.def* ../docs/ && rm -rf .speedwm || :
install_only_bin: all install_only_bin: all
@ -60,10 +60,10 @@ install_only_bin: all
mkdir -p ${DESTDIR}${PREFIX}/share/speedwm mkdir -p ${DESTDIR}${PREFIX}/share/speedwm
mkdir -p ${DESTDIR}${PREFIX}/share/xsessions/ mkdir -p ${DESTDIR}${PREFIX}/share/xsessions/
mkdir -p ${DESTDIR}${PREFIX}/share/pixmaps/ mkdir -p ${DESTDIR}${PREFIX}/share/pixmaps/
[ -f speedwm-msg ] && cp -f speedwm-msg ${DESTDIR}${PREFIX}/bin || : [ -f speedwm-ipc ] && cp -f speedwm-ipc ${DESTDIR}${PREFIX}/bin || :
[ -f speedwm ] && cp -f speedwm ${DESTDIR}${PREFIX}/bin || : [ -f speedwm-ipc ] && chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm-ipc || :
[ -f speedwm-msg ] && chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm-msg || :
[ -f speedwm.png ] && cp -f speedwm.png ${DESTDIR}${PREFIX}/share/pixmaps/speedwm.png || : [ -f speedwm.png ] && cp -f speedwm.png ${DESTDIR}${PREFIX}/share/pixmaps/speedwm.png || :
[ -f speedwm ] && cp -f speedwm ${DESTDIR}${PREFIX}/bin || :
[ -f docs/entry.desktop ] && cp -f docs/entry.desktop ${DESTDIR}${PREFIX}/share/xsessions/speedwm.desktop || : [ -f docs/entry.desktop ] && cp -f docs/entry.desktop ${DESTDIR}${PREFIX}/share/xsessions/speedwm.desktop || :
chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm
rm -f *.o rm -f *.o
@ -77,7 +77,6 @@ install_only_misc:
[ -f docs/toggle.def.h ] || cp -f toggle.h docs/toggle.def.h || : [ -f docs/toggle.def.h ] || cp -f toggle.h docs/toggle.def.h || :
[ -f docs/toggle.def.mk ] || cp -f toggle.mk docs/toggle.def.mk || : [ -f docs/toggle.def.mk ] || cp -f toggle.mk docs/toggle.def.mk || :
[ -f docs/keybinds.def.h ] || cp -f keybinds.h docs/keybinds.def.h || : [ -f docs/keybinds.def.h ] || cp -f keybinds.h docs/keybinds.def.h || :
[ -f docs/actions.def.h ] || cp -f actions.h docs/actions.def.h || :
[ -f docs/colors.def.h ] || cp -f colors.h docs/colors.def.h || : [ -f docs/colors.def.h ] || cp -f colors.h docs/colors.def.h || :
[ -f docs/colors.def.h ] || cp -f colors.h docs/colors.def.h || : [ -f docs/colors.def.h ] || cp -f colors.h docs/colors.def.h || :
[ -f docs/statusbar.def.h ] || cp -f statusbar.h docs/statusbar.def.h || : [ -f docs/statusbar.def.h ] || cp -f statusbar.h docs/statusbar.def.h || :
@ -88,8 +87,6 @@ install_only_misc:
cp -f docs/doc-* ${DESTDIR}${PREFIX}/share/speedwm/ cp -f docs/doc-* ${DESTDIR}${PREFIX}/share/speedwm/
cp -f docs/example.* ${DESTDIR}${PREFIX}/share/speedwm/ cp -f docs/example.* ${DESTDIR}${PREFIX}/share/speedwm/
cp -f scripts/speedwm* ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm* cp -f scripts/speedwm* ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm*
chmod +x ./scripts/speedwm-compatcheck
./scripts/speedwm-compatcheck
make modules_install make modules_install
echo ${VERSION} > ${DESTDIR}${PREFIX}/share/speedwm/speedwm-version echo ${VERSION} > ${DESTDIR}${PREFIX}/share/speedwm/speedwm-version
@ -102,7 +99,7 @@ install: all
mkdir -p ${DESTDIR}${PREFIX}/share/speedwm mkdir -p ${DESTDIR}${PREFIX}/share/speedwm
mkdir -p ${DESTDIR}${PREFIX}/share/xsessions/ mkdir -p ${DESTDIR}${PREFIX}/share/xsessions/
mkdir -p ${DESTDIR}${PREFIX}/share/pixmaps/ mkdir -p ${DESTDIR}${PREFIX}/share/pixmaps/
[ -f speedwm-msg ] && cp -f speedwm-msg ${DESTDIR}${PREFIX}/bin || : [ -f speedwm-ipc ] && cp -f speedwm-ipc ${DESTDIR}${PREFIX}/bin || :
[ -f speedwm ] && cp -f speedwm ${DESTDIR}${PREFIX}/bin || : [ -f speedwm ] && cp -f speedwm ${DESTDIR}${PREFIX}/bin || :
[ -f docs/autostart.def.h ] || cp -f autostart.h docs/autostart.def.h || : [ -f docs/autostart.def.h ] || cp -f autostart.h docs/autostart.def.h || :
[ -f docs/options.def.h ] || cp -f options.h docs/options.def.h || : [ -f docs/options.def.h ] || cp -f options.h docs/options.def.h || :
@ -112,21 +109,18 @@ install: all
[ -f docs/toggle.def.h ] || cp -f toggle.h docs/toggle.def.h || : [ -f docs/toggle.def.h ] || cp -f toggle.h docs/toggle.def.h || :
[ -f docs/toggle.def.mk ] || cp -f toggle.mk docs/toggle.def.mk || : [ -f docs/toggle.def.mk ] || cp -f toggle.mk docs/toggle.def.mk || :
[ -f docs/keybinds.def.h ] || cp -f keybinds.h docs/keybinds.def.h || : [ -f docs/keybinds.def.h ] || cp -f keybinds.h docs/keybinds.def.h || :
[ -f docs/actions.def.h ] || cp -f actions.h docs/actions.def.h || :
[ -f docs/colors.def.h ] || cp -f colors.h docs/colors.def.h || : [ -f docs/colors.def.h ] || cp -f colors.h docs/colors.def.h || :
[ -f docs/colors.def.h ] || cp -f colors.h docs/colors.def.h || : [ -f docs/colors.def.h ] || cp -f colors.h docs/colors.def.h || :
[ -f docs/statusbar.def.h ] || cp -f statusbar.h docs/statusbar.def.h || : [ -f docs/statusbar.def.h ] || cp -f statusbar.h docs/statusbar.def.h || :
[ -f docs/entry.desktop ] && cp -f docs/entry.desktop ${DESTDIR}${PREFIX}/share/xsessions/speedwm.desktop || : [ -f docs/entry.desktop ] && cp -f docs/entry.desktop ${DESTDIR}${PREFIX}/share/xsessions/speedwm.desktop || :
[ -f speedwm-msg ] && chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm-msg || : [ -f speedwm-ipc ] && chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm-ipc || :
[ -f speedwm.png ] && cp -f speedwm.png ${DESTDIR}${PREFIX}/share/pixmaps/speedwm.png || : [ -f speedwm.png ] && cp -f speedwm.png ${DESTDIR}${PREFIX}/share/pixmaps/speedwm.png || :
cp -f docs/keybinds ${DESTDIR}${PREFIX}/share/speedwm/keybinds cp -f docs/keybinds ${DESTDIR}${PREFIX}/share/speedwm/keybinds
cp -f docs/dependencies ${DESTDIR}${PREFIX}/share/speedwm/dependencies cp -f docs/dependencies ${DESTDIR}${PREFIX}/share/speedwm/dependencies
cp -f docs/doc-* ${DESTDIR}${PREFIX}/share/speedwm/ cp -f docs/doc-* ${DESTDIR}${PREFIX}/share/speedwm/
cp -f docs/example.* ${DESTDIR}${PREFIX}/share/speedwm/ cp -f docs/example.* ${DESTDIR}${PREFIX}/share/speedwm/
cp -f scripts/speedwm* ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm* cp -f scripts/speedwm* ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm*
chmod +x ./scripts/speedwm-compatcheck
chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm
./scripts/speedwm-compatcheck
make modules_install make modules_install
[ -f ${DESTDIR}${PREFIX}/bin/speedwm ] && rm -f drw.o speedwm.o util.o speedwm speedwm-msg || : [ -f ${DESTDIR}${PREFIX}/bin/speedwm ] && rm -f drw.o speedwm.o util.o speedwm speedwm-msg || :
echo ${VERSION} > ${DESTDIR}${PREFIX}/share/speedwm/speedwm-version echo ${VERSION} > ${DESTDIR}${PREFIX}/share/speedwm/speedwm-version

View file

@ -1,91 +0,0 @@
/* speedwm actions
*
* This header is for configuring the actions and classes keybinds and rules use.
* These should be set using the '#define' but if you prefer you can use a char as well.
*
* Example of a valid #define: #define MYAWESOMEKEYBIND "myawesomescript"
* In this example, myawesomescript is the command that will run and MYAWESOMEKEYBIND is the define itself.
*
* You can use this define in a keybind (see keybinds.h) or in a rule (see rules.h).
*
* For example if you wanted to change icecat to firefox:
* #define BROWSER "icecat" -> #define BROWSER "firefox"
*
* You do not need to edit 'keybinds.h' or 'rules.h' because that's where the values we defined are actually used.
* Once you're done with your edits, run 'make clean install' to install it.
*/
/* Software options
* Note that any software named "speedwm-*" is bundled with this build and does not need to be replaced unless you want to.
*/
/* Terminal */
#define TERMINAL "st -e " /* Terminal to use */
#define TERMINAL_CLASS "st" /* Terminal to use for rules */
/* Web browser */
#define BROWSER "icecat" /* Web browser to use */
#define BROWSER_CLASS "Navigator" /* Web browser to use for rules */
/* System monitor */
#define SYSTEMSTAT "htop" /* System stat viewer to use */
/* RSS reader */
#define RSS "newsboat" /* RSS reader to use */
/* Chat client */
#define CHAT "tmux new-session -A -D -s weechat $(which --skip-alias weechat)" /* Chat client to use */
#define CHAT2 "iron" /* Second chat client (such as an IM) to use */
/* Email client */
#define EMAIL "aerc" /* Email client to use */
/* Text editor */
#define EDITOR "nvim" /* Text editor to use */
/* Run actions */
#define RUN "dmenu_run -l 0 -p 'Run:'" /* Run launcher */
#define RUN_ALT "speedwm-applist" /* Alternative run launcher */
#define RUN_DESKTOP "j4-dmenu-desktop --term=st --dmenu='dmenu -l 20 -p Open'"
/* Custom layout */
#define CUSTOM_HISTFILE ".config/speedwm-de/history" /* History file for the custom layout */
#define RUN_CUSTOM_LAYOUT "dmenu -i -l 10 -p 'Enter an S expression >' <" /* Run launcher to use for the custom layout */
/* Screenshot actions */
#define SCREENSHOT "speedwm-screenshotutil -s" /* How to take screenshots (Selection) */
#define SCREENSHOT_FULL "speedwm-screenshotutil -f" /* How to take screenshots (Full screen) */
/* File manager */
#define FILEMANAGER "vifmrun || vifm" /* File manager that will be used */
#define FILEMANAGER_CLASS "vifmrun" /* File manager that will be used for rules */
/* Screen locker */
#define LOCKER "slock" /* Screen locker that will be used */
/* Music actions */
#define MUSIC "tmux new-session -A -D -s cmus $(which --skip-alias cmus)" /* Music player to use */
#define KILLMUSIC "pkill cmus" /* Command to run when killing the music player */
#define NEXTMUSIC "cmus-remote --next" /* Command to run when skipping to the next track */
#define PREVMUSIC "cmus-remote --prev" /* Command to run when moving back to the previous track */
#define UPMUSIC "cmus-remote --volume +3000" /* Command to run when increasing music volume */
#define DOWNMUSIC "cmus-remote --volume -3000" /* Command to run when decreasing music volume */
#define PAUSEMUSIC "cmus-remote --pause" /* Command to run when pausing the track */
/* PDF reader */
#define PDF_CLASS "Zathura" /* PDF reader to use for rules */
/* Audio options */
#define MIXER "speedwm-audioctrl -runmixer" /* Audio mixer to use */
#define VOL_DOWN "speedwm-audioctrl -lower" /* Command to run when decreasing volume */
#define VOL_UP "speedwm-audioctrl -raise" /* Command to run when increasing volume */
#define VOL_MUTE "speedwm-audioctrl -mute" /* Command to run when muting volume */
/* Managers */
#define CLIPBOARD "xclip" /* Clipboard to use */
#define COMPOSITOR "picom" /* Compositor to use */
#define NETWORK "speedwm-netctrl" /* Network manager to use */
#define KILLNETWORK "speedwm-netctrl disconnect" /* Command to run when disconnecting */
#define BLUETOOTH "speedwm-btctrl" /* Bluetooth manager to use */
#define NOTIFICATION "dunst" /* Notification daemon to use */

View file

@ -12,21 +12,15 @@
*************************************************************/ *************************************************************/
static const char *autostart[] = { static const char *autostart[] = {
/* Run the defined clipboard manager */
shell, "-c", CLIPBOARD "& > /tmp/clipboard-log", NULL,
/* Run the defined compositor */ /* Run the built in status bar */
shell, "-c", COMPOSITOR "& > /tmp/compositor-log", NULL, shell, "-c", "pgrep speedwm_status || speedwm_status &", NULL,
/* Run the defined notification daemon */
shell, "-c", NOTIFICATION "& > /tmp/notification-log", NULL,
/* Run the defined status bar */
shell, "-c", "pgrep -x speedwm_status || speedwm_status &", NULL,
/* Autostart script, if it exists */ /* Autostart script, if it exists */
shell, "-c", "$HOME/.config/speedwm-de/autostart.sh", NULL, shell, "-c", "$HOME/.config/speedwm/autostart.sh", NULL,
/* Autostart second script, if it exists */
shell, "-c", "speedwm-autostart", NULL,
NULL NULL
}; };

View file

@ -11,42 +11,35 @@
- Very minimal C compiler that speedwm uses to speed up compile times. If you don't want this dependency, edit host.mk and set CC to 'cc' (or what you prefer). - Very minimal C compiler that speedwm uses to speed up compile times. If you don't want this dependency, edit host.mk and set CC to 'cc' (or what you prefer).
-- Features -- -- Features --
These are necessary for certain features. By default speedwm will prevent an installation without them but you can bypass these if you want. These are necessary for certain features.
If you want to use an alternative, change it in options.h. If you want to use an alternative, change it in options.h and/or keybinds.h and mouse.h.
- dmenu - dmenu
- NOTE: dmenu is required for most scripts included with this build of speedwm. My build is required for proper Pywal support. - NOTE: dmenu is required for most scripts included with this build of speedwm. My build is required for proper Pywal support.
- If you do not have the password, grid and center patches, you must disable them in ~/.config/speedwm-de/global/config by setting two variables to false.
- picom - picom
- Optional but speedwm looks sort of ugly without it. - Optional but speedwm looks sort of ugly without a compositor.
- xclip (Required for clipboard support by a few scripts, will start automatically)
- xwallpaper (Required to set wallpapers)
- xmodmap
- Required if you want the Alt+Tab to have proper keybinds.
- xrdb (Install if you want .Xresources support) - xrdb (Install if you want .Xresources support)
- pywal (Install if you want pywal support. Requires swal aka the default way to set wallpapers) - pywal (Install if you want pywal support. Requires swal (the default way to set wallpapers) or a tool that supports the correct signal for instant reloading)
- wmctrl (Needed for proper window management)
- 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.
- maim (Required for built in 'speedwm-screenshotutil' script)
- j4-dmenu-desktop - j4-dmenu-desktop
- Required for dmenu desktop entries. speedwm will not prevent installation without this because it doesn't provide much functionality. - Required for dmenu desktop entries..
-- Software -- -- Software --
This build of speedwm comes with binds for software. This build of speedwm comes with binds for software.
These must be installed by default but you can change what software is required by editing 'options.h' and running 'make clean install'. These must be installed by default but you can change what software is required by editing 'options.h' and running 'make clean install'.
You can also remove keybinds by editing 'keybinds.h' and running 'make clean install'. You can also remove keybinds by editing 'keybinds.h' and running 'make clean install'.
- speedwm-extras
- Important metapackage containing extra scripts that speedwm makes use of. (https://codeberg.org/speedie/speedwm-extras)
- st (Terminal) - st (Terminal)
- GNU IceCat (Web browser) - Firefox (Web browser)
- htop (Status monitor) - htop (Status monitor)
- newsboat (RSS reader) - newsboat (RSS reader)
- zathura (PDF reader) - zathura (PDF reader)
- alsa-utils (Required for audio controls)
- cmus (Default music player) - cmus (Default music player)
- neovim (Text editor) - neovim (Text editor)
- aerc (Email client) - aerc (Email client)
- maim (Screenshot tool, automatically copies to clipboard using xclip)
- vifm (File manager) - vifm (File manager)
- slock (Lock screen) - slock (Lock screen)
And everything under 'Features'. And everything under 'Features'.

View file

@ -7,5 +7,5 @@ You can see (Dependencies) for a list of all dependencies required to use this f
- make clean install - make clean install
- If any warnings show up, fix it by installing the missing dependency. - If any warnings show up, fix it by installing the missing dependency.
- If a .xinitrc is used, add 'speedwm_run' to the end. - If a .xinitrc is used, add 'speedwm_run' to the end.
- NOTE: Your .xinitrc should ONLY contain 'speedwm_run'. speedwm will automatically start everything else. If not, edit autostart.h and 'make clean install'. If a .xinitrc is not used then you don't need to worry. A .desktop file is automatically created when you run 'make clean install'. - If you do not have a .xinitrc, you can add autostart commands to the file ~/.config/speedwm/autostart.sh or autostart-once.sh. speedwm-autostart in $PATH will also work.

View file

@ -13,16 +13,15 @@ Instead, config.h is split into different parts to make it easier to edit. Inste
- statusbar.h for adding/removing statuscmd clicks. - statusbar.h for adding/removing statuscmd clicks.
- ipc.h for adding/removing IPC commands. (If support is compiled in) - ipc.h for adding/removing IPC commands. (If support is compiled in)
- toggle.h for adding/removing features from getting compiled in. - toggle.h for adding/removing features from getting compiled in.
- actions.h for changing classes/defines used by keybinds and rules.
After you've edited one of the files, you need to run 'make clean install' to reinstall speedwm. After you've edited one of the files, you need to run 'make clean install' to reinstall speedwm.
Remember that you can change colors through your .Xresources file (see .Xresources and Pywal) meaning you do not need to recompile speedwm. Remember that you can change colors through your .Xresources file (see .Xresources and Pywal) meaning you do not need to recompile speedwm.
Another important detail you must keep in mind is that this build comes with a status bar simply named 'status'. Another important detail you must keep in mind is that this build comes with a status bar simply named 'speedwm_status'.
It can be found in the speedwm source code directory. It is just a shell script which adds stuff to your status bar. It will automatically be started when speedwm starts. It can be found in the speedwm source code directory. It is just a shell script which adds stuff to your status bar. It will automatically be started when speedwm starts.
You can edit the status bar simply by editing 'status' and running 'make clean install'. 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'. You can also configure it by editing '~/.config/speedwm/statusrc'.
If you want to change status bar, edit options.h and set 'static char status' to your status bar binary (must be in $PATH). 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 it in .Xresources (See .Xresources and Pywal). Alternatively, you can also set it in .Xresources (See .Xresources and Pywal).

View file

@ -5,7 +5,7 @@ Colors can be reloaded on-the-fly using the built in wallpaper utility. In order
Note that the 'xrdb' dependency is required for both pywal and .Xresources support. 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. However ~/.config/speedwm-de/speedwmrc should be created automatically, which can (and should most of the time) be used instead. Below is a list of all .Xresources values you can define. The .Xresources file should be placed in ~ or ~/.config by the user. However ~/.config/speedwm/speedwmrc should be created automatically, which can (and should most of the time) be used instead.
If it is not or you want it somewhere else, you can edit 'autostart.h' and 'make clean install'. If it is not or you want it somewhere else, you can edit 'autostart.h' and 'make clean install'.

View file

@ -1,11 +1,13 @@
-- Switching run launcher -- -- Maintaining settings easily --
Some users may prefer to use a different run launcher than dmenu. speedwm is a personal fork of dwm and will therefore likely have keybinds and other options you may not like.
Previously all scripts bundled would only run dmenu from $PATH but you can now switch run launcher very easily.
- Edit options.h and change RUN to your run launcher Because of this, I recommend that you use the patching system to manage your "custom" settings. speedwm has a patching system. It allows you to create a patch with your changes to most of the headers.
- Add "export RUNLAUNCHER=<runlauncher>" to your .<shell>rc
Run launchers must support dmenu arguments because otherwise scripts are going to be incompatible. To create a patch, simply make clean install once and then the docs folder will contain backups of your source code. If you perform changes to any of these four files, run make patch to create patches against the backups in docs and your modified files. Then once you're updating, do make patch_remove, git pull, make patch_install, and make clean install and all your settings will be there.
It must also support the additional '-g' argument that the dmenu grid patch provides unless you modify the scripts bundled.
Keep in mind that if you use a different run launcher, it may not support Pywal/.Xresources. The only (obvious) problem with doing this is that eventually the backup files patches are being created against will be pretty old causing patches to no longer apply correctly. If this is the case you will need to create new patches and backups.
If this seems like more effort than it is worth, maintaining your own fork is always an option. This allows you to perform any options you want yourself. This however doesn't allow you to grab any updates so this should be your second choice.
Another option, if you use Gentoo, you can add my overlay and install speedwm using the 'savedconfig' USE flag. This USE flag will combine all the headers into one and will be placed in /etc/portage/savedconfig/x11-wm/speedwm-version. To use the settings, simply emerge speedwm again.

View file

@ -1,13 +1,7 @@
-- Maintaining settings easily -- -- Additional note on autostart --
speedwm is a personal fork of dwm and will therefore likely have keybinds and other options you may not like. If you wish to add autostart entries without recompiling, consider using $HOME/.config/speedwm/autostart.sh. This is a path added to autostart.h and you can fill it with anything you want. You can also use speedwm-autostart. This is a binary that will be executed if it is in $PATH.
Because of this, I recommend that you use the patching system to manage your "custom" settings. speedwm has a patching system. It allows you to create a patch with your changes to most of the headers. Do note that it will NOT just run once. It will run every time you restart and start speedwm (signals count as well).
To get around this, you may wrap stuff in a function in the script and have some way of checking if it has ran before. If it hasn't, call the function.
To create a patch, simply make clean install once and then the docs folder will contain backups of your source code. If you perform changes to any of these four files, run make patch to create patches against the backups in docs and your modified files. Then once you're updating, do make patch_remove, git pull, make patch_install, and make clean install and all your settings will be there.
The only (obvious) problem with doing this is that eventually the backup files patches are being created against will be pretty old causing patches to no longer apply correctly. If this is the case you will need to create new patches and backups.
If this seems like more effort than it is worth, maintaining your own fork is always an option. This allows you to perform any options you want yourself. This however doesn't allow you to grab any updates so this should be your second choice.
Another option, if you use Gentoo, you can add my overlay and install speedwm using the 'savedconfig' USE flag. This USE flag will combine all the headers into one and will be placed in /etc/portage/savedconfig/x11-wm/speedwm-version. To use the settings, simply emerge speedwm again.
An alternative is to use the $HOME/.config/speedwm/autostart_once.sh path. This one is autostarted by speedwm_run and is therefore not hardcoded and not affected by speedwm restarting. Just like the previous autostart script, it does not exist so you need to create it.

View file

@ -1,7 +0,0 @@
-- Additional note on autostart --
If you wish to add autostart entries without recompiling, consider using $HOME/.config/speedwm-de/autostart.sh. This is a path added to autostart.h and you can fill it with anything you want.
Do note that it will NOT just run once. It will run every time you restart and start speedwm (signals count as well).
To get around this, you may wrap stuff in a function in the script and have some way of checking if it has ran before. If it hasn't, call the function.
An alternative is to use the $HOME/.config/speedwm-de/autostart_once.sh path. This one is autostarted by speedwm_run and is therefore not hardcoded and not affected by speedwm restarting. Just like the previous autostart script, it does not exist so you need to create it.

View file

@ -1,6 +1,6 @@
!! speedwm configuration file !! speedwm configuration file
!! !!
!! This is the speedwm configuration file. It will be loaded on startup provided it is located in ~/.config/speedwm-de/speedwmrc. !! This is the speedwm configuration file. It will be loaded on startup provided it is located in ~/.config/speedwm/speedwmrc.
!! If it is not, you need to manually load it. !! If it is not, you need to manually load it.
!! !!
!! To reload settings during runtime, run 'speedwm.run -r'. !! To reload settings during runtime, run 'speedwm.run -r'.

View file

@ -4,18 +4,16 @@
- Super+Shift+Enter - Opens a terminal - Super+Shift+Enter - Opens a terminal
- Super+Shift+Colon - Opens a dmenu prompt - Super+Shift+Colon - Opens a dmenu prompt
- Super+Shift+s - Opens 'maim' to take a screenshot and copies it to the clipboard using 'xclip' - Super+Shift+s - Opens 'maim' to take a screenshot and copies it to the clipboard using 'xclip' (requires speedwm-extras)
- Super+Shift+f - Opens the defined file manager - Super+Shift+f - Opens the defined file manager
- Super+Shift+w - Opens the defined web browser - Super+Shift+w - Opens the defined web browser
- Super+Shift+o - Opens the bundled dfmpeg dmenu script to record your screen. - Super+Shift+o - Opens the speedwm-dfmpeg dmenu script to record your screen. (requires speedwm-extras)
- Super+Shift+t - Opens the defined editor in your terminal - Super+Shift+t - Opens the defined editor in your terminal
- Super+Shift+m - Kills the defined music player - Super+Shift+m - Kills the defined music player
- Super+Shift+a - Opens the defined mixer in your terminal - Super+Shift+a - Opens the defined mixer in your terminal
- Super+Shift+m - Opens the defined music player - Super+Shift+m - Opens the defined music player
- Super+Shift+x - Opens the defined system process viewer in your terminal - Super+Shift+x - Opens the defined system process viewer in your terminal
- Super+Shift+c - Opens the defined chat client - Super+Shift+c - Opens the defined chat client
- Super+Shift+i - Open a dmenu prompt and open the file the user picks in Zathura
- Super+Shift+p - Open a dmenu prompt and open the file the user picks in Vim
- Super+Shift+d - Opens iron in the terminal if it is installed. - Super+Shift+d - Opens iron in the terminal if it is installed.
- Super+Shift+u - Opens the defined RSS reader - Super+Shift+u - Opens the defined RSS reader
- Super+Shift+r - Opens the defined email client - Super+Shift+r - Opens the defined email client
@ -36,7 +34,7 @@
- Super+Equal - Remove the scratchpad - Super+Equal - Remove the scratchpad
- Super+Enter - Switch order of windows - Super+Enter - Switch order of windows
- Super+Colon - Open a list of desktop entries in dmenu - Super+Colon - Open a list of desktop entries in dmenu
- Super+Tab - Switch between windows on the same tag. (Like Windows Alt+Tab) - Super+Tab - Switch between windows on the same tag. (Microsoft Windows-like Alt+Tab)
- Super+0 - Reset mfact - Super+0 - Reset mfact
- Super+r - Reset number of masters - Super+r - Reset number of masters
- Super+y - Make the current selected window sticky - Super+y - Make the current selected window sticky
@ -100,12 +98,11 @@
- Super+Control+Shift+7 - Move the focused window to tag 7 - Super+Control+Shift+7 - Move the focused window to tag 7
- Super+Control+Shift+8 - Move the focused window to tag 8 - Super+Control+Shift+8 - Move the focused window to tag 8
- Super+Control+Shift+9 - Move the focused window to tag 9 - Super+Control+Shift+9 - Move the focused window to tag 9
- Super+Control+Shift+Esc - Open speedwm-utils - Super+Control+Shift+Esc - Open speedwm-utils (requires speedwm-extras)
- Super+Control+Shift+Arrow - Resize the window to the screen size. - Super+Control+Shift+Arrow - Resize the window to the screen size.
- Super+Control+Shift+s - Set a wallpaper - Super+Control+Shift+s - Set a wallpaper
- Super+Control+Shift+n - Connect to WLAN (Using iwd) - Super+Control+Shift+n - Connect to WLAN (Using iwd)
- Super+Control+Shift+b - Connect to a Bluetooth device (Using bluez) - Super+Control+Shift+b - Connect to a Bluetooth device (Using bluez)
- Super+Control+Shift+f - Open up a list of speedwm config files in dmenu that you can edit.
- Super+Control+Shift+q - Pauses your music - Super+Control+Shift+q - Pauses your music
- Super+Control+Shift+w - Decreases your music volume - Super+Control+Shift+w - Decreases your music volume
- Super+Control+Shift+e - Increase your music volume - Super+Control+Shift+e - Increase your music volume
@ -131,7 +128,7 @@
- Super+t & o - Toggle inactive fade - Super+t & o - Toggle inactive fade
- Super+t & b - Show all bar modules - Super+t & b - Show all bar modules
- Super+t & s - Make the current selected window sticky - Super+t & s - Make the current selected window sticky
- Super+c & w - Get the weather (Using wttr.in) - Super+c & w - Get the weather (Using wttr.in) using speedwm-core (requires speedwm-extras)
- Super+c & n - Switch to the next track - Super+c & n - Switch to the next track
- Super+c & p - Switch to the previous track - Super+c & p - Switch to the previous track
- Super+g & t - Toggle gaps - Super+g & t - Toggle gaps
@ -160,11 +157,11 @@
- Pause button - Pauses the current track - Pause button - Pauses the current track
- Stop button - Stops your defined music player - Stop button - Stops your defined music player
- Browser button - Opens your defined web browser - Browser button - Opens your defined web browser
- Power button - Ask if you wanna shut down, restart or lock your computer. - Power button - Ask if you wanna shut down, restart or lock your computer. (requires speedwm-extras)
- Email button - Open your defined email client - Email button - Open your defined email client
- System button - Open your defined status viewer in a terminal - System button - Open your defined status viewer in a terminal
- Music button - Open your defined music player - Music button - Open your defined music player
- WLAN button - Disconnect from WLAN - WLAN button - Disconnect from WLAN (requires speedwm-extras)
-- Mouse -- -- Mouse --
@ -176,13 +173,13 @@
- Layout indicator (Middle click) - Switch to the next layout - Layout indicator (Middle click) - Switch to the next layout
- Layout indicator (Right click) - Open a dmenu list of all layouts - Layout indicator (Right click) - Open a dmenu list of all layouts
- Window title (Left click) - Hide/Show the window - Window title (Left click) - Hide/Show the window
- Window title (Right click) - Open speedwm-utils - Window title (Right click) - Open speedwm-utils (requires speedwm-extras)
- Focused window (Super+Alt+Left click) - Move the focused window around - Focused window (Super+Alt+Left click) - Move the focused window around
- Focused window (Super+Alt+Middle click) - Make the focused window floating - Focused window (Super+Alt+Middle click) - Make the focused window floating
- Focused window title (Middle click) - Rotate stack - Focused window title (Middle click) - Rotate stack
- Dragging (Super+Right click) - Increase/decrease size of each window (mfact) - Dragging (Super+Right click) - Increase/decrease size of each window (mfact)
- Dragging (SuperControl+Right click) - Increase/decrease cfact - Dragging (SuperControl+Right click) - Increase/decrease cfact
- Root window (Right click) - List .desktop entries and open them - Root window (Right click) - List .desktop entries and open them (requires j4-dmenu-desktop)
There are also keybinds for statuscmd, but you must implement it into your own status bar. There are also keybinds for statuscmd, but you must implement it into your own status bar.
See mouse.h for more information. See mouse.h for more information.

2
draw.h
View file

@ -40,7 +40,7 @@ void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw); void drw_free(Drw *drw);
/* Fnt abstraction */ /* Fnt abstraction */
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); Fnt *drw_fontset_create(Drw* drw, const char *fontarray[], size_t fontcount);
void drw_fontset_free(Fnt* set); void drw_fontset_free(Fnt* set);
unsigned int drw_fontset_getwidth(Drw *drw, const char *text); unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);

View file

@ -22,6 +22,10 @@
* Once you're done with your edits, run 'make clean install'. * Once you're done with your edits, run 'make clean install'.
*/ */
/* For terminal applications */
#define TERMINAL "st -e "
/* Modifier keys /* Modifier keys
* Mod4Mask | Super (Windows/command) key * Mod4Mask | Super (Windows/command) key
* Mod1Mask | Alt key * Mod1Mask | Alt key
@ -40,48 +44,46 @@ static Key keys[] = {
/* modifier chain key key function argument */ /* modifier chain key key function argument */
/* Run keybinds */ /* Run keybinds */
{ MODIFIER1|SHIFT, -1, XK_semicolon, spawn, cmd( RUN ) }, { MODIFIER1|SHIFT, -1, XK_semicolon, spawn, cmd( "dmenu_run -l 0 -p 'Run:'" ) },
{ MODIFIER1, -1, XK_semicolon, spawn, cmd( RUN_DESKTOP ) }, { MODIFIER1, -1, XK_semicolon, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='dmenu -l 20 -p Open:'" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_semicolon, spawn, cmd( RUN_ALT ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_semicolon, spawn, cmd( "speedwm-applist" ) },
/* Application keybinds */ /* Application keybinds */
{ MODIFIER1|SHIFT, -1, XK_Return, spawn, cmd( TERMINAL ) }, { MODIFIER1|SHIFT, -1, XK_Return, spawn, cmd( TERMINAL ) },
{ MODIFIER1|SHIFT, -1, XK_s, spawn, cmd( SCREENSHOT ) }, { MODIFIER1|SHIFT, -1, XK_s, spawn, cmd( "speedwm-screenshotutil -s" ) },
{ MODIFIER1|SHIFT, -1, XK_f, spawn, cmd( TERMINAL FILEMANAGER ) }, { MODIFIER1|SHIFT, -1, XK_f, spawn, cmd( TERMINAL "vifmrun || vifm" ) },
{ MODIFIER1|SHIFT, -1, XK_w, spawn, cmd( BROWSER ) }, { MODIFIER1|SHIFT, -1, XK_w, spawn, cmd( "firefox" ) },
{ MODIFIER1|SHIFT, -1, XK_o, spawn, cmd( "speedwm-dfmpeg" ) }, { MODIFIER1|SHIFT, -1, XK_o, spawn, cmd( "speedwm-dfmpeg" ) },
{ MODIFIER1|SHIFT, -1, XK_d, spawn, cmd( TERMINAL CHAT2 ) }, { MODIFIER1|SHIFT, -1, XK_d, spawn, cmd( TERMINAL "iron" ) },
{ MODIFIER1|SHIFT, -1, XK_t, spawn, cmd( TERMINAL EDITOR ) }, { MODIFIER1|SHIFT, -1, XK_t, spawn, cmd( TERMINAL "nvim" ) },
{ MODIFIER1|SHIFT, -1, XK_a, spawn, cmd( TERMINAL MIXER ) }, { MODIFIER1|SHIFT, -1, XK_a, spawn, cmd( TERMINAL "speedwm-audioctrl -runmixer" ) },
{ MODIFIER1|SHIFT, -1, XK_m, spawn, cmd( TERMINAL MUSIC ) }, { MODIFIER1|SHIFT, -1, XK_m, spawn, cmd( TERMINAL "tmux new-session -A -D -s cmus $(which --skip-alias cmus)" ) },
#if USESWITCHER
{ MODIFIER1, -1, XK_Tab, switcherstart, {0} },
#endif
{ MODIFIER1|SHIFT, -1, XK_Tab, spawn, cmd( "speedwm-winnav" ) }, { MODIFIER1|SHIFT, -1, XK_Tab, spawn, cmd( "speedwm-winnav" ) },
{ MODIFIER1|SHIFT, -1, XK_x, spawn, cmd( TERMINAL SYSTEMSTAT ) }, { MODIFIER1|SHIFT, -1, XK_x, spawn, cmd( TERMINAL "htop" ) },
{ MODIFIER1|SHIFT, -1, XK_c, spawn, cmd( TERMINAL CHAT ) }, { MODIFIER1|SHIFT, -1, XK_c, spawn, cmd( TERMINAL "tmux new-session -A -D -s weechat $(which --skip-alias weechat)" ) },
{ MODIFIER1|SHIFT, -1, XK_Escape, spawn, cmd( "speedwm-shutdown" ) }, { MODIFIER1|SHIFT, -1, XK_Escape, spawn, cmd( "speedwm-shutdown" ) },
{ MODIFIER1|SHIFT, -1, XK_u, spawn, cmd( TERMINAL RSS ) }, { MODIFIER1|SHIFT, -1, XK_u, spawn, cmd( TERMINAL "newsboat" ) },
{ MODIFIER1|SHIFT, -1, XK_r, spawn, cmd( TERMINAL EMAIL ) }, { MODIFIER1|SHIFT, -1, XK_r, spawn, cmd( TERMINAL "aerc" ) },
{ MODIFIER1|CONTROL, -1, XK_Tab, spawn, cmd( "speedwm-utils layout" ) }, { MODIFIER1|CONTROL, -1, XK_Tab, spawn, cmd( "speedwm-utils layout" ) },
{ MODIFIER1|CONTROL, -1, XK_h, spawn, cmd( TERMINAL "speedwm-help -2" ) }, { MODIFIER1|CONTROL, -1, XK_h, spawn, cmd( TERMINAL "speedwm-help -2" ) },
{ MODIFIER1|CONTROL, -1, XK_s, spawn, cmd( SCREENSHOT_FULL ) }, { MODIFIER1|CONTROL, -1, XK_s, spawn, cmd( "speedwm-screenshotutil -f" ) },
{ MODIFIER1|CONTROL, -1, XK_m, spawn, cmd( KILLMUSIC ) }, { MODIFIER1|CONTROL, -1, XK_m, spawn, cmd( "pkill cmus" ) },
{ MODIFIER1|CONTROL, -1, XK_q, spawn, cmd( VOL_MUTE ) }, { MODIFIER1|CONTROL, -1, XK_q, spawn, cmd( "speedwm-audioctrl -mute" ) },
{ MODIFIER1|CONTROL, -1, XK_w, spawn, cmd( VOL_DOWN ) }, { MODIFIER1|CONTROL, -1, XK_w, spawn, cmd( "speedwm-audioctrl -lower" ) },
{ MODIFIER1|CONTROL, -1, XK_e, spawn, cmd( VOL_UP ) }, { MODIFIER1|CONTROL, -1, XK_e, spawn, cmd( "speedwm-audioctrl -raise" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_q, spawn, cmd( PAUSEMUSIC ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_q, spawn, cmd( "cmus-remote --pause" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_w, spawn, cmd( DOWNMUSIC ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_w, spawn, cmd( "cmus-remote --volume -3000" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_e, spawn, cmd( UPMUSIC ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_e, spawn, cmd( "cmus-remote --volume +3000" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_Escape, spawn, cmd( "speedwm-utils" ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_Escape, spawn, cmd( "speedwm-utils" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_s, spawn, cmd( "speedwm-swal" ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_s, spawn, cmd( "speedwm-swal" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_n, spawn, cmd( NETWORK ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_n, spawn, cmd( "speedwm-netctrl" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_b, spawn, cmd( BLUETOOTH ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_b, spawn, cmd( "speedwm-btctrl" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_f, spawn, cmd( "speedwm_run -configure" ) },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_r, spawn, cmd( "speedwm_run -r" ) }, { MODIFIER1|CONTROL|SHIFT, -1, XK_r, spawn, cmd( "speedwm_run -r" ) },
#if USESYSTRAY
/* System tray */
#if USESYSTRAY
{ MODIFIER1, -1, XK_s, togglesystray, {0} }, { MODIFIER1, -1, XK_s, togglesystray, {0} },
#endif #endif
/* Layout keybinds */ /* Layout keybinds */
{ MODIFIER1|CONTROL|SHIFT, -1, XK_a, cyclelayout, {.i = -1 } }, { MODIFIER1|CONTROL|SHIFT, -1, XK_a, cyclelayout, {.i = -1 } },
@ -125,6 +127,9 @@ static Key keys[] = {
{ MODIFIER1|CONTROL|SHIFT, -1, XK_0, resetbarheight, {0} }, { MODIFIER1|CONTROL|SHIFT, -1, XK_0, resetbarheight, {0} },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_equal, setbarheight, {.i = +1} }, { MODIFIER1|CONTROL|SHIFT, -1, XK_equal, setbarheight, {.i = +1} },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_minus, setbarheight, {.i = -1} }, { MODIFIER1|CONTROL|SHIFT, -1, XK_minus, setbarheight, {.i = -1} },
#if USESWITCHER
{ MODIFIER1, -1, XK_Tab, switcherstart, {0} },
#endif
/* Floating mode keybinds */ /* Floating mode keybinds */
{ MODIFIER1, -1, XK_w, moveresizeaspect, {.i = +24} }, { MODIFIER1, -1, XK_w, moveresizeaspect, {.i = +24} },
@ -169,8 +174,8 @@ static Key keys[] = {
/* Chained keybinds */ /* Chained keybinds */
{ MODIFIER1, XK_c, XK_w, spawn, cmd( TERMINAL "speedwm-core -curl-weather" ) }, { MODIFIER1, XK_c, XK_w, spawn, cmd( TERMINAL "speedwm-core -curl-weather" ) },
{ MODIFIER1, XK_c, XK_n, spawn, cmd( NEXTMUSIC ) }, { MODIFIER1, XK_c, XK_n, spawn, cmd( "cmus-remote --next" ) },
{ MODIFIER1, XK_c, XK_p, spawn, cmd( PREVMUSIC ) }, { MODIFIER1, XK_c, XK_p, spawn, cmd( "cmus-remote --prev" ) },
{ MODIFIER1, XK_r, XK_s, spawn, cmd( "screenkey" ) }, { MODIFIER1, XK_r, XK_s, spawn, cmd( "screenkey" ) },
{ MODIFIER1, XK_r, XK_d, spawn, cmd( "pkill screenkey" ) }, { MODIFIER1, XK_r, XK_d, spawn, cmd( "pkill screenkey" ) },
{ MODIFIER1, XK_t, XK_r, reorganizetags, {0} }, { MODIFIER1, XK_t, XK_r, reorganizetags, {0} },
@ -215,19 +220,19 @@ static Key keys[] = {
/* Media buttons */ /* Media buttons */
#if USEMEDIA #if USEMEDIA
{ 0, -1, XF86XK_AudioMute, spawn, cmd( VOL_MUTE ) }, { 0, -1, XF86XK_AudioMute, spawn, cmd( "speedwm-audioctrl -mute" ) },
{ 0, -1, XF86XK_AudioRaiseVolume, spawn, cmd( VOL_UP ) }, { 0, -1, XF86XK_AudioRaiseVolume, spawn, cmd( "speedwm-audioctrl -raise" ) },
{ 0, -1, XF86XK_AudioLowerVolume, spawn, cmd( VOL_DOWN ) }, { 0, -1, XF86XK_AudioLowerVolume, spawn, cmd( "speedwm-audioctrl -lower" ) },
{ 0, -1, XF86XK_AudioPrev, spawn, cmd( PREVMUSIC ) }, { 0, -1, XF86XK_AudioPrev, spawn, cmd( "cmus-remote --prev" ) },
{ 0, -1, XF86XK_AudioNext, spawn, cmd( NEXTMUSIC ) }, { 0, -1, XF86XK_AudioNext, spawn, cmd( "cmus-remote --next" ) },
{ 0, -1, XF86XK_AudioStop, spawn, cmd( KILLMUSIC ) }, { 0, -1, XF86XK_AudioStop, spawn, cmd( "pkill cmus" ) },
{ 0, -1, XF86XK_AudioPause, spawn, cmd( PAUSEMUSIC ) }, { 0, -1, XF86XK_AudioPause, spawn, cmd( "cmus-remote --pause" ) },
{ 0, -1, XF86XK_WWW, spawn, cmd( BROWSER ) }, { 0, -1, XF86XK_WWW, spawn, cmd( "firefox" ) },
{ 0, -1, XF86XK_PowerOff, spawn, cmd( "speedwm-shutdown" ) }, { 0, -1, XF86XK_PowerOff, spawn, cmd( "speedwm-shutdown" ) },
{ 0, -1, XF86XK_Sleep, spawn, cmd( LOCKER ) }, { 0, -1, XF86XK_Sleep, spawn, cmd( "slock" ) },
{ 0, -1, XF86XK_Mail, spawn, cmd( TERMINAL EMAIL ) }, { 0, -1, XF86XK_Mail, spawn, cmd( TERMINAL "aerc" ) },
{ 0, -1, XF86XK_TaskPane, spawn, cmd( TERMINAL SYSTEMSTAT ) }, { 0, -1, XF86XK_TaskPane, spawn, cmd( TERMINAL "htop" ) },
{ 0, -1, XF86XK_WLAN, spawn, cmd( KILLNETWORK ) }, { 0, -1, XF86XK_WLAN, spawn, cmd( "speedwm-netctrl disconnect" ) },
{ 0, -1, XF86XK_Music, spawn, cmd( TERMINAL MUSIC ) }, { 0, -1, XF86XK_Music, spawn, cmd( TERMINAL "tmux new-session -A -D -s cmus $(which --skip-alias cmus)" ) },
#endif #endif
}; };

View file

@ -1507,17 +1507,17 @@ void set_s_layout(const Arg *arg)
char pathbuf[1024]; char pathbuf[1024];
char *home = getenv("HOME"); char *home = getenv("HOME");
if (home != NULL) { if (home != NULL) {
snprintf(pathbuf, 1023, "%s/" CUSTOM_HISTFILE, home); snprintf(pathbuf, 1023, "%s/", customhistfile, home);
pathbuf[1023] = '\0'; pathbuf[1023] = '\0';
/* make sure the history file exists */ /* make sure the history file exists */
hf = fopen(CUSTOM_HISTFILE, "a"); fclose(hf); hf = fopen(customhistfile, "a"); fclose(hf);
system("sort " CUSTOM_HISTFILE " | uniq > " CUSTOM_HISTFILE "~"); system("sort" customhistfile " | uniq > " customhistfile "~");
system("mv " CUSTOM_HISTFILE "~ " CUSTOM_HISTFILE); system("mv " customhistfile "~ " customhistfile);
pp = popen(RUN_CUSTOM_LAYOUT CUSTOM_HISTFILE, "r"); pp = popen(customprompt customhistfile, "r");
} else { } else {
pp = popen(RUN_CUSTOM_LAYOUT, "r"); pp = popen(customprompt, "r");
} }
@ -1531,7 +1531,7 @@ void set_s_layout(const Arg *arg)
if (buf[0] == '\0') if (buf[0] == '\0')
return; return;
hf = fopen(CUSTOM_HISTFILE, "a"); hf = fopen(customhistfile, "a");
fprintf(hf, "%s", buf); fprintf(hf, "%s", buf);
fclose(hf); fclose(hf);

View file

@ -2,7 +2,7 @@
# battery module for status/stellar # battery module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
# argument 1 # argument 1

View file

@ -2,7 +2,7 @@
# date module for status/stellar # date module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
ARG1="$1" ARG1="$1"

View file

@ -2,7 +2,7 @@
# dfmpeg module for status/stellar # dfmpeg module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
ARG1="$1" ARG1="$1"

View file

@ -2,7 +2,7 @@
# music module for status/stellar # music module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
ARG1="$1" ARG1="$1"

View file

@ -2,7 +2,7 @@
# network module for status/stellar # network module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
ARG1="$1" ARG1="$1"

View file

@ -2,7 +2,7 @@
# news module for status/stellar # news module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
# argument 1 # argument 1

View file

@ -2,7 +2,7 @@
# ram module for status/stellar # ram module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
ARG1="$1" ARG1="$1"

View file

@ -2,7 +2,7 @@
# cpu temp module for status/stellar # cpu temp module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
ARG1="$1" ARG1="$1"

View file

@ -2,7 +2,7 @@
# time module for status/stellar # time module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
ARG1="$1" ARG1="$1"

View file

@ -2,7 +2,7 @@
# volume module for status/stellar # volume module for status/stellar
# #
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
ARG1="$1" ARG1="$1"

View file

@ -2,7 +2,7 @@
# weather module for status/stellar # weather module for status/stellar
# load config # load config
. $HOME/.config/speedwm-de/status/config . $HOME/.config/speedwm-de/statusrc
BINDIR="$(dirname $(command -v speedwm_status))/" BINDIR="$(dirname $(command -v speedwm_status))/"
# argument 1 # argument 1

View file

@ -33,7 +33,7 @@ static const Button buttons[] = {
{ ClkStatusText, 0, Button3, spawn, {.v = statuscmd } }, { ClkStatusText, 0, Button3, spawn, {.v = statuscmd } },
{ ClkWinTitle, 0, Button1, togglewin, {0} }, { ClkWinTitle, 0, Button1, togglewin, {0} },
{ ClkWinTitle, 0, Button3, spawn, cmd( "speedwm-utils" ) }, { ClkWinTitle, 0, Button3, spawn, cmd( "speedwm-utils" ) },
{ ClkRootWin, 0, Button3, spawn, cmd( RUN_DESKTOP ) }, { ClkRootWin, 0, Button3, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='dmenu -l 20 -p Open:'" ) },
{ ClkTagBar, 0, Button1, view, {0} }, { ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button4, view, {0} }, { ClkTagBar, 0, Button4, view, {0} },
{ ClkTagBar, 0, Button5, view, {0} }, { ClkTagBar, 0, Button5, view, {0} },

View file

@ -3,6 +3,7 @@
* -- What is speedwm -- * -- What is speedwm --
* *
* speedwm is a fork of suckless.org's dwm, a window manager for X. * speedwm is a fork of suckless.org's dwm, a window manager for X.
*
* Unlike the original 'dwm' window manager, speedwm tries to be minimal, just like dwm but also has functionality and aesthetics as a goal. * Unlike the original 'dwm' window manager, speedwm tries to be minimal, just like dwm but also has functionality and aesthetics as a goal.
* speedwm has a bigger codebase than suckless.org's dwm, however is still much more minimal than other tiling window managers such as i3-gaps while providing more features for the user. * speedwm has a bigger codebase than suckless.org's dwm, however is still much more minimal than other tiling window managers such as i3-gaps while providing more features for the user.
* *
@ -17,7 +18,7 @@
* Otherwise you may maintain your own fork of speedwm if you prefer. * Otherwise you may maintain your own fork of speedwm if you prefer.
* *
* In addition to this, if speedwm doesn't have a feature you want, there's nothing stopping you from adding it as it still follows the suckless philosophy somewhat. * In addition to this, if speedwm doesn't have a feature you want, there's nothing stopping you from adding it as it still follows the suckless philosophy somewhat.
* While there are VERY likely going to be patch conflicts, this is still dwm, just modified. * While there are VERY likely going to be patch conflicts, this is still dwm, just modified. I suggest you take the time to learn the codebase for dwm as it can be applied to speedwm.
* *
* Below is a configuration file. Read the instructions below for information about how to configure it. * Below is a configuration file. Read the instructions below for information about how to configure it.
* *
@ -29,16 +30,14 @@
* *
* -- What is this file for? -- * -- What is this file for? --
* *
* The header you are currently reading is for changing what software you want to use. An important thing to note is that because this build of speedwm auto-starts software such as your compositor, you may want to change this by changing '#define COMPOSITOR' for example. Same goes for other software. * The header you are currently reading is for changing options for various features.
* *
* If you aren't aware of this, do not add anything to your .xinitrc if it is listed in autostart.h * If you are a user of a display manager, you may not be able to use .xinitrc. Because of this you can autostart shell scripts using the $HOME/.config/speedwm/autostart.sh script. It is not there by default but if you want to use it, just create the file, chmod +x it and add your shell script to it. There is also the autostart-once.sh script in the same directory which is only started once.
* You can also autostart shell scripts using the $HOME/.config/speedwm-de/autostart.sh script. It is not there by default but if you want to use it, just create the file, chmod +x it and add your shell script to it.
* *
* -- What are all the headers about? -- * -- What are all the headers about? --
* *
* speedwm unlike dwm doesn't just have a single header, config.h but rather multiple. Below is a list of them * speedwm unlike dwm doesn't just have a single header, config.h but rather multiple. Below is a list of them
* *
* - If you were looking for the software options, they can be found here in actions.h
* - If you were looking for colors, and other options, they can be found here in options.h * - If you were looking for colors, and other options, they can be found here in options.h
* - If you were looking for the keybinds, they can be found in keybinds.h * - If you were looking for the keybinds, they can be found in keybinds.h
* - If you use another operating system such as OpenBSD, FreeBSD or Solaris (Not GNU/Linux), edit host.mk * - If you use another operating system such as OpenBSD, FreeBSD or Solaris (Not GNU/Linux), edit host.mk
@ -53,6 +52,7 @@
* The goal of this is to decrease the size of headers and make it easier to find what you want to find, because if I were to combine all of this into one big file, it would be really difficult to hack on it (see dwm-flexipatch for an example). * The goal of this is to decrease the size of headers and make it easier to find what you want to find, because if I were to combine all of this into one big file, it would be really difficult to hack on it (see dwm-flexipatch for an example).
* *
* Also note that: * Also note that:
*
* speedwm.c = dwm.c * speedwm.c = dwm.c
* host.mk = config.mk * host.mk = config.mk
* Rest of the headers = config.h/config.def.h * Rest of the headers = config.h/config.def.h
@ -62,16 +62,16 @@
* I do not recommend that you attempt to use the patch coreutil as it is not likely to patch successfully. * I do not recommend that you attempt to use the patch coreutil as it is not likely to patch successfully.
* There are however a few speedwm specific patches available on my Codeberg (https://codeberg.org/speedie/patches). These were created when I removed a feature that I decided was not worth keeping in. * There are however a few speedwm specific patches available on my Codeberg (https://codeberg.org/speedie/patches). These were created when I removed a feature that I decided was not worth keeping in.
* *
* Alternatively, you can change some of these in ~/.config/speedwm-de/speedwmrc. * Alternatively, you can change some of these in ~/.config/speedwm/speedwmrc.
* *
* Do note that settings in speedwmrc will override the settings in all of the headers (as long as the file is valid). * Do note that settings in speedwmrc will override the settings in all of the headers (as long as the file is valid).
* If you do not like this behavior, you may add "rm -f $HOME/.config/speedwm-de/speedwmrc" to autostart.sh which will make sure the speedwmrc options are not used. * If you do not like this behavior, you may add "rm -f $HOME/.config/speedwm/speedwmrc" to autostart.sh which will make sure the speedwmrc options are not used.
* *
******************************************************/ ******************************************************/
/* Options /* Options
* *
* If xrdb is installed, you can simply edit ~/.config/speedwm-de/speedwmrc instead of recompiling. * If xrdb is installed, you can simply edit ~/.config/speedwm/speedwmrc instead of recompiling.
* Once you're done with your edits, run 'make clean install'. * Once you're done with your edits, run 'make clean install'.
* *
* It should be noted that options in speedwmrc will override the options in here. This means if an option does nothing here, it's likely different in the config file. * It should be noted that options in speedwmrc will override the options in here. This means if an option does nothing here, it's likely different in the config file.
@ -138,13 +138,8 @@ static char font1[] = { "NotoSans-Regular:size=8:antia
static char font2[] = { "fontawesome:size=8:antialiasing=true" }; /* Second font */ static char font2[] = { "fontawesome:size=8:antialiasing=true" }; /* Second font */
static char font3[] = { "Noto Color Emoji:size=8:antialiasing=true" }; /* Third font */ static char font3[] = { "Noto Color Emoji:size=8:antialiasing=true" }; /* Third font */
/* Extra fonts */
static char *fonts[] = { "Noto Emoji:size=8:antialiasing=true",
"monospace:size=8:antialiasing=true",
};
/* Status options */ /* Status options */
static char status[] = "status"; /* Status bar to use, stellar for stellar, dwmblocks for dwmblocks, slstatus for slstatus, etc. */ static char status[] = "speedwm_status"; /* Status bar to use, stellar for stellar, dwmblocks for dwmblocks, slstatus for slstatus, etc. */
static char defaultstatus[] = ""; /* What to print when a status bar is not running */ static char defaultstatus[] = ""; /* What to print when a status bar is not running */
/* Alternate bar /* Alternate bar
@ -245,6 +240,10 @@ static char deckformat[] = "[%d]"; /* Format of the deck co
/* Dynamic Grid layout */ /* Dynamic Grid layout */
static int forcevsplit = 1; /* Force two clients to always split vertically in the dynamic grid layout */ static int forcevsplit = 1; /* Force two clients to always split vertically in the dynamic grid layout */
/* Custom layout */
#define customhistfile ".config/speedwm/history" /* History file */
#define customprompt "dmenu -i -l 10 -p 'Enter an S expression >' <" /* Run launcher to use for the custom layout */
/* Resetting */ /* Resetting */
static int resetlayout = 1; /* Reset layout when there is only one client visible */ static int resetlayout = 1; /* Reset layout when there is only one client visible */
static int resetmfact = 1; /* Reset mfact when there is only one client visible */ static int resetmfact = 1; /* Reset mfact when there is only one client visible */

16
rules.h
View file

@ -8,22 +8,26 @@
* - isterminal: Whether or not the CLASS, INSTANCE or TITLE is a terminal or not (1/0) * - isterminal: Whether or not the CLASS, INSTANCE or TITLE is a terminal or not (1/0)
* - noswallow: Whether or not the CLASS, INSTANCE or TITLE gets swallowed by a terminal or not (1/0) * - noswallow: Whether or not the CLASS, INSTANCE or TITLE gets swallowed by a terminal or not (1/0)
* - ignoretransient: Whether or not to ignore transient windows for CLASS, INSTANCE or TITLE (1/0) * - ignoretransient: Whether or not to ignore transient windows for CLASS, INSTANCE or TITLE (1/0)
* - unmanaged: Whether or not to allow speedwm to manage the window (tile it, focus it, move it, etc.)
* *
* For the rest, leave as they currently are and copy them for new rules. * For the rest, leave as they currently are and copy them for new rules.
* Once you're done with your edits, run 'make clean install'. * Once you're done with your edits, run 'make clean install'.
* *
***************************************************************/ ***************************************************************/
/* For terminal applications */
#define TERMINAL_CLASS "st"
static const Rule rules[] = { static const Rule rules[] = {
/* class instance title tags mask isfloating ispermanent isterminal noswallow monitor unmanaged ignoretransient scratch key */ /* class instance title tags mask isfloating ispermanent isterminal noswallow monitor unmanaged ignoretransient scratch key */
{ TERMINAL_CLASS, NULL, NULL, 0, 0, 0, 1, 0, -1, 0, 0, 0 }, { TERMINAL_CLASS, NULL, NULL, 0, 0, 0, 1, 0, -1, 0, 0, 0 },
{ TERMINAL_CLASS, NULL, "sxiv", 0, 0, 0, 0, 0, -1, 0, 0, 0 }, { TERMINAL_CLASS, NULL, "sxiv", 0, 0, 0, 0, 0, -1, 0, 0, 0 },
{ TERMINAL_CLASS, NULL, FILEMANAGER_CLASS, 0, 0, 0, 1, 0, -1, 0, 0, 0 }, { TERMINAL_CLASS, NULL, "Vifm", 0, 0, 0, 1, 0, -1, 0, 0, 0 },
{ PDF_CLASS, NULL, NULL, 0, 0, 0, 0, 0, -1, 0, 0, 0 }, { "Zathura", NULL, NULL, 0, 0, 0, 0, 0, -1, 0, 0, 0 },
{ TERMINAL_CLASS, NULL, EDITOR, 0, 0, 0, 1, 1, -1, 0, 0, 0 }, { TERMINAL_CLASS, NULL, "nvim", 0, 0, 0, 1, 1, -1, 0, 0, 0 },
{ TERMINAL_CLASS, NULL, MUSIC, 0, 0, 0, 0, 1, -1, 0, 0, 0 }, { TERMINAL_CLASS, NULL, "cmus", 0, 0, 0, 0, 1, -1, 0, 0, 0 },
{ TERMINAL_CLASS, NULL, notitle, 0, 0, 0, 0, 1, -1, 0, 0, 0 }, { TERMINAL_CLASS, NULL, notitle, 0, 0, 0, 0, 1, -1, 0, 0, 0 },
{ TERMINAL_CLASS, NULL, MIXER, 0, 1, 0, 0, 1, -1, 0, 0, 0 }, { "Navigator", NULL, NULL, 0, 0, 0, 0, 0, -1, 0, 0, 0 },
{ BROWSER_CLASS, NULL, NULL, 0, 0, 0, 0, 0, -1, 0, 0, 0 },
{ "mpv", NULL, NULL, 0, 0, 0, 0, 0, -1, 0, 0, 0 }, { "mpv", NULL, NULL, 0, 0, 0, 0, 0, -1, 0, 0, 0 },
{ "tabbed", NULL, NULL, 0, 0, 0, 0, 1, -1, 0, 0, 0 }, { "tabbed", NULL, NULL, 0, 0, 0, 0, 1, -1, 0, 0, 0 },
{ "trayer", NULL, NULL, 0, 1, 1, 0, 1, -1, 1, 0, 0 }, { "trayer", NULL, NULL, 0, 1, 1, 0, 1, -1, 1, 0, 0 },

View file

@ -1,94 +0,0 @@
#!/bin/sh
# speedwm-applist
# list extra applications
# rl
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu ;;
esac
# assume we have grid as default
HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
echo "Loaded configuration!"
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
fi
# grid number is one
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
# grid argument
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
# create applist
MK_APPLIST() {
if [ -e "$HOME/.local/share/speedwm/applist" ]; then
USER_CMD="$(printf "$(cat $HOME/.local/share/speedwm/applist)\n------\nAdd command\nRemove command\nClear\n" | $RUNLAUNCHER -l 20 -p 'Run:' $GRIDARG $GRIDNUM)"
else
mkdir -p $HOME/.local/share/speedwm
echo "No commands added." > $HOME/.local/share/speedwm/applist
$0 && exit 0
fi
}
# remove commands
REMOVE_CMD() {
USER_CMD="$(printf "$(cat $HOME/.local/share/speedwm/applist)\n------\nAdd command\nRemove command\nClear\n" | $RUNLAUNCHER -l 20 -p 'Remove: ' $GRIDARG $GRIDNUM)"
if [ "$(cat $HOME/.local/share/speedwm/applist | wc -l)" -lt "2" ]; then
rm -f $HOME/.local/share/speedwm/applist
else
grep -v "$USER_CMD" $HOME/.local/share/speedwm/applist | sed ':a;N;$!ba;s/\n//g' > /tmp/applist
mv /tmp/applist $HOME/.local/share/speedwm/applist
fi
$0 && exit 0
}
# clear commands
CLEAR_CMD() {
case "$(printf "Yes\nNo\n" | $RUNLAUNCHER -l 2 -p 'Are you sure?')" in
"Yes") rm -f $HOME/.local/share/speedwm/applist ;;
esac
$0 && exit 0
}
# add command
ADD_CMD() {
grep -q "No commands added" $HOME/.local/share/speedwm/applist && rm -f $HOME/.local/share/speedwm/applist
USER_I_ARG="$(printf "" | $RUNLAUNCHER -l 0 -p 'Enter a command:' $GRIDARG $GRIDNUM)"
printf "$USER_I_ARG\n" >> $HOME/.local/share/speedwm/applist
$0 && exit 0
}
MK_APPLIST
# check user cmd
if [ "$USER_CMD" = "" ]; then
exit 0
else
if [ "$USER_CMD" = "Add command" ]; then
ADD_CMD
else
if [ "$USER_CMD" = "Clear" ]; then
CLEAR_CMD
else
if [ "$USER_CMD" = "Remove command" ]; then
REMOVE_CMD
else
$USER_CMD
fi
fi
fi
fi

View file

@ -1,145 +0,0 @@
#!/bin/sh
# speedwm-audioctrl
# This simple shell script handles audio controls for speedwm.
# Run speedwm-audioctrl -help for more information!
# License: GPLv3.
BINDIR="$(dirname $(command -v speedwm_status))/"
MUTE() {
# Mute for pulseaudio/pipewire
if [ "$AUDIO" = "pulse" ]; then
if [ -e "${BINDIR}pactl" ]; then
pactl set-sink-mute 0 toggle
if [ -e "${BINDIR}notify-send" ]; then
if [ "$remute" = "" ]; then
notify-send " Toggled mute"
fi
fi
else
amixer set Master toggle
if [ -e "${BINDIR}notify-send" ]; then
if [ "$remute" = "" ]; then
notify-send " Toggled mute"
fi
fi
fi
fi
}
RAISE() {
if [ "$AUDIO" = "pulse" ]; then
if [ -e "${BINDIR}pactl" ]; then
if [ "$(pactl get-sink-volume 0 | awk '{ print $5;exit }' | sed 's/%//g')" -gt "100" ]; then
pactl set-sink-volume 0 100%
else
pactl set-sink-volume 0 +10%
test ${BINDIR}notify-send && notify-send " $(pactl get-sink-volume 0 | awk '{ print $5;exit }')"
fi
fi
else
if [ "$(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")" = "100" ]; then
a=$a
else
amixer -c 0 set Master 7%+
ls ${BINDIR}notify-send && notify-send " $(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")%"
fi
fi
}
LOWER() {
if [ "$AUDIO" = "pulse" ]; then
if [ -e "${BINDIR}pactl" ]; then
if [ "$(pactl get-sink-volume 0 | awk '{ print $5;exit }' | sed 's/%//g')" != "0" ]; then
pactl set-sink-volume 0 -10%
test ${BINDIR}notify-send && notify-send " $(pactl get-sink-volume 0 | awk '{ print $5;exit }')"
fi
fi
else
if [ "$(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")" = "0" ]; then
a=$a
else
amixer -c 0 set Master 7%-
test ${BINDIR}notify-send && notify-send " $(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")%"
fi
fi
}
GETVOL() {
if [ "$AUDIO" = "pulse" ]; then
if [ -e "${BINDIR}pactl" ]; then
pactl get-sink-volume 0 | awk '{ print $5;exit }'
fi
else
echo "$(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")%"
fi
}
GETMUTE() {
if [ "$AUDIO" = "pulse" ]; then
if [ -e "${BINDIR}pactl" ]; then
pactl get-sink-mute 0 | sed "s/Mute: //; s/no/Not muted/; s/yes/Muted/g"
fi
fi
}
SWITCH() {
ls $HOME/.local/share/audioctrl-status || echo "0" > $HOME/.local/share/audioctrl-status
if [ "$(cat $HOME/.local/share/audioctrl-status)" = "0" ]; then
amixer -c 0 sset 'Auto-Mute Mode' Enabled ; echo "1" > $HOME/.local/share/audioctrl-status
if [ -e "${BINDIR}notify-send" ]; then
notify-send " Switched to headphones."
fi
else
amixer -c 0 sset 'Auto-Mute Mode' Disabled ; echo "0" > $HOME/.local/share/audioctrl-status
if [ -e "${BINDIR}notify-send" ]; then
notify-send " Switched to speakers."
fi
fi
}
RUNMIXER() {
if [ "$AUDIO" = "pulse" ]; then
if [ -e "${BINDIR}pulsemixer" ]; then
pulsemixer
elif [ -e "${BINDIR}alsamixer" ]; then
alsamixer
fi
fi
}
AUDIO=$2
case "$2" in
"") AUDIO=alsa
if [ -e "${BINDIR}pulsemixer" ]; then
AUDIO=pulse
else
if [ -e "${BINDIR}pactl" ]; then
AUDIO=pulse
fi
fi
;;
esac
# Update status
UPDATESTATUS() {
pkill -x status && status &
}
case "$1" in
"-mute") MUTE && GETMUTE > /tmp/speedwm-audioctrl-mutestatus ;;
"-remute") remute=true ; MUTE && GETMUTE > /tmp/speedwm-audioctrl-mutestatus ; MUTE && GETMUTE > /tmp/speedwm-audioctrl-mutestatus ; remute="" ; exit 0 ;;
"-raise") RAISE ;;
"-lower") LOWER ;;
"-switch") SWITCH && exit 0 ;;
"-getvol") GETVOL && exit 0 ;;
"-getmute") GETMUTE > /tmp/speedwm-audioctrl-mutestatus && exit 0 ;;
"-getbackend") printf "$AUDIO\n" && exit 0 ;;
"-runmixer") RUNMIXER && exit 0 ;;
"-help") printf "speedwm-audioctrl\n-mute | Toggle mute\n-raise | Raise the volume by 7\n-lower | Lower the volume by 7\n-switch | Toggle output\n-getvol | Get current volume in percentage\n-getmute | Get mute status\n-getbackend | Get audio backend (ALSA, PulseAudio, etc.)\n-runmixer | Run the audio mixer detected on the system\n-remute | Mute and unmute.\n-help | Display this help screen\nNo arguments | Display this help screen\n"; exit 0 ;;
"") $0 -help && exit 0 ;;
esac
#pgrep -x status && UPDATESTATUS
# no longer needed :)

View file

@ -1,145 +0,0 @@
#!/bin/sh
# speedwm-btctrl
# Basic dmenu/other run launcher Bluetooth manager written for speedwm.
# Licensed under GNU GPLv3.
# Check stuff
CHECK() {
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu ;;
esac
BINDIR="$(dirname $(command -v speedwm_status))/"
}
HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
CHECK
# Help
HELP() {
printf "\n1. Turn on your device\n2. Make sure the bluetooth service is running. If it is not, start it.\n3. Press the pair button on your device\n4. Select your device in the list of devices. If it does not show up, select 'Refresh'.\n5. Select 'Pair' and then optionally 'Trust' to save it in the list of devices.\n6. And finally, select 'Connect' to connect the device." | $RUNLAUNCHER -l 12 $GRIDARG $GRIDNUM -p 'How to use'
$0 && exit 0
}
# Enable bluetooth and scan for devices
ENABLE_BT() {
bluetoothctl power on > /dev/null && echo "Power: On"
bluetoothctl scan on & # Start scanning for devices
bluetoothctl devices | grep -q "No default controller" && printf "No Bluetooth controller was found.\n" && exit 1
USEROPT_1="$(printf "$(bluetoothctl devices | cut -d\ -f3-)\n------\nRefresh\nHelp\nExit" | $RUNLAUNCHER -l 12 $GRIDARG $GRIDNUM -p "Select a device")"
# Check what to do
case "$USEROPT_1" in
"") exit 0 ;;
"Refresh") ENABLE_BT ;;
"Exit") exit 0 ;;
"Help") HELP && $0 && exit 0 ;;
esac
SELDEVICE_MAC="$(bluetoothctl devices | grep "$USEROPT_1$" | awk '{ print $2 }')"
echo "$SELDEVICE_MAC"
# Check if a MAC was grabbed
case "$SELDEVICE_MAC" in
"") echo "Could not get MAC" && exit 1 ;;
esac
}
ENABLE_BT
# List options for the device
LIST_OPTIONS() {
USEROPT_2="$(echo -e "-- Options --\nConnect\nDisconnect\n-- Toggle --\nPair\nRemove\nTrust\nUntrust\n--\nExit\nHelp" | sed "s/-e //g" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 20 -p "What do you want to do with this device?" | awk '{ print $1 }')"
}
LIST_OPTIONS
# Trust device
TRUST() {
bluetoothctl trust $SELDEVICE_MAC
}
# Pair device
PAIR() {
bluetoothctl pair $SELDEVICE_MAC
}
# Remove device
REMOVE() {
bluetoothctl remove $SELDEVICE_MAC
}
UNTRUST() {
bluetoothctl untrust $SELDEVICE_MAC
}
# Connect
CONNECT() {
if [ -e "$/tmp/isconnected" ]; then
NOTIFY_ALREADY_CONNECTED && exit 0
fi
bluetoothctl connect $SELDEVICE_MAC
touch /tmp/isconnected
}
# Disconnect
DISCONNECT() {
rm -f /tmp/isconnected
bluetoothctl disconnect $SELDEVICE_MAC
}
# Notification when connecting
NOTIFY_CONNECT() {
notify-send " Connected to ${USEROPT_1}!"
}
# Notification when disconnecting
NOTIFY_DISCONNECT() {
notify-send " Disconnected from ${USEROPT_1}!"
}
# Notification when removing
NOTIFY_REMOVE() {
notify-send " Removed ${USEROPT_1}!"
}
# Notification when already connected
NOTIFY_ALREADY_CONNECTED() {
notify-send " Device $USEROPT_1 is already connected!"
}
# Perform actions as per user choice
PERFORM() {
case "$USEROPT_2" in
"Trust") TRUST && LIST_OPTIONS ;;
"Pair") PAIR && LIST_OPTIONS ;;
"Connect") CONNECT && NOTIFY_CONNECT && LIST_OPTIONS ;;
"Disconnect") DISCONNECT && NOTIFY_DISCONNECT && LIST_OPTIONS ;;
"Untrust") UNTRUST && LIST_OPTIONS ;;
"Remove") REMOVE && NOTIFY_REMOVE && LIST_OPTIONS ;;
"Exit") exit 0 ;;
"Help") HELP ;;
"") exit 0 ;;
esac
}
PERFORM
$0 && exit 0

View file

@ -1,39 +0,0 @@
#!/bin/sh
# speedwm-compatcheck
# compatibility checker used by 'make' when compiling speedwm.
BINDIR="$(dirname $(command -v speedwm_status))/"
# Check if xrdb exists
if [ -e "${BINDIR}xrdb" ]; then
xrdb_exists=true
else
printf "Warning: ${BINDIR}xrdb was not found\n"
fi
# Check if wmctrl exists
if [ -e "${BINDIR}wmctrl" ]; then
wmctrl_exists=true
else
printf "Warning: ${BINDIR}wmctrl was not found\n"
fi
# Check if xwallpaper exists
if [ -e "${BINDIR}xwallpaper" ]; then
xwallpaper_exists=true
else
printf "Warning: ${BINDIR}xwallpaper was not found\n"
fi
# Check if xmodmap exists
if [ -e "${BINDIR}xmodmap" ]; then
xmodmap_exists=true
else
printf "Warning: ${BINDIR}xmodmap was not found\n"
fi
# Check if dmenu exists
command -v dmenu > /dev/null || printf "\nWARNING: dmenu was not found. This means running applications will potentially be very inconvenient. It also means most bundled scripts will NOT work unless modified to work with rofi. See help for more information"
# 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."

View file

@ -1,54 +0,0 @@
#!/bin/sh
# speedwm-core
# This script handles the updating and other things necessary for keybinds.
BINDIR="$(dirname $(command -v speedwm_status))/"
# update
UPDATE_SPEEDWM() {
FAIL_SOURCEDOESNOTEXIST() {
echo "The speedwm source code directory could not be located. This means an automatic update cannot be performed. Clone a new build (instructions on https://speedie.gq/speedwm) and update manually."
exit 1
}
FAIL_NOT_INSTALLED_USING_GIT() {
echo "Your build of speedwm was likely not installed through Git (maybe installed using a tarball?) so therefore the update cannot continue. Clone a new build (instructions on https://speedie.gq/speedwm) and update manually."
exit 1
}
FAIL_NO_AUTH() {
echo "Failed to authenticate."
exit 1
}
SOURCEDIR=$(cat /usr/share/speedwm/sourcedir)
test $SOURCEDIR || FAIL_SOURCEDOESNOTEXIST
# Check if Git is available
if [ -e "${BINDIR}git" ]; then
echo "Git found!"
else
echo "Git was not found, therefore the speedwm update cannot continue." ; exit 1
fi
cd $SOURCEDIR
make patch
make patch_remove
git stash
git pull || FAIL_NOT_INSTALLED_USING_GIT
make patch_install
clear
printf "speedwm requires root permissions briefly to run the following command:\nmake clean install\nEnter your password to allow this.\n"
su -c "make clean install" || FAIL_NO_AUTH
echo 'speedwm has been updated!'
exit 0
}
OPT=$1
case "$OPT" in
"-curl-weather") clear ; curl -s wttr.in | head -n 38 | tail -n 37 && sleep 60 ;;
"-update-speedwm") UPDATE_SPEEDWM ;;
esac

View file

@ -1,17 +0,0 @@
#!/bin/sh
install_xephyr() {
echo "Xephyr not installed, please install it."
exit 1
}
command -v Xephyr > /dev/null || install_xephyr
Xephyr -screen 1024x768 :80 &
sleep 1
export DISPLAY=:80
speedwm_run -f
~/.config/speedwm/swal/swal_wm
killall Xephyr

View file

@ -1,197 +0,0 @@
#!/bin/sh
# speedwm-dfmpeg
# dmenu/other run launcher GUI for recording your screen with ffmpeg
#
# Licensed under MIT, written by speedie
# Modified version for speedwm (available https://speedie.gq/speedwm)
# https://speedie.gq/dmenu-scripts
# speedwm specfic dotfile directory, probably don't change
DOTDIR=$HOME/.config/speedwm-de/dfmpeg
NOMKCONFIG=false # Do not create a config file if this is set to true
# Set runlauncher
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu
esac
# -s flag stops recording
case "$1" in
"-s") pkill -x ffmpeg ; rm /tmp/dfmpeg-recording ; STATUS=idle ; exit ;;
esac
HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
# Write default configuration
defaultConfig() {
RESOLUTION="1920x1080" # The resolution to record in
AUDIO_DEVICE="alsa" # How to capture audio (alsa/pulseaudio)
FRAME_RATE="60" # Frame rate to capture in.
RECORD_DEVICE="x11grab" # Probably do not change.
OUTPUT_PATH="$HOME/Recordings" # Path where videos will be saved.
OUTPUT_FORMAT="mp4" # What format to use
OUTPUT_FILENAME="dfmpeg-output" # File name of the output. Probably don't need to change.
ENCODE=true # Encode or not (true/false)
ENCODE_CODEC=libx264 # Codec to encode in
ENCODE_PRESET=ultrafast # ffmpeg preset. Available options: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow
WH=":0.0" # Width and height, no need to change, defaults should work.
TERM="$TERMINAL" # Terminal to use when editing the configuration file.
EDITOR="vim" # Editor to edit the config file with
MEDIA_PLAYER="mpv" # Media player to play videos in
}
defaultConfig
USECONFIG() {
echo "Using $DOTDIR/config for configuration!" && . $DOTDIR/config
}
MKCONFIG() {
if [ -e "$DOTDIR/config" ]; then
USECONFIG
else
if [ "$NOMKCONFIG" = "false" ]; then
mkdir -p $DOTDIR
printf "RESOLUTION=$RESOLUTION # The resolution to capture in" > $DOTDIR/config
printf "\nAUDIO_DEVICE=$AUDIO_DEVICE # How to capture audio (alsa/pulseaudio)" >> $DOTDIR/config
printf "\nFRAME_RATE=$FRAME_RATE # Frame rate to capture in." >> $DOTDIR/config
printf "\nOUTPUT_PATH=$OUTPUT_PATH # Directory where captures will be saved." >> $DOTDIR/config
printf "\nOUTPUT_FORMAT=$OUTPUT_FORMAT # What format to use" >> $DOTDIR/config
printf "\n#OUTPUT_FILENAME='filename'" >> $DOTDIR/config
printf "\n\nRECORD_DEVICE=$RECORD_DEVICE" >> $DOTDIR/config
printf "\nWH=$WH" >> $DOTDIR/config
printf "\nTERM=$TERMINAL # Terminal to use when editing the config file" >> $DOTDIR/config
printf "\nEDITOR=$EDITOR # Editor to edit the config file" >> $DOTDIR/config
printf "\nMEDIA_PLAYER=$MEDIA_PLAYER # Media player to play videos in" >> $DOTDIR/config
printf "\nENCODE=$ENCODE # Encode or not on 'Stop' (true/false)" >> $DOTDIR/config
printf "\nENCODE_CODEC=$ENCODE_CODEC # Codec to encode in (libx264 is default)" >> $DOTDIR/config
printf "\nENCODE_PRESET=$ENCODE_PRESET # ffmpeg preset. Available options: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow" >> $DOTDIR/config
fi
fi
}
MKCONFIG
OUTPUT_FILENAME="$OUTPUT_PATH/$OUTPUT_FILENAME.$OUTPUT_FORMAT"
# Create the output path if it does not exist
if [ -e "$OUTPUT_PATH" ]; then
a=$a
else
mkdir -p $OUTPUT_PATH
fi
# Check if we should encode the video or not.
if [ "$ENCODE" = "false" ]; then
startrec="ffmpeg -f $RECORD_DEVICE -s $RESOLUTION -i $WH -f $AUDIO_DEVICE -r $FRAME_RATE -i default $OUTPUT_FILENAME"
startrec_no_audio="ffmpeg -y -f $RECORD_DEVICE -s $RESOLUTION -r $FRAME_RATE -i $WH $OUTPUT_FILENAME"
else
startrec="ffmpeg -y -f x11grab -framerate $FRAME_RATE -s $RESOLUTION -i $WH -f $AUDIO_DEVICE -i default -r 30 -c:v $ENCODE_CODEC -crf 0 -preset ultrafast -c:a aac $OUTPUT_FILENAME"
startrec_no_audio="ffmpeg -y -f x11grab -framerate $FRAME_RATE -s $RESOLUTION -i $WH -r 30 -c:v $ENCODE_CODEC -crf 0 -preset ultrafast -c:a aac $OUTPUT_FILENAME"
touch /tmp/isencoding
echo $ENCODE_CODEC > /tmp/encoding-codec
fi
# Call this function to encode a video manually.
# /tmp/rec.$OUTPUT_FORMAT must be the file. Consider copying it there and then copying it back.
encode() {
if [ "$ENCODE" = "true" ]; then
cp $(cat /tmp/outputfilename) /tmp/rec.$OUTPUT_FORMAT
ffmpeg -i /tmp/rec.$OUTPUT_FORMAT -c:v $ENCODE_CODEC -preset $ENCODE_PRESET -threads 0 -b:v -pass 1 -f $OUTPUT_FORMAT -qp 0
cp /tmp/rec.$OUTPUT_FORMAT $(cat /tmp/outputfilename)
rm -f "/tmp/rec.$OUTPUT_FORMAT"
fi
}
# Hardcoded version number
dfmpeg_ver="2022-08-06-r1"
about_screen="dfmpeg $dfmpeg_ver."
# About screen text
about_screen_2="Licensed under MIT, written by speedie.gq and jornmann."
about_screen_3="Modified for https://speedie.gq/speedwm"
about_screen_4="https://speedie.gq/dmenu-scripts"
# Conversion function
convert() {
# Convert mp4 to mp3
mp42mp3() {
COPT=$(printf 'Enter a path\n------\nExit' | $RUNLAUNCHER -l 3 -p 'Convert which file?')
case "$COPT" in
"Enter a path") exit 0 ;;
"------") exit 0 ;;
"Exit") exit 0 ;;
"") exit 0 ;;
esac
echo $COPT | grep ".mp4" && ffmpeg -i $COPT -vn $(echo $COPT | sed "s/.mp4/.mp3/g")
}
case "$(printf '.mp4 to .mp3\n------\n..\nExit' | $RUNLAUNCHER -l 40 -p 'Convertion options')" in
".mp4 to .mp3") mp42mp3 ;;
"Exit") exit 0 ;;
"------") exit 0 ;;
"..") $0 && exit 0 ;;
esac
}
encodeopts() {
case "$(printf 'Encode last recording\nEncode video\n------\n..\nExit' | $RUNLAUNCHER -l 40 -p 'Encoding options')" in
"Encode last recording") encode ; exit 0 ;;
"Encode video") echo "$(echo "" | $RUNLAUNCHER -l 1 $GRIDARG $GRIDNUM -p "What file do you want to encode?")" > /tmp/outputfilename && encode ; exit 0 ;;
"------") exit 0 ;;
"Exit") exit 0 ;;
"..") $0 && exit 0 ;;
"") exit 0 ;;
esac
}
# More options
MORE_OPTIONS() {
case "$(printf 'Encode\nConvert\nConfigure\n------\n..\nExit' | $RUNLAUNCHER -l 40 -p 'More options')" in
"Encode last recording") encode ; exit 0 ;;
"Encode video") echo "$(echo "" | $RUNLAUNCHER -l 1 $GRIDARG $GRIDNUM -p "What file do you want to encode?")" > /tmp/outputfilename && encode ; exit 0 ;;
"Encode") encodeopts ; exit 0 ;;
"Configure") $TERM $EDITOR $DOTDIR/config ; exit 0 ;;
"Convert") convert ; exit 0 ;;
"") exit 0 ;;
"..") $0 && exit 0 ;;
"------") exit 0 ;;
esac
}
case "$(printf 'Start\nStop\nStart without audio\nPlay last\n------\nMore options\nAbout\nExit' | $RUNLAUNCHER -l 40 -p 'Record your screen:')" in
"Exit") STATUS=idle && exit 0 ;;
"Start") touch /tmp/isaudio ; echo "$OUTPUT_FILENAME" > /tmp/outputfilename && STATUS=recording && touch /tmp/dfmpeg-recording
$startrec && exit 0 ;;
"Stop") pkill -x ffmpeg ; rm /tmp/dfmpeg-recording ; STATUS=idle ;;
"Start without audio") echo "$OUTPUT_FILENAME" > /tmp/outputfilename && STATUS=recording && touch /tmp/dfmpeg-recording
$startrec_no_audio && exit 0 ;;
"Play last") DFMPEG_STATUS=idle && $MEDIA_PLAYER $(cat /tmp/outputfilename) && exit 0 ;;
"More options") MORE_OPTIONS && exit 0 ;;
"") exit 0 ;;
"About")
echo $about_screen > /tmp/dfmpeg_about
echo $about_screen_2 >> /tmp/dfmpeg_about
echo $about_screen_3 >> /tmp/dfmpeg_about
echo $about_screen_4 >> /tmp/dfmpeg_about
cat /tmp/dfmpeg_about | $RUNLAUNCHER -l 40 $GRIDARG $GRIDNUM
;;
esac
exit 0 # This fixes a small bug.

View file

@ -50,8 +50,7 @@ ${DOCDIR}/${PREFIX}doc-06 \
${DOCDIR}/${PREFIX}doc-07 \ ${DOCDIR}/${PREFIX}doc-07 \
${DOCDIR}/${PREFIX}example.signal \ ${DOCDIR}/${PREFIX}example.signal \
${DOCDIR}/${PREFIX}doc-08 \ ${DOCDIR}/${PREFIX}doc-08 \
${DOCDIR}/${PREFIX}doc-09 \ ${DOCDIR}/${PREFIX}doc-09 | grep -v "!!" > /tmp/${PREFIX}doc
${DOCDIR}/${PREFIX}doc-10 | grep -v "!!" > /tmp/${PREFIX}doc
case "$ARG1" in case "$ARG1" in
"-w") tail -n $(expr $(cat /tmp/${PREFIX}doc | wc -l) "-" 1) /tmp/${PREFIX}doc > ../readme ;; "-w") tail -n $(expr $(cat /tmp/${PREFIX}doc | wc -l) "-" 1) /tmp/${PREFIX}doc > ../readme ;;
@ -74,8 +73,7 @@ case "$ARG1" in
sed "s|-- .Xresources and Pywal --|## .Xresources and Pywal|g" | \ sed "s|-- .Xresources and Pywal --|## .Xresources and Pywal|g" | \
sed "s|-- Signals --|## Signals|g" | \ sed "s|-- Signals --|## Signals|g" | \
sed "s|-- Additional note on autostart --|## Additional note on autostart|g" | \ sed "s|-- Additional note on autostart --|## Additional note on autostart|g" | \
sed "s|-- Maintaining settings easily --|## Maintaining settings easily|g" | \ sed "s|-- Maintaining settings easily --|## Maintaining settings easily|g" > ../README.md ;;
sed "s|-- Switching run launcher --|## Switching run launcher|g" > ../README.md ;;
"-whtml") tail -n $(expr $(cat /tmp/${PREFIX}doc | wc -l) "-" 1) /tmp/${PREFIX}doc | \ "-whtml") tail -n $(expr $(cat /tmp/${PREFIX}doc | wc -l) "-" 1) /tmp/${PREFIX}doc | \
sed "s|-- speedwm --|# speedwm|g" | \ sed "s|-- speedwm --|# speedwm|g" | \
sed "s|-- What is speedwm? --|## What is speedwm?|g" | \ sed "s|-- What is speedwm? --|## What is speedwm?|g" | \
@ -95,8 +93,7 @@ case "$ARG1" in
sed "s|-- .Xresources and Pywal --|## .Xresources and Pywal|g" | \ sed "s|-- .Xresources and Pywal --|## .Xresources and Pywal|g" | \
sed "s|-- Signals --|## Signals|g" | \ sed "s|-- Signals --|## Signals|g" | \
sed "s|-- Maintaining settings easily --|## Maintaining settings easily|g" | \ sed "s|-- Maintaining settings easily --|## Maintaining settings easily|g" | \
sed "s|-- Additional note on autostart --|## Additional note on autostart|g" | \ sed "s|-- Additional note on autostart --|## Additional note on autostart|g" > ../README.md
sed "s|-- Switching run launcher --|## Switching run launcher|g" > ../README.md
markdown ../README.md > ../readme.html || printf "\nmarkdown-to-html not found, install using:\nnpm install markdown-to-html -g\n" && exit 1 ;; markdown ../README.md > ../readme.html || printf "\nmarkdown-to-html not found, install using:\nnpm install markdown-to-html -g\n" && exit 1 ;;
"-whtml-wtemplate") test ../readme.html && cat ../docs/speedwm.html.template.1 ../readme.html ../docs/speedwm.html.template.2 >> ../speedwm.html && exit 0 "-whtml-wtemplate") test ../readme.html && cat ../docs/speedwm.html.template.1 ../readme.html ../docs/speedwm.html.template.2 >> ../speedwm.html && exit 0
printf "\nYou need to $0 -whtml first." ; exit 1 ;; printf "\nYou need to $0 -whtml first." ; exit 1 ;;

View file

@ -1,129 +0,0 @@
#!/bin/sh
# speedwm-netctrl
# dmenu/other run launcher GUI for iwd
# Licensed under the GNU GPLv3 free software license.
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu ;;
esac
BINDIR="$(dirname $(command -v speedwm_status))/"
command -v iwctl > /dev/null || exit 1
HAVE_GRID="true"
HAVE_PASSWORD="false"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
grep -q HAVE_PASSWORD $HOME/.config/speedwm-de/global/config || printf "\nHAVE_PASSWORD=$HAVE_PASSWORD # Whether or not to use the Password argument if a script requests it. If you do not have the dmenu password patch, set this to false. Doing so will disable password prompts." >> $HOME/.config/speedwm-de/global/config
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
printf "\nHAVE_PASSWORD=$HAVE_PASSWORD # Whether or not to use the Password argument if a script requests it. If you do not have the dmenu password patch, set this to false. Doing so will disable password prompts." >> $HOME/.config/speedwm-de/global/config
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
SHOW_PASSWORD="true"
test ${BINDIR}iwctl || exit 0
if [ -e "$HOME/.config/speedwm-de/netctrl/config" ]; then
. $HOME/.config/speedwm-de/netctrl/config
else
mkdir -p $HOME/.config/speedwm-de/netctrl
printf "SHOW_PASSWORD=$SHOW_PASSWORD # Show password when entering it or not? Requires the 'password' dmenu patch. If you do not have it, you can get my build. You also need to enable it in $HOME/.config/speedwm-de/global/config. (true/false)" > $HOME/.config/speedwm-de/netctrl/config
fi
if [ "$SHOW_PASSWORD" = "false" ]; then
if [ "$HAVE_PASSWORD" = "true" ]; then
PASS_ARG="-P"
fi
fi
# Get the device used to connect.
getdevice() {
seldevice=$1
if [ -e "$HOME/.local/share/seldevice" ]; then
seldevice=$(cat $HOME/.local/share/seldevice)
else
case "$1" in
"") devices="$(printf "\n$(ip link)" | awk '{ print $2 }' | awk 'NR%2==0' | sed "s/://g")"
seldevice=$(echo $devices | sed 's/ /\n/g' | $RUNLAUNCHER -p "What device do you want to connect with?" -l 10 $GRIDARG $GRIDNUM) && echo $seldevice > $HOME/.local/share/seldevice ;;
esac
fi
case "$seldevice" in
"") exit 0 ;;
esac
}
# connect to wifi
connectwifi() {
# if args aren't disconnect, scan for networks
# if it is disconnect, disconnect
if [ "$INARGS" != "disconnect" ]; then
iwctl station $seldevice scan
network="$(printf "$(iwctl station $seldevice get-networks | sed -n 6,20p | sed "s|>||g" | awk '{ print $1 }')\nDisconnect\n------\nExit" | sed "s| |No networks found|g" | $RUNLAUNCHER -l 10 $GRIDARG $GRIDNUM -p "Select a network to connect to" | sed "s|------||g" | sed "s|No networks found| |g")"
case "$network" in
"") exit 0 ;;
"Disconnect") disconnect=true ;;
"Exit") exit 0 ;;
esac
else
disconnect=true
fi
if [ "$disconnect" != "true" ]; then
iwctl station $seldevice get-networks | grep "$network" > /dev/null || exit 1
connect_pass() {
PASSPHRASE=$(printf "\n" | $RUNLAUNCHER -p "This network is protected. Enter the passphrase." -l 1 $GRIDARG $GRIDNUM $PASS_ARG)
case "$PASSPHRASE" in
"") exit 0 ;;
esac
printf "$network\n" >> $HOME/.local/share/networks
iwctl station $seldevice connect $network -P $PASSPHRASE || connect_pass
if [ -e "${BINDIR}notify-send" ]; then
notify-send " Connected to $network!"
fi
exit 0
}
connect_no_pass() {
iwctl station $seldevice connect $network || exit 0
if [ -e "${BINDIR}notify-send" ]; then
notify-send " Connected to $network!"
fi
exit 0
}
fi
disconnect() {
iwctl station $seldevice disconnect
if [ -e "${BINDIR}notify-send" ]; then
notify-send " Disconnected from the network!"
fi
exit 0
}
if [ "$disconnect" != "true" ]; then
grep $network $HOME/.local/share/networks && connect_no_pass && exit 0
iwctl station $seldevice get-networks | grep psk && connect_pass && exit 0
else
disconnect
fi
}
export INARGS="$1"
getdevice && connectwifi
pgrep -x status > /dev/null && pkill status && status &

View file

@ -1,145 +0,0 @@
#!/bin/sh
# speedwm-screenshotutil
# Built in screenshot utility for my build of speedwm
# Requires curl, maim and xclip.
#
# curl snippet by nezbednik, thank you!
rm -f /tmp/screenshot*
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu ;;
esac
BINDIR="$(dirname $(command -v speedwm_status))/"
HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
EXPORTDIR=$HOME/.config/speedwm-de/screenshotutil
mkdir -p $EXPORTDIR
# Config
SHOWCURSOR="true" # Show cursor or not (true/false)
DEFAULTSCREENSHOTPATH=$HOME/Screenshots # Default screenshot path
FORMAT="+%T_%D" # Screenshot format
if [ -e "$EXPORTDIR/config" ]; then
. $EXPORTDIR/config
else
printf "SHOWCURSOR=$SHOWCURSOR # Show cursor or not (true/false)" > $EXPORTDIR/config
printf "\nDEFAULTSCREENSHOTPATH=$DEFAULTSCREENSHOTPATH # Where screenshots are saved\n" >> $EXPORTDIR/config
echo "FORMAT='$FORMAT' # Where screenshots are saved. : and / will be replaced with _ and nothing respectively." >> $EXPORTDIR/config
fi
case "$SHOWCURSOR" in
"true") ARG2="" ;;
"false") ARG2=u ;;
esac
# Help argument action
HELP() {
printf "speedwm-screenshotutil\n-t | Wait <second argument> seconds and then take the screenshot."
printf "\n-f | Take a full screen screenshot instead of selecting manually."
printf "\n-s | Take a screenshot, allowing the user to select a section manually."
printf "\n-o | Select a file and allow the user to perform actions with it."
printf "\n-tf | Wait <second argument> seconds and then take a full screen screenshot."
printf "\n-h | View this help screen"
printf "\nNo arguments will print this screen.\n"
}
# Sleep argument (-t)
if [ "$1" = "-t" ]; then
sleep $2 && maim -s${ARG2}B > /tmp/screenshot-$DATE || exit 0
fi
# Open argument (-o)
if [ "$1" = "-o" ]; then
cat $2 > /tmp/screenshot-$DATE
fi
# Sleep and full argument (-tf)
if [ "$1" = "-tf" ]; then
sleep $2 && maim -${ARG2}B > /tmp/screenshot-$DATE || exit 0
elif [ "$1" = "-ft" ]; then
sleep $2 && maim -${ARG2}B > /tmp/screenshot-$DATE || exit 0
fi
# Full argument (-f)
if [ "$1" = "" ]; then
HELP ; exit 0
else
if [ "$1" = "-f" ]; then
if [ -e "/tmp/screenshot-$DATE" ]; then
exists=true
else
maim -${ARG2}B > /tmp/screenshot-$DATE || exit 0
fi
fi
if [ "$1" = "-s" ]; then
if [ -e "/tmp/screenshot-$DATE" ]; then
exists=true
else
maim -s${ARG2}B > /tmp/screenshot-$DATE || exit 0
fi
fi
fi
# Help argument (-h)
if [ "$1" = "-h" ]; then
HELP ; exit 0
fi
# User action
if [ -e "/tmp/screenshot-$DATE" ]; then
U_INPUT="$(printf "Image\nURL\nSave" | $RUNLAUNCHER -l 3 -p "Copy to clipboard as an: ")"
else
exit 0
fi
# Send notification for URL
SENDNOTIF_URL() {
if [ -e "${BINDIR}notify-send" ]; then
notify-send "Screenshot copied to clipboard."
fi
}
# Send notifcation for local image save
SENDNOTIF_SAVE() {
if [ -e "${BINDIR}notify-send" ]; then
notify-send "Screenshot saved to $SAVEDIR."
fi
}
# Send notification for image copied to clipboard
SENDNOTIF_IMG() {
if [ -e "${BINDIR}notify-send" ]; then
notify-send "Screenshot copied to clipboard."
fi
}
mkdir -p $DEFAULTSCREENSHOTPATH
# Perform actions based on user input
case "$U_INPUT" in
"Image") cat /tmp/screenshot-$DATE | xclip -selection clipboard -t image/png && SENDNOTIF_IMG ;;
"URL") printf "\n" | xclip -selection clipboard && curl -s -F source=@"/tmp/screenshot-$DATE" -F "type=file" -F "action=upload" "https://imgbb.com/json" | sed "s/\\\\//g; s/\"/\\n/g" | grep -m 1 -A 2 url | tail -n 1 | xclip -selection clipboard && SENDNOTIF_URL ;;
"Save") SAVEDIR=$(printf "$DEFAULTSCREENSHOTPATH/screenshot-$(date "$FORMAT" | sed "s|:|-|g" | sed "s|/||g").png" | $RUNLAUNCHER -l 1 $GRIDARG $GRIDNUM -p "Where do you want to save it? (Including filename)") && cat /tmp/screenshot-$DATE > $SAVEDIR && SENDNOTIF_SAVE ;;
esac
rm -f /tmp/screenshot* # Remove the screenshots

View file

@ -1,173 +0,0 @@
#!/bin/sh
# speedwm-shutdwon
# This simple script uses $RUNLAUNCHER to ask the user what action they want to perform.
#
# NOTE: You must either permit nopass for poweroff and reboot commands for your user or simply enable nopass entirely!!
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu ;;
esac
case "$TERMINAL" in
"") TERMINAL=st ;;
esac
HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
BINDIR="$(dirname $(command -v speedwm_status))/"
EXPORTDIR=$HOME/.config/speedwm-de/powermenu
mkdir -p $EXPORTDIR
command -v sudo > /dev/null && PERM=sudo
command -v doas > /dev/null && PERM=doas
command -v rootdo > /dev/null && PERM=rootdo
case "$PERM" in
"") PERM=su ;;
esac
COL_NORMAL_TEXT_NORMAL="#ffffff"
COL_NORMAL_TEXT_SELECTED="#ffffff"
COL_NORMAL_BACKGROUND_NORMAL="#333333"
COL_NORMAL_BACKGROUND_SELECTED="#222222"
COL_WARNING_TEXT_NORMAL="#ffffff"
COL_WARNING_TEXT_SELECTED="#000000"
COL_WARNING_BACKGROUND_NORMAL="#DC143C"
COL_WARNING_BACKGROUND_SELECTED="#8b0000"
USEDEFAULTCOLORS=false
LOCK_TEXT=""
# Load config if available and override settings
if [ -e "$EXPORTDIR/config" ]; then
. $EXPORTDIR/config
else
printf "# Colors for the prompt. Replace the color values with 'dmenu' for regular default colors." > $EXPORTDIR/config
printf "\nCOL_NORMAL_TEXT_NORMAL=$COL_NORMAL_TEXT_NORMAL # Text color for not selected options (Regular prompt)" >> $EXPORTDIR/config
printf "\nCOL_NORMAL_TEXT_SELECTED=$COL_NORMAL_TEXT_SELECTED # Text color for selected option (Regular prompt)" >> $EXPORTDIR/config
printf "\nCOL_NORMAL_BACKGROUND_NORMAL=$COL_NORMAL_BACKGROUND_NORMAL # Background color for not selected options (Regular prompt)" >> $EXPORTDIR/config
printf "\nCOL_NORMAL_BACKGROUND_SELECTED=$COL_NORMAL_BACKGROUND_SELECTED # Background color for selected option (Regular prompt)" >> $EXPORTDIR/config
printf "\nCOL_WARNING_TEXT_NORMAL=$COL_WARNING_TEXT_NORMAL # Text color for not selected options (Warning prompt)" >> $EXPORTDIR/config
printf "\nCOL_WARNING_TEXT_SELECTED=$COL_WARNING_TEXT_SELECTED # Text color for selected option (Warning prompt)" >> $EXPORTDIR/config
printf "\nCOL_WARNING_BACKGROUND_NORMAL=$COL_WARNING_BACKGROUND_NORMAL # Background color for not selected options (Warning prompt)" >> $EXPORTDIR/config
printf "\nCOL_WARNING_BACKGROUND_SELECTED=$COL_WARNING_BACKGROUND_SELECTED # Background color for selected option (Warning prompt)" >> $EXPORTDIR/config
printf "\nPERM=$PERM # Root access tool (sudo, doas, etc.). Must support nopass for poweroff and reboot commands." >> $EXPORTDIR/config
printf "\nUSEDEFAULTCOLORS=$USEDEFAULTCOLORS # Use $RUNLAUNCHER colors instead of custom ones (true/false)" >> $EXPORTDIR/config
printf "\nLOCK_TEXT=$LOCK_TEXT # Text to display on the lock screen. Only works with slock and requires the message patch." >> $EXPORTDIR/config
fi
case "$LOCK_TEXT" in
"") MESSAGEFLAG="" ;;
esac
SBFLAG="-sb"
SFFLAG="-sf"
NBFLAG="-nb"
NFFLAG="-nf"
if [ "$USEDEFAULTCOLORS" = "true" ]; then
SBFLAG=""
NBFLAG=""
SFFLAG=""
NFFLAG=""
COL_NORMAL_BACKGROUND_SELECTED=""
COL_NORMAL_BACKGROUND_NORMAL=""
COL_NORMAL_TEXT_SELECTED=""
COL_NORMAL_TEXT_NORMAL=""
COL_WARNING_BACKGROUND_NORMAL=""
COL_WARNING_TEXT_SELECTED=""
COL_WARNING_TEXT_NORMAL=""
COL_WARNING_BACKGROUND_SELECTED=""
fi
# Standard Background
if [ "$COL_NORMAL_BACKGROUND_SELECTED" = "dmenu" ]; then
SBFLAG=""
COL_NORMAL_BACKGROUND_SELECTED=""
fi
# Normal Background
if [ "$COL_NORMAL_BACKGROUND_NORMAL" = "dmenu" ]; then
NBFLAG=""
COL_NORMAL_BACKGROUND_NORMAL=""
fi
# Standard Background
if [ "$COL_NORMAL_TEXT_SELECTED" = "dmenu" ]; then
SFFLAG=""
COL_NORMAL_TEXT_SELECTED=""
fi
# Normal Text
if [ "$COL_NORMAL_TEXT_NORMAL" = "dmenu" ]; then
NFFLAG=""
COL_NORMAL_TEXT_NORMAL=""
fi
# Standard Background
if [ "$COL_WARNING_BACKGROUND_SELECTED" = "dmenu" ]; then
SBFLAG=""
COL_WARNING_BACKGROUND_SELECTED=""
fi
# Normal Background
if [ "$COL_WARNING_BACKGROUND_NORMAL" = "dmenu" ]; then
NBFLAG=""
COL_WARNING_BACKGROUND_NORMAL=""
fi
# Standard Background
if [ "$COL_WARNING_TEXT_SELECTED" = "dmenu" ]; then
SFFLAG=""
COL_WARNING_TEXT_SELECTED=""
fi
# Normal Text
if [ "$COL_WARNING_TEXT_NORMAL" = "dmenu" ]; then
NFFLAG=""
COL_WARNING_TEXT_NORMAL=""
fi
MOREOPTS() {
USER_OPT3=$(printf "Restart speedwm\nEnd task\nspeedwm command\nUpdate speedwm\n.." | $RUNLAUNCHER -l 4 $GRIDARG $GRIDNUM -p "What do you want to do?" $NBFLAG $COL_NORMAL_BACKGROUND_NORMAL $SBFLAG $COL_NORMAL_BACKGROUND_SELECTED $NFFLAG $COL_NORMAL_TEXT_NORMAL $SFFLAG $COL_NORMAL_TEXT_SELECTED)
case "$USER_OPT3" in
"") exit 0 ;;
"Restart speedwm") speedwm_run -r && exit 0 ;;
"End task") ENDTASK=$(printf "\n" | $RUNLAUNCHER -l 1 -p "What task to end?" $NBFLAG $COL_NORMAL_BACKGROUND_NORMAL $SBFLAG $COL_NORMAL_BACKGROUND_SELECTED $NFFLAG $COL_NORMAL_TEXT_NORMAL $SFFLAG $COL_NORMAL_TEXT_SELECTED) && pkill $ENDTASK && exit 0 ;;
"speedwm command") speedwm-utils && exit 0 ;;
"Update speedwm") $TERMINAL -e speedwm-core -update-speedwm ; exit 0 ;;
"..") $0 && exit 0 ;;
esac
}
USER_OPT1=$(printf "Shutdown\nReboot\nExit\nLock\nMore" | $RUNLAUNCHER -l 5 -p "What do you want to do?" $NBFLAG $COL_NORMAL_BACKGROUND_NORMAL $SBFLAG $COL_NORMAL_BACKGROUND_SELECTED $NFFLAG $COL_NORMAL_TEXT_NORMAL $SFFLAG $COL_NORMAL_TEXT_SELECTED)
case "$USER_OPT1" in
"Shutdown") CMD="$PERM poweroff" ;;
"Reboot") CMD="$PERM reboot" ;;
"Exit") exit 0 ;;
"Lock") CMD="slock $MESSAGEFLAG '$LOCK_TEXT'" ;;
"More") MOREOPTS ;;
"") exit 0 ;;
esac
USER_OPT2=$(printf "Yes\nNo" | $RUNLAUNCHER -l 2 -p "Are you sure?" $NBFLAG "$COL_WARNING_BACKGROUND_NORMAL" $SBFLAG "$COL_WARNING_BACKGROUND_SELECTED" $NFFLAG "$COL_WARNING_TEXT_NORMAL" $SFFLAG "$COL_WARNING_TEXT_SELECTED")
case "$USER_OPT2" in
"Yes") $CMD ;;
"No") exit 0 ;;
"") exit 0 ;;
esac

View file

@ -13,17 +13,19 @@
# CONFIG # CONFIG
# This is the configuration for the status bar # This is the configuration for the status bar
# #
# I highly recommend editing ~/.config/speedwm-de/status/config instead though # I highly recommend editing ~/.config/speedwm/status/config instead though
# All settings can be changed there. Otherwise, carefully edit the file and recompile speedwm! # All settings can be changed there. Otherwise, carefully edit the file and recompile speedwm!
if [ ! -e "$HOME/.config/speedwm-de/status/config" ]; then if [ ! -e "$HOME/.config/speedwm/statusrc" ]; then
cat <<EOF > ~/.config/speedwm-de/status/config cat <<CONFIG > ~/.config/speedwm/statusrc
# status configuration # speedwm status configuration
#
# NOTE: Should be configured in /bin/sh compatible syntax. For best compatibility, I suggest that you only use POSIX compliant shell. No bash, no fish and no zsh. Of course if /bin/sh is Bash then you don't strictly NEED to keep it POSIX compliant.
# General settings # General settings
REFRESHDELAY=1 # How long delay in seconds between each reload (num) 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 DATEBINDIR="/bin/" # Directory where your 'date' binary is. Default should be fine for most people
SETMETHOD="speedwm -s" # Method used to set the status bar SETMETHOD="speedwm -s" # Method used to set the status bar. speedwm -s will set the status so only change this if you use this status bar with dwm or awesome.
SEPARATOR="❰" # Separator to use. Alternative separators: "❰", "<", "|" SEPARATOR="❰" # Separator to use. Alternative separators: "❰", "<", "|"
COLORFG=true # Color foreground (true/false) COLORFG=true # Color foreground (true/false)
COLORBG=false # Color background (true/false) COLORBG=false # Color background (true/false)
@ -122,10 +124,10 @@ ITEM11_SHOW_CHARGING_STATUS=true # Show 'Charging', 'Not charging' or 'Fully cha
ITEM11_DISCHARGING_TEXT="Not charging" # Text when not charging (text) ITEM11_DISCHARGING_TEXT="Not charging" # Text when not charging (text)
ITEM11_CHARGING_TEXT="Charging" # Text when charging (text) ITEM11_CHARGING_TEXT="Charging" # Text when charging (text)
ITEM11_FULL_TEXT="Fully charged" # Text when fully charged (text) ITEM11_FULL_TEXT="Fully charged" # Text when fully charged (text)
EOF CONFIG
. $HOME/.config/speedwm-de/status/config && echo "Created configuration file" . $HOME/.config/speedwm/statusrc && echo "Created configuration file"
else else
. $HOME/.config/speedwm-de/status/config && echo "Loaded configuration file" . $HOME/.config/speedwm/statusrc && echo "Loaded configuration file"
fi fi
######################################################################### #########################################################################
@ -198,7 +200,7 @@ rm -f /tmp/itest
rm -f /tmp/wstatus rm -f /tmp/wstatus
rm -f /tmp/iscelsius rm -f /tmp/iscelsius
mkdir -p $HOME/.config/speedwm-de/status mkdir -p $HOME/.config/speedwm/status
printf "Loaded $0 $VER\n---\n" printf "Loaded $0 $VER\n---\n"

View file

@ -1,357 +0,0 @@
#!/bin/sh
# speedwm-swal
# wallpaper utility written for speedwm.
# Licensed under the GNU GPLv3 free software license.
ARGS="$@"
ARG1="$1"
# Default configuration, should be fine for most users.
SWAL_DEFAULT_CONFIG()
{
SWAL_WALLPAPERDIR=$HOME/Wallpapers
SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu ;;
esac
SWAL_OPT=xwallpaper
SWAL_BINDIR=$BINDIR # compatibility with old config files
SWAL_EXPORTDIR=$HOME/.config/speedwm-de/swal # Config directory
SWAL_IMAGE_VIEWER="sxiv -to" # Image viewer to use (<char>)
SWAL_ASK_WAL=false # Ask whether or not to use Pywal if possible (true/false)
SWAL_RANDOMIZE=false # Select a random wallpaper on login
}
# By default, assume we have grid.
HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
echo "Loaded configuration!"
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
fi
# Grid number is one
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
# Grid argument
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
# Create the configuration
SWAL_MKCONFIG() {
mkdir -p $SWAL_EXPORTDIR
touch $SWAL_EXPORTDIR/config
SWAL_ASK_WAL_NEW=$SWAL_ASK_WAL
SWAL_WALLPAPERDIR_NEW=$SWAL_WALLPAPERDIR
SWAL_CHANGE_WALLPAPERDIR() {
SWAL_WALLPAPERDIR_NEW=$(printf "Your wallpaper directory" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "Where are all your wallpapers stored?" -l 1)
}
SWAL_CHANGE_ASK_WAL() {
command -v wal > /dev/null && SWAL_ASK_WAL_NEW=$(printf "Yes\nNo" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "Ask whether or not to use Pywal?" -l 2 | sed "s|No|false|g" | sed "s|Yes|true|g")
}
SWAL_CHANGE_IMAGE_VIEWER() {
SWAL_IMAGE_VIEWER=$(printf "" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "What image viewer do you want to use for previews?" -l 1)
}
SWAL_CHANGE_RANDOMIZE() {
SWAL_RANDOMIZE=$(printf "Yes\nNo" | $RUNLAUNCHER $GRIDARG $GRIDNUM -p "Pick a random wallpaper on login?" -l 2 | sed "s|No|false|g" | sed "s|Yes|true|g")
}
USER_OPT_ACTION=$(printf "Wallpaper directory\nPywal\nImage Viewer\nRandomize\n------\nExit" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 10 -p "What setting do you want to change?")
case "$USER_OPT_ACTION" in
"") $0 && exit 0 ;;
"Wallpaper directory") SWAL_CHANGE_WALLPAPERDIR && CHANGED=true ;;
"Pywal") SWAL_CHANGE_ASK_WAL && CHANGED=true ;;
"Image Viewer") SWAL_CHANGE_IMAGE_VIEWER && CHANGED=true ;;
"Randomize") SWAL_CHANGE_RANDOMIZE && CHANGED=true ;;
"Exit") exit 0 ;;
"------") $0 && exit 0 ;;
esac
case "$CHANGED" in
"") $0 && exit 0 ;;
esac
case "$SWAL_ASK_WAL_NEW" in
"true") ASKED=true ;;
"false") ASKED=true ;;
esac
if [ "$ASKED" = "" ]; then
$0 && exit 0
fi
printf "SWAL_WALLPAPERDIR=$SWAL_WALLPAPERDIR_NEW" > $SWAL_EXPORTDIR/config
printf "\nRUNLAUNCHER=$RUNLAUNCHER" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_OPT=$SWAL_OPT" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_EXPORTDIR=$SWAL_EXPORTDIR" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_IMAGE_VIEWER='$SWAL_IMAGE_VIEWER'" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_ASK_WAL=$SWAL_ASK_WAL_NEW" >> $SWAL_EXPORTDIR/config
printf "\nSWAL_RANDOMIZE=$SWAL_RANDOMIZE" >> $SWAL_EXPORTDIR/config
}
# Binary directory
BINDIR="$(dirname $(command -v speedwm_status))/"
SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR
# Source things
SWAL_SOURCE()
{
ls "$SWAL_EXPORTDIR/config" || SWAL_MKCONFIG
. "$SWAL_EXPORTDIR/config" || rm -f "$SWAL_EXPORTDIR/config"
}
# Set image viewer if none is specified.
SWAL_CHECK()
{
if [ "$SWAL_IMAGE_VIEWER" = "" ]; then
if [ -e "${BINDIR}feh" ]; then
SWAL_IMAGE_VIEWER=feh
elif [ -e "${BINDIR}sxiv" ]; then
SWAL_IMAGE_VIEWER=sxiv
fi
fi
command -v xwallpaper > /dev/null || SWAL_DIE
}
# Die
SWAL_DIE()
{
SWAL_EXIT=1 && exit 1
}
# Print usage.
SWAL_USAGE() {
echo "To set a wallpaper, you must create a configuration. To do this, select 'Options' in the menu and set all the options to your liking."
echo "The image viewer must be set to an image viewer that supports printing the filename to stdout. If you use sxiv, set the image viewer to 'sxiv -o'."
echo "In the case of sxiv, This means you can press 'm' when previewing an image to select it and then set it."
echo "Once you've selected your image using the method you prefer, select how you want to set it."
echo "Then your pywal colors will reload, and the wallpaper will be set."
echo "For more information, see speedwm-help -a."
}
# Select wallpaper
SWAL_SELWALLPAPER()
{
if [ "$ARG1" = "" ]; then
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
}
# Set the type/check what was selected.
SWAL_SETTYPE()
{
case "$ARG1" in
"--randomize") SWAL_SELWALLPAPER="Random" ;;
"--previous") SWAL_SELWALLPAPER="Previous" ;;
esac
case "$SWAL_SELWALLPAPER" in
"Options") SWAL_MKCONFIG && $0 $@ && exit 0 ;;
"") $0 && exit 0 ;;
"Favorites") SWAL_SELWALLPAPER="$(printf "$(cat $SWAL_EXPORTDIR/favorites.filename)\n------\n..\nClear\n\nExit" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 100 -p "What wallpaper would you like to set?")" ; FAVORITES=true ;;
"Add used wallpaper to favorites") echo "$(readlink "$SWAL_EXPORTDIR/CurrentWallpaper")" >> $SWAL_EXPORTDIR/favorites ; echo "$(basename "$(readlink "$SWAL_EXPORTDIR/CurrentWallpaper")")" >> $SWAL_EXPORTDIR/favorites.filename && $0 && exit 0 ;;
"Preview") SWAL_PREVIEWIMG="$($SWAL_IMAGE_VIEWER "$SWAL_WALLPAPERDIR"/*)" ;;
"..") cd "$SWAL_WALLPAPERDIR/.." && SWAL_WALLPAPERDIR="$(pwd)" && SWAL_SELWALLPAPER && SET && exit 0 ;;
"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 ;;
"Help") SWAL_USAGE | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 50 -p "How to use" && $0 && exit 0 ;;
"------") $0 && exit 0 ;;
esac
# Favorites feature
if [ "$FAVORITES" = "true" ]; then
case "$SWAL_SELWALLPAPER" in
"") $0 && exit 0 ;;
"Clear") rm -f $SWAL_EXPORTDIR/favorites* ; $0 && exit 0 ;;
"Exit") exit 0 ;;
"..") $0 && exit 0 ;;
"------") $0 && exit 0 ;;
esac
SWAL_WALLPAPERDIR="$(dirname "$(cat "$SWAL_EXPORTDIR/favorites" | grep "$SWAL_SELWALLPAPER")")"
fi
# If it's an actual image, use it as wallpaper
if [ "$SWAL_SELWALLPAPER" = "Preview" ]; then
if [ "$SWAL_PREVIEWIMG" = "" ]; then
$0 && exit 0
else
SWAL_SELWALLPAPER="$SWAL_PREVIEWIMG"
SWAL_WALLPAPERDIR=""
fi
fi
# Check if it's a directory
if [ -d "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" ]; then
cd "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" && SWAL_WALLPAPERDIR="$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" && SWAL_SELWALLPAPER && SET && exit 0
fi
# Fail if the wallpaper is not a proper wallpaper.
FAIL_NOT_REAL() {
command -v notify-send > /dev/null && notify-send "The selected wallpaper is not valid/does not exist."
$0 ; exit 1
}
ls "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" || FAIL_NOT_REAL
# don't set type if using argument
if [ "$SWAL_ASK_TYPE" != "false" ]; then
if [ "$ARG1" = "" ]; then
SWAL_TYPE=$(printf "Center\nTile\nZoom\nStretch\n------\nExit" | $RUNLAUNCHER -p "How do you want to set the wallpaper?" $GRIDARG $GRIDNUM -l 7)
else
SWAL_TYPE="Stretch"
fi
fi
case "$SWAL_TYPE" in
"Center") SWAL_TYPE=center ;;
"Tile") SWAL_TYPE=tile ;;
"Zoom") SWAL_TYPE=zoom ;;
"Stretch") SWAL_TYPE=stretch ;;
"Exit") exit 0 ;;
"------") $0 && exit 0 ;;
"") $0 && exit 0 ;;
esac
# Set type to stretch, shouldn't matter as xwallpaper can determine if it makes sense.
if [ "$SWAL_ASK_TYPE" = "false" ]; then
SWAL_TYPE=stretch
fi
# Set variables so that we can use them with xwallpaper directly.
SWAL_TYPE="--$SWAL_TYPE"
SWAL_WAL_STATUS="0"
# Check whether or not to ask based on configuration file.
if [ "$ARG1" = "" ]; then
case "$SWAL_ASK_WAL" in
"true") command -v wal > /dev/null && SWAL_USE_WAL=$(printf "Yes\nNo" | $RUNLAUNCHER $GRIDARG $GRIDNUM -l 90 -p "Do you want to use Pywal?" -l 2) && SWAL_WAL_STATUS="1" ;;
"false") command -v wal > /dev/null && SWAL_USE_WAL="Yes" && SWAL_WAL_STATUS="1" ;;
esac
else
command -v wal > /dev/null && SWAL_USE_WAL="Yes" && SWAL_WAL_STATUS="1"
fi
# Don't perform pywal actions if not installed/used
if [ "$SWAL_WAL_STATUS" = "0" ]; then
SWAL_USE_WAL="No"
fi
}
# Set the wallpaper.
SWAL_SETWALLPAPER()
{
$SWAL_OPT $SWAL_TYPE "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" || FAIL_NOT_REAL
}
# Export script to autostart on login
SWAL_EXPORT_SCRIPT()
{
if [ "$SWAL_RANDOMIZE" = "false" ]; then
printf "#!/bin/sh\n$SWAL_OPT $SWAL_TYPE ""'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'""" > $SWAL_EXPORTDIR/swal_wm
if [ -e "$SWAL_EXPORTDIR/CurrentWallpaper" ]; then
rm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev ; ln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" $SWAL_EXPORTDIR/CurrentWallpaper_prev
fi
rm -f $SWAL_EXPORTDIR/CurrentWallpaper ; ln -s "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" $SWAL_EXPORTDIR/CurrentWallpaper
else
printf "#!/bin/sh" > $SWAL_EXPORTDIR/swal_wm
printf "\nSWAL_WALLPAPERDIR=""'$SWAL_OLDWALLPAPERDIR'""" >> $SWAL_EXPORTDIR/swal_wm
printf "\nSWAL_EXPORTDIR=""'$SWAL_EXPORTDIR'""" >> $SWAL_EXPORTDIR/swal_wm
printf '\nSWAL_SELWALLPAPER="$(find "$SWAL_WALLPAPERDIR"/* -type f | shuf -n 1)"' >> $SWAL_EXPORTDIR/swal_wm
printf "\n$SWAL_OPT $SWAL_TYPE " >> $SWAL_EXPORTDIR/swal_wm
printf '"$SWAL_SELWALLPAPER"' >> $SWAL_EXPORTDIR/swal_wm
printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm
printf '\nln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" ' >> $SWAL_EXPORTDIR/swal_wm
printf "$SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm
printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm
printf '\nln -s "$SWAL_SELWALLPAPER" ' >> $SWAL_EXPORTDIR/swal_wm
printf "$SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm
fi
chmod +x $SWAL_EXPORTDIR/swal_wm
}
# Export script to autostart on login for Pywal users
SWAL_EXPORT_SCRIPT_WAL()
{
if [ "$SWAL_RANDOMIZE" = "false" ]; then
printf "#!/bin/sh\n$SWAL_OPT $SWAL_TYPE ""'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'""\nwal -qi ""'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'"" || rm -rf $HOME/.cache/wal ; xrdb -remove\nxrdb ~/.cache/wal/colors.Xresources" > $SWAL_EXPORTDIR/swal_wm
else
printf "#!/bin/sh" > $SWAL_EXPORTDIR/swal_wm
printf "\nSWAL_WALLPAPERDIR=""'$SWAL_OLDWALLPAPERDIR'""" >> $SWAL_EXPORTDIR/swal_wm
printf "\nSWAL_EXPORTDIR=""'$SWAL_EXPORTDIR'""" >> $SWAL_EXPORTDIR/swal_wm
printf '\nSWAL_SELWALLPAPER="$(find "$SWAL_WALLPAPERDIR"/* -type f | shuf -n 1)"' >> $SWAL_EXPORTDIR/swal_wm
printf "\n$SWAL_OPT $SWAL_TYPE " >> $SWAL_EXPORTDIR/swal_wm
printf '"$SWAL_SELWALLPAPER"' >> $SWAL_EXPORTDIR/swal_wm
printf '\nwal -nqi "$SWAL_SELWALLPAPER" || rm -rf $HOME/.cache/wal ; xrdb -remove\nxrdb $HOME/.cache/wal/colors.Xresources\nxrdb $HOME/.cache/wal/colors.Xresources' >> $SWAL_EXPORTDIR/swal_wm
printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm
printf '\nln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" ' >> $SWAL_EXPORTDIR/swal_wm
printf "$SWAL_EXPORTDIR/CurrentWallpaper_prev" >> $SWAL_EXPORTDIR/swal_wm
printf "\nrm -f $SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm
printf '\nln -s "$SWAL_SELWALLPAPER" ' >> $SWAL_EXPORTDIR/swal_wm
printf "$SWAL_EXPORTDIR/CurrentWallpaper" >> $SWAL_EXPORTDIR/swal_wm
fi
chmod +x $SWAL_EXPORTDIR/swal_wm
rm -rf $HOME/.cache/wal # Delete previous colors
wal -nqi "'$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER'" && xrdb ~/.cache/wal/colors.Xresources || xrdb -remove # Compatibility with my speedwm build
if [ -e "$SWAL_EXPORTDIR/CurrentWallpaper" ]; then
rm -f $SWAL_EXPORTDIR/CurrentWallpaper_prev ; ln -s "$(readlink $SWAL_EXPORTDIR/CurrentWallpaper)" $SWAL_EXPORTDIR/CurrentWallpaper_prev
fi
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 -rnoloadcolors
}
# Send notification
SWAL_SENDNOTIFICATION() {
if [ "$SWAL_SELWAL" = "" ]; then
command -v notify-send > /dev/null && notify-send " $SWAL_SELWALLPAPER set as wallpaper in $(echo $SWAL_TYPE | sed "s|--||g") mode."
else
command -v notify-send > /dev/null && notify-send " $SWAL_SELWAL set as wallpaper in $(echo $SWAL_TYPE | sed "s|--||g") mode."
fi
exit 0
}
SWAL_DEFAULT_CONFIG
SWAL_SOURCE || SWAL_DIE
SWAL_CHECK || SWAL_DIE
SWAL_SELWALLPAPER || SWAL_DIE
SET() {
SWAL_SETTYPE || SWAL_DIE
SWAL_SETWALLPAPER || SWAL_DIE
# Pywal
case "$SWAL_USE_WAL" in
"Yes") SWAL_EXPORT_SCRIPT_WAL || SWAL_DIE ;;
"No") SWAL_EXPORT_SCRIPT || SWAL_DIE ;;
"") exit 0 ;;
esac
rm -rf $HOME/.local/share/swal_wm
cp $SWAL_EXPORTDIR/swal_wm $HOME/.local/share/swal_wm
chmod +x $HOME/.local/share/swal_wm
SWAL_SENDNOTIFICATION
}
SET
$0 && exit 0

View file

@ -1,115 +0,0 @@
#!/bin/sh
# speedwm-utils
# Because controlling speedwm using shell scripts is based.
# Licensed under GNU GPLv3.
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu # Run launcher to use (dmenu, rofi, etc.) ;;
esac
HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
VARS() {
BINDIR="$(dirname $(command -v speedwm_status))/"
}
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 +") 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
}
OPT() {
MENUOPTS=$(printf "Layout\nReload .Xresources\nGeneral\nExit" | $RUNLAUNCHER -l 20 -p 'What do you want to do?')
case "$MENUOPTS" in
"Layout") ${0} layout $2 && exit 0 ;;
"Reload .Xresources") ${0} reloadcolors && exit 0 ;;
"General") ${0} -general $2 && exit 0 ;;
"Exit") exit 0 ;;
esac
}
HELP() {
printf "speedwm-utils - Control speedwm using your terminal or dmenu.\n"
printf "\nlayout Let the user select a speedwm layout"
printf "\nreloadcolors Reload .Xresources"
printf "\nexec <signum> Execute an fsignal signum"
printf "\nlist List all available signums"
printf "\n"
}
L1="$(printf "L1: Tiling\n")"
L2="$(printf "L2: Floating\n")"
L3="$(printf "L3: Monocle\n")"
L4="$(printf "L4: Grid\n")"
L5="$(printf "L5: Deck\n")"
L6="$(printf "L6: Centered Master\n")"
L7="$(printf "L7: Centered Floating Master\n")"
L8="$(printf "L8: Dwindle\n")"
L9="$(printf "L9: Spiral\n")"
L10="$(printf "L10: Bottom Stack (Vertical)\n")"
L11="$(printf "L11: Bottom Stack (Horizontal)\n")"
L12="$(printf "L12: Grid (Horizontal)\n")"
L13="$(printf "L13: Dynamic Grid\n")"
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") speedwm -s "#cmd:65" ;;
"list") sed 's|speedwm -s "#cmd:||g; s|"||g; s| - ||g; s@|@-@g' /usr/share/speedwm/example.signal | head -n "$(expr "$(cat /usr/share/speedwm/example.signal | wc -l)" - 1)" ;;
"-help") HELP ;;
"exec")
if [ "$2" = "" ]; then
exit 0
else
speedwm -s "#cmd:$2"
fi ;;
"-h") HELP ;;
"-general") GENERAL ;;
"") OPT ;;
esac
case "$SEL_LAYOUT" in
"Exit") exit 0 ;;
"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

File diff suppressed because it is too large Load diff

View file

@ -1,118 +0,0 @@
#!/bin/sh
# speedwm-winnav
# Alt+tab navigation for speedwm
#
# This script is from the suckless.org website.
# I made the following changes to it:
# - POSIX compliant
# - Tab goes down, j/k to navigate
# - Removed class from $windows making it look nicer
# - Configuration file
# - dmenu center patch support
# - Other small improvements.
RESTORE() {
if [ -e "${BINDIR}xmodmap" ]; then
xmodmap -e "keycode 23 = Tab"
xmodmap -e "keycode 116 = Down"
# Vim
xmodmap -e "keycode 44 = j"
xmodmap -e "keycode 45 = k"
fi
}
HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then
. $HOME/.config/speedwm-de/global/config
else
mkdir -p $HOME/.config/speedwm-de/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDNUM="1"
fi
if [ "$HAVE_GRID" = "true" ]; then
GRIDARG="-g"
fi
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu ;;
esac
BINDIR="$(dirname $(command -v speedwm_status))/"
DOTDIR=$HOME/.config/speedwm-de/winnav
POSITION="bottom" # top, bottom, center (your $RUNLAUNCHER must support center for this to work)
mkdir -p $HOME/.config/speedwm-de/winnav
# Create config if it does not exist.
if [ -e "$HOME/.config/speedwm-de/winnav/config" ]; then
. $HOME/.config/speedwm-de/winnav/config
else
printf "POSITION=$POSITION # top, bottom, center (Your installed $RUNLAUNCHER must support center (-c) for this to work)" > $HOME/.config/speedwm-de/winnav/config
fi
# Set position based on config
case "$POSITION" in
"bottom") POSARG="-b" ;;
"top") POSARG="" ;;
"center") POSARG="-c" ;;
esac
# Check if wmctrl is available
if [ -e "${BINDIR}wmctrl" ]; then
echo "wmctrl found"
case "$(wmctrl -xl | wc -l)" in
"") echo "No clients found." ; exit 1 ;;
"1") echo "One client running, will not open menu." ; exit 0 ;;
esac
else
echo "wmctrl not found, exiting." && exit 1
fi
SET() {
if [ -e "${BINDIR}xmodmap" ]; then
xmodmap -e "keycode 23 = Down"
xmodmap -e "keycode 116 = Tab"
# Vim
xmodmap -e "keycode 44 = Down"
xmodmap -e "keycode 45 = Up"
fi
}
SET
windows=$(wmctrl -xl | tr -s '[:blank:]' | cut -d ' ' -f 3-3,5- | sed 's/^[a-zA-Z0-9-]*\.//' | sort | uniq)
echo "Windows are:\n $windows\n============================"
windows_class=$(echo $windows | awk '{ print $1 }')
echo "Class is:\n $windows_class\n============================"
# Add spaces to align the WM_NAMEs of the windows
max=$(echo "$windows" | awk '{cur=length($1); max=(cur>max?cur:max)} END{print max}')
echo "Max is:\n$max"
windows=$(echo "$windows" | \
awk -v max="$max" \
'{cur=length($1); printf $1; \
for(i=0; i < max - cur + 1; i++) printf " "; \
$1 = ""; printf "%s\n", $0}')
target=$(printf "\n$windows" | cut -f 2- -d ' ' | sed 's/^ *//g' | $RUNLAUNCHER $POSARG -l 10 $GRIDARG $GRIDNUM -p "Which window?" | tr -s '[:blank:]' | sed "s/$class | //g")
case "$target" in
"") RESTORE && exit 0 ;;
esac
wmctrl -a "$target" && echo "Switched focus"
# show hidden window
speedwm -s "#cmd:28"
RESTORE

View file

@ -3,22 +3,19 @@
# External script which starts speedwm! # External script which starts speedwm!
# https://speedie.gq/speedwm for instructions and usage! # https://speedie.gq/speedwm for instructions and usage!
BINDIR="$(dirname $(command -v speedwm_status))/"
ARGS=$1 ARGS=$1
# No second argument is supported # No second argument is supported
if [ "$2" = "" ]; then if [ "$2" != "" ]; then
ARGS2=""
else
echo "Unknown argument: $2" ; exit 1 echo "Unknown argument: $2" ; exit 1
fi fi
HAVE_GRID="true" HAVE_GRID="true"
if [ -e "$HOME/.config/speedwm-de/global/config" ]; then if [ -e "$HOME/.config/speedwm/global/config" ]; then
. $HOME/.config/speedwm-de/global/config . $HOME/.config/speedwm/global/config
else else
mkdir -p $HOME/.config/speedwm-de/global mkdir -p $HOME/.config/speedwm/global
printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm-de/global/config printf "HAVE_GRID=$HAVE_GRID # Whether or not to use the Grid argument. If you do not have the dmenu grid patch, set this to false. Doing so will disable grid." > $HOME/.config/speedwm/global/config
fi fi
if [ "$HAVE_GRID" = "true" ]; then if [ "$HAVE_GRID" = "true" ]; then
@ -39,11 +36,11 @@ fi
# Load .Xresources if available # Load .Xresources if available
XRESOURCES() { XRESOURCES() {
if [ -e "$HOME/.Xresources" ]; then if [ -e "$HOME/.Xresources" ]; then
if [ -e "${BINDIR}xrdb" ]; then if command -v xrdb > /dev/null; then
xrdb $HOME/.Xresources xrdb $HOME/.Xresources
fi fi
elif [ -e "$HOME/.config/.Xresources" ]; then elif [ -e "$HOME/.config/.Xresources" ]; then
if [ -e "${BINDIR}xrdb" ]; then if command -v xrdb > /dev/null; then
xrdb $HOME/.config/.Xresources xrdb $HOME/.config/.Xresources
fi fi
fi fi
@ -51,13 +48,13 @@ XRESOURCES() {
# Load speedwm config, create if it does not exist. # Load speedwm config, create if it does not exist.
LOADCONFIG() { LOADCONFIG() {
mkdir -p $HOME/.config/speedwm-de mkdir -p $HOME/.config/speedwm
if [ -e "${BINDIR}xrdb" ]; then if command -v xrdb > /dev/null; then
if [ "$DONOTMKCONFIG" = "false" ]; then if [ "$DONOTMKCONFIG" = "false" ]; then
if [ -e "$HOME/.config/speedwm-de/speedwmrc" ]; then if [ -e "$HOME/.config/speedwm/speedwmrc" ]; then
xrdb -merge -quiet $HOME/.config/speedwm-de/speedwmrc xrdb -merge -quiet $HOME/.config/speedwm/speedwmrc
else else
sed "s| - ||g; s|!@||g" /usr/share/speedwm/example.Xresources > $HOME/.config/speedwm-de/speedwmrc && echo "Wrote example configuration file" sed "s| - ||g; s|!@||g" /usr/share/speedwm/example.Xresources > $HOME/.config/speedwm/speedwmrc && echo "Wrote example configuration file"
fi fi
fi fi
@ -69,7 +66,7 @@ LOADSWAL() {
if [ "$DONOTLOADCONFIG" = "true" ]; then if [ "$DONOTLOADCONFIG" = "true" ]; then
DONOTLOADCONFIG=true DONOTLOADCONFIG=true
else else
$HOME/.config/speedwm-de/swal/swal_wm > /dev/null $HOME/.config/speedwm/swal/swal_wm > /dev/null
echo "Loaded wallpaper and pywal colors" echo "Loaded wallpaper and pywal colors"
fi fi
} }
@ -87,8 +84,8 @@ LOADCOLS() {
# Autostart # Autostart
AUTOSTART() { AUTOSTART() {
if [ -e "$HOME/.config/speedwm-de/autostart_once.sh" ]; then if [ -e "$HOME/.config/speedwm/autostart_once.sh" ]; then
$HOME/.config/speedwm-de/autostart_once.sh $HOME/.config/speedwm/autostart_once.sh
fi fi
} }
@ -99,7 +96,7 @@ RESET() {
else else
speedwm -s "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 "#cmd:27" # Send fsignal to restart speedwm
speedwm -s "Loading" # To hide the ugly fsignal status speedwm -s "" # To hide the ugly fsignal status
fi fi
} }
@ -115,48 +112,13 @@ CHECKEXISTINGWM() {
# Start speedwm itself # Start speedwm itself
START_SPEEDWM() { START_SPEEDWM() {
# Set starter if it's going to be used.
if [ -e "${BINDIR}sx" ]; then
starter="sx sh"
else
starter="startx"
fi
if [ "$ISSFLAG" = "" ]; then if [ "$ISSFLAG" = "" ]; then
while true; do while true; do
speedwm > /tmp/speedwm-log pgrep -x speedwm > /dev/null || speedwm > /tmp/speedwm-log
done done
else
$starter "speedwm_run -f > /tmp/speedwm-log-auto"
fi fi
} }
# Config
CONFIGURE() {
test $HOME/.config/speedwm-de/speedwmrc && DOTFILE1="$HOME/.config/speedwm-de/speedwmrc"
test $HOME/.config/speedwm-de/dfmpeg/config && DOTFILE2="$HOME/.config/speedwm-de/dfmpeg/config"
test $HOME/.config/speedwm-de/powermenu/config && DOTFILE3="$HOME/.config/speedwm-de/powermenu/config"
test $HOME/.config/speedwm-de/screenshotutil/config && DOTFILE4="$HOME/.config/speedwm-de/screenshotutil/config"
test $HOME/.config/speedwm-de/status/config && DOTFILE5="$HOME/.config/speedwm-de/status/config"
test $HOME/.config/speedwm-de/swal/config && DOTFILE6="$HOME/.config/speedwm-de/swal/config"
test $HOME/.config/speedwm-de/winnav/config && DOTFILE7="$HOME/.config/speedwm-de/winnav/config"
test $HOME/.config/speedwm-de/global/config && DOTFILE8="$HOME/.config/speedwm-de/global/config"
case "$TERMINAL" in
"") TERMINAL="st -e"
esac
case "$EDITOR" in
"") EDITOR='vim'
esac
case "$RUNLAUNCHER" in
"") RUNLAUNCHER=dmenu
esac
$TERMINAL $EDITOR "$(printf "$DOTFILE1\n$DOTFILE2\n$DOTFILE3\n$DOTFILE4\n$DOTFILE5\n$DOTFILE6\n$DOTFILE7\n$DOTFILE8" | $RUNLAUNCHER -l 8 $GRIDARG $GRIDNUM -p "Edit which configuration?")"
}
# List of arguments # List of arguments
HELP() { HELP() {
printf "speedwm\nNo arguments | Start speedwm using default options\n\ printf "speedwm\nNo arguments | Start speedwm using default options\n\
@ -170,12 +132,12 @@ printf "speedwm\nNo arguments | Start speedwm using default options\n\
-unloadconfig | Unload the speedwm configuration\n\ -unloadconfig | Unload the speedwm configuration\n\
-deleteconfig | Delete the speedwm configuration\n\ -deleteconfig | Delete the speedwm configuration\n\
-rnoload | Restart speedwm without reloading colors\n\ -rnoload | Restart speedwm without reloading colors\n\
-configure | Bring up a list of speedwm-de dotfiles in $RUNLAUNCHER and ask the user which one to open in \$EDITOR inside \$TERMINAL\n" -configure | Bring up a list of speedwm dotfiles in $RUNLAUNCHER and ask the user which one to open in \$EDITOR inside \$TERMINAL\n"
} }
# Unload speedwm configuration # Unload speedwm configuration
UNLOADCONFIG() { UNLOADCONFIG() {
if [ -e "${BINDIR}xrdb" ]; then if command -v xrdb > /dev/null; then
xrdb -remove speedwm* && echo "Unloaded configuration" xrdb -remove speedwm* && echo "Unloaded configuration"
else else
echo "Unable to unload configuration" ; exit 1 echo "Unable to unload configuration" ; exit 1
@ -184,8 +146,8 @@ UNLOADCONFIG() {
# Delete speedwm configuration # Delete speedwm configuration
DELETECONFIG() { DELETECONFIG() {
if [ -e "$HOME/.config/speedwm-de/speedwmrc" ]; then if [ -e "$HOME/.config/speedwm/speedwmrc" ]; then
rm -f $HOME/.config/speedwm-de/speedwmrc && echo "Deleted $HOME/.config/speedwm-de/speedwmrc." rm -f $HOME/.config/speedwm/speedwmrc && echo "Deleted $HOME/.config/speedwm/speedwmrc."
else else
echo "Failed to delete configuration file." ; exit 1 echo "Failed to delete configuration file." ; exit 1
fi fi
@ -194,7 +156,6 @@ DELETECONFIG() {
case "$ARGS" in case "$ARGS" in
"") CHECKEXISTINGWM ; XRESOURCES ; AUTOSTART ; LOADSWAL ; LOADCONFIG ; RESET ; START_SPEEDWM ; exit 0 ;; "") CHECKEXISTINGWM ; XRESOURCES ; AUTOSTART ; LOADSWAL ; LOADCONFIG ; RESET ; START_SPEEDWM ; exit 0 ;;
"-s") ISSFLAG=true ; CHECKEXISTINGWM ; XRESOURCES ; AUTOSTART ; LOADSWAL ; LOADCONFIG ; RESET ; START_SPEEDWM ; exit 0 ;; "-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 ;; "-r") XRESOURCES ; LOADSWAL ; LOADCONFIG ; RESET ; echo "Restarted speedwm." ; exit 0 ;;
"-rcolors") XRESOURCES ; LOADSWAL ; LOADCONFIG ; LOADCOLS ; echo "Restarted speedwm." ; exit 0 ;; "-rcolors") XRESOURCES ; LOADSWAL ; LOADCONFIG ; LOADCOLS ; echo "Restarted speedwm." ; exit 0 ;;
"-rnoloadcolors") LOADCONFIG ; LOADCOLS ; echo "Restarted speedwm." ; exit 0 ;; "-rnoloadcolors") LOADCONFIG ; LOADCOLS ; echo "Restarted speedwm." ; exit 0 ;;

View file

@ -1,9 +1,11 @@
#!/bin/sh #!/bin/sh
# speedwm_status # speedwm_status
# status bar manager # status bar manager for speedwm/stellar
STATUSBAR="speedwm-stellar" STATUSBAR="speedwm-stellar" # should be stellar
IN_ARGS="$@" IN_ARGS="$@" # arguments
mkdir -p $HOME/.config/speedwm/
statusfunc() { statusfunc() {
pgrep -x $STATUSBAR || $STATUSBAR $IN_ARGS > /tmp/statusbar-log & pgrep -x $STATUSBAR || $STATUSBAR $IN_ARGS > /tmp/statusbar-log &

101
speedwm.c
View file

@ -439,6 +439,8 @@ static long getstate(Window w);
static unsigned int getsystraywidth(); static unsigned int getsystraywidth();
static Monitor *systraytomon(Monitor *m); static Monitor *systraytomon(Monitor *m);
static void resizebarwin(Monitor *m); static void resizebarwin(Monitor *m);
/* systray */
#if USESYSTRAY #if USESYSTRAY
static void removesystrayicon(Client *i); static void removesystrayicon(Client *i);
static void resizerequest(XEvent *e); static void resizerequest(XEvent *e);
@ -451,6 +453,7 @@ static void togglesystray();
#else #else
static int sendevent(Client *c, Atom proto); static int sendevent(Client *c, Atom proto);
#endif #endif
static int gettextprop(Window w, Atom atom, char *text, unsigned int size); static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused); static void grabbuttons(Client *c, int focused);
static void hide(const Arg *arg); static void hide(const Arg *arg);
@ -471,34 +474,6 @@ static void managealtbar(Window win, XWindowAttributes *wa);
static void managetray(Window win, XWindowAttributes *wa); static void managetray(Window win, XWindowAttributes *wa);
static void mappingnotify(XEvent *e); static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e); static void maprequest(XEvent *e);
#if LAYOUT_MONOCLE
static void monocle(Monitor *m);
#endif
#if LAYOUT_GRID
static void grid(Monitor *m);
#endif
#if LAYOUT_SPIRAL
static void spiral(Monitor *m);
#endif
#if LAYOUT_BSTACK
static void bstack(Monitor *m);
#endif
#if LAYOUT_BSTACKH
static void bstackhoriz(Monitor *m);
#endif
#if LAYOUT_HGRID
static void horizgrid(Monitor *m);
#endif
#if LAYOUT_DGRID
static void dynamicgrid(Monitor *m);
#endif
#if LAYOUT_CUSTOM
static void custom(Monitor *m);
static void set_s_layout(const Arg *arg);
#endif
#if LAYOUT_DWINDLE
static void dwindle(Monitor *m);
#endif
static void motionnotify(XEvent *e); static void motionnotify(XEvent *e);
#if USEMOUSE #if USEMOUSE
static void movemouse(const Arg *arg); static void movemouse(const Arg *arg);
@ -535,6 +510,7 @@ static void restack(Monitor *m);
static void run(void); static void run(void);
static void scantray(void); static void scantray(void);
static void scan(void); static void scan(void);
/* scratchpad functions */ /* scratchpad functions */
static void scratchpad_hide(); static void scratchpad_hide();
static _Bool scratchpad_last_showed_is_killed(void); static _Bool scratchpad_last_showed_is_killed(void);
@ -542,7 +518,7 @@ static void scratchpad_remove();
static void scratchpad_show(); static void scratchpad_show();
static void scratchpad_show_client(Client *c); static void scratchpad_show_client(Client *c);
static void scratchpad_show_first(void); static void scratchpad_show_first(void);
/* */
static void sendmon(Client *c, Monitor *m); static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state); static void setclientstate(Client *c, long state);
static void setclienttagprop(Client *c); static void setclienttagprop(Client *c);
@ -558,23 +534,29 @@ static void setlayout(const Arg *arg);
#if USEMOUSE #if USEMOUSE
static void dragcfact(const Arg *arg); static void dragcfact(const Arg *arg);
#endif #endif
#if USEIPC
static void setlayoutsafe(const Arg *arg);
#endif
static void setcfact(const Arg *arg); static void setcfact(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setup(void); static void setup(void);
/* ipc */
#if USEIPC #if USEIPC
static void setlayoutsafe(const Arg *arg);
static void setupepoll(void); static void setupepoll(void);
#endif #endif
static void seturgent(Client *c, int urg); static void seturgent(Client *c, int urg);
/* show/hide */
static void show(const Arg *arg); static void show(const Arg *arg);
static void showall(const Arg *arg); static void showall(const Arg *arg);
static void hideall(const Arg *arg); static void hideall(const Arg *arg);
static void showwin(Client *c); static void showwin(Client *c);
static void showhide(Client *c); static void showhide(Client *c);
/* tag previews */
#if USETAGPREVIEW #if USETAGPREVIEW
static void showtagpreview(unsigned int i); static void showtagpreview(unsigned int i);
static void takepreview(void);
#endif #endif
static void sigchld(int unused); static void sigchld(int unused);
#ifdef XINERAMA #ifdef XINERAMA
@ -586,23 +568,46 @@ static void spawn(const Arg *arg);
static void spawnbar(); static void spawnbar();
static void unmanagealtbar(Window w); static void unmanagealtbar(Window w);
static void unmanagetray(Window w); static void unmanagetray(Window w);
#if USETAGPREVIEW
static void takepreview(void);
#endif
static void tagmon(const Arg *arg); static void tagmon(const Arg *arg);
/* layouts */
#if LAYOUT_TILE #if LAYOUT_TILE
static void tile(Monitor *m); static void tile(Monitor *m);
#endif #endif
#if LAYOUT_DECK #if LAYOUT_DECK
static void deck(Monitor *m); static void deck(Monitor *m);
#endif #endif
#if LAYOUT_EMPTY #if LAYOUT_MONOCLE
static void empty(Monitor *m); static void monocle(Monitor *m);
#endif
#if LAYOUT_GRID
static void grid(Monitor *m);
#endif
#if LAYOUT_SPIRAL
static void spiral(Monitor *m);
#endif
#if LAYOUT_BSTACK
static void bstack(Monitor *m);
#endif
#if LAYOUT_BSTACKH
static void bstackhoriz(Monitor *m);
#endif
#if LAYOUT_HGRID
static void horizgrid(Monitor *m);
#endif
#if LAYOUT_DGRID
static void dynamicgrid(Monitor *m);
#endif
#if LAYOUT_CUSTOM
static void custom(Monitor *m);
static void set_s_layout(const Arg *arg);
#endif
#if LAYOUT_DWINDLE
static void dwindle(Monitor *m);
#endif #endif
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
/* bar items */ /* bar items */
static void togglebar(const Arg *arg);
static void togglebartags(const Arg *arg); static void togglebartags(const Arg *arg);
static void togglebaremptytags(const Arg *arg); static void togglebaremptytags(const Arg *arg);
static void togglebartitle(const Arg *arg); static void togglebartitle(const Arg *arg);
@ -615,12 +620,14 @@ static void togglebaricon(const Arg *arg);
static void togglebarsticky(const Arg *arg); static void togglebarsticky(const Arg *arg);
static void resetbar(const Arg *arg); static void resetbar(const Arg *arg);
/* misc toggles */
static void togglefloating(const Arg *arg);
static void toggleopacity(const Arg *arg); static void toggleopacity(const Arg *arg);
static void togglefullscr(const Arg *arg); static void togglefullscr(const Arg *arg);
static void setbarheight(const Arg *arg); static void setbarheight(const Arg *arg);
static void resetbarheight(const Arg *arg); static void resetbarheight(const Arg *arg);
/* todo: create standalone patch for these functions */ /* barpadding */
static void setbarpaddingv(const Arg *arg); static void setbarpaddingv(const Arg *arg);
static void setbarpaddingh(const Arg *arg); static void setbarpaddingh(const Arg *arg);
static void setbarpadding(const Arg *arg); static void setbarpadding(const Arg *arg);
@ -702,13 +709,16 @@ static const char notitle[] = ""; /* Title when none can be grabbed. */
#if USEMOUSE #if USEMOUSE
static const char *layoutcmd = "speedwm-utils layout"; static const char *layoutcmd = "speedwm-utils layout";
#endif #endif
static char stext[1024]; static char stext[1024]; /* max character count */
static char rawstext[1024]; static char rawstext[1024]; /* max character count */
static int statusw; static int statusw;
/* clickability */
#if USEMOUSE #if USEMOUSE
static int statuscmdn; static int statuscmdn;
static char lastbutton[] = "-"; static char lastbutton[] = "-";
#endif #endif
static int screen; static int screen;
static int tw, sh; /* X display screen geometry width, height */ static int tw, sh; /* X display screen geometry width, height */
static int bh; /* bar geometry */ static int bh; /* bar geometry */
@ -749,8 +759,8 @@ static Atom wmatom[WMLast], netatom[NetLast], motifatom;
static int epoll_fd; static int epoll_fd;
static int dpy_fd; static int dpy_fd;
#endif #endif
static int running = 1; static int running = 1; /* yes, we are in fact running */
static int restart = 0; static int restart = 0; /* which means we are definitely not restarting */
static Cur *cursor[CurLast]; static Cur *cursor[CurLast];
static Clr **scheme; static Clr **scheme;
static Clr **tagscheme; static Clr **tagscheme;
@ -798,7 +808,6 @@ static const char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL };
#endif #endif
/* Configuration */ /* Configuration */
#include "actions.h" /* include #defines */
#include "options.h" /* Include options */ #include "options.h" /* Include options */
/* Options */ /* Options */
@ -841,7 +850,7 @@ static int systraypinningfailfirst = 1;
#include "toggle/ipc-yajl.c" #include "toggle/ipc-yajl.c"
#endif #endif
static char *fontarray[] = { font1, font2, font3, fonts }; /* All fonts */ static char *fontarray[] = { font1, font2, font3 }; /* All fonts */
unsigned int tagw[LENGTH(tags)]; unsigned int tagw[LENGTH(tags)];

View file

@ -11,11 +11,11 @@
#include <unistd.h> #include <unistd.h>
#include <yajl/yajl_gen.h> #include <yajl/yajl_gen.h>
#define IPC_MAGIC "DWM-IPC" #define IPC_MAGIC "SPEEDWM-IPC"
// clang-format off // clang-format off
#define IPC_MAGIC_ARR { 'D', 'W', 'M', '-', 'I', 'P', 'C' } #define IPC_MAGIC_ARR { 'S', 'P', 'E', 'E', 'D', 'W', 'M', '-', 'I', 'P', 'C' }
// clang-format on // clang-format on
#define IPC_MAGIC_LEN 7 // Not including null char #define IPC_MAGIC_LEN 11 // Not including null char
#define IPC_EVENT_TAG_CHANGE "tag_change_event" #define IPC_EVENT_TAG_CHANGE "tag_change_event"
#define IPC_EVENT_CLIENT_FOCUS_CHANGE "client_focus_change_event" #define IPC_EVENT_CLIENT_FOCUS_CHANGE "client_focus_change_event"
@ -53,7 +53,7 @@ typedef enum IPCMessageType {
IPC_TYPE_GET_MONITORS = 1, IPC_TYPE_GET_MONITORS = 1,
IPC_TYPE_GET_TAGS = 2, IPC_TYPE_GET_TAGS = 2,
IPC_TYPE_GET_LAYOUTS = 3, IPC_TYPE_GET_LAYOUTS = 3,
IPC_TYPE_GET_DWM_CLIENT = 4, IPC_TYPE_GET_SPEEDWM_CLIENT = 4,
IPC_TYPE_SUBSCRIBE = 5, IPC_TYPE_SUBSCRIBE = 5,
IPC_TYPE_EVENT = 6 IPC_TYPE_EVENT = 6
} IPCMessageType; } IPCMessageType;
@ -397,7 +397,7 @@ get_speedwm_client(Window win)
yajl_gen_get_buf(gen, &msg, &msg_size); yajl_gen_get_buf(gen, &msg, &msg_size);
send_message(IPC_TYPE_GET_DWM_CLIENT, msg_size, (uint8_t *)msg); send_message(IPC_TYPE_GET_SPEEDWM_CLIENT, msg_size, (uint8_t *)msg);
print_socket_reply(); print_socket_reply();

View file

@ -94,7 +94,7 @@ ipc_recv_message(int fd, uint8_t *msg_type, uint32_t *reply_size,
uint8_t **reply) uint8_t **reply)
{ {
uint32_t read_bytes = 0; uint32_t read_bytes = 0;
const int32_t to_read = sizeof(dwm_ipc_header_t); const int32_t to_read = sizeof(speedwm_ipc_header_t);
char header[to_read]; char header[to_read];
char *walk = header; char *walk = header;
@ -356,7 +356,7 @@ ipc_parse_run_command(char *msg, IPCParsedCommand *parsed_command)
*argc = args_val->u.array.len; *argc = args_val->u.array.len;
// If no arguments are specified, make a dummy argument to pass to the // If no arguments are specified, make a dummy argument to pass to the
// function. This is just the way dwm's void(Arg*) functions are setup. // function. This is just the way speedwm's void(Arg*) functions are setup.
if (*argc == 0) { if (*argc == 0) {
*args = (Arg *)malloc(sizeof(Arg)); *args = (Arg *)malloc(sizeof(Arg));
*arg_types = (ArgType *)malloc(sizeof(ArgType)); *arg_types = (ArgType *)malloc(sizeof(ArgType));
@ -540,14 +540,14 @@ ipc_parse_subscribe(const char *msg, IPCSubscriptionAction *subscribe,
} }
/** /**
* Parse an IPC_TYPE_GET_DWM_CLIENT message from a client. This function * Parse an IPC_TYPE_GET_SPEEDWM_CLIENT message from a client. This function
* extracts the window id from the message. * extracts the window id from the message.
* *
* Returns 0 if message was successfully parsed * Returns 0 if message was successfully parsed
* Returns -1 otherwise * Returns -1 otherwise
*/ */
static int static int
ipc_parse_get_dwm_client(const char *msg, Window *win) ipc_parse_get_speedwm_client(const char *msg, Window *win)
{ {
char error_buffer[100]; char error_buffer[100];
@ -585,7 +585,7 @@ ipc_parse_get_dwm_client(const char *msg, Window *win)
* *
* NOTE: There is currently no check for argument validity beyond the number of * NOTE: There is currently no check for argument validity beyond the number of
* arguments given and types of arguments. There is also no way to check if the * arguments given and types of arguments. There is also no way to check if the
* function succeeded based on dwm's void(const Arg*) function types. Pointer * function succeeded based on speedwm's void(const Arg*) function types. Pointer
* arguments can cause crashes if they are not validated in the function itself. * arguments can cause crashes if they are not validated in the function itself.
* *
* Returns 0 if message was successfully parsed * Returns 0 if message was successfully parsed
@ -684,7 +684,7 @@ ipc_get_layouts(IPCClient *c, const Layout layouts[], const int layouts_len)
} }
/** /**
* Called when an IPC_TYPE_GET_DWM_CLIENT message is received from a client. It * Called when an IPC_TYPE_GET_SPEEDWM_CLIENT message is received from a client. It
* prepares a JSON reply with the properties of the client with the specified * prepares a JSON reply with the properties of the client with the specified
* window XID. * window XID.
* *
@ -693,11 +693,11 @@ ipc_get_layouts(IPCClient *c, const Layout layouts[], const int layouts_len)
* Returns -1 if the message could not be parsed * Returns -1 if the message could not be parsed
*/ */
static int static int
ipc_get_dwm_client(IPCClient *ipc_client, const char *msg, const Monitor *mons) ipc_get_speedwm_client(IPCClient *ipc_client, const char *msg, const Monitor *mons)
{ {
Window win; Window win;
if (ipc_parse_get_dwm_client(msg, &win) < 0) return -1; if (ipc_parse_get_speedwm_client(msg, &win) < 0) return -1;
// Find client with specified window XID // Find client with specified window XID
for (const Monitor *m = mons; m; m = m->next) for (const Monitor *m = mons; m; m = m->next)
@ -709,12 +709,12 @@ ipc_get_dwm_client(IPCClient *ipc_client, const char *msg, const Monitor *mons)
dump_client(gen, c); dump_client(gen, c);
ipc_reply_prepare_send_message(gen, ipc_client, ipc_reply_prepare_send_message(gen, ipc_client,
IPC_TYPE_GET_DWM_CLIENT); IPC_TYPE_GET_SPEEDWM_CLIENT);
return 0; return 0;
} }
ipc_prepare_reply_failure(ipc_client, IPC_TYPE_GET_DWM_CLIENT, ipc_prepare_reply_failure(ipc_client, IPC_TYPE_GET_SPEEDWM_CLIENT,
"Client with window id %d not found", win); "Client with window id %d not found", win);
return -1; return -1;
} }
@ -962,10 +962,10 @@ void
ipc_prepare_send_message(IPCClient *c, const IPCMessageType msg_type, ipc_prepare_send_message(IPCClient *c, const IPCMessageType msg_type,
const uint32_t msg_size, const char *msg) const uint32_t msg_size, const char *msg)
{ {
dwm_ipc_header_t header = { speedwm_ipc_header_t header = {
.magic = IPC_MAGIC_ARR, .type = msg_type, .size = msg_size}; .magic = IPC_MAGIC_ARR, .type = msg_type, .size = msg_size};
uint32_t header_size = sizeof(dwm_ipc_header_t); uint32_t header_size = sizeof(speedwm_ipc_header_t);
uint32_t packet_size = header_size + msg_size; uint32_t packet_size = header_size + msg_size;
if (c->buffer == NULL) if (c->buffer == NULL)
@ -1170,8 +1170,8 @@ ipc_handle_client_epoll_event(struct epoll_event *ev, Monitor *mons,
else if (msg_type == IPC_TYPE_RUN_COMMAND) { else if (msg_type == IPC_TYPE_RUN_COMMAND) {
if (ipc_run_command(c, msg) < 0) return -1; if (ipc_run_command(c, msg) < 0) return -1;
ipc_send_events(mons, lastselmon, selmon); ipc_send_events(mons, lastselmon, selmon);
} else if (msg_type == IPC_TYPE_GET_DWM_CLIENT) { } else if (msg_type == IPC_TYPE_GET_SPEEDWM_CLIENT) {
if (ipc_get_dwm_client(c, msg, mons) < 0) return -1; if (ipc_get_speedwm_client(c, msg, mons) < 0) return -1;
} else if (msg_type == IPC_TYPE_SUBSCRIBE) { } else if (msg_type == IPC_TYPE_SUBSCRIBE) {
if (ipc_subscribe(c, msg) < 0) return -1; if (ipc_subscribe(c, msg) < 0) return -1;
} else { } else {

View file

@ -8,9 +8,9 @@
#include "ipc-cli.h" #include "ipc-cli.h"
// clang-format off // clang-format off
#define IPC_MAGIC "DWM-IPC" #define IPC_MAGIC "SPEEDWM-IPC"
#define IPC_MAGIC_ARR { 'D', 'W', 'M', '-', 'I', 'P', 'C'} #define IPC_MAGIC_ARR { 'S', 'P', 'E', 'E', 'D', 'W', 'M', '-', 'I', 'P', 'C'}
#define IPC_MAGIC_LEN 7 // Not including null char #define IPC_MAGIC_LEN 11 // Not including null char
#define IPCCOMMAND(FUNC, ARGC, TYPES) \ #define IPCCOMMAND(FUNC, ARGC, TYPES) \
{ #FUNC, {FUNC }, ARGC, (ArgType[ARGC])TYPES } { #FUNC, {FUNC }, ARGC, (ArgType[ARGC])TYPES }
@ -21,7 +21,7 @@ typedef enum IPCMessageType {
IPC_TYPE_GET_MONITORS = 1, IPC_TYPE_GET_MONITORS = 1,
IPC_TYPE_GET_TAGS = 2, IPC_TYPE_GET_TAGS = 2,
IPC_TYPE_GET_LAYOUTS = 3, IPC_TYPE_GET_LAYOUTS = 3,
IPC_TYPE_GET_DWM_CLIENT = 4, IPC_TYPE_GET_SPEEDWM_CLIENT = 4,
IPC_TYPE_SUBSCRIBE = 5, IPC_TYPE_SUBSCRIBE = 5,
IPC_TYPE_EVENT = 6 IPC_TYPE_EVENT = 6
} IPCMessageType; } IPCMessageType;
@ -43,11 +43,11 @@ typedef enum IPCSubscriptionAction {
/** /**
* Every IPC packet starts with this structure * Every IPC packet starts with this structure
*/ */
typedef struct dwm_ipc_header { typedef struct speedwm_ipc_header {
uint8_t magic[IPC_MAGIC_LEN]; uint8_t magic[IPC_MAGIC_LEN];
uint32_t size; uint32_t size;
uint8_t type; uint8_t type;
} __attribute((packed)) dwm_ipc_header_t; } __attribute((packed)) speedwm_ipc_header_t;
typedef enum ArgType { typedef enum ArgType {
ARG_TYPE_NONE = 0, ARG_TYPE_NONE = 0,
@ -219,8 +219,8 @@ void ipc_tag_change_event(const int mon_num, TagState old_state,
* when the client focus changes. * when the client focus changes.
* *
* @param mon_num The index of the monitor (Monitor.num property) * @param mon_num The index of the monitor (Monitor.num property)
* @param old_client The old DWM client selection (Monitor.oldsel) * @param old_client The old SPEEDWM client selection (Monitor.oldsel)
* @param new_client The new (now current) DWM client selection * @param new_client The new (now current) SPEEDWM client selection
*/ */
void ipc_client_focus_change_event(const int mon_num, Client *old_client, void ipc_client_focus_change_event(const int mon_num, Client *old_client,
Client *new_client); Client *new_client);

View file

@ -10,7 +10,6 @@ ResourcePref resources[] = {
{ "fonts.font1", STRING, &font1 }, { "fonts.font1", STRING, &font1 },
{ "fonts.font2", STRING, &font2 }, { "fonts.font2", STRING, &font2 },
{ "fonts.font3", STRING, &font3 }, { "fonts.font3", STRING, &font3 },
{ "fonts.fonts", STRING, &fonts },
{ "col.background", STRING, &col_background }, { "col.background", STRING, &col_background },
{ "col.titlenorm", STRING, &col_titlenorm }, { "col.titlenorm", STRING, &col_titlenorm },
{ "col.titlesel", STRING, &col_titlesel }, { "col.titlesel", STRING, &col_titlesel },