geany-osx icon indicating copy to clipboard operation
geany-osx copied to clipboard

Open dialog enter file path text

Open JanAxelsson opened this issue 5 years ago • 18 comments

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

JanAxelsson avatar Oct 21 '19 18:10 JanAxelsson

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

techee avatar Oct 21 '19 20:10 techee

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" () };
}

JanAxelsson avatar Oct 21 '19 20:10 JanAxelsson

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.

techee avatar Oct 22 '19 17:10 techee

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 [email protected]:

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.

JanAxelsson avatar Oct 22 '19 19:10 JanAxelsson

@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?

elextr avatar Oct 22 '19 22:10 elextr

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 [email protected]:

@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.

JanAxelsson avatar Oct 22 '19 22:10 JanAxelsson

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.

elextr avatar Oct 22 '19 23:10 elextr

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.

JanAxelsson avatar Oct 23 '19 15:10 JanAxelsson

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.

techee avatar Oct 23 '19 17:10 techee

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

zainengineer avatar Mar 11 '24 01:03 zainengineer

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

pragma-git avatar Mar 11 '24 06:03 pragma-git

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.

elextr avatar Mar 11 '24 07:03 elextr

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.

pragma-git avatar Mar 11 '24 13:03 pragma-git

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.

elextr avatar Mar 11 '24 19:03 elextr

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.

techee avatar Mar 11 '24 19:03 techee

(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 ;-)

elextr avatar Mar 11 '24 20:03 elextr

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.

eht16 avatar Mar 17 '24 17:03 eht16

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

techee avatar Jun 12 '24 12:06 techee