i3 exit
Publicado por Ryuk Shinigami (última atualização em 13/04/2019)
[ Hits: 2.818 ]
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
Implementando um simples manipulador de eventos de teclado
Instalar splashtop em um pendrive
Restaura gerenciador de boot grub
Atenção a quem posta conteúdo de dicas, scripts e tal (1)
Manutenção de sistemas Linux Debian e derivados com apt-get, apt, aptitude e dpkg
Melhorando o tempo de boot do Fedora e outras distribuições
Como instalar as extensões Dash To Dock e Hide Top Bar no Gnome 45/46
Como Atualizar Fedora 39 para 40
Instalar Google Chrome no Debian e derivados
Consertando o erro do Sushi e Wayland no Opensuse Leap 15
Instalar a última versão do PostgreSQL no Lunix mantendo atualizado
Flathub na sua distribuição Linux e comandos básicos de gerenciamento
Problema Envio email GLPI Versao 10.0.15 (0)
Como adicionar módulo de saúde da bateria dos notebooks Acer ao kernel... (25)
Impressora Canon Ip 1800 (Drivers) 64 bit (1)
[Shell Script] Script para desinstalar pacotes desnecessários no OpenSuse
[Shell Script] Script para criar certificados de forma automatizada no OpenVpn
[Shell Script] Conversor de vídeo com opção de legenda
[C/C++] BRT - Bulk Renaming Tool
[Shell Script] Criação de Usuarios , Grupo e instalação do servidor de arquivos samba