I have scripts that will utilise the SFDC case number, but why type it manually when the computer can do it?
Firstly, you need to have xdotool installed, for RHEL or CentOS Stream, it is in EPEL. I have tried xprop and xwininfo, but they do not accept search with WM_Class
Secondly, get the WM_Class of the X program, usually it is just the program name. If you are unsure, open that X program, then run xprog and click at the X program, then search WM_CLASS amongst the output.
Thirdly, for X program that has multiple tabs, make sure you activate the tab you want.
Now, to get the active title of firefox:
for i in $(xdotool search --onlyvisible --class firefox); do xdotool getwindowname $i; done
Two titles will be shown like:
The actual title
For me, I am only interest in the number which are in the beginning of the title, so my command is:
for i in $(xdotool search --onlyvisible --class firefox); do xdotool getwindowname $i; done | sed -rne '/^[0-9]+/ s/^([0-9]+).*$/\1/p'