How can I show the output of a shell command in a gnome panel or the top menu bar?

cfi*_*cfi 7 gnome shell gnome-panel

The top bar in a classic gnome desktop shows menus (top left), then some freely configurable panel space, and on the top right a somewhat configurable panel space with system status icons, date/time, username and such.

With big monitors today, the top bar is wide enough to show a lot of empty space. Since this bar also is tall enough to host text, I would like to make use of that space to show some more status information.

Particularly I'm looking for a way to

  • Repeatedly run arbitrary shell commands, e.g.
    • date '+%Y%m%d-%H%M%S'
    • bjobs | wc -l
    • etc.
  • 在顶部菜单栏中显示那些输出

一个解决方案可能是编写一个自定义的 gnome 小程序,它不使用静态图标来表示自身,但执行上述操作。然后我可以将该小程序附加到顶部栏中的面板。

有没有更快的方法?

对我来说更快的方法是将 shell 命令放入脚本中,然后创建一个命名管道,并将该管道输入到一些 gnome 配置文件中。

有任何想法吗?

请注意,我不是机器上的root用户。如果唯一的解决方案需要我安装一些东西,我鼓励您仍然将其发布在这里。也许我可以影响系统管理员,或者以其他方式解决。

ph_*_*h_0 2

有一个 gnome-shell 扩展允许添加任意 shell 命令并在顶部面板中显示输出: https: //raujonas.github.io/executor/

命令、它们的显示位置和刷新间隔可以在 GUI 窗口中配置:

gnome-shell 扩展的屏幕截图

另请参阅询问 ubuntu 上的此答案:https ://askubuntu.com/a/1347060/1134740