SWMO - SXMO over Wayland
This is a huge patch for Swmo, Sxmo over Sway.
It is Dwm backward compatible so dwm users should not expect regressions.
If you install all dependencies, you then can toggle between Sway and Dwm using a new config entry. It will reboot the phone.
This commit also contains:
    * Make the modemmonitor bullet proof
    * various other smaller fixes
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
			
			
This commit is contained in:
		
							parent
							
								
									b1403f983e
								
							
						
					
					
						commit
						8a27933c47
					
				
					 54 changed files with 1500 additions and 545 deletions
				
			
		| 
						 | 
				
			
			@ -4,21 +4,6 @@ WMCLASS="$1"
 | 
			
		|||
WMNAME="$2"
 | 
			
		||||
ACTION="$3"
 | 
			
		||||
 | 
			
		||||
key() {
 | 
			
		||||
	xdotool windowactivate "$WIN"
 | 
			
		||||
	xdotool key --delay 50 --clearmodifiers "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type() {
 | 
			
		||||
	xdotool windowactivate "$WIN"
 | 
			
		||||
	xdotool type --delay 50 --clearmodifiers "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
typeenter() {
 | 
			
		||||
	type "$@"
 | 
			
		||||
	xdotool key Return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# You must exit 0 if you handled the input to not trigger default behaviors
 | 
			
		||||
 | 
			
		||||
if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then
 | 
			
		||||
| 
						 | 
				
			
			@ -35,24 +20,24 @@ exit 1 # Remove this in your user hook
 | 
			
		|||
# Please share your recipes to the community :D
 | 
			
		||||
 | 
			
		||||
case "$WMCLASS" in
 | 
			
		||||
	*"st-256color"*)
 | 
			
		||||
	*"foot"*)
 | 
			
		||||
		case "$WMNAME" in
 | 
			
		||||
			*"weechat"*)
 | 
			
		||||
				case "$ACTION" in
 | 
			
		||||
					*"oneleft")
 | 
			
		||||
						key Alt+a
 | 
			
		||||
						sxmo_type.sh -M Alt -k a
 | 
			
		||||
						exit 0
 | 
			
		||||
						;;
 | 
			
		||||
					*"oneright")
 | 
			
		||||
						key Alt+Shift+comma
 | 
			
		||||
						sxmo_type.sh -M Alt -k less
 | 
			
		||||
						exit 0
 | 
			
		||||
						;;
 | 
			
		||||
					*"oneup")
 | 
			
		||||
						key Page_Down
 | 
			
		||||
						sxmo_type.sh -k Page_Down
 | 
			
		||||
						exit 0
 | 
			
		||||
						;;
 | 
			
		||||
					*"onedown")
 | 
			
		||||
						key Page_Up
 | 
			
		||||
						sxmo_type.sh -k Page_Up
 | 
			
		||||
						exit 0
 | 
			
		||||
						;;
 | 
			
		||||
			esac
 | 
			
		||||
| 
						 | 
				
			
			@ -62,19 +47,19 @@ case "$WMCLASS" in
 | 
			
		|||
	*"mpv"*)
 | 
			
		||||
		case "$ACTION" in
 | 
			
		||||
			"oneright")
 | 
			
		||||
				key Left
 | 
			
		||||
				sxmo_type.sh -k Left
 | 
			
		||||
				exit 0
 | 
			
		||||
				;;
 | 
			
		||||
			"oneleft")
 | 
			
		||||
				key Right
 | 
			
		||||
				sxmo_type.sh -k Right
 | 
			
		||||
				exit 0
 | 
			
		||||
				;;
 | 
			
		||||
			"upone")
 | 
			
		||||
				key m
 | 
			
		||||
			"oneup")
 | 
			
		||||
				sxmo_type.sh m
 | 
			
		||||
				exit 0
 | 
			
		||||
				;;
 | 
			
		||||
			"onedown")
 | 
			
		||||
				key p
 | 
			
		||||
				sxmo_type.sh p
 | 
			
		||||
				exit 0
 | 
			
		||||
				;;
 | 
			
		||||
		esac
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,10 +13,40 @@ if [ -z "$LISGD_THRESHOLD_PRESSED" ]; then
 | 
			
		|||
	LISGD_THRESHOLD_PRESSED=60
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
case "$(sxmo_wm.sh)" in
 | 
			
		||||
	sway)
 | 
			
		||||
		output="$(
 | 
			
		||||
			swaymsg -t get_outputs \
 | 
			
		||||
				| jq -r '.[] | select(.name == "DSI-1") | {transform: .transform, width: .current_mode.width, height: .current_mode.height}' \
 | 
			
		||||
				| sed "s|normal|0|"
 | 
			
		||||
		)"
 | 
			
		||||
		transform="$(printf %s "$output" | jq -r .transform)"
 | 
			
		||||
		width="$(printf %s "$output" | jq -r .width)"
 | 
			
		||||
		height="$(printf %s "$output" | jq -r .height)"
 | 
			
		||||
		orientation="$((transform / 90))"
 | 
			
		||||
		;;
 | 
			
		||||
	dwm)
 | 
			
		||||
		output="$(xrandr | grep DSI-1 | sed "s|.* \(\d\+\)x\(\d\+\)+.*|\1 \2|")"
 | 
			
		||||
		height="$(printf %s "$output" | cut -d" " -f2)"
 | 
			
		||||
		width="$(printf %s "$output" | cut -d" " -f1)"
 | 
			
		||||
		case "$(xrandr | grep DSI-1 | cut -d' ' -f 5)" in
 | 
			
		||||
			right) orientation=1;;
 | 
			
		||||
			left) orientation=3;;
 | 
			
		||||
			inverted) orientation=2;;
 | 
			
		||||
			*) orientation=0;;
 | 
			
		||||
		esac
 | 
			
		||||
		if [ "$((orientation%2))" -ne 0 ]; then
 | 
			
		||||
			tmp="$height"
 | 
			
		||||
			height="$width"
 | 
			
		||||
			width="$tmp"
 | 
			
		||||
		fi
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
#-g format:
 | 
			
		||||
#   fingers,swipe,edge,distance,command
 | 
			
		||||
#order matters, only the first match gets executed
 | 
			
		||||
lisgd "$@" -t "$LISGD_THRESHOLD" -T "$LISGD_THRESHOLD_PRESSED" \
 | 
			
		||||
lisgd "$@" -o "$orientation" -h "$height" -w "$width" \
 | 
			
		||||
	-t "$LISGD_THRESHOLD" -T "$LISGD_THRESHOLD_PRESSED" \
 | 
			
		||||
	-g '1,DRUL,BR,*,sxmo_inputhandler.sh bottomrightcorner' \
 | 
			
		||||
	-g '1,DLUR,BL,*,sxmo_inputhandler.sh bottomleftcorner' \
 | 
			
		||||
	-g '1,ULDR,TL,*,sxmo_inputhandler.sh topleftcorner' \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ sim_n() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
retry=1
 | 
			
		||||
pkill dmenu #kill existing dmenu
 | 
			
		||||
sxmo_dmenu.sh close
 | 
			
		||||
while [ $retry -eq 1 ]; do
 | 
			
		||||
	PICKED="$(
 | 
			
		||||
		# shellcheck disable=SC2039,SC3037
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue