Detect route change

How can I update my HTML Dom whenever the route changes. I see no event for this.

I want the users of my frappe app to dynamically modify the css of certain doctype-forms, doctype-lists and the workspace. So my basic idea is to update a css class on the body tag so that they can write their own css in my Settings Doctypes CSS field (of type code - css) .

I’m not aware of any event linked to route changes in Frappe, but you should be able to listen to click and keypress events.

Something like this?

Cool, with this found a way to do this!
Let’s see, if they introduce keyboard-shortcuts to change the route at some point, then my solution breaks… :frowning:

Thanks for now! :smiley: