URL mappings support embedded variables.
So you can define url mappings for your category controller like this
"/$category" (controller:"category", action="index")
Make sure you put this mapping at the top of other url mappings / remove the default urlmappings.
The above url mappings will map to all the urls like domain.com/mobile, domain.com/laptops etc. And the name of the variable will be available in params.
So in your controller you can get the name of the category like this
class Category {
def index() {
String categoryName = params.category //this is embedded variable in urlmappings
}
}
Refer docs for more details.