How do I assign a hotkey to restart my display manager?

How do i create a hotkey to restart my display manager if it requires sudo? Is there a way around this?

Sometimes my display manager or videocard crashes i am not sure which, and i can no longer see anything on my monitors except a static image of what was last seen (not a black screen). If i restart my monitors they turn black.

Create your script into a file, make it executable and set a shortcut key/combination to it … If sudo is required then it might also work with pkexec command, but maybe this will suffice and no elevated user privileges required …