https://bugs.kde.org/show_bug.cgi?id=381266

--- Comment #15 from Andrei Shevchuk <and...@shevchuk.co> ---
I think I have a [decent
workaround](https://shevchuk.co/notes/2021/03/06/chromium-web-apps-on-kde-plasma).
The problem is that task bar seems to ignore instance name when making grouping
decision. It also does not update grouping even if you update window class
manually. As a workaround, we have  to hide window from the task bar, then
change its class and bring it back. But if we bring it back too quickly,
taskbar still won't update grouping despite the new class, so we have to add
some delay before bringing window back. So here is a script I use:

```sh
#! /usr/bin/env sh

TIMEOUT=10 # seconds
T0=$(date +%s)

if [ $# -ne 2 ] ; then
  echo "Usage: `basename $0`" '"class search regex" "new class"'
  exit 1
fi

while [ $(( `date +%s` - T0 )) -lt $TIMEOUT ]; do
  w=$(wmctrl -l -x | awk -v e="$1" '$3 ~ e { print $1 }' 2>/dev/null | head -n
1)
  if [ -n "$w" ]; then
    wmctrl -i -r $w -b add,skip_taskbar
    xdotool set_window --class "$2" --classname "$2" $w
    sleep 1
    wmctrl -i -r $w -b remove,skip_taskbar
    break
  fi
done
```

Basically, we search for our window by class using regex, then hide it, change
its class and bring it back. All in a loop with a timeout, so we don't search
forever.

Save it somewhere in your `$PATH`, e.g. `~/.local/bin/change-window-class`

You can use it like this: `change-window-class "^class-regex-to-search-for"
"new-class"`

With Chromium web app:  
`chromium --profile-directory="App - Google" --app=https://calendar.google.com
& change-window-class "^calendar.google.com" "web-app-google-calendar"`

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to