• 0 Posts
  • 2 Comments
Joined 5 years ago
cake
Cake day: June 7th, 2020

help-circle
  • rxxrc@lemmy.mltoLinux@lemmy.mlhook sh script to libnotify
    link
    fedilink
    English
    arrow-up
    8
    ·
    edit-2
    8 days ago

    Libnotify backends are D-Bus services, which isn’t really something you’d want to implement in a shell script. Going by some source code I just found, it looks pretty straightforward to do in Python, so that’s one option.

    The easier option would be to use an existing notification daemon that lets you disable the default GUI and specify a script to run as a hook, but I don’t actually know of any like that.


  • I’m on Wayland these days, but if you happen to be using X11 this is the homebrew solution I used to use:

    xdotool type --delay 50 "$(xclip -o -sel c)"
    

    The --delay argument specifies the delay in milliseconds between keystrokes; if you go too low on that it tends to break things.

    Interested to see what solrize comes up with because this method definitely has drawbacks – no way to interrupt it and if you accidentally paste something large it takes a long time to finish due to the forced delays.

    I’ve never really had the need for a Wayland version, but I don’t see why subbing ydotool for xdotool and wl-paste for xclip wouldn’t work.