3

I'm trying to add hotkeys to fast open some applications (for example KeePassXC) and I've done what I wanted

Keyboard Settings -> Keyboard Shortcuts -> /usr/bin/keepassxc ; wmctrl -a keepassxc

This works during the first run, or when the window was completely closed. The problem starts when the window is not activated and I want to activate it and bring to front. During pressing the hotkey Ubuntu just shows the notification that the Program is Ready, without activation. I'm new to the system, need help with finding the way to get rid of that notification and actually bring the needed app to the front with focus.

2

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)
  • Great sample of answer: now I know about how to use GNOME extensions + "NoAnnoyance" was the thing I was looking for! And what's the logic behind that "Window is ready"? Thank you! – 0x49D1 May 7 '18 at 18:32
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.