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.
This commit is contained in:
parent
72ecf44743
commit
43f0dd09bc
10 changed files with 206 additions and 2 deletions
|
@ -2,6 +2,15 @@
|
|||
|
||||
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" |
|
||||
grep -E '(\[[0-9]+\]|^$|name|phone|mobile)' |
|
||||
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)"
|
||||
echo "$line" | tr '\t' '\n' |
|
||||
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)"
|
||||
echo -e "$name\t$num\t$numType"
|
||||
done
|
||||
done
|
||||
done | filter "$*"
|
||||
|
|
21
bin/.bin/dmenu/menu-phone
Executable file
21
bin/.bin/dmenu/menu-phone
Executable file
|
@ -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
|
||||
|
21
bin/.bin/dmenu/menu-st
Executable file
21
bin/.bin/dmenu/menu-st
Executable file
|
@ -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
|
||||
|
37
bin/.bin/dmenu/menu-system
Executable file
37
bin/.bin/dmenu/menu-system
Executable file
|
@ -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
|
||||
|
58
bin/.bin/dmenu/rofi-volume
Executable file
58
bin/.bin/dmenu/rofi-volume
Executable file
|
@ -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
|
27
bin/.bin/dmenu/spawn-phone-menu
Executable file
27
bin/.bin/dmenu/spawn-phone-menu
Executable file
|
@ -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"
|
||||
|
||||
|
||||
|
12
bin/.bin/dmenu/trofi
Executable file
12
bin/.bin/dmenu/trofi
Executable file
|
@ -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"
|
10
bin/.bin/notifications/phoneStatus
Executable file
10
bin/.bin/notifications/phoneStatus
Executable file
|
@ -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"
|
||||
|
7
bin/.bin/toggleKeyboard
Executable file
7
bin/.bin/toggleKeyboard
Executable file
|
@ -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
|
||||
amixer -q -D default sset Master toggle
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if type -p pulseaudio-ctl 2> /dev/null; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue