Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Determine the clipboard command based on the session type
- if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
- clip_cmd="wl-paste --primary --no-newline"
- else
- clip_cmd="xclip -o"
- fi
- # Temporary file for clipboard content
- temp_file="/tmp/clip.txt"
- # Retrieve clipboard content and replace newlines with ,,,
- $clip_cmd | sed -z 's/\n/,,,/g' > "$temp_file"
- # Check if the temporary file was created successfully
- if [ ! -f "$temp_file" ]; then
- notify-send "Failed to retrieve clipboard content."
- exit 1
- fi
- # Read the temporary file, escape special characters, and pass to SpeechNote
- cat "$temp_file" | sed 's/[^a-zA-Z0-9]/\\&/g' | xargs flatpak run net.mkiol.SpeechNote --action start-reading-text --text
- # Clean up the temporary file
- rm "$temp_file"
Advertisement
Add Comment
Please, Sign In to add comment