Initial Commit

This commit is contained in:
Didier Slof 2022-12-16 14:23:28 +01:00
commit fb9e4f9eff
Signed by: didier
GPG key ID: 01E71F18AA4398E5
18 changed files with 564 additions and 0 deletions

11
README.md Normal file
View file

@ -0,0 +1,11 @@
# Dotfiles (v2)
This repo has a simple sync script with a few features:
- file sync (not symlinked anymore)
- package install
- after install commands
- deploy script
## Notes
- `gpackage.list`
This is a list with packages only installed if the `-g` or `--graphical` flag is used.

0
command.list Normal file
View file

View file

@ -0,0 +1,10 @@
bell:
animation: 'Ease'
duration: 50
color: '#555555'
cursor:
style:
shape: 'Block'
blinking: 'On'
blink_interval: 500

View file

@ -0,0 +1 @@
/home/didier/.local/dotfiles/./files/kitty/kitty.conf

View file

@ -0,0 +1 @@
@theme "Arc-Dark"

246
files/%HOME/.config/sway/config Executable file
View file

@ -0,0 +1,246 @@
# Faulty's sway Config
set $mod Mod1
set $sup Mod4
set $terminal kitty #sway-sensible-terminal
set $browser firefox
set $editor gedit
#font pango:monospace 8
font pango:DejaVu Sans Mono 8
#! Startup Applications
exec --no-startup-id xss-lock --transfer-sleep-lock -- swaylock --nofork
exec --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11
exec --no-startup-id nm-applet
exec thunderbird
exec discord
set $lock swaylock -c "#000000"
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (Shift+r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id $lock, mode "default"
bindsym e exec --no-startup-id sway exit, mode "default"
bindsym s exec --no-startup-id $lock && systemctl suspend, mode "default"
bindsym h exec --no-startup-id $lock && systemctl hibernate, mode "default"
bindsym Shift+r exec --no-startup-id systemctl reboot, mode "default"
bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $sup+Delete mode "$mode_system"
bindsym $sup+l exec --no-startup-id $lock
#! Media
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_swaystatus
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_swaystatus
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_swaystatus
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_swaystatus
#! Light
bindsym XF86MonBrightnessUp exec light -A 10 # increase screen brightness
bindsym XF86MonBrightnessDown exec light -U 10 # decrease screen brightness
#! Customization
# class border backgr. text indicator child_border
client.focused #000000 #222299 #ffffff #000000 #222222
client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a
client.unfocused #333333 #222222 #888888 #292d2e #222222
client.urgent #EF2929 #900000 #ffffff #900000 #900000
client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c
client.background #888A85
#exec --no-startup-id xsetroot -solid "#333333"
exec --no-startup-id swaybg -i ~/Pictures/background.png
no_focus [class="Fig" instance="fig" window_role="autocomplete"]
for_window [class="Fig" instance="fig" window_role="autocomplete"] border pixel 0
#! Navigation
set $up l
set $down k
set $left j
set $right semicolon
# use Mouse+Mod1 to drag floating windows to their wanted position
floating_modifier $sup
#! Applications
bindsym $sup+Return exec $terminal
bindsym $sup+q exec $browser
bindsym $sup+d exec rofi -show run
bindsym $sup+Shift+d exec --no-startup-id rofi -show drun
bindsym Ctrl+Print exec --no-startup-id grim ~/Pictures/Screenshots/$(date +"%d-%m-%y_%H:%M:%S").png
bindsym Print exec --no-startup-id grim - | xclip -selection clipboard -t image/png
# kill focused window
bindsym $sup+Shift+q kill
# change focus
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+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right 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
#! Layouts
# change container layout (stacked, tabbed, toggle split)
bindsym $sup+s layout stacking
bindsym $sup+w layout tabbed
bindsym $sup+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 Mod1+d focus child
# move the currently focused window to the scratchpad
bindsym $sup+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $sup+minus scratchpad show
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
#! Workspaces
set $ws1 "1: main"
set $ws2 "2: browse"
set $ws3 "3: term"
set $ws4 "4: other"
set $ws5 "5: other"
set $ws6 "6: other"
set $ws7 "7: other"
set $ws8 "8: business"
set $ws9 "9: talk"
set $ws10 "10: misc"
#! Assignments
assign [class="Spotify"] $ws10
assign [class="firefox"] $ws2
assign [class="thunderbird"] $ws8
assign [class="discord"] $ws9
assign [class="jetbrains-idea-ce"] $ws1
bindsym $sup+$left workspace prev
bindsym $sup+$right workspace next
# alter.. youknow what is coming
bindsym $sup+Left workspace prev
bindsym $sup+Right workspace next
# switch to workspace
bindsym $sup+1 workspace number $ws1
bindsym $sup+2 workspace number $ws2
bindsym $sup+3 workspace number $ws3
bindsym $sup+4 workspace number $ws4
bindsym $sup+5 workspace number $ws5
bindsym $sup+6 workspace number $ws6
bindsym $sup+7 workspace number $ws7
bindsym $sup+8 workspace number $ws8
bindsym $sup+9 workspace number $ws9
bindsym $sup+0 workspace number $ws10
# move focused container to workspace
bindsym $sup+Shift+1 move container to workspace number $ws1
bindsym $sup+Shift+2 move container to workspace number $ws2
bindsym $sup+Shift+3 move container to workspace number $ws3
bindsym $sup+Shift+4 move container to workspace number $ws4
bindsym $sup+Shift+5 move container to workspace number $ws5
bindsym $sup+Shift+6 move container to workspace number $ws6
bindsym $sup+Shift+7 move container to workspace number $ws7
bindsym $sup+Shift+8 move container to workspace number $ws8
bindsym $sup+Shift+9 move container to workspace number $ws9
bindsym $sup+Shift+0 move container to workspace number $ws10
#! sway manage
# reload the configuration file
bindsym $sup+Shift+c reload
# restart sway inplace (preserves your layout/session, can be used to upgrade sway)
bindsym $sup+Shift+r restart
# exit sway (logs you out of your X session)
bindsym $sup+Shift+e exec "swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your X session.' -B 'Yes, exit sway' 'sway exit'"
# edit config
bindsym $sup+Shift+Alt+c exec "$editor ~/.config/sway/config"
#! Resize
# 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 $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
# 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 or Mod1+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $sup+r mode "default"
}
bindsym $sup+r mode "resize"
input "1102:4629:ALP0016:00_044E:1215" {
tap enabled
natural_scroll enabled
}
bar {
position top
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command while ~/.config/sway/status.sh; do printf ''; done
colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}

View file

@ -0,0 +1,25 @@
import socket
from datetime import datetime
from psutil import disk_usage, sensors_battery
from psutil._common import bytes2human
import socket
from subprocess import check_output
from sys import stdout
from time import sleep
def write(data):
stdout.write('%s\n' % data)
stdout.flush()
def refresh():
disk = f"{bytes2human(disk_usage('/').used)} / {bytes2human(disk_usage('/').total)} ({bytes2human(disk_usage('/').free)})"
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname+".")
battery = int(sensors_battery().percent)
status = "Charging" if sensors_battery().power_plugged else "Discharging"
date = datetime.now().strftime('%h %d %A %H:%M:%S')
write(f"d: {disk} | n: {hostname} @ {ip} | b: {battery}% ({status.lower()[:3]}) | {date}")
while True:
refresh()
sleep(1)

View file

@ -0,0 +1,16 @@
#!/bin/sh
uptimef=$(uptime | cut -d ',' -f1 | cut -d ' ' -f4,5)
datef=$(date "+%a %F %H:%M:%S")
linux_version=$(uname -r | cut -d '-' -f1)
battery_status=$(cat /sys/class/power_supply/BAT0/status)
battery_percent=$(cat /sys/class/power_supply/BAT0/capacity)
#audio_volume=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master))
audio_volume=$(pamixer --get-volume)%
disk_usage=$(df -kh / | grep dev | awk '{print $5}')
mem_used=$(free | awk '/Mem/{printf("%.2f%"), $3/$2*100}')
local_ip=$(ip addr show wlp58s0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
# 💎 💻 💡 🔌 ⚡ 📁 \|
printf "📁 %3s | 💎 %7s | 💻 %s | 📶 %s | 🐧 %7s | 🔋 %7s | 🔉 %4s | %s\n" \
"$disk_usage" "$mem_used" "$uptimef" "$local_ip" "$linux_version" "$battery_percent% ($battery_status)" "$audio_volume" "$datef"
sleep 1

2
files/%HOME/.vimrc Executable file
View file

@ -0,0 +1,2 @@
set number
set relativenumber

33
files/%HOME/.zshrc Normal file
View file

@ -0,0 +1,33 @@
export GPG_TTY=$(tty)
source ~/.zsh_preferences
# paths
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
if [ $_ZSH_PREF_NO_NONSENSE != 1 ]; then
# ZSH
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="afowler"
plugins=(git docker docker-compose node zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
source ~/.zsh_scripts
# ALIASES
alias open="xdg-open"
alias nobeep="sudo modprobe -r pcspkr"
alias bl="sudo light -S"
alias kssh="kitty +kitten ssh"
alias get_idf='. $HOME/esp/esp-idf/export.sh'
alias get_rust='. $HOME/.cargo/env'
# COSMETICS
if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then pfetch; fi
else
PS1="$(whoami)@$(cat /etc/hostname) $ "
fi
alias q="exit"
export PATH="${PATH}:/home/${USER}/.local/bin"

100
files/etc/pacman.conf Normal file
View file

@ -0,0 +1,100 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
#Color
#NoProgressBar
CheckSpace
#VerbosePkgLists
ParallelDownloads = 5
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View file

@ -0,0 +1,11 @@
# Mirrorlist for NL setup
# Private mirror
Server = https://arch.neo.faulty.nl/$repo/os/$arch
# Public mirrors
Server = http://mirror.mikrogravitation.org/archlinux/$repo/os/$arch
Server = http://mirror.wtnet.de/archlinux/$repo/os/$arch
Server = http://mirror.pagenotfound.de/archlinux/$repo/os/$arch
Server = http://mirror.informatik.tu-freiberg.de/arch/$repo/os/$arch
Server = http://ftp.snt.utwente.nl/pub/os/linux/archlinux/$repo/os/$arch

1
gpackage.list Normal file
View file

@ -0,0 +1 @@
alacritty

16
lib/deploy.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh
REPO_LIST="https://git.faulty.nl/didier/dotfiles"
DOTFILES_DIR="$HOME/.local/dotfiles"
clone() {
for repo in $REPO_LIST; do
git clone "$repo" "$DOTFILES_DIR" && return 0
done
}
main() {
[ -d "$DOTFILES_DIR" ] || clone
cd "$DOTFILES_DIR" || exit 1
./sync.sh "$@"
}

19
lib/lib.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
DRY_RUN=${DRY_RUN:-no}
bool() {
case "$1" in
1|true|yes|on|TRUE|YES|ON) return 0 ;;
*) return 1 ;;
esac
}
run() {
if bool "$DRY_RUN"; then
echo "DRY: + $*"
else
echo "+ $*"
"$@"
fi
}

