From 7b3b97e79854c02ae59d8e21cc629ef535bd79b2 Mon Sep 17 00:00:00 2001 From: Ryan Caezar Itang Date: Thu, 7 Sep 2023 19:07:33 +0800 Subject: [PATCH] feat(komorebi): migrate to static + whkd config --- Reference.md | 6 ++ chezmoi/dot_config/komorebi/komorebi.json | 11 ++ chezmoi/dot_config/whkdrc | 73 +++++++++++++ chezmoi/komorebi.ahk | 119 ---------------------- 4 files changed, 90 insertions(+), 119 deletions(-) create mode 100644 chezmoi/dot_config/komorebi/komorebi.json create mode 100644 chezmoi/dot_config/whkdrc delete mode 100644 chezmoi/komorebi.ahk diff --git a/Reference.md b/Reference.md index 3e5e2ae..80a358f 100644 --- a/Reference.md +++ b/Reference.md @@ -1,4 +1,5 @@ ## Prerequisites + - bat - delta - fzf @@ -9,20 +10,25 @@ - npm ### Linux + - sheldon - zsh ### Windows + - oh-my-posh - clink +- whkd ### Node + - [czg](https://cz-git.qbb.sh/cli/) - @commitlint/config-conventional ### PowerShell #### Modules + - PSFzf - PSReadLine - Terminal-Icons diff --git a/chezmoi/dot_config/komorebi/komorebi.json b/chezmoi/dot_config/komorebi/komorebi.json new file mode 100644 index 0000000..bf03440 --- /dev/null +++ b/chezmoi/dot_config/komorebi/komorebi.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/master/schema.json", + "app_specific_configuration_path": "$Env:USERPROFILE/.config/komorebi/applications.yaml", + "alt_focus_hack": true, + "window_hiding_behaviour": "Cloak", + "cross_monitor_move_behaviour": "Insert", + "mouse_follows_focus": false, + "active_window_border": false, + "default_container_padding": 3, + "default_workspace_padding": 3 +} \ No newline at end of file diff --git a/chezmoi/dot_config/whkdrc b/chezmoi/dot_config/whkdrc new file mode 100644 index 0000000..7d05945 --- /dev/null +++ b/chezmoi/dot_config/whkdrc @@ -0,0 +1,73 @@ +.shell powershell + +# Reload whkd configuration +# alt + o : taskkill /f /im whkd.exe && start /b whkd # if shell is cmd +alt + o : taskkill /f /im whkd.exe && Start-Process whkd -WindowStyle hidden # if shell is pwsh / powershell +alt + shift + o : komorebic reload-configuration + +# Close window +alt + q : komorebic close + +# Focus windows +alt + h : komorebic focus left +alt + j : komorebic focus down +alt + k : komorebic focus up +alt + l : komorebic focus right +alt + shift + oem_4 : komorebic cycle-focus previous # oem_4 is [ +alt + shift + oem_6 : komorebic cycle-focus next # oem_6 is ] + +# Move windows +alt + shift + h : komorebic move left +alt + shift + j : komorebic move down +alt + shift + k : komorebic move up +alt + shift + l : komorebic move right +alt + shift + return : komorebic promote + +# Stack windows +alt + left : komorebic stack left +alt + down : komorebic stack down +alt + up : komorebic stack up +alt + right : komorebic stack right +alt + oem_1 : komorebic unstack # oem_1 is ; +alt + oem_4 : komorebic cycle-stack previous # oem_4 is [ +alt + oem_6 : komorebic cycle-stack next # oem_6 is ] + +# Resize +alt + oem_plus : komorebic resize-axis horizontal increase +alt + oem_minus : komorebic resize-axis horizontal decrease +alt + shift + oem_plus : komorebic resize-axis vertical increase +alt + shift + oem_minus : komorebic resize-axis vertical decrease + +# Manipulate windows +alt + t : komorebic toggle-float +alt + shift + f : komorebic toggle-monocle + +# Window manager options +alt + shift + r : komorebic retile +alt + p : komorebic toggle-pause + +# Layouts +alt + x : komorebic flip-layout horizontal +alt + y : komorebic flip-layout vertical + +# Workspaces +alt + 1 : komorebic focus-workspace 0 +alt + 2 : komorebic focus-workspace 1 +alt + 3 : komorebic focus-workspace 2 +alt + 4 : komorebic focus-workspace 3 +alt + 5 : komorebic focus-workspace 4 +alt + 6 : komorebic focus-workspace 5 +alt + 7 : komorebic focus-workspace 6 +alt + 8 : komorebic focus-workspace 7 +alt + 9 : komorebic focus-workspace 8 + +# Move windows across workspaces +alt + shift + 1 : komorebic move-to-workspace 0 +alt + shift + 2 : komorebic move-to-workspace 1 +alt + shift + 3 : komorebic move-to-workspace 2 +alt + shift + 4 : komorebic move-to-workspace 3 +alt + shift + 5 : komorebic move-to-workspace 4 +alt + shift + 6 : komorebic move-to-workspace 5 +alt + shift + 7 : komorebic move-to-workspace 6 +alt + shift + 8 : komorebic move-to-workspace 7 +alt + shift + 9 : komorebic move-to-workspace 8 \ No newline at end of file diff --git a/chezmoi/komorebi.ahk b/chezmoi/komorebi.ahk deleted file mode 100644 index 5d98fb4..0000000 --- a/chezmoi/komorebi.ahk +++ /dev/null @@ -1,119 +0,0 @@ -#Requires AutoHotkey v2.0 -#SingleInstance Force -#Include komorebic.lib.ahk ; Generate with 'komorebic ahk-library' -#Include komorebi.generated.ahk ; Application configuration rules. Generated with 'komorebic ahk-app-specific-configuration' - -; -; Variables -; - -workspaceCount := 6 -monitorCount := MonitorGetCount() - -; -; Options -; - -WatchConfiguration("enable") -FocusFollowsMouse("disable", "windows") -MouseFollowsFocus("disable") -CrossMonitorMoveBehaviour("insert") -AltFocusHack("enable") -WindowHidingBehaviour("cloak") - -Loop monitorCount { - monitorIndex := A_Index - 1 - EnsureWorkspaces(monitorIndex, workspaceCount) - Loop workspaceCount { - workspaceIndex := A_Index - 1 - ContainerPadding(monitorIndex, workspaceIndex, 3) - WorkspacePadding(monitorIndex, workspaceIndex, 3) - } -} - -CompleteConfiguration() - -; -; Keybindings -; - -; Change the focused window, Alt + Vim direction keys -!h:: Focus("left") -!j:: Focus("down") -!k:: Focus("up") -!l:: Focus("right") - -; Move the focused window in a given direction, Alt + Shift + Vim direction keys -!+h:: Move("left") -!+j:: Move("down") -!+k:: Move("up") -!+l:: Move("right") - -; Resize the focused window in a given direction, Ctrl + Win + Alt + Vim direction keys -^#!h:: { - Resize("left", "increase") - Resize("right", "decrease") -} -^#!j:: { - Resize("down", "increase") - Resize("up", "decrease") -} -^#!k:: { - Resize("up", "increase") - Resize("down", "decrease") -} -^#!l::{ - Resize("right", "increase") - Resize("left", "decrease") -} - -; Stack the focused window in a given direction, Alt + Shift + direction keys -!+Left:: Stack("left") -!+Down:: Stack("down") -!+Up:: Stack("up") -!+Right:: Stack("right") -!]:: CycleStack("next") -![:: CycleStack("previous") - -; Unstack the focused window, Alt + Shift + D -!+d:: Unstack() -; Promote the focused window to the top of the tree, Alt + Shift + Enter -!+Enter:: Promote() -; Manage the focused window -!=:: Manage() -; Unmanage the focused window -!-:: Unmanage() -; Switch to an equal-width, max-height column layout on the main workspace, Alt + Shift + C -!+c:: ChangeLayout("columns") -; Switch to the default bsp tiling layout on the main workspace, Alt + Shift + T -!+t:: ChangeLayout("bsp") -; Toggle the Monocle layout for the focused window, Alt + Shift + F -!+f:: ToggleMonocle() -; Toggle native maximize for the focused window, Alt + Shift + = -!+=:: ToggleMaximize() -; Flip horizontally, Alt + X -!x:: FlipLayout("horizontal") -; Flip vertically, Alt + Y -!y:: FlipLayout("vertical") -; Force a retile if things get janky, Alt + Shift + R -!+r:: Retile() -; Float the focused window, Alt + T -!t:: ToggleFloat() -; Reload ~/komorebi.ahk, Alt + O -!o:: ReloadConfiguration() -; Pause responding to any window events or komorebic commands, Alt + P -!p:: TogglePause() - -Loop workspaceCount { - ; Switch to workspace, Alt + 1~9 - Hotkey "!" A_Index, (key) => FocusWorkspace(Integer(SubStr(key, 2)) - 1) , "On" - ; Move window to workspace, Alt + Shift + 1~9 - Hotkey "!+" A_Index, (key) => MoveToWorkspace(Integer(SubStr(key, 3)) - 1) , "On" -} - -; -; Non-komorebi keybindings -; - -; Close application; Alt + Q -!q:: WinClose "A"