Many changes including introduction to menu system

THe main addition here is the menu system that is used to contoll the
phone. THere are also some small helper scripts for calls etc.
Jonathan Hodgson 4 years ago
parent 86840be8ee
commit e0cf58430b
  1. 14
      bin/.bin/contact-numbers
  2. 21
      bin/.bin/dmenu/menu-phone
  3. 21
      bin/.bin/dmenu/menu-st
  4. 37
      bin/.bin/dmenu/menu-system
  5. 58
      bin/.bin/dmenu/rofi-volume
  6. 27
      bin/.bin/dmenu/spawn-phone-menu
  7. 12
      bin/.bin/dmenu/trofi
  8. 10
      bin/.bin/notifications/phoneStatus
  9. 7
      bin/.bin/toggleKeyboard
  10. 1
      bin/.bin/volume

@ -2,6 +2,15 @@
addressbook="$HOME/.abook/addressbook" addressbook="$HOME/.abook/addressbook"
filter(){
if [ -n "$1" ]; then
local str="$(echo "$1" | tr -d ' ' | sed 's/^0/+44/')"
grep -i "$str"
else
cat -
fi
}
cat "$addressbook" | cat "$addressbook" |
grep -E '(\[[0-9]+\]|^$|name|phone|mobile)' | grep -E '(\[[0-9]+\]|^$|name|phone|mobile)' |
awk -v RS="\n\n" -v ORS="\n" '{gsub("\n","\t",$0); print $0}' | awk -v RS="\n\n" -v ORS="\n" '{gsub("\n","\t",$0); print $0}' |
@ -9,8 +18,9 @@ cat "$addressbook" |
name="$(echo "$line" | cut -d ' ' -f 2 | cut -d '=' -f 2)" name="$(echo "$line" | cut -d ' ' -f 2 | cut -d '=' -f 2)"
echo "$line" | tr '\t' '\n' | echo "$line" | tr '\t' '\n' |
grep -E '(phone|mobile)' | while read -r numLine; do grep -E '(phone|mobile)' | while read -r numLine; do
num="$(echo "$numLine" | cut -d '=' -f 2 | tr -d ' ' | sed 's/+44(0)/+44/')" num="$(echo "$numLine" | cut -d '=' -f 2 | tr -d ' ' |
sed 's/+44(0)/+44/' | sed 's/^0/+44/')"
numType="$(echo "$numLine" | cut -d '=' -f 1)" numType="$(echo "$numLine" | cut -d '=' -f 1)"
echo -e "$name\t$num\t$numType" echo -e "$name\t$num\t$numType"
done done
done done | filter "$*"

@ -0,0 +1,21 @@
#!/usr/bin/env bash
options="End All Calls
Check for Calls
Check for Texts
Dialer"
while true ; do
choice="$(echo "$options" | trofi)"
case "$choice" in
"End All Calls")
modem="$(mmcli -L | grep -oE 'Modem\/[0-9]+' | head -n 1 | cut -d'/' -f2)"
mmcli -m "$modem" --voice-hangup-all
break ;;
"Check for Calls") checkCall ;;
"Check for Texts") checkSMS ;;
"Dialer") (dialer &); break ;;
"Back") break;;
esac
done

@ -0,0 +1,21 @@
#!/usr/bin/env bash
options="Zoom In
Zoom Out
Paste
System Menu
Exit"
choice=""
while : ; do
choice="$(echo "$options" | trofi)"
case "$choice" in
"Zoom In") sleep 0.3; xdotool key --clearmodifiers "ctrl+shift+j" ;;
"Zoom Out") sleep 0.3; xdotool key --clearmodifiers "ctrl+shift+k" ;;
"Paste") sleep 0.3; xdotool key --clearmodifiers "ctrl+shift+v" ;;
"System Menu") menu-system; break ;;
"Exit") sleep 0.3; xdotool key --clearmodifiers "Super_L+q"; break ;;
"") break ;;
esac
done

@ -0,0 +1,37 @@
#!/usr/bin/env bash
options="Terminal
Browser
Phone
Podcasts
Go To Workspace
Move To Workspace
Power Menu
Exit"
chooseWorkspace(){
seq 1 10 | trofi
}
goToWorkspace(){
xdotool key --clearmodifiers "Super_L+$(chooseWorkspace)"
}
moveToWorkspace(){
xdotool key --clearmodifiers "Super_L+Shift+$(chooseWorkspace)"
}
while true ; do
choice="$(echo "$options" | trofi)"
case "$choice" in
"Terminal") (folder-shell &); break ;;
"Browser") (firefox &); break ;;
"Podcasts") (gnome-podcasts &); break ;;
"Phone") spawn-phone-menu phone ; break ;;
"Go To Workspace") goToWorkspace ; break ;;
"Move To Workspace") moveToWorkspace ; break ;;
"Power Menu") (rofi-shutdown &); break ;;
"Exit") sleep 0.3; xdotool key --clearmodifiers "Super_L+q"; break ;;
"") break;;
esac
done

@ -0,0 +1,58 @@
#!/usr/bin/env bash
up=""
down=""
mute="ﱝ"
while : ; do
active=""
urgent=""
if type -p pulseaudio-ctl 2> /dev/null; then
volume="$(pulseaudio-ctl full-status | cut -d ' ' -f1)"
speakerStatus="$(pulseaudio-ctl full-status | cut -d ' ' -f2 |
sed 's/no/on/g')"
else
volume="$(amixer -D default sget Master | grep -o '\[.*\%' |
head -n 1 | tr -d '[%')"
speakerStatus="$(amixer -D default sget Master | grep -o '\[\(on\|off\)' |
head -n 1 | tr -d '[')"
fi
if [ "$speakerStatus" = "off" ]; then
volume="Muted"
urgent="-u 2"
else
active="-a 2"
fi
choice="$(echo -e "$up\n$down\n$mute" |
rofi -dmenu -theme 'themes/volume.rasi' -p "$volume" $urgent $active)"
case "$choice" in
"$up")
if type -p pulseaudio-ctl 2> /dev/null; then
pulseaudio-ctl up
else
amixer -q -D default sset Master 5%+ unmute
fi
;;
"$down")
if type -p pulseaudio-ctl 2> /dev/null; then
pulseaudio-ctl down
else
amixer -q -D default sset Master 5%- unmute
fi
;;
"$mute")
if type -p pulseaudio-ctl 2> /dev/null; then
pulseaudio-ctl mute
else
amixer -q -D default sset Master toggle
fi
;;
"") break
esac
done

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# This script creates menus for applications running on my phone
error(){
echo "$@" > /dev/stderr
exit 1
}
windowFocus="$(xdotool getwindowfocus)"
if [ -n "$1" ]; then
menu="menu-$1"
else
class="$(xprop -id "$windowFocus" | grep "WM_CLASS" | cut -d '"' -f 2)"
case "$class" in
"xterm-256color") menu="menu-st" ;;
*) menu="menu-$class" ;;
esac
fi
type "$menu" > /dev/null 2>&1 || menu="menu-system"
"$menu"

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# THis is a simple wrapper around rofi which makes it nicer to use with touch screens
input="$(cat -)"
lines="$(echo "$input" | wc -l )"
[ "$lines" -gt 15 ] && lines=15
echo "$input" | rofi -dmenu -me-accept-entry '!MousePrimary' -theme "themes/touch-dmenu.rasi" -lines "$lines"

@ -0,0 +1,10 @@
#!/usr/bin/env bash
battery="$(cat /sys/class/power_supply/axp20x-battery/capacity)"
batteryStatus="$(cat /sys/class/power_supply/axp20x-battery/status)"
[ "$batteryStatus" = "Charging" ] && batteryIcon="🔌" || batteryIcon="🔋"
time="$(date "+%H:%M")"
notify-send "$(hostname)" "$batteryIcon ${battery}%\nTime $time"

@ -0,0 +1,7 @@
#!/usr/bin/env bash
if pidof svkbd-colemak || pidof svkbd-numbers; then
pkill "svkbd-*"
else
svkbd-colemak & disown
fi

@ -43,6 +43,7 @@ case "$1" in
else else
amixer -q -D default sset Master toggle amixer -q -D default sset Master toggle
fi fi
;;
esac esac
if type -p pulseaudio-ctl 2> /dev/null; then if type -p pulseaudio-ctl 2> /dev/null; then

Loading…
Cancel
Save