geany / geany-osx

Things needed to bundle Geany for OSX
Other
24 stars 14 forks source link

Open dialog enter file path text #14

Open JanAxelsson opened 4 years ago

JanAxelsson commented 4 years ago

Previously the file path could be pasted in a file dialog.

With the new nice-looking OSX file dialog in Geany 1.36, this feature is no longer there. Standard behavior in OSX is "Command-Shift G" to bring up the path dialog. It would be super great if this expected OSX behavior was implemented also in Geany

techee commented 4 years ago

This is the standard GTK3 file open dialog (which is a little stupid) so we can't change much (the previous one was GTK2). However, you can press Command+L and it will show an entry where you can paste arbitrary path. See e.g.

https://forums.linuxmint.com/viewtopic.php?t=272123

JanAxelsson commented 4 years ago

I have a feeling, correct me if wrong, that the intention is that it should be standard Mac Command-Shift-G. See /Applications/Geany.app/Contents/Resources/share/themes/Mac/gtk-3.0/gtk-keys.css

In that file, the following section appears twice, but is not honored when Geany is executed :


@binding-set gtk-mac-file-chooser
{
  bind "<meta>v" { "location-popup-on-paste" () };
  unbind "<ctrl>v";

  bind "<meta><shift>G" { "location-popup" () };
  bind "<meta><shift>H" { "home-folder" () };
  bind "<meta>Up" { "up-folder" () };
}
techee commented 4 years ago

Well, no idea what might be wrong. I tried setting gtk-key-theme-name=Mac inside .config/gtk-3.0/settings.ini but it didn't help. We do some magic in geany in order to make keybindings work so maybe it's affected by this in some way.

JanAxelsson commented 4 years ago

Well, I keep my fingers crossed that you or someone else gives it an attempt. Would be very much appreciated for my limited brain not to have to learn new shortcuts for Geany too. :-). I am sorry that I don’t have the capability to do this myself.

/Jan

22 okt. 2019 kl. 19:49 skrev Jiří Techet notifications@github.com:

Well, no idea what might be wrong. I tried setting gtk-key-theme-name=Mac inside .config/gtk-3.0/settings.ini but it didn't help. We do some magic in geany in order to make keybindings work so maybe it's affected by this in some way.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geany/geany-osx/issues/14?email_source=notifications&email_token=AG7S4VSAE4LBGK6CUU75U3LQP44K5A5CNFSM4JDC3T52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB6TUWI#issuecomment-545077849, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7S4VRBELYLTT6RZKOKUTLQP44K5ANCNFSM4JDC3T5Q.

elextr commented 4 years ago

@techee I doubt its anything to do with Geany if its for the GTK open dialog since we don't see any keys until the dialog finishes.

Just asking a dumb question, whats the "gtk-mac-file-chooser" that the bindings are set on? And are you using it?

JanAxelsson commented 4 years ago

I do not quite understand the under the hood bit. However, my impression is that the defined binding makes the GTK3 file-chooser widget do its magic without Geany being involved. Until the widget is released. I assume somehow the binding of the keys needs to be injected from Geany, though.

This gtk-mac-file-chooser is nothing I have invented, but seems to come from GTK. I believe this can be bound to the File chooser, but how that is done is way over my horizon. I don’t know if this might be useful, but this seems related to the binding in a file-chooser : "https://developer.gnome.org/gtk3/stable/GtkFileChooserWidget.html https://stackoverflow.com/questions/30487963/gtk3-keys-bindings-in-css-files"

/Jan

23 okt. 2019 kl. 00:15 skrev elextr notifications@github.com:

@techee https://github.com/techee I doubt its anything to do with Geany if its for the GTK open dialog since we don't see any keys until the dialog finishes.

Just asking a dumb question, whats the "gtk-mac-file-chooser" that the bindings are set on? And are you using it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geany/geany-osx/issues/14?email_source=notifications&email_token=AG7S4VXSGVFIMRRLFJZOAGLQP53PZA5CNFSM4JDC3T52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB7MNHA#issuecomment-545179292, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7S4VT4Y55RXNA2X55BSZLQP53PZANCNFSM4JDC3T5Q.

