[~] Refactor

This commit is contained in:
Siarhei Siniak 2024-03-19 23:03:20 +03:00
parent 8aebcf9996
commit c5ae224dbf
4 changed files with 40 additions and 25 deletions

@ -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 \

@ -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:

24
dotfiles/.py3.vimrc Normal file

@ -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

@ -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