Add laptop/desktop switch

This commit is contained in:
David Aizenberg
2020-03-01 00:21:57 +02:00
parent 6006c84d1c
commit 3df9a88308
7 changed files with 475 additions and 8 deletions

8
.vimrc
View File

@@ -43,6 +43,9 @@ set cul
set number set number
highlight LineNr ctermfg=grey highlight LineNr ctermfg=grey
" map F5 to inserting the time/date
nnoremap <F5> "=strftime("%I:%M %p %a %d/%m/%Y")<CR>p
inoremap <F5> <C-R>=strftime("%I:%M %p %a %d/%m/%Y")<CR>
"set list " show invisible characters "set list " show invisible characters
"set mouse=a " try to use a mouse in the console (wimp!) "set mouse=a " try to use a mouse in the console (wimp!)
@@ -50,11 +53,14 @@ set autoindent " set the cursor at same indent as line above
set smartindent " try to be smart about indenting (C-style) set smartindent " try to be smart about indenting (C-style)
set noexpandtab set noexpandtab
" use blowfish for file encryption
set cm=blowfish
" ############################### " ###############################
" # Language Dependent settings # " # Language Dependent settings #
" ############################### " ###############################
" Shell " Shell
autocmd FileType sh setlocal expandtab shiftwidth=4 tabstop=8 softtabstop=4 autocmd FileType sh setlocal expandtab shiftwidth=4 tabstop=8 softtabstop=4

188
.zshrc Normal file
View File

@@ -0,0 +1,188 @@
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/david/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="sunaku"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# 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 nvm pip git systemadmin web-search)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
alias moc="mocp"
alias mt="neomutt"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias scrot='scrot -s ~/Pictures/Screenshots/%b%d::%H%M%S.png'
alias mem='smem -rk'
alias ss="sshch"
export PATH=/home/david/.local/bin:$PATH
alias dump="HASTE_SERVER=https://dump.aizenberg.co.uk haste"
alias ports='sudo netstat -nape --inet' #Network mon. aliases.
alias opennet='lsof -i'
alias ping='ping -c 4'
alias ns='sudo netstat -alnp --protocol=inet'
alias reload='source ~/.bashrc' # reload bash config.
alias kb="setxkbmap -layout gb,ru -option -option grp:caps_toggle,grp_led:scroll,terminate:ctrl_alt_bksp"
alias g='grep'
#Git specific aliases
alias store='git config credential.helper store'
alias gcl='git clone'
alias ga='git add'
alias gr='git reset HEAD'
alias gitwipe='git reset --hard && git clean -dfx'
alias get='git'
alias gst='git status'
alias pull='git pull'
alias push='git push'
alias commit='git commit -v -m'
alias checkout='git checkout'
alias master='git checkout master'
alias blame='git log --graph --pretty=oneline --abbrev-commit'
alias du="ncdu -rr -x --exclude .git --exclude node_modules"
alias fixtouch="xinput map-to-output 9 eDP-1"
#Automatically do an ls after each cd
cd() {
if [ -n "$1" ]; then
builtin cd "$@" && ls -hF
else
builtin cd ~ && ls -hF
fi
}
rain() {
curl -4 http://wttr.in/$1
}
# Logbook
# Idea taken from: https://news.ycombinator.com/item?id=17064520
lb() {
vim ~/Dropbox/logbooks/$(date '+%d-%m-%Y').md
}
# Get IP (call with myip)
alias myip="curl http://ipecho.net/plain; echo"
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
export PY_USER_BIN=$(python -c 'import site; print(site.USER_BASE + "/bin")')
export PATH=$PY_USER_BIN:$PATH
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Yavide alias
alias yavide="gvim --servername yavide -f -N -u /opt/yavide/.vimrc"
alias t="clear; python ~/t/t.py --task-dir ~/Dropbox --list tasks"
function ta() {
t "$1"
t
}
function tf() {
t -f "$1"
t
}

191
desktop/i3/config Normal file
View File

@@ -0,0 +1,191 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod1
set $super Mod4
# 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
exec --no-startup-id compton
#exec feh --bg-fill /home/david/Pictures/Wallpapers/ellie_full.jpg
exec_always feh --bg-center /home/david/Pictures/wall.jpg
exec setxkbmap -layout gb,ru -variant ,winkeys -option grp:caps_toggle,grp_led:scroll,terminate:ctrl_alt_bksp,compose:ralt
exec /home/david/.screenlayout/main.sh
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# Force mpv to left-most screen
for_window [class="mpv"] move to workspace 1
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle # mute sound
bindsym XF86MonBrightnessUp exec xbacklight -inc 10 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 10 # decrease screen brightness
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
# kill focused window
bindsym $mod+Shift+q kill
bindsym --release Print exec scrot -s ~/Pictures/Screenshots/%b%d::%H%M%S.png
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+Shif+j focus left
bindsym $mod+Shift+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# 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
# move focused window
#bindsym $mod+Shift+j move left
#bindsym $mod+Shift+k move down
#bindsym $mod+Shift+l move up
#bindsym $mod+Shift+semicolon move 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+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
workspace_auto_back_and_forth yes
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
bindsym $mod+c workspace tg
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
bindsym $mod+Shift+c move container to workspace tg
# mocp
#bindsym $mod+Shift+j exec "/usr/bin/mocp -G"
bindsym $mod+p exec "/usr/bin/mocp -G"
bindsym $mod+k exec "/usr/bin/mocp -f"
bindsym $mod+j exec "/usr/bin/mocp -r"
bindsym $super+l exec i3lock -i /home/david/Pictures/wall.png
# 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'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# 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 i3status
}

