Maim doesn't work on wayland/sway, but grim/slurp do. It should be easy enough to check some environmental variable to determine if sway is being used and then switch to using grim/slurp if so. The most portable option would probably be to check if XDG_CURRENT_DESKTOP=sway. Let me know if there's any other/better methods too.
edit: Actually the better method would be to check if $WAYLAND_DISPLAY is set, and then swap to grim/slurp if so.
Maim doesn't work on wayland/sway, but grim/slurp do. It should be easy enough to check some environmental variable to determine if sway is being used and then switch to using grim/slurp if so. The most portable option would probably be to check if XDG_CURRENT_DESKTOP=sway. Let me know if there's any other/better methods too.
edit: Actually the better method would be to check if
$WAYLAND_DISPLAYis set, and then swap to grim/slurp if so.