A friend mentioned their cats were pretty good at opening their interior sliding door. They described how a flip-down retainer could probably keep it in position. What I came up with was a slim assembly that can stay out of the way until you want to use it, with a fingercatch and some bumps and detents to retain it in a stowed position when not in use.
It's quite rugged, even made with PLA - although I wouldn't suggest it as a security apparatus. I realized it could also be used as a flip-down coat hook, so have made a couple of small adjustments which I'll load into Thingiverse as a remix of this version.
The 'small' version of this device only needs 10mm of clearance from the wall. The 'large' version is 40% bigger, so would need 14mm.
A #6 screw will work well in the small version, whereas a #8 (or maybe even a #10) would work with the larger one.
It's pretty chunky so variations in resolution and infill should be well accepted. It was designed so that no supports are required
Just a little clean up of the edges with a file or sandpaper will help it to work well.
Load the latch piece in from the back. When screwed to your wall or baseboard, the latch is well retained. (use a hollow-wall anchor if you're mounting on drywall of course.
Multiple opens and closings before mounting makes the operation smoother. Particularly for the large ones, you can lightly sand the bumps on the latch if you want it to snap into stowed mode a little easier, but it doesn't appear to be necessary.