Tree view elements can be deleted by the remove operator located on the right side with `-` icon. But these operators are different for every type. Now introduced `UI_OT_view_item_delete`. With that it is possible to delete elements with X key when mouse is over tree view. In future maybe we could remove type specific operators (for example: `GREASE_PENCIL_OT_layer_remove`). See video in PR description Pull Request: https://projects.blender.org/blender/blender/pulls/144045