If you have a mouse that has side buttons, you might use my karabiner complex modification for mapping side buttons to desktop switch.
Hopefully you can edit this for your use.
{
"title": "Switch desktop with mouse side buttons 4,5",
"rules": [
{
"description": "Maps button 4, 5 to left desktop and right desktop switch",
"manipulators": [
{
"type": "basic",
"from": {
"pointing_button": "button5"
},
"to": [
{
"key_code": "left_arrow",
"modifiers": "left_control"
}
]
},
{
"type": "basic",
"from": {
"pointing_button": "button4"
},
"to": [
{
"key_code": "right_arrow",
"modifiers": "left_control"
}
]
}
]
}
]
}