Logo

dev-resources.site

for different kinds of informations.

Faking the tmux experience on Windows using AutoHotkey

Published at
9/20/2024
Categories
neovim
linuxsucks
irony
windowsgang
Author
kanndide
Author
8 person written this
kanndide
open
Faking the tmux experience on Windows using AutoHotkey

I watch too many bad-ass developers on YouTube moving around their terminal's and text editors in ways that only bad-asses can. However, I would need to migrate from Windows in order to achieve this sort of skill. Windows just doesn't have the same amount of tools focused on making the life of the developer easier like Linux does.

So, I decided to see if there was any type of functionality I could mimic on Windows without having to install and run the Windows Subsystem for Linux. There has always been something about have two operations systems on my machine that just makes me feel dirty. I want my daily driver to be pure Linux, I don't want to settle for the small VM that Windows gives me just to help scratch an itch.

So, I decided to see what I could do with the tools available to Windows that don't require me to hack together something or spend too much time coding. First up, the terminal.

I chose Alacritty for this. Why? Because it's written in Rust. Is there any other reason? It also has a pretty simple and has an easy to understand settings page and uses TOML. It also has built in support for vi motions. All wins. It's pretty easy to install as well, just follow the link above. I went with the portable version. Just make sure you note where it is going to look for the configuration files.

My settings are very simple and look like this:

import = ["C:/Users/yourusername/AppData/Roaming/alacritty/nightowl/night_owl.toml"]

[shell]
program = "pwsh"
args = []

# Font configuration
[font]
normal.family = "Dank Mono"
size = 18

# Window settings
[window]
opacity = 0.85
padding.x = 5
padding.y = 15
startup_mode = "Maximized"
decorations = "Full"

# Scrolling settings
[scrolling]
history = 10000
multiplier = 3

[keyboard]
bindings = [
  { key = "M", mods = "Control | Shift", action = "Minimize" }
]
Enter fullscreen mode Exit fullscreen mode

Pretty simple, right? The only key-binding I have is so I can use it to minimize my terminal windows when I start hacking together a solution to running multiple terminals at once. To do this, I use AutoHotkey.

Pseuod-tmux:

; AutoHotkey v2 Script to Open Alacritty as "Terminal 1" with Ctrl+Shift+1

#Requires AutoHotkey v2.0+

; Hotkey for Ctrl + Shift + 1 (Terminal 1)
^+1:: {
    title := "Terminal 1"

    if WinExist(title) 
        WinActivate 
    else 
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 2 (Terminal 2)
^+2:: {
    title := "Terminal 2"

    ; Check if a window with the title "Terminal 1" already exists
    if WinExist(title) 
        WinActivate 
    else 
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 3 (Terminal 3)
^+3:: {
    title := "Terminal 3"
    if WinExist(title)
        WinActivate(title)
    else
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 4 (Terminal 4)
^+4:: {
    title := "Terminal 4"
    if WinExist(title)
        WinActivate(title)
    else
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 5 (Terminal 5)
^+5:: {
    title := "Terminal 5"
    if WinExist(title)
        WinActivate(title)
    else
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 6 (Terminal 6)
^+6:: {
    title := "Terminal 6"
    if WinExist(title)
        WinActivate(title)
    else
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 7 (Terminal 7)
^+7:: {
    title := "Terminal 7"
    if WinExist(title)
        WinActivate(title)
    else
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 8 (Terminal 8)
^+8:: {
    title := "Terminal 8"
    if WinExist(title)
        WinActivate(title)
    else
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 9 (Terminal 9)
^+9:: {
    title := "Terminal 9"
    if WinExist(title)
        WinActivate(title)
    else
        Run('alacritty.exe -t "' title '"')
}

; Hotkey for Ctrl + Shift + 0 (Terminal 10)
^+0:: {
    title := "Terminal 10"
    if WinExist(title)
        WinActivate(title)
    else
        Run('alacritty.exe -t "' title '"')
}

Enter fullscreen mode Exit fullscreen mode

Is that not the stupidest shit?

Essentially, this just opens an instance of Alacritty with a unique name, which allows me to cycle between them suing key bindings (ctrl-shift-number) in this case.

The best way to do this would be to actually learn how to manage virtual desktops in Windows with AutoHotkey, but I don't even know if that's possible. For now, I accept a hacky workaround with hotkeys.

At least I'm not using Windows Terminal.

Happy Coding!

neovim Article's
30 articles in total
Favicon
How to Enable Undercurl in Neovim: Terminal and Tmux Setup Guide
Favicon
Hassle free flutter Development in Hyprland with Neovim
Favicon
How to setup VueJs in Neovim (January 2025)
Favicon
Setting Up NeoVim + LazyVim on My New Mac Mini M4 💻✨
Favicon
Zed IDE vs. NeoVim and Other IDEs: The Future of Modern Coding Environments
Favicon
Enhancing Elixir Development in LazyVim: Quick Documentation Access by Telescope
Favicon
Lazyvim version 14.x in WSL
Favicon
From Vi to NeoVim: A Journey into the Heart of Text Editing
Favicon
As a beginner I use Arch, Neovim and code in assembly btw
Favicon
How to Setup Vim for Kotlin Development
Favicon
This developer created a 2K star repo from his phone
Favicon
Atomic Note-Taking Guide
Favicon
obsidian neovim markdown
Favicon
What I've Learned About My Editing Skills
Favicon
Vim Regex Tricks - Capitalize Every First Letter
Favicon
Lite 🚀 ApolloNvim Distro 2024
Favicon
[SOLVED] Vue 3 + TypeScript + Inlay Hint support in NeoVim
Favicon
Migrating from VSCode to Neovim: A Journey of Learning, Confusion, and Triumph! 🚀
Favicon
Managing LSPs in Neovim: Enable/Disable for the Entire Session
Favicon
Create a New Note for Your Obsidian Vault from the Terminal
Favicon
Faking the tmux experience on Windows using AutoHotkey
Favicon
How to resume neovim session
Favicon
Can't believe I've created 20 vim plugins since 2016
Favicon
Top 5 Neovim Repositories in this Week
Favicon
Compile Neovim in Debian/Ubuntu Linux
Favicon
Neovim for beginners
Favicon
Make environment to develop commonlisp with NeoVim
Favicon
Setting up neovim for web development in Golang
Favicon
Github copilot setup on Austronvim
Favicon
How I Developed My First Neovim Plugin: A Step-by-Step Guide

Featured ones: