jpenguin

speak selection Linux

Jun 28th, 2025 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Determine the clipboard command based on the session type
  4. if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
  5. clip_cmd="wl-paste --primary --no-newline"
  6. else
  7. clip_cmd="xclip -rmlastnl -o"
  8. fi
  9.  
  10. # Retrieve clipboard content and replace newlines with ,,,
  11. clipboard_content=$($clip_cmd | sed -z 's/\n/,,,/g')
  12.  
  13. # Escape special characters and pass to SpeechNote
  14. echo "$clipboard_content" | sed 's/[^a-zA-Z0-9]/\\&/g' | xargs flatpak run net.mkiol.SpeechNote --action start-reading-text --text
  15.  
  16.  
Advertisement
Add Comment
Please, Sign In to add comment