我无法暂停 Kubuntu 14.04.2 笔记本电脑,因为当我从睡眠模式唤醒时,KDE 无法运行。因此,我没有让笔记本电脑进入睡眠状态,而是让屏幕在 10 分钟不活动后变黑。我想通过单击按钮或图标来触发屏幕关闭。是否有一些 bash 命令可以运行来关闭屏幕?当我移动鼠标或在键盘上键入字母时,屏幕会重新亮起?非常感谢您的帮助!感谢您的阅读和回复!
答案1
关闭屏幕
可以通过命令关闭显示:
xset dpms force off
关于命令-man xset:
DESCRIPTION
This program is used to set various user preference options of the display.
-dpms The -dpms option disables DPMS (Energy Star) features.
+dpms The +dpms option enables DPMS (Energy Star) features.
dpms flags...
The dpms option allows the DPMS (Energy Star) parameters to be set. The option can take up to
three numerical values, or the `force' flag followed by a DPMS state. The `force' flags forces
the server to immediately switch to the DPMS state specified. The DPMS state can be one of
`standby', `suspend', `off', or `on'. When numerical values are given, they set the inactivity
period (in units of seconds) before the three modes are activated. The first value given is for
the `standby' mode, the second is for the `suspend' mode, and the third is for the `off' mode.
Setting these values implicitly enables the DPMS features. A value of zero disables a particu‐
lar mode.
打开屏幕保护程序/锁定程序
可以通过命令打开 KDE 屏幕保护程序/锁定程序:
qdbus org.kde.ksmserver /ScreenSaver SetActive true
该命令将根据用户设置启动屏幕保护程序或锁定。KDE 系统设置 > 显示和监视器 > 屏幕锁定器。
关于 qdbus - man qdbus:
NAME
qdbus - a communication-interface for qt-based applications
SYNOPSIS
qdbus [--system] [--literal] [servicename] [path] [method] [args]
DESCRIPTION
qdbus provides an interface to Qt-based applications communicating over D-Bus. See http://www.freedesk‐
top.org/software/dbus/ for more information about the big picture.
By default qdbus will list all service names of services that are running and you can manipulate at the
moment. You can also manipulate and run several types of methods for each dbus-enabled application.
更多的:https://techbase.kde.org/Development/Tutorials/D-Bus/Introduction
命令按钮
KDE 有菜单编辑器:https://docs.kde.org/stable/en/kde-workspace/kmenuedit/
该命令有启动按钮后,该按钮可以从 KDE 菜单转移到桌面或面板。
另一种方法是添加等离子小部件-开/关开关:http://kde-apps.org/content/show.php/On/Off%20Switch?content=116323
并将等离子小部件添加到桌面/面板。
来自 Ubuntu PPA 的二进制文件:https://launchpad.net/ubuntu/+ppas?name_filter=plasma-widget-on-off-switch