Skip to content

Instantly share code, notes, and snippets.

@tekkoc
Last active January 4, 2017 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tekkoc/d53433eca4318a3a7cbf0872519cb484 to your computer and use it in GitHub Desktop.
Save tekkoc/d53433eca4318a3a7cbf0872519cb484 to your computer and use it in GitHub Desktop.
Amethystの補助としてSlateを使用する例
// Amethystと併用を前提
// Amethystの「Display current layout」をオフにすること
var util = {
// alt + shift + ..
key: function(k, mod) {
return k + ':alt,shift' + (mod ? ',' + mod : '');
}
};
// i .. 下に隠れているウィンドウをフォーカス
slate.bind(util.key('i'), slate.operation('focus', { direction: 'behind' }));
// q .. フォーカスしているアプリを終了
slate.bind(util.key('q'), function(win) {
var pid = win.app().pid();
slate.log('Kill process ' + pid);
win.doOperation(
slate.operation('shell', {
'command' : '/bin/kill '+ pid
})
);
});
// r .. Amethystを再起動
slate.bind(util.key('r'), function(win) {
win.doOperation(
slate.operation('shell', {
'command' : '/usr/bin/killall Amethyst'
})
);
win.doOperation(
slate.operation('shell', {
'command' : '/usr/bin/open -a Amethyst'
})
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment