From c9010fe6978f78ea61e1710bc5a674ec9769300c Mon Sep 17 00:00:00 2001 From: Raine Date: Thu, 7 Mar 2024 14:25:45 +0100 Subject: [PATCH] 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