diff --git a/d1/f1.sh b/d1/f1.sh index b0290d0..7bb2a7b 100644 --- a/d1/f1.sh +++ b/d1/f1.sh @@ -7,6 +7,7 @@ cp dotfiles/.sway/config ~/.sway/config cp dotfiles/.zshenv ~/.zshenv cp dotfiles/.zshrc ~/.zshrc cp dotfiles/.vimrc ~/.vimrc +cp dotfiles/.py3.vimrc ~/.py3.vimrc cp dotfiles/.tmux.conf ~/.tmux.conf cp -rp \ dotfiles/.ipython/profile_default/ipython_config.py \ diff --git a/dotfiles/.local/bin/commands b/dotfiles/.local/bin/commands index 51cade9..11f91ce 100755 --- a/dotfiles/.local/bin/commands +++ b/dotfiles/.local/bin/commands @@ -1363,7 +1363,14 @@ def pm_service(argv): parser = optparse.OptionParser() options, args = parser.parse_args(argv) + assert sys.platform == 'darwin' + while True: + subprocess.check_call([ + 'osascript', + '-e', + 'tell application "Finder" to sleep' + ]) subprocess.check_call(['pmset', 'sleepnow']) @@ -1389,7 +1396,11 @@ def pm_service(argv): #''', shell=True).decode('utf-8') if not cmd is None and 'TurnedOn' in cmd: - if 'AppleMultitouchDevice' in cmd: + if ( + 'AppleMultitouchDevice' in cmd or + 'AppleACPIButton' in cmd or + 'eventType:29' in cmd + ): action = 'wake-up' break else: diff --git a/dotfiles/.py3.vimrc b/dotfiles/.py3.vimrc new file mode 100644 index 0000000..3a58712 --- /dev/null +++ b/dotfiles/.py3.vimrc @@ -0,0 +1,24 @@ +py3 << EOF +def f1(): + t1 = vim.current.window + t2 = t1.width + vim.command('vnew') + t3 = t2 // 3 + vim.command('vertical resize %d' % t3) + vim.current.window = t1 + +def f2(): + context = { + k : vim.options['splitright'] + for k in ['splitright'] + } + try: + current_window = vim.current.window + vim.options['splitright'] = True + vim.command('vnew') + vim.command('r! tmux show-buffer') + vim.current.window = current_window + finally: + for k, v in context.items(): + vim.options[k] = v +EOF diff --git a/dotfiles/.vimrc b/dotfiles/.vimrc index 1d03705..8d1cfb9 100644 --- a/dotfiles/.vimrc +++ b/dotfiles/.vimrc @@ -4,30 +4,9 @@ filetype off set viminfo+=/1000000,:1000000 -py3 << EOF -def f1(): - t1 = vim.current.window - t2 = t1.width - vim.command('vnew') - t3 = t2 // 3 - vim.command('vertical resize %d' % t3) - vim.current.window = t1 - -def f2(): - context = { - k : vim.options['splitright'] - for k in ['splitright'] - } - try: - current_window = vim.current.window - vim.options['splitright'] = True - vim.command('vnew') - vim.command('r! tmux show-buffer') - vim.current.window = current_window - finally: - for k, v in context.items(): - vim.options[k] = v -EOF +if has('python3') + source = $HOME . '.py3.vimrmc' +endif filetype plugin indent on