~mil/sxmo-utils

24905884eea0293e9ab8bb8a349a9f9bed6177f4 — Maarten van Gompel 10 months ago 9d15272
Removed explicit font from most dmenu calls, dmenu font is read from Xresources now and kept as uniform as possible
A configs/appcfg/xresources_dmenu.xr => configs/appcfg/xresources_dmenu.xr +3 -0
@@ 0,0 1,3 @@
dmenu.font: Terminus-30



M scripts/appscripts/sxmo_files.sh => scripts/appscripts/sxmo_files.sh +1 -1
@@ 14,7 14,7 @@ while true; do

	PICKED="$(
		echo "$CHOICES" |
		dmenu -fn Terminus-18 -c -p "$DIR" -l 20 -i
		dmenu -c -p "$DIR" -l 20 -i
	)"

	echo "$PICKED" | grep "Close Menu" && exit 0

M scripts/appscripts/sxmo_record.sh => scripts/appscripts/sxmo_record.sh +3 -3
@@ 38,13 38,13 @@ recordconfirm() {
				Delete Recording
			" |
			xargs -0 echo | sed '/^[[:space:]]*$/d' | awk '{$1=$1};1' |
			dmenu -p "$DUR" -fn Terminus-18 -c -l 10
			dmenu -p "$DUR" -c -l 10
		)"
		if echo "$PICK" | grep "Playback"; then
			st -e mpv -ao=alsa -v "$FILE"
		elif echo "$PICK" | grep "Delete Recording"; then
			rm "$FILE"
			echo "File deleted." | dmenu -fn Terminus-18 -c -l 10
			echo "File deleted." | dmenu -c -l 10
			return
		else
			return


@@ 67,7 67,7 @@ recordmenu() {
			xargs -0 echo |
			sed '/^[[:space:]]*$/d' |
			awk '{$1=$1};1' |
			dmenu -fn Terminus-30 -c -p "Record" -l 20
			dmenu -c -p "Record" -l 20
		)"

		if [ "$OPTION" = "Line Jack" ]; then

M scripts/appscripts/sxmo_reddit.sh => scripts/appscripts/sxmo_reddit.sh +1 -1
@@ 5,7 5,7 @@ menu() {
	pidof "$KEYBOARD" || "$KEYBOARD" &
	SUBREDDIT="$(
		printf %b "Close Menu\n$(echo "$SXMO_SUBREDDITS" | tr " " '\n')" |
		dmenu -p "Subreddit:" -c -l 10 -fn Terminus-20
		dmenu -p "Subreddit:" -c -l 10
	)"
	pkill "$KEYBOARD"
	[ "Close Menu" = "$SUBREDDIT" ] && exit 0

M scripts/appscripts/sxmo_rss.sh => scripts/appscripts/sxmo_rss.sh +1 -1
@@ 61,7 61,7 @@ rsstimespanmenu() {
			echo "$CHOICES" |
			sed '/^[[:space:]]*$/d' |
			awk '{$1=$1};1' |
			dmenu -p "RSS Timespan" -c -l 10 -fn Terminus-20
			dmenu -p "RSS Timespan" -c -l 10
		)"

		if echo "$CHOICE" | grep "Fetch"; then

M scripts/appscripts/sxmo_timer.sh => scripts/appscripts/sxmo_timer.sh +1 -1
@@ 40,7 40,7 @@ menu() {
		1m
		30s
		Close Menu
	" | awk 'NF' | awk '{$1=$1};1' | dmenu -p Timer -c -fn "Terminus-30" -l 20
	" | awk 'NF' | awk '{$1=$1};1' | dmenu -p Timer -c -l 20
	)"
	pkill "$KEYBOARD"
	[ "Close Menu" = "$TIMEINPUT" ] && exit 0

M scripts/appscripts/sxmo_weather.sh => scripts/appscripts/sxmo_weather.sh +1 -1
@@ 130,7 130,7 @@ weathermenu() {
		)" |
		grep -vE '^#' |
		sed "s/\t/: /g" |
		sxmo_dmenu_with_kb.sh -i -c -l 10 -fn Terminus-18 -p "Locations"
		sxmo_dmenu_with_kb.sh -i -c -l 10 -p "Locations"
	)"
	if [ "$CHOICE" = "Close Menu" ]; then
		exit 0

M scripts/appscripts/sxmo_websearch.sh => scripts/appscripts/sxmo_websearch.sh +1 -1
@@ 1,7 1,7 @@
#!/usr/bin/env sh
pidof "$KEYBOARD" || "$KEYBOARD" &
SEARCHQUERY="$(
	echo "Close Menu" | dmenu -t -p "Search Query:" -c -fn "Terminus-20" -l 20
	echo "Close Menu" | dmenu -t -p "Search:" -c -l 20
)"
pkill "$KEYBOARD"
[ "Close Menu" = "$SEARCHQUERY" ] && exit 0

