add OS detection and refactor keybindings