mirror of https://github.com/k0kubun/xremap
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
513 B
Ruby
20 lines
513 B
Ruby
define :activate do |query, options = {}|
|
|
command = options[:command] || query
|
|
execute(<<-SHELL)
|
|
match=$(wmctrl -l | grep "$(hostname) #{query}")
|
|
case $? in
|
|
1)
|
|
#{command}
|
|
;;
|
|
0)
|
|
window_id=$(echo $match | tail -n1 | cut -d' ' -f1)
|
|
wmctrl -i -R $window_id
|
|
;;
|
|
esac
|
|
SHELL
|
|
end
|
|
|
|
remap 'C-o', to: activate('Nocturn', command: 'nocturn')
|
|
remap 'C-u', to: activate('.*Google Chrome$', command: 'google-chrome-stable')
|
|
remap 'C-h', to: activate('urxvt')
|