Skip to content

pkellyuk/WEDGE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Edge Desktop Switcher

A Windows 11 application that switches virtual desktops when your mouse hits the screen edges, similar to many X11 window managers.

Features

  • Edge Detection: Move mouse to left/right screen edge to switch desktops
  • Debouncing: Prevents accidental rapid switching (500ms cooldown)
  • Logging: Debug output shows all operations for troubleshooting
  • Graceful Shutdown: Handles Ctrl+C for clean exit

How It Works

The program continuously monitors your mouse position. When the mouse cursor reaches within 5 pixels of the left or right screen edge, it simulates the keyboard shortcut Ctrl+Win+Left or Ctrl+Win+Right to switch virtual desktops.

Requirements

  • Windows 11 (or Windows 10 with virtual desktop support)
  • GCC compiler (MinGW or Cygwin)

Building

Using the build script:

build.bat

Manual compilation:

gcc edge_desktop_switcher.c -o edge_desktop_switcher.exe -lgdi32 -luser32

Usage

Simply run the executable:

edge_desktop_switcher.exe

The program will:

  1. Start monitoring mouse position
  2. Print status messages to console
  3. Switch desktops when mouse hits edges
  4. Run until you press Ctrl+C

Configuration

You can modify these constants in edge_desktop_switcher.c:

  • EDGE_THRESHOLD (default: 5) - Pixels from edge to trigger switch
  • DEBOUNCE_MS (default: 500) - Milliseconds before allowing another switch
  • POLL_INTERVAL_MS (default: 50) - Mouse polling interval

Technical Details

The program uses:

  • GetCursorPos() - Monitor mouse position
  • SendInput() - Simulate keyboard shortcuts
  • Win32 API - System metrics and input handling

Since Windows doesn't expose a public API for virtual desktop switching, the program simulates the native keyboard shortcuts that Windows 11 uses.

Troubleshooting

Desktop not switching?

  • Verify you have multiple virtual desktops created in Windows 11
  • Check that Ctrl+Win+Arrow works manually
  • Look at console output for debug messages

Switches too often?

  • Increase DEBOUNCE_MS value
  • Increase EDGE_THRESHOLD for larger trigger zone

Not detecting edge?

  • Reduce EDGE_THRESHOLD value
  • Check console for mouse position logs

License

This is free and unencumbered software released into the public domain.

About

Scroll windows 11 workspaces when the mouse hits the Windows Edge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published