Win*_*nix 3 bash scripts unity system-tray
我有一个 bash 脚本,它在设定的时间后锁定屏幕(应用程序将在 Ubuntu 的设定时间后锁定屏幕)。我想在 Ubuntu 的系统托盘/应用程序指示器栏中显示剩余时间。
我发现的最佳方法是本文中的System Monitor Indicator:webupd8.org - 显示 bash 的 Ubuntu 应用程序指示器。它在 Unity 系统托盘/应用程序指示器栏上显示您的 bash 脚本“回声”的文本。
上面的文章针对 Ubuntu 16.04 with Unity。有关 Xubuntu、Gnome-Shell + app-indicator 扩展和 Budgie 的更多信息,请访问开发者网站:fossfreedom / indicator-sysmonitor。另请访问该站点以获取更详细的安装和配置说明。
indicator-sysmonitor
要安装System Monitor Indicator,您需要首先指定indicator-sysmonitor
可以找到的 PPA :
sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor
sudo apt-get update
sudo apt-get install indicator-sysmonitor
Run Code Online (Sandbox Code Playgroud)
现在从 Dash ( Alt+ F2)运行“indicator-sysmonitor”GUI 。
custom
Bash Indicator
_ 在 Command 字段中输入 bash 脚本的名称,即/mnt/e/bin/indicator-sysmonitor-display
custom
行并单击Add按钮将其激活。2
秒更改为秒.3
。支持“旋转披萨”解释如下。这.gif
显示了更新 Ubuntu 的 Unity 系统托盘时的外观。
multi-timer
(下面的链接)启动并逐步执行多个计时器。注意:系统监视器指示器还显示“亮度:3000”。这是我的英特尔背光硬件亮度级别的白天设置(下面的链接)。
创建类似于以下的脚本,并将其分配给变量{Custom}
在sysmonitor所在行指示灯:
sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor
sudo apt-get update
sudo apt-get install indicator-sysmonitor
Run Code Online (Sandbox Code Playgroud)
在通过设置它在每个刷新间隔运行的变量告诉Sysmonitor Indicator你的 bash 脚本的名称之后{Custom}
。无论您的 bash 脚本通过echo
命令输出什么,都会出现在 Ubuntu 的系统托盘中。
注意:脚本显示剩余时间和显示亮度级别值。这些值由Ask Ubuntu 中记录的脚本设置: 应用程序将在Ubuntu设定的时间后锁定屏幕,一个计时器,用于同时设置不同的警报,并分别根据日出和日落自动调整显示亮度。
text-spinner
BASH 脚本在text-spinner
bash脚本通过人物创建由骑自行车的旋转比萨饼效果|
,/
,?
和\
。这种效果突出了某些东西正在“工作”或“思考”的事实。要获得“旋转效果”,您需要将Sysmonitor 指标刷新间隔从默认2
秒数更改为大约0.30
秒数。
这是text-spinner
bash 脚本:
#!/bin/bash
# UPDT: May 30 2018 - Cohesion with new multi-timer and old lock-screen-timer.
if [ -f ~/.lock-screen-timer-remaining ]; then
text-spinner
Spinner=$(cat ~/.last-text-spinner) # read last text spinner used
String=$(cat ~/.lock-screen-timer-remaining)
systray="$Spinner $String"
else
systray=""
fi
if [ -f /tmp/display-current-brightness ]; then
Brightness=$(cat /tmp/display-current-brightness)
systray="$systray Brightness: $Brightness"
else
systray="$systray Brightness: OFF"
fi
# Below for AU answer: https://askubuntu.com/questions/1024866/is-it-possible-to-show-ip-address-on-top-bar-near-the-time
# default_interface=$(route -n | awk '$1 == "0.0.0.0" {print $8; exit}')
# ip_address=$(ifconfig "$default_interface" | awk 'sub(/.* inet addr:/, "") {print $1}')
# systray="$systray $ip_address"
echo "$systray" # sysmon-indidicator will put echo string into systray for us.
exit 0
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1712 次 |
最近记录: |