1
0
mirror of https://github.com/Adam-Ant/dotfiles synced 2024-11-05 01:06:21 +00:00

Initial commit

This commit is contained in:
Adam Dodman 2017-04-23 00:43:18 +01:00
commit 322ad7d05d
13 changed files with 688 additions and 0 deletions

61
Xresources Normal file
View File

@ -0,0 +1,61 @@
URxvt*depth: 32
URxvt*background: #0f0f0f
URxvt*background: rgba:0000/0000/0200/c800
URxvt*font: xft:Droid Sans Mono for Powerline:size=10
URxvt*boldFont: xft:Monospace:size=11:bold
URxvt*termName: rxvt
URxvt*foreground: #dedede
URxvt*scrollBar: false
URxvt*matcher.button: 1
URxvt.transparent: false
URxvt*allow_bold: true
URxvt*urlLauncher: chromium
Xft*dpi: 96
Xft*antialias: true
Xft*hinting: full
URxvt*geometry: 85x11
URxvt*fading: 0
URxvt*tintColor: #ffffff
URxvt*shading: 0
URxvt*inheritPixmap: Fckground: #0f0f0f
! special
*.foreground: #dedede
*.background: #0f0f0f
*.cursorColor: #dedede
! black
*.color0: #39474a
*.color8: #4c5f63
! red
*.color1: #d6341f
*.color9: #e34e3b
! green
*.color2: #b85a11
*.color10: #de7c31
! yellow
*.color3: #bc5b44
*.color11: #d2725b
! blue
*.color4: #2e43df
*.color12: #6676ed
! magenta
*.color5: #b9924a
*.color13: #d69d55
! cyan
*.color6: #3c8696
*.color14: #5eb1c2
! white
*.color7: #ccb7a7
*.color15: #efd7c4
! Rofi Config

182
i3/config Normal file
View File

@ -0,0 +1,182 @@
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
#Named Workspaces
set $ws1 "1:Monitor 1"
set $ws2 "2:Monitor 2"
set $ws3 "3:Monitor 3"
set $ws4 "4:Terms 1"
set $ws5 "5:Terms 2"
set $ws6 6
set $ws7 7
set $ws8 8
set $ws9 9:Comms
set $ws10 10:Misc
# Setup screens
workspace $ws1 output HDMI-0
workspace $ws2 output DVI-D-0
workspace $ws3 output DVI-I-1
workspace $ws4 output HDMI-0
workspace $ws9 output DVI-D-0
#Cosmetic Changes
for_window [class="^.*"] border pixel 3
gaps inner 6
gaps outer 0
# Pwetty Colours!
set $bg-active #D64937
set $bg-inactive #39474A
set $bg-urgent #5EB1C2
set $dark-text #0F0F0F
set $light-text #DEDEDE
# Name Border Background Text Indicator
client.focused $bg-active $bg-active $dark-text $bg-active
client.unfocused $bg-inactive $bg-inactive $light-text $bg-inactive
client.focused_inactive $bg-inactive $bg-inactive $light-text $bg-inactive
client.urgent $bg-urgent $bg-urgent $dark-text $bg-urgent
client.placeholder #000000 #0C0C0C #FFFFFF
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
# Programs to run on startup:
# Background Tasks
exec --no-startup-id compton -CG --config ~/.config/compton.conf
exec --no-startup-id feh --bg-scale 'Pictures/1920x1080.png' --bg-scale 'Pictures/2560x1080.png' --bg-scale 'Pictures/1920x1080.png'
# Set up the workspaces
exec --no-startup-id sleep 5 && teamspeak3
exec --no-startup-id urxvt -name music -e ncmpcpp
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
#Assign certain programs to certain workspaces
assign [instance="ts3client_linux_amd64"] $ws9
assign [class="chromium"] $ws3
assign [instance="music" class="URxvt"] $ws10
# start a terminal
bindsym $mod+Return exec urxvt
# kill focused window
bindsym $mod+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id rofi -show run
#Screenshots!
bindsym --release Print exec imgur-screenshot -s
bindsym --release $mod+Print exec imgur-screenshot -f
#Gist the clipboard:
bindsym --release $mod+p exec gist -cpPR
#Lock the screen:
bindsym --release $mod+l exec ~/.config/i3/lock.sh
#Chromium
bindsym --release $mod+c exec chromium
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Tab floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
#bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
bindsym $mod+Shift+e exec ~/.config/i3/powermenu.sh
bindsym $mod+numbersign exec ~/.config/i3/passmenu.sh
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command i3blocks -c ~/.config/i3/i3blocks
strip_workspace_numbers yes
position bottom
}

1
i3/i3 Symbolic link
View File

@ -0,0 +1 @@
/home/adam/.config/i3

153
i3/i3blocks Normal file
View File

@ -0,0 +1,153 @@
# i3blocks config file
#
# Please see man i3blocks for a complete reference!
# The man page is also hosted at http://vivien.github.io/i3blocks
#
# List of valid properties:
#
# align
# color
# command
# full_text
# instance
# interval
# label
# min_width
# name
# separator
# separator_block_width
# short_text
# signal
# urgent
# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
command=/usr/lib/i3blocks/$BLOCK_NAME
separator_block_width=15
markup=none
# Volume indicator
#
# The first parameter sets the step (and units to display)
# The second parameter overrides the mixer selection
# See the script for details.
[volume]
label=VOL
#label=♪
instance=Master
#instance=PCM
interval=once
signal=10
# Memory usage
#
# The type defaults to "mem" if the instance is not specified.
[memory]
label=MEM
separator=false
interval=30
[memory]
label=SWAP
instance=swap
separator=false
interval=30
# Disk usage
#
# The directory defaults to $HOME if the instance is not specified.
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
[disk]
label=HOME
#instance=/mnt/data
interval=30
# Network interface monitoring
#
# If the instance is not specified, use the interface used for default route.
# The address can be forced to IPv4 or IPv6 with -4 or -6 switches.
[iface]
#instance=wlan0
color=#00FF00
interval=10
separator=false
[wifi]
#instance=wlp3s0
interval=10
separator=false
[bandwidth]
#instance=eth0
interval=5
# CPU usage
#
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
[cpu_usage]
label=CPU
interval=10
min_width=CPU: 100.00%
#separator=false
#[load_average]
#interval=10
# Battery indicator
#
# The battery instance defaults to 0.
[battery]
label=BAT
#label=⚡
#instance=1
interval=30
# Date Time
#
[time]
command=date '+%Y-%m-%d %H:%M:%S'
interval=5
# Generic media player support
#
# This displays "ARTIST - SONG" if a music is playing.
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
#[mediaplayer]
#instance=spotify
#interval=5
#signal=10
# OpenVPN support
#
# Support multiple VPN, with colors.
#[openvpn]
#interval=20
# Temperature
#
# Support multiple chips, though lm-sensors.
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
#[temperature]
#label=TEMP
#interval=10
# Key indicators
#
# Add the following bindings to i3 config file:
#
# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
#[keyindicator]
#instance=CAPS
#interval=once
#signal=11
#[keyindicator]
#instance=NUM
#interval=once
#signal=11

BIN
i3/lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

36
i3/lock.sh Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
icon="$HOME/.config/i3/lock.png"
tmpbg='/tmp/lock.png'
(( $# )) && { icon=$1; }
# screenshot
scrot "$tmpbg"
PX=0
PY=0
# lockscreen image info
R=$(file $icon | grep -o '[0-9]* x [0-9]*')
RX=$(echo $R | cut -d' ' -f 1)
RY=$(echo $R | cut -d' ' -f 3)
RES=$(xrandr --query | grep 'HDMI-0' | cut -f4 -d' ')
# monitor position/offset
SRX=$(echo $RES | cut -d'x' -f 1) # x pos
SRY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 1) # y pos
SROX=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 2) # x offset
SROY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 3) # y offset
PX=$(($SROX + $SRX/2 - $RX/2))
PY=$(($SROY + $SRY/2 - $RY/2))
# pixelize and add lock icon
convert $tmpbg -scale 5% -scale 2000% $tmpbg
convert $tmpbg $icon -geometry +$PX+$PY -composite -matte $tmpbg
i3lock -i "$tmpbg" -n -e
rm "$tmpbg"

