Multiple chromium icons in launcher of 14.04 LTSRunning a .desktop file in the terminalHow do I permanently change window titles?All browsers with one icon in the launcher!Why does custom launcher behavior differ in the Dash and other means of launching?Can I make new tabs open in my default Chrome(ium) profile?Custom VirtualBox Launcher in GNOME 3How to remove the 'tile' background in the launcher icons?Unity launcher: how can I make it show one icon per window?How to change icon for mounted devices in Unity/Nautilus?How can I create profile-specific launchers for Chrome in 16.04?Chromium does not start up on Ubuntu 14.04 LTSHow can I start a separate instance (not profile) of Chromium, with its own icon?

Q: What is a Checkmate Word™?

In a diamond problem in c++ , Why do we need to call grand_parent constructor from child class?

Does academia have a lazy work culture?

How can I stop myself from micromanaging other PCs' actions?

Inadvertently nuked my disk permission structure - why?

How important is a good quality camera for good photography?

What does Kasparov mean by "I was behind in three and even in one after six games"?

How to add 1 milliseconds to a datetime string?

Explanation for a joke about a three-legged dog that walks into a bar

How do professional electronic musicians/sound engineers combat listening fatigue?

A planet illuminated by a black hole?

"I you already know": is this proper English?

Is there a reason why I should not use the HaveIBeenPwned API to warn users about exposed passwords?

Is it correct to translate English noun adjuncts into adjectives?

kids pooling money for Lego League and taxes

Where is this photo of a group of hikers taken? Is it really in the Ural?

Why did Saturn V not head straight to the moon?

Is it normal practice to screen share with a client?

Why no ";" after "do" in sh loops?

Airplanes in static display at Whiteman AFB

Why is my read in of data taking so long?

Why are so many countries still in the Commonwealth?

How did C64 games handle music during gameplay?

How do you perform a ContentSearch using the "MoreLikeThis" handler?



Multiple chromium icons in launcher of 14.04 LTS


Running a .desktop file in the terminalHow do I permanently change window titles?All browsers with one icon in the launcher!Why does custom launcher behavior differ in the Dash and other means of launching?Can I make new tabs open in my default Chrome(ium) profile?Custom VirtualBox Launcher in GNOME 3How to remove the 'tile' background in the launcher icons?Unity launcher: how can I make it show one icon per window?How to change icon for mounted devices in Unity/Nautilus?How can I create profile-specific launchers for Chrome in 16.04?Chromium does not start up on Ubuntu 14.04 LTSHow can I start a separate instance (not profile) of Chromium, with its own icon?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5















EDIT 2014-04-19:

To add a little extra context to my question, these are the original instructions I followed http://ricardofeliciano.me/how-to-create-a-unity-launcher-icon-for-each-chromechromium-profile-in-ubuntu/. I got it to work with Ubuntu 14.04 LTS a few weeks before the official release date. After updating on April 17th I can no longer get it to work:



ORIGINAL POST:

I installed Ubuntu 14.04 LTS a few weeks before the official release and set up multiple google chromium profiles. Using "StartupWMClass", I managed to get each profile to have a separate version of the chromium icon in the unity launcher (same icon, separate appearance in the launcher). After the official release of 14.04 I updated all packages (including chromium) and ever since my additional chromium profiles no longer get their own icon location on the launcher, but group together with the main chromium icon.



here's what I believe to be the essentials of my setup:



  • Under ~/.local/share/applications/ I have my *.desktop files, containing among others the lines
    • Exec=chromium-browser --user-data-dir=/home/<mydir>/.config/chromium/Profiles/<profile-name> --class=<profile-class-name> %U

    • StartupWMClass=<profile-class-name>


  • Under /usr/share/applications/ I have the default chromium-browser.desktop file created upon installing chromium, containing among others the lines
    • Exec=chromium-browser --class=Chromium-browser %U

    • StartupWMClass=Chromium-browser


Adding --class=Chromium-browser to the Exec= line of the default installation .desktop file used to do the trick so that each profile including the default profile would be associated with their own icon on the launcher. After the update I am no longer able to get this to work.



I tried:



  • closing all chromium windows,

  • unlocking from launcher any remaining chromium icons,

  • using the unity search to start the default Chromium Web Browser,

  • locking the appearing icon to the launcher

  • using the unity search to start an additional, custom Chromium profile

  • --> the window of the additional chromium profile is associated with the the icon started for the default chromium profile. They use the same launcher icon.

