reduced duplicated code by defining dmenu_t function