View File

@@ -17,9 +17,9 @@ set $super Mod4
font pango:monospace 8 font pango:monospace 8
#exec feh --bg-fill /home/david/Pictures/Wallpapers/ellie_full.jpg #exec feh --bg-fill /home/david/Pictures/Wallpapers/ellie_full.jpg
exec feh --bg-fill /home/david/Pictures/wall.jpg exec feh --bg-fill /home/david/Pictures/wall.png
exec setxkbmap -layout gb,ru -variant ,winkeys -option grp:caps_toggle,grp_led:scroll,terminate:ctrl_alt_bksp,compose:ralt exec setxkbmap -layout gb,ru -variant ,winkeys -option grp:caps_toggle,grp_led:scroll,terminate:ctrl_alt_bksp,compose:ralt
exec /home/david/.screenlayout/main.sh
# This font is widely installed, provides lots of unicode glyphs, right-to-left # This font is widely installed, provides lots of unicode glyphs, right-to-left
@@ -176,3 +176,4 @@ bindsym $mod+r mode "resize"
bar { bar {
status_command i3status status_command i3status
} }

69
laptop/i3status/config Normal file
View File

@@ -0,0 +1,69 @@
general {
colors = true
interval = 5
}
order += "wireless wlp58s0"
order += "ethernet enp0s31f6"
order += "path_exists VPN"
order += "load"
order += "tztime local"
order += "tztime berlin"
order += "battery all"
wireless wlp58s0 {
format_up = "%essid"
format_down = "wlan"
}
ethernet enp0s31f6 {
# if you use %speed, i3status requires the cap_net_admin capability
format_up = "eth: %ip (%speed)"
format_down = "eth"
}
battery all {
format = "%status %percentage %remaining %consumption"
format_down = "No battery"
last_full_capacity = true
status_chr = "⚡ CHR"
status_bat = "🔋 BAT"
status_unk = "? UNK"
status_full = "☻ FULL"
path = "/sys/class/power_supply/BAT%d/uevent"
low_threshold = 20
}
run_watch DHCP {
pidfile = "/var/run/dhclient*.pid"
}
run_watch VPNC {
# file containing the PID of a vpnc process
pidfile = "/var/run/vpnc/pid"
}
path_exists VPN {
# path exists when a VPN tunnel launched by nmcli/nm-applet is active
path = "/proc/sys/net/ipv4/conf/tun0"
}
tztime local {
format = "Day: %d Local: %H:%M"
}
tztime berlin {
format = "HH: %H:%M"
timezone = "Europe/Berlin"
}
load {
format = "%5min"
}
disk "/" {
format = "%free"
}

View File

@@ -17,6 +17,16 @@ then
echo -e "${GREEN} Deleted old backups ${RESET}" echo -e "${GREEN} Deleted old backups ${RESET}"
fi fi
read -n 1 -p "Is this desktop or laptop? (d/l/q) " ans;
case $ans in
d|D)
PLATFORM='desktop';;
l|L)
PLATFORM='laptop';;
*)
exit;;
esac
echo -e "${GREEN} Backing Up and moving configs ${RESET}" echo -e "${GREEN} Backing Up and moving configs ${RESET}"
@@ -41,14 +51,16 @@ mkdir -p ~/.vim/colors
# Create tmp dir # Create tmp dir
mkdir tmp/ mkdir tmp/
ln -rsf wmfsrc ~/.config/wmfs/wmfsrc # obsolette for now
# ln -rsf wmfsrc ~/.config/wmfs/wmfsrc
ln -rsf i3/config ~/.config/i3/config ln -rsf ${PLATFORM}/i3/config ~/.config/i3/config
ln -rsf i3status/config ~/.config/i3status/config ln -rsf ${PLATFORM}/i3status/config ~/.config/i3status/config
ln -rsf .zshrc ~/.zshrc
ln -rsf .bashrc ~/.bashrc ln -rsf .bashrc ~/.bashrc
read -p "Install screen lock unit for systemd? Requires sudo? " -n 1 -r read -p "Install screen lock unit for systemd? Requires sudo " -n 1 -r
echo echo
if [[ $REPLY =~ ^[Yy]$ ]] if [[ $REPLY =~ ^[Yy]$ ]]
then then
@@ -68,7 +80,7 @@ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
mkdir -p ~/.vim/plugin mkdir -p ~/.vim/plugin
wget "https://www.vim.org/scripts/download_script.php?src_id=26272" -O ~/.vim/plugin/switch.vim #wget "https://www.vim.org/scripts/download_script.php?src_id=26272" -O ~/.vim/plugin/switch.vim
echo -e "${GREEN} Installing Deps ${RESET}" echo -e "${GREEN} Installing Deps ${RESET}"
echo -e "vim-airline" echo -e "vim-airline"