logout option in power menu
This commit is contained in:
parent
75e1d2d070
commit
d19d2719e8
2 changed files with 10 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ lib, stdenvNoCC, makeWrapper, libnotify, rofi-wayland, tmux, kitty, imagemagick, swaybg }:
|
{ lib, stdenvNoCC, makeWrapper, libnotify, rofi-wayland, tmux, kitty, imagemagick, swaybg, sway, hyprland }:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
pname = "scripts";
|
pname = "scripts";
|
||||||
|
@ -12,7 +12,7 @@ stdenvNoCC.mkDerivation {
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp power-menu.sh $out/bin/power-menu
|
cp power-menu.sh $out/bin/power-menu
|
||||||
chmod +x $out/bin/power-menu
|
chmod +x $out/bin/power-menu
|
||||||
wrapProgram $out/bin/power-menu --prefix PATH : ${lib.makeBinPath [ libnotify rofi-wayland ]}
|
wrapProgram $out/bin/power-menu --prefix PATH : ${lib.makeBinPath [ libnotify rofi-wayland sway hyprland ]}
|
||||||
|
|
||||||
cp tmux-sessions.sh $out/bin/tmux-sessions
|
cp tmux-sessions.sh $out/bin/tmux-sessions
|
||||||
chmod +x $out/bin/tmux-sessions
|
chmod +x $out/bin/tmux-sessions
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
SWAYSOCK=${SWAYSOCK:-}
|
||||||
|
HYPRLAND_INSTANCE_SIGNATURE=${HYPRLAND_INSTANCE_SIGNATURE:-}
|
||||||
|
|
||||||
chpower() {
|
chpower() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"")
|
"")
|
||||||
|
@ -15,13 +18,17 @@ chpower() {
|
||||||
Hibernate)
|
Hibernate)
|
||||||
exec systemctl hibernate
|
exec systemctl hibernate
|
||||||
;;
|
;;
|
||||||
|
Logout)
|
||||||
|
[ -n "$SWAYSOCK" ] && swaymsg exit
|
||||||
|
[ -n "$HYPRLAND_INSTANCE_SIGNATURE" ] && hyprctl dispatch exit
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
notify-send -t 1500 -u low "Invalid Option"
|
notify-send -t 1500 -u low "Invalid Option"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTIONS="Shutdown\nReboot\nHibernate"
|
OPTIONS="Shutdown\nReboot\nHibernate\nLogout"
|
||||||
|
|
||||||
chpower "$(printf "%b" "$OPTIONS" | sort | rofi -dmenu -p "Power Menu")"
|
chpower "$(printf "%b" "$OPTIONS" | sort | rofi -dmenu -p "Power Menu")"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue