Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Category Archives: CentOS

How to get the active title of an X program

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'

Barrier/Synergy installation on EL8

I have packaged barrier and synergy a while ago. A user stated that he cannot install it because it misses dependency: avahi-compat-libdns_sd

For RHEL 8, it is in channel codeready-builder-for-rhel-8-x86_64-rpms

To enable it, runs
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms

For CentOS Stream 8, it is in repository powertools

To enable it, runs
sudo yum-config-manager --enablerepo powertools