Skip to content

Commit

Permalink
Changes for AHK2 + used my own config
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardvSchie committed May 12, 2024
1 parent 6510f0b commit 2c96971
Show file tree
Hide file tree
Showing 13 changed files with 994 additions and 474 deletions.
File renamed without changes
91 changes: 91 additions & 0 deletions config/komorebi.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
; Adapted from https://github.com/LGUG2Z/komorebi/blob/master/komorebi.sample.ahk
#SingleInstance Force
#Include "%A_ScriptDir%\lib\komorebic.lib.ahk"

; Open/Close windows
!+q:: Close()
!Enter:: {
if (PID := ProcessExist("wezterm-gui.exe")) {
} else {
Run("wezterm-gui")
}
; Jump to the process
FocusMonitorWorkspace(0, 0)
}

; Focus windows
!h:: Focus("left")
!j:: Focus("down")
!k:: Focus("up")
!l:: Focus("right")
!f:: ToggleMaximize()

; Move windows
!+h:: Move("left")
!+j:: Move("down")
!+k:: Move("up")
!+l:: Move("right")

; Resize
!=:: ResizeAxis("horizontal", "increase")
!-:: ResizeAxis("horizontal", "decrease")
!+=:: ResizeAxis("vertical", "increase")
!+-:: ResizeAxis("vertical", "decrease")

; Workspaces
!1:: FocusWorkspace(0)
!2:: FocusWorkspace(1)
!3:: FocusWorkspace(2)
!4:: FocusWorkspace(3)
!5:: FocusWorkspace(4)
!6:: FocusWorkspace(5)
!7:: FocusWorkspace(6)
!8:: FocusWorkspace(7)
!9:: FocusWorkspace(8)

; Move windows across workspaces
!+1:: MoveToWorkspace(0)
!+2:: MoveToWorkspace(1)
!+3:: MoveToWorkspace(2)
!+4:: MoveToWorkspace(3)
!+5:: MoveToWorkspace(4)
!+6:: MoveToWorkspace(5)
!+7:: MoveToWorkspace(6)
!+8:: MoveToWorkspace(7)
!+9:: MoveToWorkspace(8)

; Scroll taskbar to cycle workspaces (disabled since I don't want to use it)
; #Hotif MouseIsOver("ahk_class Shell_TrayWnd") || MouseIsOver("ahk_class Shell_SecondaryTrayWnd")
; WheelUp:: ScrollWorkspace("next")
; WheelDown:: ScrollWorkspace("previous")
; #Hotif

; Alt + scroll to cycle workspaces
!WheelUp:: ScrollWorkspace("next")
!WheelDown:: ScrollWorkspace("previous")

LastTaskbarScroll := 0
ScrollWorkspace(dir) {
global LastTaskbarScroll
; This adds a state-dependent debounce timer to adress an issue where a single wheel
; click spawns multiple clicks when a web browser is in focus.
_isBrowser := WinActive("ahk_class Chrome_WidgetWin_1") || WinActive("ahk_class MozillaWindowClass")
_t := _isBrowser ? 800 : 100
; Total debounce time = _t[this_call] + _t[last_call] to address interim focus changes
if (A_PriorKey != A_ThisHotkey) || (A_TickCount - LastTaskbarScroll > _t) {
LastTaskbarScroll := A_TickCount + _t
MouseFollowsFocus(false)
CycleWorkspace(dir)
; ToDo: only re-enable if it was enabled before
MouseFollowsFocus(true)
}
}

; ======================================================================
; Auxiliary Functions
; ======================================================================

MouseIsOver(WinTitle) {
MouseGetPos(, , &Win)
return WinExist(WinTitle . " ahk_id " . Win)
}
57 changes: 57 additions & 0 deletions config/komorebi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.24/schema.json",
"app_specific_configuration_path": "$Env:USERPROFILE/applications.yaml",
"window_hiding_behaviour": "Cloak",
"cross_monitor_move_behaviour": "Insert",
"default_workspace_padding": 0,
"default_container_padding": 0,
"border_offset": -1,
"border_width": 1,
"active_window_border": false,
"active_window_border_colours": {
"single": "#42a5f5",
"stack": "#00a542",
"monocle": "#ff3399"
},
"focus_follows_mouse": "Komorebi",
"monitors": [
{
"workspaces": [
{
"name": "Coding",
"layout": "VerticalStack",
"workspace_rules": [
{
"kind": "Exe",
"id": "wezterm-gui.exe"
}
]
},
{
"name": "Browser",
"layout": "BSP",
"workspace_rules": [
{
"kind": "Exe",
"id": "waterfox.exe"
}
]
},
{
"name": "Teams/Discord",
"layout": "BSP",
"workspace_rules": [
{
"kind": "Exe",
"id": "Discord.exe"
}
]
},
{
"name": "Anything goes",
"layout": "BSP"
}
]
}
]
}
1 change: 0 additions & 1 deletion komorebi-config/.gitignore

This file was deleted.

51 changes: 0 additions & 51 deletions komorebi-config/bindings.ahk

This file was deleted.

Binary file removed komorebi-config/img/bindings.png
Binary file not shown.
32 changes: 0 additions & 32 deletions komorebi-config/komorebi.json

This file was deleted.

40 changes: 0 additions & 40 deletions komorebi-config/readme.md

This file was deleted.

Loading

0 comments on commit 2c96971

Please sign in to comment.