キーボードショートカットを使用して一時停止するには?

キーボードショートカットを使用して一時停止するには?

一時停止したいシベントゥ(14.04)システムキーボードショートカットスーパーユーザーパスワードを入力する必要はありません(Sudo)。ショートカットに変換できるコマンドラインを探しています。

これまで私は2つの解決策を試しました。

Xfce コマンド:

xfce4-session-logout --suspend

質問:システムはセッションをロックしません。覚醒コードを入力する必要はなく、入力したいと思います。

バス:

dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend

質問:目が覚めた後、インターネット接続が失われて回復するには、システムを再起動する必要があります。

1.気象中にパスワードを尋ね、2.インターネット接続を妨げない3番目の解決策はありますか?

実際、メニューのグラフィックの基本ショートカットはうまく機能します。どのコマンドラインを呼び出すべきかわかりません。

ベストアンサー1

私は台本を書いた。あなたの条件を満たすようです:

#!/usr/bin/env zsh
# Custom suspend
#
# (That 'zsh' up there can be switched to 'bash', or 
# pretty much any shell - this doesn't do anything too fancy.)
#
# Dependencies are mostly xfce stuff:
#
#   xbacklight
#   xflock4
#   xfce4-session-logout

# Set how dim we want the screen to go (percentage, out of 100)
dim=5

# Pack up your toys
previous_dimness=$(xbacklight -get)

# Turn down the lights
xbacklight -set $dim

# Lock the door (this requires a password to get back in)
xflock4

# And go to sleep
xfce4-session-logout --suspend

# When we wake up, turn the lights back on
xbacklight -set $previous_dimness

おすすめ記事