2
package.list Normal file
View file

@ -0,0 +1,2 @@
vim
zsh

10
sync.conf Normal file
View file

@ -0,0 +1,10 @@
# PM - Package Manager Options
PM_COMMAND=${PM_COMMAND:-pacman}
PM_NOCONFIRM_ARG=${PM_NOCONFIRM_ARG:-"--noconfirm"}
PM_INSTALL_ARG=${PM_INSTALL_ARG:--S}
PM_REMOVE_ARG=${PM_REMOVE_ARG:-R}
PM_UPDATE_ARG=${PM_UPDATE_ARG:-Sy}
# SYS - System Options
SYS_SUDO=${SYS_SUDO:-"sudo"}
SYS_ROOT=${SYS_ROOT:-"/"}

60
sync.sh Executable file
View file

@ -0,0 +1,60 @@
#!/bin/sh
SYNC_FILES=${SYNC_FILES:-yes}
INSTALL_PKGS=${INSTALL_PKGS:-yes}
RUN_CMDS=${RUN_CMDS:-yes}
PULL_GIT=${PULL_GIT:-yes}
. ./lib/lib.sh
. ./sync.conf
_install_pkgs() {
while read -r pkg; do
run $SYS_SUDO $PM_COMMAND $PM_INSTALL_ARG $PM_NOCONFIRM_ARG $pkg
done <$1
}
_sync_files() {
#copy all files and folders from ./files to /
#except for ./files/%HOME
for item in ./files/*; do
[ "$item" = "./files/%HOME" ] && continue
# e.g. ./files/etc -> /etc
run mkdir -p "$SYS_ROOT/$(basename "${item#./files/}")"
run $SYS_SUDO cp -r "$item/." "$SYS_ROOT/${item#./files/}"
done
}
_run_cmds() {
while read -r cmd; do
if [ "$(echo "$cmd" | cut -c1)" = "^" ]; then
run $SYS_SUDO sh -c "$(echo "$cmd" | cut -c2-)"
else
run sh -c "$cmd"
fi
done <./command.list
}
arg_handler() {
case $1 in
--graphical|-g)
bool "$INSTALL_PKGS" && _install_pkgs ./gpackage.list
;;
esac
}
main() {
bool "$PULL_GIT" && run git pull
bool "$SYNC_FILES" && run cp -a "./files/%HOME/." "$HOME"
bool "$SYNC_FILES" && _sync_files
bool "$INSTALL_PKGS" && _install_pkgs ./package.list
arg_handler "$@"
bool "$RUN_CMDS" && _run_cmds
}
echo "# exec: start."
time main "$@"
echo "# exec: done."