[Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn button

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
doia
Posts: 21
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

[Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn button

Postby doia » Mon May 31, 2021 4:12 pm

Hi, I try to set some custom keyboard shortcuts and would like to set the deletion of objects to the Delete key. On Mac, the default Delete key is not recognized.

does not recognize Delete key
does not recognize Delete key
Bildschirmfoto 2021-05-31 um 17.55.41.png (167.5 KiB) Viewed 482 times

Only if pressed in combination with the Fn key. Could this be a bug?

accepts Delete key only in combination with Fn key
accepts Delete key only in combination with Fn key
Bildschirmfoto 2021-05-31 um 17.56.02.png (194.03 KiB) Viewed 482 times

I am using the ProDark theme, but the behavior is reproducible with no style sheet set as well.

OS: macOS 10.16
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git)
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
Last edited by doia on Wed Jun 02, 2021 1:04 pm, edited 2 times in total.
edwilliams16
Posts: 438
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: [Bug?] Mac keyboard Delete button is not recognized, only in combination with Fn button

Postby edwilliams16 » Mon May 31, 2021 9:16 pm

It is standard Mac keyboard mapping. Mac delete = PC backspace, Mac Fn-Delete = PC Delete https://support.apple.com/en-gb/HT201236
I thought ctrl-d might work for Fn-delete, but it doesn't seem to.
Full-size Mac external keyboards have a delete-right key.
doia
Posts: 21
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: [Bug?] Mac keyboard Delete button is not recognized, only in combination with Fn button

Postby doia » Tue Jun 01, 2021 7:44 am

edwilliams16 wrote: Mon May 31, 2021 9:16 pm It is standard Mac keyboard mapping. Mac delete = PC backspace, Mac Fn-Delete = PC Delete https://support.apple.com/en-gb/HT201236
Understood and correct.

But shouldn't I be able to set Mac Delete/PC Backspace as a valid single key for triggering the Delete action? Yet FC does not recognize this single key, just displays "none". I don't know if it is possible on a Linux/Windows system. Could you check, if you work on such a system?

The why: Just a personal preference/habit known from other software, e.g. Revit allows deleting an element by pressing the Mac Delete key.
chrisb
Posts: 35373
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug?] Mac keyboard Delete button is not recognized, only in combination with Fn button

Postby chrisb » Tue Jun 01, 2021 11:39 am

doia wrote: Tue Jun 01, 2021 7:44 am But shouldn't I be able to set Mac Delete/PC Backspace as a valid single key for triggering the Delete action? Yet FC does not recognize this single key, just displays "none". I don't know if it is possible on a Linux/Windows system. Could you check, if you work on such a system?
This is out of the scope of FreeCAD: you can freely configure the keyboard layout on MacOS with a keyboard layout XML file.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
doia
Posts: 21
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: [Bug?] Mac keyboard Delete button is not recognized, only in combination with Fn button

Postby doia » Wed Jun 02, 2021 1:03 pm

I don't think it has anything to do with keyboard layout definitions, as I will not change the layout (e.g. map the backspace key to the x key). Maybe I misstated my problem. The Mac Delete key is not recognized within the FC Tools->Customize->Keyboard screen.

The key is recognized in other screens or workbenches, as I can use Mac Delete within the Spreadsheet WB or in any other WB where I have to enter a value into a field. If pressed, the character left of the cursor gets deleted. Just as expected.

Other programs like Blender or Inkscape recognize the Mac Delete key for keyboard shortcut settings, without any change in keyboard layout XML files.
martin51
Posts: 58
Joined: Sun May 03, 2020 8:45 pm
Location: Irvine, California

Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu

Postby martin51 » Wed Jun 02, 2021 3:08 pm

Editing FreeCAD's user.cfg file to remap the delete key worked for me:

<FCParamGroup Name="Shortcut">
<FCText Name="Std_Delete">Backspace</FCText>
</FCParamGroup>
doia
Posts: 21
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu

Postby doia » Mon Jun 07, 2021 9:05 am

Thank you @martin51, that works. I can now delete elements with just pressing the Mac Delete key, e.g. deleting lines in the Sketcher WB.

So the bug is confirmed. FC on Mac can read and interpret the Mac Delete (aka Backspace) key without additionally pressing the FN key, if set manually in the Library/Preferences/Freecad/user.cfg file. But this key is not recognised within the FC Tools->Customize->Keyboard interface, which should be able use this key to set it in the user.cfg file.

I will file a bug in the tracker.
edwilliams16
Posts: 438
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu

Postby edwilliams16 » Mon Jun 07, 2021 6:47 pm

If anybody else wants to do this, note that FreeCAD cannot be open when you edit user.cfg or your changes will be over-written when FreeCAD closes.
doia
Posts: 21
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: [Bug] Mac keyboard Delete button is not recognized within Tools->Customize->Keyboard, only in combination with Fn bu

Postby doia » Mon Jun 07, 2021 6:50 pm

:lol: Yep, had to learn that too. Took me 3 attempts until I closed FC before editing user.cfg