Files
desktop-planer/dev/click.sh
2026-09-18 22:02:53 +02:00

15 lines
742 B
Bash
Executable File

#!/bin/bash
# Simuliert einen Klick in der nested Shell: dev/click.sh x y
# Ermittelt den Actor an der Position wie bei einem echten Klick (Picking) und löst den
# nächstliegenden St.Button aus. Gibt den getroffenen Actor aus.
DIR=$(cd "$(dirname "$0")" && pwd)
"$DIR/eval.sh" "const Clutter = imports.gi.Clutter, St = imports.gi.St;
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, $1, $2);
const hit = actor ? actor.constructor.name + ' [' + (actor.style_class ?? '') + ']' : 'nichts';
while (actor && !(actor instanceof St.Button))
actor = actor.get_parent();
if (actor)
actor.emit('clicked', 1);
hit + (actor ? ' -> clicked ' + actor.constructor.name + ' [' + actor.style_class + ']' : ' -> kein Button');
"