Skip to content

Conversation

peternasser99
Copy link

@peternasser99 peternasser99 commented Sep 20, 2025

  • Introduced global variables to capture last key event (state, keysym, button)
  • Extended feh_printf to expand %K with the actual key pressed
  • Updated keyevents.c to assign globals before action handling
  • this so downstream actions could be branced on pressed key not be limited to 10 actions only

This PR introduces a new printf-style substitution %K that expands
to the key (or key combination) which triggered the action.

Motivation

Currently, feh actions can access file paths (%f, %F) and other
contextual info, but not the actual key used. This makes it harder
to write key-dependent custom scripts.

Changes

  • Added global vars in feh.h to store the last key event.
  • Updated keyevents.c to populate these vars in feh_event_handle_generic.
  • Extended feh_printf in slideshow.c to substitute %K with
    the triggering key sequence.
  • Verified %K expands correctly for simple keys and combinations.

Example usage

feh --action1 'echo "Pressed %K on %f"'

note:
most of this is llm generated for my use if any wants to have more actions than 10

- Introduced global variables to capture last key event (state, keysym, button)
- Extended feh_printf to expand %K with the actual key pressed
- Updated keyevents.c to assign globals before action handling
- this so downstream actions could be branced on pressed key not be limited to 10 actions only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant