Sometimes we don't want the sidebar on at all the times, thus it'd great if we can have a shortcut which can toggle it.
Ideally, I'd request that items in the menu bar have a shortcut. (line wrapping, going to next tab).
I searched through the keyboard shortcuts but couldn't find it. If they are indeed present, it'd be great to display them in the menu bar itself, it is immensely helpful.
Thank you!
Look in menu->edit->preferences->keybindings under the View group, there is a "toggle sidebar" keybinding. It is not bound by default, but you can set it as you require.
I am sorry, I read it thrice yet somehow I missed. How about switching tabs?
See the Notebook group in the same dialog, <primary>-page-up <primary>-page-down
there are no page-up buttons in mac :(
So re-define the bindings to whatever you want.
Can we make the bindings to alt+tab? so that tab switch would work across all platforms?
Because otherwise every Mac geany is installed on would have to modify the key binding.
Unfortunately that would change the binding for every other user, instead somebody could provide a PR to change the binding on OSX only using `#ifdef`s, see `keybindings.c`
I will send a PR as soon as possible!
Can we make the bindings to alt+tab?
Definitely not <kbd>Alt+Tab</kbd>: it's the common shortcut for switching applications and/or windows, both on Linux desktops and Windows.
Inserting a specific keybinding might (?) be best in a bundle defaults? @techee may have an opinion on the MacOS part
Sublime Text and Firefox on my Macbook use <kbd>Ctrl</kbd>+<kbd>Tab</kbd> (similar to Geany's keybinding to switch tabs in random/MRU order), and <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> for going backwards. Would probably be a useful Mac-specific default for people using the crippled built-in laptop keyboards.
@codebrainz @b4n
Can we have Mac specific bindings so that it doesn't affect other OSes? For eg, alt+tab = switch between tabs for macOS, super+tab = switch between windows
of course, we can't have alt+tab for windows/linux, because that is their primary window switching shortcut.
Ctrl+Tab doesn't switch between tabs for me, I might have changed it, I am not sure because I have changed a lot of shortcuts.
Also, I haven't been able to find out how to do this, "select till the end of line", I was able to find select till the start of the line.
My main problem is that the Mac shortcuts don't feel native to Mac, native to Mac as in what is generally used shortcut for Mac.
As I said above, the default binding could be changed by wrapping the appropriate definition in `#ifdef __APPLE__`. There are already a couple of these in keybindings.h/c. Unless @techee has a better idea?
Yes, I'll be sending a PR shortly, before that, let's agree upon the shortcuts which you'll allow into the product.
Ahh, that probably needs to be commented on by @techee he is the manitainer of the OSX build.
Inserting a specific keybinding might (?) be best in a bundle defaults? @techee may have an opinion on the MacOS part
Is there anything like a global keybindings file that could be placed to a bundle and to which the settings would fall back? Maybe I miss something but the only `keybindings.conf` I see in the code is inside configdir and this one has to be created by Geany.
Note that unlike Windows there is no real installer executable that could possibly create the file - the dmg file is a disk image (something like iso) which gets mounted when double-clicked which contains the app bundle (simple directory with an app extension) which the user drags-and-drops to the destination Applications directory where other apps live.
I think this leaves the `#ifdef` as the only solution.
@techee sadly the defaults are defined [here](https://github.com/geany/geany/blob/master/src/keybindings.c#L330) not in a convenient file. Thats why I suggest `#ifdef`.
@techee you could distribute a `keybindings.conf` file with the platform-specific shortcuts. IIRC you already have a shell script that launches the Geany executable, maybe you could add a line like:
```bash if [ ! -f ~/.config/geany/keybindings.conf ] then cp theBundle/wherever/keybindings.conf ~/.config/geany/ fi ```
@techee you could distribute a keybindings.conf file with the platform-specific shortcuts.
You would have to modify Geany to use that distributed copy as the default when it creates a new config directory. IIUC currently it writes out defaults stored in the code.
You would have to modify Geany to use that distributed copy as the default when it creates a new config directory. IIUC currently it writes out defaults stored in the code.
Unless Geany is broken, it won't clobber the user's custom `keybindings.conf` file with hard-coded defaults, so if the MacOS launcher script puts some platform-specific `keybindings.conf` file in the user's config directory if it doesn't yet exist, Geany won't clobber it and instead use it as the defaults.
When it creates a NEW config directory, like `-c non-existant`.
Most people on MacOS will use not launch Geany from the command line, and if they do, they will be knowledgeable enough to figure out how to pass the proper command line arguments.
Yes, but if they do figure out `-c xxx` it will do the wrong thing, giving them lindows shortcuts.
They won't, it requires some obscure command like:
```bash /Users/me/Applications/Geany.app/some/subdirs/bin/geany -c XXX ```
Such kind of users will figure out copying a `keybindings.conf` file or customizing shortcuts via the GUI. If a simple hack can work for 99% of users, it's worthwhile until a proper fix.
Well, if @techee agrees that all OSX users are dumb enough that its not a problem (apologies to the OP) then he can do that, though a couple of `#ifdefs` isn't an issue either. Whoever makes the PR first :)
Well, if @techee agrees that all OSX users are dumb enough that its not a problem
It's not to do with dumb, but rather with likely uses. If you install the Geany on OSX it gives an Application you can launch with GUI. If you like to use from the command line, you probably want to make an alias like `alias geany=/Applications/Geany.app/bleh/bin/geany`. If you got this far, you probably can copy a .ini file or re-configure favourite keyboard shortcuts, you are the 1%.
@elextr I do not think anyone would start geany from the terminal, so even if we are dumb enough not to understand how to run a specialized way, there is no point :smile:.
@codebrainz Rather than throwing in a patch, I'd rather wait for the solution, just avoids the technical debt. I mean Geany is just an outstanding IDE, I'd rather wait patiently for another month to get the fix than ruin the IDE.
@thewhitetulip don't worry patches don't get committed without being checked, and in the case of OSX specific ones, not until @techee who does the OSX builds agrees too :)
@elextr I know! My general opinion is that we completely fix the underlying problem rather than just gluing the code :-)
I'd be willing to make a PR if you wish, just tag me in the conversation.
Also, a lot of shortcuts aren't Mac friendly. I mean tab control in Mac is done by alt+tab, window switching is command+tab. This goes contrary to other platforms, if @techee agrees, we can fix that as well. I wasn't able to figure out the shortcut to "select from cursor location to the end of line", I was able to find, "select from cursor location to the start of line"
The select to start/end of line are `<shift>-<home>` and `<shift>-<end>` and they are provided by the underlying editing widget, not by Geany, so they don't appear in the bindings list.
that's the issue, `home` and `end` are _not_ available on a mac keyboard! we use shift+cmd+ -> or <- on Mac for selecting to start or end of line
Ok, well that requires rather more than just a `keybindings.conf` or `#ifdef`. It needs code to add the actions to Geany so they can be bound, then you can set the default, not a lot of code but somebody has to do it.
I am ready to write the code, just the thing is, I haven't really used C much apart from the simple simple things we did in college. let's wait for @techee to reply, then probably we can decide what exactly needs to be done and I can start.
A platform-specific `keybindings.conf` would work fine.
A platform-specific keybindings.conf would work fine.
How does that change Scintilla bindings?
How does that change Scintilla bindings?
If it doesn't, keybindings are broken in Geany.
keybindings are broken in Geany.
But the keybindings for select to end of line are in scintilla, not in geany.
But the keybindings for select to end of line are in scintilla, not in geany.
If they aren't saved and user-overridable, then they are broken.
If they aren't saved and user-overridable, then they are broken.
Yes, ok, they are broken in that they are not in Geany and can't be overridden, so that needs code, not just a `keybindings.conf` which is what I said above.
Yes, ok, they are broken in that they are not in Geany and can't be overridden, so that needs code, not just a keybindings.conf which is what I said above.
Since the ones in the OP are not a hard-coded Scintilla shortcuts, I don't see why it matters.
RTFT, the conversation has moved on from those to "select to end of line" which is a scintilla only one AFAICT.
For user-overridable shortcuts stored in `keybindings.conf` the MacOS bundle providing a default user file should work fine.
Sure, thats already been agreed above if @techee wants to do it that way.
Then I don't understand why it's being challenged or considered not a suitable fix. It's the cleanest way to override the hard-coded defaults on a per-platform basis.
Is there anything like a global keybindings file that could be placed to a bundle and to which the settings would fall back? Maybe I miss something but the only `keybindings.conf` I see in the code is inside configdir and this one has to be created by Geany.
Hum, if we don't indeed, it might be worth considering adding support for that as I wouldn't expect this to be too hard, instead of `#ifdef`ing half of the keybindings.
Or consider @codebrainz's solution if we accept it's not something Geany itself does but that is left to the bundle.
BTW, there's an interesting question regarding backward compatibility: if we install different defaults, keybindings might change for existing users if they didn't override any keybinding. That might be a problem -- or not?
BTW, there's an interesting question regarding backward compatibility: if we install different defaults, keybindings might change for existing users if they didn't override any keybinding. That might be a problem -- or not?
Indeed, but only for OSX users who have not already set bindings the way they want them, OTOH unless an upgrade is going to overwrite an existing keybindings.conf the new OSX friendly bindings will never arrive for any existing users. YMMV
Of course the manual will have to be updated to note the OSX specific keybindings too.
@elextr Can we upgrade geany? I didn't find a way to do that!
Can we upgrade geany?
Not sure what you mean.
When I install geany, does geany provide me a way to upgrade the app from the menu? Visual Studio Code and many other software's allow the user to upgrade the app without having to uninstall the app and reinstall the new version. I wasn't able to find the "upgrade" function in Geany.
@thewhitetulip Geany is a C language program, it must be compiled for specific target systems and the Geany project itself does not provide those binaries as part of the project (except for Windows for historical reasons) so, Geany cannot upgrade itself because it does not know where the binaries to do that are. VS Code is Javascript and does not need to be compiled so it can load itself anywhere.
Also note, github issues are specific issues, please keep them on topic and ask random questions like this on the Geany mailing list.
Sorry for the delay, I've been extremely busy in the last month, should be better now.
The idea of @codebrainz should be possible - `/Applications/Geany.app/Contents/MacOS/geany` is the wrapper script that sets up environment variables so the actual Geany binary (`/Applications/Geany.app/Contents/MacOS/geany-bin`) can find GTK libraries. You always run the script, even from command line - running the binary directly wouldn't work as the GTK libraries wouldn't be found. So it should be possible to add something to the launcher script and have it executed always.
That said I find this manual copying-over the config file a bit scary and fragile (one has to make sure the directory exists, that we don't overwrite existing file, etc.). Also this will only work for Geany's bundle - not Geany built independently and distributed e.g. using Homebrew.
I would rather prefer something like @b4n suggests, i.e. adding support into Geany for loading some global platform-specific keybinding file.
The way it works now is that these two functions are called:
``` keybindings_init(); //loads default keybindings from code keybindings_load_keyfile(); //overrides the keybindings by the ones from the config file ```
When the custom keybinding file is saved, it saves all keybindings so the next time the above functions are run, it basically behaves as if only `keybindings_load_keyfile()` was called (unless theres a new version of Geany with new keybindings which will be added to the custom keybinding file).
What I would suggest (in principle) is to add one more function between these two:
``` keybindings_load_global_keyfile(); //overrides the keybindings by the ones from the GLOBAL config file ```
This would mean that keybindings would still be initialized by `keybindings_init()` and only the ones which need to be overridden would be placed into the global config file. Also custom keybindings would be preserved because after this function is called `keybindings_load_keyfile()` would be called which would override it with custom keybindings. I think it's better this way to avoid surprises that keybindings have changed. Users who would like to switch to the new Mac keybindings would have to delete their custom keybindings.conf first though.
Should be quite easy to implement.
What do you think?
Unless it has side effects I didn't think about, I'm all for builtin support for loading a system *keybindings.conf*.
If we have a system `keybindings.conf`, why leave the defaults in `keybindings_init()` ?
Well yeah we could have 'em all there as we depends on installed stuff anyway. But that would be trickier to add override for the issue at hand though. So… dunno what's best.
One disadvantage of the config-file-only approach is there's no type check at all and if you misspell some key name, the keybinding will be wrong (or probably unset, I don't know what GTK will do about this). So maybe for the "master" defaults it's better to have them in the code with at least some basic type-checking.
I'll try to prepare a patch - but @thewhitetulip I'd ask you to prepare the file with the keybinding overrides for Mac (for the keybindings I use I'm more or less fine with the way it is).
@b4n why would it be trickier? Jiri just replaces the default system keybindings.conf with the OSX one? Or have I misunderstood his proposal?
@techee misspelled entries will be ignored IIUC. If Geany uses a file for the defaults I would have thought it would be easier for you to keep another file up to date, rather than having to compare your file to the code.
@elextr yeah, but that means he'd have to maintain his own version and update it as ours changes.
@b4n, yes, whereas with the defaults in the code he has to still maintain his own version, albeit only the differences, by comparing it to changes in the code, not another file of the same format. Dunno which is easier, YMMV, though certainly leaving the defaults in code approach has less immediate changes.
I created a pull request here https://github.com/geany/geany/pull/1395 which adds basic support to enable platform-specific keybinding overrides.
I didn't create the configuration with overrides though, for what I use I'm fine with the default ones. @thewhitetulip if you are still interested in this feature, please create a patch which updates the keybindings_osx.conf file.
@techee I am sorry, I switched to vim.
@thewhitetulip We all hate you! ;-)
@techee I'll update the conf file, do you want a new PR?
@thewhitetulip That would be great! But don't worry too much if it takes you too much time and if you don't use Geany anyway.
It depends on what @b4n and others think about #1395 - e.g. the filename can change etc. But for now you could for example just write a comment #1395 and paste the keybindings that should change there.
Probably the easiest way will be to update the keybindings in Geany UI, then open ~/.config/geany/keybindings.conf and copy-out the changed ones.
@techee It is not that I don't use geany, but my primary coding editor is Vi :-)
Let's finalize the shortcuts! If I were to give a PR I would give shortcuts as I'd like
Let's finalize the shortcuts! If I were to give a PR I would give shortcuts as I'd like
Good, but it shouldn't be something non-standard but rather something that other editors use too.
something that other editors use too.
Something other **normal** editors use, vi and emacs don't count :smile:
Closing since the original problem has already been resolved and the tangential discussion resulted in #1395 where further discussion can continue.
Closed #1324.
github-comments@lists.geany.org