I tried restarting compiz, logging out and even restarting my computer.



Any tips on what I might be missing?



p.s. One thing that confuses me is that the launcher I created for Google Calendar with File -> Create application shortcuts... works as expected (uses it's own, different icon), and doesn't even make use of the --class=<profile> argument I thought was necessary...










share|improve this question
























  • To be honest, the whole construction seems rather fuzzy to me. Apart from the fact that I do not follow your description of the setup you made: a)you can give a desktop file multiple entries, without the complicated setup b) taking old desktop files to new versions of Ubuntu is a bad idea in general, because of possible mismatches of commands in old (local) desktop files and global ones of newer application versions that come with the new Ubuntu release. c) If you keep a local .desktop file of an application, the global one plays no role wahtsoever, not in the Unity launcher, not in Dash.

    – Jacob Vlijm
    Apr 18 '14 at 22:34











  • please let me know if there is anything I can do to clarify my problem. The original instructions I followed were ricardofeliciano.me/…. That might help put my question into context.

    – Student
    Apr 19 '14 at 9:57







  • 1





    I see, I removed my answer because I think I misunderstood your setup and what you want to achieve ;) I have to run, will look into it tonight (unless someone else solved the problem in the meantime)

    – Jacob Vlijm
    Apr 19 '14 at 10:14






  • 1





    I do not have an answer, but I simply think Unity does not accept anymore that application windows are grouped under another icon than the icon of the "native" desktop file, meaning: the desktop file with the application-command as its native command. That is actually a good thing, and I indeed noticed more consistancy and less errors in how desktop files behave in the launcher lately. However, I think your solution does not work anymore, as I tried myself.

    – Jacob Vlijm
    Apr 19 '14 at 19:44






  • 1





    This is not working anymore in Ubuntu 14.04 due to a chromium bug, caused by the switch to v34 (and aura engine). Unity has not changed anything related to this.

    – Treviño
    Apr 30 '14 at 5:00

















5















EDIT 2014-04-19:

To add a little extra context to my question, these are the original instructions I followed http://ricardofeliciano.me/how-to-create-a-unity-launcher-icon-for-each-chromechromium-profile-in-ubuntu/. I got it to work with Ubuntu 14.04 LTS a few weeks before the official release date. After updating on April 17th I can no longer get it to work:



ORIGINAL POST:

I installed Ubuntu 14.04 LTS a few weeks before the official release and set up multiple google chromium profiles. Using "StartupWMClass", I managed to get each profile to have a separate version of the chromium icon in the unity launcher (same icon, separate appearance in the launcher). After the official release of 14.04 I updated all packages (including chromium) and ever since my additional chromium profiles no longer get their own icon location on the launcher, but group together with the main chromium icon.



here's what I believe to be the essentials of my setup:



  • Under ~/.local/share/applications/ I have my *.desktop files, containing among others the lines
    • Exec=chromium-browser --user-data-dir=/home/<mydir>/.config/chromium/Profiles/<profile-name> --class=<profile-class-name> %U

    • StartupWMClass=<profile-class-name>


  • Under /usr/share/applications/ I have the default chromium-browser.desktop file created upon installing chromium, containing among others the lines
    • Exec=chromium-browser --class=Chromium-browser %U

    • StartupWMClass=Chromium-browser


Adding --class=Chromium-browser to the Exec= line of the default installation .desktop file used to do the trick so that each profile including the default profile would be associated with their own icon on the launcher. After the update I am no longer able to get this to work.



I tried:



  • closing all chromium windows,

  • unlocking from launcher any remaining chromium icons,

  • using the unity search to start the default Chromium Web Browser,

  • locking the appearing icon to the launcher

  • using the unity search to start an additional, custom Chromium profile

  • --> the window of the additional chromium profile is associated with the the icon started for the default chromium profile. They use the same launcher icon.

I tried restarting compiz, logging out and even restarting my computer.



Any tips on what I might be missing?



