Cleanup virtual keyboard management
Some devices doesn't need a virtual keyboard, aka Nokia N900, aka Pinephone with keyboard. This give a way to disable this feature completely. Also, we remove the sxmo_dmenu_with_kb.sh script, cause it is poorly used, and give inconsistent behavior between menus. The user can already open the keyboard very easily. For this same reason, we remove some random "sxmo_keyboards.sh open". If this isn't necessary cause of a specific usage (aka dtmf special layout. I also dropped some code in sxmo_dmenu.sh that adapt the available size depending on if the keyboard is open or not. The keyboard can be open later, so this is dumb to rely on this, and we should alway be able to open/close it, and to read all lines. I adapted the inputhandler a bit when keyboard is disabled. If you guys think about better usage of freed handler, I'm open!
This commit is contained in:
@@ -615,7 +615,7 @@ case "$WMCLASS" in
|
||||
;;
|
||||
*vimb*)
|
||||
CHOICES="
|
||||
$icon_glb Navigate ^ 0 ^ sxmo_type -k Escape o && sxmo_keyboard.sh open
|
||||
$icon_glb Navigate ^ 0 ^ sxmo_type -k Escape o
|
||||
$icon_zmi Zoom ^ 1 ^ sxmo_type -k Escape zi
|
||||
$icon_zmo Zoom ^ 1 ^ sxmo_type -k Escape zo
|
||||
$icon_arl History ^ 1 ^ sxmo_type -M Ctrl o
|
||||
@@ -632,12 +632,12 @@ case "$WMCLASS" in
|
||||
$icon_cls Close Tab ^ 0 ^ sxmo_type -M Ctrl w
|
||||
$icon_bok Open Bookmarks ^ 0 ^ sxmo_type -M Ctrl b
|
||||
$icon_pls Add Bookmark ^ 0 ^ sxmo_type -M Ctrl d
|
||||
$icon_edt Edit Bookmarks ^ 0 ^ sxmo_keyboard.sh open && sxmo_terminal.sh $EDITOR ~/.local/share/geopard/bookmarks.gemini
|
||||
$icon_edt Edit Bookmarks ^ 0 ^ sxmo_terminal.sh $EDITOR ~/.local/share/geopard/bookmarks.gemini
|
||||
$icon_zmi Increase Font Size ^ 1 ^ sxmo_type -M Ctrl -k plus
|
||||
$icon_zmo Decrease Font Size ^ 1 ^ sxmo_type -M Ctrl -k minus
|
||||
$icon_arl History Back ^ 1 ^ sxmo_type -M Alt -k Left
|
||||
$icon_arr History Forward ^ 1 ^ sxmo_type -M Alt -k Right
|
||||
$icon_fnd URL Bar ^ 0 ^ sxmo_keyboard.sh open && sxmo_type -k F6
|
||||
$icon_fnd URL Bar ^ 0 ^ sxmo_type -k F6
|
||||
$icon_rld Refresh ^ 0 ^ sxmo_type -k F6 -k Return
|
||||
"
|
||||
WINNAME=Geopard
|
||||
@@ -663,7 +663,7 @@ case "$WMCLASS" in
|
||||
$icon_zmi Zoom in ^ 1 ^ sxmo_type -M ctrl =
|
||||
$icon_zmo Zoom out ^ 1 ^ sxmo_type -M ctrl -k minus
|
||||
$icon_fnd Explore POI ^ 0 ^ sxmo_type -M ctrl -M Shift F
|
||||
$icon_fnd Search ^ 0 ^ sxmo_type -M ctrl f && sxmo_keyboard.sh open
|
||||
$icon_fnd Search ^ 0 ^ sxmo_type -M ctrl f
|
||||
$icon_lst Show last results ^ 0 ^ sxmo_type -M ctrl r
|
||||
$icon_map Toggle route planner ^ 0 ^ sxmo_type -M ctrl d
|
||||
$icon_gps Show current location ^ 0 ^ sxmo_type -M ctrl l
|
||||
|
@@ -318,7 +318,11 @@ case "$ACTION" in
|
||||
exit 0
|
||||
;;
|
||||
"voldown_one")
|
||||
sxmo_keyboard.sh toggle
|
||||
if [ -n "$SXMO_NO_KEYBOARD" ]; then
|
||||
sxmo_killwindow.sh
|
||||
else
|
||||
sxmo_keyboard.sh toggle
|
||||
fi
|
||||
exit
|
||||
;;
|
||||
"voldown_two")
|
||||
@@ -374,11 +378,19 @@ case "$ACTION" in
|
||||
exit 0
|
||||
;;
|
||||
"upbottomedge")
|
||||
sxmo_keyboard.sh open
|
||||
if [ -n "$SXMO_NO_KEYBOARD" ]; then
|
||||
sxmo_terminal.sh
|
||||
else
|
||||
sxmo_keyboard.sh open
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
"downbottomedge")
|
||||
sxmo_keyboard.sh close
|
||||
if [ -n "$SXMO_NO_KEYBOARD" ]; then
|
||||
sxmo_killwindow.sh
|
||||
else
|
||||
sxmo_keyboard.sh close
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
"downtopedge")
|
||||
|
@@ -11,7 +11,7 @@
|
||||
menu() {
|
||||
SUBREDDIT="$(
|
||||
printf %b "Close Menu\n$(echo "$SXMO_SUBREDDITS" | tr " " '\n')" |
|
||||
sxmo_dmenu_with_kb.sh -p "Subreddit:"
|
||||
sxmo_dmenu.sh -p "Subreddit:"
|
||||
)" || exit 0
|
||||
[ "Close Menu" = "$SUBREDDIT" ] && exit 0
|
||||
|
||||
|
@@ -41,7 +41,7 @@ stopwatchrun() {
|
||||
}
|
||||
|
||||
menu() {
|
||||
TIMEINPUT="$(sxmo_dmenu_with_kb.sh -p Timer <<EOF
|
||||
TIMEINPUT="$(sxmo_dmenu.sh -p Timer <<EOF
|
||||
Stopwatch
|
||||
1h
|
||||
10m
|
||||
|
@@ -138,7 +138,7 @@ weathermenu() {
|
||||
)" |
|
||||
grep -vE '^#' |
|
||||
sed "s/\t/: /g" |
|
||||
sxmo_dmenu_with_kb.sh -i -c -l 10 -p "Locations"
|
||||
sxmo_dmenu.sh -i -c -l 10 -p "Locations"
|
||||
)" || exit 0
|
||||
if [ "$CHOICE" = "Close Menu" ]; then
|
||||
exit 0
|
||||
|
@@ -6,7 +6,7 @@
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. sxmo_common.sh
|
||||
|
||||
SEARCHQUERY="$(echo "Close Menu" | sxmo_dmenu_with_kb.sh -p "Search:")" || exit 0
|
||||
SEARCHQUERY="$(echo "Close Menu" | sxmo_dmenu.sh -p "Search:")" || exit 0
|
||||
|
||||
case "$SEARCHQUERY" in
|
||||
"Close Menu") exit 0 ;;
|
||||
|
@@ -34,7 +34,7 @@ searchmenu() {
|
||||
xargs -0 echo |
|
||||
sed '/^[[:space:]]*$/d' |
|
||||
awk '{$1=$1};1' |
|
||||
sxmo_dmenu_with_kb.sh -p "Yt Search"
|
||||
sxmo_dmenu.sh -p "Yt Search"
|
||||
)" || exit 0
|
||||
|
||||
if [ "Close Menu" = "$ENTRY" ]; then
|
||||
|
@@ -11,7 +11,7 @@ set -e
|
||||
|
||||
# shellcheck disable=SC2120
|
||||
newcontact() {
|
||||
name="$(printf "" | sxmo_dmenu_with_kb.sh -p "$icon_usr Name")"
|
||||
name="$(printf "" | sxmo_dmenu.sh -p "$icon_usr Name")"
|
||||
|
||||
number="$1"
|
||||
if [ -n "$number" ]; then
|
||||
@@ -19,7 +19,7 @@ newcontact() {
|
||||
fi
|
||||
|
||||
while [ -z "$number" ]; do
|
||||
number="$(sxmo_contacts.sh --unknown | sxmo_dmenu_with_kb.sh -p "$icon_phl Number")"
|
||||
number="$(sxmo_contacts.sh --unknown | sxmo_dmenu.sh -p "$icon_phl Number")"
|
||||
number="$(sxmo_validnumber.sh "$number")" || continue
|
||||
done
|
||||
|
||||
@@ -35,7 +35,7 @@ editcontactname() {
|
||||
ENTRIES="$(printf %b "Old name: $oldname")"
|
||||
PICKED="$(
|
||||
printf %b "$ENTRIES" |
|
||||
sxmo_dmenu_with_kb.sh -p "$icon_edt Edit Contact"
|
||||
sxmo_dmenu.sh -p "$icon_edt Edit Contact"
|
||||
)"
|
||||
|
||||
if ! printf %s "$PICKED" | grep -q "^Old name: "; then
|
||||
@@ -56,7 +56,7 @@ editcontactnumber() {
|
||||
while [ -z "$PICKED" ]; do
|
||||
PICKED="$(
|
||||
printf %b "$ENTRIES" |
|
||||
sxmo_dmenu_with_kb.sh -p "$icon_edt Edit Contact"
|
||||
sxmo_dmenu.sh -p "$icon_edt Edit Contact"
|
||||
)"
|
||||
if printf %s "$PICKED" | grep -q "(Old number)$"; then
|
||||
editcontact "$1"
|
||||
@@ -166,7 +166,7 @@ main() {
|
||||
|
||||
PICKED="$(
|
||||
printf %b "$ENTRIES" |
|
||||
sxmo_dmenu_with_kb.sh -i -p "$icon_lst Contacts"
|
||||
sxmo_dmenu.sh -i -p "$icon_lst Contacts"
|
||||
)"
|
||||
|
||||
case "$PICKED" in
|
||||
|
@@ -61,21 +61,12 @@ if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
|
||||
# TODO: kill dmenu?
|
||||
|
||||
if sxmo_keyboard.sh isopen; then
|
||||
# shellcheck disable=SC2086
|
||||
exec dmenu $SXMO_DMENU_OPTS -l "$(sxmo_rotate.sh isrotated > /dev/null && \
|
||||
printf %s "${SXMO_DMENU_WITH_KB_LANDSCAPE_LINES:-5}" || \
|
||||
printf %s "${SXMO_DMENU_WITH_KB_PORTRAIT_LINES:-12}")" "$@"
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
exec dmenu $SXMO_DMENU_OPTS -l "$(sxmo_rotate.sh isrotated > /dev/null && \
|
||||
printf %s "${SXMO_DMENU_LANDSCAPE_LINES:-7}" || \
|
||||
printf %s "${SXMO_DMENU_PORTRAIT_LINES:-15}")" "$@"
|
||||
fi
|
||||
exit
|
||||
# shellcheck disable=SC2086
|
||||
exec dmenu $SXMO_DMENU_OPTS -l "$(sxmo_rotate.sh isrotated > /dev/null && \
|
||||
printf %s "${SXMO_DMENU_LANDSCAPE_LINES:-5}" || \
|
||||
printf %s "${SXMO_DMENU_PORTRAIT_LINES:-12}")" "$@"
|
||||
fi
|
||||
|
||||
export BEMENU_BACKEND=curses
|
||||
|
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2022 Sxmo Contributors
|
||||
|
||||
if [ -n "$WAYLAND_DISPLAY$DISPLAY" ]; then
|
||||
if sxmo_keyboard.sh isopen; then
|
||||
wasopen="1"
|
||||
fi
|
||||
sxmo_keyboard.sh open
|
||||
sleep .1 # give keyboard time to open
|
||||
fi
|
||||
|
||||
OUTPUT="$(cat | sxmo_dmenu.sh "$@")"
|
||||
exitcode=$?
|
||||
|
||||
if [ -z "$wasopen" ]; then
|
||||
sxmo_keyboard.sh close
|
||||
fi
|
||||
|
||||
printf %s "$OUTPUT"
|
||||
exit $exitcode
|
@@ -14,6 +14,9 @@ isopen() {
|
||||
}
|
||||
|
||||
open() {
|
||||
if [ -n "$SXMO_NO_KEYBOARD" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -n "$KEYBOARD" ]; then
|
||||
#Note: KEYBOARD_ARGS is not quoted by design as it may includes a pipe and further tools
|
||||
# shellcheck disable=SC2086
|
||||
|
@@ -94,14 +94,14 @@ getifname() {
|
||||
addnetworkgsmmenu() {
|
||||
CONNNAME="$(
|
||||
echo "$icon_cls Close Menu" |
|
||||
sxmo_dmenu_with_kb.sh -p "Alias"
|
||||
sxmo_dmenu.sh -p "Alias"
|
||||
)"
|
||||
[ -z "$CONNNAME" ] && return
|
||||
echo "$CONNNAME" | grep -q "Close Menu" && return
|
||||
|
||||
APN="$(
|
||||
echo "$icon_cls Close Menu" |
|
||||
sxmo_dmenu_with_kb.sh -p "APN"
|
||||
sxmo_dmenu.sh -p "APN"
|
||||
)"
|
||||
[ -z "$APN" ] && return
|
||||
echo "$APN" | grep -q "Close Menu" && return
|
||||
@@ -133,7 +133,7 @@ addnetworkgsmmenu() {
|
||||
}
|
||||
|
||||
addnetworkwpamenu() {
|
||||
SSID="$(cat <<EOF | sxmo_dmenu_with_kb.sh -p "SSID"
|
||||
SSID="$(cat <<EOF | sxmo_dmenu.sh -p "SSID"
|
||||
$icon_cls Close Menu
|
||||
$(nmcli d wifi list | tail -n +2 | grep -v '^\*' | awk -F' ' '{ print $6 }' | grep -v '\-\-')
|
||||
EOF
|
||||
@@ -141,7 +141,7 @@ EOF
|
||||
[ -z "$SSID" ] && return
|
||||
echo "$SSID" | grep -q "Close Menu" && return
|
||||
|
||||
PASSPHRASE="$(cat <<EOF | sxmo_dmenu_with_kb.sh -p "Passphrase"
|
||||
PASSPHRASE="$(cat <<EOF | sxmo_dmenu.sh -p "Passphrase"
|
||||
$icon_cls Close Menu
|
||||
None
|
||||
EOF
|
||||
@@ -160,7 +160,7 @@ EOF
|
||||
addhotspotusbmenu() {
|
||||
CONNNAME="$(
|
||||
echo "$icon_cls Close Menu" |
|
||||
sxmo_dmenu_with_kb.sh -p "Alias"
|
||||
sxmo_dmenu.sh -p "Alias"
|
||||
)"
|
||||
[ -z "$CONNNAME" ] && return
|
||||
echo "$CONNNAME" | grep -q "Close Menu" && return
|
||||
@@ -174,21 +174,21 @@ addhotspotusbmenu() {
|
||||
addhotspotwifimenu() {
|
||||
SSID="$(
|
||||
echo "$icon_cls Close Menu" |
|
||||
sxmo_dmenu_with_kb.sh -p "SSID"
|
||||
sxmo_dmenu.sh -p "SSID"
|
||||
)"
|
||||
[ -z "$SSID" ] && return
|
||||
echo "$SSID" | grep -q "Close Menu" && return
|
||||
|
||||
key="$(
|
||||
echo "$icon_cls Close Menu" |
|
||||
sxmo_dmenu_with_kb.sh -p "Passphrase"
|
||||
sxmo_dmenu.sh -p "Passphrase"
|
||||
)"
|
||||
[ -z "$key" ] && return
|
||||
echo "$key" | grep -q "Close Menu" && return
|
||||
|
||||
key1="$(
|
||||
echo "$icon_cls Close Menu" |
|
||||
sxmo_dmenu_with_kb.sh -p "Confirm"
|
||||
sxmo_dmenu.sh -p "Confirm"
|
||||
)"
|
||||
[ -z "$key1" ] && return
|
||||
echo "$key1" | grep -q "Close Menu" && return
|
||||
@@ -210,7 +210,7 @@ addhotspotwifimenu() {
|
||||
fi
|
||||
|
||||
channel="$(
|
||||
printf "%s Close Menu\n11\n" "$icon_cls" | sxmo_dmenu_with_kb.sh -p "Channel"
|
||||
printf "%s Close Menu\n11\n" "$icon_cls" | sxmo_dmenu.sh -p "Channel"
|
||||
)"
|
||||
[ -z "$channel" ] && return
|
||||
echo "$channel" | grep -q "Close Menu" && return
|
||||
|
@@ -9,7 +9,7 @@ menu() {
|
||||
printf %b "$(
|
||||
echo "Close Menu";
|
||||
echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]' | sort | uniq
|
||||
)" | sxmo_dmenu_with_kb.sh -p "$PROMPT" -i
|
||||
)" | sxmo_dmenu.sh -p "$PROMPT" -i
|
||||
)"
|
||||
}
|
||||
|
||||
|
@@ -75,7 +75,5 @@ link_select() {
|
||||
link_normalize "$(xprop -id "$SURF_WINDOW" _SURF_URI | cut -d '"' -f 2)"
|
||||
}
|
||||
|
||||
sxmo_keyboard.sh open
|
||||
VAL="$(link_select)"
|
||||
sxmo_keyboard.sh close
|
||||
echo "$VAL"
|
||||
|
@@ -30,7 +30,7 @@ menu() {
|
||||
find "$zoneinfo_dir" -type f |
|
||||
sed "s#^${zoneinfo_dir}/##g" |
|
||||
sort |
|
||||
sxmo_dmenu_with_kb.sh -p Timezone -i
|
||||
sxmo_dmenu.sh -p Timezone -i
|
||||
)" || exit 0
|
||||
sxmo_terminal.sh "$0" "$T"
|
||||
}
|
||||
|
@@ -79,6 +79,8 @@ SXMO_DISABLE_KEYBINDS | Disable most custom Sxmo binds on volume keys if set.
|
||||
|
||||
SXMO_MONITOR | Display "Output" from `swaymsg -t get_outputs`. Should be the same as the output from the `xrandr` command when running dwm.
|
||||
|
||||
SXMO_NO_KEYBOARD | Disable all virtual keyboard management, and change some related gesture behavior.
|
||||
|
||||
### General / Misc.
|
||||
SXMO_VIBRATE_DEV | Path to vibration device (see sxmo_vibrate.c and clickclack.c) [default: /dev/input/by-path/platform-vibrator-event]
|
||||
SXMO_VIBRATE_STRENGTH | Strength parameter to pass to sxmo_vibrate [default: 1]
|
||||
|
@@ -4,3 +4,4 @@ export SXMO_DISABLE_KEYBINDS=1
|
||||
export SXMO_STATES="unlock locker"
|
||||
export SXMO_UNLOCK_IDLE_TIME=300
|
||||
export SXMO_NO_MODEM=1
|
||||
export SXMO_NO_KEYBOARD=1
|
||||
|
@@ -13,3 +13,4 @@ export SXMO_ROTATE_DIRECTION="left"
|
||||
export SXMO_KEYBOARD_SLIDER_EVENT_DEVICE="/dev/input/by-path/platform-gpio_keys-event"
|
||||
export SXMO_KEYBOARD_SLIDER_CLOSE_EVENT="*code 10 (SW_KEYPAD_SLIDE), value 0*"
|
||||
export SXMO_KEYBOARD_SLIDER_OPEN_EVENT="*code 10 (SW_KEYPAD_SLIDE), value 1*"
|
||||
export SXMO_NO_KEYBOARD=1
|
||||
|
@@ -61,7 +61,7 @@ EOF
|
||||
dial_menu() {
|
||||
# Initial menu with recently contacted people
|
||||
NUMBER="$(
|
||||
grep . <<EOF | sxmo_dmenu_with_kb.sh -p Number -i
|
||||
grep . <<EOF | sxmo_dmenu.sh -p Number -i
|
||||
Close Menu
|
||||
More contacts
|
||||
$(sxmo_contacts.sh --no-groups)
|
||||
@@ -71,7 +71,7 @@ EOF
|
||||
# Submenu with all contacts
|
||||
if [ "$NUMBER" = "More contacts" ]; then
|
||||
NUMBER="$(
|
||||
grep . <<EOF | sxmo_dmenu_with_kb.sh -p Number -i
|
||||
grep . <<EOF | sxmo_dmenu.sh -p Number -i
|
||||
Close Menu
|
||||
$(sxmo_contacts.sh --all --no-groups)
|
||||
EOF
|
||||
|
@@ -21,7 +21,7 @@ choosenumbermenu() {
|
||||
NUMBER="$(
|
||||
printf %b "\n$icon_cls Cancel\n$icon_grp More contacts\n$(sxmo_contacts.sh | grep -E "\+[0-9]+$")" |
|
||||
awk NF |
|
||||
sxmo_dmenu_with_kb.sh -p "Number" -i |
|
||||
sxmo_dmenu.sh -p "Number" -i |
|
||||
cut -d: -f2 |
|
||||
tr -d -- '- '
|
||||
)"
|
||||
@@ -30,7 +30,7 @@ choosenumbermenu() {
|
||||
NUMBER="$( #joined words without space is not a bug
|
||||
printf %b "\nCancel\n$(sxmo_contacts.sh --all)" |
|
||||
grep . |
|
||||
sxmo_dmenu_with_kb.sh -p "Number" -i |
|
||||
sxmo_dmenu.sh -p "Number" -i |
|
||||
cut -d: -f2 |
|
||||
tr -d -- '- '
|
||||
)"
|
||||
@@ -203,7 +203,7 @@ $icon_edt Send a Text
|
||||
$(sxmo_contacts.sh --texted)
|
||||
EOF
|
||||
)"
|
||||
PICKED="$(printf %b "$ENTRIES" | sxmo_dmenu_with_kb.sh -p "Texts" -i)" || exit
|
||||
PICKED="$(printf %b "$ENTRIES" | sxmo_dmenu.sh -p "Texts" -i)" || exit
|
||||
|
||||
if echo "$PICKED" | grep "Close Menu"; then
|
||||
exit 1
|
||||
|
@@ -16,7 +16,7 @@ set -e
|
||||
|
||||
while : ; do
|
||||
PICKED="$(
|
||||
cat <<EOF | sxmo_dmenu_with_kb.sh -l 3 -p "PIN:"
|
||||
cat <<EOF | sxmo_dmenu.sh -l 3 -p "PIN:"
|
||||
$icon_cls Cancel
|
||||
0000
|
||||
1234
|
||||
|
Reference in New Issue
Block a user