有没有办法在Ubuntu中只使用终端重新加载Google Chrome标签页?我不想只是打开一个新窗口,而是真正刷新一个选项卡!
额外问题:在其他浏览器中也是可能的,比如Opera火狐浏览器。
发布于 2017-03-22 01:12:26
一个liner,它将聚焦Chrome窗口,然后通过发送Control+r重新加载浏览器
xdotool search --onlyvisible --class Chrome windowfocus key ctrl+r
发布于 2018-06-28 02:25:05
sudo apt-get update
sudo apt-get install xdotool
DISPLAY=:0 xdotool key F5
这就是你所需要的。
发布于 2015-06-25 10:46:10
看起来user2974830的答案是使用了一些不正确的(可能是旧的) xdotool语法。--search
应该只是search
(没有破折号),而--windowid
应该是--window
也就是说,这里有一个更全面的解决方案that I found here。链接使用inotifywait,但我更喜欢包装inotifywait的entr。
echo "$(date --rfc-3339=seconds) Refresh: $FILE"
CUR_WID=$(xdotool getwindowfocus)
#gets the first $BROWSER window, if you have more than one
#$BROWSER window open, it might not refresh the right one,
#as an alternative you can search by the window/html title
WID=$(xdotool search --onlyvisible --class $BROWSER|head -1)
#TITLE="window/html file title"
#WID=$(xdotool search --title "$TITLE"|head -1)
xdotool windowactivate $WID
xdotool key 'ctrl+r'
xdotool windowactivate $CUR_WID
我将其保存到一个名为reload-chrome-nix
的文件中,然后运行find . -type f | entr ./reload-chrome-nix
https://stackoverflow.com/questions/28132070
复制相似问题