14
i3/newpass.sh Executable file
View File

@ -0,0 +1,14 @@
ROFI_OPTIONS="-bw 4 -width 80 -lines 1 -location 6 -yoffset -50"
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
ROFI_PATH=$(printf '%s\n' "${password_files[@]}" | rofi -dmenu -p "Path: " -sync $ROFI_OPTIONS)
USERNAME=$(rofi -dmenu -p "Username: " $ROFI_OPTIONS)
URL=$(rofi -dmenu -p "URL: " $ROFI_OPTIONS)
printf "REPLACEME\nUsername: %s\nURL: %s" "$USERNAME" "$URL" | pass insert -m $ROFI_PATH
pass generate -ci $ROFI_PATH

12
i3/passmenu.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
password=$(printf '%s\n' "${password_files[@]}" | rofi -dmenu -p "Password: " -bw 4 -i -width 80 -lines 3 -location 6 -no-custom -sync -yoffset -50 "$@")
[[ -n $password ]] || exit
pass show -c "$password" 2>/dev/null

15
i3/powermenu.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
option=$(echo "Lock|Logout|Sleep|Power Off|Restart|Windows" | rofi -sep "|" -dmenu -i -p "Power Menu" -auto-select -hide-scrollbar -width -10 -lines 6 -eh 2 -line-margin 6 -bw 7| xargs)
case $option in
Lock) ./lock.sh;;
Logout) i3-msg exit;;
Sleep) systemctl suspend;;
'Power Off') systemctl poweroff;;
Restart) systemctl reboot;;
Windows)
windows=`efibootmgr | grep -Po -m1 'Boot\K(\d{4}).*Windows.*' | head -c4`
`sudo efibootmgr -n $windows`
reboot;;
esac
exit 0

4
makelinks.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
ln -s ~/.dotfiles/zsh/zshrc .zshrc
ln -s ~/.dotfiles/i3 ~/.config/i3
ln -s ~/.dotfiles/Xresources ~/.Xresources

66
zsh/gitstatus.py Normal file
View File

@ -0,0 +1,66 @@
#!/usr/bin/env python
#Code borrowed from https://github.com/olivierverdier/zsh-git-prompt/
from __future__ import print_function
# change this symbol to whatever you prefer
prehash = ':'
from subprocess import Popen, PIPE
import sys
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
branch, error = gitsym.communicate()
error_string = error.decode('utf-8')
if 'fatal: Not a git repository' in error_string:
sys.exit(0)
branch = branch.decode("utf-8").strip()[11:]
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
err_string = err.decode('utf-8')
if 'fatal' in err_string:
sys.exit(0)
changed_files = [namestat[0] for namestat in res.decode("utf-8").splitlines()]
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
nb_changed = len(changed_files) - changed_files.count('U')
nb_U = staged_files.count('U')
nb_staged = len(staged_files) - nb_U
staged = str(nb_staged)
conflicts = str(nb_U)
changed = str(nb_changed)
nb_untracked = len([0 for status in Popen(['git','status','--porcelain',],stdout=PIPE).communicate()[0].decode("utf-8").splitlines() if status.startswith('??')])
untracked = str(nb_untracked)
ahead, behind = 0,0
if not branch: # not on any branch
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
else:
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name:
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name == '.': # local
remote_ref = merge_name
else:
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
revlist = revgit.communicate()[0]
if revgit.poll(): # fallback to local
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
behead = revlist.decode("utf-8").splitlines()
ahead = len([x for x in behead if x[0]=='>'])
behind = len(behead) - ahead
out = ' '.join([
branch,
str(ahead),
str(behind),
staged,
conflicts,
changed,
untracked,
])
print(out, end='')

