move power-menu to the scripts package

This commit is contained in:
Adithya 2023-04-06 01:27:09 +05:30
parent 8527cc5003
commit d39da7fbfd
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
4 changed files with 45 additions and 34 deletions

View file

@ -27,40 +27,6 @@ in
''; '';
executable = true; 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" = "scripts/volume_up.sh" =
let let

View file

@ -3,6 +3,8 @@ self: super: {
catppuccin-wallpapers = super.callPackage ./catppuccin-wallpapers { }; catppuccin-wallpapers = super.callPackage ./catppuccin-wallpapers { };
dracula-gtk = super.callPackage ./dracula-gtk { }; dracula-gtk = super.callPackage ./dracula-gtk { };
newaita-icon-theme = super.callPackage ./newaita-icon-theme { }; newaita-icon-theme = super.callPackage ./newaita-icon-theme { };
scripts = super.callPackage ./scripts { };
waybar = super.waybar.overrideAttrs (oldAttrs: { waybar = super.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
}); });

View 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 ]}
'';
}

View 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")"