Ubuntu Forums Archive Viewer

Tip: xprop alias to give the Class Info you need

Archived thread 1056818 from Outdated Tutorials & Tips. Markdown source: Outdated_Tutorials_&_Tips/thread_1056818_Tip_xprop_alias_to_give_the_Class_Info_you_need.md

Original URL About this archive
#1

Just popping this in here so I don't lose it again, but this is a useful line to put in your .bashrc file, especially if you are using devilspie, compiz windows placement, or openbox configs.

it simplifies the output of the command xprop, by simply returning the Class information only

  1. open up a terminal and open $HOME/.bashrc
sudo nano $HOME/.bashrc
  1. Scroll down to alias section and add
alias xp='xprop | grep "WM_WINDOW_ROLE\|WM_CLASS" && echo "WM_CLASS(STRING) = \"NAME\", \"CLASS\""'

and save out and close your shell.

Your cursor turns into an "X". Click on the window you need info about and it should return something like this in your terminal (for a Firefox window)

  1. To test reopen a terminal and type "xp" at the prompt (no quotes)
WM_WINDOW_ROLE(STRING) = "browser"
WM_CLASS(STRING) = "Navigator", "Firefox"
WM_CLASS(STRING) = "NAME", "CLASS"

of course you can modify alias name and string to your own liking :)