I have this script that runs via a keyboard shortcut (and toggles the Stylus extension stylesheet on/off***). It is specifically for maximized windows so the xdotool values won't change:
#!/bin/bash
xgg="$(xdotool getactivewindow getwindowname)"
if [[ "$xgg" == *" - Mozilla Firefox" ]]
then
xdotool mousemove --sync 18 54 click 1
sleep 0.2
xdotool mousemove --sync 134 85 click 1
sleep 0.2
xdotool mousemove --sync 1365 85 click 1
sleep 0.2
xdotool mousemove --sync 683 384
fi
It checks if the window in focus is Firefox because of *" - Mozilla Firefox"
, which is how titles of Firefox windows end, and, if it matches, it performs the subsequent xdotool commands.
I now would like the xdotool commands to run even if the window is a Private Browsing instance of Firefox.
If I have both a regular Firefox window and a private browsing window open, wmctrl -l
shows this:
$ wmctrl -l
0x0260000b -1 N/A Desktop — Plasma
0x02600016 -1 N/A Plasma
0x03e00018 0 kububb Newest Questions - Ask Ubuntu - Mozilla Firefox
0x03e001cd 0 kububb Newest Questions - Ask Ubuntu - Mozilla Firefox (Private Browsing)
0x05a00006 0 N/A bash: dkb — Konsole
$
What regex is required for the script to recognize both - Mozilla Firefox
and - Mozilla Firefox (Private Browsing)
at the end of the windows' titles?
*** I have the icon for Stylus to the left of the address bar. When the icon is clicked once, a dropdown appears.The second click (in a specific area of the dropdown) toggles the stylesheet on/off.
*
? Or you can also use logical OR.