From fb9e4f9eff70a3ca92659d8f357c02666e755b68 Mon Sep 17 00:00:00 2001 From: faulty Date: Fri, 16 Dec 2022 14:23:28 +0100 Subject: [PATCH 001/177] Initial Commit --- README.md | 11 + command.list | 0 files/%HOME/.config/alacritty/alacritty.yml | 10 + files/%HOME/.config/kitty/kitty.conf | 1 + files/%HOME/.config/rofi/config.rasi | 1 + files/%HOME/.config/sway/config | 246 ++++++++++++++++++++ files/%HOME/.config/sway/status.py | 25 ++ files/%HOME/.config/sway/status.sh | 16 ++ files/%HOME/.vimrc | 2 + files/%HOME/.zshrc | 33 +++ files/etc/pacman.conf | 100 ++++++++ files/etc/pacman.d/mirrorlist | 11 + gpackage.list | 1 + lib/deploy.sh | 16 ++ lib/lib.sh | 19 ++ package.list | 2 + sync.conf | 10 + sync.sh | 60 +++++ 18 files changed, 564 insertions(+) create mode 100644 README.md create mode 100644 command.list create mode 100644 files/%HOME/.config/alacritty/alacritty.yml create mode 120000 files/%HOME/.config/kitty/kitty.conf create mode 100755 files/%HOME/.config/rofi/config.rasi create mode 100755 files/%HOME/.config/sway/config create mode 100755 files/%HOME/.config/sway/status.py create mode 100755 files/%HOME/.config/sway/status.sh create mode 100755 files/%HOME/.vimrc create mode 100644 files/%HOME/.zshrc create mode 100644 files/etc/pacman.conf create mode 100644 files/etc/pacman.d/mirrorlist create mode 100644 gpackage.list create mode 100644 lib/deploy.sh create mode 100644 lib/lib.sh create mode 100644 package.list create mode 100644 sync.conf create mode 100755 sync.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..7ee0aa8 --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file diff --git a/command.list b/command.list new file mode 100644 index 0000000..e69de29 diff --git a/files/%HOME/.config/alacritty/alacritty.yml b/files/%HOME/.config/alacritty/alacritty.yml new file mode 100644 index 0000000..3bc0096 --- /dev/null +++ b/files/%HOME/.config/alacritty/alacritty.yml @@ -0,0 +1,10 @@ +bell: + animation: 'Ease' + duration: 50 + color: '#555555' +cursor: + style: + shape: 'Block' + blinking: 'On' + blink_interval: 500 + diff --git a/files/%HOME/.config/kitty/kitty.conf b/files/%HOME/.config/kitty/kitty.conf new file mode 120000 index 0000000..de7259e --- /dev/null +++ b/files/%HOME/.config/kitty/kitty.conf @@ -0,0 +1 @@ +/home/didier/.local/dotfiles/./files/kitty/kitty.conf \ No newline at end of file diff --git a/files/%HOME/.config/rofi/config.rasi b/files/%HOME/.config/rofi/config.rasi new file mode 100755 index 0000000..1efb65f --- /dev/null +++ b/files/%HOME/.config/rofi/config.rasi @@ -0,0 +1 @@ +@theme "Arc-Dark" diff --git a/files/%HOME/.config/sway/config b/files/%HOME/.config/sway/config new file mode 100755 index 0000000..e1ccce6 --- /dev/null +++ b/files/%HOME/.config/sway/config @@ -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 windowโ€™s width. + # Pressing right will grow the windowโ€™s width. + # Pressing up will shrink the windowโ€™s height. + # Pressing down will grow the windowโ€™s 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 + } +} diff --git a/files/%HOME/.config/sway/status.py b/files/%HOME/.config/sway/status.py new file mode 100755 index 0000000..5a89322 --- /dev/null +++ b/files/%HOME/.config/sway/status.py @@ -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) diff --git a/files/%HOME/.config/sway/status.sh b/files/%HOME/.config/sway/status.sh new file mode 100755 index 0000000..c8bcfc3 --- /dev/null +++ b/files/%HOME/.config/sway/status.sh @@ -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 diff --git a/files/%HOME/.vimrc b/files/%HOME/.vimrc new file mode 100755 index 0000000..abb89b3 --- /dev/null +++ b/files/%HOME/.vimrc @@ -0,0 +1,2 @@ +set number +set relativenumber diff --git a/files/%HOME/.zshrc b/files/%HOME/.zshrc new file mode 100644 index 0000000..e03626e --- /dev/null +++ b/files/%HOME/.zshrc @@ -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" diff --git a/files/etc/pacman.conf b/files/etc/pacman.conf new file mode 100644 index 0000000..12cabfa --- /dev/null +++ b/files/etc/pacman.conf @@ -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 diff --git a/files/etc/pacman.d/mirrorlist b/files/etc/pacman.d/mirrorlist new file mode 100644 index 0000000..013da94 --- /dev/null +++ b/files/etc/pacman.d/mirrorlist @@ -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 diff --git a/gpackage.list b/gpackage.list new file mode 100644 index 0000000..7997ddc --- /dev/null +++ b/gpackage.list @@ -0,0 +1 @@ +alacritty diff --git a/lib/deploy.sh b/lib/deploy.sh new file mode 100644 index 0000000..f2f822c --- /dev/null +++ b/lib/deploy.sh @@ -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 "$@" +} \ No newline at end of file diff --git a/lib/lib.sh b/lib/lib.sh new file mode 100644 index 0000000..b8e0419 --- /dev/null +++ b/lib/lib.sh @@ -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 +} diff --git a/package.list b/package.list new file mode 100644 index 0000000..6eee86b --- /dev/null +++ b/package.list @@ -0,0 +1,2 @@ +vim +zsh diff --git a/sync.conf b/sync.conf new file mode 100644 index 0000000..139ef97 --- /dev/null +++ b/sync.conf @@ -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:-"/"} \ No newline at end of file diff --git a/sync.sh b/sync.sh new file mode 100755 index 0000000..95c9375 --- /dev/null +++ b/sync.sh @@ -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." From 8749c9dc32f00fe0ad0ce80d6b5e66257d6709be Mon Sep 17 00:00:00 2001 From: faulty Date: Fri, 16 Dec 2022 14:25:20 +0100 Subject: [PATCH 002/177] fix: deploy script --- lib/deploy.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/deploy.sh b/lib/deploy.sh index f2f822c..65abbd6 100644 --- a/lib/deploy.sh +++ b/lib/deploy.sh @@ -13,4 +13,6 @@ main() { [ -d "$DOTFILES_DIR" ] || clone cd "$DOTFILES_DIR" || exit 1 ./sync.sh "$@" -} \ No newline at end of file +} + +main "$@" \ No newline at end of file From 8c2bd11821f3dfd2c235a051155009388e540519 Mon Sep 17 00:00:00 2001 From: faulty Date: Fri, 16 Dec 2022 14:28:48 +0100 Subject: [PATCH 003/177] fix: exit on error --- sync.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sync.sh b/sync.sh index 95c9375..2b5f2f0 100755 --- a/sync.sh +++ b/sync.sh @@ -8,6 +8,8 @@ PULL_GIT=${PULL_GIT:-yes} . ./lib/lib.sh . ./sync.conf +set -e # Exit on error + _install_pkgs() { while read -r pkg; do run $SYS_SUDO $PM_COMMAND $PM_INSTALL_ARG $PM_NOCONFIRM_ARG $pkg From 70a565df77c2c9c09da2b4c6c79a555214593a3e Mon Sep 17 00:00:00 2001 From: faulty Date: Fri, 16 Dec 2022 14:35:54 +0100 Subject: [PATCH 004/177] add: zsh files --- .gitignore | 1 + files/%HOME/.zsh_preferences | 2 ++ files/%HOME/.zsh_scripts | 47 ++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 .gitignore create mode 100644 files/%HOME/.zsh_preferences create mode 100644 files/%HOME/.zsh_scripts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62c8935 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/files/%HOME/.zsh_preferences b/files/%HOME/.zsh_preferences new file mode 100644 index 0000000..2677a0e --- /dev/null +++ b/files/%HOME/.zsh_preferences @@ -0,0 +1,2 @@ +_ZSH_PREF_NO_PFETCH=0 +_ZSH_PREF_NO_NONSENSE=0 \ No newline at end of file diff --git a/files/%HOME/.zsh_scripts b/files/%HOME/.zsh_scripts new file mode 100644 index 0000000..4004d8f --- /dev/null +++ b/files/%HOME/.zsh_scripts @@ -0,0 +1,47 @@ +__is_arch() { + . /etc/os-release + if [ "$ID" = "arch" ]; then return 0; else return 1; fi +} + +pkg_once() { + if [ ! __is_arch ]; then + printf "This command is only for Arch Linux.\n" + return + fi + if [ ! -n "$1" ]; then + printf "Usage: pkg_once [command]\n" + printf "command is optional; if there is no command the package name is ran\n" + return + fi + printf "Installing $1...\n" + yay -S --noconfirm $1 > /dev/null + + if [ ! -n "$2" ]; then $1; else $2; fi + printf "Remoiving $1..." + yay -R --noconfirm $1 > /dev/null + echo "done.\n" +} + +rando () { + case $1 in + *|d|default) tr -dc A-Za-z0-9 ?@[\]^_`{|}~' > $file + fi + chmod +x $file + printf '%s' $file +} \ No newline at end of file From 4ef7f7756fdf4765925fbe922fb573bb3023a23e Mon Sep 17 00:00:00 2001 From: faulty Date: Fri, 16 Dec 2022 15:33:59 +0100 Subject: [PATCH 005/177] crap --- command.list | 4 ++++ lib/lib.sh | 6 ++++++ sync.conf | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/command.list b/command.list index e69de29..7ec30e1 100644 --- a/command.list +++ b/command.list @@ -0,0 +1,4 @@ +^pacman -Syyu +^[ -d /tmp/yay ] && rm -rf /tmp/yay +git clone https://aur.archlinux.org/yay /tmp/yay +cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM \ No newline at end of file diff --git a/lib/lib.sh b/lib/lib.sh index b8e0419..b703116 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -1,5 +1,7 @@ #!/bin/sh +. ./sync.conf || . ../sync.conf + DRY_RUN=${DRY_RUN:-no} bool() { @@ -17,3 +19,7 @@ run() { "$@" fi } + +is_graphical() { + command -v $PREF_TERM && return 0 || return 1 +} \ No newline at end of file diff --git a/sync.conf b/sync.conf index 139ef97..2a6caa7 100644 --- a/sync.conf +++ b/sync.conf @@ -7,4 +7,9 @@ PM_UPDATE_ARG=${PM_UPDATE_ARG:-Sy} # SYS - System Options SYS_SUDO=${SYS_SUDO:-"sudo"} -SYS_ROOT=${SYS_ROOT:-"/"} \ No newline at end of file +SYS_ROOT=${SYS_ROOT:-"/"} + +# PREF - Preferences +PREF_TERM=${PREF_TERM:-alacritty} +PREF_TERM_SET_TITLE=${PREF_TERM_SET_TITLE:--t} +PREF_TERM_RUN_CMD=${PREF_TERM_RUN_CMD:--e} \ No newline at end of file From a307370a157cfaa99695dfb94f5b5e0a47c503c9 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 21:43:34 +0100 Subject: [PATCH 006/177] fix names --- command.list | 3 ++- sync.conf | 9 +++++---- sync.sh | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/command.list b/command.list index 7ec30e1..a67257b 100644 --- a/command.list +++ b/command.list @@ -1,4 +1,5 @@ -^pacman -Syyu +^. ./sync.conf && $PM_COMMAND $PM_UPGRADE ^[ -d /tmp/yay ] && rm -rf /tmp/yay + git clone https://aur.archlinux.org/yay /tmp/yay cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM \ No newline at end of file diff --git a/sync.conf b/sync.conf index 2a6caa7..8c57fc4 100644 --- a/sync.conf +++ b/sync.conf @@ -1,9 +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} +PM_NOCONFIRM=${PM_NOCONFIRM:-"--noconfirm"} +PM_INSTALL=${PM_INSTALL:--S} +PM_REMOVE=${PM_REMOVE:-R} +PM_UPDATE=${PM_UPDATE:--Sy} +PM_UPGRADE=${PM_UPGRADE:--Syyu} # SYS - System Options SYS_SUDO=${SYS_SUDO:-"sudo"} diff --git a/sync.sh b/sync.sh index 2b5f2f0..cff0c17 100755 --- a/sync.sh +++ b/sync.sh @@ -11,8 +11,9 @@ PULL_GIT=${PULL_GIT:-yes} set -e # Exit on error _install_pkgs() { + run $SYS_SUDO $PM_COMMAND $PM_UPDATE $PM_NOCONFIRM while read -r pkg; do - run $SYS_SUDO $PM_COMMAND $PM_INSTALL_ARG $PM_NOCONFIRM_ARG $pkg + run $SYS_SUDO $PM_COMMAND $PM_INSTALL $PM_NOCONFIRM $pkg done <$1 } @@ -58,5 +59,5 @@ main() { } echo "# exec: start." -time main "$@" +[ bool ${TIME_TRACK:-no} ] && time main "$@" || main "$@" echo "# exec: done." From f2bf7ea423c8817eb7f3ca1c5a9e6325820bae6e Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 21:51:53 +0100 Subject: [PATCH 007/177] update dotfiles --- command.list | 4 ++-- gpackage.list | 1 + lib/lib.sh | 4 +++- package.list | 1 + sync.sh | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/command.list b/command.list index a67257b..308817f 100644 --- a/command.list +++ b/command.list @@ -1,5 +1,5 @@ ^. ./sync.conf && $PM_COMMAND $PM_UPGRADE ^[ -d /tmp/yay ] && rm -rf /tmp/yay - git clone https://aur.archlinux.org/yay /tmp/yay -cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM \ No newline at end of file +cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended diff --git a/gpackage.list b/gpackage.list index 7997ddc..db10bfa 100644 --- a/gpackage.list +++ b/gpackage.list @@ -1 +1,2 @@ alacritty +sway diff --git a/lib/lib.sh b/lib/lib.sh index b703116..1798188 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -22,4 +22,6 @@ run() { is_graphical() { command -v $PREF_TERM && return 0 || return 1 -} \ No newline at end of file +} + +command -v $SYS_SUDO || $SYS_SUDO="" \ No newline at end of file diff --git a/package.list b/package.list index 6eee86b..bbecb9e 100644 --- a/package.list +++ b/package.list @@ -1,2 +1,3 @@ +curl vim zsh diff --git a/sync.sh b/sync.sh index cff0c17..69ed6ae 100755 --- a/sync.sh +++ b/sync.sh @@ -59,5 +59,5 @@ main() { } echo "# exec: start." -[ bool ${TIME_TRACK:-no} ] && time main "$@" || main "$@" +bool ${TIME_TRACK:-no} && time main "$@" || main "$@" echo "# exec: done." From ccce1d5217739e476539a7871e987ac7b0147548 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 22:03:55 +0100 Subject: [PATCH 008/177] fix stuff --- lib/lib.sh | 2 +- sync.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/lib.sh b/lib/lib.sh index 1798188..a7619e1 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -24,4 +24,4 @@ is_graphical() { command -v $PREF_TERM && return 0 || return 1 } -command -v $SYS_SUDO || $SYS_SUDO="" \ No newline at end of file +command -v $SYS_SUDO || SYS_SUDO="" \ No newline at end of file diff --git a/sync.sh b/sync.sh index 69ed6ae..f6a850e 100755 --- a/sync.sh +++ b/sync.sh @@ -6,7 +6,6 @@ RUN_CMDS=${RUN_CMDS:-yes} PULL_GIT=${PULL_GIT:-yes} . ./lib/lib.sh -. ./sync.conf set -e # Exit on error From acf3ba06c0d88a1ac6bb6702f7516df61f1c1ec4 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 22:21:22 +0100 Subject: [PATCH 009/177] compatibility --- command.list | 4 ++-- comp.sh | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 comp.sh diff --git a/command.list b/command.list index 308817f..4437ba9 100644 --- a/command.list +++ b/command.list @@ -1,5 +1,5 @@ -^. ./sync.conf && $PM_COMMAND $PM_UPGRADE +^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM ^[ -d /tmp/yay ] && rm -rf /tmp/yay git clone https://aur.archlinux.org/yay /tmp/yay cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM -sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" diff --git a/comp.sh b/comp.sh new file mode 100755 index 0000000..4091ead --- /dev/null +++ b/comp.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# #################### # +# Compatibility Script # +# #################### # +if [ ! -z "$1" ]; then + cmd=$1; shift +fi + +case $cmd in + debian|ubuntu|apt|deb) + PM_COMMAND=apt \ + PM_NOCONFIRM=-y \ + PM_INSTALL=install \ + PM_UPDATE=update \ + PM_UPGRADE=upgrade \ + PM_REMOVE=purge \ + ./sync.sh "$@" + ;; + *|''|arch) ./sync.sh ;; +esac \ No newline at end of file From 11004129d6f413e9261be2c09d5e312ed87bfae7 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 22:23:58 +0100 Subject: [PATCH 010/177] err_handler --- sync.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sync.sh b/sync.sh index f6a850e..79b7d1f 100755 --- a/sync.sh +++ b/sync.sh @@ -57,6 +57,14 @@ main() { bool "$RUN_CMDS" && _run_cmds } +err_handler() { + echo "Something went wrong!" + echo "You can look at what went wrong by running this script more verbosely" + echo "Sorry!" +} + +trap err_handler ERR + echo "# exec: start." bool ${TIME_TRACK:-no} && time main "$@" || main "$@" echo "# exec: done." From 08226f12210e91dd4cc0902f881e80742527ac2b Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 22:47:29 +0100 Subject: [PATCH 011/177] remove error handler, fix pfetch and crap --- command.list | 7 ++++--- sync.sh | 8 -------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/command.list b/command.list index 4437ba9..1d2f022 100644 --- a/command.list +++ b/command.list @@ -1,5 +1,6 @@ ^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM -^[ -d /tmp/yay ] && rm -rf /tmp/yay -git clone https://aur.archlinux.org/yay /tmp/yay -cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM +^[ -d /tmp/yay ] && rm -rf /tmp/yay || printf "" +command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si)) +^[ -d /tmp/pfetch ] && rm -rf /tmp/pfetch || printf "" +^git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch) sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" diff --git a/sync.sh b/sync.sh index 79b7d1f..f6a850e 100755 --- a/sync.sh +++ b/sync.sh @@ -57,14 +57,6 @@ main() { bool "$RUN_CMDS" && _run_cmds } -err_handler() { - echo "Something went wrong!" - echo "You can look at what went wrong by running this script more verbosely" - echo "Sorry!" -} - -trap err_handler ERR - echo "# exec: start." bool ${TIME_TRACK:-no} && time main "$@" || main "$@" echo "# exec: done." From 482eb5a163bf227023c6dbd64efcb568d8aee773 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 22:50:54 +0100 Subject: [PATCH 012/177] yay is arch exclusive --- command.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command.list b/command.list index 1d2f022..8db5df5 100644 --- a/command.list +++ b/command.list @@ -1,6 +1,6 @@ ^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM ^[ -d /tmp/yay ] && rm -rf /tmp/yay || printf "" -command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si)) +command -v makepkg && (command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si))) ^[ -d /tmp/pfetch ] && rm -rf /tmp/pfetch || printf "" ^git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch) sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" From adcb02180d423923b73fbd8eaa752c525834e80a Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 22:52:02 +0100 Subject: [PATCH 013/177] err handling --- command.list | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/command.list b/command.list index 8db5df5..c855eca 100644 --- a/command.list +++ b/command.list @@ -1,6 +1,6 @@ -^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM +^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM || printf "" ^[ -d /tmp/yay ] && rm -rf /tmp/yay || printf "" -command -v makepkg && (command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si))) +command -v makepkg && (command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si))) || printf "" ^[ -d /tmp/pfetch ] && rm -rf /tmp/pfetch || printf "" -^git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch) +^(git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch)) || printf "" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" From 1e2f124e656eb356df4d54c2bcba909eb0a234ed Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 23:20:11 +0100 Subject: [PATCH 014/177] docker image --- README.md | 4 ++++ lib/Dockerfile | 12 ++++++++++++ lib/docker.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 lib/Dockerfile create mode 100644 lib/docker.py diff --git a/README.md b/README.md index 7ee0aa8..23b8670 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ This repo has a simple sync script with a few features: - after install commands - deploy script +## Deployment +To import the dotfiles run: +`curl --proto '=https' --tlsv1.2 -sSf https://git.faulty.nl/didier/dotfiles/-/raw/main/lib/deploy.sh | sh` + ## Notes - `gpackage.list` This is a list with packages only installed if the `-g` or `--graphical` flag is used. \ No newline at end of file diff --git a/lib/Dockerfile b/lib/Dockerfile new file mode 100644 index 0000000..82e454e --- /dev/null +++ b/lib/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.10-alpine + +RUN apk add git + +COPY . /app + +WORKDIR /app + +# if no remote then add remote or otherwrite +RUN git remote get-url origin || git remote add origin https://git.faulty.nl/didier/dotfiles && git remote set-url origin https://git.faulty.nl/didier/dotfiles + +ENTRYPOINT ["python3", "/app/lib/docker.py"] \ No newline at end of file diff --git a/lib/docker.py b/lib/docker.py new file mode 100644 index 0000000..4bd925e --- /dev/null +++ b/lib/docker.py @@ -0,0 +1,30 @@ +# any HTTP request returns the contents of: ./lib/deploy.sh +# If the deploy script is older then a day, do a git pull + +from http.server import BaseHTTPRequestHandler, HTTPServer +import subprocess +import os +import time + +class handler(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-type','text/plain') + self.end_headers() + if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400): + subprocess.call(['git', 'pull']) + with open('./lib/deploy.sh') as f: + self.wfile.write(bytes(f.read(), 'utf-8')) + + +def main(): + try: + server = HTTPServer(('', 80), handler) + print('started httpserver...') + server.serve_forever() + except KeyboardInterrupt: + print('^C received, shutting down the web server') + server.socket.close() + +if __name__ == '__main__': + main() \ No newline at end of file From e9afc5e4f1852cd97e3b2e1fcfa876fbbbf35043 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 23:30:18 +0100 Subject: [PATCH 015/177] gitty up --- lib/Dockerfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/Dockerfile b/lib/Dockerfile index 82e454e..d174a2e 100644 --- a/lib/Dockerfile +++ b/lib/Dockerfile @@ -1,12 +1,7 @@ FROM python:3.10-alpine RUN apk add git - -COPY . /app +RUN git clone https://git.faulty.nl/didier/dotfiles /app WORKDIR /app - -# if no remote then add remote or otherwrite -RUN git remote get-url origin || git remote add origin https://git.faulty.nl/didier/dotfiles && git remote set-url origin https://git.faulty.nl/didier/dotfiles - ENTRYPOINT ["python3", "/app/lib/docker.py"] \ No newline at end of file From c6499882b18dbf27fd68cedced1e0b3c23f8d6e7 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 23:45:15 +0100 Subject: [PATCH 016/177] run compatibility script instead of sync script --- comp.sh | 4 ++-- lib/deploy.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/comp.sh b/comp.sh index 4091ead..0d6c724 100755 --- a/comp.sh +++ b/comp.sh @@ -15,7 +15,7 @@ case $cmd in PM_UPDATE=update \ PM_UPGRADE=upgrade \ PM_REMOVE=purge \ - ./sync.sh "$@" + ./sync.sh $@ ;; - *|''|arch) ./sync.sh ;; + *|''|arch) ./sync.sh $cmd $@ ;; esac \ No newline at end of file diff --git a/lib/deploy.sh b/lib/deploy.sh index 65abbd6..04a7b34 100644 --- a/lib/deploy.sh +++ b/lib/deploy.sh @@ -12,7 +12,7 @@ clone() { main() { [ -d "$DOTFILES_DIR" ] || clone cd "$DOTFILES_DIR" || exit 1 - ./sync.sh "$@" + ./comp.sh "$@" } main "$@" \ No newline at end of file From 89750c97e75c731b0996b3dd47b9195ac384a8c3 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 23:46:56 +0100 Subject: [PATCH 017/177] allow force pulls --- lib/docker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docker.py b/lib/docker.py index 4bd925e..87967a9 100644 --- a/lib/docker.py +++ b/lib/docker.py @@ -11,7 +11,7 @@ class handler(BaseHTTPRequestHandler): self.send_response(200) self.send_header('Content-type','text/plain') self.end_headers() - if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400): + if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400) or self.path == '/pull': subprocess.call(['git', 'pull']) with open('./lib/deploy.sh') as f: self.wfile.write(bytes(f.read(), 'utf-8')) From d6c21ba3cb34fcb05463f83e97c399073bff150d Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 18 Dec 2022 23:49:48 +0100 Subject: [PATCH 018/177] Add git pull acknowledge statement --- lib/docker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docker.py b/lib/docker.py index 87967a9..08ad428 100644 --- a/lib/docker.py +++ b/lib/docker.py @@ -15,6 +15,7 @@ class handler(BaseHTTPRequestHandler): subprocess.call(['git', 'pull']) with open('./lib/deploy.sh') as f: self.wfile.write(bytes(f.read(), 'utf-8')) + self.wfile.write(bytes("# Git pull: " + str(time.time() - os.path.getmtime('./lib/deploy.sh')) + " seconds ago", 'utf-8')) def main(): From 04401a98938424378409dda1fadc88b7828853fd Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 16 Jan 2023 00:49:52 +0100 Subject: [PATCH 019/177] add: term screensaver --- files/%HOME/.config/sway/config | 2 +- files/%HOME/.zshrc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/files/%HOME/.config/sway/config b/files/%HOME/.config/sway/config index e1ccce6..51a6062 100755 --- a/files/%HOME/.config/sway/config +++ b/files/%HOME/.config/sway/config @@ -3,7 +3,7 @@ set $mod Mod1 set $sup Mod4 -set $terminal kitty #sway-sensible-terminal +set $terminal alacritty #sway-sensible-terminal set $browser firefox set $editor gedit diff --git a/files/%HOME/.zshrc b/files/%HOME/.zshrc index e03626e..4dc2718 100644 --- a/files/%HOME/.zshrc +++ b/files/%HOME/.zshrc @@ -21,6 +21,7 @@ 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' +alias s="title $HOST && cmatrix -s && clear" # COSMETICS if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then pfetch; fi @@ -31,3 +32,4 @@ fi alias q="exit" export PATH="${PATH}:/home/${USER}/.local/bin" +export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh" From f9a3b13bfe55188c20d6cf7d92a15e6b7c2d9c84 Mon Sep 17 00:00:00 2001 From: faulty Date: Wed, 18 Jan 2023 07:43:13 +0100 Subject: [PATCH 020/177] mod: new files and configs --- files/%HOME/.config/sway/config | 6 ++++-- files/%HOME/.zshrc | 2 +- package.list | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/files/%HOME/.config/sway/config b/files/%HOME/.config/sway/config index 51a6062..2b78650 100755 --- a/files/%HOME/.config/sway/config +++ b/files/%HOME/.config/sway/config @@ -11,6 +11,7 @@ set $editor gedit font pango:DejaVu Sans Mono 8 #! Startup Applications +exec --no-startup-id kanshi 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 @@ -193,8 +194,9 @@ bindsym $sup+Shift+0 move container to workspace number $ws10 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'" +# exit sway (logs you out of your wayland 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'" +bindsym $sup+Shift+e exec wlogout # edit config bindsym $sup+Shift+Alt+c exec "$editor ~/.config/sway/config" diff --git a/files/%HOME/.zshrc b/files/%HOME/.zshrc index 4dc2718..431f59c 100644 --- a/files/%HOME/.zshrc +++ b/files/%HOME/.zshrc @@ -21,7 +21,7 @@ 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' -alias s="title $HOST && cmatrix -s && clear" +alias s="title $HOST && cmatrix -rs && clear" # COSMETICS if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then pfetch; fi diff --git a/package.list b/package.list index bbecb9e..10f9aee 100644 --- a/package.list +++ b/package.list @@ -1,3 +1,5 @@ curl vim zsh +wlogout +kanshi From b1883bc03829cd8f55ae5df375fa7b5f128d3b7e Mon Sep 17 00:00:00 2001 From: faulty Date: Wed, 18 Jan 2023 07:46:35 +0100 Subject: [PATCH 021/177] mod: they're graphical packages --- gpackage.list | 2 ++ package.list | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gpackage.list b/gpackage.list index db10bfa..661b9ba 100644 --- a/gpackage.list +++ b/gpackage.list @@ -1,2 +1,4 @@ alacritty sway +wlogout +kanshi diff --git a/package.list b/package.list index 10f9aee..92146dc 100644 --- a/package.list +++ b/package.list @@ -1,5 +1,4 @@ curl vim zsh -wlogout -kanshi + From 78dec7897ae6c4ecfe74083f1b08e35828878f11 Mon Sep 17 00:00:00 2001 From: faulty Date: Wed, 25 Jan 2023 13:32:37 +0100 Subject: [PATCH 022/177] add: doccur --- files/%HOME/.zsh_scripts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/%HOME/.zsh_scripts b/files/%HOME/.zsh_scripts index 4004d8f..7537861 100644 --- a/files/%HOME/.zsh_scripts +++ b/files/%HOME/.zsh_scripts @@ -44,4 +44,6 @@ touchx () { fi chmod +x $file printf '%s' $file -} \ No newline at end of file +} + +alias docurr="docker run -itd --rm --name current" From f05a04bf191b46c57ea091051d3a7c48ca527f59 Mon Sep 17 00:00:00 2001 From: faulty Date: Thu, 26 Jan 2023 15:13:35 +0100 Subject: [PATCH 023/177] mod: remodel --- files/%HOME/.config/kanshi/config | 9 +++++ lib/lib.sh | 9 ++++- package.list | 1 - sync.sh | 62 ++++++++++++++++++++++++++----- 4 files changed, 68 insertions(+), 13 deletions(-) create mode 100644 files/%HOME/.config/kanshi/config diff --git a/files/%HOME/.config/kanshi/config b/files/%HOME/.config/kanshi/config new file mode 100644 index 0000000..5a245d2 --- /dev/null +++ b/files/%HOME/.config/kanshi/config @@ -0,0 +1,9 @@ +profile school { + output "Iiyama North America PL2483H 1156290962278" mode 1920x1080 position 0,0 + output eDP-1 mode 1920x1080 position 1920,0 +} + +#profile sharing { +# output HDMI-A-1 mode 1920x1080 position 0,1080 +# output eDP-1 mode 1920x1080 position 0,0 +#} diff --git a/lib/lib.sh b/lib/lib.sh index a7619e1..5ba6f73 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -12,6 +12,11 @@ bool() { } run() { + # Check if command starts with NO_RUN ($*) and remove it + if echo "$*" | grep -q "^NO_RUN"; then + return 0 + fi + if bool "$DRY_RUN"; then echo "DRY: + $*" else @@ -21,7 +26,7 @@ run() { } is_graphical() { - command -v $PREF_TERM && return 0 || return 1 + command -v $PREF_TERM > /dev/null && return 0 || return 1 } -command -v $SYS_SUDO || SYS_SUDO="" \ No newline at end of file +command -v $SYS_SUDO > /dev/null || SYS_SUDO="NO_RUN" diff --git a/package.list b/package.list index 92146dc..bbecb9e 100644 --- a/package.list +++ b/package.list @@ -1,4 +1,3 @@ curl vim zsh - diff --git a/sync.sh b/sync.sh index f6a850e..a753714 100755 --- a/sync.sh +++ b/sync.sh @@ -4,6 +4,9 @@ SYNC_FILES=${SYNC_FILES:-yes} INSTALL_PKGS=${INSTALL_PKGS:-yes} RUN_CMDS=${RUN_CMDS:-yes} PULL_GIT=${PULL_GIT:-yes} +TIME_TRACK=${TIME_TRACK:-no} + +ARGS="$@" . ./lib/lib.sh @@ -11,9 +14,13 @@ set -e # Exit on error _install_pkgs() { run $SYS_SUDO $PM_COMMAND $PM_UPDATE $PM_NOCONFIRM + _APPLICATIONS="" while read -r pkg; do - run $SYS_SUDO $PM_COMMAND $PM_INSTALL $PM_NOCONFIRM $pkg - done <$1 + [ -z "$pkg" ] && continue + [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue + _APPLICATIONS="$_APPLICATIONS $pkg" + done <"$1" + run $SYS_SUDO $PM_COMMAND $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS } _sync_files() { @@ -38,25 +45,60 @@ _run_cmds() { done <./command.list } +ARGS="$@" +_skip_next_arg="n" arg_handler() { - case $1 in - --graphical|-g) - bool "$INSTALL_PKGS" && _install_pkgs ./gpackage.list - ;; - esac + for arg in $ARGS; do + bool $_skip_next_arg && continue + + case $arg in + +files) SYNC_FILES=yes ;; + -files) SYNC_FILES=no ;; + +pkgs) INSTALL_PKGS=yes ;; + -pkgs) INSTALL_PKGS=no ;; + +cmds) RUN_CMDS=yes ;; + -cmds) RUN_CMDS=no ;; + +git) PULL_GIT=yes ;; + -git) PULL_GIT=no ;; + +) SYNC_FILES=yes; INSTALL_PKGS=yes; RUN_CMDS=yes; PULL_GIT=yes ;; + -) SYNC_FILES=no; INSTALL_PKGS=no; RUN_CMDS=no; PULL_GIT=no ;; + +*) + echo "# Unknown argument: $arg" + exit 1 + ;; + -*) + echo "# Unknown argument: $arg" + exit 1 + ;; + esac + done } main() { + arg_handler + + echo "# hook: PULL_GIT" bool "$PULL_GIT" && run git pull + + echo "# hook: SYNC_FILES (/)" bool "$SYNC_FILES" && run cp -a "./files/%HOME/." "$HOME" + + echo "# hook: SYNC_FILES" bool "$SYNC_FILES" && _sync_files + + echo "# hook: INSTALL_PKGS" bool "$INSTALL_PKGS" && _install_pkgs ./package.list - arg_handler "$@" - + echo "# hook: RUN_CMDS" bool "$RUN_CMDS" && _run_cmds + + return 0 } echo "# exec: start." -bool ${TIME_TRACK:-no} && time main "$@" || main "$@" +if bool $TIME_TRACK; then + time main "$@" +else + main "$@" +fi echo "# exec: done." From 0d8090e3c8df0db30c81d5f7915ab5ddee1b4cc7 Mon Sep 17 00:00:00 2001 From: faulty Date: Sun, 19 Feb 2023 21:02:08 +0100 Subject: [PATCH 024/177] refactor: v3 --- README.md | 20 ++-- command.list | 6 - comp.sh | 21 ---- .../.config/alacritty/alacritty.yml | 0 files/{%HOME => home}/.config/kanshi/config | 0 .../{%HOME => home}/.config/kitty/kitty.conf | 0 .../{%HOME => home}/.config/rofi/config.rasi | 0 files/{%HOME => home}/.config/sway/config | 0 files/{%HOME => home}/.config/sway/status.py | 0 files/{%HOME => home}/.config/sway/status.sh | 0 files/{%HOME => home}/.vimrc | 0 files/{%HOME => home}/.zsh_preferences | 0 files/{%HOME => home}/.zsh_scripts | 0 files/{%HOME => home}/.zshrc | 0 files/{ => root}/etc/pacman.conf | 0 files/{ => root}/etc/pacman.d/mirrorlist | 0 gpackage.list | 1 - lib/Dockerfile | 7 -- lib/deploy.sh | 18 --- lib/docker.py | 31 ----- lib/lib.sh | 32 ------ scripts/00-install-requirements.sh | 6 + scripts/10-copy-files.sh | 8 ++ scripts/20-install-pkgs.sh | 23 ++++ sync.conf | 16 --- sync.sh | 108 ++---------------- 26 files changed, 55 insertions(+), 242 deletions(-) delete mode 100644 command.list delete mode 100755 comp.sh rename files/{%HOME => home}/.config/alacritty/alacritty.yml (100%) rename files/{%HOME => home}/.config/kanshi/config (100%) rename files/{%HOME => home}/.config/kitty/kitty.conf (100%) rename files/{%HOME => home}/.config/rofi/config.rasi (100%) rename files/{%HOME => home}/.config/sway/config (100%) rename files/{%HOME => home}/.config/sway/status.py (100%) rename files/{%HOME => home}/.config/sway/status.sh (100%) rename files/{%HOME => home}/.vimrc (100%) rename files/{%HOME => home}/.zsh_preferences (100%) rename files/{%HOME => home}/.zsh_scripts (100%) rename files/{%HOME => home}/.zshrc (100%) rename files/{ => root}/etc/pacman.conf (100%) rename files/{ => root}/etc/pacman.d/mirrorlist (100%) delete mode 100644 lib/Dockerfile delete mode 100644 lib/deploy.sh delete mode 100644 lib/docker.py delete mode 100644 lib/lib.sh create mode 100644 scripts/00-install-requirements.sh create mode 100644 scripts/10-copy-files.sh create mode 100644 scripts/20-install-pkgs.sh delete mode 100644 sync.conf diff --git a/README.md b/README.md index 23b8670..2e5da9f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,9 @@ -# Dotfiles (v2) +# Faulty's Dotfiles +Version: 3 -This repo has a simple sync script with a few features: -- file sync (not symlinked anymore) -- package install -- after install commands -- deploy script +--- -## Deployment -To import the dotfiles run: -`curl --proto '=https' --tlsv1.2 -sSf https://git.faulty.nl/didier/dotfiles/-/raw/main/lib/deploy.sh | sh` - -## Notes -- `gpackage.list` -This is a list with packages only installed if the `-g` or `--graphical` flag is used. \ No newline at end of file +## file sync +files in `./files` are synced across the system. +files in `./files/home` are synced to the home of the user running the script. +files in `./files/root` are synced with sudo to the root of the script. \ No newline at end of file diff --git a/command.list b/command.list deleted file mode 100644 index c855eca..0000000 --- a/command.list +++ /dev/null @@ -1,6 +0,0 @@ -^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM || printf "" -^[ -d /tmp/yay ] && rm -rf /tmp/yay || printf "" -command -v makepkg && (command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si))) || printf "" -^[ -d /tmp/pfetch ] && rm -rf /tmp/pfetch || printf "" -^(git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch)) || printf "" -sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" diff --git a/comp.sh b/comp.sh deleted file mode 100755 index 0d6c724..0000000 --- a/comp.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# #################### # -# Compatibility Script # -# #################### # -if [ ! -z "$1" ]; then - cmd=$1; shift -fi - -case $cmd in - debian|ubuntu|apt|deb) - PM_COMMAND=apt \ - PM_NOCONFIRM=-y \ - PM_INSTALL=install \ - PM_UPDATE=update \ - PM_UPGRADE=upgrade \ - PM_REMOVE=purge \ - ./sync.sh $@ - ;; - *|''|arch) ./sync.sh $cmd $@ ;; -esac \ No newline at end of file diff --git a/files/%HOME/.config/alacritty/alacritty.yml b/files/home/.config/alacritty/alacritty.yml similarity index 100% rename from files/%HOME/.config/alacritty/alacritty.yml rename to files/home/.config/alacritty/alacritty.yml diff --git a/files/%HOME/.config/kanshi/config b/files/home/.config/kanshi/config similarity index 100% rename from files/%HOME/.config/kanshi/config rename to files/home/.config/kanshi/config diff --git a/files/%HOME/.config/kitty/kitty.conf b/files/home/.config/kitty/kitty.conf similarity index 100% rename from files/%HOME/.config/kitty/kitty.conf rename to files/home/.config/kitty/kitty.conf diff --git a/files/%HOME/.config/rofi/config.rasi b/files/home/.config/rofi/config.rasi similarity index 100% rename from files/%HOME/.config/rofi/config.rasi rename to files/home/.config/rofi/config.rasi diff --git a/files/%HOME/.config/sway/config b/files/home/.config/sway/config similarity index 100% rename from files/%HOME/.config/sway/config rename to files/home/.config/sway/config diff --git a/files/%HOME/.config/sway/status.py b/files/home/.config/sway/status.py similarity index 100% rename from files/%HOME/.config/sway/status.py rename to files/home/.config/sway/status.py diff --git a/files/%HOME/.config/sway/status.sh b/files/home/.config/sway/status.sh similarity index 100% rename from files/%HOME/.config/sway/status.sh rename to files/home/.config/sway/status.sh diff --git a/files/%HOME/.vimrc b/files/home/.vimrc similarity index 100% rename from files/%HOME/.vimrc rename to files/home/.vimrc diff --git a/files/%HOME/.zsh_preferences b/files/home/.zsh_preferences similarity index 100% rename from files/%HOME/.zsh_preferences rename to files/home/.zsh_preferences diff --git a/files/%HOME/.zsh_scripts b/files/home/.zsh_scripts similarity index 100% rename from files/%HOME/.zsh_scripts rename to files/home/.zsh_scripts diff --git a/files/%HOME/.zshrc b/files/home/.zshrc similarity index 100% rename from files/%HOME/.zshrc rename to files/home/.zshrc diff --git a/files/etc/pacman.conf b/files/root/etc/pacman.conf similarity index 100% rename from files/etc/pacman.conf rename to files/root/etc/pacman.conf diff --git a/files/etc/pacman.d/mirrorlist b/files/root/etc/pacman.d/mirrorlist similarity index 100% rename from files/etc/pacman.d/mirrorlist rename to files/root/etc/pacman.d/mirrorlist diff --git a/gpackage.list b/gpackage.list index 661b9ba..2f78a0b 100644 --- a/gpackage.list +++ b/gpackage.list @@ -1,4 +1,3 @@ alacritty sway -wlogout kanshi diff --git a/lib/Dockerfile b/lib/Dockerfile deleted file mode 100644 index d174a2e..0000000 --- a/lib/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM python:3.10-alpine - -RUN apk add git -RUN git clone https://git.faulty.nl/didier/dotfiles /app - -WORKDIR /app -ENTRYPOINT ["python3", "/app/lib/docker.py"] \ No newline at end of file diff --git a/lib/deploy.sh b/lib/deploy.sh deleted file mode 100644 index 04a7b34..0000000 --- a/lib/deploy.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/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 - ./comp.sh "$@" -} - -main "$@" \ No newline at end of file diff --git a/lib/docker.py b/lib/docker.py deleted file mode 100644 index 08ad428..0000000 --- a/lib/docker.py +++ /dev/null @@ -1,31 +0,0 @@ -# any HTTP request returns the contents of: ./lib/deploy.sh -# If the deploy script is older then a day, do a git pull - -from http.server import BaseHTTPRequestHandler, HTTPServer -import subprocess -import os -import time - -class handler(BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(200) - self.send_header('Content-type','text/plain') - self.end_headers() - if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400) or self.path == '/pull': - subprocess.call(['git', 'pull']) - with open('./lib/deploy.sh') as f: - self.wfile.write(bytes(f.read(), 'utf-8')) - self.wfile.write(bytes("# Git pull: " + str(time.time() - os.path.getmtime('./lib/deploy.sh')) + " seconds ago", 'utf-8')) - - -def main(): - try: - server = HTTPServer(('', 80), handler) - print('started httpserver...') - server.serve_forever() - except KeyboardInterrupt: - print('^C received, shutting down the web server') - server.socket.close() - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/lib/lib.sh b/lib/lib.sh deleted file mode 100644 index 5ba6f73..0000000 --- a/lib/lib.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -. ./sync.conf || . ../sync.conf - -DRY_RUN=${DRY_RUN:-no} - -bool() { - case "$1" in - 1|true|yes|on|TRUE|YES|ON) return 0 ;; - *) return 1 ;; - esac -} - -run() { - # Check if command starts with NO_RUN ($*) and remove it - if echo "$*" | grep -q "^NO_RUN"; then - return 0 - fi - - if bool "$DRY_RUN"; then - echo "DRY: + $*" - else - echo "+ $*" - "$@" - fi -} - -is_graphical() { - command -v $PREF_TERM > /dev/null && return 0 || return 1 -} - -command -v $SYS_SUDO > /dev/null || SYS_SUDO="NO_RUN" diff --git a/scripts/00-install-requirements.sh b/scripts/00-install-requirements.sh new file mode 100644 index 0000000..33a1cf5 --- /dev/null +++ b/scripts/00-install-requirements.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# This file only installs what is needed for the sync to perform... + +$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ + rsync \ No newline at end of file diff --git a/scripts/10-copy-files.sh b/scripts/10-copy-files.sh new file mode 100644 index 0000000..e5c4941 --- /dev/null +++ b/scripts/10-copy-files.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +HOME_FILES=${HOME_FILES:-./files/home} +ROOT_FILES=${ROOT_FILES:-./files/root} + +# overwrite files but preserve files surrounding +rsync -av $HOME_FILES/ $HOME +$SUDO rsync -av $ROOT_FILES/ / \ No newline at end of file diff --git a/scripts/20-install-pkgs.sh b/scripts/20-install-pkgs.sh new file mode 100644 index 0000000..b2f0fd2 --- /dev/null +++ b/scripts/20-install-pkgs.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +PACKAGE_LIST=${PACKAGE_LIST:-./package.list} +GRAPHICAL_PACKAGE_LIST=${GRAPHICAL_PACKAGE_LIST:-./gpackage.list} + +_APPLICATIONS="" +while read -r pkg; do + [ -z "$pkg" ] && continue + [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue + _APPLICATIONS="$_APPLICATIONS $pkg" +done < "$PACKAGE_LIST" + +if [ "${GRAPHICAL:-no}" = "yes" ]; then + if [ -f "$GRAPHICAL_PACKAGE_LIST" ]; then + while read -r pkg; do + [ -z "$pkg" ] && continue + [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue + _APPLICATIONS="$_APPLICATIONS $pkg" + done < "$GRAPHICAL_PACKAGE_LIST" + fi +fi + +$SUDO $PM $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS diff --git a/sync.conf b/sync.conf deleted file mode 100644 index 8c57fc4..0000000 --- a/sync.conf +++ /dev/null @@ -1,16 +0,0 @@ -# PM - Package Manager Options -PM_COMMAND=${PM_COMMAND:-pacman} -PM_NOCONFIRM=${PM_NOCONFIRM:-"--noconfirm"} -PM_INSTALL=${PM_INSTALL:--S} -PM_REMOVE=${PM_REMOVE:-R} -PM_UPDATE=${PM_UPDATE:--Sy} -PM_UPGRADE=${PM_UPGRADE:--Syyu} - -# SYS - System Options -SYS_SUDO=${SYS_SUDO:-"sudo"} -SYS_ROOT=${SYS_ROOT:-"/"} - -# PREF - Preferences -PREF_TERM=${PREF_TERM:-alacritty} -PREF_TERM_SET_TITLE=${PREF_TERM_SET_TITLE:--t} -PREF_TERM_RUN_CMD=${PREF_TERM_RUN_CMD:--e} \ No newline at end of file diff --git a/sync.sh b/sync.sh index a753714..e0a04d2 100755 --- a/sync.sh +++ b/sync.sh @@ -1,104 +1,18 @@ #!/bin/sh -SYNC_FILES=${SYNC_FILES:-yes} -INSTALL_PKGS=${INSTALL_PKGS:-yes} -RUN_CMDS=${RUN_CMDS:-yes} -PULL_GIT=${PULL_GIT:-yes} -TIME_TRACK=${TIME_TRACK:-no} +SUDO=${SUDO:-sudo} -ARGS="$@" - -. ./lib/lib.sh - -set -e # Exit on error - -_install_pkgs() { - run $SYS_SUDO $PM_COMMAND $PM_UPDATE $PM_NOCONFIRM - _APPLICATIONS="" - while read -r pkg; do - [ -z "$pkg" ] && continue - [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue - _APPLICATIONS="$_APPLICATIONS $pkg" - done <"$1" - run $SYS_SUDO $PM_COMMAND $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS -} - -_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 -} - -ARGS="$@" -_skip_next_arg="n" -arg_handler() { - for arg in $ARGS; do - bool $_skip_next_arg && continue - - case $arg in - +files) SYNC_FILES=yes ;; - -files) SYNC_FILES=no ;; - +pkgs) INSTALL_PKGS=yes ;; - -pkgs) INSTALL_PKGS=no ;; - +cmds) RUN_CMDS=yes ;; - -cmds) RUN_CMDS=no ;; - +git) PULL_GIT=yes ;; - -git) PULL_GIT=no ;; - +) SYNC_FILES=yes; INSTALL_PKGS=yes; RUN_CMDS=yes; PULL_GIT=yes ;; - -) SYNC_FILES=no; INSTALL_PKGS=no; RUN_CMDS=no; PULL_GIT=no ;; - +*) - echo "# Unknown argument: $arg" - exit 1 - ;; - -*) - echo "# Unknown argument: $arg" - exit 1 - ;; - esac - done -} +PM=${PM:-pacman} +PM_INSTALL=${PM_INSTALL:--S} +PM_NOCONFIRM=${PM_NOCONFIRM:---noconfirm} main() { - arg_handler - - echo "# hook: PULL_GIT" - bool "$PULL_GIT" && run git pull - - echo "# hook: SYNC_FILES (/)" - bool "$SYNC_FILES" && run cp -a "./files/%HOME/." "$HOME" - - echo "# hook: SYNC_FILES" - bool "$SYNC_FILES" && _sync_files - - echo "# hook: INSTALL_PKGS" - bool "$INSTALL_PKGS" && _install_pkgs ./package.list - - echo "# hook: RUN_CMDS" - bool "$RUN_CMDS" && _run_cmds - - return 0 + for script in ./scripts/* ; do + echo "# exec $script" + . $script + done } -echo "# exec: start." -if bool $TIME_TRACK; then - time main "$@" -else - main "$@" -fi -echo "# exec: done." +main "$@" + +echo "# OK" \ No newline at end of file From adea9b916ef174994f90dd57aa31a1d403e272fa Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 01:26:02 +0100 Subject: [PATCH 025/177] feat: dwm --- files/dwm/config.h | 128 +++++++++++++++++++++ files/dwm/dwm-start.sh | 31 +++++ files/dwm/dwm.desktop | 6 + files/home/.config/alacritty/alacritty.yml | 2 + scripts/30-dwm.sh | 34 ++++++ 5 files changed, 201 insertions(+) create mode 100644 files/dwm/config.h create mode 100755 files/dwm/dwm-start.sh create mode 100644 files/dwm/dwm.desktop create mode 100644 scripts/30-dwm.sh diff --git a/files/dwm/config.h b/files/dwm/config.h new file mode 100644 index 0000000..996e250 --- /dev/null +++ b/files/dwm/config.h @@ -0,0 +1,128 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ +static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ +static const unsigned int systrayspacing = 2; /* systray spacing */ +static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ +static const int showsystray = 1; /* 0 means no systray */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ +static const char *fonts[] = { "monospace:size=10" }; +static const char dmenufont[] = "monospace:size=10"; +static const char col_gray1[] = "#222222"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; +static const char col_cyan[] = "#005577"; +static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, +}; + +/* tagging */ +static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", }; + +static const Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, True, -1 }, + { "Firefox", NULL, NULL, 0, False, -1 }, + { "Thunderbird", NULL, NULL, 2, False, -1 }, + { "stalonetray", NULL, NULL, 1, False, -1 }, + { "chrome", NULL, NULL, 4, False, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ +static const int nmaster = 1; /* number of clients in master area */ +static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod4Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; + +static const char *termcmd[] = { "alacritty", NULL }; +static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; + +static const char *volup[] = { "amixer", "set", "Master", "5%+", NULL }; +static const char *voldown[] = { "amixer", "set", "Master", "5%-", NULL }; + +static const char *dwmdie[] = { "killall", "dwm-start", NULL }; +static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_Return, spawn, {.v = termcmd } }, + { MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } }, + { MODKEY, XK_l, spawn, {.v = locksaver } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} }, + { MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} }, + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { MODKEY, XK_Up, spawn, {.v = volup } }, + { MODKEY, XK_Down, spawn, {.v = voldown } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} }, +}; + +/* button definitions */ +/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; + diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh new file mode 100755 index 0000000..40bf68f --- /dev/null +++ b/files/dwm/dwm-start.sh @@ -0,0 +1,31 @@ +#!/bin/sh +gnome-screensaver & + +xsetroot -solid black + +#while loop to update statusbar with some goodies +while true; do + #memfreak to get it in MB + memfreak2=$(grep MemFree /proc/meminfo | awk '{ print $2 }') + memfreak=$(($memfreak2 / 1024)) + #time + CLK=$(date +'%a %b %d %R:%S %Z') + #volume + VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') + #loadavg + AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) + #network stats in Bytes + NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') + battper=$(cat /sys/class/power_supply/BAT0/capacity) + #this one is not so good, increases a delay of 1-2s of the updating. + #put it in the xsetrootname plz (tip of the day, do not put | as first char after " + xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | " + sleep 1 +done & + + +nm-applet & +mate-volume-control-status-icon & +feh -z -Z --bg-scale /home/didier/Pictures/background.png + +exec dwm >/dev/null diff --git a/files/dwm/dwm.desktop b/files/dwm/dwm.desktop new file mode 100644 index 0000000..2f8e70f --- /dev/null +++ b/files/dwm/dwm.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=dwm +Comment=This session starts dwm +Exec=/usr/local/bin/dwm-start +Type=Application \ No newline at end of file diff --git a/files/home/.config/alacritty/alacritty.yml b/files/home/.config/alacritty/alacritty.yml index 3bc0096..882e5c9 100644 --- a/files/home/.config/alacritty/alacritty.yml +++ b/files/home/.config/alacritty/alacritty.yml @@ -2,6 +2,8 @@ bell: animation: 'Ease' duration: 50 color: '#555555' +font: + size: 7.0 cursor: style: shape: 'Block' diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh new file mode 100644 index 0000000..6813bc5 --- /dev/null +++ b/scripts/30-dwm.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# This file configures builds and installs DWM. + +# install dependencies +$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ + feh \ + network-manager-applet \ + alsa-utils \ + dstat \ + curl + +# clone +[ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm + +# config +cp ./files/dwm/config.h /tmp/dotfiles-dwm/config.h + +# build, patch and install +pushd /tmp/dotfiles-dwm + +# patches +curl https://dwm.suckless.org/patches/systray/dwm-systray-6.4.diff -o /tmp/dwm-systray.diff +git apply -3 /tmp/dwm-systray.diff + +$SUDO make install +popd + +# start script +chmod +x ./files/dwm/dwm-start.sh +$SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start + +# DM entry +$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop \ No newline at end of file From aee809669d8de7bd5b0b9047b69e8003c01641a3 Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 11:48:59 +0100 Subject: [PATCH 026/177] feat(dwm): more controls --- files/dwm/config.h | 145 ++++++++++++++++++++++++--------------------- 1 file changed, 77 insertions(+), 68 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index 996e250..dc4b931 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ +#include + /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ @@ -18,21 +20,21 @@ static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; static const char col_cyan[] = "#005577"; static const char *colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; /* tagging */ static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", }; static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, True, -1 }, - { "Firefox", NULL, NULL, 0, False, -1 }, - { "Thunderbird", NULL, NULL, 2, False, -1 }, - { "stalonetray", NULL, NULL, 1, False, -1 }, - { "chrome", NULL, NULL, 4, False, -1 }, + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, True, -1 }, + { "Firefox", NULL, NULL, 0, False, -1 }, + { "Thunderbird", NULL, NULL, 2, False, -1 }, + { "stalonetray", NULL, NULL, 1, False, -1 }, + { "chrome", NULL, NULL, 4, False, -1 }, }; /* layout(s) */ @@ -42,19 +44,19 @@ static const int nmaster = 1; /* number of clients in master area */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, }; /* key definitions */ #define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ - { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } @@ -66,63 +68,70 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, static const char *termcmd[] = { "alacritty", NULL }; static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; -static const char *volup[] = { "amixer", "set", "Master", "5%+", NULL }; -static const char *voldown[] = { "amixer", "set", "Master", "5%-", NULL }; +static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; +static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; +static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; -static const char *dwmdie[] = { "killall", "dwm-start", NULL }; +static const char *light_up[] = {"light", "-A", "5", NULL}; +static const char *light_down[] = {"light", "-U", "5", NULL}; + +static const char *dwmdie[] = {"/bin/sh", "-c", "pkill dwm-start && pkill dwm", "null"}; static Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } }, - { MODKEY, XK_l, spawn, {.v = locksaver } }, - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} }, - { MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} }, - { MODKEY|ShiftMask, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - { MODKEY, XK_Up, spawn, {.v = volup } }, - { MODKEY, XK_Down, spawn, {.v = voldown } }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) - TAGKEYS( XK_4, 3) - TAGKEYS( XK_5, 4) - TAGKEYS( XK_6, 5) - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} }, + /* modifier key function argument */ + { MODKEY, XK_Return, spawn, {.v = termcmd } }, + { MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } }, + { MODKEY, XK_l, spawn, {.v = locksaver } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} }, + { MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} }, + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, + { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, + { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, + { 0, XF86XK_MonBrightnessUp, spawn, {.v = light_up} }, + { 0, XF86XK_MonBrightnessDown, spawn, {.v = light_down} }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} }, }; /* button definitions */ /* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkTagBar, 0, Button1, view, {0} }, - { ClkTagBar, 0, Button3, toggleview, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; From 4a2dc0c95bf6f0c5d5f28b566f5d99a5111f9a7d Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 14:10:35 +0100 Subject: [PATCH 027/177] feat(dwm): screenshots --- files/dwm/config.h | 17 ++++++++++++++--- files/dwm/dwm-start.sh | 1 + scripts/30-dwm.sh | 5 +++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index dc4b931..0cf9a63 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -3,7 +3,7 @@ #include /* appearance */ -static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int borderpx = 2; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ @@ -62,20 +62,29 @@ static const Layout layouts[] = { #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ + +// dmenu static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +// terminal static const char *termcmd[] = { "alacritty", NULL }; -static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; +// general & sys +static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; - static const char *light_up[] = {"light", "-A", "5", NULL}; static const char *light_down[] = {"light", "-U", "5", NULL}; +// screenshots +static const char *screenshot[] = {"flameshot", "full", "-c", NULL}; +static const char *screenshot_partial[] = {"flameshot", "gui", "-c", NULL}; + +// kill dwm static const char *dwmdie[] = {"/bin/sh", "-c", "pkill dwm-start && pkill dwm", "null"}; + static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_Return, spawn, {.v = termcmd } }, @@ -101,6 +110,8 @@ static Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { 0, XK_Print, spawn, {.v = screenshot } }, + { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 40bf68f..a6b9372 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -26,6 +26,7 @@ done & nm-applet & mate-volume-control-status-icon & +flameshot & feh -z -Z --bg-scale /home/didier/Pictures/background.png exec dwm >/dev/null diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 6813bc5..30a2e78 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -8,7 +8,8 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ network-manager-applet \ alsa-utils \ dstat \ - curl + curl \ + flameshot # clone [ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm @@ -31,4 +32,4 @@ chmod +x ./files/dwm/dwm-start.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start # DM entry -$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop \ No newline at end of file +$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop From 172b107f101f3fb8b6c5e44cc7e5202c05d9a030 Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 16:30:21 +0100 Subject: [PATCH 028/177] feat(dwm): pink --- files/dwm/config.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index 0cf9a63..9d8701c 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -14,15 +14,17 @@ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; -static const char col_gray1[] = "#222222"; -static const char col_gray2[] = "#444444"; -static const char col_gray3[] = "#bbbbbb"; -static const char col_gray4[] = "#eeeeee"; -static const char col_cyan[] = "#005577"; + +static const char col_bg_inactive[] = "#444444"; +static const char col_fg_inactive[] = "#bbbbbb"; + +static const char col_bg_highlight[] = "#ffaaaa"; +static const char col_fg_highlight[] = "#000000"; + static const char *colors[][3] = { /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + [SchemeNorm] = { col_fg_inactive, col_bg_inactive, col_bg_inactive }, + [SchemeSel] = { col_fg_highlight, col_bg_highlight, col_bg_highlight } }; /* tagging */ @@ -65,7 +67,14 @@ static const Layout layouts[] = { // dmenu static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ -static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *dmenucmd[] = { + "dmenu_run", + "-m", dmenumon, + "-fn", dmenufont, + "-nb", col_bg_inactive, + "-nf", col_fg_inactive, + "-sb", col_bg_highlight, + "-sf", col_fg_highlight, NULL }; // terminal static const char *termcmd[] = { "alacritty", NULL }; From 529e149d220c2864084164cf2e5aaf8ab112c195 Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 16:47:39 +0100 Subject: [PATCH 029/177] feat(dwm+main): tools update --- files/dwm/dwm-start.sh | 8 ++++++-- scripts/30-dwm.sh | 10 ++++++++-- sync.sh | 8 +++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index a6b9372..ae7f36b 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -27,6 +27,10 @@ done & nm-applet & mate-volume-control-status-icon & flameshot & -feh -z -Z --bg-scale /home/didier/Pictures/background.png +feh -z -Z --bg-scale $HOME/Pictures/background.* -exec dwm >/dev/null +touch /tmp/restart-dwm +while [ -f /tmp/restart-dwm ]; do + exec dwm >/dev/null + rm -rf /tmp/restart-dwm +done diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 30a2e78..08b1f83 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -27,9 +27,15 @@ git apply -3 /tmp/dwm-systray.diff $SUDO make install popd -# start script -chmod +x ./files/dwm/dwm-start.sh +# dwm boot/manage scripts +chmod +x ./files/dwm/*.sh + $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start +$SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync # DM entry $SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop + +# background +rm -rf $HOME/Pictures/background.* +curl https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/9757d496-239b-46c5-baea-6873cbfe9b3d/ddkbeml-015b05e6-6f8f-471e-a3a4-1c4360127ea6.jpg -o $HOME/Pictures/background.jpg diff --git a/sync.sh b/sync.sh index e0a04d2..b44e920 100755 --- a/sync.sh +++ b/sync.sh @@ -6,7 +6,13 @@ PM=${PM:-pacman} PM_INSTALL=${PM_INSTALL:--S} PM_NOCONFIRM=${PM_NOCONFIRM:---noconfirm} +set -e + main() { + if [ ! -z "$@" ]; then + . ./scripts/$@ + exit 0 + fi for script in ./scripts/* ; do echo "# exec $script" . $script @@ -15,4 +21,4 @@ main() { main "$@" -echo "# OK" \ No newline at end of file +echo "# OK" From 46c84486a31e381f424965df18a6775dff8c276c Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 16:48:44 +0100 Subject: [PATCH 030/177] feat(dwm): fix restart opt --- files/dwm/dwm-start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index ae7f36b..8bf86b8 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -6,7 +6,7 @@ xsetroot -solid black #while loop to update statusbar with some goodies while true; do #memfreak to get it in MB - memfreak2=$(grep MemFree /proc/meminfo | awk '{ print $2 }') + memfreak2=$(grep MemUsed /proc/meminfo | awk '{ print $2 }') memfreak=$(($memfreak2 / 1024)) #time CLK=$(date +'%a %b %d %R:%S %Z') @@ -31,6 +31,6 @@ feh -z -Z --bg-scale $HOME/Pictures/background.* touch /tmp/restart-dwm while [ -f /tmp/restart-dwm ]; do - exec dwm >/dev/null rm -rf /tmp/restart-dwm + exec dwm >/dev/null done From a701919885fcc7ee5d209d48ead39281eb6d8c3a Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 17:12:29 +0100 Subject: [PATCH 031/177] feat(dwm): startup apps --- files/dwm/config.h | 13 ++++++------ files/dwm/dwm-start.sh | 46 +++++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index 9d8701c..b92e5a0 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -31,12 +31,13 @@ static const char *colors[][3] = { static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", }; static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, True, -1 }, - { "Firefox", NULL, NULL, 0, False, -1 }, - { "Thunderbird", NULL, NULL, 2, False, -1 }, - { "stalonetray", NULL, NULL, 1, False, -1 }, - { "chrome", NULL, NULL, 4, False, -1 }, + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, True, -1 }, + { "firefox", NULL, NULL, 1 << 2, False, -1 }, + { "discord", NULL, NULL, 1 << 3, False, -1 }, + { "Thunderbird", NULL, NULL, 2, False, -1 }, + { "stalonetray", NULL, NULL, 1, False, -1 }, + { "chrome", NULL, NULL, 4, False, -1 }, }; /* layout(s) */ diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 8bf86b8..3941ea8 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -5,22 +5,23 @@ xsetroot -solid black #while loop to update statusbar with some goodies while true; do - #memfreak to get it in MB - memfreak2=$(grep MemUsed /proc/meminfo | awk '{ print $2 }') - memfreak=$(($memfreak2 / 1024)) - #time - CLK=$(date +'%a %b %d %R:%S %Z') - #volume - VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') - #loadavg - AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) - #network stats in Bytes - NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') - battper=$(cat /sys/class/power_supply/BAT0/capacity) - #this one is not so good, increases a delay of 1-2s of the updating. - #put it in the xsetrootname plz (tip of the day, do not put | as first char after " - xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | " - sleep 1 + #memfreak to get it in MB + memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }') + memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }') + memfreak=$(((memtotal - memfree) / 1024)) + #time + CLK=$(date +'%a %b %d %R:%S %Z') + #volume + VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') + #loadavg + AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) + #network stats in Bytes + NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') + battper=$(cat /sys/class/power_supply/BAT0/capacity) + #this one is not so good, increases a delay of 1-2s of the updating. + #put it in the xsetrootname plz (tip of the day, do not put | as first char after " + xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | " + sleep 1 done & @@ -29,8 +30,11 @@ mate-volume-control-status-icon & flameshot & feh -z -Z --bg-scale $HOME/Pictures/background.* -touch /tmp/restart-dwm -while [ -f /tmp/restart-dwm ]; do - rm -rf /tmp/restart-dwm - exec dwm >/dev/null -done +start_apps() { + discord & + firefox & +} + +(sleep 1 && start_apps) & + +exec dwm >/dev/null From 596cece3638b5c812d226d9cbf079addea55c598 Mon Sep 17 00:00:00 2001 From: faulty Date: Mon, 20 Feb 2023 22:07:44 +0100 Subject: [PATCH 032/177] feat(fun): portal shutdown --- scripts/30-dwm.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 08b1f83..82dfb39 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -33,6 +33,9 @@ chmod +x ./files/dwm/*.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start $SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync +# funny tool +$SUDO cp ./files/dwm/shutdown-seq.sh /usr/local/bin/portal-sys-kill + # DM entry $SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop From 3b3e5f4e726e416a63c26221270da06211488b3e Mon Sep 17 00:00:00 2001 From: Didier Date: Mon, 6 Mar 2023 13:44:58 +0100 Subject: [PATCH 033/177] fix(cfg): font was too smalll --- files/home/.config/alacritty/alacritty.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/files/home/.config/alacritty/alacritty.yml b/files/home/.config/alacritty/alacritty.yml index 882e5c9..3bc0096 100644 --- a/files/home/.config/alacritty/alacritty.yml +++ b/files/home/.config/alacritty/alacritty.yml @@ -2,8 +2,6 @@ bell: animation: 'Ease' duration: 50 color: '#555555' -font: - size: 7.0 cursor: style: shape: 'Block' From 79c7765224d82850a421e4e5e6eddaa1787d23fc Mon Sep 17 00:00:00 2001 From: Didier Date: Mon, 6 Mar 2023 13:45:20 +0100 Subject: [PATCH 034/177] feat: compatibility script --- compatibility/fedora.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 compatibility/fedora.sh diff --git a/compatibility/fedora.sh b/compatibility/fedora.sh new file mode 100755 index 0000000..18dbe37 --- /dev/null +++ b/compatibility/fedora.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +export SUDO=sudo + +export PM=dnf +export PM_INSTALL=install +export PM_NOCONFIRM=-y + +[ -f ./sync.sh ] && ./sync.sh $@ || (cd .. && ./sync.sh $@) \ No newline at end of file From d5095e5f19bb9e98191911481e8f2982e267bf0a Mon Sep 17 00:00:00 2001 From: Didier Date: Mon, 6 Mar 2023 13:45:28 +0100 Subject: [PATCH 035/177] feat: hop script --- hop.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 hop.sh diff --git a/hop.sh b/hop.sh new file mode 100755 index 0000000..06a1d1b --- /dev/null +++ b/hop.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# need to hop? this script copies the important stuff. + +tar \ + --exclude={node_modules,target,dist,cache} \ + -cvf \ + ${TAR_FILE:-backup.tar} \ + ~/.ssh \ + ~/.config \ + ~/.mozilla \ + ~/Documents \ + ~/Pictures \ + ~/code \ + ~/environments From d1dc8f84955a5e3533df3f53127182be27854a10 Mon Sep 17 00:00:00 2001 From: Didier Date: Mon, 6 Mar 2023 13:45:41 +0100 Subject: [PATCH 036/177] fix: optional dwm --- scripts/30-dwm.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 82dfb39..e1b994d 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -2,6 +2,8 @@ # This file configures builds and installs DWM. +[ "${NO_GRAPHICS:-no}" = "yes" ] && return 0 + # install dependencies $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ feh \ From 37114b94eb7dbfe21d4fa06da06742b33f551957 Mon Sep 17 00:00:00 2001 From: Didier Date: Mon, 6 Mar 2023 13:45:47 +0100 Subject: [PATCH 037/177] zsh install script --- scripts/05-zsh.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 scripts/05-zsh.sh diff --git a/scripts/05-zsh.sh b/scripts/05-zsh.sh new file mode 100644 index 0000000..34b1bb6 --- /dev/null +++ b/scripts/05-zsh.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ + zsh + +# install pfetch +[ -d /tmp/pfetch ] || $SUDO bash -c \ + "git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SUDO mv ./pfetch /usr/local/pfetch)" + +# install omz +bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" + +# favourite omz plugins +PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR +PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting +[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR + +# set default shell +$SUDO usermod $USER --shell /bin/zsh \ No newline at end of file From bb6919ad8143e1ee60feea0a42a789105dbe27e7 Mon Sep 17 00:00:00 2001 From: Didier Date: Mon, 6 Mar 2023 13:50:33 +0100 Subject: [PATCH 038/177] fix: pfetch dir --- scripts/05-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/05-zsh.sh b/scripts/05-zsh.sh index 34b1bb6..75ee7f6 100644 --- a/scripts/05-zsh.sh +++ b/scripts/05-zsh.sh @@ -5,7 +5,7 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ # install pfetch [ -d /tmp/pfetch ] || $SUDO bash -c \ - "git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SUDO mv ./pfetch /usr/local/pfetch)" + "git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SUDO mv ./pfetch /usr/local/bin/pfetch)" # install omz bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" From 9875954f4a6b7f3482bd1e39eb1fbca54931e9ea Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 10:06:27 +0100 Subject: [PATCH 039/177] fastfetch :) --- files/home/.zshrc | 2 +- scripts/05-zsh.sh | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/files/home/.zshrc b/files/home/.zshrc index 431f59c..ec4a6f4 100644 --- a/files/home/.zshrc +++ b/files/home/.zshrc @@ -24,7 +24,7 @@ alias get_rust='. $HOME/.cargo/env' alias s="title $HOST && cmatrix -rs && clear" # COSMETICS -if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then pfetch; fi +if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then fastfetch; fi else PS1="$(whoami)@$(cat /etc/hostname) $ " diff --git a/scripts/05-zsh.sh b/scripts/05-zsh.sh index 75ee7f6..5a2c865 100644 --- a/scripts/05-zsh.sh +++ b/scripts/05-zsh.sh @@ -1,11 +1,23 @@ #!/bin/sh $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ - zsh + zsh \ + cmake # for fastfetch -# install pfetch -[ -d /tmp/pfetch ] || $SUDO bash -c \ - "git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SUDO mv ./pfetch /usr/local/bin/pfetch)" +# install fastfetch +[ -d /tmp/fastfetch ] || \ + git clone https://github.com/LinusDierheimer/fastfetch /tmp/fastfetch + +if [ ! -f /tmp/fastfetch/build/fastfetch ]; then +pushd /tmp/fastfetch + mkdir -p build + pushd build + cmake .. + cmake --build . --target fastfetch + $SUDO mv fastfetch /usr/local/bin/fastfetch + popd +popd +fi # install omz bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" From c4e88c75bb62496d01f98748e6c5c09a9f1c32c3 Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 11:58:33 +0100 Subject: [PATCH 040/177] fix: scripts --- files/dwm/dwm-sync.sh | 7 +++++++ scripts/30-dwm.sh | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100755 files/dwm/dwm-sync.sh diff --git a/files/dwm/dwm-sync.sh b/files/dwm/dwm-sync.sh new file mode 100755 index 0000000..eb2f276 --- /dev/null +++ b/files/dwm/dwm-sync.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +pushd ~/.local/dotfiles +./sync.sh 30-dwm.sh +popd + +loginctl kill-user $USER \ No newline at end of file diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index e1b994d..bc7afeb 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -35,9 +35,6 @@ chmod +x ./files/dwm/*.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start $SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync -# funny tool -$SUDO cp ./files/dwm/shutdown-seq.sh /usr/local/bin/portal-sys-kill - # DM entry $SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop From 9608b219dced809649de78757e2082422326adeb Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 11:58:35 +0100 Subject: [PATCH 041/177] fix: fedora update --- compatibility/fedora.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compatibility/fedora.sh b/compatibility/fedora.sh index 18dbe37..bc85691 100755 --- a/compatibility/fedora.sh +++ b/compatibility/fedora.sh @@ -6,4 +6,7 @@ export PM=dnf export PM_INSTALL=install export PM_NOCONFIRM=-y +$SUDO dnf update +[ "${NO_GRAPHICS:-no}" = "yes" ] || $SUDO $PM $PM_INSTALL $PM_NOCONFIRM libX11-devel libXft-devel libXinerama-devel libXrandr-devel xorg-x11-xinit-session + [ -f ./sync.sh ] && ./sync.sh $@ || (cd .. && ./sync.sh $@) \ No newline at end of file From bad7e5739497ef4ec38bcd8f9c70b7d87d2d7590 Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 12:05:42 +0100 Subject: [PATCH 042/177] refactor(dwm): change apps of dwm --- files/dwm/dwm-start.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 3941ea8..4faedf2 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -1,5 +1,4 @@ #!/bin/sh -gnome-screensaver & xsetroot -solid black @@ -24,9 +23,7 @@ while true; do sleep 1 done & - nm-applet & -mate-volume-control-status-icon & flameshot & feh -z -Z --bg-scale $HOME/Pictures/background.* From f0bb78922de76160c0761b1c6a038369d18cd70d Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 12:07:11 +0100 Subject: [PATCH 043/177] fix: dmenu pkg --- scripts/30-dwm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index bc7afeb..d635c39 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -11,7 +11,8 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ alsa-utils \ dstat \ curl \ - flameshot + flameshot \ + dmenu # i don't care to customize # clone [ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm From eff3dffdce96f502cf872ef276542542021fecd6 Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 12:11:07 +0100 Subject: [PATCH 044/177] feat: DWM start script envvars --- files/dwm/dwm-start.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 4faedf2..5243da3 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -1,5 +1,7 @@ #!/bin/sh +LITE=${LITE:-no} + xsetroot -solid black #while loop to update statusbar with some goodies @@ -23,15 +25,15 @@ while true; do sleep 1 done & -nm-applet & -flameshot & feh -z -Z --bg-scale $HOME/Pictures/background.* start_apps() { + nm-applet & + flameshot & discord & firefox & } -(sleep 1 && start_apps) & +[ "$LITE" = "yes" ] || (sleep 1 && start_apps) & -exec dwm >/dev/null +[ "${NO_DWM:-no}" = "yes" ] || exec dwm >/dev/null From 78e3c81e0de51fa908280c9d572c648ee1724292 Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 12:13:21 +0100 Subject: [PATCH 045/177] fix: unused var to NOG var --- package.list | 1 + scripts/20-install-pkgs.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.list b/package.list index bbecb9e..1e45b12 100644 --- a/package.list +++ b/package.list @@ -1,3 +1,4 @@ curl vim zsh +docker diff --git a/scripts/20-install-pkgs.sh b/scripts/20-install-pkgs.sh index b2f0fd2..912f9cc 100644 --- a/scripts/20-install-pkgs.sh +++ b/scripts/20-install-pkgs.sh @@ -10,7 +10,7 @@ while read -r pkg; do _APPLICATIONS="$_APPLICATIONS $pkg" done < "$PACKAGE_LIST" -if [ "${GRAPHICAL:-no}" = "yes" ]; then +if [ "${NO_GRAPHICS:-no}" = "no" ]; then if [ -f "$GRAPHICAL_PACKAGE_LIST" ]; then while read -r pkg; do [ -z "$pkg" ] && continue From 30a3e1e21160e06fc41505f06b1b7b1f7287cb51 Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 12:18:57 +0100 Subject: [PATCH 046/177] feat(dwm): i3lock --- scripts/30-dwm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index d635c39..7eda15e 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -12,7 +12,8 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ dstat \ curl \ flameshot \ - dmenu # i don't care to customize + dmenu \ + i3lock # clone [ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm From e0588cd6d173eed06b49b9aafce617b49b3b0710 Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 7 Mar 2023 13:14:10 +0100 Subject: [PATCH 047/177] refactor(dwm): lock, start update, segregate status, etc. --- files/dwm/config.h | 4 ++-- files/dwm/dwm-lock.sh | 5 +++++ files/dwm/dwm-start.sh | 25 ++----------------------- files/dwm/dwm-status.sh | 26 ++++++++++++++++++++++++++ scripts/30-dwm.sh | 4 ++++ 5 files changed, 39 insertions(+), 25 deletions(-) create mode 100755 files/dwm/dwm-lock.sh create mode 100755 files/dwm/dwm-status.sh diff --git a/files/dwm/config.h b/files/dwm/config.h index b92e5a0..d957645 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -81,7 +81,7 @@ static const char *dmenucmd[] = { static const char *termcmd[] = { "alacritty", NULL }; // general & sys -static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; +static const char *locksaver[] = { "/usr/local/bin/dwm-lock", NULL }; static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; @@ -121,7 +121,7 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, { 0, XK_Print, spawn, {.v = screenshot } }, - { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, + { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, diff --git a/files/dwm/dwm-lock.sh b/files/dwm/dwm-lock.sh new file mode 100755 index 0000000..2ce99e0 --- /dev/null +++ b/files/dwm/dwm-lock.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +touch /tmp/$USER-screen.lock +i3lock ${@:--nefc "#000000"} +rm -f /tmp/$USER-screen.lock diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 5243da3..88c7cd4 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -4,29 +4,6 @@ LITE=${LITE:-no} xsetroot -solid black -#while loop to update statusbar with some goodies -while true; do - #memfreak to get it in MB - memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }') - memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }') - memfreak=$(((memtotal - memfree) / 1024)) - #time - CLK=$(date +'%a %b %d %R:%S %Z') - #volume - VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') - #loadavg - AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) - #network stats in Bytes - NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') - battper=$(cat /sys/class/power_supply/BAT0/capacity) - #this one is not so good, increases a delay of 1-2s of the updating. - #put it in the xsetrootname plz (tip of the day, do not put | as first char after " - xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | " - sleep 1 -done & - -feh -z -Z --bg-scale $HOME/Pictures/background.* - start_apps() { nm-applet & flameshot & @@ -34,6 +11,8 @@ start_apps() { firefox & } +[ "$LITE" = "yes" ] || /usr/local/bin/dwm-status & [ "$LITE" = "yes" ] || (sleep 1 && start_apps) & +feh -zZ --bg-scale $HOME/Pictures/background.* [ "${NO_DWM:-no}" = "yes" ] || exec dwm >/dev/null diff --git a/files/dwm/dwm-status.sh b/files/dwm/dwm-status.sh new file mode 100755 index 0000000..bfa8a91 --- /dev/null +++ b/files/dwm/dwm-status.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +xsetroot -solid black -name "starting dwm..." + +#while loop to update statusbar with some goodies +while true; do + sleep 1 + [ -f /tmp/$USER-screen.lock ] && continue + #memfreak to get it in MB + memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }') + memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }') + memfreak=$(((memtotal - memfree) / 1024)) + #time + CLK=$(date +'%a %b %d %R:%S %Z') + #volume + VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') + #loadavg + AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) + #network stats in Bytes + NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') + battper=$(cat /sys/class/power_supply/BAT0/capacity) + #this one is not so good, increases a delay of 1-2s of the updating. + #put it in the xsetrootname plz (tip of the day, do not put | as first char after " + xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK |" +done + diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 7eda15e..10a440a 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -35,7 +35,11 @@ popd chmod +x ./files/dwm/*.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start +$SUDO cp ./files/dwm/dwm-status.sh /usr/local/bin/dwm-status $SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync +$SUDO cp ./files/dwm/dwm-lock.sh /usr/local/bin/dwm-lock + +$SUDO chmod +x /usr/local/bin/dwm-* # DM entry $SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop From 7f0421d094889dc889dae003833e01d957cfbec0 Mon Sep 17 00:00:00 2001 From: Didier Date: Wed, 23 Aug 2023 06:14:56 +0200 Subject: [PATCH 048/177] next gen init --- .gitignore | 3 +- README.md | 17 +- compatibility/fedora.sh | 12 - distros/alpine/pm.sh | 19 ++ distros/any/package.list | 4 + distros/any/root/etc/sudoers | 4 + distros/arch/package.list | 2 + distros/arch/pm.sh | 22 ++ distros/arch/root/etc/pacman.conf | 31 +++ distros/arch/sys-scripts/00-reflector.sh | 12 + distros/arch/user-scripts/00-yay.sh | 13 + files/dwm/config.h | 158 ----------- files/dwm/dwm-lock.sh | 5 - files/dwm/dwm-start.sh | 18 -- files/dwm/dwm-status.sh | 26 -- files/dwm/dwm-sync.sh | 7 - files/dwm/dwm.desktop | 6 - files/home/.config/kanshi/config | 9 - files/home/.config/kitty/kitty.conf | 1 - files/home/.config/rofi/config.rasi | 1 - files/home/.config/sway/config | 248 ------------------ files/home/.config/sway/status.py | 25 -- files/home/.config/sway/status.sh | 16 -- files/home/.zsh_preferences | 2 - files/home/.zsh_scripts | 49 ---- files/home/.zshrc | 35 --- files/root/etc/pacman.conf | 100 ------- files/root/etc/pacman.d/mirrorlist | 11 - gpackage.list | 3 - .../.config/alacritty/alacritty.yml | 0 {files/home => home}/.vimrc | 1 + hop.sh | 15 -- package.list | 4 - scripts/00-install-requirements.sh | 6 - scripts/05-zsh.sh | 32 --- scripts/10-copy-files.sh | 8 - scripts/20-install-pkgs.sh | 23 -- scripts/30-dwm.sh | 49 ---- sync.sh | 126 +++++++-- unlink.sh | 10 + 40 files changed, 239 insertions(+), 894 deletions(-) delete mode 100755 compatibility/fedora.sh create mode 100644 distros/alpine/pm.sh create mode 100644 distros/any/package.list create mode 100644 distros/any/root/etc/sudoers create mode 100644 distros/arch/package.list create mode 100644 distros/arch/pm.sh create mode 100644 distros/arch/root/etc/pacman.conf create mode 100644 distros/arch/sys-scripts/00-reflector.sh create mode 100644 distros/arch/user-scripts/00-yay.sh delete mode 100644 files/dwm/config.h delete mode 100755 files/dwm/dwm-lock.sh delete mode 100755 files/dwm/dwm-start.sh delete mode 100755 files/dwm/dwm-status.sh delete mode 100755 files/dwm/dwm-sync.sh delete mode 100644 files/dwm/dwm.desktop delete mode 100644 files/home/.config/kanshi/config delete mode 120000 files/home/.config/kitty/kitty.conf delete mode 100755 files/home/.config/rofi/config.rasi delete mode 100755 files/home/.config/sway/config delete mode 100755 files/home/.config/sway/status.py delete mode 100755 files/home/.config/sway/status.sh delete mode 100644 files/home/.zsh_preferences delete mode 100644 files/home/.zsh_scripts delete mode 100644 files/home/.zshrc delete mode 100644 files/root/etc/pacman.conf delete mode 100644 files/root/etc/pacman.d/mirrorlist delete mode 100644 gpackage.list rename {files/home => home}/.config/alacritty/alacritty.yml (100%) rename {files/home => home}/.vimrc (96%) mode change 100755 => 100644 delete mode 100755 hop.sh delete mode 100644 package.list delete mode 100644 scripts/00-install-requirements.sh delete mode 100644 scripts/05-zsh.sh delete mode 100644 scripts/10-copy-files.sh delete mode 100644 scripts/20-install-pkgs.sh delete mode 100644 scripts/30-dwm.sh mode change 100755 => 100644 sync.sh create mode 100644 unlink.sh diff --git a/.gitignore b/.gitignore index 62c8935..e0318d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea/ \ No newline at end of file +.idea/ +.dotfiles/ \ No newline at end of file diff --git a/README.md b/README.md index 2e5da9f..e6074a3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -# Faulty's Dotfiles -Version: 3 +# Dotfiles ---- - -## file sync -files in `./files` are synced across the system. -files in `./files/home` are synced to the home of the user running the script. -files in `./files/root` are synced with sudo to the root of the script. \ No newline at end of file +## `distros/` +This directory is meant to setup the distro to the liking of the user. +### `distros/*/root` +Contains files to overlay over the executing system. +### `distro/*/sys-scripts` +scripts that are ran as `root` +### `distro/*/user-scripts` +scripts that are ran as the user \ No newline at end of file diff --git a/compatibility/fedora.sh b/compatibility/fedora.sh deleted file mode 100755 index bc85691..0000000 --- a/compatibility/fedora.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -export SUDO=sudo - -export PM=dnf -export PM_INSTALL=install -export PM_NOCONFIRM=-y - -$SUDO dnf update -[ "${NO_GRAPHICS:-no}" = "yes" ] || $SUDO $PM $PM_INSTALL $PM_NOCONFIRM libX11-devel libXft-devel libXinerama-devel libXrandr-devel xorg-x11-xinit-session - -[ -f ./sync.sh ] && ./sync.sh $@ || (cd .. && ./sync.sh $@) \ No newline at end of file diff --git a/distros/alpine/pm.sh b/distros/alpine/pm.sh new file mode 100644 index 0000000..90eac36 --- /dev/null +++ b/distros/alpine/pm.sh @@ -0,0 +1,19 @@ +cmd="apk" +while getopts "icru" opt; do + case $opt in + i) + cmd="$cmd add" + ;; + u) + cmd="$cmd add" + r) + cmd="$cmd remove" + ;; + c) + cmd="$cmd info -q" + ;; + esac +done +shift $((OPTIND-1)) + +$cmd $@ \ No newline at end of file diff --git a/distros/any/package.list b/distros/any/package.list new file mode 100644 index 0000000..53b3000 --- /dev/null +++ b/distros/any/package.list @@ -0,0 +1,4 @@ +neofetch +git +vim +sudo \ No newline at end of file diff --git a/distros/any/root/etc/sudoers b/distros/any/root/etc/sudoers new file mode 100644 index 0000000..e77799b --- /dev/null +++ b/distros/any/root/etc/sudoers @@ -0,0 +1,4 @@ +root ALL=(ALL:ALL) ALL +%wheel ALL=(ALL:ALL) ALL +%root ALL=(ALL:ALL) NOPASSWD: ALL +@includedir /etc/sudoers.d diff --git a/distros/arch/package.list b/distros/arch/package.list new file mode 100644 index 0000000..c3e02c8 --- /dev/null +++ b/distros/arch/package.list @@ -0,0 +1,2 @@ +reflector # for scripts/00-reflector.sh +alacritty # favourite terminal emulator \ No newline at end of file diff --git a/distros/arch/pm.sh b/distros/arch/pm.sh new file mode 100644 index 0000000..0fd802c --- /dev/null +++ b/distros/arch/pm.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +cmd="pacman --noconfirm" +while getopts "icru" opt; do + case $opt in + i) + cmd="$cmd -S" + ;; + u) + cmd="$cmd -Syyu" + ;; + r) + cmd="$cmd -R" + ;; + c) + cmd="$cmd -Q" + ;; + esac +done +shift $((OPTIND-1)) + +$cmd $@ \ No newline at end of file diff --git a/distros/arch/root/etc/pacman.conf b/distros/arch/root/etc/pacman.conf new file mode 100644 index 0000000..e63be35 --- /dev/null +++ b/distros/arch/root/etc/pacman.conf @@ -0,0 +1,31 @@ +[options] +HoldPkg = pacman glibc yay +Architecture = auto + +Color +CheckSpace +ParallelDownloads = 5 + +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional + +#[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 + +#[multilib-testing] +#Include = /etc/pacman.d/mirrorlist + +[multilib] +Include = /etc/pacman.d/mirrorlist diff --git a/distros/arch/sys-scripts/00-reflector.sh b/distros/arch/sys-scripts/00-reflector.sh new file mode 100644 index 0000000..7d2aa9d --- /dev/null +++ b/distros/arch/sys-scripts/00-reflector.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Sets up fast mirrors on arch + +if ! pacman -Q reflector; then + echo "reflector was not installed" + exit 1 +fi + +cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak +reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist +echo "Server = arch.neo.faulty.nl/$repo/os/$arch" >> /etc/pacman.d/mirrorlist \ No newline at end of file diff --git a/distros/arch/user-scripts/00-yay.sh b/distros/arch/user-scripts/00-yay.sh new file mode 100644 index 0000000..4ce4631 --- /dev/null +++ b/distros/arch/user-scripts/00-yay.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Installs yay. + +[ "$UID" = "0" ] || exit 0 + +yaytmpdir=$(mktemp -d) + +git clone https://aur.archlinux.org/yay $yaytmpdir +oldpwd=$(pwd) +cd $yaytmpdir +makepkg -si +cd $oldpwd diff --git a/files/dwm/config.h b/files/dwm/config.h deleted file mode 100644 index d957645..0000000 --- a/files/dwm/config.h +++ /dev/null @@ -1,158 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#include - -/* appearance */ -static const unsigned int borderpx = 2; /* border pixel of windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ -static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ -static const unsigned int systrayspacing = 2; /* systray spacing */ -static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ -static const int showsystray = 1; /* 0 means no systray */ -static const int showbar = 1; /* 0 means no bar */ -static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "monospace:size=10" }; -static const char dmenufont[] = "monospace:size=10"; - -static const char col_bg_inactive[] = "#444444"; -static const char col_fg_inactive[] = "#bbbbbb"; - -static const char col_bg_highlight[] = "#ffaaaa"; -static const char col_fg_highlight[] = "#000000"; - -static const char *colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { col_fg_inactive, col_bg_inactive, col_bg_inactive }, - [SchemeSel] = { col_fg_highlight, col_bg_highlight, col_bg_highlight } -}; - -/* tagging */ -static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", }; - -static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, True, -1 }, - { "firefox", NULL, NULL, 1 << 2, False, -1 }, - { "discord", NULL, NULL, 1 << 3, False, -1 }, - { "Thunderbird", NULL, NULL, 2, False, -1 }, - { "stalonetray", NULL, NULL, 1, False, -1 }, - { "chrome", NULL, NULL, 4, False, -1 }, -}; - -/* layout(s) */ -static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ -static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ -static const int nmaster = 1; /* number of clients in master area */ -static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ - -static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, -}; - -/* key definitions */ -#define MODKEY Mod4Mask -#define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ - { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, - -/* helper for spawning shell commands in the pre dwm-5.0 fashion */ -#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } - -/* commands */ - -// dmenu -static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ -static const char *dmenucmd[] = { - "dmenu_run", - "-m", dmenumon, - "-fn", dmenufont, - "-nb", col_bg_inactive, - "-nf", col_fg_inactive, - "-sb", col_bg_highlight, - "-sf", col_fg_highlight, NULL }; - -// terminal -static const char *termcmd[] = { "alacritty", NULL }; - -// general & sys -static const char *locksaver[] = { "/usr/local/bin/dwm-lock", NULL }; -static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; -static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; -static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; -static const char *light_up[] = {"light", "-A", "5", NULL}; -static const char *light_down[] = {"light", "-U", "5", NULL}; - -// screenshots -static const char *screenshot[] = {"flameshot", "full", "-c", NULL}; -static const char *screenshot_partial[] = {"flameshot", "gui", "-c", NULL}; - -// kill dwm -static const char *dwmdie[] = {"/bin/sh", "-c", "pkill dwm-start && pkill dwm", "null"}; - -static Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } }, - { MODKEY, XK_l, spawn, {.v = locksaver } }, - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} }, - { MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} }, - { MODKEY|ShiftMask, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - { 0, XK_Print, spawn, {.v = screenshot } }, - { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, - { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, - { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, - { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, - { 0, XF86XK_MonBrightnessUp, spawn, {.v = light_up} }, - { 0, XF86XK_MonBrightnessDown, spawn, {.v = light_down} }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) - TAGKEYS( XK_4, 3) - TAGKEYS( XK_5, 4) - TAGKEYS( XK_6, 5) - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} }, -}; - -/* button definitions */ -/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ -static Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkTagBar, 0, Button1, view, {0} }, - { ClkTagBar, 0, Button3, toggleview, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, -}; - diff --git a/files/dwm/dwm-lock.sh b/files/dwm/dwm-lock.sh deleted file mode 100755 index 2ce99e0..0000000 --- a/files/dwm/dwm-lock.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -touch /tmp/$USER-screen.lock -i3lock ${@:--nefc "#000000"} -rm -f /tmp/$USER-screen.lock diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh deleted file mode 100755 index 88c7cd4..0000000 --- a/files/dwm/dwm-start.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -LITE=${LITE:-no} - -xsetroot -solid black - -start_apps() { - nm-applet & - flameshot & - discord & - firefox & -} - -[ "$LITE" = "yes" ] || /usr/local/bin/dwm-status & -[ "$LITE" = "yes" ] || (sleep 1 && start_apps) & - -feh -zZ --bg-scale $HOME/Pictures/background.* -[ "${NO_DWM:-no}" = "yes" ] || exec dwm >/dev/null diff --git a/files/dwm/dwm-status.sh b/files/dwm/dwm-status.sh deleted file mode 100755 index bfa8a91..0000000 --- a/files/dwm/dwm-status.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -xsetroot -solid black -name "starting dwm..." - -#while loop to update statusbar with some goodies -while true; do - sleep 1 - [ -f /tmp/$USER-screen.lock ] && continue - #memfreak to get it in MB - memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }') - memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }') - memfreak=$(((memtotal - memfree) / 1024)) - #time - CLK=$(date +'%a %b %d %R:%S %Z') - #volume - VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') - #loadavg - AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) - #network stats in Bytes - NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') - battper=$(cat /sys/class/power_supply/BAT0/capacity) - #this one is not so good, increases a delay of 1-2s of the updating. - #put it in the xsetrootname plz (tip of the day, do not put | as first char after " - xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK |" -done - diff --git a/files/dwm/dwm-sync.sh b/files/dwm/dwm-sync.sh deleted file mode 100755 index eb2f276..0000000 --- a/files/dwm/dwm-sync.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -pushd ~/.local/dotfiles -./sync.sh 30-dwm.sh -popd - -loginctl kill-user $USER \ No newline at end of file diff --git a/files/dwm/dwm.desktop b/files/dwm/dwm.desktop deleted file mode 100644 index 2f8e70f..0000000 --- a/files/dwm/dwm.desktop +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=dwm -Comment=This session starts dwm -Exec=/usr/local/bin/dwm-start -Type=Application \ No newline at end of file diff --git a/files/home/.config/kanshi/config b/files/home/.config/kanshi/config deleted file mode 100644 index 5a245d2..0000000 --- a/files/home/.config/kanshi/config +++ /dev/null @@ -1,9 +0,0 @@ -profile school { - output "Iiyama North America PL2483H 1156290962278" mode 1920x1080 position 0,0 - output eDP-1 mode 1920x1080 position 1920,0 -} - -#profile sharing { -# output HDMI-A-1 mode 1920x1080 position 0,1080 -# output eDP-1 mode 1920x1080 position 0,0 -#} diff --git a/files/home/.config/kitty/kitty.conf b/files/home/.config/kitty/kitty.conf deleted file mode 120000 index de7259e..0000000 --- a/files/home/.config/kitty/kitty.conf +++ /dev/null @@ -1 +0,0 @@ -/home/didier/.local/dotfiles/./files/kitty/kitty.conf \ No newline at end of file diff --git a/files/home/.config/rofi/config.rasi b/files/home/.config/rofi/config.rasi deleted file mode 100755 index 1efb65f..0000000 --- a/files/home/.config/rofi/config.rasi +++ /dev/null @@ -1 +0,0 @@ -@theme "Arc-Dark" diff --git a/files/home/.config/sway/config b/files/home/.config/sway/config deleted file mode 100755 index 2b78650..0000000 --- a/files/home/.config/sway/config +++ /dev/null @@ -1,248 +0,0 @@ -# Faulty's sway Config - - -set $mod Mod1 -set $sup Mod4 -set $terminal alacritty #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 kanshi -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 wayland 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'" -bindsym $sup+Shift+e exec wlogout -# 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 windowโ€™s width. - # Pressing right will grow the windowโ€™s width. - # Pressing up will shrink the windowโ€™s height. - # Pressing down will grow the windowโ€™s 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 - } -} diff --git a/files/home/.config/sway/status.py b/files/home/.config/sway/status.py deleted file mode 100755 index 5a89322..0000000 --- a/files/home/.config/sway/status.py +++ /dev/null @@ -1,25 +0,0 @@ -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) diff --git a/files/home/.config/sway/status.sh b/files/home/.config/sway/status.sh deleted file mode 100755 index c8bcfc3..0000000 --- a/files/home/.config/sway/status.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/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 diff --git a/files/home/.zsh_preferences b/files/home/.zsh_preferences deleted file mode 100644 index 2677a0e..0000000 --- a/files/home/.zsh_preferences +++ /dev/null @@ -1,2 +0,0 @@ -_ZSH_PREF_NO_PFETCH=0 -_ZSH_PREF_NO_NONSENSE=0 \ No newline at end of file diff --git a/files/home/.zsh_scripts b/files/home/.zsh_scripts deleted file mode 100644 index 7537861..0000000 --- a/files/home/.zsh_scripts +++ /dev/null @@ -1,49 +0,0 @@ -__is_arch() { - . /etc/os-release - if [ "$ID" = "arch" ]; then return 0; else return 1; fi -} - -pkg_once() { - if [ ! __is_arch ]; then - printf "This command is only for Arch Linux.\n" - return - fi - if [ ! -n "$1" ]; then - printf "Usage: pkg_once [command]\n" - printf "command is optional; if there is no command the package name is ran\n" - return - fi - printf "Installing $1...\n" - yay -S --noconfirm $1 > /dev/null - - if [ ! -n "$2" ]; then $1; else $2; fi - printf "Remoiving $1..." - yay -R --noconfirm $1 > /dev/null - echo "done.\n" -} - -rando () { - case $1 in - *|d|default) tr -dc A-Za-z0-9 ?@[\]^_`{|}~' > $file - fi - chmod +x $file - printf '%s' $file -} - -alias docurr="docker run -itd --rm --name current" diff --git a/files/home/.zshrc b/files/home/.zshrc deleted file mode 100644 index ec4a6f4..0000000 --- a/files/home/.zshrc +++ /dev/null @@ -1,35 +0,0 @@ -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' -alias s="title $HOST && cmatrix -rs && clear" - -# COSMETICS -if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then fastfetch; fi - -else -PS1="$(whoami)@$(cat /etc/hostname) $ " -fi - -alias q="exit" -export PATH="${PATH}:/home/${USER}/.local/bin" -export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh" diff --git a/files/root/etc/pacman.conf b/files/root/etc/pacman.conf deleted file mode 100644 index 12cabfa..0000000 --- a/files/root/etc/pacman.conf +++ /dev/null @@ -1,100 +0,0 @@ -# -# /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 diff --git a/files/root/etc/pacman.d/mirrorlist b/files/root/etc/pacman.d/mirrorlist deleted file mode 100644 index 013da94..0000000 --- a/files/root/etc/pacman.d/mirrorlist +++ /dev/null @@ -1,11 +0,0 @@ -# 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 diff --git a/gpackage.list b/gpackage.list deleted file mode 100644 index 2f78a0b..0000000 --- a/gpackage.list +++ /dev/null @@ -1,3 +0,0 @@ -alacritty -sway -kanshi diff --git a/files/home/.config/alacritty/alacritty.yml b/home/.config/alacritty/alacritty.yml similarity index 100% rename from files/home/.config/alacritty/alacritty.yml rename to home/.config/alacritty/alacritty.yml diff --git a/files/home/.vimrc b/home/.vimrc old mode 100755 new mode 100644 similarity index 96% rename from files/home/.vimrc rename to home/.vimrc index abb89b3..6f12643 --- a/files/home/.vimrc +++ b/home/.vimrc @@ -1,2 +1,3 @@ set number set relativenumber + diff --git a/hop.sh b/hop.sh deleted file mode 100755 index 06a1d1b..0000000 --- a/hop.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# need to hop? this script copies the important stuff. - -tar \ - --exclude={node_modules,target,dist,cache} \ - -cvf \ - ${TAR_FILE:-backup.tar} \ - ~/.ssh \ - ~/.config \ - ~/.mozilla \ - ~/Documents \ - ~/Pictures \ - ~/code \ - ~/environments diff --git a/package.list b/package.list deleted file mode 100644 index 1e45b12..0000000 --- a/package.list +++ /dev/null @@ -1,4 +0,0 @@ -curl -vim -zsh -docker diff --git a/scripts/00-install-requirements.sh b/scripts/00-install-requirements.sh deleted file mode 100644 index 33a1cf5..0000000 --- a/scripts/00-install-requirements.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# This file only installs what is needed for the sync to perform... - -$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ - rsync \ No newline at end of file diff --git a/scripts/05-zsh.sh b/scripts/05-zsh.sh deleted file mode 100644 index 5a2c865..0000000 --- a/scripts/05-zsh.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ - zsh \ - cmake # for fastfetch - -# install fastfetch -[ -d /tmp/fastfetch ] || \ - git clone https://github.com/LinusDierheimer/fastfetch /tmp/fastfetch - -if [ ! -f /tmp/fastfetch/build/fastfetch ]; then -pushd /tmp/fastfetch - mkdir -p build - pushd build - cmake .. - cmake --build . --target fastfetch - $SUDO mv fastfetch /usr/local/bin/fastfetch - popd -popd -fi - -# install omz -bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" - -# favourite omz plugins -PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions -[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR -PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting -[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR - -# set default shell -$SUDO usermod $USER --shell /bin/zsh \ No newline at end of file diff --git a/scripts/10-copy-files.sh b/scripts/10-copy-files.sh deleted file mode 100644 index e5c4941..0000000 --- a/scripts/10-copy-files.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -HOME_FILES=${HOME_FILES:-./files/home} -ROOT_FILES=${ROOT_FILES:-./files/root} - -# overwrite files but preserve files surrounding -rsync -av $HOME_FILES/ $HOME -$SUDO rsync -av $ROOT_FILES/ / \ No newline at end of file diff --git a/scripts/20-install-pkgs.sh b/scripts/20-install-pkgs.sh deleted file mode 100644 index 912f9cc..0000000 --- a/scripts/20-install-pkgs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -PACKAGE_LIST=${PACKAGE_LIST:-./package.list} -GRAPHICAL_PACKAGE_LIST=${GRAPHICAL_PACKAGE_LIST:-./gpackage.list} - -_APPLICATIONS="" -while read -r pkg; do - [ -z "$pkg" ] && continue - [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue - _APPLICATIONS="$_APPLICATIONS $pkg" -done < "$PACKAGE_LIST" - -if [ "${NO_GRAPHICS:-no}" = "no" ]; then - if [ -f "$GRAPHICAL_PACKAGE_LIST" ]; then - while read -r pkg; do - [ -z "$pkg" ] && continue - [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue - _APPLICATIONS="$_APPLICATIONS $pkg" - done < "$GRAPHICAL_PACKAGE_LIST" - fi -fi - -$SUDO $PM $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh deleted file mode 100644 index 10a440a..0000000 --- a/scripts/30-dwm.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -# This file configures builds and installs DWM. - -[ "${NO_GRAPHICS:-no}" = "yes" ] && return 0 - -# install dependencies -$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ - feh \ - network-manager-applet \ - alsa-utils \ - dstat \ - curl \ - flameshot \ - dmenu \ - i3lock - -# clone -[ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm - -# config -cp ./files/dwm/config.h /tmp/dotfiles-dwm/config.h - -# build, patch and install -pushd /tmp/dotfiles-dwm - -# patches -curl https://dwm.suckless.org/patches/systray/dwm-systray-6.4.diff -o /tmp/dwm-systray.diff -git apply -3 /tmp/dwm-systray.diff - -$SUDO make install -popd - -# dwm boot/manage scripts -chmod +x ./files/dwm/*.sh - -$SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start -$SUDO cp ./files/dwm/dwm-status.sh /usr/local/bin/dwm-status -$SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync -$SUDO cp ./files/dwm/dwm-lock.sh /usr/local/bin/dwm-lock - -$SUDO chmod +x /usr/local/bin/dwm-* - -# DM entry -$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop - -# background -rm -rf $HOME/Pictures/background.* -curl https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/9757d496-239b-46c5-baea-6873cbfe9b3d/ddkbeml-015b05e6-6f8f-471e-a3a4-1c4360127ea6.jpg -o $HOME/Pictures/background.jpg diff --git a/sync.sh b/sync.sh old mode 100755 new mode 100644 index b44e920..c3a4b09 --- a/sync.sh +++ b/sync.sh @@ -1,24 +1,118 @@ #!/bin/sh -SUDO=${SUDO:-sudo} +osreleaseprop() { + cat /etc/os-release | grep -e "^$1=" | sed 's/ID=//' +} -PM=${PM:-pacman} -PM_INSTALL=${PM_INSTALL:--S} -PM_NOCONFIRM=${PM_NOCONFIRM:---noconfirm} - -set -e - -main() { - if [ ! -z "$@" ]; then - . ./scripts/$@ - exit 0 +elevated() { + s=${SUDO:-sudo} + if [ ! "$s" = "none" ]; then + if ! which $s &> /dev/null; then + echo "command \"$s\" not found" + exit 1 + fi + else + s="" fi - for script in ./scripts/* ; do - echo "# exec $script" - . $script + $s $@ +} + +DISTRO=$(osreleaseprop ID) +if [ ! -d "distros/$DISTRO" ]; then + echo "$DISTRO is not supported." + exit 1 +fi + +pm() { + elevated "sh distros/$DISTRO/pm.sh $@" +} + +install_package_list() { + pkgs="" + [ -f "distros/${1:-$DISTRO}/package.list" ] || return 1 + for pkg in $(cat distros/${1:-$DISTRO}/package.list | sed 's/#.*$//'); do + pkgs="$pkgs $pkg" + done + pm -i $pkgs +} + +run_scripts() { + cmd=$1 + shift + case $cmd in + sys) + dir="distros/${1:-$DISTRO}/sys-scripts" + [ -d "$dir" ] || return + for s in $(ls $dir); do + echo "# running $dir/$s..." + elevated sh $dir/$s || exit 1 + done + ;; + user) + dir="distros/${1:-$DISTRO}/user-scripts" + [ -d "$dir" ] || return + for s in $(ls $dir); do + echo "# running $dir/$s..." + sh $dir/$s || exit 1 + done + ;; + esac +} + +overlay() { + [ -d "distros/${1:-$DISTRO}/root" ] || return 0 + elevated cp -r distros/${1:-$DISTRO}/root / +} + +__step_update() { + echo "# updating system..." + pm -u +} + +__step_install_package_list() { + echo "# installing package lists..." + install_package_list any + install_package_list +} + +__step_run_system_scripts() { + echo "# running system scripts..." + run_scripts sys any + run_scripts sys +} + +__step_run_user_scripts() { + echo "# running user scripts..." + run_scripts user any + run_scripts user +} + +__step_overlay() { + echo "# overlaying root directories..." + overlay any + overlay +} + +__step_link_home() { + echo "# linking all home files..." + trackingfile=".dotfiles/$(git rev-parse HEAD)-links" + for item in $(find ./home -type f); do + path=$(echo $item | sed "s/\.\/home//") + [ -z "$path" ] && continue + path="$HOME$path" + mkdir -p $(dirname $path) &> /dev/null + ln $item $path && echo "$path" >> $trackingfile done } -main "$@" +mkdir -p .dotfiles &> /dev/null -echo "# OK" +if [ -n "$1" ]; then + $(printf "__step_%s" "$1") +else + __step_update + __step_install_package_list + __step_run_system_scripts + __step_run_user_scripts + __step_overlay +fi diff --git a/unlink.sh b/unlink.sh new file mode 100644 index 0000000..3650aa8 --- /dev/null +++ b/unlink.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +for linkfile in $@; do + echo "# processing linkfile $linkfile..." + for link in $(cat $linkfile); do + echo "# unlinking $link..." + unlink $link + done + rm -rf $linkfile +done \ No newline at end of file From ed88d0a5b55107383f48040187cc487886562f90 Mon Sep 17 00:00:00 2001 From: Didier Date: Wed, 23 Aug 2023 06:16:08 +0200 Subject: [PATCH 049/177] fix: add link home step --- sync.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/sync.sh b/sync.sh index c3a4b09..593f38a 100644 --- a/sync.sh +++ b/sync.sh @@ -114,5 +114,6 @@ else __step_install_package_list __step_run_system_scripts __step_run_user_scripts + __step_link_home __step_overlay fi From bfa0f9a0c70de14cb70a286b2a48cd6942ab2f74 Mon Sep 17 00:00:00 2001 From: Didier Date: Wed, 23 Aug 2023 06:36:14 +0200 Subject: [PATCH 050/177] feat: add some utils like tracking --- skip_steps.sh | 7 +++++++ sync.sh | 27 ++++++++++++++++++++------- unlink.sh | 2 +- 3 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 skip_steps.sh diff --git a/skip_steps.sh b/skip_steps.sh new file mode 100644 index 0000000..b6e9ee1 --- /dev/null +++ b/skip_steps.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +mkdir .dotfiles &>/dev/null + +for item in ${@:-update install_package_list run_system_scripts run_user_scripts link_home overlay}; do + echo "executed_step:$item" >> .dotfiles/pending_sync +done \ No newline at end of file diff --git a/sync.sh b/sync.sh index 593f38a..4b8f01a 100644 --- a/sync.sh +++ b/sync.sh @@ -99,21 +99,34 @@ __step_link_home() { for item in $(find ./home -type f); do path=$(echo $item | sed "s/\.\/home//") [ -z "$path" ] && continue + grep -q "$path" $trackingfile &> /dev/null && continue path="$HOME$path" mkdir -p $(dirname $path) &> /dev/null ln $item $path && echo "$path" >> $trackingfile done } +step() { + if ! grep -q "executed_step:$1" .dotfiles/pending_sync &> /dev/null; then + $(printf "__step_%s" "$1") + echo "executed_step:$1" >> .dotfiles/pending_sync + fi +} + mkdir -p .dotfiles &> /dev/null +touch .dotfiles/pending_sync if [ -n "$1" ]; then - $(printf "__step_%s" "$1") + step $1 else - __step_update - __step_install_package_list - __step_run_system_scripts - __step_run_user_scripts - __step_link_home - __step_overlay + echo "started_sync:$(date)" >> .dotfiles/log + step update + step install_package_list + step run_system_scripts + step run_user_scripts + step link_home + step overlay + echo "finished_sync:$(date)" >> .dotfiles/log fi + +unlink .dotfiles/pending_sync diff --git a/unlink.sh b/unlink.sh index 3650aa8..44e593c 100644 --- a/unlink.sh +++ b/unlink.sh @@ -1,6 +1,6 @@ #!/bin/sh -for linkfile in $@; do +for linkfile in ${@:-$(find .dotfiles -type f -name *-links)}; do echo "# processing linkfile $linkfile..." for link in $(cat $linkfile); do echo "# unlinking $link..." From 09709a39f74de7e8ed48bd119d63874250c7859a Mon Sep 17 00:00:00 2001 From: Didier Date: Wed, 23 Aug 2023 06:47:44 +0200 Subject: [PATCH 051/177] fix: stuff --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index 4b8f01a..89ed355 100644 --- a/sync.sh +++ b/sync.sh @@ -7,7 +7,7 @@ osreleaseprop() { elevated() { s=${SUDO:-sudo} if [ ! "$s" = "none" ]; then - if ! which $s &> /dev/null; then + if ! command -v $s &> /dev/null; then echo "command \"$s\" not found" exit 1 fi From 2d96f7592b319de3ed4d2732c8536773a17d736b Mon Sep 17 00:00:00 2001 From: Didier Date: Wed, 23 Aug 2023 06:49:14 +0200 Subject: [PATCH 052/177] add apline config --- distros/alpine/package.list | 1 + distros/alpine/root/etc/doas.conf | 1 + distros/alpine/sys-scripts/00-remove-sudo.sh | 5 +++++ 3 files changed, 7 insertions(+) create mode 100644 distros/alpine/package.list create mode 100644 distros/alpine/root/etc/doas.conf create mode 100644 distros/alpine/sys-scripts/00-remove-sudo.sh diff --git a/distros/alpine/package.list b/distros/alpine/package.list new file mode 100644 index 0000000..9d32a57 --- /dev/null +++ b/distros/alpine/package.list @@ -0,0 +1 @@ +doas \ No newline at end of file diff --git a/distros/alpine/root/etc/doas.conf b/distros/alpine/root/etc/doas.conf new file mode 100644 index 0000000..c50a253 --- /dev/null +++ b/distros/alpine/root/etc/doas.conf @@ -0,0 +1 @@ +permit persit wheel \ No newline at end of file diff --git a/distros/alpine/sys-scripts/00-remove-sudo.sh b/distros/alpine/sys-scripts/00-remove-sudo.sh new file mode 100644 index 0000000..2845cb8 --- /dev/null +++ b/distros/alpine/sys-scripts/00-remove-sudo.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# removes sudo + +apk del sudo \ No newline at end of file From 661be1811ba0308d35f338702fd8f3db5c125e19 Mon Sep 17 00:00:00 2001 From: Didier Date: Wed, 23 Aug 2023 06:50:19 +0200 Subject: [PATCH 053/177] fix: alpine pm impl --- distros/alpine/pm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distros/alpine/pm.sh b/distros/alpine/pm.sh index 90eac36..7560ed9 100644 --- a/distros/alpine/pm.sh +++ b/distros/alpine/pm.sh @@ -6,8 +6,9 @@ while getopts "icru" opt; do ;; u) cmd="$cmd add" + ;; r) - cmd="$cmd remove" + cmd="$cmd del" ;; c) cmd="$cmd info -q" From 33ee95006d919c97a2c0d6611564ba02328e5f45 Mon Sep 17 00:00:00 2001 From: Didier Date: Fri, 1 Sep 2023 03:34:08 +0200 Subject: [PATCH 054/177] feat: final-ish version --- crates/20-vim/crate.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 crates/20-vim/crate.sh diff --git a/crates/20-vim/crate.sh b/crates/20-vim/crate.sh new file mode 100644 index 0000000..3210eac --- /dev/null +++ b/crates/20-vim/crate.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +describe="Install vim and it's stuff" +scripts="@distro @self" + +apply() { + [ -e "$HOME/.vimrc" ] || ln files/.vimrc $HOME/.vimrc + [ -e "$HOME/.ideavimrc" ] || ln files/.ideavimrc $HOME/.ideavimrc +} + +undo() { + unlink $HOME/.vimrc + unlink $HOME/.ideavimrc +} \ No newline at end of file From 721a9d18131c96666cf08074e54077288fd79b72 Mon Sep 17 00:00:00 2001 From: Didier Date: Fri, 1 Sep 2023 03:34:16 +0200 Subject: [PATCH 055/177] stuff --- .gitignore | 2 - README.md | 10 -- crates/00-system/crate.arch.sh | 11 ++ crates/00-system/crate.sh | 7 + .../00-system/files}/pacman.conf | 0 .../etc => crates/00-system/files}/sudoers | 0 crates/10-zsh/crate.arch.sh | 7 + crates/10-zsh/crate.sh | 41 ++++++ crates/10-zsh/files/.zshrc | 23 +++ crates/20-vim/crate.arch.sh | 7 + crates/20-vim/files/.ideavimrc | 10 ++ {home => crates/20-vim/files}/.vimrc | 1 - crates/30-alacritty/crate.arch.sh | 7 + crates/30-alacritty/crate.sh | 12 ++ .../30-alacritty/files}/alacritty.yml | 4 - distros/alpine/package.list | 1 - distros/alpine/pm.sh | 20 --- distros/alpine/root/etc/doas.conf | 1 - distros/alpine/sys-scripts/00-remove-sudo.sh | 5 - distros/any/package.list | 4 - distros/arch/package.list | 2 - distros/arch/pm.sh | 22 --- distros/arch/sys-scripts/00-reflector.sh | 12 -- distros/arch/user-scripts/00-yay.sh | 13 -- dot | 85 +++++++++++ skip_steps.sh | 7 - sync.sh | 132 ------------------ unlink.sh | 10 -- 28 files changed, 210 insertions(+), 246 deletions(-) delete mode 100644 .gitignore delete mode 100644 README.md create mode 100644 crates/00-system/crate.arch.sh create mode 100644 crates/00-system/crate.sh rename {distros/arch/root/etc => crates/00-system/files}/pacman.conf (100%) rename {distros/any/root/etc => crates/00-system/files}/sudoers (100%) create mode 100644 crates/10-zsh/crate.arch.sh create mode 100644 crates/10-zsh/crate.sh create mode 100644 crates/10-zsh/files/.zshrc create mode 100644 crates/20-vim/crate.arch.sh create mode 100644 crates/20-vim/files/.ideavimrc rename {home => crates/20-vim/files}/.vimrc (96%) create mode 100644 crates/30-alacritty/crate.arch.sh create mode 100644 crates/30-alacritty/crate.sh rename {home/.config/alacritty => crates/30-alacritty/files}/alacritty.yml (56%) delete mode 100644 distros/alpine/package.list delete mode 100644 distros/alpine/pm.sh delete mode 100644 distros/alpine/root/etc/doas.conf delete mode 100644 distros/alpine/sys-scripts/00-remove-sudo.sh delete mode 100644 distros/any/package.list delete mode 100644 distros/arch/package.list delete mode 100644 distros/arch/pm.sh delete mode 100644 distros/arch/sys-scripts/00-reflector.sh delete mode 100644 distros/arch/user-scripts/00-yay.sh create mode 100755 dot delete mode 100644 skip_steps.sh delete mode 100644 sync.sh delete mode 100644 unlink.sh diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e0318d4..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.idea/ -.dotfiles/ \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index e6074a3..0000000 --- a/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Dotfiles - -## `distros/` -This directory is meant to setup the distro to the liking of the user. -### `distros/*/root` -Contains files to overlay over the executing system. -### `distro/*/sys-scripts` -scripts that are ran as `root` -### `distro/*/user-scripts` -scripts that are ran as the user \ No newline at end of file diff --git a/crates/00-system/crate.arch.sh b/crates/00-system/crate.arch.sh new file mode 100644 index 0000000..ce3f7dd --- /dev/null +++ b/crates/00-system/crate.arch.sh @@ -0,0 +1,11 @@ +super_apply() { + pacman -S --needed sudo reflector + if ! grep -q "Reflector" /etc/pacman.d/mirrorlist; then + cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak + reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist + else + echo "err: reflector already executed -- skipping..." + fi + + cp files/pacman.conf /etc/pacman.conf +} \ No newline at end of file diff --git a/crates/00-system/crate.sh b/crates/00-system/crate.sh new file mode 100644 index 0000000..2a73944 --- /dev/null +++ b/crates/00-system/crate.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +describe="Install stuff on the system!" + +super_apply() { + cp files/sudoers /etc/sudoers +} \ No newline at end of file diff --git a/distros/arch/root/etc/pacman.conf b/crates/00-system/files/pacman.conf similarity index 100% rename from distros/arch/root/etc/pacman.conf rename to crates/00-system/files/pacman.conf diff --git a/distros/any/root/etc/sudoers b/crates/00-system/files/sudoers similarity index 100% rename from distros/any/root/etc/sudoers rename to crates/00-system/files/sudoers diff --git a/crates/10-zsh/crate.arch.sh b/crates/10-zsh/crate.arch.sh new file mode 100644 index 0000000..b44c9ed --- /dev/null +++ b/crates/10-zsh/crate.arch.sh @@ -0,0 +1,7 @@ +super_apply() { + pacman -S --needed zsh cmake +} + +super_undo() { + pacman -R zsh +} \ No newline at end of file diff --git a/crates/10-zsh/crate.sh b/crates/10-zsh/crate.sh new file mode 100644 index 0000000..2e470d8 --- /dev/null +++ b/crates/10-zsh/crate.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +describe="Install zsh and oh-my-zsh!" +scripts="@distro @self" + +super_apply() { + [ -d /tmp/fastfetch ] || git clone https://github.com/LinusDierheimer/fastfetch /tmp/fastfetch + + if ! command -v fastfetch &> /dev/null; then + cd /tmp/fastfetch + mkdir -p build + cd build + cmake .. + cmake --build . --target fastfetch + mv fastfetch /usr/local/bin/fastfetch + fi + + usermod $USER --shell /bin/zsh +} + +super_undo() { + usermod $USER --shell /bin/bash +} + +apply() { + if [ ! -d "$HOME/.oh-my-zsh" ]; then + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended + + PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions + [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR + PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting + [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR + fi + + [ -e "$HOME/.zshrc" ] || ln files/.zshrc $HOME/.zshrc +} + +undo() { + unlink $HOME/.zshrc + rm -rf $HOME/.oh-my-zsh +} \ No newline at end of file diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc new file mode 100644 index 0000000..58358a2 --- /dev/null +++ b/crates/10-zsh/files/.zshrc @@ -0,0 +1,23 @@ +export GPG_TTY=$(tty) + +# paths +export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" + +# 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 + +# ALIASES +alias open="xdg-open" +alias nobeep="sudo modprobe -r pcspkr" +alias s="title $HOST && cmatrix -rs && clear" +alias q="exit" + +# COSMETICS +fastfetch + +export PATH="${PATH}:/home/${USER}/.local/bin" +export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh" diff --git a/crates/20-vim/crate.arch.sh b/crates/20-vim/crate.arch.sh new file mode 100644 index 0000000..d95ce2d --- /dev/null +++ b/crates/20-vim/crate.arch.sh @@ -0,0 +1,7 @@ +super_apply() { + pacman -S --needed vim +} + +super_undo() { + echo "we never uninstall vim -_-" +} \ No newline at end of file diff --git a/crates/20-vim/files/.ideavimrc b/crates/20-vim/files/.ideavimrc new file mode 100644 index 0000000..115e47f --- /dev/null +++ b/crates/20-vim/files/.ideavimrc @@ -0,0 +1,10 @@ +source ~/.vimrc + +set scrolloff=5 +set incsearch + +map Q gq + +Plug 'machakann/vim-highlightedyank' +Plug 'tpope/vim-commentary' +Plug 'wellle/targets.vim' diff --git a/home/.vimrc b/crates/20-vim/files/.vimrc similarity index 96% rename from home/.vimrc rename to crates/20-vim/files/.vimrc index 6f12643..abb89b3 100644 --- a/home/.vimrc +++ b/crates/20-vim/files/.vimrc @@ -1,3 +1,2 @@ set number set relativenumber - diff --git a/crates/30-alacritty/crate.arch.sh b/crates/30-alacritty/crate.arch.sh new file mode 100644 index 0000000..a91b78b --- /dev/null +++ b/crates/30-alacritty/crate.arch.sh @@ -0,0 +1,7 @@ +super_apply() { + pacman -S --needed alacritty +} + +super_undo() { + pacman -R alacritty +} \ No newline at end of file diff --git a/crates/30-alacritty/crate.sh b/crates/30-alacritty/crate.sh new file mode 100644 index 0000000..3a433d2 --- /dev/null +++ b/crates/30-alacritty/crate.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +describe="Installs alacritty and configs" +scripts="@distro @self" + +apply() { + [ -e "$HOME/.config/alacritty/alacritty.yml" ] || ln files/alacritty.yml $HOME/.config/alacritty/alacritty.yml +} + +undo() { + unlink $HOME/.config/alacritty/alacritty.yml +} \ No newline at end of file diff --git a/home/.config/alacritty/alacritty.yml b/crates/30-alacritty/files/alacritty.yml similarity index 56% rename from home/.config/alacritty/alacritty.yml rename to crates/30-alacritty/files/alacritty.yml index 3bc0096..1a30120 100644 --- a/home/.config/alacritty/alacritty.yml +++ b/crates/30-alacritty/files/alacritty.yml @@ -1,7 +1,3 @@ -bell: - animation: 'Ease' - duration: 50 - color: '#555555' cursor: style: shape: 'Block' diff --git a/distros/alpine/package.list b/distros/alpine/package.list deleted file mode 100644 index 9d32a57..0000000 --- a/distros/alpine/package.list +++ /dev/null @@ -1 +0,0 @@ -doas \ No newline at end of file diff --git a/distros/alpine/pm.sh b/distros/alpine/pm.sh deleted file mode 100644 index 7560ed9..0000000 --- a/distros/alpine/pm.sh +++ /dev/null @@ -1,20 +0,0 @@ -cmd="apk" -while getopts "icru" opt; do - case $opt in - i) - cmd="$cmd add" - ;; - u) - cmd="$cmd add" - ;; - r) - cmd="$cmd del" - ;; - c) - cmd="$cmd info -q" - ;; - esac -done -shift $((OPTIND-1)) - -$cmd $@ \ No newline at end of file diff --git a/distros/alpine/root/etc/doas.conf b/distros/alpine/root/etc/doas.conf deleted file mode 100644 index c50a253..0000000 --- a/distros/alpine/root/etc/doas.conf +++ /dev/null @@ -1 +0,0 @@ -permit persit wheel \ No newline at end of file diff --git a/distros/alpine/sys-scripts/00-remove-sudo.sh b/distros/alpine/sys-scripts/00-remove-sudo.sh deleted file mode 100644 index 2845cb8..0000000 --- a/distros/alpine/sys-scripts/00-remove-sudo.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# removes sudo - -apk del sudo \ No newline at end of file diff --git a/distros/any/package.list b/distros/any/package.list deleted file mode 100644 index 53b3000..0000000 --- a/distros/any/package.list +++ /dev/null @@ -1,4 +0,0 @@ -neofetch -git -vim -sudo \ No newline at end of file diff --git a/distros/arch/package.list b/distros/arch/package.list deleted file mode 100644 index c3e02c8..0000000 --- a/distros/arch/package.list +++ /dev/null @@ -1,2 +0,0 @@ -reflector # for scripts/00-reflector.sh -alacritty # favourite terminal emulator \ No newline at end of file diff --git a/distros/arch/pm.sh b/distros/arch/pm.sh deleted file mode 100644 index 0fd802c..0000000 --- a/distros/arch/pm.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -cmd="pacman --noconfirm" -while getopts "icru" opt; do - case $opt in - i) - cmd="$cmd -S" - ;; - u) - cmd="$cmd -Syyu" - ;; - r) - cmd="$cmd -R" - ;; - c) - cmd="$cmd -Q" - ;; - esac -done -shift $((OPTIND-1)) - -$cmd $@ \ No newline at end of file diff --git a/distros/arch/sys-scripts/00-reflector.sh b/distros/arch/sys-scripts/00-reflector.sh deleted file mode 100644 index 7d2aa9d..0000000 --- a/distros/arch/sys-scripts/00-reflector.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Sets up fast mirrors on arch - -if ! pacman -Q reflector; then - echo "reflector was not installed" - exit 1 -fi - -cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak -reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist -echo "Server = arch.neo.faulty.nl/$repo/os/$arch" >> /etc/pacman.d/mirrorlist \ No newline at end of file diff --git a/distros/arch/user-scripts/00-yay.sh b/distros/arch/user-scripts/00-yay.sh deleted file mode 100644 index 4ce4631..0000000 --- a/distros/arch/user-scripts/00-yay.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Installs yay. - -[ "$UID" = "0" ] || exit 0 - -yaytmpdir=$(mktemp -d) - -git clone https://aur.archlinux.org/yay $yaytmpdir -oldpwd=$(pwd) -cd $yaytmpdir -makepkg -si -cd $oldpwd diff --git a/dot b/dot new file mode 100755 index 0000000..7993255 --- /dev/null +++ b/dot @@ -0,0 +1,85 @@ +#!/bin/sh + +ask=0 + +is_function() { + type "$1" 2> /dev/null | sed "s/$1//" | grep -qwi function +} + +curr_distro() { + cat /etc/os-release | grep -G "^ID=" | sed 's/ID=//' +} + +include() { + [ -f "$1" ] || return 1 + . $1 + return 0 +} + +func() { + if is_function $(echo "super_$2"); then + sudo sh -c ". $1 && super_$2" + fi + is_function $2 && $2 +} + +get_command() { + case $1 in + a*) + printf "apply" + ;; + u*) + printf "undo" + ;; + *) + echo "err: not supported" >&2 + exit 1 + ;; + esac +} + +# only run this *in crate dir* +run_crate() { + include ./crate.sh || exit 1 + if [ -n "$describe" ]; then + echo "desc($(basename $PWD)): $describe" + fi + cmd=$(get_command $1) + scripts=${scripts:-"@self @distro"} + for s in $scripts; do + echo "exec($(basename $PWD)): $s/$cmd" + case $s in + @self) + func ./crate.sh $cmd + ;; + @distro) + unset -f super_$cmd + unset -f $cmd + include ./crate.$(curr_distro).sh + func ./crate.$(curr_distro).sh $cmd + unset -f super_$cmd + unset -f $cmd + include ./crate.sh + ;; + *) + sh $s + ;; + esac + done +} + +if [ $# -eq 2 ]; then + [ -d crates/*$1 ] || exit 1 + cd crates/*$1 + run_crate $2 + cd ../.. +else + [ $# -eq 0 ] && exit 2 + for crate in $(find ./crates -mindepth 1 -maxdepth 1 -type d | sort); do + cd $crate + run_crate $1 + cd ../.. + done +fi + + \ No newline at end of file diff --git a/skip_steps.sh b/skip_steps.sh deleted file mode 100644 index b6e9ee1..0000000 --- a/skip_steps.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -mkdir .dotfiles &>/dev/null - -for item in ${@:-update install_package_list run_system_scripts run_user_scripts link_home overlay}; do - echo "executed_step:$item" >> .dotfiles/pending_sync -done \ No newline at end of file diff --git a/sync.sh b/sync.sh deleted file mode 100644 index 89ed355..0000000 --- a/sync.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/sh - -osreleaseprop() { - cat /etc/os-release | grep -e "^$1=" | sed 's/ID=//' -} - -elevated() { - s=${SUDO:-sudo} - if [ ! "$s" = "none" ]; then - if ! command -v $s &> /dev/null; then - echo "command \"$s\" not found" - exit 1 - fi - else - s="" - fi - $s $@ -} - -DISTRO=$(osreleaseprop ID) -if [ ! -d "distros/$DISTRO" ]; then - echo "$DISTRO is not supported." - exit 1 -fi - -pm() { - elevated "sh distros/$DISTRO/pm.sh $@" -} - -install_package_list() { - pkgs="" - [ -f "distros/${1:-$DISTRO}/package.list" ] || return 1 - for pkg in $(cat distros/${1:-$DISTRO}/package.list | sed 's/#.*$//'); do - pkgs="$pkgs $pkg" - done - pm -i $pkgs -} - -run_scripts() { - cmd=$1 - shift - case $cmd in - sys) - dir="distros/${1:-$DISTRO}/sys-scripts" - [ -d "$dir" ] || return - for s in $(ls $dir); do - echo "# running $dir/$s..." - elevated sh $dir/$s || exit 1 - done - ;; - user) - dir="distros/${1:-$DISTRO}/user-scripts" - [ -d "$dir" ] || return - for s in $(ls $dir); do - echo "# running $dir/$s..." - sh $dir/$s || exit 1 - done - ;; - esac -} - -overlay() { - [ -d "distros/${1:-$DISTRO}/root" ] || return 0 - elevated cp -r distros/${1:-$DISTRO}/root / -} - -__step_update() { - echo "# updating system..." - pm -u -} - -__step_install_package_list() { - echo "# installing package lists..." - install_package_list any - install_package_list -} - -__step_run_system_scripts() { - echo "# running system scripts..." - run_scripts sys any - run_scripts sys -} - -__step_run_user_scripts() { - echo "# running user scripts..." - run_scripts user any - run_scripts user -} - -__step_overlay() { - echo "# overlaying root directories..." - overlay any - overlay -} - -__step_link_home() { - echo "# linking all home files..." - trackingfile=".dotfiles/$(git rev-parse HEAD)-links" - for item in $(find ./home -type f); do - path=$(echo $item | sed "s/\.\/home//") - [ -z "$path" ] && continue - grep -q "$path" $trackingfile &> /dev/null && continue - path="$HOME$path" - mkdir -p $(dirname $path) &> /dev/null - ln $item $path && echo "$path" >> $trackingfile - done -} - -step() { - if ! grep -q "executed_step:$1" .dotfiles/pending_sync &> /dev/null; then - $(printf "__step_%s" "$1") - echo "executed_step:$1" >> .dotfiles/pending_sync - fi -} - -mkdir -p .dotfiles &> /dev/null -touch .dotfiles/pending_sync - -if [ -n "$1" ]; then - step $1 -else - echo "started_sync:$(date)" >> .dotfiles/log - step update - step install_package_list - step run_system_scripts - step run_user_scripts - step link_home - step overlay - echo "finished_sync:$(date)" >> .dotfiles/log -fi - -unlink .dotfiles/pending_sync diff --git a/unlink.sh b/unlink.sh deleted file mode 100644 index 44e593c..0000000 --- a/unlink.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -for linkfile in ${@:-$(find .dotfiles -type f -name *-links)}; do - echo "# processing linkfile $linkfile..." - for link in $(cat $linkfile); do - echo "# unlinking $link..." - unlink $link - done - rm -rf $linkfile -done \ No newline at end of file From b4c79069d4458fb3e6462418afd7d647c176aae8 Mon Sep 17 00:00:00 2001 From: Didier Date: Fri, 1 Sep 2023 03:36:34 +0200 Subject: [PATCH 056/177] change behaviour to also update on apply --- crates/00-system/crate.arch.sh | 1 + crates/00-system/crate.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/00-system/crate.arch.sh b/crates/00-system/crate.arch.sh index ce3f7dd..2bdf8c5 100644 --- a/crates/00-system/crate.arch.sh +++ b/crates/00-system/crate.arch.sh @@ -1,4 +1,5 @@ super_apply() { + pacman -Syyu pacman -S --needed sudo reflector if ! grep -q "Reflector" /etc/pacman.d/mirrorlist; then cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak diff --git a/crates/00-system/crate.sh b/crates/00-system/crate.sh index 2a73944..5519bcb 100644 --- a/crates/00-system/crate.sh +++ b/crates/00-system/crate.sh @@ -1,6 +1,7 @@ #!/bin/sh describe="Install stuff on the system!" +scripts="@distro @self" super_apply() { cp files/sudoers /etc/sudoers From 96bd318184d1b2ea06a113b4a29b44f036dca96a Mon Sep 17 00:00:00 2001 From: Didier Date: Fri, 1 Sep 2023 03:39:43 +0200 Subject: [PATCH 057/177] make sure the proper zshrc is used --- crates/10-zsh/crate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/10-zsh/crate.sh b/crates/10-zsh/crate.sh index 2e470d8..e08f719 100644 --- a/crates/10-zsh/crate.sh +++ b/crates/10-zsh/crate.sh @@ -32,6 +32,7 @@ apply() { [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR fi + unlink $HOME/.zshrc [ -e "$HOME/.zshrc" ] || ln files/.zshrc $HOME/.zshrc } From af9fe2328029bfb206c10e5bfb1c9234900388d8 Mon Sep 17 00:00:00 2001 From: Didier Date: Sun, 3 Sep 2023 00:22:17 +0200 Subject: [PATCH 058/177] woah so cool --- crates/10-zsh/files/.zshrc | 1 - crates/30-alacritty/crate.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 58358a2..c49eb5c 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -20,4 +20,3 @@ alias q="exit" fastfetch export PATH="${PATH}:/home/${USER}/.local/bin" -export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh" diff --git a/crates/30-alacritty/crate.sh b/crates/30-alacritty/crate.sh index 3a433d2..27f5762 100644 --- a/crates/30-alacritty/crate.sh +++ b/crates/30-alacritty/crate.sh @@ -4,6 +4,7 @@ describe="Installs alacritty and configs" scripts="@distro @self" apply() { + [ -d "$HOME/.config/alacritty" ] || mkdir -p $HOME/.config/alacritty [ -e "$HOME/.config/alacritty/alacritty.yml" ] || ln files/alacritty.yml $HOME/.config/alacritty/alacritty.yml } From d70a5fd43a0a4533bc656ea0842efc79e002249a Mon Sep 17 00:00:00 2001 From: Didier Date: Sun, 3 Sep 2023 00:24:32 +0200 Subject: [PATCH 059/177] fix: add deps --- crates/05-i3/crate.arch.sh | 11 ++ crates/05-i3/crate.sh | 24 +++ crates/05-i3/files/40-proper-touchpad.conf | 8 + crates/05-i3/files/config | 214 +++++++++++++++++++++ crates/05-i3/files/status_config | 58 ++++++ 5 files changed, 315 insertions(+) create mode 100644 crates/05-i3/crate.arch.sh create mode 100644 crates/05-i3/crate.sh create mode 100644 crates/05-i3/files/40-proper-touchpad.conf create mode 100644 crates/05-i3/files/config create mode 100644 crates/05-i3/files/status_config diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh new file mode 100644 index 0000000..f87ce45 --- /dev/null +++ b/crates/05-i3/crate.arch.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu" + +super_apply() { + pacman -S --needed --noconfirm $pkgs +} + +super_undo() { + pacman -R --noconfirm $pkgs +} diff --git a/crates/05-i3/crate.sh b/crates/05-i3/crate.sh new file mode 100644 index 0000000..36c624e --- /dev/null +++ b/crates/05-i3/crate.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +describe="Installs i3" +scripts="@distro @self" + +apply() { + [ -d "$HOME/.config/i3" ] || mkdir -p $HOME/.config/i3 + [ -d "$HOME/.config/i3status" ] || mkdir -p $HOME/.config/i3status + [ -e "$HOME/.config/i3/config" ] || ln files/config $HOME/.config/i3/config + [ -e "$HOME/.config/i3status/config" ] || ln files/status_config $HOME/.config/i3status/config +} + +undo() { + rm $HOME/.config/i3/config + rm $HOME/.config/i3status/config +} + +super_apply() { + cp files/40-proper-touchpad.conf /etc/X11/xorg.conf.d/40-proper-touchpad.conf +} + +super_undo() { + rm /etc/X11/xorg.conf.d/40-proper-touchpad.conf +} diff --git a/crates/05-i3/files/40-proper-touchpad.conf b/crates/05-i3/files/40-proper-touchpad.conf new file mode 100644 index 0000000..80049de --- /dev/null +++ b/crates/05-i3/files/40-proper-touchpad.conf @@ -0,0 +1,8 @@ +Section "InputClass" + Identifier "libinput touchpad catchall" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + Driver "libinput" + Option "NaturalScrolling" "True" + Option "Tapping" "on" +EndSection diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config new file mode 100644 index 0000000..568e25a --- /dev/null +++ b/crates/05-i3/files/config @@ -0,0 +1,214 @@ +###################### +## Raine's i3 config ## +## Sept 2, 2023 ## +####################### + +## Mostly similar to i3's config yet differs + +# Useful variables: +# This section probably gets changed a lot +# --- +set $terminal alacritty +set $screen_lock i3lock -c "#111111" --nofork +set $appmenu i3-dmenu-desktop + +set $screenshot maim | xclip -selection clipboard -t image/png +set $alt_screenshot maim ~/Pictures/Screenshots/$(date +%s).png + +set $mod Mod4 +set $alt Mod1 +set $font pango:monospace 8 + +# Startup Applications: +# Things that will startup when starting i3. +# --- +exec --no-startup-id dex --autostart --environment i3 +exec --no-startup-id nm-applet +exec --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock + +# Extra variables: +# Only need changing for very specific installations. +# --- +set $audio_volume_up XF86AudioRaiseVolume +set $audio_volume_down XF86AudioLowerVolume +set $audio_mute XF86AudioMute +set $audio_mute_mic XF86AudioMicMute + +set $brightness_up XF86MonBrightnessUp +set $brightness_down XF86MonBrightnessDown + +set $nav_up l +set $nav_down k +set $nav_left j +set $nav_right semicolon + +set $ws_1 "1" +set $ws_2 "2" +set $ws_3 "3" +set $ws_4 "4" +set $ws_5 "5" +set $ws_6 "6" +set $ws_7 "7" +set $ws_8 "8" +set $ws_9 "9" +set $ws_10 "10" + +set $mode_resize_combo Mod4+r +set $mode_session_combo Mod4+Delete + +set $op_floating_modifier Mod1 + +set $meta_refresh_statusbar killall -SIGUSR1 i3status +bar { + status_command i3status +} + +# END OF CONFIG + +# Customization +#! Customization +# class border backgr. text indicator child_border +client.focused #D991BA #D27099 #ffffff #D96FBA #D951B0 +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 + +# Generic +floating_modifier $op_floating_modifier +tiling_drag modifier titlebar +font $font + +# Open a terminal +bindsym $mod+Return exec $terminal + +# Kill current window +bindsym $alt+Shift+q kill + +# Open app menu +bindsym $mod+Shift+d exec --no-startup-id $appmenu + +# Lock screen +bindsym $mod+l exec --no-startup-id $screen_lock + +# Screenshots +bindsym Print exec $screenshot +bindsym Mod1+Print exec $alt_screenshot + +# Audio +bindsym $audio_volume_up exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $meta_refresh_statusbar +bindsym $audio_volume_down exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $meta_refresh_statusbar +bindsym $audio_mute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $meta_refresh_statusbar +bindsym $audio_mute_mic exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $meta_refresh_statusbar + +# Brightness +bindsym $brightness_up exec --no-startup-id brightnessctl set +5% && $meta_refresh_statusbar +bindsym $brightness_down exec --no-startup-id brightnessctl set 5%- && $meta_refresh_statusbar + +# Change focused window +bindsym $alt+$nav_up focus up +bindsym $alt+$nav_down focus down +bindsym $alt+$nav_left focus left +bindsym $alt+$nav_right focus right +bindsym $alt+Up focus up +bindsym $alt+Down focus down +bindsym $alt+Left focus left +bindsym $alt+Right focus right + +# Move focused window +bindsym $alt+Shift+Up move up +bindsym $alt+Shift+Down move down +bindsym $alt+Shift+Left move left +bindsym $alt+Shift+Right move right +bindsym $alt+Shift+$nav_up move up +bindsym $alt+Shift+$nav_down move down +bindsym $alt+Shift+$nav_left move left +bindsym $alt+Shift+$nav_right move right + +# Splits +bindsym $alt+h split h +bindsym $alt+v split v + +# Make current window fullscreen +bindsym $alt+f fullscreen toggle + +# Change container layout +bindsym $mod+Mod1+s layout stacking +bindsym $mod+Mod1+t layout tabbed +bindsym $mod+Mod1+e layout toggle split + +# Floating stuff +bindsym $mod+Shift+space floating toggle +bindsym $alt+space focus mode_toggle + +# Scratchpad +bindsym $alt+minus move scratchpad +bindsym $mod+minus scratchpad show + +# Switch to workspace +bindsym $mod+1 workspace number $ws_1 +bindsym $mod+2 workspace number $ws_2 +bindsym $mod+3 workspace number $ws_3 +bindsym $mod+4 workspace number $ws_4 +bindsym $mod+5 workspace number $ws_5 +bindsym $mod+6 workspace number $ws_6 +bindsym $mod+7 workspace number $ws_7 +bindsym $mod+8 workspace number $ws_8 +bindsym $mod+9 workspace number $ws_9 +bindsym $mod+0 workspace number $ws_10 + +# Move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws_1 +bindsym $mod+Shift+2 move container to workspace number $ws_2 +bindsym $mod+Shift+3 move container to workspace number $ws_3 +bindsym $mod+Shift+4 move container to workspace number $ws_4 +bindsym $mod+Shift+5 move container to workspace number $ws_5 +bindsym $mod+Shift+6 move container to workspace number $ws_6 +bindsym $mod+Shift+7 move container to workspace number $ws_7 +bindsym $mod+Shift+8 move container to workspace number $ws_8 +bindsym $mod+Shift+9 move container to workspace number $ws_9 +bindsym $mod+Shift+0 move container to workspace number $ws_10 + +# Move to workspace next to current +bindsym $mod+$nav_left workspace prev +bindsym $mod+$nav_right workspace next +bindsym $mod+Left workspace prev +bindsym $mod+Right workspace next + +# WM stuff +# reload i3 config +bindsym $mod+Control+c reload +# restart i3 +bindsym $mod+Control+r restart +# exit i3 (recognized combo; for people who need to exit your session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes, exit i3' 'i3-msg exit'" + +# Modes +bindsym $mode_resize_combo mode resize +mode "resize" { + bindsym $nav_left resize shrink width 10 px or 10 ppt + bindsym $nav_down resize grow height 10 px or 10 ppt + bindsym $nav_up resize shrink height 10 px or 10 ppt + bindsym $nav_right resize grow width 10 px or 10 ppt + 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 + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mode_resize_combo mode "default" +} + +bindsym $mode_session_combo mode "session" +mode "session" { + bindsym l exec --no-startup-id $lock, mode "default" + bindsym e exec --no-startup-id i3-msg exit, 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" + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mode_session_combo mode "default" +} diff --git a/crates/05-i3/files/status_config b/crates/05-i3/files/status_config new file mode 100644 index 0000000..529f125 --- /dev/null +++ b/crates/05-i3/files/status_config @@ -0,0 +1,58 @@ +general { + output_format = "i3bar" + colors = true + interval = 5 +} + +order += "ipv6" +order += "disk /" +order += "wireless wlan0" +order += "battery 0" +order += "memory" +order += "load" +order += "tztime local" +order += "tztime berlin" + +wireless wlp58s0 { + format_up = "W: (%quality at %essid, %bitrate) %ip" + format_down = "W: down" +} + +battery 0 { + format = "%status %percentage %remaining %emptytime" + format_down = "No battery" + status_chr = "โšก CHR" + status_bat = "๐Ÿ”‹ BAT" + status_unk = "? UNK" + status_full = "โ˜ป FULL" + path = "/sys/class/power_supply/BAT%d/uevent" + low_threshold = 10 +} + +tztime local { + format = "%Y-%m-%d %H:%M:%S" + hide_if_equals_localtime = true +} + +tztime berlin { + format = "%Y-%m-%d %H:%M:%S %Z" + timezone = "Europe/Berlin" +} + +load { + format = "%5min" +} + +memory { + format = "%used" + threshold_degraded = "10%" + format_degraded = "MEMORY: %free" +} + +disk "/" { + format = "%free" +} + +read_file uptime { + path = "/proc/uptime" +} From fda38a3012e1dcda0972fe68a92a4046e051f946 Mon Sep 17 00:00:00 2001 From: Didier Date: Sun, 3 Sep 2023 00:31:36 +0200 Subject: [PATCH 060/177] fix: config stuff --- crates/05-i3/files/config | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index 568e25a..26613d1 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -42,16 +42,16 @@ set $nav_down k set $nav_left j set $nav_right semicolon -set $ws_1 "1" -set $ws_2 "2" -set $ws_3 "3" -set $ws_4 "4" +set $ws_1 "main" +set $ws_2 "term" +set $ws_3 "browser" +set $ws_4 "mail" set $ws_5 "5" set $ws_6 "6" set $ws_7 "7" set $ws_8 "8" -set $ws_9 "9" -set $ws_10 "10" +set $ws_9 "background" +set $ws_10 "multimedia" set $mode_resize_combo Mod4+r set $mode_session_combo Mod4+Delete @@ -139,36 +139,36 @@ bindsym $mod+Mod1+t layout tabbed bindsym $mod+Mod1+e layout toggle split # Floating stuff -bindsym $mod+Shift+space floating toggle -bindsym $alt+space focus mode_toggle +bindsym $mod+space focus mode_toggle +bindsym $alt+space floating toggle # Scratchpad bindsym $alt+minus move scratchpad bindsym $mod+minus scratchpad show # Switch to workspace -bindsym $mod+1 workspace number $ws_1 -bindsym $mod+2 workspace number $ws_2 -bindsym $mod+3 workspace number $ws_3 -bindsym $mod+4 workspace number $ws_4 -bindsym $mod+5 workspace number $ws_5 -bindsym $mod+6 workspace number $ws_6 -bindsym $mod+7 workspace number $ws_7 -bindsym $mod+8 workspace number $ws_8 -bindsym $mod+9 workspace number $ws_9 -bindsym $mod+0 workspace number $ws_10 +bindsym $mod+1 workspace $ws_1 +bindsym $mod+2 workspace $ws_2 +bindsym $mod+3 workspace $ws_3 +bindsym $mod+4 workspace $ws_4 +bindsym $mod+5 workspace $ws_5 +bindsym $mod+6 workspace $ws_6 +bindsym $mod+7 workspace $ws_7 +bindsym $mod+8 workspace $ws_8 +bindsym $mod+9 workspace $ws_9 +bindsym $mod+0 workspace $ws_10 # Move focused container to workspace -bindsym $mod+Shift+1 move container to workspace number $ws_1 -bindsym $mod+Shift+2 move container to workspace number $ws_2 -bindsym $mod+Shift+3 move container to workspace number $ws_3 -bindsym $mod+Shift+4 move container to workspace number $ws_4 -bindsym $mod+Shift+5 move container to workspace number $ws_5 -bindsym $mod+Shift+6 move container to workspace number $ws_6 -bindsym $mod+Shift+7 move container to workspace number $ws_7 -bindsym $mod+Shift+8 move container to workspace number $ws_8 -bindsym $mod+Shift+9 move container to workspace number $ws_9 -bindsym $mod+Shift+0 move container to workspace number $ws_10 +bindsym $mod+Shift+1 move container to workspace $ws_1 +bindsym $mod+Shift+2 move container to workspace $ws_2 +bindsym $mod+Shift+3 move container to workspace $ws_3 +bindsym $mod+Shift+4 move container to workspace $ws_4 +bindsym $mod+Shift+5 move container to workspace $ws_5 +bindsym $mod+Shift+6 move container to workspace $ws_6 +bindsym $mod+Shift+7 move container to workspace $ws_7 +bindsym $mod+Shift+8 move container to workspace $ws_8 +bindsym $mod+Shift+9 move container to workspace $ws_9 +bindsym $mod+Shift+0 move container to workspace $ws_10 # Move to workspace next to current bindsym $mod+$nav_left workspace prev From 9ba500564be32075d92cb21b05da8ec9e3c8fd57 Mon Sep 17 00:00:00 2001 From: Didier Date: Sun, 3 Sep 2023 00:42:57 +0200 Subject: [PATCH 061/177] fix: deps --- crates/05-i3/crate.arch.sh | 2 +- crates/05-i3/files/config | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh index f87ce45..ba1eeec 100644 --- a/crates/05-i3/crate.arch.sh +++ b/crates/05-i3/crate.arch.sh @@ -1,6 +1,6 @@ #!/bin/sh -pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu" +pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring" super_apply() { pacman -S --needed --noconfirm $pkgs diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index 26613d1..d6ec4d9 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -25,6 +25,7 @@ set $font pango:monospace 8 exec --no-startup-id dex --autostart --environment i3 exec --no-startup-id nm-applet exec --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock +exec --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11 # Extra variables: # Only need changing for very specific installations. From 8374e98494c71b73e85f83c17bc11e4c0253f9ff Mon Sep 17 00:00:00 2001 From: Didier Date: Sun, 3 Sep 2023 00:43:07 +0200 Subject: [PATCH 062/177] add optional sudo for work --- dot | 1 + 1 file changed, 1 insertion(+) diff --git a/dot b/dot index 7993255..bfcd9f0 100755 --- a/dot +++ b/dot @@ -18,6 +18,7 @@ include() { func() { if is_function $(echo "super_$2"); then + [ "${DO_SUDO:-yes}" = "yes" ] || return 0 sudo sh -c ". $1 && super_$2" fi is_function $2 && $2 From b8e5e1e5f683cc953d118410da920152e1481c2b Mon Sep 17 00:00:00 2001 From: Didier Date: Sun, 3 Sep 2023 00:46:15 +0200 Subject: [PATCH 063/177] i don't need conformation, i need drugs --- crates/00-system/crate.arch.sh | 4 ++-- crates/10-zsh/crate.arch.sh | 4 ++-- crates/20-vim/crate.arch.sh | 2 +- crates/30-alacritty/crate.arch.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/00-system/crate.arch.sh b/crates/00-system/crate.arch.sh index 2bdf8c5..164fde4 100644 --- a/crates/00-system/crate.arch.sh +++ b/crates/00-system/crate.arch.sh @@ -1,6 +1,6 @@ super_apply() { - pacman -Syyu - pacman -S --needed sudo reflector + pacman -Syyu --noconfirm + pacman -S --needed --noconfirm sudo reflector if ! grep -q "Reflector" /etc/pacman.d/mirrorlist; then cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist diff --git a/crates/10-zsh/crate.arch.sh b/crates/10-zsh/crate.arch.sh index b44c9ed..5e00687 100644 --- a/crates/10-zsh/crate.arch.sh +++ b/crates/10-zsh/crate.arch.sh @@ -1,7 +1,7 @@ super_apply() { - pacman -S --needed zsh cmake + pacman -S --needed --noconfirm zsh cmake } super_undo() { - pacman -R zsh + pacman -R --noconfirm zsh } \ No newline at end of file diff --git a/crates/20-vim/crate.arch.sh b/crates/20-vim/crate.arch.sh index d95ce2d..e114bc1 100644 --- a/crates/20-vim/crate.arch.sh +++ b/crates/20-vim/crate.arch.sh @@ -1,5 +1,5 @@ super_apply() { - pacman -S --needed vim + pacman -S --needed --noconfirm vim } super_undo() { diff --git a/crates/30-alacritty/crate.arch.sh b/crates/30-alacritty/crate.arch.sh index a91b78b..068ee1c 100644 --- a/crates/30-alacritty/crate.arch.sh +++ b/crates/30-alacritty/crate.arch.sh @@ -1,5 +1,5 @@ super_apply() { - pacman -S --needed alacritty + pacman -S --needed --noconfirm alacritty } super_undo() { From a38ff78c36be061a60de1124fbdcf2b643276d25 Mon Sep 17 00:00:00 2001 From: Didier Date: Sun, 3 Sep 2023 01:00:11 +0200 Subject: [PATCH 064/177] fix: no confirm --- crates/30-alacritty/crate.arch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/30-alacritty/crate.arch.sh b/crates/30-alacritty/crate.arch.sh index 068ee1c..cc95257 100644 --- a/crates/30-alacritty/crate.arch.sh +++ b/crates/30-alacritty/crate.arch.sh @@ -3,5 +3,5 @@ super_apply() { } super_undo() { - pacman -R alacritty + pacman -R --noconfirm alacritty } \ No newline at end of file From f78fed9c08492bb09883c708fa3a754cb886461e Mon Sep 17 00:00:00 2001 From: Didier Date: Sun, 3 Sep 2023 01:20:33 +0200 Subject: [PATCH 065/177] fix: numbering --- crates/05-i3/files/config | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index d6ec4d9..8e72cfd 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -43,16 +43,16 @@ set $nav_down k set $nav_left j set $nav_right semicolon -set $ws_1 "main" -set $ws_2 "term" -set $ws_3 "browser" -set $ws_4 "mail" +set $ws_1 "1:main" +set $ws_2 "2:term" +set $ws_3 "3:browser" +set $ws_4 "4:mail" set $ws_5 "5" set $ws_6 "6" set $ws_7 "7" set $ws_8 "8" -set $ws_9 "background" -set $ws_10 "multimedia" +set $ws_9 "9:background" +set $ws_10 "10:multimedia" set $mode_resize_combo Mod4+r set $mode_session_combo Mod4+Delete @@ -61,6 +61,7 @@ set $op_floating_modifier Mod1 set $meta_refresh_statusbar killall -SIGUSR1 i3status bar { + strip_workspace_numbers yes status_command i3status } From e894f37042d3221da8532a0617aa3381ca417d67 Mon Sep 17 00:00:00 2001 From: Didier Date: Mon, 4 Sep 2023 10:14:10 +0200 Subject: [PATCH 066/177] fix: i3status --- crates/05-i3/files/status_config | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/05-i3/files/status_config b/crates/05-i3/files/status_config index 529f125..3fce4a7 100644 --- a/crates/05-i3/files/status_config +++ b/crates/05-i3/files/status_config @@ -5,13 +5,12 @@ general { } order += "ipv6" -order += "disk /" -order += "wireless wlan0" +order += "wireless wlp58s0" order += "battery 0" +order += "disk /" order += "memory" order += "load" order += "tztime local" -order += "tztime berlin" wireless wlp58s0 { format_up = "W: (%quality at %essid, %bitrate) %ip" @@ -31,7 +30,7 @@ battery 0 { tztime local { format = "%Y-%m-%d %H:%M:%S" - hide_if_equals_localtime = true + hide_if_equals_localtime = false } tztime berlin { From e21e43b7a443e96cd93d56a66c80865acd65a440 Mon Sep 17 00:00:00 2001 From: Didier Slof Date: Fri, 8 Sep 2023 12:30:53 +0200 Subject: [PATCH 067/177] feat: modify for gemini --- crates/05-i3/files/config | 28 ++++++++++++++++++++++++---- crates/05-i3/files/status_config | 8 ++++---- crates/10-zsh/files/.zshrc | 2 +- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index 8e72cfd..aba8c1f 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -12,7 +12,7 @@ set $terminal alacritty set $screen_lock i3lock -c "#111111" --nofork set $appmenu i3-dmenu-desktop -set $screenshot maim | xclip -selection clipboard -t image/png +set $screenshot maim -s | xclip -selection clipboard -t image/png set $alt_screenshot maim ~/Pictures/Screenshots/$(date +%s).png set $mod Mod4 @@ -22,6 +22,8 @@ set $font pango:monospace 8 # Startup Applications: # Things that will startup when starting i3. # --- +exec --no-startup-id xrandr --output DP-2-1 --left-of DP-1-1 +exec --no-startup-id sh .scripts/clock-in.sh exec --no-startup-id dex --autostart --environment i3 exec --no-startup-id nm-applet exec --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock @@ -47,7 +49,7 @@ set $ws_1 "1:main" set $ws_2 "2:term" set $ws_3 "3:browser" set $ws_4 "4:mail" -set $ws_5 "5" +set $ws_5 "5:notes" set $ws_6 "6" set $ws_7 "7" set $ws_8 "8" @@ -56,6 +58,7 @@ set $ws_10 "10:multimedia" set $mode_resize_combo Mod4+r set $mode_session_combo Mod4+Delete +set $mode_keybind_combo Mod4+Insert set $op_floating_modifier Mod1 @@ -82,6 +85,17 @@ floating_modifier $op_floating_modifier tiling_drag modifier titlebar font $font +workspace $ws_1 output DP-2-1 +workspace $ws_2 output DP-2-1 +workspace $ws_3 output DP-1-1 +workspace $ws_4 output DP-1-1 +workspace $ws_5 output DP-2-1 +workspace $ws_6 output DP-2-1 +workspace $ws_7 output DP-1-1 +workspace $ws_8 output DP-1-1 +workspace $ws_9 output DP-2-1 +workspace $ws_10 output DP-2-1 + # Open a terminal bindsym $mod+Return exec $terminal @@ -203,14 +217,20 @@ mode "resize" { bindsym $mode_resize_combo mode "default" } -bindsym $mode_session_combo mode "session" +bindsym $mode_session_combo mode session mode "session" { - bindsym l exec --no-startup-id $lock, mode "default" + bindsym l exec --no-startup-id $screen_lock, mode "default" bindsym e exec --no-startup-id i3-msg exit, mode "default" bindsym Shift+r exec --no-startup-id systemctl reboot, mode "default" + bindsym Shift+h exec --no-startup-id systemctl hibernate, mode "default" bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default" bindsym Return mode "default" bindsym Escape mode "default" bindsym $mode_session_combo mode "default" } + +bindsym $mode_keybind_combo mode kbmode +mode "kbmode" { + bindsym $mode_keybind_combo mode "default" +} diff --git a/crates/05-i3/files/status_config b/crates/05-i3/files/status_config index 3fce4a7..6c8b38e 100644 --- a/crates/05-i3/files/status_config +++ b/crates/05-i3/files/status_config @@ -5,16 +5,16 @@ general { } order += "ipv6" -order += "wireless wlp58s0" +order += "ethernet eno1" order += "battery 0" order += "disk /" order += "memory" order += "load" order += "tztime local" -wireless wlp58s0 { - format_up = "W: (%quality at %essid, %bitrate) %ip" - format_down = "W: down" +ethernet eno1 { + format_up = "E: %ip (%speed)" + format_down = "E: down" } battery 0 { diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index c49eb5c..15fc2b4 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -17,6 +17,6 @@ alias s="title $HOST && cmatrix -rs && clear" alias q="exit" # COSMETICS -fastfetch +#fastfetch export PATH="${PATH}:/home/${USER}/.local/bin" From 0b7502d13d30757420e77ca2443260056d38d337 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:03 +0200 Subject: [PATCH 068/177] Initial Commit --- README.md | 11 + command.list | 0 files/%HOME/.config/alacritty/alacritty.yml | 10 + files/%HOME/.config/kitty/kitty.conf | 1 + files/%HOME/.config/rofi/config.rasi | 1 + files/%HOME/.config/sway/config | 246 ++++++++++++++++++++ files/%HOME/.config/sway/status.py | 25 ++ files/%HOME/.config/sway/status.sh | 16 ++ files/%HOME/.vimrc | 2 + files/%HOME/.zshrc | 33 +++ files/etc/pacman.conf | 100 ++++++++ files/etc/pacman.d/mirrorlist | 11 + gpackage.list | 1 + lib/deploy.sh | 16 ++ lib/lib.sh | 19 ++ package.list | 2 + sync.conf | 10 + sync.sh | 60 +++++ 18 files changed, 564 insertions(+) create mode 100644 README.md create mode 100644 command.list create mode 100644 files/%HOME/.config/alacritty/alacritty.yml create mode 120000 files/%HOME/.config/kitty/kitty.conf create mode 100755 files/%HOME/.config/rofi/config.rasi create mode 100755 files/%HOME/.config/sway/config create mode 100755 files/%HOME/.config/sway/status.py create mode 100755 files/%HOME/.config/sway/status.sh create mode 100755 files/%HOME/.vimrc create mode 100644 files/%HOME/.zshrc create mode 100644 files/etc/pacman.conf create mode 100644 files/etc/pacman.d/mirrorlist create mode 100644 gpackage.list create mode 100644 lib/deploy.sh create mode 100644 lib/lib.sh create mode 100644 package.list create mode 100644 sync.conf create mode 100755 sync.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..7ee0aa8 --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file diff --git a/command.list b/command.list new file mode 100644 index 0000000..e69de29 diff --git a/files/%HOME/.config/alacritty/alacritty.yml b/files/%HOME/.config/alacritty/alacritty.yml new file mode 100644 index 0000000..3bc0096 --- /dev/null +++ b/files/%HOME/.config/alacritty/alacritty.yml @@ -0,0 +1,10 @@ +bell: + animation: 'Ease' + duration: 50 + color: '#555555' +cursor: + style: + shape: 'Block' + blinking: 'On' + blink_interval: 500 + diff --git a/files/%HOME/.config/kitty/kitty.conf b/files/%HOME/.config/kitty/kitty.conf new file mode 120000 index 0000000..de7259e --- /dev/null +++ b/files/%HOME/.config/kitty/kitty.conf @@ -0,0 +1 @@ +/home/didier/.local/dotfiles/./files/kitty/kitty.conf \ No newline at end of file diff --git a/files/%HOME/.config/rofi/config.rasi b/files/%HOME/.config/rofi/config.rasi new file mode 100755 index 0000000..1efb65f --- /dev/null +++ b/files/%HOME/.config/rofi/config.rasi @@ -0,0 +1 @@ +@theme "Arc-Dark" diff --git a/files/%HOME/.config/sway/config b/files/%HOME/.config/sway/config new file mode 100755 index 0000000..e1ccce6 --- /dev/null +++ b/files/%HOME/.config/sway/config @@ -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 windowโ€™s width. + # Pressing right will grow the windowโ€™s width. + # Pressing up will shrink the windowโ€™s height. + # Pressing down will grow the windowโ€™s 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 + } +} diff --git a/files/%HOME/.config/sway/status.py b/files/%HOME/.config/sway/status.py new file mode 100755 index 0000000..5a89322 --- /dev/null +++ b/files/%HOME/.config/sway/status.py @@ -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) diff --git a/files/%HOME/.config/sway/status.sh b/files/%HOME/.config/sway/status.sh new file mode 100755 index 0000000..c8bcfc3 --- /dev/null +++ b/files/%HOME/.config/sway/status.sh @@ -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 diff --git a/files/%HOME/.vimrc b/files/%HOME/.vimrc new file mode 100755 index 0000000..abb89b3 --- /dev/null +++ b/files/%HOME/.vimrc @@ -0,0 +1,2 @@ +set number +set relativenumber diff --git a/files/%HOME/.zshrc b/files/%HOME/.zshrc new file mode 100644 index 0000000..e03626e --- /dev/null +++ b/files/%HOME/.zshrc @@ -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" diff --git a/files/etc/pacman.conf b/files/etc/pacman.conf new file mode 100644 index 0000000..12cabfa --- /dev/null +++ b/files/etc/pacman.conf @@ -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 diff --git a/files/etc/pacman.d/mirrorlist b/files/etc/pacman.d/mirrorlist new file mode 100644 index 0000000..013da94 --- /dev/null +++ b/files/etc/pacman.d/mirrorlist @@ -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 diff --git a/gpackage.list b/gpackage.list new file mode 100644 index 0000000..7997ddc --- /dev/null +++ b/gpackage.list @@ -0,0 +1 @@ +alacritty diff --git a/lib/deploy.sh b/lib/deploy.sh new file mode 100644 index 0000000..f2f822c --- /dev/null +++ b/lib/deploy.sh @@ -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 "$@" +} \ No newline at end of file diff --git a/lib/lib.sh b/lib/lib.sh new file mode 100644 index 0000000..b8e0419 --- /dev/null +++ b/lib/lib.sh @@ -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 +} diff --git a/package.list b/package.list new file mode 100644 index 0000000..6eee86b --- /dev/null +++ b/package.list @@ -0,0 +1,2 @@ +vim +zsh diff --git a/sync.conf b/sync.conf new file mode 100644 index 0000000..139ef97 --- /dev/null +++ b/sync.conf @@ -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:-"/"} \ No newline at end of file diff --git a/sync.sh b/sync.sh new file mode 100755 index 0000000..95c9375 --- /dev/null +++ b/sync.sh @@ -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." From 1efbdc318daae444a8f7629fc13f2dba674379cc Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:03 +0200 Subject: [PATCH 069/177] fix: deploy script --- lib/deploy.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/deploy.sh b/lib/deploy.sh index f2f822c..65abbd6 100644 --- a/lib/deploy.sh +++ b/lib/deploy.sh @@ -13,4 +13,6 @@ main() { [ -d "$DOTFILES_DIR" ] || clone cd "$DOTFILES_DIR" || exit 1 ./sync.sh "$@" -} \ No newline at end of file +} + +main "$@" \ No newline at end of file From cd6b4dfc614302f7a32d5fd112ab1348a1a79068 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:03 +0200 Subject: [PATCH 070/177] fix: exit on error --- sync.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sync.sh b/sync.sh index 95c9375..2b5f2f0 100755 --- a/sync.sh +++ b/sync.sh @@ -8,6 +8,8 @@ PULL_GIT=${PULL_GIT:-yes} . ./lib/lib.sh . ./sync.conf +set -e # Exit on error + _install_pkgs() { while read -r pkg; do run $SYS_SUDO $PM_COMMAND $PM_INSTALL_ARG $PM_NOCONFIRM_ARG $pkg From 56b4964dc7e01faeb6b448321b19422425a3e060 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:03 +0200 Subject: [PATCH 071/177] add: zsh files --- .gitignore | 1 + files/%HOME/.zsh_preferences | 2 ++ files/%HOME/.zsh_scripts | 47 ++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 .gitignore create mode 100644 files/%HOME/.zsh_preferences create mode 100644 files/%HOME/.zsh_scripts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62c8935 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/files/%HOME/.zsh_preferences b/files/%HOME/.zsh_preferences new file mode 100644 index 0000000..2677a0e --- /dev/null +++ b/files/%HOME/.zsh_preferences @@ -0,0 +1,2 @@ +_ZSH_PREF_NO_PFETCH=0 +_ZSH_PREF_NO_NONSENSE=0 \ No newline at end of file diff --git a/files/%HOME/.zsh_scripts b/files/%HOME/.zsh_scripts new file mode 100644 index 0000000..4004d8f --- /dev/null +++ b/files/%HOME/.zsh_scripts @@ -0,0 +1,47 @@ +__is_arch() { + . /etc/os-release + if [ "$ID" = "arch" ]; then return 0; else return 1; fi +} + +pkg_once() { + if [ ! __is_arch ]; then + printf "This command is only for Arch Linux.\n" + return + fi + if [ ! -n "$1" ]; then + printf "Usage: pkg_once [command]\n" + printf "command is optional; if there is no command the package name is ran\n" + return + fi + printf "Installing $1...\n" + yay -S --noconfirm $1 > /dev/null + + if [ ! -n "$2" ]; then $1; else $2; fi + printf "Remoiving $1..." + yay -R --noconfirm $1 > /dev/null + echo "done.\n" +} + +rando () { + case $1 in + *|d|default) tr -dc A-Za-z0-9 ?@[\]^_`{|}~' > $file + fi + chmod +x $file + printf '%s' $file +} \ No newline at end of file From 0b7fb13bc4ec641b7db7929cbaa7f71efbbb0754 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:04 +0200 Subject: [PATCH 072/177] crap --- command.list | 4 ++++ lib/lib.sh | 6 ++++++ sync.conf | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/command.list b/command.list index e69de29..7ec30e1 100644 --- a/command.list +++ b/command.list @@ -0,0 +1,4 @@ +^pacman -Syyu +^[ -d /tmp/yay ] && rm -rf /tmp/yay +git clone https://aur.archlinux.org/yay /tmp/yay +cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM \ No newline at end of file diff --git a/lib/lib.sh b/lib/lib.sh index b8e0419..b703116 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -1,5 +1,7 @@ #!/bin/sh +. ./sync.conf || . ../sync.conf + DRY_RUN=${DRY_RUN:-no} bool() { @@ -17,3 +19,7 @@ run() { "$@" fi } + +is_graphical() { + command -v $PREF_TERM && return 0 || return 1 +} \ No newline at end of file diff --git a/sync.conf b/sync.conf index 139ef97..2a6caa7 100644 --- a/sync.conf +++ b/sync.conf @@ -7,4 +7,9 @@ PM_UPDATE_ARG=${PM_UPDATE_ARG:-Sy} # SYS - System Options SYS_SUDO=${SYS_SUDO:-"sudo"} -SYS_ROOT=${SYS_ROOT:-"/"} \ No newline at end of file +SYS_ROOT=${SYS_ROOT:-"/"} + +# PREF - Preferences +PREF_TERM=${PREF_TERM:-alacritty} +PREF_TERM_SET_TITLE=${PREF_TERM_SET_TITLE:--t} +PREF_TERM_RUN_CMD=${PREF_TERM_RUN_CMD:--e} \ No newline at end of file From 3da7dc88b41aecd8911040fa5381e4bd7d4588ac Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:04 +0200 Subject: [PATCH 073/177] fix names --- command.list | 3 ++- sync.conf | 9 +++++---- sync.sh | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/command.list b/command.list index 7ec30e1..a67257b 100644 --- a/command.list +++ b/command.list @@ -1,4 +1,5 @@ -^pacman -Syyu +^. ./sync.conf && $PM_COMMAND $PM_UPGRADE ^[ -d /tmp/yay ] && rm -rf /tmp/yay + git clone https://aur.archlinux.org/yay /tmp/yay cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM \ No newline at end of file diff --git a/sync.conf b/sync.conf index 2a6caa7..8c57fc4 100644 --- a/sync.conf +++ b/sync.conf @@ -1,9 +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} +PM_NOCONFIRM=${PM_NOCONFIRM:-"--noconfirm"} +PM_INSTALL=${PM_INSTALL:--S} +PM_REMOVE=${PM_REMOVE:-R} +PM_UPDATE=${PM_UPDATE:--Sy} +PM_UPGRADE=${PM_UPGRADE:--Syyu} # SYS - System Options SYS_SUDO=${SYS_SUDO:-"sudo"} diff --git a/sync.sh b/sync.sh index 2b5f2f0..cff0c17 100755 --- a/sync.sh +++ b/sync.sh @@ -11,8 +11,9 @@ PULL_GIT=${PULL_GIT:-yes} set -e # Exit on error _install_pkgs() { + run $SYS_SUDO $PM_COMMAND $PM_UPDATE $PM_NOCONFIRM while read -r pkg; do - run $SYS_SUDO $PM_COMMAND $PM_INSTALL_ARG $PM_NOCONFIRM_ARG $pkg + run $SYS_SUDO $PM_COMMAND $PM_INSTALL $PM_NOCONFIRM $pkg done <$1 } @@ -58,5 +59,5 @@ main() { } echo "# exec: start." -time main "$@" +[ bool ${TIME_TRACK:-no} ] && time main "$@" || main "$@" echo "# exec: done." From caa51cb79234228ecf7d97e01691f1dfee715a2e Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:04 +0200 Subject: [PATCH 074/177] update dotfiles --- command.list | 4 ++-- gpackage.list | 1 + lib/lib.sh | 4 +++- package.list | 1 + sync.sh | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/command.list b/command.list index a67257b..308817f 100644 --- a/command.list +++ b/command.list @@ -1,5 +1,5 @@ ^. ./sync.conf && $PM_COMMAND $PM_UPGRADE ^[ -d /tmp/yay ] && rm -rf /tmp/yay - git clone https://aur.archlinux.org/yay /tmp/yay -cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM \ No newline at end of file +cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended diff --git a/gpackage.list b/gpackage.list index 7997ddc..db10bfa 100644 --- a/gpackage.list +++ b/gpackage.list @@ -1 +1,2 @@ alacritty +sway diff --git a/lib/lib.sh b/lib/lib.sh index b703116..1798188 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -22,4 +22,6 @@ run() { is_graphical() { command -v $PREF_TERM && return 0 || return 1 -} \ No newline at end of file +} + +command -v $SYS_SUDO || $SYS_SUDO="" \ No newline at end of file diff --git a/package.list b/package.list index 6eee86b..bbecb9e 100644 --- a/package.list +++ b/package.list @@ -1,2 +1,3 @@ +curl vim zsh diff --git a/sync.sh b/sync.sh index cff0c17..69ed6ae 100755 --- a/sync.sh +++ b/sync.sh @@ -59,5 +59,5 @@ main() { } echo "# exec: start." -[ bool ${TIME_TRACK:-no} ] && time main "$@" || main "$@" +bool ${TIME_TRACK:-no} && time main "$@" || main "$@" echo "# exec: done." From 977270210519f072bd42ccbb087eb18d7ab28191 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:04 +0200 Subject: [PATCH 075/177] fix stuff --- lib/lib.sh | 2 +- sync.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/lib.sh b/lib/lib.sh index 1798188..a7619e1 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -24,4 +24,4 @@ is_graphical() { command -v $PREF_TERM && return 0 || return 1 } -command -v $SYS_SUDO || $SYS_SUDO="" \ No newline at end of file +command -v $SYS_SUDO || SYS_SUDO="" \ No newline at end of file diff --git a/sync.sh b/sync.sh index 69ed6ae..f6a850e 100755 --- a/sync.sh +++ b/sync.sh @@ -6,7 +6,6 @@ RUN_CMDS=${RUN_CMDS:-yes} PULL_GIT=${PULL_GIT:-yes} . ./lib/lib.sh -. ./sync.conf set -e # Exit on error From e97067be1035ebda9cadd021769ac65c67f29110 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:04 +0200 Subject: [PATCH 076/177] compatibility --- command.list | 4 ++-- comp.sh | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 comp.sh diff --git a/command.list b/command.list index 308817f..4437ba9 100644 --- a/command.list +++ b/command.list @@ -1,5 +1,5 @@ -^. ./sync.conf && $PM_COMMAND $PM_UPGRADE +^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM ^[ -d /tmp/yay ] && rm -rf /tmp/yay git clone https://aur.archlinux.org/yay /tmp/yay cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM -sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" diff --git a/comp.sh b/comp.sh new file mode 100755 index 0000000..4091ead --- /dev/null +++ b/comp.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# #################### # +# Compatibility Script # +# #################### # +if [ ! -z "$1" ]; then + cmd=$1; shift +fi + +case $cmd in + debian|ubuntu|apt|deb) + PM_COMMAND=apt \ + PM_NOCONFIRM=-y \ + PM_INSTALL=install \ + PM_UPDATE=update \ + PM_UPGRADE=upgrade \ + PM_REMOVE=purge \ + ./sync.sh "$@" + ;; + *|''|arch) ./sync.sh ;; +esac \ No newline at end of file From 62e049de78aa23b63c00b2b021fc1e4ee7da37dd Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:04 +0200 Subject: [PATCH 077/177] err_handler --- sync.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sync.sh b/sync.sh index f6a850e..79b7d1f 100755 --- a/sync.sh +++ b/sync.sh @@ -57,6 +57,14 @@ main() { bool "$RUN_CMDS" && _run_cmds } +err_handler() { + echo "Something went wrong!" + echo "You can look at what went wrong by running this script more verbosely" + echo "Sorry!" +} + +trap err_handler ERR + echo "# exec: start." bool ${TIME_TRACK:-no} && time main "$@" || main "$@" echo "# exec: done." From d0fa7a8aa3b805247104a001e3d357ee67a993e7 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:05 +0200 Subject: [PATCH 078/177] remove error handler, fix pfetch and crap --- command.list | 7 ++++--- sync.sh | 8 -------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/command.list b/command.list index 4437ba9..1d2f022 100644 --- a/command.list +++ b/command.list @@ -1,5 +1,6 @@ ^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM -^[ -d /tmp/yay ] && rm -rf /tmp/yay -git clone https://aur.archlinux.org/yay /tmp/yay -cd /tmp/yay && makepkg --noconfirm -si && echo $PREF_TERM +^[ -d /tmp/yay ] && rm -rf /tmp/yay || printf "" +command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si)) +^[ -d /tmp/pfetch ] && rm -rf /tmp/pfetch || printf "" +^git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch) sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" diff --git a/sync.sh b/sync.sh index 79b7d1f..f6a850e 100755 --- a/sync.sh +++ b/sync.sh @@ -57,14 +57,6 @@ main() { bool "$RUN_CMDS" && _run_cmds } -err_handler() { - echo "Something went wrong!" - echo "You can look at what went wrong by running this script more verbosely" - echo "Sorry!" -} - -trap err_handler ERR - echo "# exec: start." bool ${TIME_TRACK:-no} && time main "$@" || main "$@" echo "# exec: done." From af2ece196981c30bea62db8096e037285a5efdac Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:05 +0200 Subject: [PATCH 079/177] yay is arch exclusive --- command.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command.list b/command.list index 1d2f022..8db5df5 100644 --- a/command.list +++ b/command.list @@ -1,6 +1,6 @@ ^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM ^[ -d /tmp/yay ] && rm -rf /tmp/yay || printf "" -command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si)) +command -v makepkg && (command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si))) ^[ -d /tmp/pfetch ] && rm -rf /tmp/pfetch || printf "" ^git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch) sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" From 4b1a3bc46d818dd713697ab9021418aba45c07fd Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:05 +0200 Subject: [PATCH 080/177] err handling --- command.list | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/command.list b/command.list index 8db5df5..c855eca 100644 --- a/command.list +++ b/command.list @@ -1,6 +1,6 @@ -^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM +^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM || printf "" ^[ -d /tmp/yay ] && rm -rf /tmp/yay || printf "" -command -v makepkg && (command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si))) +command -v makepkg && (command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si))) || printf "" ^[ -d /tmp/pfetch ] && rm -rf /tmp/pfetch || printf "" -^git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch) +^(git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch)) || printf "" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" From 176059905aba6fceb8a4b2b3afda55e73d2e4623 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:05 +0200 Subject: [PATCH 081/177] docker image --- README.md | 4 ++++ lib/Dockerfile | 12 ++++++++++++ lib/docker.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 lib/Dockerfile create mode 100644 lib/docker.py diff --git a/README.md b/README.md index 7ee0aa8..23b8670 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ This repo has a simple sync script with a few features: - after install commands - deploy script +## Deployment +To import the dotfiles run: +`curl --proto '=https' --tlsv1.2 -sSf https://git.faulty.nl/didier/dotfiles/-/raw/main/lib/deploy.sh | sh` + ## Notes - `gpackage.list` This is a list with packages only installed if the `-g` or `--graphical` flag is used. \ No newline at end of file diff --git a/lib/Dockerfile b/lib/Dockerfile new file mode 100644 index 0000000..82e454e --- /dev/null +++ b/lib/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.10-alpine + +RUN apk add git + +COPY . /app + +WORKDIR /app + +# if no remote then add remote or otherwrite +RUN git remote get-url origin || git remote add origin https://git.faulty.nl/didier/dotfiles && git remote set-url origin https://git.faulty.nl/didier/dotfiles + +ENTRYPOINT ["python3", "/app/lib/docker.py"] \ No newline at end of file diff --git a/lib/docker.py b/lib/docker.py new file mode 100644 index 0000000..4bd925e --- /dev/null +++ b/lib/docker.py @@ -0,0 +1,30 @@ +# any HTTP request returns the contents of: ./lib/deploy.sh +# If the deploy script is older then a day, do a git pull + +from http.server import BaseHTTPRequestHandler, HTTPServer +import subprocess +import os +import time + +class handler(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-type','text/plain') + self.end_headers() + if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400): + subprocess.call(['git', 'pull']) + with open('./lib/deploy.sh') as f: + self.wfile.write(bytes(f.read(), 'utf-8')) + + +def main(): + try: + server = HTTPServer(('', 80), handler) + print('started httpserver...') + server.serve_forever() + except KeyboardInterrupt: + print('^C received, shutting down the web server') + server.socket.close() + +if __name__ == '__main__': + main() \ No newline at end of file From 00ee86af398f1a674654ab679f7aecf336849d32 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:05 +0200 Subject: [PATCH 082/177] gitty up --- lib/Dockerfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/Dockerfile b/lib/Dockerfile index 82e454e..d174a2e 100644 --- a/lib/Dockerfile +++ b/lib/Dockerfile @@ -1,12 +1,7 @@ FROM python:3.10-alpine RUN apk add git - -COPY . /app +RUN git clone https://git.faulty.nl/didier/dotfiles /app WORKDIR /app - -# if no remote then add remote or otherwrite -RUN git remote get-url origin || git remote add origin https://git.faulty.nl/didier/dotfiles && git remote set-url origin https://git.faulty.nl/didier/dotfiles - ENTRYPOINT ["python3", "/app/lib/docker.py"] \ No newline at end of file From a8808b4a270d5439e421c9c7f9cdf3c37b1947e4 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:05 +0200 Subject: [PATCH 083/177] run compatibility script instead of sync script --- comp.sh | 4 ++-- lib/deploy.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/comp.sh b/comp.sh index 4091ead..0d6c724 100755 --- a/comp.sh +++ b/comp.sh @@ -15,7 +15,7 @@ case $cmd in PM_UPDATE=update \ PM_UPGRADE=upgrade \ PM_REMOVE=purge \ - ./sync.sh "$@" + ./sync.sh $@ ;; - *|''|arch) ./sync.sh ;; + *|''|arch) ./sync.sh $cmd $@ ;; esac \ No newline at end of file diff --git a/lib/deploy.sh b/lib/deploy.sh index 65abbd6..04a7b34 100644 --- a/lib/deploy.sh +++ b/lib/deploy.sh @@ -12,7 +12,7 @@ clone() { main() { [ -d "$DOTFILES_DIR" ] || clone cd "$DOTFILES_DIR" || exit 1 - ./sync.sh "$@" + ./comp.sh "$@" } main "$@" \ No newline at end of file From ab17f173d3139578961d538eaaae54be4cf423bc Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:06 +0200 Subject: [PATCH 084/177] allow force pulls --- lib/docker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docker.py b/lib/docker.py index 4bd925e..87967a9 100644 --- a/lib/docker.py +++ b/lib/docker.py @@ -11,7 +11,7 @@ class handler(BaseHTTPRequestHandler): self.send_response(200) self.send_header('Content-type','text/plain') self.end_headers() - if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400): + if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400) or self.path == '/pull': subprocess.call(['git', 'pull']) with open('./lib/deploy.sh') as f: self.wfile.write(bytes(f.read(), 'utf-8')) From 022eebd5b72a4197a83b66f0637bde939eeb3632 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:06 +0200 Subject: [PATCH 085/177] Add git pull acknowledge statement --- lib/docker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docker.py b/lib/docker.py index 87967a9..08ad428 100644 --- a/lib/docker.py +++ b/lib/docker.py @@ -15,6 +15,7 @@ class handler(BaseHTTPRequestHandler): subprocess.call(['git', 'pull']) with open('./lib/deploy.sh') as f: self.wfile.write(bytes(f.read(), 'utf-8')) + self.wfile.write(bytes("# Git pull: " + str(time.time() - os.path.getmtime('./lib/deploy.sh')) + " seconds ago", 'utf-8')) def main(): From 3e3329738d16ab6dc84832148cb7a003c5381cc0 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:06 +0200 Subject: [PATCH 086/177] add: term screensaver --- files/%HOME/.config/sway/config | 2 +- files/%HOME/.zshrc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/files/%HOME/.config/sway/config b/files/%HOME/.config/sway/config index e1ccce6..51a6062 100755 --- a/files/%HOME/.config/sway/config +++ b/files/%HOME/.config/sway/config @@ -3,7 +3,7 @@ set $mod Mod1 set $sup Mod4 -set $terminal kitty #sway-sensible-terminal +set $terminal alacritty #sway-sensible-terminal set $browser firefox set $editor gedit diff --git a/files/%HOME/.zshrc b/files/%HOME/.zshrc index e03626e..4dc2718 100644 --- a/files/%HOME/.zshrc +++ b/files/%HOME/.zshrc @@ -21,6 +21,7 @@ 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' +alias s="title $HOST && cmatrix -s && clear" # COSMETICS if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then pfetch; fi @@ -31,3 +32,4 @@ fi alias q="exit" export PATH="${PATH}:/home/${USER}/.local/bin" +export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh" From 6d60f7ce13329302cce0492499a2b4ede90ced5d Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:06 +0200 Subject: [PATCH 087/177] mod: new files and configs --- files/%HOME/.config/sway/config | 6 ++++-- files/%HOME/.zshrc | 2 +- package.list | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/files/%HOME/.config/sway/config b/files/%HOME/.config/sway/config index 51a6062..2b78650 100755 --- a/files/%HOME/.config/sway/config +++ b/files/%HOME/.config/sway/config @@ -11,6 +11,7 @@ set $editor gedit font pango:DejaVu Sans Mono 8 #! Startup Applications +exec --no-startup-id kanshi 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 @@ -193,8 +194,9 @@ bindsym $sup+Shift+0 move container to workspace number $ws10 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'" +# exit sway (logs you out of your wayland 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'" +bindsym $sup+Shift+e exec wlogout # edit config bindsym $sup+Shift+Alt+c exec "$editor ~/.config/sway/config" diff --git a/files/%HOME/.zshrc b/files/%HOME/.zshrc index 4dc2718..431f59c 100644 --- a/files/%HOME/.zshrc +++ b/files/%HOME/.zshrc @@ -21,7 +21,7 @@ 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' -alias s="title $HOST && cmatrix -s && clear" +alias s="title $HOST && cmatrix -rs && clear" # COSMETICS if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then pfetch; fi diff --git a/package.list b/package.list index bbecb9e..10f9aee 100644 --- a/package.list +++ b/package.list @@ -1,3 +1,5 @@ curl vim zsh +wlogout +kanshi From f8b9435e82b84abd2947259931d63dabd5b83d47 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:06 +0200 Subject: [PATCH 088/177] mod: they're graphical packages --- gpackage.list | 2 ++ package.list | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gpackage.list b/gpackage.list index db10bfa..661b9ba 100644 --- a/gpackage.list +++ b/gpackage.list @@ -1,2 +1,4 @@ alacritty sway +wlogout +kanshi diff --git a/package.list b/package.list index 10f9aee..92146dc 100644 --- a/package.list +++ b/package.list @@ -1,5 +1,4 @@ curl vim zsh -wlogout -kanshi + From 99c3f02a2dd3d088dd72c8e2b155ed48a5a29a67 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:06 +0200 Subject: [PATCH 089/177] add: doccur --- files/%HOME/.zsh_scripts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/%HOME/.zsh_scripts b/files/%HOME/.zsh_scripts index 4004d8f..7537861 100644 --- a/files/%HOME/.zsh_scripts +++ b/files/%HOME/.zsh_scripts @@ -44,4 +44,6 @@ touchx () { fi chmod +x $file printf '%s' $file -} \ No newline at end of file +} + +alias docurr="docker run -itd --rm --name current" From 9434b666e5ac37a005a8ae467b448658457dfee8 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:06 +0200 Subject: [PATCH 090/177] mod: remodel --- files/%HOME/.config/kanshi/config | 9 +++++ lib/lib.sh | 9 ++++- package.list | 1 - sync.sh | 62 ++++++++++++++++++++++++++----- 4 files changed, 68 insertions(+), 13 deletions(-) create mode 100644 files/%HOME/.config/kanshi/config diff --git a/files/%HOME/.config/kanshi/config b/files/%HOME/.config/kanshi/config new file mode 100644 index 0000000..5a245d2 --- /dev/null +++ b/files/%HOME/.config/kanshi/config @@ -0,0 +1,9 @@ +profile school { + output "Iiyama North America PL2483H 1156290962278" mode 1920x1080 position 0,0 + output eDP-1 mode 1920x1080 position 1920,0 +} + +#profile sharing { +# output HDMI-A-1 mode 1920x1080 position 0,1080 +# output eDP-1 mode 1920x1080 position 0,0 +#} diff --git a/lib/lib.sh b/lib/lib.sh index a7619e1..5ba6f73 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -12,6 +12,11 @@ bool() { } run() { + # Check if command starts with NO_RUN ($*) and remove it + if echo "$*" | grep -q "^NO_RUN"; then + return 0 + fi + if bool "$DRY_RUN"; then echo "DRY: + $*" else @@ -21,7 +26,7 @@ run() { } is_graphical() { - command -v $PREF_TERM && return 0 || return 1 + command -v $PREF_TERM > /dev/null && return 0 || return 1 } -command -v $SYS_SUDO || SYS_SUDO="" \ No newline at end of file +command -v $SYS_SUDO > /dev/null || SYS_SUDO="NO_RUN" diff --git a/package.list b/package.list index 92146dc..bbecb9e 100644 --- a/package.list +++ b/package.list @@ -1,4 +1,3 @@ curl vim zsh - diff --git a/sync.sh b/sync.sh index f6a850e..a753714 100755 --- a/sync.sh +++ b/sync.sh @@ -4,6 +4,9 @@ SYNC_FILES=${SYNC_FILES:-yes} INSTALL_PKGS=${INSTALL_PKGS:-yes} RUN_CMDS=${RUN_CMDS:-yes} PULL_GIT=${PULL_GIT:-yes} +TIME_TRACK=${TIME_TRACK:-no} + +ARGS="$@" . ./lib/lib.sh @@ -11,9 +14,13 @@ set -e # Exit on error _install_pkgs() { run $SYS_SUDO $PM_COMMAND $PM_UPDATE $PM_NOCONFIRM + _APPLICATIONS="" while read -r pkg; do - run $SYS_SUDO $PM_COMMAND $PM_INSTALL $PM_NOCONFIRM $pkg - done <$1 + [ -z "$pkg" ] && continue + [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue + _APPLICATIONS="$_APPLICATIONS $pkg" + done <"$1" + run $SYS_SUDO $PM_COMMAND $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS } _sync_files() { @@ -38,25 +45,60 @@ _run_cmds() { done <./command.list } +ARGS="$@" +_skip_next_arg="n" arg_handler() { - case $1 in - --graphical|-g) - bool "$INSTALL_PKGS" && _install_pkgs ./gpackage.list - ;; - esac + for arg in $ARGS; do + bool $_skip_next_arg && continue + + case $arg in + +files) SYNC_FILES=yes ;; + -files) SYNC_FILES=no ;; + +pkgs) INSTALL_PKGS=yes ;; + -pkgs) INSTALL_PKGS=no ;; + +cmds) RUN_CMDS=yes ;; + -cmds) RUN_CMDS=no ;; + +git) PULL_GIT=yes ;; + -git) PULL_GIT=no ;; + +) SYNC_FILES=yes; INSTALL_PKGS=yes; RUN_CMDS=yes; PULL_GIT=yes ;; + -) SYNC_FILES=no; INSTALL_PKGS=no; RUN_CMDS=no; PULL_GIT=no ;; + +*) + echo "# Unknown argument: $arg" + exit 1 + ;; + -*) + echo "# Unknown argument: $arg" + exit 1 + ;; + esac + done } main() { + arg_handler + + echo "# hook: PULL_GIT" bool "$PULL_GIT" && run git pull + + echo "# hook: SYNC_FILES (/)" bool "$SYNC_FILES" && run cp -a "./files/%HOME/." "$HOME" + + echo "# hook: SYNC_FILES" bool "$SYNC_FILES" && _sync_files + + echo "# hook: INSTALL_PKGS" bool "$INSTALL_PKGS" && _install_pkgs ./package.list - arg_handler "$@" - + echo "# hook: RUN_CMDS" bool "$RUN_CMDS" && _run_cmds + + return 0 } echo "# exec: start." -bool ${TIME_TRACK:-no} && time main "$@" || main "$@" +if bool $TIME_TRACK; then + time main "$@" +else + main "$@" +fi echo "# exec: done." From 4c7c6b5307cbba8fe7b967e0c4c6b8b6578edb39 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:07 +0200 Subject: [PATCH 091/177] refactor: v3 --- README.md | 20 ++-- command.list | 6 - comp.sh | 21 ---- .../.config/alacritty/alacritty.yml | 0 files/{%HOME => home}/.config/kanshi/config | 0 .../{%HOME => home}/.config/kitty/kitty.conf | 0 .../{%HOME => home}/.config/rofi/config.rasi | 0 files/{%HOME => home}/.config/sway/config | 0 files/{%HOME => home}/.config/sway/status.py | 0 files/{%HOME => home}/.config/sway/status.sh | 0 files/{%HOME => home}/.vimrc | 0 files/{%HOME => home}/.zsh_preferences | 0 files/{%HOME => home}/.zsh_scripts | 0 files/{%HOME => home}/.zshrc | 0 files/{ => root}/etc/pacman.conf | 0 files/{ => root}/etc/pacman.d/mirrorlist | 0 gpackage.list | 1 - lib/Dockerfile | 7 -- lib/deploy.sh | 18 --- lib/docker.py | 31 ----- lib/lib.sh | 32 ------ scripts/00-install-requirements.sh | 6 + scripts/10-copy-files.sh | 8 ++ scripts/20-install-pkgs.sh | 23 ++++ sync.conf | 16 --- sync.sh | 108 ++---------------- 26 files changed, 55 insertions(+), 242 deletions(-) delete mode 100644 command.list delete mode 100755 comp.sh rename files/{%HOME => home}/.config/alacritty/alacritty.yml (100%) rename files/{%HOME => home}/.config/kanshi/config (100%) rename files/{%HOME => home}/.config/kitty/kitty.conf (100%) rename files/{%HOME => home}/.config/rofi/config.rasi (100%) rename files/{%HOME => home}/.config/sway/config (100%) rename files/{%HOME => home}/.config/sway/status.py (100%) rename files/{%HOME => home}/.config/sway/status.sh (100%) rename files/{%HOME => home}/.vimrc (100%) rename files/{%HOME => home}/.zsh_preferences (100%) rename files/{%HOME => home}/.zsh_scripts (100%) rename files/{%HOME => home}/.zshrc (100%) rename files/{ => root}/etc/pacman.conf (100%) rename files/{ => root}/etc/pacman.d/mirrorlist (100%) delete mode 100644 lib/Dockerfile delete mode 100644 lib/deploy.sh delete mode 100644 lib/docker.py delete mode 100644 lib/lib.sh create mode 100644 scripts/00-install-requirements.sh create mode 100644 scripts/10-copy-files.sh create mode 100644 scripts/20-install-pkgs.sh delete mode 100644 sync.conf diff --git a/README.md b/README.md index 23b8670..2e5da9f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,9 @@ -# Dotfiles (v2) +# Faulty's Dotfiles +Version: 3 -This repo has a simple sync script with a few features: -- file sync (not symlinked anymore) -- package install -- after install commands -- deploy script +--- -## Deployment -To import the dotfiles run: -`curl --proto '=https' --tlsv1.2 -sSf https://git.faulty.nl/didier/dotfiles/-/raw/main/lib/deploy.sh | sh` - -## Notes -- `gpackage.list` -This is a list with packages only installed if the `-g` or `--graphical` flag is used. \ No newline at end of file +## file sync +files in `./files` are synced across the system. +files in `./files/home` are synced to the home of the user running the script. +files in `./files/root` are synced with sudo to the root of the script. \ No newline at end of file diff --git a/command.list b/command.list deleted file mode 100644 index c855eca..0000000 --- a/command.list +++ /dev/null @@ -1,6 +0,0 @@ -^. ./sync.conf && $PM_COMMAND $PM_UPGRADE $PM_NOCONFIRM || printf "" -^[ -d /tmp/yay ] && rm -rf /tmp/yay || printf "" -command -v makepkg && (command -v yay || (git clone https://aur.archlinux.org/yay /tmp/yay && (cd /tmp/yay && makepkg --noconfirm -si))) || printf "" -^[ -d /tmp/pfetch ] && rm -rf /tmp/pfetch || printf "" -^(git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SYS_SUDO mv ./pfetch /usr/local/pfetch)) || printf "" -sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" diff --git a/comp.sh b/comp.sh deleted file mode 100755 index 0d6c724..0000000 --- a/comp.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# #################### # -# Compatibility Script # -# #################### # -if [ ! -z "$1" ]; then - cmd=$1; shift -fi - -case $cmd in - debian|ubuntu|apt|deb) - PM_COMMAND=apt \ - PM_NOCONFIRM=-y \ - PM_INSTALL=install \ - PM_UPDATE=update \ - PM_UPGRADE=upgrade \ - PM_REMOVE=purge \ - ./sync.sh $@ - ;; - *|''|arch) ./sync.sh $cmd $@ ;; -esac \ No newline at end of file diff --git a/files/%HOME/.config/alacritty/alacritty.yml b/files/home/.config/alacritty/alacritty.yml similarity index 100% rename from files/%HOME/.config/alacritty/alacritty.yml rename to files/home/.config/alacritty/alacritty.yml diff --git a/files/%HOME/.config/kanshi/config b/files/home/.config/kanshi/config similarity index 100% rename from files/%HOME/.config/kanshi/config rename to files/home/.config/kanshi/config diff --git a/files/%HOME/.config/kitty/kitty.conf b/files/home/.config/kitty/kitty.conf similarity index 100% rename from files/%HOME/.config/kitty/kitty.conf rename to files/home/.config/kitty/kitty.conf diff --git a/files/%HOME/.config/rofi/config.rasi b/files/home/.config/rofi/config.rasi similarity index 100% rename from files/%HOME/.config/rofi/config.rasi rename to files/home/.config/rofi/config.rasi diff --git a/files/%HOME/.config/sway/config b/files/home/.config/sway/config similarity index 100% rename from files/%HOME/.config/sway/config rename to files/home/.config/sway/config diff --git a/files/%HOME/.config/sway/status.py b/files/home/.config/sway/status.py similarity index 100% rename from files/%HOME/.config/sway/status.py rename to files/home/.config/sway/status.py diff --git a/files/%HOME/.config/sway/status.sh b/files/home/.config/sway/status.sh similarity index 100% rename from files/%HOME/.config/sway/status.sh rename to files/home/.config/sway/status.sh diff --git a/files/%HOME/.vimrc b/files/home/.vimrc similarity index 100% rename from files/%HOME/.vimrc rename to files/home/.vimrc diff --git a/files/%HOME/.zsh_preferences b/files/home/.zsh_preferences similarity index 100% rename from files/%HOME/.zsh_preferences rename to files/home/.zsh_preferences diff --git a/files/%HOME/.zsh_scripts b/files/home/.zsh_scripts similarity index 100% rename from files/%HOME/.zsh_scripts rename to files/home/.zsh_scripts diff --git a/files/%HOME/.zshrc b/files/home/.zshrc similarity index 100% rename from files/%HOME/.zshrc rename to files/home/.zshrc diff --git a/files/etc/pacman.conf b/files/root/etc/pacman.conf similarity index 100% rename from files/etc/pacman.conf rename to files/root/etc/pacman.conf diff --git a/files/etc/pacman.d/mirrorlist b/files/root/etc/pacman.d/mirrorlist similarity index 100% rename from files/etc/pacman.d/mirrorlist rename to files/root/etc/pacman.d/mirrorlist diff --git a/gpackage.list b/gpackage.list index 661b9ba..2f78a0b 100644 --- a/gpackage.list +++ b/gpackage.list @@ -1,4 +1,3 @@ alacritty sway -wlogout kanshi diff --git a/lib/Dockerfile b/lib/Dockerfile deleted file mode 100644 index d174a2e..0000000 --- a/lib/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM python:3.10-alpine - -RUN apk add git -RUN git clone https://git.faulty.nl/didier/dotfiles /app - -WORKDIR /app -ENTRYPOINT ["python3", "/app/lib/docker.py"] \ No newline at end of file diff --git a/lib/deploy.sh b/lib/deploy.sh deleted file mode 100644 index 04a7b34..0000000 --- a/lib/deploy.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/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 - ./comp.sh "$@" -} - -main "$@" \ No newline at end of file diff --git a/lib/docker.py b/lib/docker.py deleted file mode 100644 index 08ad428..0000000 --- a/lib/docker.py +++ /dev/null @@ -1,31 +0,0 @@ -# any HTTP request returns the contents of: ./lib/deploy.sh -# If the deploy script is older then a day, do a git pull - -from http.server import BaseHTTPRequestHandler, HTTPServer -import subprocess -import os -import time - -class handler(BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(200) - self.send_header('Content-type','text/plain') - self.end_headers() - if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400) or self.path == '/pull': - subprocess.call(['git', 'pull']) - with open('./lib/deploy.sh') as f: - self.wfile.write(bytes(f.read(), 'utf-8')) - self.wfile.write(bytes("# Git pull: " + str(time.time() - os.path.getmtime('./lib/deploy.sh')) + " seconds ago", 'utf-8')) - - -def main(): - try: - server = HTTPServer(('', 80), handler) - print('started httpserver...') - server.serve_forever() - except KeyboardInterrupt: - print('^C received, shutting down the web server') - server.socket.close() - -if __name__ == '__main__': - main() \ No newline at end of file diff --git a/lib/lib.sh b/lib/lib.sh deleted file mode 100644 index 5ba6f73..0000000 --- a/lib/lib.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -. ./sync.conf || . ../sync.conf - -DRY_RUN=${DRY_RUN:-no} - -bool() { - case "$1" in - 1|true|yes|on|TRUE|YES|ON) return 0 ;; - *) return 1 ;; - esac -} - -run() { - # Check if command starts with NO_RUN ($*) and remove it - if echo "$*" | grep -q "^NO_RUN"; then - return 0 - fi - - if bool "$DRY_RUN"; then - echo "DRY: + $*" - else - echo "+ $*" - "$@" - fi -} - -is_graphical() { - command -v $PREF_TERM > /dev/null && return 0 || return 1 -} - -command -v $SYS_SUDO > /dev/null || SYS_SUDO="NO_RUN" diff --git a/scripts/00-install-requirements.sh b/scripts/00-install-requirements.sh new file mode 100644 index 0000000..33a1cf5 --- /dev/null +++ b/scripts/00-install-requirements.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# This file only installs what is needed for the sync to perform... + +$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ + rsync \ No newline at end of file diff --git a/scripts/10-copy-files.sh b/scripts/10-copy-files.sh new file mode 100644 index 0000000..e5c4941 --- /dev/null +++ b/scripts/10-copy-files.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +HOME_FILES=${HOME_FILES:-./files/home} +ROOT_FILES=${ROOT_FILES:-./files/root} + +# overwrite files but preserve files surrounding +rsync -av $HOME_FILES/ $HOME +$SUDO rsync -av $ROOT_FILES/ / \ No newline at end of file diff --git a/scripts/20-install-pkgs.sh b/scripts/20-install-pkgs.sh new file mode 100644 index 0000000..b2f0fd2 --- /dev/null +++ b/scripts/20-install-pkgs.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +PACKAGE_LIST=${PACKAGE_LIST:-./package.list} +GRAPHICAL_PACKAGE_LIST=${GRAPHICAL_PACKAGE_LIST:-./gpackage.list} + +_APPLICATIONS="" +while read -r pkg; do + [ -z "$pkg" ] && continue + [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue + _APPLICATIONS="$_APPLICATIONS $pkg" +done < "$PACKAGE_LIST" + +if [ "${GRAPHICAL:-no}" = "yes" ]; then + if [ -f "$GRAPHICAL_PACKAGE_LIST" ]; then + while read -r pkg; do + [ -z "$pkg" ] && continue + [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue + _APPLICATIONS="$_APPLICATIONS $pkg" + done < "$GRAPHICAL_PACKAGE_LIST" + fi +fi + +$SUDO $PM $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS diff --git a/sync.conf b/sync.conf deleted file mode 100644 index 8c57fc4..0000000 --- a/sync.conf +++ /dev/null @@ -1,16 +0,0 @@ -# PM - Package Manager Options -PM_COMMAND=${PM_COMMAND:-pacman} -PM_NOCONFIRM=${PM_NOCONFIRM:-"--noconfirm"} -PM_INSTALL=${PM_INSTALL:--S} -PM_REMOVE=${PM_REMOVE:-R} -PM_UPDATE=${PM_UPDATE:--Sy} -PM_UPGRADE=${PM_UPGRADE:--Syyu} - -# SYS - System Options -SYS_SUDO=${SYS_SUDO:-"sudo"} -SYS_ROOT=${SYS_ROOT:-"/"} - -# PREF - Preferences -PREF_TERM=${PREF_TERM:-alacritty} -PREF_TERM_SET_TITLE=${PREF_TERM_SET_TITLE:--t} -PREF_TERM_RUN_CMD=${PREF_TERM_RUN_CMD:--e} \ No newline at end of file diff --git a/sync.sh b/sync.sh index a753714..e0a04d2 100755 --- a/sync.sh +++ b/sync.sh @@ -1,104 +1,18 @@ #!/bin/sh -SYNC_FILES=${SYNC_FILES:-yes} -INSTALL_PKGS=${INSTALL_PKGS:-yes} -RUN_CMDS=${RUN_CMDS:-yes} -PULL_GIT=${PULL_GIT:-yes} -TIME_TRACK=${TIME_TRACK:-no} +SUDO=${SUDO:-sudo} -ARGS="$@" - -. ./lib/lib.sh - -set -e # Exit on error - -_install_pkgs() { - run $SYS_SUDO $PM_COMMAND $PM_UPDATE $PM_NOCONFIRM - _APPLICATIONS="" - while read -r pkg; do - [ -z "$pkg" ] && continue - [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue - _APPLICATIONS="$_APPLICATIONS $pkg" - done <"$1" - run $SYS_SUDO $PM_COMMAND $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS -} - -_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 -} - -ARGS="$@" -_skip_next_arg="n" -arg_handler() { - for arg in $ARGS; do - bool $_skip_next_arg && continue - - case $arg in - +files) SYNC_FILES=yes ;; - -files) SYNC_FILES=no ;; - +pkgs) INSTALL_PKGS=yes ;; - -pkgs) INSTALL_PKGS=no ;; - +cmds) RUN_CMDS=yes ;; - -cmds) RUN_CMDS=no ;; - +git) PULL_GIT=yes ;; - -git) PULL_GIT=no ;; - +) SYNC_FILES=yes; INSTALL_PKGS=yes; RUN_CMDS=yes; PULL_GIT=yes ;; - -) SYNC_FILES=no; INSTALL_PKGS=no; RUN_CMDS=no; PULL_GIT=no ;; - +*) - echo "# Unknown argument: $arg" - exit 1 - ;; - -*) - echo "# Unknown argument: $arg" - exit 1 - ;; - esac - done -} +PM=${PM:-pacman} +PM_INSTALL=${PM_INSTALL:--S} +PM_NOCONFIRM=${PM_NOCONFIRM:---noconfirm} main() { - arg_handler - - echo "# hook: PULL_GIT" - bool "$PULL_GIT" && run git pull - - echo "# hook: SYNC_FILES (/)" - bool "$SYNC_FILES" && run cp -a "./files/%HOME/." "$HOME" - - echo "# hook: SYNC_FILES" - bool "$SYNC_FILES" && _sync_files - - echo "# hook: INSTALL_PKGS" - bool "$INSTALL_PKGS" && _install_pkgs ./package.list - - echo "# hook: RUN_CMDS" - bool "$RUN_CMDS" && _run_cmds - - return 0 + for script in ./scripts/* ; do + echo "# exec $script" + . $script + done } -echo "# exec: start." -if bool $TIME_TRACK; then - time main "$@" -else - main "$@" -fi -echo "# exec: done." +main "$@" + +echo "# OK" \ No newline at end of file From 471acdb79aadcf65572778f78f766b10d32b5904 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:07 +0200 Subject: [PATCH 092/177] feat: dwm --- files/dwm/config.h | 128 +++++++++++++++++++++ files/dwm/dwm-start.sh | 31 +++++ files/dwm/dwm.desktop | 6 + files/home/.config/alacritty/alacritty.yml | 2 + scripts/30-dwm.sh | 34 ++++++ 5 files changed, 201 insertions(+) create mode 100644 files/dwm/config.h create mode 100755 files/dwm/dwm-start.sh create mode 100644 files/dwm/dwm.desktop create mode 100644 scripts/30-dwm.sh diff --git a/files/dwm/config.h b/files/dwm/config.h new file mode 100644 index 0000000..996e250 --- /dev/null +++ b/files/dwm/config.h @@ -0,0 +1,128 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ +static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ +static const unsigned int systrayspacing = 2; /* systray spacing */ +static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ +static const int showsystray = 1; /* 0 means no systray */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ +static const char *fonts[] = { "monospace:size=10" }; +static const char dmenufont[] = "monospace:size=10"; +static const char col_gray1[] = "#222222"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; +static const char col_cyan[] = "#005577"; +static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, +}; + +/* tagging */ +static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", }; + +static const Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, True, -1 }, + { "Firefox", NULL, NULL, 0, False, -1 }, + { "Thunderbird", NULL, NULL, 2, False, -1 }, + { "stalonetray", NULL, NULL, 1, False, -1 }, + { "chrome", NULL, NULL, 4, False, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ +static const int nmaster = 1; /* number of clients in master area */ +static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod4Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; + +static const char *termcmd[] = { "alacritty", NULL }; +static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; + +static const char *volup[] = { "amixer", "set", "Master", "5%+", NULL }; +static const char *voldown[] = { "amixer", "set", "Master", "5%-", NULL }; + +static const char *dwmdie[] = { "killall", "dwm-start", NULL }; +static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_Return, spawn, {.v = termcmd } }, + { MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } }, + { MODKEY, XK_l, spawn, {.v = locksaver } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} }, + { MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} }, + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { MODKEY, XK_Up, spawn, {.v = volup } }, + { MODKEY, XK_Down, spawn, {.v = voldown } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} }, +}; + +/* button definitions */ +/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; + diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh new file mode 100755 index 0000000..40bf68f --- /dev/null +++ b/files/dwm/dwm-start.sh @@ -0,0 +1,31 @@ +#!/bin/sh +gnome-screensaver & + +xsetroot -solid black + +#while loop to update statusbar with some goodies +while true; do + #memfreak to get it in MB + memfreak2=$(grep MemFree /proc/meminfo | awk '{ print $2 }') + memfreak=$(($memfreak2 / 1024)) + #time + CLK=$(date +'%a %b %d %R:%S %Z') + #volume + VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') + #loadavg + AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) + #network stats in Bytes + NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') + battper=$(cat /sys/class/power_supply/BAT0/capacity) + #this one is not so good, increases a delay of 1-2s of the updating. + #put it in the xsetrootname plz (tip of the day, do not put | as first char after " + xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | " + sleep 1 +done & + + +nm-applet & +mate-volume-control-status-icon & +feh -z -Z --bg-scale /home/didier/Pictures/background.png + +exec dwm >/dev/null diff --git a/files/dwm/dwm.desktop b/files/dwm/dwm.desktop new file mode 100644 index 0000000..2f8e70f --- /dev/null +++ b/files/dwm/dwm.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=dwm +Comment=This session starts dwm +Exec=/usr/local/bin/dwm-start +Type=Application \ No newline at end of file diff --git a/files/home/.config/alacritty/alacritty.yml b/files/home/.config/alacritty/alacritty.yml index 3bc0096..882e5c9 100644 --- a/files/home/.config/alacritty/alacritty.yml +++ b/files/home/.config/alacritty/alacritty.yml @@ -2,6 +2,8 @@ bell: animation: 'Ease' duration: 50 color: '#555555' +font: + size: 7.0 cursor: style: shape: 'Block' diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh new file mode 100644 index 0000000..6813bc5 --- /dev/null +++ b/scripts/30-dwm.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# This file configures builds and installs DWM. + +# install dependencies +$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ + feh \ + network-manager-applet \ + alsa-utils \ + dstat \ + curl + +# clone +[ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm + +# config +cp ./files/dwm/config.h /tmp/dotfiles-dwm/config.h + +# build, patch and install +pushd /tmp/dotfiles-dwm + +# patches +curl https://dwm.suckless.org/patches/systray/dwm-systray-6.4.diff -o /tmp/dwm-systray.diff +git apply -3 /tmp/dwm-systray.diff + +$SUDO make install +popd + +# start script +chmod +x ./files/dwm/dwm-start.sh +$SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start + +# DM entry +$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop \ No newline at end of file From 3ff5485a1ff192ffdb63a1e6d7825668fa13eb8b Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:07 +0200 Subject: [PATCH 093/177] feat(dwm): more controls --- files/dwm/config.h | 145 ++++++++++++++++++++++++--------------------- 1 file changed, 77 insertions(+), 68 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index 996e250..dc4b931 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ +#include + /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ @@ -18,21 +20,21 @@ static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; static const char col_cyan[] = "#005577"; static const char *colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; /* tagging */ static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", }; static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, True, -1 }, - { "Firefox", NULL, NULL, 0, False, -1 }, - { "Thunderbird", NULL, NULL, 2, False, -1 }, - { "stalonetray", NULL, NULL, 1, False, -1 }, - { "chrome", NULL, NULL, 4, False, -1 }, + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, True, -1 }, + { "Firefox", NULL, NULL, 0, False, -1 }, + { "Thunderbird", NULL, NULL, 2, False, -1 }, + { "stalonetray", NULL, NULL, 1, False, -1 }, + { "chrome", NULL, NULL, 4, False, -1 }, }; /* layout(s) */ @@ -42,19 +44,19 @@ static const int nmaster = 1; /* number of clients in master area */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, }; /* key definitions */ #define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ - { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } @@ -66,63 +68,70 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, static const char *termcmd[] = { "alacritty", NULL }; static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; -static const char *volup[] = { "amixer", "set", "Master", "5%+", NULL }; -static const char *voldown[] = { "amixer", "set", "Master", "5%-", NULL }; +static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; +static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; +static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; -static const char *dwmdie[] = { "killall", "dwm-start", NULL }; +static const char *light_up[] = {"light", "-A", "5", NULL}; +static const char *light_down[] = {"light", "-U", "5", NULL}; + +static const char *dwmdie[] = {"/bin/sh", "-c", "pkill dwm-start && pkill dwm", "null"}; static Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } }, - { MODKEY, XK_l, spawn, {.v = locksaver } }, - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} }, - { MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} }, - { MODKEY|ShiftMask, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - { MODKEY, XK_Up, spawn, {.v = volup } }, - { MODKEY, XK_Down, spawn, {.v = voldown } }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) - TAGKEYS( XK_4, 3) - TAGKEYS( XK_5, 4) - TAGKEYS( XK_6, 5) - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} }, + /* modifier key function argument */ + { MODKEY, XK_Return, spawn, {.v = termcmd } }, + { MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } }, + { MODKEY, XK_l, spawn, {.v = locksaver } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} }, + { MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} }, + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, + { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, + { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, + { 0, XF86XK_MonBrightnessUp, spawn, {.v = light_up} }, + { 0, XF86XK_MonBrightnessDown, spawn, {.v = light_down} }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} }, }; /* button definitions */ /* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkTagBar, 0, Button1, view, {0} }, - { ClkTagBar, 0, Button3, toggleview, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; From d66545e9be5641a998c569f6e6f5d00a603b2019 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:07 +0200 Subject: [PATCH 094/177] feat(dwm): screenshots --- files/dwm/config.h | 17 ++++++++++++++--- files/dwm/dwm-start.sh | 1 + scripts/30-dwm.sh | 5 +++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index dc4b931..0cf9a63 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -3,7 +3,7 @@ #include /* appearance */ -static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int borderpx = 2; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ @@ -62,20 +62,29 @@ static const Layout layouts[] = { #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ + +// dmenu static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +// terminal static const char *termcmd[] = { "alacritty", NULL }; -static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; +// general & sys +static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; - static const char *light_up[] = {"light", "-A", "5", NULL}; static const char *light_down[] = {"light", "-U", "5", NULL}; +// screenshots +static const char *screenshot[] = {"flameshot", "full", "-c", NULL}; +static const char *screenshot_partial[] = {"flameshot", "gui", "-c", NULL}; + +// kill dwm static const char *dwmdie[] = {"/bin/sh", "-c", "pkill dwm-start && pkill dwm", "null"}; + static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_Return, spawn, {.v = termcmd } }, @@ -101,6 +110,8 @@ static Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + { 0, XK_Print, spawn, {.v = screenshot } }, + { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 40bf68f..a6b9372 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -26,6 +26,7 @@ done & nm-applet & mate-volume-control-status-icon & +flameshot & feh -z -Z --bg-scale /home/didier/Pictures/background.png exec dwm >/dev/null diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 6813bc5..30a2e78 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -8,7 +8,8 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ network-manager-applet \ alsa-utils \ dstat \ - curl + curl \ + flameshot # clone [ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm @@ -31,4 +32,4 @@ chmod +x ./files/dwm/dwm-start.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start # DM entry -$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop \ No newline at end of file +$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop From 1d134f5d27ffb591fb92de5c138ad87d4f84e68d Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:07 +0200 Subject: [PATCH 095/177] feat(dwm): pink --- files/dwm/config.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index 0cf9a63..9d8701c 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -14,15 +14,17 @@ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; -static const char col_gray1[] = "#222222"; -static const char col_gray2[] = "#444444"; -static const char col_gray3[] = "#bbbbbb"; -static const char col_gray4[] = "#eeeeee"; -static const char col_cyan[] = "#005577"; + +static const char col_bg_inactive[] = "#444444"; +static const char col_fg_inactive[] = "#bbbbbb"; + +static const char col_bg_highlight[] = "#ffaaaa"; +static const char col_fg_highlight[] = "#000000"; + static const char *colors[][3] = { /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + [SchemeNorm] = { col_fg_inactive, col_bg_inactive, col_bg_inactive }, + [SchemeSel] = { col_fg_highlight, col_bg_highlight, col_bg_highlight } }; /* tagging */ @@ -65,7 +67,14 @@ static const Layout layouts[] = { // dmenu static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ -static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *dmenucmd[] = { + "dmenu_run", + "-m", dmenumon, + "-fn", dmenufont, + "-nb", col_bg_inactive, + "-nf", col_fg_inactive, + "-sb", col_bg_highlight, + "-sf", col_fg_highlight, NULL }; // terminal static const char *termcmd[] = { "alacritty", NULL }; From c9a3d852f50c8993d623bccfd4140c46b25fe852 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:07 +0200 Subject: [PATCH 096/177] feat(dwm+main): tools update --- files/dwm/dwm-start.sh | 8 ++++++-- scripts/30-dwm.sh | 10 ++++++++-- sync.sh | 8 +++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index a6b9372..ae7f36b 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -27,6 +27,10 @@ done & nm-applet & mate-volume-control-status-icon & flameshot & -feh -z -Z --bg-scale /home/didier/Pictures/background.png +feh -z -Z --bg-scale $HOME/Pictures/background.* -exec dwm >/dev/null +touch /tmp/restart-dwm +while [ -f /tmp/restart-dwm ]; do + exec dwm >/dev/null + rm -rf /tmp/restart-dwm +done diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 30a2e78..08b1f83 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -27,9 +27,15 @@ git apply -3 /tmp/dwm-systray.diff $SUDO make install popd -# start script -chmod +x ./files/dwm/dwm-start.sh +# dwm boot/manage scripts +chmod +x ./files/dwm/*.sh + $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start +$SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync # DM entry $SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop + +# background +rm -rf $HOME/Pictures/background.* +curl https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/9757d496-239b-46c5-baea-6873cbfe9b3d/ddkbeml-015b05e6-6f8f-471e-a3a4-1c4360127ea6.jpg -o $HOME/Pictures/background.jpg diff --git a/sync.sh b/sync.sh index e0a04d2..b44e920 100755 --- a/sync.sh +++ b/sync.sh @@ -6,7 +6,13 @@ PM=${PM:-pacman} PM_INSTALL=${PM_INSTALL:--S} PM_NOCONFIRM=${PM_NOCONFIRM:---noconfirm} +set -e + main() { + if [ ! -z "$@" ]; then + . ./scripts/$@ + exit 0 + fi for script in ./scripts/* ; do echo "# exec $script" . $script @@ -15,4 +21,4 @@ main() { main "$@" -echo "# OK" \ No newline at end of file +echo "# OK" From 2e38a18413dd526112013757e1ff58185187100e Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:08 +0200 Subject: [PATCH 097/177] feat(dwm): fix restart opt --- files/dwm/dwm-start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index ae7f36b..8bf86b8 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -6,7 +6,7 @@ xsetroot -solid black #while loop to update statusbar with some goodies while true; do #memfreak to get it in MB - memfreak2=$(grep MemFree /proc/meminfo | awk '{ print $2 }') + memfreak2=$(grep MemUsed /proc/meminfo | awk '{ print $2 }') memfreak=$(($memfreak2 / 1024)) #time CLK=$(date +'%a %b %d %R:%S %Z') @@ -31,6 +31,6 @@ feh -z -Z --bg-scale $HOME/Pictures/background.* touch /tmp/restart-dwm while [ -f /tmp/restart-dwm ]; do - exec dwm >/dev/null rm -rf /tmp/restart-dwm + exec dwm >/dev/null done From 7ae783532b246a02b35545611749bb2654a3f019 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:08 +0200 Subject: [PATCH 098/177] feat(dwm): startup apps --- files/dwm/config.h | 13 ++++++------ files/dwm/dwm-start.sh | 46 +++++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/files/dwm/config.h b/files/dwm/config.h index 9d8701c..b92e5a0 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -31,12 +31,13 @@ static const char *colors[][3] = { static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", }; static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, True, -1 }, - { "Firefox", NULL, NULL, 0, False, -1 }, - { "Thunderbird", NULL, NULL, 2, False, -1 }, - { "stalonetray", NULL, NULL, 1, False, -1 }, - { "chrome", NULL, NULL, 4, False, -1 }, + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, True, -1 }, + { "firefox", NULL, NULL, 1 << 2, False, -1 }, + { "discord", NULL, NULL, 1 << 3, False, -1 }, + { "Thunderbird", NULL, NULL, 2, False, -1 }, + { "stalonetray", NULL, NULL, 1, False, -1 }, + { "chrome", NULL, NULL, 4, False, -1 }, }; /* layout(s) */ diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 8bf86b8..3941ea8 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -5,22 +5,23 @@ xsetroot -solid black #while loop to update statusbar with some goodies while true; do - #memfreak to get it in MB - memfreak2=$(grep MemUsed /proc/meminfo | awk '{ print $2 }') - memfreak=$(($memfreak2 / 1024)) - #time - CLK=$(date +'%a %b %d %R:%S %Z') - #volume - VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') - #loadavg - AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) - #network stats in Bytes - NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') - battper=$(cat /sys/class/power_supply/BAT0/capacity) - #this one is not so good, increases a delay of 1-2s of the updating. - #put it in the xsetrootname plz (tip of the day, do not put | as first char after " - xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | " - sleep 1 + #memfreak to get it in MB + memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }') + memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }') + memfreak=$(((memtotal - memfree) / 1024)) + #time + CLK=$(date +'%a %b %d %R:%S %Z') + #volume + VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') + #loadavg + AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) + #network stats in Bytes + NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') + battper=$(cat /sys/class/power_supply/BAT0/capacity) + #this one is not so good, increases a delay of 1-2s of the updating. + #put it in the xsetrootname plz (tip of the day, do not put | as first char after " + xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | " + sleep 1 done & @@ -29,8 +30,11 @@ mate-volume-control-status-icon & flameshot & feh -z -Z --bg-scale $HOME/Pictures/background.* -touch /tmp/restart-dwm -while [ -f /tmp/restart-dwm ]; do - rm -rf /tmp/restart-dwm - exec dwm >/dev/null -done +start_apps() { + discord & + firefox & +} + +(sleep 1 && start_apps) & + +exec dwm >/dev/null From 687e2ea93856cb5c334657da8f8f182d262fdf11 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:08 +0200 Subject: [PATCH 099/177] feat(fun): portal shutdown --- scripts/30-dwm.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 08b1f83..82dfb39 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -33,6 +33,9 @@ chmod +x ./files/dwm/*.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start $SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync +# funny tool +$SUDO cp ./files/dwm/shutdown-seq.sh /usr/local/bin/portal-sys-kill + # DM entry $SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop From 5a24481d4b7d6b38f2c370277ebc8bd4de45838e Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:08 +0200 Subject: [PATCH 100/177] fix(cfg): font was too smalll --- files/home/.config/alacritty/alacritty.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/files/home/.config/alacritty/alacritty.yml b/files/home/.config/alacritty/alacritty.yml index 882e5c9..3bc0096 100644 --- a/files/home/.config/alacritty/alacritty.yml +++ b/files/home/.config/alacritty/alacritty.yml @@ -2,8 +2,6 @@ bell: animation: 'Ease' duration: 50 color: '#555555' -font: - size: 7.0 cursor: style: shape: 'Block' From 833cb5bf1887aa63c6adfbbb21b7283c0bb5fec9 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:08 +0200 Subject: [PATCH 101/177] feat: compatibility script --- compatibility/fedora.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 compatibility/fedora.sh diff --git a/compatibility/fedora.sh b/compatibility/fedora.sh new file mode 100755 index 0000000..18dbe37 --- /dev/null +++ b/compatibility/fedora.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +export SUDO=sudo + +export PM=dnf +export PM_INSTALL=install +export PM_NOCONFIRM=-y + +[ -f ./sync.sh ] && ./sync.sh $@ || (cd .. && ./sync.sh $@) \ No newline at end of file From a9180bdaf9dd580f7c1dc7890d17072e6c560c4d Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:08 +0200 Subject: [PATCH 102/177] feat: hop script --- hop.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 hop.sh diff --git a/hop.sh b/hop.sh new file mode 100755 index 0000000..06a1d1b --- /dev/null +++ b/hop.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# need to hop? this script copies the important stuff. + +tar \ + --exclude={node_modules,target,dist,cache} \ + -cvf \ + ${TAR_FILE:-backup.tar} \ + ~/.ssh \ + ~/.config \ + ~/.mozilla \ + ~/Documents \ + ~/Pictures \ + ~/code \ + ~/environments From 8332afa133d3e67ef19c7e30c28fe25c017e0169 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:09 +0200 Subject: [PATCH 103/177] fix: optional dwm --- scripts/30-dwm.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 82dfb39..e1b994d 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -2,6 +2,8 @@ # This file configures builds and installs DWM. +[ "${NO_GRAPHICS:-no}" = "yes" ] && return 0 + # install dependencies $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ feh \ From 88f1fd8d01ffcbc8f8ae2df13c6c964432cd5ae2 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:09 +0200 Subject: [PATCH 104/177] zsh install script --- scripts/05-zsh.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 scripts/05-zsh.sh diff --git a/scripts/05-zsh.sh b/scripts/05-zsh.sh new file mode 100644 index 0000000..34b1bb6 --- /dev/null +++ b/scripts/05-zsh.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ + zsh + +# install pfetch +[ -d /tmp/pfetch ] || $SUDO bash -c \ + "git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SUDO mv ./pfetch /usr/local/pfetch)" + +# install omz +bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" + +# favourite omz plugins +PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR +PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting +[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR + +# set default shell +$SUDO usermod $USER --shell /bin/zsh \ No newline at end of file From f7340b13977590dc25a4686f6c4b0252d6b0b7d8 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:09 +0200 Subject: [PATCH 105/177] fix: pfetch dir --- scripts/05-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/05-zsh.sh b/scripts/05-zsh.sh index 34b1bb6..75ee7f6 100644 --- a/scripts/05-zsh.sh +++ b/scripts/05-zsh.sh @@ -5,7 +5,7 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ # install pfetch [ -d /tmp/pfetch ] || $SUDO bash -c \ - "git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SUDO mv ./pfetch /usr/local/pfetch)" + "git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SUDO mv ./pfetch /usr/local/bin/pfetch)" # install omz bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" From af7c33d567e41a2e0750492efd94f7ed3dd8ec1b Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:09 +0200 Subject: [PATCH 106/177] fastfetch :) --- files/home/.zshrc | 2 +- scripts/05-zsh.sh | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/files/home/.zshrc b/files/home/.zshrc index 431f59c..ec4a6f4 100644 --- a/files/home/.zshrc +++ b/files/home/.zshrc @@ -24,7 +24,7 @@ alias get_rust='. $HOME/.cargo/env' alias s="title $HOST && cmatrix -rs && clear" # COSMETICS -if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then pfetch; fi +if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then fastfetch; fi else PS1="$(whoami)@$(cat /etc/hostname) $ " diff --git a/scripts/05-zsh.sh b/scripts/05-zsh.sh index 75ee7f6..5a2c865 100644 --- a/scripts/05-zsh.sh +++ b/scripts/05-zsh.sh @@ -1,11 +1,23 @@ #!/bin/sh $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ - zsh + zsh \ + cmake # for fastfetch -# install pfetch -[ -d /tmp/pfetch ] || $SUDO bash -c \ - "git clone https://github.com/dylanaraps/pfetch.git /tmp/pfetch && cd /tmp/pfetch && (chmod a+x ./pfetch && $SUDO mv ./pfetch /usr/local/bin/pfetch)" +# install fastfetch +[ -d /tmp/fastfetch ] || \ + git clone https://github.com/LinusDierheimer/fastfetch /tmp/fastfetch + +if [ ! -f /tmp/fastfetch/build/fastfetch ]; then +pushd /tmp/fastfetch + mkdir -p build + pushd build + cmake .. + cmake --build . --target fastfetch + $SUDO mv fastfetch /usr/local/bin/fastfetch + popd +popd +fi # install omz bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" From eb825bad3cc22ef1bcf614d4ca2fd4eaad0f48f3 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:09 +0200 Subject: [PATCH 107/177] fix: scripts --- files/dwm/dwm-sync.sh | 7 +++++++ scripts/30-dwm.sh | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100755 files/dwm/dwm-sync.sh diff --git a/files/dwm/dwm-sync.sh b/files/dwm/dwm-sync.sh new file mode 100755 index 0000000..eb2f276 --- /dev/null +++ b/files/dwm/dwm-sync.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +pushd ~/.local/dotfiles +./sync.sh 30-dwm.sh +popd + +loginctl kill-user $USER \ No newline at end of file diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index e1b994d..bc7afeb 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -35,9 +35,6 @@ chmod +x ./files/dwm/*.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start $SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync -# funny tool -$SUDO cp ./files/dwm/shutdown-seq.sh /usr/local/bin/portal-sys-kill - # DM entry $SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop From bf1b8589db0c13896d269bab3b8914bf9b4b00e9 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:09 +0200 Subject: [PATCH 108/177] fix: fedora update --- compatibility/fedora.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compatibility/fedora.sh b/compatibility/fedora.sh index 18dbe37..bc85691 100755 --- a/compatibility/fedora.sh +++ b/compatibility/fedora.sh @@ -6,4 +6,7 @@ export PM=dnf export PM_INSTALL=install export PM_NOCONFIRM=-y +$SUDO dnf update +[ "${NO_GRAPHICS:-no}" = "yes" ] || $SUDO $PM $PM_INSTALL $PM_NOCONFIRM libX11-devel libXft-devel libXinerama-devel libXrandr-devel xorg-x11-xinit-session + [ -f ./sync.sh ] && ./sync.sh $@ || (cd .. && ./sync.sh $@) \ No newline at end of file From f3fb90d78c5325ec07be144ad638101938f9d8c2 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:10 +0200 Subject: [PATCH 109/177] refactor(dwm): change apps of dwm --- files/dwm/dwm-start.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 3941ea8..4faedf2 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -1,5 +1,4 @@ #!/bin/sh -gnome-screensaver & xsetroot -solid black @@ -24,9 +23,7 @@ while true; do sleep 1 done & - nm-applet & -mate-volume-control-status-icon & flameshot & feh -z -Z --bg-scale $HOME/Pictures/background.* From 2d48daa04af7b4d3b8edb8a44dfb136c33c9d780 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:10 +0200 Subject: [PATCH 110/177] fix: dmenu pkg --- scripts/30-dwm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index bc7afeb..d635c39 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -11,7 +11,8 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ alsa-utils \ dstat \ curl \ - flameshot + flameshot \ + dmenu # i don't care to customize # clone [ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm From f6826084212d3e1c3e0b8e6441e460f61566cbbc Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:10 +0200 Subject: [PATCH 111/177] feat: DWM start script envvars --- files/dwm/dwm-start.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 4faedf2..5243da3 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -1,5 +1,7 @@ #!/bin/sh +LITE=${LITE:-no} + xsetroot -solid black #while loop to update statusbar with some goodies @@ -23,15 +25,15 @@ while true; do sleep 1 done & -nm-applet & -flameshot & feh -z -Z --bg-scale $HOME/Pictures/background.* start_apps() { + nm-applet & + flameshot & discord & firefox & } -(sleep 1 && start_apps) & +[ "$LITE" = "yes" ] || (sleep 1 && start_apps) & -exec dwm >/dev/null +[ "${NO_DWM:-no}" = "yes" ] || exec dwm >/dev/null From e19dc36a2fdfbe87f8c403cc7cd34836166e3c0c Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:10 +0200 Subject: [PATCH 112/177] fix: unused var to NOG var --- package.list | 1 + scripts/20-install-pkgs.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.list b/package.list index bbecb9e..1e45b12 100644 --- a/package.list +++ b/package.list @@ -1,3 +1,4 @@ curl vim zsh +docker diff --git a/scripts/20-install-pkgs.sh b/scripts/20-install-pkgs.sh index b2f0fd2..912f9cc 100644 --- a/scripts/20-install-pkgs.sh +++ b/scripts/20-install-pkgs.sh @@ -10,7 +10,7 @@ while read -r pkg; do _APPLICATIONS="$_APPLICATIONS $pkg" done < "$PACKAGE_LIST" -if [ "${GRAPHICAL:-no}" = "yes" ]; then +if [ "${NO_GRAPHICS:-no}" = "no" ]; then if [ -f "$GRAPHICAL_PACKAGE_LIST" ]; then while read -r pkg; do [ -z "$pkg" ] && continue From 9904c7d5f49d146a6414ff30c5c23c806cdb5268 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:10 +0200 Subject: [PATCH 113/177] feat(dwm): i3lock --- scripts/30-dwm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index d635c39..7eda15e 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -12,7 +12,8 @@ $SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ dstat \ curl \ flameshot \ - dmenu # i don't care to customize + dmenu \ + i3lock # clone [ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm From 84872dc1038135b658c4a154e6cf2f3666c2846c Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:10 +0200 Subject: [PATCH 114/177] refactor(dwm): lock, start update, segregate status, etc. --- files/dwm/config.h | 4 ++-- files/dwm/dwm-lock.sh | 5 +++++ files/dwm/dwm-start.sh | 25 ++----------------------- files/dwm/dwm-status.sh | 26 ++++++++++++++++++++++++++ scripts/30-dwm.sh | 4 ++++ 5 files changed, 39 insertions(+), 25 deletions(-) create mode 100755 files/dwm/dwm-lock.sh create mode 100755 files/dwm/dwm-status.sh diff --git a/files/dwm/config.h b/files/dwm/config.h index b92e5a0..d957645 100644 --- a/files/dwm/config.h +++ b/files/dwm/config.h @@ -81,7 +81,7 @@ static const char *dmenucmd[] = { static const char *termcmd[] = { "alacritty", NULL }; // general & sys -static const char *locksaver[] = { "i3lock", "-c", "#000000", NULL }; +static const char *locksaver[] = { "/usr/local/bin/dwm-lock", NULL }; static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; @@ -121,7 +121,7 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, { 0, XK_Print, spawn, {.v = screenshot } }, - { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, + { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, diff --git a/files/dwm/dwm-lock.sh b/files/dwm/dwm-lock.sh new file mode 100755 index 0000000..2ce99e0 --- /dev/null +++ b/files/dwm/dwm-lock.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +touch /tmp/$USER-screen.lock +i3lock ${@:--nefc "#000000"} +rm -f /tmp/$USER-screen.lock diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh index 5243da3..88c7cd4 100755 --- a/files/dwm/dwm-start.sh +++ b/files/dwm/dwm-start.sh @@ -4,29 +4,6 @@ LITE=${LITE:-no} xsetroot -solid black -#while loop to update statusbar with some goodies -while true; do - #memfreak to get it in MB - memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }') - memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }') - memfreak=$(((memtotal - memfree) / 1024)) - #time - CLK=$(date +'%a %b %d %R:%S %Z') - #volume - VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') - #loadavg - AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) - #network stats in Bytes - NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') - battper=$(cat /sys/class/power_supply/BAT0/capacity) - #this one is not so good, increases a delay of 1-2s of the updating. - #put it in the xsetrootname plz (tip of the day, do not put | as first char after " - xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | " - sleep 1 -done & - -feh -z -Z --bg-scale $HOME/Pictures/background.* - start_apps() { nm-applet & flameshot & @@ -34,6 +11,8 @@ start_apps() { firefox & } +[ "$LITE" = "yes" ] || /usr/local/bin/dwm-status & [ "$LITE" = "yes" ] || (sleep 1 && start_apps) & +feh -zZ --bg-scale $HOME/Pictures/background.* [ "${NO_DWM:-no}" = "yes" ] || exec dwm >/dev/null diff --git a/files/dwm/dwm-status.sh b/files/dwm/dwm-status.sh new file mode 100755 index 0000000..bfa8a91 --- /dev/null +++ b/files/dwm/dwm-status.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +xsetroot -solid black -name "starting dwm..." + +#while loop to update statusbar with some goodies +while true; do + sleep 1 + [ -f /tmp/$USER-screen.lock ] && continue + #memfreak to get it in MB + memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }') + memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }') + memfreak=$(((memtotal - memfree) / 1024)) + #time + CLK=$(date +'%a %b %d %R:%S %Z') + #volume + VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') + #loadavg + AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) + #network stats in Bytes + NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') + battper=$(cat /sys/class/power_supply/BAT0/capacity) + #this one is not so good, increases a delay of 1-2s of the updating. + #put it in the xsetrootname plz (tip of the day, do not put | as first char after " + xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK |" +done + diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh index 7eda15e..10a440a 100644 --- a/scripts/30-dwm.sh +++ b/scripts/30-dwm.sh @@ -35,7 +35,11 @@ popd chmod +x ./files/dwm/*.sh $SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start +$SUDO cp ./files/dwm/dwm-status.sh /usr/local/bin/dwm-status $SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync +$SUDO cp ./files/dwm/dwm-lock.sh /usr/local/bin/dwm-lock + +$SUDO chmod +x /usr/local/bin/dwm-* # DM entry $SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop From a16479ee7a0977bb88bcb905b01c4a6c32b14e8b Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:11 +0200 Subject: [PATCH 115/177] next gen init --- .gitignore | 3 +- README.md | 17 +- compatibility/fedora.sh | 12 - distros/alpine/pm.sh | 19 ++ distros/any/package.list | 4 + distros/any/root/etc/sudoers | 4 + distros/arch/package.list | 2 + distros/arch/pm.sh | 22 ++ distros/arch/root/etc/pacman.conf | 31 +++ distros/arch/sys-scripts/00-reflector.sh | 12 + distros/arch/user-scripts/00-yay.sh | 13 + files/dwm/config.h | 158 ----------- files/dwm/dwm-lock.sh | 5 - files/dwm/dwm-start.sh | 18 -- files/dwm/dwm-status.sh | 26 -- files/dwm/dwm-sync.sh | 7 - files/dwm/dwm.desktop | 6 - files/home/.config/kanshi/config | 9 - files/home/.config/kitty/kitty.conf | 1 - files/home/.config/rofi/config.rasi | 1 - files/home/.config/sway/config | 248 ------------------ files/home/.config/sway/status.py | 25 -- files/home/.config/sway/status.sh | 16 -- files/home/.zsh_preferences | 2 - files/home/.zsh_scripts | 49 ---- files/home/.zshrc | 35 --- files/root/etc/pacman.conf | 100 ------- files/root/etc/pacman.d/mirrorlist | 11 - gpackage.list | 3 - .../.config/alacritty/alacritty.yml | 0 {files/home => home}/.vimrc | 1 + hop.sh | 15 -- package.list | 4 - scripts/00-install-requirements.sh | 6 - scripts/05-zsh.sh | 32 --- scripts/10-copy-files.sh | 8 - scripts/20-install-pkgs.sh | 23 -- scripts/30-dwm.sh | 49 ---- sync.sh | 126 +++++++-- unlink.sh | 10 + 40 files changed, 239 insertions(+), 894 deletions(-) delete mode 100755 compatibility/fedora.sh create mode 100644 distros/alpine/pm.sh create mode 100644 distros/any/package.list create mode 100644 distros/any/root/etc/sudoers create mode 100644 distros/arch/package.list create mode 100644 distros/arch/pm.sh create mode 100644 distros/arch/root/etc/pacman.conf create mode 100644 distros/arch/sys-scripts/00-reflector.sh create mode 100644 distros/arch/user-scripts/00-yay.sh delete mode 100644 files/dwm/config.h delete mode 100755 files/dwm/dwm-lock.sh delete mode 100755 files/dwm/dwm-start.sh delete mode 100755 files/dwm/dwm-status.sh delete mode 100755 files/dwm/dwm-sync.sh delete mode 100644 files/dwm/dwm.desktop delete mode 100644 files/home/.config/kanshi/config delete mode 120000 files/home/.config/kitty/kitty.conf delete mode 100755 files/home/.config/rofi/config.rasi delete mode 100755 files/home/.config/sway/config delete mode 100755 files/home/.config/sway/status.py delete mode 100755 files/home/.config/sway/status.sh delete mode 100644 files/home/.zsh_preferences delete mode 100644 files/home/.zsh_scripts delete mode 100644 files/home/.zshrc delete mode 100644 files/root/etc/pacman.conf delete mode 100644 files/root/etc/pacman.d/mirrorlist delete mode 100644 gpackage.list rename {files/home => home}/.config/alacritty/alacritty.yml (100%) rename {files/home => home}/.vimrc (96%) mode change 100755 => 100644 delete mode 100755 hop.sh delete mode 100644 package.list delete mode 100644 scripts/00-install-requirements.sh delete mode 100644 scripts/05-zsh.sh delete mode 100644 scripts/10-copy-files.sh delete mode 100644 scripts/20-install-pkgs.sh delete mode 100644 scripts/30-dwm.sh mode change 100755 => 100644 sync.sh create mode 100644 unlink.sh diff --git a/.gitignore b/.gitignore index 62c8935..e0318d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea/ \ No newline at end of file +.idea/ +.dotfiles/ \ No newline at end of file diff --git a/README.md b/README.md index 2e5da9f..e6074a3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -# Faulty's Dotfiles -Version: 3 +# Dotfiles ---- - -## file sync -files in `./files` are synced across the system. -files in `./files/home` are synced to the home of the user running the script. -files in `./files/root` are synced with sudo to the root of the script. \ No newline at end of file +## `distros/` +This directory is meant to setup the distro to the liking of the user. +### `distros/*/root` +Contains files to overlay over the executing system. +### `distro/*/sys-scripts` +scripts that are ran as `root` +### `distro/*/user-scripts` +scripts that are ran as the user \ No newline at end of file diff --git a/compatibility/fedora.sh b/compatibility/fedora.sh deleted file mode 100755 index bc85691..0000000 --- a/compatibility/fedora.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -export SUDO=sudo - -export PM=dnf -export PM_INSTALL=install -export PM_NOCONFIRM=-y - -$SUDO dnf update -[ "${NO_GRAPHICS:-no}" = "yes" ] || $SUDO $PM $PM_INSTALL $PM_NOCONFIRM libX11-devel libXft-devel libXinerama-devel libXrandr-devel xorg-x11-xinit-session - -[ -f ./sync.sh ] && ./sync.sh $@ || (cd .. && ./sync.sh $@) \ No newline at end of file diff --git a/distros/alpine/pm.sh b/distros/alpine/pm.sh new file mode 100644 index 0000000..90eac36 --- /dev/null +++ b/distros/alpine/pm.sh @@ -0,0 +1,19 @@ +cmd="apk" +while getopts "icru" opt; do + case $opt in + i) + cmd="$cmd add" + ;; + u) + cmd="$cmd add" + r) + cmd="$cmd remove" + ;; + c) + cmd="$cmd info -q" + ;; + esac +done +shift $((OPTIND-1)) + +$cmd $@ \ No newline at end of file diff --git a/distros/any/package.list b/distros/any/package.list new file mode 100644 index 0000000..53b3000 --- /dev/null +++ b/distros/any/package.list @@ -0,0 +1,4 @@ +neofetch +git +vim +sudo \ No newline at end of file diff --git a/distros/any/root/etc/sudoers b/distros/any/root/etc/sudoers new file mode 100644 index 0000000..e77799b --- /dev/null +++ b/distros/any/root/etc/sudoers @@ -0,0 +1,4 @@ +root ALL=(ALL:ALL) ALL +%wheel ALL=(ALL:ALL) ALL +%root ALL=(ALL:ALL) NOPASSWD: ALL +@includedir /etc/sudoers.d diff --git a/distros/arch/package.list b/distros/arch/package.list new file mode 100644 index 0000000..c3e02c8 --- /dev/null +++ b/distros/arch/package.list @@ -0,0 +1,2 @@ +reflector # for scripts/00-reflector.sh +alacritty # favourite terminal emulator \ No newline at end of file diff --git a/distros/arch/pm.sh b/distros/arch/pm.sh new file mode 100644 index 0000000..0fd802c --- /dev/null +++ b/distros/arch/pm.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +cmd="pacman --noconfirm" +while getopts "icru" opt; do + case $opt in + i) + cmd="$cmd -S" + ;; + u) + cmd="$cmd -Syyu" + ;; + r) + cmd="$cmd -R" + ;; + c) + cmd="$cmd -Q" + ;; + esac +done +shift $((OPTIND-1)) + +$cmd $@ \ No newline at end of file diff --git a/distros/arch/root/etc/pacman.conf b/distros/arch/root/etc/pacman.conf new file mode 100644 index 0000000..e63be35 --- /dev/null +++ b/distros/arch/root/etc/pacman.conf @@ -0,0 +1,31 @@ +[options] +HoldPkg = pacman glibc yay +Architecture = auto + +Color +CheckSpace +ParallelDownloads = 5 + +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional + +#[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 + +#[multilib-testing] +#Include = /etc/pacman.d/mirrorlist + +[multilib] +Include = /etc/pacman.d/mirrorlist diff --git a/distros/arch/sys-scripts/00-reflector.sh b/distros/arch/sys-scripts/00-reflector.sh new file mode 100644 index 0000000..7d2aa9d --- /dev/null +++ b/distros/arch/sys-scripts/00-reflector.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Sets up fast mirrors on arch + +if ! pacman -Q reflector; then + echo "reflector was not installed" + exit 1 +fi + +cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak +reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist +echo "Server = arch.neo.faulty.nl/$repo/os/$arch" >> /etc/pacman.d/mirrorlist \ No newline at end of file diff --git a/distros/arch/user-scripts/00-yay.sh b/distros/arch/user-scripts/00-yay.sh new file mode 100644 index 0000000..4ce4631 --- /dev/null +++ b/distros/arch/user-scripts/00-yay.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Installs yay. + +[ "$UID" = "0" ] || exit 0 + +yaytmpdir=$(mktemp -d) + +git clone https://aur.archlinux.org/yay $yaytmpdir +oldpwd=$(pwd) +cd $yaytmpdir +makepkg -si +cd $oldpwd diff --git a/files/dwm/config.h b/files/dwm/config.h deleted file mode 100644 index d957645..0000000 --- a/files/dwm/config.h +++ /dev/null @@ -1,158 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#include - -/* appearance */ -static const unsigned int borderpx = 2; /* border pixel of windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ -static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ -static const unsigned int systrayspacing = 2; /* systray spacing */ -static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ -static const int showsystray = 1; /* 0 means no systray */ -static const int showbar = 1; /* 0 means no bar */ -static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "monospace:size=10" }; -static const char dmenufont[] = "monospace:size=10"; - -static const char col_bg_inactive[] = "#444444"; -static const char col_fg_inactive[] = "#bbbbbb"; - -static const char col_bg_highlight[] = "#ffaaaa"; -static const char col_fg_highlight[] = "#000000"; - -static const char *colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { col_fg_inactive, col_bg_inactive, col_bg_inactive }, - [SchemeSel] = { col_fg_highlight, col_bg_highlight, col_bg_highlight } -}; - -/* tagging */ -static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", }; - -static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, True, -1 }, - { "firefox", NULL, NULL, 1 << 2, False, -1 }, - { "discord", NULL, NULL, 1 << 3, False, -1 }, - { "Thunderbird", NULL, NULL, 2, False, -1 }, - { "stalonetray", NULL, NULL, 1, False, -1 }, - { "chrome", NULL, NULL, 4, False, -1 }, -}; - -/* layout(s) */ -static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ -static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ -static const int nmaster = 1; /* number of clients in master area */ -static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ - -static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, -}; - -/* key definitions */ -#define MODKEY Mod4Mask -#define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ - { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, - -/* helper for spawning shell commands in the pre dwm-5.0 fashion */ -#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } - -/* commands */ - -// dmenu -static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ -static const char *dmenucmd[] = { - "dmenu_run", - "-m", dmenumon, - "-fn", dmenufont, - "-nb", col_bg_inactive, - "-nf", col_fg_inactive, - "-sb", col_bg_highlight, - "-sf", col_fg_highlight, NULL }; - -// terminal -static const char *termcmd[] = { "alacritty", NULL }; - -// general & sys -static const char *locksaver[] = { "/usr/local/bin/dwm-lock", NULL }; -static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL }; -static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL }; -static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL }; -static const char *light_up[] = {"light", "-A", "5", NULL}; -static const char *light_down[] = {"light", "-U", "5", NULL}; - -// screenshots -static const char *screenshot[] = {"flameshot", "full", "-c", NULL}; -static const char *screenshot_partial[] = {"flameshot", "gui", "-c", NULL}; - -// kill dwm -static const char *dwmdie[] = {"/bin/sh", "-c", "pkill dwm-start && pkill dwm", "null"}; - -static Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } }, - { MODKEY, XK_l, spawn, {.v = locksaver } }, - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} }, - { MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} }, - { MODKEY|ShiftMask, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - { 0, XK_Print, spawn, {.v = screenshot } }, - { Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } }, - { 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } }, - { 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } }, - { 0, XF86XK_AudioMute, spawn, {.v = vol_mute } }, - { 0, XF86XK_MonBrightnessUp, spawn, {.v = light_up} }, - { 0, XF86XK_MonBrightnessDown, spawn, {.v = light_down} }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) - TAGKEYS( XK_4, 3) - TAGKEYS( XK_5, 4) - TAGKEYS( XK_6, 5) - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} }, -}; - -/* button definitions */ -/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ -static Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkTagBar, 0, Button1, view, {0} }, - { ClkTagBar, 0, Button3, toggleview, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, -}; - diff --git a/files/dwm/dwm-lock.sh b/files/dwm/dwm-lock.sh deleted file mode 100755 index 2ce99e0..0000000 --- a/files/dwm/dwm-lock.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -touch /tmp/$USER-screen.lock -i3lock ${@:--nefc "#000000"} -rm -f /tmp/$USER-screen.lock diff --git a/files/dwm/dwm-start.sh b/files/dwm/dwm-start.sh deleted file mode 100755 index 88c7cd4..0000000 --- a/files/dwm/dwm-start.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -LITE=${LITE:-no} - -xsetroot -solid black - -start_apps() { - nm-applet & - flameshot & - discord & - firefox & -} - -[ "$LITE" = "yes" ] || /usr/local/bin/dwm-status & -[ "$LITE" = "yes" ] || (sleep 1 && start_apps) & - -feh -zZ --bg-scale $HOME/Pictures/background.* -[ "${NO_DWM:-no}" = "yes" ] || exec dwm >/dev/null diff --git a/files/dwm/dwm-status.sh b/files/dwm/dwm-status.sh deleted file mode 100755 index bfa8a91..0000000 --- a/files/dwm/dwm-status.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -xsetroot -solid black -name "starting dwm..." - -#while loop to update statusbar with some goodies -while true; do - sleep 1 - [ -f /tmp/$USER-screen.lock ] && continue - #memfreak to get it in MB - memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }') - memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }') - memfreak=$(((memtotal - memfree) / 1024)) - #time - CLK=$(date +'%a %b %d %R:%S %Z') - #volume - VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]') - #loadavg - AVG=$(cat /proc/loadavg | cut -d ' ' -f -3) - #network stats in Bytes - NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}') - battper=$(cat /sys/class/power_supply/BAT0/capacity) - #this one is not so good, increases a delay of 1-2s of the updating. - #put it in the xsetrootname plz (tip of the day, do not put | as first char after " - xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK |" -done - diff --git a/files/dwm/dwm-sync.sh b/files/dwm/dwm-sync.sh deleted file mode 100755 index eb2f276..0000000 --- a/files/dwm/dwm-sync.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -pushd ~/.local/dotfiles -./sync.sh 30-dwm.sh -popd - -loginctl kill-user $USER \ No newline at end of file diff --git a/files/dwm/dwm.desktop b/files/dwm/dwm.desktop deleted file mode 100644 index 2f8e70f..0000000 --- a/files/dwm/dwm.desktop +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=dwm -Comment=This session starts dwm -Exec=/usr/local/bin/dwm-start -Type=Application \ No newline at end of file diff --git a/files/home/.config/kanshi/config b/files/home/.config/kanshi/config deleted file mode 100644 index 5a245d2..0000000 --- a/files/home/.config/kanshi/config +++ /dev/null @@ -1,9 +0,0 @@ -profile school { - output "Iiyama North America PL2483H 1156290962278" mode 1920x1080 position 0,0 - output eDP-1 mode 1920x1080 position 1920,0 -} - -#profile sharing { -# output HDMI-A-1 mode 1920x1080 position 0,1080 -# output eDP-1 mode 1920x1080 position 0,0 -#} diff --git a/files/home/.config/kitty/kitty.conf b/files/home/.config/kitty/kitty.conf deleted file mode 120000 index de7259e..0000000 --- a/files/home/.config/kitty/kitty.conf +++ /dev/null @@ -1 +0,0 @@ -/home/didier/.local/dotfiles/./files/kitty/kitty.conf \ No newline at end of file diff --git a/files/home/.config/rofi/config.rasi b/files/home/.config/rofi/config.rasi deleted file mode 100755 index 1efb65f..0000000 --- a/files/home/.config/rofi/config.rasi +++ /dev/null @@ -1 +0,0 @@ -@theme "Arc-Dark" diff --git a/files/home/.config/sway/config b/files/home/.config/sway/config deleted file mode 100755 index 2b78650..0000000 --- a/files/home/.config/sway/config +++ /dev/null @@ -1,248 +0,0 @@ -# Faulty's sway Config - - -set $mod Mod1 -set $sup Mod4 -set $terminal alacritty #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 kanshi -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 wayland 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'" -bindsym $sup+Shift+e exec wlogout -# 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 windowโ€™s width. - # Pressing right will grow the windowโ€™s width. - # Pressing up will shrink the windowโ€™s height. - # Pressing down will grow the windowโ€™s 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 - } -} diff --git a/files/home/.config/sway/status.py b/files/home/.config/sway/status.py deleted file mode 100755 index 5a89322..0000000 --- a/files/home/.config/sway/status.py +++ /dev/null @@ -1,25 +0,0 @@ -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) diff --git a/files/home/.config/sway/status.sh b/files/home/.config/sway/status.sh deleted file mode 100755 index c8bcfc3..0000000 --- a/files/home/.config/sway/status.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/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 diff --git a/files/home/.zsh_preferences b/files/home/.zsh_preferences deleted file mode 100644 index 2677a0e..0000000 --- a/files/home/.zsh_preferences +++ /dev/null @@ -1,2 +0,0 @@ -_ZSH_PREF_NO_PFETCH=0 -_ZSH_PREF_NO_NONSENSE=0 \ No newline at end of file diff --git a/files/home/.zsh_scripts b/files/home/.zsh_scripts deleted file mode 100644 index 7537861..0000000 --- a/files/home/.zsh_scripts +++ /dev/null @@ -1,49 +0,0 @@ -__is_arch() { - . /etc/os-release - if [ "$ID" = "arch" ]; then return 0; else return 1; fi -} - -pkg_once() { - if [ ! __is_arch ]; then - printf "This command is only for Arch Linux.\n" - return - fi - if [ ! -n "$1" ]; then - printf "Usage: pkg_once [command]\n" - printf "command is optional; if there is no command the package name is ran\n" - return - fi - printf "Installing $1...\n" - yay -S --noconfirm $1 > /dev/null - - if [ ! -n "$2" ]; then $1; else $2; fi - printf "Remoiving $1..." - yay -R --noconfirm $1 > /dev/null - echo "done.\n" -} - -rando () { - case $1 in - *|d|default) tr -dc A-Za-z0-9 ?@[\]^_`{|}~' > $file - fi - chmod +x $file - printf '%s' $file -} - -alias docurr="docker run -itd --rm --name current" diff --git a/files/home/.zshrc b/files/home/.zshrc deleted file mode 100644 index ec4a6f4..0000000 --- a/files/home/.zshrc +++ /dev/null @@ -1,35 +0,0 @@ -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' -alias s="title $HOST && cmatrix -rs && clear" - -# COSMETICS -if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then fastfetch; fi - -else -PS1="$(whoami)@$(cat /etc/hostname) $ " -fi - -alias q="exit" -export PATH="${PATH}:/home/${USER}/.local/bin" -export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh" diff --git a/files/root/etc/pacman.conf b/files/root/etc/pacman.conf deleted file mode 100644 index 12cabfa..0000000 --- a/files/root/etc/pacman.conf +++ /dev/null @@ -1,100 +0,0 @@ -# -# /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 diff --git a/files/root/etc/pacman.d/mirrorlist b/files/root/etc/pacman.d/mirrorlist deleted file mode 100644 index 013da94..0000000 --- a/files/root/etc/pacman.d/mirrorlist +++ /dev/null @@ -1,11 +0,0 @@ -# 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 diff --git a/gpackage.list b/gpackage.list deleted file mode 100644 index 2f78a0b..0000000 --- a/gpackage.list +++ /dev/null @@ -1,3 +0,0 @@ -alacritty -sway -kanshi diff --git a/files/home/.config/alacritty/alacritty.yml b/home/.config/alacritty/alacritty.yml similarity index 100% rename from files/home/.config/alacritty/alacritty.yml rename to home/.config/alacritty/alacritty.yml diff --git a/files/home/.vimrc b/home/.vimrc old mode 100755 new mode 100644 similarity index 96% rename from files/home/.vimrc rename to home/.vimrc index abb89b3..6f12643 --- a/files/home/.vimrc +++ b/home/.vimrc @@ -1,2 +1,3 @@ set number set relativenumber + diff --git a/hop.sh b/hop.sh deleted file mode 100755 index 06a1d1b..0000000 --- a/hop.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# need to hop? this script copies the important stuff. - -tar \ - --exclude={node_modules,target,dist,cache} \ - -cvf \ - ${TAR_FILE:-backup.tar} \ - ~/.ssh \ - ~/.config \ - ~/.mozilla \ - ~/Documents \ - ~/Pictures \ - ~/code \ - ~/environments diff --git a/package.list b/package.list deleted file mode 100644 index 1e45b12..0000000 --- a/package.list +++ /dev/null @@ -1,4 +0,0 @@ -curl -vim -zsh -docker diff --git a/scripts/00-install-requirements.sh b/scripts/00-install-requirements.sh deleted file mode 100644 index 33a1cf5..0000000 --- a/scripts/00-install-requirements.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# This file only installs what is needed for the sync to perform... - -$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ - rsync \ No newline at end of file diff --git a/scripts/05-zsh.sh b/scripts/05-zsh.sh deleted file mode 100644 index 5a2c865..0000000 --- a/scripts/05-zsh.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ - zsh \ - cmake # for fastfetch - -# install fastfetch -[ -d /tmp/fastfetch ] || \ - git clone https://github.com/LinusDierheimer/fastfetch /tmp/fastfetch - -if [ ! -f /tmp/fastfetch/build/fastfetch ]; then -pushd /tmp/fastfetch - mkdir -p build - pushd build - cmake .. - cmake --build . --target fastfetch - $SUDO mv fastfetch /usr/local/bin/fastfetch - popd -popd -fi - -# install omz -bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed" - -# favourite omz plugins -PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions -[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR -PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting -[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR - -# set default shell -$SUDO usermod $USER --shell /bin/zsh \ No newline at end of file diff --git a/scripts/10-copy-files.sh b/scripts/10-copy-files.sh deleted file mode 100644 index e5c4941..0000000 --- a/scripts/10-copy-files.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -HOME_FILES=${HOME_FILES:-./files/home} -ROOT_FILES=${ROOT_FILES:-./files/root} - -# overwrite files but preserve files surrounding -rsync -av $HOME_FILES/ $HOME -$SUDO rsync -av $ROOT_FILES/ / \ No newline at end of file diff --git a/scripts/20-install-pkgs.sh b/scripts/20-install-pkgs.sh deleted file mode 100644 index 912f9cc..0000000 --- a/scripts/20-install-pkgs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -PACKAGE_LIST=${PACKAGE_LIST:-./package.list} -GRAPHICAL_PACKAGE_LIST=${GRAPHICAL_PACKAGE_LIST:-./gpackage.list} - -_APPLICATIONS="" -while read -r pkg; do - [ -z "$pkg" ] && continue - [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue - _APPLICATIONS="$_APPLICATIONS $pkg" -done < "$PACKAGE_LIST" - -if [ "${NO_GRAPHICS:-no}" = "no" ]; then - if [ -f "$GRAPHICAL_PACKAGE_LIST" ]; then - while read -r pkg; do - [ -z "$pkg" ] && continue - [ "$(echo "$pkg" | cut -c1)" = "#" ] && continue - _APPLICATIONS="$_APPLICATIONS $pkg" - done < "$GRAPHICAL_PACKAGE_LIST" - fi -fi - -$SUDO $PM $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS diff --git a/scripts/30-dwm.sh b/scripts/30-dwm.sh deleted file mode 100644 index 10a440a..0000000 --- a/scripts/30-dwm.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -# This file configures builds and installs DWM. - -[ "${NO_GRAPHICS:-no}" = "yes" ] && return 0 - -# install dependencies -$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \ - feh \ - network-manager-applet \ - alsa-utils \ - dstat \ - curl \ - flameshot \ - dmenu \ - i3lock - -# clone -[ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm - -# config -cp ./files/dwm/config.h /tmp/dotfiles-dwm/config.h - -# build, patch and install -pushd /tmp/dotfiles-dwm - -# patches -curl https://dwm.suckless.org/patches/systray/dwm-systray-6.4.diff -o /tmp/dwm-systray.diff -git apply -3 /tmp/dwm-systray.diff - -$SUDO make install -popd - -# dwm boot/manage scripts -chmod +x ./files/dwm/*.sh - -$SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start -$SUDO cp ./files/dwm/dwm-status.sh /usr/local/bin/dwm-status -$SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync -$SUDO cp ./files/dwm/dwm-lock.sh /usr/local/bin/dwm-lock - -$SUDO chmod +x /usr/local/bin/dwm-* - -# DM entry -$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop - -# background -rm -rf $HOME/Pictures/background.* -curl https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/9757d496-239b-46c5-baea-6873cbfe9b3d/ddkbeml-015b05e6-6f8f-471e-a3a4-1c4360127ea6.jpg -o $HOME/Pictures/background.jpg diff --git a/sync.sh b/sync.sh old mode 100755 new mode 100644 index b44e920..c3a4b09 --- a/sync.sh +++ b/sync.sh @@ -1,24 +1,118 @@ #!/bin/sh -SUDO=${SUDO:-sudo} +osreleaseprop() { + cat /etc/os-release | grep -e "^$1=" | sed 's/ID=//' +} -PM=${PM:-pacman} -PM_INSTALL=${PM_INSTALL:--S} -PM_NOCONFIRM=${PM_NOCONFIRM:---noconfirm} - -set -e - -main() { - if [ ! -z "$@" ]; then - . ./scripts/$@ - exit 0 +elevated() { + s=${SUDO:-sudo} + if [ ! "$s" = "none" ]; then + if ! which $s &> /dev/null; then + echo "command \"$s\" not found" + exit 1 + fi + else + s="" fi - for script in ./scripts/* ; do - echo "# exec $script" - . $script + $s $@ +} + +DISTRO=$(osreleaseprop ID) +if [ ! -d "distros/$DISTRO" ]; then + echo "$DISTRO is not supported." + exit 1 +fi + +pm() { + elevated "sh distros/$DISTRO/pm.sh $@" +} + +install_package_list() { + pkgs="" + [ -f "distros/${1:-$DISTRO}/package.list" ] || return 1 + for pkg in $(cat distros/${1:-$DISTRO}/package.list | sed 's/#.*$//'); do + pkgs="$pkgs $pkg" + done + pm -i $pkgs +} + +run_scripts() { + cmd=$1 + shift + case $cmd in + sys) + dir="distros/${1:-$DISTRO}/sys-scripts" + [ -d "$dir" ] || return + for s in $(ls $dir); do + echo "# running $dir/$s..." + elevated sh $dir/$s || exit 1 + done + ;; + user) + dir="distros/${1:-$DISTRO}/user-scripts" + [ -d "$dir" ] || return + for s in $(ls $dir); do + echo "# running $dir/$s..." + sh $dir/$s || exit 1 + done + ;; + esac +} + +overlay() { + [ -d "distros/${1:-$DISTRO}/root" ] || return 0 + elevated cp -r distros/${1:-$DISTRO}/root / +} + +__step_update() { + echo "# updating system..." + pm -u +} + +__step_install_package_list() { + echo "# installing package lists..." + install_package_list any + install_package_list +} + +__step_run_system_scripts() { + echo "# running system scripts..." + run_scripts sys any + run_scripts sys +} + +__step_run_user_scripts() { + echo "# running user scripts..." + run_scripts user any + run_scripts user +} + +__step_overlay() { + echo "# overlaying root directories..." + overlay any + overlay +} + +__step_link_home() { + echo "# linking all home files..." + trackingfile=".dotfiles/$(git rev-parse HEAD)-links" + for item in $(find ./home -type f); do + path=$(echo $item | sed "s/\.\/home//") + [ -z "$path" ] && continue + path="$HOME$path" + mkdir -p $(dirname $path) &> /dev/null + ln $item $path && echo "$path" >> $trackingfile done } -main "$@" +mkdir -p .dotfiles &> /dev/null -echo "# OK" +if [ -n "$1" ]; then + $(printf "__step_%s" "$1") +else + __step_update + __step_install_package_list + __step_run_system_scripts + __step_run_user_scripts + __step_overlay +fi diff --git a/unlink.sh b/unlink.sh new file mode 100644 index 0000000..3650aa8 --- /dev/null +++ b/unlink.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +for linkfile in $@; do + echo "# processing linkfile $linkfile..." + for link in $(cat $linkfile); do + echo "# unlinking $link..." + unlink $link + done + rm -rf $linkfile +done \ No newline at end of file From 8ba156a62bd25b7c021e0e6433e5d40e112f125c Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:11 +0200 Subject: [PATCH 116/177] fix: add link home step --- sync.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/sync.sh b/sync.sh index c3a4b09..593f38a 100644 --- a/sync.sh +++ b/sync.sh @@ -114,5 +114,6 @@ else __step_install_package_list __step_run_system_scripts __step_run_user_scripts + __step_link_home __step_overlay fi From c2eedb304e2c6aa101a4d438bd1f6d60f60e87db Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:11 +0200 Subject: [PATCH 117/177] feat: add some utils like tracking --- skip_steps.sh | 7 +++++++ sync.sh | 27 ++++++++++++++++++++------- unlink.sh | 2 +- 3 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 skip_steps.sh diff --git a/skip_steps.sh b/skip_steps.sh new file mode 100644 index 0000000..b6e9ee1 --- /dev/null +++ b/skip_steps.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +mkdir .dotfiles &>/dev/null + +for item in ${@:-update install_package_list run_system_scripts run_user_scripts link_home overlay}; do + echo "executed_step:$item" >> .dotfiles/pending_sync +done \ No newline at end of file diff --git a/sync.sh b/sync.sh index 593f38a..4b8f01a 100644 --- a/sync.sh +++ b/sync.sh @@ -99,21 +99,34 @@ __step_link_home() { for item in $(find ./home -type f); do path=$(echo $item | sed "s/\.\/home//") [ -z "$path" ] && continue + grep -q "$path" $trackingfile &> /dev/null && continue path="$HOME$path" mkdir -p $(dirname $path) &> /dev/null ln $item $path && echo "$path" >> $trackingfile done } +step() { + if ! grep -q "executed_step:$1" .dotfiles/pending_sync &> /dev/null; then + $(printf "__step_%s" "$1") + echo "executed_step:$1" >> .dotfiles/pending_sync + fi +} + mkdir -p .dotfiles &> /dev/null +touch .dotfiles/pending_sync if [ -n "$1" ]; then - $(printf "__step_%s" "$1") + step $1 else - __step_update - __step_install_package_list - __step_run_system_scripts - __step_run_user_scripts - __step_link_home - __step_overlay + echo "started_sync:$(date)" >> .dotfiles/log + step update + step install_package_list + step run_system_scripts + step run_user_scripts + step link_home + step overlay + echo "finished_sync:$(date)" >> .dotfiles/log fi + +unlink .dotfiles/pending_sync diff --git a/unlink.sh b/unlink.sh index 3650aa8..44e593c 100644 --- a/unlink.sh +++ b/unlink.sh @@ -1,6 +1,6 @@ #!/bin/sh -for linkfile in $@; do +for linkfile in ${@:-$(find .dotfiles -type f -name *-links)}; do echo "# processing linkfile $linkfile..." for link in $(cat $linkfile); do echo "# unlinking $link..." From 2d17da4a75cc54f625ac2c174d1ff8d9f7cd9ad1 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:11 +0200 Subject: [PATCH 118/177] fix: stuff --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index 4b8f01a..89ed355 100644 --- a/sync.sh +++ b/sync.sh @@ -7,7 +7,7 @@ osreleaseprop() { elevated() { s=${SUDO:-sudo} if [ ! "$s" = "none" ]; then - if ! which $s &> /dev/null; then + if ! command -v $s &> /dev/null; then echo "command \"$s\" not found" exit 1 fi From 8f6f7224d1d8977ee90f0bc784a8bbdc9c2d4314 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:11 +0200 Subject: [PATCH 119/177] add apline config --- distros/alpine/package.list | 1 + distros/alpine/root/etc/doas.conf | 1 + distros/alpine/sys-scripts/00-remove-sudo.sh | 5 +++++ 3 files changed, 7 insertions(+) create mode 100644 distros/alpine/package.list create mode 100644 distros/alpine/root/etc/doas.conf create mode 100644 distros/alpine/sys-scripts/00-remove-sudo.sh diff --git a/distros/alpine/package.list b/distros/alpine/package.list new file mode 100644 index 0000000..9d32a57 --- /dev/null +++ b/distros/alpine/package.list @@ -0,0 +1 @@ +doas \ No newline at end of file diff --git a/distros/alpine/root/etc/doas.conf b/distros/alpine/root/etc/doas.conf new file mode 100644 index 0000000..c50a253 --- /dev/null +++ b/distros/alpine/root/etc/doas.conf @@ -0,0 +1 @@ +permit persit wheel \ No newline at end of file diff --git a/distros/alpine/sys-scripts/00-remove-sudo.sh b/distros/alpine/sys-scripts/00-remove-sudo.sh new file mode 100644 index 0000000..2845cb8 --- /dev/null +++ b/distros/alpine/sys-scripts/00-remove-sudo.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# removes sudo + +apk del sudo \ No newline at end of file From 29282b5bdffd9f7e793c69311e9e392ca2f81b63 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:11 +0200 Subject: [PATCH 120/177] fix: alpine pm impl --- distros/alpine/pm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distros/alpine/pm.sh b/distros/alpine/pm.sh index 90eac36..7560ed9 100644 --- a/distros/alpine/pm.sh +++ b/distros/alpine/pm.sh @@ -6,8 +6,9 @@ while getopts "icru" opt; do ;; u) cmd="$cmd add" + ;; r) - cmd="$cmd remove" + cmd="$cmd del" ;; c) cmd="$cmd info -q" From 11187dc11c9bc5456be812bac0943680fdcc1577 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:12 +0200 Subject: [PATCH 121/177] feat: final-ish version --- crates/20-vim/crate.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 crates/20-vim/crate.sh diff --git a/crates/20-vim/crate.sh b/crates/20-vim/crate.sh new file mode 100644 index 0000000..3210eac --- /dev/null +++ b/crates/20-vim/crate.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +describe="Install vim and it's stuff" +scripts="@distro @self" + +apply() { + [ -e "$HOME/.vimrc" ] || ln files/.vimrc $HOME/.vimrc + [ -e "$HOME/.ideavimrc" ] || ln files/.ideavimrc $HOME/.ideavimrc +} + +undo() { + unlink $HOME/.vimrc + unlink $HOME/.ideavimrc +} \ No newline at end of file From 05595c2e1458b27dc2df69d88ab672c895111ed3 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:12 +0200 Subject: [PATCH 122/177] stuff --- .gitignore | 2 - README.md | 10 -- crates/00-system/crate.arch.sh | 11 ++ crates/00-system/crate.sh | 7 + .../00-system/files}/pacman.conf | 0 .../etc => crates/00-system/files}/sudoers | 0 crates/10-zsh/crate.arch.sh | 7 + crates/10-zsh/crate.sh | 41 ++++++ crates/10-zsh/files/.zshrc | 23 +++ crates/20-vim/crate.arch.sh | 7 + crates/20-vim/files/.ideavimrc | 10 ++ {home => crates/20-vim/files}/.vimrc | 1 - crates/30-alacritty/crate.arch.sh | 7 + crates/30-alacritty/crate.sh | 12 ++ .../30-alacritty/files}/alacritty.yml | 4 - distros/alpine/package.list | 1 - distros/alpine/pm.sh | 20 --- distros/alpine/root/etc/doas.conf | 1 - distros/alpine/sys-scripts/00-remove-sudo.sh | 5 - distros/any/package.list | 4 - distros/arch/package.list | 2 - distros/arch/pm.sh | 22 --- distros/arch/sys-scripts/00-reflector.sh | 12 -- distros/arch/user-scripts/00-yay.sh | 13 -- dot | 85 +++++++++++ skip_steps.sh | 7 - sync.sh | 132 ------------------ unlink.sh | 10 -- 28 files changed, 210 insertions(+), 246 deletions(-) delete mode 100644 .gitignore delete mode 100644 README.md create mode 100644 crates/00-system/crate.arch.sh create mode 100644 crates/00-system/crate.sh rename {distros/arch/root/etc => crates/00-system/files}/pacman.conf (100%) rename {distros/any/root/etc => crates/00-system/files}/sudoers (100%) create mode 100644 crates/10-zsh/crate.arch.sh create mode 100644 crates/10-zsh/crate.sh create mode 100644 crates/10-zsh/files/.zshrc create mode 100644 crates/20-vim/crate.arch.sh create mode 100644 crates/20-vim/files/.ideavimrc rename {home => crates/20-vim/files}/.vimrc (96%) create mode 100644 crates/30-alacritty/crate.arch.sh create mode 100644 crates/30-alacritty/crate.sh rename {home/.config/alacritty => crates/30-alacritty/files}/alacritty.yml (56%) delete mode 100644 distros/alpine/package.list delete mode 100644 distros/alpine/pm.sh delete mode 100644 distros/alpine/root/etc/doas.conf delete mode 100644 distros/alpine/sys-scripts/00-remove-sudo.sh delete mode 100644 distros/any/package.list delete mode 100644 distros/arch/package.list delete mode 100644 distros/arch/pm.sh delete mode 100644 distros/arch/sys-scripts/00-reflector.sh delete mode 100644 distros/arch/user-scripts/00-yay.sh create mode 100755 dot delete mode 100644 skip_steps.sh delete mode 100644 sync.sh delete mode 100644 unlink.sh diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e0318d4..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.idea/ -.dotfiles/ \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index e6074a3..0000000 --- a/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Dotfiles - -## `distros/` -This directory is meant to setup the distro to the liking of the user. -### `distros/*/root` -Contains files to overlay over the executing system. -### `distro/*/sys-scripts` -scripts that are ran as `root` -### `distro/*/user-scripts` -scripts that are ran as the user \ No newline at end of file diff --git a/crates/00-system/crate.arch.sh b/crates/00-system/crate.arch.sh new file mode 100644 index 0000000..ce3f7dd --- /dev/null +++ b/crates/00-system/crate.arch.sh @@ -0,0 +1,11 @@ +super_apply() { + pacman -S --needed sudo reflector + if ! grep -q "Reflector" /etc/pacman.d/mirrorlist; then + cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak + reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist + else + echo "err: reflector already executed -- skipping..." + fi + + cp files/pacman.conf /etc/pacman.conf +} \ No newline at end of file diff --git a/crates/00-system/crate.sh b/crates/00-system/crate.sh new file mode 100644 index 0000000..2a73944 --- /dev/null +++ b/crates/00-system/crate.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +describe="Install stuff on the system!" + +super_apply() { + cp files/sudoers /etc/sudoers +} \ No newline at end of file diff --git a/distros/arch/root/etc/pacman.conf b/crates/00-system/files/pacman.conf similarity index 100% rename from distros/arch/root/etc/pacman.conf rename to crates/00-system/files/pacman.conf diff --git a/distros/any/root/etc/sudoers b/crates/00-system/files/sudoers similarity index 100% rename from distros/any/root/etc/sudoers rename to crates/00-system/files/sudoers diff --git a/crates/10-zsh/crate.arch.sh b/crates/10-zsh/crate.arch.sh new file mode 100644 index 0000000..b44c9ed --- /dev/null +++ b/crates/10-zsh/crate.arch.sh @@ -0,0 +1,7 @@ +super_apply() { + pacman -S --needed zsh cmake +} + +super_undo() { + pacman -R zsh +} \ No newline at end of file diff --git a/crates/10-zsh/crate.sh b/crates/10-zsh/crate.sh new file mode 100644 index 0000000..2e470d8 --- /dev/null +++ b/crates/10-zsh/crate.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +describe="Install zsh and oh-my-zsh!" +scripts="@distro @self" + +super_apply() { + [ -d /tmp/fastfetch ] || git clone https://github.com/LinusDierheimer/fastfetch /tmp/fastfetch + + if ! command -v fastfetch &> /dev/null; then + cd /tmp/fastfetch + mkdir -p build + cd build + cmake .. + cmake --build . --target fastfetch + mv fastfetch /usr/local/bin/fastfetch + fi + + usermod $USER --shell /bin/zsh +} + +super_undo() { + usermod $USER --shell /bin/bash +} + +apply() { + if [ ! -d "$HOME/.oh-my-zsh" ]; then + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended + + PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions + [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR + PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting + [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR + fi + + [ -e "$HOME/.zshrc" ] || ln files/.zshrc $HOME/.zshrc +} + +undo() { + unlink $HOME/.zshrc + rm -rf $HOME/.oh-my-zsh +} \ No newline at end of file diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc new file mode 100644 index 0000000..58358a2 --- /dev/null +++ b/crates/10-zsh/files/.zshrc @@ -0,0 +1,23 @@ +export GPG_TTY=$(tty) + +# paths +export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" + +# 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 + +# ALIASES +alias open="xdg-open" +alias nobeep="sudo modprobe -r pcspkr" +alias s="title $HOST && cmatrix -rs && clear" +alias q="exit" + +# COSMETICS +fastfetch + +export PATH="${PATH}:/home/${USER}/.local/bin" +export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh" diff --git a/crates/20-vim/crate.arch.sh b/crates/20-vim/crate.arch.sh new file mode 100644 index 0000000..d95ce2d --- /dev/null +++ b/crates/20-vim/crate.arch.sh @@ -0,0 +1,7 @@ +super_apply() { + pacman -S --needed vim +} + +super_undo() { + echo "we never uninstall vim -_-" +} \ No newline at end of file diff --git a/crates/20-vim/files/.ideavimrc b/crates/20-vim/files/.ideavimrc new file mode 100644 index 0000000..115e47f --- /dev/null +++ b/crates/20-vim/files/.ideavimrc @@ -0,0 +1,10 @@ +source ~/.vimrc + +set scrolloff=5 +set incsearch + +map Q gq + +Plug 'machakann/vim-highlightedyank' +Plug 'tpope/vim-commentary' +Plug 'wellle/targets.vim' diff --git a/home/.vimrc b/crates/20-vim/files/.vimrc similarity index 96% rename from home/.vimrc rename to crates/20-vim/files/.vimrc index 6f12643..abb89b3 100644 --- a/home/.vimrc +++ b/crates/20-vim/files/.vimrc @@ -1,3 +1,2 @@ set number set relativenumber - diff --git a/crates/30-alacritty/crate.arch.sh b/crates/30-alacritty/crate.arch.sh new file mode 100644 index 0000000..a91b78b --- /dev/null +++ b/crates/30-alacritty/crate.arch.sh @@ -0,0 +1,7 @@ +super_apply() { + pacman -S --needed alacritty +} + +super_undo() { + pacman -R alacritty +} \ No newline at end of file diff --git a/crates/30-alacritty/crate.sh b/crates/30-alacritty/crate.sh new file mode 100644 index 0000000..3a433d2 --- /dev/null +++ b/crates/30-alacritty/crate.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +describe="Installs alacritty and configs" +scripts="@distro @self" + +apply() { + [ -e "$HOME/.config/alacritty/alacritty.yml" ] || ln files/alacritty.yml $HOME/.config/alacritty/alacritty.yml +} + +undo() { + unlink $HOME/.config/alacritty/alacritty.yml +} \ No newline at end of file diff --git a/home/.config/alacritty/alacritty.yml b/crates/30-alacritty/files/alacritty.yml similarity index 56% rename from home/.config/alacritty/alacritty.yml rename to crates/30-alacritty/files/alacritty.yml index 3bc0096..1a30120 100644 --- a/home/.config/alacritty/alacritty.yml +++ b/crates/30-alacritty/files/alacritty.yml @@ -1,7 +1,3 @@ -bell: - animation: 'Ease' - duration: 50 - color: '#555555' cursor: style: shape: 'Block' diff --git a/distros/alpine/package.list b/distros/alpine/package.list deleted file mode 100644 index 9d32a57..0000000 --- a/distros/alpine/package.list +++ /dev/null @@ -1 +0,0 @@ -doas \ No newline at end of file diff --git a/distros/alpine/pm.sh b/distros/alpine/pm.sh deleted file mode 100644 index 7560ed9..0000000 --- a/distros/alpine/pm.sh +++ /dev/null @@ -1,20 +0,0 @@ -cmd="apk" -while getopts "icru" opt; do - case $opt in - i) - cmd="$cmd add" - ;; - u) - cmd="$cmd add" - ;; - r) - cmd="$cmd del" - ;; - c) - cmd="$cmd info -q" - ;; - esac -done -shift $((OPTIND-1)) - -$cmd $@ \ No newline at end of file diff --git a/distros/alpine/root/etc/doas.conf b/distros/alpine/root/etc/doas.conf deleted file mode 100644 index c50a253..0000000 --- a/distros/alpine/root/etc/doas.conf +++ /dev/null @@ -1 +0,0 @@ -permit persit wheel \ No newline at end of file diff --git a/distros/alpine/sys-scripts/00-remove-sudo.sh b/distros/alpine/sys-scripts/00-remove-sudo.sh deleted file mode 100644 index 2845cb8..0000000 --- a/distros/alpine/sys-scripts/00-remove-sudo.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# removes sudo - -apk del sudo \ No newline at end of file diff --git a/distros/any/package.list b/distros/any/package.list deleted file mode 100644 index 53b3000..0000000 --- a/distros/any/package.list +++ /dev/null @@ -1,4 +0,0 @@ -neofetch -git -vim -sudo \ No newline at end of file diff --git a/distros/arch/package.list b/distros/arch/package.list deleted file mode 100644 index c3e02c8..0000000 --- a/distros/arch/package.list +++ /dev/null @@ -1,2 +0,0 @@ -reflector # for scripts/00-reflector.sh -alacritty # favourite terminal emulator \ No newline at end of file diff --git a/distros/arch/pm.sh b/distros/arch/pm.sh deleted file mode 100644 index 0fd802c..0000000 --- a/distros/arch/pm.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -cmd="pacman --noconfirm" -while getopts "icru" opt; do - case $opt in - i) - cmd="$cmd -S" - ;; - u) - cmd="$cmd -Syyu" - ;; - r) - cmd="$cmd -R" - ;; - c) - cmd="$cmd -Q" - ;; - esac -done -shift $((OPTIND-1)) - -$cmd $@ \ No newline at end of file diff --git a/distros/arch/sys-scripts/00-reflector.sh b/distros/arch/sys-scripts/00-reflector.sh deleted file mode 100644 index 7d2aa9d..0000000 --- a/distros/arch/sys-scripts/00-reflector.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Sets up fast mirrors on arch - -if ! pacman -Q reflector; then - echo "reflector was not installed" - exit 1 -fi - -cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak -reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist -echo "Server = arch.neo.faulty.nl/$repo/os/$arch" >> /etc/pacman.d/mirrorlist \ No newline at end of file diff --git a/distros/arch/user-scripts/00-yay.sh b/distros/arch/user-scripts/00-yay.sh deleted file mode 100644 index 4ce4631..0000000 --- a/distros/arch/user-scripts/00-yay.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Installs yay. - -[ "$UID" = "0" ] || exit 0 - -yaytmpdir=$(mktemp -d) - -git clone https://aur.archlinux.org/yay $yaytmpdir -oldpwd=$(pwd) -cd $yaytmpdir -makepkg -si -cd $oldpwd diff --git a/dot b/dot new file mode 100755 index 0000000..7993255 --- /dev/null +++ b/dot @@ -0,0 +1,85 @@ +#!/bin/sh + +ask=0 + +is_function() { + type "$1" 2> /dev/null | sed "s/$1//" | grep -qwi function +} + +curr_distro() { + cat /etc/os-release | grep -G "^ID=" | sed 's/ID=//' +} + +include() { + [ -f "$1" ] || return 1 + . $1 + return 0 +} + +func() { + if is_function $(echo "super_$2"); then + sudo sh -c ". $1 && super_$2" + fi + is_function $2 && $2 +} + +get_command() { + case $1 in + a*) + printf "apply" + ;; + u*) + printf "undo" + ;; + *) + echo "err: not supported" >&2 + exit 1 + ;; + esac +} + +# only run this *in crate dir* +run_crate() { + include ./crate.sh || exit 1 + if [ -n "$describe" ]; then + echo "desc($(basename $PWD)): $describe" + fi + cmd=$(get_command $1) + scripts=${scripts:-"@self @distro"} + for s in $scripts; do + echo "exec($(basename $PWD)): $s/$cmd" + case $s in + @self) + func ./crate.sh $cmd + ;; + @distro) + unset -f super_$cmd + unset -f $cmd + include ./crate.$(curr_distro).sh + func ./crate.$(curr_distro).sh $cmd + unset -f super_$cmd + unset -f $cmd + include ./crate.sh + ;; + *) + sh $s + ;; + esac + done +} + +if [ $# -eq 2 ]; then + [ -d crates/*$1 ] || exit 1 + cd crates/*$1 + run_crate $2 + cd ../.. +else + [ $# -eq 0 ] && exit 2 + for crate in $(find ./crates -mindepth 1 -maxdepth 1 -type d | sort); do + cd $crate + run_crate $1 + cd ../.. + done +fi + + \ No newline at end of file diff --git a/skip_steps.sh b/skip_steps.sh deleted file mode 100644 index b6e9ee1..0000000 --- a/skip_steps.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -mkdir .dotfiles &>/dev/null - -for item in ${@:-update install_package_list run_system_scripts run_user_scripts link_home overlay}; do - echo "executed_step:$item" >> .dotfiles/pending_sync -done \ No newline at end of file diff --git a/sync.sh b/sync.sh deleted file mode 100644 index 89ed355..0000000 --- a/sync.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/sh - -osreleaseprop() { - cat /etc/os-release | grep -e "^$1=" | sed 's/ID=//' -} - -elevated() { - s=${SUDO:-sudo} - if [ ! "$s" = "none" ]; then - if ! command -v $s &> /dev/null; then - echo "command \"$s\" not found" - exit 1 - fi - else - s="" - fi - $s $@ -} - -DISTRO=$(osreleaseprop ID) -if [ ! -d "distros/$DISTRO" ]; then - echo "$DISTRO is not supported." - exit 1 -fi - -pm() { - elevated "sh distros/$DISTRO/pm.sh $@" -} - -install_package_list() { - pkgs="" - [ -f "distros/${1:-$DISTRO}/package.list" ] || return 1 - for pkg in $(cat distros/${1:-$DISTRO}/package.list | sed 's/#.*$//'); do - pkgs="$pkgs $pkg" - done - pm -i $pkgs -} - -run_scripts() { - cmd=$1 - shift - case $cmd in - sys) - dir="distros/${1:-$DISTRO}/sys-scripts" - [ -d "$dir" ] || return - for s in $(ls $dir); do - echo "# running $dir/$s..." - elevated sh $dir/$s || exit 1 - done - ;; - user) - dir="distros/${1:-$DISTRO}/user-scripts" - [ -d "$dir" ] || return - for s in $(ls $dir); do - echo "# running $dir/$s..." - sh $dir/$s || exit 1 - done - ;; - esac -} - -overlay() { - [ -d "distros/${1:-$DISTRO}/root" ] || return 0 - elevated cp -r distros/${1:-$DISTRO}/root / -} - -__step_update() { - echo "# updating system..." - pm -u -} - -__step_install_package_list() { - echo "# installing package lists..." - install_package_list any - install_package_list -} - -__step_run_system_scripts() { - echo "# running system scripts..." - run_scripts sys any - run_scripts sys -} - -__step_run_user_scripts() { - echo "# running user scripts..." - run_scripts user any - run_scripts user -} - -__step_overlay() { - echo "# overlaying root directories..." - overlay any - overlay -} - -__step_link_home() { - echo "# linking all home files..." - trackingfile=".dotfiles/$(git rev-parse HEAD)-links" - for item in $(find ./home -type f); do - path=$(echo $item | sed "s/\.\/home//") - [ -z "$path" ] && continue - grep -q "$path" $trackingfile &> /dev/null && continue - path="$HOME$path" - mkdir -p $(dirname $path) &> /dev/null - ln $item $path && echo "$path" >> $trackingfile - done -} - -step() { - if ! grep -q "executed_step:$1" .dotfiles/pending_sync &> /dev/null; then - $(printf "__step_%s" "$1") - echo "executed_step:$1" >> .dotfiles/pending_sync - fi -} - -mkdir -p .dotfiles &> /dev/null -touch .dotfiles/pending_sync - -if [ -n "$1" ]; then - step $1 -else - echo "started_sync:$(date)" >> .dotfiles/log - step update - step install_package_list - step run_system_scripts - step run_user_scripts - step link_home - step overlay - echo "finished_sync:$(date)" >> .dotfiles/log -fi - -unlink .dotfiles/pending_sync diff --git a/unlink.sh b/unlink.sh deleted file mode 100644 index 44e593c..0000000 --- a/unlink.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -for linkfile in ${@:-$(find .dotfiles -type f -name *-links)}; do - echo "# processing linkfile $linkfile..." - for link in $(cat $linkfile); do - echo "# unlinking $link..." - unlink $link - done - rm -rf $linkfile -done \ No newline at end of file From 4d5e1112aaf5dc413f478ca6c8b9f38d9b4dd423 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:12 +0200 Subject: [PATCH 123/177] change behaviour to also update on apply --- crates/00-system/crate.arch.sh | 1 + crates/00-system/crate.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/00-system/crate.arch.sh b/crates/00-system/crate.arch.sh index ce3f7dd..2bdf8c5 100644 --- a/crates/00-system/crate.arch.sh +++ b/crates/00-system/crate.arch.sh @@ -1,4 +1,5 @@ super_apply() { + pacman -Syyu pacman -S --needed sudo reflector if ! grep -q "Reflector" /etc/pacman.d/mirrorlist; then cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak diff --git a/crates/00-system/crate.sh b/crates/00-system/crate.sh index 2a73944..5519bcb 100644 --- a/crates/00-system/crate.sh +++ b/crates/00-system/crate.sh @@ -1,6 +1,7 @@ #!/bin/sh describe="Install stuff on the system!" +scripts="@distro @self" super_apply() { cp files/sudoers /etc/sudoers From c61c65cde6c2edc2ee815af83703679d46f52c45 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:12 +0200 Subject: [PATCH 124/177] make sure the proper zshrc is used --- crates/10-zsh/crate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/10-zsh/crate.sh b/crates/10-zsh/crate.sh index 2e470d8..e08f719 100644 --- a/crates/10-zsh/crate.sh +++ b/crates/10-zsh/crate.sh @@ -32,6 +32,7 @@ apply() { [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR fi + unlink $HOME/.zshrc [ -e "$HOME/.zshrc" ] || ln files/.zshrc $HOME/.zshrc } From eca918c44c3e1a2302b37c36a90a9b52156239b2 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:12 +0200 Subject: [PATCH 125/177] woah so cool --- crates/10-zsh/files/.zshrc | 1 - crates/30-alacritty/crate.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 58358a2..c49eb5c 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -20,4 +20,3 @@ alias q="exit" fastfetch export PATH="${PATH}:/home/${USER}/.local/bin" -export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh" diff --git a/crates/30-alacritty/crate.sh b/crates/30-alacritty/crate.sh index 3a433d2..27f5762 100644 --- a/crates/30-alacritty/crate.sh +++ b/crates/30-alacritty/crate.sh @@ -4,6 +4,7 @@ describe="Installs alacritty and configs" scripts="@distro @self" apply() { + [ -d "$HOME/.config/alacritty" ] || mkdir -p $HOME/.config/alacritty [ -e "$HOME/.config/alacritty/alacritty.yml" ] || ln files/alacritty.yml $HOME/.config/alacritty/alacritty.yml } From 12d1401bdd976ef656d0c6842daa56069859120a Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:12 +0200 Subject: [PATCH 126/177] fix: add deps --- crates/05-i3/crate.arch.sh | 11 ++ crates/05-i3/crate.sh | 24 +++ crates/05-i3/files/40-proper-touchpad.conf | 8 + crates/05-i3/files/config | 214 +++++++++++++++++++++ crates/05-i3/files/status_config | 58 ++++++ 5 files changed, 315 insertions(+) create mode 100644 crates/05-i3/crate.arch.sh create mode 100644 crates/05-i3/crate.sh create mode 100644 crates/05-i3/files/40-proper-touchpad.conf create mode 100644 crates/05-i3/files/config create mode 100644 crates/05-i3/files/status_config diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh new file mode 100644 index 0000000..f87ce45 --- /dev/null +++ b/crates/05-i3/crate.arch.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu" + +super_apply() { + pacman -S --needed --noconfirm $pkgs +} + +super_undo() { + pacman -R --noconfirm $pkgs +} diff --git a/crates/05-i3/crate.sh b/crates/05-i3/crate.sh new file mode 100644 index 0000000..36c624e --- /dev/null +++ b/crates/05-i3/crate.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +describe="Installs i3" +scripts="@distro @self" + +apply() { + [ -d "$HOME/.config/i3" ] || mkdir -p $HOME/.config/i3 + [ -d "$HOME/.config/i3status" ] || mkdir -p $HOME/.config/i3status + [ -e "$HOME/.config/i3/config" ] || ln files/config $HOME/.config/i3/config + [ -e "$HOME/.config/i3status/config" ] || ln files/status_config $HOME/.config/i3status/config +} + +undo() { + rm $HOME/.config/i3/config + rm $HOME/.config/i3status/config +} + +super_apply() { + cp files/40-proper-touchpad.conf /etc/X11/xorg.conf.d/40-proper-touchpad.conf +} + +super_undo() { + rm /etc/X11/xorg.conf.d/40-proper-touchpad.conf +} diff --git a/crates/05-i3/files/40-proper-touchpad.conf b/crates/05-i3/files/40-proper-touchpad.conf new file mode 100644 index 0000000..80049de --- /dev/null +++ b/crates/05-i3/files/40-proper-touchpad.conf @@ -0,0 +1,8 @@ +Section "InputClass" + Identifier "libinput touchpad catchall" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + Driver "libinput" + Option "NaturalScrolling" "True" + Option "Tapping" "on" +EndSection diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config new file mode 100644 index 0000000..568e25a --- /dev/null +++ b/crates/05-i3/files/config @@ -0,0 +1,214 @@ +###################### +## Raine's i3 config ## +## Sept 2, 2023 ## +####################### + +## Mostly similar to i3's config yet differs + +# Useful variables: +# This section probably gets changed a lot +# --- +set $terminal alacritty +set $screen_lock i3lock -c "#111111" --nofork +set $appmenu i3-dmenu-desktop + +set $screenshot maim | xclip -selection clipboard -t image/png +set $alt_screenshot maim ~/Pictures/Screenshots/$(date +%s).png + +set $mod Mod4 +set $alt Mod1 +set $font pango:monospace 8 + +# Startup Applications: +# Things that will startup when starting i3. +# --- +exec --no-startup-id dex --autostart --environment i3 +exec --no-startup-id nm-applet +exec --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock + +# Extra variables: +# Only need changing for very specific installations. +# --- +set $audio_volume_up XF86AudioRaiseVolume +set $audio_volume_down XF86AudioLowerVolume +set $audio_mute XF86AudioMute +set $audio_mute_mic XF86AudioMicMute + +set $brightness_up XF86MonBrightnessUp +set $brightness_down XF86MonBrightnessDown + +set $nav_up l +set $nav_down k +set $nav_left j +set $nav_right semicolon + +set $ws_1 "1" +set $ws_2 "2" +set $ws_3 "3" +set $ws_4 "4" +set $ws_5 "5" +set $ws_6 "6" +set $ws_7 "7" +set $ws_8 "8" +set $ws_9 "9" +set $ws_10 "10" + +set $mode_resize_combo Mod4+r +set $mode_session_combo Mod4+Delete + +set $op_floating_modifier Mod1 + +set $meta_refresh_statusbar killall -SIGUSR1 i3status +bar { + status_command i3status +} + +# END OF CONFIG + +# Customization +#! Customization +# class border backgr. text indicator child_border +client.focused #D991BA #D27099 #ffffff #D96FBA #D951B0 +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 + +# Generic +floating_modifier $op_floating_modifier +tiling_drag modifier titlebar +font $font + +# Open a terminal +bindsym $mod+Return exec $terminal + +# Kill current window +bindsym $alt+Shift+q kill + +# Open app menu +bindsym $mod+Shift+d exec --no-startup-id $appmenu + +# Lock screen +bindsym $mod+l exec --no-startup-id $screen_lock + +# Screenshots +bindsym Print exec $screenshot +bindsym Mod1+Print exec $alt_screenshot + +# Audio +bindsym $audio_volume_up exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $meta_refresh_statusbar +bindsym $audio_volume_down exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $meta_refresh_statusbar +bindsym $audio_mute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $meta_refresh_statusbar +bindsym $audio_mute_mic exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $meta_refresh_statusbar + +# Brightness +bindsym $brightness_up exec --no-startup-id brightnessctl set +5% && $meta_refresh_statusbar +bindsym $brightness_down exec --no-startup-id brightnessctl set 5%- && $meta_refresh_statusbar + +# Change focused window +bindsym $alt+$nav_up focus up +bindsym $alt+$nav_down focus down +bindsym $alt+$nav_left focus left +bindsym $alt+$nav_right focus right +bindsym $alt+Up focus up +bindsym $alt+Down focus down +bindsym $alt+Left focus left +bindsym $alt+Right focus right + +# Move focused window +bindsym $alt+Shift+Up move up +bindsym $alt+Shift+Down move down +bindsym $alt+Shift+Left move left +bindsym $alt+Shift+Right move right +bindsym $alt+Shift+$nav_up move up +bindsym $alt+Shift+$nav_down move down +bindsym $alt+Shift+$nav_left move left +bindsym $alt+Shift+$nav_right move right + +# Splits +bindsym $alt+h split h +bindsym $alt+v split v + +# Make current window fullscreen +bindsym $alt+f fullscreen toggle + +# Change container layout +bindsym $mod+Mod1+s layout stacking +bindsym $mod+Mod1+t layout tabbed +bindsym $mod+Mod1+e layout toggle split + +# Floating stuff +bindsym $mod+Shift+space floating toggle +bindsym $alt+space focus mode_toggle + +# Scratchpad +bindsym $alt+minus move scratchpad +bindsym $mod+minus scratchpad show + +# Switch to workspace +bindsym $mod+1 workspace number $ws_1 +bindsym $mod+2 workspace number $ws_2 +bindsym $mod+3 workspace number $ws_3 +bindsym $mod+4 workspace number $ws_4 +bindsym $mod+5 workspace number $ws_5 +bindsym $mod+6 workspace number $ws_6 +bindsym $mod+7 workspace number $ws_7 +bindsym $mod+8 workspace number $ws_8 +bindsym $mod+9 workspace number $ws_9 +bindsym $mod+0 workspace number $ws_10 + +# Move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws_1 +bindsym $mod+Shift+2 move container to workspace number $ws_2 +bindsym $mod+Shift+3 move container to workspace number $ws_3 +bindsym $mod+Shift+4 move container to workspace number $ws_4 +bindsym $mod+Shift+5 move container to workspace number $ws_5 +bindsym $mod+Shift+6 move container to workspace number $ws_6 +bindsym $mod+Shift+7 move container to workspace number $ws_7 +bindsym $mod+Shift+8 move container to workspace number $ws_8 +bindsym $mod+Shift+9 move container to workspace number $ws_9 +bindsym $mod+Shift+0 move container to workspace number $ws_10 + +# Move to workspace next to current +bindsym $mod+$nav_left workspace prev +bindsym $mod+$nav_right workspace next +bindsym $mod+Left workspace prev +bindsym $mod+Right workspace next + +# WM stuff +# reload i3 config +bindsym $mod+Control+c reload +# restart i3 +bindsym $mod+Control+r restart +# exit i3 (recognized combo; for people who need to exit your session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes, exit i3' 'i3-msg exit'" + +# Modes +bindsym $mode_resize_combo mode resize +mode "resize" { + bindsym $nav_left resize shrink width 10 px or 10 ppt + bindsym $nav_down resize grow height 10 px or 10 ppt + bindsym $nav_up resize shrink height 10 px or 10 ppt + bindsym $nav_right resize grow width 10 px or 10 ppt + 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 + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mode_resize_combo mode "default" +} + +bindsym $mode_session_combo mode "session" +mode "session" { + bindsym l exec --no-startup-id $lock, mode "default" + bindsym e exec --no-startup-id i3-msg exit, 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" + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mode_session_combo mode "default" +} diff --git a/crates/05-i3/files/status_config b/crates/05-i3/files/status_config new file mode 100644 index 0000000..529f125 --- /dev/null +++ b/crates/05-i3/files/status_config @@ -0,0 +1,58 @@ +general { + output_format = "i3bar" + colors = true + interval = 5 +} + +order += "ipv6" +order += "disk /" +order += "wireless wlan0" +order += "battery 0" +order += "memory" +order += "load" +order += "tztime local" +order += "tztime berlin" + +wireless wlp58s0 { + format_up = "W: (%quality at %essid, %bitrate) %ip" + format_down = "W: down" +} + +battery 0 { + format = "%status %percentage %remaining %emptytime" + format_down = "No battery" + status_chr = "โšก CHR" + status_bat = "๐Ÿ”‹ BAT" + status_unk = "? UNK" + status_full = "โ˜ป FULL" + path = "/sys/class/power_supply/BAT%d/uevent" + low_threshold = 10 +} + +tztime local { + format = "%Y-%m-%d %H:%M:%S" + hide_if_equals_localtime = true +} + +tztime berlin { + format = "%Y-%m-%d %H:%M:%S %Z" + timezone = "Europe/Berlin" +} + +load { + format = "%5min" +} + +memory { + format = "%used" + threshold_degraded = "10%" + format_degraded = "MEMORY: %free" +} + +disk "/" { + format = "%free" +} + +read_file uptime { + path = "/proc/uptime" +} From feb470e71d72d15a219ab9592e8fab0d66a331bf Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:13 +0200 Subject: [PATCH 127/177] fix: config stuff --- crates/05-i3/files/config | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index 568e25a..26613d1 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -42,16 +42,16 @@ set $nav_down k set $nav_left j set $nav_right semicolon -set $ws_1 "1" -set $ws_2 "2" -set $ws_3 "3" -set $ws_4 "4" +set $ws_1 "main" +set $ws_2 "term" +set $ws_3 "browser" +set $ws_4 "mail" set $ws_5 "5" set $ws_6 "6" set $ws_7 "7" set $ws_8 "8" -set $ws_9 "9" -set $ws_10 "10" +set $ws_9 "background" +set $ws_10 "multimedia" set $mode_resize_combo Mod4+r set $mode_session_combo Mod4+Delete @@ -139,36 +139,36 @@ bindsym $mod+Mod1+t layout tabbed bindsym $mod+Mod1+e layout toggle split # Floating stuff -bindsym $mod+Shift+space floating toggle -bindsym $alt+space focus mode_toggle +bindsym $mod+space focus mode_toggle +bindsym $alt+space floating toggle # Scratchpad bindsym $alt+minus move scratchpad bindsym $mod+minus scratchpad show # Switch to workspace -bindsym $mod+1 workspace number $ws_1 -bindsym $mod+2 workspace number $ws_2 -bindsym $mod+3 workspace number $ws_3 -bindsym $mod+4 workspace number $ws_4 -bindsym $mod+5 workspace number $ws_5 -bindsym $mod+6 workspace number $ws_6 -bindsym $mod+7 workspace number $ws_7 -bindsym $mod+8 workspace number $ws_8 -bindsym $mod+9 workspace number $ws_9 -bindsym $mod+0 workspace number $ws_10 +bindsym $mod+1 workspace $ws_1 +bindsym $mod+2 workspace $ws_2 +bindsym $mod+3 workspace $ws_3 +bindsym $mod+4 workspace $ws_4 +bindsym $mod+5 workspace $ws_5 +bindsym $mod+6 workspace $ws_6 +bindsym $mod+7 workspace $ws_7 +bindsym $mod+8 workspace $ws_8 +bindsym $mod+9 workspace $ws_9 +bindsym $mod+0 workspace $ws_10 # Move focused container to workspace -bindsym $mod+Shift+1 move container to workspace number $ws_1 -bindsym $mod+Shift+2 move container to workspace number $ws_2 -bindsym $mod+Shift+3 move container to workspace number $ws_3 -bindsym $mod+Shift+4 move container to workspace number $ws_4 -bindsym $mod+Shift+5 move container to workspace number $ws_5 -bindsym $mod+Shift+6 move container to workspace number $ws_6 -bindsym $mod+Shift+7 move container to workspace number $ws_7 -bindsym $mod+Shift+8 move container to workspace number $ws_8 -bindsym $mod+Shift+9 move container to workspace number $ws_9 -bindsym $mod+Shift+0 move container to workspace number $ws_10 +bindsym $mod+Shift+1 move container to workspace $ws_1 +bindsym $mod+Shift+2 move container to workspace $ws_2 +bindsym $mod+Shift+3 move container to workspace $ws_3 +bindsym $mod+Shift+4 move container to workspace $ws_4 +bindsym $mod+Shift+5 move container to workspace $ws_5 +bindsym $mod+Shift+6 move container to workspace $ws_6 +bindsym $mod+Shift+7 move container to workspace $ws_7 +bindsym $mod+Shift+8 move container to workspace $ws_8 +bindsym $mod+Shift+9 move container to workspace $ws_9 +bindsym $mod+Shift+0 move container to workspace $ws_10 # Move to workspace next to current bindsym $mod+$nav_left workspace prev From 7d407d5b8a6a88a8f4237364539f61ee8cd790cb Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:13 +0200 Subject: [PATCH 128/177] fix: deps --- crates/05-i3/crate.arch.sh | 2 +- crates/05-i3/files/config | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh index f87ce45..ba1eeec 100644 --- a/crates/05-i3/crate.arch.sh +++ b/crates/05-i3/crate.arch.sh @@ -1,6 +1,6 @@ #!/bin/sh -pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu" +pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring" super_apply() { pacman -S --needed --noconfirm $pkgs diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index 26613d1..d6ec4d9 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -25,6 +25,7 @@ set $font pango:monospace 8 exec --no-startup-id dex --autostart --environment i3 exec --no-startup-id nm-applet exec --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock +exec --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11 # Extra variables: # Only need changing for very specific installations. From ae71a698f5410ed5757511e5b58a1a56ceab64ec Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:13 +0200 Subject: [PATCH 129/177] add optional sudo for work --- dot | 1 + 1 file changed, 1 insertion(+) diff --git a/dot b/dot index 7993255..bfcd9f0 100755 --- a/dot +++ b/dot @@ -18,6 +18,7 @@ include() { func() { if is_function $(echo "super_$2"); then + [ "${DO_SUDO:-yes}" = "yes" ] || return 0 sudo sh -c ". $1 && super_$2" fi is_function $2 && $2 From c3e1f11ca4de0f2dd5fbb8057295b698bdda345a Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:13 +0200 Subject: [PATCH 130/177] i don't need conformation, i need drugs --- crates/00-system/crate.arch.sh | 4 ++-- crates/10-zsh/crate.arch.sh | 4 ++-- crates/20-vim/crate.arch.sh | 2 +- crates/30-alacritty/crate.arch.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/00-system/crate.arch.sh b/crates/00-system/crate.arch.sh index 2bdf8c5..164fde4 100644 --- a/crates/00-system/crate.arch.sh +++ b/crates/00-system/crate.arch.sh @@ -1,6 +1,6 @@ super_apply() { - pacman -Syyu - pacman -S --needed sudo reflector + pacman -Syyu --noconfirm + pacman -S --needed --noconfirm sudo reflector if ! grep -q "Reflector" /etc/pacman.d/mirrorlist; then cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist diff --git a/crates/10-zsh/crate.arch.sh b/crates/10-zsh/crate.arch.sh index b44c9ed..5e00687 100644 --- a/crates/10-zsh/crate.arch.sh +++ b/crates/10-zsh/crate.arch.sh @@ -1,7 +1,7 @@ super_apply() { - pacman -S --needed zsh cmake + pacman -S --needed --noconfirm zsh cmake } super_undo() { - pacman -R zsh + pacman -R --noconfirm zsh } \ No newline at end of file diff --git a/crates/20-vim/crate.arch.sh b/crates/20-vim/crate.arch.sh index d95ce2d..e114bc1 100644 --- a/crates/20-vim/crate.arch.sh +++ b/crates/20-vim/crate.arch.sh @@ -1,5 +1,5 @@ super_apply() { - pacman -S --needed vim + pacman -S --needed --noconfirm vim } super_undo() { diff --git a/crates/30-alacritty/crate.arch.sh b/crates/30-alacritty/crate.arch.sh index a91b78b..068ee1c 100644 --- a/crates/30-alacritty/crate.arch.sh +++ b/crates/30-alacritty/crate.arch.sh @@ -1,5 +1,5 @@ super_apply() { - pacman -S --needed alacritty + pacman -S --needed --noconfirm alacritty } super_undo() { From 6cc200a620fbca37501e3a3529bbfbdee97a141e Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:13 +0200 Subject: [PATCH 131/177] fix: no confirm --- crates/30-alacritty/crate.arch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/30-alacritty/crate.arch.sh b/crates/30-alacritty/crate.arch.sh index 068ee1c..cc95257 100644 --- a/crates/30-alacritty/crate.arch.sh +++ b/crates/30-alacritty/crate.arch.sh @@ -3,5 +3,5 @@ super_apply() { } super_undo() { - pacman -R alacritty + pacman -R --noconfirm alacritty } \ No newline at end of file From c611ae32b3f54bbcdfabdbf68313ee5a49213bfa Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:13 +0200 Subject: [PATCH 132/177] fix: numbering --- crates/05-i3/files/config | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index d6ec4d9..8e72cfd 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -43,16 +43,16 @@ set $nav_down k set $nav_left j set $nav_right semicolon -set $ws_1 "main" -set $ws_2 "term" -set $ws_3 "browser" -set $ws_4 "mail" +set $ws_1 "1:main" +set $ws_2 "2:term" +set $ws_3 "3:browser" +set $ws_4 "4:mail" set $ws_5 "5" set $ws_6 "6" set $ws_7 "7" set $ws_8 "8" -set $ws_9 "background" -set $ws_10 "multimedia" +set $ws_9 "9:background" +set $ws_10 "10:multimedia" set $mode_resize_combo Mod4+r set $mode_session_combo Mod4+Delete @@ -61,6 +61,7 @@ set $op_floating_modifier Mod1 set $meta_refresh_statusbar killall -SIGUSR1 i3status bar { + strip_workspace_numbers yes status_command i3status } From 52e756594e48c2dff9bbffb08ca0447651dbf1ee Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:14 +0200 Subject: [PATCH 133/177] fix: i3status --- crates/05-i3/files/status_config | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/05-i3/files/status_config b/crates/05-i3/files/status_config index 529f125..3fce4a7 100644 --- a/crates/05-i3/files/status_config +++ b/crates/05-i3/files/status_config @@ -5,13 +5,12 @@ general { } order += "ipv6" -order += "disk /" -order += "wireless wlan0" +order += "wireless wlp58s0" order += "battery 0" +order += "disk /" order += "memory" order += "load" order += "tztime local" -order += "tztime berlin" wireless wlp58s0 { format_up = "W: (%quality at %essid, %bitrate) %ip" @@ -31,7 +30,7 @@ battery 0 { tztime local { format = "%Y-%m-%d %H:%M:%S" - hide_if_equals_localtime = true + hide_if_equals_localtime = false } tztime berlin { From 9ccf7dc4449b03ce465b60bf256eb92fa81e1c11 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:14 +0200 Subject: [PATCH 134/177] add git support --- crates/40-git/crate.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 crates/40-git/crate.sh diff --git a/crates/40-git/crate.sh b/crates/40-git/crate.sh new file mode 100644 index 0000000..524f9bc --- /dev/null +++ b/crates/40-git/crate.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +describe="Setup git" +scripts="@distro @self" + +apply() { + git config --global user.signingkey 01E71F18AA4398E5 + git config --global user.name Raine + git config --global user.email raine@ixvd.net +} From 5d479b646cc582479c5e16285bd537769baf1f79 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:14 +0200 Subject: [PATCH 135/177] feat: enabled opt --- dot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dot b/dot index bfcd9f0..6c2a942 100755 --- a/dot +++ b/dot @@ -41,10 +41,14 @@ get_command() { # only run this *in crate dir* run_crate() { + enabled=1 include ./crate.sh || exit 1 if [ -n "$describe" ]; then echo "desc($(basename $PWD)): $describe" fi + if [ $enabled -ne 1 ]; then + return + fi cmd=$(get_command $1) scripts=${scripts:-"@self @distro"} for s in $scripts; do From bf6f76c2152ef1e59ecc410a8140330094b33adb Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:14 +0200 Subject: [PATCH 136/177] add: ssh authorized_keys --- crates/01-ssh/crate.sh | 17 +++++++++++++++++ crates/01-ssh/files/authorized_keys | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 crates/01-ssh/crate.sh create mode 100644 crates/01-ssh/files/authorized_keys diff --git a/crates/01-ssh/crate.sh b/crates/01-ssh/crate.sh new file mode 100644 index 0000000..2c187de --- /dev/null +++ b/crates/01-ssh/crate.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +describe="setup ssh" + +apply() { + [ -e "$HOME/.ssh/authorized_keys" ] || ln files/authorized_keys $HOME/.ssh/authorized_keys + if ! [ -f "$HOME/.ssh/id_rsa" ]; then + echo "Creating new ssh key for this device..." + ssh-keygen -f $HOME/.ssh/id_rsa -p "" -q + echo "Adding key to authorized_keys..." + cat $HOME/.ssh/id_rsa.pub > $HOME/.ssh/authorized_keys + fi +} + +undo() { + echo "Undoing ssh keys is not supported, please do this manually." +} \ No newline at end of file diff --git a/crates/01-ssh/files/authorized_keys b/crates/01-ssh/files/authorized_keys new file mode 100644 index 0000000..abd2989 --- /dev/null +++ b/crates/01-ssh/files/authorized_keys @@ -0,0 +1,2 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= raine@ryuk +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPLKzkRko5pgr7tvQWL4cbOdrK5QLxzpp5lALPAB6YR0M7wnuOgGp36Eb/nXE4IKVUMErsQnUxVAZxHF6wi7c6noWmIk+X/qHgElZOKbAb7erwEs1+XWUO8HCofm8LZ/7VRB98w3yoqKzZTWuGh2VzkbnARxkIhwEYCXfQ0ySr9FpRvdXj0Bq3ZP/ymGOuT6O5D7z09mHGBTnIyMsb6VibE+6M4Li6i4whC8WijRVfH2RIBA5FuA+o/yAAma+DGHXYMI3wlCZPdnnk2A+87n5kPAugOGFGWbzbQup/ssXZqd5NIm3csXdGW3sOtpUZsGDjjC7RgVWGx1UxI1PXtoix9kmuStMe497LK8lAjBgwM96hjgC5MsFtujSSS7+bgLIfYrpSie2s6Bcde+kv8c0EibxYu6yxWhRPRj1bbjuecr2znwAqFNuiQjZKjCJCUGojbep2MgswwnY0f7kRronk2igIpC1Cb9YdV/NPPp5SqSdAZ8b18LUSqcJc/60ESvE= raine@neo \ No newline at end of file From 22c1e0eb6a4c6d9ba04e899085b65cca053b0a15 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:14 +0200 Subject: [PATCH 137/177] add: pam stuff --- crates/00-system/crate.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/00-system/crate.sh b/crates/00-system/crate.sh index 5519bcb..10d248e 100644 --- a/crates/00-system/crate.sh +++ b/crates/00-system/crate.sh @@ -5,4 +5,8 @@ scripts="@distro @self" super_apply() { cp files/sudoers /etc/sudoers + if [ -f /usr/lib/security/pam_wheel.so ] && ! grep -q "# pam_wheel.so added" /etc/pam.d/su; then + echo "auth sufficient pam_wheel.so trust use_uid" > /etc/pam.d/su + echo "# pam_wheel.so added" > /etc/pam.d/su + done } \ No newline at end of file From 5f8272a0128cc02a289b8391ecfda3fb162b11d7 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:14 +0200 Subject: [PATCH 138/177] add update dotfiles function --- crates/10-zsh/files/.zshrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index c49eb5c..c75277d 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -16,6 +16,13 @@ alias nobeep="sudo modprobe -r pcspkr" alias s="title $HOST && cmatrix -rs && clear" alias q="exit" +update_dotfiles() { + cd $HOME/.dotfiles + git pull + cd - &> /dev/null +} +alias udf="update_dotfiles" + # COSMETICS fastfetch From 2e923144b93984aef03588200435278f61709d7a Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:15 +0200 Subject: [PATCH 139/177] fix: crate proper closer --- crates/00-system/crate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/00-system/crate.sh b/crates/00-system/crate.sh index 10d248e..9ff0516 100644 --- a/crates/00-system/crate.sh +++ b/crates/00-system/crate.sh @@ -8,5 +8,5 @@ super_apply() { if [ -f /usr/lib/security/pam_wheel.so ] && ! grep -q "# pam_wheel.so added" /etc/pam.d/su; then echo "auth sufficient pam_wheel.so trust use_uid" > /etc/pam.d/su echo "# pam_wheel.so added" > /etc/pam.d/su - done + fi } \ No newline at end of file From 1ae541027e0d032d44fcf4c9dd50d33955e0ae3e Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:15 +0200 Subject: [PATCH 140/177] fix: unlink cmd --- crates/10-zsh/crate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/10-zsh/crate.sh b/crates/10-zsh/crate.sh index e08f719..c67edb8 100644 --- a/crates/10-zsh/crate.sh +++ b/crates/10-zsh/crate.sh @@ -32,7 +32,7 @@ apply() { [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR fi - unlink $HOME/.zshrc + [ -f "$HOME/.zshrc" ] && unlink $HOME/.zshrc [ -e "$HOME/.zshrc" ] || ln files/.zshrc $HOME/.zshrc } From 4035af56c8478362a6c1bb08e7bf542d1ed6cd7b Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:15 +0200 Subject: [PATCH 141/177] feat: remove fastfetch --- crates/10-zsh/crate.sh | 11 ----------- crates/10-zsh/files/.zshrc | 3 --- 2 files changed, 14 deletions(-) diff --git a/crates/10-zsh/crate.sh b/crates/10-zsh/crate.sh index c67edb8..2c06c84 100644 --- a/crates/10-zsh/crate.sh +++ b/crates/10-zsh/crate.sh @@ -4,17 +4,6 @@ describe="Install zsh and oh-my-zsh!" scripts="@distro @self" super_apply() { - [ -d /tmp/fastfetch ] || git clone https://github.com/LinusDierheimer/fastfetch /tmp/fastfetch - - if ! command -v fastfetch &> /dev/null; then - cd /tmp/fastfetch - mkdir -p build - cd build - cmake .. - cmake --build . --target fastfetch - mv fastfetch /usr/local/bin/fastfetch - fi - usermod $USER --shell /bin/zsh } diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index c75277d..6f027bf 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -23,7 +23,4 @@ update_dotfiles() { } alias udf="update_dotfiles" -# COSMETICS -fastfetch - export PATH="${PATH}:/home/${USER}/.local/bin" From d23ec4c9ba62743d689b50723b85d80b0719fb98 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:15 +0200 Subject: [PATCH 142/177] fix: add all sudo groups --- crates/00-system/files/sudoers | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/00-system/files/sudoers b/crates/00-system/files/sudoers index e77799b..fe82c3f 100644 --- a/crates/00-system/files/sudoers +++ b/crates/00-system/files/sudoers @@ -1,4 +1,6 @@ root ALL=(ALL:ALL) ALL %wheel ALL=(ALL:ALL) ALL +%docker ALL=(ALL:ALL) ALL +%sudo ALL=(ALL:ALL) ALL %root ALL=(ALL:ALL) NOPASSWD: ALL @includedir /etc/sudoers.d From 2ccb7476b6916e74e2866d43308ce56971a1f468 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:15 +0200 Subject: [PATCH 143/177] add details --- dot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dot b/dot index 6c2a942..38b1c13 100755 --- a/dot +++ b/dot @@ -73,6 +73,11 @@ run_crate() { done } +echo "# details:" +echo "# user: $USER ($UID)" +echo "# groups: $(groups)" +echo "# distro: $(curr_distro)" + if [ $# -eq 2 ]; then [ -d crates/*$1 ] || exit 1 cd crates/*$1 From 39b5ef0b93e494974dd720b07c3f94e729eb30db Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:15 +0200 Subject: [PATCH 144/177] remove cmake --- crates/10-zsh/crate.arch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/10-zsh/crate.arch.sh b/crates/10-zsh/crate.arch.sh index 5e00687..598a08c 100644 --- a/crates/10-zsh/crate.arch.sh +++ b/crates/10-zsh/crate.arch.sh @@ -1,5 +1,5 @@ super_apply() { - pacman -S --needed --noconfirm zsh cmake + pacman -S --needed --noconfirm zsh } super_undo() { From aff59e42bd576e6c42d3a5718733a929d7597fb3 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:16 +0200 Subject: [PATCH 145/177] add debian support --- crates/00-system/crate.debian.sh | 5 +++++ crates/10-zsh/crate.debian.sh | 7 +++++++ crates/20-vim/crate.debian.sh | 7 +++++++ 3 files changed, 19 insertions(+) create mode 100644 crates/00-system/crate.debian.sh create mode 100644 crates/10-zsh/crate.debian.sh create mode 100644 crates/20-vim/crate.debian.sh diff --git a/crates/00-system/crate.debian.sh b/crates/00-system/crate.debian.sh new file mode 100644 index 0000000..b866807 --- /dev/null +++ b/crates/00-system/crate.debian.sh @@ -0,0 +1,5 @@ +super_apply() { + apt update -y + apt install -y netselect-apt sudo + netselect-apt +} \ No newline at end of file diff --git a/crates/10-zsh/crate.debian.sh b/crates/10-zsh/crate.debian.sh new file mode 100644 index 0000000..7f0af81 --- /dev/null +++ b/crates/10-zsh/crate.debian.sh @@ -0,0 +1,7 @@ +super_apply() { + apt install -y zsh +} + +super_undo() { + pacman -R --noconfirm zsh +} \ No newline at end of file diff --git a/crates/20-vim/crate.debian.sh b/crates/20-vim/crate.debian.sh new file mode 100644 index 0000000..ba156fd --- /dev/null +++ b/crates/20-vim/crate.debian.sh @@ -0,0 +1,7 @@ +super_apply() { + apt install -y vim +} + +super_undo() { + echo "we never uninstall vim -_-" +} \ No newline at end of file From 8ce67d022a7da3c1e98dde0097db19aa19a4f3e8 Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:16 +0200 Subject: [PATCH 146/177] fix: good print screen --- crates/05-i3/files/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index 8e72cfd..568134a 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -12,7 +12,7 @@ set $terminal alacritty set $screen_lock i3lock -c "#111111" --nofork set $appmenu i3-dmenu-desktop -set $screenshot maim | xclip -selection clipboard -t image/png +set $screenshot maim -s | xclip -selection clipboard -t image/png set $alt_screenshot maim ~/Pictures/Screenshots/$(date +%s).png set $mod Mod4 From 1411eddc4b891a6a5f55f339941973a218b83ccf Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:16 +0200 Subject: [PATCH 147/177] feat: remote script --- remote_script.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 remote_script.sh diff --git a/remote_script.sh b/remote_script.sh new file mode 100644 index 0000000..517668b --- /dev/null +++ b/remote_script.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# this script is meant to be ran when .dotfiles is not present. +# +# example: +# curl https://git.ixvd.net/raine/dotfiles/raw/branch/main/remote_script.sh | sh + +git clone https://git.ixvd.net/raine/dotfiles $HOME/.dotfiles +cd $HOME/.dotfiles +./dot a From a2cb1cd00999ecb64e84f9bf548a0ba2e13d1dfa Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:16 +0200 Subject: [PATCH 148/177] doc: readme file --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b630725 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Raine's Dotfiles + +## Crates +Everything is a crate. +If something is distro specific you should follow the following naming scheme: +`crate..sh` + +## Using it +Just use the script tbh +```sh +curl -L https://via.ixvd.net/sh | sh +``` \ No newline at end of file From 6762a87b832aba1823ba87daa8a0612b48cf59cc Mon Sep 17 00:00:00 2001 From: Raine Date: Sat, 14 Oct 2023 22:38:16 +0200 Subject: [PATCH 149/177] feat: zsh --- crates/10-zsh/files/.zshrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 6f027bf..6a11cad 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -23,4 +23,18 @@ update_dotfiles() { } alias udf="update_dotfiles" +0file() { curl -F"file=@$1" {0} ; } +0pb() { curl -F"file=@-;" https://envs.sh ; } +0url() { curl -F"url=$1" https://envs.sh ; } +0short() { curl -F"shorten=$1" https://envs.sh ; } + + export PATH="${PATH}:/home/${USER}/.local/bin" + +# pnpm +export PNPM_HOME="/home/raine/.local/share/pnpm" +case ":$PATH:" in + *":$PNPM_HOME:"*) ;; + *) export PATH="$PNPM_HOME:$PATH" ;; +esac +# pnpm end \ No newline at end of file From c8610fb3fd5b726f76f6a1d9c82b1f1bb67b837e Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 16 Nov 2023 15:43:34 +0100 Subject: [PATCH 150/177] feat: add void --- crates/00-system/crate.sh | 1 - crates/00-system/files/sudoers | 6 ------ crates/01-ssh/files/authorized_keys | 3 +-- crates/05-i3/crate.void.sh | 12 ++++++++++++ crates/10-zsh/crate.void.sh | 10 ++++++++++ crates/10-zsh/files/.zshrc | 15 +++++++++------ crates/20-vim/crate.void.sh | 7 +++++++ crates/30-alacritty/crate.void.sh | 7 +++++++ crates/40-git/crate.sh | 1 - 9 files changed, 46 insertions(+), 16 deletions(-) delete mode 100644 crates/00-system/files/sudoers create mode 100644 crates/05-i3/crate.void.sh create mode 100644 crates/10-zsh/crate.void.sh create mode 100644 crates/20-vim/crate.void.sh create mode 100644 crates/30-alacritty/crate.void.sh diff --git a/crates/00-system/crate.sh b/crates/00-system/crate.sh index 9ff0516..c5c5965 100644 --- a/crates/00-system/crate.sh +++ b/crates/00-system/crate.sh @@ -4,7 +4,6 @@ describe="Install stuff on the system!" scripts="@distro @self" super_apply() { - cp files/sudoers /etc/sudoers if [ -f /usr/lib/security/pam_wheel.so ] && ! grep -q "# pam_wheel.so added" /etc/pam.d/su; then echo "auth sufficient pam_wheel.so trust use_uid" > /etc/pam.d/su echo "# pam_wheel.so added" > /etc/pam.d/su diff --git a/crates/00-system/files/sudoers b/crates/00-system/files/sudoers deleted file mode 100644 index fe82c3f..0000000 --- a/crates/00-system/files/sudoers +++ /dev/null @@ -1,6 +0,0 @@ -root ALL=(ALL:ALL) ALL -%wheel ALL=(ALL:ALL) ALL -%docker ALL=(ALL:ALL) ALL -%sudo ALL=(ALL:ALL) ALL -%root ALL=(ALL:ALL) NOPASSWD: ALL -@includedir /etc/sudoers.d diff --git a/crates/01-ssh/files/authorized_keys b/crates/01-ssh/files/authorized_keys index abd2989..b8f3fd6 100644 --- a/crates/01-ssh/files/authorized_keys +++ b/crates/01-ssh/files/authorized_keys @@ -1,2 +1 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= raine@ryuk -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPLKzkRko5pgr7tvQWL4cbOdrK5QLxzpp5lALPAB6YR0M7wnuOgGp36Eb/nXE4IKVUMErsQnUxVAZxHF6wi7c6noWmIk+X/qHgElZOKbAb7erwEs1+XWUO8HCofm8LZ/7VRB98w3yoqKzZTWuGh2VzkbnARxkIhwEYCXfQ0ySr9FpRvdXj0Bq3ZP/ymGOuT6O5D7z09mHGBTnIyMsb6VibE+6M4Li6i4whC8WijRVfH2RIBA5FuA+o/yAAma+DGHXYMI3wlCZPdnnk2A+87n5kPAugOGFGWbzbQup/ssXZqd5NIm3csXdGW3sOtpUZsGDjjC7RgVWGx1UxI1PXtoix9kmuStMe497LK8lAjBgwM96hjgC5MsFtujSSS7+bgLIfYrpSie2s6Bcde+kv8c0EibxYu6yxWhRPRj1bbjuecr2znwAqFNuiQjZKjCJCUGojbep2MgswwnY0f7kRronk2igIpC1Cb9YdV/NPPp5SqSdAZ8b18LUSqcJc/60ESvE= raine@neo \ No newline at end of file +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= raine@ryuk \ No newline at end of file diff --git a/crates/05-i3/crate.void.sh b/crates/05-i3/crate.void.sh new file mode 100644 index 0000000..1a7d575 --- /dev/null +++ b/crates/05-i3/crate.void.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +pkgs="i3 i3lock i3status pulseaudio-devel brightnessctl xss-lock dex maim dmenu gnome-keyring" + +super_apply() { + xbps-install -y $pkgs +} + +super_undo() { + xbps-remove -y $pkgs +} + diff --git a/crates/10-zsh/crate.void.sh b/crates/10-zsh/crate.void.sh new file mode 100644 index 0000000..19d54d1 --- /dev/null +++ b/crates/10-zsh/crate.void.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +super_apply() { + xbps-install -y zsh +} + +super_undo() { + xbps-remove -y zsh +} + diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 6a11cad..6ae0dcd 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -23,11 +23,14 @@ update_dotfiles() { } alias udf="update_dotfiles" -0file() { curl -F"file=@$1" {0} ; } -0pb() { curl -F"file=@-;" https://envs.sh ; } -0url() { curl -F"url=$1" https://envs.sh ; } -0short() { curl -F"shorten=$1" https://envs.sh ; } - +function share_cdn() { + if ! [ -f "$1" ]; then + echo "file needs to exist" + return 1 + fi + scp $1 keymaker:/usr/share/cdn/random/$2 > /dev/null + echo "https://cdn.ixvd.net/random/${2:-$(basename $1)}" +} export PATH="${PATH}:/home/${USER}/.local/bin" @@ -37,4 +40,4 @@ case ":$PATH:" in *":$PNPM_HOME:"*) ;; *) export PATH="$PNPM_HOME:$PATH" ;; esac -# pnpm end \ No newline at end of file +# pnpm end diff --git a/crates/20-vim/crate.void.sh b/crates/20-vim/crate.void.sh new file mode 100644 index 0000000..8fab1a3 --- /dev/null +++ b/crates/20-vim/crate.void.sh @@ -0,0 +1,7 @@ +super_apply() { + xbps-install -y vim +} + +super_undo() { + echo "we never uninstall vim -_-" +} \ No newline at end of file diff --git a/crates/30-alacritty/crate.void.sh b/crates/30-alacritty/crate.void.sh new file mode 100644 index 0000000..4312e25 --- /dev/null +++ b/crates/30-alacritty/crate.void.sh @@ -0,0 +1,7 @@ +super_apply() { + xbps-install -y alacritty +} + +super_undo() { + xbps-remove -y alacritty +} \ No newline at end of file diff --git a/crates/40-git/crate.sh b/crates/40-git/crate.sh index 524f9bc..0579e1f 100644 --- a/crates/40-git/crate.sh +++ b/crates/40-git/crate.sh @@ -4,7 +4,6 @@ describe="Setup git" scripts="@distro @self" apply() { - git config --global user.signingkey 01E71F18AA4398E5 git config --global user.name Raine git config --global user.email raine@ixvd.net } From 7e0ad304164a12d1f209f4009c49c0128de6924f Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 16 Nov 2023 15:52:49 +0100 Subject: [PATCH 151/177] fix: remote_script.sh --- remote_script.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/remote_script.sh b/remote_script.sh index 517668b..74bdbe6 100644 --- a/remote_script.sh +++ b/remote_script.sh @@ -5,6 +5,8 @@ # example: # curl https://git.ixvd.net/raine/dotfiles/raw/branch/main/remote_script.sh | sh -git clone https://git.ixvd.net/raine/dotfiles $HOME/.dotfiles +HOME=${HOME:-/home/${USER:-$(whomai)}} + +[ -f "$HOME/.dotfiles" ] || git clone https://git.ixvd.net/raine/dotfiles $HOME/.dotfiles cd $HOME/.dotfiles ./dot a From ce35ef4a578540e1bc71e9e8b14989a7e66cfab5 Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 16 Nov 2023 15:53:33 +0100 Subject: [PATCH 152/177] fix: it's a dir --- remote_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote_script.sh b/remote_script.sh index 74bdbe6..fee8f05 100644 --- a/remote_script.sh +++ b/remote_script.sh @@ -7,6 +7,6 @@ HOME=${HOME:-/home/${USER:-$(whomai)}} -[ -f "$HOME/.dotfiles" ] || git clone https://git.ixvd.net/raine/dotfiles $HOME/.dotfiles +[ -d "$HOME/.dotfiles" ] || git clone https://git.ixvd.net/raine/dotfiles $HOME/.dotfiles cd $HOME/.dotfiles ./dot a From 89c6f9f0a997efe563aa428e5eed32072e906665 Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 16 Nov 2023 15:54:49 +0100 Subject: [PATCH 153/177] fix: X11 --- crates/05-i3/crate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/05-i3/crate.sh b/crates/05-i3/crate.sh index 36c624e..53a3f77 100644 --- a/crates/05-i3/crate.sh +++ b/crates/05-i3/crate.sh @@ -16,6 +16,7 @@ undo() { } super_apply() { + [ -d "/etc/X11/xorg.conf.d" ] || mkdir -p /etc/X11/xorg.conf.d/ cp files/40-proper-touchpad.conf /etc/X11/xorg.conf.d/40-proper-touchpad.conf } From 6fa8cbeee21ae74a6c18a9fe4a64cfb8562d0be6 Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 16 Nov 2023 15:58:35 +0100 Subject: [PATCH 154/177] fix: id --- dot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dot b/dot index 38b1c13..2bb2b0f 100755 --- a/dot +++ b/dot @@ -74,7 +74,7 @@ run_crate() { } echo "# details:" -echo "# user: $USER ($UID)" +echo "# user: $USER (${UID:-$(id -u)})" echo "# groups: $(groups)" echo "# distro: $(curr_distro)" From a2ce697b175d8078af324cf69b5ad22000c2abb2 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:03:45 +0100 Subject: [PATCH 155/177] feat: update files --- crates/10-zsh/files/.zshrc | 21 +++++---------------- crates/20-vim/files/.vimrc | 1 + 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 6ae0dcd..8ba260d 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -1,9 +1,9 @@ +#!/bin/zsh + +# Raine's .zshrc + export GPG_TTY=$(tty) - -# paths -export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" - -# ZSH +export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$HOME/.local/bin" export ZSH="$HOME/.oh-my-zsh" ZSH_THEME="afowler" @@ -12,7 +12,6 @@ source $ZSH/oh-my-zsh.sh # ALIASES alias open="xdg-open" -alias nobeep="sudo modprobe -r pcspkr" alias s="title $HOST && cmatrix -rs && clear" alias q="exit" @@ -31,13 +30,3 @@ function share_cdn() { scp $1 keymaker:/usr/share/cdn/random/$2 > /dev/null echo "https://cdn.ixvd.net/random/${2:-$(basename $1)}" } - -export PATH="${PATH}:/home/${USER}/.local/bin" - -# pnpm -export PNPM_HOME="/home/raine/.local/share/pnpm" -case ":$PATH:" in - *":$PNPM_HOME:"*) ;; - *) export PATH="$PNPM_HOME:$PATH" ;; -esac -# pnpm end diff --git a/crates/20-vim/files/.vimrc b/crates/20-vim/files/.vimrc index abb89b3..8f61924 100644 --- a/crates/20-vim/files/.vimrc +++ b/crates/20-vim/files/.vimrc @@ -1,2 +1,3 @@ set number set relativenumber +syntax on From 0cd1c2011b146927bf8383039109b2749ec4f73a Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:07:02 +0100 Subject: [PATCH 156/177] fix: add more zsh stuff --- crates/10-zsh/files/.zshrc | 39 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 8ba260d..1334f5c 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -1,32 +1,35 @@ #!/bin/zsh -# Raine's .zshrc +# Raine's .zshrc +export EDITOR=vim export GPG_TTY=$(tty) export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$HOME/.local/bin" -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 - -# ALIASES -alias open="xdg-open" -alias s="title $HOST && cmatrix -rs && clear" -alias q="exit" +# oh-my-zsh init +if [ -f "$HOME/.oh-my-zsh/oh-my-zsh.sh" ]; then + 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 +else + echo "oh-my-zsh not detected :(" + PS1="$(whoami)@$(hostname) $ " +fi update_dotfiles() { cd $HOME/.dotfiles git pull cd - &> /dev/null } -alias udf="update_dotfiles" -function share_cdn() { - if ! [ -f "$1" ]; then - echo "file needs to exist" - return 1 - fi - scp $1 keymaker:/usr/share/cdn/random/$2 > /dev/null - echo "https://cdn.ixvd.net/random/${2:-$(basename $1)}" +share_cdn() { + if ! [ -f "$1" ]; then + echo "file needs to exist" + return 1 + fi + scp $1 keymaker:/usr/share/cdn/random/$2 > /dev/null + echo "https://cdn.ixvd.net/random/${2:-$(basename $1)}" } + +alias q="exit" \ No newline at end of file From daa0507b474c1ca70893451b3e83f5a2c7a1d06f Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:10:55 +0100 Subject: [PATCH 157/177] fix: smart sudo --- dot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dot b/dot index 2bb2b0f..398ca9f 100755 --- a/dot +++ b/dot @@ -19,7 +19,8 @@ include() { func() { if is_function $(echo "super_$2"); then [ "${DO_SUDO:-yes}" = "yes" ] || return 0 - sudo sh -c ". $1 && super_$2" + cmd="sh -c \". $1 && super_$2\"" + [ "$(id -u)" = "0" ] && $cmd || sudo $cmd fi is_function $2 && $2 } From 11d5c2f3e2f93024f06e4e04593df3bb6675d768 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:11:59 +0100 Subject: [PATCH 158/177] fix: no errs please --- remote_script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/remote_script.sh b/remote_script.sh index fee8f05..c0b656a 100644 --- a/remote_script.sh +++ b/remote_script.sh @@ -5,6 +5,8 @@ # example: # curl https://git.ixvd.net/raine/dotfiles/raw/branch/main/remote_script.sh | sh +set -e + HOME=${HOME:-/home/${USER:-$(whomai)}} [ -d "$HOME/.dotfiles" ] || git clone https://git.ixvd.net/raine/dotfiles $HOME/.dotfiles From 0e0bdb4aef6ce8a04721a195c2a00d15228c0257 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:12:59 +0100 Subject: [PATCH 159/177] fix: shell --- dot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dot b/dot index 398ca9f..ed8b427 100755 --- a/dot +++ b/dot @@ -19,8 +19,8 @@ include() { func() { if is_function $(echo "super_$2"); then [ "${DO_SUDO:-yes}" = "yes" ] || return 0 - cmd="sh -c \". $1 && super_$2\"" - [ "$(id -u)" = "0" ] && $cmd || sudo $cmd + cmd=". $1 && super_$2" + [ "$(id -u)" = "0" ] && sh -c "$cmd" || sudo sh -c "$cmd" fi is_function $2 && $2 } From c7957ac270b65e8c92cc3723b5b607f83056a3f4 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:17:17 +0100 Subject: [PATCH 160/177] fix: variables are hard --- dot | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dot b/dot index ed8b427..17ee37d 100755 --- a/dot +++ b/dot @@ -19,8 +19,9 @@ include() { func() { if is_function $(echo "super_$2"); then [ "${DO_SUDO:-yes}" = "yes" ] || return 0 - cmd=". $1 && super_$2" - [ "$(id -u)" = "0" ] && sh -c "$cmd" || sudo sh -c "$cmd" + ecmd=". $1 && super_$2" + [ "$(id -u)" = "0" ] && sh -c "$ecmd" || sudo sh -c "$ecmd" + unset ecmd fi is_function $2 && $2 } From 02ace21e60f456a1d23e9a0c1dea6e561f11d96b Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:18:33 +0100 Subject: [PATCH 161/177] fix: hostname --- crates/10-zsh/files/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 1334f5c..6ce5b9b 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -14,7 +14,7 @@ if [ -f "$HOME/.oh-my-zsh/oh-my-zsh.sh" ]; then source $ZSH/oh-my-zsh.sh else echo "oh-my-zsh not detected :(" - PS1="$(whoami)@$(hostname) $ " + PS1="$(whoami)@${HOSTNAME:-$(hostname)} $ " fi update_dotfiles() { From 9f33f3e258644a2c2918aec7aab699688c1cda22 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:19:47 +0100 Subject: [PATCH 162/177] feat: add container function --- crates/10-zsh/files/.zshrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 6ce5b9b..ec5a17b 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -32,4 +32,13 @@ share_cdn() { echo "https://cdn.ixvd.net/random/${2:-$(basename $1)}" } +container() { + docker run \ + -ti \ + --rm \ + --name tmp-$(id -u)-$(openssl rand -hex 8) \ + alpine \ + ash +} + alias q="exit" \ No newline at end of file From 9f7579a55e4dd6efac37f5f7b322ba16c538fd95 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 01:21:13 +0100 Subject: [PATCH 163/177] feat: container function --- crates/10-zsh/files/.zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index ec5a17b..5e5ea4e 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -37,6 +37,7 @@ container() { -ti \ --rm \ --name tmp-$(id -u)-$(openssl rand -hex 8) \ + --network ${CONTAINER_NETWORK:-internal} \ alpine \ ash } From 7e009a8b506343c2cdee59be69ceddf5e3178a36 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 15:42:05 +0100 Subject: [PATCH 164/177] fix: the one true vim --- crates/10-zsh/files/.zshrc | 3 ++- crates/20-vim/crate.sh | 4 ++-- crates/20-vim/files/.nvimrc | 17 +++++++++++++++++ crates/20-vim/files/.vimrc | 3 --- 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 crates/20-vim/files/.nvimrc delete mode 100644 crates/20-vim/files/.vimrc diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 5e5ea4e..ffbebf3 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -42,4 +42,5 @@ container() { ash } -alias q="exit" \ No newline at end of file +alias q="exit" +alias vim="nvim" \ No newline at end of file diff --git a/crates/20-vim/crate.sh b/crates/20-vim/crate.sh index 3210eac..2b465b1 100644 --- a/crates/20-vim/crate.sh +++ b/crates/20-vim/crate.sh @@ -4,11 +4,11 @@ describe="Install vim and it's stuff" scripts="@distro @self" apply() { - [ -e "$HOME/.vimrc" ] || ln files/.vimrc $HOME/.vimrc + [ -e "$HOME/.nvimrc" ] || ln files/.nvimrc $HOME/.nvimrc [ -e "$HOME/.ideavimrc" ] || ln files/.ideavimrc $HOME/.ideavimrc } undo() { - unlink $HOME/.vimrc + unlink $HOME/.nvimrc unlink $HOME/.ideavimrc } \ No newline at end of file diff --git a/crates/20-vim/files/.nvimrc b/crates/20-vim/files/.nvimrc new file mode 100644 index 0000000..c50c376 --- /dev/null +++ b/crates/20-vim/files/.nvimrc @@ -0,0 +1,17 @@ +" vim preferences +set number +set relativenumber +syntax on + +" ensure vim-plug +let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +if empty(glob(data_dir . '/autoload/plug.vim')) + silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif + +call plug#begin() + +Plug 'ThePrimeagen/vim-be-good' + +call plug#end() diff --git a/crates/20-vim/files/.vimrc b/crates/20-vim/files/.vimrc deleted file mode 100644 index 8f61924..0000000 --- a/crates/20-vim/files/.vimrc +++ /dev/null @@ -1,3 +0,0 @@ -set number -set relativenumber -syntax on From 058e23302bbf21fac013e355fee95ce284069f90 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 15:47:41 +0100 Subject: [PATCH 165/177] fix: the one true vim --- crates/20-vim/crate.arch.sh | 2 +- crates/20-vim/crate.debian.sh | 2 +- crates/20-vim/crate.sh | 5 +++-- crates/20-vim/crate.void.sh | 2 +- crates/20-vim/files/{.nvimrc => init.vim} | 0 5 files changed, 6 insertions(+), 5 deletions(-) rename crates/20-vim/files/{.nvimrc => init.vim} (100%) diff --git a/crates/20-vim/crate.arch.sh b/crates/20-vim/crate.arch.sh index e114bc1..3d97b3c 100644 --- a/crates/20-vim/crate.arch.sh +++ b/crates/20-vim/crate.arch.sh @@ -1,5 +1,5 @@ super_apply() { - pacman -S --needed --noconfirm vim + pacman -S --needed --noconfirm neovim } super_undo() { diff --git a/crates/20-vim/crate.debian.sh b/crates/20-vim/crate.debian.sh index ba156fd..a6d8e34 100644 --- a/crates/20-vim/crate.debian.sh +++ b/crates/20-vim/crate.debian.sh @@ -1,5 +1,5 @@ super_apply() { - apt install -y vim + apt install -y neovim } super_undo() { diff --git a/crates/20-vim/crate.sh b/crates/20-vim/crate.sh index 2b465b1..b3b82e0 100644 --- a/crates/20-vim/crate.sh +++ b/crates/20-vim/crate.sh @@ -4,11 +4,12 @@ describe="Install vim and it's stuff" scripts="@distro @self" apply() { - [ -e "$HOME/.nvimrc" ] || ln files/.nvimrc $HOME/.nvimrc + [ -d "$HOME/.config/nvim" ] || mkdir -p "$HOME/.config/nvim" + [ -e "$HOME/.config/nvim/init.vim" ] || ln files/init.vim $HOME/.config/nvim/init.vim [ -e "$HOME/.ideavimrc" ] || ln files/.ideavimrc $HOME/.ideavimrc } undo() { - unlink $HOME/.nvimrc + unlink $HOME/.config/nvim/init.vim unlink $HOME/.ideavimrc } \ No newline at end of file diff --git a/crates/20-vim/crate.void.sh b/crates/20-vim/crate.void.sh index 8fab1a3..1b3e1e8 100644 --- a/crates/20-vim/crate.void.sh +++ b/crates/20-vim/crate.void.sh @@ -1,5 +1,5 @@ super_apply() { - xbps-install -y vim + xbps-install -y neovim } super_undo() { diff --git a/crates/20-vim/files/.nvimrc b/crates/20-vim/files/init.vim similarity index 100% rename from crates/20-vim/files/.nvimrc rename to crates/20-vim/files/init.vim From 28ca2f79bed2364ce1ac6e092cbaec0a5d976178 Mon Sep 17 00:00:00 2001 From: Raine Date: Sun, 19 Nov 2023 16:22:49 +0100 Subject: [PATCH 166/177] feat: add some vim plugins --- crates/20-vim/files/init.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/20-vim/files/init.vim b/crates/20-vim/files/init.vim index c50c376..dd8917e 100644 --- a/crates/20-vim/files/init.vim +++ b/crates/20-vim/files/init.vim @@ -3,6 +3,12 @@ set number set relativenumber syntax on +" No arrow keys +noremap +noremap +noremap +noremap + " ensure vim-plug let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' if empty(glob(data_dir . '/autoload/plug.vim')) @@ -13,5 +19,8 @@ endif call plug#begin() Plug 'ThePrimeagen/vim-be-good' +Plug 'machakann/vim-highlightedyank' +Plug 'tpope/vim-commentary' +Plug 'wellle/targets.vim' -call plug#end() +call plug#end() \ No newline at end of file From c9010fe6978f78ea61e1710bc5a674ec9769300c Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 7 Mar 2024 14:25:45 +0100 Subject: [PATCH 167/177] feat: i3 update & other minor stuff --- configs/example/crate.toml | 27 ++++++ crates/05-i3/files/config | 129 +++++++++++++--------------- crates/10-zsh/files/.zshrc | 9 +- crates/20-vim/files/init.vim | 3 +- crates/90-backups/crate.debian.sh | 8 ++ crates/90-backups/crate.sh | 4 + crates/90-backups/scripts/backup.sh | 41 +++++++++ crates/90-backups/scripts/setup.sh | 10 +++ crates/90-backups/scripts/sync.sh | 11 +++ 9 files changed, 169 insertions(+), 73 deletions(-) create mode 100644 configs/example/crate.toml create mode 100644 crates/90-backups/crate.debian.sh create mode 100644 crates/90-backups/crate.sh create mode 100644 crates/90-backups/scripts/backup.sh create mode 100644 crates/90-backups/scripts/setup.sh create mode 100644 crates/90-backups/scripts/sync.sh diff --git a/configs/example/crate.toml b/configs/example/crate.toml new file mode 100644 index 0000000..b8c6d3a --- /dev/null +++ b/configs/example/crate.toml @@ -0,0 +1,27 @@ +name = "example" #* +description = "hello" +author = ":$3" + +# [ LINKS ] +# This defines what links should be made. +# vars: +# "$CRATE" expands to path of directory of this file. +# "$CROOT" expands to base directory / cwd from the runner +# prefixes: +# "#" - system root +# "~" - home of user or user defined in options +# "%" - temp directory +[links] +"$CRATE/system.sh" = { name = "/etc/system_boot", su = "true" } +"$CRATE/system2.sh" = "#/etc/system_boot.sh" # same as above + +# [ COPIES ] +# basically the same as links but copies +[copies] +"$CRATE/system3.sh" = "#/etc/system_boot.sh" # same as above + +# [ SCRIPTS ] +# Run stuff +[scripts] +"$CRATE/system/net_config.sh" = 1 +"$CRATE/system/net_config2.sh" = { su = "false" } diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index 568134a..2513d5a 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -13,19 +13,26 @@ set $screen_lock i3lock -c "#111111" --nofork set $appmenu i3-dmenu-desktop set $screenshot maim -s | xclip -selection clipboard -t image/png -set $alt_screenshot maim ~/Pictures/Screenshots/$(date +%s).png -set $mod Mod4 -set $alt Mod1 set $font pango:monospace 8 # Startup Applications: # Things that will startup when starting i3. # --- -exec --no-startup-id dex --autostart --environment i3 -exec --no-startup-id nm-applet -exec --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock -exec --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11 +exec_always --no-startup-id dex --autostart --environment i3 +exec_always --no-startup-id nm-applet +exec_always --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock +exec_always --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11 +exec_always --no-startup-id feh --bg-fill ~/Pictures/wallpaper.jpg + + +# Gaps & Borders: +# --- +gaps inner 20 +smart_gaps on + +default_border pixel 1 +hide_edge_borders smart_no_gaps # Extra variables: # Only need changing for very specific installations. @@ -38,26 +45,16 @@ set $audio_mute_mic XF86AudioMicMute set $brightness_up XF86MonBrightnessUp set $brightness_down XF86MonBrightnessDown -set $nav_up l -set $nav_down k -set $nav_left j -set $nav_right semicolon - set $ws_1 "1:main" set $ws_2 "2:term" -set $ws_3 "3:browser" +set $ws_3 "3:docs" set $ws_4 "4:mail" set $ws_5 "5" set $ws_6 "6" set $ws_7 "7" set $ws_8 "8" -set $ws_9 "9:background" -set $ws_10 "10:multimedia" - -set $mode_resize_combo Mod4+r -set $mode_session_combo Mod4+Delete - -set $op_floating_modifier Mod1 +set $ws_9 "9:bg" +set $ws_10 "10:misc" set $meta_refresh_statusbar killall -SIGUSR1 i3status bar { @@ -67,18 +64,21 @@ bar { # END OF CONFIG +set $mod Mod4 +set $alt Mod1 + # Customization -#! Customization -# class border backgr. text indicator child_border -client.focused #D991BA #D27099 #ffffff #D96FBA #D951B0 -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 + +# class border backgr. text indic. child_border +client.focused #81A1C1 #81A1C1 #ffffff #D8DEE9 +client.focused_inactive #2E3440 #2E3440 #88C0D0 #454948 +client.unfocused #2E3440 #2E3440 #88C0D0 #454948 +client.urgent #D08770 #3B4252 #ffffff #268BD2 +client.placeholder #000000 #0c0c0c #ffffff #000000 +client.background #3B4252 # Generic -floating_modifier $op_floating_modifier +floating_modifier $mod tiling_drag modifier titlebar font $font @@ -86,17 +86,16 @@ font $font bindsym $mod+Return exec $terminal # Kill current window -bindsym $alt+Shift+q kill +bindsym $mod+$alt+q kill # Open app menu -bindsym $mod+Shift+d exec --no-startup-id $appmenu +bindsym $mod+d exec --no-startup-id $appmenu # Lock screen bindsym $mod+l exec --no-startup-id $screen_lock # Screenshots bindsym Print exec $screenshot -bindsym Mod1+Print exec $alt_screenshot # Audio bindsym $audio_volume_up exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $meta_refresh_statusbar @@ -109,43 +108,35 @@ bindsym $brightness_up exec --no-startup-id brightnessctl set +5% && $meta_refre bindsym $brightness_down exec --no-startup-id brightnessctl set 5%- && $meta_refresh_statusbar # Change focused window -bindsym $alt+$nav_up focus up -bindsym $alt+$nav_down focus down -bindsym $alt+$nav_left focus left -bindsym $alt+$nav_right focus right -bindsym $alt+Up focus up -bindsym $alt+Down focus down -bindsym $alt+Left focus left -bindsym $alt+Right focus right +bindsym $mod+Up focus up +bindsym $mod+Down focus down +bindsym $mod+Left focus left +bindsym $mod+Right focus right # Move focused window -bindsym $alt+Shift+Up move up -bindsym $alt+Shift+Down move down -bindsym $alt+Shift+Left move left -bindsym $alt+Shift+Right move right -bindsym $alt+Shift+$nav_up move up -bindsym $alt+Shift+$nav_down move down -bindsym $alt+Shift+$nav_left move left -bindsym $alt+Shift+$nav_right move right +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Right move right # Splits -bindsym $alt+h split h -bindsym $alt+v split v - -# Make current window fullscreen -bindsym $alt+f fullscreen toggle +bindsym $mod+Shift+h split h +bindsym $mod+Shift+v split v # Change container layout -bindsym $mod+Mod1+s layout stacking -bindsym $mod+Mod1+t layout tabbed -bindsym $mod+Mod1+e layout toggle split +bindsym $mod+Shift+s layout stacking +bindsym $mod+Shift+t layout tabbed +bindsym $mod+Shift+d layout toggle split + +# Make current window fullscreen +bindsym $mod+Shift+f fullscreen toggle # Floating stuff bindsym $mod+space focus mode_toggle -bindsym $alt+space floating toggle +bindsym $mod+Shift+space floating toggle # Scratchpad -bindsym $alt+minus move scratchpad +bindsym $mod+Shift+minus move scratchpad bindsym $mod+minus scratchpad show # Switch to workspace @@ -172,22 +163,20 @@ bindsym $mod+Shift+8 move container to workspace $ws_8 bindsym $mod+Shift+9 move container to workspace $ws_9 bindsym $mod+Shift+0 move container to workspace $ws_10 -# Move to workspace next to current -bindsym $mod+$nav_left workspace prev -bindsym $mod+$nav_right workspace next -bindsym $mod+Left workspace prev -bindsym $mod+Right workspace next +# Move through workspaces +bindsym $mod+$alt+Left workspace prev +bindsym $mod+$alt+Right workspace next # WM stuff # reload i3 config -bindsym $mod+Control+c reload +bindsym $mod+$alt+c reload # restart i3 -bindsym $mod+Control+r restart -# exit i3 (recognized combo; for people who need to exit your session) +bindsym $mod+$alt+r restart +# exit i3 bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes, exit i3' 'i3-msg exit'" # Modes -bindsym $mode_resize_combo mode resize +bindsym $mod+r mode resize mode "resize" { bindsym $nav_left resize shrink width 10 px or 10 ppt bindsym $nav_down resize grow height 10 px or 10 ppt @@ -200,10 +189,10 @@ mode "resize" { bindsym Return mode "default" bindsym Escape mode "default" - bindsym $mode_resize_combo mode "default" + bindsym $mod+r mode "default" } -bindsym $mode_session_combo mode "session" +bindsym $mod+s mode "session" mode "session" { bindsym l exec --no-startup-id $lock, mode "default" bindsym e exec --no-startup-id i3-msg exit, mode "default" @@ -212,5 +201,5 @@ mode "session" { bindsym Return mode "default" bindsym Escape mode "default" - bindsym $mode_session_combo mode "default" + bindsym $mod+s mode "default" } diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index ffbebf3..59de2d8 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -2,6 +2,10 @@ # Raine's .zshrc +if ! [ "$PROFILEINC" = "1" ]; then + . ~/.profile +fi + export EDITOR=vim export GPG_TTY=$(tty) export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$HOME/.local/bin" @@ -10,7 +14,7 @@ export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$ if [ -f "$HOME/.oh-my-zsh/oh-my-zsh.sh" ]; then export ZSH="$HOME/.oh-my-zsh" ZSH_THEME="afowler" - plugins=(git docker docker-compose node zsh-autosuggestions zsh-syntax-highlighting) + plugins=(git docker docker-compose node zsh-autosuggestions zsh-syntax-highlighting zsh-cargo-completion) source $ZSH/oh-my-zsh.sh else echo "oh-my-zsh not detected :(" @@ -43,4 +47,5 @@ container() { } alias q="exit" -alias vim="nvim" \ No newline at end of file +alias vim="nvim" +alias vi="nvim" diff --git a/crates/20-vim/files/init.vim b/crates/20-vim/files/init.vim index dd8917e..d87f89e 100644 --- a/crates/20-vim/files/init.vim +++ b/crates/20-vim/files/init.vim @@ -22,5 +22,6 @@ Plug 'ThePrimeagen/vim-be-good' Plug 'machakann/vim-highlightedyank' Plug 'tpope/vim-commentary' Plug 'wellle/targets.vim' +Plug 'vim-scripts/loremipsum' -call plug#end() \ No newline at end of file +call plug#end() diff --git a/crates/90-backups/crate.debian.sh b/crates/90-backups/crate.debian.sh new file mode 100644 index 0000000..e49c6e4 --- /dev/null +++ b/crates/90-backups/crate.debian.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +apply() { + echo "------------ WARNING ------------" + echo "BACKUPS ARE NOT SETUP ON DEBIAN! " + echo " PLEASE SETUP MANUALLY " + echo "---------------------------------" +} \ No newline at end of file diff --git a/crates/90-backups/crate.sh b/crates/90-backups/crate.sh new file mode 100644 index 0000000..98297e4 --- /dev/null +++ b/crates/90-backups/crate.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +describe="Setup restic backups" +scripts="@distro" # only distro \ No newline at end of file diff --git a/crates/90-backups/scripts/backup.sh b/crates/90-backups/scripts/backup.sh new file mode 100644 index 0000000..850c168 --- /dev/null +++ b/crates/90-backups/scripts/backup.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +HOSTNAME=${HOSTNAME:-$(hostname)} + +log() { + echo "log: $@" + if [ -f "/var/backups/ntfy.env" ]; then + . /var/backups/ntfy.env + curl \ + -s \ + -d "$@" \ + ${NTFY_URL:-https://push.ixvd.net/logs} + fi +} + +log starting backup for $HOSTNAME +restic \ + -r /var/backups/$HOSTNAME \ + -p /var/backups/$HOSTNAME.secret \ + backup \ + --tag auto \ + --exclude-caches \ + --exclude dist \ + --exclude target \ + --exclude node_modules \ + --exclude bin \ + --exclude .cache \ + --exclude '.config/*/cache' \ + --exclude '.config/*/Cache' \ + --exclude .cargo/git \ + --exclude .cargo/registry \ + --exclude '.rustup' \ + --exclude '.local' \ + --exclude '.var' \ + --exclude Steam \ + --exclude '.config/Code' \ + --exclude '.config/Code - OSS' \ + --exclude 'code/linux' \ + --exclude Downloads \ + /srv /home /etc +log backup finished with $? \ No newline at end of file diff --git a/crates/90-backups/scripts/setup.sh b/crates/90-backups/scripts/setup.sh new file mode 100644 index 0000000..d4a598d --- /dev/null +++ b/crates/90-backups/scripts/setup.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +HOSTNAME=${HOSTNAME:-$(hostname)} + +[ -d "/var/backups" ] || mkdir -p /var/backups +[ -f "/var/backups/$HOSTNAME.secret" ] || openssl rand -hex 64 > /var/backups/$HOSTNAME.secret + +restic init \ + -r /var/backups/$HOSTNAME \ + -p /var/backups/$HOSTNAME.secret \ No newline at end of file diff --git a/crates/90-backups/scripts/sync.sh b/crates/90-backups/scripts/sync.sh new file mode 100644 index 0000000..6b58e5f --- /dev/null +++ b/crates/90-backups/scripts/sync.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# sync backup to *the* external + +HOSTNAME=${HOSTNAME:-$(hostname)} + +set -e + +rsync \ + --info=progress2 \ + -avzylu \ \ No newline at end of file From 04d15ad27dba13866a42d13a944e2b380825805e Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 7 Mar 2024 14:26:35 +0100 Subject: [PATCH 168/177] fix: feh dep --- crates/05-i3/crate.arch.sh | 2 +- crates/05-i3/crate.void.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh index ba1eeec..5c0684d 100644 --- a/crates/05-i3/crate.arch.sh +++ b/crates/05-i3/crate.arch.sh @@ -1,6 +1,6 @@ #!/bin/sh -pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring" +pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring feh" super_apply() { pacman -S --needed --noconfirm $pkgs diff --git a/crates/05-i3/crate.void.sh b/crates/05-i3/crate.void.sh index 1a7d575..d080b85 100644 --- a/crates/05-i3/crate.void.sh +++ b/crates/05-i3/crate.void.sh @@ -1,6 +1,6 @@ #!/bin/sh -pkgs="i3 i3lock i3status pulseaudio-devel brightnessctl xss-lock dex maim dmenu gnome-keyring" +pkgs="i3 i3lock i3status pulseaudio-devel brightnessctl xss-lock dex maim dmenu gnome-keyring feh" super_apply() { xbps-install -y $pkgs From 37c7eaf334575b251749bff105f4279158fb1c92 Mon Sep 17 00:00:00 2001 From: Raine Date: Fri, 22 Mar 2024 10:04:21 +0100 Subject: [PATCH 169/177] feat: stuff --- crates/05-i3/crate.arch.sh | 2 +- crates/05-i3/crate.sh | 1 + crates/05-i3/crate.void.sh | 2 +- crates/05-i3/files/config | 11 ++++++----- crates/05-i3/files/picom.conf | 9 +++++++++ crates/10-zsh/files/.zshrc | 4 +++- scripts/void.d/update-discord.sh | 13 +++++++++++++ 7 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 crates/05-i3/files/picom.conf create mode 100755 scripts/void.d/update-discord.sh diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh index 5c0684d..41e73a0 100644 --- a/crates/05-i3/crate.arch.sh +++ b/crates/05-i3/crate.arch.sh @@ -1,6 +1,6 @@ #!/bin/sh -pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring feh" +pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" super_apply() { pacman -S --needed --noconfirm $pkgs diff --git a/crates/05-i3/crate.sh b/crates/05-i3/crate.sh index 53a3f77..09edde5 100644 --- a/crates/05-i3/crate.sh +++ b/crates/05-i3/crate.sh @@ -8,6 +8,7 @@ apply() { [ -d "$HOME/.config/i3status" ] || mkdir -p $HOME/.config/i3status [ -e "$HOME/.config/i3/config" ] || ln files/config $HOME/.config/i3/config [ -e "$HOME/.config/i3status/config" ] || ln files/status_config $HOME/.config/i3status/config + [ -e "$HOME/.config/picom.conf" ] || ln files/picom.conf $HOME/.config/picom.conf } undo() { diff --git a/crates/05-i3/crate.void.sh b/crates/05-i3/crate.void.sh index d080b85..3f7f59b 100644 --- a/crates/05-i3/crate.void.sh +++ b/crates/05-i3/crate.void.sh @@ -1,6 +1,6 @@ #!/bin/sh -pkgs="i3 i3lock i3status pulseaudio-devel brightnessctl xss-lock dex maim dmenu gnome-keyring feh" +pkgs="i3 i3lock i3status pulseaudio-devel brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" super_apply() { xbps-install -y $pkgs diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config index 2513d5a..d08481b 100644 --- a/crates/05-i3/files/config +++ b/crates/05-i3/files/config @@ -1,6 +1,7 @@ -###################### +####################### ## Raine's i3 config ## -## Sept 2, 2023 ## +## Mar 22, 2023 ## +## mutation: 1m ## ####################### ## Mostly similar to i3's config yet differs @@ -24,11 +25,11 @@ exec_always --no-startup-id nm-applet exec_always --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock exec_always --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11 exec_always --no-startup-id feh --bg-fill ~/Pictures/wallpaper.jpg - +exec_always --no-startup-id picom # Gaps & Borders: # --- -gaps inner 20 +gaps inner 10 smart_gaps on default_border pixel 1 @@ -95,7 +96,7 @@ bindsym $mod+d exec --no-startup-id $appmenu bindsym $mod+l exec --no-startup-id $screen_lock # Screenshots -bindsym Print exec $screenshot +bindsym Print exec --no-startup-id $screenshot # Audio bindsym $audio_volume_up exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $meta_refresh_statusbar diff --git a/crates/05-i3/files/picom.conf b/crates/05-i3/files/picom.conf new file mode 100644 index 0000000..5bff83a --- /dev/null +++ b/crates/05-i3/files/picom.conf @@ -0,0 +1,9 @@ +inactive-opacity = 0.75; + +blur: { + method = "box"; + size = 10; + background = false; + background-frame = false; + background-fixed = false; +} diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index 59de2d8..c730706 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -2,7 +2,7 @@ # Raine's .zshrc -if ! [ "$PROFILEINC" = "1" ]; then +if [ "$PROFILEINC" = "1" ]; then . ~/.profile fi @@ -46,6 +46,8 @@ container() { ash } +[ -f "$HOME/.config/i3/shortcuts-i3.sh" ] && . ~/.config/i3/shortcuts-i3.sh + alias q="exit" alias vim="nvim" alias vi="nvim" diff --git a/scripts/void.d/update-discord.sh b/scripts/void.d/update-discord.sh new file mode 100755 index 0000000..5c753c6 --- /dev/null +++ b/scripts/void.d/update-discord.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +echo "Downloading newest package..." +curl -Lo /tmp/discord.deb "https://discord.com/api/download?platform=linux&format=deb" +cd /tmp +echo "Extracting package..." +xdeb discord.deb +echo "Installing package..." +sudo xbps-install -R /tmp/binpkgs discord +rm -rf /tmp/binpkgs +cd - From f9907d9a71cdafe0bf5d6ae5c29fde9bdca5c7a0 Mon Sep 17 00:00:00 2001 From: Raine Date: Tue, 4 Jun 2024 14:29:51 +0200 Subject: [PATCH 170/177] cleanup --- configs/example/crate.toml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 configs/example/crate.toml diff --git a/configs/example/crate.toml b/configs/example/crate.toml deleted file mode 100644 index b8c6d3a..0000000 --- a/configs/example/crate.toml +++ /dev/null @@ -1,27 +0,0 @@ -name = "example" #* -description = "hello" -author = ":$3" - -# [ LINKS ] -# This defines what links should be made. -# vars: -# "$CRATE" expands to path of directory of this file. -# "$CROOT" expands to base directory / cwd from the runner -# prefixes: -# "#" - system root -# "~" - home of user or user defined in options -# "%" - temp directory -[links] -"$CRATE/system.sh" = { name = "/etc/system_boot", su = "true" } -"$CRATE/system2.sh" = "#/etc/system_boot.sh" # same as above - -# [ COPIES ] -# basically the same as links but copies -[copies] -"$CRATE/system3.sh" = "#/etc/system_boot.sh" # same as above - -# [ SCRIPTS ] -# Run stuff -[scripts] -"$CRATE/system/net_config.sh" = 1 -"$CRATE/system/net_config2.sh" = { su = "false" } From dd70dd0ad404585be2c4ef2e58009ee5e2063f2f Mon Sep 17 00:00:00 2001 From: Raine Date: Tue, 4 Jun 2024 14:30:25 +0200 Subject: [PATCH 171/177] fix: url --- remote_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remote_script.sh b/remote_script.sh index c0b656a..8866057 100644 --- a/remote_script.sh +++ b/remote_script.sh @@ -3,12 +3,12 @@ # this script is meant to be ran when .dotfiles is not present. # # example: -# curl https://git.ixvd.net/raine/dotfiles/raw/branch/main/remote_script.sh | sh +# curl https://git.saluco.nl/strix/dotfiles/raw/branch/main/remote_script.sh | sh set -e HOME=${HOME:-/home/${USER:-$(whomai)}} -[ -d "$HOME/.dotfiles" ] || git clone https://git.ixvd.net/raine/dotfiles $HOME/.dotfiles +[ -d "$HOME/.dotfiles" ] || git clone https://git.saluco.nl/strix/dotfiles $HOME/.dotfiles cd $HOME/.dotfiles ./dot a From ba52a96a6010709620add8092b46f038c607779f Mon Sep 17 00:00:00 2001 From: Strix Date: Tue, 4 Jun 2024 14:43:05 +0200 Subject: [PATCH 172/177] fix: stuff --- crates/01-ssh/files/authorized_keys | 2 +- crates/40-git/crate.sh | 4 +- crates/90-backups/crate.debian.sh | 8 --- crates/90-backups/crate.sh | 4 -- crates/90-backups/scripts/backup.sh | 41 --------------- crates/90-backups/scripts/setup.sh | 10 ---- crates/90-backups/scripts/sync.sh | 11 ---- dot | 80 +++++++++++++---------------- 8 files changed, 39 insertions(+), 121 deletions(-) delete mode 100644 crates/90-backups/crate.debian.sh delete mode 100644 crates/90-backups/crate.sh delete mode 100644 crates/90-backups/scripts/backup.sh delete mode 100644 crates/90-backups/scripts/setup.sh delete mode 100644 crates/90-backups/scripts/sync.sh diff --git a/crates/01-ssh/files/authorized_keys b/crates/01-ssh/files/authorized_keys index b8f3fd6..7115b29 100644 --- a/crates/01-ssh/files/authorized_keys +++ b/crates/01-ssh/files/authorized_keys @@ -1 +1 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= raine@ryuk \ No newline at end of file +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= strix@ryuk \ No newline at end of file diff --git a/crates/40-git/crate.sh b/crates/40-git/crate.sh index 0579e1f..e9376ac 100644 --- a/crates/40-git/crate.sh +++ b/crates/40-git/crate.sh @@ -4,6 +4,6 @@ describe="Setup git" scripts="@distro @self" apply() { - git config --global user.name Raine - git config --global user.email raine@ixvd.net + git config --global user.name Strix + git config --global user.email strix@saluco.nl } diff --git a/crates/90-backups/crate.debian.sh b/crates/90-backups/crate.debian.sh deleted file mode 100644 index e49c6e4..0000000 --- a/crates/90-backups/crate.debian.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -apply() { - echo "------------ WARNING ------------" - echo "BACKUPS ARE NOT SETUP ON DEBIAN! " - echo " PLEASE SETUP MANUALLY " - echo "---------------------------------" -} \ No newline at end of file diff --git a/crates/90-backups/crate.sh b/crates/90-backups/crate.sh deleted file mode 100644 index 98297e4..0000000 --- a/crates/90-backups/crate.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -describe="Setup restic backups" -scripts="@distro" # only distro \ No newline at end of file diff --git a/crates/90-backups/scripts/backup.sh b/crates/90-backups/scripts/backup.sh deleted file mode 100644 index 850c168..0000000 --- a/crates/90-backups/scripts/backup.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -HOSTNAME=${HOSTNAME:-$(hostname)} - -log() { - echo "log: $@" - if [ -f "/var/backups/ntfy.env" ]; then - . /var/backups/ntfy.env - curl \ - -s \ - -d "$@" \ - ${NTFY_URL:-https://push.ixvd.net/logs} - fi -} - -log starting backup for $HOSTNAME -restic \ - -r /var/backups/$HOSTNAME \ - -p /var/backups/$HOSTNAME.secret \ - backup \ - --tag auto \ - --exclude-caches \ - --exclude dist \ - --exclude target \ - --exclude node_modules \ - --exclude bin \ - --exclude .cache \ - --exclude '.config/*/cache' \ - --exclude '.config/*/Cache' \ - --exclude .cargo/git \ - --exclude .cargo/registry \ - --exclude '.rustup' \ - --exclude '.local' \ - --exclude '.var' \ - --exclude Steam \ - --exclude '.config/Code' \ - --exclude '.config/Code - OSS' \ - --exclude 'code/linux' \ - --exclude Downloads \ - /srv /home /etc -log backup finished with $? \ No newline at end of file diff --git a/crates/90-backups/scripts/setup.sh b/crates/90-backups/scripts/setup.sh deleted file mode 100644 index d4a598d..0000000 --- a/crates/90-backups/scripts/setup.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -HOSTNAME=${HOSTNAME:-$(hostname)} - -[ -d "/var/backups" ] || mkdir -p /var/backups -[ -f "/var/backups/$HOSTNAME.secret" ] || openssl rand -hex 64 > /var/backups/$HOSTNAME.secret - -restic init \ - -r /var/backups/$HOSTNAME \ - -p /var/backups/$HOSTNAME.secret \ No newline at end of file diff --git a/crates/90-backups/scripts/sync.sh b/crates/90-backups/scripts/sync.sh deleted file mode 100644 index 6b58e5f..0000000 --- a/crates/90-backups/scripts/sync.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# sync backup to *the* external - -HOSTNAME=${HOSTNAME:-$(hostname)} - -set -e - -rsync \ - --info=progress2 \ - -avzylu \ \ No newline at end of file diff --git a/dot b/dot index 17ee37d..6a0f50d 100755 --- a/dot +++ b/dot @@ -3,7 +3,7 @@ ask=0 is_function() { - type "$1" 2> /dev/null | sed "s/$1//" | grep -qwi function + type "$1" 2>/dev/null | sed "s/$1//" | grep -qwi function } curr_distro() { @@ -23,22 +23,7 @@ func() { [ "$(id -u)" = "0" ] && sh -c "$ecmd" || sudo sh -c "$ecmd" unset ecmd fi - is_function $2 && $2 -} - -get_command() { - case $1 in - a*) - printf "apply" - ;; - u*) - printf "undo" - ;; - *) - echo "err: not supported" >&2 - exit 1 - ;; - esac + is_function $2 && $2 } # only run this *in crate dir* @@ -51,25 +36,25 @@ run_crate() { if [ $enabled -ne 1 ]; then return fi - cmd=$(get_command $1) + cmd=$1 scripts=${scripts:-"@self @distro"} - for s in $scripts; do + for s in $scripts; do echo "exec($(basename $PWD)): $s/$cmd" case $s in - @self) - func ./crate.sh $cmd + @self) + func ./crate.sh $cmd ;; - @distro) - unset -f super_$cmd - unset -f $cmd - include ./crate.$(curr_distro).sh - func ./crate.$(curr_distro).sh $cmd - unset -f super_$cmd - unset -f $cmd - include ./crate.sh + @distro) + unset -f super_$cmd + unset -f $cmd + include ./crate.$(curr_distro).sh + func ./crate.$(curr_distro).sh $cmd + unset -f super_$cmd + unset -f $cmd + include ./crate.sh ;; - *) - sh $s + *) + sh $s ;; esac done @@ -80,18 +65,25 @@ echo "# user: $USER (${UID:-$(id -u)})" echo "# groups: $(groups)" echo "# distro: $(curr_distro)" -if [ $# -eq 2 ]; then - [ -d crates/*$1 ] || exit 1 - cd crates/*$1 - run_crate $2 - cd ../.. -else - [ $# -eq 0 ] && exit 2 - for crate in $(find ./crates -mindepth 1 -maxdepth 1 -type d | sort); do - cd $crate - run_crate $1 - cd ../.. - done +cmd=$1 +if [ -z "$cmd" ]; then + echo "usage: $0 [...args]" + exit 1 +else + shift fi - \ No newline at end of file +for c in ${@:-$(ls crates)}; do + [ -d crates/*$c ] || exit 1 + cd crates/*$c + case $cmd in + a | apply) + run_crate apply + ;; + u | undo) + run_crate undo + ;; + *) exit 1 ;; + esac + cd ../.. +done From 1573398e8d3322ca9c91b7a237ea7667f63b51b0 Mon Sep 17 00:00:00 2001 From: Strix Date: Sun, 12 Jan 2025 18:52:10 +0100 Subject: [PATCH 173/177] feats for pop --- crates/01-ssh/crate.sh | 5 +++-- crates/01-ssh/files/config | 22 ++++++++++++++++++++++ crates/05-i3/crate.arch.sh | 6 +++--- crates/05-i3/crate.pop.sh | 11 +++++++++++ crates/10-zsh/crate.debian.sh | 4 ++-- crates/10-zsh/crate.pop.sh | 7 +++++++ crates/30-alacritty/crate.pop.sh | 7 +++++++ 7 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 crates/01-ssh/files/config create mode 100644 crates/05-i3/crate.pop.sh create mode 100644 crates/10-zsh/crate.pop.sh create mode 100644 crates/30-alacritty/crate.pop.sh diff --git a/crates/01-ssh/crate.sh b/crates/01-ssh/crate.sh index 2c187de..6801c37 100644 --- a/crates/01-ssh/crate.sh +++ b/crates/01-ssh/crate.sh @@ -2,8 +2,9 @@ describe="setup ssh" -apply() { +apply() { [ -e "$HOME/.ssh/authorized_keys" ] || ln files/authorized_keys $HOME/.ssh/authorized_keys + [ -e "$HOME/.ssh/config" ] || ln files/config $HOME/.ssh/config if ! [ -f "$HOME/.ssh/id_rsa" ]; then echo "Creating new ssh key for this device..." ssh-keygen -f $HOME/.ssh/id_rsa -p "" -q @@ -14,4 +15,4 @@ apply() { undo() { echo "Undoing ssh keys is not supported, please do this manually." -} \ No newline at end of file +} diff --git a/crates/01-ssh/files/config b/crates/01-ssh/files/config new file mode 100644 index 0000000..8c9646d --- /dev/null +++ b/crates/01-ssh/files/config @@ -0,0 +1,22 @@ +## neb servers + +# hydrogen red helix +Host H + Hostname hydrogen.red.helix.saluco.nl + +# argon red helix +Host A + Hostname argon.red.helix.saluco.nl + +# iron red sphere +Host I + Hostname iron.red.sphere.saluco.nl + +## utility servers +Host git + Hostname git.saluco.nl + User git + +Host github + Hostname github.com + User git diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh index 41e73a0..ccffa03 100644 --- a/crates/05-i3/crate.arch.sh +++ b/crates/05-i3/crate.arch.sh @@ -1,11 +1,11 @@ #!/bin/sh -pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" +pkgs="i3 i3lock i3status libpulse-mainloop-glib brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" super_apply() { - pacman -S --needed --noconfirm $pkgs + apt install -y $pkgs } super_undo() { - pacman -R --noconfirm $pkgs + apt remove -y $pkgs } diff --git a/crates/05-i3/crate.pop.sh b/crates/05-i3/crate.pop.sh new file mode 100644 index 0000000..41e73a0 --- /dev/null +++ b/crates/05-i3/crate.pop.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" + +super_apply() { + pacman -S --needed --noconfirm $pkgs +} + +super_undo() { + pacman -R --noconfirm $pkgs +} diff --git a/crates/10-zsh/crate.debian.sh b/crates/10-zsh/crate.debian.sh index 7f0af81..33b0fcc 100644 --- a/crates/10-zsh/crate.debian.sh +++ b/crates/10-zsh/crate.debian.sh @@ -3,5 +3,5 @@ super_apply() { } super_undo() { - pacman -R --noconfirm zsh -} \ No newline at end of file + apt remove -y zsh +} diff --git a/crates/10-zsh/crate.pop.sh b/crates/10-zsh/crate.pop.sh new file mode 100644 index 0000000..33b0fcc --- /dev/null +++ b/crates/10-zsh/crate.pop.sh @@ -0,0 +1,7 @@ +super_apply() { + apt install -y zsh +} + +super_undo() { + apt remove -y zsh +} diff --git a/crates/30-alacritty/crate.pop.sh b/crates/30-alacritty/crate.pop.sh new file mode 100644 index 0000000..27ea4e9 --- /dev/null +++ b/crates/30-alacritty/crate.pop.sh @@ -0,0 +1,7 @@ +super_apply() { + apt install -y alacritty +} + +super_undo() { + apt remove -y alacritty +} From f0e039461cb302525aa6a4f75bee29368611e909 Mon Sep 17 00:00:00 2001 From: Strix Date: Sun, 12 Jan 2025 18:58:48 +0100 Subject: [PATCH 174/177] fix --- crates/05-i3/crate.arch.sh | 6 +++--- crates/05-i3/crate.pop.sh | 6 +++--- crates/10-zsh/files/.zshrc | 11 +---------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh index ccffa03..41e73a0 100644 --- a/crates/05-i3/crate.arch.sh +++ b/crates/05-i3/crate.arch.sh @@ -1,11 +1,11 @@ #!/bin/sh -pkgs="i3 i3lock i3status libpulse-mainloop-glib brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" +pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" super_apply() { - apt install -y $pkgs + pacman -S --needed --noconfirm $pkgs } super_undo() { - apt remove -y $pkgs + pacman -R --noconfirm $pkgs } diff --git a/crates/05-i3/crate.pop.sh b/crates/05-i3/crate.pop.sh index 41e73a0..ccffa03 100644 --- a/crates/05-i3/crate.pop.sh +++ b/crates/05-i3/crate.pop.sh @@ -1,11 +1,11 @@ #!/bin/sh -pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" +pkgs="i3 i3lock i3status libpulse-mainloop-glib brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" super_apply() { - pacman -S --needed --noconfirm $pkgs + apt install -y $pkgs } super_undo() { - pacman -R --noconfirm $pkgs + apt remove -y $pkgs } diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc index c730706..4bbe248 100644 --- a/crates/10-zsh/files/.zshrc +++ b/crates/10-zsh/files/.zshrc @@ -18,7 +18,7 @@ if [ -f "$HOME/.oh-my-zsh/oh-my-zsh.sh" ]; then source $ZSH/oh-my-zsh.sh else echo "oh-my-zsh not detected :(" - PS1="$(whoami)@${HOSTNAME:-$(hostname)} $ " + PS1="$(whoami)@${HOSTNAME:-$(hostname)} $ " fi update_dotfiles() { @@ -27,15 +27,6 @@ update_dotfiles() { cd - &> /dev/null } -share_cdn() { - if ! [ -f "$1" ]; then - echo "file needs to exist" - return 1 - fi - scp $1 keymaker:/usr/share/cdn/random/$2 > /dev/null - echo "https://cdn.ixvd.net/random/${2:-$(basename $1)}" -} - container() { docker run \ -ti \ From 344e1693bd0d161d65d54ed6c0a25f0caa72c8c6 Mon Sep 17 00:00:00 2001 From: Strix Date: Wed, 26 Feb 2025 03:05:18 +0100 Subject: [PATCH 175/177] bulk: syncr --- .gitignore | 2 + README.md | 12 - crates/00-system/crate.arch.sh | 12 - crates/00-system/crate.debian.sh | 5 - crates/00-system/crate.sh | 11 - crates/00-system/files/pacman.conf | 31 - crates/01-ssh/crate.sh | 18 - crates/01-ssh/files/authorized_keys | 1 - crates/01-ssh/files/config | 22 - crates/05-i3/crate.arch.sh | 11 - crates/05-i3/crate.pop.sh | 11 - crates/05-i3/crate.sh | 26 - crates/05-i3/crate.void.sh | 12 - crates/05-i3/files/40-proper-touchpad.conf | 8 - crates/05-i3/files/config | 206 ---- crates/05-i3/files/picom.conf | 9 - crates/05-i3/files/status_config | 57 - crates/10-zsh/crate.arch.sh | 7 - crates/10-zsh/crate.debian.sh | 7 - crates/10-zsh/crate.pop.sh | 7 - crates/10-zsh/crate.sh | 31 - crates/10-zsh/crate.void.sh | 10 - crates/10-zsh/files/.zshrc | 44 - crates/20-vim/crate.arch.sh | 7 - crates/20-vim/crate.debian.sh | 7 - crates/20-vim/crate.sh | 15 - crates/20-vim/crate.void.sh | 7 - crates/20-vim/files/.ideavimrc | 10 - crates/20-vim/files/init.vim | 27 - crates/30-alacritty/crate.arch.sh | 7 - crates/30-alacritty/crate.pop.sh | 7 - crates/30-alacritty/crate.sh | 13 - crates/30-alacritty/crate.void.sh | 7 - crates/30-alacritty/files/alacritty.yml | 6 - crates/40-git/crate.sh | 9 - crates/common/crate.toml | 23 + crates/common/scripts/pam_wheel.sh | 4 + dot | 89 -- remote_script.sh | 14 - scripts/void.d/update-discord.sh | 13 - sync-runner/Cargo.lock | 1149 ++++++++++++++++++++ sync-runner/Cargo.toml | 20 + sync-runner/package_manager.list | 11 + sync-runner/src/action.rs | 10 + sync-runner/src/cfg/daemon.rs | 7 + sync-runner/src/cfg/mod.rs | 15 + sync-runner/src/crates/mod.rs | 34 + sync-runner/src/crates/pm.rs | 90 ++ sync-runner/src/logging.rs | 64 ++ sync-runner/src/main.rs | 77 ++ sync-runner/src/prelude.rs | 5 + sync-runner/src/source/git.rs | 241 ++++ sync-runner/src/source/mod.rs | 68 ++ sync.sh | 1 + syncr.toml | 17 + 55 files changed, 1838 insertions(+), 796 deletions(-) create mode 100644 .gitignore delete mode 100644 README.md delete mode 100644 crates/00-system/crate.arch.sh delete mode 100644 crates/00-system/crate.debian.sh delete mode 100644 crates/00-system/crate.sh delete mode 100644 crates/00-system/files/pacman.conf delete mode 100644 crates/01-ssh/crate.sh delete mode 100644 crates/01-ssh/files/authorized_keys delete mode 100644 crates/01-ssh/files/config delete mode 100644 crates/05-i3/crate.arch.sh delete mode 100644 crates/05-i3/crate.pop.sh delete mode 100644 crates/05-i3/crate.sh delete mode 100644 crates/05-i3/crate.void.sh delete mode 100644 crates/05-i3/files/40-proper-touchpad.conf delete mode 100644 crates/05-i3/files/config delete mode 100644 crates/05-i3/files/picom.conf delete mode 100644 crates/05-i3/files/status_config delete mode 100644 crates/10-zsh/crate.arch.sh delete mode 100644 crates/10-zsh/crate.debian.sh delete mode 100644 crates/10-zsh/crate.pop.sh delete mode 100644 crates/10-zsh/crate.sh delete mode 100644 crates/10-zsh/crate.void.sh delete mode 100644 crates/10-zsh/files/.zshrc delete mode 100644 crates/20-vim/crate.arch.sh delete mode 100644 crates/20-vim/crate.debian.sh delete mode 100644 crates/20-vim/crate.sh delete mode 100644 crates/20-vim/crate.void.sh delete mode 100644 crates/20-vim/files/.ideavimrc delete mode 100644 crates/20-vim/files/init.vim delete mode 100644 crates/30-alacritty/crate.arch.sh delete mode 100644 crates/30-alacritty/crate.pop.sh delete mode 100644 crates/30-alacritty/crate.sh delete mode 100644 crates/30-alacritty/crate.void.sh delete mode 100644 crates/30-alacritty/files/alacritty.yml delete mode 100644 crates/40-git/crate.sh create mode 100644 crates/common/crate.toml create mode 100644 crates/common/scripts/pam_wheel.sh delete mode 100755 dot delete mode 100644 remote_script.sh delete mode 100755 scripts/void.d/update-discord.sh create mode 100644 sync-runner/Cargo.lock create mode 100644 sync-runner/Cargo.toml create mode 100644 sync-runner/package_manager.list create mode 100644 sync-runner/src/action.rs create mode 100644 sync-runner/src/cfg/daemon.rs create mode 100644 sync-runner/src/cfg/mod.rs create mode 100644 sync-runner/src/crates/mod.rs create mode 100644 sync-runner/src/crates/pm.rs create mode 100644 sync-runner/src/logging.rs create mode 100644 sync-runner/src/main.rs create mode 100644 sync-runner/src/prelude.rs create mode 100644 sync-runner/src/source/git.rs create mode 100644 sync-runner/src/source/mod.rs create mode 100644 sync.sh create mode 100644 syncr.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7780ed --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.data/ +target/ \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index b630725..0000000 --- a/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Raine's Dotfiles - -## Crates -Everything is a crate. -If something is distro specific you should follow the following naming scheme: -`crate..sh` - -## Using it -Just use the script tbh -```sh -curl -L https://via.ixvd.net/sh | sh -``` \ No newline at end of file diff --git a/crates/00-system/crate.arch.sh b/crates/00-system/crate.arch.sh deleted file mode 100644 index 164fde4..0000000 --- a/crates/00-system/crate.arch.sh +++ /dev/null @@ -1,12 +0,0 @@ -super_apply() { - pacman -Syyu --noconfirm - pacman -S --needed --noconfirm sudo reflector - if ! grep -q "Reflector" /etc/pacman.d/mirrorlist; then - cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak - reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist - else - echo "err: reflector already executed -- skipping..." - fi - - cp files/pacman.conf /etc/pacman.conf -} \ No newline at end of file diff --git a/crates/00-system/crate.debian.sh b/crates/00-system/crate.debian.sh deleted file mode 100644 index b866807..0000000 --- a/crates/00-system/crate.debian.sh +++ /dev/null @@ -1,5 +0,0 @@ -super_apply() { - apt update -y - apt install -y netselect-apt sudo - netselect-apt -} \ No newline at end of file diff --git a/crates/00-system/crate.sh b/crates/00-system/crate.sh deleted file mode 100644 index c5c5965..0000000 --- a/crates/00-system/crate.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -describe="Install stuff on the system!" -scripts="@distro @self" - -super_apply() { - if [ -f /usr/lib/security/pam_wheel.so ] && ! grep -q "# pam_wheel.so added" /etc/pam.d/su; then - echo "auth sufficient pam_wheel.so trust use_uid" > /etc/pam.d/su - echo "# pam_wheel.so added" > /etc/pam.d/su - fi -} \ No newline at end of file diff --git a/crates/00-system/files/pacman.conf b/crates/00-system/files/pacman.conf deleted file mode 100644 index e63be35..0000000 --- a/crates/00-system/files/pacman.conf +++ /dev/null @@ -1,31 +0,0 @@ -[options] -HoldPkg = pacman glibc yay -Architecture = auto - -Color -CheckSpace -ParallelDownloads = 5 - -SigLevel = Required DatabaseOptional -LocalFileSigLevel = Optional - -#[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 - -#[multilib-testing] -#Include = /etc/pacman.d/mirrorlist - -[multilib] -Include = /etc/pacman.d/mirrorlist diff --git a/crates/01-ssh/crate.sh b/crates/01-ssh/crate.sh deleted file mode 100644 index 6801c37..0000000 --- a/crates/01-ssh/crate.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -describe="setup ssh" - -apply() { - [ -e "$HOME/.ssh/authorized_keys" ] || ln files/authorized_keys $HOME/.ssh/authorized_keys - [ -e "$HOME/.ssh/config" ] || ln files/config $HOME/.ssh/config - if ! [ -f "$HOME/.ssh/id_rsa" ]; then - echo "Creating new ssh key for this device..." - ssh-keygen -f $HOME/.ssh/id_rsa -p "" -q - echo "Adding key to authorized_keys..." - cat $HOME/.ssh/id_rsa.pub > $HOME/.ssh/authorized_keys - fi -} - -undo() { - echo "Undoing ssh keys is not supported, please do this manually." -} diff --git a/crates/01-ssh/files/authorized_keys b/crates/01-ssh/files/authorized_keys deleted file mode 100644 index 7115b29..0000000 --- a/crates/01-ssh/files/authorized_keys +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= strix@ryuk \ No newline at end of file diff --git a/crates/01-ssh/files/config b/crates/01-ssh/files/config deleted file mode 100644 index 8c9646d..0000000 --- a/crates/01-ssh/files/config +++ /dev/null @@ -1,22 +0,0 @@ -## neb servers - -# hydrogen red helix -Host H - Hostname hydrogen.red.helix.saluco.nl - -# argon red helix -Host A - Hostname argon.red.helix.saluco.nl - -# iron red sphere -Host I - Hostname iron.red.sphere.saluco.nl - -## utility servers -Host git - Hostname git.saluco.nl - User git - -Host github - Hostname github.com - User git diff --git a/crates/05-i3/crate.arch.sh b/crates/05-i3/crate.arch.sh deleted file mode 100644 index 41e73a0..0000000 --- a/crates/05-i3/crate.arch.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -pkgs="i3 i3lock i3status libpulse brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" - -super_apply() { - pacman -S --needed --noconfirm $pkgs -} - -super_undo() { - pacman -R --noconfirm $pkgs -} diff --git a/crates/05-i3/crate.pop.sh b/crates/05-i3/crate.pop.sh deleted file mode 100644 index ccffa03..0000000 --- a/crates/05-i3/crate.pop.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -pkgs="i3 i3lock i3status libpulse-mainloop-glib brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" - -super_apply() { - apt install -y $pkgs -} - -super_undo() { - apt remove -y $pkgs -} diff --git a/crates/05-i3/crate.sh b/crates/05-i3/crate.sh deleted file mode 100644 index 09edde5..0000000 --- a/crates/05-i3/crate.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -describe="Installs i3" -scripts="@distro @self" - -apply() { - [ -d "$HOME/.config/i3" ] || mkdir -p $HOME/.config/i3 - [ -d "$HOME/.config/i3status" ] || mkdir -p $HOME/.config/i3status - [ -e "$HOME/.config/i3/config" ] || ln files/config $HOME/.config/i3/config - [ -e "$HOME/.config/i3status/config" ] || ln files/status_config $HOME/.config/i3status/config - [ -e "$HOME/.config/picom.conf" ] || ln files/picom.conf $HOME/.config/picom.conf -} - -undo() { - rm $HOME/.config/i3/config - rm $HOME/.config/i3status/config -} - -super_apply() { - [ -d "/etc/X11/xorg.conf.d" ] || mkdir -p /etc/X11/xorg.conf.d/ - cp files/40-proper-touchpad.conf /etc/X11/xorg.conf.d/40-proper-touchpad.conf -} - -super_undo() { - rm /etc/X11/xorg.conf.d/40-proper-touchpad.conf -} diff --git a/crates/05-i3/crate.void.sh b/crates/05-i3/crate.void.sh deleted file mode 100644 index 3f7f59b..0000000 --- a/crates/05-i3/crate.void.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -pkgs="i3 i3lock i3status pulseaudio-devel brightnessctl xss-lock dex maim dmenu gnome-keyring feh picom" - -super_apply() { - xbps-install -y $pkgs -} - -super_undo() { - xbps-remove -y $pkgs -} - diff --git a/crates/05-i3/files/40-proper-touchpad.conf b/crates/05-i3/files/40-proper-touchpad.conf deleted file mode 100644 index 80049de..0000000 --- a/crates/05-i3/files/40-proper-touchpad.conf +++ /dev/null @@ -1,8 +0,0 @@ -Section "InputClass" - Identifier "libinput touchpad catchall" - MatchIsTouchpad "on" - MatchDevicePath "/dev/input/event*" - Driver "libinput" - Option "NaturalScrolling" "True" - Option "Tapping" "on" -EndSection diff --git a/crates/05-i3/files/config b/crates/05-i3/files/config deleted file mode 100644 index d08481b..0000000 --- a/crates/05-i3/files/config +++ /dev/null @@ -1,206 +0,0 @@ -####################### -## Raine's i3 config ## -## Mar 22, 2023 ## -## mutation: 1m ## -####################### - -## Mostly similar to i3's config yet differs - -# Useful variables: -# This section probably gets changed a lot -# --- -set $terminal alacritty -set $screen_lock i3lock -c "#111111" --nofork -set $appmenu i3-dmenu-desktop - -set $screenshot maim -s | xclip -selection clipboard -t image/png - -set $font pango:monospace 8 - -# Startup Applications: -# Things that will startup when starting i3. -# --- -exec_always --no-startup-id dex --autostart --environment i3 -exec_always --no-startup-id nm-applet -exec_always --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock -exec_always --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11 -exec_always --no-startup-id feh --bg-fill ~/Pictures/wallpaper.jpg -exec_always --no-startup-id picom - -# Gaps & Borders: -# --- -gaps inner 10 -smart_gaps on - -default_border pixel 1 -hide_edge_borders smart_no_gaps - -# Extra variables: -# Only need changing for very specific installations. -# --- -set $audio_volume_up XF86AudioRaiseVolume -set $audio_volume_down XF86AudioLowerVolume -set $audio_mute XF86AudioMute -set $audio_mute_mic XF86AudioMicMute - -set $brightness_up XF86MonBrightnessUp -set $brightness_down XF86MonBrightnessDown - -set $ws_1 "1:main" -set $ws_2 "2:term" -set $ws_3 "3:docs" -set $ws_4 "4:mail" -set $ws_5 "5" -set $ws_6 "6" -set $ws_7 "7" -set $ws_8 "8" -set $ws_9 "9:bg" -set $ws_10 "10:misc" - -set $meta_refresh_statusbar killall -SIGUSR1 i3status -bar { - strip_workspace_numbers yes - status_command i3status -} - -# END OF CONFIG - -set $mod Mod4 -set $alt Mod1 - -# Customization - -# class border backgr. text indic. child_border -client.focused #81A1C1 #81A1C1 #ffffff #D8DEE9 -client.focused_inactive #2E3440 #2E3440 #88C0D0 #454948 -client.unfocused #2E3440 #2E3440 #88C0D0 #454948 -client.urgent #D08770 #3B4252 #ffffff #268BD2 -client.placeholder #000000 #0c0c0c #ffffff #000000 -client.background #3B4252 - -# Generic -floating_modifier $mod -tiling_drag modifier titlebar -font $font - -# Open a terminal -bindsym $mod+Return exec $terminal - -# Kill current window -bindsym $mod+$alt+q kill - -# Open app menu -bindsym $mod+d exec --no-startup-id $appmenu - -# Lock screen -bindsym $mod+l exec --no-startup-id $screen_lock - -# Screenshots -bindsym Print exec --no-startup-id $screenshot - -# Audio -bindsym $audio_volume_up exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $meta_refresh_statusbar -bindsym $audio_volume_down exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $meta_refresh_statusbar -bindsym $audio_mute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $meta_refresh_statusbar -bindsym $audio_mute_mic exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $meta_refresh_statusbar - -# Brightness -bindsym $brightness_up exec --no-startup-id brightnessctl set +5% && $meta_refresh_statusbar -bindsym $brightness_down exec --no-startup-id brightnessctl set 5%- && $meta_refresh_statusbar - -# Change focused window -bindsym $mod+Up focus up -bindsym $mod+Down focus down -bindsym $mod+Left focus left -bindsym $mod+Right focus right - -# Move focused window -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Right move right - -# Splits -bindsym $mod+Shift+h split h -bindsym $mod+Shift+v split v - -# Change container layout -bindsym $mod+Shift+s layout stacking -bindsym $mod+Shift+t layout tabbed -bindsym $mod+Shift+d layout toggle split - -# Make current window fullscreen -bindsym $mod+Shift+f fullscreen toggle - -# Floating stuff -bindsym $mod+space focus mode_toggle -bindsym $mod+Shift+space floating toggle - -# Scratchpad -bindsym $mod+Shift+minus move scratchpad -bindsym $mod+minus scratchpad show - -# Switch to workspace -bindsym $mod+1 workspace $ws_1 -bindsym $mod+2 workspace $ws_2 -bindsym $mod+3 workspace $ws_3 -bindsym $mod+4 workspace $ws_4 -bindsym $mod+5 workspace $ws_5 -bindsym $mod+6 workspace $ws_6 -bindsym $mod+7 workspace $ws_7 -bindsym $mod+8 workspace $ws_8 -bindsym $mod+9 workspace $ws_9 -bindsym $mod+0 workspace $ws_10 - -# Move focused container to workspace -bindsym $mod+Shift+1 move container to workspace $ws_1 -bindsym $mod+Shift+2 move container to workspace $ws_2 -bindsym $mod+Shift+3 move container to workspace $ws_3 -bindsym $mod+Shift+4 move container to workspace $ws_4 -bindsym $mod+Shift+5 move container to workspace $ws_5 -bindsym $mod+Shift+6 move container to workspace $ws_6 -bindsym $mod+Shift+7 move container to workspace $ws_7 -bindsym $mod+Shift+8 move container to workspace $ws_8 -bindsym $mod+Shift+9 move container to workspace $ws_9 -bindsym $mod+Shift+0 move container to workspace $ws_10 - -# Move through workspaces -bindsym $mod+$alt+Left workspace prev -bindsym $mod+$alt+Right workspace next - -# WM stuff -# reload i3 config -bindsym $mod+$alt+c reload -# restart i3 -bindsym $mod+$alt+r restart -# exit i3 -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes, exit i3' 'i3-msg exit'" - -# Modes -bindsym $mod+r mode resize -mode "resize" { - bindsym $nav_left resize shrink width 10 px or 10 ppt - bindsym $nav_down resize grow height 10 px or 10 ppt - bindsym $nav_up resize shrink height 10 px or 10 ppt - bindsym $nav_right resize grow width 10 px or 10 ppt - 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 - - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" -} - -bindsym $mod+s mode "session" -mode "session" { - bindsym l exec --no-startup-id $lock, mode "default" - bindsym e exec --no-startup-id i3-msg exit, 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" - - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+s mode "default" -} diff --git a/crates/05-i3/files/picom.conf b/crates/05-i3/files/picom.conf deleted file mode 100644 index 5bff83a..0000000 --- a/crates/05-i3/files/picom.conf +++ /dev/null @@ -1,9 +0,0 @@ -inactive-opacity = 0.75; - -blur: { - method = "box"; - size = 10; - background = false; - background-frame = false; - background-fixed = false; -} diff --git a/crates/05-i3/files/status_config b/crates/05-i3/files/status_config deleted file mode 100644 index 3fce4a7..0000000 --- a/crates/05-i3/files/status_config +++ /dev/null @@ -1,57 +0,0 @@ -general { - output_format = "i3bar" - colors = true - interval = 5 -} - -order += "ipv6" -order += "wireless wlp58s0" -order += "battery 0" -order += "disk /" -order += "memory" -order += "load" -order += "tztime local" - -wireless wlp58s0 { - format_up = "W: (%quality at %essid, %bitrate) %ip" - format_down = "W: down" -} - -battery 0 { - format = "%status %percentage %remaining %emptytime" - format_down = "No battery" - status_chr = "โšก CHR" - status_bat = "๐Ÿ”‹ BAT" - status_unk = "? UNK" - status_full = "โ˜ป FULL" - path = "/sys/class/power_supply/BAT%d/uevent" - low_threshold = 10 -} - -tztime local { - format = "%Y-%m-%d %H:%M:%S" - hide_if_equals_localtime = false -} - -tztime berlin { - format = "%Y-%m-%d %H:%M:%S %Z" - timezone = "Europe/Berlin" -} - -load { - format = "%5min" -} - -memory { - format = "%used" - threshold_degraded = "10%" - format_degraded = "MEMORY: %free" -} - -disk "/" { - format = "%free" -} - -read_file uptime { - path = "/proc/uptime" -} diff --git a/crates/10-zsh/crate.arch.sh b/crates/10-zsh/crate.arch.sh deleted file mode 100644 index 598a08c..0000000 --- a/crates/10-zsh/crate.arch.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - pacman -S --needed --noconfirm zsh -} - -super_undo() { - pacman -R --noconfirm zsh -} \ No newline at end of file diff --git a/crates/10-zsh/crate.debian.sh b/crates/10-zsh/crate.debian.sh deleted file mode 100644 index 33b0fcc..0000000 --- a/crates/10-zsh/crate.debian.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - apt install -y zsh -} - -super_undo() { - apt remove -y zsh -} diff --git a/crates/10-zsh/crate.pop.sh b/crates/10-zsh/crate.pop.sh deleted file mode 100644 index 33b0fcc..0000000 --- a/crates/10-zsh/crate.pop.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - apt install -y zsh -} - -super_undo() { - apt remove -y zsh -} diff --git a/crates/10-zsh/crate.sh b/crates/10-zsh/crate.sh deleted file mode 100644 index 2c06c84..0000000 --- a/crates/10-zsh/crate.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -describe="Install zsh and oh-my-zsh!" -scripts="@distro @self" - -super_apply() { - usermod $USER --shell /bin/zsh -} - -super_undo() { - usermod $USER --shell /bin/bash -} - -apply() { - if [ ! -d "$HOME/.oh-my-zsh" ]; then - sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended - - PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions - [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR - PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting - [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR - fi - - [ -f "$HOME/.zshrc" ] && unlink $HOME/.zshrc - [ -e "$HOME/.zshrc" ] || ln files/.zshrc $HOME/.zshrc -} - -undo() { - unlink $HOME/.zshrc - rm -rf $HOME/.oh-my-zsh -} \ No newline at end of file diff --git a/crates/10-zsh/crate.void.sh b/crates/10-zsh/crate.void.sh deleted file mode 100644 index 19d54d1..0000000 --- a/crates/10-zsh/crate.void.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -super_apply() { - xbps-install -y zsh -} - -super_undo() { - xbps-remove -y zsh -} - diff --git a/crates/10-zsh/files/.zshrc b/crates/10-zsh/files/.zshrc deleted file mode 100644 index 4bbe248..0000000 --- a/crates/10-zsh/files/.zshrc +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/zsh - -# Raine's .zshrc - -if [ "$PROFILEINC" = "1" ]; then - . ~/.profile -fi - -export EDITOR=vim -export GPG_TTY=$(tty) -export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$HOME/.local/bin" - -# oh-my-zsh init -if [ -f "$HOME/.oh-my-zsh/oh-my-zsh.sh" ]; then - export ZSH="$HOME/.oh-my-zsh" - ZSH_THEME="afowler" - plugins=(git docker docker-compose node zsh-autosuggestions zsh-syntax-highlighting zsh-cargo-completion) - source $ZSH/oh-my-zsh.sh -else - echo "oh-my-zsh not detected :(" - PS1="$(whoami)@${HOSTNAME:-$(hostname)} $ " -fi - -update_dotfiles() { - cd $HOME/.dotfiles - git pull - cd - &> /dev/null -} - -container() { - docker run \ - -ti \ - --rm \ - --name tmp-$(id -u)-$(openssl rand -hex 8) \ - --network ${CONTAINER_NETWORK:-internal} \ - alpine \ - ash -} - -[ -f "$HOME/.config/i3/shortcuts-i3.sh" ] && . ~/.config/i3/shortcuts-i3.sh - -alias q="exit" -alias vim="nvim" -alias vi="nvim" diff --git a/crates/20-vim/crate.arch.sh b/crates/20-vim/crate.arch.sh deleted file mode 100644 index 3d97b3c..0000000 --- a/crates/20-vim/crate.arch.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - pacman -S --needed --noconfirm neovim -} - -super_undo() { - echo "we never uninstall vim -_-" -} \ No newline at end of file diff --git a/crates/20-vim/crate.debian.sh b/crates/20-vim/crate.debian.sh deleted file mode 100644 index a6d8e34..0000000 --- a/crates/20-vim/crate.debian.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - apt install -y neovim -} - -super_undo() { - echo "we never uninstall vim -_-" -} \ No newline at end of file diff --git a/crates/20-vim/crate.sh b/crates/20-vim/crate.sh deleted file mode 100644 index b3b82e0..0000000 --- a/crates/20-vim/crate.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -describe="Install vim and it's stuff" -scripts="@distro @self" - -apply() { - [ -d "$HOME/.config/nvim" ] || mkdir -p "$HOME/.config/nvim" - [ -e "$HOME/.config/nvim/init.vim" ] || ln files/init.vim $HOME/.config/nvim/init.vim - [ -e "$HOME/.ideavimrc" ] || ln files/.ideavimrc $HOME/.ideavimrc -} - -undo() { - unlink $HOME/.config/nvim/init.vim - unlink $HOME/.ideavimrc -} \ No newline at end of file diff --git a/crates/20-vim/crate.void.sh b/crates/20-vim/crate.void.sh deleted file mode 100644 index 1b3e1e8..0000000 --- a/crates/20-vim/crate.void.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - xbps-install -y neovim -} - -super_undo() { - echo "we never uninstall vim -_-" -} \ No newline at end of file diff --git a/crates/20-vim/files/.ideavimrc b/crates/20-vim/files/.ideavimrc deleted file mode 100644 index 115e47f..0000000 --- a/crates/20-vim/files/.ideavimrc +++ /dev/null @@ -1,10 +0,0 @@ -source ~/.vimrc - -set scrolloff=5 -set incsearch - -map Q gq - -Plug 'machakann/vim-highlightedyank' -Plug 'tpope/vim-commentary' -Plug 'wellle/targets.vim' diff --git a/crates/20-vim/files/init.vim b/crates/20-vim/files/init.vim deleted file mode 100644 index d87f89e..0000000 --- a/crates/20-vim/files/init.vim +++ /dev/null @@ -1,27 +0,0 @@ -" vim preferences -set number -set relativenumber -syntax on - -" No arrow keys -noremap -noremap -noremap -noremap - -" ensure vim-plug -let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' -if empty(glob(data_dir . '/autoload/plug.vim')) - silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -endif - -call plug#begin() - -Plug 'ThePrimeagen/vim-be-good' -Plug 'machakann/vim-highlightedyank' -Plug 'tpope/vim-commentary' -Plug 'wellle/targets.vim' -Plug 'vim-scripts/loremipsum' - -call plug#end() diff --git a/crates/30-alacritty/crate.arch.sh b/crates/30-alacritty/crate.arch.sh deleted file mode 100644 index cc95257..0000000 --- a/crates/30-alacritty/crate.arch.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - pacman -S --needed --noconfirm alacritty -} - -super_undo() { - pacman -R --noconfirm alacritty -} \ No newline at end of file diff --git a/crates/30-alacritty/crate.pop.sh b/crates/30-alacritty/crate.pop.sh deleted file mode 100644 index 27ea4e9..0000000 --- a/crates/30-alacritty/crate.pop.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - apt install -y alacritty -} - -super_undo() { - apt remove -y alacritty -} diff --git a/crates/30-alacritty/crate.sh b/crates/30-alacritty/crate.sh deleted file mode 100644 index 27f5762..0000000 --- a/crates/30-alacritty/crate.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -describe="Installs alacritty and configs" -scripts="@distro @self" - -apply() { - [ -d "$HOME/.config/alacritty" ] || mkdir -p $HOME/.config/alacritty - [ -e "$HOME/.config/alacritty/alacritty.yml" ] || ln files/alacritty.yml $HOME/.config/alacritty/alacritty.yml -} - -undo() { - unlink $HOME/.config/alacritty/alacritty.yml -} \ No newline at end of file diff --git a/crates/30-alacritty/crate.void.sh b/crates/30-alacritty/crate.void.sh deleted file mode 100644 index 4312e25..0000000 --- a/crates/30-alacritty/crate.void.sh +++ /dev/null @@ -1,7 +0,0 @@ -super_apply() { - xbps-install -y alacritty -} - -super_undo() { - xbps-remove -y alacritty -} \ No newline at end of file diff --git a/crates/30-alacritty/files/alacritty.yml b/crates/30-alacritty/files/alacritty.yml deleted file mode 100644 index 1a30120..0000000 --- a/crates/30-alacritty/files/alacritty.yml +++ /dev/null @@ -1,6 +0,0 @@ -cursor: - style: - shape: 'Block' - blinking: 'On' - blink_interval: 500 - diff --git a/crates/40-git/crate.sh b/crates/40-git/crate.sh deleted file mode 100644 index e9376ac..0000000 --- a/crates/40-git/crate.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -describe="Setup git" -scripts="@distro @self" - -apply() { - git config --global user.name Strix - git config --global user.email strix@saluco.nl -} diff --git a/crates/common/crate.toml b/crates/common/crate.toml new file mode 100644 index 0000000..45fc314 --- /dev/null +++ b/crates/common/crate.toml @@ -0,0 +1,23 @@ +name = "common" +description = "Common set of utilities" + +[pkgs] +openssh-server = {} +openssh-client = {} +git = {} +netselect = { distros = ["debian", "ubuntu"] } +reflector = { distros = ["arch"] } + +[actions] +setup_ssh = ["sh", "./scripts/%"] +reflector = { args = ["sh", "./scripts/setup_pm/%"], distro = ["arch"] } +netselect = { args = [ + "sh", + "./scripts/setup_pm/%", +], distro = [ + "debian", + "ubuntu", +] } + +[super_actions] +pam_wheel = ["sh", "./scripts/%"] diff --git a/crates/common/scripts/pam_wheel.sh b/crates/common/scripts/pam_wheel.sh new file mode 100644 index 0000000..e3adf88 --- /dev/null +++ b/crates/common/scripts/pam_wheel.sh @@ -0,0 +1,4 @@ +if [ -f /usr/lib/security/pam_wheel.so ] && ! grep -q "# pam_wheel.so added" /etc/pam.d/su; then + echo "auth sufficient pam_wheel.so trust use_uid" > /etc/pam.d/su + echo "# pam_wheel.so added" > /etc/pam.d/su +fi diff --git a/dot b/dot deleted file mode 100755 index 6a0f50d..0000000 --- a/dot +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh - -ask=0 - -is_function() { - type "$1" 2>/dev/null | sed "s/$1//" | grep -qwi function -} - -curr_distro() { - cat /etc/os-release | grep -G "^ID=" | sed 's/ID=//' -} - -include() { - [ -f "$1" ] || return 1 - . $1 - return 0 -} - -func() { - if is_function $(echo "super_$2"); then - [ "${DO_SUDO:-yes}" = "yes" ] || return 0 - ecmd=". $1 && super_$2" - [ "$(id -u)" = "0" ] && sh -c "$ecmd" || sudo sh -c "$ecmd" - unset ecmd - fi - is_function $2 && $2 -} - -# only run this *in crate dir* -run_crate() { - enabled=1 - include ./crate.sh || exit 1 - if [ -n "$describe" ]; then - echo "desc($(basename $PWD)): $describe" - fi - if [ $enabled -ne 1 ]; then - return - fi - cmd=$1 - scripts=${scripts:-"@self @distro"} - for s in $scripts; do - echo "exec($(basename $PWD)): $s/$cmd" - case $s in - @self) - func ./crate.sh $cmd - ;; - @distro) - unset -f super_$cmd - unset -f $cmd - include ./crate.$(curr_distro).sh - func ./crate.$(curr_distro).sh $cmd - unset -f super_$cmd - unset -f $cmd - include ./crate.sh - ;; - *) - sh $s - ;; - esac - done -} - -echo "# details:" -echo "# user: $USER (${UID:-$(id -u)})" -echo "# groups: $(groups)" -echo "# distro: $(curr_distro)" - -cmd=$1 -if [ -z "$cmd" ]; then - echo "usage: $0 [...args]" - exit 1 -else - shift -fi - -for c in ${@:-$(ls crates)}; do - [ -d crates/*$c ] || exit 1 - cd crates/*$c - case $cmd in - a | apply) - run_crate apply - ;; - u | undo) - run_crate undo - ;; - *) exit 1 ;; - esac - cd ../.. -done diff --git a/remote_script.sh b/remote_script.sh deleted file mode 100644 index 8866057..0000000 --- a/remote_script.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# this script is meant to be ran when .dotfiles is not present. -# -# example: -# curl https://git.saluco.nl/strix/dotfiles/raw/branch/main/remote_script.sh | sh - -set -e - -HOME=${HOME:-/home/${USER:-$(whomai)}} - -[ -d "$HOME/.dotfiles" ] || git clone https://git.saluco.nl/strix/dotfiles $HOME/.dotfiles -cd $HOME/.dotfiles -./dot a diff --git a/scripts/void.d/update-discord.sh b/scripts/void.d/update-discord.sh deleted file mode 100755 index 5c753c6..0000000 --- a/scripts/void.d/update-discord.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -set -e - -echo "Downloading newest package..." -curl -Lo /tmp/discord.deb "https://discord.com/api/download?platform=linux&format=deb" -cd /tmp -echo "Extracting package..." -xdeb discord.deb -echo "Installing package..." -sudo xbps-install -R /tmp/binpkgs discord -rm -rf /tmp/binpkgs -cd - diff --git a/sync-runner/Cargo.lock b/sync-runner/Cargo.lock new file mode 100644 index 0000000..3493d48 --- /dev/null +++ b/sync-runner/Cargo.lock @@ -0,0 +1,1149 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +dependencies = [ + "anstyle", + "once_cell", + "windows-sys 0.59.0", +] + +[[package]] +name = "bitflags" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "cc" +version = "1.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.5.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acebd8ad879283633b343856142139f2da2317c96b05b4dd6181c61e2480184" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ba32cbda51c7e1dfd49acc1457ba1a7dec5b64fe360e828acb13ca8dc9c2f9" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[package]] +name = "colored" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.7", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "execute" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a82608ee96ce76aeab659e9b8d3c2b787bffd223199af88c674923d861ada10" +dependencies = [ + "execute-command-macro", + "execute-command-tokens", + "generic-array 1.2.0", +] + +[[package]] +name = "execute-command-macro" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90dec53d547564e911dc4ff3ecb726a64cf41a6fa01a2370ebc0d95175dd08bd" +dependencies = [ + "execute-command-macro-impl", +] + +[[package]] +name = "execute-command-macro-impl" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8cd46a041ad005ab9c71263f9a0ff5b529eac0fe4cc9b4a20f4f0765d8cf4b" +dependencies = [ + "execute-command-tokens", + "quote", + "syn", +] + +[[package]] +name = "execute-command-tokens" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69dc321eb6be977f44674620ca3aa21703cb20ffbe560e1ae97da08401ffbcad" + +[[package]] +name = "fern" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4316185f709b23713e41e3195f90edef7fb00c3ed4adc79769cf09cc762a3b29" +dependencies = [ + "log", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "generic-array" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c8444bc9d71b935156cc0ccab7f622180808af7867b1daae6547d773591703" +dependencies = [ + "typenum", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "git2" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fda788993cc341f69012feba8bf45c0ba4f3291fcc08e214b4d5a7332d88aff" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "openssl-probe", + "openssl-sys", + "url", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.170" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" + +[[package]] +name = "libgit2-sys" +version = "0.18.0+1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1a117465e7e1597e8febea8bb0c410f1c7fb93b1e1cddf34363f8390367ffec" +dependencies = [ + "cc", + "libc", + "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +] + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "libssh2-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9b68e50e6e0b26f672573834882eb57759f6db9b3be2ea3c35c91188bb4eaa" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + +[[package]] +name = "log" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "once_cell" +version = "1.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "proc-macro2" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "serde" +version = "1.0.218" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.218" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shellexpand" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b" +dependencies = [ + "dirs", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "smallvec" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync-runner" +version = "0.1.0" +dependencies = [ + "clap", + "colored", + "execute", + "fern", + "git2", + "glob", + "hex", + "lazy_static", + "log", + "regex", + "serde", + "sha2", + "shellexpand", + "toml", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "toml" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1" +dependencies = [ + "memchr", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/sync-runner/Cargo.toml b/sync-runner/Cargo.toml new file mode 100644 index 0000000..4eaa739 --- /dev/null +++ b/sync-runner/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "sync-runner" +version = "0.1.0" +edition = "2021" + +[dependencies] +clap = { version = "4.5.29", features = ["derive"] } +colored = "3.0.0" +execute = "0.2.13" +fern = "0.7.1" +git2 = "0.20.0" +glob = "0.3.2" +hex = "0.4.3" +lazy_static = "1.5.0" +log = "0.4.26" +regex = "1.11.1" +serde = { version = "1.0.218", features = ["serde_derive"] } +sha2 = "0.10.8" +shellexpand = "3.1.0" +toml = "0.8.20" diff --git a/sync-runner/package_manager.list b/sync-runner/package_manager.list new file mode 100644 index 0000000..e175111 --- /dev/null +++ b/sync-runner/package_manager.list @@ -0,0 +1,11 @@ +install(pacman): pacman -Sy %args +uninstall(pacman): pacman -Rn %args + +install(apt): apt install %args +uninstall(apt): apt remove %args + +install(dnf): dnf install %args +uninstall(dnf): dnf remove %args + +install(yum): yum install %args +uninstall(yum): yum remove %args diff --git a/sync-runner/src/action.rs b/sync-runner/src/action.rs new file mode 100644 index 0000000..667cbed --- /dev/null +++ b/sync-runner/src/action.rs @@ -0,0 +1,10 @@ +use clap::Parser; + +#[derive(Parser, Debug)] +pub enum Action { + /// Sync your device with dotfiles repository + Sync { + #[arg(short, long)] + config_path: Option, + }, +} diff --git a/sync-runner/src/cfg/daemon.rs b/sync-runner/src/cfg/daemon.rs new file mode 100644 index 0000000..3d4a908 --- /dev/null +++ b/sync-runner/src/cfg/daemon.rs @@ -0,0 +1,7 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Daemon { + /// interval in minutes + pub interval: u64, +} diff --git a/sync-runner/src/cfg/mod.rs b/sync-runner/src/cfg/mod.rs new file mode 100644 index 0000000..1f56292 --- /dev/null +++ b/sync-runner/src/cfg/mod.rs @@ -0,0 +1,15 @@ + +#![allow(unused)] + +use std::collections::HashMap; + +use serde::{Deserialize, Serialize}; + +mod daemon; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Config { + pub title: String, + pub daemon: daemon::Daemon, + pub source: HashMap +} diff --git a/sync-runner/src/crates/mod.rs b/sync-runner/src/crates/mod.rs new file mode 100644 index 0000000..ec3d5dd --- /dev/null +++ b/sync-runner/src/crates/mod.rs @@ -0,0 +1,34 @@ +use std::collections::HashMap; + +use serde::{Deserialize, Serialize}; + +mod pm; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Package { + name: String, +} + +impl Package { + pub fn install(&self) { + todo!() + } + + pub fn uninstall(&self) { + todo!() + } +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct CrateAction { + pub name: String, + pub command: String, + pub args: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct Crate { + pub pkgs: HashMap, + pub actions: HashMap, + pub super_actions: HashMap, +} diff --git a/sync-runner/src/crates/pm.rs b/sync-runner/src/crates/pm.rs new file mode 100644 index 0000000..692ec15 --- /dev/null +++ b/sync-runner/src/crates/pm.rs @@ -0,0 +1,90 @@ +use lazy_static::lazy_static; +use regex::Regex; +use std::{process::Command, str::FromStr}; + +const pm_cfg: &str = include_str!("../../package_manager.list"); + +/// regex: `(?[a-z]+)>(?(?:un)?install+): (?.*)` +/// example: pacman>install: pacman -Sy %args + +lazy_static! { + static ref PM_REGEX: Regex = + Regex::new(r"(?P[a-z]+)>(?P(?:un)?install+): (?P.*)").unwrap(); +} + +#[derive(Debug)] +struct PackageManager { + name: String, + command: String, + args: Vec, +} + +impl PackageManager { + fn new(name: &str, command: &str, args: Vec) -> Self { + Self { + name: name.to_string(), + command: command.to_string(), + args, + } + } + + pub fn install(&self, packages: Vec) -> Result<(), Vec> { + Command::new(&self.command) + .args(&self.args) + .args(packages) + .spawn() + .expect("err"); + Ok(()) + } + pub fn uninstall(&self, packages: Vec) -> Result<(), Vec> { + todo!(); + } +} +impl FromStr for PackageManager { + type Err = String; + fn from_str(s: &str) -> Result { + let caps = PM_REGEX.captures(s).ok_or("invalid package manager")?; + let name = caps.name("pm").ok_or("invalid package manager")?.as_str(); + let command = caps + .name("command") + .ok_or("invalid package manager")? + .as_str(); + let args = caps + .name("args") + .ok_or("invalid package manager")? + .as_str() + .split_whitespace() + .map(|s| s.to_string()) + .collect(); + Ok(Self::new(name, command, args)) + } +} +#[derive(Debug)] +struct Package { + name: String, +} +impl FromStr for Package { + type Err = String; + fn from_str(s: &str) -> Result { + let caps = PM_REGEX.captures(s).ok_or("invalid package")?; + let name = caps.name("name").ok_or("invalid package")?.as_str(); + Ok(Self::new(name)) + } +} + +impl Package { + fn new(name: &str) -> Self { + Self { + name: name.to_string(), + } + } +} + +pub fn package_managers() -> Vec { + pm_cfg + .lines() + .map(|s| s.to_string()) + .map(|s| s.parse::()) + .collect::, String>>() + .expect("invalid package manager") +} diff --git a/sync-runner/src/logging.rs b/sync-runner/src/logging.rs new file mode 100644 index 0000000..6f6c082 --- /dev/null +++ b/sync-runner/src/logging.rs @@ -0,0 +1,64 @@ +use std::env; + +use colored::Colorize; +use fern::Dispatch; +use log::{Record, SetLoggerError}; + +fn format_regular>(log: S, record: &Record) -> String { + let log = log.into(); + let line_prefix = |line: String, extend: bool| { + let prefix = if extend { + match record.level() { + log::Level::Trace => " ]".bright_blue(), + log::Level::Debug => " ?".green(), + log::Level::Info => " >".blue(), + log::Level::Warn => " #".yellow(), + log::Level::Error => " !".red(), + }.to_string() + } else { + match record.level() { + log::Level::Trace => "[TRACE]".bright_blue().italic(), + log::Level::Debug => "??".green(), + log::Level::Info => "=>".blue(), + log::Level::Warn => "##".yellow(), + log::Level::Error => "!!".red().bold() + }.to_string() + }; + return format!("{} {}", prefix, line); + }; + + let mut lines = log.lines().peekable(); + let mut output = match lines.peek() { + Some(_line) => line_prefix(lines.next().unwrap().to_string(), false), + None => return "".to_string(), + }; + + for line in lines { + output.push_str(&*format!("\n{}", line_prefix(line.to_string(), true))); + } + + output +} + +pub fn setup_logger() -> Result<(), SetLoggerError> { + Dispatch::new() + .format(|out, message, record| { + match record.metadata().target() { + // command output logging + "command:stdout" => out.finish(format_args!("{} {}", ">>".cyan(), message.to_string())), + "command:stderr" => out.finish(format_args!("{} {}", ">>".red(), message.to_string())), + // this target means, it's an item and not a log. + "item" => out.finish(format_args!("{} {}", "*".blue(), message.to_string())), + // default logging + _ => out.finish(format_args!("{}", format_regular(message.to_string(), record))), + } + }) + .level( + env::var("SYNCR_LOG_LEVEL") + .unwrap_or_else(|_| "info".to_string()) + .parse() + .unwrap_or(log::LevelFilter::Info), + ) + .chain(std::io::stdout()) + .apply() +} diff --git a/sync-runner/src/main.rs b/sync-runner/src/main.rs new file mode 100644 index 0000000..539e733 --- /dev/null +++ b/sync-runner/src/main.rs @@ -0,0 +1,77 @@ +use std::{ + env::set_current_dir, + fs::{exists, read_to_string, File}, + path::{absolute, Path}, + process::{exit, Stdio}, +}; + +use action::Action; +use cfg::Config; +use clap::Parser; +use colored::Colorize; +use execute::{command_args, Execute}; +use log::{debug, error, info, trace, warn}; +use prelude::abspath; + +mod action; +mod cfg; +mod crates; +mod logging; +mod prelude; +mod source; + +fn main() -> Result<(), Box> { + logging::setup_logger()?; + + let git_sha1 = String::from_utf8( + command_args!("git", "rev-parse", "HEAD") + .stdout(Stdio::piped()) + .execute_output()? + .stdout, + )?; + + let action = Action::parse(); + match action { + Action::Sync { config_path } => { + trace!("fetching config dir... {config_path:?}"); + if let Some(config_path) = abspath(&config_path.unwrap_or("~/.syncr".into())) { + trace!("setting config dir as cwd... {config_path}"); + set_current_dir(config_path)?; + } + let config = + toml::from_str::(&read_to_string(abspath("./syncr.toml").unwrap())?)?; + info!("syncing \"{}\"...", config.title.bold()); + + info!("updating sources..."); + let mut available_sources = vec![]; + for (name, source) in &config.source { + debug!("checking {name}..."); + if !source.available() { + warn!("source \"{name}\" unavailable."); + } else { + info!("source \"{name}\" available!"); + available_sources.push(source); + } + } + + if available_sources.len() == 0 { + error!("{}", "sync impossible; no sources.".bold()); + exit(1); + } + + let oldpwd = absolute(".")?; + for source in available_sources { + // cd to source dir + source.go_to_dir()?; + for c in source.get_crates()? { + info!("{} pkgs", c.pkgs.len()) + } + } + } + _ => { + println!("{action:#?}"); + } + } + + Ok(()) +} diff --git a/sync-runner/src/prelude.rs b/sync-runner/src/prelude.rs new file mode 100644 index 0000000..0b1994b --- /dev/null +++ b/sync-runner/src/prelude.rs @@ -0,0 +1,5 @@ +pub fn abspath(p: &str) -> Option { + let exp_path = shellexpand::full(p).ok()?; + let can_path = std::fs::canonicalize(exp_path.as_ref()).ok()?; + can_path.into_os_string().into_string().ok() +} \ No newline at end of file diff --git a/sync-runner/src/source/git.rs b/sync-runner/src/source/git.rs new file mode 100644 index 0000000..8ad2389 --- /dev/null +++ b/sync-runner/src/source/git.rs @@ -0,0 +1,241 @@ +use std::{ + env::current_dir, fs::{self, create_dir_all, exists}, io::Write, path::{Path, PathBuf} +}; + +use git2::Repository; +use log::{debug, info, trace, warn}; +use serde::{Deserialize, Serialize}; +use sha2::{Digest, Sha256, Sha512}; + +use crate::prelude::abspath; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Git { + pub url: String, + #[serde(default = "default_branch")] + pub branch: String, +} + +fn default_branch() -> String { + "main".to_string() +} + +impl Git { + fn url_hash(&self) -> String { + let mut hasher = Sha256::new(); + hasher.update(&self.url); + let hash = hasher.finalize(); + hex::encode(hash) + } + + fn branch_hash(&self) -> String { + let mut hasher = Sha256::new(); + hasher.update(&self.url); + let hash = hasher.finalize(); + hex::encode(hash) + } + + pub fn repository_path_str(&self) -> String { + format!(".data/git/{}{}", self.url_hash(), self.branch_hash()) + } + + pub fn repository_path(&self) -> Result { + fs::canonicalize(self.repository_path_str()) + } + + pub fn exists_on_fs(&self) -> bool { + self.repository_path().is_ok() + } + + pub fn clone_repository(&self) -> Result { + Repository::clone_recurse(&self.url, Path::new(&self.repository_path_str())) + } + + pub fn repository(&self) -> Result { + if !self.exists_on_fs() { + create_dir_all(self.repository_path_str()).unwrap(); + } + match Repository::open(self.repository_path().unwrap()) { + Ok(r) => Ok(r), + Err(_) => self.clone_repository(), + } + } + + fn up_to_date(&self) -> Result>{ + debug!("checking repo up to date..."); + let repo = self.repository()?; + let mut remote = repo.find_remote("origin")?; + + // Fetch latest references from remote + remote.fetch(&[self.branch.clone()], None, None)?; + + let fetch_head = repo.refname_to_id(&format!("refs/remotes/origin/{}", self.branch))?; + let local_head = repo.refname_to_id(&format!("refs/heads/{}", self.branch))?; + + + Ok(fetch_head == local_head) + } + + pub fn update(&self) -> Result> { + if self.up_to_date()? { + return Ok(true); + } + debug!("updating repository..."); + let repository = self.repository()?; + let mut remote = repository.find_remote("origin")?; + let mut cb = git2::RemoteCallbacks::new(); + + cb.transfer_progress(|stats| { + if stats.received_objects() == stats.total_objects() { + print!( + "resolving deltas {}/{}\r", + stats.indexed_deltas(), + stats.total_deltas() + ); + } else if stats.total_objects() > 0 { + print!( + "received {}/{} objects ({}) in {} bytes\r", + stats.received_objects(), + stats.total_objects(), + stats.indexed_objects(), + stats.received_bytes() + ); + } + std::io::stdout().flush().unwrap(); + true + }); + + let mut fo = git2::FetchOptions::new(); + fo.remote_callbacks(cb); + // Always fetch all tags. + // Perform a download and also update tips + fo.download_tags(git2::AutotagOption::All); + info!("fetching {}...", remote.name().unwrap()); + remote.fetch(&[self.branch.clone()], Some(&mut fo), None)?; + + let fetch_head = repository.find_reference("FETCH_HEAD")?; + + do_merge( + &repository, + &self.branch, + repository.reference_to_annotated_commit(&fetch_head)?, + )?; + + Ok(true) + } + + pub fn ensure(&self) -> Result<&Self, Box> { + if self.exists_on_fs() { + self.update(); + } else { + self.clone_repository()?; + } + Ok(self) + } +} + +fn do_merge<'a>( + repo: &'a Repository, + remote_branch: &str, + fetch_commit: git2::AnnotatedCommit<'a>, +) -> Result<(), git2::Error> { + // 1. do a merge analysis + let analysis = repo.merge_analysis(&[&fetch_commit])?; + + // 2. Do the appopriate merge + if analysis.0.is_fast_forward() { + info!("doing a fast forward..."); + // do a fast forward + let refname = format!("refs/heads/{}", remote_branch); + match repo.find_reference(&refname) { + Ok(mut r) => { + fast_forward(repo, &mut r, &fetch_commit)?; + } + Err(_) => { + // The branch doesn't exist so just set the reference to the + // commit directly. Usually this is because you are pulling + // into an empty repository. + repo.reference( + &refname, + fetch_commit.id(), + true, + &format!("Setting {} to {}", remote_branch, fetch_commit.id()), + )?; + repo.set_head(&refname)?; + repo.checkout_head(Some( + git2::build::CheckoutBuilder::default() + .allow_conflicts(true) + .conflict_style_merge(true) + .force(), + ))?; + } + }; + } else if analysis.0.is_normal() { + // do a normal merge + let head_commit = repo.reference_to_annotated_commit(&repo.head()?)?; + normal_merge(&repo, &head_commit, &fetch_commit)?; + } else { + info!("nothing to do..."); + } + Ok(()) +} + +fn fast_forward( + repo: &Repository, + lb: &mut git2::Reference, + rc: &git2::AnnotatedCommit, +) -> Result<(), git2::Error> { + let name = match lb.name() { + Some(s) => s.to_string(), + None => String::from_utf8_lossy(lb.name_bytes()).to_string(), + }; + let msg = format!("fast-forward: setting {} to id: {}", name, rc.id()); + info!("{}", msg); + lb.set_target(rc.id(), &msg)?; + repo.set_head(&name)?; + repo.checkout_head(Some( + git2::build::CheckoutBuilder::default() + // For some reason the force is required to make the working directory actually get updated + // I suspect we should be adding some logic to handle dirty working directory states + // but this is just an example so maybe not. + .force(), + ))?; + Ok(()) +} + +fn normal_merge( + repo: &Repository, + local: &git2::AnnotatedCommit, + remote: &git2::AnnotatedCommit, +) -> Result<(), git2::Error> { + let local_tree = repo.find_commit(local.id())?.tree()?; + let remote_tree = repo.find_commit(remote.id())?.tree()?; + let ancestor = repo + .find_commit(repo.merge_base(local.id(), remote.id())?)? + .tree()?; + let mut idx = repo.merge_trees(&ancestor, &local_tree, &remote_tree, None)?; + + if idx.has_conflicts() { + warn!("merge conficts detected..."); + repo.checkout_index(Some(&mut idx), None)?; + return Ok(()); + } + let result_tree = repo.find_tree(idx.write_tree_to(repo)?)?; + // now create the merge commit + let msg = format!("Merge: {} into {}", remote.id(), local.id()); + let sig = repo.signature()?; + let local_commit = repo.find_commit(local.id())?; + let remote_commit = repo.find_commit(remote.id())?; + // Do our merge commit and set current branch head to that commit. + let _merge_commit = repo.commit( + Some("HEAD"), + &sig, + &sig, + &msg, + &result_tree, + &[&local_commit, &remote_commit], + )?; + // Set working tree to match head. + repo.checkout_head(None)?; + Ok(()) +} diff --git a/sync-runner/src/source/mod.rs b/sync-runner/src/source/mod.rs new file mode 100644 index 0000000..7ab1dcd --- /dev/null +++ b/sync-runner/src/source/mod.rs @@ -0,0 +1,68 @@ +use std::{env::{current_dir, set_current_dir}, fs::{create_dir_all, read_to_string}, path::PathBuf}; + +use log::{debug, info, trace}; +use serde::{Deserialize, Serialize}; + +use crate::{crates::Crate, prelude::abspath}; + +pub mod git; + +#[derive(Serialize, Deserialize, Debug)] +#[serde(default)] +pub struct Source { + interval: u64, + git: Option, +} + +impl Default for Source { + fn default() -> Self { + Source { + interval: 60, + git: None, + } + } +} + +impl Source { + pub fn available(&self) -> bool { + if let Some(git) = &self.git { + trace!("checking git..."); + return git.ensure().is_ok(); + } + false + } + + pub fn go_to_dir(&self) -> Result<(), Box> { + if let Some(git) = &self.git { + if PathBuf::from(git.repository_path_str()) == current_dir()? { + return Ok(()) + } + let dir = git.ensure()?.repository_path()?; + trace!("setting git dir as cwd... ({}@{}, {})", git.url, git.branch, dir.display()); + set_current_dir(dir)?; + } + Ok(()) + } + + pub fn get_crates(&self) -> Result, Box> { + let mut crates = vec![]; + if let Some(git) = &self.git { + trace!("getting crates from git..."); + debug!("{}", current_dir()?.display()); + + // get crates (read dir, crates/*/crate.toml) + for crate_file in glob::glob("crates/*/crate.toml").expect("err") { + debug!("{crate_file:#?}"); + match crate_file { + Ok(cd) =>{ + debug!("{}", cd.display()); + crates.push(toml::from_str(&read_to_string(cd)?)?) + }, + _ => continue + } + } + } + debug!("{:#?}", crates); + Ok(crates) + } +} diff --git a/sync.sh b/sync.sh new file mode 100644 index 0000000..fd8e62d --- /dev/null +++ b/sync.sh @@ -0,0 +1 @@ +node sync-runner/index.js diff --git a/syncr.toml b/syncr.toml new file mode 100644 index 0000000..13e4343 --- /dev/null +++ b/syncr.toml @@ -0,0 +1,17 @@ +title = "strix's syncr config" + +[daemon] +# interval +# discription: how often to check for new updates, this is the default for syncs +# you can define a custom interval for specific sources +# unit = minutes +interval = 60 + +[source.personal.git] # default is the uid +url = "https://git.saluco.nl/strix/dotfiles.git" +crate_dir = "./crates" # default +cfg_toml = "./syncr.toml" # default + +[source.work.git] +url = "https://git.saluco.nl/dotfiles.git" +branch = "work" \ No newline at end of file From ea70650c455c046e322c9b94c80330011ffd2eca Mon Sep 17 00:00:00 2001 From: Strix Date: Tue, 4 Mar 2025 22:08:08 +0100 Subject: [PATCH 176/177] feat: working app --- crates/common/crate.toml | 45 ++++--- crates/ssh/config | 22 ++++ crates/ssh/crate.toml | 11 ++ sync-runner/Cargo.lock | 187 ++++++++++++++++++++++++++++- sync-runner/Cargo.toml | 3 + sync-runner/package_manager.list | 11 -- sync-runner/src/cfg/mod.rs | 8 +- sync-runner/src/crates/action.rs | 89 ++++++++++++++ sync-runner/src/crates/manifest.rs | 28 +++++ sync-runner/src/crates/mod.rs | 86 ++++++++----- sync-runner/src/crates/package.rs | 78 ++++++++++++ sync-runner/src/crates/pm.rs | 90 -------------- sync-runner/src/main.rs | 30 +++-- sync-runner/src/prelude.rs | 6 +- sync-runner/src/source/git.rs | 18 +-- sync-runner/src/source/mod.rs | 46 ++++--- sync-runner/src/tags.rs | 71 +++++++++++ sync.sh | 7 +- syncr.toml | 14 +-- 19 files changed, 653 insertions(+), 197 deletions(-) create mode 100644 crates/ssh/config create mode 100644 crates/ssh/crate.toml delete mode 100644 sync-runner/package_manager.list create mode 100644 sync-runner/src/crates/action.rs create mode 100644 sync-runner/src/crates/manifest.rs create mode 100644 sync-runner/src/crates/package.rs delete mode 100644 sync-runner/src/crates/pm.rs create mode 100644 sync-runner/src/tags.rs diff --git a/crates/common/crate.toml b/crates/common/crate.toml index 45fc314..be4a4a8 100644 --- a/crates/common/crate.toml +++ b/crates/common/crate.toml @@ -1,23 +1,28 @@ -name = "common" -description = "Common set of utilities" +# Crate Manifest for Dotfile Processor -[pkgs] -openssh-server = {} -openssh-client = {} -git = {} -netselect = { distros = ["debian", "ubuntu"] } -reflector = { distros = ["arch"] } +[crate] +name = "dotfile-processor" +description = "A versatile crate for managing dotfiles and system configurations." +author = "Strix" -[actions] -setup_ssh = ["sh", "./scripts/%"] -reflector = { args = ["sh", "./scripts/setup_pm/%"], distro = ["arch"] } -netselect = { args = [ - "sh", - "./scripts/setup_pm/%", -], distro = [ - "debian", - "ubuntu", -] } +# List of packages to be installed +[[packages]] +name = "git" +description = "Version control system" -[super_actions] -pam_wheel = ["sh", "./scripts/%"] +[[packages]] +name = "nvim" +description = "Text editor for creating and editing files" +distro_name_mapping = { pacman = "neovim" } + +[[packages]] +name = "zsh" +description = "Shell designed for interactive use" + +[[actions.command]] +user = "root" +command = "sh ./scripts/pam_wheel.sh" +description = "Pam wheel setup" + +[metadata] +repository = "https://git.saluco.nl/strix/dotfiles" diff --git a/crates/ssh/config b/crates/ssh/config new file mode 100644 index 0000000..8c9646d --- /dev/null +++ b/crates/ssh/config @@ -0,0 +1,22 @@ +## neb servers + +# hydrogen red helix +Host H + Hostname hydrogen.red.helix.saluco.nl + +# argon red helix +Host A + Hostname argon.red.helix.saluco.nl + +# iron red sphere +Host I + Hostname iron.red.sphere.saluco.nl + +## utility servers +Host git + Hostname git.saluco.nl + User git + +Host github + Hostname github.com + User git diff --git a/crates/ssh/crate.toml b/crates/ssh/crate.toml new file mode 100644 index 0000000..d26d45e --- /dev/null +++ b/crates/ssh/crate.toml @@ -0,0 +1,11 @@ +[crate] +name = "ssh" +author = "Strix" +description = "fixes the ssh files" + +[[actions.command]] +command = "ls -lah" + +[[actions.link]] +src = "./config" +dest = "~/.ssh/config" \ No newline at end of file diff --git a/sync-runner/Cargo.lock b/sync-runner/Cargo.lock index 3493d48..0eb3d2a 100644 --- a/sync-runner/Cargo.lock +++ b/sync-runner/Cargo.lock @@ -76,6 +76,12 @@ dependencies = [ "generic-array 0.14.7", ] +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + [[package]] name = "cc" version = "1.2.15" @@ -167,6 +173,17 @@ dependencies = [ "typenum", ] +[[package]] +name = "dbus" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" +dependencies = [ + "libc", + "libdbus-sys", + "winapi", +] + [[package]] name = "digest" version = "0.10.7" @@ -177,13 +194,33 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys 0.3.7", +] + [[package]] name = "dirs" version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ - "dirs-sys", + "dirs-sys 0.4.1", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", ] [[package]] @@ -503,6 +540,16 @@ dependencies = [ "libc", ] +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -515,6 +562,15 @@ version = "0.2.170" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" +[[package]] +name = "libdbus-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72" +dependencies = [ + "pkg-config", +] + [[package]] name = "libgit2-sys" version = "0.18.0+1.9.0" @@ -643,6 +699,15 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "redox_syscall" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.4.6" @@ -683,6 +748,15 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "resolve-path" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "321e5e41b3b192dab6f1e75b9deacb6688b4b8c5e68906a78e8f43e7c2887bb5" +dependencies = [ + "dirs 4.0.0", +] + [[package]] name = "serde" version = "1.0.218" @@ -729,7 +803,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b" dependencies = [ - "dirs", + "dirs 5.0.1", ] [[package]] @@ -773,6 +847,7 @@ version = "0.1.0" dependencies = [ "clap", "colored", + "dbus", "execute", "fern", "git2", @@ -781,10 +856,12 @@ dependencies = [ "lazy_static", "log", "regex", + "resolve-path", "serde", "sha2", "shellexpand", "toml", + "whoami", ] [[package]] @@ -921,6 +998,112 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "whoami" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +dependencies = [ + "redox_syscall", + "wasite", + "web-sys", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-sys" version = "0.48.0" diff --git a/sync-runner/Cargo.toml b/sync-runner/Cargo.toml index 4eaa739..6ef4146 100644 --- a/sync-runner/Cargo.toml +++ b/sync-runner/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] clap = { version = "4.5.29", features = ["derive"] } colored = "3.0.0" +dbus = "0.9.7" execute = "0.2.13" fern = "0.7.1" git2 = "0.20.0" @@ -14,7 +15,9 @@ hex = "0.4.3" lazy_static = "1.5.0" log = "0.4.26" regex = "1.11.1" +resolve-path = "0.1.0" serde = { version = "1.0.218", features = ["serde_derive"] } sha2 = "0.10.8" shellexpand = "3.1.0" toml = "0.8.20" +whoami = "1.5.2" diff --git a/sync-runner/package_manager.list b/sync-runner/package_manager.list deleted file mode 100644 index e175111..0000000 --- a/sync-runner/package_manager.list +++ /dev/null @@ -1,11 +0,0 @@ -install(pacman): pacman -Sy %args -uninstall(pacman): pacman -Rn %args - -install(apt): apt install %args -uninstall(apt): apt remove %args - -install(dnf): dnf install %args -uninstall(dnf): dnf remove %args - -install(yum): yum install %args -uninstall(yum): yum remove %args diff --git a/sync-runner/src/cfg/mod.rs b/sync-runner/src/cfg/mod.rs index 1f56292..44f4c48 100644 --- a/sync-runner/src/cfg/mod.rs +++ b/sync-runner/src/cfg/mod.rs @@ -1,7 +1,7 @@ #![allow(unused)] -use std::collections::HashMap; +use std::{collections::HashMap, fs::read_to_string}; use serde::{Deserialize, Serialize}; @@ -13,3 +13,9 @@ pub struct Config { pub daemon: daemon::Daemon, pub source: HashMap } + +impl Config { + pub fn parse(path: &str) -> Result> { + Ok(toml::from_str::(&read_to_string(path)?)?) + } +} diff --git a/sync-runner/src/crates/action.rs b/sync-runner/src/crates/action.rs new file mode 100644 index 0000000..5a43b7c --- /dev/null +++ b/sync-runner/src/crates/action.rs @@ -0,0 +1,89 @@ +use std::{ + collections::HashMap, fs, process::{Command, Stdio}, time::Duration +}; + +use dbus::{ + arg::Variant, + blocking::{BlockingSender, Connection}, + Message, +}; +use log::{debug, error, info, trace}; +use resolve_path::PathResolveExt; +use serde::{Deserialize, Serialize}; + +use crate::{tags::Tag}; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Actions { + /// command actions + #[serde(rename = "command")] + pub commands: Option>, + /// link actions + #[serde(rename = "link")] + pub links: Option>, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct CommandAction { + #[serde(default = "whoami::username")] + user: String, + command: String, + pub description: Option, + pub require: Option>, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinkAction { + pub src: String, + pub dest: String, +} + +impl CommandAction { + pub fn new>(command: S, user: S) -> Self { + Self { + command: command.into(), + user: user.into(), + description: None, + require: None + } + } + + pub fn run(&self) -> Result> { + trace!("running \"{}\" as {}...", &self.command, &self.user); + if self.user != whoami::username() { + Ok(Command::new("sudo") + .arg("-u") + .arg(&self.user) + .arg("--") + .arg("sh") + .arg("-c") + .arg(&self.command) + .status()? + .code() + .unwrap_or(1)) + } else { + Ok(Command::new("sh") + .arg("-c") + .arg(&self.command) + .status()? + .code() + .unwrap_or(1)) + } + } +} + +impl LinkAction { + pub fn link(&self) -> Result<(), Box> { + trace!("linking from {:?} to {:?}...", &self.src.resolve(), &self.dest.resolve()); + if let Ok(existing) = fs::read_link(&self.dest.resolve()) { + if existing == self.src.resolve() { + debug!("link OK"); + return Ok(()); + } else { + return Err("Destination is linked to a different path".into()); + } + } + std::os::unix::fs::symlink(&self.src.resolve(), &self.dest.resolve())?; + Ok(()) + } +} \ No newline at end of file diff --git a/sync-runner/src/crates/manifest.rs b/sync-runner/src/crates/manifest.rs new file mode 100644 index 0000000..70c85fe --- /dev/null +++ b/sync-runner/src/crates/manifest.rs @@ -0,0 +1,28 @@ +use std::fmt::Display; + +use serde::{Deserialize, Serialize}; + +use super::{action::Actions, package::Package}; + +#[derive(Serialize, Deserialize, Debug)] +pub struct CrateManifest { + #[serde(rename = "crate")] + pub crate_info: CrateInfo, + pub packages: Option>, + pub actions: Option, + pub metadata: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct CrateInfo { + pub name: String, + pub description: String, + pub author: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Metadata { + pub homepage: Option, + pub repository: Option, + pub issues: Option, +} \ No newline at end of file diff --git a/sync-runner/src/crates/mod.rs b/sync-runner/src/crates/mod.rs index ec3d5dd..af10023 100644 --- a/sync-runner/src/crates/mod.rs +++ b/sync-runner/src/crates/mod.rs @@ -1,34 +1,62 @@ -use std::collections::HashMap; - +use log::{error, info, warn}; +use manifest::CrateManifest; +use package::PackageManager; use serde::{Deserialize, Serialize}; -mod pm; +pub mod action; +pub mod manifest; +pub mod package; -#[derive(Debug, Serialize, Deserialize)] -pub struct Package { - name: String, -} - -impl Package { - pub fn install(&self) { - todo!() - } - - pub fn uninstall(&self) { - todo!() - } -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct CrateAction { - pub name: String, - pub command: String, - pub args: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] pub struct Crate { - pub pkgs: HashMap, - pub actions: HashMap, - pub super_actions: HashMap, + pub manifest: CrateManifest, +} + +impl Crate { + pub fn from_toml_str(string: &str) -> Result { + Ok(Crate { + manifest: toml::from_str::(string)?, + }) + } + + pub fn install_packages(&self) -> bool { + if let Some(packages) = &self.manifest.packages { + info!("Installing packages..."); + let pkgs: Vec = packages + .iter() + .map(|p| p.get_correct_package_name()) + .collect(); + info!(target: "item", "pkgs: {}", pkgs.join(", ")); + if let Some(pm) = PackageManager::get_available() { + pm.install(pkgs).is_ok() + } else { + false + } + } else { + false + } + } + + pub fn run_actions(&self) -> Result<(), Box> { + if let Some(actions) = &self.manifest.actions { + if let Some(commands) = &actions.commands { + for command in commands { + info!( + "Running {}...", + &command.description.clone().unwrap_or("action".to_string()) + ); + command.run()?; + } + } + if let Some(links) = &actions.links { + for link in links { + info!("Link {} -> {}...", link.src, link.dest); + if let Err(e) = link.link() { + error!("could not link: {e}"); + continue; + } + } + } + } + Ok(()) + } } diff --git a/sync-runner/src/crates/package.rs b/sync-runner/src/crates/package.rs new file mode 100644 index 0000000..2e11f8d --- /dev/null +++ b/sync-runner/src/crates/package.rs @@ -0,0 +1,78 @@ +use std::{collections::HashMap, io}; + +use log::{error, info}; +use serde::{Deserialize, Serialize}; + +use super::action::CommandAction; + +#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash)] +pub enum PackageManager { + #[serde(rename = "pacman")] + Pacman, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Package { + pub name: String, + pub distro_name_mapping: Option>, +} + +impl PackageManager { + pub fn install(&self, packages: Vec) -> Result> { + match &self { + PackageManager::Pacman => { + CommandAction::new( + format!("pacman -S --noconfirm {}", packages.join(" ")), + "root".to_string(), + ) + .run()?; + } + } + Ok(true) + } + + pub fn get_available() -> Option { + Self::from_str(match whoami::distro().as_str() { + "Manjaro Linux" => "pacman", + _ => "unknown" + }) + } + + pub fn from_str(distro: &str) -> Option { + match distro { + "pacman" => Some(PackageManager::Pacman), + _ => None, + } + } +} + +impl Package { + pub fn get_correct_package_name(&self) -> String { + if let Some(pm) = PackageManager::get_available() { + if let Some(mappings) = &self.distro_name_mapping { + if let Some(name) = mappings.get(&pm) { + name.to_string() + } else { + self.name.clone() + } + } else { + self.name.clone() + } + } else { + self.name.clone() + } + } + + pub fn install(&self) -> Result> { + if let Some(pm) = PackageManager::get_available() { + pm.install(vec![self.get_correct_package_name()])?; + } else { + error!("no package manager found..."); + return Err(Box::new(io::Error::new( + io::ErrorKind::NotFound, + "package manager not found", + ))); + } + Ok(false) + } +} diff --git a/sync-runner/src/crates/pm.rs b/sync-runner/src/crates/pm.rs deleted file mode 100644 index 692ec15..0000000 --- a/sync-runner/src/crates/pm.rs +++ /dev/null @@ -1,90 +0,0 @@ -use lazy_static::lazy_static; -use regex::Regex; -use std::{process::Command, str::FromStr}; - -const pm_cfg: &str = include_str!("../../package_manager.list"); - -/// regex: `(?[a-z]+)>(?(?:un)?install+): (?.*)` -/// example: pacman>install: pacman -Sy %args - -lazy_static! { - static ref PM_REGEX: Regex = - Regex::new(r"(?P[a-z]+)>(?P(?:un)?install+): (?P.*)").unwrap(); -} - -#[derive(Debug)] -struct PackageManager { - name: String, - command: String, - args: Vec, -} - -impl PackageManager { - fn new(name: &str, command: &str, args: Vec) -> Self { - Self { - name: name.to_string(), - command: command.to_string(), - args, - } - } - - pub fn install(&self, packages: Vec) -> Result<(), Vec> { - Command::new(&self.command) - .args(&self.args) - .args(packages) - .spawn() - .expect("err"); - Ok(()) - } - pub fn uninstall(&self, packages: Vec) -> Result<(), Vec> { - todo!(); - } -} -impl FromStr for PackageManager { - type Err = String; - fn from_str(s: &str) -> Result { - let caps = PM_REGEX.captures(s).ok_or("invalid package manager")?; - let name = caps.name("pm").ok_or("invalid package manager")?.as_str(); - let command = caps - .name("command") - .ok_or("invalid package manager")? - .as_str(); - let args = caps - .name("args") - .ok_or("invalid package manager")? - .as_str() - .split_whitespace() - .map(|s| s.to_string()) - .collect(); - Ok(Self::new(name, command, args)) - } -} -#[derive(Debug)] -struct Package { - name: String, -} -impl FromStr for Package { - type Err = String; - fn from_str(s: &str) -> Result { - let caps = PM_REGEX.captures(s).ok_or("invalid package")?; - let name = caps.name("name").ok_or("invalid package")?.as_str(); - Ok(Self::new(name)) - } -} - -impl Package { - fn new(name: &str) -> Self { - Self { - name: name.to_string(), - } - } -} - -pub fn package_managers() -> Vec { - pm_cfg - .lines() - .map(|s| s.to_string()) - .map(|s| s.parse::()) - .collect::, String>>() - .expect("invalid package manager") -} diff --git a/sync-runner/src/main.rs b/sync-runner/src/main.rs index 539e733..5735a1e 100644 --- a/sync-runner/src/main.rs +++ b/sync-runner/src/main.rs @@ -19,16 +19,13 @@ mod crates; mod logging; mod prelude; mod source; +mod tags; fn main() -> Result<(), Box> { logging::setup_logger()?; - let git_sha1 = String::from_utf8( - command_args!("git", "rev-parse", "HEAD") - .stdout(Stdio::piped()) - .execute_output()? - .stdout, - )?; + info!(target: "item", "user: {}", whoami::username()); + info!(target: "item", "distro: {}", whoami::distro()); let action = Action::parse(); match action { @@ -38,8 +35,7 @@ fn main() -> Result<(), Box> { trace!("setting config dir as cwd... {config_path}"); set_current_dir(config_path)?; } - let config = - toml::from_str::(&read_to_string(abspath("./syncr.toml").unwrap())?)?; + let config = Config::parse(&abspath("./syncr.toml").unwrap())?; info!("syncing \"{}\"...", config.title.bold()); info!("updating sources..."); @@ -63,10 +59,24 @@ fn main() -> Result<(), Box> { for source in available_sources { // cd to source dir source.go_to_dir()?; - for c in source.get_crates()? { - info!("{} pkgs", c.pkgs.len()) + for (mut path, c) in source.get_crates()? { + path.pop(); + set_current_dir(absolute(path)?)?; + info!("Syncing crate: {}...", c.manifest.crate_info.name); + + c.install_packages(); + + if let Err(e) = c.run_actions() { + error!("action failed: {e}"); + } + + set_current_dir(&oldpwd)?; // i hate this but im lazy okay + source.go_to_dir()?; } } + set_current_dir(oldpwd)?; + + info!("Completed sync."); } _ => { println!("{action:#?}"); diff --git a/sync-runner/src/prelude.rs b/sync-runner/src/prelude.rs index 0b1994b..f318ed2 100644 --- a/sync-runner/src/prelude.rs +++ b/sync-runner/src/prelude.rs @@ -1,5 +1,9 @@ +use std::path::{Path, PathBuf}; + +use std::env; + pub fn abspath(p: &str) -> Option { let exp_path = shellexpand::full(p).ok()?; let can_path = std::fs::canonicalize(exp_path.as_ref()).ok()?; can_path.into_os_string().into_string().ok() -} \ No newline at end of file +} diff --git a/sync-runner/src/source/git.rs b/sync-runner/src/source/git.rs index 8ad2389..408011c 100644 --- a/sync-runner/src/source/git.rs +++ b/sync-runner/src/source/git.rs @@ -1,8 +1,11 @@ use std::{ - env::current_dir, fs::{self, create_dir_all, exists}, io::Write, path::{Path, PathBuf} + env::current_dir, + fs::{self, create_dir_all, exists}, + io::Write, + path::{Path, PathBuf}, }; -use git2::Repository; +use git2::{build::RepoBuilder, Repository}; use log::{debug, info, trace, warn}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256, Sha512}; @@ -30,13 +33,13 @@ impl Git { fn branch_hash(&self) -> String { let mut hasher = Sha256::new(); - hasher.update(&self.url); + hasher.update(&self.branch); let hash = hasher.finalize(); hex::encode(hash) } pub fn repository_path_str(&self) -> String { - format!(".data/git/{}{}", self.url_hash(), self.branch_hash()) + format!(".data/git/{}.{}", self.url_hash(), self.branch_hash()) } pub fn repository_path(&self) -> Result { @@ -48,7 +51,9 @@ impl Git { } pub fn clone_repository(&self) -> Result { - Repository::clone_recurse(&self.url, Path::new(&self.repository_path_str())) + RepoBuilder::new() + .branch(&self.branch) + .clone(&self.url, Path::new(&self.repository_path_str())) } pub fn repository(&self) -> Result { @@ -61,7 +66,7 @@ impl Git { } } - fn up_to_date(&self) -> Result>{ + fn up_to_date(&self) -> Result> { debug!("checking repo up to date..."); let repo = self.repository()?; let mut remote = repo.find_remote("origin")?; @@ -72,7 +77,6 @@ impl Git { let fetch_head = repo.refname_to_id(&format!("refs/remotes/origin/{}", self.branch))?; let local_head = repo.refname_to_id(&format!("refs/heads/{}", self.branch))?; - Ok(fetch_head == local_head) } diff --git a/sync-runner/src/source/mod.rs b/sync-runner/src/source/mod.rs index 7ab1dcd..9b43853 100644 --- a/sync-runner/src/source/mod.rs +++ b/sync-runner/src/source/mod.rs @@ -1,4 +1,8 @@ -use std::{env::{current_dir, set_current_dir}, fs::{create_dir_all, read_to_string}, path::PathBuf}; +use std::{ + env::{current_dir, set_current_dir}, + fs::{create_dir_all, exists, read_to_string}, + path::PathBuf, +}; use log::{debug, info, trace}; use serde::{Deserialize, Serialize}; @@ -12,6 +16,7 @@ pub mod git; pub struct Source { interval: u64, git: Option, + dir: Option, } impl Default for Source { @@ -19,6 +24,7 @@ impl Default for Source { Source { interval: 60, git: None, + dir: None, } } } @@ -29,40 +35,44 @@ impl Source { trace!("checking git..."); return git.ensure().is_ok(); } + if let Some(dir) = &self.dir { + return exists(dir).is_ok(); + } false } pub fn go_to_dir(&self) -> Result<(), Box> { if let Some(git) = &self.git { if PathBuf::from(git.repository_path_str()) == current_dir()? { - return Ok(()) + return Ok(()); } let dir = git.ensure()?.repository_path()?; - trace!("setting git dir as cwd... ({}@{}, {})", git.url, git.branch, dir.display()); + trace!( + "setting git dir as cwd... ({}@{}, {})", + git.url, + git.branch, + dir.display() + ); set_current_dir(dir)?; } + if let Some(path) = &self.dir { + set_current_dir(path)?; + } Ok(()) } - pub fn get_crates(&self) -> Result, Box> { + pub fn get_crates(&self) -> Result, Box> { let mut crates = vec![]; - if let Some(git) = &self.git { - trace!("getting crates from git..."); - debug!("{}", current_dir()?.display()); - - // get crates (read dir, crates/*/crate.toml) - for crate_file in glob::glob("crates/*/crate.toml").expect("err") { - debug!("{crate_file:#?}"); - match crate_file { - Ok(cd) =>{ - debug!("{}", cd.display()); - crates.push(toml::from_str(&read_to_string(cd)?)?) - }, - _ => continue + // get crates (read dir, crates/*/crate.toml) + for crate_file in glob::glob("crates/*/crate.toml").expect("err") { + match crate_file { + Ok(cd) => { + debug!("found {}", cd.display()); + crates.push((cd.clone(), Crate::from_toml_str(&read_to_string(cd)?)?)) } + _ => continue, } } - debug!("{:#?}", crates); Ok(crates) } } diff --git a/sync-runner/src/tags.rs b/sync-runner/src/tags.rs new file mode 100644 index 0000000..4be8d32 --- /dev/null +++ b/sync-runner/src/tags.rs @@ -0,0 +1,71 @@ +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[derive(Debug)] +pub struct Tag { + pub category: String, + pub value: String +} + +impl<'de> Deserialize<'de> for Tag { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + // First, deserialize the string + let s: String = Deserialize::deserialize(deserializer)?; + + // Split the string into category and value by ":" + let parts: Vec<&str> = s.splitn(2, ':').collect(); + if parts.len() != 2 { + return Err(serde::de::Error::invalid_value( + serde::de::Unexpected::Str(&s), + &"a string in the format 'category:value'", + )); + } + + // Return a Tag with the split parts + Ok(Tag { + category: parts[0].to_string(), + value: parts[1].to_string(), + }) + } +} + +impl Serialize for Tag { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(&format!("{}:{}", self.category, self.value)) + } +} + +impl Into for Tag { + fn into(self) -> String { + self.category + " : " + &self.value + } +} + +impl TryFrom for Tag { + type Error = std::io::Error; + fn try_from(value: String) -> Result { + let parts: Vec<&str> = value.split(':').collect(); + if parts.len() != 2 { + Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "could not match string to tag")) + } else { + Ok(Self { + category: parts[0].into(), + value: parts[1].into() + }) + } + } +} + +impl Tag { + pub fn distro() -> Tag { + Tag { + category: "distro".into(), + value: whoami::distro() + } + } +} \ No newline at end of file diff --git a/sync.sh b/sync.sh index fd8e62d..e0d44c3 100644 --- a/sync.sh +++ b/sync.sh @@ -1 +1,6 @@ -node sync-runner/index.js +if ! [ -f /tmp/sync-runner ]; then + curl -O /tmp/sync-runner https://git.saluco.nl/repos/strix/releases/download/latest/sync-runner + chmod +x /tmp/sync-runner +fi + +/tmp/sync-runner \ No newline at end of file diff --git a/syncr.toml b/syncr.toml index 13e4343..d012160 100644 --- a/syncr.toml +++ b/syncr.toml @@ -7,11 +7,11 @@ title = "strix's syncr config" # unit = minutes interval = 60 -[source.personal.git] # default is the uid -url = "https://git.saluco.nl/strix/dotfiles.git" -crate_dir = "./crates" # default -cfg_toml = "./syncr.toml" # default +[source.personal] +dir = "." -[source.work.git] -url = "https://git.saluco.nl/dotfiles.git" -branch = "work" \ No newline at end of file +# [source.personal.git] # default is the uid +# url = "https://git.saluco.nl/strix/dotfiles.git" +# branch = "syncr" +# crate_dir = "./crates" # default +# cfg_toml = "./syncr.toml" # default From eb3e637462dff833aecdec39ef395a1d95db0e76 Mon Sep 17 00:00:00 2001 From: Strix Date: Tue, 4 Mar 2025 22:34:13 +0100 Subject: [PATCH 177/177] fix: crates --- crates/common/crate.toml | 10 +- crates/i3/crate.toml | 62 +++++++++ crates/i3/files/i3config | 206 +++++++++++++++++++++++++++++ crates/i3/files/i3status_config | 57 ++++++++ crates/i3/files/picom.conf | 9 ++ crates/i3/files/touchpad.conf | 8 ++ crates/ssh/crate.toml | 1 - crates/vim/crate.toml | 15 +++ crates/vim/ideavimrc | 10 ++ crates/vim/init.vim | 27 ++++ crates/zsh/crate.toml | 14 ++ crates/zsh/setup-omzsh.sh | 10 ++ crates/zsh/zshrc | 44 ++++++ sync-runner/src/crates/action.rs | 27 +++- sync-runner/src/crates/manifest.rs | 1 - 15 files changed, 487 insertions(+), 14 deletions(-) create mode 100644 crates/i3/crate.toml create mode 100644 crates/i3/files/i3config create mode 100644 crates/i3/files/i3status_config create mode 100644 crates/i3/files/picom.conf create mode 100644 crates/i3/files/touchpad.conf create mode 100644 crates/vim/crate.toml create mode 100644 crates/vim/ideavimrc create mode 100644 crates/vim/init.vim create mode 100644 crates/zsh/crate.toml create mode 100644 crates/zsh/setup-omzsh.sh create mode 100644 crates/zsh/zshrc diff --git a/crates/common/crate.toml b/crates/common/crate.toml index be4a4a8..8afd2d8 100644 --- a/crates/common/crate.toml +++ b/crates/common/crate.toml @@ -1,11 +1,7 @@ -# Crate Manifest for Dotfile Processor - [crate] -name = "dotfile-processor" +name = "common" description = "A versatile crate for managing dotfiles and system configurations." -author = "Strix" -# List of packages to be installed [[packages]] name = "git" description = "Version control system" @@ -24,5 +20,9 @@ user = "root" command = "sh ./scripts/pam_wheel.sh" description = "Pam wheel setup" +[[actions.command]] +command = "git config --global user.name Strix && git config --global user.email strix@saluco.nl" +description = "git setup" + [metadata] repository = "https://git.saluco.nl/strix/dotfiles" diff --git a/crates/i3/crate.toml b/crates/i3/crate.toml new file mode 100644 index 0000000..399166a --- /dev/null +++ b/crates/i3/crate.toml @@ -0,0 +1,62 @@ +[crate] +name = "i3" +description = "install and setup i3" + +[[packages]] +name = "i3" + +[[packages]] +name = "i3lock" + +[[packages]] +name = "i3status" + +[[packages]] +name = "libpulse" +require = ["distro:arch"] + +[[packages]] +name = "brightnessctl" + +[[packages]] +name = "xss-lock" + +[[packages]] +name = "dex" + +[[packages]] +name = "maim" + +[[packages]] +name = "dmenu" + +[[packages]] +name = "gnome-keyring" + +[[packages]] +name = "feh" + +[[packages]] +name = "picom" + +[[actions.link]] +src = "files/i3config" +dest = "~/.config/i3/config" + +[[actions.link]] +src = "files/i3status_config" +dest = "~/.config/i3status/config" + +[[actions.link]] +src = "files/picom.conf" +dest = "~/.config/picom.conf" + +[[actions.command]] +user = "root" +command = "[ -d '/etc/X11/xorg.conf.d' ] || mkdir -p /etc/X11/xorg.conf.d/" +description = "ensure /etc/X11/xorg.conf.d" + +[[actions.command]] +user = "root" +command = "cp files/touchpad.conf /etc/X11/xorg.conf.d/40-touchpad.conf" +description = "copy touchpad config to /etc/X11/xorg.conf.d" diff --git a/crates/i3/files/i3config b/crates/i3/files/i3config new file mode 100644 index 0000000..18e8618 --- /dev/null +++ b/crates/i3/files/i3config @@ -0,0 +1,206 @@ +####################### +## Strix' i3 config ## +## Mar 22, 2023 ## +## mutation: 1m ## +####################### + +## Mostly similar to i3's config yet differs + +# Useful variables: +# This section probably gets changed a lot +# --- +set $terminal alacritty +set $screen_lock i3lock -c "#111111" --nofork +set $appmenu i3-dmenu-desktop + +set $screenshot maim -s | xclip -selection clipboard -t image/png + +set $font pango:monospace 8 + +# Startup Applications: +# Things that will startup when starting i3. +# --- +exec_always --no-startup-id dex --autostart --environment i3 +exec_always --no-startup-id nm-applet +exec_always --no-startup-id xss-lock --transfer-sleep-lock -- $screen_lock +exec_always --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11 +exec_always --no-startup-id feh --bg-fill ~/Pictures/wallpaper.jpg +exec_always --no-startup-id picom + +# Gaps & Borders: +# --- +gaps inner 10 +smart_gaps on + +default_border pixel 1 +hide_edge_borders smart_no_gaps + +# Extra variables: +# Only need changing for very specific installations. +# --- +set $audio_volume_up XF86AudioRaiseVolume +set $audio_volume_down XF86AudioLowerVolume +set $audio_mute XF86AudioMute +set $audio_mute_mic XF86AudioMicMute + +set $brightness_up XF86MonBrightnessUp +set $brightness_down XF86MonBrightnessDown + +set $ws_1 "1:main" +set $ws_2 "2:term" +set $ws_3 "3:docs" +set $ws_4 "4:mail" +set $ws_5 "5" +set $ws_6 "6" +set $ws_7 "7" +set $ws_8 "8" +set $ws_9 "9:bg" +set $ws_10 "10:misc" + +set $meta_refresh_statusbar killall -SIGUSR1 i3status +bar { + strip_workspace_numbers yes + status_command i3status +} + +# END OF CONFIG + +set $mod Mod4 +set $alt Mod1 + +# Customization + +# class border backgr. text indic. child_border +client.focused #81A1C1 #81A1C1 #ffffff #D8DEE9 +client.focused_inactive #2E3440 #2E3440 #88C0D0 #454948 +client.unfocused #2E3440 #2E3440 #88C0D0 #454948 +client.urgent #D08770 #3B4252 #ffffff #268BD2 +client.placeholder #000000 #0c0c0c #ffffff #000000 +client.background #3B4252 + +# Generic +floating_modifier $mod +tiling_drag modifier titlebar +font $font + +# Open a terminal +bindsym $mod+Return exec $terminal + +# Kill current window +bindsym $mod+$alt+q kill + +# Open app menu +bindsym $mod+d exec --no-startup-id $appmenu + +# Lock screen +bindsym $mod+l exec --no-startup-id $screen_lock + +# Screenshots +bindsym Print exec --no-startup-id $screenshot + +# Audio +bindsym $audio_volume_up exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $meta_refresh_statusbar +bindsym $audio_volume_down exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $meta_refresh_statusbar +bindsym $audio_mute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $meta_refresh_statusbar +bindsym $audio_mute_mic exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $meta_refresh_statusbar + +# Brightness +bindsym $brightness_up exec --no-startup-id brightnessctl set +5% && $meta_refresh_statusbar +bindsym $brightness_down exec --no-startup-id brightnessctl set 5%- && $meta_refresh_statusbar + +# Change focused window +bindsym $mod+Up focus up +bindsym $mod+Down focus down +bindsym $mod+Left focus left +bindsym $mod+Right focus right + +# Move focused window +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Right move right + +# Splits +bindsym $mod+Shift+h split h +bindsym $mod+Shift+v split v + +# Change container layout +bindsym $mod+Shift+s layout stacking +bindsym $mod+Shift+t layout tabbed +bindsym $mod+Shift+d layout toggle split + +# Make current window fullscreen +bindsym $mod+Shift+f fullscreen toggle + +# Floating stuff +bindsym $mod+space focus mode_toggle +bindsym $mod+Shift+space floating toggle + +# Scratchpad +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + +# Switch to workspace +bindsym $mod+1 workspace $ws_1 +bindsym $mod+2 workspace $ws_2 +bindsym $mod+3 workspace $ws_3 +bindsym $mod+4 workspace $ws_4 +bindsym $mod+5 workspace $ws_5 +bindsym $mod+6 workspace $ws_6 +bindsym $mod+7 workspace $ws_7 +bindsym $mod+8 workspace $ws_8 +bindsym $mod+9 workspace $ws_9 +bindsym $mod+0 workspace $ws_10 + +# Move focused container to workspace +bindsym $mod+Shift+1 move container to workspace $ws_1 +bindsym $mod+Shift+2 move container to workspace $ws_2 +bindsym $mod+Shift+3 move container to workspace $ws_3 +bindsym $mod+Shift+4 move container to workspace $ws_4 +bindsym $mod+Shift+5 move container to workspace $ws_5 +bindsym $mod+Shift+6 move container to workspace $ws_6 +bindsym $mod+Shift+7 move container to workspace $ws_7 +bindsym $mod+Shift+8 move container to workspace $ws_8 +bindsym $mod+Shift+9 move container to workspace $ws_9 +bindsym $mod+Shift+0 move container to workspace $ws_10 + +# Move through workspaces +bindsym $mod+$alt+Left workspace prev +bindsym $mod+$alt+Right workspace next + +# WM stuff +# reload i3 config +bindsym $mod+$alt+c reload +# restart i3 +bindsym $mod+$alt+r restart +# exit i3 +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes, exit i3' 'i3-msg exit'" + +# Modes +bindsym $mod+r mode resize +mode "resize" { + bindsym $nav_left resize shrink width 10 px or 10 ppt + bindsym $nav_down resize grow height 10 px or 10 ppt + bindsym $nav_up resize shrink height 10 px or 10 ppt + bindsym $nav_right resize grow width 10 px or 10 ppt + 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 + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+s mode "session" +mode "session" { + bindsym l exec --no-startup-id $lock, mode "default" + bindsym e exec --no-startup-id i3-msg exit, 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" + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+s mode "default" +} diff --git a/crates/i3/files/i3status_config b/crates/i3/files/i3status_config new file mode 100644 index 0000000..3fce4a7 --- /dev/null +++ b/crates/i3/files/i3status_config @@ -0,0 +1,57 @@ +general { + output_format = "i3bar" + colors = true + interval = 5 +} + +order += "ipv6" +order += "wireless wlp58s0" +order += "battery 0" +order += "disk /" +order += "memory" +order += "load" +order += "tztime local" + +wireless wlp58s0 { + format_up = "W: (%quality at %essid, %bitrate) %ip" + format_down = "W: down" +} + +battery 0 { + format = "%status %percentage %remaining %emptytime" + format_down = "No battery" + status_chr = "โšก CHR" + status_bat = "๐Ÿ”‹ BAT" + status_unk = "? UNK" + status_full = "โ˜ป FULL" + path = "/sys/class/power_supply/BAT%d/uevent" + low_threshold = 10 +} + +tztime local { + format = "%Y-%m-%d %H:%M:%S" + hide_if_equals_localtime = false +} + +tztime berlin { + format = "%Y-%m-%d %H:%M:%S %Z" + timezone = "Europe/Berlin" +} + +load { + format = "%5min" +} + +memory { + format = "%used" + threshold_degraded = "10%" + format_degraded = "MEMORY: %free" +} + +disk "/" { + format = "%free" +} + +read_file uptime { + path = "/proc/uptime" +} diff --git a/crates/i3/files/picom.conf b/crates/i3/files/picom.conf new file mode 100644 index 0000000..5bff83a --- /dev/null +++ b/crates/i3/files/picom.conf @@ -0,0 +1,9 @@ +inactive-opacity = 0.75; + +blur: { + method = "box"; + size = 10; + background = false; + background-frame = false; + background-fixed = false; +} diff --git a/crates/i3/files/touchpad.conf b/crates/i3/files/touchpad.conf new file mode 100644 index 0000000..80049de --- /dev/null +++ b/crates/i3/files/touchpad.conf @@ -0,0 +1,8 @@ +Section "InputClass" + Identifier "libinput touchpad catchall" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + Driver "libinput" + Option "NaturalScrolling" "True" + Option "Tapping" "on" +EndSection diff --git a/crates/ssh/crate.toml b/crates/ssh/crate.toml index d26d45e..676e2e8 100644 --- a/crates/ssh/crate.toml +++ b/crates/ssh/crate.toml @@ -1,6 +1,5 @@ [crate] name = "ssh" -author = "Strix" description = "fixes the ssh files" [[actions.command]] diff --git a/crates/vim/crate.toml b/crates/vim/crate.toml new file mode 100644 index 0000000..92810a3 --- /dev/null +++ b/crates/vim/crate.toml @@ -0,0 +1,15 @@ +[crate] +name = "vim" +description = "install & configure vim" + + +[[packages]] +name = "neovim" + +[[actions.link]] +src = "./ideavimrc" +dest = "~/.ideavimrc" + +[[actions.link]] +src = "./init.vim" +dest = "~/.config/nvim/init.vim" \ No newline at end of file diff --git a/crates/vim/ideavimrc b/crates/vim/ideavimrc new file mode 100644 index 0000000..115e47f --- /dev/null +++ b/crates/vim/ideavimrc @@ -0,0 +1,10 @@ +source ~/.vimrc + +set scrolloff=5 +set incsearch + +map Q gq + +Plug 'machakann/vim-highlightedyank' +Plug 'tpope/vim-commentary' +Plug 'wellle/targets.vim' diff --git a/crates/vim/init.vim b/crates/vim/init.vim new file mode 100644 index 0000000..d87f89e --- /dev/null +++ b/crates/vim/init.vim @@ -0,0 +1,27 @@ +" vim preferences +set number +set relativenumber +syntax on + +" No arrow keys +noremap +noremap +noremap +noremap + +" ensure vim-plug +let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +if empty(glob(data_dir . '/autoload/plug.vim')) + silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif + +call plug#begin() + +Plug 'ThePrimeagen/vim-be-good' +Plug 'machakann/vim-highlightedyank' +Plug 'tpope/vim-commentary' +Plug 'wellle/targets.vim' +Plug 'vim-scripts/loremipsum' + +call plug#end() diff --git a/crates/zsh/crate.toml b/crates/zsh/crate.toml new file mode 100644 index 0000000..1a8c65a --- /dev/null +++ b/crates/zsh/crate.toml @@ -0,0 +1,14 @@ +[crate] +name = "zsh" +description = "install & configure zsh" + +[[packages]] +name = "zsh" + +[[actions.command]] +command = "sh ./setup-omzsh.sh" +description = "oh-my-zsh setup" + +[[actions.link]] +src = "./zshrc" +dest = "~/.zshrc" \ No newline at end of file diff --git a/crates/zsh/setup-omzsh.sh b/crates/zsh/setup-omzsh.sh new file mode 100644 index 0000000..9565661 --- /dev/null +++ b/crates/zsh/setup-omzsh.sh @@ -0,0 +1,10 @@ +if [ ! -d "$HOME/.oh-my-zsh" ]; then + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended + + PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions + [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR + PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting + [ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR +fi + +[ -f "$HOME/.zshrc" ] && unlink $HOME/.zshrc \ No newline at end of file diff --git a/crates/zsh/zshrc b/crates/zsh/zshrc new file mode 100644 index 0000000..4bbe248 --- /dev/null +++ b/crates/zsh/zshrc @@ -0,0 +1,44 @@ +#!/bin/zsh + +# Raine's .zshrc + +if [ "$PROFILEINC" = "1" ]; then + . ~/.profile +fi + +export EDITOR=vim +export GPG_TTY=$(tty) +export PATH="$PATH:$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$HOME/.local/bin" + +# oh-my-zsh init +if [ -f "$HOME/.oh-my-zsh/oh-my-zsh.sh" ]; then + export ZSH="$HOME/.oh-my-zsh" + ZSH_THEME="afowler" + plugins=(git docker docker-compose node zsh-autosuggestions zsh-syntax-highlighting zsh-cargo-completion) + source $ZSH/oh-my-zsh.sh +else + echo "oh-my-zsh not detected :(" + PS1="$(whoami)@${HOSTNAME:-$(hostname)} $ " +fi + +update_dotfiles() { + cd $HOME/.dotfiles + git pull + cd - &> /dev/null +} + +container() { + docker run \ + -ti \ + --rm \ + --name tmp-$(id -u)-$(openssl rand -hex 8) \ + --network ${CONTAINER_NETWORK:-internal} \ + alpine \ + ash +} + +[ -f "$HOME/.config/i3/shortcuts-i3.sh" ] && . ~/.config/i3/shortcuts-i3.sh + +alias q="exit" +alias vim="nvim" +alias vi="nvim" diff --git a/sync-runner/src/crates/action.rs b/sync-runner/src/crates/action.rs index 5a43b7c..a4fa945 100644 --- a/sync-runner/src/crates/action.rs +++ b/sync-runner/src/crates/action.rs @@ -1,5 +1,8 @@ use std::{ - collections::HashMap, fs, process::{Command, Stdio}, time::Duration + collections::HashMap, + fs::{self, remove_file}, + process::{Command, Stdio}, + time::Duration, }; use dbus::{ @@ -11,7 +14,7 @@ use log::{debug, error, info, trace}; use resolve_path::PathResolveExt; use serde::{Deserialize, Serialize}; -use crate::{tags::Tag}; +use crate::tags::Tag; #[derive(Serialize, Deserialize, Debug)] pub struct Actions { @@ -36,6 +39,7 @@ pub struct CommandAction { pub struct LinkAction { pub src: String, pub dest: String, + overwrite: Option, } impl CommandAction { @@ -44,7 +48,7 @@ impl CommandAction { command: command.into(), user: user.into(), description: None, - require: None + require: None, } } @@ -74,16 +78,25 @@ impl CommandAction { impl LinkAction { pub fn link(&self) -> Result<(), Box> { - trace!("linking from {:?} to {:?}...", &self.src.resolve(), &self.dest.resolve()); + trace!( + "linking from {:?} to {:?}...", + &self.src.resolve(), + &self.dest.resolve() + ); if let Ok(existing) = fs::read_link(&self.dest.resolve()) { if existing == self.src.resolve() { debug!("link OK"); return Ok(()); } else { - return Err("Destination is linked to a different path".into()); + if self.overwrite.unwrap_or(false) == true { + debug!("removing {}...", self.dest); + remove_file(self.dest.resolve())?; + } else { + return Err("Destination is linked to a different path".into()); + } } } std::os::unix::fs::symlink(&self.src.resolve(), &self.dest.resolve())?; Ok(()) - } -} \ No newline at end of file + } +} diff --git a/sync-runner/src/crates/manifest.rs b/sync-runner/src/crates/manifest.rs index 70c85fe..e2d4cd3 100644 --- a/sync-runner/src/crates/manifest.rs +++ b/sync-runner/src/crates/manifest.rs @@ -17,7 +17,6 @@ pub struct CrateManifest { pub struct CrateInfo { pub name: String, pub description: String, - pub author: String, } #[derive(Serialize, Deserialize, Debug)]