move power-menu to the scripts package
This commit is contained in:
parent
8527cc5003
commit
d39da7fbfd
4 changed files with 45 additions and 34 deletions
|
@ -27,40 +27,6 @@ in
|
|||
'';
|
||||
executable = true;
|
||||
};
|
||||
"scripts/power_menu.sh" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
chpower() {
|
||||
case "$1" in
|
||||
"")
|
||||
;;
|
||||
Shutdown)
|
||||
exec systemctl poweroff
|
||||
;;
|
||||
Reboot)
|
||||
exec systemctl reboot
|
||||
;;
|
||||
Hibernate)
|
||||
exec systemctl hibernate
|
||||
;;
|
||||
Logout)
|
||||
swaymsg exit
|
||||
;;
|
||||
*)
|
||||
${notify-send} -t 1500 -u low "Invalid Option"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
OPTIONS="Shutdown\nReboot\nHibernate\nLogout"
|
||||
|
||||
chpower "$(printf "%b" "$OPTIONS" | sort | ${dmenu} -p "Power Menu")"
|
||||
'';
|
||||
};
|
||||
|
||||
"scripts/volume_up.sh" =
|
||||
let
|
||||
|
|
|
@ -3,6 +3,8 @@ self: super: {
|
|||
catppuccin-wallpapers = super.callPackage ./catppuccin-wallpapers { };
|
||||
dracula-gtk = super.callPackage ./dracula-gtk { };
|
||||
newaita-icon-theme = super.callPackage ./newaita-icon-theme { };
|
||||
scripts = super.callPackage ./scripts { };
|
||||
|
||||
waybar = super.waybar.overrideAttrs (oldAttrs: {
|
||||
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
|
||||
});
|
||||
|
|
16
packages/scripts/default.nix
Normal file
16
packages/scripts/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ lib, stdenvNoCC, makeWrapperm, libnotify }:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "scripts";
|
||||
version = "1.0";
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [ ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp power-menu.sh $out/bin/power-menu
|
||||
chmod +x $out/bin/power-menu
|
||||
wrapProgram $out/bin/power-menu --prefix PATH : ${lib.makeBinPath [ libnotify ]}
|
||||
'';
|
||||
}
|
27
packages/scripts/power-menu.sh
Normal file
27
packages/scripts/power-menu.sh
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
chpower() {
|
||||
case "$1" in
|
||||
"")
|
||||
;;
|
||||
Shutdown)
|
||||
exec systemctl poweroff
|
||||
;;
|
||||
Reboot)
|
||||
exec systemctl reboot
|
||||
;;
|
||||
Hibernate)
|
||||
exec systemctl hibernate
|
||||
;;
|
||||
*)
|
||||
notify-send -t 1500 -u low "Invalid Option"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
OPTIONS="Shutdown\nReboot\nHibernate"
|
||||
|
||||
chpower "$(printf "%b" "$OPTIONS" | sort | ${dmenu} -p "Power Menu")"
|
||||
|
Loading…
Reference in a new issue