You are not logged in.
Hi
I have a hotkey 'Super + z' set to open https://search.disconnect.me/. If I run the script when firefox is in another workspace, then it takes firefox and move it to my current workspace where i ran the script.
Is it therefore possible to make a script with bash or python, so if firefox is running in the same workspace then it will open the website as a new tab in firefox. But if firefox is running in another workspace, then it will open a new instance of firefox in the current workspace and launch the website.
Regards
Frederik Jørgensen
Last edited by Fred7109 (2015-06-08 15:03:15)
Offline
Your current Desktop manager would be usefull info to provide
Offline
Sorry for the missing info. I am using XFCE and the default window manager
Last edited by Fred7109 (2015-06-08 14:15:31)
Offline
Here is a bash script that should work for you
Install this if you don't already have it installed
sudo pacman -S wmctrl
#!/bin/bash
# Find Firefox
ff_desktop="$( wmctrl -l | grep Firefox |awk '{print $2}' )"
# show current desktop
curr_desktop="$( wmctrl -d | gawk '{if ($2 == "*") print $1}' )"
#
if [ "$ff_desktop" == "$curr_desktop" ]; then # firefox opened in the same workspace
exec firefox --new-tab https://search.disconnect.me/
else
exec firefox --new-window https://search.disconnect.me/
fi
Offline
Thanks for help!
But the script is not working perfect yet. Because it always open firefox in a new window, it should only open firefox in a new window if there not is a current instance in the same workspace?
Last edited by Fred7109 (2015-06-08 15:12:32)
Offline
I have made som small changes and now it works perfect:
#!/bin/bash
# Find Firefox
ff_desktop="$( wmctrl -l | grep Firefox |awk '{print $2}' )"
# show current desktop
curr_desktop="$( wmctrl -d | gawk '{if ($2 == "*") printf $1}' )"
#
if [[ $ff_desktop == *"$curr_desktop"* ]]; then # firefox is opened in the same workspace
exec firefox --new-tab https://search.disconnect.me/
else
exec firefox --new-window https://search.disconnect.me/
fi
Last edited by Fred7109 (2015-06-08 16:43:11)
Offline