PIR to activate virtual keystroke

i want to switch this so that the activation is via a pir not shorting across pins.

What is your PIR doing? The ones I know are exactly doing that: closing a circuit over a relays. If you connect that to the pins it's shortening them.

For the function key use:

Keyboard.press(KEY_F1);
Keyboard.release(KEY_F1);