diff --git a/autolock.sh b/autolock.sh deleted file mode 100755 index a2cce5f..0000000 --- a/autolock.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -exec xautolock -detectsleep \ - -time 15 -locker "i3lock -c 000000" \ - -notify 30 \ - -notifier "notify-send -u critical -t 10000 -- 'LOCKING screen in 30 seconds'" diff --git a/init.sh b/init.sh index e7c38cd..e041b32 100755 --- a/init.sh +++ b/init.sh @@ -5,7 +5,7 @@ ln -snf `pwd`/tmux.conf ~/.tmux.conf ln -snf `pwd`/qtile_config.py ~/.config/qtile/config.py ln -snf `pwd`/gitconfig ~/.gitconfig ln -snf `pwd`/gitignore ~/.gitignore -ln -snf `pwd`/autolock.sh ~/.autolock.sh +ln -snf `pwd`/autostart.sh ~/.autostart.sh echo "Installing oh-my-zsh..." sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" diff --git a/init_server.sh b/init_server.sh index 4c8c78d..9daf1d4 100755 --- a/init_server.sh +++ b/init_server.sh @@ -1,12 +1,8 @@ mkdir -p ~/.backup ln -snf `pwd`/vimrc ~/.vimrc ln -snf `pwd`/tmux.server.conf ~/.tmux.conf -ln -snf `pwd`/zshrc.local ~/.zshrc.local -ln -snf `pwd`/zshrc ~/.zshrc ln -snf `pwd`/gitconfig ~/.gitconfig ln -snf `pwd`/gitignore ~/.gitignore -# set up vim -#vim +BundleInstall! +qall echo "Installing oh-my-zsh..." sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" diff --git a/ohmyzshrc b/ohmyzshrc index c717610..65f0fc0 100644 --- a/ohmyzshrc +++ b/ohmyzshrc @@ -4,6 +4,7 @@ export ZSH_TMUX_FIXTERM=false # Path to your oh-my-zsh installation. export ZSH=~/.oh-my-zsh +export LC_ALL=en_US.UTF-8 # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ @@ -53,8 +54,9 @@ ZSH_THEME="gentoo" # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git cp dirpersist tmux ssh-agent) +plugins=(tmux dirpersist virtualenvwrapper ssh-agent extract node npm) +zstyle ':completion:*' special-dirs true zstyle :omz:plugins:ssh-agent identities id_rsa # User configuration @@ -88,3 +90,8 @@ source $ZSH/oh-my-zsh.sh # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" + +alias mkvirtualenv3="mkvirtualenv -p `which python3`" +alias dc="docker-compose" + +stty -ixon diff --git a/qtile_config.py b/qtile_config.py index f6be391..a923aa8 100644 --- a/qtile_config.py +++ b/qtile_config.py @@ -26,20 +26,41 @@ import os import subprocess +import re +import logging from libqtile.config import Key, Screen, Group, Drag, Click from libqtile.command import lazy from libqtile import layout, bar, widget, hook +def spawn_with_env_lazy(command, env): + def spawn_env(): + subprocess.Popen(command.split(' '), env=env) + + return spawn_env + + mod = "mod4" home = os.path.expanduser('~') keys = [ Key( [mod, "control"], "1", + lazy.spawn("sh -c " + home + "/.screenlayout/1screen.sh"), + ), + Key( + [mod, "control"], "2", + lazy.spawn("sh -c " + home + "/.screenlayout/2screens.sh"), + ), + Key( + [mod, "control"], "3", lazy.spawn("sh -c " + home + "/.screenlayout/office.sh"), ), + Key( + [mod, "control"], "4", + lazy.spawn("sh -c " + home + "/.screenlayout/home.sh"), + ), # Switch between windows in current stack pane Key( @@ -83,6 +104,14 @@ keys = [ ), Key([mod], "Return", lazy.spawn("terminator")), Key(["control", "mod1"], "l", lazy.spawn("xautolock -locknow")), + Key([], "XF86AudioMute", lazy.spawn("pavucontrol")), + Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 3")), + Key(["shift"], "XF86MonBrightnessUp", lazy.spawn("xbacklight -set 100")), + Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 3")), + Key(["shift"], "XF86MonBrightnessDown", lazy.spawn("xbacklight -set 1")), + Key([], "XF86LaunchA", lazy.spawn("xinput set-prop 11 \"Device Enabled\" 0")), + Key(["shift"], "XF86LaunchA", lazy.spawn("xinput set-prop 11 \"Device Enabled\" 1")), + Key(['mod1', "control"], "f", lazy.spawn('/home/ars/start_ff.sh')), # Toggle between different layouts as defined below Key([mod], "Tab", lazy.next_layout()), @@ -122,8 +151,20 @@ widget_defaults = dict( def getIp(): import requests - r = requests.get("http://ipv4.nsupdate.info/myip") - return r.text + try: + r = requests.get("http://ipv4.nsupdate.info/myip") + return r.text + except: + return 'No IPv4' + + +def getIpv6(): + import requests + try: + r = requests.get("http://ipv6.nsupdate.info/myip") + return r.text + except: + return 'No IPv6' screens = [ Screen( @@ -141,7 +182,9 @@ screens = [ bottom=bar.Bar( [ widget.WindowName(), - widget.Notify(), + widget.Notify(default_timeout=10), + widget.GenPollText(func=getIpv6), + widget.Sep(), widget.GenPollText(func=getIp), widget.Sep(), widget.ThermalSensor(tag_sensor='Core 0'), @@ -186,3 +229,27 @@ auto_fullscreen = True # We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in # java that happens to be on java's whitelist. wmname = "LG3D" + + +def is_running(process): + s = subprocess.Popen(["ps", "axuw"], stdout=subprocess.PIPE) + if isinstance(process, list): + process = process[0] + + for x in s.stdout: + if re.search(process.encode(), x): + return True + return False + + +def execute_once(process): + if not is_running(process): + logging.getLogger('libqtile').warning('Starting ' + str(process)) + return subprocess.Popen(process) + else: + logging.getLogger('libqtile').warning(str(process) + ' already running. Not starting it') + + +@hook.subscribe.startup +def startup(): + execute_once('nm-applet') diff --git a/tmux.conf b/tmux.conf index f3ae5a4..1e8c7bc 100644 --- a/tmux.conf +++ b/tmux.conf @@ -9,6 +9,9 @@ set -g prefix C-a bind a send-prefix bind-key C-a last-window +# new window with current pwd +bind c new-window -c "#{pane_current_path}" + # basic settings set -g history-limit 30000 set-option -g default-shell /usr/bin/zsh diff --git a/vimrc b/vimrc index 0554112..db7f0bf 100644 --- a/vimrc +++ b/vimrc @@ -32,6 +32,7 @@ set undofile set undodir=~/.backup/ set backup set backupdir=~/.backup/ +set backupcopy=yes "" tabs and stuff set nosmartindent @@ -79,9 +80,6 @@ autocmd BufNewFile,BufReadPost *.md set formatoptions+=t autocmd BufNewFile,BufReadPost Dockerfile set filetype=dockerfile -au BufNewFile,BufRead *.mustache,*.hogan,*.hulk,*.hjs set filetype=html.mustache syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim -au BufNewFile,BufRead *.handlebars,*.hbs set filetype=html.handlebars syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim - "" Vundle " Setting up Vundle - the vim plugin bundler @@ -166,3 +164,13 @@ Bundle 'trevorrjohn/vim-obsidian' colorscheme obsidian Plugin 'othree/html5.vim' +Plugin 'othree/yajs.vim', { 'for': 'html' } +Plugin 'othree/javascript-libraries-syntax.vim' +Plugin 'vim-scripts/SyntaxComplete' +Plugin 'pangloss/vim-javascript' +Plugin 'posva/vim-vue' +au BufNewFile,BufRead *.vue set filetype=html +au BufNewFile,BufReadPost *.vue set shiftwidth=2 +au BufNewFile,BufReadPost *.vue set softtabstop=2 +au BufNewFile,BufReadPost *.js set shiftwidth=2 +au BufNewFile,BufReadPost *.js set softtabstop=2