Files
sxmo-utils/scripts/core/sxmo_timezonechange.sh
Willow Barraco 4913fac4ee 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!
2024-03-25 17:32:26 +01:00

51 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
change_alpine() {
echo "Changing timezone to $1"
doas setup-timezone -z "$1"
sxmo_hook_statusbar.sh time
echo "Timezone changed ok"
}
change_systemd() {
echo "Changing timezone to $1"
timedatectl set-timezone "$1"
sxmo_hook_statusbar.sh time
echo "Timezone changed ok"
}
menu() {
zoneinfo_dir=$(xdg_data_path zoneinfo)
T="$(
find "$zoneinfo_dir" -type f |
sed "s#^${zoneinfo_dir}/##g" |
sort |
sxmo_dmenu.sh -p Timezone -i
)" || exit 0
sxmo_terminal.sh "$0" "$T"
}
if [ $# -gt 0 ]; then
trap "read -r" EXIT
set -e
case "$SXMO_OS" in
alpine|postmarketos) change_alpine "$@";;
arch|archarm|debian) change_systemd "$@";;
nixos) echo "Change the timezone in configuration.nix with time.timeZone = \"[timezone]\"";;
*) echo "Changing the timezone isn't implemented on your distro yet";;
esac
else
menu
fi