diff --git a/pkgs/by-name/sane-open/sane-open b/pkgs/by-name/sane-open/sane-open index 981ae16d3..e9c01c997 100755 --- a/pkgs/by-name/sane-open/sane-open +++ b/pkgs/by-name/sane-open/sane-open @@ -83,6 +83,22 @@ configureKeyboardFor_uri() { log "configureKeyboardFor_uri: $1" } +configureKeyboard() { + local resourceType="$1" + shift + case $resourceType in + (application) + configureKeyboardFor_application "$@" + ;; + (file) + configureKeyboardFor_file "$@" + ;; + (uri) + configureKeyboardFor_uri "$@" + ;; + esac +} + open_application() { log "open_application: '$1'" gdbus call --session --timeout 10 \ @@ -123,6 +139,22 @@ open_uri() { "" "$1" "{'ask': }" } +open() { + local resourceType="$1" + shift + case $resourceType in + (application) + open_application "$@" + ;; + (file) + open_file "$@" + ;; + (uri) + open_uri "$@" + ;; + esac +} + # evaluate truthy and print desktop name as `FOO.desktop` if the provided file is a .desktop file suitable for open_application. tryAsDesktopFile() { # open_application (i.e. the DynamicLauncher portal) only understands applications by their @@ -263,7 +295,7 @@ fi if [ -n "$autoKeyboard" ]; then # do in parallel to avoid delaying app launch - configureKeyboardFor_"$resourceType" "$resource" & + (configureKeyboard "$resourceType" "$resource") & fi -open_"$resourceType" "$resource" +open "$resourceType" "$resource"