Wednesday, May 8, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 2661  / 3 Years ago, thu, may 20, 2021, 2:57:55

As far as I know the below line of code should pull into focus the open nautilus window



xdotool windowactivate `xdotool search --onlyvisible --class nautilus`


But I am getting the error




xdotool: Unknown command: 21043361



More From » command-line

 Answers
7

I think what's happening is that the inner xdotool command is reporting multiple window IDs. So the outer command sees something like xdotool windowactivate 12345678 21043361 and doesn't know what to make of the second number.



If you don't mind which open Nautilus window you activate, you can select the first one:



xdotool windowactivate $(xdotool search --onlyvisible --class nautilus | head -n 1)


If you do mind, you might want to select further with --title or --maxdepth.



To exclude the root window, which is provided by Nautilus, this should work:



xdotool windowactivate $(xdotool search --onlyvisible --class nautilus |
grep -vxF $(xwininfo -int -size -root |
sed -n 's/.*Window id: *([0-9]+).*/1/p') |
head -n 1)

[#34583] Friday, May 21, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rmodmi

Total Points: 390
Total Questions: 122
Total Answers: 111

Location: Venezuela
Member since Mon, Oct 18, 2021
3 Years ago
;