Highlighter in parallele of a "usermode -lock" menu

Hello,

I have a custom usermode, that I call with the -lock option.

I would like to have an highlighter that appear when I enter the usermode and is removed when I leave it.

I have tried to have this behaviour with hook on ModeChange but didn’t went far.

Any hint on how I could make it work?

Thanks in advance

I assume the tricky part is determining when the mode is left, since -lock works a bit weird for user modes. @Screwtapello had a suggestion you can try on the linked thread by using the NormalIdle hook. For entering the user mode you can always add the highlighter using the ModeChange hook, maybe with an -override switch so that it doesn’t complain when the mode is re-entered.

1 Like

Thanks @bravekarma !
From your post and for the future readers, I found this solution:

hook -always global ModeChange 'push:[^:]*:next-key\[user.my_usermode\]' %{

  set-face window PrimarySelection   default,rgba:00ff0080 # new color

}

hook -always global ModeChange 'pop:next-key\[user.my_usermode\]:[^:]*' %{

  set-face window PrimarySelection   default,rgba:ff000080 # default color

}

1 Like

A minor maintainability hint: if you make the second hook do unset-face window PrimarySelection then you don’t have to modify this hook when you switch to a different colour scheme that uses a different default colour.

1 Like