109
zsh/zshgit.sh Normal file
View File

@ -0,0 +1,109 @@
# Code borrowed from https://github.com/olivierverdier/zsh-git-prompt
# To install source this file from your .zshrc file
# see documentation at http://linux.die.net/man/1/zshexpn
# A: finds the absolute path, even if this is symlinked
# h: equivalent to dirname
export __GIT_PROMPT_DIR=${0:A:h}
export GIT_PROMPT_EXECUTABLE=${GIT_PROMPT_EXECUTABLE:-"python"}
# Initialize colors.
autoload -U colors
colors
# Allow for functions in the prompt.
setopt PROMPT_SUBST
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_update_git_vars
add-zsh-hook preexec preexec_update_git_vars
add-zsh-hook precmd precmd_update_git_vars
## Function definitions
function preexec_update_git_vars() {
case "$2" in
git*|hub*|gh*|stg*)
__EXECUTED_GIT_COMMAND=1
;;
esac
}
function precmd_update_git_vars() {
if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ ! -n "$ZSH_THEME_GIT_PROMPT_CACHE" ]; then
update_current_git_vars
unset __EXECUTED_GIT_COMMAND
fi
}
function chpwd_update_git_vars() {
update_current_git_vars
}
function update_current_git_vars() {
unset __CURRENT_GIT_STATUS
if [[ "$GIT_PROMPT_EXECUTABLE" == "python" ]]; then
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
_GIT_STATUS=`python ${gitstatus} 2>/dev/null`
fi
if [[ "$GIT_PROMPT_EXECUTABLE" == "haskell" ]]; then
_GIT_STATUS=`git status --porcelain --branch &> /dev/null | $__GIT_PROMPT_DIR/src/.bin/gitstatus`
fi
__CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
GIT_BEHIND=$__CURRENT_GIT_STATUS[3]
GIT_STAGED=$__CURRENT_GIT_STATUS[4]
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5]
GIT_CHANGED=$__CURRENT_GIT_STATUS[6]
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
}
git_super_status() {
precmd_update_git_vars
if [ -n "$__CURRENT_GIT_STATUS" ]; then
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
if [ "$GIT_BEHIND" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
fi
if [ "$GIT_AHEAD" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}"
fi
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
if [ "$GIT_STAGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
fi
if [ "$GIT_CONFLICTS" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
fi
if [ "$GIT_CHANGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
fi
if [ "$GIT_UNTRACKED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
fi
if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
echo "$STATUS"
fi
}
# Default values for the appearance of the prompt. Configure at will.
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}"
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}"
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}"
ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{…%G%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"

35
zsh/zshrc Normal file
View File

@ -0,0 +1,35 @@
##General QOL
alias la='ls -lah --color=auto'
alias ls='ls -h --color=auto'
eval "$(thefuck --alias)"
dme (){ eval $(docker-machine env "$@");}
alias dmssh='docker-machine ssh'
alias dm='docker-machine'
alias dps='docker ps'
alias dpsa='docker ps -a'
alias drm='docker rm'
alias drmi='docker rmi'
alias dim='docker images'
alias dbl='docker build'
alias dbl.='docker build .'
alias drun='docker run -ti'
alias dkl='docker kill'
alias dalpine='docker run -ti --rm alpine:3.5 /bin/sh'
alias drm-stopped='docker rm -v $(docker ps -a -q -f status=exited)'
alias drmi-untag='docker rmi $(docker images -f "dangling=true" -q)'
dsh() {
docker exec -ti $1 /bin/sh
}
alias pacup='pacaur -Syu'
alias pacrm='pacaur -Rs'
alias pacadd='pacaur -S'
alias shred='shred -uzn 5'
#VirtualEnv
export WORKON_HOME=$HOME/.virtualenvs # optional
export PROJECT_HOME=$HOME/Sync/Programming/Python # optional
source /usr/bin/virtualenvwrapper.sh