GIMP + Wacom Tablet Customization

I wasn’t sure if I should put this in software/application, tablet, or here. To be honest, this might not even be a manjaro forum question so feel free to delete the thread if that’s the case.

I have a wacom intuos pro medium that I use with GIMP frequently and I want to set it up so that I have a good way to markup academic papers and annotate books. Instead of a PDF editor, since I do math and want to write freeform, I think GIMP is the best. I have used user’s bogdancovaciu guide on setting up the tablet preferences with xsetwacom and so I think what I’m asking for is possible (but again this might not be the place to ask)

Customization goal
I want to make a macro in GIMP that does:

  1. toggle current layer visibility
  2. select next layer down

And another that inverts the process

  1. select next layer up
  2. toggle current layer visibility

Once I have that macro, I want to keybind that to the side mouse buttons on my mouse. However, it looks like GIMP doesn’t recognize my side mouse buttons currently. Other programs do, but it registers as just a stander mouse click in GIMP. The keybind options in GIMP seem to suggest that it is only possible to do keyboard binds, but I’m not sure if that is just due to some setting I have.

If possible, I’d also like to keybind similar commands to my tablet keys and the stylus keys on my stylus, but I’m not sure if GIMP allows for this. Does anyone have experience or a guide? I’ve searched but come up empty

In Gimp > Edit > Imput devices
you can assign for each what to do, and if is for window or screen, also each one of the Keys you can define accelerators by double clicking on each Disabled one …

Macros are not a thing i’m aware of in GIMP, nor recording such actions … but rather use Script-Fu or Python-Fu and have “macro” sub-menus. In some extent GEGL operations are also a thing, but most are predefined.
While this might help

a script needs to be written by someone for what you described, or learn how to do it …