initial commit: basic setup script centered around arch linux

This commit is contained in:
puffaboo 2022-07-14 18:30:30 +01:00
commit 8bfec4fc45
9 changed files with 429 additions and 0 deletions

36
Xorg/.xinitrc Normal file
View File

@ -0,0 +1,36 @@
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec herbstluftwm --locked

188
Xorg/autostart Normal file
View File

@ -0,0 +1,188 @@
#!/usr/bin/env bash
# this is a simple config for herbstluftwm
hc() {
herbstclient "$@"
}
hc emit_hook reload
xsetroot -solid '#5A8E3A'
# remove all existing keybindings
hc keyunbind --all
TERMINAL=urxvt
# keybindings
# if you have a super key you will be much happier with Mod set to Mod4
Mod=Mod4 # Use alt as the main modifier
#Mod=Mod4 # Use the super key as the main modifier
hc keybind $Mod-Shift-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close
hc keybind $Mod-Return spawn "bemenu-run"
hc keybind $Mod-Home spawn "${TERMINAL:-xterm}" # use your $TERMINAL with xterm as fallback
# Move focused window to another monitor
hc keybind $Mod-Shift-1 shift_to_monitor -l
hc keybind $Mod-Shift-2 shift_to_monitor -r
# basic movement in tiling and floating mode
# focusing clients
hc keybind $Mod-Left focus left
hc keybind $Mod-Down focus down
hc keybind $Mod-Up focus up
hc keybind $Mod-Right focus right
hc keybind $Mod-h focus left
hc keybind $Mod-j focus down
hc keybind $Mod-k focus up
hc keybind $Mod-l focus right
# moving clients in tiling and floating mode
hc keybind $Mod-Shift-Left shift left
hc keybind $Mod-Shift-Down shift down
hc keybind $Mod-Shift-Up shift up
hc keybind $Mod-Shift-Right shift right
hc keybind $Mod-Shift-h shift left
hc keybind $Mod-Shift-j shift down
hc keybind $Mod-Shift-k shift up
hc keybind $Mod-Shift-l shift right
# splitting frames
# create an empty frame at the specified direction
hc keybind $Mod-u split bottom 0.5
hc keybind $Mod-o split right 0.5
# let the current frame explode into subframes
hc keybind $Mod-Control-space split explode
# resizing frames and floating clients
resizestep=0.02
hc keybind $Mod-Control-h resize left +$resizestep
hc keybind $Mod-Control-j resize down +$resizestep
hc keybind $Mod-Control-k resize up +$resizestep
hc keybind $Mod-Control-l resize right +$resizestep
hc keybind $Mod-Control-Left resize left +$resizestep
hc keybind $Mod-Control-Down resize down +$resizestep
hc keybind $Mod-Control-Up resize up +$resizestep
hc keybind $Mod-Control-Right resize right +$resizestep
# tags
tag_names=( {1..9} )
tag_keys=( {1..9} 0 )
hc rename default "${tag_names[0]}" || true
for i in "${!tag_names[@]}" ; do
hc add "${tag_names[$i]}"
key="${tag_keys[$i]}"
if ! [ -z "$key" ] ; then
hc keybind "$Mod-$key" use_index "$i"
hc keybind "$Mod-Shift-$key" move_index "$i"
fi
done
# cycle through tags
#hc keybind $Mod-period use_index +1 --skip-visible
#hc keybind $Mod-comma use_index -1 --skip-visible
# layouting
hc keybind $Mod-r remove
hc keybind $Mod-s spawn "/usr/local/bin/scr"
hc keybind $Mod-f fullscreen toggle
hc keybind $Mod-Shift-f set_attr clients.focus.floating toggle
hc keybind $Mod-Shift-m set_attr clients.focus.minimized true
# restore all minimized windows of the focused tag
hc keybind $Mod-Ctrl-m foreach CLIENT clients. \
sprintf MINATT "%c.minimized" CLIENT \
sprintf TAGATT "%c.tag" CLIENT and \
, compare MINATT "=" "true" \
, substitute FOCUS "tags.focus.name" compare TAGATT "=" FOCUS \
, set_attr MINATT false
hc keybind $Mod-p pseudotile toggle
# The following cycles through the available layouts within a frame, but skips
# layouts, if the layout change wouldn't affect the actual window positions.
# I.e. if there are two windows within a frame, the grid layout is skipped.
hc keybind $Mod-space \
or , and . compare tags.focus.curframe_wcount = 2 \
. cycle_layout +1 vertical horizontal max vertical grid \
, cycle_layout +1
# mouse
hc mouseunbind --all
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize
# focus
hc keybind $Mod-BackSpace cycle_monitor
hc keybind $Mod-Tab cycle_all +1
hc keybind $Mod-Shift-Tab cycle_all -1
hc keybind $Mod-c cycle
hc keybind $Mod-i jumpto urgent
# theme
hc attr theme.tiling.reset 1
hc attr theme.floating.reset 1
hc set frame_border_active_color '#222222'
hc set frame_border_normal_color '#101010'
hc set frame_bg_normal_color '#565656'
hc set frame_bg_active_color '#345F0C'
hc set frame_border_width 1
hc set always_show_frame on
hc set frame_bg_transparent on
hc set frame_transparent_width 5
hc set frame_gap 4
hc attr theme.title_height 15
hc attr theme.title_font 'Dejavu Sans:pixelsize=12' # example using Xft
# hc attr theme.title_font '-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
hc attr theme.padding_top 2 # space below the title's baseline (i.e. text depth)
hc attr theme.active.color purple #'#9fbc00'
hc attr theme.normal.color '#454545'
hc attr theme.urgent.color orange
hc attr theme.inner_width 1
hc attr theme.inner_color black
hc attr theme.border_width 3
hc attr theme.floating.border_width 4
hc attr theme.floating.outer_width 1
hc attr theme.floating.outer_color black
hc attr theme.active.inner_color '#3E4A00'
hc attr theme.active.outer_color '#3E4A00'
hc attr theme.background_color '#141414'
hc set window_gap 0
hc set frame_padding 0
hc set smart_window_surroundings off
hc set smart_frame_surroundings on
hc set mouse_recenter_gap 0
# rules
hc unrule -F
#hc rule class=XTerm tag=3 # move all xterms to tag 3
hc rule focus=on # normally focus new clients
hc rule floatplacement=smart
#hc rule focus=off # normally do not focus new clients
# give focus to most common terminals
#hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=on
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
hc set tree_style '╾│ ├└╼─┐'
# unlock, just to be sure
hc unlock
# do multi monitor setup here, e.g.:
# hc set_monitors 1280x1024+0+0 1280x1024+1280+0
# or simply:
hc detect_monitors
# find the panel
panel=~/.config/herbstluftwm/panel.sh
[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
for monitor in $(hc list_monitors | cut -d: -f1) ; do
# start it on each monitor
"$panel" "$monitor" &
done

29
fish/config.fish Executable file
View File

@ -0,0 +1,29 @@
alias reboot "shutdown -r now"
setenv BROWSER "/usr/bin/firefox"
setenv TERM "xterm-256color"
setenv TERMINAL "kitty"
set fish_greeting ""
set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1
set -g __fish_git_prompt_color_branch -o blue
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
set -g __fish_git_prompt_char_upstream_prefix ""
set -g __fish_git_prompt_char_stagedstate "●"
set -g __fish_git_prompt_char_dirtystate "✚"
set -g __fish_git_prompt_char_untrackedfiles "…"
set -g __fish_git_prompt_char_conflictedstate "✖"
set -g __fish_git_prompt_char_cleanstate "✔"
set -g __fish_git_prompt_color_dirtystate blue
set -g __fish_git_prompt_color_stagedstate yellow
set -g __fish_git_prompt_color_invalidstate red
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
set -g __fish_git_prompt_color_cleanstate -o green
set -g __fish_git_prompt_color_prefix -o blue
set -g __fish_git_prompt_color_suffix -o blue

15
fish/functions/fish_prompt.fish Executable file
View File

@ -0,0 +1,15 @@
function fish_prompt
set_color $fish_color_cwd
echo -n \(
set_color magenta
echo -n \[(echo -n $USER)\]
set_color $fish_color_cwd
echo -n (hostname):
set_color cyan
echo -n (prompt_pwd)
set_color $fish_color_cwd
echo -n (fish_git_prompt)
echo -n \)
set_color normal
echo -n ' > '
end

8
fish/functions/prompt_pwd.fish Executable file
View File

@ -0,0 +1,8 @@
function prompt_pwd --description 'Print the current working directory, NOT shortened to fit the prompt'
if test "$PWD" != "$HOME"
printf "%s" (echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|")
else
echo '~'
end
end

4
post-install.fish Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/fish
fish_add_path /usr/local/go/bin
fish_add_path $HOME/.cargo/bin

111
setup.sh Executable file
View File

@ -0,0 +1,111 @@
#!/bin/sh
set -e
START_DIR=$(pwd)
INITENV_DIR=$(dirname "$0")
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH_GO="amd64"
fi
if [ "$ARCH" = "aarch64" ]; then
ARCH_GO="arm64"
fi
setup_configs() {
mkdir -p $HOME/.config
mkdir -p $HOME/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDtHnwPdfiqbqK+kh9DrVpNfPLuukBFvPbaZNhH1Ih59m0NxpiqMnfUeKTvBz9tHixcGCZ59jj8Lhy6egB5SXQBm2YUadfQKk5hNPJaRuBLP2Vj35PO6E6HZfx3brPumdDCqL35G1I/8KSryQF5q7u+VSKVkjQCA5Cdaz8IOtU9kfyzRPUYXIxvSlCVFjuviBVerjBopa9HwrzhYq5PTftmyuWOiV8nzxhlcAju2Xe8yvZJcyusFABmjNimY366pQYAaXX2Uxi4nP4C8WL+axYliLV/FxAZSpk51LP9cfQkHGV7jEZQzf/M02DPlo7NR7VRULaJlWaVYulT/LbuQecpr+KimaB62GkWbjX5tG/dc3RsL0yz+UcrYD2bYd0PZpakIvnwQOaMxrJYyWOZrTsw7X/lBWNb1M62xN828pZ3PfqGkWGzVaH09Jb24U4yHyYrfAU/RKiHnvVyw2ISl3SCz20fhiIGOV7lhDtTyVOLau16AluQDz0U3fcYV2Eipa4euOf7sShoFsJg8N5R9EG0ZvmQathEN856ViaJZE3SIkvyQ5epngrc1IdZPGH/4fQabywgiEa0vk6ZDW7RuvZXztpHDWZpmd7zXL98vSplvEYuT1VFk9DwAIcbGIK2Xwfedt1GDsCsdGY+eZ0LZMCDAa0DPTydjic7/6xVl78iYQ== emilisbliudzius@gmail.com" >$HOME/.ssh/authorized_keys
}
setup_Xorg() {
mkdir -p $HOME/.config/herbstluftwm/
cp $INITENV_DIR/Xorg/autostart $HOME/.config/herbstluftwm/
cp $INITENV_DIR/Xorg/.xinitrc $HOME/
}
setup_fishe() {
cp -r $INITENV_DIR/fish $HOME/.config/
}
setup_golang() {
mkdir $INITENV_DIR/go-tmp
cd $INITENV_DIR/go-tmp
GO_VERSION=$(curl https://go.dev/VERSION\?m=text)
GO_ARCHIVE="$GO_VERSION.linux-$ARCH_GO.tar.gz"
wget "https://dl.google.com/go/$GO_ARCHIVE"
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf $GO_ARCHIVE
rm $GO_ARCHIVE
cd $START_DIR
}
setup_rust() {
wget https://sh.rustup.rs -O $INITENV_DIR/rustup.sh
chmod +x $INITENV_DIR/rustup.sh
sh $INITENV_DIR/rustup.sh -yq
rm $INITENV_DIR/rustup.sh
}
setup_pkgs() {
if [ ! -f "/etc/arch-release" ]; then
echo "Not on arch, skipping installing packages"
return
fi
setup_aur
yay --noconfirm -S ttf-twemoji-color
sudo pacman -Sy --noconfirm fish bat code vim flameshot herbstluftwm \
kitty xorg-server xorg-xrandr xorg-xinit ttf-dejavu ttf-fira-code ttf-hanazono \
ttf-liberation ttf-liberation ttf-liberation wget man \
inetutils tar xz unzip bemenu-x11 bemenu firefox base-devel pipewire
}
setup_aur() {
sudo pacman --noconfirm -Sy git autoconf
mkdir -p $INITENV_DIR/yay-bin
git clone https://aur.archlinux.org/yay-bin.git $INITENV_DIR/yay-bin
cd $INITENV_DIR/yay-bin
makepkg --noconfirm -si
cd $START_DIR
rm -rf $INITENV_DIR/yay-bin
}
setup_vscode() {
yay --noconfirm -Sy code-marketplace
mkdir -p $HOME/.config/Code\ -\ OSS/User/
cp $INITENV_DIR/vscode/settings.json $HOME/.config/Code\ -\ OSS/User/
cp $INITENV_DIR/vscode/keybindings.json $HOME/.config/Code\ -\ OSS/User/
# Extensions
extensions="golang.Go rust-lang.rust-analyzer vadimcn.vscode-lldb
bungcip.better-toml eamodio.gitlens vscodevim.vim donjayamanne.githistory
ziyasal.vscode-open-in-github"
for ext in $extensions; do
code --install-extension $ext --force
done
# Go tools for vscode
/usr/local/go/bin/go install github.com/cweill/gotests/...@latest
/usr/local/go/bin/go install github.com/fatih/gomodifytags@latest
/usr/local/go/bin/go install github.com/josharian/impl@latest
/usr/local/go/bin/go install github.com/haya14busa/goplay/cmd/goplay@latest
/usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest
/usr/local/go/bin/go install honnef.co/go/tools/cmd/staticcheck@latest
/usr/local/go/bin/go install golang.org/x/tools/gopls@latest
}
setup_finisher() {
fish $INITENV_DIR/post-install.fish
sudo chsh -s $(which fish) $USER
echo "all done."
fish
}
setup_configs
setup_pkgs
setup_rust
setup_golang
setup_fishe
setup_Xorg
setup_vscode
setup_finisher

11
vscode/keybindings.json Normal file
View File

@ -0,0 +1,11 @@
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+numpad_add",
"command": "editor.action.fontZoomIn"
},
{
"key": "ctrl+numpad_subtract",
"command": "editor.action.fontZoomOut"
}
]

27
vscode/settings.json Normal file
View File

@ -0,0 +1,27 @@
{
"files.autoSave": "onFocusChange",
"telemetry.telemetryLevel": "off",
"files.insertFinalNewline": true,
"vim.handleKeys": {
"<C-d>": false,
"<C-c>": false,
"<C-v>": false,
"<C-x>": false,
"<C-f>": false,
"<C-a>": false,
},
"go.formatTool": "gofumpt",
// "editor.formatOnSave": false,
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"editor.detectIndentation": false,
"go.docsTool": "gogetdoc",
"editor.suggestSelection": "first",
"files.associations": {
"*.ts": "typescript"
},
"[typescript]": {
"editor.formatOnSave": false
},
"go.toolsManagement.autoUpdate": true
}