Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for AHK2 + used my own config #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"AutoHotkey2.InterpreterPath": "c:\\Program_Files\\AutoHotkey\\v2\\AutoHotkey.exe"
}
File renamed without changes
111 changes: 111 additions & 0 deletions config/komorebi.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
; 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:: FocusMonitorWorkspace(0, 0)
!2:: FocusMonitorWorkspace(0, 1)
!3:: FocusMonitorWorkspace(0, 2)
!4:: FocusMonitorWorkspace(0, 3)
!5:: FocusMonitorWorkspace(0, 4)
!6:: FocusMonitorWorkspace(0, 5)
!7:: FocusMonitorWorkspace(0, 6)
!8:: FocusMonitorWorkspace(0, 7)
!9:: FocusMonitorWorkspace(0, 8)

<^>!1:: FocusMonitorWorkspace(1, 0)
<^>!2:: FocusMonitorWorkspace(1, 1)
<^>!3:: FocusMonitorWorkspace(1, 2)
<^>!4:: FocusMonitorWorkspace(1, 3)
<^>!5:: FocusMonitorWorkspace(1, 4)
<^>!6:: FocusMonitorWorkspace(1, 5)
<^>!7:: FocusMonitorWorkspace(1, 6)
<^>!8:: FocusMonitorWorkspace(1, 7)
<^>!9:: FocusMonitorWorkspace(1, 8)

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

<^>!+1:: SendToMonitorWorkspace(1, 0)
<^>!+2:: SendToMonitorWorkspace(1, 1)
<^>!+3:: SendToMonitorWorkspace(1, 2)
<^>!+4:: SendToMonitorWorkspace(1, 3)
<^>!+5:: SendToMonitorWorkspace(1, 4)
<^>!+6:: SendToMonitorWorkspace(1, 5)
<^>!+7:: SendToMonitorWorkspace(1, 6)
<^>!+8:: SendToMonitorWorkspace(1, 7)
<^>!+9:: SendToMonitorWorkspace(1, 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)
}
53 changes: 53 additions & 0 deletions config/komorebi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"$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"
}
]
}
]
}
]
}
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