How can I to switch function keys, without using the Logitech Software on a Logitech K400 Plus?

On a Logitch K400 Plus keyboard, the F1-12 keys don’t work as regular F-keys by default, but as multimedia keys. To use the F-keys, you need to press FN. Installing the Logitech Software is a solution, but it comes with 500MB of bloatware. Uninstalling is not an option because the keyboard layout reverts to its default state, with the media keys as default.

The solution I’m looking for is a solution that does not need to be repeated on every new device I connect to. Alternatively device-specific solution for Windows (Win 11), Linux (Debian, Ubuntu, RHEL, ARCH) and MAC) which I don’t know yet (see below). I would prefer not to use 3rd-party software, but if necessary, it should be lightweight.

Those solutions are already known to me: