Skip to content

Instantly share code, notes, and snippets.

@EvansWinner
Created March 12, 2021 22:18
Show Gist options
  • Save EvansWinner/917d413bacc67714dab4e6227792ed20 to your computer and use it in GitHub Desktop.
Save EvansWinner/917d413bacc67714dab4e6227792ed20 to your computer and use it in GitHub Desktop.
// Banish the mouse cursor in MS Windows from the keyboard
// This is meant to be like the function of the same name
// in Stumpwm, which I miss. You compile it, put it somewhere,
// then create a shortcut to it and put the SHORTCUT on your
// desktop, then in the shortcut properties, select a keyboard
// shortcut.
// I don't even know Csharp, really but figured out enough to do
// this with some judicious Googling.
// Turns out if an application has installed the .NET framework
// you have to Csharp compiler....
// BUGS: Yes. Winodws insists on opening a command window briefly
// when this runs. You can tell Windows to run it minimized in the
// shortcut properties I mentioned, but it will still cause your
// current window to lose focus, so after running this with Ctrl-Alt-b
// or whatever you use, you will have to Alt-Tab back to whatever you
// were working on. Lame.
using System.Drawing;
using System.Windows.Forms;
class Banish {
public static void Main(){
Cursor.Position = new Point(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment