diff --git a/Makefile b/Makefile index b5a8cbb..f555f06 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,11 @@ dist: clean rm -rf spmenu-$(VERSION) install: all + rm -rf $(DESTDIR)$(PREFIX)/share/spmenu/ mkdir -p $(DESTDIR)$(PREFIX)/bin + mkdir -p $(DESTDIR)$(PREFIX)/share/spmenu + cp -rf docs/* $(DESTDIR)$(PREFIX)/share/spmenu/ + echo "${VERSION}" > $(DESTDIR)$(PREFIX)/share/spmenu/version cp -rf spmenu scripts/* $(DESTDIR)$(PREFIX)/bin [ -f spmenu.1 ] && mkdir -p ${DESTDIR}${MANPREFIX}/man1 || : [ -f spmenu.1 ] && cp spmenu.1 ${DESTDIR}${MANPREFIX}/man1/spmenu.1 || : diff --git a/TODO b/TODO index ac35901..7426f51 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,7 @@ # TODO for spmenu -- More example scripts - Mouse bind array +- Remove padding added for background colors - Add configuration file using (probably) libconfig - Fix highlighting for last character in a match - Don't allow image scaling too far up/down diff --git a/libs/schemes.c b/libs/schemes.c index 43f4f13..cb00019 100644 --- a/libs/schemes.c +++ b/libs/schemes.c @@ -18,24 +18,20 @@ init_appearance(void) for (i = 0; i < LENGTH(textcolors) && i < LENGTH(textclrs); i++) drw_clr_create(drw, &textclrs[i], textcolors[i], 0); - if (i == 0 && colorsupport) + if (i == 0) drw_clr_create(drw, &textclrs[i++], "#000000", 0); for (; i < 7; i++) { - if (!colorsupport) - break; snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", !!(i & 1) * 0x7f, !!(i & 2) * 0x7f, !!(i & 4) * 0x7f); drw_clr_create(drw, &textclrs[i], cbuf, 0); } - if (i == 7 && colorsupport) + if (i == 7) drw_clr_create(drw, &textclrs[i++], "#000000", 0); - if (i == 8 && colorsupport) + if (i == 8) drw_clr_create(drw, &textclrs[i++], "#333333", 0); for (; i < 16; i++) { - if (!colorsupport) - break; snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", !!(i & 1) * 0xff, !!(i & 2) * 0xff, @@ -43,8 +39,6 @@ init_appearance(void) drw_clr_create(drw, &textclrs[i], cbuf, 0); } for (; i < 6 * 6 * 6 + 16; i++) { - if (!colorsupport) - break; snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", sixd_to_8bit(((i - 16) / 36) % 6), sixd_to_8bit(((i - 16) / 6) % 6), @@ -52,8 +46,6 @@ init_appearance(void) drw_clr_create(drw, &textclrs[i], cbuf, 0); } for (; i < 256; i++) { - if (!colorsupport) - break; snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", 0x08 + (i - 6 * 6 * 6 - 16) * 0x0a, 0x08 + (i - 6 * 6 * 6 - 16) * 0x0a, diff --git a/options.h b/options.h index 7f7ce42..15f65ee 100644 --- a/options.h +++ b/options.h @@ -28,9 +28,6 @@ static int mode = 0; /* Mode to start speedwm in (0: Norm static char normtext[] = "Normal"; /* Text to display for normal mode */ static char instext[] = "Insert"; /* Text to display for insert mode */ -/* Color support */ -static int colorsupport = 1; /* Support 256 colors? Otherwise the default 16 colors will be used. */ - /* Window border options */ static int borderwidth = 2; /* Width of the border */ static int bordercentered = 1; /* Draw border only when centered */ diff --git a/scripts/spmenu_test b/scripts/spmenu_test new file mode 100755 index 0000000..2188c61 --- /dev/null +++ b/scripts/spmenu_test @@ -0,0 +1,109 @@ +#!/bin/sh +# spmenu test script + +# reset sequence +reset='\033[0m' + +# fg colors +v1='\033[0;30m' +v2='\033[0;31m' +v3='\033[0;32m' +v4='\033[0;33m' +v5='\033[0;34m' +v6='\033[0;35m' +v7='\033[0;36m' +v8='\033[0;37m' +v9='\033[1;30m' +v10='\033[1;31m' +v11='\033[1;32m' +v12='\033[1;33m' +v13='\033[1;34m' +v14='\033[1;35m' +v15='\033[1;36m' +v16='\033[1;37m' + +# bg colors +b1='\033[0;40m' +b2='\033[0;41m' +b3='\033[0;42m' +b4='\033[0;43m' +b5='\033[0;44m' +b6='\033[0;45m' +b7='\033[0;46m' +b8='\033[0;47m' +b9='\033[1;40m' +b10='\033[1;41m' +b11='\033[1;42m' +b12='\033[1;43m' +b13='\033[1;44m' +b14='\033[1;45m' +b15='\033[1;46m' +b16='\033[1;47m' + +IMAGE="/usr/share/spmenu/preview.png" +cp $IMAGE /tmp/image.png +command -v maim > /dev/null && maim -uB > /tmp/image.png +IMAGE="/tmp/image.png" + +main() { +[ -e "$IMAGE" ] && IMAGEARG="-is 500" && IMAGEPREFIX="IMG:" || IMAGE="" + +printf "$IMAGEPREFIX$IMAGE\t\ +${v1}\ +s\ +${v2}\ +p\ +${v3}\ +m\ +${v4}\ +e\ +${v5}\ +n\ +${v6}\ +u \ +${v7}\ +v\ +${v8}\ +e\ +${v9}\ +r\ +${v10}\ +s\ +${v11}\ +i\ +${v12}\ +o\ +${v13}\ +n $reset$(cat /usr/share/spmenu/version)\ +${b1}\n\ +${b2}\n\ +${b3}\n\ +${b4}\n\ +${b5}\n\ +${b6}\n\ +${b7}\n\ +${b8}\n\ +${b9}\n\ +${b10}\n\ +${b11}\n\ +${b12}\n\ +${b13}\n\ +${b14}\n\ +${b15}\n\ +${b16}\n\ +${v1}q${v2}w${v3}e${v4}r${v5}t${v6}y${v7}u${v8}i${v9}o${v10}p${v11}[${v12}]${v13}a${v14}s${v15}d${v16}f\n\ +qwertyuiop[]asdf - b\n\ +qwertyuiop[]asdf - i\n\ +qwertyuiop[]asdf - s\n\ +qwertyuiop[]asdf - u\n\ +qwertyuiop[]asdf - sub\n\ +qwertyuiop[]asdf - sup\n\ +qwertyuiop[]asdf - tt\n\ +qwertyuiop[]asdf - small\n\ +qwertyuiop[]asdf - big\n\n\ +Arguments will be passed to spmenu.\n\ +Report any issues at the Codeberg repo.\n\ +" | spmenu -na -l 40 $IMAGEARG "$@" -g 1 -p "spmenu test script" +} + +main "$@"