Add speedwm, we'll see if I use this repository instead.
This commit is contained in:
commit
fe5a87e14c
38
LICENSE
Normal file
38
LICENSE
Normal file
|
@ -0,0 +1,38 @@
|
|||
MIT/X Consortium License
|
||||
|
||||
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
|
||||
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
||||
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
||||
© 2007-2011 Peter Hartlich <sgkkr at hartlich dot com>
|
||||
© 2007-2009 Szabolcs Nagy <nszabolcs at gmail dot com>
|
||||
© 2007-2009 Christof Musik <christof at sendfax dot de>
|
||||
© 2007-2009 Premysl Hruby <dfenze at gmail dot com>
|
||||
© 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
|
||||
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
||||
© 2008 Neale Pickett <neale dot woozle dot org>
|
||||
© 2009 Mate Nagy <mnagy at port70 dot net>
|
||||
© 2010-2016 Hiltjo Posthuma <hiltjo@codemadness.org>
|
||||
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
|
||||
© 2011 Christoph Lohmann <20h@r-36.net>
|
||||
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
||||
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
||||
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
|
||||
© 2021-2022 speedie.gq <speedie@duck.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
180
Makefile
Normal file
180
Makefile
Normal file
|
@ -0,0 +1,180 @@
|
|||
# speespeedwm // minimal X window manager designed for productivity and aesthetics.
|
||||
# See LICENSE file for copyright and license details.
|
||||
|
||||
include config.mk
|
||||
|
||||
SRC = drw.c speedwm.c util.c
|
||||
OBJ = ${SRC:.c=.o}
|
||||
|
||||
all: options speedwm
|
||||
|
||||
options:
|
||||
@echo speedwm build options:
|
||||
@echo "CFLAGS = ${CFLAGS}"
|
||||
@echo "LDFLAGS = ${LDFLAGS}"
|
||||
@echo "CC = ${CC}"
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $<
|
||||
|
||||
${OBJ}: config.mk
|
||||
|
||||
speedwm: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS} ; rm -f drw.o speedwm.o util.o
|
||||
|
||||
clean:
|
||||
rm -f speedwm ${OBJ} speedwm-spde-${VERSION}.tar.gz && echo "Cleaned!"
|
||||
|
||||
dist: clean
|
||||
mkdir -p speedwm-spde-${VERSION}
|
||||
cp -R *.mk *.c *.h *.png docs patches status LICENSE Makefile scripts speedwm-spde-${VERSION}
|
||||
tar -cf speedwm-spde-${VERSION}.tar speedwm-spde-${VERSION}
|
||||
gzip speedwm-spde-${VERSION}.tar
|
||||
rm -rf speedwm-spde-${VERSION} speedwm
|
||||
|
||||
install: all
|
||||
touch drw.o speedwm.o util.o
|
||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||
cp -f speedwm ${DESTDIR}${PREFIX}/bin
|
||||
chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm
|
||||
cp -f docs/bindlist ${DESTDIR}${PREFIX}/share/speedwm-bindlist
|
||||
cp -f docs/deplist ${DESTDIR}${PREFIX}/share/speedwm-deplist
|
||||
cp -f docs/about ${DESTDIR}${PREFIX}/share/speedwm-about
|
||||
cp -f docs/about2 ${DESTDIR}${PREFIX}/share/speedwm-about-2
|
||||
cp -f docs/about3 ${DESTDIR}${PREFIX}/share/speedwm-about-3
|
||||
cp -f docs/about4 ${DESTDIR}${PREFIX}/share/speedwm-about-4
|
||||
cp -f docs/about5 ${DESTDIR}${PREFIX}/share/speedwm-about-5
|
||||
cp -f docs/example.Xresources ${DESTDIR}${PREFIX}/share/speedwm-xresources
|
||||
cp -f docs/example.fsignal ${DESTDIR}${PREFIX}/share/speedwm-fsignal
|
||||
cp -f scripts/speedwm-help ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-help
|
||||
cp -f scripts/speedwm-shutdown ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-shutdown
|
||||
cp -f scripts/speedwm-winnav ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-winnav
|
||||
cp -f scripts/speedwm-utils ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-utils
|
||||
cp -f scripts/speedwm-swal ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-swal
|
||||
cp -f scripts/speedwm-screenshotutil ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-screenshotutil
|
||||
cp -f scripts/speedwm-virtualkeyboard ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-virtualkeyboard
|
||||
cp -f scripts/speedwm-pdfopen ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-pdfopen
|
||||
cp -f scripts/speedwm-audioctrl ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-audioctrl
|
||||
cp -f scripts/speedwm-netctrl ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-netctrl
|
||||
cp -f scripts/speedwm-btctrl ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-btctrl
|
||||
cp -f scripts/speedwm_run ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm_run
|
||||
cp -f scripts/speedwm-core ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-core
|
||||
cp -f scripts/speedwm-dfmpeg ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm-dfmpeg
|
||||
cp -f status ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/status
|
||||
chmod +x ./scripts/speedwm-compatcheck
|
||||
chmod +x ./scripts/speedwm-dm
|
||||
mkdir -p /usr/share
|
||||
echo "${DESTDIR}${PREFIX}/bin/" > /usr/share/speedwm-bindir
|
||||
./scripts/speedwm-compatcheck
|
||||
./scripts/speedwm-dm
|
||||
[ -f speedwm.png ] && cp -f speedwm.png ${DESTDIR}${PREFIX}/share/pixmaps/speedwm.png || :
|
||||
rm -f drw.o speedwm.o util.o speedwm ; echo "Installed speedwm to ${DESTDIR}${PREFIX}/bin"
|
||||
|
||||
uninstall:
|
||||
rm -f ${DESTDIR}${PREFIX}/bin/speedwm\
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-utils \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-audioctrl \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-winnav \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-shutdown \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-swal \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-help \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-netctrl \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-btctrl \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-screenshotutil \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-virtualkeyboard \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-pdfopen \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-core \
|
||||
${DESTDIR}${PREFIX}/bin/speedwm-dfmpeg \
|
||||
${DESTDIR}${PREFIX}/bin/status \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-bindlist \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-deplist \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-about \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-about-2 \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-about-3 \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-about-4 \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-about-5 \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-xresources \
|
||||
${DESTDIR}${PREFIX}/share/speedwm-fsignal \
|
||||
|
||||
docs:
|
||||
chmod +x scripts/speedwm-help
|
||||
./scripts/speedwm-help -a -o
|
||||
|
||||
help:
|
||||
@echo dynamic window manager makefile help
|
||||
@echo install: Installs speedwm. You may need to run this as root.
|
||||
@echo uninstall: Uninstalls speedwm. You may need to run this as root.
|
||||
@echo libxftfix: This option compiles and installs libXft-bgra which is necessary to prevent speedwm from crashing.
|
||||
@echo gentoo-libxftfix: This option installs libXft-bgra by patching it for Gentoo only.
|
||||
@echo arch-libxftfix: This option installs libXft-bgra using the AUR on Arch Linux only.
|
||||
@echo help: Displays this help sheet.
|
||||
@echo docs: View documentation for speedwm
|
||||
@echo html: Write HTML document based on documentation.
|
||||
@echo markdown: Write Markdown document based on documentation.
|
||||
@echo readme: Write output of speedwm-help -a to readme.
|
||||
@echo upload: git commit and git push this build.
|
||||
@echo page: Creates the https://speedie.gq/speedwm page in HTML form.
|
||||
@echo page_install: Copy the page to ${HTMLDIR}.
|
||||
@echo page_push: git commit and git push the page in ${HTMLDIR}.
|
||||
@echo make page page_install page_push to do all of the above page changes instantly.
|
||||
@echo make release to run make markdown, make upload, make page, make page_install, make page_push instantly.
|
||||
|
||||
release:
|
||||
make markdown
|
||||
make upload
|
||||
make page
|
||||
make page_install
|
||||
make page_push
|
||||
rm -f speedwm.html
|
||||
rm -f readme.html
|
||||
rm -f readme
|
||||
@echo "Complete!"
|
||||
|
||||
upload:
|
||||
chmod +x scripts/speedwm-mkpage
|
||||
./scripts/speedwm-mkpage -ulspeedwm
|
||||
@echo "Uploaded everything."
|
||||
|
||||
libxftfix:
|
||||
chmod +x scripts/libxftfix
|
||||
./scripts/libxftfix -source
|
||||
|
||||
page:
|
||||
chmod +x scripts/speedwm-mkpage
|
||||
chmod +x scripts/speedwm-help
|
||||
./scripts/speedwm-mkpage -mkpage
|
||||
|
||||
page_install:
|
||||
cp speedwm.html ${HTMLDIR}
|
||||
@echo "Copied speedwm.html to ${HTMLDIR}."
|
||||
|
||||
page_push:
|
||||
echo ${HTMLDIR} > /tmp/speedwm-htmldir
|
||||
chmod +x scripts/speedwm-mkpage
|
||||
chmod +x scripts/speedwm-help
|
||||
./scripts/speedwm-mkpage -page-push
|
||||
|
||||
html:
|
||||
chmod +x scripts/speedwm-mkpage
|
||||
chmod +x scripts/speedwm-help
|
||||
./scripts/speedwm-mkpage -mkhtml
|
||||
|
||||
markdown:
|
||||
chmod +x scripts/speedwm-mkpage
|
||||
chmod +x scripts/speedwm-help
|
||||
./scripts/speedwm-mkpage -mkmd
|
||||
|
||||
readme:
|
||||
chmod +x scripts/speedwm-mkpage
|
||||
chmod +x scripts/speedwm-help
|
||||
./scripts/speedwm-mkpage -mk
|
||||
|
||||
gentoo-libxftfix:
|
||||
chmod +x scripts/libxftfix
|
||||
./scripts/libxftfix -gentoo
|
||||
|
||||
arch-libxftfix:
|
||||
chmod +x scripts/libxftfix
|
||||
./scripts/libxftfix -arch
|
||||
|
||||
.PHONY: all options clean dist install uninstall help libxftfix gentoo-libxftfix arch-libxftfix docs page page_install html markdown readme page_push upload release
|
439
README.md
Normal file
439
README.md
Normal file
|
@ -0,0 +1,439 @@
|
|||
https://speedie.gq/speedwm
|
||||
|
||||
https://speedie.gq/donate
|
||||
|
||||
## What is speedwm?
|
||||
speedwm is a window manager forked from suckless.org's dwm or dynamic window manager. It manages the user's open windows and tiles them according to a set layout (dynamic).
|
||||
Unlike dwm, speedwm tries to be minimal just dwm but also has functionality and aesthetics as a goal. It is also much more minimal than other window managers like i3-gaps while offering many more features.
|
||||
|
||||
Tiling window managers (unlike floating window managers that you may be used to) tile windows based on a set layout making them easy to get productive on.
|
||||
They also encourage the user to use their keyboard instead of the mouse so that the user doesn't have to move their hands much but there are mouse keybinds and more can be added.
|
||||
|
||||
## Installation
|
||||
In order to install this build of speedwm, all dependencies must be installed.
|
||||
You can see (Dependencies) for a list of all dependencies required to use this fork.
|
||||
|
||||
- git clone https://codeberg.org/speedie/speedwm
|
||||
- cd speedwm
|
||||
- make clean install
|
||||
- If any warnings show up, fix it by installing the missing dependency.
|
||||
- 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'.
|
||||
|
||||
## Layouts
|
||||
speedwm comes with the following layouts:
|
||||
|
||||
- Tile
|
||||
- Monocle
|
||||
- Grid
|
||||
- Deck
|
||||
- Centered Master
|
||||
- Centered Floating Master
|
||||
- Spiral
|
||||
- Dwindle
|
||||
- Three Column
|
||||
- Bottom Stack
|
||||
- Horizontal Bottom Stack
|
||||
- Horizonal Grid
|
||||
- Tatami
|
||||
- Tilewide
|
||||
- Stairs
|
||||
- Tiling (5:4)
|
||||
- Column
|
||||
- Dynamic Grid
|
||||
|
||||
They can be switched between using a little menu (See Keybinds for more information) or by right clicking the Layout indicator.
|
||||
The more commonly used layouts can be switched between using a quick keybind.
|
||||
|
||||
## Keybinds
|
||||
Below is a list of all speedwm keybinds.
|
||||
|
||||
### Applications
|
||||
|
||||
Keybinds for regular applications
|
||||
|
||||
- Super+Shift+Enter | Opens a terminal
|
||||
- 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+f | Opens the defined file manager
|
||||
- Super+Shift+w | Opens the defined web browser
|
||||
- Super+Shift+o | Opens the bundled dfmpeg dmenu script to record your screen.
|
||||
- Super+Shift+e | Opens the dboard dmenu script in dmenu which can copy text to your clipboard
|
||||
- Super+Shift+t | Opens the defined editor in your terminal
|
||||
- Super+Shift+p | Kills the defined web browser
|
||||
- Super+Shift+m | Kills the defined music player
|
||||
- Super+Shift+a | Opens the defined mixer in your terminal
|
||||
- Super+Shift+m | Opens the defined music player
|
||||
- Super+Shift+x | Opens the defined system process viewer in your terminal
|
||||
- Super+Control+Shift+m | Opens the defined email client
|
||||
- Super+Control+u | Opens the defined RSS reader
|
||||
|
||||
### Navigation
|
||||
|
||||
These keybinds are for navigating speedwm
|
||||
|
||||
- Super+t | Reorganize tags and move clients
|
||||
- Super+f | Full-screen the selected window
|
||||
- Super+b | Show/hide the speedwm bar
|
||||
- Super+s | Show/hide the systray (If trayer is installed)
|
||||
- Super+j/k | Move focus between visible windows
|
||||
- Super+Alt+j/k | Increase/decrease gaps between windows in tiling layout by 1
|
||||
- Super+Alt+u/d | Increase/decrease gaps between windows in tiling layout by 5
|
||||
- Super+Shift+j/k | Move focus between hidden windows
|
||||
- Super+a/d | Increase/decrease size of each window
|
||||
- Super+o | Hide a window
|
||||
- Super+Control+o | Show a window
|
||||
- Super+w | Hide all windows except focused
|
||||
- Super+Control+w | Show all windows except focused
|
||||
- Super+a/d | Move to the next/previous tag
|
||||
- Super+Minus | Show the scratchpad
|
||||
- Super+Equal | Remove the scratchpad
|
||||
- Super+Enter | Switch order of windows
|
||||
- Super+Shift+q | Close the current window
|
||||
- Super+Space | Set layout
|
||||
- Super+t | Disable inactive fade
|
||||
- Super+Shift+Equal | Toggle scratchpads
|
||||
- Super+Shift+Minus | Hide the scratchpad
|
||||
- Super+Shift+Space | Unfloat floating windows
|
||||
- Super+Shift+Arrow | Resizes a window in floating mode
|
||||
- Super+1 | Move to tag 1
|
||||
- Super+2 | Move to tag 2
|
||||
- Super+3 | Move to tag 3
|
||||
- Super+4 | Move to tag 4
|
||||
- Super+5 | Move to tag 5
|
||||
- Super+6 | Move to tag 6
|
||||
- Super+7 | Move to tag 7
|
||||
- Super+8 | Move to tag 8
|
||||
- Super+9 | Move to tag 9
|
||||
- Super+Shift+1 | Preview tag 1
|
||||
- Super+Shift+2 | Preview tag 2
|
||||
- Super+Shift+3 | Preview tag 3
|
||||
- Super+Shift+4 | Preview tag 4
|
||||
- Super+Shift+5 | Preview tag 5
|
||||
- Super+Shift+6 | Preview tag 6
|
||||
- Super+Shift+7 | Preview tag 7
|
||||
- Super+Shift+8 | Preview tag 8
|
||||
- Super+Shift+9 | Preview tag 9
|
||||
- Super+Shift+h/j/k/l | Rotates a stack.
|
||||
- Super+Shift+Escape | Ask the user if they want to shutdown or reboot or nothing
|
||||
- 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+Control+e | Switch to layout 3 (Grid)
|
||||
- Super+Control+r | Switch to layout 1 (Monocle)
|
||||
- Super+Control+t | Switch to layout 0 (Master & stack)
|
||||
- Super+Control+y | Switch to layout 4 (Deck)
|
||||
- Super+Control+0 | Set all windows to use the same tag
|
||||
- Super+Control+Arrow | Moves a window to any corner of your screen (Arrow key)
|
||||
- Super+Control+Tab | Open a dmenu prompt asking the user what layout to switch to
|
||||
- Super+Control+h | Open a list of all keybinds in your terminal using less
|
||||
- Super+Control+Shift+a/d | Move between available layouts
|
||||
- Super+Alt+s | Make the current selected window sticky
|
||||
- Super+Control+Shift+Esc | Open speedwm-utils (Main menu)
|
||||
- Super+Control+Shift+Arrow | Resize the window to the screen size.
|
||||
- Super+Control+Shift+s | Set a wallpaper
|
||||
- Super+Control+Shift+n | Connect to wifi (Requires iwd)
|
||||
- Super+Control+Shift+b | Connect to a bluetooth device (Requires bluez and bluez-utils)
|
||||
- Super+Control+Shift+e | Open up a list of dotfiles in dmenu that you can edit.
|
||||
- Alt+Tab | Switch windows quickly and easily
|
||||
- Alt+Control+j/k | Change window size vertically (cfact)
|
||||
|
||||
### Chained keybinds
|
||||
- Super+c & w | Curl wttr.in and open in less
|
||||
- Super+c & m | Ask the user for a topic and curl cheat.sh
|
||||
- Super+g & t | Toggle gaps
|
||||
- Super+g & 0 | Reset gaps
|
||||
- Super+g & i | Increase inner gaps by 1
|
||||
- Super+Shift+g & i | Decrease inner gaps by 1
|
||||
- Super+g & o | Increase outer gaps by 1
|
||||
- Super+Shift+g & o | Decrease outer gaps by 1
|
||||
- Super+r+v | Open the defined music visualizer
|
||||
|
||||
### Extras
|
||||
|
||||
These will only work if your keyboard has special multimedia buttons.
|
||||
|
||||
- Mute button | Mutes your audio
|
||||
- Up Volume button | Increases your volume
|
||||
- Down Volume button | Decreases your volume
|
||||
- Stop button | Stops your defined music player
|
||||
- Browser button | Opens your defined web browser
|
||||
- Power button | Ask if you wanna shut down, restart or lock your computer.
|
||||
- Email button | Open your defined email client
|
||||
- System button | Open your defined status viewer in a terminal
|
||||
|
||||
-- Mouse --
|
||||
|
||||
These binds can be activated using your mouse
|
||||
|
||||
- Tag <num> (Left click) | Switch to tag <num>
|
||||
- Layout indicator (Left 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
|
||||
- Window title (Left click) | Hide/Show the window
|
||||
- Window title (Right click) | Open speedwm-utils
|
||||
- Focused window (Super+Alt+Left click) | Move the focused window around
|
||||
- Focused window (Super+Alt+Middle click) | Make the focused window floating
|
||||
- Focused window title (Middle click) | Rotate stack
|
||||
- Dragging (Super+Right click) | Increase/decrease size of each window
|
||||
|
||||
There are also keybinds for statuscmd, but you must implement it into your own status bar.
|
||||
See mouse.h for more information.
|
||||
|
||||
## Dependencies
|
||||
These are absolutely necessary, speedwm will NOT compile without them
|
||||
- libxft-bgra (Can be installed through 'make <distro>-libxftfix')
|
||||
- NOTE: libXft will do but will cause speedwm and as such all your applications to crash if a colored emoji is displayed in the status bar.
|
||||
- libXinerama
|
||||
- Can be disabled through editing config.mk if you're not interested in multiple monitors.
|
||||
- imlib2
|
||||
|
||||
## Features
|
||||
These are dependencies if you wanna use certain features
|
||||
NOTE: Do not add any of these to .xinitrc or similar. They are going to be autostarted by speedwm.
|
||||
If you want to use an alternative, change it in options.h.
|
||||
- dmenu
|
||||
- NOTE: dmenu is required for most scripts included with this build of speedwm. My build is required for Pywal support.
|
||||
- NOTE 2: The build must have the 'grid' patch. If yours does not have this, you can patch it in or get my build here: https://codeberg.org/speedie/dmenu
|
||||
- picom
|
||||
- xclip (Required for clipboard support by a few scripts, will start automatically)
|
||||
- xwallpaper (Required to set wallpapers automatically)
|
||||
- xmodmap (Install if you want Escape instead of Caps Lock and Right Super+hjkl for arrow keys)
|
||||
- xrdb (Install if you want .Xresources support)
|
||||
- pywal (Install if you want pywal support. Requires swal aka the default way to set wallpapers)
|
||||
- wmctrl (Needed for proper window management)
|
||||
- xsetroot (Needed for most scripts including Pywal support)
|
||||
- slock (Required for screen locking)
|
||||
- maim (Required for built in 'speedwm-screenshotutil' script)
|
||||
|
||||
## 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'.
|
||||
You can also remove keybinds by editing 'keybinds.h' and running 'make clean install'.
|
||||
- st (Terminal)
|
||||
- firefox (Web browser)
|
||||
- htop (Status monitor)
|
||||
- newsboat (RSS reader)
|
||||
- zathura (PDF reader)
|
||||
- alsa-utils (Required for audio controls)
|
||||
- mocp (Default music player)
|
||||
- vim (Text editor)
|
||||
- neomutt (Email client)
|
||||
- maim (Screenshot tool, automatically copies to clipboard using xclip)
|
||||
- vifm (File manager)
|
||||
- slock (Lock screen)
|
||||
And everything under 'Features'.
|
||||
|
||||
## Important
|
||||
If you're used to dwm, speedwm might be a little unfamiliar to you at first. This is because speedwm doesn't use config.h (or config.def.h).
|
||||
Instead, config.h is split into different parts to make it easier to edit. Instead of editing config.h you'll want to edit:
|
||||
|
||||
- autostart.h for starting stuff right before speedwm (For example xclip, pywal, etc.)
|
||||
- options.h for changing colors and applications to use with keybinds.
|
||||
- fsignal.h for adding fake signals
|
||||
- colors.h for changing alpha options, most users won't need to edit it.
|
||||
- xresources.h for adding .Xresources options
|
||||
- rules.h for adding rules
|
||||
- keybinds.h for adding/removing keybinds.
|
||||
|
||||
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.
|
||||
|
||||
Another important detail you must keep in mind is that this build comes with a status bar simply named '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.
|
||||
|
||||
You can edit the status bar simply by editing 'status' and running 'make clean install'.
|
||||
You can also configure it by editing '~/.config/speedwm-de/status/config'.
|
||||
Please note that most status bars including the built in 'status' depends on xsetroot which must be installed. speedwm-compatcheck is going to tell you about this when compiling.
|
||||
|
||||
If you want to change status bar, edit options.h and set 'static char status' to your status bar binary (must be in $PATH).
|
||||
Alternatively, you can also set speedwm.status: <statusbar> in .Xresources (See .Xresources and Pywal)
|
||||
|
||||
## .Xresources and Pywal
|
||||
This fork of speedwm has .Xresources support thanks to the .Xresources patch.
|
||||
It also has pywal support (tool which grabs colors based on your wallpaper).
|
||||
|
||||
Colors reload automagically because of a reloadxresources function this build has combined with fsignal and a wallpaper script I wrote.
|
||||
Therefore, if you want colors to reload instantly, you're unfortunately forced to use the bundled wallpaper script.
|
||||
|
||||
If you want to use another script, you can open up speedwm-utils and select 'Reload .Xresources' to reload .Xresources.
|
||||
Alternatively, you can write a script yourself (18 reloads the colors)
|
||||
|
||||
Below is a list of all .Xresources values you can define. The .Xresources file should be placed in ~ or ~/.config by the user.
|
||||
If it is not or you want it somewhere else, you can edit 'autostart.h' and 'make clean install'.
|
||||
|
||||
Note that the 'xrdb' dependency is required for both pywal and .Xresources support and 'xsetroot' is required for automatic reloading of colors, the built in status bar, and more so you should install this.
|
||||
|
||||
- speedwm.nmaster: 1
|
||||
- speedwm.font: fontawesome:size=8
|
||||
- speedwm.font2: NotoSans-Regular:size=8:antialiasing=true
|
||||
- speedwm.font3: Noto Emoji:size=8
|
||||
- speedwm.col_background: #222222
|
||||
- speedwm.col_backgroundmid: #222222
|
||||
- speedwm.col_textnorm: #bbbbbb
|
||||
- speedwm.col_textsel: #eeeeee
|
||||
- speedwm.col_windowbordersel: #eeeeee
|
||||
- speedwm.col_windowbordernorm: #000000
|
||||
- speedwm.col_tag1: #333333
|
||||
- speedwm.col_tag1_text: #eeeeee
|
||||
- speedwm.col_tag2: #333333
|
||||
- speedwm.col_tag2_text: #eeeeee
|
||||
- speedwm.col_tag3: #333333
|
||||
- speedwm.col_tag3_text: #eeeeee
|
||||
- speedwm.col_tag4: #333333
|
||||
- speedwm.col_tag4_text: #eeeeee
|
||||
- speedwm.col_tag5: #333333
|
||||
- speedwm.col_tag5_text: #eeeeee
|
||||
- speedwm.col_tag6: #333333
|
||||
- speedwm.col_tag6_text: #eeeeee
|
||||
- speedwm.col_tag7: #333333
|
||||
- speedwm.col_tag7_text: #eeeeee
|
||||
- speedwm.col_tag8: #333333
|
||||
- speedwm.col_tag8_text: #eeeeee
|
||||
- speedwm.col_tag9: #333333
|
||||
- speedwm.col_tag9_text: #eeeeee
|
||||
- speedwm.col_layouttext: #000000
|
||||
- speedwm.col_layoutbgnorm: #222222
|
||||
- speedwm.col_layoutbgsel: #bbbbbb
|
||||
- speedwm.col_status0: #131210
|
||||
- speedwm.col_status1: #bf616a
|
||||
- speedwm.col_status2: #A16F9D
|
||||
- speedwm.col_status3: #68ABAA
|
||||
- speedwm.col_status4: #A89F93
|
||||
- speedwm.col_status5: #D3A99B
|
||||
- speedwm.col_status6: #AFC9AC
|
||||
- speedwm.col_status7: #eae1cb
|
||||
- speedwm.col_status8: #a39d8e
|
||||
- speedwm.col_status9: #6D5E8E
|
||||
- speedwm.col_status10: #A16F9D
|
||||
- speedwm.col_status11: #D3A99B
|
||||
- speedwm.col_status12: #AFC9AC
|
||||
- speedwm.col_status13: #eae1cb
|
||||
- speedwm.col_status14: #6D5E8E
|
||||
- speedwm.col_status15: #ffffff
|
||||
- speedwm.borderpx: 1
|
||||
- speedwm.snap: 20
|
||||
- speedwm.showbar: 1
|
||||
- speedwm.resizehints: 0
|
||||
- speedwm.mousemfact: 1
|
||||
- speedwm.mfact: 0.50
|
||||
- speedwm.startontag: 1
|
||||
- speedwm.enablegaps: 1
|
||||
- speedwm.smartgaps: 1
|
||||
- speedwm.smartgapsize: 0
|
||||
- speedwm.gappih: 10
|
||||
- speedwm.gappiv: 10
|
||||
- speedwm.gappoh: 10
|
||||
- speedwm.gappov: 10
|
||||
- speedwm.attachdirection: 3
|
||||
- speedwm.shell: /bin/sh
|
||||
- speedwm.sizeicon: 10
|
||||
- speedwm.spacingicon: 5
|
||||
- speedwm.status: status
|
||||
- speedwm.defaultname:
|
||||
- speedwm.refreshrules: 1
|
||||
- speedwm.decorhints: 1
|
||||
- speedwm.barpaddingv: 0
|
||||
- speedwm.barpaddingh: 0
|
||||
- speedwm.barheight: 5
|
||||
- speedwm.altbar: 0
|
||||
- speedwm.altbarclass: Polybar
|
||||
- speedwm.alttrayname: tray
|
||||
- speedwm.altbarcmd: polybar &
|
||||
- speedwm.centerfloating: 1
|
||||
- speedwm.savefloat: 1
|
||||
- speedwm.warpcursor: 1
|
||||
- speedwm.pertag: 1
|
||||
- speedwm.i3nmaster: 0
|
||||
- speedwm.scalepreview: 4
|
||||
- speedwm.tagpreview: 1
|
||||
- speedwm.mousepreview: 1
|
||||
- speedwm.monocleclientcount: 0
|
||||
- speedwm.monoclecount: 0
|
||||
- speedwm.monocleformat: [%d/%d]
|
||||
- speedwm.statusallmons: 1
|
||||
- speedwm.hidelayout: 0
|
||||
- speedwm.hidetitle: 0
|
||||
- speedwm.hidestatus: 0
|
||||
- speedwm.hidetags: 0
|
||||
- speedwm.hidesticky: 0
|
||||
- speedwm.hidefloating: 0
|
||||
- speedwm.leftlayout: 1
|
||||
- speedwm.fadeinactive: 1
|
||||
- speedwm.defaultlayout: 1
|
||||
- speedwm.wmclass: 1
|
||||
- speedwm.clicktofocus: 0
|
||||
- speedwm.stairpx: 20
|
||||
- speedwm.stairdirection: 1
|
||||
- speedwm.stairsamesize: 1
|
||||
- speedwm.deckcount: 0
|
||||
- speedwm.deckformat: D %d
|
||||
- speedwm.roundedcorners: 0
|
||||
- speedwm.cornerradius: 3
|
||||
- speedwm.swallowclients: 1
|
||||
- speedwm.swallowfloating: 1
|
||||
- speedwm.movefullscreenmon: 0
|
||||
- speedwm.lockfullscreen: 1
|
||||
- speedwm.underline: 0
|
||||
- speedwm.underlineall: 0
|
||||
- speedwm.underlinepad: 5
|
||||
- speedwm.underlinestroke: 2
|
||||
- speedwm.underlinevoffset: 0
|
||||
- speedwm.forcevsplit: 1
|
||||
- speedwm.floatscratchpad: 0
|
||||
|
||||
## Fsignal
|
||||
Thanks to the 'fsignal' patch available on suckless.org's website, we can easily write shell scripts to interact with dwm and therefore speedwm.
|
||||
This is exactly what I did and speedwm-utils, speedwm-swal, speedwm-shutdown and more take advantage of it.
|
||||
|
||||
In order to use 'fsignal', your system must have 'xsetroot' installed.
|
||||
Then simply use the dwm-utils script. Syntax is dwm-utils -exec <signum>
|
||||
|
||||
Below is a list of all signums and what they do.
|
||||
|
||||
- 1 | Switch to the Tiling layout
|
||||
- 2 | Switch to the Floating layout
|
||||
- 3 | Switch to the Monocle layout
|
||||
- 4 | Switch to the Grid layout
|
||||
- 5 | Switch to the Deck layout
|
||||
- 6 | Switch to the Centered Master layout
|
||||
- 7 | Switch to the Centered Floating Master layout
|
||||
- 8 | Switch to the Fibonacci Spiral layout
|
||||
- 9 | Switch to the Fibonacci Dwindle layout
|
||||
- 10 | Switch to the Three Column layout
|
||||
- 11 | Switch to the Bottom Stack Vertical layout
|
||||
- 12 | Switch to the Bottom Stack Horizontal layout
|
||||
- 13 | Switch to the Horizontal Grid layout
|
||||
- 14 | Switch to the Tatami layout
|
||||
- 15 | To be added
|
||||
- 16 | Cycle layout (Previous)
|
||||
- 17 | Cycle layout (Next)
|
||||
- 18 | Reload colors from .Xresources
|
||||
- 19 | Set mfact (-0.05)
|
||||
- 20 | Set mfact (+0.05)
|
||||
- 21 | Toggle Scratchpad
|
||||
- 22 | Toggle Sticky
|
||||
- 23 | Toggle Bar
|
||||
- 24 | Toggle Fullscreen
|
||||
- 25 | Restart speedwm keeping all your applications open.
|
||||
- 26 | Unused at the moment.
|
||||
- 27 | Switch to the Stairs layout
|
||||
- 28 | Reset layout and mfact
|
||||
- 29 | Reorganize tags
|
||||
- 30 | Restart speedwm
|
||||
- 31 | Shutdown speedwm
|
||||
- 32 | To be added
|
||||
- 33 | To be added
|
||||
- 34 | To be added
|
||||
- 35 | Switch to the Tiling (5:4) layout
|
||||
- 36 | Switch to the Column layout
|
||||
- 37 | Switch to the Dynamic Grid layout
|
||||
|
||||
## Switching run launcher
|
||||
Some users may prefer to use a different run launcher than dmenu.
|
||||
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
|
||||
- Add export RUNLAUNCHER=<runlauncher> to your .<shell>rc
|
||||
|
||||
Run launchers must support dmenu arguments because otherwise scripts are going to be incompatible.
|
||||
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.
|
44
autostart.h
Normal file
44
autostart.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* Anything in here will automatically start before speedwm
|
||||
* I use it to start my status bar and some other stuff, though.
|
||||
*
|
||||
* If you wish to run more commands, add a line below.
|
||||
*
|
||||
* Syntax: "shell, "-c", "<command>", NULL,"
|
||||
*
|
||||
* "shell" is automatically defined as your shell.
|
||||
*
|
||||
* If you need help, run speedwm-keybinds.
|
||||
* Once you're done with your edits, run 'make clean install'.
|
||||
*************************************************************/
|
||||
|
||||
#define STATUSBAR status
|
||||
#define ICONSIZE sizeicon
|
||||
#define ICONSPACING spacingicon
|
||||
static const char *const autostart[] = {
|
||||
|
||||
/* Bind Right Super+hjkl to arrow keys */
|
||||
shell, "-c", "xmodmap -e 'keycode 134 = Mode_switch'", NULL,
|
||||
shell, "-c", "xmodmap -e 'keycode 43 = h H Left H'", NULL,
|
||||
shell, "-c", "xmodmap -e 'keycode 44 = j J Down J'", NULL,
|
||||
shell, "-c", "xmodmap -e 'keycode 45 = k K Up K", NULL,
|
||||
shell, "-c", "xmodmap -e 'keycode 46 = l L Right L", NULL,
|
||||
|
||||
/* Caps Lock = Escape */
|
||||
shell, "-c", "xmodmap -e 'clear Lock'", NULL,
|
||||
shell, "-c", "xmodmap -e 'keycode 66 = Escape NoSymbol Escape'", NULL,
|
||||
|
||||
/* Run the defined clipboard manager */
|
||||
shell, "-c", CLIPBOARD "&", NULL,
|
||||
|
||||
/* Run the defined compositor */
|
||||
shell, "-c", COMPOSITOR "&", NULL,
|
||||
|
||||
/* Run the defined notification daemon */
|
||||
shell, "-c", NOTIFICATION "&", NULL,
|
||||
|
||||
/* Run the status bar defined */
|
||||
shell, "-c", STATUSBAR, NULL,
|
||||
|
||||
NULL
|
||||
};
|
||||
|
73
colors.h
Normal file
73
colors.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* Color/Alpha settings
|
||||
* You probably don't need to change these unless you want special opacity settings.
|
||||
*
|
||||
* Once you're done with your edits, run 'make clean install'. */
|
||||
|
||||
/* Misc color options */
|
||||
static char *colors[][3] = {
|
||||
[SchemeBar] = { col_textnorm, col_background, col_windowbordernorm },
|
||||
[SchemeTags] = { col_textnorm, col_background, col_windowbordernorm },
|
||||
[SchemeNormBorder] = { col_textnorm, col_background, col_windowbordernorm },
|
||||
[SchemeSelBorder] = { col_textsel, col_windowbordernorm, col_windowbordersel },
|
||||
[SchemeStatus] = { col_textnorm, col_textsel, col_textsel },
|
||||
[SchemeNormTitle] = { col_textnorm, col_background, col_background },
|
||||
[SchemeSelTitle] = { col_textsel, col_backgroundmid, col_textsel },
|
||||
[SchemeHid] = { col_backgroundmid, col_background, col_backgroundmid },
|
||||
[SchemeLayout] = { col_layouttext, col_layoutbgsel, col_layoutbgnorm },
|
||||
/* text background window border
|
||||
*/
|
||||
};
|
||||
|
||||
/* Colors for the status bar (.Xresources) */
|
||||
static char *colstatus[] = {
|
||||
col_status0,
|
||||
col_status1,
|
||||
col_status2,
|
||||
col_status3,
|
||||
col_status4,
|
||||
col_status5,
|
||||
col_status6,
|
||||
col_status7,
|
||||
col_status8,
|
||||
col_status9,
|
||||
col_status10,
|
||||
col_status11,
|
||||
col_status12,
|
||||
col_status13,
|
||||
col_status14,
|
||||
col_status15,
|
||||
};
|
||||
|
||||
/* Colors to use for opacity
|
||||
*/
|
||||
|
||||
static const unsigned int alphas[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeBar] = { OPAQUE, baropacity, baropacity },
|
||||
[SchemeNormTitle] = { OPAQUE, normtitleopacity, normtitleopacity },
|
||||
[SchemeSelTitle] = { OPAQUE, seltitleopacity, seltitleopacity },
|
||||
[SchemeLayout] = { OPAQUE, layoutopacity, layoutopacity },
|
||||
[SchemeStatus] = { OPAQUE, statusopacity, statusopacity },
|
||||
[SchemeHid] = { hiddenopacity, hiddenopacity, hiddenopacity },
|
||||
[SchemeTags] = { tagselopacity, tagselopacity, tagnormopacity },
|
||||
};
|
||||
|
||||
/* Colors to use for tags */
|
||||
static char *tagsel[][2] = {
|
||||
{ col_tag1_text, col_tag1 },
|
||||
{ col_tag2_text, col_tag2 },
|
||||
{ col_tag3_text, col_tag3 },
|
||||
{ col_tag4_text, col_tag4 },
|
||||
{ col_tag5_text, col_tag5 },
|
||||
{ col_tag6_text, col_tag6 },
|
||||
{ col_tag7_text, col_tag7 },
|
||||
{ col_tag8_text, col_tag8 },
|
||||
{ col_tag9_text, col_tag9 },
|
||||
/* Text Background */
|
||||
};
|
||||
|
||||
/* Alpha for tags */
|
||||
static const unsigned int tagalpha[] = {
|
||||
tagselopacity,
|
||||
tagnormopacity,
|
||||
};
|
55
config.mk
Normal file
55
config.mk
Normal file
|
@ -0,0 +1,55 @@
|
|||
# speedwm compilation options
|
||||
#
|
||||
# Depending on your configuration, you may need to uncomment some lines here.
|
||||
|
||||
# OpenBSD support
|
||||
# If you use OpenBSD, uncomment this line. (remove the # at the start of the line below)
|
||||
#FREETYPEINC = ${X11INC}/freetype2
|
||||
|
||||
# Solaris support
|
||||
# If you use Solaris, uncomment this line. (remove the # at the start of the line below)
|
||||
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
|
||||
#LDFLAGS = ${LIBS}
|
||||
|
||||
# Xinerama, comment these lines if you don't want multimonitor support
|
||||
# If you don't know what this means, don't change anything and install:
|
||||
# Arch: libxinerama
|
||||
# Gentoo: libXinerama
|
||||
# Debian: libXinerama-devel
|
||||
XINERAMALIBS = -lXinerama
|
||||
XINERAMAFLAGS = -DXINERAMA
|
||||
|
||||
# Compiling with -Ofast. If you're having issues (such as dwm crashing, change it to -O2. (That's not a zero)
|
||||
# Using -O2 is not recommended due to the usage of Imlib2.
|
||||
# If these features are used, they will be slow with the use of -O2.
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Ofast ${INCS} ${CPPFLAGS}
|
||||
LDFLAGS = ${LIBS}
|
||||
|
||||
# Compiler and linker.
|
||||
# You can swap this out if you know what you're doing.
|
||||
CC = cc
|
||||
|
||||
# Paths
|
||||
# These should be fine for most users but if you use a distribution of GNU/Linux like NixOS or GNU Guix, consider changing this to fit your use case.
|
||||
# HTMLDIR is only useful if you are using 'make release'.
|
||||
PREFIX = /usr
|
||||
HTMLDIR = "/home/anon/Projects/spdgmr.github.io/"
|
||||
|
||||
###################################################################################
|
||||
|
||||
# speedwm version
|
||||
VERSION = 0.1
|
||||
|
||||
X11INC = /usr/X11R6/include
|
||||
X11LIB = /usr/X11R6/lib
|
||||
|
||||
# freetype
|
||||
FREETYPELIBS = -lfontconfig -lXft
|
||||
FREETYPEINC = /usr/include/freetype2
|
||||
|
||||
# includes and libs
|
||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender -lImlib2 -lX11-xcb -lxcb -lxcb-res -lXext
|
||||
|
||||
# flags
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
47
docs/about
Normal file
47
docs/about
Normal file
|
@ -0,0 +1,47 @@
|
|||
-- speedwm --
|
||||
https://speedie.gq/speedwm
|
||||
|
||||
https://speedie.gq/donate
|
||||
|
||||
-- What is speedwm? --
|
||||
speedwm is a window manager forked from suckless.org's dwm or dynamic window manager. It manages the user's open windows and tiles them according to a set layout (dynamic).
|
||||
Unlike dwm, speedwm tries to be minimal just dwm but also has functionality and aesthetics as a goal. It is also much more minimal than other window managers like i3-gaps while offering many more features.
|
||||
|
||||
Tiling window managers (unlike floating window managers that you may be used to) tile windows based on a set layout making them easy to get productive on.
|
||||
They also encourage the user to use their keyboard instead of the mouse so that the user doesn't have to move their hands much but there are mouse keybinds and more can be added.
|
||||
|
||||
-- Installation --
|
||||
In order to install this build of speedwm, all dependencies must be installed.
|
||||
You can see (Dependencies) for a list of all dependencies required to use this fork.
|
||||
|
||||
- git clone https://codeberg.org/speedie/speedwm
|
||||
- cd speedwm
|
||||
- make clean install
|
||||
- If any warnings show up, fix it by installing the missing dependency.
|
||||
- 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'.
|
||||
|
||||
-- Layouts --
|
||||
speedwm comes with the following layouts:
|
||||
|
||||
- Tile
|
||||
- Monocle
|
||||
- Grid
|
||||
- Deck
|
||||
- Centered Master
|
||||
- Centered Floating Master
|
||||
- Spiral
|
||||
- Dwindle
|
||||
- Three Column
|
||||
- Bottom Stack
|
||||
- Horizontal Bottom Stack
|
||||
- Horizonal Grid
|
||||
- Tatami
|
||||
- Tilewide
|
||||
- Stairs
|
||||
- Tiling (5:4)
|
||||
- Column
|
||||
- Dynamic Grid
|
||||
|
||||
They can be switched between using a little menu (See Keybinds for more information) or by right clicking the Layout indicator.
|
||||
The more commonly used layouts can be switched between using a quick keybind.
|
4
docs/about2
Normal file
4
docs/about2
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
-- Keybinds --
|
||||
Below is a list of all speedwm keybinds.
|
||||
|
40
docs/about3
Normal file
40
docs/about3
Normal file
|
@ -0,0 +1,40 @@
|
|||
-- Important --
|
||||
If you're used to dwm, speedwm might be a little unfamiliar to you at first. This is because speedwm doesn't use config.h (or config.def.h).
|
||||
Instead, config.h is split into different parts to make it easier to edit. Instead of editing config.h you'll want to edit:
|
||||
|
||||
- autostart.h for starting stuff right before speedwm (For example xclip, pywal, etc.)
|
||||
- options.h for changing colors and applications to use with keybinds.
|
||||
- fsignal.h for adding fake signals
|
||||
- colors.h for changing alpha options, most users won't need to edit it.
|
||||
- xresources.h for adding .Xresources options
|
||||
- rules.h for adding rules
|
||||
- keybinds.h for adding/removing keybinds.
|
||||
|
||||
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.
|
||||
|
||||
Another important detail you must keep in mind is that this build comes with a status bar simply named '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.
|
||||
|
||||
You can edit the status bar simply by editing 'status' and running 'make clean install'.
|
||||
You can also configure it by editing '~/.config/speedwm-de/status/config'.
|
||||
Please note that most status bars including the built in 'status' depends on xsetroot which must be installed. speedwm-compatcheck is going to tell you about this when compiling.
|
||||
|
||||
If you want to change status bar, edit options.h and set 'static char status' to your status bar binary (must be in $PATH).
|
||||
Alternatively, you can also set "speedwm.status: <statusbar>" in .Xresources (See .Xresources and Pywal)
|
||||
|
||||
-- .Xresources and Pywal --
|
||||
This fork of speedwm has .Xresources support thanks to the .Xresources patch.
|
||||
It also has pywal support (tool which grabs colors based on your wallpaper).
|
||||
|
||||
Colors reload automagically because of a reloadxresources function this build has combined with fsignal and a wallpaper script I wrote.
|
||||
Therefore, if you want colors to reload instantly, you're unfortunately forced to use the bundled wallpaper script.
|
||||
|
||||
If you want to use another script, you can open up speedwm-utils and select 'Reload .Xresources' to reload .Xresources.
|
||||
Alternatively, you can write a script yourself (xsetroot -name "fsignal:18" reloads the colors)
|
||||
|
||||
Below is a list of all .Xresources values you can define. The .Xresources file should be placed in ~ or ~/.config by the user.
|
||||
If it is not or you want it somewhere else, you can edit 'autostart.h' and 'make clean install'.
|
||||
|
||||
Note that the 'xrdb' dependency is required for both pywal and .Xresources support and 'xsetroot' is required for automatic reloading of colors, the built in status bar, and more so you should install this.
|
||||
|
10
docs/about4
Normal file
10
docs/about4
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
-- Fsignal --
|
||||
Thanks to the 'fsignal' patch available on suckless.org's website, we can easily write shell scripts to interact with dwm and therefore speedwm.
|
||||
This is exactly what I did and speedwm-utils, speedwm-swal, speedwm-shutdown and more take advantage of it.
|
||||
|
||||
In order to use 'fsignal', your system must have 'xsetroot' installed.
|
||||
Then simply use the dwm-utils script. Syntax is dwm-utils -exec <signum>
|
||||
|
||||
Below is a list of all signums and what they do.
|
||||
|
9
docs/about5
Normal file
9
docs/about5
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- Switching run launcher --
|
||||
Some users may prefer to use a different run launcher than dmenu.
|
||||
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
|
||||
- Add "export RUNLAUNCHER=<runlauncher>" to your .<shell>rc
|
||||
|
||||
Run launchers must support dmenu arguments because otherwise scripts are going to be incompatible.
|
||||
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.
|
131
docs/bindlist
Normal file
131
docs/bindlist
Normal file
|
@ -0,0 +1,131 @@
|
|||
-- Applications --
|
||||
|
||||
Keybinds for regular applications
|
||||
|
||||
- Super+Shift+Enter | Opens a terminal
|
||||
- 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+f | Opens the defined file manager
|
||||
- Super+Shift+w | Opens the defined web browser
|
||||
- Super+Shift+o | Opens the bundled dfmpeg dmenu script to record your screen.
|
||||
- Super+Shift+e | Opens the dboard dmenu script in dmenu which can copy text to your clipboard
|
||||
- Super+Shift+t | Opens the defined editor in your terminal
|
||||
- Super+Shift+p | Kills the defined web browser
|
||||
- Super+Shift+m | Kills the defined music player
|
||||
- Super+Shift+a | Opens the defined mixer in your terminal
|
||||
- Super+Shift+m | Opens the defined music player
|
||||
- Super+Shift+x | Opens the defined system process viewer in your terminal
|
||||
- Super+Control+Shift+m | Opens the defined email client
|
||||
- Super+Control+u | Opens the defined RSS reader
|
||||
|
||||
-- Navigation --
|
||||
|
||||
These keybinds are for navigating speedwm
|
||||
|
||||
- Super+t | Reorganize tags and move clients
|
||||
- Super+f | Full-screen the selected window
|
||||
- Super+b | Show/hide the speedwm bar
|
||||
- Super+s | Show/hide the systray (If trayer is installed)
|
||||
- Super+j/k | Move focus between visible windows
|
||||
- Super+Alt+j/k | Increase/decrease gaps between windows in tiling layout by 1
|
||||
- Super+Alt+u/d | Increase/decrease gaps between windows in tiling layout by 5
|
||||
- Super+Shift+j/k | Move focus between hidden windows
|
||||
- Super+a/d | Increase/decrease size of each window
|
||||
- Super+o | Hide a window
|
||||
- Super+Control+o | Show a window
|
||||
- Super+w | Hide all windows except focused
|
||||
- Super+Control+w | Show all windows except focused
|
||||
- Super+a/d | Move to the next/previous tag
|
||||
- Super+Minus | Show the scratchpad
|
||||
- Super+Equal | Remove the scratchpad
|
||||
- Super+Enter | Switch order of windows
|
||||
- Super+Shift+q | Close the current window
|
||||
- Super+Space | Set layout
|
||||
- Super+t | Disable inactive fade
|
||||
- Super+Shift+Equal | Toggle scratchpads
|
||||
- Super+Shift+Minus | Hide the scratchpad
|
||||
- Super+Shift+Space | Unfloat floating windows
|
||||
- Super+Shift+Arrow | Resizes a window in floating mode
|
||||
- Super+1 | Move to tag 1
|
||||
- Super+2 | Move to tag 2
|
||||
- Super+3 | Move to tag 3
|
||||
- Super+4 | Move to tag 4
|
||||
- Super+5 | Move to tag 5
|
||||
- Super+6 | Move to tag 6
|
||||
- Super+7 | Move to tag 7
|
||||
- Super+8 | Move to tag 8
|
||||
- Super+9 | Move to tag 9
|
||||
- Super+Shift+1 | Preview tag 1
|
||||
- Super+Shift+2 | Preview tag 2
|
||||
- Super+Shift+3 | Preview tag 3
|
||||
- Super+Shift+4 | Preview tag 4
|
||||
- Super+Shift+5 | Preview tag 5
|
||||
- Super+Shift+6 | Preview tag 6
|
||||
- Super+Shift+7 | Preview tag 7
|
||||
- Super+Shift+8 | Preview tag 8
|
||||
- Super+Shift+9 | Preview tag 9
|
||||
- Super+Shift+h/j/k/l | Rotates a stack.
|
||||
- Super+Shift+Escape | Ask the user if they want to shutdown or reboot or nothing
|
||||
- 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+Control+e | Switch to layout 3 (Grid)
|
||||
- Super+Control+r | Switch to layout 1 (Monocle)
|
||||
- Super+Control+t | Switch to layout 0 (Master & stack)
|
||||
- Super+Control+y | Switch to layout 4 (Deck)
|
||||
- Super+Control+0 | Set all windows to use the same tag
|
||||
- Super+Control+Arrow | Moves a window to any corner of your screen (Arrow key)
|
||||
- Super+Control+Tab | Open a dmenu prompt asking the user what layout to switch to
|
||||
- Super+Control+h | Open a list of all keybinds in your terminal using less
|
||||
- Super+Control+Shift+a/d | Move between available layouts
|
||||
- Super+Alt+s | Make the current selected window sticky
|
||||
- Super+Control+Shift+Esc | Open speedwm-utils (Main menu)
|
||||
- Super+Control+Shift+Arrow | Resize the window to the screen size.
|
||||
- Super+Control+Shift+s | Set a wallpaper
|
||||
- Super+Control+Shift+n | Connect to wifi (Requires iwd)
|
||||
- Super+Control+Shift+b | Connect to a bluetooth device (Requires bluez and bluez-utils)
|
||||
- Super+Control+Shift+e | Open up a list of dotfiles in dmenu that you can edit.
|
||||
- Alt+Tab | Switch windows quickly and easily
|
||||
- Alt+Control+j/k | Change window size vertically (cfact)
|
||||
|
||||
-- Chained keybinds --
|
||||
- Super+c & w | Curl wttr.in and open in less
|
||||
- Super+c & m | Ask the user for a topic and curl cheat.sh
|
||||
- Super+g & t | Toggle gaps
|
||||
- Super+g & 0 | Reset gaps
|
||||
- Super+g & i | Increase inner gaps by 1
|
||||
- Super+Shift+g & i | Decrease inner gaps by 1
|
||||
- Super+g & o | Increase outer gaps by 1
|
||||
- Super+Shift+g & o | Decrease outer gaps by 1
|
||||
- Super+r+v | Open the defined music visualizer
|
||||
|
||||
-- Extras --
|
||||
|
||||
These will only work if your keyboard has special multimedia buttons.
|
||||
|
||||
- Mute button | Mutes your audio
|
||||
- Up Volume button | Increases your volume
|
||||
- Down Volume button | Decreases your volume
|
||||
- Stop button | Stops your defined music player
|
||||
- Browser button | Opens your defined web browser
|
||||
- Power button | Ask if you wanna shut down, restart or lock your computer.
|
||||
- Email button | Open your defined email client
|
||||
- System button | Open your defined status viewer in a terminal
|
||||
|
||||
-- Mouse --
|
||||
|
||||
These binds can be activated using your mouse
|
||||
|
||||
- Tag <num> (Left click) | Switch to tag <num>
|
||||
- Layout indicator (Left 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
|
||||
- Window title (Left click) | Hide/Show the window
|
||||
- Window title (Right click) | Open speedwm-utils
|
||||
- Focused window (Super+Alt+Left click) | Move the focused window around
|
||||
- Focused window (Super+Alt+Middle click) | Make the focused window floating
|
||||
- Focused window title (Middle click) | Rotate stack
|
||||
- Dragging (Super+Right click) | Increase/decrease size of each window
|
||||
|
||||
There are also keybinds for statuscmd, but you must implement it into your own status bar.
|
||||
See mouse.h for more information.
|
||||
|
44
docs/deplist
Normal file
44
docs/deplist
Normal file
|
@ -0,0 +1,44 @@
|
|||
-- Dependencies --
|
||||
These are absolutely necessary, speedwm will NOT compile without them
|
||||
- libxft-bgra (Can be installed through 'make <distro>-libxftfix')
|
||||
- NOTE: libXft will do but will cause speedwm and as such all your applications to crash if a colored emoji is displayed in the status bar.
|
||||
- libXinerama
|
||||
- Can be disabled through editing config.mk if you're not interested in multiple monitors.
|
||||
- imlib2
|
||||
|
||||
-- Features --
|
||||
These are dependencies if you wanna use certain features
|
||||
NOTE: Do not add any of these to .xinitrc or similar. They are going to be autostarted by speedwm.
|
||||
If you want to use an alternative, change it in options.h.
|
||||
- dmenu
|
||||
- NOTE: dmenu is required for most scripts included with this build of speedwm. My build is required for Pywal support.
|
||||
- NOTE 2: The build must have the 'grid' patch. If yours does not have this, you can patch it in or get my build here: https://codeberg.org/speedie/dmenu
|
||||
- picom
|
||||
- xclip (Required for clipboard support by a few scripts, will start automatically)
|
||||
- xwallpaper (Required to set wallpapers automatically)
|
||||
- xmodmap (Install if you want Escape instead of Caps Lock and Right Super+hjkl for arrow keys)
|
||||
- xrdb (Install if you want .Xresources support)
|
||||
- pywal (Install if you want pywal support. Requires swal aka the default way to set wallpapers)
|
||||
- wmctrl (Needed for proper window management)
|
||||
- xsetroot (Needed for most scripts including Pywal support)
|
||||
- slock (Required for screen locking)
|
||||
- maim (Required for built in 'speedwm-screenshotutil' script)
|
||||
|
||||
-- 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'.
|
||||
You can also remove keybinds by editing 'keybinds.h' and running 'make clean install'.
|
||||
- st (Terminal)
|
||||
- firefox (Web browser)
|
||||
- htop (Status monitor)
|
||||
- newsboat (RSS reader)
|
||||
- zathura (PDF reader)
|
||||
- alsa-utils (Required for audio controls)
|
||||
- mocp (Default music player)
|
||||
- vim (Text editor)
|
||||
- neomutt (Email client)
|
||||
- maim (Screenshot tool, automatically copies to clipboard using xclip)
|
||||
- vifm (File manager)
|
||||
- slock (Lock screen)
|
||||
And everything under 'Features'.
|
||||
|
117
docs/example.Xresources
Normal file
117
docs/example.Xresources
Normal file
|
@ -0,0 +1,117 @@
|
|||
- speedwm.nmaster: 1
|
||||
- speedwm.font: fontawesome:size=8
|
||||
- speedwm.font2: NotoSans-Regular:size=8:antialiasing=true
|
||||
- speedwm.font3: Noto Emoji:size=8
|
||||
- speedwm.col_background: #222222
|
||||
- speedwm.col_backgroundmid: #222222
|
||||
- speedwm.col_textnorm: #bbbbbb
|
||||
- speedwm.col_textsel: #eeeeee
|
||||
- speedwm.col_windowbordersel: #eeeeee
|
||||
- speedwm.col_windowbordernorm: #000000
|
||||
- speedwm.col_tag1: #333333
|
||||
- speedwm.col_tag1_text: #eeeeee
|
||||
- speedwm.col_tag2: #333333
|
||||
- speedwm.col_tag2_text: #eeeeee
|
||||
- speedwm.col_tag3: #333333
|
||||
- speedwm.col_tag3_text: #eeeeee
|
||||
- speedwm.col_tag4: #333333
|
||||
- speedwm.col_tag4_text: #eeeeee
|
||||
- speedwm.col_tag5: #333333
|
||||
- speedwm.col_tag5_text: #eeeeee
|
||||
- speedwm.col_tag6: #333333
|
||||
- speedwm.col_tag6_text: #eeeeee
|
||||
- speedwm.col_tag7: #333333
|
||||
- speedwm.col_tag7_text: #eeeeee
|
||||
- speedwm.col_tag8: #333333
|
||||
- speedwm.col_tag8_text: #eeeeee
|
||||
- speedwm.col_tag9: #333333
|
||||
- speedwm.col_tag9_text: #eeeeee
|
||||
- speedwm.col_layouttext: #000000
|
||||
- speedwm.col_layoutbgnorm: #222222
|
||||
- speedwm.col_layoutbgsel: #bbbbbb
|
||||
- speedwm.col_status0: #131210
|
||||
- speedwm.col_status1: #bf616a
|
||||
- speedwm.col_status2: #A16F9D
|
||||
- speedwm.col_status3: #68ABAA
|
||||
- speedwm.col_status4: #A89F93
|
||||
- speedwm.col_status5: #D3A99B
|
||||
- speedwm.col_status6: #AFC9AC
|
||||
- speedwm.col_status7: #eae1cb
|
||||
- speedwm.col_status8: #a39d8e
|
||||
- speedwm.col_status9: #6D5E8E
|
||||
- speedwm.col_status10: #A16F9D
|
||||
- speedwm.col_status11: #D3A99B
|
||||
- speedwm.col_status12: #AFC9AC
|
||||
- speedwm.col_status13: #eae1cb
|
||||
- speedwm.col_status14: #6D5E8E
|
||||
- speedwm.col_status15: #ffffff
|
||||
- speedwm.borderpx: 1
|
||||
- speedwm.snap: 20
|
||||
- speedwm.showbar: 1
|
||||
- speedwm.resizehints: 0
|
||||
- speedwm.mousemfact: 1
|
||||
- speedwm.mfact: 0.50
|
||||
- speedwm.startontag: 1
|
||||
- speedwm.enablegaps: 1
|
||||
- speedwm.smartgaps: 1
|
||||
- speedwm.smartgapsize: 0
|
||||
- speedwm.gappih: 10
|
||||
- speedwm.gappiv: 10
|
||||
- speedwm.gappoh: 10
|
||||
- speedwm.gappov: 10
|
||||
- speedwm.attachdirection: 3
|
||||
- speedwm.shell: /bin/sh
|
||||
- speedwm.sizeicon: 10
|
||||
- speedwm.spacingicon: 5
|
||||
- speedwm.status: status
|
||||
- speedwm.defaultname:
|
||||
- speedwm.refreshrules: 1
|
||||
- speedwm.decorhints: 1
|
||||
- speedwm.barpaddingv: 0
|
||||
- speedwm.barpaddingh: 0
|
||||
- speedwm.barheight: 5
|
||||
- speedwm.altbar: 0
|
||||
- speedwm.altbarclass: Polybar
|
||||
- speedwm.alttrayname: tray
|
||||
- speedwm.altbarcmd: polybar &
|
||||
- speedwm.centerfloating: 1
|
||||
- speedwm.savefloat: 1
|
||||
- speedwm.warpcursor: 1
|
||||
- speedwm.pertag: 1
|
||||
- speedwm.i3nmaster: 0
|
||||
- speedwm.scalepreview: 4
|
||||
- speedwm.tagpreview: 1
|
||||
- speedwm.mousepreview: 1
|
||||
- speedwm.monocleclientcount: 0
|
||||
- speedwm.monoclecount: 0
|
||||
- speedwm.monocleformat: [%d/%d]
|
||||
- speedwm.statusallmons: 1
|
||||
- speedwm.hidelayout: 0
|
||||
- speedwm.hidetitle: 0
|
||||
- speedwm.hidestatus: 0
|
||||
- speedwm.hidetags: 0
|
||||
- speedwm.hidesticky: 0
|
||||
- speedwm.hidefloating: 0
|
||||
- speedwm.leftlayout: 1
|
||||
- speedwm.fadeinactive: 1
|
||||
- speedwm.defaultlayout: 1
|
||||
- speedwm.wmclass: 1
|
||||
- speedwm.clicktofocus: 0
|
||||
- speedwm.stairpx: 20
|
||||
- speedwm.stairdirection: 1
|
||||
- speedwm.stairsamesize: 1
|
||||
- speedwm.deckcount: 0
|
||||
- speedwm.deckformat: D %d
|
||||
- speedwm.roundedcorners: 0
|
||||
- speedwm.cornerradius: 3
|
||||
- speedwm.swallowclients: 1
|
||||
- speedwm.swallowfloating: 1
|
||||
- speedwm.movefullscreenmon: 0
|
||||
- speedwm.lockfullscreen: 1
|
||||
- speedwm.underline: 0
|
||||
- speedwm.underlineall: 0
|
||||
- speedwm.underlinepad: 5
|
||||
- speedwm.underlinestroke: 2
|
||||
- speedwm.underlinevoffset: 0
|
||||
- speedwm.forcevsplit: 1
|
||||
- speedwm.floatscratchpad: 0
|
38
docs/example.fsignal
Normal file
38
docs/example.fsignal
Normal file
|
@ -0,0 +1,38 @@
|
|||
- xsetroot -name "fsignal:1" | Switch to the Tiling layout
|
||||
- xsetroot -name "fsignal:2" | Switch to the Floating layout
|
||||
- xsetroot -name "fsignal:3" | Switch to the Monocle layout
|
||||
- xsetroot -name "fsignal:4" | Switch to the Grid layout
|
||||
- xsetroot -name "fsignal:5" | Switch to the Deck layout
|
||||
- xsetroot -name "fsignal:6" | Switch to the Centered Master layout
|
||||
- xsetroot -name "fsignal:7" | Switch to the Centered Floating Master layout
|
||||
- xsetroot -name "fsignal:8" | Switch to the Fibonacci Spiral layout
|
||||
- xsetroot -name "fsignal:9" | Switch to the Fibonacci Dwindle layout
|
||||
- xsetroot -name "fsignal:10" | Switch to the Three Column layout
|
||||
- xsetroot -name "fsignal:11" | Switch to the Bottom Stack Vertical layout
|
||||
- xsetroot -name "fsignal:12" | Switch to the Bottom Stack Horizontal layout
|
||||
- xsetroot -name "fsignal:13" | Switch to the Horizontal Grid layout
|
||||
- xsetroot -name "fsignal:14" | Switch to the Tatami layout
|
||||
- xsetroot -name "fsignal:15" | To be added
|
||||
- xsetroot -name "fsignal:16" | Cycle layout (Previous)
|
||||
- xsetroot -name "fsignal:17" | Cycle layout (Next)
|
||||
- xsetroot -name "fsignal:18" | Reload colors from .Xresources
|
||||
- xsetroot -name "fsignal:19" | Set mfact (-0.05)
|
||||
- xsetroot -name "fsignal:20" | Set mfact (+0.05)
|
||||
- xsetroot -name "fsignal:21" | Toggle Scratchpad
|
||||
- xsetroot -name "fsignal:22" | Toggle Sticky
|
||||
- xsetroot -name "fsignal:23" | Toggle Bar
|
||||
- xsetroot -name "fsignal:24" | Toggle Fullscreen
|
||||
- xsetroot -name "fsignal:25" | Restart speedwm keeping all your applications open.
|
||||
- xsetroot -name "fsignal:26" | Unused at the moment.
|
||||
- xsetroot -name "fsignal:27" | Switch to the Stairs layout
|
||||
- xsetroot -name "fsignal:28" | Reset layout and mfact
|
||||
- xsetroot -name "fsignal:29" | Reorganize tags
|
||||
- xsetroot -name "fsignal:30" | Restart speedwm
|
||||
- xsetroot -name "fsignal:31" | Shutdown speedwm
|
||||
- xsetroot -name "fsignal:32" | To be added
|
||||
- xsetroot -name "fsignal:33" | To be added
|
||||
- xsetroot -name "fsignal:34" | To be added
|
||||
- xsetroot -name "fsignal:35" | Switch to the Tiling (5:4) layout
|
||||
- xsetroot -name "fsignal:36" | Switch to the Column layout
|
||||
- xsetroot -name "fsignal:37" | Switch to the Dynamic Grid layout
|
||||
|
24
docs/speedwm.html.template.1
Normal file
24
docs/speedwm.html.template.1
Normal file
|
@ -0,0 +1,24 @@
|
|||
<head>
|
||||
<div class="header">
|
||||
<title>Dynamic window manager // speedie's website</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="speedie's build of suckless dynamic window manager. Older version is part of spDE.">
|
||||
<meta name="author" content="speedie">
|
||||
<link rel="stylesheet" href="https://unpkg.com/terminal.css@0.7.2/dist/terminal.min.css" /><link rel="stylesheet" href="https://unpkg.com/terminal.css@0.7.1/dist/terminal.min.css" /><link rel="stylesheet" href="https://unpkg.com/terminal.css@0.7.1/dist/terminal.min.css" />
|
||||
<link rel="stylesheet" href="css/dwm.css">
|
||||
<h1>speedie's website</h1>
|
||||
<link rel="icon" type="image/png" href="png/antibloat.png">
|
||||
<a href="index.html">🏠 Home</a>
|
||||
<a href="projects.html">💾 Projects</a>
|
||||
<a href="blog.html">📘 Blog</a>
|
||||
<a href="guides.html">📕 Guides</a>
|
||||
<a href="mailto:speedie@duck.com">📧 Email</a>
|
||||
<a href="https://github.com/speedie-de">🐧 Dotfiles</a>
|
||||
<a href="rss.xml">📰 RSS</a>
|
||||
<a href="donate.html">💰Donate</a>
|
||||
</a>
|
||||
</div>
|
||||
<hr>
|
||||
</header>
|
||||
<body>
|
||||
<p><img src="img/gentoorice.png" alt="image"></p>
|
9
docs/speedwm.html.template.2
Normal file
9
docs/speedwm.html.template.2
Normal file
|
@ -0,0 +1,9 @@
|
|||
<h2>Auto generated.</h2>
|
||||
<p>This page was auto generated by the speedwm-help script bundled with speedwm. It acts as the help script and it writes documentation to HTML, Markdown and plain text from documentation in the docs folder and data grabbed from your current system.</p>
|
||||
</body>
|
||||
<footer>
|
||||
<h2>Website made by speedie, proudly written in Vim on Gentoo Linux.</h2>
|
||||
<h4>This website is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International.</h4>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
536
drw.c
Normal file
536
drw.c
Normal file
|
@ -0,0 +1,536 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <Imlib2.h>
|
||||
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
|
||||
#define UTF_INVALID 0xFFFD
|
||||
#define UTF_SIZ 4
|
||||
|
||||
static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
|
||||
static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
|
||||
static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
|
||||
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
|
||||
unsigned int ew;
|
||||
|
||||
static long
|
||||
utf8decodebyte(const char c, size_t *i)
|
||||
{
|
||||
for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
|
||||
if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
|
||||
return (unsigned char)c & ~utfmask[*i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t
|
||||
utf8validate(long *u, size_t i)
|
||||
{
|
||||
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
|
||||
*u = UTF_INVALID;
|
||||
for (i = 1; *u > utfmax[i]; ++i)
|
||||
;
|
||||
return i;
|
||||
}
|
||||
|
||||
static size_t
|
||||
utf8decode(const char *c, long *u, size_t clen)
|
||||
{
|
||||
size_t i, j, len, type;
|
||||
long udecoded;
|
||||
|
||||
*u = UTF_INVALID;
|
||||
if (!clen)
|
||||
return 0;
|
||||
udecoded = utf8decodebyte(c[0], &len);
|
||||
if (!BETWEEN(len, 1, UTF_SIZ))
|
||||
return 1;
|
||||
for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
|
||||
udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
|
||||
if (type)
|
||||
return j;
|
||||
}
|
||||
if (j < len)
|
||||
return 0;
|
||||
*u = udecoded;
|
||||
utf8validate(u, len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
Drw *
|
||||
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
|
||||
{
|
||||
Drw *drw = ecalloc(1, sizeof(Drw));
|
||||
|
||||
drw->dpy = dpy;
|
||||
drw->screen = screen;
|
||||
drw->root = root;
|
||||
drw->w = w;
|
||||
drw->h = h;
|
||||
drw->visual = visual;
|
||||
drw->depth = depth;
|
||||
drw->cmap = cmap;
|
||||
drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
|
||||
drw->picture = XRenderCreatePicture(dpy, drw->drawable, XRenderFindVisualFormat(dpy, visual), 0, NULL);
|
||||
drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
|
||||
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||
|
||||
return drw;
|
||||
}
|
||||
|
||||
void
|
||||
drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
||||
{
|
||||
if (!drw)
|
||||
return;
|
||||
|
||||
drw->w = w;
|
||||
drw->h = h;
|
||||
if (drw->picture)
|
||||
XRenderFreePicture(drw->dpy, drw->picture);
|
||||
if (drw->drawable)
|
||||
XFreePixmap(drw->dpy, drw->drawable);
|
||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
|
||||
drw->picture = XRenderCreatePicture(drw->dpy, drw->drawable, XRenderFindVisualFormat(drw->dpy, drw->visual), 0, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
drw_free(Drw *drw)
|
||||
{
|
||||
XRenderFreePicture(drw->dpy, drw->picture);
|
||||
XFreePixmap(drw->dpy, drw->drawable);
|
||||
XFreeGC(drw->dpy, drw->gc);
|
||||
drw_fontset_free(drw->fonts);
|
||||
free(drw);
|
||||
}
|
||||
|
||||
/* This function is an implementation detail. Library users should use
|
||||
* drw_fontset_create instead.
|
||||
*/
|
||||
static Fnt *
|
||||
xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
||||
{
|
||||
Fnt *font;
|
||||
XftFont *xfont = NULL;
|
||||
FcPattern *pattern = NULL;
|
||||
|
||||
if (fontname) {
|
||||
/* Using the pattern found at font->xfont->pattern does not yield the
|
||||
* same substitution results as using the pattern returned by
|
||||
* FcNameParse; using the latter results in the desired fallback
|
||||
* behaviour whereas the former just results in missing-character
|
||||
* rectangles being drawn, at least with some fonts. */
|
||||
if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) {
|
||||
fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname);
|
||||
return NULL;
|
||||
}
|
||||
if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
|
||||
fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname);
|
||||
XftFontClose(drw->dpy, xfont);
|
||||
return NULL;
|
||||
}
|
||||
} else if (fontpattern) {
|
||||
if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) {
|
||||
fprintf(stderr, "error, cannot load font from pattern.\n");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
die("no font specified.");
|
||||
}
|
||||
|
||||
/* Do not allow using color fonts. This is a workaround for a BadLength
|
||||
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
||||
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
||||
* https://lists.suckless.org/dev/1701/30932.html
|
||||
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
||||
* and lots more all over the internet.
|
||||
*/
|
||||
/*FcBool iscol;
|
||||
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
||||
XftFontClose(drw->dpy, xfont);
|
||||
return NULL;
|
||||
}*/
|
||||
|
||||
font = ecalloc(1, sizeof(Fnt));
|
||||
font->xfont = xfont;
|
||||
font->pattern = pattern;
|
||||
font->h = xfont->ascent + xfont->descent;
|
||||
font->dpy = drw->dpy;
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
static void
|
||||
xfont_free(Fnt *font)
|
||||
{
|
||||
if (!font)
|
||||
return;
|
||||
if (font->pattern)
|
||||
FcPatternDestroy(font->pattern);
|
||||
XftFontClose(font->dpy, font->xfont);
|
||||
free(font);
|
||||
}
|
||||
|
||||
Fnt*
|
||||
drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
|
||||
{
|
||||
Fnt *cur, *ret = NULL;
|
||||
size_t i;
|
||||
|
||||
if (!drw || !fonts)
|
||||
return NULL;
|
||||
|
||||
for (i = 1; i <= fontcount; i++) {
|
||||
if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) {
|
||||
cur->next = ret;
|
||||
ret = cur;
|
||||
}
|
||||
}
|
||||
return (drw->fonts = ret);
|
||||
}
|
||||
|
||||
void
|
||||
drw_fontset_free(Fnt *font)
|
||||
{
|
||||
if (font) {
|
||||
drw_fontset_free(font->next);
|
||||
xfont_free(font);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
|
||||
{
|
||||
if (!drw || !dest || !clrname)
|
||||
return;
|
||||
|
||||
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
|
||||
clrname, dest))
|
||||
|
||||
die("error, cannot allocate color '%s'", clrname);
|
||||
|
||||
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
|
||||
|
||||
}
|
||||
|
||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||
* returned color scheme when done using it. */
|
||||
Clr *
|
||||
drw_scm_create(Drw *drw, char *clrnames[], const unsigned int alphas[], size_t clrcount)
|
||||
{
|
||||
size_t i;
|
||||
Clr *ret;
|
||||
|
||||
/* need at least two colors for a scheme */
|
||||
if (!drw || !clrnames || clrcount < 2 || !(ret = ecalloc(clrcount, sizeof(XftColor))))
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < clrcount; i++)
|
||||
drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
drw_setfontset(Drw *drw, Fnt *set)
|
||||
{
|
||||
if (drw)
|
||||
drw->fonts = set;
|
||||
}
|
||||
|
||||
void
|
||||
drw_setscheme(Drw *drw, Clr *scm)
|
||||
{
|
||||
if (drw)
|
||||
drw->scheme = scm;
|
||||
}
|
||||
|
||||
Picture
|
||||
drw_picture_create_resized(Drw *drw, char *src, unsigned int srcw, unsigned int srch, unsigned int dstw, unsigned int dsth) {
|
||||
Pixmap pm;
|
||||
Picture pic;
|
||||
GC gc;
|
||||
|
||||
if (srcw <= (dstw << 1u) && srch <= (dsth << 1u)) {
|
||||
XImage img = {
|
||||
srcw, srch, 0, ZPixmap, src,
|
||||
ImageByteOrder(drw->dpy), BitmapUnit(drw->dpy), BitmapBitOrder(drw->dpy), 32,
|
||||
32, 0, 32,
|
||||
0, 0, 0
|
||||
};
|
||||
XInitImage(&img);
|
||||
|
||||
pm = XCreatePixmap(drw->dpy, drw->root, srcw, srch, 32);
|
||||
gc = XCreateGC(drw->dpy, pm, 0, NULL);
|
||||
XPutImage(drw->dpy, pm, gc, &img, 0, 0, 0, 0, srcw, srch);
|
||||
XFreeGC(drw->dpy, gc);
|
||||
|
||||
pic = XRenderCreatePicture(drw->dpy, pm, XRenderFindStandardFormat(drw->dpy, PictStandardARGB32), 0, NULL);
|
||||
XFreePixmap(drw->dpy, pm);
|
||||
|
||||
XRenderSetPictureFilter(drw->dpy, pic, FilterBilinear, NULL, 0);
|
||||
XTransform xf;
|
||||
xf.matrix[0][0] = (srcw << 16u) / dstw; xf.matrix[0][1] = 0; xf.matrix[0][2] = 0;
|
||||
xf.matrix[1][0] = 0; xf.matrix[1][1] = (srch << 16u) / dsth; xf.matrix[1][2] = 0;
|
||||
xf.matrix[2][0] = 0; xf.matrix[2][1] = 0; xf.matrix[2][2] = 65536;
|
||||
XRenderSetPictureTransform(drw->dpy, pic, &xf);
|
||||
} else {
|
||||
Imlib_Image origin = imlib_create_image_using_data(srcw, srch, (DATA32 *)src);
|
||||
if (!origin) return None;
|
||||
imlib_context_set_image(origin);
|
||||
imlib_image_set_has_alpha(1);
|
||||
Imlib_Image scaled = imlib_create_cropped_scaled_image(0, 0, srcw, srch, dstw, dsth);
|
||||
imlib_free_image_and_decache();
|
||||
if (!scaled) return None;
|
||||
imlib_context_set_image(scaled);
|
||||
imlib_image_set_has_alpha(1);
|
||||
|
||||
XImage img = {
|
||||
dstw, dsth, 0, ZPixmap, (char *)imlib_image_get_data_for_reading_only(),
|
||||
ImageByteOrder(drw->dpy), BitmapUnit(drw->dpy), BitmapBitOrder(drw->dpy), 32,
|
||||
32, 0, 32,
|
||||
0, 0, 0
|
||||
};
|
||||
XInitImage(&img);
|
||||
|
||||
pm = XCreatePixmap(drw->dpy, drw->root, dstw, dsth, 32);
|
||||
gc = XCreateGC(drw->dpy, pm, 0, NULL);
|
||||
XPutImage(drw->dpy, pm, gc, &img, 0, 0, 0, 0, dstw, dsth);
|
||||
imlib_free_image_and_decache();
|
||||
XFreeGC(drw->dpy, gc);
|
||||
|
||||
pic = XRenderCreatePicture(drw->dpy, pm, XRenderFindStandardFormat(drw->dpy, PictStandardARGB32), 0, NULL);
|
||||
XFreePixmap(drw->dpy, pm);
|
||||
}
|
||||
|
||||
return pic;
|
||||
}
|
||||
|
||||
void
|
||||
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
|
||||
{
|
||||
if (!drw || !drw->scheme)
|
||||
return;
|
||||
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
|
||||
if (filled)
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||
else
|
||||
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
|
||||
}
|
||||
|
||||
void
|
||||
drw_polygon(Drw *drw, int x, int y, int ow, int oh, int sw, int sh, const XPoint *points, int npoints, int shape, int filled) /* wrapper function to scale and draw a polygon with X11 */
|
||||
{
|
||||
if (!drw || !drw->scheme)
|
||||
return;
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColFg].pixel);
|
||||
if (!filled) { /* reduces the scaled width and height by 1 when drawing the outline to compensate for X11 drawing the line 1 pixel over */
|
||||
sw -= 1;
|
||||
sh -= 1;
|
||||
}
|
||||
XPoint scaledpoints[npoints];
|
||||
memcpy(scaledpoints, points, npoints);
|
||||
for (int v = 0; v < npoints; v++)
|
||||
scaledpoints[v] = (XPoint){ .x = points[v].x * sw / ow + x, .y = points[v].y * sh / oh + y };
|
||||
if (filled)
|
||||
XFillPolygon(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, shape, CoordModeOrigin); /* Change shape to 'Convex' or 'Complex' in speedwm.c if the shape is not 'Nonconvex' */
|
||||
else
|
||||
XDrawLines(drw->dpy, drw->drawable, drw->gc, scaledpoints, npoints, CoordModeOrigin);
|
||||
}
|
||||
|
||||
int
|
||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
||||
{
|
||||
char buf[1024];
|
||||
int ty;
|
||||
//unsigned int ew;
|
||||
XftDraw *d = NULL;
|
||||
Fnt *usedfont, *curfont, *nextfont;
|
||||
size_t i, len;
|
||||
int utf8strlen, utf8charlen, render = x || y || w || h;
|
||||
long utf8codepoint = 0;
|
||||
const char *utf8str;
|
||||
FcCharSet *fccharset;
|
||||
FcPattern *fcpattern;
|
||||
FcPattern *match;
|
||||
XftResult result;
|
||||
int charexists = 0;
|
||||
|
||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
||||
return 0;
|
||||
|
||||
if (!render) {
|
||||
w = ~w;
|
||||
} else {
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
|
||||
x += lpad;
|
||||
w -= lpad;
|
||||
}
|
||||
|
||||
usedfont = drw->fonts;
|
||||
while (1) {
|
||||
utf8strlen = 0;
|
||||
utf8str = text;
|
||||
nextfont = NULL;
|
||||
while (*text) {
|
||||
utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
|
||||
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
|
||||
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
||||
if (charexists) {
|
||||
if (curfont == usedfont) {
|
||||
utf8strlen += utf8charlen;
|
||||
text += utf8charlen;
|
||||
} else {
|
||||
nextfont = curfont;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!charexists || nextfont)
|
||||
break;
|
||||
else
|
||||
charexists = 0;
|
||||
}
|
||||
|
||||
if (utf8strlen) {
|
||||
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
||||
/* shorten text if necessary */
|
||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
|
||||
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
|
||||
|
||||
if (len) {
|
||||
memcpy(buf, utf8str, len);
|
||||
buf[len] = '\0';
|
||||
if (len < utf8strlen)
|
||||
for (i = len; i && i > len - 3; buf[--i] = '.')
|
||||
; /* NOP */
|
||||
|
||||
if (render) {
|
||||
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
||||
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
||||
usedfont->xfont, x, ty, (XftChar8 *)buf, len);
|
||||
}
|
||||
x += ew;
|
||||
w -= ew;
|
||||
}
|
||||
}
|
||||
|
||||
if (!*text) {
|
||||
break;
|
||||
} else if (nextfont) {
|
||||
charexists = 0;
|
||||
usedfont = nextfont;
|
||||
} else {
|
||||
/* Regardless of whether or not a fallback font is found, the
|
||||
* character must be drawn. */
|
||||
charexists = 1;
|
||||
|
||||
fccharset = FcCharSetCreate();
|
||||
FcCharSetAddChar(fccharset, utf8codepoint);
|
||||
|
||||
if (!drw->fonts->pattern) {
|
||||
/* Refer to the comment in xfont_create for more information. */
|
||||
die("the first font in the cache must be loaded from a font string.");
|
||||
}
|
||||
|
||||
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
||||
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
||||
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
||||
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
||||
|
||||
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
||||
FcDefaultSubstitute(fcpattern);
|
||||
match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result);
|
||||
|
||||
FcCharSetDestroy(fccharset);
|
||||
FcPatternDestroy(fcpattern);
|
||||
|
||||
if (match) {
|
||||
usedfont = xfont_create(drw, NULL, match);
|
||||
if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) {
|
||||
for (curfont = drw->fonts; curfont->next; curfont = curfont->next)
|
||||
; /* NOP */
|
||||
curfont->next = usedfont;
|
||||
} else {
|
||||
xfont_free(usedfont);
|
||||
usedfont = drw->fonts;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (d)
|
||||
XftDrawDestroy(d);
|
||||
|
||||
return x + (render ? w : 0);
|
||||
}
|
||||
|
||||
void
|
||||
drw_pic(Drw *drw, int x, int y, unsigned int w, unsigned int h, Picture pic)
|
||||
{
|
||||
if (!drw)
|
||||
return;
|
||||
XRenderComposite(drw->dpy, PictOpOver, pic, None, drw->picture, 0, 0, 0, 0, x, y, w, h);
|
||||
}
|
||||
|
||||
void
|
||||
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
|
||||
{
|
||||
if (!drw)
|
||||
return;
|
||||
|
||||
XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
|
||||
XSync(drw->dpy, False);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
drw_fontset_getwidth(Drw *drw, const char *text)
|
||||
{
|
||||
if (!drw || !drw->fonts || !text)
|
||||
return 0;
|
||||
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
|
||||
}
|
||||
|
||||
void
|
||||
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
||||
{
|
||||
XGlyphInfo ext;
|
||||
|
||||
if (!font || !text)
|
||||
return;
|
||||
|
||||
XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
|
||||
if (w)
|
||||
*w = ext.xOff;
|
||||
if (h)
|
||||
*h = font->h;
|
||||
}
|
||||
|
||||
Cur *
|
||||
drw_cur_create(Drw *drw, int shape)
|
||||
{
|
||||
Cur *cur;
|
||||
|
||||
if (!drw || !(cur = ecalloc(1, sizeof(Cur))))
|
||||
return NULL;
|
||||
|
||||
cur->cursor = XCreateFontCursor(drw->dpy, shape);
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
||||
void
|
||||
drw_cur_free(Drw *drw, Cur *cursor)
|
||||
{
|
||||
if (!cursor)
|
||||
return;
|
||||
|
||||
XFreeCursor(drw->dpy, cursor->cursor);
|
||||
free(cursor);
|
||||
}
|
65
drw.h
Normal file
65
drw.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
typedef struct {
|
||||
Cursor cursor;
|
||||
} Cur;
|
||||
|
||||
typedef struct Fnt {
|
||||
Display *dpy;
|
||||
unsigned int h;
|
||||
XftFont *xfont;
|
||||
FcPattern *pattern;
|
||||
struct Fnt *next;
|
||||
} Fnt;
|
||||
|
||||
enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */
|
||||
typedef XftColor Clr;
|
||||
|
||||
typedef struct {
|
||||
unsigned int w, h;
|
||||
Display *dpy;
|
||||
int screen;
|
||||
Window root;
|
||||
Visual *visual;
|
||||
unsigned int depth;
|
||||
Colormap cmap;
|
||||
Drawable drawable;
|
||||
Picture picture;
|
||||
GC gc;
|
||||
Clr *scheme;
|
||||
Fnt *fonts;
|
||||
} Drw;
|
||||
|
||||
/* Drawable abstraction */
|
||||
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
|
||||
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
|
||||
void drw_free(Drw *drw);
|
||||
|
||||
/* Fnt abstraction */
|
||||
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
|
||||
void drw_fontset_free(Fnt* set);
|
||||
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);
|
||||
|
||||
/* Colorscheme abstraction */
|
||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
|
||||
Clr *drw_scm_create(Drw *drw, char *clrnames[], const unsigned int alphas[], size_t clrcount);
|
||||
|
||||
/* Cursor abstraction */
|
||||
Cur *drw_cur_create(Drw *drw, int shape);
|
||||
void drw_cur_free(Drw *drw, Cur *cursor);
|
||||
|
||||
/* Drawing context manipulation */
|
||||
void drw_setfontset(Drw *drw, Fnt *set);
|
||||
void drw_setscheme(Drw *drw, Clr *scm);
|
||||
|
||||
Picture drw_picture_create_resized(Drw *drw, char *src, unsigned int src_w, unsigned int src_h, unsigned int dst_w, unsigned int dst_h);
|
||||
|
||||
/* Drawing functions */
|
||||
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
|
||||
void drw_polygon(Drw *drw, int x, int y, int ow, int oh, int sw, int sh, const XPoint *points, int npoints, int shape, int filled);
|
||||
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
|
||||
void drw_pic(Drw *drw, int x, int y, unsigned int w, unsigned int h, Picture pic);
|
||||
|
||||
/* Map functions */
|
||||
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
|
41
fsignal.h
Normal file
41
fsignal.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* Signal definitions
|
||||
* Signum must be greater than 0
|
||||
* Trigger signals using `speedwm-utils -exec <signum>"`
|
||||
*
|
||||
* Once you're done with your edits, run 'make clean install'. */
|
||||
static Signal signals[] = {
|
||||
/* signum function argument */
|
||||
{ 1, setlayout, {.v = &layouts[0]} },
|
||||
{ 2, setlayout, {.v = &layouts[1]} },
|
||||
{ 3, setlayout, {.v = &layouts[2]} },
|
||||
{ 4, setlayout, {.v = &layouts[3]} },
|
||||
{ 5, setlayout, {.v = &layouts[4]} },
|
||||
{ 6, setlayout, {.v = &layouts[5]} },
|
||||
{ 7, setlayout, {.v = &layouts[6]} },
|
||||
{ 8, setlayout, {.v = &layouts[7]} },
|
||||
{ 9, setlayout, {.v = &layouts[8]} },
|
||||
{ 10, setlayout, {.v = &layouts[9]} },
|
||||
{ 11, setlayout, {.v = &layouts[10]} },
|
||||
{ 12, setlayout, {.v = &layouts[11]} },
|
||||
{ 13, setlayout, {.v = &layouts[12]} },
|
||||
{ 14, setlayout, {.v = &layouts[13]} },
|
||||
{ 15, setlayout, {.v = &layouts[14]} },
|
||||
{ 16, cyclelayout, {.i = -1 } },
|
||||
{ 17, cyclelayout, {.i = +1 } },
|
||||
{ 18, livereloadxrdb, {0} },
|
||||
{ 19, setmfact, {.f = -0.05} },
|
||||
{ 20, setmfact, {.f = +0.05} },
|
||||
{ 21, togglescratch, {.v = scratchpadcmd } },
|
||||
{ 22, togglesticky, {0} },
|
||||
{ 23, togglebar, {0} },
|
||||
{ 24, togglefullscr, {0} },
|
||||
{ 25, self_restart, {0} },
|
||||
{ 27, setlayout, {.v = &layouts[15]} },
|
||||
{ 28, resetlayout, {0} },
|
||||
{ 29, reorganizetags, {0} },
|
||||
{ 30, quit, {1} },
|
||||
{ 31, quit, {0} },
|
||||
{ 35, setlayout, {.v = &layouts[16]} },
|
||||
{ 36, setlayout, {.v = &layouts[17]} },
|
||||
{ 37, setlayout, {.v = &layouts[18]} },
|
||||
};
|
170
keybinds.h
Normal file
170
keybinds.h
Normal file
|
@ -0,0 +1,170 @@
|
|||
/* These are all your keybinds.
|
||||
*
|
||||
* Example keybind:
|
||||
*
|
||||
* { MODKEY, -1, XK_1, spawn, SHCMD(TERMINAL "echo "Hello world!") },
|
||||
* { MODKEY, XK_F1, XK_1, spawn, SHCMD(TERMINAL "echo "Hello world! Pressing two keys in a row is based!") },
|
||||
*
|
||||
* Modifiers
|
||||
*
|
||||
* MODKEY is what you defined (in options.h, default is Super)
|
||||
* SMODKEY is what you defined (in options.h, default is Alt)
|
||||
* ShiftMask is unless changed going to be your Shift key.
|
||||
* ControlMask is unless changed going to be your Control key.
|
||||
*
|
||||
* It is recommended that you avoid using 'SMODKEY' (Mod1Mask) by itself because it can break software defined shortcuts.
|
||||
*
|
||||
* If you need help, see speedwm-help.
|
||||
* Once you're done with your edits, run 'make clean install'.
|
||||
*/
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier chain key key function argument */
|
||||
|
||||
/* Application keybinds */
|
||||
{ MODKEY|ShiftMask, -1, XK_semicolon, spawn, SHCMD(RUN) },
|
||||
{ MODKEY|ShiftMask, -1, XK_Return, spawn, SHCMD(TERMINAL) },
|
||||
{ MODKEY|ShiftMask, -1, XK_s, spawn, SHCMD(SCREENSHOT) },
|
||||
{ MODKEY|ShiftMask, -1, XK_f, spawn, SHCMD(TERMINAL FILEMANAGER) },
|
||||
{ MODKEY|ShiftMask, -1, XK_w, spawn, SHCMD(BROWSER) },
|
||||
{ MODKEY|ShiftMask, -1, XK_o, spawn, SHCMD("speedwm-dfmpeg") },
|
||||
{ MODKEY|ShiftMask, -1, XK_e, spawn, SHCMD("speedwm-virtualkeyboard") },
|
||||
{ MODKEY|ShiftMask, -1, XK_t, spawn, SHCMD(TERMINAL EDITOR) },
|
||||
{ MODKEY|ShiftMask, -1, XK_a, spawn, SHCMD(TERMINAL MIXER) },
|
||||
{ MODKEY|ShiftMask, -1, XK_m, spawn, SHCMD(TERMINAL MUSIC) },
|
||||
{ SMODKEY, -1, XK_Tab, spawn, SHCMD("speedwm-winnav") },
|
||||
{ MODKEY|ShiftMask, -1, XK_x, spawn, SHCMD(TERMINAL SYSTEMSTAT) },
|
||||
{ MODKEY|ShiftMask, -1, XK_i, spawn, SHCMD(OPENPDF) },
|
||||
{ MODKEY|ShiftMask, -1, XK_Escape, spawn, SHCMD("speedwm-shutdown") },
|
||||
{ ControlMask|MODKEY, -1, XK_Tab, spawn, SHCMD("speedwm-utils -layout") },
|
||||
{ ControlMask|MODKEY, -1, XK_h, spawn, SHCMD(TERMINAL "speedwm-help -3") },
|
||||
{ ControlMask|MODKEY, -1, XK_s, spawn, SHCMD(SCREENSHOT_FULL) },
|
||||
{ ControlMask|MODKEY, -1, XK_u, spawn, SHCMD(TERMINAL RSS) },
|
||||
{ ControlMask|MODKEY, -1, XK_m, spawn, SHCMD(KILLMUSIC) },
|
||||
{ ControlMask|MODKEY, -1, XK_1, spawn, SHCMD(VOL_MUTE) },
|
||||
{ ControlMask|MODKEY, -1, XK_2, spawn, SHCMD(VOL_DOWN) },
|
||||
{ ControlMask|MODKEY, -1, XK_3, spawn, SHCMD(VOL_UP) },
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_k, spawn, SHCMD(VOL_OUTPUT_SPEAKER) },
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_Escape, spawn, SHCMD("speedwm-utils") },
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_s, spawn, SHCMD("speedwm-swal") },
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_n, spawn, SHCMD(NETWORK) },
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_b, spawn, SHCMD(BLUETOOTH) },
|
||||
{ MODKEY, -1, XK_s, spawn, SHCMD("speedwm-core -toggle") },
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_m, spawn, SHCMD(TERMINAL EMAIL) },
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_e, spawn, SHCMD("speedwm_run -configure") },
|
||||
|
||||
/* Layout keybinds */
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_a, cyclelayout, {.i = -1 } },
|
||||
{ ControlMask|MODKEY|ShiftMask, -1, XK_d, cyclelayout, {.i = +1 } },
|
||||
{ MODKEY|ControlMask, -1, XK_y, setlayout, {.v = &layouts[4]} },
|
||||
{ MODKEY|ControlMask, -1, XK_e, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY|ControlMask, -1, XK_r, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY|ControlMask, -1, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, -1, XK_space, setlayout, {0} },
|
||||
|
||||
/* Sticky keybinds */
|
||||
{ SMODKEY|MODKEY, -1, XK_s, togglesticky, {0} },
|
||||
|
||||
/* Scratchpad keybinds */
|
||||
{ MODKEY, -1, XK_minus, scratchpad_show, {0} },
|
||||
{ MODKEY|ShiftMask, -1, XK_minus, scratchpad_hide, {0} },
|
||||
{ MODKEY, -1, XK_equal, scratchpad_remove, {0} },
|
||||
{ MODKEY|ShiftMask, -1, XK_equal, togglescratch, {.v = scratchpadcmd } },
|
||||
|
||||
/* speedwm general binds */
|
||||
{ MODKEY, -1, XK_f, togglefullscr, {0} },
|
||||
{ MODKEY, -1, XK_b, togglebar, {0} },
|
||||
{ MODKEY, -1, XK_j, focusstackvis, {.i = +1 } },
|
||||
{ MODKEY, -1, XK_k, focusstackvis, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, -1, XK_j, focusstackhid, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, -1, XK_k, focusstackhid, {.i = -1 } },
|
||||
{ MODKEY, -1, XK_a, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, -1, XK_d, setmfact, {.f = +0.05} },
|
||||
{ SMODKEY|ControlMask, -1, XK_k, setcfact, {.f = +0.25} },
|
||||
{ SMODKEY|ControlMask, -1, XK_j, setcfact, {.f = -0.25} },
|
||||
{ SMODKEY|ControlMask, -1, XK_0, setcfact, {.f = 0.00} },
|
||||
{ MODKEY, -1, XK_Return, zoom, {0} },
|
||||
{ MODKEY|ShiftMask, -1, XK_q, killclient, {0} },
|
||||
{ MODKEY|ShiftMask, -1, XK_space, togglefloating, {0} },
|
||||
{ MODKEY|ControlMask, -1, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY, -1, XK_d, focusmon, {.i = -1 } },
|
||||
{ MODKEY, -1, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, -1, XK_d, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, -1, XK_period, tagmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, -1, XK_Tab, livereloadxrdb, {0} },
|
||||
{ MODKEY|ShiftMask, -1, XK_j, inplacerotate, {.i = +1} },
|
||||
{ MODKEY|ShiftMask, -1, XK_k, inplacerotate, {.i = -1} },
|
||||
{ MODKEY|ShiftMask, -1, XK_h, inplacerotate, {.i = +2} },
|
||||
{ MODKEY|ShiftMask, -1, XK_l, inplacerotate, {.i = -2} },
|
||||
{ MODKEY, -1, XK_n, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, -1, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, -1, XK_t, toggleopacity, {0} },
|
||||
|
||||
/* Floating mode keybinds */
|
||||
{ MODKEY, -1, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
|
||||
{ MODKEY, -1, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
|
||||
{ MODKEY, -1, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },
|
||||
{ MODKEY, -1, XK_Left, moveresize, {.v = "-25x 0y 0w 0h" } },
|
||||
{ MODKEY|ShiftMask, -1, XK_Down, moveresize, {.v = "0x 0y 0w 25h" } },
|
||||
{ MODKEY|ShiftMask, -1, XK_Up, moveresize, {.v = "0x 0y 0w -25h" } },
|
||||
{ MODKEY|ShiftMask, -1, XK_Right, moveresize, {.v = "0x 0y 25w 0h" } },
|
||||
{ MODKEY|ShiftMask, -1, XK_Left, moveresize, {.v = "0x 0y -25w 0h" } },
|
||||
{ MODKEY|ControlMask, -1, XK_Up, moveresizeedge, {.v = "t"} },
|
||||
{ MODKEY|ControlMask, -1, XK_Down, moveresizeedge, {.v = "b"} },
|
||||
{ MODKEY|ControlMask, -1, XK_Left, moveresizeedge, {.v = "l"} },
|
||||
{ MODKEY|ControlMask, -1, XK_Right, moveresizeedge, {.v = "r"} },
|
||||
{ MODKEY|ControlMask|ShiftMask, -1, XK_Up, moveresizeedge, {.v = "T"} },
|
||||
{ MODKEY|ControlMask|ShiftMask, -1, XK_Down, moveresizeedge, {.v = "B"} },
|
||||
{ MODKEY|ControlMask|ShiftMask, -1, XK_Left, moveresizeedge, {.v = "L"} },
|
||||
{ MODKEY|ControlMask|ShiftMask, -1, XK_Right, moveresizeedge, {.v = "R"} },
|
||||
|
||||
/* Tag keybinds */
|
||||
TAGKEYS( -1, XK_1, 0)
|
||||
TAGKEYS( -1, XK_2, 1)
|
||||
TAGKEYS( -1, XK_3, 2)
|
||||
TAGKEYS( -1, XK_4, 3)
|
||||
TAGKEYS( -1, XK_5, 4)
|
||||
TAGKEYS( -1, XK_6, 5)
|
||||
TAGKEYS( -1, XK_7, 6)
|
||||
TAGKEYS( -1, XK_8, 7)
|
||||
TAGKEYS( -1, XK_9, 8)
|
||||
{ MODKEY, -1, XK_t, reorganizetags, {0} },
|
||||
{ SMODKEY, -1, XK_a, viewtoleft, {0} },
|
||||
{ SMODKEY, -1, XK_d, viewtoright, {0} },
|
||||
|
||||
/* Hide/Show keybinds */
|
||||
{ MODKEY, -1, XK_o, hidewin, {0} },
|
||||
{ MODKEY|ControlMask, -1, XK_o, restorewin, {0} },
|
||||
{ MODKEY, -1, XK_w, hideotherwins, {0} },
|
||||
{ MODKEY|ControlMask, -1, XK_w, restoreotherwins, {0} },
|
||||
|
||||
/* Chained keybinds */
|
||||
{ MODKEY, XK_c, XK_w, spawn, SHCMD(TERMINAL "speedwm-core -curl-weather") },
|
||||
{ MODKEY, XK_c, XK_m, spawn, SHCMD(TERMINAL "speedwm-core -curl-cheatsheet") },
|
||||
{ MODKEY, XK_r, XK_v, spawn, SHCMD(TERMINAL VISUALIZER) },
|
||||
|
||||
/* Gap keybinds */
|
||||
{ MODKEY|SMODKEY, -1, XK_j, incrgaps, {.i = +1 } },
|
||||
{ MODKEY|SMODKEY, -1, XK_k, incrgaps, {.i = -1 } },
|
||||
{ MODKEY|SMODKEY, -1, XK_d, incrgaps, {.i = +5 } },
|
||||
{ MODKEY|SMODKEY, -1, XK_u, incrgaps, {.i = -5 } },
|
||||
|
||||
/* Chained gap keybinds */
|
||||
{ MODKEY, XK_g, XK_t, togglegaps, {0} },
|
||||
{ MODKEY, XK_g, XK_0, defaultgaps, {0} },
|
||||
{ MODKEY, XK_g, XK_i, incrigaps, {.i = +1} },
|
||||
{ MODKEY|ShiftMask, XK_g, XK_i, incrigaps, {.i = -1} },
|
||||
{ MODKEY, XK_g, XK_o, incrogaps, {.i = +1} },
|
||||
{ MODKEY|ShiftMask, XK_g, XK_o, incrogaps, {.i = -1} },
|
||||
|
||||
/* Media buttons */
|
||||
{ 0, -1, XF86XK_AudioMute, spawn, SHCMD(VOL_MUTE) },
|
||||
{ 0, -1, XF86XK_AudioRaiseVolume, spawn, SHCMD(VOL_UP) },
|
||||
{ 0, -1, XF86XK_AudioLowerVolume, spawn, SHCMD(VOL_DOWN) },
|
||||
{ 0, -1, XF86XK_AudioStop, spawn, SHCMD(KILLMUSIC) },
|
||||
{ 0, -1, XF86XK_WWW, spawn, SHCMD(BROWSER) },
|
||||
{ 0, -1, XF86XK_PowerOff, spawn, SHCMD("speedwm-shutdown") },
|
||||
{ 0, -1, XF86XK_Sleep, spawn, SHCMD(LOCKER) },
|
||||
{ 0, -1, XF86XK_Mail, spawn, SHCMD(TERMINAL EMAIL) },
|
||||
{ 0, -1, XF86XK_TaskPane, spawn, SHCMD(TERMINAL SYSTEMSTAT) },
|
||||
};
|
981
layouts.c
Normal file
981
layouts.c
Normal file
|
@ -0,0 +1,981 @@
|
|||
static void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
int oh, ov, ih, iv;
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
sx = mx = m->wx + ov;
|
||||
sy = my = m->wy + oh;
|
||||
mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
||||
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
||||
sw = mw = m->ww - 2*ov;
|
||||
|
||||
if (m->nmaster && n > m->nmaster) {
|
||||
sw = (mw - iv) * (1 - m->mfact);
|
||||
mw = mw - iv - sw;
|
||||
sx = mx + mw + iv;
|
||||
}
|
||||
|
||||
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||
my += HEIGHT(c) + ih;
|
||||
} else {
|
||||
resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
|
||||
sy += HEIGHT(c) + ih;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
monocle(Monitor *m)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
if (monocleclientcount && !monoclecount) {
|
||||
unsigned int n = 0;
|
||||
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (ISVISIBLE(c))
|
||||
n++;
|
||||
if (n > 0) /* override layout symbol */
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
||||
}
|
||||
|
||||
for (c = m->stack; c && (!ISVISIBLE(c) || c->isfloating); c = c->snext);
|
||||
if (c && !c->isfloating) {
|
||||
XMoveWindow(dpy, c->win, m->wx, m->wy);
|
||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
c = c->snext;
|
||||
}
|
||||
for (; c; c = c->snext)
|
||||
if (!c->isfloating && ISVISIBLE(c))
|
||||
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
|
||||
}
|
||||
|
||||
void
|
||||
grid(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
int cx, cy, cw, ch, cc, cr, chrest, cwrest, cols, rows;
|
||||
int oh, ov, ih, iv;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
|
||||
/* grid dimensions */
|
||||
for (rows = 0; rows <= n/2; rows++)
|
||||
if (rows*rows >= n)
|
||||
break;
|
||||
cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows;
|
||||
|
||||
/* window geoms (cell height/width) */
|
||||
ch = (m->wh - 2*oh - ih * (rows - 1)) / (rows ? rows : 1);
|
||||
cw = (m->ww - 2*ov - iv * (cols - 1)) / (cols ? cols : 1);
|
||||
chrest = (m->wh - 2*oh - ih * (rows - 1)) - ch * rows;
|
||||
cwrest = (m->ww - 2*ov - iv * (cols - 1)) - cw * cols;
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
cc = i / rows;
|
||||
cr = i % rows;
|
||||
cx = m->wx + ov + cc * (cw + iv) + MIN(cc, cwrest);
|
||||
cy = m->wy + oh + cr * (ch + ih) + MIN(cr, chrest);
|
||||
resize(c, cx, cy, cw + (cc < cwrest ? 1 : 0) - 2*c->bw, ch + (cr < chrest ? 1 : 0) - 2*c->bw, False);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gaplessgrid(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
int x, y, cols, rows, ch, cw, cn, rn, rrest, crest; // counters
|
||||
int oh, ov, ih, iv;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
/* grid dimensions */
|
||||
for (cols = 0; cols <= n/2; cols++)
|
||||
if (cols*cols >= n)
|
||||
break;
|
||||
if (n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
|
||||
cols = 2;
|
||||
rows = n/cols;
|
||||
cn = rn = 0; // reset column no, row no, client count
|
||||
|
||||
ch = (m->wh - 2*oh - ih * (rows - 1)) / rows;
|
||||
cw = (m->ww - 2*ov - iv * (cols - 1)) / cols;
|
||||
rrest = (m->wh - 2*oh - ih * (rows - 1)) - ch * rows;
|
||||
crest = (m->ww - 2*ov - iv * (cols - 1)) - cw * cols;
|
||||
x = m->wx + ov;
|
||||
y = m->wy + oh;
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
|
||||
if (i/rows + 1 > cols - n%cols) {
|
||||
rows = n/cols + 1;
|
||||
ch = (m->wh - 2*oh - ih * (rows - 1)) / rows;
|
||||
rrest = (m->wh - 2*oh - ih * (rows - 1)) - ch * rows;
|
||||
}
|
||||
resize(c,
|
||||
x,
|
||||
y + rn*(ch + ih) + MIN(rn, rrest),
|
||||
cw + (cn < crest ? 1 : 0) - 2*c->bw,
|
||||
ch + (rn < rrest ? 1 : 0) - 2*c->bw,
|
||||
0);
|
||||
rn++;
|
||||
if (rn >= rows) {
|
||||
rn = 0;
|
||||
x += cw + ih + (cn < crest ? 1 : 0);
|
||||
cn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fibonacci(Monitor *m, int s)
|
||||
{
|
||||
unsigned int i, n;
|
||||
int nx, ny, nw, nh;
|
||||
int oh, ov, ih, iv;
|
||||
int nv, hrest = 0, wrest = 0, r = 1;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
nx = m->wx + ov;
|
||||
ny = m->wy + oh;
|
||||
nw = m->ww - 2*ov;
|
||||
nh = m->wh - 2*oh;
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
||||
if (r) {
|
||||
if ((i % 2 && (nh - ih) / 2 <= (bh + 2*c->bw))
|
||||
|| (!(i % 2) && (nw - iv) / 2 <= (bh + 2*c->bw))) {
|
||||
r = 0;
|
||||
}
|
||||
if (r && i < n - 1) {
|
||||
if (i % 2) {
|
||||
nv = (nh - ih) / 2;
|
||||
hrest = nh - 2*nv - ih;
|
||||
nh = nv;
|
||||
} else {
|
||||
nv = (nw - iv) / 2;
|
||||
wrest = nw - 2*nv - iv;
|
||||
nw = nv;
|
||||
}
|
||||
|
||||
if ((i % 4) == 2 && !s)
|
||||
nx += nw + iv;
|
||||
else if ((i % 4) == 3 && !s)
|
||||
ny += nh + ih;
|
||||
}
|
||||
|
||||
if ((i % 4) == 0) {
|
||||
if (s) {
|
||||
ny += nh + ih;
|
||||
nh += hrest;
|
||||
}
|
||||
else {
|
||||
nh -= hrest;
|
||||
ny -= nh + ih;
|
||||
}
|
||||
}
|
||||
else if ((i % 4) == 1) {
|
||||
nx += nw + iv;
|
||||
nw += wrest;
|
||||
}
|
||||
else if ((i % 4) == 2) {
|
||||
ny += nh + ih;
|
||||
nh += hrest;
|
||||
if (i < n - 1)
|
||||
nw += wrest;
|
||||
}
|
||||
else if ((i % 4) == 3) {
|
||||
if (s) {
|
||||
nx += nw + iv;
|
||||
nw -= wrest;
|
||||
} else {
|
||||
nw -= wrest;
|
||||
nx -= nw + iv;
|
||||
nh += hrest;
|
||||
}
|
||||
}
|
||||
if (i == 0) {
|
||||
if (n != 1) {
|
||||
nw = (m->ww - iv - 2*ov) - (m->ww - iv - 2*ov) * (1 - m->mfact);
|
||||
wrest = 0;
|
||||
}
|
||||
ny = m->wy + oh;
|
||||
}
|
||||
else if (i == 1)
|
||||
nw = m->ww - nw - iv - 2*ov;
|
||||
i++;
|
||||
}
|
||||
|
||||
resize(c, nx, ny, nw - (2*c->bw), nh - (2*c->bw), False);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dwindle(Monitor *m)
|
||||
{
|
||||
fibonacci(m, 1);
|
||||
}
|
||||
|
||||
void
|
||||
spiral(Monitor *m)
|
||||
{
|
||||
fibonacci(m, 0);
|
||||
}
|
||||
|
||||
void
|
||||
tcl(Monitor * m)
|
||||
{
|
||||
int x, y, h, w, mw, sw, bdw;
|
||||
unsigned int i, n;
|
||||
Client * c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c;
|
||||
c = nexttiled(c->next), n++);
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
c = nexttiled(m->clients);
|
||||
|
||||
mw = m->mfact * m->ww;
|
||||
sw = (m->ww - mw) / 2;
|
||||
bdw = (2 * c->bw);
|
||||
resize(c,
|
||||
n < 3 ? m->wx : m->wx + sw,
|
||||
m->wy,
|
||||
n == 1 ? m->ww - bdw : mw - bdw,
|
||||
m->wh - bdw,
|
||||
False);
|
||||
|
||||
if (--n == 0)
|
||||
return;
|
||||
|
||||
w = (m->ww - mw) / ((n > 1) + 1);
|
||||
c = nexttiled(c->next);
|
||||
|
||||
if (n > 1)
|
||||
{
|
||||
x = m->wx + ((n > 1) ? mw + sw : mw);
|
||||
y = m->wy;
|
||||
h = m->wh / (n / 2);
|
||||
|
||||
if (h < bh)
|
||||
h = m->wh;
|
||||
|
||||
for (i = 0; c && i < n / 2; c = nexttiled(c->next), i++)
|
||||
{
|
||||
resize(c,
|
||||
x,
|
||||
y,
|
||||
w - bdw,
|
||||
(i + 1 == n / 2) ? m->wy + m->wh - y - bdw : h - bdw,
|
||||
False);
|
||||
|
||||
if (h != m->wh)
|
||||
y = c->y + HEIGHT(c);
|
||||
}
|
||||
}
|
||||
|
||||
x = (n + 1 / 2) == 1 ? mw : m->wx;
|
||||
y = m->wy;
|
||||
h = m->wh / ((n + 1) / 2);
|
||||
|
||||
if (h < bh)
|
||||
h = m->wh;
|
||||
|
||||
for (i = 0; c; c = nexttiled(c->next), i++)
|
||||
{
|
||||
resize(c,
|
||||
x,
|
||||
y,
|
||||
(i + 1 == (n + 1) / 2) ? w - bdw : w - bdw,
|
||||
(i + 1 == (n + 1) / 2) ? m->wy + m->wh - y - bdw : h - bdw,
|
||||
False);
|
||||
|
||||
if (h != m->wh)
|
||||
y = c->y + HEIGHT(c);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bstack(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
int oh, ov, ih, iv;
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
sx = mx = m->wx + ov;
|
||||
sy = my = m->wy + oh;
|
||||
sh = mh = m->wh - 2*oh;
|
||||
mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
||||
sw = m->ww - 2*ov - iv * (n - m->nmaster - 1);
|
||||
|
||||
if (m->nmaster && n > m->nmaster) {
|
||||
sh = (mh - ih) * (1 - m->mfact);
|
||||
mh = mh - ih - sh;
|
||||
sx = mx;
|
||||
sy = my + mh + ih;
|
||||
}
|
||||
|
||||
getfacts(m, mw, sw, &mfacts, &sfacts, &mrest, &srest);
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
if (i < m->nmaster) {
|
||||
resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||
mx += WIDTH(c) + iv;
|
||||
} else {
|
||||
resize(c, sx, sy, sw * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
||||
sx += WIDTH(c) + iv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bstackhoriz(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
int oh, ov, ih, iv;
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
sx = mx = m->wx + ov;
|
||||
sy = my = m->wy + oh;
|
||||
mh = m->wh - 2*oh;
|
||||
sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
|
||||
mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1);
|
||||
sw = m->ww - 2*ov;
|
||||
|
||||
if (m->nmaster && n > m->nmaster) {
|
||||
sh = (mh - ih) * (1 - m->mfact);
|
||||
mh = mh - ih - sh;
|
||||
sy = my + mh + ih;
|
||||
sh = m->wh - mh - 2*oh - ih * (n - m->nmaster);
|
||||
}
|
||||
|
||||
getfacts(m, mw, sh, &mfacts, &sfacts, &mrest, &srest);
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
if (i < m->nmaster) {
|
||||
resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||
mx += WIDTH(c) + iv;
|
||||
} else {
|
||||
resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
|
||||
sy += HEIGHT(c) + ih;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
horizgrid(Monitor *m) {
|
||||
Client *c;
|
||||
unsigned int n, i;
|
||||
int oh, ov, ih, iv;
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
int ntop, nbottom = 1;
|
||||
float mfacts = 0, sfacts = 0;
|
||||
int mrest, srest, mtotal = 0, stotal = 0;
|
||||
|
||||
/* Count windows */
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
if (n <= 2)
|
||||
ntop = n;
|
||||
else {
|
||||
ntop = n / 2;
|
||||
nbottom = n - ntop;
|
||||
}
|
||||
sx = mx = m->wx + ov;
|
||||
sy = my = m->wy + oh;
|
||||
sh = mh = m->wh - 2*oh;
|
||||
sw = mw = m->ww - 2*ov;
|
||||
|
||||
if (n > ntop) {
|
||||
sh = (mh - ih) / 2;
|
||||
mh = mh - ih - sh;
|
||||
sy = my + mh + ih;
|
||||
mw = m->ww - 2*ov - iv * (ntop - 1);
|
||||
sw = m->ww - 2*ov - iv * (nbottom - 1);
|
||||
}
|
||||
|
||||
/* calculate facts */
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < ntop)
|
||||
mfacts += c->cfact;
|
||||
else
|
||||
sfacts += c->cfact;
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < ntop)
|
||||
mtotal += mh * (c->cfact / mfacts);
|
||||
else
|
||||
stotal += sw * (c->cfact / sfacts);
|
||||
|
||||
mrest = mh - mtotal;
|
||||
srest = sw - stotal;
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < ntop) {
|
||||
resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||
mx += WIDTH(c) + iv;
|
||||
} else {
|
||||
resize(c, sx, sy, sw * (c->cfact / sfacts) + ((i - ntop) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
||||
sx += WIDTH(c) + iv;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dynamicgrid(Monitor *m)
|
||||
{
|
||||
unsigned int n;
|
||||
int ri = 0, ci = 0; /* counters */
|
||||
int oh, ov, ih, iv; /* vanitygap settings */
|
||||
unsigned int cx, cy, cw, ch; /* client geometry */
|
||||
unsigned int uw = 0, uh = 0, uc = 0; /* utilization trackers */
|
||||
unsigned int cols, rows = m->nmaster + 1;
|
||||
Client *c;
|
||||
|
||||
/* count clients */
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
|
||||
/* nothing to do here */
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
/* force 2 clients to always split vertically */
|
||||
if (FORCE_VSPLIT && n == 2)
|
||||
rows = 1;
|
||||
|
||||
/* never allow empty rows */
|
||||
if (n < rows)
|
||||
rows = n;
|
||||
|
||||
/* define first row */
|
||||
cols = n / rows;
|
||||
uc = cols;
|
||||
cy = m->wy + oh;
|
||||
ch = (m->wh - 2*oh - ih*(rows - 1)) / rows;
|
||||
uh = ch;
|
||||
|
||||
for (c = nexttiled(m->clients); c; c = nexttiled(c->next), ci++) {
|
||||
if (ci == cols) {
|
||||
uw = 0;
|
||||
ci = 0;
|
||||
ri++;
|
||||
|
||||
/* next row */
|
||||
cols = (n - uc) / (rows - ri);
|
||||
uc += cols;
|
||||
cy = m->wy + oh + uh + ih;
|
||||
uh += ch + ih;
|
||||
}
|
||||
|
||||
cx = m->wx + ov + uw;
|
||||
cw = (m->ww - 2*ov - uw) / (cols - ci);
|
||||
uw += cw + iv;
|
||||
|
||||
resize(c, cx, cy, cw - (2*c->bw), ch - (2*c->bw), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tatami(Monitor *m) {
|
||||
unsigned int i, n, nx, ny, nw, nh,
|
||||
mats, tc,
|
||||
tnx, tny, tnw, tnh;
|
||||
Client *c;
|
||||
|
||||
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n);
|
||||
if(n == 0)
|
||||
return;
|
||||
|
||||
nx = m->wx;
|
||||
ny = 0;
|
||||
nw = m->ww;
|
||||
nh = m->wh;
|
||||
|
||||
c = nexttiled(m->clients);
|
||||
|
||||
if(n != 1) nw = m->ww * m->mfact;
|
||||
ny = m->wy;
|
||||
|
||||
resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False);
|
||||
|
||||
c = nexttiled(c->next);
|
||||
|
||||
nx += nw;
|
||||
nw = m->ww - nw;
|
||||
|
||||
if(n>1)
|
||||
{
|
||||
|
||||
tc = n-1;
|
||||
mats = tc/5;
|
||||
|
||||
nh/=(mats + (tc % 5 > 0));
|
||||
|
||||
for(i = 0; c && (i < (tc % 5)); c = nexttiled(c->next))
|
||||
{
|
||||
tnw=nw;
|
||||
tnx=nx;
|
||||
tnh=nh;
|
||||
tny=ny;
|
||||
switch(tc - (mats*5))
|
||||
{
|
||||
case 1://fill
|
||||
break;
|
||||
case 2://up and down
|
||||
if((i % 5) == 0) //up
|
||||
tnh/=2;
|
||||
else if((i % 5) == 1) //down
|
||||
{
|
||||
tnh/=2;
|
||||
tny += nh/2;
|
||||
}
|
||||
break;
|
||||
case 3://bottom, up-left and up-right
|
||||
if((i % 5) == 0) //up-left
|
||||
{
|
||||
tnw = nw/2;
|
||||
tnh = (2*nh)/3;
|
||||
}
|
||||
else if((i % 5) == 1)//up-right
|
||||
{
|
||||
tnx += nw/2;
|
||||
tnw = nw/2;
|
||||
tnh = (2*nh)/3;
|
||||
}
|
||||
else if((i % 5) == 2)//bottom
|
||||
{
|
||||
tnh = nh/3;
|
||||
tny += (2*nh)/3;
|
||||
}
|
||||
break;
|
||||
case 4://bottom, left, right and top
|
||||
if((i % 5) == 0) //top
|
||||
{
|
||||
tnh = (nh)/4;
|
||||
}
|
||||
else if((i % 5) == 1)//left
|
||||
{
|
||||
tnw = nw/2;
|
||||
tny += nh/4;
|
||||
tnh = (nh)/2;
|
||||
}
|
||||
else if((i % 5) == 2)//right
|
||||
{
|
||||
tnx += nw/2;
|
||||
tnw = nw/2;
|
||||
tny += nh/4;
|
||||
tnh = (nh)/2;
|
||||
}
|
||||
else if((i % 5) == 3)//bottom
|
||||
{
|
||||
tny += (3*nh)/4;
|
||||
tnh = (nh)/4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
resize(c, tnx, tny, tnw - 2 * c->bw, tnh - 2 * c->bw, False);
|
||||
}
|
||||
|
||||
++mats;
|
||||
|
||||
for(i = 0; c && (mats>0); c = nexttiled(c->next)) {
|
||||
|
||||
if((i%5)==0)
|
||||
{
|
||||
--mats;
|
||||
if(((tc % 5) > 0)||(i>=5))
|
||||
ny+=nh;
|
||||
}
|
||||
|
||||
tnw=nw;
|
||||
tnx=nx;
|
||||
tnh=nh;
|
||||
tny=ny;
|
||||
|
||||
|
||||
switch(i % 5)
|
||||
{
|
||||
case 0: //top-left-vert
|
||||
tnw = (nw)/3;
|
||||
tnh = (nh*2)/3;
|
||||
break;
|
||||
case 1: //top-right-hor
|
||||
tnx += (nw)/3;
|
||||
tnw = (nw*2)/3;
|
||||
tnh = (nh)/3;
|
||||
break;
|
||||
case 2: //center
|
||||
tnx += (nw)/3;
|
||||
tnw = (nw)/3;
|
||||
tny += (nh)/3;
|
||||
tnh = (nh)/3;
|
||||
break;
|
||||
case 3: //bottom-right-vert
|
||||
tnx += (nw*2)/3;
|
||||
tnw = (nw)/3;
|
||||
tny += (nh)/3;
|
||||
tnh = (nh*2)/3;
|
||||
break;
|
||||
case 4: //(oldest) bottom-left-hor
|
||||
tnw = (2*nw)/3;
|
||||
tny += (2*nh)/3;
|
||||
tnh = (nh)/3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
++i;
|
||||
//i%=5;
|
||||
resize(c, tnx, tny, tnw - 2 * c->bw, tnh - 2 * c->bw, False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tilewide(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, w, h, mw, mx, ty;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
mw = m->ww;
|
||||
for (i = mx = ty = 0, c = nexttiled(m->clients); c;
|
||||
c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
w = (mw - mx) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx + mx, m->wy, w - (2*c->bw), (m->wh - ty) - (2*c->bw), 0);
|
||||
if (mx + WIDTH(c) < m->ww)
|
||||
mx += WIDTH(c);
|
||||
} else {
|
||||
h = (m->wh - ty) / (n - i);
|
||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
ty += HEIGHT(c);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
stairs(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, h, mw, my;
|
||||
unsigned int ox, oy, ow, oh; /* stair offset values */
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
mw = m->ww;
|
||||
|
||||
for (i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
if (i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx, m->wy + my, mw - (2 * c->bw), h - (2 * c->bw), 0);
|
||||
if (my + HEIGHT(c) < m->wh)
|
||||
my += HEIGHT(c);
|
||||
} else {
|
||||
oy = i - m->nmaster;
|
||||
ox = stairdirection ? n - i - 1 : (stairsamesize ? i - m->nmaster : 0);
|
||||
ow = stairsamesize ? n - m->nmaster - 1 : n - i - 1;
|
||||
oh = stairsamesize ? ow : i - m->nmaster;
|
||||
resize(c,
|
||||
m->wx + mw + (ox * stairpx),
|
||||
m->wy + (oy * stairpx),
|
||||
m->ww - mw - (2 * c->bw) - (ow * stairpx),
|
||||
m->wh - (2 * c->bw) - (oh * stairpx),
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
centeredmaster(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
int oh, ov, ih, iv;
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int lx = 0, ly = 0, lw = 0, lh = 0;
|
||||
int rx = 0, ry = 0, rw = 0, rh = 0;
|
||||
float mfacts = 0, lfacts = 0, rfacts = 0;
|
||||
int mtotal = 0, ltotal = 0, rtotal = 0;
|
||||
int mrest = 0, lrest = 0, rrest = 0;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
/* initialize areas */
|
||||
mx = m->wx + ov;
|
||||
my = m->wy + oh;
|
||||
mh = m->wh - 2*oh - ih * ((!m->nmaster ? n : MIN(n, m->nmaster)) - 1);
|
||||
mw = m->ww - 2*ov;
|
||||
lh = m->wh - 2*oh - ih * (((n - m->nmaster) / 2) - 1);
|
||||
rh = m->wh - 2*oh - ih * (((n - m->nmaster) / 2) - ((n - m->nmaster) % 2 ? 0 : 1));
|
||||
|
||||
if (m->nmaster && n > m->nmaster) {
|
||||
/* go mfact box in the center if more than nmaster clients */
|
||||
if (n - m->nmaster > 1) {
|
||||
/* ||<-S->|<---M--->|<-S->|| */
|
||||
mw = (m->ww - 2*ov - 2*iv) * m->mfact;
|
||||
lw = (m->ww - mw - 2*ov - 2*iv) / 2;
|
||||
rw = (m->ww - mw - 2*ov - 2*iv) - lw;
|
||||
mx += lw + iv;
|
||||
} else {
|
||||
/* ||<---M--->|<-S->|| */
|
||||
mw = (mw - iv) * m->mfact;
|
||||
lw = 0;
|
||||
rw = m->ww - mw - iv - 2*ov;
|
||||
}
|
||||
lx = m->wx + ov;
|
||||
ly = m->wy + oh;
|
||||
rx = mx + mw + iv;
|
||||
ry = m->wy + oh;
|
||||
}
|
||||
|
||||
/* calculate facts */
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
|
||||
if (!m->nmaster || n < m->nmaster)
|
||||
mfacts += c->cfact;
|
||||
else if ((n - m->nmaster) % 2)
|
||||
lfacts += c->cfact; // total factor of left hand stack area
|
||||
else
|
||||
rfacts += c->cfact; // total factor of right hand stack area
|
||||
}
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++)
|
||||
if (!m->nmaster || n < m->nmaster)
|
||||
mtotal += mh * (c->cfact / mfacts);
|
||||
else if ((n - m->nmaster) % 2)
|
||||
ltotal += lh * (c->cfact / lfacts);
|
||||
else
|
||||
rtotal += rh * (c->cfact / rfacts);
|
||||
|
||||
mrest = mh - mtotal;
|
||||
lrest = lh - ltotal;
|
||||
rrest = rh - rtotal;
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
if (!m->nmaster || i < m->nmaster) {
|
||||
/* nmaster clients are stacked vertically, in the center of the screen */
|
||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||
my += HEIGHT(c) + ih;
|
||||
} else {
|
||||
/* stack clients are stacked vertically */
|
||||
if ((i - m->nmaster) % 2 ) {
|
||||
resize(c, lx, ly, lw - (2*c->bw), lh * (c->cfact / lfacts) + ((i - 2*m->nmaster) < 2*lrest ? 1 : 0) - (2*c->bw), 0);
|
||||
ly += HEIGHT(c) + ih;
|
||||
} else {
|
||||
resize(c, rx, ry, rw - (2*c->bw), rh * (c->cfact / rfacts) + ((i - 2*m->nmaster) < 2*rrest ? 1 : 0) - (2*c->bw), 0);
|
||||
ry += HEIGHT(c) + ih;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
centeredfloatingmaster(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
float mfacts, sfacts;
|
||||
float mivf = 1.0; // master inner vertical gap factor
|
||||
int oh, ov, ih, iv, mrest, srest;
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
sx = mx = m->wx + ov;
|
||||
sy = my = m->wy + oh;
|
||||
sh = mh = m->wh - 2*oh;
|
||||
mw = m->ww - 2*ov - iv*(n - 1);
|
||||
sw = m->ww - 2*ov - iv*(n - m->nmaster - 1);
|
||||
|
||||
if (m->nmaster && n > m->nmaster) {
|
||||
mivf = 0.8;
|
||||
/* go mfact box in the center if more than nmaster clients */
|
||||
if (m->ww > m->wh) {
|
||||
mw = m->ww * m->mfact - iv*mivf*(MIN(n, m->nmaster) - 1);
|
||||
mh = m->wh * 0.9;
|
||||
} else {
|
||||
mw = m->ww * 0.9 - iv*mivf*(MIN(n, m->nmaster) - 1);
|
||||
mh = m->wh * m->mfact;
|
||||
}
|
||||
mx = m->wx + (m->ww - mw) / 2;
|
||||
my = m->wy + (m->wh - mh - 2*oh) / 2;
|
||||
|
||||
sx = m->wx + ov;
|
||||
sy = m->wy + oh;
|
||||
sh = m->wh - 2*oh;
|
||||
}
|
||||
|
||||
getfacts(m, mw, sw, &mfacts, &sfacts, &mrest, &srest);
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
/* nmaster clients are stacked horizontally, in the center of the screen */
|
||||
resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
||||
mx += WIDTH(c) + iv*mivf;
|
||||
} else {
|
||||
/* stack clients are stacked horizontally */
|
||||
resize(c, sx, sy, sw * (c->cfact / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
||||
sx += WIDTH(c) + iv;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
deck(Monitor *m)
|
||||
{
|
||||
unsigned int i, n;
|
||||
int oh, ov, ih, iv;
|
||||
int mx = 0, my = 0, mh = 0, mw = 0;
|
||||
int sx = 0, sy = 0, sh = 0, sw = 0;
|
||||
float mfacts, sfacts;
|
||||
int mrest, srest;
|
||||
Client *c;
|
||||
|
||||
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
sx = mx = m->wx + ov;
|
||||
sy = my = m->wy + oh;
|
||||
sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
|
||||
sw = mw = m->ww - 2*ov;
|
||||
|
||||
if (m->nmaster && n > m->nmaster) {
|
||||
sw = (mw - iv) * (1 - m->mfact);
|
||||
mw = mw - iv - sw;
|
||||
sx = mx + mw + iv;
|
||||
sh = m->wh - 2*oh;
|
||||
}
|
||||
|
||||
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
|
||||
|
||||
if (n - m->nmaster > 0) /* override layout symbol */
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
|
||||
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
|
||||
my += HEIGHT(c) + ih;
|
||||
} else {
|
||||
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tile54(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, h, mw, my, ty, move;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
if (n == 1) {
|
||||
mw = m->ww * 0.703125; // 16:9 to horizontal 5:4
|
||||
//mw = m->ww * 0.45; // 16:9 to vertical 5:4
|
||||
move = (m->ww - mw) / 2;
|
||||
h = m->wh;
|
||||
c = nexttiled(m->clients);
|
||||
i = my = ty = 0;
|
||||
resize(c, m->wx + move, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
mw = m->ww;
|
||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
my += HEIGHT(c);
|
||||
} else {
|
||||
h = (m->wh - ty) / (n - i);
|
||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
ty += HEIGHT(c);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
col(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, h, w, x, y, mw;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
mw = m->ww;
|
||||
for (i = x = y = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
w = (mw - x) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, x + m->wx, m->wy, w - (2 * c->bw), m->wh - (2 * c->bw), 0);
|
||||
x += WIDTH(c);
|
||||
} else {
|
||||
h = (m->wh - y) / (n - i);
|
||||
resize(c, x + m->wx, m->wy + y, m->ww - x - (2 * c->bw), h - (2 * c->bw), 0);
|
||||
y += HEIGHT(c);
|
||||
}
|
||||
}
|
||||
|
28
layouts.h
Normal file
28
layouts.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* These are all available layouts in speedwm.
|
||||
* Any new layouts should be added in the exact same way as existing layouts.
|
||||
* Layouts that are added through patches should be in layouts.c
|
||||
*
|
||||
* Once you're done with your edits, run 'make clean install'. */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
{ "(L1)", tile },
|
||||
{ "(L2)", NULL },
|
||||
{ "(L3)", monocle },
|
||||
{ "(L4)", grid },
|
||||
{ "(L5)", deck },
|
||||
{ "(L6)", centeredmaster },
|
||||
{ "(L7)", centeredfloatingmaster },
|
||||
{ "(L8)", spiral },
|
||||
{ "(L9)", dwindle },
|
||||
{ "(L10)", tcl },
|
||||
{ "(L11)", bstack },
|
||||
{ "(L12)", bstackhoriz },
|
||||
{ "(L13)", horizgrid },
|
||||
{ "(L14)", tatami },
|
||||
{ "(L15)", tilewide },
|
||||
{ "(L16)", stairs },
|
||||
{ "(L17)", tile54 },
|
||||
{ "(L18)", col },
|
||||
{ "(L19)", dynamicgrid },
|
||||
{ NULL, NULL },
|
||||
};
|
38
mouse.h
Normal file
38
mouse.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* Mouse bindings
|
||||
*
|
||||
* This header contains mouse binds.
|
||||
* Change them, or remove them if you prefer. You can also add more if you want.
|
||||
* Once you're done with your edits, run 'make clean install'.
|
||||
*/
|
||||
|
||||
/* Actions when the mouse clicks a part of the screen */
|
||||
static Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button3, layoutmenu, {0} },
|
||||
{ ClkLtSymbol, 0, Button1, cyclelayout, {.i = +1 } },
|
||||
{ ClkLtSymbol, 0, Button2, cyclelayout, {.i = -1 } },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkClientWin, MODKEY, Button1, moveorplace, {.i = 1} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
{ ClkStatusText, 0, Button1, spawn, {.v = statuscmd } },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = statuscmd } },
|
||||
{ ClkStatusText, 0, Button3, spawn, {.v = statuscmd } },
|
||||
{ ClkWinTitle, 0, Button1, togglewin, {0} },
|
||||
{ ClkWinTitle, 0, Button3, spawn, SHCMD("speedwm-utils") },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
};
|
||||
|
||||
/* Commands that will run when a part of the status bar is pressed
|
||||
* Built in status bar does not have support for this yet but you can add it by adding:
|
||||
* '\x<num>
|
||||
* before you print anything. Keep in mind <num> MUST be two digits.
|
||||
*
|
||||
* Invalid: xsetroot -name "\x01This is a test"
|
||||
* Valid: xsetroot -name "$(printf '\x01This is a test')"
|
||||
*/
|
||||
static const StatusCmd statuscmds[] = {
|
||||
{ "notify-send 'Status item (1) was pressed.'", 1 },
|
||||
{ "notify-send 'Status item (2) was pressed.'", 2 },
|
||||
{ "notify-send 'Status item (3) was pressed.'", 3 },
|
||||
};
|
312
options.h
Normal file
312
options.h
Normal file
|
@ -0,0 +1,312 @@
|
|||
/* speedwm
|
||||
*
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* Keep in mind that speedwm is a personal window manager and therefore comes with keybinds for software I use and find appealing.
|
||||
* If you do not like these keybinds, consider:
|
||||
* - Copying this source code folder to another folder (such as speedwm-orig)
|
||||
* - Deleting the lines you don't want in the files
|
||||
* - Creating a patch using 'diff -up speedwm speedwm-orig > speedwm-settings.diff'
|
||||
* - Copy the diff elsewhere. When updating speedwm (such as with 'git pull'), you can copy it to the source code folder and run 'patch < speedwm-settings.diff'.
|
||||
* Otherwise you may maintain your own fork of speedwm.
|
||||
*
|
||||
* 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.
|
||||
* Below is a configuration file. Read the instructions below for information about how to configure it.
|
||||
*
|
||||
* To use speedwm, you must first install all the dependencies. See 'speedwm-help -a' for a list of dependencies.
|
||||
* Then, you need to run 'speedwm_run' after X has started. This can usually be done by adding 'speedwm_run' to ~/.xinitrc and running 'startx'.
|
||||
* If you use a display manger/login manager like sddm, lightdm or something that uses entries, the entry should be created after installation.
|
||||
*
|
||||
* The header you are currently reading is for changing what software you want to use.
|
||||
*
|
||||
* Because this build of speedwm auto-starts software such as your compositor, you may want to change this by changing '#define COMPOSITOR'. Same goes for other software.
|
||||
*
|
||||
* If you aren't aware of this, do not add anything to your .xinitrc if it is listed in autostart.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 config.mk
|
||||
*
|
||||
* This build comes with defines for common software such as your web
|
||||
* browser or terminal.
|
||||
* If you wish to use a different browser for example, simply change the values.
|
||||
*
|
||||
* You do not need to edit 'keybinds.h' or 'rules.h' because that's where these are used.
|
||||
* Once you're done with your edits, run 'make clean install'.
|
||||
*
|
||||
* Alternatively, you can change some of these in ~/.config/speedwm-de/speedwmrc.
|
||||
* Software options must be changed in this file though.
|
||||
******************************************************/
|
||||
|
||||
/* Software options
|
||||
* Note that any software named "speedwm-*" is bundled with this build and does not need to be replaced unless you want to.
|
||||
*/
|
||||
#define TERMINAL "st -e " /* Terminal to use */
|
||||
#define BROWSER "firefox" /* Web browser to use */
|
||||
#define SYSTEMSTAT "htop" /* System stat viewer to use */
|
||||
#define RSS "newsboat" /* RSS reader to use */
|
||||
#define PDF "zathura" /* PDF reader to use */
|
||||
#define MUSIC "cmus" /* Music player to use */
|
||||
#define VISUALIZER "~/.local/bin/vis || vis" /* Music visualizer to use */
|
||||
#define EMAIL "aerc" /* Email client to use */
|
||||
#define EDITOR "nvim" /* Text editor to use */
|
||||
#define RUN "dmenu_run -l 0 -p 'Run:' -h 19" /* Run launcher */
|
||||
#define SCREENSHOT "speedwm-screenshotutil -s" /* How to take screenshots (Selection) */
|
||||
#define SCREENSHOT_FULL "speedwm-screenshotutil -f" /* How to take screenshots (Full screen) */
|
||||
#define FILEMANAGER "vifmrun || vifm" /* File manager that will be used */
|
||||
#define LOCKER "slock" /* Screen locker that will be used */
|
||||
#define OPENPDF "speedwm-pdfopen ~/Documents zathura || ~/Scripts/speedwm-pdfopen ~/Documents zathura" /* Command to run when listing and opening PDFs. */
|
||||
#define KILLMUSIC "pkill cmus" /* Command to run when killing the music player */
|
||||
|
||||
/* Software classes */
|
||||
#define TERMINAL_CLASS "St" /* Terminal to use for rules */
|
||||
#define BROWSER_CLASS "firefox" /* Web browser to use for rules */
|
||||
#define PDF_CLASS "Zathura" /* PDF reader to use for rules */
|
||||
#define FILEMANAGER_CLASS "vifmrun" /* File manager that will be used 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 */
|
||||
#define VOL_OUTPUT_SPEAKER "speedwm-audioctrl -switch" /* Command to run when enabling speakers */
|
||||
|
||||
/* Modifier keys
|
||||
* Mod4Mask | Super (Windows/command) key
|
||||
* Mod1Mask | Alt key
|
||||
*/
|
||||
#define MODKEY Mod4Mask
|
||||
#define SMODKEY Mod1Mask
|
||||
|
||||
/* Managers */
|
||||
#define CLIPBOARD "xclip" /* Clipboard to use */
|
||||
#define COMPOSITOR "picom --experimental-backends" /* Compositor to use */
|
||||
#define NETWORK "speedwm-netctrl" /* Network manager to use */
|
||||
#define BLUETOOTH "speedwm-btctrl" /* Bluetooth manager to use */
|
||||
#define NOTIFICATION "dunst" /* Notification daemon to use */
|
||||
|
||||
/* Paths */
|
||||
#define SESSION_FILE "/tmp/speedwm-session" /* Session file. This file may be used as a list of windows and their tagnum */
|
||||
|
||||
/* Misc */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ shell, "-c", cmd, NULL } }
|
||||
#define TAGKEYS(CHAIN,KEY,TAG) { MODKEY, CHAIN, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, CHAIN, KEY, previewtag, {.ui = TAG} },
|
||||
/* Options
|
||||
*
|
||||
* If xrdb is installed, you can simply edit ~/.config/speedwm-de/speedwmrc instead of recompiling.
|
||||
* Once you're done with your edits, run 'make clean install'.
|
||||
*/
|
||||
|
||||
/* Window alignment options */
|
||||
static unsigned int borderpx = 1; /* How big your border is */
|
||||
static unsigned int snap = 20; /* Snap pixel */
|
||||
static int nmaster = 1;
|
||||
static int resizehints = 0;
|
||||
static int decorhints = 1; /* Respect decoration hints */
|
||||
static int savefloat = 1; /* Save position of floating windows */
|
||||
static int refreshrules = 1; /* Refresh rules when a CLASS or TITLE changes */
|
||||
static int i3nmaster = 0; /* Enable i3-gaps like nmaster (1/0) */
|
||||
static int mousemfact = 1; /* Enable adjusting mfact using the mouse (1/0) */
|
||||
static float mfact = 0.50;
|
||||
|
||||
/* Window gap options */
|
||||
static int enablegaps = 1; /* Enable gaps */
|
||||
static unsigned int gappih = 10; /* horiz inner gap between windows */
|
||||
static unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||
static unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||
static unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
||||
static unsigned int smartgapsize = 0; /* Gaps for smartgaps. If set to zero, gaps will be disabled. */
|
||||
static int smartgaps = 0; /* 1 means use different gap size when there is only one window */
|
||||
|
||||
/* Window aesthetic options */
|
||||
static int fadeinactive = 1; /* Fade inactive windows */
|
||||
static double activeopacity = 1.0f; /* Window opacity when it's focused (0 <= opacity <= 1) */
|
||||
static double inactiveopacity = 0.875f; /* Window opacity when it's inactive (0 <= opacity <= 1) */
|
||||
static Bool bUseOpacity = True; /* Starts with opacity on any unfocused windows */
|
||||
|
||||
/* Rounded corners
|
||||
* In order to use:
|
||||
* - borderpx must also be set to 0 or else rounded corners will be disabled.
|
||||
*/
|
||||
static int roundedcorners = 0; /* Enable (1) rounded corners or disable (0) rounded corners. */
|
||||
static int cornerradius = 3; /* Radius of rounded corners, 10 is the default. */
|
||||
|
||||
/* Tag preview options */
|
||||
static int tagpreview = 1; /* Enable tag previews */
|
||||
static int mousepreview = 1; /* Display tag previews if hovering over a tag */
|
||||
static int scalepreview = 4; /* Size of tag preview */
|
||||
|
||||
/* Window spawning options */
|
||||
static int spawncd = 1; /* Spawn clients in the working directory of the focused client */
|
||||
static int attachdirection = 3; /* 0 default, 1 above, 2 aside, 3 below, 4 bottom, 5 top */
|
||||
static int swallowclients = 1; /* Swallow windows or not */
|
||||
static int swallowfloating = 1; /* Swallow floating windows by default */
|
||||
static int centerfloating = 1; /* Center floating windows by default */
|
||||
static int startontag = 1; /* Start on a tag or not? */
|
||||
static int floatscratchpad = 0; /* Float the scratchpad window on hide (1/0) */
|
||||
|
||||
/* Font options */
|
||||
static char font[] = { "fontawesome:size=8" }; /* What font should we use? */
|
||||
static char font2[] = { "NotoSans-Regular:size=8:antialiasing=true" }; /* Second font */
|
||||
static char font3[] = { "Noto Emoji:size=8" }; /* Third font */
|
||||
static const char *fonts[] = { font, font2, font3 };
|
||||
static char defaultname[] = ""; /* What to print when a status bar is not running */
|
||||
|
||||
/* Bar options */
|
||||
static char status[] = "status"; /* Status bar to use, speedwmblocks for speedwmblocks, slstatus for slstatus, etc. */
|
||||
|
||||
/* Alternate bar
|
||||
*
|
||||
* Some users may prefer to use a different bar than what speedwm provides.
|
||||
* Polybar users for example might want to use their bspwm bar in speedwm.
|
||||
* If so, follow these instructions:
|
||||
* - Use xprop to find the class (WM_CLASS) and add that to altbarclass
|
||||
* - Set altbarcmd to the bar you want to use.
|
||||
* - Set altbar to 1 (0 will disable it).
|
||||
* - Recompile speedwm and restart it using 'speedwm_run -r'
|
||||
*
|
||||
* If you didn't do any changes to the source code, just run speedwm_run -r'
|
||||
* If you use Polybar, the default settings here will work, just set altbar to 1 and set altbarcmd to 'polybar &'.
|
||||
*/
|
||||
static char *altbarcmd = "";
|
||||
static int altbar = 0; /* 1 means use non-speedwm status bar */
|
||||
static char *altbarclass = "Polybar"; /* Alternate bar class name */
|
||||
static char *alttrayname = "tray"; /* Polybar tray instance name */
|
||||
|
||||
/* Misc */
|
||||
static char shell[] = "/bin/sh"; /* Shell to use */
|
||||
static char *scratchpadcmd[] = {"s", TERMINAL, "-t", "scratchpad", NULL};
|
||||
static int movefullscreenmon = 1; /* Move fullscreen windows to another monitor */
|
||||
static int lockfullscreen = 1;
|
||||
static int warpcursor = 1; /* Warp cursor when switching client/monitor */
|
||||
static int pertag = 1; /* Use different mfact and layout for each layout */
|
||||
static int wmclass = 1; /* Enable (1) workaround for when a class cannot be grabbed */
|
||||
static int clicktofocus = 0; /* Click to focus a window, instead of focusing when touched. (1/0) */
|
||||
|
||||
/* Icon options */
|
||||
static int sizeicon = 10; /* size of the icon */
|
||||
static int spacingicon = 5; /* spacing between the title and icon */
|
||||
|
||||
/* Bar options */
|
||||
static int barheight = 5; /* Bar height in px, 0 = calculate automatically */
|
||||
static int barposition = 1; /* Bar position. Top: 0, Bottom: 1 */
|
||||
static int barpaddingv = 0; /* How much padding to have vertically in pixels */
|
||||
static int barpaddingh = 0; /* How much padding to have horizontally in pixels */
|
||||
static int leftlayout = 1; /* Layout indicator on the left (1) or on the right (0) */
|
||||
|
||||
/* Tag text options */
|
||||
static int underline = 0; /* Underline tags (1) or not (0) */
|
||||
static int underlineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
|
||||
static int underlinepad = 5; /* Horizontal padding between the underline and tag */
|
||||
static int underlinestroke = 2; /* Height of the underline */
|
||||
static int underlinevoffset = 0; /* How far above the bottom of the bar the line should appear */
|
||||
|
||||
/* Bar item options */
|
||||
static int showbar = 1; /* Show the bar or not? */
|
||||
static int hidelayout = 0; /* Hide layout indicator (1) or show (0) */
|
||||
static int hidetitle = 0; /* Hide title (1) or show (0) */
|
||||
static int hidestatus = 0; /* Hide status bar (1) or show (0) */
|
||||
static int hidetags = 0; /* Hide status bar (1) or show (0) */
|
||||
static int hidefloating = 0; /* Hide floating indicator (1) or show (0) */
|
||||
static int hidesticky = 0; /* Hide sticky indicator (1) or show (0) */
|
||||
|
||||
/* Status options */
|
||||
static int statusallmons = 1; /* Draw status bar on all monitors */
|
||||
|
||||
/* Layout options */
|
||||
static unsigned int monocleclientcount = 0; /* Display client count in the Monocle layout */
|
||||
static unsigned int monoclecount = 0; /* Display focused client and number of total clients in the Monocle layout */
|
||||
static char monocleformat[] = "[%d/%d]"; /* Format of the monocle count. Unsigned integer monoclecount must be set to 1 for this to be used. */
|
||||
static unsigned int deckcount = 0; /* Display deck count in the deck layout */
|
||||
static char deckformat[] = "D %d"; /* Format of the deck count. deckcount must be set to 1 for this to be used. */
|
||||
static unsigned int stairpx = 20; /* depth of the stairs layout */
|
||||
static int stairdirection = 1; /* 0: left-aligned, 1: right-aligned */
|
||||
static int stairsamesize = 1; /* 1 means shrink all the staired windows to the same size */
|
||||
static int defaultlayout = 1; /* Reset layout when there is only one client visible */
|
||||
static int forcevsplit = 1; /* Force two clients to always split vertically in nrowgrid layout */
|
||||
|
||||
/* Bar colors */
|
||||
static char col_background[] = "#222222"; /* speedwm dark bg & slstatus bg */
|
||||
static char col_backgroundmid[] = "#222222"; /* speedwm middle background */
|
||||
|
||||
/* General text colors */
|
||||
static char col_textnorm[] = "#bbbbbb"; /* application title bar/font for norm */
|
||||
static char col_textsel[] = "#eeeeee"; /* speedwm text/font for selected */
|
||||
|
||||
/* Window border colors */
|
||||
static char col_windowbordernorm[] = "#000000"; /* speedwm norm window border */
|
||||
static char col_windowbordersel[] = "#eeeeee"; /* speedwm sel window border */
|
||||
|
||||
/* Tag text/background colors */
|
||||
static char col_tag1[] = "#333333"; /* tag 1 background */
|
||||
static char col_tag1_text[] = "#eeeeee"; /* tag 1 text (fg) */
|
||||
static char col_tag2[] = "#333333"; /* tag 2 background */
|
||||
static char col_tag2_text[] = "#eeeeee"; /* tag 2 text (fg) */
|
||||
static char col_tag3[] = "#333333"; /* tag 3 background */
|
||||
static char col_tag3_text[] = "#eeeeee"; /* tag 3 text (fg) */
|
||||
static char col_tag4[] = "#333333"; /* tag 4 background */
|
||||
static char col_tag4_text[] = "#eeeeee"; /* tag 4 text (fg) */
|
||||
static char col_tag5[] = "#333333"; /* tag 5 background */
|
||||
static char col_tag5_text[] = "#eeeeee"; /* tag 5 text (fg) */
|
||||
static char col_tag6[] = "#333333"; /* tag 6 background */
|
||||
static char col_tag6_text[] = "#eeeeee"; /* tag 6 text (fg) */
|
||||
static char col_tag7[] = "#333333"; /* tag 7 background */
|
||||
static char col_tag7_text[] = "#eeeeee"; /* tag 7 text (fg) */
|
||||
static char col_tag8[] = "#333333"; /* tag 8 background */
|
||||
static char col_tag8_text[] = "#eeeeee"; /* tag 8 text (fg) */
|
||||
static char col_tag9[] = "#333333"; /* tag 9 background */
|
||||
static char col_tag9_text[] = "#eeeeee"; /* tag 9 text (fg) */
|
||||
|
||||
/* Layout indicator colors */
|
||||
static char col_layouttext[] = "#000000"; /* Layout indicator text (fg) */
|
||||
static char col_layoutbgnorm[] = "#222222"; /* Layout indicator background (norm) */
|
||||
static char col_layoutbgsel[] = "#bbbbbb"; /* Layout indicator background (norm) */
|
||||
|
||||
/* status2d colors */
|
||||
static char col_status0[] = "#131210";
|
||||
static char col_status1[] = "#bf616a";
|
||||
static char col_status2[] = "#A16F9D";
|
||||
static char col_status3[] = "#68ABAA";
|
||||
static char col_status4[] = "#A89F93";
|
||||
static char col_status5[] = "#D3A99B";
|
||||
static char col_status6[] = "#AFC9AC";
|
||||
static char col_status7[] = "#eae1cb";
|
||||
static char col_status8[] = "#a39d8e";
|
||||
static char col_status9[] = "#6D5E8E";
|
||||
static char col_status10[] = "#A16F9D";
|
||||
static char col_status11[] = "#D3A99B";
|
||||
static char col_status12[] = "#AFC9AC";
|
||||
static char col_status13[] = "#eae1cb";
|
||||
static char col_status14[] = "#6D5E8E";
|
||||
static char col_status15[] = "#ffffff";
|
||||
|
||||
/* Opacity settings
|
||||
* These options set the opacity of the status bar modules.
|
||||
* They can be anything from 0 (fully transparent) to 255 (fully opaque).
|
||||
*
|
||||
* You can also set OPAQUE and TRANSPARENT which are the same as 0 and 255 respectively.
|
||||
*/
|
||||
static const unsigned int baropacity = 160; /* Opacity for the overall bar */
|
||||
static const unsigned int layoutopacity = 160; /* Opacity for the layout indicator */
|
||||
static const unsigned int tagnormopacity = OPAQUE; /* Opacity for other tags */
|
||||
static const unsigned int tagselopacity = OPAQUE; /* Opacity for the selected tag */
|
||||
static const unsigned int normtitleopacity = 160; /* Opacity for all other windows in the speedwm bar */
|
||||
static const unsigned int seltitleopacity = 160; /* Opacity for the focused window in the speedwm bar */
|
||||
static const unsigned int hiddenopacity = 0; /* Opacity for hidden/minimized windows */
|
||||
static const unsigned int statusopacity = 180; /* Opacity for speedwm status bar */
|
||||
|
||||
/* Tag text options */
|
||||
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
/* NOTE: alttags will not be used if taglabels are used. */
|
||||
static char *alttags[] = { "[1]", "[2]", "[3]", "[4]", "[5]", "[6]", "[7]", "[8]", "[9]" };
|
||||
|
||||
/* Icon misc */
|
||||
static XPoint stickyicon[] = { {0,0}, {4,0}, {4,8}, {2,6}, {0,8}, {0,0} }; /* represents the icon as an array of vertices */
|
||||
static XPoint stickyiconbb = {4,8}; /* defines the bottom right corner of the polygon's bounding box (speeds up scaling) */
|
||||
|
||||
/* You have reached the end of the configuration file.
|
||||
* For keybinds, see 'keybinds.h'
|
||||
* Once you're done editing, run 'make clean install'.
|
||||
*/
|
38
rules.h
Normal file
38
rules.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* Rules
|
||||
* Any applications defined here must follow the rules specified.
|
||||
* The user can get the class by running a program like xprop (must be installed by the user) and then selecting the software.
|
||||
*
|
||||
* - tags mask: Disable tags where the CLASS, INSTANCE or TITLE will spawn. (X << Y)
|
||||
* - isfloating: Choose whether a CLASS, INSTANCE or TITLE will spawn as floating. (1/0)
|
||||
* - ispermanent: Whether or not you can kill a client
|
||||
* - 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)
|
||||
* - ignoretransient: Whether or not to ignore transient windows for CLASS, INSTANCE or TITLE (1/0)
|
||||
*
|
||||
* 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'.
|
||||
*
|
||||
***************************************************************/
|
||||
static const Rule rules[] = {
|
||||
/* 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, "sxiv", 0, 0, 0, 0, 0, -1, 0, 0, 0 },
|
||||
{ TERMINAL_CLASS, NULL, FILEMANAGER_CLASS, 0, 0, 0, 1, 0, -1, 0, 0, 0 },
|
||||
{ PDF_CLASS, 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, MUSIC, 0, 0, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ TERMINAL_CLASS, NULL, broken, 0, 0, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ TERMINAL_CLASS, NULL, MIXER, 0, 1, 0, 0, 1, -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 },
|
||||
{ "tabbed", NULL, NULL, 0, 0, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ "trayer", NULL, NULL, 0, 1, 1, 0, 1, -1, 1, 0, 0 },
|
||||
{ NULL, NULL, "CustomizeMii 3.11 by Leathl", 0, 1, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ NULL, NULL, "Picture-in-Picture", 0, 1, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ NULL, NULL, "About GNU IceCat", 0, 1, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ NULL, NULL, "About LibreWolf", 0, 1, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ NULL, NULL, "About Mozilla Firefox", 0, 1, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ NULL, NULL, "Save Image", 0, 1, 0, 0, 1, -1, 0, 0, 0 },
|
||||
{ NULL, NULL, "scratchpad", 0, 0, 0, -1, 's' },
|
||||
};
|
||||
|
34
scripts/libxftfix
Executable file
34
scripts/libxftfix
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
# libxft_bgra install script.
|
||||
|
||||
echo "WARNING: This script has not been properly tested and may not work as expected or at all. Expect to install libXft-bgra manually if necessary."
|
||||
|
||||
libxft_arch() {
|
||||
ls /usr/bin/git
|
||||
git clone https://aur.archlinux.org/libxft-bgra && echo "Cloned libXft-bgra AUR repository."
|
||||
cd libxft-bgra && echo "Changed directory to libxft_bgra"
|
||||
makepkg -si && echo "Installed libXft-bgra"
|
||||
cd ..
|
||||
rm -r libxft-bgra && echo "Cleaned."
|
||||
echo "Done installing libXft-bgra."
|
||||
}
|
||||
|
||||
libxft_gentoo() {
|
||||
mkdir -p /etc/portage/patches/x11-libs/libXft && echo "Created directory."
|
||||
curl -o /etc/portage/patches/x11-libs/libXft/bgra.diff https://raw.githubusercontent.com/speediegq/spDE-resources/main/1.diff && echo "Downloaded patch."
|
||||
emerge x11-libs/libXft && echo "Installed libXft-bgra."
|
||||
}
|
||||
|
||||
libxft_source() {
|
||||
git clone https://github.com/uditkarode/libxft-bgra && cd libxft-bgra && echo "Cloned and changed directory."
|
||||
sh autogen.sh --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man && echo "Ran autogen script"
|
||||
make install && echo "Compiled libXft-bgra."
|
||||
cd .. && rm -r libxft-bgra && echo "Cleaned."
|
||||
echo "Done installing libXft-bgra."
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"-gentoo") libxft_gentoo ;;
|
||||
"-arch") libxft_arch ;;
|
||||
"-source") libxft_source ;;
|
||||
esac
|
142
scripts/speedwm-audioctrl
Executable file
142
scripts/speedwm-audioctrl
Executable file
|
@ -0,0 +1,142 @@
|
|||
#!/bin/sh
|
||||
# speedwm-audioctrl
|
||||
# This simple shell script handles audio controls for speedwm.
|
||||
# Run speedwm-audioctrl -help for more information!
|
||||
# License: GPLv3.
|
||||
|
||||
BINDIR=$(cat /usr/share/speedwm-bindir)
|
||||
|
||||
MUTE() {
|
||||
# Mute for pulseaudio/pipewire
|
||||
if [ "$AUDIO" = "pulse" ]; then
|
||||
if [ -e "${BINDIR}pulsemixer" ]; then
|
||||
pulsemixer --toggle-mute
|
||||
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}pulsemixer" ]; then
|
||||
if [ "$(pulsemixer --get-volume | awk '{ print $1 }')" = "100" ]; then
|
||||
a=$a
|
||||
else
|
||||
pulsemixer --change-volume +7
|
||||
test ${BINDIR}notify-send && notify-send " $(pulsemixer --get-volume | awk '{ print $1 }')%"
|
||||
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}pulsemixer" ]; then
|
||||
if [ "$(pulsemixer --get-volume | awk '{ print $1 }')" = "0" ]; then
|
||||
a=$a
|
||||
else
|
||||
pulsemixer --change-volume -7
|
||||
test ${BINDIR}notify-send && notify-send " $(pulsemixer --get-volume | awk '{ print $1 }')%"
|
||||
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}pulsemixer" ]; then
|
||||
echo "$(pulsemixer --get-volume | awk '{ print $1 }')%"
|
||||
fi
|
||||
else
|
||||
echo "$(amixer -c 0 get Master | tail -n 1 | sed -r "s/.*\[(.*)%\].*/\1/")%"
|
||||
fi
|
||||
}
|
||||
|
||||
GETMUTE() {
|
||||
if [ "$AUDIO" = "pulse" ]; then
|
||||
if [ -e "${BINDIR}pulsemixer" ]; then
|
||||
pulsemixer --get-mute | grep 1 > /dev/null && echo "Muted"
|
||||
pulsemixer --get-mute | grep 0 > /dev/null && echo "Not muted"
|
||||
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
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
# Update status
|
||||
UPDATESTATUS() {
|
||||
pkill 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
|
115
scripts/speedwm-btctrl
Executable file
115
scripts/speedwm-btctrl
Executable file
|
@ -0,0 +1,115 @@
|
|||
#!/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=$(cat /usr/share/speedwm-bindir) # Set binary directory to the contents of this file for NixOS support
|
||||
}
|
||||
|
||||
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 -g 1 -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
|
||||
USEROPT_1="$(printf "$(bluetoothctl devices | cut -d\ -f3-)\n------\nRefresh\nHelp\nExit" | $RUNLAUNCHER -l 12 -g 1 -p "Select a device")"
|
||||
|
||||
# Check what to do
|
||||
case "$USEROPT_1" in
|
||||
"") $0 && 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 "-- Options --\nConnect\nDisconnect\n-- Toggle --\nPair\nRemove\nTrust\nUntrust\n--\nExit\nHelp" | $RUNLAUNCHER -g 1 -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() {
|
||||
bluetoothctl connect $SELDEVICE_MAC
|
||||
}
|
||||
|
||||
# Disconnect
|
||||
DISCONNECT() {
|
||||
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"
|
||||
}
|
||||
|
||||
NOTIFY_REMOVE() {
|
||||
notify-send " Removed $USEROPT_1"
|
||||
}
|
||||
|
||||
# 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 ;;
|
||||
"") $0 && exit 0 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
PERFORM
|
||||
|
||||
$0 && exit 0
|
68
scripts/speedwm-compatcheck
Executable file
68
scripts/speedwm-compatcheck
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
# speedwm-compatcheck
|
||||
# compatibility checker used by 'make' when compiling speedwm.
|
||||
|
||||
BINDIR=$(cat /usr/share/speedwm-bindir)
|
||||
|
||||
# Check if xrdb exists
|
||||
if [ -e "${BINDIR}xrdb" ]; then
|
||||
xrdb_exists=true
|
||||
else
|
||||
printf "\nWARNING: xrdb was not found. .Xresources and Pywal support will not work."
|
||||
fi
|
||||
|
||||
# Check if wmctrl exists
|
||||
if [ -e "${BINDIR}wmctrl" ]; then
|
||||
wmctrl_exists=true
|
||||
else
|
||||
printf "\nWARNING: wmctrl was not found. Window management using 'Alt+Tab' will not work."
|
||||
fi
|
||||
|
||||
# Check if xsetroot exists
|
||||
if [ -e "${BINDIR}xsetroot" ]; then
|
||||
xsetroot_exists=true
|
||||
else
|
||||
printf "\nerror: ${BINDIR}xsetroot was not found\n" && exit 1
|
||||
fi
|
||||
|
||||
# Check if xwallpaper exists
|
||||
if [ -e "${BINDIR}xwallpaper" ]; then
|
||||
xwallpaper_exists=true
|
||||
else
|
||||
printf "\nWARNING: xwallpaper was not found. This means setting your wallpaper and Pywal support won't work."
|
||||
fi
|
||||
|
||||
# Check if xmodmap exists
|
||||
if [ -e "${BINDIR}xmodmap" ]; then
|
||||
xmodmap_exists=true
|
||||
else
|
||||
printf "\nWARNING: xmodmap was not found. This means the Alt+Tab script will not be able to remap Alt+hjkl temporarily."
|
||||
fi
|
||||
|
||||
# Check if trayer exists
|
||||
if [ -e "${BINDIR}trayer" ]; then
|
||||
trayer_exists=true
|
||||
elif [ -e "${BINDIR}trayer-srg" ]; then
|
||||
trayer_exists=true
|
||||
trayer_srg=true
|
||||
fi
|
||||
|
||||
# Check if srg or not.
|
||||
if [ "$trayer_exists" = "false" ]; then
|
||||
printf "\nWARNING: trayer was not found. This means the systray will not be available.\n"
|
||||
elif [ "$trayer_srg" = "true" ]; then
|
||||
printf "\nWARNING: Before trayer-srg can be used instead of trayer, you must edit ~/.config/speedwm-de/systray/config and set USE_SRG to true.\n"
|
||||
fi
|
||||
|
||||
# Check if dmenu exists
|
||||
dmenu -v > /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
|
||||
slock -v > /dev/null || printf "\nWARNING: slock was not found. This means the shutdown menu can't lock your screen."
|
||||
|
||||
result="$(echo "$xrdb_exists$wmctrl_exists$xsetroot_exists$xwallpaper_exists$xmodmap_exists$trayer_exists")"
|
||||
|
||||
case "$result" in
|
||||
"truetruetruetruetruetrue") printf "\nAll dependencies were found.\n\n" ;;
|
||||
"") printf "\nSome dependencies could not be found." ;;
|
||||
esac
|
183
scripts/speedwm-core
Executable file
183
scripts/speedwm-core
Executable file
|
@ -0,0 +1,183 @@
|
|||
#!/bin/sh
|
||||
# speedwm-core
|
||||
# This script handles the systray and other things necessary for keybinds.
|
||||
|
||||
# Set binary directory if not set already.
|
||||
if [ -e "/usr/share/dwm-bindir" ]; then
|
||||
BINDIR=$(cat /usr/share/dwm-bindir) # Set binary directory to the contents of this variable.
|
||||
else
|
||||
BINDIR="/usr/bin/"
|
||||
fi
|
||||
|
||||
TINT="#222222" # Default tint
|
||||
EDGE="top" # Part of the screen where your systray will be placed
|
||||
GET_EDGE_AUTO="true" # Get edge automatically (true/false)
|
||||
SYSTRAY_COL=1 # When using pywal, set color to background (1) or backgroundmid (0)
|
||||
USE_SRG=false # Use $SYSTRAY-srg (available in Gentoo repos and AUR as $SYSTRAY-srg-git) instead of $SYSTRAY adding more features (true/false)
|
||||
USE_DEFAULT_TINT=false # Use default $TINT or use $SYSTRAY_COL
|
||||
ALPHA=0 # Opacity of the systray (0 is opaque, 255 is fully transparent)
|
||||
HIDE_BAR_WHEN_SYSTRAY_SHOW=false # Hide the dwm bar when the systray is running.
|
||||
ALPHA_BARHIDDEN=255 # Opacity of the systray when the dwm bar is hidden (0 is opaque, 255 is fully transparent)
|
||||
TRANSPARENT=true # Transparent or not (true/false)
|
||||
EXPORTDIR=$HOME/.config/dwm-de/systray # Config directory
|
||||
HEIGHT=18 # Height of the systray
|
||||
WIDTH=30 # Width of the systray
|
||||
mkdir -p $EXPORTDIR
|
||||
|
||||
# Load config if available and override settings
|
||||
if [ -e "$EXPORTDIR/config" ]; then
|
||||
. $EXPORTDIR/config
|
||||
else
|
||||
printf "TINT=$TINT # Tint when pywal is not used." > $EXPORTDIR/config
|
||||
printf "\nEDGE=$EDGE # Part of the screen where your systray will be placed" >> $EXPORTDIR/config
|
||||
printf "\nGET_EDGE_AUTO=$GET_EDGE_AUTO # Get edge automatically (true/false)" >> $EXPORTDIR/config
|
||||
printf "\nSYSTRAY_COL=$SYSTRAY_COL # When using pywal, set color to background (1) or backgroundmid (0)" >> $EXPORTDIR/config
|
||||
printf "\nALPHA=$ALPHA # Opacity of the systray (0 is opaque, 255 is fully transparent)" >> $EXPORTDIR/config
|
||||
printf "\nALPHA_BARHIDDEN=$ALPHA_BARHIDDEN # Opacity of the systray when the dwm bar is hidden (0 is opaque, 255 is fully transparent)" >> $EXPORTDIR/config
|
||||
printf "\nTRANSPARENT=true # Transparent or not (true/false)" >> $EXPORTDIR/config
|
||||
printf "\nHIDE_BAR_WHEN_SYSTRAY_SHOW=$HIDE_BAR_WHEN_SYSTRAY_SHOW # Hide the dwm bar when the systray is running." >> $EXPORTDIR/config
|
||||
printf "\nUSE_SRG=$USE_SRG # Use $SYSTRAY-srg (available in Gentoo repos and AUR as $SYSTRAY-srg-git) instead of $SYSTRAY adding more features (true/false)" >> $EXPORTDIR/config
|
||||
printf "\nUSE_DEFAULT_TINT=$USE_DEFAULT_TINT # Use default $TINT or use $SYSTRAY_COL" >> $EXPORTDIR/config
|
||||
printf "\nHEIGHT=$HEIGHT # Height of the systray" >> $EXPORTDIR/config
|
||||
printf "\nWIDTH=$WIDTH # Width of the systray\n" >> $EXPORTDIR/config
|
||||
fi
|
||||
|
||||
TINT="$(echo $TINT | sed "s|#||g")"
|
||||
|
||||
OPT=$1
|
||||
|
||||
# Pywal tint
|
||||
PYWAL_TINT() {
|
||||
# Pywal tint
|
||||
if [ "$USE_DEFAULT_TINT" = "false" ]; then
|
||||
if [ -e "$HOME/.cache/wal/colors" ]; then
|
||||
if [ "$SYSTRAY_COL" = "1" ]; then
|
||||
TINT=$(sed -n 1,1p $HOME/.cache/wal/colors | sed "s|#||g")
|
||||
elif [ "$SYSTRAY_COL" = "0" ]; then
|
||||
TINT=$(sed -n 13,13p $HOME/.cache/wal/colors | sed "s|#||g")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Set edge
|
||||
SETEDGE() {
|
||||
if [ "$GET_EDGE_AUTO" = "true" ]; then
|
||||
if [ -e "/usr/share/dwm-topbar" ]; then
|
||||
EDGE="top"
|
||||
else
|
||||
EDGE="bottom"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Set alpha
|
||||
SETALPHA() {
|
||||
if [ "$HIDE_BAR_WHEN_SYSTRAY_SHOW" = "true" ]; then
|
||||
ALPHA=$ALPHA_BARHIDDEN
|
||||
else
|
||||
ALPHA=$ALPHA
|
||||
fi
|
||||
}
|
||||
|
||||
PYWAL_TINT
|
||||
SETEDGE
|
||||
SETALPHA
|
||||
|
||||
# Set systray
|
||||
if [ "$USE_SRG" = "true" ]; then
|
||||
SYSTRAY=trayer-srg
|
||||
else
|
||||
SYSTRAY=trayer
|
||||
fi
|
||||
|
||||
USE() {
|
||||
# Toggle
|
||||
TOGGLE() {
|
||||
if [ -e "/tmp/systray-started" ]; then
|
||||
OPT="-stop"
|
||||
else
|
||||
OPT="-start"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Update dwm
|
||||
UPDATE() {
|
||||
|
||||
FAIL_SOURCEDOESNOTEXIST() {
|
||||
echo "The dwm source code directory could not be located. This means an automatic update cannot be performed. Clone a new build (instructions on https://speedie.gq/dwm) and update manually."
|
||||
exit 1
|
||||
}
|
||||
|
||||
FAIL_NOT_INSTALLED_USING_GIT() {
|
||||
echo "Your build of dwm 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/dwm) and update manually."
|
||||
exit 1
|
||||
}
|
||||
|
||||
FAIL_NO_AUTH() {
|
||||
echo "Failed to authenticate."
|
||||
exit 1
|
||||
}
|
||||
|
||||
SOURCEDIR=$(cat /usr/share/dwm-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 dwm update cannot continue." ; exit 1
|
||||
fi
|
||||
|
||||
cd $SOURCEDIR
|
||||
git stash
|
||||
git pull || FAIL_NOT_INSTALLED_USING_GIT
|
||||
clear
|
||||
|
||||
echo "dwm 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 'dwm has been updated!'
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
case "$OPT" in
|
||||
"-toggle") TOGGLE ;;
|
||||
"-update-dwm") UPDATE ;;
|
||||
esac
|
||||
|
||||
case "$OPT" in
|
||||
"-start") $SYSTRAY --edge $EDGE --align right --SetDockType true --SetPartialStrut true --expand true --width $WIDTH --transparent $TRANSPARENT --alpha $ALPHA --tint 0x${TINT} --height $HEIGHT &
|
||||
touch /tmp/systray-started ; pgrep -x status && pkill status ; status &
|
||||
if [ "$HIDE_BAR_WHEN_SYSTRAY_SHOW" = "true" ]; then
|
||||
xsetroot -name "fsignal:23"
|
||||
fi ;;
|
||||
"-stop") rm -f /tmp/systray-started ; pkill $SYSTRAY ; pgrep -x status && pkill status ; status &
|
||||
if [ "$HIDE_BAR_WHEN_SYSTRAY_SHOW" = "true" ]; then
|
||||
xsetroot -name "fsignal:23"
|
||||
fi ;;
|
||||
"") echo "dwm-core\n-start | Start the systray and restart status\n-stop | Stop the systray and restart status\n-toggle | Toggle systray and restart status\n-update-dwm | Update dwm using git\n-curl-weather | Curl wttr.in in a readable format\n-curl-cheatsheet | Ask the user what cheatsheet they want and then curl it." ;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$OPT" in
|
||||
"-curl-weather") clear ; curl -s wttr.in | head -n 38 | tail -n 37 && sleep 60 ;;
|
||||
"-curl-cheatsheet") clear ; echo -n "What cheatsheet do you want to view?\nExample: vim\n > " ; read CHEATSHEET ; curl -s cheat.sh/$(echo $CHEATSHEET | tr '[:upper:]' '[:lower:]') > /tmp/cheatsheet
|
||||
grep "Unknown topic." /tmp/cheatsheet && $0 -curl-cheatsheet && exit 0
|
||||
less /tmp/cheatsheet ;;
|
||||
esac
|
||||
|
||||
# Start systray
|
||||
if [ -e "${BINDIR}$SYSTRAY" ]; then
|
||||
if [ -e "/usr/share/dwm-nopadding" ]; then
|
||||
if [ -e "$HOME/.config/dwm-de/dwmrc" ]; then
|
||||
grep "vertpad" $HOME/.config/dwm-de/dwmrc > /tmp/out
|
||||
grep "0" /tmp/out > /dev/null && USE
|
||||
else
|
||||
USE
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Trayer not installed, exiting." && exit 1
|
||||
fi
|
177
scripts/speedwm-dfmpeg
Executable file
177
scripts/speedwm-dfmpeg
Executable file
|
@ -0,0 +1,177 @@
|
|||
#!/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
|
||||
|
||||
# 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"
|
||||
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") $0 && exit 0 ;;
|
||||
"------") $0 && exit 0 ;;
|
||||
"Exit") exit 0 ;;
|
||||
"") $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 ;;
|
||||
"------") $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 -g 1 -p "What file do you want to encode?")" > /tmp/outputfilename && encode ; exit 0 ;;
|
||||
"------") $0 && exit 0 ;;
|
||||
"Exit") exit 0 ;;
|
||||
"..") $0 && exit 0 ;;
|
||||
"") $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 -g 1 -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 ;;
|
||||
"") $0 && exit 0 ;;
|
||||
"..") $0 && exit 0 ;;
|
||||
"------") $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") echo "$OUTPUT_FILENAME" > /tmp/outputfilename && STATUS=recording && touch /tmp/dfmpeg-recording
|
||||
pgrep -x status && pkill status && status &
|
||||
$startrec && exit 0 ;;
|
||||
"Stop") pkill ffmpeg ; rm /tmp/dfmpeg-recording ; STATUS=idle
|
||||
pgrep -x status && pkill status && status & ;;
|
||||
"Start without audio") echo "$OUTPUT_FILENAME" > /tmp/outputfilename && STATUS=recording && touch /tmp/dfmpeg-recording
|
||||
pgrep -x status && pkill status && status &
|
||||
$startrec_no_audio && exit 0 ;;
|
||||
"Play last") DFMPEG_STATUS=idle && $MEDIA_PLAYER $(cat /tmp/outputfilename) && exit 0 ;;
|
||||
"More options") MORE_OPTIONS && exit 0 ;;
|
||||
"") $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 -g 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0 # This fixes a small bug.
|
27
scripts/speedwm-dm
Executable file
27
scripts/speedwm-dm
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
# speedwm-dm
|
||||
# Create a .desktop file for people who use display managers.
|
||||
|
||||
# Delete the topbar file
|
||||
rm -f /usr/share/speedwm-topbar
|
||||
|
||||
# Delete the padding file
|
||||
rm -f /usr/share/speedwm-nopadding
|
||||
|
||||
# Make the directory for the .desktop file if it does not exist
|
||||
mkdir -p /usr/share/xsessions
|
||||
|
||||
# Write the .desktop entry
|
||||
printf "[Desktop Entry]\nEncoding=UTF-8\nName=speedwm\nComment=Dynamic window manager\nExec=/usr/bin/speedwm_run\nIcon=speedwm\nType=XSession" > /usr/share/xsessions/speedwm.desktop
|
||||
|
||||
# If the bar is on the top, touch /usr/share/speedwm-topbar
|
||||
TOPBAR=$(grep "barposition" options.h | grep "1" | awk '{ print $5 }')
|
||||
PADDING=$(grep "barpaddingv" options.h | grep "0" | awk '{ print $5 }')
|
||||
echo $TOPBAR | grep "1" && touch /usr/share/speedwm-topbar
|
||||
echo $PADDING | grep "0" && touch /usr/share/speedwm-nopadding
|
||||
echo $(pwd) > /usr/share/speedwm-sourcedir
|
||||
|
||||
# Copy .Xresources file
|
||||
cp docs/example.Xresources /usr/share/example.Xresources
|
||||
|
||||
exit 0
|
83
scripts/speedwm-help
Executable file
83
scripts/speedwm-help
Executable file
|
@ -0,0 +1,83 @@
|
|||
#!/bin/bash
|
||||
# speedwm-help
|
||||
# Documentation generator/list for speedwm.
|
||||
# Licensed under the GNU GPLv3 free software license.
|
||||
|
||||
# No color if NOCOLOR is exported as true.
|
||||
if [ "$NOCOLOR" != "true" ]; then
|
||||
COL2="$(printf '\033[0;35m')" # Color 2
|
||||
COL1="$(printf '\033[0m')" # Color 1
|
||||
fi
|
||||
|
||||
ARG1=$1
|
||||
ARG2=$2
|
||||
ARGINF=$@
|
||||
|
||||
if [ "$ARG2" = "" ]; then
|
||||
VIEWER=less
|
||||
else
|
||||
VIEWER="$ARG2"
|
||||
echo "Using $ARG2 as output." | sed "s|-o|stdout|g"
|
||||
fi
|
||||
|
||||
case "$VIEWER" in
|
||||
"-o") VIEWER="cat" ;;
|
||||
esac
|
||||
|
||||
echo "${0}. Run '$0 -h' to see a list of arguments or to jump to a specific section.\n$(cat /usr/share/speedwm-about /usr/share/speedwm-about-2 /usr/share/speedwm-bindlist /usr/share/speedwm-deplist /usr/share/speedwm-about-3 /usr/share/speedwm-xresources /usr/share/speedwm-about-4 /usr/share/speedwm-fsignal /usr/share/speedwm-about-5 | sed 's|xsetroot -name "fsignal:||g' | sed 's|"||g')" > /tmp/speedwm-doc
|
||||
|
||||
case "$ARG1" in
|
||||
"-w") tail -n $(expr $(cat /tmp/speedwm-doc | wc -l) "-" 1) /tmp/speedwm-doc > ../readme ;;
|
||||
"-wmd") tail -n $(expr $(cat /tmp/speedwm-doc | wc -l) "-" 1) /tmp/speedwm-doc | \
|
||||
sed "s|-- speedwm --|# speedwm|g" | \
|
||||
sed "s|-- What is speedwm? --|## What is speedwm?|g" | \
|
||||
sed "s|-- Installation --|## Installation|g" | \
|
||||
sed "s|-- Layouts --|## Layouts|g" | \
|
||||
sed "s|-- Patches --|## Patches|g" | \
|
||||
sed "s|-- Keybinds --|## Keybinds|g" | \
|
||||
sed "s|-- Applications --|### Applications|g" | \
|
||||
sed "s|-- Navigation --|### Navigation|g" | \
|
||||
sed "s|-- Chained keybinds --|### Chained keybinds|g" | \
|
||||
sed "s|-- Extras --|### Extras|g" | \
|
||||
sed "s|-- Dependencies --|## Dependencies|g" | \
|
||||
sed "s|-- Features --|## Features|g" | \
|
||||
sed "s|-- Software --|## Software|g" | \
|
||||
sed "s|-- Important --|## Important|g" | \
|
||||
sed "s|-- .Xresources and Pywal --|## .Xresources and Pywal|g" | \
|
||||
sed "s|-- Fsignal --|## Fsignal|g" | \
|
||||
sed "s|-- Switching run launcher --|## Switching run launcher|g" > ../README.md ;;
|
||||
"-whtml") tail -n $(expr $(cat /tmp/speedwm-doc | wc -l) "-" 1) /tmp/speedwm-doc | \
|
||||
sed "s|-- speedwm --|# speedwm|g" | \
|
||||
sed "s|-- What is speedwm? --|## What is speedwm?|g" | \
|
||||
sed "s|-- Installation --|## Installation|g" | \
|
||||
sed "s|-- Layouts --|## Layouts|g" | \
|
||||
sed "s|-- Patches --|## Patches|g" | \
|
||||
sed "s|-- Keybinds --|## Keybinds|g" | \
|
||||
sed "s|-- Applications --|### Applications|g" | \
|
||||
sed "s|-- Navigation --|### Navigation|g" | \
|
||||
sed "s|-- Chained keybinds --|### Chained keybinds|g" | \
|
||||
sed "s|-- Mouse --|### Mouse|g" | \
|
||||
sed "s|-- Extras --|### Extras|g" | \
|
||||
sed "s|-- Dependencies --|## Dependencies|g" | \
|
||||
sed "s|-- Features --|## Features|g" | \
|
||||
sed "s|-- Software --|## Software|g" | \
|
||||
sed "s|-- Important --|## Important|g" | \
|
||||
sed "s|-- .Xresources and Pywal --|## .Xresources and Pywal|g" | \
|
||||
sed "s|-- Fsignal --|## Fsignal|g" | \
|
||||
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 ;;
|
||||
"-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 ;;
|
||||
"") $0 -h && exit 0 ;;
|
||||
"-h") printf "speedwm help\n\nNo arguments to view this list of arguments.\n-h | View this list of arguments.\n-a | View everything.\n-1 | What is speedwm?\n-2 | List of all keybinds\n-3 | List of all dependencies\n-4 | .Xresources/Pywal information.\n-5 | Fsignal information\n-6 | Switching run launcher\n-7 | Installation\n-8 | Layouts\n-9| Important information.\n-w | Write documentation to ../readme\n-wmd | Write documentation (Markdown)\n-whtml | Write documentation (HTML) using markdown-to-html.\n-whtml-wtemplate | Combine template 1, output of -whtml and template 2 (from docs/) to create a full HTML document.\n\nIf second argument is -o, the requested output will be sent to stdout.\n-o can be replaced with a text editor or reader of your choice (such as less, vim, emacs, etc.)\n"; exit 0 ;;
|
||||
"-1") sed "s|--|${COL2}--${COL1}|g" /usr/share/speedwm-about | head -n 10 > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-2") cat /usr/share/speedwm-about-2 /usr/share/speedwm-bindlist | sed "s|--|${COL2}--${COL1}|g" > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-3") sed "s|--|${COL2}--${COL1}|g" /usr/share/speedwm-deplist > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-4") cat /usr/share/speedwm-about-3 /usr/share/speedwm-xresources | tail -n 59 | sed "s|--|${COL2}--${COL1}|g" > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-5") cat /usr/share/speedwm-about-4 /usr/share/speedwm-fsignal | sed "s|--|${COL2}--${COL1}|g" | sed 's|xsetroot -name "fsignal:||g' | sed 's|"||g' > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-6") sed "s|--|${COL2}--${COL1}|g" /usr/share/speedwm-about-5 > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-7") sed "s|--|${COL2}--${COL1}|g" /usr/share/speedwm-about | head -n 22 | tail -n 11 > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-8") sed "s|--|${COL2}--${COL1}|g" /usr/share/speedwm-about | tail -n 22 | head -n 19 > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-9") sed "s|--|${COL2}--${COL1}|g" /usr/share/speedwm-about-3 | head -n 24 > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
"-a") sed "s|--|${COL2}--${COL1}|g" /tmp/speedwm-doc > /tmp/stdout ; $VIEWER /tmp/stdout ;;
|
||||
esac
|
53
scripts/speedwm-mkpage
Executable file
53
scripts/speedwm-mkpage
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
# speedwm-mkpage
|
||||
|
||||
cd scripts
|
||||
|
||||
MKPAGE() {
|
||||
./speedwm-help -whtml
|
||||
./speedwm-help -whtml-wtemplate
|
||||
cd ..
|
||||
rm -f readme.html
|
||||
echo "Created speedwm.html"
|
||||
}
|
||||
|
||||
PUSHPAGE() {
|
||||
HTMLDIR=$(cat /tmp/speedwm-htmldir)
|
||||
cd $HTMLDIR || exit 1
|
||||
git commit -a -m "speedwm-mkpage: Uploaded new page."
|
||||
git push && exit 0
|
||||
echo "Could not git push."
|
||||
exit 1
|
||||
}
|
||||
|
||||
MKHTML() {
|
||||
./speedwm-help -whtml
|
||||
cd ..
|
||||
echo "Created readme.html"
|
||||
}
|
||||
|
||||
MKMD() {
|
||||
./speedwm-help -wmd
|
||||
cd ..
|
||||
echo "Created README.md"
|
||||
}
|
||||
|
||||
MK() {
|
||||
./speedwm-help -w
|
||||
cd ..
|
||||
echo "Created readme"
|
||||
}
|
||||
|
||||
# Perform actions based on user input
|
||||
case "$1" in
|
||||
"") echo "speedwm-mkpage\nNo arguments | Show the help screen\n-h | Show the help screen\n-mkpage | Create full page with templates from docs/\n-mkhtml | Create HTML document based on speedwm documentation\n-mkmd | Create markdown file (usually for use with GitHub repositories)\n-mk | Copy the output of speedwm-help -a to 'readme'.\n-ulspeedwm | Auto-push speedwm changes\n" ; exit 0 ;;
|
||||
"-help") $0 && exit 0 ;;
|
||||
"-h") $0 && exit 0 ;;
|
||||
"-mkpage") MKPAGE && exit 0 ;;
|
||||
"-mkhtml") MKHTML && exit 0 ;;
|
||||
"-mkmd") MKMD && exit 0 ;;
|
||||
"-mk") MK && exit 0 ;;
|
||||
"-page-push") PUSHPAGE && exit 0 ;;
|
||||
"-ulspeedwm") cd .. && git add * && git commit -a -m "speedwm-mkpage: Auto-pushed speedwm changes!" && git push && exit 0 ;;
|
||||
esac
|
||||
|
70
scripts/speedwm-netctrl
Executable file
70
scripts/speedwm-netctrl
Executable file
|
@ -0,0 +1,70 @@
|
|||
#!/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=$(cat /usr/share/speedwm-bindir)
|
||||
|
||||
test ${BINDIR}iwctl || exit 0
|
||||
|
||||
# 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 -g 1) && echo $seldevice > $HOME/.local/share/seldevice ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "$seldevice" in
|
||||
"") exit 0 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
connectwifi() {
|
||||
iwctl station $seldevice scan
|
||||
network="$(printf "$(iwctl station $seldevice get-networks | sed -n 6,20p | sed "s|>||g" | awk '{ print $1 }')\n------\nExit" | sed "s| |No networks found|g" | $RUNLAUNCHER -l 10 -g 1 -p "Select a network to connect to" | sed "s|------||g" | sed "s|No networks found| |g")"
|
||||
|
||||
case "$network" in
|
||||
"") $0 && exit 0 ;;
|
||||
"Exit") exit 0 ;;
|
||||
esac
|
||||
|
||||
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 -g 1)
|
||||
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
|
||||
}
|
||||
|
||||
grep $network $HOME/.local/share/networks && connect_no_pass && exit 0
|
||||
iwctl station $seldevice get-networks | grep psk && connect_pass && exit 0
|
||||
}
|
||||
|
||||
getdevice && connectwifi
|
||||
pkill status && status &
|
17
scripts/speedwm-pdfopen
Executable file
17
scripts/speedwm-pdfopen
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
# speedwm-pdfopen
|
||||
# list of pdfs for the user to open in dmenu.
|
||||
|
||||
cd $1
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
esac
|
||||
|
||||
SELPDF=$(ls -Ap1 *.pdf | $RUNLAUNCHER -g 1 -l 50 -p "What PDF do you want to open?")
|
||||
|
||||
case "$SELPDF" in
|
||||
"") exit 0 ;;
|
||||
esac
|
||||
|
||||
$2 "$1/$SELPDF"
|
133
scripts/speedwm-screenshotutil
Executable file
133
scripts/speedwm-screenshotutil
Executable file
|
@ -0,0 +1,133 @@
|
|||
#!/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
|
||||
|
||||
if [ -e "/usr/share/speedwm-bindir" ]; then
|
||||
BINDIR=$(cat /usr/share/speedwm-bindir)
|
||||
else
|
||||
BINDIR="/usr/bin/"
|
||||
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 -g 1 -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
|
91
scripts/speedwm-shutdown
Executable file
91
scripts/speedwm-shutdown
Executable file
|
@ -0,0 +1,91 @@
|
|||
#!/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
|
||||
|
||||
if [ -e "/usr/share/speedwm-bindir" ]; then
|
||||
BINDIR=$(cat /usr/share/speedwm-bindir)
|
||||
else
|
||||
BINDIR="/usr/bin/"
|
||||
fi
|
||||
|
||||
EXPORTDIR=$HOME/.config/speedwm-de/powermenu
|
||||
mkdir -p $EXPORTDIR
|
||||
|
||||
ls ${BINDIR}sudo && PERM=sudo
|
||||
ls ${BINDIR}doas && PERM=doas
|
||||
ls ${BINDIR}rootdo && 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"
|
||||
LOCK_TEXT=""
|
||||
|
||||
# Load config if available and override settings
|
||||
if [ -e "$EXPORTDIR/config" ]; then
|
||||
. $EXPORTDIR/config
|
||||
else
|
||||
printf "COL_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 "\nLOCK_TEXT=$LOCK_TEXT # Text to display on the lock screen" >> $EXPORTDIR/config
|
||||
fi
|
||||
|
||||
case "$LOCK_TEXT" in
|
||||
"") MESSAGEFLAG="" ;;
|
||||
esac
|
||||
|
||||
MOREOPTS() {
|
||||
USER_OPT3=$(printf "Restart speedwm\nEnd task\nspeedwm command\nUpdate speedwm\n.." | $RUNLAUNCHER -l 4 -g 1 -p "What do you want to do?" -nb "$COL_NORMAL_BACKGROUND_NORMAL" -sb "$COL_NORMAL_BACKGROUND_SELECTED" -nf "$COL_NORMAL_TEXT_NORMAL" -sf "$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?" -nb "$COL_NORMAL_BACKGROUND_NORMAL" -sb "$COL_NORMAL_BACKGROUND_SELECTED" -nf "$COL_NORMAL_TEXT_NORMAL" -sf "$COL_NORMAL_TEXT_SELECTED") && pkill $ENDTASK && exit 0 ;;
|
||||
"speedwm command") speedwmutils && 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?" -nb "$COL_NORMAL_BACKGROUND_NORMAL" -sb "$COL_NORMAL_BACKGROUND_SELECTED" -nf "$COL_NORMAL_TEXT_NORMAL" -sf "$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?" -nb "$COL_WARNING_BACKGROUND_NORMAL" -sb "$COL_WARNING_BACKGROUND_SELECTED" -nf "$COL_WARNING_TEXT_NORMAL" -sf "$COL_WARNING_TEXT_SELECTED")
|
||||
case "$USER_OPT2" in
|
||||
"Yes") $CMD ;;
|
||||
"No") exit 0 ;;
|
||||
"") exit 0 ;;
|
||||
esac
|
347
scripts/speedwm-swal
Executable file
347
scripts/speedwm-swal
Executable file
|
@ -0,0 +1,347 @@
|
|||
#!/bin/sh
|
||||
# speedwm-swal
|
||||
# wallpaper utility written for speedwm.
|
||||
# Licensed under the GNU GPLv3 free software license.
|
||||
|
||||
# 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
|
||||
SWAL_EXPORTDIR=$HOME/.config/speedwm-de/swal # Config directory
|
||||
SWAL_FSIGNAL_RELOAD_XRESOURCES=18 # Fsignal signum when reloading
|
||||
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
|
||||
}
|
||||
|
||||
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 -g 1 -p "Where are all your wallpapers stored?" -l 1)
|
||||
}
|
||||
|
||||
SWAL_CHANGE_ASK_WAL() {
|
||||
wal -v > /dev/null && SWAL_ASK_WAL_NEW=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -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 -g 1 -p "What image viewer do you want to use for previews?" -l 1)
|
||||
}
|
||||
|
||||
SWAL_CHANGE_RANDOMIZE() {
|
||||
SWAL_RANDOMIZE=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -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 -g 1 -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_BINDIR=$SWAL_BINDIR" >> $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
|
||||
}
|
||||
|
||||
BINDIR=$(cat /usr/share/speedwm-bindir)
|
||||
SWAL_OLDWALLPAPERDIR=$SWAL_WALLPAPERDIR
|
||||
|
||||
# Source things
|
||||
SWAL_SOURCE()
|
||||
{
|
||||
ls "$SWAL_EXPORTDIR/config" || SWAL_MKCONFIG
|
||||
. "$SWAL_EXPORTDIR/config" || rm -f "$SWAL_EXPORTDIR/config"
|
||||
}
|
||||
|
||||
SWAL_CHECK()
|
||||
{
|
||||
if [ "$SWAL_IMAGE_VIEWER" = "" ]; then
|
||||
ls "$SWAL_BINDIR/feh" && SWAL_IMAGE_VIEWER=feh
|
||||
ls "$SWAL_BINDIR/sxiv" && SWAL_IMAGE_VIEWER=sxiv
|
||||
fi
|
||||
|
||||
ls "$SWAL_BINDIR/xwallpaper" || SWAL_DIE
|
||||
}
|
||||
|
||||
SWAL_DIE()
|
||||
{
|
||||
SWAL_EXIT=1 && exit 1
|
||||
}
|
||||
|
||||
SWAL_HELP() {
|
||||
echo "swal is a minimal xwallpaper frontend for dmenu/rofi."
|
||||
echo "-w /path/to/wallpaper.png | Set the wallpaper specified."
|
||||
echo "-h | View this help screen."
|
||||
echo "-f X | fsignal signum to reload .Xresources (with reloadxresources, fsignal and .Xresources speedwm patches)"
|
||||
}
|
||||
|
||||
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."
|
||||
}
|
||||
|
||||
SWAL_SELWALLPAPER()
|
||||
{
|
||||
case "$NEW1" in
|
||||
"") ls /tmp/swal_cpath || SWAL_SELWALLPAPER="$(printf "$(ls "$SWAL_WALLPAPERDIR")\n------\n..\nPreview\nPrevious\nRandom\nFavorites\nAdd used wallpaper to favorites\nOptions\nHelp\nExit" | $RUNLAUNCHER -g 1 -l 100 -p "What wallpaper would you like to set?")" ;;
|
||||
"-w") SWAL_SELWALLPAPER="$(basename "$NEW2")" && touch /tmp/swal_cpath ;;
|
||||
"-h") SWAL_HELP | $RUNLAUNCHER -g 1 -l 90 ;;
|
||||
"-f") SWAL_FSIGNAL_RELOAD_XRESOURCES="$NEW2" ;;
|
||||
esac
|
||||
|
||||
case "$NEW3" in
|
||||
"-w") SWAL_SELWALLPAPER="$(basename "$NEW4")" && touch /tmp/swal_cpath ;;
|
||||
"-h") SWAL_HELP | $RUNLAUNCHER -g 1 -l 90 ;;
|
||||
"-f") SWAL_FSIGNAL_RELOAD_XRESOURCES="$NEW4" ;;
|
||||
esac
|
||||
|
||||
case "$NEW5" in
|
||||
"-w") SWAL_SELWALLPAPER="$(basename "$NEW6")" && touch /tmp/swal_cpath ;;
|
||||
"-h") SWAL_HELP | $RUNLAUNCHER -g 1 -l 90 ;;
|
||||
"-f") SWAL_FSIGNAL_RELOAD_XRESOURCES="$NEW6" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
SWAL_SETTYPE()
|
||||
{
|
||||
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 -g 1 -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="$(basename $($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 -g 1 -l 50 -p "How to use" && $0 && exit 0 ;;
|
||||
"------") $0 && exit 0 ;;
|
||||
esac
|
||||
|
||||
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"
|
||||
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_NOT_REAL() {
|
||||
test ${BINDIR}notify-send && notify-send "The selected wallpaper is not valid/does not exist."
|
||||
$0 ; exit 1
|
||||
}
|
||||
|
||||
ls "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" || FAIL_NOT_REAL
|
||||
|
||||
SWAL_TYPE=$(printf "Center\nTile\nZoom\nStretch\n------\nExit" | $RUNLAUNCHER -p "How do you want to set the wallpaper?" -g 1 -l 7)
|
||||
|
||||
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
|
||||
|
||||
SWAL_TYPE="--$SWAL_TYPE"
|
||||
SWAL_WAL_STATUS="0"
|
||||
|
||||
case "$SWAL_ASK_WAL" in
|
||||
"true") wal -v && SWAL_USE_WAL=$(printf "Yes\nNo" | $RUNLAUNCHER -g 1 -l 90 -p "Do you want to use Pywal?" -l 2) && SWAL_WAL_STATUS="1" ;;
|
||||
"false") wal -v && SWAL_USE_WAL="Yes" && SWAL_WAL_STATUS="1" ;;
|
||||
esac
|
||||
|
||||
# Don't perform pywal actions if not installed/used
|
||||
if [ "$SWAL_WAL_STATUS" = "0" ]; then
|
||||
SWAL_USE_WAL="No"
|
||||
fi
|
||||
}
|
||||
|
||||
SWAL_SETWALLPAPER()
|
||||
{
|
||||
$SWAL_OPT $SWAL_TYPE "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER" || FAIL_NOT_REAL
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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\nxsetroot -name 'fsignal:$SWAL_FSIGNAL_RELOAD_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 "\nxsetroot -name "fsignal:$SWAL_FSIGNAL_RELOAD_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 && xsetroot -name "fsignal:$SWAL_FSIGNAL_RELOAD_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
|
||||
|
||||
if [ -e "$HOME/.config/speedwm-de/speedwmrc" ]; then
|
||||
. $HOME/.config/speedwm-de/speedwmrc
|
||||
fi
|
||||
|
||||
wal -nqi "$SWAL_WALLPAPERDIR/$SWAL_SELWALLPAPER"
|
||||
|
||||
# Reload dmenu colors if supported
|
||||
if [ -e "/usr/bin/${RUNLAUNCHER}_run" ]; then
|
||||
grep "PYWAL" ${BINDIR}${RUNLAUNCHER}_run && printf "\n${RUNLAUNCHER}_run -r" >> $SWAL_EXPORTDIR/swal_wm
|
||||
${RUNLAUNCHER}_run -r # For speedie.gq/dmenu
|
||||
fi
|
||||
|
||||
speedwm_run -loadconfig # For speedie.gq/speedwm
|
||||
speedwm_run -rnoload # For speedie.gq/speedwm
|
||||
pgrep -x status && pkill status ; status &
|
||||
}
|
||||
|
||||
|
||||
SWAL_XRESOURCES()
|
||||
{
|
||||
xrdb -query | grep "swal" | sed "s|: |=|" | sed "s|swal.|swal_|" > /tmp/swal
|
||||
. /tmp/swal
|
||||
}
|
||||
|
||||
SWAL_SENDNOTIFICATION() {
|
||||
if [ "$SWAL_SELWAL" = "" ]; then
|
||||
test ${BINDIR}notify-send && notify-send " $SWAL_SELWALLPAPER set as wallpaper in $(echo $SWAL_TYPE | sed "s|--||g") mode."
|
||||
else
|
||||
test ${BINDIR}notify-send && notify-send " $SWAL_SELWAL set as wallpaper in $(echo $SWAL_TYPE | sed "s|--||g") mode."
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Arguments
|
||||
NEW1=$1
|
||||
NEW2=$2
|
||||
NEW3=$3
|
||||
NEW4=$4
|
||||
NEW5=$5
|
||||
NEW6=$6
|
||||
|
||||
rm -f /tmp/swal_cpath
|
||||
SWAL_DEFAULT_CONFIG
|
||||
SWAL_SOURCE || SWAL_DIE
|
||||
SWAL_XRESOURCES
|
||||
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
|
127
scripts/speedwm-utils
Executable file
127
scripts/speedwm-utils
Executable file
|
@ -0,0 +1,127 @@
|
|||
#!/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
|
||||
|
||||
VARS() {
|
||||
BINDIR=$(cat /usr/share/speedwm-bindir)
|
||||
|
||||
SIGNAL_1=1 # Layout: Tiling
|
||||
SIGNAL_2=2 # Layout: Floating
|
||||
SIGNAL_3=3 # Layout: Monocle
|
||||
SIGNAL_4=4 # Layout: Grid
|
||||
SIGNAL_5=5 # Layout: Deck
|
||||
SIGNAL_6=6 # Layout: Centered Master
|
||||
SIGNAL_7=7 # Layout: Centered Floating Master
|
||||
SIGNAL_8=8 # Layout: Fibonacci Spiral
|
||||
SIGNAL_9=9 # Layout: Fibonacci Dwindle
|
||||
SIGNAL_10=10 # Layout: Three Column
|
||||
SIGNAL_11=11 # Layout: Bottom Stack Vertical
|
||||
SIGNAL_12=12 # Layout: Bottom Stack Horizontal
|
||||
SIGNAL_13=13 # Layout: Horizontal Grid
|
||||
SIGNAL_14=14 # Layout: Tatami
|
||||
SIGNAL_15=15 # Layout: Tilewide
|
||||
SIGNAL_16=16 # Layout: Previous
|
||||
SIGNAL_17=17 # Layout: Next
|
||||
SIGNAL_18=18 # General: Reload resources (xrdb)
|
||||
SIGNAL_19=19 # General: Set mfact (-0.05)
|
||||
SIGNAL_20=20 # General: Set mfact (+0.05)
|
||||
SIGNAL_21=21 # General: Toggle Scratchpad
|
||||
SIGNAL_22=22 # General: Toggle Sticky
|
||||
SIGNAL_23=23 # General: Toggle Bar
|
||||
SIGNAL_24=24 # General: Toggle Fullscreen
|
||||
SIGNAL_25=25 # General: Restart speedwm
|
||||
SIGNAL_26=26 # Unused: Unused 26
|
||||
SIGNAL_27=27 # Layout: Stairs
|
||||
SIGNAL_28=28 # General: Reset layout/mfact
|
||||
SIGNAL_29=29 # General: Reorganize Tags
|
||||
SIGNAL_30=30 # General: Quit speedwm
|
||||
SIGNAL_31=31 # General: Restart speedwm
|
||||
SIGNAL_32=32 # Unused: Unused 32
|
||||
SIGNAL_33=33 # Unused: Unused 33
|
||||
SIGNAL_34=34 # Unused: Unused 34
|
||||
SIGNAL_35=35 # Layout: Tiling 5:4
|
||||
SIGNAL_36=36 # Layout: Columns
|
||||
SIGNAL_37=37 # Layout: Dynamic Grid
|
||||
}
|
||||
|
||||
VARS
|
||||
|
||||
GENERAL() {
|
||||
GENERALOPTS=$(printf "mfact +\nmfact -\nToggle Scratchpad\nToggle Sticky\nToggle Bar\nToggle Fullscreen\nToggle rmaster\nReset Layout/mfact\nReorganize Tags" | $RUNLAUNCHER -l 20 -p 'What do you want to do?')
|
||||
case "$GENERALOPTS" in
|
||||
"mfact +") xsetroot -name "fsignal:$SIGNAL_20" ;;
|
||||
"mfact -") xsetroot -name "fsignal:$SIGNAL_19" ;;
|
||||
"Toggle Scratchpad") xsetroot -name "fsignal:$SIGNAL_21" ;;
|
||||
"Toggle Sticky") xsetroot -name "fsignal:$SIGNAL_22" ;;
|
||||
"Toggle Bar") xsetroot -name "fsignal:$SIGNAL_23" ;;
|
||||
"Toggle Fullscreen") xsetroot -name "fsignal:$SIGNAL_24" ;;
|
||||
"Toggle rmaster") xsetroot -name "fsignal:$SIGNAL_26" ;;
|
||||
"Reorganize Tags") xsetroot -name "fsignal:$SIGNAL_29" ;;
|
||||
"Reset Layout/mfact") xsetroot -name "fsignal:$SIGNAL_28" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
OPT() {
|
||||
MENUOPTS=$(printf "Layout\nReload .Xresources\nSpawn\nGeneral\nExit" | $RUNLAUNCHER -l 20 -p 'What do you want to do?')
|
||||
|
||||
case "$MENUOPTS" in
|
||||
"Layout") ${0} -layout $2 && exit 0 ;;
|
||||
"Reload .Xresources") ${0} -reloadxrdb && exit 0 ;;
|
||||
"Spawn") ${0} -spawn $2 && exit 0 ;;
|
||||
"General") ${0} -general $2 && exit 0 ;;
|
||||
"Exit") exit 0 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
HELP() {
|
||||
printf "speedwmutils allows you to control speedwm using your terminal or dmenu/rofi.\n-- Arguments --\n-layout | Let the user select a speedwm layout\n-reloadxrdb | Reload .Xresources\n-spawn | Spawn a command through speedwm\n-exec | Execute an fsignal signum\n-list | List all available signums\n" > /tmp/speedwm-printed-help
|
||||
pgrep -x $RUNLAUNCHER || cat /tmp/speedwm-printed-help
|
||||
pgrep -x $RUNLAUNCHER && cat /tmp/speedwm-printed-help | $RUNLAUNCHER -p 'speedwmutils help' -g 1 -l 20
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"-layout") SEL_LAYOUT=$(printf "L1: Tiling\nL2: Floating\nL3: Monocle\nL4: Grid\nL5: Deck\nL6: Centered Master\nL7: Centered Floating Master\nL8: Fibonacci Spiral\nL9: Fibonacci Dwindle\nL10: Three Column\nL11: Bottom Stack Vertical\nL12: Bottom Stack Horizontal\nL13: Horizontal Grid\nL14: Tatami\nL15: Tilewide\nL16: Stairs\nL17: Tiling (5:4)\nL18: Column\nL19: Dynamic Grid\nPrevious Layout\nNext Layout" | $RUNLAUNCHER -l 21 -p "Pick a layout: ") ;;
|
||||
"-spawn") printf "Not complete" ;;
|
||||
"-list") sed 's|xsetroot -name "fsignal:||g' /usr/share/speedwm-fsignal | sed 's|"||g' ;;
|
||||
"-reloadxrdb") xsetroot -name "fsignal:$SIGNAL_18" ;;
|
||||
"-help") HELP ;;
|
||||
"-exec")
|
||||
if [ "$2" = "" ]; then
|
||||
exit 0
|
||||
else
|
||||
xsetroot -name "fsignal:$2"
|
||||
fi ;;
|
||||
"-h") HELP ;;
|
||||
"-general") GENERAL ;;
|
||||
"") OPT ;;
|
||||
esac
|
||||
|
||||
case "$SEL_LAYOUT" in
|
||||
"Exit") exit 0 ;;
|
||||
"L1: Tiling") xsetroot -name "fsignal:$SIGNAL_1" ;;
|
||||
"L2: Floating") xsetroot -name "fsignal:$SIGNAL_2" ;;
|
||||
"L3: Monocle") xsetroot -name "fsignal:$SIGNAL_3" ;;
|
||||
"L4: Grid") xsetroot -name "fsignal:$SIGNAL_4" ;;
|
||||
"L5: Deck") xsetroot -name "fsignal:$SIGNAL_5" ;;
|
||||
"L6: Centered Master") xsetroot -name "fsignal:$SIGNAL_6" ;;
|
||||
"L7: Centered Floating Master") xsetroot -name "fsignal:$SIGNAL_7" ;;
|
||||
"L8: Fibonacci Spiral") xsetroot -name "fsignal:$SIGNAL_8" ;;
|
||||
"L9: Fibonacci Dwindle") xsetroot -name "fsignal:$SIGNAL_9" ;;
|
||||
"L10: Three Column") xsetroot -name "fsignal:$SIGNAL_10" ;;
|
||||
"L11: Bottom Stack Vertical") xsetroot -name "fsignal:$SIGNAL_11" ;;
|
||||
"L12: Bottom Stack Horizontal") xsetroot -name "fsignal:$SIGNAL_12" ;;
|
||||
"L13: Horizontal Grid") xsetroot -name "fsignal:$SIGNAL_13" ;;
|
||||
"L14: Tatami") xsetroot -name "fsignal:$SIGNAL_14" ;;
|
||||
"L15: Tilewide") xsetroot -name "fsignal:$SIGNAL_15" ;;
|
||||
"L16: Stairs") xsetroot -name "fsignal:$SIGNAL_27" ;;
|
||||
"L17: Tiling (5:4)") xsetroot -name "fsignal:$SIGNAL_35" ;;
|
||||
"L18: Column") xsetroot -name "fsignal:$SIGNAL_36" ;;
|
||||
"L19: Dynamic Grid") xsetroot -name "fsignal:$SIGNAL_37" ;;
|
||||
"Previous Layout") xsetroot -name "fsignal:$SIGNAL_16" ;;
|
||||
"Next Layout") xsetroot -name "fsignal:$SIGNAL_17" ;;
|
||||
esac
|
2181
scripts/speedwm-virtualkeyboard
Executable file
2181
scripts/speedwm-virtualkeyboard
Executable file
File diff suppressed because it is too large
Load diff
98
scripts/speedwm-winnav
Executable file
98
scripts/speedwm-winnav
Executable file
|
@ -0,0 +1,98 @@
|
|||
#!/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
|
||||
}
|
||||
|
||||
case "$RUNLAUNCHER" in
|
||||
"") RUNLAUNCHER=dmenu ;;
|
||||
esac
|
||||
|
||||
BINDIR=$(cat /usr/share/speedwm-bindir)
|
||||
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 -g 1 -p "Which window?" | tr -s '[:blank:]' | sed "s/$class | //g")
|
||||
|
||||
case "$target" in
|
||||
"") RESTORE && exit 0 ;;
|
||||
esac
|
||||
|
||||
wmctrl -a "$target" && echo "Switched focus"
|
||||
|
||||
RESTORE
|
158
scripts/speedwm_run
Executable file
158
scripts/speedwm_run
Executable file
|
@ -0,0 +1,158 @@
|
|||
#!/bin/sh
|
||||
# External script which starts speedwm!
|
||||
# https://speedie.gq/speedwm for instructions and usage!
|
||||
|
||||
BINDIR=$(cat /usr/share/speedwm-bindir)
|
||||
ARGS=$1
|
||||
|
||||
# No second argument is supported
|
||||
if [ "$2" = "" ]; then
|
||||
ARGS2=""
|
||||
else
|
||||
echo "Unknown argument: $2" ; exit 1
|
||||
fi
|
||||
|
||||
# Don't make config if asked not to.
|
||||
if [ -e "$HOME/.local/share/speedwm-do-not-mkconfig" ]; then
|
||||
DONOTMKCONFIG=true
|
||||
else
|
||||
DONOTMKCONFIG=false
|
||||
fi
|
||||
|
||||
# Load .Xresources if available
|
||||
XRESOURCES() {
|
||||
pgrep -x status > /dev/null && pkill status
|
||||
if [ -e "$HOME/.Xresources" ]; then
|
||||
if [ -e "${BINDIR}xrdb" ]; then
|
||||
xrdb $HOME/.Xresources
|
||||
fi
|
||||
elif [ -e "$HOME/.config/.Xresources" ]; then
|
||||
if [ -e "${BINDIR}xrdb" ]; then
|
||||
xrdb $HOME/.config/.Xresources
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Load speedwm config, create if it does not exist.
|
||||
LOADCONFIG() {
|
||||
mkdir -p $HOME/.config/speedwm-de
|
||||
if [ -e "${BINDIR}xrdb" ]; then
|
||||
if [ "$DONOTMKCONFIG" = "false" ]; then
|
||||
if [ -e "$HOME/.config/speedwm-de/speedwmrc" ]; then
|
||||
xrdb -merge -quiet $HOME/.config/speedwm-de/speedwmrc
|
||||
else
|
||||
echo "! dynamic window manager configuration file" > $HOME/.config/speedwm-de/speedwmrc && echo "Wrote comment 1"
|
||||
echo "! This is your speedwm configuration file. It is configured in .Xresources syntax." >> $HOME/.config/speedwm-de/speedwmrc && echo "Wrote comment 2"
|
||||
echo "! It is loaded on startup but you can reload it during runtime by running $0 -r.\n" >> $HOME/.config/speedwm-de/speedwmrc && echo "Wrote comment 3"
|
||||
sed "s| - ||g" /usr/share/example.Xresources >> $HOME/.config/speedwm-de/speedwmrc && echo "Wrote example configuration file"
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
LOADSWAL() {
|
||||
if [ "$DONOTLOADCONFIG" = "true" ]; then
|
||||
DONOTLOADCONFIG=true
|
||||
else
|
||||
$HOME/.config/speedwm-de/swal/swal_wm > /dev/null
|
||||
echo "Loaded wallpaper and pywal colors"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Reset speedwm
|
||||
RESET() {
|
||||
if [ "$DONOTRELOAD" = "true" ]; then
|
||||
DONOTRELOAD=true
|
||||
else
|
||||
xsetroot -name "Loading" # To hide the ugly fsignal status
|
||||
xsetroot -name "fsignal:31" # Send fsignal to restart speedwm
|
||||
xsetroot -name "Loading" # To hide the ugly fsignal status
|
||||
fi
|
||||
}
|
||||
|
||||
# Check for running window managers
|
||||
CHECKEXISTINGWM() {
|
||||
if [ "$CARG" = "force" ]; then
|
||||
echo "WARNING: Bypassing all checks (due to -f argument). Use this with caution!"
|
||||
else
|
||||
pgrep -x speedwm > /dev/null && echo "speedwm is already running. Use $0 -r to restart it."
|
||||
pgrep -x speedwm > /dev/null && exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Start speedwm itself
|
||||
START_DWM() {
|
||||
speedwm-audioctrl -remute # Fix a weird bug
|
||||
while true; do
|
||||
speedwm > /tmp/speedwm-log
|
||||
done
|
||||
}
|
||||
|
||||
# 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/systray/config && DOTFILE7="$HOME/.config/speedwm-de/systray/config"
|
||||
test $HOME/.config/speedwm-de/winnav/config && DOTFILE8="$HOME/.config/speedwm-de/winnav/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 -g 1 -p "Edit which configuration?")"
|
||||
}
|
||||
|
||||
# List of arguments
|
||||
HELP() {
|
||||
printf "dynamic window manager\nNo arguments | Start speedwm using default options\n-f | Start speedwm bypassing all checks (such as whether or not a window manager is running)\n-noxrdb | Start speedwm without loading colors.\n-nomkconfig | Start speedwm without creating a config file (or loading it)\n-h | View this list of arguments\n-r | Restart speedwm and reload colors\n-loadconfig | Load and create config if it does not exist\n-unloadconfig | Unload the speedwm configuration\n-deleteconfig | Delete the speedwm configuration\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"
|
||||
}
|
||||
|
||||
# Unload speedwm configuration
|
||||
UNLOADCONFIG() {
|
||||
if [ -e "${BINDIR}xrdb" ]; then
|
||||
xrdb -remove speedwm* && echo "Unloaded configuration"
|
||||
else
|
||||
echo "Unable to unload configuration" ; exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Delete speedwm configuration
|
||||
DELETECONFIG() {
|
||||
if [ -e "$HOME/.config/speedwm-de/speedwmrc" ]; then
|
||||
rm -f $HOME/.config/speedwm-de/speedwmrc && echo "Deleted $HOME/.config/speedwm-de/speedwmrc."
|
||||
else
|
||||
echo "Failed to delete configuration file." ; exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$ARGS" in
|
||||
"") CHECKEXISTINGWM ; XRESOURCES ; LOADSWAL ; LOADCONFIG ; RESET ; START_DWM ; exit 0 ;;
|
||||
"-configure") CONFIGURE ; exit 0 ;;
|
||||
"-r") XRESOURCES ; LOADSWAL ; LOADCONFIG ; RESET ; echo "Restarted speedwm." ; exit 0 ;;
|
||||
"-rnoload") RESET ; echo "Restarted speedwm." ; exit 0 ;;
|
||||
"-h") HELP ; exit 0 ;;
|
||||
"-f") CARG="force" ; XRESOURCES ; LOADSWAL ; LOADCONFIG ; RESET ; START_DWM ; exit 0 ;;
|
||||
"-loadconfig") LOADCONFIG ; exit 0 ;;
|
||||
"-unloadconfig") UNLOADCONFIG ; RESET ; exit 0 ;;
|
||||
"-deleteconfig") DELETECONFIG ; RESET ; exit 0 ;;
|
||||
"-noxrdb") START_DWM ; exit 0 ;;
|
||||
"-stop") pgrep -x speedwm && pkill speedwm ; echo "speedwm has been stopped." ; exit 0
|
||||
echo "speedwm is not running, cannot stop it." ; exit 1 ;;
|
||||
"-nomkconfig") CHECKEXISTINGWM ; XRESOURCES ; LOADSWAL ; RESET ; START_DWM ; exit 0 ;;
|
||||
esac
|
||||
|
||||
exit 0
|
439
speedwm.html
Normal file
439
speedwm.html
Normal file
|
@ -0,0 +1,439 @@
|
|||
<head>
|
||||
<div class="header">
|
||||
<title>Dynamic window manager // speedie's website</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="description" content="speedie's build of suckless dynamic window manager. Older version is part of spDE.">
|
||||
<meta name="author" content="speedie">
|
||||
<link rel="stylesheet" href="https://unpkg.com/terminal.css@0.7.2/dist/terminal.min.css" /><link rel="stylesheet" href="https://unpkg.com/terminal.css@0.7.1/dist/terminal.min.css" /><link rel="stylesheet" href="https://unpkg.com/terminal.css@0.7.1/dist/terminal.min.css" />
|
||||
<link rel="stylesheet" href="css/dwm.css">
|
||||
<h1>speedie's website</h1>
|
||||
<link rel="icon" type="image/png" href="png/antibloat.png">
|
||||
<a href="index.html">🏠 Home</a>
|
||||
<a href="projects.html">💾 Projects</a>
|
||||
<a href="blog.html">📘 Blog</a>
|
||||
<a href="guides.html">📕 Guides</a>
|
||||
<a href="mailto:speedie@duck.com">📧 Email</a>
|
||||
<a href="https://github.com/speedie-de">🐧 Dotfiles</a>
|
||||
<a href="rss.xml">📰 RSS</a>
|
||||
<a href="donate.html">💰Donate</a>
|
||||
</a>
|
||||
</div>
|
||||
<hr>
|
||||
</header>
|
||||
<body>
|
||||
<p><img src="img/gentoorice.png" alt="image"></p>
|
||||
<p> <a href="https://speedie.gq/speedwm">https://speedie.gq/speedwm</a></p>
|
||||
<p> <a href="https://speedie.gq/donate">https://speedie.gq/donate</a></p>
|
||||
<h2 id="what-is-speedwm-">What is speedwm?</h2>
|
||||
<p>speedwm is a window manager forked from suckless.org's dwm or dynamic window manager. It manages the user's open windows and tiles them according to a set layout (dynamic).<br>Unlike dwm, speedwm tries to be minimal just dwm but also has functionality and aesthetics as a goal. It is also much more minimal than other window managers like i3-gaps while offering many more features.</p>
|
||||
<p>Tiling window managers (unlike floating window managers that you may be used to) tile windows based on a set layout making them easy to get productive on.<br>They also encourage the user to use their keyboard instead of the mouse so that the user doesn't have to move their hands much but there are mouse keybinds and more can be added.</p>
|
||||
<h2 id="installation">Installation</h2>
|
||||
<p>In order to install this build of speedwm, all dependencies must be installed.<br>You can see (Dependencies) for a list of all dependencies required to use this fork.</p>
|
||||
<ul>
|
||||
<li>git clone <a href="https://codeberg.org/speedie/speedwm">https://codeberg.org/speedie/speedwm</a></li>
|
||||
<li>cd speedwm</li>
|
||||
<li>make clean install<ul>
|
||||
<li>If any warnings show up, fix it by installing the missing dependency.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If a .xinitrc is used, add 'speedwm_run' to the end.<ul>
|
||||
<li>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'.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 id="layouts">Layouts</h2>
|
||||
<p>speedwm comes with the following layouts:</p>
|
||||
<ul>
|
||||
<li>Tile</li>
|
||||
<li>Monocle</li>
|
||||
<li>Grid</li>
|
||||
<li>Deck</li>
|
||||
<li>Centered Master</li>
|
||||
<li>Centered Floating Master</li>
|
||||
<li>Spiral</li>
|
||||
<li>Dwindle</li>
|
||||
<li>Three Column</li>
|
||||
<li>Bottom Stack</li>
|
||||
<li>Horizontal Bottom Stack</li>
|
||||
<li>Horizonal Grid</li>
|
||||
<li>Tatami</li>
|
||||
<li>Tilewide</li>
|
||||
<li>Stairs</li>
|
||||
<li>Tiling (5:4)</li>
|
||||
<li>Column</li>
|
||||
<li>Dynamic Grid</li>
|
||||
</ul>
|
||||
<p>They can be switched between using a little menu (See Keybinds for more information) or by right clicking the Layout indicator.<br>The more commonly used layouts can be switched between using a quick keybind.</p>
|
||||
<h2 id="keybinds">Keybinds</h2>
|
||||
<p>Below is a list of all speedwm keybinds.</p>
|
||||
<h3 id="applications">Applications</h3>
|
||||
<p> Keybinds for regular applications</p>
|
||||
<ul>
|
||||
<li>Super+Shift+Enter | Opens a terminal</li>
|
||||
<li>Super+Shift+Colon | Opens a dmenu prompt</li>
|
||||
<li>Super+Shift+s | Opens 'maim' to take a screenshot and copies it to the clipboard using 'xclip'</li>
|
||||
<li>Super+Shift+f | Opens the defined file manager</li>
|
||||
<li>Super+Shift+w | Opens the defined web browser</li>
|
||||
<li>Super+Shift+o | Opens the bundled dfmpeg dmenu script to record your screen.</li>
|
||||
<li>Super+Shift+e | Opens the dboard dmenu script in dmenu which can copy text to your clipboard</li>
|
||||
<li>Super+Shift+t | Opens the defined editor in your terminal</li>
|
||||
<li>Super+Shift+p | Kills the defined web browser</li>
|
||||
<li>Super+Shift+m | Kills the defined music player</li>
|
||||
<li>Super+Shift+a | Opens the defined mixer in your terminal</li>
|
||||
<li>Super+Shift+m | Opens the defined music player</li>
|
||||
<li>Super+Shift+x | Opens the defined system process viewer in your terminal</li>
|
||||
<li>Super+Control+Shift+m | Opens the defined email client</li>
|
||||
<li><p>Super+Control+u | Opens the defined RSS reader</p>
|
||||
<h3 id="navigation">Navigation</h3>
|
||||
<p>These keybinds are for navigating speedwm</p>
|
||||
</li>
|
||||
<li><p>Super+t | Reorganize tags and move clients</p>
|
||||
</li>
|
||||
<li>Super+f | Full-screen the selected window</li>
|
||||
<li>Super+b | Show/hide the speedwm bar</li>
|
||||
<li>Super+s | Show/hide the systray (If trayer is installed)</li>
|
||||
<li>Super+j/k | Move focus between visible windows</li>
|
||||
<li>Super+Alt+j/k | Increase/decrease gaps between windows in tiling layout by 1</li>
|
||||
<li>Super+Alt+u/d | Increase/decrease gaps between windows in tiling layout by 5</li>
|
||||
<li>Super+Shift+j/k | Move focus between hidden windows</li>
|
||||
<li>Super+a/d | Increase/decrease size of each window</li>
|
||||
<li>Super+o | Hide a window</li>
|
||||
<li>Super+Control+o | Show a window</li>
|
||||
<li>Super+w | Hide all windows except focused</li>
|
||||
<li>Super+Control+w | Show all windows except focused</li>
|
||||
<li>Super+a/d | Move to the next/previous tag</li>
|
||||
<li>Super+Minus | Show the scratchpad</li>
|
||||
<li>Super+Equal | Remove the scratchpad</li>
|
||||
<li>Super+Enter | Switch order of windows</li>
|
||||
<li>Super+Shift+q | Close the current window</li>
|
||||
<li>Super+Space | Set layout</li>
|
||||
<li>Super+t | Disable inactive fade</li>
|
||||
<li>Super+Shift+Equal | Toggle scratchpads</li>
|
||||
<li>Super+Shift+Minus | Hide the scratchpad</li>
|
||||
<li>Super+Shift+Space | Unfloat floating windows</li>
|
||||
<li>Super+Shift+Arrow | Resizes a window in floating mode</li>
|
||||
<li>Super+1 | Move to tag 1</li>
|
||||
<li>Super+2 | Move to tag 2</li>
|
||||
<li>Super+3 | Move to tag 3</li>
|
||||
<li>Super+4 | Move to tag 4</li>
|
||||
<li>Super+5 | Move to tag 5</li>
|
||||
<li>Super+6 | Move to tag 6</li>
|
||||
<li>Super+7 | Move to tag 7</li>
|
||||
<li>Super+8 | Move to tag 8</li>
|
||||
<li>Super+9 | Move to tag 9</li>
|
||||
<li>Super+Shift+1 | Preview tag 1</li>
|
||||
<li>Super+Shift+2 | Preview tag 2</li>
|
||||
<li>Super+Shift+3 | Preview tag 3</li>
|
||||
<li>Super+Shift+4 | Preview tag 4</li>
|
||||
<li>Super+Shift+5 | Preview tag 5</li>
|
||||
<li>Super+Shift+6 | Preview tag 6</li>
|
||||
<li>Super+Shift+7 | Preview tag 7</li>
|
||||
<li>Super+Shift+8 | Preview tag 8</li>
|
||||
<li>Super+Shift+9 | Preview tag 9</li>
|
||||
<li>Super+Shift+h/j/k/l | Rotates a stack.</li>
|
||||
<li>Super+Shift+Escape | Ask the user if they want to shutdown or reboot or nothing</li>
|
||||
<li>Super+Shift+i | Open a dmenu prompt and open the file the user picks in Zathura</li>
|
||||
<li>Super+Shift+p | Open a dmenu prompt and open the file the user picks in Vim</li>
|
||||
<li>Super+Control+e | Switch to layout 3 (Grid)</li>
|
||||
<li>Super+Control+r | Switch to layout 1 (Monocle)</li>
|
||||
<li>Super+Control+t | Switch to layout 0 (Master & stack)</li>
|
||||
<li>Super+Control+y | Switch to layout 4 (Deck)</li>
|
||||
<li>Super+Control+0 | Set all windows to use the same tag</li>
|
||||
<li>Super+Control+Arrow | Moves a window to any corner of your screen (Arrow key)</li>
|
||||
<li>Super+Control+Tab | Open a dmenu prompt asking the user what layout to switch to</li>
|
||||
<li>Super+Control+h | Open a list of all keybinds in your terminal using less</li>
|
||||
<li>Super+Control+Shift+a/d | Move between available layouts</li>
|
||||
<li>Super+Alt+s | Make the current selected window sticky</li>
|
||||
<li>Super+Control+Shift+Esc | Open speedwm-utils (Main menu)</li>
|
||||
<li>Super+Control+Shift+Arrow | Resize the window to the screen size.</li>
|
||||
<li>Super+Control+Shift+s | Set a wallpaper</li>
|
||||
<li>Super+Control+Shift+n | Connect to wifi (Requires iwd)</li>
|
||||
<li>Super+Control+Shift+b | Connect to a bluetooth device (Requires bluez and bluez-utils)</li>
|
||||
<li>Super+Control+Shift+e | Open up a list of dotfiles in dmenu that you can edit.</li>
|
||||
<li>Alt+Tab | Switch windows quickly and easily </li>
|
||||
<li><p>Alt+Control+j/k | Change window size vertically (cfact)</p>
|
||||
<h3 id="chained-keybinds">Chained keybinds</h3>
|
||||
</li>
|
||||
<li>Super+c & w | Curl wttr.in and open in less</li>
|
||||
<li>Super+c & m | Ask the user for a topic and curl cheat.sh</li>
|
||||
<li>Super+g & t | Toggle gaps</li>
|
||||
<li>Super+g & 0 | Reset gaps</li>
|
||||
<li>Super+g & i | Increase inner gaps by 1</li>
|
||||
<li>Super+Shift+g & i | Decrease inner gaps by 1</li>
|
||||
<li>Super+g & o | Increase outer gaps by 1</li>
|
||||
<li>Super+Shift+g & o | Decrease outer gaps by 1</li>
|
||||
<li><p>Super+r+v | Open the defined music visualizer</p>
|
||||
<h3 id="extras">Extras</h3>
|
||||
<p>These will only work if your keyboard has special multimedia buttons.</p>
|
||||
</li>
|
||||
<li><p>Mute button | Mutes your audio</p>
|
||||
</li>
|
||||
<li>Up Volume button | Increases your volume</li>
|
||||
<li>Down Volume button | Decreases your volume</li>
|
||||
<li>Stop button | Stops your defined music player</li>
|
||||
<li>Browser button | Opens your defined web browser</li>
|
||||
<li>Power button | Ask if you wanna shut down, restart or lock your computer.</li>
|
||||
<li>Email button | Open your defined email client</li>
|
||||
<li><p>System button | Open your defined status viewer in a terminal</p>
|
||||
<h3 id="mouse">Mouse</h3>
|
||||
<p>These binds can be activated using your mouse</p>
|
||||
</li>
|
||||
<li><p>Tag <num> (Left click) | Switch to tag <num></p>
|
||||
</li>
|
||||
<li>Layout indicator (Left click) | Switch to the next layout</li>
|
||||
<li>Layout indicator (Middle click) | Switch to the next layout</li>
|
||||
<li>Layout indicator (Right click) | Open a dmenu list of all layouts</li>
|
||||
<li>Window title (Left click) | Hide/Show the window</li>
|
||||
<li>Window title (Right click) | Open speedwm-utils</li>
|
||||
<li>Focused window (Super+Alt+Left click) | Move the focused window around</li>
|
||||
<li>Focused window (Super+Alt+Middle click) | Make the focused window floating</li>
|
||||
<li>Focused window title (Middle click) | Rotate stack</li>
|
||||
<li><p>Dragging (Super+Right click) | Increase/decrease size of each window</p>
|
||||
<p>There are also keybinds for statuscmd, but you must implement it into your own status bar.<br>See mouse.h for more information.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 id="dependencies">Dependencies</h2>
|
||||
<p> These are absolutely necessary, speedwm will NOT compile without them</p>
|
||||
<ul>
|
||||
<li>libxft-bgra (Can be installed through 'make <distro>-libxftfix')<ul>
|
||||
<li>NOTE: libXft will do but will cause speedwm and as such all your applications to crash if a colored emoji is displayed in the status bar.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>libXinerama<ul>
|
||||
<li>Can be disabled through editing config.mk if you're not interested in multiple monitors.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><p>imlib2</p>
|
||||
<h2 id="features">Features</h2>
|
||||
<p>These are dependencies if you wanna use certain features<br>NOTE: Do not add any of these to .xinitrc or similar. They are going to be autostarted by speedwm.<br>If you want to use an alternative, change it in options.h.</p>
|
||||
</li>
|
||||
<li>dmenu<ul>
|
||||
<li>NOTE: dmenu is required for most scripts included with this build of speedwm. My build is required for Pywal support.</li>
|
||||
<li>NOTE 2: The build must have the 'grid' patch. If yours does not have this, you can patch it in or get my build here: <a href="https://codeberg.org/speedie/dmenu">https://codeberg.org/speedie/dmenu</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>picom</li>
|
||||
<li>xclip (Required for clipboard support by a few scripts, will start automatically)</li>
|
||||
<li>xwallpaper (Required to set wallpapers automatically)</li>
|
||||
<li>xmodmap (Install if you want Escape instead of Caps Lock and Right Super+hjkl for arrow keys)</li>
|
||||
<li>xrdb (Install if you want .Xresources support)</li>
|
||||
<li>pywal (Install if you want pywal support. Requires swal aka the default way to set wallpapers)</li>
|
||||
<li>wmctrl (Needed for proper window management)</li>
|
||||
<li>xsetroot (Needed for most scripts including Pywal support)</li>
|
||||
<li>slock (Required for screen locking)</li>
|
||||
<li><p>maim (Required for built in 'speedwm-screenshotutil' script)</p>
|
||||
<h2 id="software">Software</h2>
|
||||
<p>This build of speedwm comes with binds for software.<br>These must be installed by default but you can change what software is required by editing 'options.h' and running 'make clean install'.<br>You can also remove keybinds by editing 'keybinds.h' and running 'make clean install'.</p>
|
||||
</li>
|
||||
<li>st (Terminal)</li>
|
||||
<li>firefox (Web browser)</li>
|
||||
<li>htop (Status monitor)</li>
|
||||
<li>newsboat (RSS reader)</li>
|
||||
<li>zathura (PDF reader)</li>
|
||||
<li>alsa-utils (Required for audio controls)</li>
|
||||
<li>mocp (Default music player)</li>
|
||||
<li>vim (Text editor)</li>
|
||||
<li>neomutt (Email client)</li>
|
||||
<li>maim (Screenshot tool, automatically copies to clipboard using xclip)</li>
|
||||
<li>vifm (File manager)</li>
|
||||
<li>slock (Lock screen)<br>And everything under 'Features'.</li>
|
||||
</ul>
|
||||
<h2 id="important">Important</h2>
|
||||
<p>If you're used to dwm, speedwm might be a little unfamiliar to you at first. This is because speedwm doesn't use config.h (or config.def.h).<br>Instead, config.h is split into different parts to make it easier to edit. Instead of editing config.h you'll want to edit:</p>
|
||||
<ul>
|
||||
<li>autostart.h for starting stuff right before speedwm (For example xclip, pywal, etc.)</li>
|
||||
<li>options.h for changing colors and applications to use with keybinds.</li>
|
||||
<li>fsignal.h for adding fake signals</li>
|
||||
<li>colors.h for changing alpha options, most users won't need to edit it.</li>
|
||||
<li>xresources.h for adding .Xresources options</li>
|
||||
<li>rules.h for adding rules</li>
|
||||
<li>keybinds.h for adding/removing keybinds.</li>
|
||||
</ul>
|
||||
<p>After you've edited one of the files, you need to run 'make clean install' to reinstall speedwm.<br>Remember that you can change colors through your .Xresources file (see .Xresources and Pywal) meaning you do not need to recompile speedwm.</p>
|
||||
<p>Another important detail you must keep in mind is that this build comes with a status bar simply named 'status'.<br>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.</p>
|
||||
<p>You can edit the status bar simply by editing 'status' and running 'make clean install'.<br>You can also configure it by editing '~/.config/speedwm-de/status/config'.<br>Please note that most status bars including the built in 'status' depends on xsetroot which must be installed. speedwm-compatcheck is going to tell you about this when compiling.</p>
|
||||
<p>If you want to change status bar, edit options.h and set 'static char status' to your status bar binary (must be in $PATH).<br>Alternatively, you can also set speedwm.status: <statusbar> in .Xresources (See .Xresources and Pywal)</p>
|
||||
<h2 id="-xresources-and-pywal">.Xresources and Pywal</h2>
|
||||
<p>This fork of speedwm has .Xresources support thanks to the .Xresources patch.<br>It also has pywal support (tool which grabs colors based on your wallpaper).</p>
|
||||
<p>Colors reload automagically because of a reloadxresources function this build has combined with fsignal and a wallpaper script I wrote.<br>Therefore, if you want colors to reload instantly, you're unfortunately forced to use the bundled wallpaper script.</p>
|
||||
<p>If you want to use another script, you can open up speedwm-utils and select 'Reload .Xresources' to reload .Xresources.<br>Alternatively, you can write a script yourself (18 reloads the colors)</p>
|
||||
<p>Below is a list of all .Xresources values you can define. The .Xresources file should be placed in ~ or ~/.config by the user.<br>If it is not or you want it somewhere else, you can edit 'autostart.h' and 'make clean install'.</p>
|
||||
<p>Note that the 'xrdb' dependency is required for both pywal and .Xresources support and 'xsetroot' is required for automatic reloading of colors, the built in status bar, and more so you should install this.</p>
|
||||
<ul>
|
||||
<li>speedwm.nmaster: 1</li>
|
||||
<li>speedwm.font: fontawesome:size=8</li>
|
||||
<li>speedwm.font2: NotoSans-Regular:size=8:antialiasing=true</li>
|
||||
<li>speedwm.font3: Noto Emoji:size=8</li>
|
||||
<li>speedwm.col_background: #222222</li>
|
||||
<li>speedwm.col_backgroundmid: #222222</li>
|
||||
<li>speedwm.col_textnorm: #bbbbbb</li>
|
||||
<li>speedwm.col_textsel: #eeeeee</li>
|
||||
<li>speedwm.col_windowbordersel: #eeeeee</li>
|
||||
<li>speedwm.col_windowbordernorm: #000000</li>
|
||||
<li>speedwm.col_tag1: #333333</li>
|
||||
<li>speedwm.col_tag1_text: #eeeeee</li>
|
||||
<li>speedwm.col_tag2: #333333</li>
|
||||
<li>speedwm.col_tag2_text: #eeeeee</li>
|
||||
<li>speedwm.col_tag3: #333333</li>
|
||||
<li>speedwm.col_tag3_text: #eeeeee</li>
|
||||
<li>speedwm.col_tag4: #333333</li>
|
||||
<li>speedwm.col_tag4_text: #eeeeee</li>
|
||||
<li>speedwm.col_tag5: #333333</li>
|
||||
<li>speedwm.col_tag5_text: #eeeeee</li>
|
||||
<li>speedwm.col_tag6: #333333</li>
|
||||
<li>speedwm.col_tag6_text: #eeeeee</li>
|
||||
<li>speedwm.col_tag7: #333333</li>
|
||||
<li>speedwm.col_tag7_text: #eeeeee</li>
|
||||
<li>speedwm.col_tag8: #333333</li>
|
||||
<li>speedwm.col_tag8_text: #eeeeee</li>
|
||||
<li>speedwm.col_tag9: #333333</li>
|
||||
<li>speedwm.col_tag9_text: #eeeeee</li>
|
||||
<li>speedwm.col_layouttext: #000000</li>
|
||||
<li>speedwm.col_layoutbgnorm: #222222</li>
|
||||
<li>speedwm.col_layoutbgsel: #bbbbbb</li>
|
||||
<li>speedwm.col_status0: #131210</li>
|
||||
<li>speedwm.col_status1: #bf616a</li>
|
||||
<li>speedwm.col_status2: #A16F9D</li>
|
||||
<li>speedwm.col_status3: #68ABAA</li>
|
||||
<li>speedwm.col_status4: #A89F93</li>
|
||||
<li>speedwm.col_status5: #D3A99B</li>
|
||||
<li>speedwm.col_status6: #AFC9AC</li>
|
||||
<li>speedwm.col_status7: #eae1cb</li>
|
||||
<li>speedwm.col_status8: #a39d8e</li>
|
||||
<li>speedwm.col_status9: #6D5E8E</li>
|
||||
<li>speedwm.col_status10: #A16F9D</li>
|
||||
<li>speedwm.col_status11: #D3A99B</li>
|
||||
<li>speedwm.col_status12: #AFC9AC</li>
|
||||
<li>speedwm.col_status13: #eae1cb</li>
|
||||
<li>speedwm.col_status14: #6D5E8E</li>
|
||||
<li>speedwm.col_status15: #ffffff</li>
|
||||
<li>speedwm.borderpx: 1</li>
|
||||
<li>speedwm.snap: 20</li>
|
||||
<li>speedwm.showbar: 1</li>
|
||||
<li>speedwm.resizehints: 0</li>
|
||||
<li>speedwm.mousemfact: 1</li>
|
||||
<li>speedwm.mfact: 0.50</li>
|
||||
<li>speedwm.startontag: 1</li>
|
||||
<li>speedwm.enablegaps: 1</li>
|
||||
<li>speedwm.smartgaps: 1</li>
|
||||
<li>speedwm.smartgapsize: 0</li>
|
||||
<li>speedwm.gappih: 10</li>
|
||||
<li>speedwm.gappiv: 10</li>
|
||||
<li>speedwm.gappoh: 10</li>
|
||||
<li>speedwm.gappov: 10</li>
|
||||
<li>speedwm.attachdirection: 3</li>
|
||||
<li>speedwm.shell: /bin/sh</li>
|
||||
<li>speedwm.sizeicon: 10</li>
|
||||
<li>speedwm.spacingicon: 5</li>
|
||||
<li>speedwm.status: status</li>
|
||||
<li>speedwm.defaultname:</li>
|
||||
<li>speedwm.refreshrules: 1</li>
|
||||
<li>speedwm.decorhints: 1</li>
|
||||
<li>speedwm.barpaddingv: 0</li>
|
||||
<li>speedwm.barpaddingh: 0 </li>
|
||||
<li>speedwm.barheight: 5</li>
|
||||
<li>speedwm.altbar: 0</li>
|
||||
<li>speedwm.altbarclass: Polybar</li>
|
||||
<li>speedwm.alttrayname: tray</li>
|
||||
<li>speedwm.altbarcmd: polybar &</li>
|
||||
<li>speedwm.centerfloating: 1</li>
|
||||
<li>speedwm.savefloat: 1</li>
|
||||
<li>speedwm.warpcursor: 1</li>
|
||||
<li>speedwm.pertag: 1</li>
|
||||
<li>speedwm.i3nmaster: 0</li>
|
||||
<li>speedwm.scalepreview: 4</li>
|
||||
<li>speedwm.tagpreview: 1</li>
|
||||
<li>speedwm.mousepreview: 1</li>
|
||||
<li>speedwm.monocleclientcount: 0</li>
|
||||
<li>speedwm.monoclecount: 0</li>
|
||||
<li>speedwm.monocleformat: [%d/%d]</li>
|
||||
<li>speedwm.statusallmons: 1</li>
|
||||
<li>speedwm.hidelayout: 0</li>
|
||||
<li>speedwm.hidetitle: 0</li>
|
||||
<li>speedwm.hidestatus: 0</li>
|
||||
<li>speedwm.hidetags: 0</li>
|
||||
<li>speedwm.hidesticky: 0</li>
|
||||
<li>speedwm.hidefloating: 0</li>
|
||||
<li>speedwm.leftlayout: 1</li>
|
||||
<li>speedwm.fadeinactive: 1</li>
|
||||
<li>speedwm.defaultlayout: 1</li>
|
||||
<li>speedwm.wmclass: 1</li>
|
||||
<li>speedwm.clicktofocus: 0</li>
|
||||
<li>speedwm.stairpx: 20</li>
|
||||
<li>speedwm.stairdirection: 1</li>
|
||||
<li>speedwm.stairsamesize: 1</li>
|
||||
<li>speedwm.deckcount: 0</li>
|
||||
<li>speedwm.deckformat: D %d</li>
|
||||
<li>speedwm.roundedcorners: 0</li>
|
||||
<li>speedwm.cornerradius: 3</li>
|
||||
<li>speedwm.swallowclients: 1</li>
|
||||
<li>speedwm.swallowfloating: 1</li>
|
||||
<li>speedwm.movefullscreenmon: 0</li>
|
||||
<li>speedwm.lockfullscreen: 1</li>
|
||||
<li>speedwm.underline: 0</li>
|
||||
<li>speedwm.underlineall: 0</li>
|
||||
<li>speedwm.underlinepad: 5</li>
|
||||
<li>speedwm.underlinestroke: 2</li>
|
||||
<li>speedwm.underlinevoffset: 0</li>
|
||||
<li>speedwm.forcevsplit: 1</li>
|
||||
<li>speedwm.floatscratchpad: 0</li>
|
||||
</ul>
|
||||
<h2 id="fsignal">Fsignal</h2>
|
||||
<p>Thanks to the 'fsignal' patch available on suckless.org's website, we can easily write shell scripts to interact with dwm and therefore speedwm.<br>This is exactly what I did and speedwm-utils, speedwm-swal, speedwm-shutdown and more take advantage of it.</p>
|
||||
<p>In order to use 'fsignal', your system must have 'xsetroot' installed.<br>Then simply use the dwm-utils script. Syntax is dwm-utils -exec <signum></p>
|
||||
<p>Below is a list of all signums and what they do.</p>
|
||||
<ul>
|
||||
<li>1 | Switch to the Tiling layout</li>
|
||||
<li>2 | Switch to the Floating layout</li>
|
||||
<li>3 | Switch to the Monocle layout</li>
|
||||
<li>4 | Switch to the Grid layout</li>
|
||||
<li>5 | Switch to the Deck layout</li>
|
||||
<li>6 | Switch to the Centered Master layout</li>
|
||||
<li>7 | Switch to the Centered Floating Master layout</li>
|
||||
<li>8 | Switch to the Fibonacci Spiral layout</li>
|
||||
<li>9 | Switch to the Fibonacci Dwindle layout</li>
|
||||
<li>10 | Switch to the Three Column layout</li>
|
||||
<li>11 | Switch to the Bottom Stack Vertical layout</li>
|
||||
<li>12 | Switch to the Bottom Stack Horizontal layout</li>
|
||||
<li>13 | Switch to the Horizontal Grid layout</li>
|
||||
<li>14 | Switch to the Tatami layout</li>
|
||||
<li>15 | To be added</li>
|
||||
<li>16 | Cycle layout (Previous)</li>
|
||||
<li>17 | Cycle layout (Next)</li>
|
||||
<li>18 | Reload colors from .Xresources</li>
|
||||
<li>19 | Set mfact (-0.05)</li>
|
||||
<li>20 | Set mfact (+0.05)</li>
|
||||
<li>21 | Toggle Scratchpad</li>
|
||||
<li>22 | Toggle Sticky</li>
|
||||
<li>23 | Toggle Bar</li>
|
||||
<li>24 | Toggle Fullscreen</li>
|
||||
<li>25 | Restart speedwm keeping all your applications open.</li>
|
||||
<li>26 | Unused at the moment.</li>
|
||||
<li>27 | Switch to the Stairs layout</li>
|
||||
<li>28 | Reset layout and mfact</li>
|
||||
<li>29 | Reorganize tags</li>
|
||||
<li>30 | Restart speedwm</li>
|
||||
<li>31 | Shutdown speedwm</li>
|
||||
<li>32 | To be added</li>
|
||||
<li>33 | To be added</li>
|
||||
<li>34 | To be added</li>
|
||||
<li>35 | Switch to the Tiling (5:4) layout</li>
|
||||
<li>36 | Switch to the Column layout</li>
|
||||
<li>37 | Switch to the Dynamic Grid layout</li>
|
||||
</ul>
|
||||
<h2 id="switching-run-launcher">Switching run launcher</h2>
|
||||
<p>Some users may prefer to use a different run launcher than dmenu.<br>Previously all scripts bundled would only run dmenu from $PATH but you can now switch run launcher very easily.</p>
|
||||
<ul>
|
||||
<li>Edit options.h and change RUN to your run launcher</li>
|
||||
<li>Add export RUNLAUNCHER=<runlauncher> to your .<shell>rc</li>
|
||||
</ul>
|
||||
<p>Run launchers must support dmenu arguments because otherwise scripts are going to be incompatible.<br>It must also support the additional '-g' argument that the dmenu grid patch provides unless you modify the scripts bundled.<br>Keep in mind that if you use a different run launcher, it may not support Pywal/.Xresources.</p>
|
||||
<h2>Auto generated.</h2>
|
||||
<p>This page was auto generated by the dwm-help script bundled with dwm. It acts as the help script and it writes documentation to HTML, Markdown and plain text from documentation in the docs folder and data grabbed from your current system.</p>
|
||||
</body>
|
||||
<footer>
|
||||
<h2>Website made by speedie, proudly written in Vim on Gentoo Linux.</h2>
|
||||
<h4>This website is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International.</h4>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
BIN
speedwm.png
Normal file
BIN
speedwm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 145 B |
521
status
Executable file
521
status
Executable file
|
@ -0,0 +1,521 @@
|
|||
#!/bin/sh
|
||||
# Status bar for speedwm
|
||||
# Written by speedie.gq in POSIX sh for https://speedie.gq/speedwm
|
||||
# Licensed under the GNU GPLv3 free software license.
|
||||
#
|
||||
# NOTE: Anything in the DISPLAY function will be printed to your status bar.
|
||||
# This means stdout will be printed regardless.
|
||||
# You can output to /dev/null to silence most commands.
|
||||
#
|
||||
# Once you're done editing, run 'make clean install'.
|
||||
#
|
||||
# CONFIG
|
||||
# This is the configuration for the status bar
|
||||
#
|
||||
# I highly recommend editing ~/.config/speedwm-de/status/config instead though
|
||||
# All settings with the exception of changing the order of items can be
|
||||
# changed there. Otherwise, carefully edit the file and recompile speedwm!
|
||||
#
|
||||
# General settings
|
||||
USEWAL=true # Use Pywal if possible (true/false)
|
||||
RUNONCE=false # Only run status bar once (true/false)
|
||||
SLEEPTIME=7 # How long delay in seconds between each reload (int)
|
||||
DATEBINDIR="/bin/" # Directory where your 'date' binary is. Default should be fine for most people
|
||||
SETMETHOD="xsetroot -name" # Method used to set the status bar
|
||||
SEP="<" # Separator to use
|
||||
COLORFG=true # Color foreground (true/false)
|
||||
COLORBG=false # Color background (true/false)
|
||||
USEBUILTINCOL=false # Use built in speedwm colors (col_status<num>). This also supports Pywal. (true/false)
|
||||
|
||||
# Status bar modules
|
||||
# Set to true/false to enable/disable.
|
||||
# Keep in mind, if the dependencies are not installed, then they will not be used regardless of what the option is set to.
|
||||
ENABLE_ITEM1=true # Enable RAM usage (true/false)
|
||||
ENABLE_ITEM2=true # Enable Time (HH:MM) (true/false)
|
||||
ENABLE_ITEM3=true # Enable Date (DD/MM/YY) (true/false)
|
||||
ENABLE_ITEM4=true # Enable Volume/Mute status (<perc>%) (true/false)
|
||||
ENABLE_ITEM5=true # Enable Weather (true/false)
|
||||
ENABLE_ITEM6=true # Enable Network Traffic (<num>B/s (true/false)
|
||||
ENABLE_ITEM7=true # Enable dfmpeg status (true/false)
|
||||
ENABLE_ITEM8=true # Enable CPU temp (true/false)
|
||||
ENABLE_ITEM9=true # Enable music status (true/false)
|
||||
ENABLE_ITEM10=false # Enable newsboat unread (true/false)
|
||||
ENABLE_ITEM11=true # Enable battery percentage and charging status (true/false)
|
||||
ENABLE_ITEM12=false # Enable #ff IRC backlog in status bar (true/false)
|
||||
|
||||
ITEM1_ICON="" # Icon for ITEM1
|
||||
ITEM2_ICON="" # Icon for ITEM2
|
||||
ITEM3_ICON="" # Icon for ITEM3
|
||||
ITEM4_ICON="" # Icon for ITEM4
|
||||
ITEM5_ICON="" # Icon for ITEM5
|
||||
ITEM6_ICON="" # Icon for ITEM6
|
||||
ITEM7_ICON="" # Icon for ITEM7
|
||||
ITEM8_ICON="" # Icon for ITEM8
|
||||
ITEM9_ICON="" # Icon for ITEM9
|
||||
ITEM10_ICON="" # Icon for ITEM10
|
||||
ITEM11_ICON="" # Icon for ITEM11
|
||||
ITEM12_ICON="" # Icon for ITEM12
|
||||
|
||||
ITEM9_BACKEND="auto" # Backend for the music status (cmus/mocp/auto)
|
||||
|
||||
# Systray options
|
||||
HIDE_STATUS_SYSTRAY=true # Hide the status when a systray is running (true/false)
|
||||
SYSTRAY="trayer" # Systray to use (<systray executable>).
|
||||
STATUS_WHEN_HIDDEN="" # Status to print when status is hidden (char)
|
||||
|
||||
# Order of colors and items in the status bar
|
||||
PRINT() {
|
||||
$SETMETHOD "\
|
||||
$FSETCOLORCMD11\
|
||||
$BSETCOLORCMD11\
|
||||
$(ITEM2) \
|
||||
$FSETCOLORCMD10\
|
||||
$BSETCOLORCMD10\
|
||||
$(ITEM3) \
|
||||
$FSETCOLORCMD13\
|
||||
$BSETCOLORCMD13\
|
||||
$(ITEM11) \
|
||||
$FSETCOLORCMD8\
|
||||
$BSETCOLORCMD8\
|
||||
$(ITEM4) \
|
||||
$FSETCOLORCMD7\
|
||||
$BSETCOLORCMD7\
|
||||
$(ITEM1) \
|
||||
$FSETCOLORCMD6\
|
||||
$BSETCOLORCMD6\
|
||||
$(ITEM6) \
|
||||
$FSETCOLORCMD4\
|
||||
$BSETCOLORCMD4\
|
||||
$(ITEM8) \
|
||||
$FSETCOLORCMD3\
|
||||
$BSETCOLORCMD3\
|
||||
$(ITEM5) \
|
||||
$FSETCOLORCMD2\
|
||||
$BSETCOLORCMD2\
|
||||
$(ITEM9) \
|
||||
$FSETCOLORCMD5\
|
||||
$BSETCOLORCMD5\
|
||||
$(ITEM7) \
|
||||
$FSETCOLORCMD9\
|
||||
$BSETCOLORCMD9\
|
||||
$(ITEM10) \
|
||||
$FSETCOLORCMD14\
|
||||
$BSETCOLORCMD14\
|
||||
$(ITEM12)"
|
||||
}
|
||||
|
||||
# Colors
|
||||
####################################
|
||||
# The colors under SETCOLORS will be used if Pywal is not enabled.
|
||||
|
||||
# Default colorscheme, for when pywal is not enabled or available.
|
||||
# I recommend using Vim, vim-plugin and colorizer so that you can actually see the colors.
|
||||
SETCOLORS() {
|
||||
COLOR1=#131210
|
||||
COLOR2=#bf616a
|
||||
COLOR3=#A16F9D
|
||||
COLOR4=#68ABAA
|
||||
COLOR5=#A89F93
|
||||
COLOR6=#D3A99B
|
||||
COLOR7=#AFC9AC
|
||||
COLOR8=#eae1cb
|
||||
COLOR9=#a39d8e
|
||||
COLOR10=#6D5E8E
|
||||
COLOR11=#A16F9D
|
||||
COLOR12=#D3A99B
|
||||
COLOR13=#AFC9AC
|
||||
COLOR14=#eae1cb
|
||||
COLOR15=#6D5E8E
|
||||
}
|
||||
|
||||
# Add colors to status2d compatible variable to use with xsetroot later.
|
||||
SETCOLORS_CMD() {
|
||||
if [ "$COLORFG" = "true" ]; then
|
||||
FSETCOLORCMD1="^c${COLOR1}^"
|
||||
FSETCOLORCMD2="^c${COLOR2}^"
|
||||
FSETCOLORCMD3="^c${COLOR3}^"
|
||||
FSETCOLORCMD4="^c${COLOR4}^"
|
||||
FSETCOLORCMD5="^c${COLOR5}^"
|
||||
FSETCOLORCMD6="^c${COLOR6}^"
|
||||
FSETCOLORCMD7="^c${COLOR7}^"
|
||||
FSETCOLORCMD8="^c${COLOR8}^"
|
||||
FSETCOLORCMD9="^c${COLOR9}^"
|
||||
FSETCOLORCMD10="^c${COLOR10}^"
|
||||
FSETCOLORCMD11="^c${COLOR11}^"
|
||||
FSETCOLORCMD12="^c${COLOR12}^"
|
||||
FSETCOLORCMD13="^c${COLOR13}^"
|
||||
FSETCOLORCMD14="^c${COLOR14}^"
|
||||
FSETCOLORCMD15="^c${COLOR15}^"
|
||||
fi
|
||||
|
||||
if [ "$COLORBG" = "true" ]; then
|
||||
BSETCOLORCMD1="^b${COLOR1}^"
|
||||
BSETCOLORCMD2="^b${COLOR2}^"
|
||||
BSETCOLORCMD3="^b${COLOR3}^"
|
||||
BSETCOLORCMD4="^b${COLOR4}^"
|
||||
BSETCOLORCMD5="^b${COLOR5}^"
|
||||
BSETCOLORCMD6="^b${COLOR6}^"
|
||||
BSETCOLORCMD7="^b${COLOR7}^"
|
||||
BSETCOLORCMD8="^b${COLOR8}^"
|
||||
BSETCOLORCMD9="^b${COLOR9}^"
|
||||
BSETCOLORCMD10="^b${COLOR10}^"
|
||||
BSETCOLORCMD11="^b${COLOR11}^"
|
||||
BSETCOLORCMD12="^b${COLOR12}^"
|
||||
BSETCOLORCMD13="^b${COLOR13}^"
|
||||
BSETCOLORCMD14="^b${COLOR14}^"
|
||||
BSETCOLORCMD15="^b${COLOR15}^"
|
||||
fi
|
||||
|
||||
if [ "$USEBUILTINCOL" = "true" ]; then
|
||||
if [ "$COLORFG" = "true" ]; then
|
||||
FSETCOLORCMD1="^C1^"
|
||||
FSETCOLORCMD2="^C2^"
|
||||
FSETCOLORCMD3="^C3^"
|
||||
FSETCOLORCMD4="^C4^"
|
||||
FSETCOLORCMD5="^C5^"
|
||||
FSETCOLORCMD6="^C6^"
|
||||
FSETCOLORCMD7="^C7^"
|
||||
FSETCOLORCMD8="^C8^"
|
||||
FSETCOLORCMD9="^C9^"
|
||||
FSETCOLORCMD10="^C10^"
|
||||
FSETCOLORCMD11="^C11^"
|
||||
FSETCOLORCMD12="^C12^"
|
||||
FSETCOLORCMD13="^C13^"
|
||||
FSETCOLORCMD14="^C14^"
|
||||
FSETCOLORCMD15="^C15^"
|
||||
fi
|
||||
|
||||
if [ "$COLORBG" = "true" ]; then
|
||||
BSETCOLORCMD1="^B1^"
|
||||
BSETCOLORCMD2="^B2^"
|
||||
BSETCOLORCMD3="^B3^"
|
||||
BSETCOLORCMD4="^B4^"
|
||||
BSETCOLORCMD5="^B5^"
|
||||
BSETCOLORCMD6="^B6^"
|
||||
BSETCOLORCMD7="^B7^"
|
||||
BSETCOLORCMD8="^B8^"
|
||||
BSETCOLORCMD9="^B9^"
|
||||
BSETCOLORCMD10="^B10^"
|
||||
BSETCOLORCMD11="^B11^"
|
||||
BSETCOLORCMD12="^B12^"
|
||||
BSETCOLORCMD13="^B13^"
|
||||
BSETCOLORCMD14="^B14^"
|
||||
BSETCOLORCMD15="^B15^"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Grab colors from pywal if possible
|
||||
# For example, 1,1p means the first line
|
||||
SETCOLORS_WAL() {
|
||||
if [ "$USEWAL" = "true" ]; then
|
||||
if [ -e "$HOME/.cache/wal/colors" ]; then
|
||||
COLOR1=$(sed -n 1,1p $HOME/.cache/wal/colors)
|
||||
COLOR2=$(sed -n 2,2p $HOME/.cache/wal/colors)
|
||||
COLOR3=$(sed -n 3,3p $HOME/.cache/wal/colors)
|
||||
COLOR4=$(sed -n 4,4p $HOME/.cache/wal/colors)
|
||||
COLOR5=$(sed -n 5,5p $HOME/.cache/wal/colors)
|
||||
COLOR6=$(sed -n 6,6p $HOME/.cache/wal/colors)
|
||||
COLOR7=$(sed -n 7,7p $HOME/.cache/wal/colors)
|
||||
COLOR8=$(sed -n 8,8p $HOME/.cache/wal/colors)
|
||||
COLOR9=$(sed -n 9,9p $HOME/.cache/wal/colors)
|
||||
COLOR10=$(sed -n 10,10p $HOME/.cache/wal/colors)
|
||||
COLOR11=$(sed -n 11,11p $HOME/.cache/wal/colors)
|
||||
COLOR12=$(sed -n 12,12p $HOME/.cache/wal/colors)
|
||||
COLOR13=$(sed -n 13,13p $HOME/.cache/wal/colors)
|
||||
COLOR14=$(sed -n 14,14p $HOME/.cache/wal/colors)
|
||||
COLOR15=$(sed -n 15,15p $HOME/.cache/wal/colors)
|
||||
USINGWAL=true
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# End of configuration
|
||||
#########################################################################
|
||||
|
||||
# Set bindir
|
||||
case "$BINDIR" in
|
||||
"") BINDIR=$(cat /usr/share/speedwm-bindir) ;;
|
||||
esac
|
||||
|
||||
mkdir -p $HOME/.config/speedwm-de/status
|
||||
|
||||
# Load config and create options if it does not exist
|
||||
LOADCONFIG() {
|
||||
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
||||
. $HOME/.config/speedwm-de/status/config && echo "Loaded configuration file"
|
||||
else
|
||||
touch $HOME/.config/speedwm-de/status/config && echo "Created configuration file"
|
||||
printf "USEWAL=$USEWAL # Use Pywal if possible (true/false)" > $HOME/.config/speedwm-de/status/config
|
||||
printf "\nRUNONCE=$RUNONCE # Only run status bar once (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nSLEEPTIME=$SLEEPTIME # How long delay in seconds between each reload (int)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nSEP='$SEP' # Separator to use" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\n\nENABLE_ITEM1=$ENABLE_ITEM1 # Enable RAM usage (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM2=$ENABLE_ITEM2 # Enable Time (HH:MM) (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM3=$ENABLE_ITEM3 # Enable Date (DD/MM/YY) (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM4=$ENABLE_ITEM4 # Enable Volume/Mute status (<perc>%) (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM5=$ENABLE_ITEM5 # Enable Weather (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM6=$ENABLE_ITEM6 # Enable Network Traffic (<num>B/s) (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM7=$ENABLE_ITEM7 # Enable dfmpeg status (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM8=$ENABLE_ITEM8 # Enable CPU temp (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM9=$ENABLE_ITEM9 # Enable music status (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM10=$ENABLE_ITEM10 # Enable newsboat unread (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM11=$ENABLE_ITEM11 # Enable battery percentage and charging status (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nENABLE_ITEM12=$ENABLE_ITEM12 # Enable #ff IRC backlogs in status bar (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\n\nITEM1_ICON=$ITEM1_ICON # Icon for ITEM1" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM2_ICON=$ITEM2_ICON # Icon for ITEM2" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM3_ICON=$ITEM3_ICON # Icon for ITEM3" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM4_ICON=$ITEM4_ICON # Icon for ITEM4" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM5_ICON=$ITEM5_ICON # Icon for ITEM5" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM6_ICON=$ITEM6_ICON # Icon for ITEM6" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM7_ICON=$ITEM7_ICON # Icon for ITEM7" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM8_ICON=$ITEM8_ICON # Icon for ITEM8" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM9_ICON=$ITEM9_ICON # Icon for ITEM9" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM10_ICON=$ITEM10_ICON # Icon for ITEM10" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM11_ICON=$ITEM11_ICON # Icon for ITEM11" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nITEM12_ICON=$ITEM12_ICON # Icon for ITEM12" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\n\nITEM9_BACKEND=$ITEM9_BACKEND # Backend for the music status (cmus/mocp/auto)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\n\nHIDE_STATUS_SYSTRAY=$HIDE_STATUS_SYSTRAY # Hide the status when a systray is running (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nSYSTRAY=$SYSTRAY # Systray to use (<systray executable>)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nSTATUS_WHEN_HIDDEN=$STATUS_WHEN_HIDDEN # Status to print when status is hidden (char)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLORFG=$COLORFG # Color foreground (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLORBG=$COLORBG # Color background (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nUSEBUILTINCOL=$USEBUILTINCOL # Use built in speedwm colors (col_status<num>). This also supports Pywal. (true/false)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\n\nCOLOR1=$COLOR1 # Color for ITEM1 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR2=$COLOR2 # Color for ITEM2 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR3=$COLOR3 # Color for ITEM3 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR4=$COLOR4 # Color for ITEM4 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR5=$COLOR5 # Color for ITEM5 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR6=$COLOR6 # Color for ITEM6 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR7=$COLOR7 # Color for ITEM7 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR8=$COLOR8 # Color for ITEM8 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR9=$COLOR9 # Color for ITEM9 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR10=$COLOR10 # Color for ITEM10 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR11=$COLOR11 # Color for ITEM11 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR12=$COLOR12 # Color for ITEM12 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR13=$COLOR13 # Color for ITEM13 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR14=$COLOR14 # Color for ITEM14 (hex color)" >> $HOME/.config/speedwm-de/status/config
|
||||
printf "\nCOLOR15=$COLOR15 # Color for ITEM15 (hex color)\n" >> $HOME/.config/speedwm-de/status/config
|
||||
fi
|
||||
}
|
||||
|
||||
# Set it to /usr/bin if it was not possible to get it through /usr/share/speedwm-bindir
|
||||
case "$BINDIR" in
|
||||
"") BINDIR="/usr/bin" ;;
|
||||
esac
|
||||
|
||||
# Check if muted, for use with volume status bar. Unmute if muted.
|
||||
case "$MUTED" in
|
||||
"") MUTED=false ;;
|
||||
"true") MUTED=false ;;
|
||||
esac
|
||||
|
||||
# Systray stuff
|
||||
PRINT_SYSTRAY() {
|
||||
if [ "$SYSTRAY" = "trayer" ]; then
|
||||
grep "USE_SRG=true" $HOME/.config/speedwm-de/systray/config && SYSTRAY="trayer-srg"
|
||||
fi
|
||||
|
||||
if [ "$HIDE_STATUS_SYSTRAY" = "true" ]; then
|
||||
pgrep -x $SYSTRAY > /dev/null && SYSTRAYRUNNING=true
|
||||
case "$SYSTRAYRUNNING" in
|
||||
"true") $SETMETHOD "$STATUS_WHEN_HIDDEN" && exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ "$HIDE_SYSTEM_SYSTRAY" = "true" ]; then
|
||||
if [ "$SYSTRAYRUNNING" != "true" ]; then
|
||||
PRINT
|
||||
fi
|
||||
else
|
||||
PRINT
|
||||
fi
|
||||
}
|
||||
|
||||
# RAM usage
|
||||
ITEM1() {
|
||||
if [ "$ENABLE_ITEM1" = "true" ]; then
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
echo "$SEP $ITEM1_ICON $(echo $(free -h --giga | awk '/^Mem/ {print $3}')B)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Time
|
||||
ITEM2() {
|
||||
if [ "$ENABLE_ITEM2" = "true" ]; then
|
||||
if [ -e "${DATEBINDIR}date" ]; then
|
||||
echo "$SEP $ITEM2_ICON $(date +%H:%M)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Date
|
||||
ITEM3() {
|
||||
if [ "$ENABLE_ITEM3" = "true" ]; then
|
||||
if [ -e "${DATEBINDIR}date" ]; then
|
||||
echo "$SEP $ITEM3_ICON $(date +%d/%m/%Y)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Volume
|
||||
ITEM4() {
|
||||
if [ "$ENABLE_ITEM4" = "true" ]; then
|
||||
if [ -e "${BINDIR}pulsemixer" ]; then
|
||||
echo "$SEP $ITEM4_ICON $(echo $(pulsemixer --get-volume | awk '{ print $1 }')%)"
|
||||
test /tmp/speedwm-audioctrl-mutestatus && grep "Not muted" /tmp/speedwm-audioctrl-mutestatus > /dev/null && MUTED=false
|
||||
test /tmp/speedwm-audioctrl-mutestatus && grep "Not muted" /tmp/speedwm-audioctrl-mutestatus > /dev/null || MUTED=true
|
||||
test /tmp/speedwm-audioctrl-mutestatus || MUTED=false
|
||||
else
|
||||
echo "$SEP $ITEM4_ICON $(echo $(amixer -c 0 get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")%)"
|
||||
fi
|
||||
|
||||
if [ "$MUTED" != "false" ]; then
|
||||
printf "\n (Muted)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Weather
|
||||
ITEM5() {
|
||||
if [ "$ENABLE_ITEM5" = "true" ]; then
|
||||
if [ -e "${BINDIR}curl" ]; then
|
||||
curl -so /tmp/hacky_internet_test wttr.in && echo "$SEP $ITEM5_ICON $(echo $(curl -s wttr.in/?format="%C"), $(curl -s wttr.in/?format=3 | sed 's/.* //' | sed 's/.*\(.....\)/\1/'))"
|
||||
rm -f /tmp/hacky_internet_test
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Network traffic
|
||||
ITEM6() {
|
||||
if [ "$ENABLE_ITEM6" = "true" ]; then
|
||||
if [ -e "${BINDIR}awk" ]; then
|
||||
echo "$SEP $ITEM6_ICON $(awk '{$1=$1/1024000; print $1"B";}' /sys/class/net/[ew]*/statistics/tx_bytes | sed 's/.*\(....\)/\1/' | sed "s|B|B/s |")"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Dfmpeg status
|
||||
ITEM7() {
|
||||
# Check if we're recording with dfmpeg or not
|
||||
if [ "$ENABLE_ITEM7" = "true" ]; then
|
||||
if [ -e "/tmp/dfmpeg-recording" ]; then
|
||||
echo "$SEP $ITEM7_ICON Recording"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# CPU temp
|
||||
ITEM8() {
|
||||
if [ "$ENABLE_ITEM8" = "true" ]; then
|
||||
if [ -e "${BINDIR}sensors" ]; then
|
||||
echo "$SEP $ITEM8_ICON $(sensors | grep "temp1" | sed 's/(.*//' | sed "s/temp1.//" | sed -r 's/\s+//g' | awk '{ print $1 }')"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# mocp/cmus status
|
||||
ITEM9() {
|
||||
# Auto set backend if set to auto
|
||||
if [ "$ITEM9_BACKEND" = "auto" ]; then
|
||||
if [ -e "${BINDIR}cmus" ]; then
|
||||
ITEM9_BACKEND="cmus"
|
||||
elif [ -e "${BINDIR}mocp" ]; then
|
||||
ITEM9_BACKEND="mocp"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ "$ITEM9_BACKEND" = "mocp" ]; then
|
||||
if [ -e "${BINDIR}mocp" ]; then
|
||||
if [ "$(echo $(mocp -Q %file))" != "" ]; then
|
||||
echo "$SEP $ITEM9_ICON $(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ -e "${BINDIR}cmus-remote" ]; then
|
||||
if [ "$(cmus-remote -C status | head -n 1 | awk '{ print $2 }')" = "playing" ]; then
|
||||
echo "$SEP $ITEM9_ICON $(basename "$(cmus-remote -C status | grep file)"| sed 's|\(.*\)[.].*|\1|')"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Newsboat unreads
|
||||
ITEM10() {
|
||||
if [ "$ENABLE_ITEM10" = "true" ]; then
|
||||
if [ -e "${BINDIR}newsboat" ]; then
|
||||
pgrep -x newsboat > /dev/null || echo "$SEP $ITEM10_ICON $(newsboat -x print-unread | sed "s| unread articles||") unread!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Battery percentage/charging status
|
||||
ITEM11() {
|
||||
if [ "$ENABLE_ITEM11" = "true" ]; then
|
||||
if [ -e "/sys/class/power_supply/BAT0/capacity" ]; then
|
||||
echo "$SEP $ITEM11_ICON $(cat /sys/class/power_supply/BAT0/capacity)%"
|
||||
fi
|
||||
|
||||
if [ -e "${BINDIR}acpi" ]; then
|
||||
CHARGESTATUS=$(echo ", $(acpi | awk '{ print $3 }' | sed "s|,||g" | sed "s|Discharging|Not charging|g")") && echo $CHARGESTATUS
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# IRC #ff backlogs
|
||||
ITEM12() {
|
||||
if [ "$ENABLE_ITEM12" = "true" ]; then
|
||||
if [ -e "${BINDIR}curl" ]; then
|
||||
curl -so /tmp/ff-backlogs https://donut.gq/ff/read.php
|
||||
if [ -e "/tmp/ff-backlogs" ]; then
|
||||
echo "$SEP $ITEM12_ICON $(cat /tmp/ff-backlogs | tail -n 1)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
BASE() {
|
||||
# Determine whether or not
|
||||
if [ "$USEWAL" = "true" ]; then
|
||||
if [ "$USINGWAL" = "true" ]; then
|
||||
if [ "$COLOR1" != "$(sed 1,1p $HOME/.cache/wal/colors)" ]; then
|
||||
SETCOLORS_WAL && SETCOLORS_CMD
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run once if set to false (useful for maybe a shell)
|
||||
case "$RUNONCE" in
|
||||
"false") PRINT_SYSTRAY && sleep $SLEEPTIME ;;
|
||||
"true") exit 0 ;;
|
||||
esac
|
||||
|
||||
BASE
|
||||
}
|
||||
|
||||
# Set base colors
|
||||
SETCOLORS
|
||||
|
||||
# Use pywal once if possible
|
||||
USE_PYWAL_COLORS() {
|
||||
if [ -e "${BINDIR}xsetroot" ]; then
|
||||
if [ -e "${BINDIR}xrdb" ]; then
|
||||
if [ "$USEWAL" = "true" ]; then
|
||||
wal -v > /dev/null && SETCOLORS_WAL
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
LOADCONFIG
|
||||
USE_PYWAL_COLORS
|
||||
SETCOLORS_CMD
|
||||
PRINT_SYSTRAY
|
||||
BASE
|
||||
|
||||
exit 0
|
42
transient.c
Normal file
42
transient.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* cc transient.c -o transient -lX11 */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
int main(void) {
|
||||
Display *d;
|
||||
Window r, f, t = None;
|
||||
XSizeHints h;
|
||||
XEvent e;
|
||||
|
||||
d = XOpenDisplay(NULL);
|
||||
if (!d)
|
||||
exit(1);
|
||||
r = DefaultRootWindow(d);
|
||||
|
||||
f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
|
||||
h.min_width = h.max_width = h.min_height = h.max_height = 400;
|
||||
h.flags = PMinSize | PMaxSize;
|
||||
XSetWMNormalHints(d, f, &h);
|
||||
XStoreName(d, f, "floating");
|
||||
XMapWindow(d, f);
|
||||
|
||||
XSelectInput(d, f, ExposureMask);
|
||||
while (1) {
|
||||
XNextEvent(d, &e);
|
||||
|
||||
if (t == None) {
|
||||
sleep(5);
|
||||
t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
|
||||
XSetTransientForHint(d, t, f);
|
||||
XStoreName(d, t, "transient");
|
||||
XMapWindow(d, t);
|
||||
XSelectInput(d, t, ExposureMask);
|
||||
}
|
||||
}
|
||||
|
||||
XCloseDisplay(d);
|
||||
exit(0);
|
||||
}
|
35
util.c
Normal file
35
util.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
void *
|
||||
ecalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if (!(p = calloc(nmemb, size)))
|
||||
die("calloc:");
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
die(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
||||
fputc(' ', stderr);
|
||||
perror(NULL);
|
||||
} else {
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
8
util.h
Normal file
8
util.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
||||
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
|
||||
|
||||
void die(const char *fmt, ...);
|
||||
void *ecalloc(size_t nmemb, size_t size);
|
171
xresources.h
Normal file
171
xresources.h
Normal file
|
@ -0,0 +1,171 @@
|
|||
/*
|
||||
* Xresources preferences to load at startup
|
||||
* You can add more if you know what you're doing.
|
||||
*
|
||||
* When you're done with your edits, run 'make clean install'.
|
||||
*
|
||||
* Value in .Xresources Type Value internally */
|
||||
ResourcePref resources[] = {
|
||||
{ "font", STRING, &font },
|
||||
{ "font2", STRING, &font2 },
|
||||
{ "font3", STRING, &font3 },
|
||||
{ "col_background", STRING, &col_background },
|
||||
{ "col_backgroundmid", STRING, &col_backgroundmid },
|
||||
{ "col_windowbordersel", STRING, &col_windowbordersel },
|
||||
{ "col_windowbordernorm", STRING, &col_windowbordernorm },
|
||||
{ "col_layoutbgsel", STRING, &col_layoutbgsel },
|
||||
{ "col_layoutbgnorm", STRING, &col_layoutbgnorm },
|
||||
{ "col_layouttext", STRING, &col_layouttext },
|
||||
{ "col_textnorm", STRING, &col_textnorm },
|
||||
{ "col_textsel", STRING, &col_textsel },
|
||||
{ "col_tag1", STRING, &col_tag1 },
|
||||
{ "col_tag1_text", STRING, &col_tag1_text },
|
||||
{ "col_tag2", STRING, &col_tag2 },
|
||||
{ "col_tag2_text", STRING, &col_tag2_text },
|
||||
{ "col_tag3", STRING, &col_tag3 },
|
||||
{ "col_tag3_text", STRING, &col_tag3_text },
|
||||
{ "col_tag4", STRING, &col_tag4 },
|
||||
{ "col_tag4_text", STRING, &col_tag4_text },
|
||||
{ "col_tag5", STRING, &col_tag5 },
|
||||
{ "col_tag5_text", STRING, &col_tag5_text },
|
||||
{ "col_tag6", STRING, &col_tag6 },
|
||||
{ "col_tag6_text", STRING, &col_tag6_text },
|
||||
{ "col_tag7", STRING, &col_tag7 },
|
||||
{ "col_tag7_text", STRING, &col_tag7_text },
|
||||
{ "col_tag8", STRING, &col_tag8 },
|
||||
{ "col_tag8_text", STRING, &col_tag8_text },
|
||||
{ "col_tag9", STRING, &col_tag9 },
|
||||
{ "col_tag9_text", STRING, &col_tag9_text },
|
||||
{ "col_status0", STRING, &col_status0 },
|
||||
{ "col_status1", STRING, &col_status1 },
|
||||
{ "col_status2", STRING, &col_status2 },
|
||||
{ "col_status3", STRING, &col_status3 },
|
||||
{ "col_status4", STRING, &col_status4 },
|
||||
{ "col_status5", STRING, &col_status5 },
|
||||
{ "col_status6", STRING, &col_status6 },
|
||||
{ "col_status7", STRING, &col_status7 },
|
||||
{ "col_status8", STRING, &col_status8 },
|
||||
{ "col_status9", STRING, &col_status9 },
|
||||
{ "col_status10", STRING, &col_status10 },
|
||||
{ "col_status11", STRING, &col_status11 },
|
||||
{ "col_status12", STRING, &col_status12 },
|
||||
{ "col_status13", STRING, &col_status13 },
|
||||
{ "col_status14", STRING, &col_status14 },
|
||||
{ "col_status15", STRING, &col_status15 },
|
||||
|
||||
/* pywal support */
|
||||
{ "color0", STRING, &col_background },
|
||||
{ "color4", STRING, &col_backgroundmid },
|
||||
{ "color8", STRING, &col_windowbordersel },
|
||||
{ "color0", STRING, &col_windowbordernorm },
|
||||
{ "color4", STRING, &col_textnorm },
|
||||
{ "color0", STRING, &col_textsel },
|
||||
{ "color0", STRING, &col_layouttext },
|
||||
{ "color2", STRING, &col_layoutbgnorm },
|
||||
{ "color4", STRING, &col_layoutbgsel },
|
||||
{ "color1", STRING, &col_tag1 },
|
||||
{ "color0", STRING, &col_tag1_text },
|
||||
{ "color2", STRING, &col_tag2 },
|
||||
{ "color0", STRING, &col_tag2_text },
|
||||
{ "color3", STRING, &col_tag3 },
|
||||
{ "color0", STRING, &col_tag3_text },
|
||||
{ "color4", STRING, &col_tag4 },
|
||||
{ "color0", STRING, &col_tag4_text },
|
||||
{ "color5", STRING, &col_tag5 },
|
||||
{ "color0", STRING, &col_tag5_text },
|
||||
{ "color6", STRING, &col_tag6 },
|
||||
{ "color0", STRING, &col_tag6_text },
|
||||
{ "color7", STRING, &col_tag7 },
|
||||
{ "color0", STRING, &col_tag7_text },
|
||||
{ "color8", STRING, &col_tag8 },
|
||||
{ "color0", STRING, &col_tag8_text },
|
||||
{ "color9", STRING, &col_tag9 },
|
||||
{ "color0", STRING, &col_tag9_text },
|
||||
{ "color0", STRING, &col_status0 },
|
||||
{ "color1", STRING, &col_status1 },
|
||||
{ "color2", STRING, &col_status2 },
|
||||
{ "color3", STRING, &col_status3 },
|
||||
{ "color4", STRING, &col_status4 },
|
||||
{ "color5", STRING, &col_status5 },
|
||||
{ "color6", STRING, &col_status6 },
|
||||
{ "color7", STRING, &col_status7 },
|
||||
{ "color8", STRING, &col_status8 },
|
||||
{ "color9", STRING, &col_status9 },
|
||||
{ "color10", STRING, &col_status10 },
|
||||
{ "color11", STRING, &col_status11 },
|
||||
{ "color12", STRING, &col_status12 },
|
||||
{ "color13", STRING, &col_status13 },
|
||||
{ "color14", STRING, &col_status14 },
|
||||
{ "color15", STRING, &col_status15 },
|
||||
|
||||
{ "shell", STRING, &shell },
|
||||
{ "status", STRING, &status },
|
||||
{ "defaultname", STRING, &defaultname },
|
||||
{ "monocleformat", STRING, &monocleformat },
|
||||
{ "deckformat", STRING, &deckformat },
|
||||
{ "altbarclass", STRING, &altbarclass },
|
||||
{ "altbarcmd", STRING, &altbarcmd },
|
||||
{ "alttrayname", STRING, &alttrayname },
|
||||
{ "lockfullscreen", INTEGER, &lockfullscreen },
|
||||
{ "movefullscreenmon", INTEGER, &movefullscreenmon },
|
||||
{ "refreshrules", INTEGER, &refreshrules },
|
||||
{ "borderpx", INTEGER, &borderpx },
|
||||
{ "snap", INTEGER, &snap },
|
||||
{ "showbar", INTEGER, &showbar },
|
||||
{ "nmaster", INTEGER, &nmaster },
|
||||
{ "attachdirection", INTEGER, &attachdirection },
|
||||
{ "resizehints", INTEGER, &resizehints },
|
||||
{ "startontag", INTEGER, &startontag },
|
||||
{ "sizeicon", INTEGER, &sizeicon },
|
||||
{ "decorhints", INTEGER, &decorhints },
|
||||
{ "swallowclients", INTEGER, &swallowclients },
|
||||
{ "swallowfloating", INTEGER, &swallowfloating },
|
||||
{ "barpaddingv", INTEGER, &barpaddingv },
|
||||
{ "barpaddingh", INTEGER, &barpaddingh },
|
||||
{ "barheight", INTEGER, &barheight },
|
||||
{ "centerfloating", INTEGER, ¢erfloating },
|
||||
{ "savefloat", INTEGER, &savefloat },
|
||||
{ "warpcursor", INTEGER, &warpcursor },
|
||||
{ "pertag", INTEGER, &pertag },
|
||||
{ "i3nmaster", INTEGER, &i3nmaster },
|
||||
{ "monocleclientcount", INTEGER, &monocleclientcount },
|
||||
{ "monoclecount", INTEGER, &monoclecount },
|
||||
{ "scalepreview", INTEGER, &scalepreview },
|
||||
{ "tagpreview", INTEGER, &tagpreview },
|
||||
{ "mousepreview", INTEGER, &mousepreview },
|
||||
{ "leftlayout", INTEGER, &leftlayout },
|
||||
{ "hidelayout", INTEGER, &hidelayout },
|
||||
{ "hidetitle", INTEGER, &hidetitle },
|
||||
{ "hidetags", INTEGER, &hidetags },
|
||||
{ "hidestatus", INTEGER, &hidestatus },
|
||||
{ "hidesticky", INTEGER, &hidesticky },
|
||||
{ "hidefloating", INTEGER, &hidefloating },
|
||||
{ "statusallmons", INTEGER, &statusallmons },
|
||||
{ "fadeinactive", INTEGER, &fadeinactive },
|
||||
{ "stairpx", INTEGER, &stairpx },
|
||||
{ "stairdirection", INTEGER, &stairdirection },
|
||||
{ "stairsamesize", INTEGER, &stairsamesize },
|
||||
{ "deckcount", INTEGER, &deckcount },
|
||||
{ "defaultlayout", INTEGER, &defaultlayout },
|
||||
{ "wmclass", INTEGER, &wmclass },
|
||||
{ "clicktofocus", INTEGER, &clicktofocus },
|
||||
{ "roundedcorners", INTEGER, &roundedcorners },
|
||||
{ "cornerradius", INTEGER, &cornerradius },
|
||||
{ "underline", INTEGER, &underline },
|
||||
{ "underlinepad", INTEGER, &underlinepad },
|
||||
{ "underlinestroke", INTEGER, &underlinestroke },
|
||||
{ "underlinevoffset", INTEGER, &underlinevoffset },
|
||||
{ "enablegaps", INTEGER, &enablegaps },
|
||||
{ "gappih", INTEGER, &gappih },
|
||||
{ "gappiv", INTEGER, &gappiv },
|
||||
{ "gappoh", INTEGER, &gappoh },
|
||||
{ "gappov", INTEGER, &gappov },
|
||||
{ "smartgaps", INTEGER, &smartgaps },
|
||||
{ "smartgapsize", INTEGER, &smartgapsize },
|
||||
{ "forcevsplit", INTEGER, &forcevsplit },
|
||||
{ "mousemfact", INTEGER, &mousemfact },
|
||||
{ "floatscratchpad", INTEGER, &floatscratchpad },
|
||||
{ "altbar", INTEGER, &altbar },
|
||||
{ "mfact", FLOAT, &mfact },
|
||||
/* value in .Xresources type value in speedwm */
|
||||
};
|
Loading…
Reference in a new issue