This commit is contained in:
Adithya 2023-03-17 22:44:27 +05:30
parent f928745497
commit cac0fac5a3
No known key found for this signature in database
GPG key ID: 0C7F35F4F821290F

View file

@ -1,5 +1,8 @@
{ osConfig, pkgs, ... }: { osConfig, pkgs, ... }:
let
notify-send = "${pkgs.libnotify}/bin/notify-send";
dmenu = "${pkgs.rofi-wayland}/bin/rofi -dmenu";
in
{ {
xdg.configFile = { xdg.configFile = {
"scripts/power_menu.sh" = { "scripts/power_menu.sh" = {
@ -26,45 +29,54 @@
swaymsg exit swaymsg exit
;; ;;
*) *)
${pkgs.libnotify}/bin/notify-send -t 1500 -u low "Invalid Option" ${notify-send} -t 1500 -u low "Invalid Option"
;; ;;
esac esac
} }
OPTIONS="Shutdown\nReboot\nHibernate\nLogout" OPTIONS="Shutdown\nReboot\nHibernate\nLogout"
chpower "$(printf "%b" "$OPTIONS" | sort | ${pkgs.rofi-wayland}/bin/rofi -dmenu -p "Power Menu")" chpower "$(printf "%b" "$OPTIONS" | sort | ${dmenu} -p "Power Menu")"
''; '';
}; };
"scripts/volume_up.sh" = { "scripts/volume_up.sh" =
executable = true; let
text = '' wpctl = "${pkgs.wireplumber}/bin/wpctl";
#!/bin/sh in
{
executable = true;
text = ''
#!/bin/sh
set -eu set -eu
${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 ${wpctl} set-mute @DEFAULT_AUDIO_SINK@ 0
[ $(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk -F': ' '{print $2}' | sed 's/\.//') -lt 100 ] && ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ [ $(${wpctl} get-volume @DEFAULT_AUDIO_SINK@ | awk -F': ' '{print $2}' | sed 's/\.//') -lt 100 ] && ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%+
''; '';
}; };
"scripts/tmux_sessions.sh" = { "scripts/tmux_sessions.sh" =
executable = true; let
text = '' kitty = "${pkgs.kitty}/bin/kitty";
#!/bin/sh tmux = "${pkgs.tmux}/bin/tmux";
in
{
executable = true;
text = ''
#!/bin/sh
set -eu set -eu
SESSION="$(${pkgs.tmux}/bin/tmux list-sessions -F "(#{session_attached}) #S [#{pane_current_command} in #{pane_current_path}] #{pane_title}" | sort | ${pkgs.rofi-wayland}/bin/rofi -dmenu -p "Running TMUX Sessions" | awk '{print $2}')" SESSION="$(${tmux} list-sessions -F "(#{session_attached}) #S [#{pane_current_command} in #{pane_current_path}] #{pane_title}" | sort | ${dmenu} -p "Running TMUX Sessions" | awk '{print $2}')"
case "$SESSION" in case "$SESSION" in
"") "")
;; ;;
*) *)
${pkgs.kitty}/bin/kitty ${pkgs.tmux}/bin/tmux -u attach-session -dEt "$SESSION" ${kitty} ${tmux} -u attach-session -dEt "$SESSION"
;; ;;
esac''; esac'';
}; };
"scripts/power_profile.sh" = "scripts/power_profile.sh" =
let let
sudo = "/run/wrappers/bin/sudo"; sudo = "/run/wrappers/bin/sudo";
@ -97,6 +109,7 @@
POWER_PROFILE="powersave" POWER_PROFILE="powersave"
fi fi
echo $POWER_PROFILE > $POWER_PROFILE_FILE echo $POWER_PROFILE > $POWER_PROFILE_FILE
${notify-send} -u normal "Power Profile" "Switched to $POWER_PROFILE mode."
;; ;;
"icon") "icon")
if [ "$POWER_PROFILE" == "powersave" ]; then if [ "$POWER_PROFILE" == "powersave" ]; then