cockpit-project / cockpit-files

A Featureful File Browser for Cockpit (Modernized and tested version of https://github.com/45Drives/cockpit-navigator)
GNU Lesser General Public License v2.1
46 stars 25 forks source link

Keyboard shortcuts (general) #451

Closed garrett closed 2 days ago

garrett commented 4 months ago

In addition to an obvious keyboard shortcut for editing the bar, we should also have other shortcuts.

But we need to determine what they are, if we can use them, and so on.

To kick off the discussion, here's what Nautilus has:

image

image

image

I couldn't find it in KDE, but did find a list of some common ones in their docs @ https://docs.kde.org/stable5/en/khelpcenter/fundamentals/kbd.html#kbd-files (but it's not very detailed).

Dolphin itself (which is installable via Flathub, BTW) has a keyboard shortcut configuration dialog that has a ton of defaults.

image

image

garrett commented 4 months ago

In addition to having shortcuts: We'd probably want a way to show the keyboard shortcuts too.

I'd suggest an entry in the top-level menu that shows a modal that has a table with the action and the shortcut, more or less similar to Nautilus. It doesn't have to be as fancy.

When displaying it, we could use the <kbd> key like MDN shows: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd — I think we'd need to add CSS to make it look like a key if we wanted that, as it doesn't come by default and I think PF doesn't add that to the element.

garrett commented 4 months ago

Note: macOS generally uses a command key instead of a control key, so handling for macOS would probably need to be different from Linux and Windows.

We also probably want to consider which of the commands from Nautilus overlap with the functionality of Windows and macOS also. (I'd imagine GNOME folks already thought of that and are using the common shortcuts that are also in Windows and macOS.)

We could (and probably should) start small and expand the list of useful shortcuts.

garrett commented 3 months ago

Our keyboard shortcut reference modal would look something like this:

Keyboard shortcuts modal reference

Each section would have a header. There would be multiple groups per section, with related shortcuts (navigation would have arrow keys grouped). And then use that in a grid or definition list for a group.

We'd use something like this HTML for the keyboard shortcuts, with kbd:

<kbd class="shortcut"><kbd class="key">Ctrl</kbd> + <kbd class="key">A</kbd></kbd>

...which will probably need some special CSS to add a background color, border, and roundedness, to look like a key.

garrett commented 1 day ago

Congrats!

It needs a follow-up for Apple OS support (macOS, iPhone, iPad) for proper support there:

(I wrote some details with screenshots and provided some code at the bottom which can be used to solve the issue. It should be relatively straightforward to add. I can test on my ancient Mac, we can peek at a VM, and/or we can ask Matej or anyone else with a modern Mac to confirm it's fine.)