How to set a Sidecar toggle on the notch bar?

Dear all,

I would like to add a Sidecar toggle to my notch bar (don't have a touch bar mac). I found two solutions for the touch bar, respectively:

  1. This solution by @Caliguvara
  2. And this one by @mikelxc

Both look really nice and I tried to download the presets in an attempt to copy the basic logic. However, I don't know how to replicate the same thing (or something similar) on the notch bar. Any tips?

There’s a breaking change for Monterey, you can check my github