Hello
Does anyone know why this snippet of code doesn’t work when invoked from Shortcuts?
When it’s launched from terminal or Tracker works flawlessly
Tnx in advance
#! /bin/sh
while read app_name
do
while read win_count
do
for ((count=0;count<${win_count};count++))
do
if [ "`timeout 1 hey -o "${app_name}" get Active of Window ${count}`" == "true" ]
then
alert "${app_name} ${count}"
exit
fi
done
done <<< `hey -o ${app_name} count of Window`
done <<< `roster | grep -v 'server' | awk '/\(/{print $2}' FS='[()]' | sort -u`
tbh not sure if I can answer this… from what I can tell, it looks like it should work (and you’d mentioned it works from Terminal, which I guess confirms my theory)… but ngl I haven’t tried a script in Shortcuts yet. But anyways, my first guess is chmod +x the script (like chmod +x ./windowing-script.sh) in Terminal and Identify the script in Tracker. If Haiku doesn’t get the MIME type, maybe try assigning it manually. If nothing works, I guess the last thing I’d say is maybe Shortcuts needs a Haiku executable to work… so last thing I’d try is maybe wrap the script inside a basic C program by calling the script in system();, compile it with gcc, and see if it works that way? Not sure what else I could give to help but I legit hope this helps
Tnx for your reply, i already use shortcut to launch a script that prompt through alert a “power management menu” and this works, but it’s simpler than the previous one, this runs multiple instances so probably it cannot be done using input_server