Example #1
0
dir = os.path.dirname(__file__)


def install_autohotkey():
    install_path = os.path.join(tempfile.gettempdir(), 'ahk-install.exe')

    if not os.path.exists(install_path):
        url = 'http://ahkscript.org/download/ahk-install.exe'
        response = urllib.request.urlopen(url)
        data = response.read()
        with open(install_path, 'wb') as f:
            f.write(data)

    os.chmod(install_path, 0o777)
    if not run_silent([install_path, '/s'])[0]:
        raise RuntimeError('Failed to install AutoHotkey')

    os.unlink(install_path)


install_autohotkey()

script_path = os.path.join(dir, 'hk.ahk')
if FileInstaller.has_executable('cygpath'):
    script_path = run_silent(['cygpath', '-w', script_path])[1].strip()

run_silent([
    'reg', 'add', 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', '/v',
    'AutoHotkey', '/t', 'REG_SZ', '/f', '/d', script_path
])
Example #2
0
#!/bin/python
import os
from libinstall import FileInstaller, PackageInstaller
dir = os.path.dirname(__file__)

#TODO: rewrite this to my own screenshot solution
PackageInstaller.try_install('escrotum-git')  # to make screenshots

PackageInstaller.try_install('xorg-xsetroot') # to fix the mouse cursor
PackageInstaller.try_install('xorg-xrandr')   # to query monitor information
PackageInstaller.try_install('xdotool')       # for all sort of things
PackageInstaller.try_install('autocutsel')    # synchronize primary and selection clipboards
PackageInstaller.try_install('clipit')        # keep clipboard content even after application closes
PackageInstaller.try_install('compton')       # for shadows, transparency and vsync

FileInstaller.create_symlink(os.path.join(dir, '.xinitrc'), '~/')
FileInstaller.create_symlink(os.path.join(dir, 'compton.conf'), '~/.config/compton.conf')

if FileInstaller.has_executable('zsh'):
    FileInstaller.create_symlink(os.path.join(dir, '.zlogin'), '~/')
Example #3
0
#!/bin/python
import os
from libinstall import FileInstaller, PackageInstaller
dir = os.path.dirname(__file__)

choices = ['vim',
           'gvim']  #gvim supports for X11 clipboard, but has more dependencies
choice = None
while choice not in choices:
    choice = input('Which package to install? (%s) ' % choices).lower()
PackageInstaller.try_install(choice)

for folder in ['undo', 'backup', 'swap', 'spell']:
    FileInstaller.create_dir('~/.vim/' + folder)

FileInstaller.create_symlink(os.path.join(dir, 'spell/pl.utf-8.add'),
                             '~/.vim/spell/')
FileInstaller.create_symlink(os.path.join(dir, 'spell/en.utf-8.add'),
                             '~/.vim/spell/')
FileInstaller.create_symlink(os.path.join(dir, 'vundle'), '~/.vim/vundle')
FileInstaller.create_symlink(os.path.join(dir, '.vimrc'), '~/')

if FileInstaller.has_executable('devenv'):
    FileInstaller.copy_file(os.path.join(dir, '.vimrc'), '~/.vsvimrc')
Example #4
0
def install_autohotkey():
    install_path = os.path.join(tempfile.gettempdir(), 'ahk-install.exe')

    if not os.path.exists(install_path):
        url = 'http://ahkscript.org/download/ahk-install.exe'
        response = urllib.request.urlopen(url)
        data = response.read()
        with open(install_path, 'wb') as f:
            f.write(data)

    os.chmod(install_path, 0o777)
    if not run_silent([install_path, '/s'])[0]:
        raise RuntimeError('Failed to install AutoHotkey')

    os.unlink(install_path)

install_autohotkey()

script_path = os.path.join(dir, 'hk.ahk')
if FileInstaller.has_executable('cygpath'):
    script_path = run_silent(['cygpath', '-w', script_path])[1].strip()

run_silent([
    'reg',
    'add', 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run',
    '/v', 'AutoHotkey',
    '/t', 'REG_SZ',
    '/f',
    '/d', script_path])
Example #5
0
#!/bin/python
import os
from libinstall import FileInstaller, PackageInstaller
dir = os.path.dirname(__file__)

if not FileInstaller.has_executable('vifm'):
    PackageInstaller.try_install('vifm')
