waycrate / swhkd

Sxhkd clone for Wayland (works on TTY and X11 too)
https://git.sr.ht/~shinyzenith/swhkd
BSD 2-Clause "Simplified" License
667 stars 47 forks source link

feat: added @pend internal command #220

Open EdenQwQ opened 11 months ago

EdenQwQ commented 11 months ago

This could fix #219 @tsankuanglee

Usage

Use @pend mode_name to enter a mode, and the remaining commands will not run until the mode is escaped with @escape or oneoff.

Example

swhkdrc:

super + r
  notify-send "entering resize mode" && @pend resize && notify-send "exiting resize mode"

mode resize
{h, l, j, k}
  hyprctl dispatch resizeactive {\-5 0, 5 0, 0 5, 0 \-5}
ctrl + c
  notify-send "entering move-canvas mode" && @pend move-canvas && notify-send "exiting move-canvas mode"
q
  @escape
endmode

mode move-canvas
{h, l, j, k}
  /home/eden/.config/hypr/scripts/move-canvas {5 0, \-5 0, 0 \-5, 0 5}
q
  @escape
endmode

When super + r is pressed, the notification "entering resize mode" would show up, and we will enter resize mode.

In resize mode, when ctrl + c is pressed, notification "entering move-canvas mode" would show up, and we will enter the move-canvas mode.

After that, when q is pressed, we will escape from move-canvas mode, and notification "leaving move-canvas mode" would show up. Now we are still in resize mode.

Finally, when q is pressed, we will escape from resize mode and notification "exiting resize mode" would show up.

Shinyzenith commented 4 months ago

@EdenQwQ Apologies for being so late, the pr looks good to me but it's not documented. Would you mind adding some documentation?