p.s. One thing that confuses me is that the launcher I created for Google Calendar with File -> Create application shortcuts... works as expected (uses it's own, different icon), and doesn't even make use of the --class=<profile> argument I thought was necessary...










share|improve this question
























  • To be honest, the whole construction seems rather fuzzy to me. Apart from the fact that I do not follow your description of the setup you made: a)you can give a desktop file multiple entries, without the complicated setup b) taking old desktop files to new versions of Ubuntu is a bad idea in general, because of possible mismatches of commands in old (local) desktop files and global ones of newer application versions that come with the new Ubuntu release. c) If you keep a local .desktop file of an application, the global one plays no role wahtsoever, not in the Unity launcher, not in Dash.

    – Jacob Vlijm
    Apr 18 '14 at 22:34











  • please let me know if there is anything I can do to clarify my problem. The original instructions I followed were ricardofeliciano.me/…. That might help put my question into context.

    – Student
    Apr 19 '14 at 9:57







  • 1





    I see, I removed my answer because I think I misunderstood your setup and what you want to achieve ;) I have to run, will look into it tonight (unless someone else solved the problem in the meantime)

    – Jacob Vlijm
    Apr 19 '14 at 10:14






  • 1





    I do not have an answer, but I simply think Unity does not accept anymore that application windows are grouped under another icon than the icon of the "native" desktop file, meaning: the desktop file with the application-command as its native command. That is actually a good thing, and I indeed noticed more consistancy and less errors in how desktop files behave in the launcher lately. However, I think your solution does not work anymore, as I tried myself.

    – Jacob Vlijm
    Apr 19 '14 at 19:44






  • 1





    This is not working anymore in Ubuntu 14.04 due to a chromium bug, caused by the switch to v34 (and aura engine). Unity has not changed anything related to this.

    – Treviño
    Apr 30 '14 at 5:00













5












5








5


3






EDIT 2014-04-19:

To add a little extra context to my question, these are the original instructions I followed http://ricardofeliciano.me/how-to-create-a-unity-launcher-icon-for-each-chromechromium-profile-in-ubuntu/. I got it to work with Ubuntu 14.04 LTS a few weeks before the official release date. After updating on April 17th I can no longer get it to work:



ORIGINAL POST:

I installed Ubuntu 14.04 LTS a few weeks before the official release and set up multiple google chromium profiles. Using "StartupWMClass", I managed to get each profile to have a separate version of the chromium icon in the unity launcher (same icon, separate appearance in the launcher). After the official release of 14.04 I updated all packages (including chromium) and ever since my additional chromium profiles no longer get their own icon location on the launcher, but group together with the main chromium icon.



here's what I believe to be the essentials of my setup:



  • Under ~/.local/share/applications/ I have my *.desktop files, containing among others the lines
    • Exec=chromium-browser --user-data-dir=/home/<mydir>/.config/chromium/Profiles/<profile-name> --class=<profile-class-name> %U

    • StartupWMClass=<profile-class-name>


  • Under /usr/share/applications/ I have the default chromium-browser.desktop file created upon installing chromium, containing among others the lines
    • Exec=chromium-browser --class=Chromium-browser %U

    • StartupWMClass=Chromium-browser


Adding --class=Chromium-browser to the Exec= line of the default installation .desktop file used to do the trick so that each profile including the default profile would be associated with their own icon on the launcher. After the update I am no longer able to get this to work.



I tried:



  • closing all chromium windows,

  • unlocking from launcher any remaining chromium icons,

  • using the unity search to start the default Chromium Web Browser,

  • locking the appearing icon to the launcher

  • using the unity search to start an additional, custom Chromium profile

  • --> the window of the additional chromium profile is associated with the the icon started for the default chromium profile. They use the same launcher icon.

I tried restarting compiz, logging out and even restarting my computer.



Any tips on what I might be missing?



