Browse Source

Wrote combined setup scripts for user and root

red-hat-laptop
Kevin Mok 6 years ago
parent
commit
ae31b055c2
  1. 7
      configs/i3blocks-scripts/wifi
  2. 2
      configs/i3blocks/i3blocks.conf
  3. 2
      dotfiles/vimrc
  4. 33
      root-setup.sh
  5. 4
      scripts/shortcuts.sh
  6. 72
      setup.sh
  7. 4
      txt/key_files.txt

7
configs/i3blocks-scripts/wifi

@ -17,17 +17,20 @@
#------------------------------------------------------------------------
INTERFACE="${BLOCK_INSTANCE:-wlan0}"
echo $INTERFACE
# INTERFACE="${INSTANCE}"
#------------------------------------------------------------------------
# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless
# connection (think desktop), the corresponding block should not be displayed.
[[ ! -d /sys/class/net/${INTERFACE}/wireless ]] ||
[[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && exit
# [[ ! -d /sys/class/net/${INTERFACE}/wireless ]] ||
# [[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && exit
#------------------------------------------------------------------------
QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
echo $QUALITY
W_inter=$(ip link | grep "[1-9]: wlp" | cut -d " " -f2 | tr -d ':')
W_name=$(nmcli d | grep "$W_inter" | awk '{print $4}')

2
configs/i3blocks/i3blocks.conf

@ -41,7 +41,7 @@ color=#cccccc
# [wifi]
# label=
# instance=wlp3s0
# instance=wlp4s0
# interval=10
# unbold this?

2
dotfiles/vimrc

@ -37,7 +37,7 @@ autocmd Filetype css,htmldjango,html,tex,txt,markdown set tabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd Filetype markdown set textwidth=0
autocmd BufWritePost key_*.txt !bash ~/linux-config/shortcuts.sh
autocmd BufWritePost key_*.txt !bash ~/linux-config/scripts/shortcuts.sh
" }}} commands for file types "

33
root-setup.sh

@ -0,0 +1,33 @@
#!/bin/zsh
setup_marble=false
linux_config_dir=/home/kevin/linux-config
dot_dir=$linux_config_dir/dotfiles
pc=$(hostname)
# Get directory variables from script.
# List of dotfiles I want to link to system.
dotfiles=(bashrc gitconfig inputrc imwheelrc vimrc Xmodmap Xresources zshrc)
cd $dot_dir
for dotfile in $dotfiles; do
# Remove system dotfile.
rm ~/."$dotfile"
# Link dotfile in repository to system dotfile.
cp "$dot_dir"/"$dotfile" ~/."$dotfile"
done
# marble mouse {{{ #
if [[ "$setup_marble" = true ]]; then
config_file_name="10-evdev.conf"
sys_layout_file="/etc/X11/xorg.conf.d/$config_file_name"
config_dir="$linux_config_dir/x/marble-mouse"
# Remove system file.
sudo rm -rf "$sys_layout_file"
# Link config file in repository to system config location.
sudo cp "$config_dir"/"$config_file_name" "$sys_layout_file"
fi
# }}} marble mouse #

4
scripts/shortcuts.sh

@ -4,8 +4,8 @@
shellrc="$HOME/.zshrc"
# Config locations
folders="$HOME/linux-config/key_dirs.txt"
configs="$HOME/linux-config/key_files.txt"
folders="$HOME/linux-config/txt/key_dirs.txt"
configs="$HOME/linux-config/txt/key_files.txt"
# Output locations
shell_shortcuts="$HOME/.shortcuts"

72
setup.sh

@ -0,0 +1,72 @@
#!/bin/zsh
setup_marble=true
# vars {{{ #
linux_config_dir=/home/kevin/linux-config
dot_dir=$linux_config_dir/dotfiles
config_dir=$linux_config_dir/configs
sys_config_dir=~/.config
pc=$(hostname)
# }}} vars #
# dotfiles {{{ #
# link files {{{ #
# Get directory variables from script.
# List of dotfiles I want to link to system.
dotfiles=(bashrc gitconfig inputrc imwheelrc vimrc xinitrc Xmodmap Xresources zshrc)
cd $dot_dir
for dotfile in $dotfiles; do
# Remove system dotfile.
rm ~/."$dotfile"
# Link dotfile in repository to system dotfile.
ln -s "$dot_dir"/"$dotfile" ~/."$dotfile" && echo "Linked .$dotfile."
done
# }}} link files #
# setup nvim config {{{ #
orig_file="$sys_config_dir"/nvim/init.vim
# Remove system dotfile.
rm "$orig_file"
# Link dotfile in repository to system dotfile.
ln -s "$dot_dir"/nvim "$orig_file" && echo "Setup Neovim config."
# }}} setup nvim config #
# }}} dotfiles #
# configs {{{ #
cd $linux_config_dir
# List of config dirs in system config dir that I want to link to.
config_dirs=(neofetch i3 i3blocks sam-i3blocks ranger)
# config_dirs=(neofetch i3 i3blocks ranger)
for cur_dir in $config_dirs; do
# Remove system file.
rm -rf "$sys_config_dir"/"$cur_dir"
# Link config file in repository to system config location.
ln -s "$config_dir"/"$cur_dir" "$sys_config_dir"/"$cur_dir" && echo "Linked $cur_dir config."
done
# }}} configs #
# marble mouse {{{ #
if [[ "$setup_marble" = true ]]; then
config_file_name="10-evdev.conf"
sys_layout_file="/etc/X11/xorg.conf.d/$config_file_name"
config_dir="$linux_config_dir/x/marble-mouse"
# Remove system file.
sudo rm -rf "$sys_layout_file"
# Link config file in repository to system config location.
sudo ln -s "$config_dir"/"$config_file_name" "$sys_layout_file" && echo "Setup Marble mouse config."
fi
# }}} marble mouse #

4
txt/key_files.txt

@ -2,8 +2,8 @@
3 ~/.config/i3/config
3b ~/.config/i3blocks/i3blocks.conf
d ~/linux-config/key_dirs.txt
f ~/linux-config/key_files.txt
d ~/linux-config/txt/key_dirs.txt
f ~/linux-config/txt/key_files.txt
r ~/.config/ranger/rc.conf
sr ~/linux-config/configs/ranger/shortcuts.conf
ss ~/.shortcuts

Loading…
Cancel
Save