Identify package by window?

Solution 1:

Open a terminal (ctrl-alt-t) and type

ubuntu-bug -w

a message will pop up instructing you to click on a window to file a bug report about the application owning that window.

Incidentally, this uses apport, which collects a lot of useful debugging information automatically and is the preferred way to report Ubuntu bugs.

Solution 2:

roadmr's answer above is by far the best way to go, but I wanted to see if I could come up with a bash one-liner that reports back the correct source package. It's even messier than I imagined since you apparently can't pipe to dpkg or which.

dpkg -S $(which $(xprop | grep "WM_CLASS(STRING)" | grep -o "\".*\"" | cut -d "," -f 1 | tr -d '""')) | cut -d ":" -f 1

Let's unpack this a little. The grep and cut stuff are simply searching for and manipulating strings. The interesting things are:

  • xprop - Lets you find out information about the window you click on.

  • which - Returns the full path of the command used. Example:

    $ which  gnome-control-center
    /usr/bin/gnome-control-center
    
  • dpkg -S - Given a file, provides the name of the source package it comes from. Very useful when the binary name and source package name differ. Example:

    $ dpkg -S /usr/bin/orca
    gnome-orca: /usr/bin/orca