p.s. One thing that confuses me is that the launcher I created for Google Calendar with File -> Create application shortcuts... works as expected (uses it's own, different icon), and doesn't even make use of the --class=<profile> argument I thought was necessary...










share|improve this question
















EDIT 2014-04-19:

To add a little extra context to my question, these are the original instructions I followed http://ricardofeliciano.me/how-to-create-a-unity-launcher-icon-for-each-chromechromium-profile-in-ubuntu/. I got it to work with Ubuntu 14.04 LTS a few weeks before the official release date. After updating on April 17th I can no longer get it to work:



ORIGINAL POST:

I installed Ubuntu 14.04 LTS a few weeks before the official release and set up multiple google chromium profiles. Using "StartupWMClass", I managed to get each profile to have a separate version of the chromium icon in the unity launcher (same icon, separate appearance in the launcher). After the official release of 14.04 I updated all packages (including chromium) and ever since my additional chromium profiles no longer get their own icon location on the launcher, but group together with the main chromium icon.



here's what I believe to be the essentials of my setup:



  • Under ~/.local/share/applications/ I have my *.desktop files, containing among others the lines
    • Exec=chromium-browser --user-data-dir=/home/<mydir>/.config/chromium/Profiles/<profile-name> --class=<profile-class-name> %U

    • StartupWMClass=<profile-class-name>


  • Under /usr/share/applications/ I have the default chromium-browser.desktop file created upon installing chromium, containing among others the lines
    • Exec=chromium-browser --class=Chromium-browser %U

    • StartupWMClass=Chromium-browser


Adding --class=Chromium-browser to the Exec= line of the default installation .desktop file used to do the trick so that each profile including the default profile would be associated with their own icon on the launcher. After the update I am no longer able to get this to work.



I tried:



  • closing all chromium windows,

  • unlocking from launcher any remaining chromium icons,

  • using the unity search to start the default Chromium Web Browser,

  • locking the appearing icon to the launcher

  • using the unity search to start an additional, custom Chromium profile

  • --> the window of the additional chromium profile is associated with the the icon started for the default chromium profile. They use the same launcher icon.

I tried restarting compiz, logging out and even restarting my computer.



Any tips on what I might be missing?



p.s. One thing that confuses me is that the launcher I created for Google Calendar with File -> Create application shortcuts... works as expected (uses it's own, different icon), and doesn't even make use of the --class=<profile> argument I thought was necessary...







unity launcher google-chrome icons chromium






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 19 '14 at 14:11







Student

















asked Apr 18 '14 at 21:33









StudentStudent

1261 silver badge4 bronze badges




1261 silver badge4 bronze badges












  • To be honest, the whole construction seems rather fuzzy to me. Apart from the fact that I do not follow your description of the setup you made: a)you can give a desktop file multiple entries, without the complicated setup b) taking old desktop files to new versions of Ubuntu is a bad idea in general, because of possible mismatches of commands in old (local) desktop files and global ones of newer application versions that come with the new Ubuntu release. c) If you keep a local .desktop file of an application, the global one plays no role wahtsoever, not in the Unity launcher, not in Dash.

    – Jacob Vlijm
    Apr 18 '14 at 22:34











  • please let me know if there is anything I can do to clarify my problem. The original instructions I followed were ricardofeliciano.me/…. That might help put my question into context.

    – Student
    Apr 19 '14 at 9:57







  • 1





    I see, I removed my answer because I think I misunderstood your setup and what you want to achieve ;) I have to run, will look into it tonight (unless someone else solved the problem in the meantime)

    – Jacob Vlijm
    Apr 19 '14 at 10:14






  • 1





    I do not have an answer, but I simply think Unity does not accept anymore that application windows are grouped under another icon than the icon of the "native" desktop file, meaning: the desktop file with the application-command as its native command. That is actually a good thing, and I indeed noticed more consistancy and less errors in how desktop files behave in the launcher lately. However, I think your solution does not work anymore, as I tried myself.

    – Jacob Vlijm
    Apr 19 '14 at 19:44






  • 1





    This is not working anymore in Ubuntu 14.04 due to a chromium bug, caused by the switch to v34 (and aura engine). Unity has not changed anything related to this.

    – Treviño
    Apr 30 '14 at 5:00

















  • To be honest, the whole construction seems rather fuzzy to me. Apart from the fact that I do not follow your description of the setup you made: a)you can give a desktop file multiple entries, without the complicated setup b) taking old desktop files to new versions of Ubuntu is a bad idea in general, because of possible mismatches of commands in old (local) desktop files and global ones of newer application versions that come with the new Ubuntu release. c) If you keep a local .desktop file of an application, the global one plays no role wahtsoever, not in the Unity launcher, not in Dash.

    – Jacob Vlijm
    Apr 18 '14 at 22:34











  • please let me know if there is anything I can do to clarify my problem. The original instructions I followed were ricardofeliciano.me/…. That might help put my question into context.

    – Student
    Apr 19 '14 at 9:57







  • 1





    I see, I removed my answer because I think I misunderstood your setup and what you want to achieve ;) I have to run, will look into it tonight (unless someone else solved the problem in the meantime)

    – Jacob Vlijm
    Apr 19 '14 at 10:14






  • 1





    I do not have an answer, but I simply think Unity does not accept anymore that application windows are grouped under another icon than the icon of the "native" desktop file, meaning: the desktop file with the application-command as its native command. That is actually a good thing, and I indeed noticed more consistancy and less errors in how desktop files behave in the launcher lately. However, I think your solution does not work anymore, as I tried myself.

    – Jacob Vlijm
    Apr 19 '14 at 19:44






  • 1





    This is not working anymore in Ubuntu 14.04 due to a chromium bug, caused by the switch to v34 (and aura engine). Unity has not changed anything related to this.

    – Treviño
    Apr 30 '14 at 5:00
















