You are not logged in.
Pages: 1
I created a shell scripts to re-position termite window (running calcurse) to top right. If I run each line separately in terminal, it works flawlessly. But running it as a shell script does not produce the desired effect. Here is the script :
termite -e calcurse
WID=$(xdotool search --onlyvisible --name 'calcurse')
xdotool windowsize $WID 600 420
xdotool windowmove $WID 1320 0
Can anyone help?
Offline
Put in some logging of some sort. Perhaps check WID after the second command by echoing it to a file. Do you run those commands exactly like that and in that order from a terminal? I'd suspect the first one would need to be backgrounded.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Moved to Programming and Scripting.
Offline
Put in some logging of some sort. Perhaps check WID after the second command by echoing it to a file. Do you run those commands exactly like that and in that order from a terminal? I'd suspect the first one would need to be backgrounded.
I ran these commands exactly as above in the same order. I checked the WID, by echoing. If I run it as script it returns blank. If I run it manually, it is giving a windows id.
Second line of the program is not able to get the Windows Id if I run it as script.
Offline
I suspect it may take termite a moment to start up and/or properly set the name. As an initial test of this, I'd put a sleep command between launching termite and the second command.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I suspect it may take termite a moment to start up and/or properly set the name. As an initial test of this, I'd put a sleep command between launching termite and the second command.
I have put sleep 10 before the second line, but that is not giving desired result also.
Offline
Log the error output from xdotool:
xdotool search --onlyvisible --name 'calcurse' > ~/xdotool.out 2> ~/xdotool.err
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Exactly this (waiting for window to appear) is covered by the man page in the description of options for the search command. But if a 10 second sleep doesn't help, you might have another problem. Also, you can use command chaining (leaving ${args} as exercise for the reader):
xdotool search ${args} windowsize 600 420 windowmove 1320 0
Offline
termite -e calcurse
Termite stops executing script until exit. Execute termite in background with '&' at the end.
Last edited by dimich (2018-12-27 04:14:19)
Offline
Please edit the title of this thread to be something vaguely useful, as opposed to "Problem in script".
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Pages: 1