{ config, lib, pkgs, ... }: 
{
  home.packages = with pkgs; lib.mkIf config.wayland.windowManager.sway.enable [
    (pkgs.writeScriptBin "prop-sway" ''
      selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | ${pkgs.slurp}/bin/slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
      if [ -n "$selected_window" ]; then
        app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id')
        system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell'))
        notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")"
      fi
    '')
  ];
}