FileInstaller.create_dir('~/.config/vifm')
FileInstaller.create_symlink(os.path.join(dir, 'vifmrc'),
                             '~/.config/vifm/vifmrc')
FileInstaller.create_symlink(os.path.join(dir, 'colors'),
                             '~/.config/vifm/colors')
Example #6
0
#!/bin/python
import os
from libinstall import FileInstaller, PackageInstaller
dir = os.path.dirname(__file__)

if not FileInstaller.has_executable('vifm'):
    PackageInstaller.try_install('vifm')
FileInstaller.create_dir('~/.config/vifm')
FileInstaller.create_symlink(os.path.join(dir, 'vifmrc'), '~/.config/vifm/vifmrc')
FileInstaller.create_symlink(os.path.join(dir, 'colors'), '~/.config/vifm/colors')
Example #7
0
import os, glob
from libinstall import FileInstaller, PackageInstaller, run_verbose

dir = os.path.dirname(__file__)

PackageInstaller.try_install('xorg-font-utils')
PackageInstaller.try_install('ttf-dejavu')
PackageInstaller.try_install('ttf-symbola')
PackageInstaller.try_install('ttf-font-awesome')
PackageInstaller.try_install('ttf-ipa-mona')

if os.path.exists('/usr/share/fonts'):
    fonts_dir = os.path.expanduser('~/.local/share/fonts')

    FileInstaller.create_dir(fonts_dir)
    for font_path in glob.glob(os.path.join(dir, '*.ttf')):
        FileInstaller.create_symlink(font_path, fonts_dir + '/')

    if FileInstaller.has_executable('mkfontscale'):
        run_verbose(['mkfontscale', fonts_dir])
    if FileInstaller.has_executable('mkfontdir'):
        run_verbose(['mkfontdir', fonts_dir])
    if FileInstaller.has_executable('xset'):
        run_verbose(['xset', '+fp', fonts_dir])
        run_verbose(['xset', 'fp', 'rehash'])

if FileInstaller.has_executable('fc-cache'):
    FileInstaller.create_symlink(os.path.join(dir, 'fonts.conf'),
                                 '~/.config/fontconfig/')
    run_verbose(['fc-cache'])
Example #8
0
#!/usr/bin/env python3

import os
import sys
from libinstall import FileInstaller, PackageInstaller


dir = os.path.dirname(__file__)

if not FileInstaller.has_executable('bspwm'):
    print('Missing bspwm! Exiting...')
    sys.exit(1)
if not FileInstaller.has_executable('sxhkd'):
    print('Missing sxhkd! Exiting...')
    sys.exit(1)

# Debian packages
PackageInstaller.try_install('python3-pyqt5')     # for panel
PackageInstaller.try_install('python3-pyqt5.qtwebkit')     # for panel
PackageInstaller.try_install('python3-psutil')       # CPU usage
PackageInstaller.try_install('python3-xlib') # window titles
PackageInstaller.try_install('suckless-tools')            # program executor
PackageInstaller.try_install('feh')              # wallpaper renderer

# Pip packages
PackageInstaller.try_install('pyalsaaudio', method='pip')  # system volume
PackageInstaller.try_install('python-mpd2', method='pip')  # mpd interaction
# PackageInstaller.try_install('psutil', method='pip')       # CPU usage
# PackageInstaller.try_install('python3-xlib', method='pip') # window titles

# Files to link
Example #9
0
#!/bin/python
import os
from libinstall import FileInstaller, PackageInstaller
dir = os.path.dirname(__file__)

choices = ['vim', 'gvim'] #gvim supports for X11 clipboard, but has more dependencies
choice = None
while choice not in choices:
    choice = input('Which package to install? (%s) ' % choices).lower()
PackageInstaller.try_install(choice)

for folder in ['undo', 'backup', 'swap', 'spell']:
    FileInstaller.create_dir('~/.vim/' + folder)

FileInstaller.create_symlink(os.path.join(dir, 'spell/pl.utf-8.add'), '~/.vim/spell/')
FileInstaller.create_symlink(os.path.join(dir, 'spell/en.utf-8.add'), '~/.vim/spell/')
FileInstaller.create_symlink(os.path.join(dir, 'vundle'), '~/.vim/vundle')
FileInstaller.create_symlink(os.path.join(dir, '.vimrc'), '~/')

if FileInstaller.has_executable('devenv'):
    FileInstaller.copy_file(os.path.join(dir, '.vimrc'), '~/.vsvimrc')