Skip to content

Instantly share code, notes, and snippets.

@Rafael-Conde
Last active December 15, 2022 16:29
Show Gist options
  • Save Rafael-Conde/59026ac36ebf72fc6adf5aab3c55a48a to your computer and use it in GitHub Desktop.
Save Rafael-Conde/59026ac36ebf72fc6adf5aab3c55a48a to your computer and use it in GitHub Desktop.
Komorebi autoHotKey V1 script with more functionality
#SingleInstance Force
; You can generate a fresh version of this file with "komorebic ahk-library"
#Include %A_ScriptDir%\komorebic.lib.ahk
; https://github.com/LGUG2Z/komorebi/#generating-common-application-specific-configurations
#Include %A_ScriptDir%\komorebi.generated.ahk
; Default to minimizing windows when switching workspaces
WindowHidingBehaviour("minimize")
; Set cross-monitor move behaviour to insert instead of swap
CrossMonitorMoveBehaviour("insert")
; Enable hot reloading of changes to this file
; WatchConfiguration("enable")
; Ensure there is 9 workspaces created on monitor 0
EnsureWorkspaces(0, 9)
; Ensure there is 9 workspaces created on monitor 1
EnsureWorkspaces(1, 9)
; Configure the invisible border dimensions
InvisibleBorders(7, 0, 14, 7)
; Configure the 1st workspace
; WorkspaceName(0, 0, "I")
; Uncomment the next two lines if you want a visual border drawn around the focused window
ActiveWindowBorderColour(66, 165, 245, "single") ; this is a nice blue colour
ActiveWindowBorder("enable")
; Allow komorebi to start managing windows
CompleteConfiguration()
; WorkspaceNumber = 9
; global numbers = [0,1,2,3,4,5,6,7,8]
!1::
FocusWorkspace(0)
return
!2::
FocusWorkspace(1)
return
!3::
FocusWorkspace(2)
return
!4::
FocusWorkspace(3)
return
!5::
FocusWorkspace(4)
return
!6::
FocusWorkspace(5)
return
!7::
FocusWorkspace(6)
return
!8::
FocusWorkspace(7)
return
!9::
FocusWorkspace(8)
return
!+1::
MoveToWorkspace(0)
return
!+2::
MoveToWorkspace(1)
return
!+3::
MoveToWorkspace(2)
return
!+4::
MoveToWorkspace(3)
return
!+5::
MoveToWorkspace(4)
return
!+6::
MoveToWorkspace(5)
return
!+7::
MoveToWorkspace(6)
return
!+8::
MoveToWorkspace(7)
return
!+9::
MoveToWorkspace(8)
return
; Switch to workspace
; Alt + 1~9
; Equal to bind key !1 to !9 to workspace 0 ~ 8
; For num in numbers{
; Hotkey, "!" . (num+1), (key) => FocusWorkspace(Integer, (SubStr, key, 3)-1)
; }
; Move window to workspace
; Alt + Shift + 1~9
; Equal to bind key !+1 to !+9 to workspace 0 ~ 8
; For num in numbers{
; Hotkey, "!+" . (num+1), (key) => Run, "komorebic move-to-workspace " . Integer, (SubStr, key, 3)-1, ,"Hide"
; }
; Change the focused window, Alt + Vim direction keys (HJKL)
!h::
Focus("left")
return
!j::
Focus("down")
return
!k::
Focus("up")
return
!l::
Focus("right")
return
; Move the focused window in a given direction, Alt + Shift + Vim direction keys (HJKL)
!+h::
Move("left")
return
!+j::
Move("down")
return
!+k::
Move("up")
return
!+l::
Move("right")
return
; minimize window
!m::
Minimize()
return
!f::
ToggleMaximize()
return
; toggle Monocle mone
!+f::
ToggleMonocle()
return
; retile windows
!r::
Retile()
return
; There are many more commands that you can bind to whatever keys combinations you want!
;
; Have a look at the komorebic.lib.ahk file to see which arguments are required by different commands
;
; If you want more information about a command, you can run every komorebic command with "--help"
;
; For example, if you see this in komorebic.lib.ahk
;
; WorkspaceLayout(monitor, workspace, value) {
; Run, komorebic.exe workspace-layout %monitor% %workspace% %value%, , Hide
; }
;
; Just run "komorebic.exe workspace-layout --help" and you'll get all the information you need to use the command
;
; komorebic.exe-workspace-layout
; Set the layout for the specified workspace
;
; USAGE:
; komorebic.exe workspace-layout <MONITOR> <WORKSPACE> <VALUE>
;
; ARGS:
; <MONITOR> Monitor index (zero-indexed)
; <WORKSPACE> Workspace index on the specified monitor (zero-indexed)
; <VALUE> [possible values: bsp, columns, rows, vertical-stack, horizontal-stack, ultrawide-vertical-stack]
;
; OPTIONS:
; -h, --help Print help information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment