Skip to content

Instantly share code, notes, and snippets.

@dewomser
Last active May 31, 2024 07:12
Show Gist options
  • Save dewomser/fd5dcc3f8fdd90aec93c3aa212496a17 to your computer and use it in GitHub Desktop.
Save dewomser/fd5dcc3f8fdd90aec93c3aa212496a17 to your computer and use it in GitHub Desktop.
URL aus aktueller Firefoxanzeige auslesen Wayland, KDE, BASH
Progrmme werden benötigt:
kdotool
ydotool + ydotoold
wl-clipboard
Das ganze ist sehr buggy, besonders der ydotool-server
-------
Vorbereitung
window_id=$(kdotool search --class "firefox")
kdotool windowactivate $window_id
ydotool immer mit Server ! (rumgebastel)
sudo /home/foo/.local/bin/ydotoold -p /run/user/1000/.ydotool_socket -P 0777
Test:
ydotool key 42:1 38:1 38:0 24:1 24:0 38:1 38:0 42:0
Ergibt LOL
-------------
Parameter für die Tasten-Shortcuts
soll werden :
CTRL+l CTRL+c Escape
keycode gibts hier:
cat /usr/include/linux/input-event-codes.h |grep (irgendwas z.B)CTRL
#define KEY_LEFTCTRL 29
#define KEY_ESC 1
#define KEY_L 38
#define KEY_C 46
ist das:
ydotool key 29:1 38:1 38:0 29:0 29:1 46:1 46:0 29:0 1:1 1:0
-----------------------
Erst den Server starten, Gucken ob er evtl schon PID hat. Dann nicht.
sudo /home/karl/.local/bin/ydotoold -p /run/user/1000/.ydotool_socket -P 0777
------------------
danach (das kann auch als Skript):
window_id=$(kdotool search --class "firefox")
kdotool windowactivate $window_id
ydotool key 29:1 38:1 38:0 29:0 29:1 46:1 46:0 29:0 1:1 1:0
a=$"wl-paste"
echo$a
#!/usr/bin/bash
startyd="sudo /home/foo/.local/bin/ydotoold -p /run/user/1000/.ydotool_socket -P 0777"
if ! pgrep -x "ydotoold" > /dev/null; then konsole --new-tab -e $startyd
fi
echo "$startyd"
window_id=$(kdotool search --class "firefox")
echo "$window_id"
kdotool windowactivate "$window_id"
ydotool key 29:1 38:1 38:0 29:0 29:1 46:1 46:0 29:0 01:1 01:0
wl-paste > url.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment