# Log out and shutdown menu
{
  home.file =
    let
      dir = ".config/wlogout";
    in
    {
      "${dir}/hibernate.svg".source = ./hibernate.svg;
      "${dir}/lock.svg".source = ./lock.svg;
      "${dir}/logout.svg".source = ./logout.svg;
      "${dir}/reboot.svg".source = ./reboot.svg;
      "${dir}/shutdown.svg".source = ./shutdown.svg;
      "${dir}/suspend.svg".source = ./suspend.svg;
    };

  programs.wlogout = {
    enable = false;
    layout = [
      {
        label = "lock";
        action = "sh -c '(sleep 0.5s; hyprlock)'";
        text = "Lock";
        keybind = "l";
      }
      {
        label = "hibernate";
        action = "systemctl hibernate";
        text = "Hibernate";
        keybind = "h";
      }
      {
        label = "logout";
        action = "loginctl terminate-user $USER";
        text = "Logout";
        keybind = "e";
      }
      {
        label = "shutdown";
        action = "systemctl poweroff";
        text = "Shutdown";
        keybind = "s";
      }
      {
        label = "suspend";
        action = "systemctl suspend";
        text = "Suspend";
        keybind = "u";
      }
      {
        label = "reboot";
        action = "systemctl reboot";
        text = "Reboot";
        keybind = "r";
      }
    ];
    style =
      let
        theme = import ../../theme.nix;
      in
      ''
        * {
          background-image: none;
          box-shadow: none;
        }

        window {
          background-color: rgba(30, 30, 46, 0.9);
        }

        button {
          border-radius: 0;
          border-color: #${theme.pinkAlpha};
          text-decoration-color: #${theme.textAlpha};
          color: #${theme.textAlpha};
          background-color: #${theme.mantleAlpha};
          border-style: solid;
          border-width: 1px;
          background-repeat: no-repeat;
          background-position: center;
          background-size: 25%;
        }

        button:focus,
        button:active,
        button:hover {
          /* 20% Overlay 2, 80% mantle */
          background-color: rgb(48, 50, 66);
          outline-style: none;
        }

        #lock {
          background-image: url("./lock.svg");
        }

        #logout {
          background-image: url("./logout.svg");
        }

        #suspend {
          background-image: url("./suspend.svg");
        }

        #hibernate {
          background-image: url("./hibernate.svg");
        }

        #shutdown {
          background-image: url("./shutdown.svg");
        }

        #reboot {
          background-image: url("./reboot.svg");
        }
      '';
  };
}
