Open daniels opened 3 weeks ago
Can you share your skhd config so we can see how your utilizing modes? This might help Anze see what can be done. I use skhd and asked Anze to implement the skhd sheet, but I haven't got used to modes yet, so I don't use it. Funny I've been using nvim for about a year now and still have to get used to modes lol.
Hey daniels,
Thank you for your suggestion! Supporting skhd modes is a great idea, and I can see how that would improve usability.
To make sure fully capture your needs, and like gldtn said, could you share a sample of your skhdrc configuration? This will help to understand how to approach adding mode-based support to the CLI.
Hi, and thanks for considering this idea!
Here follows a sample of my skhdrc.
It includes mode definitions (which do not have shortcuts in themselves, but where the comment might be used as some sort of heading for the mode shortcuts. (skhd_mode_change
is a script I trigger with the mode name as parameter when the mode activates that sets up some interface clues as to which mode is active - here I could maybe activate KeyClue to show the sheet cheat - given that it doesn't steel focus from the window I'm operating on ...)
Then there are shortcuts for switching from default into modes and back again, and for switching between modes.
And finally shortcuts in the different modes, where some are defined simultaneously for two modes. I've chosen to show examples where the exact same shortcut is used for different things in different modes, but this could of course vary. The examples all control yabai, which is my main use for both skhdrc in general and especially the modes,
### Mode definitions
# Default - global shortcuts
:: default : skhd_mode_change default
# Focus - navigate displays, spaces and windows
:: focus @ : skhd_mode_change focus
# Grid - control windows in float mode
:: grid @ : skhd_mode_change grid
# Swap - swap windows placements in a space
:: swap @ : skhd_mode_change swap
# Warp - move windows - focus follows movement
:: warp @ : skhd_mode_change warp
# Warp no-follow - move windows.
:: warpnf @ : skhd_mode_change warpnf
# Resize - resize windows
:: resize @ : skhd_mode_change resize
### Toggle modes on-off
# Toggle focus mode
default < hyper - space ; focus
# Toggle default mode
focus, grid, swap, warp, warpnf, resize < hyper - space ; default
# Leave mode
focus, grid, swap, warp, warpnf, resize < escape ; default
### Select modes
# Select focus mode
focus, grid, swap, warp, warpnf, resize < f ; focus
# Select grid mode
focus, grid, swap, warp, warpnf, resize < g ; grid
# Select swap mode
focus, grid, swap, warp, warpnf, resize < s ; swap
# Select resize mode
focus, grid, swap, warp, warpnf, resize < r ; resize
# Select warp mode
focus, grid, swap, warp, warpnf, resize < w ; warp
# Select warpnf mode
focus, grid, swap, warp, warpnf, resize < shift - w ; warpnf
### Focus mode examples
# Focus left
focus < h : yabai -m window --focus west
# Focus down
focus < j : yabai -m window --focus south
# Focus up
focus < k : yabai -m window --focus north
# Focus right
focus < l : yabai -m window --focus east
### Grid mode examples
# Place left half
grid < h : yabai -m window --grid 1:2:0:0:1:1
# Place bottom half
grid < j : yabai -m window --grid 2:1:0:1:1:1
# Place top half
grid < k : yabai -m window --grid 2:1:0:0:1:1
# Place right half
grid < l : yabai -m window --grid 1:2:1:0:1:1
### Swap mode example
# Swap left
swap < h : yabai -m window --swap west
# Swap down
swap < j : yabai -m window --swap south
# Swap up
swap < k : yabai -m window --swap north
# Swap right
swap < l : yabai -m window --swap east
### Warp examples, duplicated in warpnf (no-follow) mode
# Warp left
warp, warpnf < h : yabai -m window --warp west
# Warp down
warp, warpnf < j : yabai -m window --warp south
# Warp up
warp, warpnf < k : yabai -m window --warp north
# Warp right
warp, warpnf < l : yabai -m window --warp east
### Resize examples
# Expand left
resize < h : yabai -m window --resize left:-10:0
# Expand down
resize < j : yabai -m window --resize bottom:0:18
# Expand up
resize < k : yabai -m window --resize top:0:-18
# Expand right
resize < l : yabai -m window --resize right:10:0
I've borrowed from and expanded on some other users configs, not sure if maybe these parts are taken more or less verbatim from one of them:
Proposal
Add support for parsing skhd modes, and add an additional optional mode-flag when using the CLI
--sheet skhd
flag, for example--sheet skhd --mode focus
When the parameter is set, only show shortcuts for that mode.I just found KeyClu when looking for a way to display my own skhd cheat sheets, markdown files I've generated by parsing skhdrc myself. But when I saw that KeyClu supported skhd shortcuts natively that was an even better solution. But I use modes heavily, so unfortunately the current KeyClu-skhd integration doesn't work for me.
Alternatives
No response
Edit: Removed reference to nonexistent CLI parameter
--skhd
.