Add custom shortcut to open and focus applications

You may use some GNOME shell extensions to remove the "Program is Ready" notification and also put the newly launched window into focus, for example

  1. 'Window Is Ready' Notification Remover
  2. NoAnnoyance (Removes the 'Windows is ready' notification and also puts the window into focus)
  3. Focus my window (same as above)

This may not do anything to resolve the notification issue in the question. However, the command pattern described ([cmd] ; wmctrl -a [cls]) may start multiple instances of a program, which the following script avoids. To use, save somewhere in the path, such as ~/bin/find_app.sh, and give it execute permission (chmod +x ~/bin/find_app.sh).

#! /usr/bin/env bash

if [ $# -lt 1 ]; then
   echo "usage: `basename $0` [class-name] [command] [args]"
   echo
   echo "Find and activate window with [class-name]."
   echo "Execute [command] if window cannot be found."
   echo
   echo "If [command] is not given, it is assumed to be [class-name]"
   exit 1
fi

if [ $# -lt 2 ]; then
   # find_app="wmctrl -xa $class"
   class="$1"
   find_app="xdotool search --onlyvisible --class $class windowactivate"
   command="$1"
else
   class="$1"
   find_app="xdotool search --onlyvisible --class $class windowactivate"
   shift
   command="$@"
fi

if (! eval "${find_app}") ; then
   eval "xdotool exec ${command}"
fi

Note: xdotool may return an error for some apps:

XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)

A workaround for the issue is to add --desktop 0 to the find_app variables.

find_app="xdotool search --desktop 0 --onlyvisible --class $class windowactivate"