Make a bone head movable within the armature
I'm not sure a full mechanical solution with rigging is possible, with Blender being primarily a modeller/animator.  A game engine might be better suited to this.
If it's only for video however, the simplest way would be to rotate the green strip and have the grey strip looking at the bolt screwed into the green.  i.e. Give the grey a &quot;Track to&quot; constraint.  Set the target as the bolt.

Addendum:  7th Feb 2021
Should the green strip be attached to a hinged window, then it would be the same constraint on the grey strip but the green strip would not be animated, instead, be carried in an arc by the window frame.