about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xpos-dyntercomms.sh (renamed from sxmo_hook_contextmenu.sh)99
-rw-r--r--s2.sh2
2 files changed, 15 insertions, 86 deletions
diff --git a/sxmo_hook_contextmenu.sh b/pos-dyntercomms.sh
index d398d0d..2110bd3 100755
--- a/sxmo_hook_contextmenu.sh
+++ b/pos-dyntercomms.sh
@@ -3,6 +3,8 @@
 # Copyright 2022 Sxmo Contributors
 # derived from sxmo_hook_contextmenu.sh
 # Copyright 2024 Zach DeCook
+
+setComms(){
 activewmclass="$1"
 activetitle="$2"
 if ! test "$activewmclass"; then
@@ -16,29 +18,12 @@ echo $WMNAME
 case "$activewmclass" in
 	*mpv*)
 		# MPV
-		CHOICES="
-			$icon_pau Pause        ^ 0 ^ sxmo_type -k Space
-			$icon_fbw Seek       ^ 1 ^ sxmo_type -k Left
-			$icon_ffw Seek       ^ 1 ^ sxmo_type -k Right
-			$icon_aru App Volume Up ^ 1 ^ sxmo_type 0
-			$icon_ard App Volume Down ^ 1 ^ sxmo_type 9
-			$icon_aru Speed up      ^ 1 ^ sxmo_type -k bracketRight
-			$icon_ard Speed down    ^ 1 ^ sxmo_type -k bracketLeft
-			$icon_cam Screenshot   ^ 1 ^ sxmo_type s
-			$icon_itm Loopmark     ^ 1 ^ sxmo_type l
-			$icon_inf Info         ^ 1 ^ sxmo_type i
-			$icon_inf Seek Info    ^ 1 ^ sxmo_type o
-		"
+		#pause seekbw seekfw volu vold 
+		#speedup         speeddown
+		#screenshot loopmark info seekinfo
+		c="' ','Left','Right','0','9','BracketRight','BracketLeft','s','l','i','o'"
 		WINNAME=Mpv
 		;;
-	io.bassi.amberol)
-		CHOICES="
-			$icon_pau Play/Pause ^ 0 ^ playerctl play-pause
-			$icon_prv Previous Track ^ 1 ^ playerctl previous
-			$icon_nxt Next Track ^ 1 ^ playerctl next
-		"
-		WINNAME=Amberol
-		;;
 	*feh*)
 		# Feh
 		CHOICES="
@@ -146,8 +131,6 @@ case "$activewmclass" in
 				$icon_pst Paste           ^ 0 ^ sxmo_type -M Ctrl u
 				$icon_itm Type complete   ^ 0 ^ sxmo_type -M Shift -M Ctrl u
 				$icon_cpy Copy complete   ^ 0 ^ sxmo_type -M Shift -M Ctrl i
-				$icon_zmi Zoom in         ^ 1 ^ sxmo_type -k Prior
-				$icon_zmo Zoom out        ^ 1 ^ sxmo_type -k Next
 				$icon_mnu Terminal menu   ^ 0 ^ sxmo_appmenu.sh $WMCLASS
 			"
 			WINNAME=Nano
@@ -283,32 +266,6 @@ case "$activewmclass" in
 			"
 			WINNAME=weechat
 			;;
-		*" sms "*|*"missed call"*)
-			number="$(printf "%s\n" "$WMNAME" | xargs -0 pnc find | tr -d '\n')"
-			#sms
-			CHOICES="
-				$icon_msg Conversation   ^ 0 ^ sxmo_terminal.sh sxmo_modemtext.sh conversationloop $number
-				$icon_msg Reply          ^ 0 ^ sxmo_modemtext.sh sendtextmenu $number
-				$icon_phn Call           ^ 0 ^ sxmo_modemdial.sh $number
-				$([ -d "$SXMO_LOGDIR/$number/attachments" ] && echo "$icon_att View Attachments ^ 1 ^ sxmo_files.sh $SXMO_LOGDIR/$number/attachments --date-sort")
-				$(
-
-				found_numbers="$(printf %s "$number" | xargs -I{} pnc find "{}")"
-				printf "%s\n" "$found_numbers" | while read -r line; do
-					sxmo_contacts.sh --name "$line" | grep -q '???' && echo "$icon_usr Add $line ^ 1 ^ sxmo_contactmenu.sh newcontact $line"
-				done
-				# if this is a group chain, then allow to add entire chain as a contact too
-				if [ "$(printf "%s\n" "$found_numbers" | wc -l)" -gt 1 ]; then
-					sxmo_contacts.sh --name "$number" | grep -q '???' && echo "$icon_usr Add $number ^ 1 ^ sxmo_contactmenu.sh newcontact $number"
-				fi
-
-				)
-				$icon_aru Scroll up       ^ 1 ^ sxmo_type -M Shift -M Ctrl b
-				$icon_ard Scroll down     ^ 1 ^ sxmo_type -M Shift -M Ctrl f
-				$icon_mnu Terminal menu ^ 0 ^ sxmo_appmenu.sh $WMCLASS
-			"
-			WINNAME=phone
-			;;
 		*cmus*)
 			# cmus
 			# requires `:set set_term_title=false` in cmus to match the application
