jump to navigation

Google chrome per-workspace profiles 2013 September 24 13:44

Posted by diamond in : Tech , trackback

Do you use chrome and find it irritating that when you click on a link outside of the browser, it’ll just use whatever chrome window you last had active? I sure do. Here’s my fix for gnome classic:

1) A custom launcher script that detects which workspace i’m on, and decides which browser profile to send the request to:

$ cat bin/google-chrome-launcher
#!/bin/bash
workspace=$(xprop -root -notype _NET_CURRENT_DESKTOP | sed 's/^.* = //')
profiledir=""
 
case "$workspace" in
0) profiledir="Default";;
1) profiledir="Profile 1";;
esac
 
if [ -n "$profiledir" ]; then
exec google-chrome --profile-directory="$profiledir" "$@"
else
exec google-chrome "$@"
fi

2) A custom .desktop to invoke my custom script:

$ cat .local/share/applications/google-chrome-custom.desktop
[Desktop Entry]
Version=1.0
Name=Google Chrome Custom
Exec=google-chrome-launcher %U
Terminal=false
Icon=google-chrome
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;

3) Make this the default. Gnome Classic/Fallback being the horrible hybrid broken beast that it is, i could find no gui way of doing this, so i simply edited ~/.local/share/applications/mimeapps.list and changed every occurrence of google-chrome.desktop to google-chrome-custom.desktop, and that seemed to do the trick.

Comments»

no comments yet - be the first?