├── .gitignore ├── .wallpapers ├── 001.jpg ├── 002.png ├── 003.png ├── 004.png ├── 005.jpg ├── 006.jpg ├── 007.jpg ├── 008.png ├── 009.png ├── 010.jpg ├── 010.png ├── 011.png ├── 012.png ├── 013.png ├── 014.png ├── 015.png ├── 016.png ├── 017.png ├── 018.jpg ├── 018.png ├── 019.jpg ├── 019.png ├── 020.jpg ├── 021.jpg ├── 021.png ├── 022.jpg ├── 022.png ├── 023.png ├── 024.jpg ├── 025.jpg └── 026.jpg ├── README.md ├── autostart.sh ├── dmenu ├── LICENSE ├── Makefile ├── README ├── arg.h ├── colorschemes │ ├── catppuccin.h │ ├── everforest.h │ └── gruvbox.h ├── config.def.h ├── config.def.h.orig ├── config.def.h.rej ├── config.h ├── config.mk ├── dmenu ├── dmenu.1 ├── dmenu.1.orig ├── dmenu.c ├── dmenu.c.orig ├── dmenu.c.rej ├── dmenu.o ├── dmenu_path ├── dmenu_run ├── drw.c ├── drw.h ├── drw.o ├── patches │ ├── dmenu-border-4.9.diff │ ├── dmenu-caseinsensitive-20200523-db6093f.diff │ ├── dmenu-center-20200111-8cd37e1.diff │ ├── dmenu-fuzzyhighlight-4.9.diff │ ├── dmenu-grid-4.9.diff │ └── dmenu-lineheight-5.0.diff ├── stest ├── stest.1 ├── stest.c ├── stest.o ├── util.c ├── util.h └── util.o ├── dunst └── dunstrc ├── dwm ├── LICENSE ├── Makefile ├── README ├── XF86keysym.h ├── colorschemes │ ├── bananaTime.h │ ├── catppuccin.h │ ├── darkGT.h │ ├── doomOne.h │ ├── dracula.h │ ├── everforest.h │ ├── gruvbox.h │ ├── kanagawa.h │ ├── monokai.h │ ├── ocean.h │ ├── onedark.h │ ├── papercolor.h │ └── thwarted-summer-shower.h ├── config.def.h ├── config.def.h.orig ├── config.def.h.rej ├── config.h ├── config.mk ├── config.mk.orig ├── drw.c ├── drw.c.orig ├── drw.h ├── drw.h.orig ├── drw.o ├── dwm ├── dwm.1 ├── dwm.1.orig ├── dwm.c ├── dwm.c.orig ├── dwm.c.rej ├── dwm.o ├── dwm.png ├── patches │ ├── dwm-alwayscenter-20200625-f04cac6.diff │ ├── dwm-attachbottom-20201227-61bb8b2.diff │ ├── dwm-autostart-20210120-cb3f58a.diff │ ├── dwm-pertag-20200914-61bb8b2.diff │ ├── dwm-preserveonrestart-6.3.diff │ ├── dwm-restartsig-20180523-6.2.diff │ ├── dwm-rotatestack-20161021-ab9571b.diff │ ├── dwm-stairs-20220430-8b48e30.diff │ ├── dwm-status2d-systray-6.4.diff │ ├── dwm-systray-6.4.diff │ ├── dwm-titlecolor-20210815-ed3ab6b4.diff │ ├── dwm-vanitygaps-6.2.diff │ └── dwm-winicon-6.3-v2.1.diff ├── scripts │ ├── brightnessnotifications.sh │ ├── browserbookmarks.sh │ ├── config.sh │ ├── powermenu.sh │ └── volumenotifications.sh ├── transient.c ├── util.c ├── util.h ├── util.o └── vanitygaps.c ├── img ├── s1.png ├── s2.png └── s3.png ├── script.sh ├── slock ├── LICENSE ├── Makefile ├── README ├── arg.h ├── config.def.h ├── config.def.h.orig ├── config.h ├── config.mk ├── explicit_bzero.c ├── explicit_bzero.o ├── patches │ ├── slock-capscolor-20170106-2d2a21a.diff │ └── slock-message-20191002-b46028b.diff ├── slock ├── slock.1 ├── slock.c ├── slock.c.orig ├── slock.o └── util.h ├── slstatus ├── LICENSE ├── Makefile ├── README ├── arg.h ├── components │ ├── battery.c │ ├── battery.o │ ├── cpu.c │ ├── cpu.o │ ├── datetime.c │ ├── datetime.o │ ├── disk.c │ ├── disk.o │ ├── entropy.c │ ├── entropy.o │ ├── hostname.c │ ├── hostname.o │ ├── ip.c │ ├── ip.o │ ├── kernel_release.c │ ├── kernel_release.o │ ├── keyboard_indicators.c │ ├── keyboard_indicators.o │ ├── keymap.c │ ├── keymap.o │ ├── load_avg.c │ ├── load_avg.o │ ├── netspeeds.c │ ├── netspeeds.o │ ├── num_files.c │ ├── num_files.o │ ├── ram.c │ ├── ram.o │ ├── run_command.c │ ├── run_command.o │ ├── separator.c │ ├── separator.o │ ├── swap.c │ ├── swap.o │ ├── temperature.c │ ├── temperature.o │ ├── uptime.c │ ├── uptime.o │ ├── user.c │ ├── user.o │ ├── volume.c │ ├── volume.o │ ├── wifi.c │ └── wifi.o ├── config.def.h ├── config.h ├── config.mk ├── slstatus ├── slstatus.1 ├── slstatus.c ├── slstatus.h ├── slstatus.o ├── util.c ├── util.h └── util.o └── st ├── FAQ ├── LEGACY ├── LICENSE ├── Makefile ├── README ├── TODO ├── arg.h ├── colorschemes ├── bananaTime.h ├── catppuccin.h ├── dracula.h └── gruvbox.h ├── config.def.h ├── config.def.h.orig ├── config.def.h.rej ├── config.h ├── config.mk ├── patches ├── st-alpha-20220206-0.8.5.diff ├── st-font2-20190326-f64c2f8.diff ├── st-glyph-wide-support-20220411-ef05519.diff ├── st-scrollback-20210507-4536f46.diff └── st-scrollback-mouse-20220127-2c5edf2.diff ├── st ├── st.1 ├── st.c ├── st.c.orig ├── st.h ├── st.info ├── st.o ├── win.h ├── x.c ├── x.c.orig ├── x.c.rej └── x.o /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.gitignore -------------------------------------------------------------------------------- /.wallpapers/001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/001.jpg -------------------------------------------------------------------------------- /.wallpapers/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/002.png -------------------------------------------------------------------------------- /.wallpapers/003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/003.png -------------------------------------------------------------------------------- /.wallpapers/004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/004.png -------------------------------------------------------------------------------- /.wallpapers/005.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/005.jpg -------------------------------------------------------------------------------- /.wallpapers/006.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/006.jpg -------------------------------------------------------------------------------- /.wallpapers/007.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/007.jpg -------------------------------------------------------------------------------- /.wallpapers/008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/008.png -------------------------------------------------------------------------------- /.wallpapers/009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/009.png -------------------------------------------------------------------------------- /.wallpapers/010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/010.jpg -------------------------------------------------------------------------------- /.wallpapers/010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/010.png -------------------------------------------------------------------------------- /.wallpapers/011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/011.png -------------------------------------------------------------------------------- /.wallpapers/012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/012.png -------------------------------------------------------------------------------- /.wallpapers/013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/013.png -------------------------------------------------------------------------------- /.wallpapers/014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/014.png -------------------------------------------------------------------------------- /.wallpapers/015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/015.png -------------------------------------------------------------------------------- /.wallpapers/016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/016.png -------------------------------------------------------------------------------- /.wallpapers/017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/017.png -------------------------------------------------------------------------------- /.wallpapers/018.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/018.jpg -------------------------------------------------------------------------------- /.wallpapers/018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/018.png -------------------------------------------------------------------------------- /.wallpapers/019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/019.jpg -------------------------------------------------------------------------------- /.wallpapers/019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/019.png -------------------------------------------------------------------------------- /.wallpapers/020.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/020.jpg -------------------------------------------------------------------------------- /.wallpapers/021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/021.jpg -------------------------------------------------------------------------------- /.wallpapers/021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/021.png -------------------------------------------------------------------------------- /.wallpapers/022.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/022.jpg -------------------------------------------------------------------------------- /.wallpapers/022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/022.png -------------------------------------------------------------------------------- /.wallpapers/023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/023.png -------------------------------------------------------------------------------- /.wallpapers/024.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/024.jpg -------------------------------------------------------------------------------- /.wallpapers/025.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/025.jpg -------------------------------------------------------------------------------- /.wallpapers/026.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/.wallpapers/026.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arch ❤️ DWM 2 | 3 | ### All in one suckless tools(dwm, dmenu, st, slstatus, slock) 4 | 5 | ![Alt text](/img/s1.png?raw=true "First image") 6 | ![Alt text](/img/s2.png?raw=true "Second image") 7 | ![Alt text](/img/s3.png?raw=true "Third image") 8 | 9 | #### What i use: 10 | 11 | - **Feh** as wallpapers manager 12 | - **dunst** as notifications manager (include config) 13 | - **flameshot** for screenshots 14 | - **brightnessctl** and **pamixer** for volume and brightness control 15 | - **playerctl** for multimedia control 16 | - **[Ubuntu Mono Nerd Font](https://archlinux.org/packages/community/any/ttf-ubuntumono-nerd/)** & **[JetBrainsMono Font](https://archlinux.org/packages/community/any/ttf-jetbrains-mono/)** - as fonts 17 | - **picom** - as compositor(i use fork from [pijulius](https://github.com/pijulius)) 18 | 19 | #### Installation 20 | 21 | 1. Install `git` 22 | 23 | ``` 24 | sudo pacman -Sy git 25 | ``` 26 | 27 | 2. Copy this repository to home folder 28 | 29 | ``` 30 | cd $HOME 31 | sudo git clone https://github.com/octagony/dwm-config-files.git 32 | ``` 33 | 34 | 3. Make `script.sh` executable and run it 35 | 36 | ``` 37 | sudo chmod +x script.sh 38 | ./script.sh 39 | ``` 40 | 41 | 4. **(Optional)** By default, script does not check for `.desktop` files in `xsessions` folder. If you use display manager(like sddm or others), add `dwm.desktop` file in `xsessions` folder with following content: 42 | 43 | ``` 44 | [Desktop Entry] 45 | Name=DWM 46 | Comment=Dynamic Window Manager 47 | Exec=dwm 48 | Type=Application 49 | ``` 50 | 51 | #### Feh directory (for backgrounds): 52 | 53 | ``` 54 | /home/{user_name}/.wallpapers 55 | ``` 56 | 57 | #### DWM Patches: 58 | 59 | - **alwayscenter** 60 | - **attachbottom** 61 | - **autostart** 62 | - **pertag** 63 | - **preserveonrestart** 64 | - **restartsig** 65 | - **rotatestack** 66 | - **stairs** 67 | - **status2d** 68 | - **status2d-systray** 69 | - **titlecolor** 70 | - **vanitygaps** 71 | - **winicon** 72 | 73 | #### DMenu Patches: 74 | 75 | - **border** 76 | - **caseinsensitive** 77 | - **center** 78 | - **fuzzyhighlight** 79 | - **grid** 80 | - **lineheight** 81 | 82 | #### St Patches: 83 | 84 | - **alpha** 85 | - **font2** 86 | - **glyph-wide-support** 87 | - **scrollback-mouse** 88 | 89 | #### Slock Patches: 90 | 91 | - **capscolor** 92 | - **message** 93 | -------------------------------------------------------------------------------- /autostart.sh: -------------------------------------------------------------------------------- 1 | # Setup Feh 2 | feh --bg-fill --randomize ~/.wallpapers/* 3 | 4 | #Setup Picom 5 | "$HOME"/.config/picom/build/src/./picom -b --animations --animation-window-mass 0.5 --animation-for-open-window zoom --animation-stiffness 500 & 6 | 7 | #Exec slstatus 8 | exec slstatus & 9 | 10 | #Exec dunst 11 | exec dunst & 12 | 13 | #Helper for keyboard layout 14 | setxkbmap -model pc105 -layout us,ru -option grp:alt_shift_toggle 15 | -------------------------------------------------------------------------------- /dmenu/LICENSE: -------------------------------------------------------------------------------- 1 | MIT/X Consortium License 2 | 3 | © 2006-2019 Anselm R Garbe 4 | © 2006-2008 Sander van Dijk 5 | © 2006-2007 Michał Janeczek 6 | © 2007 Kris Maglione 7 | © 2009 Gottox 8 | © 2009 Markus Schnalke 9 | © 2009 Evan Gates 10 | © 2010-2012 Connor Lane Smith 11 | © 2014-2022 Hiltjo Posthuma 12 | © 2015-2019 Quentin Rameau 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a 15 | copy of this software and associated documentation files (the "Software"), 16 | to deal in the Software without restriction, including without limitation 17 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 18 | and/or sell copies of the Software, and to permit persons to whom the 19 | Software is furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 27 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 29 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 30 | DEALINGS IN THE SOFTWARE. 31 | -------------------------------------------------------------------------------- /dmenu/Makefile: -------------------------------------------------------------------------------- 1 | # dmenu - dynamic menu 2 | # See LICENSE file for copyright and license details. 3 | 4 | include config.mk 5 | 6 | SRC = drw.c dmenu.c stest.c util.c 7 | OBJ = $(SRC:.c=.o) 8 | 9 | all: options dmenu stest 10 | 11 | options: 12 | @echo dmenu build options: 13 | @echo "CFLAGS = $(CFLAGS)" 14 | @echo "LDFLAGS = $(LDFLAGS)" 15 | @echo "CC = $(CC)" 16 | 17 | .c.o: 18 | $(CC) -c $(CFLAGS) $< 19 | 20 | config.h: 21 | cp config.def.h $@ 22 | 23 | $(OBJ): arg.h config.h config.mk drw.h 24 | 25 | dmenu: dmenu.o drw.o util.o 26 | $(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS) 27 | 28 | stest: stest.o 29 | $(CC) -o $@ stest.o $(LDFLAGS) 30 | 31 | clean: 32 | rm -f dmenu stest $(OBJ) dmenu-$(VERSION).tar.gz 33 | 34 | dist: clean 35 | mkdir -p dmenu-$(VERSION) 36 | cp LICENSE Makefile README arg.h config.def.h config.mk dmenu.1\ 37 | drw.h util.h dmenu_path dmenu_run stest.1 $(SRC)\ 38 | dmenu-$(VERSION) 39 | tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION) 40 | gzip dmenu-$(VERSION).tar 41 | rm -rf dmenu-$(VERSION) 42 | 43 | install: all 44 | mkdir -p $(DESTDIR)$(PREFIX)/bin 45 | cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin 46 | chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu 47 | chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path 48 | chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run 49 | chmod 755 $(DESTDIR)$(PREFIX)/bin/stest 50 | mkdir -p $(DESTDIR)$(MANPREFIX)/man1 51 | sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 52 | sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1 53 | chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 54 | chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1 55 | 56 | uninstall: 57 | rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\ 58 | $(DESTDIR)$(PREFIX)/bin/dmenu_path\ 59 | $(DESTDIR)$(PREFIX)/bin/dmenu_run\ 60 | $(DESTDIR)$(PREFIX)/bin/stest\ 61 | $(DESTDIR)$(MANPREFIX)/man1/dmenu.1\ 62 | $(DESTDIR)$(MANPREFIX)/man1/stest.1 63 | 64 | .PHONY: all options clean dist install uninstall 65 | -------------------------------------------------------------------------------- /dmenu/README: -------------------------------------------------------------------------------- 1 | dmenu - dynamic menu 2 | ==================== 3 | dmenu is an efficient dynamic menu for X. 4 | 5 | 6 | Requirements 7 | ------------ 8 | In order to build dmenu you need the Xlib header files. 9 | 10 | 11 | Installation 12 | ------------ 13 | Edit config.mk to match your local setup (dmenu is installed into 14 | the /usr/local namespace by default). 15 | 16 | Afterwards enter the following command to build and install dmenu 17 | (if necessary as root): 18 | 19 | make clean install 20 | 21 | 22 | Running dmenu 23 | ------------- 24 | See the man page for details. 25 | -------------------------------------------------------------------------------- /dmenu/arg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copy me if you can. 3 | * by 20h 4 | */ 5 | 6 | #ifndef ARG_H__ 7 | #define ARG_H__ 8 | 9 | extern char *argv0; 10 | 11 | /* use main(int argc, char *argv[]) */ 12 | #define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ 13 | argv[0] && argv[0][0] == '-'\ 14 | && argv[0][1];\ 15 | argc--, argv++) {\ 16 | char argc_;\ 17 | char **argv_;\ 18 | int brk_;\ 19 | if (argv[0][1] == '-' && argv[0][2] == '\0') {\ 20 | argv++;\ 21 | argc--;\ 22 | break;\ 23 | }\ 24 | for (brk_ = 0, argv[0]++, argv_ = argv;\ 25 | argv[0][0] && !brk_;\ 26 | argv[0]++) {\ 27 | if (argv_ != argv)\ 28 | break;\ 29 | argc_ = argv[0][0];\ 30 | switch (argc_) 31 | 32 | #define ARGEND }\ 33 | } 34 | 35 | #define ARGC() argc_ 36 | 37 | #define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\ 38 | ((x), abort(), (char *)0) :\ 39 | (brk_ = 1, (argv[0][1] != '\0')?\ 40 | (&argv[0][1]) :\ 41 | (argc--, argv++, argv[0]))) 42 | 43 | #define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\ 44 | (char *)0 :\ 45 | (brk_ = 1, (argv[0][1] != '\0')?\ 46 | (&argv[0][1]) :\ 47 | (argc--, argv++, argv[0]))) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /dmenu/colorschemes/catppuccin.h: -------------------------------------------------------------------------------- 1 | static const char *colors[SchemeLast][2] = { 2 | /* fg bg */ 3 | [SchemeNorm] = { "#cdd6f4", "#1e1e2e" }, 4 | [SchemeSel] = { "#1e1e2e", "#cba6f7" }, 5 | [SchemeOut] = { "#000000", "#cba6f7" }, 6 | }; 7 | -------------------------------------------------------------------------------- /dmenu/colorschemes/everforest.h: -------------------------------------------------------------------------------- 1 | static const char *colors[SchemeLast][2] = { 2 | /* fg bg */ 3 | [SchemeNorm] = { "#d3c6aa", "#1e2326" }, 4 | [SchemeSel] = { "#1e2326", "#d3c6aa" }, 5 | [SchemeOut] = { "#7a8478", "#1e2326" }, 6 | }; 7 | -------------------------------------------------------------------------------- /dmenu/colorschemes/gruvbox.h: -------------------------------------------------------------------------------- 1 | static const char *colors[SchemeLast][2] = { 2 | /* fg bg */ 3 | [SchemeNorm] = { "#ebdbb2", "#282828" }, 4 | [SchemeSel] = { "#ebdbb2", "#689d6a" }, 5 | [SchemeOut] = { "#ebdbb2", "#8ec07c" }, 6 | }; 7 | -------------------------------------------------------------------------------- /dmenu/config.def.h: -------------------------------------------------------------------------------- 1 | #include "./colorschemes/catppuccin.h" 2 | 3 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 4 | static int centered = 0; /* -c option; centers dmenu on screen */ 5 | static int min_width = 1000; /* minimum width when centered */ 6 | /* -fn option overrides fonts[0]; default X11 font or font set */ 7 | static const char *fonts[] = { 8 | "JetBrainsMonoNL:size=14:antialias=true:hinting=true" 9 | }; 10 | static const char *prompt = "You again?"; /* -p option; prompt to the left of input field */ 11 | static unsigned int lines = 0; 12 | static unsigned int columns = 0; 13 | /* -h option; minimum height of a menu line */ 14 | static unsigned int lineheight = 0; 15 | static unsigned int min_lineheight = 8; 16 | 17 | /* 18 | * Characters not considered part of a word while deleting words 19 | * for example: " /?\"&[]" 20 | */ 21 | static const char worddelimiters[] = " "; 22 | 23 | /* Size of the window border */ 24 | static const unsigned int border_width = 2; 25 | -------------------------------------------------------------------------------- /dmenu/config.def.h.orig: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | /* Default settings; can be overriden by command line. */ 3 | 4 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 5 | static int centered = 0; /* -c option; centers dmenu on screen */ 6 | static int min_width = 500; /* minimum width when centered */ 7 | /* -fn option overrides fonts[0]; default X11 font or font set */ 8 | static const char *fonts[] = { 9 | "monospace:size=10" 10 | }; 11 | static const char *prompt = NULL; /* -p option; prompt to the left of input field */ 12 | static const char *colors[SchemeLast][2] = { 13 | /* fg bg */ 14 | [SchemeNorm] = { "#bbbbbb", "#222222" }, 15 | [SchemeSel] = { "#eeeeee", "#005577" }, 16 | [SchemeSelHighlight] = { "#ffc978", "#005577" }, 17 | [SchemeNormHighlight] = { "#ffc978", "#222222" }, 18 | [SchemeOut] = { "#000000", "#00ffff" }, 19 | }; 20 | /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ 21 | static unsigned int lines = 0; 22 | /* -h option; minimum height of a menu line */ 23 | static unsigned int lineheight = 0; 24 | static unsigned int min_lineheight = 8; 25 | 26 | /* 27 | * Characters not considered part of a word while deleting words 28 | * for example: " /?\"&[]" 29 | */ 30 | static const char worddelimiters[] = " "; 31 | 32 | /* Size of the window border */ 33 | static const unsigned int border_width = 5; 34 | -------------------------------------------------------------------------------- /dmenu/config.def.h.rej: -------------------------------------------------------------------------------- 1 | --- config.def.h 2 | +++ config.def.h 3 | @@ -13,8 +13,9 @@ static const char *colors[SchemeLast][2] = { 4 | [SchemeSel] = { "#eeeeee", "#005577" }, 5 | [SchemeOut] = { "#000000", "#00ffff" }, 6 | }; 7 | -/* -l option; if nonzero, dmenu uses vertical list with given number of lines */ 8 | +/* -l and -g options; controls number of lines and columns in grid if > 0 */ 9 | static unsigned int lines = 0; 10 | +static unsigned int columns = 0; 11 | 12 | /* 13 | * Characters not considered part of a word while deleting words 14 | -------------------------------------------------------------------------------- /dmenu/config.h: -------------------------------------------------------------------------------- 1 | #include "./colorschemes/catppuccin.h" 2 | 3 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 4 | static int centered = 0; /* -c option; centers dmenu on screen */ 5 | static int min_width = 1000; /* minimum width when centered */ 6 | /* -fn option overrides fonts[0]; default X11 font or font set */ 7 | static const char *fonts[] = { 8 | "JetBrainsMonoNL:size=14:antialias=true:hinting=true" 9 | }; 10 | static const char *prompt = "You again?"; /* -p option; prompt to the left of input field */ 11 | static unsigned int lines = 0; 12 | static unsigned int columns = 0; 13 | /* -h option; minimum height of a menu line */ 14 | static unsigned int lineheight = 0; 15 | static unsigned int min_lineheight = 8; 16 | 17 | /* 18 | * Characters not considered part of a word while deleting words 19 | * for example: " /?\"&[]" 20 | */ 21 | static const char worddelimiters[] = " "; 22 | 23 | /* Size of the window border */ 24 | static const unsigned int border_width = 2; 25 | -------------------------------------------------------------------------------- /dmenu/config.mk: -------------------------------------------------------------------------------- 1 | # dmenu version 2 | VERSION = 5.2 3 | 4 | # paths 5 | PREFIX = /usr/local 6 | MANPREFIX = $(PREFIX)/share/man 7 | 8 | X11INC = /usr/X11R6/include 9 | X11LIB = /usr/X11R6/lib 10 | 11 | # Xinerama, comment if you don't want it 12 | XINERAMALIBS = -lXinerama 13 | XINERAMAFLAGS = -DXINERAMA 14 | 15 | # freetype 16 | FREETYPELIBS = -lfontconfig -lXft 17 | FREETYPEINC = /usr/include/freetype2 18 | # OpenBSD (uncomment) 19 | #FREETYPEINC = $(X11INC)/freetype2 20 | #MANPREFIX = ${PREFIX}/man 21 | 22 | # includes and libs 23 | INCS = -I$(X11INC) -I$(FREETYPEINC) 24 | LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) 25 | 26 | # flags 27 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) 28 | CFLAGS = -std=c99 -pedantic -Wall -Os $(INCS) $(CPPFLAGS) 29 | LDFLAGS = $(LIBS) 30 | 31 | # compiler and linker 32 | CC = cc 33 | -------------------------------------------------------------------------------- /dmenu/dmenu: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dmenu/dmenu -------------------------------------------------------------------------------- /dmenu/dmenu.1: -------------------------------------------------------------------------------- 1 | .TH DMENU 1 dmenu\-VERSION 2 | .SH NAME 3 | dmenu \- dynamic menu 4 | .SH SYNOPSIS 5 | .B dmenu 6 | .RB [ \-bfiv ] 7 | .RB [ \-g 8 | .IR columns ] 9 | .RB [ \-l 10 | .IR lines ] 11 | .RB [ \-h 12 | .IR height ] 13 | .RB [ \-m 14 | .IR monitor ] 15 | .RB [ \-p 16 | .IR prompt ] 17 | .RB [ \-fn 18 | .IR font ] 19 | .RB [ \-nb 20 | .IR color ] 21 | .RB [ \-nf 22 | .IR color ] 23 | .RB [ \-sb 24 | .IR color ] 25 | .RB [ \-sf 26 | .IR color ] 27 | .RB [ \-nhb 28 | .IR color ] 29 | .RB [ \-nhf 30 | .IR color ] 31 | .RB [ \-shb 32 | .IR color ] 33 | .RB [ \-shf 34 | .IR color ] 35 | .RB [ \-w 36 | .IR windowid ] 37 | .P 38 | .BR dmenu_run " ..." 39 | .SH DESCRIPTION 40 | .B dmenu 41 | is a dynamic menu for X, which reads a list of newline\-separated items from 42 | stdin. When the user selects an item and presses Return, their choice is printed 43 | to stdout and dmenu terminates. Entering text will narrow the items to those 44 | matching the tokens in the input. 45 | .P 46 | .B dmenu_run 47 | is a script used by 48 | .IR dwm (1) 49 | which lists programs in the user's $PATH and runs the result in their $SHELL. 50 | .SH OPTIONS 51 | .TP 52 | .B \-b 53 | dmenu appears at the bottom of the screen. 54 | .TP 55 | .B \-c 56 | dmenu appears centered on the screen. 57 | .TP 58 | .B \-f 59 | dmenu grabs the keyboard before reading stdin if not reading from a tty. This 60 | is faster, but will lock up X until stdin reaches end\-of\-file. 61 | .TP 62 | .B \-i 63 | dmenu matches menu items case insensitively. 64 | .TP 65 | .BI \-g " columns" 66 | dmenu lists items in a grid with the given number of columns. 67 | .TP 68 | .BI \-l " lines" 69 | dmenu lists items in a grid with the given number of lines. 70 | .TP 71 | .BI \-h " height" 72 | dmenu uses a menu line of at least 'height' pixels tall, but no less than 8. 73 | .TP 74 | .BI \-m " monitor" 75 | dmenu is displayed on the monitor number supplied. Monitor numbers are starting 76 | from 0. 77 | .TP 78 | .BI \-p " prompt" 79 | defines the prompt to be displayed to the left of the input field. 80 | .TP 81 | .BI \-fn " font" 82 | defines the font or font set used. 83 | .TP 84 | .BI \-nb " color" 85 | defines the normal background color. 86 | .IR #RGB , 87 | .IR #RRGGBB , 88 | and X color names are supported. 89 | .TP 90 | .BI \-nf " color" 91 | defines the normal foreground color. 92 | .TP 93 | .BI \-sb " color" 94 | defines the selected background color. 95 | .TP 96 | .BI \-sf " color" 97 | defines the selected foreground color. 98 | .TP 99 | .BI \-nhb " color" 100 | defines the normal highlight background color. 101 | .TP 102 | .BI \-nhf " color" 103 | defines the normal highlight foreground color. 104 | .TP 105 | .BI \-shb " color" 106 | defines the selected highlight background color. 107 | .TP 108 | .BI \-shf " color" 109 | defines the selected highlight foreground color. 110 | .TP 111 | .B \-v 112 | prints version information to stdout, then exits. 113 | .TP 114 | .BI \-w " windowid" 115 | embed into windowid. 116 | .SH USAGE 117 | dmenu is completely controlled by the keyboard. Items are selected using the 118 | arrow keys, page up, page down, home, and end. 119 | .TP 120 | .B Tab 121 | Copy the selected item to the input field. 122 | .TP 123 | .B Return 124 | Confirm selection. Prints the selected item to stdout and exits, returning 125 | success. 126 | .TP 127 | .B Ctrl-Return 128 | Confirm selection. Prints the selected item to stdout and continues. 129 | .TP 130 | .B Shift\-Return 131 | Confirm input. Prints the input text to stdout and exits, returning success. 132 | .TP 133 | .B Escape 134 | Exit without selecting an item, returning failure. 135 | .TP 136 | .B Ctrl-Left 137 | Move cursor to the start of the current word 138 | .TP 139 | .B Ctrl-Right 140 | Move cursor to the end of the current word 141 | .TP 142 | .B C\-a 143 | Home 144 | .TP 145 | .B C\-b 146 | Left 147 | .TP 148 | .B C\-c 149 | Escape 150 | .TP 151 | .B C\-d 152 | Delete 153 | .TP 154 | .B C\-e 155 | End 156 | .TP 157 | .B C\-f 158 | Right 159 | .TP 160 | .B C\-g 161 | Escape 162 | .TP 163 | .B C\-h 164 | Backspace 165 | .TP 166 | .B C\-i 167 | Tab 168 | .TP 169 | .B C\-j 170 | Return 171 | .TP 172 | .B C\-J 173 | Shift-Return 174 | .TP 175 | .B C\-k 176 | Delete line right 177 | .TP 178 | .B C\-m 179 | Return 180 | .TP 181 | .B C\-M 182 | Shift-Return 183 | .TP 184 | .B C\-n 185 | Down 186 | .TP 187 | .B C\-p 188 | Up 189 | .TP 190 | .B C\-u 191 | Delete line left 192 | .TP 193 | .B C\-w 194 | Delete word left 195 | .TP 196 | .B C\-y 197 | Paste from primary X selection 198 | .TP 199 | .B C\-Y 200 | Paste from X clipboard 201 | .TP 202 | .B M\-b 203 | Move cursor to the start of the current word 204 | .TP 205 | .B M\-f 206 | Move cursor to the end of the current word 207 | .TP 208 | .B M\-g 209 | Home 210 | .TP 211 | .B M\-G 212 | End 213 | .TP 214 | .B M\-h 215 | Up 216 | .TP 217 | .B M\-j 218 | Page down 219 | .TP 220 | .B M\-k 221 | Page up 222 | .TP 223 | .B M\-l 224 | Down 225 | .SH SEE ALSO 226 | .IR dwm (1), 227 | .IR stest (1) 228 | -------------------------------------------------------------------------------- /dmenu/dmenu.1.orig: -------------------------------------------------------------------------------- 1 | .TH DMENU 1 dmenu\-VERSION 2 | .SH NAME 3 | dmenu \- dynamic menu 4 | .SH SYNOPSIS 5 | .B dmenu 6 | .RB [ \-bfiv ] 7 | .RB [ \-l 8 | .IR lines ] 9 | .RB [ \-h 10 | .IR height ] 11 | .RB [ \-m 12 | .IR monitor ] 13 | .RB [ \-p 14 | .IR prompt ] 15 | .RB [ \-fn 16 | .IR font ] 17 | .RB [ \-nb 18 | .IR color ] 19 | .RB [ \-nf 20 | .IR color ] 21 | .RB [ \-sb 22 | .IR color ] 23 | .RB [ \-sf 24 | .IR color ] 25 | .RB [ \-nhb 26 | .IR color ] 27 | .RB [ \-nhf 28 | .IR color ] 29 | .RB [ \-shb 30 | .IR color ] 31 | .RB [ \-shf 32 | .IR color ] 33 | .RB [ \-w 34 | .IR windowid ] 35 | .P 36 | .BR dmenu_run " ..." 37 | .SH DESCRIPTION 38 | .B dmenu 39 | is a dynamic menu for X, which reads a list of newline\-separated items from 40 | stdin. When the user selects an item and presses Return, their choice is printed 41 | to stdout and dmenu terminates. Entering text will narrow the items to those 42 | matching the tokens in the input. 43 | .P 44 | .B dmenu_run 45 | is a script used by 46 | .IR dwm (1) 47 | which lists programs in the user's $PATH and runs the result in their $SHELL. 48 | .SH OPTIONS 49 | .TP 50 | .B \-b 51 | dmenu appears at the bottom of the screen. 52 | .TP 53 | .B \-c 54 | dmenu appears centered on the screen. 55 | .TP 56 | .B \-f 57 | dmenu grabs the keyboard before reading stdin if not reading from a tty. This 58 | is faster, but will lock up X until stdin reaches end\-of\-file. 59 | .TP 60 | .B \-i 61 | dmenu matches menu items case insensitively. 62 | .TP 63 | .BI \-l " lines" 64 | dmenu lists items vertically, with the given number of lines. 65 | .TP 66 | .BI \-h " height" 67 | dmenu uses a menu line of at least 'height' pixels tall, but no less than 8. 68 | .TP 69 | .BI \-m " monitor" 70 | dmenu is displayed on the monitor number supplied. Monitor numbers are starting 71 | from 0. 72 | .TP 73 | .BI \-p " prompt" 74 | defines the prompt to be displayed to the left of the input field. 75 | .TP 76 | .BI \-fn " font" 77 | defines the font or font set used. 78 | .TP 79 | .BI \-nb " color" 80 | defines the normal background color. 81 | .IR #RGB , 82 | .IR #RRGGBB , 83 | and X color names are supported. 84 | .TP 85 | .BI \-nf " color" 86 | defines the normal foreground color. 87 | .TP 88 | .BI \-sb " color" 89 | defines the selected background color. 90 | .TP 91 | .BI \-sf " color" 92 | defines the selected foreground color. 93 | .TP 94 | .BI \-nhb " color" 95 | defines the normal highlight background color. 96 | .TP 97 | .BI \-nhf " color" 98 | defines the normal highlight foreground color. 99 | .TP 100 | .BI \-shb " color" 101 | defines the selected highlight background color. 102 | .TP 103 | .BI \-shf " color" 104 | defines the selected highlight foreground color. 105 | .TP 106 | .B \-v 107 | prints version information to stdout, then exits. 108 | .TP 109 | .BI \-w " windowid" 110 | embed into windowid. 111 | .SH USAGE 112 | dmenu is completely controlled by the keyboard. Items are selected using the 113 | arrow keys, page up, page down, home, and end. 114 | .TP 115 | .B Tab 116 | Copy the selected item to the input field. 117 | .TP 118 | .B Return 119 | Confirm selection. Prints the selected item to stdout and exits, returning 120 | success. 121 | .TP 122 | .B Ctrl-Return 123 | Confirm selection. Prints the selected item to stdout and continues. 124 | .TP 125 | .B Shift\-Return 126 | Confirm input. Prints the input text to stdout and exits, returning success. 127 | .TP 128 | .B Escape 129 | Exit without selecting an item, returning failure. 130 | .TP 131 | .B Ctrl-Left 132 | Move cursor to the start of the current word 133 | .TP 134 | .B Ctrl-Right 135 | Move cursor to the end of the current word 136 | .TP 137 | .B C\-a 138 | Home 139 | .TP 140 | .B C\-b 141 | Left 142 | .TP 143 | .B C\-c 144 | Escape 145 | .TP 146 | .B C\-d 147 | Delete 148 | .TP 149 | .B C\-e 150 | End 151 | .TP 152 | .B C\-f 153 | Right 154 | .TP 155 | .B C\-g 156 | Escape 157 | .TP 158 | .B C\-h 159 | Backspace 160 | .TP 161 | .B C\-i 162 | Tab 163 | .TP 164 | .B C\-j 165 | Return 166 | .TP 167 | .B C\-J 168 | Shift-Return 169 | .TP 170 | .B C\-k 171 | Delete line right 172 | .TP 173 | .B C\-m 174 | Return 175 | .TP 176 | .B C\-M 177 | Shift-Return 178 | .TP 179 | .B C\-n 180 | Down 181 | .TP 182 | .B C\-p 183 | Up 184 | .TP 185 | .B C\-u 186 | Delete line left 187 | .TP 188 | .B C\-w 189 | Delete word left 190 | .TP 191 | .B C\-y 192 | Paste from primary X selection 193 | .TP 194 | .B C\-Y 195 | Paste from X clipboard 196 | .TP 197 | .B M\-b 198 | Move cursor to the start of the current word 199 | .TP 200 | .B M\-f 201 | Move cursor to the end of the current word 202 | .TP 203 | .B M\-g 204 | Home 205 | .TP 206 | .B M\-G 207 | End 208 | .TP 209 | .B M\-h 210 | Up 211 | .TP 212 | .B M\-j 213 | Page down 214 | .TP 215 | .B M\-k 216 | Page up 217 | .TP 218 | .B M\-l 219 | Down 220 | .SH SEE ALSO 221 | .IR dwm (1), 222 | .IR stest (1) 223 | -------------------------------------------------------------------------------- /dmenu/dmenu.c.rej: -------------------------------------------------------------------------------- 1 | --- dmenu.c 2 | +++ dmenu.c 3 | @@ -714,9 +720,13 @@ main(int argc, char *argv[]) 4 | } else if (i + 1 == argc) 5 | usage(); 6 | /* these options take one argument */ 7 | - else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */ 8 | + else if (!strcmp(argv[i], "-g")) { /* number of columns in grid */ 9 | + columns = atoi(argv[++i]); 10 | + if (lines == 0) lines = 1; 11 | + } else if (!strcmp(argv[i], "-l")) { /* number of lines in grid */ 12 | lines = atoi(argv[++i]); 13 | - else if (!strcmp(argv[i], "-m")) 14 | + if (columns == 0) columns = 1; 15 | + } else if (!strcmp(argv[i], "-m")) 16 | mon = atoi(argv[++i]); 17 | else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ 18 | prompt = argv[++i]; 19 | -------------------------------------------------------------------------------- /dmenu/dmenu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dmenu/dmenu.o -------------------------------------------------------------------------------- /dmenu/dmenu_path: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}" 4 | cache="$cachedir/dmenu_run" 5 | 6 | [ ! -e "$cachedir" ] && mkdir -p "$cachedir" 7 | 8 | IFS=: 9 | if stest -dqr -n "$cache" $PATH; then 10 | stest -flx $PATH | sort -u | tee "$cache" 11 | else 12 | cat "$cache" 13 | fi 14 | -------------------------------------------------------------------------------- /dmenu/dmenu_run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & 3 | -------------------------------------------------------------------------------- /dmenu/drw.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | typedef struct { 4 | Cursor cursor; 5 | } Cur; 6 | 7 | typedef struct Fnt { 8 | Display *dpy; 9 | unsigned int h; 10 | XftFont *xfont; 11 | FcPattern *pattern; 12 | struct Fnt *next; 13 | } Fnt; 14 | 15 | enum { ColFg, ColBg }; /* Clr scheme index */ 16 | typedef XftColor Clr; 17 | 18 | typedef struct { 19 | unsigned int w, h; 20 | Display *dpy; 21 | int screen; 22 | Window root; 23 | Drawable drawable; 24 | GC gc; 25 | Clr *scheme; 26 | Fnt *fonts; 27 | } Drw; 28 | 29 | /* Drawable abstraction */ 30 | Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); 31 | void drw_resize(Drw *drw, unsigned int w, unsigned int h); 32 | void drw_free(Drw *drw); 33 | 34 | /* Fnt abstraction */ 35 | Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); 36 | void drw_fontset_free(Fnt* set); 37 | unsigned int drw_fontset_getwidth(Drw *drw, const char *text); 38 | unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n); 39 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); 40 | 41 | /* Colorscheme abstraction */ 42 | void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 43 | Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); 44 | 45 | /* Cursor abstraction */ 46 | Cur *drw_cur_create(Drw *drw, int shape); 47 | void drw_cur_free(Drw *drw, Cur *cursor); 48 | 49 | /* Drawing context manipulation */ 50 | void drw_setfontset(Drw *drw, Fnt *set); 51 | void drw_setscheme(Drw *drw, Clr *scm); 52 | 53 | /* Drawing functions */ 54 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); 55 | int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); 56 | 57 | /* Map functions */ 58 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); 59 | -------------------------------------------------------------------------------- /dmenu/drw.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dmenu/drw.o -------------------------------------------------------------------------------- /dmenu/patches/dmenu-border-4.9.diff: -------------------------------------------------------------------------------- 1 | diff -up dmenu-4.9-b/config.def.h dmenu-4.9-a/config.def.h 2 | --- dmenu-4.9-b/config.def.h 2019-02-02 13:55:02.000000000 +0100 3 | +++ dmenu-4.9-a/config.def.h 2019-05-19 02:10:12.740040403 +0200 4 | @@ -21,3 +21,6 @@ static unsigned int lines = 0; 5 | * for example: " /?\"&[]" 6 | */ 7 | static const char worddelimiters[] = " "; 8 | + 9 | +/* Size of the window border */ 10 | +static const unsigned int border_width = 5; 11 | diff -up dmenu-4.9-b/dmenu.c dmenu-4.9-a/dmenu.c 12 | --- dmenu-4.9-b/dmenu.c 2019-02-02 13:55:02.000000000 +0100 13 | +++ dmenu-4.9-a/dmenu.c 2019-05-19 02:11:20.966710117 +0200 14 | @@ -654,9 +654,10 @@ setup(void) 15 | swa.override_redirect = True; 16 | swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; 17 | swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; 18 | - win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, 19 | + win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, 20 | CopyFromParent, CopyFromParent, CopyFromParent, 21 | CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); 22 | + XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel); 23 | XSetClassHint(dpy, win, &ch); 24 | 25 | /* open input methods */ 26 | -------------------------------------------------------------------------------- /dmenu/patches/dmenu-caseinsensitive-20200523-db6093f.diff: -------------------------------------------------------------------------------- 1 | From 54acbdf72083a5eae5783eed42e162424ab2cec2 Mon Sep 17 00:00:00 2001 2 | From: Kim Torgersen 3 | Date: Sat, 23 May 2020 14:48:28 +0200 4 | Subject: [PATCH] case-insensitive item matching default, case-sensitive option 5 | (-s) 6 | 7 | --- 8 | dmenu.c | 11 ++++++----- 9 | 1 file changed, 6 insertions(+), 5 deletions(-) 10 | 11 | diff --git a/dmenu.c b/dmenu.c 12 | index 65f25ce..855df59 100644 13 | --- a/dmenu.c 14 | +++ b/dmenu.c 15 | @@ -55,8 +55,9 @@ static Clr *scheme[SchemeLast]; 16 | 17 | #include "config.h" 18 | 19 | -static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; 20 | -static char *(*fstrstr)(const char *, const char *) = strstr; 21 | +static char * cistrstr(const char *s, const char *sub); 22 | +static int (*fstrncmp)(const char *, const char *, size_t) = strncasecmp; 23 | +static char *(*fstrstr)(const char *, const char *) = cistrstr; 24 | 25 | static void 26 | appenditem(struct item *item, struct item **list, struct item **last) 27 | @@ -709,9 +710,9 @@ main(int argc, char *argv[]) 28 | topbar = 0; 29 | else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ 30 | fast = 1; 31 | - else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ 32 | - fstrncmp = strncasecmp; 33 | - fstrstr = cistrstr; 34 | + else if (!strcmp(argv[i], "-s")) { /* case-sensitive item matching */ 35 | + fstrncmp = strncmp; 36 | + fstrstr = strstr; 37 | } else if (i + 1 == argc) 38 | usage(); 39 | /* these options take one argument */ 40 | -- 41 | 2.26.2 42 | 43 | -------------------------------------------------------------------------------- /dmenu/patches/dmenu-center-20200111-8cd37e1.diff: -------------------------------------------------------------------------------- 1 | From 8cd37e1ab9e7cb025224aeb3543f1a5be8bceb93 Mon Sep 17 00:00:00 2001 2 | From: Nihal Jere 3 | Date: Sat, 11 Jan 2020 21:16:08 -0600 4 | Subject: [PATCH] center patch now has adjustable minimum width 5 | 6 | --- 7 | config.def.h | 2 ++ 8 | dmenu.1 | 3 +++ 9 | dmenu.c | 39 ++++++++++++++++++++++++++++++++------- 10 | 3 files changed, 37 insertions(+), 7 deletions(-) 11 | 12 | diff --git a/config.def.h b/config.def.h 13 | index 1edb647..88ef264 100644 14 | --- a/config.def.h 15 | +++ b/config.def.h 16 | @@ -2,6 +2,8 @@ 17 | /* Default settings; can be overriden by command line. */ 18 | 19 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ 20 | +static int centered = 0; /* -c option; centers dmenu on screen */ 21 | +static int min_width = 500; /* minimum width when centered */ 22 | /* -fn option overrides fonts[0]; default X11 font or font set */ 23 | static const char *fonts[] = { 24 | "monospace:size=10" 25 | diff --git a/dmenu.1 b/dmenu.1 26 | index 323f93c..c036baa 100644 27 | --- a/dmenu.1 28 | +++ b/dmenu.1 29 | @@ -40,6 +40,9 @@ which lists programs in the user's $PATH and runs the result in their $SHELL. 30 | .B \-b 31 | dmenu appears at the bottom of the screen. 32 | .TP 33 | +.B \-c 34 | +dmenu appears centered on the screen. 35 | +.TP 36 | .B \-f 37 | dmenu grabs the keyboard before reading stdin if not reading from a tty. This 38 | is faster, but will lock up X until stdin reaches end\-of\-file. 39 | diff --git a/dmenu.c b/dmenu.c 40 | index 65f25ce..041c7f8 100644 41 | --- a/dmenu.c 42 | +++ b/dmenu.c 43 | @@ -89,6 +89,15 @@ calcoffsets(void) 44 | break; 45 | } 46 | 47 | +static int 48 | +max_textw(void) 49 | +{ 50 | + int len = 0; 51 | + for (struct item *item = items; item && item->text; item++) 52 | + len = MAX(TEXTW(item->text), len); 53 | + return len; 54 | +} 55 | + 56 | static void 57 | cleanup(void) 58 | { 59 | @@ -611,6 +620,7 @@ setup(void) 60 | bh = drw->fonts->h + 2; 61 | lines = MAX(lines, 0); 62 | mh = (lines + 1) * bh; 63 | + promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; 64 | #ifdef XINERAMA 65 | i = 0; 66 | if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) { 67 | @@ -637,9 +647,16 @@ setup(void) 68 | if (INTERSECT(x, y, 1, 1, info[i])) 69 | break; 70 | 71 | - x = info[i].x_org; 72 | - y = info[i].y_org + (topbar ? 0 : info[i].height - mh); 73 | - mw = info[i].width; 74 | + if (centered) { 75 | + mw = MIN(MAX(max_textw() + promptw, min_width), info[i].width); 76 | + x = info[i].x_org + ((info[i].width - mw) / 2); 77 | + y = info[i].y_org + ((info[i].height - mh) / 2); 78 | + } else { 79 | + x = info[i].x_org; 80 | + y = info[i].y_org + (topbar ? 0 : info[i].height - mh); 81 | + mw = info[i].width; 82 | + } 83 | + 84 | XFree(info); 85 | } else 86 | #endif 87 | @@ -647,11 +664,17 @@ setup(void) 88 | if (!XGetWindowAttributes(dpy, parentwin, &wa)) 89 | die("could not get embedding window attributes: 0x%lx", 90 | parentwin); 91 | - x = 0; 92 | - y = topbar ? 0 : wa.height - mh; 93 | - mw = wa.width; 94 | + 95 | + if (centered) { 96 | + mw = MIN(MAX(max_textw() + promptw, min_width), wa.width); 97 | + x = (wa.width - mw) / 2; 98 | + y = (wa.height - mh) / 2; 99 | + } else { 100 | + x = 0; 101 | + y = topbar ? 0 : wa.height - mh; 102 | + mw = wa.width; 103 | + } 104 | } 105 | - promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; 106 | inputw = MIN(inputw, mw/3); 107 | match(); 108 | 109 | @@ -709,6 +732,8 @@ main(int argc, char *argv[]) 110 | topbar = 0; 111 | else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ 112 | fast = 1; 113 | + else if (!strcmp(argv[i], "-c")) /* centers dmenu on screen */ 114 | + centered = 1; 115 | else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ 116 | fstrncmp = strncasecmp; 117 | fstrstr = cistrstr; 118 | -- 119 | 2.24.1 120 | 121 | -------------------------------------------------------------------------------- /dmenu/patches/dmenu-grid-4.9.diff: -------------------------------------------------------------------------------- 1 | From 39ab9676914bd0d8105d0f96bbd7611a53077438 Mon Sep 17 00:00:00 2001 2 | From: Miles Alan 3 | Date: Sat, 4 Jul 2020 11:19:04 -0500 4 | Subject: [PATCH] Add -g option to display entries in the given number of grid 5 | columns 6 | 7 | This option can be used in conjunction with -l to format dmenu's options in 8 | arbitrary size grids. For example, to create a 4 column by 6 line grid, you 9 | could use: dmenu -g 4 -l 6 10 | --- 11 | config.def.h | 3 ++- 12 | dmenu.1 | 7 ++++++- 13 | dmenu.c | 22 ++++++++++++++++------ 14 | 3 files changed, 24 insertions(+), 8 deletions(-) 15 | 16 | diff --git a/config.def.h b/config.def.h 17 | index 1edb647..96cf3c9 100644 18 | --- a/config.def.h 19 | +++ b/config.def.h 20 | @@ -13,8 +13,9 @@ static const char *colors[SchemeLast][2] = { 21 | [SchemeSel] = { "#eeeeee", "#005577" }, 22 | [SchemeOut] = { "#000000", "#00ffff" }, 23 | }; 24 | -/* -l option; if nonzero, dmenu uses vertical list with given number of lines */ 25 | +/* -l and -g options; controls number of lines and columns in grid if > 0 */ 26 | static unsigned int lines = 0; 27 | +static unsigned int columns = 0; 28 | 29 | /* 30 | * Characters not considered part of a word while deleting words 31 | diff --git a/dmenu.1 b/dmenu.1 32 | index 323f93c..d0a734a 100644 33 | --- a/dmenu.1 34 | +++ b/dmenu.1 35 | @@ -4,6 +4,8 @@ dmenu \- dynamic menu 36 | .SH SYNOPSIS 37 | .B dmenu 38 | .RB [ \-bfiv ] 39 | +.RB [ \-g 40 | +.IR columns ] 41 | .RB [ \-l 42 | .IR lines ] 43 | .RB [ \-m 44 | @@ -47,8 +49,11 @@ is faster, but will lock up X until stdin reaches end\-of\-file. 45 | .B \-i 46 | dmenu matches menu items case insensitively. 47 | .TP 48 | +.BI \-g " columns" 49 | +dmenu lists items in a grid with the given number of columns. 50 | +.TP 51 | .BI \-l " lines" 52 | -dmenu lists items vertically, with the given number of lines. 53 | +dmenu lists items in a grid with the given number of lines. 54 | .TP 55 | .BI \-m " monitor" 56 | dmenu is displayed on the monitor number supplied. Monitor numbers are starting 57 | diff --git a/dmenu.c b/dmenu.c 58 | index 6b8f51b..d79b6bb 100644 59 | --- a/dmenu.c 60 | +++ b/dmenu.c 61 | @@ -77,7 +77,7 @@ calcoffsets(void) 62 | int i, n; 63 | 64 | if (lines > 0) 65 | - n = lines * bh; 66 | + n = lines * columns * bh; 67 | else 68 | n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">")); 69 | /* calculate which items will begin the next page and previous page */ 70 | @@ -152,9 +152,15 @@ drawmenu(void) 71 | } 72 | 73 | if (lines > 0) { 74 | - /* draw vertical list */ 75 | - for (item = curr; item != next; item = item->right) 76 | - drawitem(item, x, y += bh, mw - x); 77 | + /* draw grid */ 78 | + int i = 0; 79 | + for (item = curr; item != next; item = item->right, i++) 80 | + drawitem( 81 | + item, 82 | + x + ((i / lines) * ((mw - x) / columns)), 83 | + y + (((i % lines) + 1) * bh), 84 | + (mw - x) / columns 85 | + ); 86 | } else if (matches) { 87 | /* draw horizontal list */ 88 | x += inputw; 89 | @@ -708,9 +714,13 @@ main(int argc, char *argv[]) 90 | } else if (i + 1 == argc) 91 | usage(); 92 | /* these options take one argument */ 93 | - else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */ 94 | + else if (!strcmp(argv[i], "-g")) { /* number of columns in grid */ 95 | + columns = atoi(argv[++i]); 96 | + if (lines == 0) lines = 1; 97 | + } else if (!strcmp(argv[i], "-l")) { /* number of lines in grid */ 98 | lines = atoi(argv[++i]); 99 | - else if (!strcmp(argv[i], "-m")) 100 | + if (columns == 0) columns = 1; 101 | + } else if (!strcmp(argv[i], "-m")) 102 | mon = atoi(argv[++i]); 103 | else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ 104 | prompt = argv[++i]; 105 | -- 106 | 2.23.1 107 | 108 | -------------------------------------------------------------------------------- /dmenu/patches/dmenu-lineheight-5.0.diff: -------------------------------------------------------------------------------- 1 | From ba103e38ea4ab07f9a3ee90627714b9bea17c329 Mon Sep 17 00:00:00 2001 2 | From: pskry 3 | Date: Sun, 8 Nov 2020 22:04:22 +0100 4 | Subject: [PATCH] Add an option which defines the lineheight 5 | 6 | Despite both the panel and dmenu using the same font (a Terminus 12), 7 | dmenu is shorter and the panel is visible from under the dmenu bar. 8 | The appearance can be even more distracting when using similar colors 9 | for background and selections. With the option added by this patch, 10 | dmenu can be launched with a '-h 24', thus completely covering the panel. 11 | --- 12 | config.def.h | 3 +++ 13 | dmenu.1 | 5 +++++ 14 | dmenu.c | 11 ++++++++--- 15 | 3 files changed, 16 insertions(+), 3 deletions(-) 16 | 17 | diff --git a/config.def.h b/config.def.h 18 | index 1edb647..4394dec 100644 19 | --- a/config.def.h 20 | +++ b/config.def.h 21 | @@ -15,6 +15,9 @@ static const char *colors[SchemeLast][2] = { 22 | }; 23 | /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ 24 | static unsigned int lines = 0; 25 | +/* -h option; minimum height of a menu line */ 26 | +static unsigned int lineheight = 0; 27 | +static unsigned int min_lineheight = 8; 28 | 29 | /* 30 | * Characters not considered part of a word while deleting words 31 | diff --git a/dmenu.1 b/dmenu.1 32 | index 323f93c..f2a82b4 100644 33 | --- a/dmenu.1 34 | +++ b/dmenu.1 35 | @@ -6,6 +6,8 @@ dmenu \- dynamic menu 36 | .RB [ \-bfiv ] 37 | .RB [ \-l 38 | .IR lines ] 39 | +.RB [ \-h 40 | +.IR height ] 41 | .RB [ \-m 42 | .IR monitor ] 43 | .RB [ \-p 44 | @@ -50,6 +52,9 @@ dmenu matches menu items case insensitively. 45 | .BI \-l " lines" 46 | dmenu lists items vertically, with the given number of lines. 47 | .TP 48 | +.BI \-h " height" 49 | +dmenu uses a menu line of at least 'height' pixels tall, but no less than 8. 50 | +.TP 51 | .BI \-m " monitor" 52 | dmenu is displayed on the monitor number supplied. Monitor numbers are starting 53 | from 0. 54 | diff --git a/dmenu.c b/dmenu.c 55 | index 65f25ce..f2a4047 100644 56 | --- a/dmenu.c 57 | +++ b/dmenu.c 58 | @@ -131,7 +131,7 @@ drawmenu(void) 59 | { 60 | unsigned int curpos; 61 | struct item *item; 62 | - int x = 0, y = 0, w; 63 | + int x = 0, y = 0, fh = drw->fonts->h, w; 64 | 65 | drw_setscheme(drw, scheme[SchemeNorm]); 66 | drw_rect(drw, 0, 0, mw, mh, 1, 1); 67 | @@ -148,7 +148,7 @@ drawmenu(void) 68 | curpos = TEXTW(text) - TEXTW(&text[cursor]); 69 | if ((curpos += lrpad / 2 - 1) < w) { 70 | drw_setscheme(drw, scheme[SchemeNorm]); 71 | - drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0); 72 | + drw_rect(drw, x + curpos, 2 + (bh - fh) / 2, 2, fh - 4, 1, 0); 73 | } 74 | 75 | if (lines > 0) { 76 | @@ -609,6 +609,7 @@ setup(void) 77 | 78 | /* calculate menu geometry */ 79 | bh = drw->fonts->h + 2; 80 | + bh = MAX(bh,lineheight); /* make a menu line AT LEAST 'lineheight' tall */ 81 | lines = MAX(lines, 0); 82 | mh = (lines + 1) * bh; 83 | #ifdef XINERAMA 84 | @@ -689,7 +690,7 @@ setup(void) 85 | static void 86 | usage(void) 87 | { 88 | - fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" 89 | + fputs("usage: dmenu [-bfiv] [-l lines] [-h height] [-p prompt] [-fn font] [-m monitor]\n" 90 | " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr); 91 | exit(1); 92 | } 93 | @@ -717,6 +718,10 @@ main(int argc, char *argv[]) 94 | /* these options take one argument */ 95 | else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */ 96 | lines = atoi(argv[++i]); 97 | + else if (!strcmp(argv[i], "-h")) { /* minimum height of one menu line */ 98 | + lineheight = atoi(argv[++i]); 99 | + lineheight = MAX(lineheight, min_lineheight); 100 | + } 101 | else if (!strcmp(argv[i], "-m")) 102 | mon = atoi(argv[++i]); 103 | else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ 104 | -- 105 | 2.29.2 106 | 107 | -------------------------------------------------------------------------------- /dmenu/stest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dmenu/stest -------------------------------------------------------------------------------- /dmenu/stest.1: -------------------------------------------------------------------------------- 1 | .TH STEST 1 dmenu\-VERSION 2 | .SH NAME 3 | stest \- filter a list of files by properties 4 | .SH SYNOPSIS 5 | .B stest 6 | .RB [ -abcdefghlpqrsuwx ] 7 | .RB [ -n 8 | .IR file ] 9 | .RB [ -o 10 | .IR file ] 11 | .RI [ file ...] 12 | .SH DESCRIPTION 13 | .B stest 14 | takes a list of files and filters by the files' properties, analogous to 15 | .IR test (1). 16 | Files which pass all tests are printed to stdout. If no files are given, stest 17 | reads files from stdin. 18 | .SH OPTIONS 19 | .TP 20 | .B \-a 21 | Test hidden files. 22 | .TP 23 | .B \-b 24 | Test that files are block specials. 25 | .TP 26 | .B \-c 27 | Test that files are character specials. 28 | .TP 29 | .B \-d 30 | Test that files are directories. 31 | .TP 32 | .B \-e 33 | Test that files exist. 34 | .TP 35 | .B \-f 36 | Test that files are regular files. 37 | .TP 38 | .B \-g 39 | Test that files have their set-group-ID flag set. 40 | .TP 41 | .B \-h 42 | Test that files are symbolic links. 43 | .TP 44 | .B \-l 45 | Test the contents of a directory given as an argument. 46 | .TP 47 | .BI \-n " file" 48 | Test that files are newer than 49 | .IR file . 50 | .TP 51 | .BI \-o " file" 52 | Test that files are older than 53 | .IR file . 54 | .TP 55 | .B \-p 56 | Test that files are named pipes. 57 | .TP 58 | .B \-q 59 | No files are printed, only the exit status is returned. 60 | .TP 61 | .B \-r 62 | Test that files are readable. 63 | .TP 64 | .B \-s 65 | Test that files are not empty. 66 | .TP 67 | .B \-u 68 | Test that files have their set-user-ID flag set. 69 | .TP 70 | .B \-v 71 | Invert the sense of tests, only failing files pass. 72 | .TP 73 | .B \-w 74 | Test that files are writable. 75 | .TP 76 | .B \-x 77 | Test that files are executable. 78 | .SH EXIT STATUS 79 | .TP 80 | .B 0 81 | At least one file passed all tests. 82 | .TP 83 | .B 1 84 | No files passed all tests. 85 | .TP 86 | .B 2 87 | An error occurred. 88 | .SH SEE ALSO 89 | .IR dmenu (1), 90 | .IR test (1) 91 | -------------------------------------------------------------------------------- /dmenu/stest.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "arg.h" 12 | char *argv0; 13 | 14 | #define FLAG(x) (flag[(x)-'a']) 15 | 16 | static void test(const char *, const char *); 17 | static void usage(void); 18 | 19 | static int match = 0; 20 | static int flag[26]; 21 | static struct stat old, new; 22 | 23 | static void 24 | test(const char *path, const char *name) 25 | { 26 | struct stat st, ln; 27 | 28 | if ((!stat(path, &st) && (FLAG('a') || name[0] != '.') /* hidden files */ 29 | && (!FLAG('b') || S_ISBLK(st.st_mode)) /* block special */ 30 | && (!FLAG('c') || S_ISCHR(st.st_mode)) /* character special */ 31 | && (!FLAG('d') || S_ISDIR(st.st_mode)) /* directory */ 32 | && (!FLAG('e') || access(path, F_OK) == 0) /* exists */ 33 | && (!FLAG('f') || S_ISREG(st.st_mode)) /* regular file */ 34 | && (!FLAG('g') || st.st_mode & S_ISGID) /* set-group-id flag */ 35 | && (!FLAG('h') || (!lstat(path, &ln) && S_ISLNK(ln.st_mode))) /* symbolic link */ 36 | && (!FLAG('n') || st.st_mtime > new.st_mtime) /* newer than file */ 37 | && (!FLAG('o') || st.st_mtime < old.st_mtime) /* older than file */ 38 | && (!FLAG('p') || S_ISFIFO(st.st_mode)) /* named pipe */ 39 | && (!FLAG('r') || access(path, R_OK) == 0) /* readable */ 40 | && (!FLAG('s') || st.st_size > 0) /* not empty */ 41 | && (!FLAG('u') || st.st_mode & S_ISUID) /* set-user-id flag */ 42 | && (!FLAG('w') || access(path, W_OK) == 0) /* writable */ 43 | && (!FLAG('x') || access(path, X_OK) == 0)) != FLAG('v')) { /* executable */ 44 | if (FLAG('q')) 45 | exit(0); 46 | match = 1; 47 | puts(name); 48 | } 49 | } 50 | 51 | static void 52 | usage(void) 53 | { 54 | fprintf(stderr, "usage: %s [-abcdefghlpqrsuvwx] " 55 | "[-n file] [-o file] [file...]\n", argv0); 56 | exit(2); /* like test(1) return > 1 on error */ 57 | } 58 | 59 | int 60 | main(int argc, char *argv[]) 61 | { 62 | struct dirent *d; 63 | char path[PATH_MAX], *line = NULL, *file; 64 | size_t linesiz = 0; 65 | ssize_t n; 66 | DIR *dir; 67 | int r; 68 | 69 | ARGBEGIN { 70 | case 'n': /* newer than file */ 71 | case 'o': /* older than file */ 72 | file = EARGF(usage()); 73 | if (!(FLAG(ARGC()) = !stat(file, (ARGC() == 'n' ? &new : &old)))) 74 | perror(file); 75 | break; 76 | default: 77 | /* miscellaneous operators */ 78 | if (strchr("abcdefghlpqrsuvwx", ARGC())) 79 | FLAG(ARGC()) = 1; 80 | else 81 | usage(); /* unknown flag */ 82 | } ARGEND; 83 | 84 | if (!argc) { 85 | /* read list from stdin */ 86 | while ((n = getline(&line, &linesiz, stdin)) > 0) { 87 | if (line[n - 1] == '\n') 88 | line[n - 1] = '\0'; 89 | test(line, line); 90 | } 91 | free(line); 92 | } else { 93 | for (; argc; argc--, argv++) { 94 | if (FLAG('l') && (dir = opendir(*argv))) { 95 | /* test directory contents */ 96 | while ((d = readdir(dir))) { 97 | r = snprintf(path, sizeof path, "%s/%s", 98 | *argv, d->d_name); 99 | if (r >= 0 && (size_t)r < sizeof path) 100 | test(path, d->d_name); 101 | } 102 | closedir(dir); 103 | } else { 104 | test(*argv, *argv); 105 | } 106 | } 107 | } 108 | return match ? 0 : 1; 109 | } 110 | -------------------------------------------------------------------------------- /dmenu/stest.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dmenu/stest.o -------------------------------------------------------------------------------- /dmenu/util.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "util.h" 8 | 9 | void 10 | die(const char *fmt, ...) 11 | { 12 | va_list ap; 13 | 14 | va_start(ap, fmt); 15 | vfprintf(stderr, fmt, ap); 16 | va_end(ap); 17 | 18 | if (fmt[0] && fmt[strlen(fmt)-1] == ':') { 19 | fputc(' ', stderr); 20 | perror(NULL); 21 | } else { 22 | fputc('\n', stderr); 23 | } 24 | 25 | exit(1); 26 | } 27 | 28 | void * 29 | ecalloc(size_t nmemb, size_t size) 30 | { 31 | void *p; 32 | 33 | if (!(p = calloc(nmemb, size))) 34 | die("calloc:"); 35 | return p; 36 | } 37 | -------------------------------------------------------------------------------- /dmenu/util.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | #define MAX(A, B) ((A) > (B) ? (A) : (B)) 4 | #define MIN(A, B) ((A) < (B) ? (A) : (B)) 5 | #define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) 6 | 7 | void die(const char *fmt, ...); 8 | void *ecalloc(size_t nmemb, size_t size); 9 | -------------------------------------------------------------------------------- /dmenu/util.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dmenu/util.o -------------------------------------------------------------------------------- /dwm/LICENSE: -------------------------------------------------------------------------------- 1 | MIT/X Consortium License 2 | 3 | © 2006-2019 Anselm R Garbe 4 | © 2006-2009 Jukka Salmi 5 | © 2006-2007 Sander van Dijk 6 | © 2007-2011 Peter Hartlich 7 | © 2007-2009 Szabolcs Nagy 8 | © 2007-2009 Christof Musik 9 | © 2007-2009 Premysl Hruby 10 | © 2007-2008 Enno Gottox Boland 11 | © 2008 Martin Hurton 12 | © 2008 Neale Pickett 13 | © 2009 Mate Nagy 14 | © 2010-2016 Hiltjo Posthuma 15 | © 2010-2012 Connor Lane Smith 16 | © 2011 Christoph Lohmann <20h@r-36.net> 17 | © 2015-2016 Quentin Rameau 18 | © 2015-2016 Eric Pruitt 19 | © 2016-2017 Markus Teich 20 | © 2020-2022 Chris Down 21 | 22 | Permission is hereby granted, free of charge, to any person obtaining a 23 | copy of this software and associated documentation files (the "Software"), 24 | to deal in the Software without restriction, including without limitation 25 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 26 | and/or sell copies of the Software, and to permit persons to whom the 27 | Software is furnished to do so, subject to the following conditions: 28 | 29 | The above copyright notice and this permission notice shall be included in 30 | all copies or substantial portions of the Software. 31 | 32 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 33 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 35 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 36 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 37 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 38 | DEALINGS IN THE SOFTWARE. 39 | -------------------------------------------------------------------------------- /dwm/Makefile: -------------------------------------------------------------------------------- 1 | # dwm - dynamic window manager 2 | # See LICENSE file for copyright and license details. 3 | 4 | include config.mk 5 | 6 | SRC = drw.c dwm.c util.c 7 | OBJ = ${SRC:.c=.o} 8 | 9 | all: options dwm 10 | 11 | options: 12 | @echo dwm build options: 13 | @echo "CFLAGS = ${CFLAGS}" 14 | @echo "LDFLAGS = ${LDFLAGS}" 15 | @echo "CC = ${CC}" 16 | 17 | .c.o: 18 | ${CC} -c ${CFLAGS} $< 19 | 20 | ${OBJ}: config.h config.mk 21 | 22 | config.h: 23 | cp config.def.h $@ 24 | 25 | dwm: ${OBJ} 26 | ${CC} -o $@ ${OBJ} ${LDFLAGS} 27 | 28 | clean: 29 | rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz 30 | 31 | dist: clean 32 | mkdir -p dwm-${VERSION} 33 | cp -R LICENSE Makefile README config.def.h config.mk\ 34 | dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION} 35 | tar -cf dwm-${VERSION}.tar dwm-${VERSION} 36 | gzip dwm-${VERSION}.tar 37 | rm -rf dwm-${VERSION} 38 | 39 | install: all 40 | mkdir -p ${DESTDIR}${PREFIX}/bin 41 | cp -f dwm ${DESTDIR}${PREFIX}/bin 42 | chmod 755 ${DESTDIR}${PREFIX}/bin/dwm 43 | mkdir -p ${DESTDIR}${MANPREFIX}/man1 44 | sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 45 | chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 46 | 47 | uninstall: 48 | rm -f ${DESTDIR}${PREFIX}/bin/dwm\ 49 | ${DESTDIR}${MANPREFIX}/man1/dwm.1 50 | 51 | .PHONY: all options clean dist install uninstall 52 | -------------------------------------------------------------------------------- /dwm/README: -------------------------------------------------------------------------------- 1 | dwm - dynamic window manager 2 | ============================ 3 | dwm is an extremely fast, small, and dynamic window manager for X. 4 | 5 | 6 | Requirements 7 | ------------ 8 | In order to build dwm you need the Xlib header files. 9 | 10 | 11 | Installation 12 | ------------ 13 | Edit config.mk to match your local setup (dwm is installed into 14 | the /usr/local namespace by default). 15 | 16 | Afterwards enter the following command to build and install dwm (if 17 | necessary as root): 18 | 19 | make clean install 20 | 21 | 22 | Running dwm 23 | ----------- 24 | Add the following line to your .xinitrc to start dwm using startx: 25 | 26 | exec dwm 27 | 28 | In order to connect dwm to a specific display, make sure that 29 | the DISPLAY environment variable is set correctly, e.g.: 30 | 31 | DISPLAY=foo.bar:1 exec dwm 32 | 33 | (This will start dwm on display :1 of the host foo.bar.) 34 | 35 | In order to display status info in the bar, you can do something 36 | like this in your .xinitrc: 37 | 38 | while xsetroot -name "`date` `uptime | sed 's/.*,//'`" 39 | do 40 | sleep 1 41 | done & 42 | exec dwm 43 | 44 | 45 | Configuration 46 | ------------- 47 | The configuration of dwm is done by creating a custom config.h 48 | and (re)compiling the source code. 49 | -------------------------------------------------------------------------------- /dwm/colorschemes/bananaTime.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#1c1c1c"; 2 | static const char col_gray2[] = "#1c1c1c"; 3 | static const char col_gray3[] = "#f8f8f2"; 4 | static const char col_gray4[] = "#1c1c1c"; 5 | static const char col_cyan[] = "#f9ce74"; 6 | -------------------------------------------------------------------------------- /dwm/colorschemes/catppuccin.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#1e1d2d"; 2 | static const char col_gray2[] = "#1e1d2d"; 3 | static const char col_gray3[] = "#d2f7a6"; 4 | static const char col_gray4[] = "#1e1d2d"; 5 | static const char col_title[] = "#74c7ec"; 6 | static const char col_cyan[] = "#cba6f7"; 7 | -------------------------------------------------------------------------------- /dwm/colorschemes/darkGT.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#282828"; 2 | static const char col_gray2[] = "#32302f"; 3 | static const char col_gray3[] = "#7c6f64"; 4 | static const char col_gray4[] = "#ebdbd2"; 5 | static const char col_cyan[] = "#d65d0e"; 6 | -------------------------------------------------------------------------------- /dwm/colorschemes/doomOne.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#282c34"; 2 | static const char col_gray2[] = "#282c34"; 3 | static const char col_gray3[] = "#bbc2cf"; 4 | static const char col_gray4[] = "#bbc2cf"; 5 | static const char col_cyan[] = "#51afef"; 6 | -------------------------------------------------------------------------------- /dwm/colorschemes/dracula.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#282a36"; 2 | static const char col_gray2[] = "#282a36"; 3 | static const char col_gray3[] = "#f8f8f2"; 4 | static const char col_gray4[] = "#f8f8f2"; 5 | static const char col_cyan[] = "#bd93f9"; 6 | -------------------------------------------------------------------------------- /dwm/colorschemes/everforest.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#1e2326"; 2 | static const char col_gray2[] = "#1e2326"; 3 | static const char col_gray3[] = "#3c4841"; 4 | static const char col_gray4[] = "#1e2326"; 5 | static const char col_cyan[] = "#d3c6aa"; 6 | -------------------------------------------------------------------------------- /dwm/colorschemes/gruvbox.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#282828"; 2 | static const char col_gray2[] = "#282828"; 3 | static const char col_gray3[] = "#928374"; 4 | static const char col_gray4[] = "#282828"; 5 | static const char col_cyan[] = "#fbf1c7"; 6 | -------------------------------------------------------------------------------- /dwm/colorschemes/kanagawa.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#16161d"; 2 | static const char col_gray2[] = "#16161d"; 3 | static const char col_gray3[] = "#dcd7ba"; 4 | static const char col_gray4[] = "#16161d"; 5 | static const char col_cyan[] = "#FF9E3B"; 6 | -------------------------------------------------------------------------------- /dwm/colorschemes/monokai.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#2D2A2E"; 2 | static const char col_gray2[] = "#78DCE8"; 3 | static const char col_gray3[] = "#ffffff"; 4 | static const char col_gray4[] = "#ffffff"; 5 | static const char col_gray5[] = "#FFD866"; 6 | static const char col_cyan[] = "#F92672"; 7 | -------------------------------------------------------------------------------- /dwm/colorschemes/ocean.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#0F111A"; 2 | static const char col_gray2[] = "#E5E9F0"; 3 | static const char col_gray3[] = "#E5E9F0"; 4 | static const char col_gray4[] = "#E5E9F0"; 5 | static const char col_gray5[] = "#E5E9F0"; 6 | static const char col_cyan[] = "#3A575C"; 7 | -------------------------------------------------------------------------------- /dwm/colorschemes/onedark.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#282C34"; 2 | static const char col_gray2[] = "#ABB2BF"; 3 | static const char col_gray3[] = "#ABB2BF"; 4 | static const char col_gray4[] = "#282C34"; 5 | static const char col_gray5[] = "#c678DD"; 6 | static const char col_cyan[] = "#E06C75"; 7 | -------------------------------------------------------------------------------- /dwm/colorschemes/papercolor.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#eeeeee"; 2 | static const char col_gray2[] = "#878787"; 3 | static const char col_gray3[] = "#444444"; 4 | static const char col_gray4[] = "#eeeeee"; 5 | static const char col_gray5[] = "#d75f00"; 6 | static const char col_cyan[] = "#d70087"; 7 | -------------------------------------------------------------------------------- /dwm/colorschemes/thwarted-summer-shower.h: -------------------------------------------------------------------------------- 1 | static const char col_gray1[] = "#085e57"; 2 | static const char col_gray2[] = "#085e57"; 3 | static const char col_gray3[] = "#bcece0"; 4 | static const char col_gray4[] = "#f8f8f2"; 5 | static const char col_cyan[] = "#4c5270"; 6 | -------------------------------------------------------------------------------- /dwm/config.def.h.rej: -------------------------------------------------------------------------------- 1 | --- config.def.h 2 | +++ config.def.h 3 | @@ -5,6 +5,9 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ 4 | static const unsigned int snap = 32; /* snap pixel */ 5 | static const int showbar = 1; /* 0 means no bar */ 6 | static const int topbar = 1; /* 0 means bottom bar */ 7 | +static const unsigned int stairpx = 20; /* depth of the stairs layout */ 8 | +static const int stairdirection = 1; /* 0: left-aligned, 1: right-aligned */ 9 | +static const int stairsamesize = 1; /* 1 means shrink all the staired windows to the same size */ 10 | static const char *fonts[] = { "monospace:size=10" }; 11 | static const char dmenufont[] = "monospace:size=10"; 12 | static const char col_gray1[] = "#222222"; 13 | @@ -42,6 +45,7 @@ static const Layout layouts[] = { 14 | { "[]=", tile }, /* first entry is default */ 15 | { "><>", NULL }, /* no layout function means floating behavior */ 16 | { "[M]", monocle }, 17 | + { "[S]", stairs }, 18 | }; 19 | 20 | /* key definitions */ 21 | @@ -77,6 +81,7 @@ static Key keys[] = { 22 | { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 23 | { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 24 | { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 25 | + { MODKEY, XK_s, setlayout, {.v = &layouts[3]} }, 26 | { MODKEY, XK_space, setlayout, {0} }, 27 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 28 | { MODKEY, XK_0, view, {.ui = ~0 } }, 29 | -------------------------------------------------------------------------------- /dwm/config.mk: -------------------------------------------------------------------------------- 1 | # dwm version 2 | VERSION = 6.4 3 | 4 | # Customize below to fit your system 5 | 6 | # paths 7 | PREFIX = /usr/local 8 | MANPREFIX = ${PREFIX}/share/man 9 | 10 | X11INC = /usr/X11R6/include 11 | X11LIB = /usr/X11R6/lib 12 | 13 | # Xinerama, comment if you don't want it 14 | XINERAMALIBS = -lXinerama 15 | XINERAMAFLAGS = -DXINERAMA 16 | 17 | # freetype 18 | FREETYPELIBS = -lfontconfig -lXft 19 | FREETYPEINC = /usr/include/freetype2 20 | # OpenBSD (uncomment) 21 | #FREETYPEINC = ${X11INC}/freetype2 22 | #MANPREFIX = ${PREFIX}/man 23 | 24 | # includes and libs 25 | INCS = -I${X11INC} -I${FREETYPEINC} 26 | LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender -lImlib2 27 | 28 | # flags 29 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} 30 | #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} 31 | CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} 32 | LDFLAGS = ${LIBS} 33 | 34 | # Solaris 35 | #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" 36 | #LDFLAGS = ${LIBS} 37 | 38 | # compiler and linker 39 | CC = cc 40 | -------------------------------------------------------------------------------- /dwm/config.mk.orig: -------------------------------------------------------------------------------- 1 | # dwm version 2 | VERSION = 6.4 3 | 4 | # Customize below to fit your system 5 | 6 | # paths 7 | PREFIX = /usr/local 8 | MANPREFIX = ${PREFIX}/share/man 9 | 10 | X11INC = /usr/X11R6/include 11 | X11LIB = /usr/X11R6/lib 12 | 13 | # Xinerama, comment if you don't want it 14 | XINERAMALIBS = -lXinerama 15 | XINERAMAFLAGS = -DXINERAMA 16 | 17 | # freetype 18 | FREETYPELIBS = -lfontconfig -lXft 19 | FREETYPEINC = /usr/include/freetype2 20 | # OpenBSD (uncomment) 21 | #FREETYPEINC = ${X11INC}/freetype2 22 | #MANPREFIX = ${PREFIX}/man 23 | 24 | # includes and libs 25 | INCS = -I${X11INC} -I${FREETYPEINC} 26 | LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} 27 | 28 | # flags 29 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} 30 | #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} 31 | CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} 32 | LDFLAGS = ${LIBS} 33 | 34 | # Solaris 35 | #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" 36 | #LDFLAGS = ${LIBS} 37 | 38 | # compiler and linker 39 | CC = cc 40 | -------------------------------------------------------------------------------- /dwm/drw.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | typedef struct { 4 | Cursor cursor; 5 | } Cur; 6 | 7 | typedef struct Fnt { 8 | Display *dpy; 9 | unsigned int h; 10 | XftFont *xfont; 11 | FcPattern *pattern; 12 | struct Fnt *next; 13 | } Fnt; 14 | 15 | enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */ 16 | typedef XftColor Clr; 17 | 18 | typedef struct { 19 | unsigned int w, h; 20 | Display *dpy; 21 | int screen; 22 | Window root; 23 | Drawable drawable; 24 | Picture picture; 25 | GC gc; 26 | Clr *scheme; 27 | Fnt *fonts; 28 | } Drw; 29 | 30 | /* Drawable abstraction */ 31 | Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); 32 | void drw_resize(Drw *drw, unsigned int w, unsigned int h); 33 | void drw_free(Drw *drw); 34 | 35 | /* Fnt abstraction */ 36 | Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); 37 | void drw_fontset_free(Fnt* set); 38 | unsigned int drw_fontset_getwidth(Drw *drw, const char *text); 39 | unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n); 40 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); 41 | 42 | /* Colorscheme abstraction */ 43 | void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 44 | Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); 45 | 46 | /* Cursor abstraction */ 47 | Cur *drw_cur_create(Drw *drw, int shape); 48 | void drw_cur_free(Drw *drw, Cur *cursor); 49 | 50 | /* Drawing context manipulation */ 51 | void drw_setfontset(Drw *drw, Fnt *set); 52 | void drw_setscheme(Drw *drw, Clr *scm); 53 | 54 | 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); 55 | 56 | /* Drawing functions */ 57 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); 58 | int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); 59 | void drw_pic(Drw *drw, int x, int y, unsigned int w, unsigned int h, Picture pic); 60 | 61 | /* Map functions */ 62 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); 63 | -------------------------------------------------------------------------------- /dwm/drw.h.orig: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | typedef struct { 4 | Cursor cursor; 5 | } Cur; 6 | 7 | typedef struct Fnt { 8 | Display *dpy; 9 | unsigned int h; 10 | XftFont *xfont; 11 | FcPattern *pattern; 12 | struct Fnt *next; 13 | } Fnt; 14 | 15 | enum { ColFg, ColBg, ColBorder }; /* Clr scheme index */ 16 | typedef XftColor Clr; 17 | 18 | typedef struct { 19 | unsigned int w, h; 20 | Display *dpy; 21 | int screen; 22 | Window root; 23 | Drawable drawable; 24 | GC gc; 25 | Clr *scheme; 26 | Fnt *fonts; 27 | } Drw; 28 | 29 | /* Drawable abstraction */ 30 | Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); 31 | void drw_resize(Drw *drw, unsigned int w, unsigned int h); 32 | void drw_free(Drw *drw); 33 | 34 | /* Fnt abstraction */ 35 | Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount); 36 | void drw_fontset_free(Fnt* set); 37 | unsigned int drw_fontset_getwidth(Drw *drw, const char *text); 38 | unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n); 39 | void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); 40 | 41 | /* Colorscheme abstraction */ 42 | void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); 43 | Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); 44 | 45 | /* Cursor abstraction */ 46 | Cur *drw_cur_create(Drw *drw, int shape); 47 | void drw_cur_free(Drw *drw, Cur *cursor); 48 | 49 | /* Drawing context manipulation */ 50 | void drw_setfontset(Drw *drw, Fnt *set); 51 | void drw_setscheme(Drw *drw, Clr *scm); 52 | 53 | /* Drawing functions */ 54 | void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert); 55 | int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert); 56 | 57 | /* Map functions */ 58 | void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); 59 | -------------------------------------------------------------------------------- /dwm/drw.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dwm/drw.o -------------------------------------------------------------------------------- /dwm/dwm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dwm/dwm -------------------------------------------------------------------------------- /dwm/dwm.c.rej: -------------------------------------------------------------------------------- 1 | --- dwm.c 2 | +++ dwm.c 3 | @@ -207,6 +207,7 @@ static void seturgent(Client *c, int urg); 4 | static void showhide(Client *c); 5 | static void sigchld(int unused); 6 | static void spawn(const Arg *arg); 7 | +static void stairs(Monitor *m); 8 | static void tag(const Arg *arg); 9 | static void tagmon(const Arg *arg); 10 | static void tile(Monitor *); 11 | @@ -1659,6 +1660,43 @@ spawn(const Arg *arg) 12 | } 13 | } 14 | 15 | +void 16 | +stairs(Monitor *m) 17 | +{ 18 | + unsigned int i, n, h, mw, my; 19 | + unsigned int ox, oy, ow, oh; /* stair offset values */ 20 | + Client *c; 21 | + 22 | + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); 23 | + if (n == 0) 24 | + return; 25 | + 26 | + if (n > m->nmaster) 27 | + mw = m->nmaster ? m->ww * m->mfact : 0; 28 | + else 29 | + mw = m->ww; 30 | + 31 | + for (i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { 32 | + if (i < m->nmaster) { 33 | + h = (m->wh - my) / (MIN(n, m->nmaster) - i); 34 | + resize(c, m->wx, m->wy + my, mw - (2 * c->bw), h - (2 * c->bw), 0); 35 | + if (my + HEIGHT(c) < m->wh) 36 | + my += HEIGHT(c); 37 | + } else { 38 | + oy = i - m->nmaster; 39 | + ox = stairdirection ? n - i - 1 : (stairsamesize ? i - m->nmaster : 0); 40 | + ow = stairsamesize ? n - m->nmaster - 1 : n - i - 1; 41 | + oh = stairsamesize ? ow : i - m->nmaster; 42 | + resize(c, 43 | + m->wx + mw + (ox * stairpx), 44 | + m->wy + (oy * stairpx), 45 | + m->ww - mw - (2 * c->bw) - (ow * stairpx), 46 | + m->wh - (2 * c->bw) - (oh * stairpx), 47 | + 0); 48 | + } 49 | + } 50 | +} 51 | + 52 | void 53 | tag(const Arg *arg) 54 | { 55 | -------------------------------------------------------------------------------- /dwm/dwm.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dwm/dwm.o -------------------------------------------------------------------------------- /dwm/dwm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dwm/dwm.png -------------------------------------------------------------------------------- /dwm/patches/dwm-alwayscenter-20200625-f04cac6.diff: -------------------------------------------------------------------------------- 1 | diff -up dwm/dwm.c dwmmod/dwm.c 2 | --- dwm/dwm.c 2020-06-25 00:21:30.383692180 -0300 3 | +++ dwmmod/dwm.c 2020-06-25 00:20:35.643692330 -0300 4 | @@ -1057,6 +1057,8 @@ manage(Window w, XWindowAttributes *wa) 5 | updatewindowtype(c); 6 | updatesizehints(c); 7 | updatewmhints(c); 8 | + c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2; 9 | + c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; 10 | XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); 11 | grabbuttons(c, 0); 12 | if (!c->isfloating) 13 | -------------------------------------------------------------------------------- /dwm/patches/dwm-attachbottom-20201227-61bb8b2.diff: -------------------------------------------------------------------------------- 1 | From eea05f94baf707114ea882e8755520ba30d73cb2 Mon Sep 17 00:00:00 2001 2 | From: Szabolcs Szucs 3 | Date: Sat, 26 Dec 2020 21:17:40 +0100 4 | Subject: [PATCH] attachbottom patch 5 | 6 | --- 7 | dwm.c | 16 +++++++++++++--- 8 | 1 file changed, 13 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/dwm.c b/dwm.c 11 | index 664c527..7ee3566 100644 12 | --- a/dwm.c 13 | +++ b/dwm.c 14 | @@ -147,6 +147,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac 15 | static void arrange(Monitor *m); 16 | static void arrangemon(Monitor *m); 17 | static void attach(Client *c); 18 | +static void attachbottom(Client *c); 19 | static void attachstack(Client *c); 20 | static void buttonpress(XEvent *e); 21 | static void checkotherwm(void); 22 | @@ -407,6 +408,15 @@ attach(Client *c) 23 | c->mon->clients = c; 24 | } 25 | 26 | +void 27 | +attachbottom(Client *c) 28 | +{ 29 | + Client **tc; 30 | + c->next = NULL; 31 | + for (tc = &c->mon->clients; *tc; tc = &(*tc)->next); 32 | + *tc = c; 33 | +} 34 | + 35 | void 36 | attachstack(Client *c) 37 | { 38 | @@ -1063,7 +1073,7 @@ manage(Window w, XWindowAttributes *wa) 39 | c->isfloating = c->oldstate = trans != None || c->isfixed; 40 | if (c->isfloating) 41 | XRaiseWindow(dpy, c->win); 42 | - attach(c); 43 | + attachbottom(c); 44 | attachstack(c); 45 | XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, 46 | (unsigned char *) &(c->win), 1); 47 | @@ -1418,7 +1428,7 @@ sendmon(Client *c, Monitor *m) 48 | detachstack(c); 49 | c->mon = m; 50 | c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ 51 | - attach(c); 52 | + attachbottom(c); 53 | attachstack(c); 54 | focus(NULL); 55 | arrange(NULL); 56 | @@ -1900,7 +1910,7 @@ updategeom(void) 57 | m->clients = c->next; 58 | detachstack(c); 59 | c->mon = mons; 60 | - attach(c); 61 | + attachbottom(c); 62 | attachstack(c); 63 | } 64 | if (m == selmon) 65 | -- 66 | 2.29.2 67 | 68 | -------------------------------------------------------------------------------- /dwm/patches/dwm-preserveonrestart-6.3.diff: -------------------------------------------------------------------------------- 1 | From 713fa8650f5a20006451ebcccf57a4512e83bae8 Mon Sep 17 00:00:00 2001 2 | From: Arda Atci 3 | Date: Wed, 18 May 2022 17:23:16 +0300 4 | Subject: [PATCH] preserve clients on old tags when renewing dwm 5 | 6 | By default, when dwm is recompiled-restarted all clients will 7 | lose it's current tag and collapse to first tag. This patch preserves 8 | clients on old tags, however note that layout order is not preserved. 9 | 10 | --- 11 | dwm.c | 38 +++++++++++++++++++++++++++++++++++++- 12 | 1 file changed, 37 insertions(+), 1 deletion(-) 13 | 14 | diff --git a/dwm.c b/dwm.c 15 | index a96f33c..a12e0bd 100644 16 | --- a/dwm.c 17 | +++ b/dwm.c 18 | @@ -62,7 +62,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 19 | enum { SchemeNorm, SchemeSel }; /* color schemes */ 20 | enum { NetSupported, NetWMName, NetWMState, NetWMCheck, 21 | NetWMFullscreen, NetActiveWindow, NetWMWindowType, 22 | - NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ 23 | + NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetLast }; /* EWMH atoms */ 24 | enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ 25 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, 26 | ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ 27 | @@ -198,6 +198,7 @@ static void scan(void); 28 | static int sendevent(Client *c, Atom proto); 29 | static void sendmon(Client *c, Monitor *m); 30 | static void setclientstate(Client *c, long state); 31 | +static void setclienttagprop(Client *c); 32 | static void setfocus(Client *c); 33 | static void setfullscreen(Client *c, int fullscreen); 34 | static void setlayout(const Arg *arg); 35 | @@ -1060,6 +1061,26 @@ manage(Window w, XWindowAttributes *wa) 36 | updatewindowtype(c); 37 | updatesizehints(c); 38 | updatewmhints(c); 39 | + { 40 | + int format; 41 | + unsigned long *data, n, extra; 42 | + Monitor *m; 43 | + Atom atom; 44 | + if (XGetWindowProperty(dpy, c->win, netatom[NetClientInfo], 0L, 2L, False, XA_CARDINAL, 45 | + &atom, &format, &n, &extra, (unsigned char **)&data) == Success && n == 2) { 46 | + c->tags = *data; 47 | + for (m = mons; m; m = m->next) { 48 | + if (m->num == *(data+1)) { 49 | + c->mon = m; 50 | + break; 51 | + } 52 | + } 53 | + } 54 | + if (n > 0) 55 | + XFree(data); 56 | + } 57 | + setclienttagprop(c); 58 | + 59 | XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); 60 | grabbuttons(c, 0); 61 | if (!c->isfloating) 62 | @@ -1423,6 +1444,7 @@ sendmon(Client *c, Monitor *m) 63 | c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ 64 | attach(c); 65 | attachstack(c); 66 | + setclienttagprop(c); 67 | focus(NULL); 68 | arrange(NULL); 69 | } 70 | @@ -1566,6 +1588,7 @@ setup(void) 71 | netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); 72 | netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); 73 | netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); 74 | + netatom[NetClientInfo] = XInternAtom(dpy, "_NET_CLIENT_INFO", False); 75 | /* init cursors */ 76 | cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); 77 | cursor[CurResize] = drw_cur_create(drw, XC_sizing); 78 | @@ -1589,6 +1612,7 @@ setup(void) 79 | XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, 80 | PropModeReplace, (unsigned char *) netatom, NetLast); 81 | XDeleteProperty(dpy, root, netatom[NetClientList]); 82 | + XDeleteProperty(dpy, root, netatom[NetClientInfo]); 83 | /* select events */ 84 | wa.cursor = cursor[CurNormal]->cursor; 85 | wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask 86 | @@ -1656,11 +1680,22 @@ spawn(const Arg *arg) 87 | } 88 | } 89 | 90 | +void 91 | +setclienttagprop(Client *c) 92 | +{ 93 | + long data[] = { (long) c->tags, (long) c->mon->num }; 94 | + XChangeProperty(dpy, c->win, netatom[NetClientInfo], XA_CARDINAL, 32, 95 | + PropModeReplace, (unsigned char *) data, 2); 96 | +} 97 | + 98 | void 99 | tag(const Arg *arg) 100 | { 101 | + Client *c; 102 | if (selmon->sel && arg->ui & TAGMASK) { 103 | + c = selmon->sel; 104 | selmon->sel->tags = arg->ui & TAGMASK; 105 | + setclienttagprop(c); 106 | focus(NULL); 107 | arrange(selmon); 108 | } 109 | @@ -1735,6 +1770,7 @@ toggletag(const Arg *arg) 110 | newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); 111 | if (newtags) { 112 | selmon->sel->tags = newtags; 113 | + setclienttagprop(selmon->sel); 114 | focus(NULL); 115 | arrange(selmon); 116 | } 117 | -- 118 | 2.36.1 119 | -------------------------------------------------------------------------------- /dwm/patches/dwm-restartsig-20180523-6.2.diff: -------------------------------------------------------------------------------- 1 | From 2991f37f0aaf44b9f9b11e7893ff0af8eb88f649 Mon Sep 17 00:00:00 2001 2 | From: Christopher Drelich 3 | Date: Wed, 23 May 2018 22:50:38 -0400 4 | Subject: [PATCH] Modifies quit to handle restarts and adds SIGHUP and SIGTERM 5 | handlers. 6 | 7 | Modified quit() to restart if it receives arg .i = 1 8 | MOD+CTRL+SHIFT+Q was added to confid.def.h to do just that. 9 | 10 | Signal handlers were handled for SIGHUP and SIGTERM. 11 | If dwm receives these signals it calls quit() with 12 | arg .i = to 1 or 0, respectively. 13 | 14 | To restart dwm: 15 | MOD+CTRL+SHIFT+Q 16 | or 17 | kill -HUP dwmpid 18 | 19 | To quit dwm cleanly: 20 | MOD+SHIFT+Q 21 | or 22 | kill -TERM dwmpid 23 | --- 24 | config.def.h | 1 + 25 | dwm.1 | 10 ++++++++++ 26 | dwm.c | 22 ++++++++++++++++++++++ 27 | 3 files changed, 33 insertions(+) 28 | 29 | diff --git a/config.def.h b/config.def.h 30 | index a9ac303..e559429 100644 31 | --- a/config.def.h 32 | +++ b/config.def.h 33 | @@ -94,6 +94,7 @@ static Key keys[] = { 34 | TAGKEYS( XK_8, 7) 35 | TAGKEYS( XK_9, 8) 36 | { MODKEY|ShiftMask, XK_q, quit, {0} }, 37 | + { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, 38 | }; 39 | 40 | /* button definitions */ 41 | diff --git a/dwm.1 b/dwm.1 42 | index 13b3729..36a331c 100644 43 | --- a/dwm.1 44 | +++ b/dwm.1 45 | @@ -142,6 +142,9 @@ Add/remove all windows with nth tag to/from the view. 46 | .TP 47 | .B Mod1\-Shift\-q 48 | Quit dwm. 49 | +.TP 50 | +.B Mod1\-Control\-Shift\-q 51 | +Restart dwm. 52 | .SS Mouse commands 53 | .TP 54 | .B Mod1\-Button1 55 | @@ -155,6 +158,13 @@ Resize focused window while dragging. Tiled windows will be toggled to the float 56 | .SH CUSTOMIZATION 57 | dwm is customized by creating a custom config.h and (re)compiling the source 58 | code. This keeps it fast, secure and simple. 59 | +.SH SIGNALS 60 | +.TP 61 | +.B SIGHUP - 1 62 | +Restart the dwm process. 63 | +.TP 64 | +.B SIGTERM - 15 65 | +Cleanly terminate the dwm process. 66 | .SH SEE ALSO 67 | .BR dmenu (1), 68 | .BR st (1) 69 | diff --git a/dwm.c b/dwm.c 70 | index bb95e26..286eecd 100644 71 | --- a/dwm.c 72 | +++ b/dwm.c 73 | @@ -205,6 +205,8 @@ static void setup(void); 74 | static void seturgent(Client *c, int urg); 75 | static void showhide(Client *c); 76 | static void sigchld(int unused); 77 | +static void sighup(int unused); 78 | +static void sigterm(int unused); 79 | static void spawn(const Arg *arg); 80 | static void tag(const Arg *arg); 81 | static void tagmon(const Arg *arg); 82 | @@ -260,6 +262,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { 83 | [UnmapNotify] = unmapnotify 84 | }; 85 | static Atom wmatom[WMLast], netatom[NetLast]; 86 | +static int restart = 0; 87 | static int running = 1; 88 | static Cur *cursor[CurLast]; 89 | static Clr **scheme; 90 | @@ -1248,6 +1251,7 @@ propertynotify(XEvent *e) 91 | void 92 | quit(const Arg *arg) 93 | { 94 | + if(arg->i) restart = 1; 95 | running = 0; 96 | } 97 | 98 | @@ -1536,6 +1540,9 @@ setup(void) 99 | /* clean up any zombies immediately */ 100 | sigchld(0); 101 | 102 | + signal(SIGHUP, sighup); 103 | + signal(SIGTERM, sigterm); 104 | + 105 | /* init screen */ 106 | screen = DefaultScreen(dpy); 107 | sw = DisplayWidth(dpy, screen); 108 | @@ -1637,6 +1644,20 @@ sigchld(int unused) 109 | } 110 | 111 | void 112 | +sighup(int unused) 113 | +{ 114 | + Arg a = {.i = 1}; 115 | + quit(&a); 116 | +} 117 | + 118 | +void 119 | +sigterm(int unused) 120 | +{ 121 | + Arg a = {.i = 0}; 122 | + quit(&a); 123 | +} 124 | + 125 | +void 126 | spawn(const Arg *arg) 127 | { 128 | if (arg->v == dmenucmd) 129 | @@ -2139,6 +2160,7 @@ main(int argc, char *argv[]) 130 | setup(); 131 | scan(); 132 | run(); 133 | + if(restart) execvp(argv[0], argv); 134 | cleanup(); 135 | XCloseDisplay(dpy); 136 | return EXIT_SUCCESS; 137 | -- 138 | 2.7.4 139 | 140 | -------------------------------------------------------------------------------- /dwm/patches/dwm-rotatestack-20161021-ab9571b.diff: -------------------------------------------------------------------------------- 1 | diff --git a/config.def.h b/config.def.h 2 | index fd77a07..09737d7 100644 3 | --- a/config.def.h 4 | +++ b/config.def.h 5 | @@ -64,6 +64,8 @@ static Key keys[] = { 6 | { MODKEY, XK_p, spawn, {.v = dmenucmd } }, 7 | { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, 8 | { MODKEY, XK_b, togglebar, {0} }, 9 | + { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } }, 10 | + { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } }, 11 | { MODKEY, XK_j, focusstack, {.i = +1 } }, 12 | { MODKEY, XK_k, focusstack, {.i = -1 } }, 13 | { MODKEY, XK_i, incnmaster, {.i = +1 } }, 14 | diff --git a/dwm.c b/dwm.c 15 | index 421bf27..1ec8b10 100644 16 | --- a/dwm.c 17 | +++ b/dwm.c 18 | @@ -165,6 +165,8 @@ static void detachstack(Client *c); 19 | static Monitor *dirtomon(int dir); 20 | static void drawbar(Monitor *m); 21 | static void drawbars(void); 22 | +static void enqueue(Client *c); 23 | +static void enqueuestack(Client *c); 24 | static void enternotify(XEvent *e); 25 | static void expose(XEvent *e); 26 | static void focus(Client *c); 27 | @@ -194,6 +196,7 @@ static void resize(Client *c, int x, int y, int w, int h, int interact); 28 | static void resizeclient(Client *c, int x, int y, int w, int h); 29 | static void resizemouse(const Arg *arg); 30 | static void restack(Monitor *m); 31 | +static void rotatestack(const Arg *arg); 32 | static void run(void); 33 | static void scan(void); 34 | static int sendevent(Client *c, Atom proto); 35 | @@ -765,6 +768,28 @@ drawbars(void) 36 | } 37 | 38 | void 39 | +enqueue(Client *c) 40 | +{ 41 | + Client *l; 42 | + for (l = c->mon->clients; l && l->next; l = l->next); 43 | + if (l) { 44 | + l->next = c; 45 | + c->next = NULL; 46 | + } 47 | +} 48 | + 49 | +void 50 | +enqueuestack(Client *c) 51 | +{ 52 | + Client *l; 53 | + for (l = c->mon->stack; l && l->snext; l = l->snext); 54 | + if (l) { 55 | + l->snext = c; 56 | + c->snext = NULL; 57 | + } 58 | +} 59 | + 60 | +void 61 | enternotify(XEvent *e) 62 | { 63 | Client *c; 64 | @@ -1390,6 +1415,38 @@ restack(Monitor *m) 65 | } 66 | 67 | void 68 | +rotatestack(const Arg *arg) 69 | +{ 70 | + Client *c = NULL, *f; 71 | + 72 | + if (!selmon->sel) 73 | + return; 74 | + f = selmon->sel; 75 | + if (arg->i > 0) { 76 | + for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next)); 77 | + if (c){ 78 | + detach(c); 79 | + attach(c); 80 | + detachstack(c); 81 | + attachstack(c); 82 | + } 83 | + } else { 84 | + if ((c = nexttiled(selmon->clients))){ 85 | + detach(c); 86 | + enqueue(c); 87 | + detachstack(c); 88 | + enqueuestack(c); 89 | + } 90 | + } 91 | + if (c){ 92 | + arrange(selmon); 93 | + //unfocus(f, 1); 94 | + focus(f); 95 | + restack(selmon); 96 | + } 97 | +} 98 | + 99 | +void 100 | run(void) 101 | { 102 | XEvent ev; 103 | -------------------------------------------------------------------------------- /dwm/patches/dwm-stairs-20220430-8b48e30.diff: -------------------------------------------------------------------------------- 1 | From a189dd70bd7c0789a11f304ceb75fd2d66fa405d Mon Sep 17 00:00:00 2001 2 | From: Ehsan Ghorbannezhad 3 | Date: Sat, 30 Apr 2022 01:15:20 +0430 4 | Subject: [PATCH] add a new layout called stairs 5 | 6 | --- 7 | config.def.h | 5 +++++ 8 | dwm.c | 38 ++++++++++++++++++++++++++++++++++++++ 9 | 2 files changed, 43 insertions(+) 10 | 11 | diff --git a/config.def.h b/config.def.h 12 | index a2ac963..7774f1e 100644 13 | --- a/config.def.h 14 | +++ b/config.def.h 15 | @@ -5,6 +5,9 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ 16 | static const unsigned int snap = 32; /* snap pixel */ 17 | static const int showbar = 1; /* 0 means no bar */ 18 | static const int topbar = 1; /* 0 means bottom bar */ 19 | +static const unsigned int stairpx = 20; /* depth of the stairs layout */ 20 | +static const int stairdirection = 1; /* 0: left-aligned, 1: right-aligned */ 21 | +static const int stairsamesize = 1; /* 1 means shrink all the staired windows to the same size */ 22 | static const char *fonts[] = { "monospace:size=10" }; 23 | static const char dmenufont[] = "monospace:size=10"; 24 | static const char col_gray1[] = "#222222"; 25 | @@ -42,6 +45,7 @@ static const Layout layouts[] = { 26 | { "[]=", tile }, /* first entry is default */ 27 | { "><>", NULL }, /* no layout function means floating behavior */ 28 | { "[M]", monocle }, 29 | + { "[S]", stairs }, 30 | }; 31 | 32 | /* key definitions */ 33 | @@ -77,6 +81,7 @@ static Key keys[] = { 34 | { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, 35 | { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, 36 | { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, 37 | + { MODKEY, XK_s, setlayout, {.v = &layouts[3]} }, 38 | { MODKEY, XK_space, setlayout, {0} }, 39 | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, 40 | { MODKEY, XK_0, view, {.ui = ~0 } }, 41 | diff --git a/dwm.c b/dwm.c 42 | index 5646a5c..fcdbb06 100644 43 | --- a/dwm.c 44 | +++ b/dwm.c 45 | @@ -207,6 +207,7 @@ static void seturgent(Client *c, int urg); 46 | static void showhide(Client *c); 47 | static void sigchld(int unused); 48 | static void spawn(const Arg *arg); 49 | +static void stairs(Monitor *m); 50 | static void tag(const Arg *arg); 51 | static void tagmon(const Arg *arg); 52 | static void tile(Monitor *); 53 | @@ -1659,6 +1660,43 @@ spawn(const Arg *arg) 54 | } 55 | } 56 | 57 | +void 58 | +stairs(Monitor *m) 59 | +{ 60 | + unsigned int i, n, h, mw, my; 61 | + unsigned int ox, oy, ow, oh; /* stair offset values */ 62 | + Client *c; 63 | + 64 | + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); 65 | + if (n == 0) 66 | + return; 67 | + 68 | + if (n > m->nmaster) 69 | + mw = m->nmaster ? m->ww * m->mfact : 0; 70 | + else 71 | + mw = m->ww; 72 | + 73 | + for (i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { 74 | + if (i < m->nmaster) { 75 | + h = (m->wh - my) / (MIN(n, m->nmaster) - i); 76 | + resize(c, m->wx, m->wy + my, mw - (2 * c->bw), h - (2 * c->bw), 0); 77 | + if (my + HEIGHT(c) < m->wh) 78 | + my += HEIGHT(c); 79 | + } else { 80 | + oy = i - m->nmaster; 81 | + ox = stairdirection ? n - i - 1 : (stairsamesize ? i - m->nmaster : 0); 82 | + ow = stairsamesize ? n - m->nmaster - 1 : n - i - 1; 83 | + oh = stairsamesize ? ow : i - m->nmaster; 84 | + resize(c, 85 | + m->wx + mw + (ox * stairpx), 86 | + m->wy + (oy * stairpx), 87 | + m->ww - mw - (2 * c->bw) - (ow * stairpx), 88 | + m->wh - (2 * c->bw) - (oh * stairpx), 89 | + 0); 90 | + } 91 | + } 92 | +} 93 | + 94 | void 95 | tag(const Arg *arg) 96 | { 97 | -- 98 | 2.36.0 99 | -------------------------------------------------------------------------------- /dwm/patches/dwm-titlecolor-20210815-ed3ab6b4.diff: -------------------------------------------------------------------------------- 1 | From 45a45a0e67f3841d8c4aed2c52b57c2a7ddf2a9a Mon Sep 17 00:00:00 2001 2 | From: Jack Bird 3 | Date: Sun, 15 Aug 2021 23:15:52 +0100 4 | Subject: [PATCH] Updated title color patch for 7162335 5 | 6 | --- 7 | config.def.h | 1 + 8 | dwm.c | 4 ++-- 9 | 2 files changed, 3 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/config.def.h b/config.def.h 12 | index a2ac963..5b9ae00 100644 13 | --- a/config.def.h 14 | +++ b/config.def.h 15 | @@ -16,6 +16,7 @@ static const char *colors[][3] = { 16 | /* fg bg border */ 17 | [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, 18 | [SchemeSel] = { col_gray4, col_cyan, col_cyan }, 19 | + [SchemeTitle] = { col_gray4, col_cyan, col_cyan }, 20 | }; 21 | 22 | /* tagging */ 23 | diff --git a/dwm.c b/dwm.c 24 | index 5e4d494..73d335e 100644 25 | --- a/dwm.c 26 | +++ b/dwm.c 27 | @@ -59,7 +59,7 @@ 28 | 29 | /* enums */ 30 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 31 | -enum { SchemeNorm, SchemeSel }; /* color schemes */ 32 | +enum { SchemeNorm, SchemeSel, SchemeTitle }; /* color schemes */ 33 | enum { NetSupported, NetWMName, NetWMState, NetWMCheck, 34 | NetWMFullscreen, NetActiveWindow, NetWMWindowType, 35 | NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ 36 | @@ -731,7 +731,7 @@ drawbar(Monitor *m) 37 | 38 | if ((w = m->ww - tw - x) > bh) { 39 | if (m->sel) { 40 | - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); 41 | + drw_setscheme(drw, scheme[m == selmon ? SchemeTitle : SchemeNorm]); 42 | drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); 43 | if (m->sel->isfloating) 44 | drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); 45 | -- 46 | 2.32.0 47 | 48 | -------------------------------------------------------------------------------- /dwm/scripts/brightnessnotifications.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function send_notification(){ 4 | brightness=$(rumos -p get) 5 | dunstify -a "brightnessnotification" -u normal -r "9994" -h int:value:"$brightness" "Brightness: ${brightness}" -t 2000 6 | } 7 | 8 | case $1 in 9 | up) 10 | rumos inc 5 11 | send_notification $1 12 | ;; 13 | down) 14 | rumos dec 5 15 | send_notification $1 16 | ;; 17 | esac 18 | -------------------------------------------------------------------------------- /dwm/scripts/browserbookmarks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | options=( 4 | " DuckDuckGo 5 |  Github 6 |  Youtube 7 |  Piped 8 |  Trello 9 |  Simplenote 10 | 󰊿 DeepL 11 |  Reddit") 12 | 13 | choice=$(echo -e "${options[@]}" | dmenu -c -g 1 -fn "JetBrainsMono Nerd Font" -nb '#1e1e2d' -nf "#abe9b3" -sb "#d5aeea" -sf "#1e1d2d" -shb "#cba6f7" -shf "#585b70" -nhb "#1e1e2e" -nfh "#585b70" -l 15 -h 30 -p 'Bookmarks: ') 14 | 15 | case "$choice" in 16 | " DuckDuckGo") 17 | choice="https://duckduckgo.com/" 18 | ;; 19 | " Github") 20 | choice="https://github.com/" 21 | ;; 22 | " Youtube") 23 | choice="https://youtube.com/" 24 | ;; 25 | " Trello") 26 | choice="https://trello.com/" 27 | ;; 28 | " Simplenote") 29 | choice="https://app.simplenote.com/" 30 | ;; 31 | "󰊿 DeepL") 32 | choice="https://www.deepl.com/translator" 33 | ;; 34 | " Piped") 35 | choice="https://piped.garudalinux.org/" 36 | ;; 37 | " Reddit") 38 | choice="https://www.reddit.com/" 39 | ;; 40 | *) 41 | exit 1 42 | ;; 43 | esac 44 | 45 | thorium-browser "$choice" 46 | -------------------------------------------------------------------------------- /dwm/scripts/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | options=( 4 | "Alacritty 5 | Dmenu 6 | DWM 7 | Dunst 8 | Fastfetch 9 | Fish 10 | Nvim 11 | St 12 | Slstatus 13 | Bash 14 | Zsh 15 | Fish 16 | Tmux 17 | Tmux Statusline") 18 | 19 | choice=$(echo -e "${options[@]}" | dmenu -c -g 1 -fn "JetBrainsMono Nerd Font" -nb '#1e1e2d' -nf "#abe9b3" -sb "#d5aeea" -sf "#1e1d2d" -shb "#cba6f7" -shf "#585b70" -nhb "#1e1e2e" -nfh "#585b70" -l 15 -h 30 -p 'Dotfiles: ') 20 | 21 | case "$choice" in 22 | Alacritty) 23 | choice="$HOME/.config/alacritty/" 24 | ;; 25 | DWM) 26 | choice="$HOME/.config/suckless/dwm/" 27 | ;; 28 | Dmenu) 29 | choice="$HOME/.config/suckless/dmenu/" 30 | ;; 31 | Dunst) 32 | choice="$HOME/.config/dunst/" 33 | ;; 34 | Fastfetch) 35 | choice="$HOME/.config/fastfetch/" 36 | ;; 37 | Fish) 38 | choice="$HOME/.config/fish/" 39 | ;; 40 | Nvim) 41 | choice="$HOME/.config/nvim" 42 | ;; 43 | St) 44 | choice="$HOME/.config/suckless/st/" 45 | ;; 46 | Slstatus) 47 | choice="$HOME/.config/suckless/slstatus/" 48 | ;; 49 | Bash) 50 | choice="$HOME/.bashrc" 51 | ;; 52 | Zsh) 53 | choice="$HOME/.zshrc" 54 | ;; 55 | Fish) 56 | choice="$HOME/.config/fish/" 57 | ;; 58 | Tmux) 59 | choice="$HOME/.config/tmux/tmux.conf" 60 | ;; 61 | 'Tmux Statusline') 62 | choice="$HOME/.config/tmux/statusline.conf" 63 | ;; 64 | *) 65 | exit 1 66 | ;; 67 | esac 68 | 69 | st -e nvim "$choice" 70 | -------------------------------------------------------------------------------- /dwm/scripts/powermenu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function powermenu { 4 | options="Shutdown\nRestart\nExit\nSleep\nCancel" 5 | selected=$(echo -e $options | dmenu -c -g 1 -fn "JetBrainsMono Nerd Font" -nb "#1e1d2d" -nf "#abe9b3" -sb "#d5aeea" -sf "#1e1d2d" -shb "#cba6f7" -shf "#585b70" -nhb "#1e1e2e" -nfh "#585b70" -l 5 -h 40 -p '') 6 | if [[ $selected = "Shutdown" ]]; then 7 | systemctl poweroff 8 | elif [[ $selected = "Restart" ]]; then 9 | systemctl reboot 10 | elif [[ $selected = "Sleep" ]]; then 11 | systemctl suspend 12 | elif [[ $selected = "Exit" ]]; then 13 | systemctl exit 14 | elif [[ $selected = "Cancel" ]]; then 15 | return 16 | fi 17 | } 18 | 19 | powermenu 20 | -------------------------------------------------------------------------------- /dwm/scripts/volumenotifications.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function send_notification() { 4 | volume=$(pamixer --get-volume) 5 | dunstify -a "changevolume" -u normal -r "9993" -h int:value:"$volume" -i "audio-volume-$1" "Volume: ${volume}%" -t 2000 6 | } 7 | 8 | case $1 in 9 | up) 10 | pamixer -u 11 | pamixer -i 5 --allow-boost 12 | send_notification $1 13 | ;; 14 | down) 15 | pamixer -u 16 | pamixer -d 5 --allow-boost 17 | send_notification $1 18 | ;; 19 | mute) 20 | pamixer -t 21 | if $(pamixer --get-mute); then 22 | dunstify -i volume-mute -a "changevolume" -t 2000 -r 9993 -u low "Muted" 23 | else 24 | send_notification up 25 | fi 26 | ;; 27 | esac 28 | -------------------------------------------------------------------------------- /dwm/transient.c: -------------------------------------------------------------------------------- 1 | /* cc transient.c -o transient -lX11 */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(void) { 9 | Display *d; 10 | Window r, f, t = None; 11 | XSizeHints h; 12 | XEvent e; 13 | 14 | d = XOpenDisplay(NULL); 15 | if (!d) 16 | exit(1); 17 | r = DefaultRootWindow(d); 18 | 19 | f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0); 20 | h.min_width = h.max_width = h.min_height = h.max_height = 400; 21 | h.flags = PMinSize | PMaxSize; 22 | XSetWMNormalHints(d, f, &h); 23 | XStoreName(d, f, "floating"); 24 | XMapWindow(d, f); 25 | 26 | XSelectInput(d, f, ExposureMask); 27 | while (1) { 28 | XNextEvent(d, &e); 29 | 30 | if (t == None) { 31 | sleep(5); 32 | t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0); 33 | XSetTransientForHint(d, t, f); 34 | XStoreName(d, t, "transient"); 35 | XMapWindow(d, t); 36 | XSelectInput(d, t, ExposureMask); 37 | } 38 | } 39 | 40 | XCloseDisplay(d); 41 | exit(0); 42 | } 43 | -------------------------------------------------------------------------------- /dwm/util.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "util.h" 8 | 9 | void 10 | die(const char *fmt, ...) 11 | { 12 | va_list ap; 13 | 14 | va_start(ap, fmt); 15 | vfprintf(stderr, fmt, ap); 16 | va_end(ap); 17 | 18 | if (fmt[0] && fmt[strlen(fmt)-1] == ':') { 19 | fputc(' ', stderr); 20 | perror(NULL); 21 | } else { 22 | fputc('\n', stderr); 23 | } 24 | 25 | exit(1); 26 | } 27 | 28 | void * 29 | ecalloc(size_t nmemb, size_t size) 30 | { 31 | void *p; 32 | 33 | if (!(p = calloc(nmemb, size))) 34 | die("calloc:"); 35 | return p; 36 | } 37 | -------------------------------------------------------------------------------- /dwm/util.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | #define MAX(A, B) ((A) > (B) ? (A) : (B)) 4 | #define MIN(A, B) ((A) < (B) ? (A) : (B)) 5 | #define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) 6 | 7 | void die(const char *fmt, ...); 8 | void *ecalloc(size_t nmemb, size_t size); 9 | -------------------------------------------------------------------------------- /dwm/util.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/dwm/util.o -------------------------------------------------------------------------------- /img/s1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/img/s1.png -------------------------------------------------------------------------------- /img/s2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/img/s2.png -------------------------------------------------------------------------------- /img/s3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/img/s3.png -------------------------------------------------------------------------------- /script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | CONF=$HOME/.config 3 | SUCKLESS=$HOME/suckless 4 | 5 | cd "$HOME" || exit 6 | sudo pacman -Sy base-devel xorg-server xorg-xinit libx11 libxinerama libxft libxext libxcb xcb-util-renderutil xcb-util-image pixman dbus libconfig libglvnd pcre libev uthash xorgproto xcb-util meson ninja webkit2gtk dunst pcmanfm flameshot feh brightnessctl pamixer ttf-ubuntu-mono-nerd ttf-jetbrains-mono playerctl imlib2 7 | 8 | if [ ! -d "$CONF" ]; 9 | then 10 | mkdir .config 11 | fi 12 | 13 | if [ ! -d "$SUCKLESS" ]; 14 | then 15 | mkdir "$HOME/.config/suckless" 16 | fi 17 | 18 | cp -r dwm-config-files/{dmenu,dunst,dwm,slock,slstatus,st} "$HOME"/.config/suckless 19 | 20 | touch .xinitrc 21 | echo "exec dwm" > .xinitrc 22 | 23 | cd "$HOME"/.config/suckless/st || exit 24 | sudo make clean install 25 | cd "$HOME"/.config/suckless/dwm || exit 26 | sudo make clean install 27 | cd "$HOME"/.config/suckless/dmenu || exit 28 | sudo make clean install 29 | cd "$HOME"/.config/suckless/slock || exit 30 | sudo make clean install 31 | cd "$HOME"/.config/suckless/slstatus || exit 32 | sudo make clean install 33 | 34 | sudo chmod +x "$HOME"/.config/suckless/dwm/scripts/{powermenu.sh,volumenotifications.sh,brightnessnotifications.sh,config.sh} 35 | 36 | cd "$HOME" || exit 37 | mkdir .dwm 38 | cp "$HOME"/dwm-config-files/autostart.sh "$HOME"/.dwm/ 39 | cp -r "$HOME"/dwm-config-files/.wallpapers "$HOME" 40 | 41 | cd "$HOME/.config" || exit 42 | sudo git clone https://github.com/pijulius/picom.git 43 | cd picom/ || exit 44 | sudo git submodule update --init --recursive 45 | sudo meson --buildtype=release . build 46 | sudo ninja -C build 47 | 48 | echo "---------------------" 49 | echo "Now, just type 'startx'" 50 | echo "---------------------" 51 | -------------------------------------------------------------------------------- /slock/LICENSE: -------------------------------------------------------------------------------- 1 | MIT/X Consortium License 2 | 3 | © 2015-2016 Markus Teich 4 | © 2014 Dimitris Papastamos 5 | © 2006-2014 Anselm R Garbe 6 | © 2014-2016 Laslo Hunhold 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a 9 | copy of this software and associated documentation files (the "Software"), 10 | to deal in the Software without restriction, including without limitation 11 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 | and/or sell copies of the Software, and to permit persons to whom the 13 | Software is furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /slock/Makefile: -------------------------------------------------------------------------------- 1 | # slock - simple screen locker 2 | # See LICENSE file for copyright and license details. 3 | 4 | include config.mk 5 | 6 | SRC = slock.c ${COMPATSRC} 7 | OBJ = ${SRC:.c=.o} 8 | 9 | all: options slock 10 | 11 | options: 12 | @echo slock build options: 13 | @echo "CFLAGS = ${CFLAGS}" 14 | @echo "LDFLAGS = ${LDFLAGS}" 15 | @echo "CC = ${CC}" 16 | 17 | .c.o: 18 | @echo CC $< 19 | @${CC} -c ${CFLAGS} $< 20 | 21 | ${OBJ}: config.h config.mk arg.h util.h 22 | 23 | config.h: 24 | @echo creating $@ from config.def.h 25 | @cp config.def.h $@ 26 | 27 | slock: ${OBJ} 28 | @echo CC -o $@ 29 | @${CC} -o $@ ${OBJ} ${LDFLAGS} 30 | 31 | clean: 32 | @echo cleaning 33 | @rm -f slock ${OBJ} slock-${VERSION}.tar.gz 34 | 35 | dist: clean 36 | @echo creating dist tarball 37 | @mkdir -p slock-${VERSION} 38 | @cp -R LICENSE Makefile README slock.1 config.mk \ 39 | ${SRC} config.def.h arg.h util.h slock-${VERSION} 40 | @tar -cf slock-${VERSION}.tar slock-${VERSION} 41 | @gzip slock-${VERSION}.tar 42 | @rm -rf slock-${VERSION} 43 | 44 | install: all 45 | @echo installing executable file to ${DESTDIR}${PREFIX}/bin 46 | @mkdir -p ${DESTDIR}${PREFIX}/bin 47 | @cp -f slock ${DESTDIR}${PREFIX}/bin 48 | @chmod 755 ${DESTDIR}${PREFIX}/bin/slock 49 | @chmod u+s ${DESTDIR}${PREFIX}/bin/slock 50 | @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 51 | @mkdir -p ${DESTDIR}${MANPREFIX}/man1 52 | @sed "s/VERSION/${VERSION}/g" ${DESTDIR}${MANPREFIX}/man1/slock.1 53 | @chmod 644 ${DESTDIR}${MANPREFIX}/man1/slock.1 54 | 55 | uninstall: 56 | @echo removing executable file from ${DESTDIR}${PREFIX}/bin 57 | @rm -f ${DESTDIR}${PREFIX}/bin/slock 58 | @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 59 | @rm -f ${DESTDIR}${MANPREFIX}/man1/slock.1 60 | 61 | .PHONY: all options clean dist install uninstall 62 | -------------------------------------------------------------------------------- /slock/README: -------------------------------------------------------------------------------- 1 | slock - simple screen locker 2 | ============================ 3 | simple screen locker utility for X. 4 | 5 | 6 | Requirements 7 | ------------ 8 | In order to build slock you need the Xlib header files. 9 | 10 | 11 | Installation 12 | ------------ 13 | Edit config.mk to match your local setup (slock is installed into 14 | the /usr/local namespace by default). 15 | 16 | Afterwards enter the following command to build and install slock 17 | (if necessary as root): 18 | 19 | make clean install 20 | 21 | 22 | Running slock 23 | ------------- 24 | Simply invoke the 'slock' command. To get out of it, enter your password. 25 | -------------------------------------------------------------------------------- /slock/arg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copy me if you can. 3 | * by 20h 4 | */ 5 | 6 | #ifndef ARG_H__ 7 | #define ARG_H__ 8 | 9 | extern char *argv0; 10 | 11 | /* use main(int argc, char *argv[]) */ 12 | #define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ 13 | argv[0] && argv[0][0] == '-'\ 14 | && argv[0][1];\ 15 | argc--, argv++) {\ 16 | char argc_;\ 17 | char **argv_;\ 18 | int brk_;\ 19 | if (argv[0][1] == '-' && argv[0][2] == '\0') {\ 20 | argv++;\ 21 | argc--;\ 22 | break;\ 23 | }\ 24 | for (brk_ = 0, argv[0]++, argv_ = argv;\ 25 | argv[0][0] && !brk_;\ 26 | argv[0]++) {\ 27 | if (argv_ != argv)\ 28 | break;\ 29 | argc_ = argv[0][0];\ 30 | switch (argc_) 31 | 32 | /* Handles obsolete -NUM syntax */ 33 | #define ARGNUM case '0':\ 34 | case '1':\ 35 | case '2':\ 36 | case '3':\ 37 | case '4':\ 38 | case '5':\ 39 | case '6':\ 40 | case '7':\ 41 | case '8':\ 42 | case '9' 43 | 44 | #define ARGEND }\ 45 | } 46 | 47 | #define ARGC() argc_ 48 | 49 | #define ARGNUMF() (brk_ = 1, estrtonum(argv[0], 0, INT_MAX)) 50 | 51 | #define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\ 52 | ((x), abort(), (char *)0) :\ 53 | (brk_ = 1, (argv[0][1] != '\0')?\ 54 | (&argv[0][1]) :\ 55 | (argc--, argv++, argv[0]))) 56 | 57 | #define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\ 58 | (char *)0 :\ 59 | (brk_ = 1, (argv[0][1] != '\0')?\ 60 | (&argv[0][1]) :\ 61 | (argc--, argv++, argv[0]))) 62 | 63 | #define LNGARG() &argv[0][0] 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /slock/config.def.h: -------------------------------------------------------------------------------- 1 | /* user and group to drop privileges to */ 2 | static const char *user = "octagony"; 3 | static const char *group = "octagony"; 4 | 5 | static const char *colorname[NUMCOLS] = { 6 | [INIT] = "black", /* after initialization */ 7 | [INPUT] = "#005577", /* during input */ 8 | [FAILED] = "#CC3333", /* wrong password */ 9 | [CAPS] = "red", /* CapsLock on */ 10 | }; 11 | 12 | /* treat a cleared input like a wrong password (color) */ 13 | static const int failonclear = 1; 14 | 15 | /* default message */ 16 | static const char * message = "What do you want?"; 17 | 18 | /* text color */ 19 | static const char * text_color = "#ffffff"; 20 | /* text size (must be a valid size) */ 21 | static const char * font_name = "6x13"; 22 | -------------------------------------------------------------------------------- /slock/config.def.h.orig: -------------------------------------------------------------------------------- 1 | /* user and group to drop privileges to */ 2 | static const char *user = "octagony"; 3 | static const char *group = "octagony"; 4 | 5 | static const char *colorname[NUMCOLS] = { 6 | [INIT] = "black", /* after initialization */ 7 | [INPUT] = "#005577", /* during input */ 8 | [FAILED] = "#CC3333", /* wrong password */ 9 | [CAPS] = "red", /* CapsLock on */ 10 | }; 11 | 12 | /* treat a cleared input like a wrong password (color) */ 13 | static const int failonclear = 1; 14 | -------------------------------------------------------------------------------- /slock/config.h: -------------------------------------------------------------------------------- 1 | /* user and group to drop privileges to */ 2 | static const char *user = "octagony"; 3 | static const char *group = "octagony"; 4 | 5 | static const char *colorname[NUMCOLS] = { 6 | [INIT] = "black", /* after initialization */ 7 | [INPUT] = "#005577", /* during input */ 8 | [FAILED] = "#CC3333", /* wrong password */ 9 | [CAPS] = "red", /* CapsLock on */ 10 | }; 11 | 12 | /* treat a cleared input like a wrong password (color) */ 13 | static const int failonclear = 1; 14 | 15 | /* default message */ 16 | static const char * message = "What do you want?"; 17 | 18 | /* text color */ 19 | static const char * text_color = "#ffffff"; 20 | /* text size (must be a valid size) */ 21 | static const char * font_name = "6x13"; 22 | -------------------------------------------------------------------------------- /slock/config.mk: -------------------------------------------------------------------------------- 1 | # slock version 2 | VERSION = 1.5 3 | 4 | # Customize below to fit your system 5 | 6 | # paths 7 | PREFIX = /usr/local 8 | MANPREFIX = ${PREFIX}/share/man 9 | 10 | X11INC = /usr/X11R6/include 11 | X11LIB = /usr/X11R6/lib 12 | 13 | # includes and libs 14 | INCS = -I. -I/usr/include -I${X11INC} 15 | LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext -lXrandr -lXinerama 16 | 17 | # flags 18 | CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -DHAVE_SHADOW_H 19 | CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} 20 | LDFLAGS = -s ${LIBS} 21 | COMPATSRC = explicit_bzero.c 22 | 23 | # On OpenBSD and Darwin remove -lcrypt from LIBS 24 | #LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXext -lXrandr 25 | # On *BSD remove -DHAVE_SHADOW_H from CPPFLAGS 26 | # On NetBSD add -D_NETBSD_SOURCE to CPPFLAGS 27 | #CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE -D_NETBSD_SOURCE 28 | # On OpenBSD set COMPATSRC to empty 29 | #COMPATSRC = 30 | 31 | # compiler and linker 32 | CC = cc 33 | -------------------------------------------------------------------------------- /slock/explicit_bzero.c: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */ 2 | /* 3 | * Public domain. 4 | * Written by Matthew Dempsky. 5 | */ 6 | 7 | #include 8 | 9 | __attribute__((weak)) void 10 | __explicit_bzero_hook(void *buf, size_t len) 11 | { 12 | } 13 | 14 | void 15 | explicit_bzero(void *buf, size_t len) 16 | { 17 | memset(buf, 0, len); 18 | __explicit_bzero_hook(buf, len); 19 | } 20 | -------------------------------------------------------------------------------- /slock/explicit_bzero.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slock/explicit_bzero.o -------------------------------------------------------------------------------- /slock/patches/slock-capscolor-20170106-2d2a21a.diff: -------------------------------------------------------------------------------- 1 | From 95463f58beb669d9221881deac3b6df7d9c4f162 Mon Sep 17 00:00:00 2001 2 | From: Klemens Nanni 3 | Date: Fri, 2 Sep 2016 14:53:30 +0200 4 | Subject: [PATCH] Indicate the state of CapsLock through a different color 5 | 6 | --- 7 | config.def.h | 1 + 8 | slock.c | 15 ++++++++++++--- 9 | 2 files changed, 13 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/config.def.h b/config.def.h 12 | index 9855e21..6288856 100644 13 | --- a/config.def.h 14 | +++ b/config.def.h 15 | @@ -6,6 +6,7 @@ static const char *colorname[NUMCOLS] = { 16 | [INIT] = "black", /* after initialization */ 17 | [INPUT] = "#005577", /* during input */ 18 | [FAILED] = "#CC3333", /* wrong password */ 19 | + [CAPS] = "red", /* CapsLock on */ 20 | }; 21 | 22 | /* treat a cleared input like a wrong password (color) */ 23 | diff --git a/slock.c b/slock.c 24 | index d55eb3d..d7804f1 100644 25 | --- a/slock.c 26 | +++ b/slock.c 27 | @@ -18,6 +18,7 @@ 28 | #include 29 | #include 30 | #include 31 | +#include 32 | 33 | #include "arg.h" 34 | #include "util.h" 35 | @@ -28,6 +29,7 @@ enum { 36 | INIT, 37 | INPUT, 38 | FAILED, 39 | + CAPS, 40 | NUMCOLS 41 | }; 42 | 43 | @@ -130,16 +132,20 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 44 | { 45 | XRRScreenChangeNotifyEvent *rre; 46 | char buf[32], passwd[256], *inputhash; 47 | - int num, screen, running, failure, oldc; 48 | - unsigned int len, color; 49 | + int caps, num, screen, running, failure, oldc; 50 | + unsigned int len, color, indicators; 51 | KeySym ksym; 52 | XEvent ev; 53 | 54 | len = 0; 55 | + caps = 0; 56 | running = 1; 57 | failure = 0; 58 | oldc = INIT; 59 | 60 | + if (!XkbGetIndicatorState(dpy, XkbUseCoreKbd, &indicators)) 61 | + caps = indicators & 1; 62 | + 63 | while (running && !XNextEvent(dpy, &ev)) { 64 | if (ev.type == KeyPress) { 65 | explicit_bzero(&buf, sizeof(buf)); 66 | @@ -179,6 +185,9 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 67 | if (len) 68 | passwd[len--] = '\0'; 69 | break; 70 | + case XK_Caps_Lock: 71 | + caps = !caps; 72 | + break; 73 | default: 74 | if (num && !iscntrl((int)buf[0]) && 75 | (len + num < sizeof(passwd))) { 76 | @@ -187,7 +196,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, 77 | } 78 | break; 79 | } 80 | - color = len ? INPUT : ((failure || failonclear) ? FAILED : INIT); 81 | + color = len ? (caps ? CAPS : INPUT) : (failure || failonclear ? FAILED : INIT); 82 | if (running && oldc != color) { 83 | for (screen = 0; screen < nscreens; screen++) { 84 | XSetWindowBackground(dpy, 85 | -- 86 | 2.11.0 87 | 88 | -------------------------------------------------------------------------------- /slock/slock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slock/slock -------------------------------------------------------------------------------- /slock/slock.1: -------------------------------------------------------------------------------- 1 | .Dd 2016-08-23 2 | .Dt SLOCK 1 3 | .Sh NAME 4 | .Nm slock 5 | .Nd simple X screen locker 6 | .Sh SYNOPSIS 7 | .Nm 8 | .Op Fl v 9 | .Op Fl f 10 | .Op Fl m Ar message 11 | .Op Ar cmd Op Ar arg ... 12 | .Sh DESCRIPTION 13 | .Nm 14 | is a simple X screen locker. If provided, 15 | .Ar cmd Op Ar arg ... 16 | is executed after the screen has been locked. 17 | .Sh OPTIONS 18 | .Bl -tag -width Ds 19 | .It Fl v 20 | Print version information to stdout and exit. 21 | .It Fl f 22 | List all valid X fonts and exit. 23 | .It Fl m Ar message 24 | Overrides default slock lock message. 25 | .TP 26 | .El 27 | .Sh SECURITY CONSIDERATIONS 28 | To make sure a locked screen can not be bypassed by switching VTs 29 | or killing the X server with Ctrl+Alt+Backspace, it is recommended 30 | to disable both in 31 | .Xr xorg.conf 5 32 | for maximum security: 33 | .Bd -literal -offset left 34 | Section "ServerFlags" 35 | Option "DontVTSwitch" "True" 36 | Option "DontZap" "True" 37 | EndSection 38 | .Ed 39 | .Sh EXAMPLES 40 | $ 41 | .Nm 42 | /usr/sbin/s2ram 43 | .Sh CUSTOMIZATION 44 | .Nm 45 | can be customized by creating a custom config.h from config.def.h and 46 | (re)compiling the source code. This keeps it fast, secure and simple. 47 | -------------------------------------------------------------------------------- /slock/slock.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slock/slock.o -------------------------------------------------------------------------------- /slock/util.h: -------------------------------------------------------------------------------- 1 | #undef explicit_bzero 2 | void explicit_bzero(void *, size_t); 3 | -------------------------------------------------------------------------------- /slstatus/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright 2016-2020 Aaron Marcher 4 | 5 | Copyright 2016 Roy Freytag 6 | Copyright 2016 Vincent Loupmon 7 | Copyright 2016 Daniel Walter 8 | Copyright 2016-2018 Ali H. Fardan 9 | Copyright 2016 Jody Leonard 10 | Copyright 2016-2018 Quentin Rameau 11 | Copyright 2016 Mike Coddington 12 | Copyright 2016-2018 parazyd 13 | Copyright 2017 Tobias Stoeckmann 14 | Copyright 2017-2018 Laslo Hunhold 15 | Copyright 2018 Darron Anderson 16 | Copyright 2018 Josuah Demangeon 17 | Copyright 2018 Tobias Tschinkowitz 18 | Copyright 2018 David Demelier 19 | Copyright 2018-2019 Michael Buch 20 | Copyright 2018 Ian Remmler 21 | Copyright 2016-2019 Joerg Jung 22 | Copyright 2019 Ryan Kes 23 | Copyright 2019 Cem Keylan 24 | Copyright 2019 dsp 25 | Copyright 2019-2020 Ingo Feinerer 26 | Copyright 2020 Alexandre Ratchov 27 | Copyright 2020 Mart Lubbers 28 | Copyright 2020 Daniel Moch 29 | 30 | Permission to use, copy, modify, and/or distribute this software for any 31 | purpose with or without fee is hereby granted, provided that the above 32 | copyright notice and this permission notice appear in all copies. 33 | 34 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 35 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 36 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 37 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 38 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 39 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 40 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 41 | -------------------------------------------------------------------------------- /slstatus/Makefile: -------------------------------------------------------------------------------- 1 | # See LICENSE file for copyright and license details 2 | # slstatus - suckless status monitor 3 | .POSIX: 4 | 5 | include config.mk 6 | 7 | REQ = util 8 | COM =\ 9 | components/battery\ 10 | components/cpu\ 11 | components/datetime\ 12 | components/disk\ 13 | components/entropy\ 14 | components/hostname\ 15 | components/ip\ 16 | components/kernel_release\ 17 | components/keyboard_indicators\ 18 | components/keymap\ 19 | components/load_avg\ 20 | components/netspeeds\ 21 | components/num_files\ 22 | components/ram\ 23 | components/run_command\ 24 | components/separator\ 25 | components/swap\ 26 | components/temperature\ 27 | components/uptime\ 28 | components/user\ 29 | components/volume\ 30 | components/wifi 31 | 32 | all: slstatus 33 | 34 | $(COM:=.o): config.mk $(REQ:=.h) 35 | slstatus.o: slstatus.c slstatus.h arg.h config.h config.mk $(REQ:=.h) 36 | 37 | .c.o: 38 | $(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $< 39 | 40 | config.h: 41 | cp config.def.h $@ 42 | 43 | slstatus: slstatus.o $(COM:=.o) $(REQ:=.o) 44 | $(CC) -o $@ $(LDFLAGS) $(COM:=.o) $(REQ:=.o) slstatus.o $(LDLIBS) 45 | 46 | clean: 47 | rm -f slstatus slstatus.o $(COM:=.o) $(REQ:=.o) 48 | 49 | dist: 50 | rm -rf "slstatus-$(VERSION)" 51 | mkdir -p "slstatus-$(VERSION)/components" 52 | cp -R LICENSE Makefile README config.mk config.def.h \ 53 | arg.h slstatus.c $(COM:=.c) $(REQ:=.c) $(REQ:=.h) \ 54 | slstatus.1 "slstatus-$(VERSION)" 55 | tar -cf - "slstatus-$(VERSION)" | gzip -c > "slstatus-$(VERSION).tar.gz" 56 | rm -rf "slstatus-$(VERSION)" 57 | 58 | install: all 59 | mkdir -p "$(DESTDIR)$(PREFIX)/bin" 60 | cp -f slstatus "$(DESTDIR)$(PREFIX)/bin" 61 | chmod 755 "$(DESTDIR)$(PREFIX)/bin/slstatus" 62 | mkdir -p "$(DESTDIR)$(MANPREFIX)/man1" 63 | cp -f slstatus.1 "$(DESTDIR)$(MANPREFIX)/man1" 64 | chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1" 65 | 66 | uninstall: 67 | rm -f "$(DESTDIR)$(PREFIX)/bin/slstatus" 68 | rm -f "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1" 69 | -------------------------------------------------------------------------------- /slstatus/README: -------------------------------------------------------------------------------- 1 | slstatus - suckless status 2 | ========================== 3 | slstatus is a suckless status monitor for window managers that use WM_NAME 4 | (e.g. dwm) or stdin to fill the status bar. 5 | 6 | 7 | Features 8 | -------- 9 | - Battery percentage/state/time left 10 | - CPU usage 11 | - CPU frequency 12 | - Custom shell commands 13 | - Date and time 14 | - Disk status (free storage, percentage, total storage and used storage) 15 | - Available entropy 16 | - Username/GID/UID 17 | - Hostname 18 | - IP address (IPv4 and IPv6) 19 | - Kernel version 20 | - Keyboard indicators 21 | - Keymap 22 | - Load average 23 | - Network speeds (RX and TX) 24 | - Number of files in a directory (hint: Maildir) 25 | - Memory status (free memory, percentage, total memory and used memory) 26 | - Swap status (free swap, percentage, total swap and used swap) 27 | - Temperature 28 | - Uptime 29 | - Volume percentage 30 | - WiFi signal percentage and ESSID 31 | 32 | 33 | Requirements 34 | ------------ 35 | Currently slstatus works on FreeBSD, Linux and OpenBSD. 36 | In order to build slstatus you need the Xlib header files. 37 | 38 | 39 | Installation 40 | ------------ 41 | Edit config.mk to match your local setup (slstatus is installed into the 42 | /usr/local namespace by default). 43 | 44 | Afterwards enter the following command to build and install slstatus (if 45 | necessary as root): 46 | 47 | make clean install 48 | 49 | 50 | Running slstatus 51 | ---------------- 52 | See the man page for details. 53 | 54 | 55 | Configuration 56 | ------------- 57 | slstatus can be customized by creating a custom config.h and (re)compiling the 58 | source code. This keeps it fast, secure and simple. 59 | 60 | 61 | Upcoming 62 | -------- 63 | 64 | A release (v1.0) will come soon... ;) 65 | After a long phase of inactivity, development has been continued! 66 | -------------------------------------------------------------------------------- /slstatus/arg.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #ifndef ARG_H 3 | #define ARG_H 4 | 5 | extern char *argv0; 6 | 7 | /* int main(int argc, char *argv[]) */ 8 | #define ARGBEGIN for (argv0 = *argv, *argv ? (argc--, argv++) : ((void *)0); \ 9 | *argv && (*argv)[0] == '-' && (*argv)[1]; argc--, argv++) { \ 10 | int i_, argused_; \ 11 | if ((*argv)[1] == '-' && !(*argv)[2]) { \ 12 | argc--, argv++; \ 13 | break; \ 14 | } \ 15 | for (i_ = 1, argused_ = 0; (*argv)[i_]; i_++) { \ 16 | switch((*argv)[i_]) 17 | #define ARGEND if (argused_) { \ 18 | if ((*argv)[i_ + 1]) { \ 19 | break; \ 20 | } else { \ 21 | argc--, argv++; \ 22 | break; \ 23 | } \ 24 | } \ 25 | } \ 26 | } 27 | #define ARGC() ((*argv)[i_]) 28 | #define ARGF_(x) (((*argv)[i_ + 1]) ? (argused_ = 1, &((*argv)[i_ + 1])) : \ 29 | (*(argv + 1)) ? (argused_ = 1, *(argv + 1)) : (x)) 30 | #define EARGF(x) ARGF_(((x), exit(1), (char *)0)) 31 | #define ARGF() ARGF_((char *)0) 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /slstatus/components/battery.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/battery.o -------------------------------------------------------------------------------- /slstatus/components/cpu.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | 6 | #include "../util.h" 7 | 8 | #if defined(__linux__) 9 | const char * 10 | cpu_freq(void) 11 | { 12 | uintmax_t freq; 13 | 14 | /* in kHz */ 15 | if (pscanf("/sys/devices/system/cpu/cpu0/cpufreq/" 16 | "scaling_cur_freq", "%ju", &freq) != 1) { 17 | return NULL; 18 | } 19 | 20 | return fmt_human(freq * 1000, 1000); 21 | } 22 | 23 | const char * 24 | cpu_perc(void) 25 | { 26 | static long double a[7]; 27 | long double b[7], sum; 28 | 29 | memcpy(b, a, sizeof(b)); 30 | /* cpu user nice system idle iowait irq softirq */ 31 | if (pscanf("/proc/stat", "%*s %Lf %Lf %Lf %Lf %Lf %Lf %Lf", 32 | &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &a[6]) 33 | != 7) { 34 | return NULL; 35 | } 36 | if (b[0] == 0) { 37 | return NULL; 38 | } 39 | 40 | sum = (b[0] + b[1] + b[2] + b[3] + b[4] + b[5] + b[6]) - 41 | (a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6]); 42 | 43 | if (sum == 0) { 44 | return NULL; 45 | } 46 | 47 | return bprintf("%d", (int)(100 * 48 | ((b[0] + b[1] + b[2] + b[5] + b[6]) - 49 | (a[0] + a[1] + a[2] + a[5] + a[6])) / sum)); 50 | } 51 | #elif defined(__OpenBSD__) 52 | #include 53 | #include 54 | #include 55 | 56 | const char * 57 | cpu_freq(void) 58 | { 59 | int freq, mib[2]; 60 | size_t size; 61 | 62 | mib[0] = CTL_HW; 63 | mib[1] = HW_CPUSPEED; 64 | 65 | size = sizeof(freq); 66 | 67 | /* in MHz */ 68 | if (sysctl(mib, 2, &freq, &size, NULL, 0) < 0) { 69 | warn("sysctl 'HW_CPUSPEED':"); 70 | return NULL; 71 | } 72 | 73 | return fmt_human(freq * 1E6, 1000); 74 | } 75 | 76 | const char * 77 | cpu_perc(void) 78 | { 79 | int mib[2]; 80 | static uintmax_t a[CPUSTATES]; 81 | uintmax_t b[CPUSTATES], sum; 82 | size_t size; 83 | 84 | mib[0] = CTL_KERN; 85 | mib[1] = KERN_CPTIME; 86 | 87 | size = sizeof(a); 88 | 89 | memcpy(b, a, sizeof(b)); 90 | if (sysctl(mib, 2, &a, &size, NULL, 0) < 0) { 91 | warn("sysctl 'KERN_CPTIME':"); 92 | return NULL; 93 | } 94 | if (b[0] == 0) { 95 | return NULL; 96 | } 97 | 98 | sum = (a[CP_USER] + a[CP_NICE] + a[CP_SYS] + a[CP_INTR] + a[CP_IDLE]) - 99 | (b[CP_USER] + b[CP_NICE] + b[CP_SYS] + b[CP_INTR] + b[CP_IDLE]); 100 | 101 | if (sum == 0) { 102 | return NULL; 103 | } 104 | 105 | return bprintf("%d", 100 * 106 | ((a[CP_USER] + a[CP_NICE] + a[CP_SYS] + 107 | a[CP_INTR]) - 108 | (b[CP_USER] + b[CP_NICE] + b[CP_SYS] + 109 | b[CP_INTR])) / sum); 110 | } 111 | #elif defined(__FreeBSD__) 112 | #include 113 | #include 114 | #include 115 | 116 | const char * 117 | cpu_freq(void) 118 | { 119 | int freq; 120 | size_t size; 121 | 122 | size = sizeof(freq); 123 | /* in MHz */ 124 | if (sysctlbyname("hw.clockrate", &freq, &size, NULL, 0) == -1 125 | || !size) { 126 | warn("sysctlbyname 'hw.clockrate':"); 127 | return NULL; 128 | } 129 | 130 | return fmt_human(freq * 1E6, 1000); 131 | } 132 | 133 | const char * 134 | cpu_perc(void) 135 | { 136 | size_t size; 137 | static long a[CPUSTATES]; 138 | long b[CPUSTATES], sum; 139 | 140 | size = sizeof(a); 141 | memcpy(b, a, sizeof(b)); 142 | if (sysctlbyname("kern.cp_time", &a, &size, NULL, 0) == -1 143 | || !size) { 144 | warn("sysctlbyname 'kern.cp_time':"); 145 | return NULL; 146 | } 147 | if (b[0] == 0) { 148 | return NULL; 149 | } 150 | 151 | sum = (a[CP_USER] + a[CP_NICE] + a[CP_SYS] + a[CP_INTR] + a[CP_IDLE]) - 152 | (b[CP_USER] + b[CP_NICE] + b[CP_SYS] + b[CP_INTR] + b[CP_IDLE]); 153 | 154 | if (sum == 0) { 155 | return NULL; 156 | } 157 | 158 | return bprintf("%d", 100 * 159 | ((a[CP_USER] + a[CP_NICE] + a[CP_SYS] + 160 | a[CP_INTR]) - 161 | (b[CP_USER] + b[CP_NICE] + b[CP_SYS] + 162 | b[CP_INTR])) / sum); 163 | } 164 | #endif 165 | -------------------------------------------------------------------------------- /slstatus/components/cpu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/cpu.o -------------------------------------------------------------------------------- /slstatus/components/datetime.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | 5 | #include "../util.h" 6 | 7 | const char * 8 | datetime(const char *fmt) 9 | { 10 | time_t t; 11 | 12 | t = time(NULL); 13 | if (!strftime(buf, sizeof(buf), fmt, localtime(&t))) { 14 | warn("strftime: Result string exceeds buffer size"); 15 | return NULL; 16 | } 17 | 18 | return buf; 19 | } 20 | -------------------------------------------------------------------------------- /slstatus/components/datetime.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/datetime.o -------------------------------------------------------------------------------- /slstatus/components/disk.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | 5 | #include "../util.h" 6 | 7 | const char * 8 | disk_free(const char *path) 9 | { 10 | struct statvfs fs; 11 | 12 | if (statvfs(path, &fs) < 0) { 13 | warn("statvfs '%s':", path); 14 | return NULL; 15 | } 16 | 17 | return fmt_human(fs.f_frsize * fs.f_bavail, 1024); 18 | } 19 | 20 | const char * 21 | disk_perc(const char *path) 22 | { 23 | struct statvfs fs; 24 | 25 | if (statvfs(path, &fs) < 0) { 26 | warn("statvfs '%s':", path); 27 | return NULL; 28 | } 29 | 30 | return bprintf("%d", (int)(100 * 31 | (1.0f - ((float)fs.f_bavail / (float)fs.f_blocks)))); 32 | } 33 | 34 | const char * 35 | disk_total(const char *path) 36 | { 37 | struct statvfs fs; 38 | 39 | if (statvfs(path, &fs) < 0) { 40 | warn("statvfs '%s':", path); 41 | return NULL; 42 | } 43 | 44 | return fmt_human(fs.f_frsize * fs.f_blocks, 1024); 45 | } 46 | 47 | const char * 48 | disk_used(const char *path) 49 | { 50 | struct statvfs fs; 51 | 52 | if (statvfs(path, &fs) < 0) { 53 | warn("statvfs '%s':", path); 54 | return NULL; 55 | } 56 | 57 | return fmt_human(fs.f_frsize * (fs.f_blocks - fs.f_bfree), 1024); 58 | } 59 | -------------------------------------------------------------------------------- /slstatus/components/disk.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/disk.o -------------------------------------------------------------------------------- /slstatus/components/entropy.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #if defined(__linux__) 3 | #include 4 | #include 5 | 6 | #include "../util.h" 7 | 8 | const char * 9 | entropy(void) 10 | { 11 | uintmax_t num; 12 | 13 | if (pscanf("/proc/sys/kernel/random/entropy_avail", "%ju", &num) 14 | != 1) { 15 | return NULL; 16 | } 17 | 18 | return bprintf("%ju", num); 19 | } 20 | #elif defined(__OpenBSD__) | defined(__FreeBSD__) 21 | const char * 22 | entropy(void) 23 | { 24 | /* Unicode Character 'INFINITY' (U+221E) */ 25 | return "\xe2\x88\x9e"; 26 | } 27 | #endif 28 | -------------------------------------------------------------------------------- /slstatus/components/entropy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/entropy.o -------------------------------------------------------------------------------- /slstatus/components/hostname.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | 5 | #include "../util.h" 6 | 7 | const char * 8 | hostname(void) 9 | { 10 | if (gethostname(buf, sizeof(buf)) < 0) { 11 | warn("gethostbyname:"); 12 | return NULL; 13 | } 14 | 15 | return buf; 16 | } 17 | -------------------------------------------------------------------------------- /slstatus/components/hostname.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/hostname.o -------------------------------------------------------------------------------- /slstatus/components/ip.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #if defined(__OpenBSD__) 7 | #include 8 | #include 9 | #elif defined(__FreeBSD__) 10 | #include 11 | #include 12 | #endif 13 | 14 | #include "../util.h" 15 | 16 | static const char * 17 | ip(const char *interface, unsigned short sa_family) 18 | { 19 | struct ifaddrs *ifaddr, *ifa; 20 | int s; 21 | char host[NI_MAXHOST]; 22 | 23 | if (getifaddrs(&ifaddr) < 0) { 24 | warn("getifaddrs:"); 25 | return NULL; 26 | } 27 | 28 | for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { 29 | if (!ifa->ifa_addr) { 30 | continue; 31 | } 32 | s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), 33 | host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); 34 | if (!strcmp(ifa->ifa_name, interface) && 35 | (ifa->ifa_addr->sa_family == sa_family)) { 36 | freeifaddrs(ifaddr); 37 | if (s != 0) { 38 | warn("getnameinfo: %s", gai_strerror(s)); 39 | return NULL; 40 | } 41 | return bprintf("%s", host); 42 | } 43 | } 44 | 45 | freeifaddrs(ifaddr); 46 | 47 | return NULL; 48 | } 49 | 50 | const char * 51 | ipv4(const char *interface) 52 | { 53 | return ip(interface, AF_INET); 54 | } 55 | 56 | const char * 57 | ipv6(const char *interface) 58 | { 59 | return ip(interface, AF_INET6); 60 | } 61 | -------------------------------------------------------------------------------- /slstatus/components/ip.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/ip.o -------------------------------------------------------------------------------- /slstatus/components/kernel_release.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | 5 | #include "../util.h" 6 | 7 | const char * 8 | kernel_release(void) 9 | { 10 | struct utsname udata; 11 | 12 | if (uname(&udata) < 0) { 13 | warn("uname:"); 14 | return NULL; 15 | } 16 | 17 | return bprintf("%s", udata.release); 18 | } 19 | -------------------------------------------------------------------------------- /slstatus/components/kernel_release.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/kernel_release.o -------------------------------------------------------------------------------- /slstatus/components/keyboard_indicators.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../util.h" 8 | 9 | /* 10 | * fmt consists of uppercase or lowercase 'c' for caps lock and/or 'n' for num 11 | * lock, each optionally followed by '?', in the order of indicators desired. 12 | * If followed by '?', the letter with case preserved is included in the output 13 | * if the corresponding indicator is on. Otherwise, the letter is always 14 | * included, lowercase when off and uppercase when on. 15 | */ 16 | const char * 17 | keyboard_indicators(const char *fmt) 18 | { 19 | Display *dpy; 20 | XKeyboardState state; 21 | size_t fmtlen, i, n; 22 | int togglecase, isset; 23 | char key; 24 | 25 | if (!(dpy = XOpenDisplay(NULL))) { 26 | warn("XOpenDisplay: Failed to open display"); 27 | return NULL; 28 | } 29 | XGetKeyboardControl(dpy, &state); 30 | XCloseDisplay(dpy); 31 | 32 | fmtlen = strnlen(fmt, 4); 33 | for (i = n = 0; i < fmtlen; i++) { 34 | key = tolower(fmt[i]); 35 | if (key != 'c' && key != 'n') { 36 | continue; 37 | } 38 | togglecase = (i + 1 >= fmtlen || fmt[i + 1] != '?'); 39 | isset = (state.led_mask & (1 << (key == 'n'))); 40 | if (togglecase) { 41 | buf[n++] = isset ? toupper(key) : key; 42 | } else if (isset) { 43 | buf[n++] = fmt[i]; 44 | } 45 | } 46 | buf[n] = 0; 47 | return buf; 48 | } 49 | -------------------------------------------------------------------------------- /slstatus/components/keyboard_indicators.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/keyboard_indicators.o -------------------------------------------------------------------------------- /slstatus/components/keymap.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "../util.h" 9 | 10 | static int 11 | valid_layout_or_variant(char *sym) 12 | { 13 | size_t i; 14 | /* invalid symbols from xkb rules config */ 15 | static const char *invalid[] = { "evdev", "inet", "pc", "base" }; 16 | 17 | for (i = 0; i < LEN(invalid); i++) { 18 | if (!strncmp(sym, invalid[i], strlen(invalid[i]))) { 19 | return 0; 20 | } 21 | } 22 | 23 | return 1; 24 | } 25 | 26 | static char * 27 | get_layout(char *syms, int grp_num) 28 | { 29 | char *tok, *layout; 30 | int grp; 31 | 32 | layout = NULL; 33 | tok = strtok(syms, "+:"); 34 | for (grp = 0; tok && grp <= grp_num; tok = strtok(NULL, "+:")) { 35 | if (!valid_layout_or_variant(tok)) { 36 | continue; 37 | } else if (strlen(tok) == 1 && isdigit(tok[0])) { 38 | /* ignore :2, :3, :4 (additional layout groups) */ 39 | continue; 40 | } 41 | layout = tok; 42 | grp++; 43 | } 44 | 45 | return layout; 46 | } 47 | 48 | const char * 49 | keymap(void) 50 | { 51 | Display *dpy; 52 | XkbDescRec *desc; 53 | XkbStateRec state; 54 | char *symbols, *layout; 55 | 56 | layout = NULL; 57 | 58 | if (!(dpy = XOpenDisplay(NULL))) { 59 | warn("XOpenDisplay: Failed to open display"); 60 | return NULL; 61 | } 62 | if (!(desc = XkbAllocKeyboard())) { 63 | warn("XkbAllocKeyboard: Failed to allocate keyboard"); 64 | goto end; 65 | } 66 | if (XkbGetNames(dpy, XkbSymbolsNameMask, desc)) { 67 | warn("XkbGetNames: Failed to retrieve key symbols"); 68 | goto end; 69 | } 70 | if (XkbGetState(dpy, XkbUseCoreKbd, &state)) { 71 | warn("XkbGetState: Failed to retrieve keyboard state"); 72 | goto end; 73 | } 74 | if (!(symbols = XGetAtomName(dpy, desc->names->symbols))) { 75 | warn("XGetAtomName: Failed to get atom name"); 76 | goto end; 77 | } 78 | layout = (char *)bprintf("%s", get_layout(symbols, state.group)); 79 | XFree(symbols); 80 | end: 81 | XkbFreeKeyboard(desc, XkbSymbolsNameMask, 1); 82 | if (XCloseDisplay(dpy)) { 83 | warn("XCloseDisplay: Failed to close display"); 84 | } 85 | 86 | return layout; 87 | } 88 | -------------------------------------------------------------------------------- /slstatus/components/keymap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/keymap.o -------------------------------------------------------------------------------- /slstatus/components/load_avg.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | 5 | #include "../util.h" 6 | 7 | const char * 8 | load_avg(void) 9 | { 10 | double avgs[3]; 11 | 12 | if (getloadavg(avgs, 3) < 0) { 13 | warn("getloadavg: Failed to obtain load average"); 14 | return NULL; 15 | } 16 | 17 | return bprintf("%.2f %.2f %.2f", avgs[0], avgs[1], avgs[2]); 18 | } 19 | -------------------------------------------------------------------------------- /slstatus/components/load_avg.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/load_avg.o -------------------------------------------------------------------------------- /slstatus/components/netspeeds.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | 5 | #include "../util.h" 6 | 7 | #if defined(__linux__) 8 | #include 9 | 10 | const char * 11 | netspeed_rx(const char *interface) 12 | { 13 | uintmax_t oldrxbytes; 14 | static uintmax_t rxbytes; 15 | extern const unsigned int interval; 16 | char path[PATH_MAX]; 17 | 18 | oldrxbytes = rxbytes; 19 | 20 | if (esnprintf(path, sizeof(path), 21 | "/sys/class/net/%s/statistics/rx_bytes", 22 | interface) < 0) { 23 | return NULL; 24 | } 25 | if (pscanf(path, "%ju", &rxbytes) != 1) { 26 | return NULL; 27 | } 28 | if (oldrxbytes == 0) { 29 | return NULL; 30 | } 31 | 32 | return fmt_human((rxbytes - oldrxbytes) * 1000 / interval, 33 | 1024); 34 | } 35 | 36 | const char * 37 | netspeed_tx(const char *interface) 38 | { 39 | uintmax_t oldtxbytes; 40 | static uintmax_t txbytes; 41 | extern const unsigned int interval; 42 | char path[PATH_MAX]; 43 | 44 | oldtxbytes = txbytes; 45 | 46 | if (esnprintf(path, sizeof(path), 47 | "/sys/class/net/%s/statistics/tx_bytes", 48 | interface) < 0) { 49 | return NULL; 50 | } 51 | if (pscanf(path, "%ju", &txbytes) != 1) { 52 | return NULL; 53 | } 54 | if (oldtxbytes == 0) { 55 | return NULL; 56 | } 57 | 58 | return fmt_human((txbytes - oldtxbytes) * 1000 / interval, 59 | 1024); 60 | } 61 | #elif defined(__OpenBSD__) | defined(__FreeBSD__) 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | 68 | const char * 69 | netspeed_rx(const char *interface) 70 | { 71 | struct ifaddrs *ifal, *ifa; 72 | struct if_data *ifd; 73 | uintmax_t oldrxbytes; 74 | static uintmax_t rxbytes; 75 | extern const unsigned int interval; 76 | int if_ok = 0; 77 | 78 | oldrxbytes = rxbytes; 79 | 80 | if (getifaddrs(&ifal) == -1) { 81 | warn("getifaddrs failed"); 82 | return NULL; 83 | } 84 | rxbytes = 0; 85 | for (ifa = ifal; ifa; ifa = ifa->ifa_next) { 86 | if (!strcmp(ifa->ifa_name, interface) && 87 | (ifd = (struct if_data *)ifa->ifa_data)) { 88 | rxbytes += ifd->ifi_ibytes, if_ok = 1; 89 | } 90 | } 91 | freeifaddrs(ifal); 92 | if (!if_ok) { 93 | warn("reading 'if_data' failed"); 94 | return NULL; 95 | } 96 | if (oldrxbytes == 0) { 97 | return NULL; 98 | } 99 | 100 | return fmt_human((rxbytes - oldrxbytes) * 1000 / interval, 101 | 1024); 102 | } 103 | 104 | const char * 105 | netspeed_tx(const char *interface) 106 | { 107 | struct ifaddrs *ifal, *ifa; 108 | struct if_data *ifd; 109 | uintmax_t oldtxbytes; 110 | static uintmax_t txbytes; 111 | extern const unsigned int interval; 112 | int if_ok = 0; 113 | 114 | oldtxbytes = txbytes; 115 | 116 | if (getifaddrs(&ifal) == -1) { 117 | warn("getifaddrs failed"); 118 | return NULL; 119 | } 120 | txbytes = 0; 121 | for (ifa = ifal; ifa; ifa = ifa->ifa_next) { 122 | if (!strcmp(ifa->ifa_name, interface) && 123 | (ifd = (struct if_data *)ifa->ifa_data)) { 124 | txbytes += ifd->ifi_obytes, if_ok = 1; 125 | } 126 | } 127 | freeifaddrs(ifal); 128 | if (!if_ok) { 129 | warn("reading 'if_data' failed"); 130 | return NULL; 131 | } 132 | if (oldtxbytes == 0) { 133 | return NULL; 134 | } 135 | 136 | return fmt_human((txbytes - oldtxbytes) * 1000 / interval, 137 | 1024); 138 | } 139 | #endif 140 | -------------------------------------------------------------------------------- /slstatus/components/netspeeds.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/netspeeds.o -------------------------------------------------------------------------------- /slstatus/components/num_files.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | 6 | #include "../util.h" 7 | 8 | const char * 9 | num_files(const char *path) 10 | { 11 | struct dirent *dp; 12 | DIR *fd; 13 | int num; 14 | 15 | if (!(fd = opendir(path))) { 16 | warn("opendir '%s':", path); 17 | return NULL; 18 | } 19 | 20 | num = 0; 21 | while ((dp = readdir(fd))) { 22 | if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) { 23 | continue; /* skip self and parent */ 24 | } 25 | num++; 26 | } 27 | 28 | closedir(fd); 29 | 30 | return bprintf("%d", num); 31 | } 32 | -------------------------------------------------------------------------------- /slstatus/components/num_files.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/num_files.o -------------------------------------------------------------------------------- /slstatus/components/ram.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/ram.o -------------------------------------------------------------------------------- /slstatus/components/run_command.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | 5 | #include "../util.h" 6 | 7 | const char * 8 | run_command(const char *cmd) 9 | { 10 | char *p; 11 | FILE *fp; 12 | 13 | if (!(fp = popen(cmd, "r"))) { 14 | warn("popen '%s':", cmd); 15 | return NULL; 16 | } 17 | p = fgets(buf, sizeof(buf) - 1, fp); 18 | if (pclose(fp) < 0) { 19 | warn("pclose '%s':", cmd); 20 | return NULL; 21 | } 22 | if (!p) { 23 | return NULL; 24 | } 25 | if ((p = strrchr(buf, '\n'))) { 26 | p[0] = '\0'; 27 | } 28 | 29 | return buf[0] ? buf : NULL; 30 | } 31 | -------------------------------------------------------------------------------- /slstatus/components/run_command.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/run_command.o -------------------------------------------------------------------------------- /slstatus/components/separator.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | 4 | #include "../util.h" 5 | 6 | const char * 7 | separator(const char *separator) 8 | { 9 | return separator; 10 | } 11 | -------------------------------------------------------------------------------- /slstatus/components/separator.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/separator.o -------------------------------------------------------------------------------- /slstatus/components/swap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/swap.o -------------------------------------------------------------------------------- /slstatus/components/temperature.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | 4 | #include "../util.h" 5 | 6 | 7 | #if defined(__linux__) 8 | #include 9 | 10 | const char * 11 | temp(const char *file) 12 | { 13 | uintmax_t temp; 14 | 15 | if (pscanf(file, "%ju", &temp) != 1) { 16 | return NULL; 17 | } 18 | 19 | return bprintf("%ju", temp / 1000); 20 | } 21 | #elif defined(__OpenBSD__) 22 | #include 23 | #include /* before for struct timeval */ 24 | #include 25 | #include 26 | 27 | const char * 28 | temp(const char *unused) 29 | { 30 | int mib[5]; 31 | size_t size; 32 | struct sensor temp; 33 | 34 | mib[0] = CTL_HW; 35 | mib[1] = HW_SENSORS; 36 | mib[2] = 0; /* cpu0 */ 37 | mib[3] = SENSOR_TEMP; 38 | mib[4] = 0; /* temp0 */ 39 | 40 | size = sizeof(temp); 41 | 42 | if (sysctl(mib, 5, &temp, &size, NULL, 0) < 0) { 43 | warn("sysctl 'SENSOR_TEMP':"); 44 | return NULL; 45 | } 46 | 47 | /* kelvin to celsius */ 48 | return bprintf("%d", (int)((float)(temp.value-273150000) / 1E6)); 49 | } 50 | #elif defined(__FreeBSD__) 51 | #include 52 | #include 53 | #include 54 | 55 | const char * 56 | temp(const char *zone) 57 | { 58 | char buf[256]; 59 | int temp; 60 | size_t len; 61 | 62 | len = sizeof(temp); 63 | snprintf(buf, sizeof(buf), "hw.acpi.thermal.%s.temperature", zone); 64 | if (sysctlbyname(buf, &temp, &len, NULL, 0) == -1 65 | || !len) 66 | return NULL; 67 | 68 | /* kelvin to decimal celcius */ 69 | return bprintf("%d.%d", (temp - 2731) / 10, abs((temp - 2731) % 10)); 70 | } 71 | #endif 72 | -------------------------------------------------------------------------------- /slstatus/components/temperature.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/temperature.o -------------------------------------------------------------------------------- /slstatus/components/uptime.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | 6 | #include "../util.h" 7 | 8 | #if defined(CLOCK_BOOTTIME) 9 | #define UPTIME_FLAG CLOCK_BOOTTIME 10 | #elif defined(CLOCK_UPTIME) 11 | #define UPTIME_FLAG CLOCK_UPTIME 12 | #else 13 | #define UPTIME_FLAG CLOCK_MONOTONIC 14 | #endif 15 | 16 | const char * 17 | uptime(void) 18 | { 19 | char warn_buf[256]; 20 | uintmax_t h, m; 21 | struct timespec uptime; 22 | 23 | if (clock_gettime(UPTIME_FLAG, &uptime) < 0) { 24 | snprintf(warn_buf, 256, "clock_gettime %d", UPTIME_FLAG); 25 | warn(warn_buf); 26 | return NULL; 27 | } 28 | 29 | h = uptime.tv_sec / 3600; 30 | m = uptime.tv_sec % 3600 / 60; 31 | 32 | return bprintf("%juh %jum", h, m); 33 | } 34 | -------------------------------------------------------------------------------- /slstatus/components/uptime.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/uptime.o -------------------------------------------------------------------------------- /slstatus/components/user.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../util.h" 8 | 9 | const char * 10 | gid(void) 11 | { 12 | return bprintf("%d", getgid()); 13 | } 14 | 15 | const char * 16 | username(void) 17 | { 18 | struct passwd *pw; 19 | 20 | if (!(pw = getpwuid(geteuid()))) { 21 | warn("getpwuid '%d':", geteuid()); 22 | return NULL; 23 | } 24 | 25 | return bprintf("%s", pw->pw_name); 26 | } 27 | 28 | const char * 29 | uid(void) 30 | { 31 | return bprintf("%d", geteuid()); 32 | } 33 | -------------------------------------------------------------------------------- /slstatus/components/user.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/user.o -------------------------------------------------------------------------------- /slstatus/components/volume.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/volume.o -------------------------------------------------------------------------------- /slstatus/components/wifi.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/components/wifi.o -------------------------------------------------------------------------------- /slstatus/config.def.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | /* interval between updates (in ms) */ 4 | const unsigned int interval = 1000; 5 | 6 | /* text to show if no value can be retrieved */ 7 | static const char unknown_str[] = "n/a"; 8 | 9 | /* maximum output string length */ 10 | #define MAXLEN 4096 11 | 12 | /* 13 | * function description argument (example) 14 | * 15 | * battery_perc battery percentage battery name (BAT0) 16 | * NULL on OpenBSD/FreeBSD 17 | * battery_state battery charging state battery name (BAT0) 18 | * NULL on OpenBSD/FreeBSD 19 | * battery_remaining battery remaining HH:MM battery name (BAT0) 20 | * NULL on OpenBSD/FreeBSD 21 | * cpu_perc cpu usage in percent NULL 22 | * cpu_freq cpu frequency in MHz NULL 23 | * datetime date and time format string (%F %T) 24 | * disk_free free disk space in GB mountpoint path (/) 25 | * disk_perc disk usage in percent mountpoint path (/) 26 | * disk_total total disk space in GB mountpoint path (/) 27 | * disk_used used disk space in GB mountpoint path (/) 28 | * entropy available entropy NULL 29 | * gid GID of current user NULL 30 | * hostname hostname NULL 31 | * ipv4 IPv4 address interface name (eth0) 32 | * ipv6 IPv6 address interface name (eth0) 33 | * kernel_release `uname -r` NULL 34 | * keyboard_indicators caps/num lock indicators format string (c?n?) 35 | * see keyboard_indicators.c 36 | * keymap layout (variant) of current NULL 37 | * keymap 38 | * load_avg load average NULL 39 | * netspeed_rx receive network speed interface name (wlan0) 40 | * netspeed_tx transfer network speed interface name (wlan0) 41 | * num_files number of files in a directory path 42 | * (/home/foo/Inbox/cur) 43 | * ram_free free memory in GB NULL 44 | * ram_perc memory usage in percent NULL 45 | * ram_total total memory size in GB NULL 46 | * ram_used used memory in GB NULL 47 | * run_command custom shell command command (echo foo) 48 | * separator string to echo NULL 49 | * swap_free free swap in GB NULL 50 | * swap_perc swap usage in percent NULL 51 | * swap_total total swap size in GB NULL 52 | * swap_used used swap in GB NULL 53 | * temp temperature in degree celsius sensor file 54 | * (/sys/class/thermal/...) 55 | * NULL on OpenBSD 56 | * thermal zone on FreeBSD 57 | * (tz0, tz1, etc.) 58 | * uid UID of current user NULL 59 | * uptime system uptime NULL 60 | * username username of current user NULL 61 | * vol_perc OSS/ALSA volume in percent mixer file (/dev/mixer) 62 | * NULL on OpenBSD 63 | * wifi_perc WiFi signal in percent interface name (wlan0) 64 | * wifi_essid WiFi ESSID interface name (wlan0) 65 | * 66 | * COLORSCHEMES 67 | * Catppuccin : { 68 | * cpu/ram_perc #f38ba8 69 | * wifi_essid/battery_perc #fab387 70 | * kernel_release/keymap #a6e3a1 71 | * datetime #89dceb 72 | * } 73 | * Everforest:{ 74 | * cpu/ram_perc #e67e80 75 | * wifi_essid/battery_perc #e69875 76 | * kernel_release/keymap #a7c080 77 | * datetime #7fbbb3 78 | * } 79 | * 80 | * Gruvbox:{ 81 | * cpu/ram_perc #fb4934 82 | * wifi_essid/battery_perc #f38019 83 | * kernel_release/keymap #b8bb26 84 | * datetime #83a598 85 | * } 86 | */ 87 | 88 | static const struct arg args[] = { 89 | /* function format argument */ 90 | { cpu_perc, "^c#f38ba8^[  %s%% | ", NULL }, 91 | { ram_perc, " 󰍛 %s%% ] ", NULL }, 92 | { wifi_essid, "^c#fab387^[  %s | ", "wlo1" }, 93 | { battery_perc, " 󰁹 %s%% ] ", "BAT1" }, 94 | { kernel_release, "^c#a6e3a1^[  %s | ", NULL }, 95 | { keymap, "  %s ] ", NULL }, 96 | { datetime, "%s", "^c#89dceb^[  %a, %d.%m. |  %I:%M %p ] "}, 97 | }; 98 | -------------------------------------------------------------------------------- /slstatus/config.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | /* interval between updates (in ms) */ 4 | const unsigned int interval = 1000; 5 | 6 | /* text to show if no value can be retrieved */ 7 | static const char unknown_str[] = "n/a"; 8 | 9 | /* maximum output string length */ 10 | #define MAXLEN 4096 11 | 12 | /* 13 | * function description argument (example) 14 | * 15 | * battery_perc battery percentage battery name (BAT0) 16 | * NULL on OpenBSD/FreeBSD 17 | * battery_state battery charging state battery name (BAT0) 18 | * NULL on OpenBSD/FreeBSD 19 | * battery_remaining battery remaining HH:MM battery name (BAT0) 20 | * NULL on OpenBSD/FreeBSD 21 | * cpu_perc cpu usage in percent NULL 22 | * cpu_freq cpu frequency in MHz NULL 23 | * datetime date and time format string (%F %T) 24 | * disk_free free disk space in GB mountpoint path (/) 25 | * disk_perc disk usage in percent mountpoint path (/) 26 | * disk_total total disk space in GB mountpoint path (/) 27 | * disk_used used disk space in GB mountpoint path (/) 28 | * entropy available entropy NULL 29 | * gid GID of current user NULL 30 | * hostname hostname NULL 31 | * ipv4 IPv4 address interface name (eth0) 32 | * ipv6 IPv6 address interface name (eth0) 33 | * kernel_release `uname -r` NULL 34 | * keyboard_indicators caps/num lock indicators format string (c?n?) 35 | * see keyboard_indicators.c 36 | * keymap layout (variant) of current NULL 37 | * keymap 38 | * load_avg load average NULL 39 | * netspeed_rx receive network speed interface name (wlan0) 40 | * netspeed_tx transfer network speed interface name (wlan0) 41 | * num_files number of files in a directory path 42 | * (/home/foo/Inbox/cur) 43 | * ram_free free memory in GB NULL 44 | * ram_perc memory usage in percent NULL 45 | * ram_total total memory size in GB NULL 46 | * ram_used used memory in GB NULL 47 | * run_command custom shell command command (echo foo) 48 | * separator string to echo NULL 49 | * swap_free free swap in GB NULL 50 | * swap_perc swap usage in percent NULL 51 | * swap_total total swap size in GB NULL 52 | * swap_used used swap in GB NULL 53 | * temp temperature in degree celsius sensor file 54 | * (/sys/class/thermal/...) 55 | * NULL on OpenBSD 56 | * thermal zone on FreeBSD 57 | * (tz0, tz1, etc.) 58 | * uid UID of current user NULL 59 | * uptime system uptime NULL 60 | * username username of current user NULL 61 | * vol_perc OSS/ALSA volume in percent mixer file (/dev/mixer) 62 | * NULL on OpenBSD 63 | * wifi_perc WiFi signal in percent interface name (wlan0) 64 | * wifi_essid WiFi ESSID interface name (wlan0) 65 | * 66 | * COLORSCHEMES 67 | * Catppuccin : { 68 | * cpu/ram_perc #f38ba8 69 | * wifi_essid/battery_perc #fab387 70 | * kernel_release/keymap #a6e3a1 71 | * datetime #89dceb 72 | * } 73 | * Everforest:{ 74 | * cpu/ram_perc #e67e80 75 | * wifi_essid/battery_perc #e69875 76 | * kernel_release/keymap #a7c080 77 | * datetime #7fbbb3 78 | * } 79 | * 80 | * Gruvbox:{ 81 | * cpu/ram_perc #fb4934 82 | * wifi_essid/battery_perc #f38019 83 | * kernel_release/keymap #b8bb26 84 | * datetime #83a598 85 | * } 86 | */ 87 | 88 | static const struct arg args[] = { 89 | /* function format argument */ 90 | { cpu_perc, "^c#f38ba8^[  %s%% | ", NULL }, 91 | { ram_perc, " 󰍛 %s%% ] ", NULL }, 92 | { wifi_essid, "^c#fab387^[  %s | ", "wlo1" }, 93 | { battery_perc, " 󰁹 %s%% ] ", "BAT1" }, 94 | { kernel_release, "^c#a6e3a1^[  %s | ", NULL }, 95 | { keymap, "  %s ] ", NULL }, 96 | { datetime, "%s", "^c#89dceb^[  %a, %d.%m. |  %I:%M %p ] "}, 97 | }; 98 | -------------------------------------------------------------------------------- /slstatus/config.mk: -------------------------------------------------------------------------------- 1 | # slstatus version 2 | VERSION = 0 3 | 4 | # customize below to fit your system 5 | 6 | # paths 7 | PREFIX = /usr/local 8 | MANPREFIX = $(PREFIX)/share/man 9 | 10 | X11INC = /usr/X11R6/include 11 | X11LIB = /usr/X11R6/lib 12 | 13 | # flags 14 | CPPFLAGS = -I$(X11INC) -D_DEFAULT_SOURCE 15 | CFLAGS = -std=c99 -pedantic -Wall -Wextra -Os 16 | LDFLAGS = -L$(X11LIB) -s 17 | # OpenBSD: add -lsndio 18 | # FreeBSD: add -lkvm 19 | LDLIBS = -lX11 20 | 21 | # compiler and linker 22 | CC = cc 23 | -------------------------------------------------------------------------------- /slstatus/slstatus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/slstatus -------------------------------------------------------------------------------- /slstatus/slstatus.1: -------------------------------------------------------------------------------- 1 | .Dd 2020-06-23 2 | .Dt SLSTATUS 1 3 | .Os 4 | .Sh NAME 5 | .Nm slstatus 6 | .Nd suckless status monitor 7 | .Sh SYNOPSIS 8 | .Nm 9 | .Op Fl s 10 | .Op Fl 1 11 | .Sh DESCRIPTION 12 | .Nm 13 | is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or 14 | stdin to fill the status bar. 15 | By default, 16 | .Nm 17 | outputs to WM_NAME. 18 | .Sh OPTIONS 19 | .Bl -tag -width Ds 20 | .It Fl s 21 | Write to stdout instead of WM_NAME. 22 | .It Fl 1 23 | Write once to stdout and quit. 24 | .El 25 | .Sh CUSTOMIZATION 26 | .Nm 27 | can be customized by creating a custom config.h and (re)compiling the source 28 | code. This keeps it fast, secure and simple. 29 | -------------------------------------------------------------------------------- /slstatus/slstatus.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "arg.h" 11 | #include "slstatus.h" 12 | #include "util.h" 13 | 14 | struct arg { 15 | const char *(*func)(); 16 | const char *fmt; 17 | const char *args; 18 | }; 19 | 20 | char buf[1024]; 21 | static volatile sig_atomic_t done; 22 | static Display *dpy; 23 | 24 | #include "config.h" 25 | 26 | static void 27 | terminate(const int signo) 28 | { 29 | if (signo != SIGUSR1) 30 | done = 1; 31 | } 32 | 33 | static void 34 | difftimespec(struct timespec *res, struct timespec *a, struct timespec *b) 35 | { 36 | res->tv_sec = a->tv_sec - b->tv_sec - (a->tv_nsec < b->tv_nsec); 37 | res->tv_nsec = a->tv_nsec - b->tv_nsec + 38 | (a->tv_nsec < b->tv_nsec) * 1E9; 39 | } 40 | 41 | static void 42 | usage(void) 43 | { 44 | die("usage: %s [-s] [-1]", argv0); 45 | } 46 | 47 | int 48 | main(int argc, char *argv[]) 49 | { 50 | struct sigaction act; 51 | struct timespec start, current, diff, intspec, wait; 52 | size_t i, len; 53 | int sflag, ret; 54 | char status[MAXLEN]; 55 | const char *res; 56 | 57 | sflag = 0; 58 | ARGBEGIN { 59 | case '1': 60 | done = 1; 61 | /* fallthrough */ 62 | case 's': 63 | sflag = 1; 64 | break; 65 | default: 66 | usage(); 67 | } ARGEND 68 | 69 | if (argc) { 70 | usage(); 71 | } 72 | 73 | memset(&act, 0, sizeof(act)); 74 | act.sa_handler = terminate; 75 | sigaction(SIGINT, &act, NULL); 76 | sigaction(SIGTERM, &act, NULL); 77 | act.sa_flags |= SA_RESTART; 78 | sigaction(SIGUSR1, &act, NULL); 79 | 80 | if (!sflag && !(dpy = XOpenDisplay(NULL))) { 81 | die("XOpenDisplay: Failed to open display"); 82 | } 83 | 84 | do { 85 | if (clock_gettime(CLOCK_MONOTONIC, &start) < 0) { 86 | die("clock_gettime:"); 87 | } 88 | 89 | status[0] = '\0'; 90 | for (i = len = 0; i < LEN(args); i++) { 91 | if (!(res = args[i].func(args[i].args))) { 92 | res = unknown_str; 93 | } 94 | if ((ret = esnprintf(status + len, sizeof(status) - len, 95 | args[i].fmt, res)) < 0) { 96 | break; 97 | } 98 | len += ret; 99 | } 100 | 101 | if (sflag) { 102 | puts(status); 103 | fflush(stdout); 104 | if (ferror(stdout)) 105 | die("puts:"); 106 | } else { 107 | if (XStoreName(dpy, DefaultRootWindow(dpy), status) 108 | < 0) { 109 | die("XStoreName: Allocation failed"); 110 | } 111 | XFlush(dpy); 112 | } 113 | 114 | if (!done) { 115 | if (clock_gettime(CLOCK_MONOTONIC, ¤t) < 0) { 116 | die("clock_gettime:"); 117 | } 118 | difftimespec(&diff, ¤t, &start); 119 | 120 | intspec.tv_sec = interval / 1000; 121 | intspec.tv_nsec = (interval % 1000) * 1E6; 122 | difftimespec(&wait, &intspec, &diff); 123 | 124 | if (wait.tv_sec >= 0) { 125 | if (nanosleep(&wait, NULL) < 0 && 126 | errno != EINTR) { 127 | die("nanosleep:"); 128 | } 129 | } 130 | } 131 | } while (!done); 132 | 133 | if (!sflag) { 134 | XStoreName(dpy, DefaultRootWindow(dpy), NULL); 135 | if (XCloseDisplay(dpy) < 0) { 136 | die("XCloseDisplay: Failed to close display"); 137 | } 138 | } 139 | 140 | return 0; 141 | } 142 | -------------------------------------------------------------------------------- /slstatus/slstatus.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | 3 | /* battery */ 4 | const char *battery_perc(const char *); 5 | const char *battery_state(const char *); 6 | const char *battery_remaining(const char *); 7 | 8 | /* cpu */ 9 | const char *cpu_freq(void); 10 | const char *cpu_perc(void); 11 | 12 | /* datetime */ 13 | const char *datetime(const char *fmt); 14 | 15 | /* disk */ 16 | const char *disk_free(const char *path); 17 | const char *disk_perc(const char *path); 18 | const char *disk_total(const char *path); 19 | const char *disk_used(const char *path); 20 | 21 | /* entropy */ 22 | const char *entropy(void); 23 | 24 | /* hostname */ 25 | const char *hostname(void); 26 | 27 | /* ip */ 28 | const char *ipv4(const char *interface); 29 | const char *ipv6(const char *interface); 30 | 31 | /* kernel_release */ 32 | const char *kernel_release(void); 33 | 34 | /* keyboard_indicators */ 35 | const char *keyboard_indicators(void); 36 | 37 | /* keymap */ 38 | const char *keymap(void); 39 | 40 | /* load_avg */ 41 | const char *load_avg(void); 42 | 43 | /* netspeeds */ 44 | const char *netspeed_rx(const char *interface); 45 | const char *netspeed_tx(const char *interface); 46 | 47 | /* num_files */ 48 | const char *num_files(const char *path); 49 | 50 | /* ram */ 51 | const char *ram_free(void); 52 | const char *ram_perc(void); 53 | const char *ram_total(void); 54 | const char *ram_used(void); 55 | 56 | /* run_command */ 57 | const char *run_command(const char *cmd); 58 | 59 | /* separator */ 60 | const char *separator(const char *separator); 61 | 62 | /* swap */ 63 | const char *swap_free(void); 64 | const char *swap_perc(void); 65 | const char *swap_total(void); 66 | const char *swap_used(void); 67 | 68 | /* temperature */ 69 | const char *temp(const char *); 70 | 71 | /* uptime */ 72 | const char *uptime(void); 73 | 74 | /* user */ 75 | const char *gid(void); 76 | const char *username(void); 77 | const char *uid(void); 78 | 79 | /* volume */ 80 | const char *vol_perc(const char *card); 81 | 82 | /* wifi */ 83 | const char *wifi_perc(const char *interface); 84 | const char *wifi_essid(const char *interface); 85 | -------------------------------------------------------------------------------- /slstatus/slstatus.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/slstatus.o -------------------------------------------------------------------------------- /slstatus/util.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "util.h" 10 | 11 | char *argv0; 12 | 13 | static void 14 | verr(const char *fmt, va_list ap) 15 | { 16 | if (argv0 && strncmp(fmt, "usage", sizeof("usage") - 1)) { 17 | fprintf(stderr, "%s: ", argv0); 18 | } 19 | 20 | vfprintf(stderr, fmt, ap); 21 | 22 | if (fmt[0] && fmt[strlen(fmt) - 1] == ':') { 23 | fputc(' ', stderr); 24 | perror(NULL); 25 | } else { 26 | fputc('\n', stderr); 27 | } 28 | } 29 | 30 | void 31 | warn(const char *fmt, ...) 32 | { 33 | va_list ap; 34 | 35 | va_start(ap, fmt); 36 | verr(fmt, ap); 37 | va_end(ap); 38 | } 39 | 40 | void 41 | die(const char *fmt, ...) 42 | { 43 | va_list ap; 44 | 45 | va_start(ap, fmt); 46 | verr(fmt, ap); 47 | va_end(ap); 48 | 49 | exit(1); 50 | } 51 | 52 | static int 53 | evsnprintf(char *str, size_t size, const char *fmt, va_list ap) 54 | { 55 | int ret; 56 | 57 | ret = vsnprintf(str, size, fmt, ap); 58 | 59 | if (ret < 0) { 60 | warn("vsnprintf:"); 61 | return -1; 62 | } else if ((size_t)ret >= size) { 63 | warn("vsnprintf: Output truncated"); 64 | return -1; 65 | } 66 | 67 | return ret; 68 | } 69 | 70 | int 71 | esnprintf(char *str, size_t size, const char *fmt, ...) 72 | { 73 | va_list ap; 74 | int ret; 75 | 76 | va_start(ap, fmt); 77 | ret = evsnprintf(str, size, fmt, ap); 78 | va_end(ap); 79 | 80 | return ret; 81 | } 82 | 83 | const char * 84 | bprintf(const char *fmt, ...) 85 | { 86 | va_list ap; 87 | int ret; 88 | 89 | va_start(ap, fmt); 90 | ret = evsnprintf(buf, sizeof(buf), fmt, ap); 91 | va_end(ap); 92 | 93 | return (ret < 0) ? NULL : buf; 94 | } 95 | 96 | const char * 97 | fmt_human(uintmax_t num, int base) 98 | { 99 | double scaled; 100 | size_t i, prefixlen; 101 | const char **prefix; 102 | const char *prefix_1000[] = { "", "k", "M", "G", "T", "P", "E", "Z", 103 | "Y" }; 104 | const char *prefix_1024[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", 105 | "Zi", "Yi" }; 106 | 107 | switch (base) { 108 | case 1000: 109 | prefix = prefix_1000; 110 | prefixlen = LEN(prefix_1000); 111 | break; 112 | case 1024: 113 | prefix = prefix_1024; 114 | prefixlen = LEN(prefix_1024); 115 | break; 116 | default: 117 | warn("fmt_human: Invalid base"); 118 | return NULL; 119 | } 120 | 121 | scaled = num; 122 | for (i = 0; i < prefixlen && scaled >= base; i++) { 123 | scaled /= base; 124 | } 125 | 126 | return bprintf("%.1f %s", scaled, prefix[i]); 127 | } 128 | 129 | int 130 | pscanf(const char *path, const char *fmt, ...) 131 | { 132 | FILE *fp; 133 | va_list ap; 134 | int n; 135 | 136 | if (!(fp = fopen(path, "r"))) { 137 | warn("fopen '%s':", path); 138 | return -1; 139 | } 140 | va_start(ap, fmt); 141 | n = vfscanf(fp, fmt, ap); 142 | va_end(ap); 143 | fclose(fp); 144 | 145 | return (n == EOF) ? -1 : n; 146 | } 147 | -------------------------------------------------------------------------------- /slstatus/util.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE file for copyright and license details. */ 2 | #include 3 | 4 | extern char buf[1024]; 5 | 6 | #define LEN(x) (sizeof (x) / sizeof *(x)) 7 | 8 | extern char *argv0; 9 | 10 | void warn(const char *, ...); 11 | void die(const char *, ...); 12 | 13 | int esnprintf(char *str, size_t size, const char *fmt, ...); 14 | const char *bprintf(const char *fmt, ...); 15 | const char *fmt_human(uintmax_t num, int base); 16 | int pscanf(const char *path, const char *fmt, ...); 17 | -------------------------------------------------------------------------------- /slstatus/util.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/slstatus/util.o -------------------------------------------------------------------------------- /st/LEGACY: -------------------------------------------------------------------------------- 1 | A STATEMENT ON LEGACY SUPPORT 2 | 3 | In the terminal world there is much cruft that comes from old and unsup‐ 4 | ported terminals that inherit incompatible modes and escape sequences 5 | which noone is able to know, except when he/she comes from that time and 6 | developed a graphical vt100 emulator at that time. 7 | 8 | One goal of st is to only support what is really needed. When you en‐ 9 | counter a sequence which you really need, implement it. But while you 10 | are at it, do not add the other cruft you might encounter while sneek‐ 11 | ing at other terminal emulators. History has bloated them and there is 12 | no real evidence that most of the sequences are used today. 13 | 14 | 15 | Christoph Lohmann <20h@r-36.net> 16 | 2012-09-13T07:00:36.081271045+02:00 17 | 18 | -------------------------------------------------------------------------------- /st/LICENSE: -------------------------------------------------------------------------------- 1 | MIT/X Consortium License 2 | 3 | © 2014-2022 Hiltjo Posthuma 4 | © 2018 Devin J. Pohly 5 | © 2014-2017 Quentin Rameau 6 | © 2009-2012 Aurélien APTEL 7 | © 2008-2017 Anselm R Garbe 8 | © 2012-2017 Roberto E. Vargas Caballero 9 | © 2012-2016 Christoph Lohmann <20h at r-36 dot net> 10 | © 2013 Eon S. Jeon 11 | © 2013 Alexander Sedov 12 | © 2013 Mark Edgar 13 | © 2013-2014 Eric Pruitt 14 | © 2013 Michael Forney 15 | © 2013-2014 Markus Teich 16 | © 2014-2015 Laslo Hunhold 17 | 18 | Permission is hereby granted, free of charge, to any person obtaining a 19 | copy of this software and associated documentation files (the "Software"), 20 | to deal in the Software without restriction, including without limitation 21 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 22 | and/or sell copies of the Software, and to permit persons to whom the 23 | Software is furnished to do so, subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in 26 | all copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 31 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 34 | DEALINGS IN THE SOFTWARE. 35 | -------------------------------------------------------------------------------- /st/Makefile: -------------------------------------------------------------------------------- 1 | # st - simple terminal 2 | # See LICENSE file for copyright and license details. 3 | .POSIX: 4 | 5 | include config.mk 6 | 7 | SRC = st.c x.c 8 | OBJ = $(SRC:.c=.o) 9 | 10 | all: options st 11 | 12 | options: 13 | @echo st build options: 14 | @echo "CFLAGS = $(STCFLAGS)" 15 | @echo "LDFLAGS = $(STLDFLAGS)" 16 | @echo "CC = $(CC)" 17 | 18 | config.h: 19 | cp config.def.h config.h 20 | 21 | .c.o: 22 | $(CC) $(STCFLAGS) -c $< 23 | 24 | st.o: config.h st.h win.h 25 | x.o: arg.h config.h st.h win.h 26 | 27 | $(OBJ): config.h config.mk 28 | 29 | st: $(OBJ) 30 | $(CC) -o $@ $(OBJ) $(STLDFLAGS) 31 | 32 | clean: 33 | rm -f st $(OBJ) st-$(VERSION).tar.gz 34 | 35 | dist: clean 36 | mkdir -p st-$(VERSION) 37 | cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\ 38 | config.def.h st.info st.1 arg.h st.h win.h $(SRC)\ 39 | st-$(VERSION) 40 | tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz 41 | rm -rf st-$(VERSION) 42 | 43 | install: st 44 | mkdir -p $(DESTDIR)$(PREFIX)/bin 45 | cp -f st $(DESTDIR)$(PREFIX)/bin 46 | chmod 755 $(DESTDIR)$(PREFIX)/bin/st 47 | mkdir -p $(DESTDIR)$(MANPREFIX)/man1 48 | sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1 49 | chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 50 | tic -sx st.info 51 | @echo Please see the README file regarding the terminfo entry of st. 52 | 53 | uninstall: 54 | rm -f $(DESTDIR)$(PREFIX)/bin/st 55 | rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1 56 | 57 | .PHONY: all options clean dist install uninstall 58 | -------------------------------------------------------------------------------- /st/README: -------------------------------------------------------------------------------- 1 | st - simple terminal 2 | -------------------- 3 | st is a simple terminal emulator for X which sucks less. 4 | 5 | 6 | Requirements 7 | ------------ 8 | In order to build st you need the Xlib header files. 9 | 10 | 11 | Installation 12 | ------------ 13 | Edit config.mk to match your local setup (st is installed into 14 | the /usr/local namespace by default). 15 | 16 | Afterwards enter the following command to build and install st (if 17 | necessary as root): 18 | 19 | make clean install 20 | 21 | 22 | Running st 23 | ---------- 24 | If you did not install st with make clean install, you must compile 25 | the st terminfo entry with the following command: 26 | 27 | tic -sx st.info 28 | 29 | See the man page for additional details. 30 | 31 | Credits 32 | ------- 33 | Based on Aurélien APTEL bt source code. 34 | 35 | -------------------------------------------------------------------------------- /st/TODO: -------------------------------------------------------------------------------- 1 | vt emulation 2 | ------------ 3 | 4 | * double-height support 5 | 6 | code & interface 7 | ---------------- 8 | 9 | * add a simple way to do multiplexing 10 | 11 | drawing 12 | ------- 13 | * add diacritics support to xdraws() 14 | * switch to a suckless font drawing library 15 | * make the font cache simpler 16 | * add better support for brightening of the upper colors 17 | 18 | bugs 19 | ---- 20 | 21 | * fix shift up/down (shift selection in emacs) 22 | * remove DEC test sequence when appropriate 23 | 24 | misc 25 | ---- 26 | 27 | $ grep -nE 'XXX|TODO' st.c 28 | 29 | -------------------------------------------------------------------------------- /st/arg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copy me if you can. 3 | * by 20h 4 | */ 5 | 6 | #ifndef ARG_H__ 7 | #define ARG_H__ 8 | 9 | extern char *argv0; 10 | 11 | /* use main(int argc, char *argv[]) */ 12 | #define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ 13 | argv[0] && argv[0][0] == '-'\ 14 | && argv[0][1];\ 15 | argc--, argv++) {\ 16 | char argc_;\ 17 | char **argv_;\ 18 | int brk_;\ 19 | if (argv[0][1] == '-' && argv[0][2] == '\0') {\ 20 | argv++;\ 21 | argc--;\ 22 | break;\ 23 | }\ 24 | int i_;\ 25 | for (i_ = 1, brk_ = 0, argv_ = argv;\ 26 | argv[0][i_] && !brk_;\ 27 | i_++) {\ 28 | if (argv_ != argv)\ 29 | break;\ 30 | argc_ = argv[0][i_];\ 31 | switch (argc_) 32 | 33 | #define ARGEND }\ 34 | } 35 | 36 | #define ARGC() argc_ 37 | 38 | #define EARGF(x) ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\ 39 | ((x), abort(), (char *)0) :\ 40 | (brk_ = 1, (argv[0][i_+1] != '\0')?\ 41 | (&argv[0][i_+1]) :\ 42 | (argc--, argv++, argv[0]))) 43 | 44 | #define ARGF() ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\ 45 | (char *)0 :\ 46 | (brk_ = 1, (argv[0][i_+1] != '\0')?\ 47 | (&argv[0][i_+1]) :\ 48 | (argc--, argv++, argv[0]))) 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /st/colorschemes/bananaTime.h: -------------------------------------------------------------------------------- 1 | static const char *colorname[] = { 2 | /* 8 normal colors */ 3 | "#000000", 4 | "#b21818", 5 | "#18b218", 6 | "#be5f00", 7 | "#6d85ba", 8 | "#b218b2", 9 | "#18b2b2", 10 | "#b2b2b2", 11 | 12 | /* 8 bright colors */ 13 | "#686868", 14 | "#ff5454", 15 | "#54ff54", 16 | "#ffff54", 17 | "#6385ff", 18 | "#ff54ff", 19 | "#54ffff", 20 | "#ffffff", 21 | 22 | [255] = 0, 23 | 24 | /* more colors can be added after 255 to use with DefaultXX */ 25 | /* (cursor defaults - see below) */ 26 | "#cccccc", 27 | "#555555", 28 | "#f9ce74", /* default foreground colour */ 29 | "#1c1c1c", /* default background colour */ 30 | }; 31 | unsigned int defaultfg = 258; 32 | unsigned int defaultbg = 259; 33 | unsigned int defaultcs = 256; 34 | -------------------------------------------------------------------------------- /st/colorschemes/catppuccin.h: -------------------------------------------------------------------------------- 1 | static const char *colorname[] = { 2 | /* 8 normal colors */ 3 | "#45475A", 4 | "#F38BA8", 5 | "#A6E3A1", 6 | "#F9E2AF", 7 | "#89B4FA", 8 | "#F5C2E7", 9 | "#94E2D5", 10 | "#BAC2DE", 11 | 12 | /* 8 bright colors */ 13 | "#585B70", 14 | "#F38BA8", 15 | "#A6E3A1", 16 | "#F9E2AF", 17 | "#89B4FA", 18 | "#F5C2E7", 19 | "#94E2D5", 20 | "#A6ADC8", 21 | 22 | [256] = "#CDD6F4", 23 | [257] = "#1E1E2E", 24 | [258] = "#F5E0DC", 25 | 26 | }; 27 | -------------------------------------------------------------------------------- /st/colorschemes/dracula.h: -------------------------------------------------------------------------------- 1 | static const char *colorname[] = { 2 | /* 8 normal colors */ 3 | "black", 4 | "#f8f8f2", 5 | "#50fafb", 6 | "#f1f10c", 7 | "#8be9fd", 8 | "#ff79c6", 9 | "#ff79c6", 10 | "gray90", 11 | 12 | /* 8 bright colors */ 13 | "gray50", 14 | "red", 15 | "green", 16 | "#f1fa8c", 17 | "#f8f8f2", 18 | "#ff79c6", 19 | "#8be9fd", 20 | "white", 21 | 22 | [255] = 0, 23 | 24 | /* more colors can be added after 255 to use with DefaultXX */ 25 | "#cccccc", 26 | "#555555", 27 | "#f8f8f2", /* default foreground colour */ 28 | "#282a36", /* default background colour */ 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /st/colorschemes/gruvbox.h: -------------------------------------------------------------------------------- 1 | static const char *colorname[] = { 2 | /* 8 normal colors */ 3 | [0] = "#282828", 4 | [1] = "#cc241d", /* red */ 5 | [2] = "#98971a", /* green */ 6 | [3] = "#d79921", /* yellow */ 7 | [4] = "#458588", /* blue */ 8 | [5] = "#b16286", /* magenta */ 9 | [6] = "#689d6a", /* cyan */ 10 | [7] = "#a89984", /* white */ 11 | 12 | /* 8 bright colors */ 13 | [8] = "#928374", /* black */ 14 | [9] = "#fb4934", /* red */ 15 | [10] = "#b8bb26", /* green */ 16 | [11] = "#fabd2f", /* yellow */ 17 | [12] = "#83a598", /* blue */ 18 | [13] = "#d3869b", /* magenta */ 19 | [14] = "#8ec07c", /* cyan */ 20 | [15] = "#ebdbb2", /* white */ 21 | }; 22 | -------------------------------------------------------------------------------- /st/config.def.h.rej: -------------------------------------------------------------------------------- 1 | --- config.def.h 2 | +++ config.def.h 3 | @@ -6,6 +6,7 @@ 4 | * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html 5 | */ 6 | static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; 7 | +static char *font2 = "Roboto Mono for Powerline:pixelsize=12:antialias=true:autohint=true"; 8 | static int borderpx = 2; 9 | 10 | /* 11 | -------------------------------------------------------------------------------- /st/config.mk: -------------------------------------------------------------------------------- 1 | # st version 2 | VERSION = 0.9 3 | 4 | # Customize below to fit your system 5 | 6 | # paths 7 | PREFIX = /usr/local 8 | MANPREFIX = $(PREFIX)/share/man 9 | 10 | X11INC = /usr/X11R6/include 11 | X11LIB = /usr/X11R6/lib 12 | 13 | PKG_CONFIG = pkg-config 14 | 15 | # includes and libs 16 | INCS = -I$(X11INC) \ 17 | `$(PKG_CONFIG) --cflags fontconfig` \ 18 | `$(PKG_CONFIG) --cflags freetype2` 19 | LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\ 20 | `$(PKG_CONFIG) --libs fontconfig` \ 21 | `$(PKG_CONFIG) --libs freetype2` 22 | 23 | # flags 24 | STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 25 | STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS) 26 | STLDFLAGS = $(LIBS) $(LDFLAGS) 27 | 28 | # OpenBSD: 29 | #CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE 30 | #LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \ 31 | # `$(PKG_CONFIG) --libs fontconfig` \ 32 | # `$(PKG_CONFIG) --libs freetype2` 33 | #MANPREFIX = ${PREFIX}/man 34 | 35 | # compiler and linker 36 | # CC = c99 37 | -------------------------------------------------------------------------------- /st/patches/st-alpha-20220206-0.8.5.diff: -------------------------------------------------------------------------------- 1 | diff --git a/config.def.h b/config.def.h 2 | index 91ab8ca..6af616e 100644 3 | --- a/config.def.h 4 | +++ b/config.def.h 5 | @@ -93,6 +93,9 @@ char *termname = "st-256color"; 6 | */ 7 | unsigned int tabspaces = 8; 8 | 9 | +/* bg opacity */ 10 | +float alpha = 0.8; 11 | + 12 | /* Terminal colors (16 first used in escape sequence) */ 13 | static const char *colorname[] = { 14 | /* 8 normal colors */ 15 | diff --git a/config.mk b/config.mk 16 | index 4c4c5d5..0114bad 100644 17 | --- a/config.mk 18 | +++ b/config.mk 19 | @@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config 20 | INCS = -I$(X11INC) \ 21 | `$(PKG_CONFIG) --cflags fontconfig` \ 22 | `$(PKG_CONFIG) --cflags freetype2` 23 | -LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ 24 | +LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\ 25 | `$(PKG_CONFIG) --libs fontconfig` \ 26 | `$(PKG_CONFIG) --libs freetype2` 27 | 28 | diff --git a/st.h b/st.h 29 | index 519b9bd..8bb533d 100644 30 | --- a/st.h 31 | +++ b/st.h 32 | @@ -126,3 +126,4 @@ extern unsigned int tabspaces; 33 | extern unsigned int defaultfg; 34 | extern unsigned int defaultbg; 35 | extern unsigned int defaultcs; 36 | +extern float alpha; 37 | diff --git a/x.c b/x.c 38 | index 8a16faa..ddf4178 100644 39 | --- a/x.c 40 | +++ b/x.c 41 | @@ -105,6 +105,7 @@ typedef struct { 42 | XSetWindowAttributes attrs; 43 | int scr; 44 | int isfixed; /* is fixed geometry? */ 45 | + int depth; /* bit depth */ 46 | int l, t; /* left and top offset */ 47 | int gm; /* geometry mask */ 48 | } XWindow; 49 | @@ -243,6 +244,7 @@ static char *usedfont = NULL; 50 | static double usedfontsize = 0; 51 | static double defaultfontsize = 0; 52 | 53 | +static char *opt_alpha = NULL; 54 | static char *opt_class = NULL; 55 | static char **opt_cmd = NULL; 56 | static char *opt_embed = NULL; 57 | @@ -736,7 +738,7 @@ xresize(int col, int row) 58 | 59 | XFreePixmap(xw.dpy, xw.buf); 60 | xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, 61 | - DefaultDepth(xw.dpy, xw.scr)); 62 | + xw.depth); 63 | XftDrawChange(xw.draw, xw.buf); 64 | xclear(0, 0, win.w, win.h); 65 | 66 | @@ -796,6 +798,13 @@ xloadcols(void) 67 | else 68 | die("could not allocate color %d\n", i); 69 | } 70 | + 71 | + /* set alpha value of bg color */ 72 | + if (opt_alpha) 73 | + alpha = strtof(opt_alpha, NULL); 74 | + dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); 75 | + dc.col[defaultbg].pixel &= 0x00FFFFFF; 76 | + dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; 77 | loaded = 1; 78 | } 79 | 80 | @@ -1118,11 +1127,23 @@ xinit(int cols, int rows) 81 | Window parent; 82 | pid_t thispid = getpid(); 83 | XColor xmousefg, xmousebg; 84 | + XWindowAttributes attr; 85 | + XVisualInfo vis; 86 | 87 | if (!(xw.dpy = XOpenDisplay(NULL))) 88 | die("can't open display\n"); 89 | xw.scr = XDefaultScreen(xw.dpy); 90 | - xw.vis = XDefaultVisual(xw.dpy, xw.scr); 91 | + 92 | + if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { 93 | + parent = XRootWindow(xw.dpy, xw.scr); 94 | + xw.depth = 32; 95 | + } else { 96 | + XGetWindowAttributes(xw.dpy, parent, &attr); 97 | + xw.depth = attr.depth; 98 | + } 99 | + 100 | + XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis); 101 | + xw.vis = vis.visual; 102 | 103 | /* font */ 104 | if (!FcInit()) 105 | @@ -1132,7 +1153,7 @@ xinit(int cols, int rows) 106 | xloadfonts(usedfont, 0); 107 | 108 | /* colors */ 109 | - xw.cmap = XDefaultColormap(xw.dpy, xw.scr); 110 | + xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None); 111 | xloadcols(); 112 | 113 | /* adjust fixed window geometry */ 114 | @@ -1152,19 +1173,15 @@ xinit(int cols, int rows) 115 | | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; 116 | xw.attrs.colormap = xw.cmap; 117 | 118 | - if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) 119 | - parent = XRootWindow(xw.dpy, xw.scr); 120 | xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, 121 | - win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, 122 | + win.w, win.h, 0, xw.depth, InputOutput, 123 | xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity 124 | | CWEventMask | CWColormap, &xw.attrs); 125 | 126 | memset(&gcvalues, 0, sizeof(gcvalues)); 127 | gcvalues.graphics_exposures = False; 128 | - dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, 129 | - &gcvalues); 130 | - xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, 131 | - DefaultDepth(xw.dpy, xw.scr)); 132 | + xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); 133 | + dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); 134 | XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); 135 | XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); 136 | 137 | @@ -2019,6 +2036,9 @@ main(int argc, char *argv[]) 138 | case 'a': 139 | allowaltscreen = 0; 140 | break; 141 | + case 'A': 142 | + opt_alpha = EARGF(usage()); 143 | + break; 144 | case 'c': 145 | opt_class = EARGF(usage()); 146 | break; 147 | -------------------------------------------------------------------------------- /st/patches/st-font2-20190326-f64c2f8.diff: -------------------------------------------------------------------------------- 1 | From f64c2f83a2e3ee349fe11100526110dfdf47067a Mon Sep 17 00:00:00 2001 2 | From: Kirill Bugaev 3 | Date: Wed, 27 Mar 2019 01:28:56 +0800 4 | Subject: [PATCH] Some glyphs can be not present in font defined by default. 5 | For this glyphs st uses font-config and try to find them in font cache first. 6 | This patch append font defined in `font2` variable to the beginning of font 7 | cache. So it will be used as spare font. 8 | 9 | --- 10 | config.def.h | 1 + 11 | x.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 12 | 2 files changed, 67 insertions(+) 13 | 14 | diff --git a/config.def.h b/config.def.h 15 | index 482901e..88eee0f 100644 16 | --- a/config.def.h 17 | +++ b/config.def.h 18 | @@ -6,6 +6,7 @@ 19 | * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html 20 | */ 21 | static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; 22 | +static char *font2 = "Roboto Mono for Powerline:pixelsize=12:antialias=true:autohint=true"; 23 | static int borderpx = 2; 24 | 25 | /* 26 | diff --git a/x.c b/x.c 27 | index 5828a3b..052b10b 100644 28 | --- a/x.c 29 | +++ b/x.c 30 | @@ -149,6 +149,7 @@ static void xhints(void); 31 | static int xloadcolor(int, const char *, Color *); 32 | static int xloadfont(Font *, FcPattern *); 33 | static void xloadfonts(char *, double); 34 | +static void xloadsparefont(); 35 | static void xunloadfont(Font *); 36 | static void xunloadfonts(void); 37 | static void xsetenv(void); 38 | @@ -296,6 +297,7 @@ zoomabs(const Arg *arg) 39 | { 40 | xunloadfonts(); 41 | xloadfonts(usedfont, arg->f); 42 | + xloadsparefont(); 43 | cresize(0, 0); 44 | redraw(); 45 | xhints(); 46 | @@ -977,6 +979,67 @@ xloadfonts(char *fontstr, double fontsize) 47 | FcPatternDestroy(pattern); 48 | } 49 | 50 | +void 51 | +xloadsparefont() 52 | +{ 53 | + FcPattern *fontpattern, *match; 54 | + FcResult result; 55 | + 56 | + /* add font2 to font cache as first 4 entries */ 57 | + if ( font2[0] == '-' ) 58 | + fontpattern = XftXlfdParse(font2, False, False); 59 | + else 60 | + fontpattern = FcNameParse((FcChar8 *)font2); 61 | + if ( fontpattern ) { 62 | + /* Allocate memory for the new cache entries. */ 63 | + frccap += 4; 64 | + frc = xrealloc(frc, frccap * sizeof(Fontcache)); 65 | + /* add Normal */ 66 | + match = FcFontMatch(NULL, fontpattern, &result); 67 | + if ( match ) 68 | + frc[frclen].font = XftFontOpenPattern(xw.dpy, match); 69 | + if ( frc[frclen].font ) { 70 | + frc[frclen].flags = FRC_NORMAL; 71 | + frclen++; 72 | + } else 73 | + FcPatternDestroy(match); 74 | + /* add Italic */ 75 | + FcPatternDel(fontpattern, FC_SLANT); 76 | + FcPatternAddInteger(fontpattern, FC_SLANT, FC_SLANT_ITALIC); 77 | + match = FcFontMatch(NULL, fontpattern, &result); 78 | + if ( match ) 79 | + frc[frclen].font = XftFontOpenPattern(xw.dpy, match); 80 | + if ( frc[frclen].font ) { 81 | + frc[frclen].flags = FRC_ITALIC; 82 | + frclen++; 83 | + } else 84 | + FcPatternDestroy(match); 85 | + /* add Italic Bold */ 86 | + FcPatternDel(fontpattern, FC_WEIGHT); 87 | + FcPatternAddInteger(fontpattern, FC_WEIGHT, FC_WEIGHT_BOLD); 88 | + match = FcFontMatch(NULL, fontpattern, &result); 89 | + if ( match ) 90 | + frc[frclen].font = XftFontOpenPattern(xw.dpy, match); 91 | + if ( frc[frclen].font ) { 92 | + frc[frclen].flags = FRC_ITALICBOLD; 93 | + frclen++; 94 | + } else 95 | + FcPatternDestroy(match); 96 | + /* add Bold */ 97 | + FcPatternDel(fontpattern, FC_SLANT); 98 | + FcPatternAddInteger(fontpattern, FC_SLANT, FC_SLANT_ROMAN); 99 | + match = FcFontMatch(NULL, fontpattern, &result); 100 | + if ( match ) 101 | + frc[frclen].font = XftFontOpenPattern(xw.dpy, match); 102 | + if ( frc[frclen].font ) { 103 | + frc[frclen].flags = FRC_BOLD; 104 | + frclen++; 105 | + } else 106 | + FcPatternDestroy(match); 107 | + FcPatternDestroy(fontpattern); 108 | + } 109 | +} 110 | + 111 | void 112 | xunloadfont(Font *f) 113 | { 114 | @@ -1057,6 +1120,9 @@ xinit(int cols, int rows) 115 | usedfont = (opt_font == NULL)? font : opt_font; 116 | xloadfonts(usedfont, 0); 117 | 118 | + /* spare font (font2) */ 119 | + xloadsparefont(); 120 | + 121 | /* colors */ 122 | xw.cmap = XDefaultColormap(xw.dpy, xw.scr); 123 | xloadcols(); 124 | -- 125 | 2.21.0 126 | 127 | -------------------------------------------------------------------------------- /st/patches/st-scrollback-mouse-20220127-2c5edf2.diff: -------------------------------------------------------------------------------- 1 | From b5d3351a21442a842e01e8c0317603b6890b379c Mon Sep 17 00:00:00 2001 2 | From: asparagii 3 | Date: Thu, 27 Jan 2022 15:44:02 +0100 4 | Subject: [PATCH] st-scrollback-mouse 5 | 6 | --- 7 | config.def.h | 2 ++ 8 | 1 file changed, 2 insertions(+) 9 | 10 | diff --git a/config.def.h b/config.def.h 11 | index e3b469b..c217315 100644 12 | --- a/config.def.h 13 | +++ b/config.def.h 14 | @@ -176,6 +176,8 @@ static uint forcemousemod = ShiftMask; 15 | */ 16 | static MouseShortcut mshortcuts[] = { 17 | /* mask button function argument release */ 18 | + { ShiftMask, Button4, kscrollup, {.i = 1} }, 19 | + { ShiftMask, Button5, kscrolldown, {.i = 1} }, 20 | { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, 21 | { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, 22 | { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, 23 | -- 24 | 2.34.1 25 | 26 | -------------------------------------------------------------------------------- /st/st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/st/st -------------------------------------------------------------------------------- /st/st.1: -------------------------------------------------------------------------------- 1 | .TH ST 1 st\-VERSION 2 | .SH NAME 3 | st \- simple terminal 4 | .SH SYNOPSIS 5 | .B st 6 | .RB [ \-aiv ] 7 | .RB [ \-c 8 | .IR class ] 9 | .RB [ \-f 10 | .IR font ] 11 | .RB [ \-g 12 | .IR geometry ] 13 | .RB [ \-n 14 | .IR name ] 15 | .RB [ \-o 16 | .IR iofile ] 17 | .RB [ \-T 18 | .IR title ] 19 | .RB [ \-t 20 | .IR title ] 21 | .RB [ \-l 22 | .IR line ] 23 | .RB [ \-w 24 | .IR windowid ] 25 | .RB [[ \-e ] 26 | .IR command 27 | .RI [ arguments ...]] 28 | .PP 29 | .B st 30 | .RB [ \-aiv ] 31 | .RB [ \-c 32 | .IR class ] 33 | .RB [ \-f 34 | .IR font ] 35 | .RB [ \-g 36 | .IR geometry ] 37 | .RB [ \-n 38 | .IR name ] 39 | .RB [ \-o 40 | .IR iofile ] 41 | .RB [ \-T 42 | .IR title ] 43 | .RB [ \-t 44 | .IR title ] 45 | .RB [ \-w 46 | .IR windowid ] 47 | .RB \-l 48 | .IR line 49 | .RI [ stty_args ...] 50 | .SH DESCRIPTION 51 | .B st 52 | is a simple terminal emulator. 53 | .SH OPTIONS 54 | .TP 55 | .B \-a 56 | disable alternate screens in terminal 57 | .TP 58 | .BI \-c " class" 59 | defines the window class (default $TERM). 60 | .TP 61 | .BI \-f " font" 62 | defines the 63 | .I font 64 | to use when st is run. 65 | .TP 66 | .BI \-g " geometry" 67 | defines the X11 geometry string. 68 | The form is [=][{xX}][{+-}{+-}]. See 69 | .BR XParseGeometry (3) 70 | for further details. 71 | .TP 72 | .B \-i 73 | will fixate the position given with the -g option. 74 | .TP 75 | .BI \-n " name" 76 | defines the window instance name (default $TERM). 77 | .TP 78 | .BI \-o " iofile" 79 | writes all the I/O to 80 | .I iofile. 81 | This feature is useful when recording st sessions. A value of "-" means 82 | standard output. 83 | .TP 84 | .BI \-T " title" 85 | defines the window title (default 'st'). 86 | .TP 87 | .BI \-t " title" 88 | defines the window title (default 'st'). 89 | .TP 90 | .BI \-w " windowid" 91 | embeds st within the window identified by 92 | .I windowid 93 | .TP 94 | .BI \-l " line" 95 | use a tty 96 | .I line 97 | instead of a pseudo terminal. 98 | .I line 99 | should be a (pseudo-)serial device (e.g. /dev/ttyS0 on Linux for serial port 100 | 0). 101 | When this flag is given 102 | remaining arguments are used as flags for 103 | .BR stty(1). 104 | By default st initializes the serial line to 8 bits, no parity, 1 stop bit 105 | and a 38400 baud rate. The speed is set by appending it as last argument 106 | (e.g. 'st -l /dev/ttyS0 115200'). Arguments before the last one are 107 | .BR stty(1) 108 | flags. If you want to set odd parity on 115200 baud use for example 'st -l 109 | /dev/ttyS0 parenb parodd 115200'. Set the number of bits by using for 110 | example 'st -l /dev/ttyS0 cs7 115200'. See 111 | .BR stty(1) 112 | for more arguments and cases. 113 | .TP 114 | .B \-v 115 | prints version information to stderr, then exits. 116 | .TP 117 | .BI \-e " command " [ " arguments " "... ]" 118 | st executes 119 | .I command 120 | instead of the shell. If this is used it 121 | .B must be the last option 122 | on the command line, as in xterm / rxvt. 123 | This option is only intended for compatibility, 124 | and all the remaining arguments are used as a command 125 | even without it. 126 | .SH SHORTCUTS 127 | .TP 128 | .B Break 129 | Send a break in the serial line. 130 | Break key is obtained in PC keyboards 131 | pressing at the same time control and pause. 132 | .TP 133 | .B Ctrl-Print Screen 134 | Toggle if st should print to the 135 | .I iofile. 136 | .TP 137 | .B Shift-Print Screen 138 | Print the full screen to the 139 | .I iofile. 140 | .TP 141 | .B Print Screen 142 | Print the selection to the 143 | .I iofile. 144 | .TP 145 | .B Ctrl-Shift-Page Up 146 | Increase font size. 147 | .TP 148 | .B Ctrl-Shift-Page Down 149 | Decrease font size. 150 | .TP 151 | .B Ctrl-Shift-Home 152 | Reset to default font size. 153 | .TP 154 | .B Ctrl-Shift-y 155 | Paste from primary selection (middle mouse button). 156 | .TP 157 | .B Ctrl-Shift-c 158 | Copy the selected text to the clipboard selection. 159 | .TP 160 | .B Ctrl-Shift-v 161 | Paste from the clipboard selection. 162 | .SH CUSTOMIZATION 163 | .B st 164 | can be customized by creating a custom config.h and (re)compiling the source 165 | code. This keeps it fast, secure and simple. 166 | .SH AUTHORS 167 | See the LICENSE file for the authors. 168 | .SH LICENSE 169 | See the LICENSE file for the terms of redistribution. 170 | .SH SEE ALSO 171 | .BR tabbed (1), 172 | .BR utmp (1), 173 | .BR stty (1), 174 | .BR scroll (1) 175 | .SH BUGS 176 | See the TODO file in the distribution. 177 | 178 | -------------------------------------------------------------------------------- /st/st.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE for license details. */ 2 | 3 | #include 4 | #include 5 | 6 | /* macros */ 7 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 8 | #define MAX(a, b) ((a) < (b) ? (b) : (a)) 9 | #define LEN(a) (sizeof(a) / sizeof(a)[0]) 10 | #define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b)) 11 | #define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d)) 12 | #define DEFAULT(a, b) (a) = (a) ? (a) : (b) 13 | #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) 14 | #define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \ 15 | (a).bg != (b).bg) 16 | #define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \ 17 | (t1.tv_nsec-t2.tv_nsec)/1E6) 18 | #define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) 19 | 20 | #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) 21 | #define IS_TRUECOL(x) (1 << 24 & (x)) 22 | 23 | enum glyph_attribute { 24 | ATTR_NULL = 0, 25 | ATTR_BOLD = 1 << 0, 26 | ATTR_FAINT = 1 << 1, 27 | ATTR_ITALIC = 1 << 2, 28 | ATTR_UNDERLINE = 1 << 3, 29 | ATTR_BLINK = 1 << 4, 30 | ATTR_REVERSE = 1 << 5, 31 | ATTR_INVISIBLE = 1 << 6, 32 | ATTR_STRUCK = 1 << 7, 33 | ATTR_WRAP = 1 << 8, 34 | ATTR_WIDE = 1 << 9, 35 | ATTR_WDUMMY = 1 << 10, 36 | ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, 37 | }; 38 | 39 | enum drawing_mode { 40 | DRAW_NONE = 0, 41 | DRAW_BG = 1 << 0, 42 | DRAW_FG = 1 << 1, 43 | }; 44 | 45 | enum selection_mode { 46 | SEL_IDLE = 0, 47 | SEL_EMPTY = 1, 48 | SEL_READY = 2 49 | }; 50 | 51 | enum selection_type { 52 | SEL_REGULAR = 1, 53 | SEL_RECTANGULAR = 2 54 | }; 55 | 56 | enum selection_snap { 57 | SNAP_WORD = 1, 58 | SNAP_LINE = 2 59 | }; 60 | 61 | typedef unsigned char uchar; 62 | typedef unsigned int uint; 63 | typedef unsigned long ulong; 64 | typedef unsigned short ushort; 65 | 66 | typedef uint_least32_t Rune; 67 | 68 | #define Glyph Glyph_ 69 | typedef struct { 70 | Rune u; /* character code */ 71 | ushort mode; /* attribute flags */ 72 | uint32_t fg; /* foreground */ 73 | uint32_t bg; /* background */ 74 | } Glyph; 75 | 76 | typedef Glyph *Line; 77 | 78 | typedef union { 79 | int i; 80 | uint ui; 81 | float f; 82 | const void *v; 83 | const char *s; 84 | } Arg; 85 | 86 | void die(const char *, ...); 87 | void redraw(void); 88 | void draw(void); 89 | 90 | void kscrolldown(const Arg *); 91 | void kscrollup(const Arg *); 92 | void printscreen(const Arg *); 93 | void printsel(const Arg *); 94 | void sendbreak(const Arg *); 95 | void toggleprinter(const Arg *); 96 | 97 | int tattrset(int); 98 | void tnew(int, int); 99 | void tresize(int, int); 100 | void tsetdirtattr(int); 101 | void ttyhangup(void); 102 | int ttynew(const char *, char *, const char *, char **); 103 | size_t ttyread(void); 104 | void ttyresize(int, int); 105 | void ttywrite(const char *, size_t, int); 106 | 107 | void resettitle(void); 108 | 109 | void selclear(void); 110 | void selinit(void); 111 | void selstart(int, int, int); 112 | void selextend(int, int, int, int); 113 | int selected(int, int); 114 | char *getsel(void); 115 | 116 | size_t utf8encode(Rune, char *); 117 | 118 | void *xmalloc(size_t); 119 | void *xrealloc(void *, size_t); 120 | char *xstrdup(const char *); 121 | 122 | /* config.h globals */ 123 | extern char *utmp; 124 | extern char *scroll; 125 | extern char *stty_args; 126 | extern char *vtiden; 127 | extern wchar_t *worddelimiters; 128 | extern int allowaltscreen; 129 | extern int allowwindowops; 130 | extern char *termname; 131 | extern unsigned int tabspaces; 132 | extern unsigned int defaultfg; 133 | extern unsigned int defaultbg; 134 | extern unsigned int defaultcs; 135 | extern float alpha; 136 | -------------------------------------------------------------------------------- /st/st.info: -------------------------------------------------------------------------------- 1 | st-mono| simpleterm monocolor, 2 | acsc=+C\,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, 3 | am, 4 | bce, 5 | bel=^G, 6 | blink=\E[5m, 7 | bold=\E[1m, 8 | cbt=\E[Z, 9 | cvvis=\E[?25h, 10 | civis=\E[?25l, 11 | clear=\E[H\E[2J, 12 | cnorm=\E[?12l\E[?25h, 13 | colors#2, 14 | cols#80, 15 | cr=^M, 16 | csr=\E[%i%p1%d;%p2%dr, 17 | cub=\E[%p1%dD, 18 | cub1=^H, 19 | cud1=^J, 20 | cud=\E[%p1%dB, 21 | cuf1=\E[C, 22 | cuf=\E[%p1%dC, 23 | cup=\E[%i%p1%d;%p2%dH, 24 | cuu1=\E[A, 25 | cuu=\E[%p1%dA, 26 | dch=\E[%p1%dP, 27 | dch1=\E[P, 28 | dim=\E[2m, 29 | dl=\E[%p1%dM, 30 | dl1=\E[M, 31 | ech=\E[%p1%dX, 32 | ed=\E[J, 33 | el=\E[K, 34 | el1=\E[1K, 35 | enacs=\E)0, 36 | flash=\E[?5h$<80/>\E[?5l, 37 | fsl=^G, 38 | home=\E[H, 39 | hpa=\E[%i%p1%dG, 40 | hs, 41 | ht=^I, 42 | hts=\EH, 43 | ich=\E[%p1%d@, 44 | il1=\E[L, 45 | il=\E[%p1%dL, 46 | ind=^J, 47 | indn=\E[%p1%dS, 48 | invis=\E[8m, 49 | is2=\E[4l\E>\E[?1034l, 50 | it#8, 51 | kel=\E[1;2F, 52 | ked=\E[1;5F, 53 | ka1=\E[1~, 54 | ka3=\E[5~, 55 | kc1=\E[4~, 56 | kc3=\E[6~, 57 | kbs=\177, 58 | kcbt=\E[Z, 59 | kb2=\EOu, 60 | kcub1=\EOD, 61 | kcud1=\EOB, 62 | kcuf1=\EOC, 63 | kcuu1=\EOA, 64 | kDC=\E[3;2~, 65 | kent=\EOM, 66 | kEND=\E[1;2F, 67 | kIC=\E[2;2~, 68 | kNXT=\E[6;2~, 69 | kPRV=\E[5;2~, 70 | kHOM=\E[1;2H, 71 | kLFT=\E[1;2D, 72 | kRIT=\E[1;2C, 73 | kind=\E[1;2B, 74 | kri=\E[1;2A, 75 | kclr=\E[3;5~, 76 | kdl1=\E[3;2~, 77 | kdch1=\E[3~, 78 | kich1=\E[2~, 79 | kend=\E[4~, 80 | kf1=\EOP, 81 | kf2=\EOQ, 82 | kf3=\EOR, 83 | kf4=\EOS, 84 | kf5=\E[15~, 85 | kf6=\E[17~, 86 | kf7=\E[18~, 87 | kf8=\E[19~, 88 | kf9=\E[20~, 89 | kf10=\E[21~, 90 | kf11=\E[23~, 91 | kf12=\E[24~, 92 | kf13=\E[1;2P, 93 | kf14=\E[1;2Q, 94 | kf15=\E[1;2R, 95 | kf16=\E[1;2S, 96 | kf17=\E[15;2~, 97 | kf18=\E[17;2~, 98 | kf19=\E[18;2~, 99 | kf20=\E[19;2~, 100 | kf21=\E[20;2~, 101 | kf22=\E[21;2~, 102 | kf23=\E[23;2~, 103 | kf24=\E[24;2~, 104 | kf25=\E[1;5P, 105 | kf26=\E[1;5Q, 106 | kf27=\E[1;5R, 107 | kf28=\E[1;5S, 108 | kf29=\E[15;5~, 109 | kf30=\E[17;5~, 110 | kf31=\E[18;5~, 111 | kf32=\E[19;5~, 112 | kf33=\E[20;5~, 113 | kf34=\E[21;5~, 114 | kf35=\E[23;5~, 115 | kf36=\E[24;5~, 116 | kf37=\E[1;6P, 117 | kf38=\E[1;6Q, 118 | kf39=\E[1;6R, 119 | kf40=\E[1;6S, 120 | kf41=\E[15;6~, 121 | kf42=\E[17;6~, 122 | kf43=\E[18;6~, 123 | kf44=\E[19;6~, 124 | kf45=\E[20;6~, 125 | kf46=\E[21;6~, 126 | kf47=\E[23;6~, 127 | kf48=\E[24;6~, 128 | kf49=\E[1;3P, 129 | kf50=\E[1;3Q, 130 | kf51=\E[1;3R, 131 | kf52=\E[1;3S, 132 | kf53=\E[15;3~, 133 | kf54=\E[17;3~, 134 | kf55=\E[18;3~, 135 | kf56=\E[19;3~, 136 | kf57=\E[20;3~, 137 | kf58=\E[21;3~, 138 | kf59=\E[23;3~, 139 | kf60=\E[24;3~, 140 | kf61=\E[1;4P, 141 | kf62=\E[1;4Q, 142 | kf63=\E[1;4R, 143 | khome=\E[1~, 144 | kil1=\E[2;5~, 145 | krmir=\E[2;2~, 146 | knp=\E[6~, 147 | kmous=\E[M, 148 | kpp=\E[5~, 149 | lines#24, 150 | mir, 151 | msgr, 152 | npc, 153 | op=\E[39;49m, 154 | pairs#64, 155 | mc0=\E[i, 156 | mc4=\E[4i, 157 | mc5=\E[5i, 158 | rc=\E8, 159 | rev=\E[7m, 160 | ri=\EM, 161 | rin=\E[%p1%dT, 162 | ritm=\E[23m, 163 | rmacs=\E(B, 164 | rmcup=\E[?1049l, 165 | rmir=\E[4l, 166 | rmkx=\E[?1l\E>, 167 | rmso=\E[27m, 168 | rmul=\E[24m, 169 | rs1=\Ec, 170 | rs2=\E[4l\E>\E[?1034l, 171 | sc=\E7, 172 | sitm=\E[3m, 173 | sgr0=\E[0m, 174 | smacs=\E(0, 175 | smcup=\E[?1049h, 176 | smir=\E[4h, 177 | smkx=\E[?1h\E=, 178 | smso=\E[7m, 179 | smul=\E[4m, 180 | tbc=\E[3g, 181 | tsl=\E]0;, 182 | xenl, 183 | vpa=\E[%i%p1%dd, 184 | # XTerm extensions 185 | rmxx=\E[29m, 186 | smxx=\E[9m, 187 | # disabled rep for now: causes some issues with older ncurses versions. 188 | # rep=%p1%c\E[%p2%{1}%-%db, 189 | # tmux extensions, see TERMINFO EXTENSIONS in tmux(1) 190 | Tc, 191 | Ms=\E]52;%p1%s;%p2%s\007, 192 | Se=\E[2 q, 193 | Ss=\E[%p1%d q, 194 | 195 | st| simpleterm, 196 | use=st-mono, 197 | colors#8, 198 | setab=\E[4%p1%dm, 199 | setaf=\E[3%p1%dm, 200 | setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, 201 | setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, 202 | sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, 203 | 204 | st-256color| simpleterm with 256 colors, 205 | use=st, 206 | ccc, 207 | colors#256, 208 | oc=\E]104\007, 209 | pairs#32767, 210 | # Nicked from xterm-256color 211 | initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, 212 | setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, 213 | setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, 214 | 215 | st-meta| simpleterm with meta key, 216 | use=st, 217 | km, 218 | rmm=\E[?1034l, 219 | smm=\E[?1034h, 220 | rs2=\E[4l\E>\E[?1034h, 221 | is2=\E[4l\E>\E[?1034h, 222 | 223 | st-meta-256color| simpleterm with meta key and 256 colors, 224 | use=st-256color, 225 | km, 226 | rmm=\E[?1034l, 227 | smm=\E[?1034h, 228 | rs2=\E[4l\E>\E[?1034h, 229 | is2=\E[4l\E>\E[?1034h, 230 | 231 | st-bs| simpleterm with backspace as backspace, 232 | use=st, 233 | kbs=\010, 234 | kdch1=\177, 235 | 236 | st-bs-256color| simpleterm with backspace as backspace and 256colors, 237 | use=st-256color, 238 | kbs=\010, 239 | kdch1=\177, 240 | -------------------------------------------------------------------------------- /st/st.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/st/st.o -------------------------------------------------------------------------------- /st/win.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE for license details. */ 2 | 3 | enum win_mode { 4 | MODE_VISIBLE = 1 << 0, 5 | MODE_FOCUSED = 1 << 1, 6 | MODE_APPKEYPAD = 1 << 2, 7 | MODE_MOUSEBTN = 1 << 3, 8 | MODE_MOUSEMOTION = 1 << 4, 9 | MODE_REVERSE = 1 << 5, 10 | MODE_KBDLOCK = 1 << 6, 11 | MODE_HIDE = 1 << 7, 12 | MODE_APPCURSOR = 1 << 8, 13 | MODE_MOUSESGR = 1 << 9, 14 | MODE_8BIT = 1 << 10, 15 | MODE_BLINK = 1 << 11, 16 | MODE_FBLINK = 1 << 12, 17 | MODE_FOCUS = 1 << 13, 18 | MODE_MOUSEX10 = 1 << 14, 19 | MODE_MOUSEMANY = 1 << 15, 20 | MODE_BRCKTPASTE = 1 << 16, 21 | MODE_NUMLOCK = 1 << 17, 22 | MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ 23 | |MODE_MOUSEMANY, 24 | }; 25 | 26 | void xbell(void); 27 | void xclipcopy(void); 28 | void xdrawcursor(int, int, Glyph, int, int, Glyph); 29 | void xdrawline(Line, int, int, int); 30 | void xfinishdraw(void); 31 | void xloadcols(void); 32 | int xsetcolorname(int, const char *); 33 | int xgetcolor(int, unsigned char *, unsigned char *, unsigned char *); 34 | void xseticontitle(char *); 35 | void xsettitle(char *); 36 | int xsetcursor(int); 37 | void xsetmode(int, unsigned int); 38 | void xsetpointermotion(int); 39 | void xsetsel(char *); 40 | int xstartdraw(void); 41 | void xximspot(int, int); 42 | -------------------------------------------------------------------------------- /st/x.c.rej: -------------------------------------------------------------------------------- 1 | --- x.c 2 | +++ x.c 3 | @@ -149,6 +149,7 @@ static void xhints(void); 4 | static int xloadcolor(int, const char *, Color *); 5 | static int xloadfont(Font *, FcPattern *); 6 | static void xloadfonts(char *, double); 7 | +static void xloadsparefont(); 8 | static void xunloadfont(Font *); 9 | static void xunloadfonts(void); 10 | static void xsetenv(void); 11 | @@ -296,6 +297,7 @@ zoomabs(const Arg *arg) 12 | { 13 | xunloadfonts(); 14 | xloadfonts(usedfont, arg->f); 15 | + xloadsparefont(); 16 | cresize(0, 0); 17 | redraw(); 18 | xhints(); 19 | -------------------------------------------------------------------------------- /st/x.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/octagony/dwm-config-files/31e389097ebd5a2d5b810d3d3e675c50b5e4797e/st/x.o --------------------------------------------------------------------------------