elextr commented 4 years ago

I assume somehow the binding of the keys needs to be injected from Geany, though.

No, GTK loads them from the standard places itself (I'm assuming the location you pasted above is one).

This gtk-mac-file-chooser is nothing I have invented, but seems to come from GTK.

Well, my googling can't find it, thats why I asked, but the question was directed to @techee who might.

JanAxelsson commented 4 years ago

With the understanding you gave, and playing around with shifting locations of gtk-keys.css, I am sure this file is not used. Could there be some issues in the launcher scripts and the environmental variables set for GTK ? The settings.ini I manage to change, so it that path is apparently honored both in the .config and in the geany.app.

techee commented 4 years ago

I'm pretty sure the file is used, the keybindings just don't work for the open file dialog for some reason. For instance, try to open the Find dialog in Geany and type several words to the entry. Now you can use Alt+left/right arrow to navigate one word to the left/right. When you completely delete the contents of the css, this won't work any more. In my opinion it's some GTK issue.

zainengineer commented 6 months ago

You can simply use Control + L and it will show GTK's input for File Path

pragma-git commented 6 months ago

I know. The issue is that it breaks mac standard key combinations

elextr commented 6 months ago

I know. The issue is that it breaks mac standard key combinations

Yes, its a Linux binding, if "somebody" contributed Macos standard rebindings in a PR they can probably be included.

The only actual CSS posted was 5 years ago but its missing the -gtk-key-bindings setting for filechooser that associates the bindings with the filechooser, see here which might be why its doesn't work.

pragma-git commented 6 months ago

I think a bigger issue is that native file dialogs are not used.

One of the problems following that, is the problem reported in this issue. Another problem is that none of the favourite folders, OneDrive and other cloud drives, etc are visible in the dialogs. The user not only have to learn new keyboard shortcuts, he also has to go through the trouble to sync favourite folders between native and Geany file dialogs. It is not a deal breaker, but it feels "clunky" and old.

Don't know if it helps, but found these two links regarding native file dialogs as part of GTK: https://docs.gtk.org/gtk4/class.FileChooserNative.html https://gitlab.gnome.org/GNOME/gimp/-/issues/1830

I wish I understood how to implement this myself, but I don't. Have tried the css files, but they don't seem to pick up when Geany starts.

elextr commented 6 months ago

Did you notice that the file chooser native has two problems:

  1. its GTK4, not GTK3 which is used by Geany
  2. its deprecated

Geany used to have support for native windows dialogs but it was removed as it caused crashes in some situations and nobody supported it.

Its a moot point if Geany "should" use native dialogs, its not a native application, it is a GTK application. Whether GTK itself makes its dialogs and its keybindings more native on various platforms, thats something that needs to be taken up with GTK.

techee commented 6 months ago

its GTK4, not GTK3 which is used by Geany

It's GTK3, it's only deprecated in GTK4 (there's some other class for it in GTK4).

Native dialogs would definitely be nice and if FileChooserNative works, it might be a way to go. I'll try to have a look at it if it would require many changes in Geany to migrate to this class.

elextr commented 6 months ago

(there's some other class for it in GTK4)

I had a quick look and the alternative listed GTKFileDialog says nothing about native dialogs.

I'll try to have a look at it if it would require many changes in Geany to migrate to this class.

It would need to be optional, but I think the checkbox from the windows native dialogs is still in Glade unless @eht16 got around to removing it ;-)

eht16 commented 6 months ago

I'll try to have a look at it if it would require many changes in Geany to migrate to this class.

It would need to be optional

Why would it need to be optional? If it works well on relevant platforms and do not introduce too much restrictions, why not use it completely?

but I think the checkbox from the windows native dialogs is still in Glade unless @eht16 got around to removing it ;-)

thanks for the reminder :D.

techee commented 3 months ago

Native dialog support has been implemented in https://github.com/geany/geany/pull/3861 and it will be included in the next release.