Farlee Well I just made a basic plugin skeleton that demonstrates the principle. It's easy to adapt and upgrade according to your needs. Simply check if a node has the visible property when toggling.
@tool
extends EditorPlugin
func _input(event):
if event is InputEventKey and event.is_pressed() and event.keycode == KEY_H:
var e = get_editor_interface()
toggle_unselected_visibility(e.get_edited_scene_root(), e.get_selection().get_selected_nodes())
func toggle_unselected_visibility(node, selection):
if not node in selection:
if "visible" in node:
node.visible = not node.visible
for child in node.get_children():
toggle_unselected_visibility(child, selection)
Also toggling via the same hotkey probably isn't the best modality as it'd mess things up when you change the selection. But again, easy to change the logic to fit your particular workflow. As a homework, someone should make a version with 2 hotkeys; one for hiding and other for showing.