Coder Social home page Coder Social logo

rpash / wi3wm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pmb6tz/windows-desktop-switcher

0.0 0.0 0.0 88 KB

An AutoHotKey script for Windows that lets a user change virtual desktops by pressing Super + <num>.

License: MIT License

AutoHotkey 100.00%

wi3wm's Introduction

i3wm behavior for Windows

An AutoHotkey script for Windows that lets a user switch virtual desktops by pressing Super and a number row key at the sime time (e.g. Super + 2 to switch to Desktop 2). This is meant to mimic a (very small) subset the behavior of i3wm, the best window manager.

By default the Super key is set to the Windows key, however this can be changed by modifying user_config.ahk.

Running

Install AutoHotkey v1.1 or later, then run the wi3wm.ahk script (open with AutoHotkey if prompted). You can disable the switching animation by opening "Adjust the appearance and performance of Windows" and then unselecting the checkmark "Animate windows when minimizing and maximizing".

Notes about Windows 1809/1903≤ Updates

This project relies partly on VirtualDesktopAccessor.dll (for moving windows to other desktops). This binary is included in this repository for convenience, and was recently updated to work with the 1809/1903≤ updates.

If a future Windows Update breaks the DLL again and updating your files from this repository doesn't work, you could try building the DLL yourself (given that it was since updated by its' creators).

Customizing Hotkeys

To change the key mappings, modify the user_config.ahk script and then run wi3wm.ahk (program will restart if it's already running). Note, ! corresponds to Alt, + is Shift, # is Win, and ^ is Ctrl. A more detailed description of hotkeys can be found here. The syntax of the config file is HOTKEY::ACTION. Here are some examples of the customization options.

Single line of code example Meaning
!2::switchToDesktop(2) Hotkey: Alt + 2
Action: Switch to desktop 2
#!3::switchToDesktop(3) Hotkey: Win + Alt + 3
Action: Switch to desktop 3
CapsLock & 4::switchToDesktop(4) Hotkey: Capslock + 4
Action: Switch to desktop 4
(& is necessary when using a non-modifier key such as CapsLock)
#+2::moveCurrentWindowToDesktop(2) Hotkey: Win + Shift + 2
Action: Move current window to desktop 2
^space::send, #{tab} Hotkey: Ctrl + Space
Action: Open Desktop Manager by sending Win + Tab

A more detailed description of hotkeys can be found here: AutoHotkey docs.
After any changes to the configuration the program needs to be closed and opened again.

Running on boot

You can make the script run on every boot with either of these methods.

Simple (Non-administrator method)

  1. Press Win + R, enter shell:startup, then click OK
  2. Create a shortcut to the wi3wm.ahk file here

Advanced (Administrator method)

Windows prevents hotkeys from working in windows that were launched with higher elevation than the AutoHotKey script (such as CMD or Powershell terminals that were launched as Administrator). As a result, the hotkeys will only work within these windows if the script itself is Run as Administrator, due to the way Windows is designed.

You can do this by creating a scheduled task to invoke the script at logon. You may use 'Task Scheduler', or create the task in powershell as demonstrated.

# Run the following commands in an Administrator powershell prompt. 
# Be sure to specify the correct path to your wi3wm.ahk file. 

$A = New-ScheduledTaskAction -Execute "PATH\TO\wi3wm.ahk"
$T = New-ScheduledTaskTrigger -AtLogon
$P = New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest
$S = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 0
$D = New-ScheduledTask -Action $A -Principal $P -Trigger $T -Settings $S
Register-ScheduledTask Windowsi3WM -InputObject $D

The task is now registered and will run on the next logon, and can be viewed or modified in 'Task Scheduler'.

Credits

Other

To see debug messages, download SysInternals DebugView.

This script is intended to be lightweight in order to prioritize performance and robustness. For more advanced features (such as configuring different wallpapers on different desktops) check out https://github.com/sdias/win-10-virtual-desktop-enhancer.

wi3wm's People

Contributors

elijas avatar pmb6tz avatar rpash avatar pbozzay avatar h0r1z0n avatar j0natran avatar perlence avatar grmblfrz avatar kannymayo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.