@@ -388,7 +345,7 @@ case "$activewmclass" in
 					"
 					WINNAME=Foot
 					;;
-				*terminal*|org.gnome.vte.application)
+				*terminal*|org.gnome.vte.application|Terminal)
 					CHOICES="$icon_kbd Hotkeys ^ 0 ^ sxmo_appmenu.sh sthotkeys"
 					WINNAME=Terminal
 					;;
@@ -677,42 +634,10 @@ case "$activewmclass" in
 		"
 		WINNAME=Tabbed
 		;;
-	*)
-		# Default system menu (no matches)
-		CHOICES="
-			$icon_grd Scripts                                            ^ 0 ^ sxmo_appmenu.sh scripts
-			$icon_grd Apps                                               ^ 0 ^ sxmo_appmenu.sh applications
-			$icon_grd Binaries                                           ^ 0 ^ sxmo_brun.sh
-			$icon_dir Files                                              ^ 0 ^ sxmo_files.sh
-			$icon_phn Dialer                                             ^ 0 ^ sxmo_modemdial.sh
-			$icon_msg Texts                                              ^ 0 ^ sxmo_modemtext.sh
-			$icon_usr Contacts                                           ^ 0 ^ sxmo_contactmenu.sh
-			$(
-				rfkill list bluetooth -no ID,SOFT,HARD | grep -vq " blocked" &&
-				printf %b "$icon_bth Bluetooth ^ 1 ^ sxmo_bluetoothmenu.sh"
-			)
-			$(command -v megapixels >/dev/null && echo "$icon_cam Camera ^ 0 ^ GDK_SCALE=2 megapixels")
-			$(
-				if brightness="$(brightnessctl -d "white:flash" get)"; then
-					printf "%s Flashlight " "$icon_fll"
-					[ "$brightness" -gt 0 ] &&
-						printf %b "$icon_ton" ||  printf %b "$icon_tof";
-					printf %b "^ 1 ^ sxmo_flashtoggle.sh"
-				fi
-			)
-			$icon_net Networks                                           ^ 0 ^ sxmo_networks.sh
-			$icon_mus Audio                                              ^ 0 ^ sxmo_audio.sh
-			$icon_phn Modem                                              ^ 0 ^ sxmo_appmenu.sh modem
-			$icon_win Windows                                            ^ 0 ^ sxmo_wmmenu.sh
-			$icon_cfg Config                                             ^ 0 ^ sxmo_appmenu.sh config
-			$icon_pwr Power                                              ^ 0 ^ sxmo_appmenu.sh power
-		"
-		WINNAME=Sys
-		;;
 esac
 
 if ! test "$c"; then
-#printf "%b\n" "$WINNAME"
+printf "%b\n" "$WINNAME"
 c="$(printf "%b\n" "$CHOICES" |grep sxmo_type|sed "s/sxmo_type[^ ]* \(\S\)$/'\1'/g"|
 sed "s/sxmo_type[^ ]* -k \(\S\+\)$/'\1'/g"|
 sed "s/sxmo_type[^ ]* -M Ctrl \(\S\)$/'<ctrl>\1'/ig"|
@@ -732,10 +657,16 @@ sed "s/sxmo_type[^ ]* -M Ctrl -M Shift -M \(Enter\)$/'<ctrl><shift>\1'/ig"|
 sed "s/sxmo_type[^ ]* -M Alt \(\S\)$/'<alt>\1'/g"|
 sed "s/sxmo_type[^ ]* -M Alt -k \(\S\+\)$/'<alt>\1'/g"|
 sed "s/sxmo_type[^ ]* -M Alt \(\S\) -m Alt$/'<alt>\1'/g"|
-sed "s/sxmo_type[^ ]* -M Alt -k \(\S\+\) -m Alt$/'<alt>\1'/g" |grep -v sxmo_type | grep -o "'[^']\+'$"|tr "\n" ,)"
+sed "s/sxmo_type[^ ]* -M Alt -k \(\S\+\) -m Alt$/'<alt>\1'/g" |grep -v sxmo_type | grep -o "'[^']\+'$"|tr "\n" ,|sed 's/,$//g')"
 fi
 echo "$c"
 
 test "$c" &&
 gsettings set sm.puri.phosh.osk.Terminal shortcuts "[$c]"
+}
 
+if test "$1" = "--watch"; then
+	socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" |grep 'activewindow>>' | while read -r line; do setComms; done
+else
+	setComms "$@"
+fi
diff --git a/s2.sh b/s2.sh
deleted file mode 100644
index 8392f70..0000000
--- a/s2.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" |grep 'activewindow>>'