KDE-Activities support for Firefox

Use seperate firefox-profile for each activity in KDE.

The script below will start a specific firefox-profile depending on the kde-activity it is started from. At first start it will create a new profile based on your default firefox-profile. You can run several instances/profiles of firefox parallel.

Sources:

Script in /usr/local/sbin/kfirefox:

#
# Compatability for Firefox and kde 4.x's activities.
# by MOber.at
# based on: https://bbs.archlinux.org/viewtopic.php?id=137941
#

ACTIVITY=$( /usr/lib/qt4/bin/qdbus org.kde.ActivityManager /ActivityManager/Activities CurrentActivity )
bla=$( ls $HOME/.mozilla/firefox/ | grep .default )
DEF_PROF="$HOME/.mozilla/firefox/$bla"
NEW_PROF="$HOME/.config/kfirefox/$ACTIVITY"

if [ ! -d $NEW_PROF ];
then
firefox -CreateProfile "$ACTIVITY $NEW_PROF"
rm -rf "$NEW_PROF"
cp -a "$DEF_PROF" "$NEW_PROF"
cd $NEW_PROF
rm -rf sessionstore*
cd ~
fi

firefox -no-remote -P "$ACTIVITY" "$@"

exit

To add a launcher copy /usr/share/applications/firefox.desktop to /usr/share/applications/kde4/kfirefox.desktop and edit each Exec= line in it to point to /usr/local/sbin/kfirefox.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.