linux - 使用 xdotool 刷新桌面

标签 linux bash ubuntu-16.04 xdotool

您好,我正在尝试刷新我的桌面,使用 xdotool 模拟“F5”/“ctrl+R”按键。

我试过 xdotool key F5 但我得到了

^[[15~jake@jake-PC ~ $ ~

按下回车后:

bash: /home/jake: Is a directory

那我试过了

xdotool search --classname Desktop
73400321

得到那个 id,然后尝试:

xdotool search --classname Desktop key F5
xdotool search --classname Desktop key ctrl+R

它没有刷新我的页面。

问题:如何刷新桌面?顺便说一句,我使用的是 Ubuntu 16.04。谢谢

最佳答案

你需要同步调用:

xdotool search --onlyvisible --classname Desktop windowactivate --sync key F5

您也可以像这样尝试 xdotool 脚本:

#!/usr/bin/env xdotool
keydown Ctrl
keydown super
sleep 0.1
key D
keyup Ctrl
keyup super
key F5

您可以使用 xdotool 上的 exec 函数调用显示桌面脚本(或创建它)的另一种选择

关于linux - 使用 xdotool 刷新桌面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47633190/

相关文章:

linux - 如何在 Logrotate 上使用日期和时间作为文件名的一部分?

linux - Linux 进程间共享类对象

linux - 如何: compare command output to text file with bash

Bash =~ 在 OS X cmd 提示符下丢失 BASH_REMATCH 内容

java - jenkins 主连接失败,出现 java.nio.channels.ClosedChannelException

c++ - Linux C++用户空间应用程序实时休眠功能(POSIX、Raspberry Pi)

linux - 在后台运行 SCP 并监控进度

bash - 如何将在连接的计算机上运行的命令的输出发送到连接计算机中的文件

python - 如何在遍历文件中的行时从文件中删除行?

linux - 如何确定 ulimits - linux