I use Streamus to stream music from you tube. I want to know whether streamus can be started from terminal itself. I have asked this question in main software site and the author recommended to use xdotool for it. I have installed xdotool (sudo apt-get install xdotool
) and also able to successfully open the app.
I have mainly two problem
- Reloading the app
- Playing from the app
The problem is after the app opens it just shows blank screen. I have to use ctrl+r
to reload the app, to automate it i used xdotool. This is my script.
/usr/bin/chromium-browser --disable-gpu --enable-offline-auto-reload --enable-offline-auto-reload-visible-only --app=chrome-extension://jbnkffmindojffecdhbbmekbmkkfpmjd/foreground.html & xdotool key ctrl+r
But it seems xdotools is not working and its not reloading the app? And also can you help me with playing songs from the app.
Best Answer
TL;DR The script can not work because that shortcut will be sent to the active window, and that's not
chromium-browser
withStreamus
.This is your reload
xdotool
command:The complete command in your case is:
The execution of the shortcut can be somewhat delayed with
sleep 1
:This is your play/pause
xdotool
command:A sample script:
To start Streamus, reload and "press" play
Explanation:
xdotool search --limit 1 --name "^Streamus$"
search
Search for windows with titles, names, or classes with a regular expression pattern.
limit N
Stop searching after finding N matching windows. Specifying a limit will help speed up your search if you only want a few results.
--name
Match against the window name. This is the same string that is displayed in the window titlebar.
xargs -I {} xdotool windowactivate --sync {} key ctrl+r
xargs -I {}
Build and execute the command
xdotool
xdotool windowactivate --sync {} key ctrl+r
windowactivate
Activate the window.
sync
After sending the window activation, wait until the window is actually activated.
{}
xargs
replaces{}
with the window idkey ctrl+r
sends the shortcut Ctrl+R