M scripts/appscripts/sxmo_youtube.sh => scripts/appscripts/sxmo_youtube.sh +2 -2
@@ 31,7 31,7 @@ searchmenu() {
				xargs -0 echo |
				sed '/^[[:space:]]*$/d' |
				awk '{$1=$1};1' |
				sxmo_dmenu_with_kb.sh -p "Yt Search" -c -l 10 -fn Terminus-20
				sxmo_dmenu_with_kb.sh -p "Yt Search" -c -l 10
		)"

		if [ "Close Menu" = "$ENTRY" ]; then


@@ 59,7 59,7 @@ resultsmenu() {
				xargs -0 echo |
				sed '/^[[:space:]]*$/d' |
				awk '{$1=$1};1' |
				dmenu -c -l 10 -p "Yt Results" -fn Terminus-20
				dmenu -c -l 10 -p "Results" -fn Terminus-20
		)"

		if [ "Change Search" = "$PICKED" ]; then

M scripts/core/sxmo_appmenu.sh => scripts/core/sxmo_appmenu.sh +1 -1
@@ 440,7 440,7 @@ mainloop() {
	getprogchoices "$ARGS"
	echo "$PROGCHOICES" |
	cut -d'^' -f1 |
	dmenu -idx "$DMENUIDX" -l 16 -c -fn "Terminus-30" -p "$WINNAME" | (
	dmenu -idx "$DMENUIDX" -l 16 -c -p "$WINNAME" | (
		PICKED="$(cat)"
		echo "$PICKED" | grep . || quit
		LOOP="$(echo "$PROGCHOICES" | grep -m1 -F "$PICKED" | cut -d '^' -f2)"

M scripts/core/sxmo_gpsutil.sh => scripts/core/sxmo_gpsutil.sh +3 -3
@@ 166,7 166,7 @@ menuregionsearch() {
		printf %b "$POIS" |
		sed '/^[[:space:]]*$/d' |
		awk '{$1=$1};1' |
		sxmo_dmenu_with_kb.sh -i -c -l 10 -fn Terminus-18 -p Search
		sxmo_dmenu_with_kb.sh -i -c -l 10 -p Search
	)"

	if [ "$QUERY" = "Close Menu" ]; then


@@ 192,7 192,7 @@ menulocations() {
		)" |
		grep -vE '^#' |
		sed "s/\t/: /g" |
		sxmo_dmenu_with_kb.sh -i -c -l 10 -fn Terminus-18 -p "Locations"
		sxmo_dmenu_with_kb.sh -i -c -l 10 -p "Locations"
	)"
	ZOOM=14
	if [ "$CHOICE" = "Close Menu" ]; then


@@ 218,7 218,7 @@ menumaptype() {
		CHOICE="$(
			echo "$CHOICES" |
			awk -F^ '{ print $1 }' |
			dmenu -idx "$IDX" -c -l 10 -fn Terminus-18 -p "Map Type" |
			dmenu -idx "$IDX" -c -l 10 -p "Map Type" |
			awk '{$1=$1};1'
		)"
		echo "$CHOICE" | grep "Close Menu" && exit 0

M scripts/core/sxmo_networks.sh => scripts/core/sxmo_networks.sh +6 -6
@@ 20,7 20,7 @@ toggleconnection() {
deletenetworkmenu() {
	CHOICE="$(
		printf %b "Close Menu\n$(connections)" |
			dmenu -c -p "Delete Network" -l 14 -fn "Terminus-20"
			dmenu -c -p "Delete Network" -l 14
	)"
	if [ "$CHOICE" = "Close Menu" ]; then
		return


@@ 34,13 34,13 @@ deletenetworkmenu() {
addnetworkgsmmenu() {
	CONNNAME="$(
		echo "Close Menu" |
			sxmo_dmenu_with_kb.sh -c -p "Add GSM: Alias" -fn "Terminus-20" -l 20
			sxmo_dmenu_with_kb.sh -c -p "Add GSM: Alias" -l 20
	)"
	[ "$CONNNAME" = "Close Menu" ] && return

	APN="$(
		echo "Close Menu" |
			sxmo_dmenu_with_kb.sh -c -p "Add GSM: APN" -fn "Terminus-20" -l 20
			sxmo_dmenu_with_kb.sh -c -p "Add GSM: APN" -l 20
	)"
	[ "$APN" = "Close Menu" ] && return



@@ 56,13 56,13 @@ addnetworkwpamenu() {
	SSID="$(
		nmcli d wifi list | tail -n +2 | grep -v '^\*' | awk -F'  ' '{ print $6 }' | grep -v '\-\-' |
		xargs -0 printf 'Close Menu\n%s' |
		sxmo_dmenu_with_kb.sh -c -p "Add WPA: SSID" -fn "Terminus-20" -l 20
		sxmo_dmenu_with_kb.sh -c -p "Add WPA: SSID" -l 20
	)"
	[ "$SSID" = "Close Menu" ] && return

	PASSPHRASE="$(
		echo "Close Menu" |
			sxmo_dmenu_with_kb.sh -c -p "Add WPA: Passpharse" -fn "Terminus-20" -l 20
			sxmo_dmenu_with_kb.sh -c -p "Add WPA: Passphrase" -l 20
	)"
	[ "$PASSPHRASE" = "Close Menu" ] && return



@@ 89,7 89,7 @@ networksmenu() {
				Scan Wifi Networks
				Close Menu
			" |
			awk '{$1=$1};1' | grep '\w' | dmenu -c -p 'Networks' -l 14 -fn 'Terminus-20'
			awk '{$1=$1};1' | grep '\w' | dmenu -c -p 'Networks' -l 14
		)"
		if [ "$CHOICE" = "Close Menu" ]; then
			exit

M scripts/core/sxmo_pipecomplete.sh => scripts/core/sxmo_pipecomplete.sh +1 -1
@@ 8,7 8,7 @@ menu() {
		printf %b "$(
		echo "Close Menu";
			echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]' | sort | uniq
		)" | dmenu -p "$PROMPT" -l 10 -i -c -fn Terminus-20
		)" | dmenu -p "$PROMPT" -l 10 -i -c
	)"
	pkill "$KEYBOARD"
}

