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

Provide a "togglemode" dispatcher #114

Closed
chaorace opened this issue Jan 20, 2025 · 3 comments
Closed

Provide a "togglemode" dispatcher #114

chaorace opened this issue Jan 20, 2025 · 3 comments

Comments

@chaorace
Copy link

(Related to #112)
After integrating scroller:setmode into my workflow, I'm finding myself wishing for a toggle-type bind that more easily facilitates rapid mode switching. Rapid switching is a part of my workflow because I'll regularly switch into "column mode" just long enough to open a window in the current column before immediately returning back into my preferred "row mode".

This would be roughly analogous to the builtin Dwindle layout's togglesplit dispatcher and is desirable for the same reasons:

  • Consolidating both functions into a single key reclaims valuable keybind real-estate
  • Toggling helps to facilitate more comfortable hand movement patterns (i.e. starting/ending a motion in the same position)
@dawsers
Copy link
Owner

dawsers commented Jan 20, 2025

I would say this goes against #112 because the idea there is to provide more than two modes, so a toggle won't work any more.

Besides, you can do that right now through a script. Read this comment to see how you can know the current Hyprscroller mode. You can use that to create the "toggle", dispatching a change to the other mode with your key binding of choice.

@chaorace
Copy link
Author

chaorace commented Jan 20, 2025

I would say this goes against #112 because the idea there is to provide more than two modes, so a toggle won't work any more.

More modes wasn't exactly what I was requesting in that issue... but if that's the direction things will go then I agree completely with your evaluation. Self-closing issue.

Besides, you can do that right now through a script

Lots of things can be done through a script, of course. I actually wrote this issue after writing my own script for this -- odd I know, but sometimes creating an issue is more about documenting a need and making things better for the next people.

Anyhow, to whom it may concern, here's my version of a toggle script. I went for something more stateful because I didn't feel an IPC dependency contributed sufficient value to justify managing the extra process. I just bind a key to exec the script and that's it:

#!/usr/bin/env bash
if [ -f "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode" ]; then
  rm "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode"
  hyprctl --batch 'dispatch scroller:setmode row; notify 2 1000 0 "Row Mode"'
else
  touch "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode"
  hyprctl --batch 'dispatch scroller:setmode col; notify 0 1000 0 "Column Mode"'
fi

@dawsers
Copy link
Owner

dawsers commented Jan 20, 2025

I agree with you, and that is why I didn't close the issue even though I wasn't too excited about adding another dispatcher for something like that. Sometimes I leave issues open just to explain why they won't happen, at least in the near term.

Thank you for sharing your script, like you said, it is much better than having to depend on IPC.

I will go through with #112, and I think modes is probably what will happen. Depending on window rules for something like that is like depending on IPC for something as simple as a key bind toggle. They add overhead and lack some flexibility because they depend on something static like the configuration file. But it is your issue, so I am open to your input there, as nobody else seems to have added any ideas or thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants