Scripting

i3-nagbar 呼叫的 i3lock 在後台啟動

  • July 26, 2019

我正在嘗試使用 i3⁻nagbar 命令設置鎖定腳本。我目前的程式碼:

i3-nagbar -b "lock" "i3lock" -b "shutdown" "shutdown -h 0"

當關機按鈕工作時,鎖定按鈕只會閃爍 i3lock 螢幕,然後返回終端。任何想法為什麼?

我不完全確定原因,但如果你使用-B而不是-bthen 它可以正常工作。從手冊頁:

      -b, --button button action
          Create a button with text button. The action are the shell commands that will be executed by this button. Multiple buttons can be defined. Will launch the shell commands inside a terminal emulator, using i3-sensible-terminal.

      -B, --button-no-terminal button action
          Same as above, but will execute the shell commands directly, without launching a terminal emulator.

我的有效命令是:

bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit' -B 'Lock Screen' 'i3lock -c 000000'"

引用自:https://unix.stackexchange.com/questions/525836