improve hyprland
This commit is contained in:
83
modules/optionnals/desktop/rofi.nix
Normal file
83
modules/optionnals/desktop/rofi.nix
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
environment = {
|
||||
etc = {
|
||||
"xdg/rofi".source = ./config/etc/xdg/rofi;
|
||||
"xdg/scripts/wayland-disconnect.sh" = {
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
selected=$(printf "Lock\0icon\x1fsystem-lock-screen
|
||||
Update\0icon\x1fsystem-software-update
|
||||
Shutdown\0icon\x1fsystem-shutdown
|
||||
Reboot\0icon\x1fsystem-reboot
|
||||
Exit hyprland\0icon\x1fsystem-log-out
|
||||
Reload hyprland\0icon\x1fsystem-log-out" | ${pkgs.rofi-wayland}/bin/rofi -dmenu -show-icons -i -theme /etc/xdg/rofi/disconnect.rasi -p System)
|
||||
|
||||
echo "$selected"
|
||||
|
||||
case $selected in
|
||||
"Lock")
|
||||
${pkgs.hyprlock}/bin/hyprlock
|
||||
;;
|
||||
"Update")
|
||||
kitty /usr/local/share/dotfiles/scripts/update.sh
|
||||
;;
|
||||
"Shutdown")
|
||||
systemctl poweroff
|
||||
;;
|
||||
"Reboot")
|
||||
reboot
|
||||
;;
|
||||
"Exit hyprland")
|
||||
hyprctl dispatch exit
|
||||
;;
|
||||
"Reload hyprland")
|
||||
hyprctl reload
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
mode = "0755";
|
||||
};
|
||||
"xdg/scripts/wayland-mpv.sh" = {
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd -- "$(dirname -- "$0")" || exit
|
||||
|
||||
## if not $1
|
||||
if [[ -z $1 ]]
|
||||
then
|
||||
_LINES=$(curl "http://10.0.0.1:2013" 2>/dev/null | sed -e "s|.*<a href=\"\([^\"]*\).*|$1\1|" -e "s/.*<.*\|.*C=D.*\|.*\/\/$\|.*.nfo//" -e "/^$/d")
|
||||
else
|
||||
_LINES="$(curl "http://10.0.0.1:2013/$1" 2>/dev/null | sed -e "s|.*<a href=\"\([^\"]*\).*|$1\1|" -e "s/.*<.*\|.*C=D.*\|.*\/\/$\|.*.nfo//" -e "/^$/d")"
|
||||
fi
|
||||
|
||||
_RESULT=$(${pkgs.rofi-wayland}/bin/rofi -dmenu -config /etc/xdg/rofi/config.rasi -i <<< "$_LINES")
|
||||
|
||||
# If no output
|
||||
echo "$_RESULT"
|
||||
if [[ -z $_RESULT ]]
|
||||
then
|
||||
echo "no output, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#if line end vith /
|
||||
if [[ "$_RESULT" =~ .*/$ ]]
|
||||
then
|
||||
echo "output is a directory"
|
||||
./wayland-mpv.sh "$_RESULT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mpv "http://10.0.0.1:2013/$_RESULT"
|
||||
'';
|
||||
mode = "0755";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user