File: sxmo_menumode_toggler.sh

package info (click to toggle)
sxmo-utils 1.14.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 6,016 kB
  • sloc: sh: 9,166; ansic: 117; makefile: 68
file content (25 lines) | stat: -rwxr-xr-x 595 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors

# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh

inputs="
	${SXMO_POWER_BUTTON:-"0:0:axp20x-pek"}
	${SXMO_VOLUME_BUTTON:-"1:1:1c21800.lradc"}
"

setup_xkb() {
	for input in $inputs; do
		swaymsg input "$input" xkb_file "$1"
	done
}

swaymsg -t subscribe -m "['mode']" | while read -r message; do
	if printf %s "$message" | grep -q menu; then
		setup_xkb "$(xdg_data_path sxmo/xkb/xkb_mobile_movement_buttons)"
	else
		setup_xkb "$(xdg_data_path sxmo/xkb/xkb_mobile_normal_buttons)"
	fi
done