i3 exit
Publicado por Ryuk Shinigami (última atualização em 13/04/2019)
[ Hits: 3.245 ]
Homepage: www.alem.com.br
Script para i3, compatível com runit e systemd. Pode ser usado para sair do i3 (logout), bloquear tela, e suspender, desligar e reiniciar o sistema.
#!/bin/sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Permissões para Shutdown/Reboot/Suspend com sudo (Void linux):
# sudo visudo
# %wheel ALL=(ALL) NOPASSWD: /usr/bin/halt, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/shutdown, /usr/bin/zzz, /usr/bin/ZZZ
lock() {
import -window root /tmp/screenshot.png
convert /tmp/screenshot.png -blur 0x5 /tmp/screenshotblur.png
rm /tmp/screenshot.png
i3lock -i /tmp/screenshotblur.png
}
case "$1" in
lock)
lock
;;
logout)
i3-msg exit
;;
suspend)
if [ $(cat /proc/1/comm) = "systemd" ]; then
systemctl suspend
elif [ $(cat /proc/1/comm) = "runit" ]; then
lock && sudo zzz
else
lock && dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend boolean:true
fi
;;
hibernate)
if [ $(cat /proc/1/comm) = "systemd" ]; then
systemctl hibernate
elif [ $(cat /proc/1/comm) = "runit" ]; then
lock && sudo ZZZ
else
lock && dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Hibernate boolean:true
fi
;;
reboot)
if [ $(cat /proc/1/comm) = "systemd" ]; then
systemctl reboot
elif [ $(cat /proc/1/comm) = "runit" ]; then
sudo reboot
else
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
fi
;;
shutdown)
if [ $(cat /proc/1/comm) = "systemd" ]; then
systemctl poweroff
elif [ $(cat /proc/1/comm) = "runit" ]; then
sudo shutdown -h now
else
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
fi
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0
Montagem e desmontagem de dispositivos
Removendo arquivos com primeiro caracter especial
Autenicação no Serviço ADSL da Brasil Telecom
Screensaver Johnny Castaway - XFCE + Wine
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Como realizar um ataque de força bruta para desobrir senhas?
Como usar Gpaste no ambiente Cinnamon
Atualizando o Fedora 42 para 43
ERRO: LAZARUS 4.2 64 no Linux MINT não entra mais apos ajustar desktop... (0)
Pergunta: Meu teclado não está respondendo direito como e consertar? (2)
Secure boot, artigo interessante, nada técnico. (6)
SQLITE não quer funcionar no LINUX LMDE6 64 com Lazaruz 4.2 64bit (n... (0)









