https://bugs.kde.org/show_bug.cgi?id=410381

--- Comment #11 from Ahmad Samir <a.samir...@gmail.com> ---
If someone stumbles upon this report, here's a better version of my puny script
that uses window ID instead of relying on title (if you have two firefox
windows with the same title on two different virtual desktops, it's playing a
toss-up):

#!/bin/bash
# get the current virtual desktop number
currDesktopNum=$(wmctrl -d | grep -F "*" | cut -d' ' -f1)

# get the win id of any firefox window, if any exists, on the current desktop
ffWinID=$(wmctrl -l | grep Mozilla\ Firefox | grep -F "  "$currDesktopNum" " |
head -n1 | perl -p -e 's!([\S]+).+!$1!')

# if the win id isn't empty, i.e. there's a firefox window on this desktop,
raise that window
# then call firefox --new-tab; otherwise call firefox --new-window
if [ ! -z "$ffWinID" ]; then
    wmctrl -i -a "$ffWinID"
    /usr/bin/firefox --new-tab "$@"
else
    /usr/bin/firefox --new-window "$@"
fi

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to