How can I start a separate instance (not profile) of Chromium, with its own icon?
I want to have two completely different instances of Chromium, each with its own icon, so that:
- There are two taskbar buttons, and...
- ...two entries in the window switcher (Ubuntu 18, GNOME)
- They are easily distinguishable by icon/color
- I can Alt+Tab between these two instances, and Alt+` (key above Tab) among windows within an instance
How can I do that?
Solutions I've considered:
Different profiles - doesn't satisfy the requirements because all Chromium windows, from all profiles, get lumped under the same taskbar button and window switcher entry.- Install Chrome Beta and Chrome Dev. These aren't exactly Chromium, and I prefer the open source Chrome.
Install Chromium beta/dev. That might work, but the PPA seems maintained by an apparently random developer, who isn't affiliated with Google. If the builds get compromised, the security implications are serious. Also, I prefer the stability of Chromium, and the beta/dev builds tend to be less stable.- I've copied /usr/lib/chromium-browser to /usr/lib/chromium-browser-2 and created a local shortcut
~/.local/share/applications/chromium-browser-2.desktop
pointing to it, with a separate icon. That showed a separate icon in the Dash, but when launching it, it opened my existing Chromium profile, and the window still got lumped with the existing Chromium windows. Looks like the executable must be actually different in some way?
chromium gnome-shell
add a comment |
I want to have two completely different instances of Chromium, each with its own icon, so that:
- There are two taskbar buttons, and...
- ...two entries in the window switcher (Ubuntu 18, GNOME)
- They are easily distinguishable by icon/color
- I can Alt+Tab between these two instances, and Alt+` (key above Tab) among windows within an instance
How can I do that?
Solutions I've considered:
Different profiles - doesn't satisfy the requirements because all Chromium windows, from all profiles, get lumped under the same taskbar button and window switcher entry.- Install Chrome Beta and Chrome Dev. These aren't exactly Chromium, and I prefer the open source Chrome.
Install Chromium beta/dev. That might work, but the PPA seems maintained by an apparently random developer, who isn't affiliated with Google. If the builds get compromised, the security implications are serious. Also, I prefer the stability of Chromium, and the beta/dev builds tend to be less stable.- I've copied /usr/lib/chromium-browser to /usr/lib/chromium-browser-2 and created a local shortcut
~/.local/share/applications/chromium-browser-2.desktop
pointing to it, with a separate icon. That showed a separate icon in the Dash, but when launching it, it opened my existing Chromium profile, and the window still got lumped with the existing Chromium windows. Looks like the executable must be actually different in some way?
chromium gnome-shell
1
Try this: askubuntu.com/questions/1000818/… Also please mention your desktop environment, it may depend on that.
– pomsky
Jan 24 at 17:30
add a comment |
I want to have two completely different instances of Chromium, each with its own icon, so that:
- There are two taskbar buttons, and...
- ...two entries in the window switcher (Ubuntu 18, GNOME)
- They are easily distinguishable by icon/color
- I can Alt+Tab between these two instances, and Alt+` (key above Tab) among windows within an instance
How can I do that?
Solutions I've considered:
Different profiles - doesn't satisfy the requirements because all Chromium windows, from all profiles, get lumped under the same taskbar button and window switcher entry.- Install Chrome Beta and Chrome Dev. These aren't exactly Chromium, and I prefer the open source Chrome.
Install Chromium beta/dev. That might work, but the PPA seems maintained by an apparently random developer, who isn't affiliated with Google. If the builds get compromised, the security implications are serious. Also, I prefer the stability of Chromium, and the beta/dev builds tend to be less stable.- I've copied /usr/lib/chromium-browser to /usr/lib/chromium-browser-2 and created a local shortcut
~/.local/share/applications/chromium-browser-2.desktop
pointing to it, with a separate icon. That showed a separate icon in the Dash, but when launching it, it opened my existing Chromium profile, and the window still got lumped with the existing Chromium windows. Looks like the executable must be actually different in some way?
chromium gnome-shell
I want to have two completely different instances of Chromium, each with its own icon, so that:
- There are two taskbar buttons, and...
- ...two entries in the window switcher (Ubuntu 18, GNOME)
- They are easily distinguishable by icon/color
- I can Alt+Tab between these two instances, and Alt+` (key above Tab) among windows within an instance
How can I do that?
Solutions I've considered:
Different profiles - doesn't satisfy the requirements because all Chromium windows, from all profiles, get lumped under the same taskbar button and window switcher entry.- Install Chrome Beta and Chrome Dev. These aren't exactly Chromium, and I prefer the open source Chrome.
Install Chromium beta/dev. That might work, but the PPA seems maintained by an apparently random developer, who isn't affiliated with Google. If the builds get compromised, the security implications are serious. Also, I prefer the stability of Chromium, and the beta/dev builds tend to be less stable.- I've copied /usr/lib/chromium-browser to /usr/lib/chromium-browser-2 and created a local shortcut
~/.local/share/applications/chromium-browser-2.desktop
pointing to it, with a separate icon. That showed a separate icon in the Dash, but when launching it, it opened my existing Chromium profile, and the window still got lumped with the existing Chromium windows. Looks like the executable must be actually different in some way?
chromium gnome-shell
chromium gnome-shell
edited Jan 29 at 18:50
Dan Dascalescu
asked Jan 24 at 17:26
Dan DascalescuDan Dascalescu
1,14921637
1,14921637
1
Try this: askubuntu.com/questions/1000818/… Also please mention your desktop environment, it may depend on that.
– pomsky
Jan 24 at 17:30
add a comment |
1
Try this: askubuntu.com/questions/1000818/… Also please mention your desktop environment, it may depend on that.
– pomsky
Jan 24 at 17:30
1
1
Try this: askubuntu.com/questions/1000818/… Also please mention your desktop environment, it may depend on that.
– pomsky
Jan 24 at 17:30
Try this: askubuntu.com/questions/1000818/… Also please mention your desktop environment, it may depend on that.
– pomsky
Jan 24 at 17:30
add a comment |
3 Answers
3
active
oldest
votes
What worked (cobbled together from the various answers and comments - thanks!) was to create a .desktop
file in ~/.local/share/applications
with a few tweaks:
[Desktop Entry]
Version=1.0
Name=Chromium Browser 2
GenericName=Web Browser 2
Comment=Chromium Alternate
Exec=/usr/lib/chromium-browser/chromium-browser --user-data-dir=/home/dandv/Chr2 --class="Chr2"
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/home/dandv/chromium-browser-2.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Actions=NewWindow;Incognito;TempProfile;
X-AppInstall-Package=chromium-browser
StartupWMClass=Chr2
Make sure to replace /home/dandv/
with your home directory. Using ~
did not work.
The tweaks I applied to the .desktop
file were:
- Add
--class="SomethingLikeChr2" to the
Exec=` line - Add
StartupWMClass=SomethingLikeChr2
to the `[Desktop Entry] (use the same unique value as above; apparently this is what makes a separate window, that won't get lumped in with existing Chromium windows - Add
--user-data-dir=...
to theExec
line, due to this Chromium bug.
Result
add a comment |
The easiest way I know of is using the More Tools -> Create Shortcut. From there it will create a .desktop entry that you can customize the icon and you can go to chrome://apps
to modify settings like opening as a window.
1
Creating multiple.desktop
launchers with different icons most probably won't solve OP's problem, at least in case of GNOME shell. There will be multiple launchers with separate icons in the applications list and 'Activities' overview. But once you launch multiple windows from different profiles, all of the open windows will be grouped together under one icon as OP mentioned.
– pomsky
Jan 24 at 17:38
Well, I know it works in KDE and they are effectively treated as completely different applications with different entries into the taskbar / latte dock and when using ALT+Tab. I use it for Spotify and a few other web apps.
– Kristopher Ives
Jan 24 at 17:41
+1, that's really useful in KDE. I used to create .desktop files with different window manager classes manually before. Unfortunately, the windows are still grouped in the task switcher.
– danzel
Jan 24 at 17:58
add a comment |
The WMClass seems to have no authority when it comes to Chromium... I came up with this abomination (personal opinion... I'd just like for it to work with sh :) ) It has a few tricks, but is pretty robust for two windows.. The script sets individual classes for the opened chromium windows (not profiles, even though that is what I am after) You could specify further windows too, but they have to be manually added by adding more "specificprofile1"
along with the corresponding function.. Maybe someone could make it have more.. logic!
#!/bin/bash
# chromium-start.sh $1
# e.g. put:
# chrome-start.sh "Profile 1" to .desktop Exec=
# wmctrl -o 1366,0 ; chromium-browser %U --profile-directory=Profile 2 & sleep 3; wmctrl -o 0,0
# $1 = Profile folder name
profilename=$1
#2nd Chromium profile
specificprofile1="Profile 1"
echo "starting Chromium"
echo "args: " $1
echo "Profile name: " $profilename
echo "Specific profile: " $specificprofile1
# Just setting Chromium scaling variable, because of course Google Devs don't care about no fractional scaling on linux
scale_var=0.8
# Check if Chromium window with the specified class already exists
# Also allows using icons as "taskbar" switches (clicking icon takes to corresponding Chromium Window)
if wmctrl -l -x | grep "chromium-$profilename"
then
echo "Chromium Window exists, moving focus to it"
wmctrl -x -R chromium-"$profilename"
echo "true"
# Check if 2nd profile $specifiedprofile1 has been started yet or not. The WMCLASS(es) has to have been set correctly...
elif [[ "$specificprofile1" == "$profilename" ]] && [[ ! "`wmctrl -l -x | grep chromium-"$specificprofile1"`" ]]
then
# TODO: Nesting
if [ "$specificprofile1" == "$profilename" ]
then
echo $specificprofile1 "equals" $profilename
fi
echo "#2 Chromium Window for $specificprofile1 does not exist"
# wmctrl moves to specific position of desktop (1366 means moving to the following workspace since my resolution is 1366x768)
# Be careful if using sleep timing, since the command needs to have enough time to execute to have the window in the correct workspace
wmctrl -o 1366,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# Set's the chromium window which was opened latest to have a custom class, since Chromium doesn't care about the --class= flag...
# It has it's limitations, but should be robust enough for most use... Has not been tested long term.. Something probably could reset the WM_CLASS again
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
# Alternative method for checking if a window with specified class exists
# xprop -id "$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')" | grep -o "WM_CLASS(STRING) = ".*"" | grep -o '".*"' | tr -d '"'
# https://stackoverflow.com/a/19441380/5776626
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
done
# sleep 3
# Move Window directly to workspace (#2 with 1366x768 resolution x = 1366), optionally comment out wmctrl -o 1366,0
# wmctrl -v -i -r $winid -e 0,1366,0,-1,-1
# sleep 5
# Move back to workspace #1
wmctrl -o 0,0
elif ! wmctrl -l -x | grep chromium-"$profilename"
then
echo "#3 Chromium Window $profilename does not exist"
wmctrl -o 0,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# ....
# sleep 3
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
done
wmctrl -o 0,0
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
fi
Issues:
Printing gives errors (deprecation warnings..):
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/print line 528.
For debugging you can use the following to print out the errors when using actual icons:
https://askubuntu.com/a/664272/654028 (# The Manual alternative)
awk '/^Exec=/ {sub("^Exec=", ""); gsub(" ?%[cDdFfikmNnUuv]", ""); exit system($0)}' chrome-ws2.desktop
while loop bugs out, probably because of looping interval
Error: no such file "at while function"
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
Also when clicking a corresponding .desktop icon too fast (before the custom class has been set ?), a new window will be opened..
(quite) Sometimes when starting from both Chromium too fast (~<3s), the class of the previously opened window gets reset to chromium-browser.chromium-browser..
Then you can expect the icons to have swapped around or other unexpected behavior.
WMClass worked fine for me (see my answer above). I'm still using the method described there.
– Dan Dascalescu
2 days ago
What is yourwmctrl -l -x
output? I have been able to change the class of the Window launched first with the WMClass method, but not the one after it.. The 2nd Chromium window will have the same class as the first. Only solution I've found is to manually modify the class after the window was opened...
– rkantos
yesterday
For the two instances of Chromium, it's0x03000006 0 chromium-browser.Chromium-browser $HOSTNAME gnome shell - How can I start a separate instance (not profile) of Chromium, with its own icon? - Ask Ubuntu - Chromiumn 0x04200001 0 chromium-browser (/home/dandv/Chr2).Chr2 $HOSTNAME Inbox ... Gmail - Chromium
.
– Dan Dascalescu
19 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1112571%2fhow-can-i-start-a-separate-instance-not-profile-of-chromium-with-its-own-icon%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
What worked (cobbled together from the various answers and comments - thanks!) was to create a .desktop
file in ~/.local/share/applications
with a few tweaks:
[Desktop Entry]
Version=1.0
Name=Chromium Browser 2
GenericName=Web Browser 2
Comment=Chromium Alternate
Exec=/usr/lib/chromium-browser/chromium-browser --user-data-dir=/home/dandv/Chr2 --class="Chr2"
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/home/dandv/chromium-browser-2.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Actions=NewWindow;Incognito;TempProfile;
X-AppInstall-Package=chromium-browser
StartupWMClass=Chr2
Make sure to replace /home/dandv/
with your home directory. Using ~
did not work.
The tweaks I applied to the .desktop
file were:
- Add
--class="SomethingLikeChr2" to the
Exec=` line - Add
StartupWMClass=SomethingLikeChr2
to the `[Desktop Entry] (use the same unique value as above; apparently this is what makes a separate window, that won't get lumped in with existing Chromium windows - Add
--user-data-dir=...
to theExec
line, due to this Chromium bug.
Result
add a comment |
What worked (cobbled together from the various answers and comments - thanks!) was to create a .desktop
file in ~/.local/share/applications
with a few tweaks:
[Desktop Entry]
Version=1.0
Name=Chromium Browser 2
GenericName=Web Browser 2
Comment=Chromium Alternate
Exec=/usr/lib/chromium-browser/chromium-browser --user-data-dir=/home/dandv/Chr2 --class="Chr2"
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/home/dandv/chromium-browser-2.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Actions=NewWindow;Incognito;TempProfile;
X-AppInstall-Package=chromium-browser
StartupWMClass=Chr2
Make sure to replace /home/dandv/
with your home directory. Using ~
did not work.
The tweaks I applied to the .desktop
file were:
- Add
--class="SomethingLikeChr2" to the
Exec=` line - Add
StartupWMClass=SomethingLikeChr2
to the `[Desktop Entry] (use the same unique value as above; apparently this is what makes a separate window, that won't get lumped in with existing Chromium windows - Add
--user-data-dir=...
to theExec
line, due to this Chromium bug.
Result
add a comment |
What worked (cobbled together from the various answers and comments - thanks!) was to create a .desktop
file in ~/.local/share/applications
with a few tweaks:
[Desktop Entry]
Version=1.0
Name=Chromium Browser 2
GenericName=Web Browser 2
Comment=Chromium Alternate
Exec=/usr/lib/chromium-browser/chromium-browser --user-data-dir=/home/dandv/Chr2 --class="Chr2"
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/home/dandv/chromium-browser-2.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Actions=NewWindow;Incognito;TempProfile;
X-AppInstall-Package=chromium-browser
StartupWMClass=Chr2
Make sure to replace /home/dandv/
with your home directory. Using ~
did not work.
The tweaks I applied to the .desktop
file were:
- Add
--class="SomethingLikeChr2" to the
Exec=` line - Add
StartupWMClass=SomethingLikeChr2
to the `[Desktop Entry] (use the same unique value as above; apparently this is what makes a separate window, that won't get lumped in with existing Chromium windows - Add
--user-data-dir=...
to theExec
line, due to this Chromium bug.
Result
What worked (cobbled together from the various answers and comments - thanks!) was to create a .desktop
file in ~/.local/share/applications
with a few tweaks:
[Desktop Entry]
Version=1.0
Name=Chromium Browser 2
GenericName=Web Browser 2
Comment=Chromium Alternate
Exec=/usr/lib/chromium-browser/chromium-browser --user-data-dir=/home/dandv/Chr2 --class="Chr2"
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/home/dandv/chromium-browser-2.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Actions=NewWindow;Incognito;TempProfile;
X-AppInstall-Package=chromium-browser
StartupWMClass=Chr2
Make sure to replace /home/dandv/
with your home directory. Using ~
did not work.
The tweaks I applied to the .desktop
file were:
- Add
--class="SomethingLikeChr2" to the
Exec=` line - Add
StartupWMClass=SomethingLikeChr2
to the `[Desktop Entry] (use the same unique value as above; apparently this is what makes a separate window, that won't get lumped in with existing Chromium windows - Add
--user-data-dir=...
to theExec
line, due to this Chromium bug.
Result
answered Jan 29 at 19:24
Dan DascalescuDan Dascalescu
1,14921637
1,14921637
add a comment |
add a comment |
The easiest way I know of is using the More Tools -> Create Shortcut. From there it will create a .desktop entry that you can customize the icon and you can go to chrome://apps
to modify settings like opening as a window.
1
Creating multiple.desktop
launchers with different icons most probably won't solve OP's problem, at least in case of GNOME shell. There will be multiple launchers with separate icons in the applications list and 'Activities' overview. But once you launch multiple windows from different profiles, all of the open windows will be grouped together under one icon as OP mentioned.
– pomsky
Jan 24 at 17:38
Well, I know it works in KDE and they are effectively treated as completely different applications with different entries into the taskbar / latte dock and when using ALT+Tab. I use it for Spotify and a few other web apps.
– Kristopher Ives
Jan 24 at 17:41
+1, that's really useful in KDE. I used to create .desktop files with different window manager classes manually before. Unfortunately, the windows are still grouped in the task switcher.
– danzel
Jan 24 at 17:58
add a comment |
The easiest way I know of is using the More Tools -> Create Shortcut. From there it will create a .desktop entry that you can customize the icon and you can go to chrome://apps
to modify settings like opening as a window.
1
Creating multiple.desktop
launchers with different icons most probably won't solve OP's problem, at least in case of GNOME shell. There will be multiple launchers with separate icons in the applications list and 'Activities' overview. But once you launch multiple windows from different profiles, all of the open windows will be grouped together under one icon as OP mentioned.
– pomsky
Jan 24 at 17:38
Well, I know it works in KDE and they are effectively treated as completely different applications with different entries into the taskbar / latte dock and when using ALT+Tab. I use it for Spotify and a few other web apps.
– Kristopher Ives
Jan 24 at 17:41
+1, that's really useful in KDE. I used to create .desktop files with different window manager classes manually before. Unfortunately, the windows are still grouped in the task switcher.
– danzel
Jan 24 at 17:58
add a comment |
The easiest way I know of is using the More Tools -> Create Shortcut. From there it will create a .desktop entry that you can customize the icon and you can go to chrome://apps
to modify settings like opening as a window.
The easiest way I know of is using the More Tools -> Create Shortcut. From there it will create a .desktop entry that you can customize the icon and you can go to chrome://apps
to modify settings like opening as a window.
answered Jan 24 at 17:32
Kristopher IvesKristopher Ives
2,90211525
2,90211525
1
Creating multiple.desktop
launchers with different icons most probably won't solve OP's problem, at least in case of GNOME shell. There will be multiple launchers with separate icons in the applications list and 'Activities' overview. But once you launch multiple windows from different profiles, all of the open windows will be grouped together under one icon as OP mentioned.
– pomsky
Jan 24 at 17:38
Well, I know it works in KDE and they are effectively treated as completely different applications with different entries into the taskbar / latte dock and when using ALT+Tab. I use it for Spotify and a few other web apps.
– Kristopher Ives
Jan 24 at 17:41
+1, that's really useful in KDE. I used to create .desktop files with different window manager classes manually before. Unfortunately, the windows are still grouped in the task switcher.
– danzel
Jan 24 at 17:58
add a comment |
1
Creating multiple.desktop
launchers with different icons most probably won't solve OP's problem, at least in case of GNOME shell. There will be multiple launchers with separate icons in the applications list and 'Activities' overview. But once you launch multiple windows from different profiles, all of the open windows will be grouped together under one icon as OP mentioned.
– pomsky
Jan 24 at 17:38
Well, I know it works in KDE and they are effectively treated as completely different applications with different entries into the taskbar / latte dock and when using ALT+Tab. I use it for Spotify and a few other web apps.
– Kristopher Ives
Jan 24 at 17:41
+1, that's really useful in KDE. I used to create .desktop files with different window manager classes manually before. Unfortunately, the windows are still grouped in the task switcher.
– danzel
Jan 24 at 17:58
1
1
Creating multiple
.desktop
launchers with different icons most probably won't solve OP's problem, at least in case of GNOME shell. There will be multiple launchers with separate icons in the applications list and 'Activities' overview. But once you launch multiple windows from different profiles, all of the open windows will be grouped together under one icon as OP mentioned.– pomsky
Jan 24 at 17:38
Creating multiple
.desktop
launchers with different icons most probably won't solve OP's problem, at least in case of GNOME shell. There will be multiple launchers with separate icons in the applications list and 'Activities' overview. But once you launch multiple windows from different profiles, all of the open windows will be grouped together under one icon as OP mentioned.– pomsky
Jan 24 at 17:38
Well, I know it works in KDE and they are effectively treated as completely different applications with different entries into the taskbar / latte dock and when using ALT+Tab. I use it for Spotify and a few other web apps.
– Kristopher Ives
Jan 24 at 17:41
Well, I know it works in KDE and they are effectively treated as completely different applications with different entries into the taskbar / latte dock and when using ALT+Tab. I use it for Spotify and a few other web apps.
– Kristopher Ives
Jan 24 at 17:41
+1, that's really useful in KDE. I used to create .desktop files with different window manager classes manually before. Unfortunately, the windows are still grouped in the task switcher.
– danzel
Jan 24 at 17:58
+1, that's really useful in KDE. I used to create .desktop files with different window manager classes manually before. Unfortunately, the windows are still grouped in the task switcher.
– danzel
Jan 24 at 17:58
add a comment |
The WMClass seems to have no authority when it comes to Chromium... I came up with this abomination (personal opinion... I'd just like for it to work with sh :) ) It has a few tricks, but is pretty robust for two windows.. The script sets individual classes for the opened chromium windows (not profiles, even though that is what I am after) You could specify further windows too, but they have to be manually added by adding more "specificprofile1"
along with the corresponding function.. Maybe someone could make it have more.. logic!
#!/bin/bash
# chromium-start.sh $1
# e.g. put:
# chrome-start.sh "Profile 1" to .desktop Exec=
# wmctrl -o 1366,0 ; chromium-browser %U --profile-directory=Profile 2 & sleep 3; wmctrl -o 0,0
# $1 = Profile folder name
profilename=$1
#2nd Chromium profile
specificprofile1="Profile 1"
echo "starting Chromium"
echo "args: " $1
echo "Profile name: " $profilename
echo "Specific profile: " $specificprofile1
# Just setting Chromium scaling variable, because of course Google Devs don't care about no fractional scaling on linux
scale_var=0.8
# Check if Chromium window with the specified class already exists
# Also allows using icons as "taskbar" switches (clicking icon takes to corresponding Chromium Window)
if wmctrl -l -x | grep "chromium-$profilename"
then
echo "Chromium Window exists, moving focus to it"
wmctrl -x -R chromium-"$profilename"
echo "true"
# Check if 2nd profile $specifiedprofile1 has been started yet or not. The WMCLASS(es) has to have been set correctly...
elif [[ "$specificprofile1" == "$profilename" ]] && [[ ! "`wmctrl -l -x | grep chromium-"$specificprofile1"`" ]]
then
# TODO: Nesting
if [ "$specificprofile1" == "$profilename" ]
then
echo $specificprofile1 "equals" $profilename
fi
echo "#2 Chromium Window for $specificprofile1 does not exist"
# wmctrl moves to specific position of desktop (1366 means moving to the following workspace since my resolution is 1366x768)
# Be careful if using sleep timing, since the command needs to have enough time to execute to have the window in the correct workspace
wmctrl -o 1366,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# Set's the chromium window which was opened latest to have a custom class, since Chromium doesn't care about the --class= flag...
# It has it's limitations, but should be robust enough for most use... Has not been tested long term.. Something probably could reset the WM_CLASS again
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
# Alternative method for checking if a window with specified class exists
# xprop -id "$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')" | grep -o "WM_CLASS(STRING) = ".*"" | grep -o '".*"' | tr -d '"'
# https://stackoverflow.com/a/19441380/5776626
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
done
# sleep 3
# Move Window directly to workspace (#2 with 1366x768 resolution x = 1366), optionally comment out wmctrl -o 1366,0
# wmctrl -v -i -r $winid -e 0,1366,0,-1,-1
# sleep 5
# Move back to workspace #1
wmctrl -o 0,0
elif ! wmctrl -l -x | grep chromium-"$profilename"
then
echo "#3 Chromium Window $profilename does not exist"
wmctrl -o 0,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# ....
# sleep 3
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
done
wmctrl -o 0,0
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
fi
Issues:
Printing gives errors (deprecation warnings..):
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/print line 528.
For debugging you can use the following to print out the errors when using actual icons:
https://askubuntu.com/a/664272/654028 (# The Manual alternative)
awk '/^Exec=/ {sub("^Exec=", ""); gsub(" ?%[cDdFfikmNnUuv]", ""); exit system($0)}' chrome-ws2.desktop
while loop bugs out, probably because of looping interval
Error: no such file "at while function"
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
Also when clicking a corresponding .desktop icon too fast (before the custom class has been set ?), a new window will be opened..
(quite) Sometimes when starting from both Chromium too fast (~<3s), the class of the previously opened window gets reset to chromium-browser.chromium-browser..
Then you can expect the icons to have swapped around or other unexpected behavior.
WMClass worked fine for me (see my answer above). I'm still using the method described there.
– Dan Dascalescu
2 days ago
What is yourwmctrl -l -x
output? I have been able to change the class of the Window launched first with the WMClass method, but not the one after it.. The 2nd Chromium window will have the same class as the first. Only solution I've found is to manually modify the class after the window was opened...
– rkantos
yesterday
For the two instances of Chromium, it's0x03000006 0 chromium-browser.Chromium-browser $HOSTNAME gnome shell - How can I start a separate instance (not profile) of Chromium, with its own icon? - Ask Ubuntu - Chromiumn 0x04200001 0 chromium-browser (/home/dandv/Chr2).Chr2 $HOSTNAME Inbox ... Gmail - Chromium
.
– Dan Dascalescu
19 hours ago
add a comment |
The WMClass seems to have no authority when it comes to Chromium... I came up with this abomination (personal opinion... I'd just like for it to work with sh :) ) It has a few tricks, but is pretty robust for two windows.. The script sets individual classes for the opened chromium windows (not profiles, even though that is what I am after) You could specify further windows too, but they have to be manually added by adding more "specificprofile1"
along with the corresponding function.. Maybe someone could make it have more.. logic!
#!/bin/bash
# chromium-start.sh $1
# e.g. put:
# chrome-start.sh "Profile 1" to .desktop Exec=
# wmctrl -o 1366,0 ; chromium-browser %U --profile-directory=Profile 2 & sleep 3; wmctrl -o 0,0
# $1 = Profile folder name
profilename=$1
#2nd Chromium profile
specificprofile1="Profile 1"
echo "starting Chromium"
echo "args: " $1
echo "Profile name: " $profilename
echo "Specific profile: " $specificprofile1
# Just setting Chromium scaling variable, because of course Google Devs don't care about no fractional scaling on linux
scale_var=0.8
# Check if Chromium window with the specified class already exists
# Also allows using icons as "taskbar" switches (clicking icon takes to corresponding Chromium Window)
if wmctrl -l -x | grep "chromium-$profilename"
then
echo "Chromium Window exists, moving focus to it"
wmctrl -x -R chromium-"$profilename"
echo "true"
# Check if 2nd profile $specifiedprofile1 has been started yet or not. The WMCLASS(es) has to have been set correctly...
elif [[ "$specificprofile1" == "$profilename" ]] && [[ ! "`wmctrl -l -x | grep chromium-"$specificprofile1"`" ]]
then
# TODO: Nesting
if [ "$specificprofile1" == "$profilename" ]
then
echo $specificprofile1 "equals" $profilename
fi
echo "#2 Chromium Window for $specificprofile1 does not exist"
# wmctrl moves to specific position of desktop (1366 means moving to the following workspace since my resolution is 1366x768)
# Be careful if using sleep timing, since the command needs to have enough time to execute to have the window in the correct workspace
wmctrl -o 1366,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# Set's the chromium window which was opened latest to have a custom class, since Chromium doesn't care about the --class= flag...
# It has it's limitations, but should be robust enough for most use... Has not been tested long term.. Something probably could reset the WM_CLASS again
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
# Alternative method for checking if a window with specified class exists
# xprop -id "$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')" | grep -o "WM_CLASS(STRING) = ".*"" | grep -o '".*"' | tr -d '"'
# https://stackoverflow.com/a/19441380/5776626
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
done
# sleep 3
# Move Window directly to workspace (#2 with 1366x768 resolution x = 1366), optionally comment out wmctrl -o 1366,0
# wmctrl -v -i -r $winid -e 0,1366,0,-1,-1
# sleep 5
# Move back to workspace #1
wmctrl -o 0,0
elif ! wmctrl -l -x | grep chromium-"$profilename"
then
echo "#3 Chromium Window $profilename does not exist"
wmctrl -o 0,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# ....
# sleep 3
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
done
wmctrl -o 0,0
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
fi
Issues:
Printing gives errors (deprecation warnings..):
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/print line 528.
For debugging you can use the following to print out the errors when using actual icons:
https://askubuntu.com/a/664272/654028 (# The Manual alternative)
awk '/^Exec=/ {sub("^Exec=", ""); gsub(" ?%[cDdFfikmNnUuv]", ""); exit system($0)}' chrome-ws2.desktop
while loop bugs out, probably because of looping interval
Error: no such file "at while function"
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
Also when clicking a corresponding .desktop icon too fast (before the custom class has been set ?), a new window will be opened..
(quite) Sometimes when starting from both Chromium too fast (~<3s), the class of the previously opened window gets reset to chromium-browser.chromium-browser..
Then you can expect the icons to have swapped around or other unexpected behavior.
WMClass worked fine for me (see my answer above). I'm still using the method described there.
– Dan Dascalescu
2 days ago
What is yourwmctrl -l -x
output? I have been able to change the class of the Window launched first with the WMClass method, but not the one after it.. The 2nd Chromium window will have the same class as the first. Only solution I've found is to manually modify the class after the window was opened...
– rkantos
yesterday
For the two instances of Chromium, it's0x03000006 0 chromium-browser.Chromium-browser $HOSTNAME gnome shell - How can I start a separate instance (not profile) of Chromium, with its own icon? - Ask Ubuntu - Chromiumn 0x04200001 0 chromium-browser (/home/dandv/Chr2).Chr2 $HOSTNAME Inbox ... Gmail - Chromium
.
– Dan Dascalescu
19 hours ago
add a comment |
The WMClass seems to have no authority when it comes to Chromium... I came up with this abomination (personal opinion... I'd just like for it to work with sh :) ) It has a few tricks, but is pretty robust for two windows.. The script sets individual classes for the opened chromium windows (not profiles, even though that is what I am after) You could specify further windows too, but they have to be manually added by adding more "specificprofile1"
along with the corresponding function.. Maybe someone could make it have more.. logic!
#!/bin/bash
# chromium-start.sh $1
# e.g. put:
# chrome-start.sh "Profile 1" to .desktop Exec=
# wmctrl -o 1366,0 ; chromium-browser %U --profile-directory=Profile 2 & sleep 3; wmctrl -o 0,0
# $1 = Profile folder name
profilename=$1
#2nd Chromium profile
specificprofile1="Profile 1"
echo "starting Chromium"
echo "args: " $1
echo "Profile name: " $profilename
echo "Specific profile: " $specificprofile1
# Just setting Chromium scaling variable, because of course Google Devs don't care about no fractional scaling on linux
scale_var=0.8
# Check if Chromium window with the specified class already exists
# Also allows using icons as "taskbar" switches (clicking icon takes to corresponding Chromium Window)
if wmctrl -l -x | grep "chromium-$profilename"
then
echo "Chromium Window exists, moving focus to it"
wmctrl -x -R chromium-"$profilename"
echo "true"
# Check if 2nd profile $specifiedprofile1 has been started yet or not. The WMCLASS(es) has to have been set correctly...
elif [[ "$specificprofile1" == "$profilename" ]] && [[ ! "`wmctrl -l -x | grep chromium-"$specificprofile1"`" ]]
then
# TODO: Nesting
if [ "$specificprofile1" == "$profilename" ]
then
echo $specificprofile1 "equals" $profilename
fi
echo "#2 Chromium Window for $specificprofile1 does not exist"
# wmctrl moves to specific position of desktop (1366 means moving to the following workspace since my resolution is 1366x768)
# Be careful if using sleep timing, since the command needs to have enough time to execute to have the window in the correct workspace
wmctrl -o 1366,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# Set's the chromium window which was opened latest to have a custom class, since Chromium doesn't care about the --class= flag...
# It has it's limitations, but should be robust enough for most use... Has not been tested long term.. Something probably could reset the WM_CLASS again
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
# Alternative method for checking if a window with specified class exists
# xprop -id "$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')" | grep -o "WM_CLASS(STRING) = ".*"" | grep -o '".*"' | tr -d '"'
# https://stackoverflow.com/a/19441380/5776626
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
done
# sleep 3
# Move Window directly to workspace (#2 with 1366x768 resolution x = 1366), optionally comment out wmctrl -o 1366,0
# wmctrl -v -i -r $winid -e 0,1366,0,-1,-1
# sleep 5
# Move back to workspace #1
wmctrl -o 0,0
elif ! wmctrl -l -x | grep chromium-"$profilename"
then
echo "#3 Chromium Window $profilename does not exist"
wmctrl -o 0,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# ....
# sleep 3
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
done
wmctrl -o 0,0
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
fi
Issues:
Printing gives errors (deprecation warnings..):
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/print line 528.
For debugging you can use the following to print out the errors when using actual icons:
https://askubuntu.com/a/664272/654028 (# The Manual alternative)
awk '/^Exec=/ {sub("^Exec=", ""); gsub(" ?%[cDdFfikmNnUuv]", ""); exit system($0)}' chrome-ws2.desktop
while loop bugs out, probably because of looping interval
Error: no such file "at while function"
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
Also when clicking a corresponding .desktop icon too fast (before the custom class has been set ?), a new window will be opened..
(quite) Sometimes when starting from both Chromium too fast (~<3s), the class of the previously opened window gets reset to chromium-browser.chromium-browser..
Then you can expect the icons to have swapped around or other unexpected behavior.
The WMClass seems to have no authority when it comes to Chromium... I came up with this abomination (personal opinion... I'd just like for it to work with sh :) ) It has a few tricks, but is pretty robust for two windows.. The script sets individual classes for the opened chromium windows (not profiles, even though that is what I am after) You could specify further windows too, but they have to be manually added by adding more "specificprofile1"
along with the corresponding function.. Maybe someone could make it have more.. logic!
#!/bin/bash
# chromium-start.sh $1
# e.g. put:
# chrome-start.sh "Profile 1" to .desktop Exec=
# wmctrl -o 1366,0 ; chromium-browser %U --profile-directory=Profile 2 & sleep 3; wmctrl -o 0,0
# $1 = Profile folder name
profilename=$1
#2nd Chromium profile
specificprofile1="Profile 1"
echo "starting Chromium"
echo "args: " $1
echo "Profile name: " $profilename
echo "Specific profile: " $specificprofile1
# Just setting Chromium scaling variable, because of course Google Devs don't care about no fractional scaling on linux
scale_var=0.8
# Check if Chromium window with the specified class already exists
# Also allows using icons as "taskbar" switches (clicking icon takes to corresponding Chromium Window)
if wmctrl -l -x | grep "chromium-$profilename"
then
echo "Chromium Window exists, moving focus to it"
wmctrl -x -R chromium-"$profilename"
echo "true"
# Check if 2nd profile $specifiedprofile1 has been started yet or not. The WMCLASS(es) has to have been set correctly...
elif [[ "$specificprofile1" == "$profilename" ]] && [[ ! "`wmctrl -l -x | grep chromium-"$specificprofile1"`" ]]
then
# TODO: Nesting
if [ "$specificprofile1" == "$profilename" ]
then
echo $specificprofile1 "equals" $profilename
fi
echo "#2 Chromium Window for $specificprofile1 does not exist"
# wmctrl moves to specific position of desktop (1366 means moving to the following workspace since my resolution is 1366x768)
# Be careful if using sleep timing, since the command needs to have enough time to execute to have the window in the correct workspace
wmctrl -o 1366,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# Set's the chromium window which was opened latest to have a custom class, since Chromium doesn't care about the --class= flag...
# It has it's limitations, but should be robust enough for most use... Has not been tested long term.. Something probably could reset the WM_CLASS again
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
# Alternative method for checking if a window with specified class exists
# xprop -id "$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')" | grep -o "WM_CLASS(STRING) = ".*"" | grep -o '".*"' | tr -d '"'
# https://stackoverflow.com/a/19441380/5776626
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$specificprofile1"
done
# sleep 3
# Move Window directly to workspace (#2 with 1366x768 resolution x = 1366), optionally comment out wmctrl -o 1366,0
# wmctrl -v -i -r $winid -e 0,1366,0,-1,-1
# sleep 5
# Move back to workspace #1
wmctrl -o 0,0
elif ! wmctrl -l -x | grep chromium-"$profilename"
then
echo "#3 Chromium Window $profilename does not exist"
wmctrl -o 0,0
chromium-browser --profile-directory="$profilename" --force-device-scale-factor=$scale_var %U &
# https://askubuntu.com/a/626524/654028
# ....
# sleep 3
winrep=""
while [[ ! "`echo $winrep | grep -l "Map State: IsViewable"`" ]]
do
winid="$(wmctrl -l -x| grep "chromium-$profilename" | tail -n 1 |awk '{ print $1 }')"
# print $winid
winrep="$(xwininfo -id $winid | grep -o 'Map State: IsViewable')"
# print $winrep
sleep 0.75
xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
done
wmctrl -o 0,0
# xprop -id "$(wmctrl -l -x| grep "chromium-browser" | tail -n 1 |awk '{ print $1 }')" -f WM_CLASS 8s -set WM_CLASS "chromium-browser.chromium-$profilename"
fi
Issues:
Printing gives errors (deprecation warnings..):
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/print line 528.
For debugging you can use the following to print out the errors when using actual icons:
https://askubuntu.com/a/664272/654028 (# The Manual alternative)
awk '/^Exec=/ {sub("^Exec=", ""); gsub(" ?%[cDdFfikmNnUuv]", ""); exit system($0)}' chrome-ws2.desktop
while loop bugs out, probably because of looping interval
Error: no such file "at while function"
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
xwininfo: error: -id requires argument
xprop: error: Invalid window id format: .
Also when clicking a corresponding .desktop icon too fast (before the custom class has been set ?), a new window will be opened..
(quite) Sometimes when starting from both Chromium too fast (~<3s), the class of the previously opened window gets reset to chromium-browser.chromium-browser..
Then you can expect the icons to have swapped around or other unexpected behavior.
answered 2 days ago
rkantosrkantos
112
112
WMClass worked fine for me (see my answer above). I'm still using the method described there.
– Dan Dascalescu
2 days ago
What is yourwmctrl -l -x
output? I have been able to change the class of the Window launched first with the WMClass method, but not the one after it.. The 2nd Chromium window will have the same class as the first. Only solution I've found is to manually modify the class after the window was opened...
– rkantos
yesterday
For the two instances of Chromium, it's0x03000006 0 chromium-browser.Chromium-browser $HOSTNAME gnome shell - How can I start a separate instance (not profile) of Chromium, with its own icon? - Ask Ubuntu - Chromiumn 0x04200001 0 chromium-browser (/home/dandv/Chr2).Chr2 $HOSTNAME Inbox ... Gmail - Chromium
.
– Dan Dascalescu
19 hours ago
add a comment |
WMClass worked fine for me (see my answer above). I'm still using the method described there.
– Dan Dascalescu
2 days ago
What is yourwmctrl -l -x
output? I have been able to change the class of the Window launched first with the WMClass method, but not the one after it.. The 2nd Chromium window will have the same class as the first. Only solution I've found is to manually modify the class after the window was opened...
– rkantos
yesterday
For the two instances of Chromium, it's0x03000006 0 chromium-browser.Chromium-browser $HOSTNAME gnome shell - How can I start a separate instance (not profile) of Chromium, with its own icon? - Ask Ubuntu - Chromiumn 0x04200001 0 chromium-browser (/home/dandv/Chr2).Chr2 $HOSTNAME Inbox ... Gmail - Chromium
.
– Dan Dascalescu
19 hours ago
WMClass worked fine for me (see my answer above). I'm still using the method described there.
– Dan Dascalescu
2 days ago
WMClass worked fine for me (see my answer above). I'm still using the method described there.
– Dan Dascalescu
2 days ago
What is your
wmctrl -l -x
output? I have been able to change the class of the Window launched first with the WMClass method, but not the one after it.. The 2nd Chromium window will have the same class as the first. Only solution I've found is to manually modify the class after the window was opened...– rkantos
yesterday
What is your
wmctrl -l -x
output? I have been able to change the class of the Window launched first with the WMClass method, but not the one after it.. The 2nd Chromium window will have the same class as the first. Only solution I've found is to manually modify the class after the window was opened...– rkantos
yesterday
For the two instances of Chromium, it's
0x03000006 0 chromium-browser.Chromium-browser $HOSTNAME gnome shell - How can I start a separate instance (not profile) of Chromium, with its own icon? - Ask Ubuntu - Chromiumn 0x04200001 0 chromium-browser (/home/dandv/Chr2).Chr2 $HOSTNAME Inbox ... Gmail - Chromium
.– Dan Dascalescu
19 hours ago
For the two instances of Chromium, it's
0x03000006 0 chromium-browser.Chromium-browser $HOSTNAME gnome shell - How can I start a separate instance (not profile) of Chromium, with its own icon? - Ask Ubuntu - Chromiumn 0x04200001 0 chromium-browser (/home/dandv/Chr2).Chr2 $HOSTNAME Inbox ... Gmail - Chromium
.– Dan Dascalescu
19 hours ago
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1112571%2fhow-can-i-start-a-separate-instance-not-profile-of-chromium-with-its-own-icon%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Try this: askubuntu.com/questions/1000818/… Also please mention your desktop environment, it may depend on that.
– pomsky
Jan 24 at 17:30