M scripts/core/sxmo_timezonechange.sh => scripts/core/sxmo_timezonechange.sh +1 -1
@@ 13,7 13,7 @@ menu() {
		find /usr/share/zoneinfo -type f |
		sed  's#^/usr/share/zoneinfo/##g' |
		sort |
		sxmo_dmenu_with_kb.sh -p Timezone -c -l 10 -fn Terminus-20 -i
		sxmo_dmenu_with_kb.sh -p Timezone -c -l 10 -i
	)"
	st -e "$0" change "$T"
}

M scripts/core/sxmo_xinit.sh => scripts/core/sxmo_xinit.sh +1 -0
@@ 35,6 35,7 @@ xdefaults() {
	xsetroot -mod 29 29 -fg '#0b3a4c' -bg '#082430'
	xset s off -dpms
	xrdb /usr/share/sxmo/appcfg/xresources_xcalc.xr
	xrdb /usr/share/sxmo/appcfg/xresources_dmenu.xr
	synclient TapButton1=1 TapButton2=3 TapButton3=2 MinSpeed=0.25
}


M scripts/modem/sxmo_modemcall.sh => scripts/modem/sxmo_modemcall.sh +2 -2
@@ 192,7 192,7 @@ incallmenuloop() {
		cut -d'^' -f1 |
		sed '/^[[:space:]]*$/d' |
		awk '{$1=$1};1' | #this cryptic statement trims leading/trailing whitespace from a string
		dmenu -idx $DMENUIDX -l 14 "$([ "$WINDOWIFIED" = 0 ] && echo "-c" || echo "-wm")" -fn "Terminus-30" -p "$NUMBER" |
		dmenu -idx $DMENUIDX -l 14 "$([ "$WINDOWIFIED" = 0 ] && echo "-c" || echo "-wm")" -p "$NUMBER" |
		(
			PICKED="$(cat)";
			echo "sxmo_modemcall: Picked is $PICKED">&2


@@ 213,7 213,7 @@ dtmfmenu() {
	while true; do
		PICKED="$(
			echo "$NUMS" | grep -o . | sed '1 iReturn to Call Menu' |
			dmenu "$([ "$WINDOWIFIED" = 0 ] && echo "-c" || echo "-wm")" -l 20 -fn Terminus-20 -c -idx $DTMFINDEX -p "DTMF Tone"
			dmenu "$([ "$WINDOWIFIED" = 0 ] && echo "-c" || echo "-wm")" -l 20 -c -idx $DTMFINDEX -p "DTMF Tone"
		)"
		echo "$PICKED" | grep "Return to Call Menu" && return
		DTMFINDEX=$(echo "$NUMS" | grep -bo "$PICKED" | cut -d: -f1 | xargs -IN echo 2+N | bc)

M scripts/modem/sxmo_modemdial.sh => scripts/modem/sxmo_modemdial.sh +2 -2
@@ 21,14 21,14 @@ dialmenu() {
	NUMBER="$(
		printf %b "Close Menu\nMore contacts\n$CONTACTS" |
		grep . |
		sxmo_dmenu_with_kb.sh -l 10 -p Number -c -fn Terminus-20 -i
		sxmo_dmenu_with_kb.sh -l 10 -p Number -c -i
	)"
	echo "$NUMBER" | grep "Close Menu" && kill -9 0

	echo "$NUMBER" | grep -q "More contacts" && NUMBER="$(
		printf %b "Close Menu\n$(sxmo_contacts.sh --all)" |
		grep . |
		sxmo_dmenu_with_kb.sh -l 10 -p Number -c -fn Terminus-20 -i
		sxmo_dmenu_with_kb.sh -l 10 -p Number -c -i
	)"
	NUMBER="$(echo "$NUMBER" | cut -d: -f1 | tr -d -- '- ')"
	if [ -z "$NUMBER" ] || [ "$NUMBER" = "CloseMenu" ]; then

M scripts/modem/sxmo_modeminfo.sh => scripts/modem/sxmo_modeminfo.sh +1 -1
@@ 1,7 1,7 @@
#!/usr/bin/env sh

err() {
	printf %b "$1" | dmenu -fn Terminus-20 -c -l 10
	printf %b "$1" | dmenu -c -l 10
	exit
}


M scripts/modem/sxmo_modemtext.sh => scripts/modem/sxmo_modemtext.sh +5 -5
@@ 41,14 41,14 @@ choosenumbermenu() {
	NUMBER="$(
		printf %b "\nCancel\nMore contacts\n$(sxmo_contacts.sh | grep -E "^\+?[0-9]+:")" |
		awk NF |
		menu sxmo_dmenu_with_kb.sh -p "Number" -fn "Terminus-20" -l 10 -c -i |
		menu sxmo_dmenu_with_kb.sh -p "Number" -l 10 -c -i |
		cut -d: -f1 |
		tr -d -- '- '
	)"
	echo "$NUMBER" | grep -qE "^Morecontacts$" && NUMBER="$( #joined words without space is not a bug
		printf %b "\nCancel\n$(sxmo_contacts.sh --all)" |
			grep . |
			menu sxmo_dmenu_with_kb.sh -l 10 -p "Number" -c -fn Terminus-20 -i |
			menu sxmo_dmenu_with_kb.sh -l 10 -p "Number" -c -i |
			cut -d: -f1 |
			tr -d -- '- '
	)"


