Is there a general mechanism for remapping key combinations in Haiku?
Or a specific one for remapping the Workspace switching key combos?
Specifically, it doesn’t make sense to me that the arrow combo is CTRL-ALT-arrow when the direct switch combo is ALT-F#; I’d like to remap that to be CTRL-arrow and CTRL-F# instead.
(ALT-arrow is already normal in the web browsers to switch back to the previous page and forward to a previously-followed link.)
I’m not sure about remapping, but I just tested creating the ctrl-arrow and ctrl-f# shortcuts inside of the Shortcuts preference application and they worked fine. The Workspaces application has some hidden command line options that can be used in the shortcut. You can use /system/apps/Workspaces 3 to change to workspace 3, for instance; and you can use the +/- arguments to change to the next/previous workspace, like /system/apps/Workspaces + or /system/apps/Workspaces -
You shouldn’t need to identify the current workspace in order to do the things in your original message. If you want to jump to a different workspace with ctrl-f# then you set a shortcut with /system/apps/Workspaces #, and if you want to increment/decrement the workspace with ctrl-arrow then you can set the command to be /system/apps/Workspaces + or /system/apps/Workspaces -
Edit: You’re probably talking about arrow up/down. I forget about that because I use a single row of workspaces
Well, I can’t find any existing way to get the current workspace from the command line so I guess it’s time to dust off the C++.
I haven’t written in C++ pretty much at all since I moved off BeOS.
I’ve got a console app put together that can give me that info now, so once I’m sure it’s legit I’ll go look up the source to the workspaces app and see about putting together a patch or PR to add that info to its output.
We usually avoid overloading gui apps with cli stuff, instead adding this to proper cli commands. maybe screenmode is a better candidate? It should probably already deal with this stuff
Well, I misunderstood what “message” as a command line tool would be doing.
I’ve been away from BeOS for a loooong time.
If I wanted to publish something that other folks with the same need could use from the command line then it’d probably be best to approach it as a standalone command line tool for interacting with the workspaces.
Well, screenmode probably already needs this functionality since you can set per-workspace resolution. I don’t know how much is exposed right now, but barring making a new cli tool (which is probably ok too) It looks like the right place to me
screenmode doesn’t seem to have any workspaces-related arguments at the moment:
~/scripts> screenmode --help
Usage: screenmode [options] <mode>
Sets the specified screen mode. When no screen mode has been chosen,
the current one is printed. <mode> takes the form: <width> <height>
<depth> <refresh-rate>, or <width>x<height>, etc.
--fall-back changes to the standard fallback mode, and displays a
notification requester.
-s --short when no mode is given the current screen mode or
the screen brightness is printed in short form.
-l --list display a list of the available modes.
-q --dont-confirm do not confirm the mode after setting it.
-b --brightness f set brightness (range 0 to 1).
-b --brightness +/-f change brightness by given amount.
-B --get-brightness print the current brightness to stdout.
instead of the screen mode
-m --modeline accept and print X-style modeline modes:
<pclk> <h-display> <h-sync-start> <h-sync-end> <h-total>
<v-disp> <v-sync-start> <v-sync-end> <v-total> [flags] [depth]
(supported flags are: +/-HSync, +/-VSync, Interlace)
I defer to your experience, but to me it seems better not to try to merge workspaces-related stuff into that.
But I’ve got a command-line C++ app put together than can output the current workspace, number of rows and total number of workspaces, switch to a workspace by number, switch left or right in the linear sequence of workspaces and switch up or down a row in the grid of workspaces.
And using the Shortcuts preferences, I can do all that with CTRL-[whatever] so I have it exactly as I wanted it. Yay!
I need to build a VM to host a Forgejo, but once I’ve done that I’ll bundle this up and PR it to haikuports.
(If you want it before then, PM me and I’ll email you the project directory.)
I used Genio to throw it together, which worked pretty well.
Well, since I referred to the source for screenmode a bit while putting workspacesctl together meeting the coding style guideline doesn’t look too difficult.
I did use a global variable, so I should probably try to figure out a way to get that from main() into the BeApp object without being global.
OK, I tidied things up a bit and got rid of the global variable by re-learning how to do instance variables on a class.
I also added some functionality, so it can now go:
plus and minus by workspace number
left and right on a row
up and down in a column
directly to a workspace by number
Plus/minus, left/right and up/down also cycle correctly within their sets (i.e. going right from the rightmost column will put you in the leftmost column on the same row, etc.).
I have no idea how to integrate a new app into the Haiku build system, but I think I can figure out how to do a PR for adding the source file to the correct part of the repo.
Given that Workspaces already handles switching to a workspace by calling it with an argument and behaves as a CLI app when doing so, I don’t find it unreasonable to add left, right, up and down (or something like that) to the accepted ones on top of the number and + and -.