Gnome 2デスクトップで現在アクティブな(選択された)ウィンドウ情報を取得するには、ソリューションが必要です。私が最も興味を持っているのは、ウィンドウを実行するプロセスとウィンドウのタイトルです。
可能ですか?
解決策:
ウィンドウタイトルのインポート:
xwininfo -root -children | grep $(printf '%x\n' $(xdotool getwindowfocus)) | grep -oEi '"[^"]+"' | head -1
プロセス名を入手してください。
ps -e | grep $(xdotool getwindowpid $(xdotool getwindowfocus)) | grep -v grep | awk '{print $4}'
または:
cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm
ベストアンサー1
それは簡単です:
xdotool getactivewindow getwindowname
幸運を祈り、それがあなたに効果があることを願っています!