To be honest, the whole construction seems rather fuzzy to me. Apart from the fact that I do not follow your description of the setup you made: a)you can give a desktop file multiple entries, without the complicated setup b) taking old desktop files to new versions of Ubuntu is a bad idea in general, because of possible mismatches of commands in old (local) desktop files and global ones of newer application versions that come with the new Ubuntu release. c) If you keep a local .desktop file of an application, the global one plays no role wahtsoever, not in the Unity launcher, not in Dash.

– Jacob Vlijm
Apr 18 '14 at 22:34





To be honest, the whole construction seems rather fuzzy to me. Apart from the fact that I do not follow your description of the setup you made: a)you can give a desktop file multiple entries, without the complicated setup b) taking old desktop files to new versions of Ubuntu is a bad idea in general, because of possible mismatches of commands in old (local) desktop files and global ones of newer application versions that come with the new Ubuntu release. c) If you keep a local .desktop file of an application, the global one plays no role wahtsoever, not in the Unity launcher, not in Dash.

– Jacob Vlijm
Apr 18 '14 at 22:34













please let me know if there is anything I can do to clarify my problem. The original instructions I followed were ricardofeliciano.me/…. That might help put my question into context.

– Student
Apr 19 '14 at 9:57






please let me know if there is anything I can do to clarify my problem. The original instructions I followed were ricardofeliciano.me/…. That might help put my question into context.

– Student
Apr 19 '14 at 9:57





1




1





I see, I removed my answer because I think I misunderstood your setup and what you want to achieve ;) I have to run, will look into it tonight (unless someone else solved the problem in the meantime)

– Jacob Vlijm
Apr 19 '14 at 10:14





I see, I removed my answer because I think I misunderstood your setup and what you want to achieve ;) I have to run, will look into it tonight (unless someone else solved the problem in the meantime)

– Jacob Vlijm
Apr 19 '14 at 10:14




1




1





I do not have an answer, but I simply think Unity does not accept anymore that application windows are grouped under another icon than the icon of the "native" desktop file, meaning: the desktop file with the application-command as its native command. That is actually a good thing, and I indeed noticed more consistancy and less errors in how desktop files behave in the launcher lately. However, I think your solution does not work anymore, as I tried myself.

– Jacob Vlijm
Apr 19 '14 at 19:44





I do not have an answer, but I simply think Unity does not accept anymore that application windows are grouped under another icon than the icon of the "native" desktop file, meaning: the desktop file with the application-command as its native command. That is actually a good thing, and I indeed noticed more consistancy and less errors in how desktop files behave in the launcher lately. However, I think your solution does not work anymore, as I tried myself.

– Jacob Vlijm
Apr 19 '14 at 19:44




1




1





This is not working anymore in Ubuntu 14.04 due to a chromium bug, caused by the switch to v34 (and aura engine). Unity has not changed anything related to this.

– Treviño
Apr 30 '14 at 5:00





This is not working anymore in Ubuntu 14.04 due to a chromium bug, caused by the switch to v34 (and aura engine). Unity has not changed anything related to this.

– Treviño
Apr 30 '14 at 5:00










1 Answer
1






active

oldest

votes


















0














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.. 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.






share|improve this answer

























    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
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f450113%2fmultiple-chromium-icons-in-launcher-of-14-04-lts%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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.. 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.






    share|improve this answer



























      0














      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.. 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.






      share|improve this answer

























        0












        0








        0







        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.. 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.






        share|improve this answer













        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.. 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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 10 at 7:08









        rkantosrkantos

        313 bronze badges




        313 bronze badges



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f450113%2fmultiple-chromium-icons-in-launcher-of-14-04-lts%23new-answer', 'question_page');

            );

            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







            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?