
현재 데스크탑에 아직 존재하지 않는 경우에만 새 터미널 창을 여는 키보드 단축키를 만들고 싶습니다. 그렇지 않으면 현재 존재하는 것이 중심이 될 것입니다. 방금 Fedora 24에서 Fedora 25로 업그레이드했습니다. 업그레이드하기 전에 다음 스크립트를 다음에 바인딩했습니다 ctrl-alt-t
.
desktop="$(xdotool get_desktop)" # Get number of current desktop
#Check if there is an open terminal on the current desktop.
output="$(xdotool search --onlyvisible --class --desktop $desktop gnome-terminal)"
if [[ -n "$output" ]]
then xdotool windowactivate $output #If there is, then move focus to it.
else gnome-terminal & #Otherwise, open a new terminal.
fi
그러나 업데이트로 인해 스크립트가 손상되어 더 이상 올바르게 작동하지 않는 것 같습니다. 기존 터미널이 있는지 여부에 관계없이 항상 새 터미널이 열립니다. 테스트로 이 라이너를 실행해 보았습니다 desktop="$(xdotool get_desktop)" && for i in $(xdotool search --desktop $desktop --class ".*"); do xdotool getwindowname $i; done
. 당연히 출력에는 기존 터미널 창의 이름이 포함되지 않습니다. 문제는 xdotool
Fedora 25에서 gnome-terminal이 더 이상 인식되지 않으므로 위 스크립트는 항상 새 터미널을 생성한다는 것입니다.
편집하다:
또한 xdotool getwindowfocus getwindowname
터미널에서 실행하면 다음이 반환됩니다.
xdo_get_focused_window_sane failed (code=1)
xdo_focus_window reported an error
따라서 xdotool은 더 이상 인식하지 못하는 것 같습니다.gnome-terminal