when i run this script with a shortcut(sxhkd):
#!/bin/sh
MUSIC_DIR="$HOME/music"
songs=$(ls "$MUSIC_DIR")
filename=$( echo -e "random\n$songs" | dmenu -l 30 -i -p "Play >> ")
if [[ $filename = "random" ]]
then
filename=$(ls "$MUSIC_DIR" |shuf -n 1)
fi
if [[ -f "$MUSIC_DIR/$filename" ]]
then
notify-send -t 2500 "$filename is playing" && mpv "$MUSIC_DIR/$filename" --no-audio-display
else
notify-send -t 1500 "typo?"
fi
I want to open a terminal control mpv process on it ( get the mpv terminal interface ).
I have tried reptyr, but I'm getting this error.
~ λ reptyr $(pgrep mpv)
[-] Process 514610 (dmenuMusic) shares 514636's process group. Unable to attach.
(This most commonly means that 514636 has sub-processes).
Unable to attach to pid 514636: Invalid argument
also tried:
~ λ echo 0 | doas tee /proc/sys/kernel/yama/ptrace_scope
It just didn't work, gave me same error.
reptyr
. The process won't become a child of the new shell though.tmux
orscreen
?tmux
is fully scriptable. You have a shortcut that runs some script anyway. But I don't know what "script dmenuMusic" is and how it affects things. Anyway, I have just tested andreptyr
can do what you want to do, when the command is exactlympv song.mp3 & disown
. So I think your problem with it is because of dmenuMusic, whatever it is. I guess the question does not show us the actual command, i.e. it's not MCVE. And probably it's an XY problem. You want to controlmpv
, not necessarily to reown it.