@@ 71,7 71,7 @@ sendtextmenu() {
	do
		CONFIRM="$(
			printf %b "Edit Message ($(echo "$TEXT" | head -n1))\nSend to → $NUMBER\nSave as Draft\nCancel" |
			menu dmenu -c -idx 1 -p "Confirm" -fn "Terminus-20" -l 10
			menu dmenu -c -idx 1 -p "Confirm" -l 10
		)"
		echo "$CONFIRM" | grep -E "^Send" && (echo "$TEXT" | sxmo_modemsendsms.sh "$NUMBER" -) && echo "Sent text to $NUMBER">&2 && exit 0
		echo "$CONFIRM" | grep -E "^Cancel$" && exit 1


@@ 92,7 92,7 @@ draft() {
senddrafttextmenu() {
	CONFIRM="$(
		printf %b "Cancel\n$(ls "$DRAFT_DIR")" |
		menu sxmo_dmenu_with_kb.sh -p "Draft Message" -fn "Terminus-20" -l 10 -c -i
		menu sxmo_dmenu_with_kb.sh -p "Draft Message" -l 10 -c -i
	)"
	echo "$CONFIRM" | grep -E "^Cancel$" && exit 1
	FILE="$DRAFT_DIR/$CONFIRM"


@@ 120,7 120,7 @@ main() {
			printf %b "$CONTACT" | xargs -IL echo "L logfile"
		done
	)"
	CONTACTIDANDNUM="$(printf %b "$ENTRIES" | menu dmenu -p Texts -c -fn Terminus-20 -l 10 -i)"
	CONTACTIDANDNUM="$(printf %b "$ENTRIES" | menu dmenu -p Texts -c -l 10 -i)"
	echo "$CONTACTIDANDNUM" | grep "Close Menu" && exit 1
	echo "$CONTACTIDANDNUM" | grep "Send a Text" && sendnewtextmenu && exit 1
	echo "$CONTACTIDANDNUM" | grep "Send a Draft Text" && senddrafttextmenu && exit 1

M scripts/notifications/sxmo_notificationsmenu.sh => scripts/notifications/sxmo_notificationsmenu.sh +1 -1
@@ 19,7 19,7 @@ notificationmenu() {
		sed '/^[[:space:]]*$/d' |
		awk '{$1=$1};1' |
		cut -d^ -f1 |
		dmenu -c -i -fn "Terminus-18" -p "Notifs" -l 10
		dmenu -c -i -p "Notifs" -l 20
	)"

	[ "$PICKEDCONTENT" = "Close Menu" ] && exit 1