├── .gitignore ├── LICENSE-MIT ├── README.md ├── dotfiles ├── Xresources ├── alacritty-config.yml ├── bin │ ├── backup-sync │ ├── battery-watchdog │ ├── bench │ ├── bestafk │ ├── bspwmrc │ ├── check-deps-size │ ├── clip │ ├── compiler │ ├── cpu-usage │ ├── git-change-author │ ├── gitree │ ├── howoldis │ ├── is-wayland │ ├── nmgui │ ├── record │ ├── shot │ ├── sysinfo │ ├── sysnformat │ ├── system │ ├── toggle-audio-output │ └── wifi-ap ├── cava-config ├── dunst-config ├── esp-idf-shell.nix ├── evd-shell.nix ├── i3blocks-config ├── init.vim ├── kitty-config ├── mimeapps.list ├── polybar-config ├── rofi-config ├── ros-container │ ├── Dockerfile │ ├── Webots-R2020a.conf │ ├── bashrc.sh │ ├── startup.sh │ └── tmux.conf ├── share │ └── icons │ │ └── default │ │ └── index.theme ├── ssh-config ├── sway-config ├── sxhkdrc ├── vis-config └── vscodium-settings.json ├── modules ├── home │ ├── backup.nix │ ├── cloud.nix │ ├── default.nix │ ├── hardware.nix │ ├── packages.nix │ ├── shell.nix │ ├── users.nix │ ├── wayland.nix │ └── xserver.nix ├── hosts │ ├── helium.nix │ ├── neon.nix │ ├── nixos-qemu.nix │ └── xenon.nix └── overrides │ └── thinkfan.nix └── pkgs ├── custom ├── bitpocket.nix ├── bobthefish.nix ├── chip8.nix ├── compton-latest.nix ├── dotfiles-background.nix ├── dotfiles-bin.nix ├── esp32-toolchain.nix ├── inter-font.nix ├── kernel-gcc-patch.nix ├── kristvanity.nix ├── ls_extended.nix ├── luakit.nix ├── riko4.nix ├── sway-session.nix ├── technic-launcher.nix └── thelounge.nix ├── nur-packages.nix ├── overlays ├── custom.nix ├── default.nix ├── dotfiles.nix └── overrides.nix └── overrides ├── emacs.nix ├── neovim.nix ├── the-powder-toy.nix ├── update-resolv-conf.nix └── urn.nix /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | nixos-qemu.qcow2 3 | TODO.md 4 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CrazedProgrammer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nix 2 | 3 | My NixOS configuration files. 4 | 5 | # Structure 6 | 7 | `dotfiles/` contains dotfiles and scripts such as `init.vim` and 8 | `bin/gitree`. 9 | 10 | `modules/` contains NixOS configuration modules. Each machine has its 11 | "entry point" in `modules/hosts/.nix`. `/etc/nixos/configuration.nix` 12 | is empty and only contains an import of the corresponding entry point. 13 | 14 | `pkgs/` contains overlays, custom packages and overrides. 15 | 16 | # Building 17 | 18 | In order to build this configuration, you need to use these channels: 19 | 20 | ``` 21 | nixos https://nixos.org/channels/nixos-24.11 22 | nixos-unstable https://nixos.org/channels/nixos-unstable 23 | ``` 24 | -------------------------------------------------------------------------------- /dotfiles/Xresources: -------------------------------------------------------------------------------- 1 | Xcursor.theme: Paper 2 | -------------------------------------------------------------------------------- /dotfiles/alacritty-config.yml: -------------------------------------------------------------------------------- 1 | font: 2 | normal: 3 | family: "Fira Code" 4 | bold: 5 | family: "Fira Code" 6 | style: "Bold" 7 | italic: 8 | family: "Fira Code" 9 | style: "Oblique" 10 | size: 9.0 11 | offset: 12 | y: 1 13 | 14 | colors: 15 | primary: 16 | foreground: "0xABB2BF" 17 | background: "0x101010" 18 | cursor: 19 | cursor: "0x93A1A1" 20 | selection: 21 | text: "0x161616" 22 | background: "0x91A1A1" 23 | 24 | 25 | background_opacity: 0.85 26 | 27 | live_config_reload: false 28 | 29 | draw_bold_text_with_bright_colors: false 30 | 31 | -------------------------------------------------------------------------------- /dotfiles/bin/backup-sync: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIRS_LOCATION="$HOME/.private/backup-list" 4 | PASSWD_LOCATION="$HOME/.private/backup-passwd" 5 | 6 | BACKUP_PATH="/var/lib/backup" 7 | BACKUP_ROOT_PATH="$BACKUP_PATH/root" 8 | BACKUP_ARCHIVE_PATH="$BACKUP_PATH/archive" 9 | REMOTE_BACKUP_ARCHIVE_PATH="/home/casper/backup/$(hostname)" 10 | 11 | ZIP_METHOD="lz4" 12 | ARCHIVE_NAME="$(date --iso-8601=date)-backup-$(hostname)" 13 | ARCHIVE_PATH="${BACKUP_ARCHIVE_PATH}/${ARCHIVE_NAME}.tar.${ZIP_METHOD}" 14 | 15 | # Number of files to keep after pruning. 16 | MIN_FILES_TO_KEEP=2 17 | MAX_FILES_TO_KEEP=8 18 | MIN_DISK_GB_FREE_TO_KEEP=30 19 | 20 | sync_dirs() 21 | ( 22 | echo "Syncing directories..." 23 | while read -r dir; do 24 | mkdir -p "${BACKUP_ROOT_PATH}${dir}" 25 | rsync -a "$dir/" "${BACKUP_ROOT_PATH}${dir}" 26 | done < "$DIRS_LOCATION" 27 | ) 28 | 29 | create_archive() 30 | ( 31 | mkdir -p "$BACKUP_ARCHIVE_PATH" 32 | 33 | echo "Creating archive $ARCHIVE_NAME..." 34 | cd "$BACKUP_ROOT_PATH" || exit 1 35 | rm -f "$ARCHIVE_PATH" 36 | tar -I "${ZIP_METHOD}" -cf "$ARCHIVE_PATH" . 37 | ) 38 | 39 | encrypt_archive() 40 | ( 41 | echo "Encrypting archive..." 42 | ccrypt --encrypt -f -k "$PASSWD_LOCATION" "$ARCHIVE_PATH" 43 | ) 44 | 45 | calculate_checksum() 46 | ( 47 | echo "Calculating checksum..." 48 | sha256sum -b "$ARCHIVE_PATH.cpt" | cut -d " " -f1 > "$ARCHIVE_PATH.cpt.sha256sum" 49 | ) 50 | 51 | upload_archive() 52 | ( 53 | echo "Uploading archive to VPS..." 54 | scp -q "$ARCHIVE_PATH.cpt" "$ARCHIVE_PATH.cpt.sha256sum" "casper@radon:$REMOTE_BACKUP_ARCHIVE_PATH" 55 | ) 56 | 57 | prune_archives() 58 | ( 59 | cd "$BACKUP_ARCHIVE_PATH" || exit 1 60 | 61 | echo "Pruning archives..." 62 | while [ "$(find . -maxdepth 1 -type f | wc -l)" -gt "$MAX_FILES_TO_KEEP" ] || [ "$(df . -B 1G | tail -n1 | tr -s " " | cut -d " " -f 4)" -lt "$MIN_DISK_GB_FREE_TO_KEEP" ]; do 63 | if [ "$(find . -maxdepth 1 -type f | wc -l)" -le "$MIN_FILES_TO_KEEP" ]; then 64 | break; 65 | fi 66 | rm "$(find . -maxdepth 1 -type f | sort | head -n1)" 67 | done 68 | ) 69 | 70 | if [ ! -f "$DIRS_LOCATION" ]; then 71 | echo "Backup directory list missing from $DIRS_LOCATION" 72 | exit 1 73 | elif [ ! -f "$PASSWD_LOCATION" ]; then 74 | echo "Backup password missing from $PASSWD_LOCATION" 75 | exit 1 76 | fi 77 | 78 | sync_dirs 79 | #create_archive 80 | 81 | # Uncomment to generate encrypted archives 82 | # encrypt_archive 83 | # calculate_checksum 84 | 85 | #prune_archives 86 | 87 | # Uncomment to enable uploading back-ups to VPS 88 | #upload_archive 89 | 90 | echo "Done." 91 | -------------------------------------------------------------------------------- /dotfiles/bin/battery-watchdog: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | battery_percentage=$(cat /sys/class/power_supply/BAT0/capacity) 4 | charging=$(cat /sys/class/power_supply/AC/online) 5 | 6 | if [ "$battery_percentage" -lt 10 ] && [ "$charging" -eq 0 ]; then 7 | echo "Battery low. Suspending to prevent battery damage." 8 | systemctl suspend 9 | fi 10 | -------------------------------------------------------------------------------- /dotfiles/bin/bench: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | threads="$(nproc)" 4 | 5 | sysbench cpu --cpu-max-prime=20000 --threads="$threads" run | grep "events per second" 6 | sysbench memory --threads="$threads" run | grep "transferred" 7 | -------------------------------------------------------------------------------- /dotfiles/bin/bestafk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function reconnect { 4 | xdotool mousemove 1271 625 5 | sleep 0.5 6 | xdotool click 1 7 | sleep 1.5 8 | xdotool mousemove 784 449 9 | sleep 0.5 10 | xdotool click 1 11 | sleep 1.5 12 | xdotool mousemove 458 236 13 | sleep 0.5 14 | xdotool click 1 15 | sleep 20 16 | xdotool type t 17 | } 18 | 19 | function launch { 20 | pkill -f java 21 | MultiMC >/dev/null 2>&1 & 22 | sleep 1 23 | xdotool mousemove 149 139 click 1 24 | sleep 0.05 25 | xdotool click 1 26 | sleep 5 27 | xdotool search --name "MultiMC" windowkill 28 | xdotool mousemove 784 449 29 | sleep 60 30 | reconnect 31 | } 32 | 33 | launch 34 | while true; do 35 | reconnect 36 | 37 | sleep 600 38 | done 39 | -------------------------------------------------------------------------------- /dotfiles/bin/bspwmrc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$1" != "-r" ]; then 4 | xrdb "$(dotfiles)/Xresources" 5 | system launch & 6 | system reload & 7 | fi 8 | 9 | if [ "$(hostname)" = "xenon" ]; then 10 | bspc monitor DVI-D-0 -d SI SII 11 | bspc monitor DisplayPort-0 -d I II III IV V VI VII VIII 12 | elif [ "$(hostname)" = "neon" ] && xrandr -q | grep "DP-1 connected"; then 13 | bspc monitor LVDS-1 -d SI SII 14 | bspc monitor DP-1 -d I II III IV V VI VII VIII 15 | else 16 | bspc monitor -d I II III IV V VI VII VIII IX X 17 | fi 18 | 19 | bspc config border_width 1 20 | bspc config window_gap 8 21 | 22 | bspc config split_ratio 0.52 23 | bspc config borderless_monocle true 24 | bspc config gapless_monocle true 25 | bspc config focus_follows_pointer true 26 | bspc config pointer_follows_focus true 27 | bspc config pointer_follows_monitor true 28 | 29 | bspc rule -a "Zathura" state=tiled 30 | 31 | xsetroot -cursor_name left_ptr 32 | -------------------------------------------------------------------------------- /dotfiles/bin/check-deps-size: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | output_path=/tmp/deps.svg 4 | 5 | case "$1" in 6 | /nix/store/*) 7 | store_path="$1" 8 | ;; 9 | *) 10 | store_path="$(dirname "$(dirname "$(readlink "$(command -v "$1")")")")" 11 | ;; 12 | esac 13 | 14 | echo "$store_path" 15 | if [ "$store_path" != "." ]; then 16 | nix-du -r "$store_path" | tred | dot -Tsvg > "$output_path" 17 | xdg-open "$output_path" 18 | fi 19 | -------------------------------------------------------------------------------- /dotfiles/bin/clip: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if is-wayland; then 4 | wl-copy "$@" 5 | else 6 | xclip -selection clipboard "$@" 7 | fi 8 | -------------------------------------------------------------------------------- /dotfiles/bin/compiler: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$1" ]; then 4 | echo "usage: compiler [--open]" 5 | exit 1 6 | fi 7 | 8 | file=$(readlink -f "$1") 9 | base="${file%.*}" 10 | 11 | case "$file" in 12 | *\.md) pandoc -f markdown -s --number-sections -V geometry:margin=2cm "$file" -o "$base".pdf ;; 13 | *\.plantuml) plantuml -Smonochrome=true "$file" ;; 14 | *) echo "Invalid input file."; exit 1 ;; 15 | esac 16 | 17 | if [ "$2" ]; then 18 | case "$file" in 19 | *\.md) xdg-open "$base".pdf ;; 20 | *\.plantuml) xdg-open "$base".png ;; 21 | esac 22 | fi 23 | -------------------------------------------------------------------------------- /dotfiles/bin/cpu-usage: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | all_usage=$(mpstat -P ALL 1 1 | awk '/Average:/ && $2 ~ /[0-9]/ {print 100 - $12}' | sort -n) 4 | 5 | max_usage=$(echo "$all_usage" | tr " " "\n" | tail -n 1) 6 | 7 | sum_usage=0 8 | 9 | for usage in $all_usage; do 10 | sum_usage=$(echo "$sum_usage" + "$usage" | bc -l) 11 | done 12 | 13 | avg_usage=$(echo "$sum_usage / $(nproc)" | bc -l) 14 | 15 | 16 | printf "%.2f%% / %.2f%%" "$avg_usage" "$max_usage" 17 | -------------------------------------------------------------------------------- /dotfiles/bin/git-change-author: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export old_email="$1" 4 | export correct_name="$2" 5 | export correct_email="$3" 6 | 7 | if [ "$#" -lt 3 ]; then 8 | echo "usage: $0 " 9 | exit 1 10 | fi 11 | 12 | git filter-branch --env-filter ' 13 | 14 | OLD_EMAIL="${old_email}" 15 | CORRECT_NAME="${correct_name}" 16 | CORRECT_EMAIL="${correct_email}" 17 | 18 | if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] 19 | then 20 | export GIT_COMMITTER_NAME="$CORRECT_NAME" 21 | export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" 22 | fi 23 | if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] 24 | then 25 | export GIT_AUTHOR_NAME="$CORRECT_NAME" 26 | export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" 27 | fi 28 | ' --tag-name-filter cat -- --branches --tags 29 | -------------------------------------------------------------------------------- /dotfiles/bin/gitree: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Runs `tree`, ignoring files from .gitignore. 3 | # Copied and modified from https://gist.github.com/jpwilliams/dabff82b0ceb95dd57a7552ea7f2d675 4 | 5 | tree -C -I "$( (cat .gitignore 2> /dev/null || cat "$(git rev-parse --show-toplevel 2> /dev/null)"/.gitignore 2> /dev/null || echo "node_modules") | grep -Ev "^#.*$|^[[:space:]]*$" | tr "\\n" "|" | rev | cut -c 2- | rev)" 6 | -------------------------------------------------------------------------------- /dotfiles/bin/howoldis: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | howoldis_url=https://howoldis.herokuapp.com/api/channels 4 | howoldis_path=/tmp/howoldis.json 5 | 6 | curl -s $howoldis_url > $howoldis_path 7 | 8 | declare -a channels=("nixos-19.03" "nixos-unstable") 9 | 10 | echo "Nixpkgs channels:" 11 | 12 | for channel in "${channels[@]}" 13 | do 14 | channel_secs=$(jq -r "to_entries[] | .value | select(.name == \"${channel}\").time" < $howoldis_path) 15 | channel_hours=$(bc <<< "scale=2; $channel_secs/60/60") 16 | echo "Channel $channel updated $channel_hours hours ago" 17 | done 18 | 19 | rm $howoldis_path 20 | -------------------------------------------------------------------------------- /dotfiles/bin/is-wayland: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$XDG_SESSION_TYPE" = wayland ] 4 | -------------------------------------------------------------------------------- /dotfiles/bin/nmgui: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | nm-applet > /dev/null 2>&1 & 4 | stalonetray > /dev/null 2>&1 5 | killall nm-applet 6 | -------------------------------------------------------------------------------- /dotfiles/bin/record: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # list of upload destinations 4 | REC_PATH=/tmp/rec-$(date +"%Y%m%d-%H%M%S").mp4 5 | OUT_PATH=/tmp/rec-out-$(date +"%Y%m%d-%H%M%S").mp4 6 | FRAMERATE=60 7 | 8 | if is-wayland; then 9 | cd /tmp || exit 1 10 | wf-recorder -g "$(slurp)" 11 | cd - || exit 1 12 | mv /tmp/recording.mp4 "$REC_PATH" 13 | else 14 | DISPLAY=$(ps -u "$(id -u)" -o pid= | \ 15 | while read -r pid; do 16 | tr '\0' '\n' 2>/dev/null < /proc/"$pid"/environ | grep '^DISPLAY=:' 17 | done | grep -o ':[0-9]*' | sort -u) 18 | 19 | # region select & record the video 20 | read -r X Y W H _ _ < <(slop --noopengl -f "%x %y %w %h %g %i") 21 | W2=$(echo "($W / 2) * 2" | bc) 22 | H2=$(echo "($H / 2) * 2" | bc) 23 | ffmpeg -f x11grab -show_region 1 -framerate $FRAMERATE -video_size "${W2}x${H2}" -i "$DISPLAY.0+$X,$Y" -c:v libx264 -pix_fmt yuv420p -preset ultrafast -tune zerolatency "$REC_PATH" 24 | fi 25 | 26 | if [[ -f $REC_PATH ]]; then 27 | if [[ $(hostname) = "xenon" ]]; then 28 | ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "$REC_PATH" -c:v h264_vaapi -b:v 4M -profile 578 -bf 0 "$OUT_PATH" 29 | else 30 | ffmpeg -i "$REC_PATH" -c:v libx264 -b:v 4M -bufsize 4M -an "$OUT_PATH" 31 | fi 32 | rm "$REC_PATH" 33 | notify-send "Saved video to $OUT_PATH" 34 | fi 35 | 36 | -------------------------------------------------------------------------------- /dotfiles/bin/shot: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | path=$HOME/Pictures/Screenshots/$(date +"%Y%m%d-%H%M%S").png 4 | 5 | if is-wayland; then 6 | case $1 in 7 | "s") grim -g "$(slurp)" "$path" ;; 8 | "u") echo "Window selection unsupported."; exit 1 ;; 9 | "m") grim "$path" ;; 10 | *) exit 1 ;; 11 | esac 12 | else 13 | case $1 in 14 | "s") args=(--noopengl -s -u) ;; 15 | "u") args=(-u -i "$(xdotool getactivewindow)") ;; 16 | "m") args=() ;; 17 | *) exit 1 ;; 18 | esac 19 | 20 | maim "${args[@]}" "$path" 21 | fi 22 | 23 | xclip -selection clipboard -t image/png -i "$path" 24 | -------------------------------------------------------------------------------- /dotfiles/bin/sysinfo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case $1 in 4 | battery_usage) 5 | if [ -f /sys/class/power_supply/BAT0/power_now ]; then 6 | echo "$(sysnformat "$(cat /sys/class/power_supply/BAT0/power_now)")" W 7 | else 8 | echo "- W" 9 | fi 10 | ;; 11 | cpufreq) 12 | echo "$(sysnformat "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)")" GHz 13 | ;; 14 | *) 15 | echo "sysinfo " 16 | exit 1 17 | ;; 18 | esac 19 | -------------------------------------------------------------------------------- /dotfiles/bin/sysnformat: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | VALUE=$(awk "BEGIN { a=$1 / 1000000; print a }") 4 | 5 | printf "%.2f" "$VALUE" 6 | -------------------------------------------------------------------------------- /dotfiles/bin/system: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Program for general startup/lock commands. 4 | # This is done to avoid duplicates in i3 config. 5 | 6 | function kill { 7 | pkill -f polybar 8 | pkill -f dunst 9 | pkill -f batsignal 10 | pkill -f compton 11 | } 12 | 13 | function launch { 14 | gsettings set org.gnome.desktop.interface gtk-theme "$GTK_THEME" 15 | gsettings set org.gnome.desktop.interface icon-theme "$GTK_ICON_THEME" 16 | gsettings set org.gnome.desktop.interface cursor-theme "$GTK_ICON_THEME" 17 | 18 | if [ "$(hostname)" = "xenon" ]; then 19 | # Unmute speakers. 20 | amixer -c 1 sset "Auto-Mute Mode" Disabled 21 | fi 22 | if [ "$(hostname)" = "helium" ]; then 23 | # Remove tearing on display. 24 | xrandr --output eDP --set TearFree on 25 | fi 26 | } 27 | 28 | function reload { 29 | if is-wayland; then 30 | dunst & 31 | else 32 | if [ "$(hostname)" = "xenon" ]; then 33 | feh --bg-tile "$(dotfiles-background-wide)" & 34 | else 35 | feh --bg-scale "$(dotfiles-background)" & 36 | fi 37 | sh -c "polybar --config=$(dotfiles)/polybar-config \$(hostname) || polybar --config=$(dotfiles)/polybar-config generic" & 38 | dunst & 39 | if [ "$(hostname)" == "neon" ]; then 40 | batsignal -w 20 -c 15 & 41 | if glxinfo | grep "OpenGL vendor string: nouveau"; then 42 | compton --vsync=opengl 43 | else 44 | compton --backend=glx --vsync=drm 45 | fi 46 | else 47 | compton 48 | fi 49 | fi 50 | } 51 | 52 | function lock { 53 | if is-wayland; then 54 | swaylock -n -c 000000 55 | else 56 | i3lock -n -c 000000 57 | fi 58 | } 59 | 60 | function tlock { 61 | bash -c 'sleep 0.1; xtrlock-pam -b none' & 62 | } 63 | 64 | function suspend { 65 | if [[ "$(hostname)" == "xenon" && 6700000 -gt $(vmstat -s | grep used\ memory | cut -d " " -f7) ]] ; then 66 | # Prevent "double suspending". 67 | if [ ! -f /tmp/.suspend ]; then 68 | touch /tmp/.suspend 69 | systemctl hibernate 70 | sh -c "sleep 1; rm /tmp/.suspend" & 71 | disown 72 | fi 73 | else 74 | systemctl suspend 75 | fi 76 | } 77 | 78 | function reboot { 79 | sudo systemctl kexec || sudo systemctl reboot 80 | } 81 | 82 | function brightness-inc { 83 | sudo light -A 10 84 | } 85 | 86 | function brightness-dec { 87 | sudo light -U 10 88 | } 89 | 90 | for var in "$@" 91 | do 92 | "$var" 93 | done 94 | -------------------------------------------------------------------------------- /dotfiles/bin/toggle-audio-output: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$(hostname)" != "xenon" ]; then 4 | # This script is useless for other hosts than xenon. 5 | exit 1 6 | fi 7 | 8 | alsa_card_nr="$(arecord -l | grep "HD-Audio Generic" | head -n 1 | cut -c6-6)" 9 | pa_card_name=alsa_output.pci-0000_1e_00.3.analog-stereo 10 | lineout_port=analog-output-lineout 11 | headphone_port=analog-output-headphones 12 | 13 | current_port="$(pactl list sinks | grep "analog-output-" | grep "Active Port" | grep -oE "[^ ]+\$")" 14 | 15 | if [ "${current_port}" = "${headphone_port}" ]; then 16 | amixer -c "${alsa_card_nr}" cset iface=MIXER,name="Auto-Mute Mode" Disabled > /dev/null 17 | pactl set-sink-port "${pa_card_name}" "${lineout_port}" 18 | else 19 | pactl set-sink-port "${pa_card_name}" "${headphone_port}" 20 | fi 21 | -------------------------------------------------------------------------------- /dotfiles/bin/wifi-ap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ $1 == "on" ]]; then 4 | echo "Starting Wifi AP" 5 | sudo rfkill unblock wlan 6 | sleep 1 7 | nmcli con down EthernetHost 8 | nmcli con up EthernetClient 9 | nmcli con up Hotspot 10 | elif [[ $1 == "off" ]]; then 11 | echo "Stopping Wifi AP" 12 | nmcli con down Hotspot 13 | nmcli con down EthernetClient 14 | nmcli con up EthernetHost 15 | else 16 | echo "Expected on/off" 17 | fi 18 | -------------------------------------------------------------------------------- /dotfiles/cava-config: -------------------------------------------------------------------------------- 1 | [general] 2 | framerate = 60 3 | 4 | [output] 5 | channels = mono 6 | 7 | [color] 8 | gradient = 1 9 | gradient_color_1 = '#E05606' 10 | gradient_color_2 = '#B21E0A' 11 | 12 | [smoothing] 13 | integral = 40 14 | gravity = 600 15 | monstercat = 0 16 | waves = 1 17 | -------------------------------------------------------------------------------- /dotfiles/dunst-config: -------------------------------------------------------------------------------- 1 | [global] 2 | font = monospace 9 3 | 4 | # Allow a small subset of html markup: 5 | # bold 6 | # italic 7 | # strikethrough 8 | # underline 9 | # 10 | # For a complete reference see 11 | # . 12 | # If markup is not allowed, those tags will be stripped out of the 13 | # message. 14 | allow_markup = yes 15 | plain_text = no 16 | 17 | # The format of the message. Possible variables are: 18 | # %a appname 19 | # %s summary 20 | # %b body 21 | # %i iconname (including its path) 22 | # %I iconname (without its path) 23 | # %p progress value if set ([ 0%] to [100%]) or nothing 24 | # Markup is allowed 25 | format = "%a\n%s\n%b %p" 26 | 27 | # Sort messages by urgency. 28 | sort = no 29 | 30 | # Show how many messages are currently hidden (because of geometry). 31 | indicate_hidden = yes 32 | 33 | # Alignment of message text. 34 | # Possible values are "left", "center" and "right". 35 | alignment = center 36 | 37 | # The frequency with wich text that is longer than the notification 38 | # window allows bounces back and forth. 39 | # This option conflicts with "word_wrap". 40 | # Set to 0 to disable. 41 | bounce_freq = 0 42 | 43 | # Show age of message if message is older than show_age_threshold 44 | # seconds. 45 | # Set to -1 to disable. 46 | show_age_threshold = -1 47 | 48 | # Split notifications into multiple lines if they don't fit into 49 | # geometry. 50 | word_wrap = yes 51 | 52 | # Ignore newlines '\n' in notifications. 53 | ignore_newline = no 54 | 55 | # Hide duplicate's count and stack them 56 | stack_duplicates = yes 57 | hide_duplicates_count = yes 58 | 59 | 60 | # The geometry of the window: 61 | # [{width}]x{height}[+/-{x}+/-{y}] 62 | # The geometry of the message window. 63 | # The height is measured in number of notifications everything else 64 | # in pixels. If the width is omitted but the height is given 65 | # ("-geometry x2"), the message window expands over the whole screen 66 | # (dmenu-like). If width is 0, the window expands to the longest 67 | # message displayed. A positive x is measured from the left, a 68 | # negative from the right side of the screen. Y is measured from 69 | # the top and down respectevly. 70 | # The width can be negative. In this case the actual width is the 71 | # screen width minus the width defined in within the geometry option. 72 | #geometry = "250x50-40+40" 73 | geometry = "200x50-15+49" 74 | 75 | # Shrink window if it's smaller than the width. Will be ignored if 76 | # width is 0. 77 | shrink = no 78 | 79 | # The transparency of the window. Range: [0; 100]. 80 | # This option will only work if a compositing windowmanager is 81 | # present (e.g. xcompmgr, compiz, etc.). 82 | transparency = 5 83 | 84 | # Don't remove messages, if the user is idle (no mouse or keyboard input) 85 | # for longer than idle_threshold seconds. 86 | # Set to 0 to disable. 87 | idle_threshold = 0 88 | 89 | # Which monitor should the notifications be displayed on. 90 | monitor = 0 91 | 92 | # Display notification on focused monitor. Possible modes are: 93 | # mouse: follow mouse pointer 94 | # keyboard: follow window with keyboard focus 95 | # none: don't follow anything 96 | # 97 | # "keyboard" needs a windowmanager that exports the 98 | # _NET_ACTIVE_WINDOW property. 99 | # This should be the case for almost all modern windowmanagers. 100 | # 101 | # If this option is set to mouse or keyboard, the monitor option 102 | # will be ignored. 103 | follow = none 104 | 105 | # Should a notification popped up from history be sticky or timeout 106 | # as if it would normally do. 107 | sticky_history = yes 108 | 109 | # Maximum amount of notifications kept in history 110 | history_length = 15 111 | 112 | # Display indicators for URLs (U) and actions (A). 113 | show_indicators = no 114 | 115 | # The height of a single line. If the height is smaller than the 116 | # font height, it will get raised to the font height. 117 | # This adds empty space above and under the text. 118 | line_height = 3 119 | 120 | # Draw a line of "separatpr_height" pixel height between two 121 | # notifications. 122 | # Set to 0 to disable. 123 | separator_height = 4 124 | 125 | # Padding between text and separator. 126 | padding = 6 127 | 128 | # Horizontal padding. 129 | horizontal_padding = 6 130 | 131 | # Define a color for the separator. 132 | # possible values are: 133 | # * auto: dunst tries to find a color fitting to the background; 134 | # * foreground: use the same color as the foreground; 135 | # * frame: use the same color as the frame; 136 | # * anything else will be interpreted as a X color. 137 | separator_color = frame 138 | 139 | # Print a notification on startup. 140 | # This is mainly for error detection, since dbus (re-)starts dunst 141 | # automatically after a crash. 142 | startup_notification = false 143 | 144 | # Browser for opening urls in context menu. 145 | browser = firefox -new-tab 146 | 147 | # Align icons left/right/off 148 | icon_position = left 149 | max_icon_size = 80 150 | 151 | # Paths to default icons. 152 | icon_folders = /run/current-system/sw/share/icons/Paper/16x16/mimetypes/:/run/current-system/sw/share/icons/Paper/48x48/status/:/run/current-system/sw/share/icons/Paper/16x16/devices/:/run/current-system/sw/share/icons/Paper/48x48/notifications/:/run/current-system/sw/share/icons/Paper/48x48/emblems/ 153 | 154 | 155 | [frame] 156 | width = 2 157 | color = "#8EC07C" 158 | 159 | [shortcuts] 160 | 161 | # Shortcuts are specified as [modifier+][modifier+]...key 162 | # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", 163 | # "mod3" and "mod4" (windows-key). 164 | # Xev might be helpful to find names for keys. 165 | 166 | # Close notification. 167 | close = ctrl+space 168 | 169 | # Close all notifications. 170 | close_all = ctrl+shift+space 171 | 172 | # Redisplay last message(s). 173 | # On the US keyboard layout "grave" is normally above TAB and left 174 | # of "1". 175 | history = ctrl+grave 176 | 177 | # Context menu. 178 | context = ctrl+shift+period 179 | 180 | [urgency_low] 181 | # IMPORTANT: colors have to be defined in quotation marks. 182 | # Otherwise the "#" and following would be interpreted as a comment. 183 | frame_color = "#3B7C87" 184 | foreground = "#3B7C87" 185 | background = "#191311" 186 | #background = "#2B313C" 187 | timeout = 4 188 | 189 | [urgency_normal] 190 | frame_color = "#6B6B6B" 191 | foreground = "#7CB247" 192 | background = "#191311" 193 | #background = "#2B313C" 194 | timeout = 6 195 | 196 | [urgency_critical] 197 | frame_color = "#B7472A" 198 | foreground = "#B7472A" 199 | background = "#191311" 200 | #background = "#2B313C" 201 | timeout = 8 202 | 203 | 204 | # Every section that isn't one of the above is interpreted as a rules to 205 | # override settings for certain messages. 206 | # Messages can be matched by "appname", "summary", "body", "icon", "category", 207 | # "msg_urgency" and you can override the "timeout", "urgency", "foreground", 208 | # "background", "new_icon" and "format". 209 | # Shell-like globbing will get expanded. 210 | # 211 | # SCRIPTING 212 | # You can specify a script that gets run when the rule matches by 213 | # setting the "script" option. 214 | # The script will be called as follows: 215 | # script appname summary body icon urgency 216 | # where urgency can be "LOW", "NORMAL" or "CRITICAL". 217 | # 218 | # NOTE: if you don't want a notification to be displayed, set the format 219 | # to "". 220 | # NOTE: It might be helpful to run dunst -print in a terminal in order 221 | # to find fitting options for rules. 222 | 223 | #[espeak] 224 | # summary = "*" 225 | # script = dunst_espeak.sh 226 | 227 | #[script-test] 228 | # summary = "*script*" 229 | # script = dunst_test.sh 230 | 231 | #[ignore] 232 | # # This notification will not be displayed 233 | # summary = "foobar" 234 | # format = "" 235 | 236 | #[signed_on] 237 | # appname = Pidgin 238 | # summary = "*signed on*" 239 | # urgency = low 240 | # 241 | #[signed_off] 242 | # appname = Pidgin 243 | # summary = *signed off* 244 | # urgency = low 245 | # 246 | #[says] 247 | # appname = Pidgin 248 | # summary = *says* 249 | # urgency = critical 250 | # 251 | #[twitter] 252 | # appname = Pidgin 253 | # summary = *twitter.com* 254 | # urgency = normal 255 | # 256 | # vim: ft=cfg 257 | -------------------------------------------------------------------------------- /dotfiles/esp-idf-shell.nix: -------------------------------------------------------------------------------- 1 | { nixpkgs ? import {} }: 2 | 3 | let 4 | inherit (nixpkgs) pkgs; 5 | in 6 | 7 | pkgs.stdenv.mkDerivation { 8 | name = "esp-idf-env"; 9 | buildInputs = with pkgs; [ 10 | gawk gperf gettext automake bison flex texinfo help2man libtool autoconf ncurses5 11 | (python2.withPackages (ppkgs: with ppkgs; [ pyserial future ])) 12 | (pkgs.callPackage /home/casper/Projects/nix/pkgs/custom/esp32-toolchain.nix {}) 13 | ]; 14 | shellHook = '' 15 | export NIX_CFLAGS_LINK=-lncurses 16 | export IDF_PATH=$HOME/esp/esp-idf 17 | ''; 18 | } 19 | -------------------------------------------------------------------------------- /dotfiles/evd-shell.nix: -------------------------------------------------------------------------------- 1 | # Environment for the EVD course. 2 | 3 | { pkgs ? import {}, mkShell ? true }: 4 | 5 | let 6 | mPythonPackages = pkgs.python3Packages; 7 | buildInputs = with pkgs; 8 | [ 9 | clang 10 | cmake 11 | pkg-config 12 | llvm 13 | clang-analyzer 14 | clang-tools 15 | valgrind 16 | gdb 17 | ddd 18 | 19 | doxygen 20 | graphviz 21 | gtest 22 | 23 | gtkmm3 24 | pcre 25 | (opencv4.override { 26 | enableGtk2 = true; 27 | enablePython = true; 28 | pythonPackages = mPythonPackages; 29 | }) 30 | mPythonPackages.python 31 | mPythonPackages.autopep8 32 | 33 | qtcreator 34 | qt5.full 35 | qt5.qtquickcontrols2 36 | qt5.qtquickcontrols 37 | qt5.qtdoc 38 | ]; 39 | buildScript = '' 40 | export CC=clang 41 | export CXX=clang++ 42 | export XDG_DATA_DIRS=$XDG_DATA_DIRS:$GSETTINGS_SCHEMAS_PATH 43 | ''; 44 | in 45 | 46 | if mkShell then 47 | pkgs.mkShell { 48 | buildInputs = buildInputs; 49 | shellHook = buildScript; 50 | } 51 | else 52 | pkgs.stdenv.mkDerivation { 53 | name = "evd-shell"; 54 | phases = [ "buildPhase" ]; 55 | buildInputs = buildInputs; 56 | buildPhase = "echo $PATH > $out"; 57 | } 58 | -------------------------------------------------------------------------------- /dotfiles/i3blocks-config: -------------------------------------------------------------------------------- 1 | # i3blocks config file 2 | # 3 | # Please see man i3blocks for a complete reference! 4 | # The man page is also hosted at http://vivien.github.io/i3blocks 5 | # 6 | # List of valid properties: 7 | # 8 | # align 9 | # color 10 | # command 11 | # full_text 12 | # instance 13 | # interval 14 | # label 15 | # min_width 16 | # name 17 | # separator 18 | # separator_block_width 19 | # short_text 20 | # signal 21 | # urgent 22 | 23 | # Global properties 24 | # 25 | # The top properties below are applied to every block, but can be overridden. 26 | # Each block command defaults to the script name to avoid boilerplate. 27 | # Change $SCRIPT_DIR to the location of your scripts! 28 | command=$SCRIPT_DIR/$BLOCK_NAME 29 | separator_block_width=15 30 | markup=none 31 | 32 | # Volume indicator 33 | # 34 | # The first parameter sets the step (and units to display) 35 | # The second parameter overrides the mixer selection 36 | # See the script for details. 37 | 38 | [volume] 39 | # label=♪ 40 | label=VOL 41 | interval=1 42 | signal=10 43 | # STEP=5 44 | 45 | [backlight] 46 | label=BAC 47 | command=printf "%.0f%%" $(light -G) 48 | interval=1 49 | 50 | # Network interface monitoring 51 | # 52 | # If the instance is not specified, use the interface used for default route. 53 | # The address can be forced to IPv4 or IPv6 with -4 or -6 switches. 54 | [iface] 55 | #IFACE=wlan0 56 | color=#00FF00 57 | interval=10 58 | separator=false 59 | 60 | # Wifi signal strength 61 | [wifi] 62 | instance=wlp3s0 63 | label=SIGN 64 | interval=10 65 | separator=false 66 | 67 | [bandwidth] 68 | # Specifying a label doesn't work for some reason 69 | # command=$SCRIPT_DIR/bandwidth --inlabel "I" --outlabel "O" 70 | interval=1 71 | 72 | # CPU usage 73 | # 74 | # The script may be called with -w and -c switches to specify thresholds, 75 | # see the script for details. 76 | # [cpu_usage] 77 | # label=CPU 78 | # interval=1 79 | # min_width=CPU 100.00% 80 | # separator=false 81 | 82 | [custom_cpu_max_usage] 83 | label=CPU 84 | min_width=100.00% / 100.00% 85 | command=cpu-usage 86 | interval=1 87 | 88 | # [load_average] 89 | # label=LOAD 90 | # interval=10 91 | 92 | # Battery indicator 93 | # 94 | # The battery instance defaults to 0. 95 | [battery] 96 | label=BAT 97 | #label=⚡ 98 | interval=30 99 | 100 | # OpenVPN support 101 | # 102 | # Support multiple VPN, with colors. 103 | #[openvpn] 104 | #interval=20 105 | 106 | # Temperature 107 | # 108 | # Support multiple chips, though lm-sensors. 109 | # The script may be called with -w and -c switches to specify thresholds, 110 | # see the script for details. 111 | [temperature] 112 | label=TEMP 113 | interval=1 114 | 115 | # Date Time 116 | # 117 | [time] 118 | command=date '+%B %e %H:%M:%S' 119 | interval=1 120 | 121 | -------------------------------------------------------------------------------- /dotfiles/init.vim: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | 3 | " Prevent nesting 4 | 5 | if $NEOVIM == 'true' 6 | echo 'Nesting is disabled.' 7 | q! 8 | endif 9 | let $NEOVIM = 'true' 10 | 11 | " Plugin polyglot (nix-plugin-manager and vim-plug) 12 | 13 | if !empty(glob('~/.vim/autoload/plug.vim')) || !empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) 14 | call plug#begin('~/.vim-plug') 15 | " Deoplete doesn't work in other installations I've tested, 16 | " unfortunately. 17 | " Plug 'Shougo/deoplete.nvim' 18 | Plug 'tpope/vim-vinegar' 19 | Plug 'tpope/vim-surround' 20 | Plug 'ctrlpvim/ctrlp.vim' 21 | Plug 'sheerun/vim-polyglot' 22 | Plug 'itchyny/lightline.vim' 23 | Plug 'easymotion/vim-easymotion' 24 | Plug 'ntpeters/vim-better-whitespace' 25 | Plug 'tpope/vim-commentary' 26 | Plug 'luochen1990/rainbow' 27 | Plug 'vim-pandoc/vim-pandoc-syntax' 28 | Plug 'rhysd/vim-clang-format' 29 | Plug 'drmikehenry/vim-headerguard' 30 | Plug 'rhysd/git-messenger.vim' 31 | call plug#end() 32 | endif 33 | 34 | " Swap and backup file directory 35 | 36 | if !has('nvim') 37 | set directory=$HOME/.vim/swap// 38 | set backupdir=$HOME/.vim/backup// 39 | execute 'silent :!mkdir -p' shellescape(&directory) 40 | execute 'silent :!mkdir -p' shellescape(&backupdir) 41 | endif 42 | 43 | " File type extension registry 44 | 45 | au BufNewFile,BufRead *.inc setlocal ft=cpp 46 | 47 | " File type presets 48 | 49 | autocmd FileType css :setlocal ts=4 sw=4 50 | autocmd FileType c,cpp,cs,php,python,julia,Dockerfile :setlocal et ts=4 sw=4 51 | autocmd FileType lisp,arduino,haskell,cabal,lua,typescript,javascript,json,html,xml,cmake :setlocal et ts=2 sw=2 52 | autocmd FileType markdown,text,plaintex :setlocal foldcolumn=4 colorcolumn=79 textwidth=79 et ts=2 sw=2 53 | autocmd FileType nix,plantuml :setlocal indentexpr= 54 | 55 | " GUI and colors 56 | 57 | set mouse=a guicursor= nu rnu noshowmode background=dark tabpagemax=999 58 | hi Statement ctermfg=yellow 59 | hi LineNr ctermfg=darkgrey 60 | hi CursorLineNr ctermfg=grey 61 | hi ColorColumn ctermbg=black 62 | hi FoldColumn ctermbg=none 63 | hi Pmenu ctermbg=darkgrey 64 | hi MatchParen cterm=bold ctermbg=darkgrey ctermfg=none 65 | hi gitmessengerPopupNormal term=None ctermfg=255 ctermbg=234 66 | 67 | " Keyboard mappings 68 | 69 | nmap :w 70 | nmap :q 71 | nmap :CF 72 | imap :wi 73 | imap :q 74 | imap diwi 75 | tnoremap 76 | vnoremap p "_dP 77 | 78 | for dirkey in ['h', 'j', 'k', 'l'] 79 | execute 'nnoremap ' . dirkey 80 | execute 'inoremap ' . dirkey . 'i' 81 | execute 'tnoremap ' . dirkey . 'i' 82 | endfor 83 | 84 | " Searching 85 | 86 | set ignorecase smartcase 87 | 88 | " CtrlP 89 | 90 | let g:ctrlp_regexp = 1 91 | set wildignore+=*/venv/* 92 | 93 | " EasyMotion 94 | 95 | let g:EasyMotion_do_mapping = 0 " Disable default mappings 96 | nmap W (easymotion-w) 97 | nmap B (easymotion-b) 98 | 99 | " Autocomplete 100 | 101 | let g:deoplete#enable_at_startup = 1 102 | let g:deoplete#on_insert_enter = 0 103 | autocmd VimEnter * call deoplete#custom#option('max_list', 7) 104 | 105 | " Enable markdown section folding without the line characters. 106 | let g:markdown_folding = 1 107 | autocmd FileType markdown :setlocal foldcolumn=0 numberwidth=7 108 | 109 | " Clang-Format 110 | 111 | let g:clang_format#code_style = 'llvm' 112 | 113 | " Rainbow parentheses 114 | 115 | let g:rainbow_conf = { 116 | \ 'separately': { 117 | \ '*': 0, 118 | \ 'lisp': { 119 | \ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'], 120 | \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'], 121 | \ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'], 122 | \ } 123 | \ } 124 | \} 125 | let g:rainbow_active = 1 126 | 127 | " Status bar 128 | 129 | let g:lightline = { 130 | \ 'active': { 131 | \ 'left': [ [ 'mode', 'paste' ], 132 | \ [ 'readonly', 'buffername', 'modified' ] ], 133 | \ 'right': [ [ 'lineinfo' ], [ 'percent' ], 134 | \ [ 'fileformat', 'fileencoding', 'filetype', 'totallines' ] ], 135 | \ }, 136 | \ 'inactive':{ 137 | \ 'left': [ [ 'buffername' ] ], 138 | \ 'right': [ [ 'lineinfo' ], [ 'percent' ] ] 139 | \ }, 140 | \ 'component': { 141 | \ 'totallines': '%{line("$")}L', 142 | \ }, 143 | \ 'component_function': { 144 | \ 'buffername': 'BufName', 145 | \ }, 146 | \} 147 | 148 | let g:bufname_cache = {} 149 | function BufName() 150 | let name = expand('%:p') 151 | if !has_key(g:bufname_cache, name) 152 | if name == '' 153 | let g:bufname_cache[name] = '[new]' 154 | elseif name =~ 'term:\/\/' 155 | let g:bufname_cache[name] = expand('%:t') 156 | else 157 | let parts = split(name, '/') 158 | let homeparts = split($HOME, '/') 159 | let nhparts = len(homeparts) 160 | 161 | let ishome = parts[:nhparts - 1] == homeparts 162 | 163 | if ishome 164 | call remove(parts, 0, nhparts - 1) 165 | call insert(parts, '~') 166 | endif 167 | 168 | let nparts = len(parts) 169 | let shortparts = [] 170 | 171 | for part in parts 172 | if strpart(part, 0, 1) == '.' 173 | call add(shortparts, strpart(part, 0, 2)) 174 | else 175 | call add(shortparts, strpart(part, 0, 1)) 176 | endif 177 | endfor 178 | 179 | let shortparts[nparts - 1] = parts[nparts - 1] 180 | 181 | let g:bufname_cache[name] = (ishome ? '' : '/') . join(shortparts, '/') 182 | endif 183 | endif 184 | return g:bufname_cache[name] 185 | endfunction 186 | 187 | " Auto-load changes from disk 188 | 189 | if !exists('g:CheckUpdateStarted') 190 | let g:CheckUpdateStarted = 1 191 | call timer_start(1, 'CheckUpdate') 192 | endif 193 | function! CheckUpdate(timer) 194 | silent! checktime 195 | call timer_start(1000, 'CheckUpdate') 196 | endfunction 197 | 198 | " Commands 199 | 200 | command Term :belowright new | :terminal 201 | command CF :ClangFormat 202 | command CFA :bufdo execute ':CF' | w 203 | command CH :HeaderguardAdd 204 | command QE :%bd|e# 205 | command C :w | :execute 'silent :!compiler' shellescape(bufname('%')) '&' 206 | command CO :w | :execute 'silent :!compiler' shellescape(bufname('%')) '--open' '&' 207 | 208 | " Misc functions 209 | 210 | function Chomp(str) 211 | return substitute(a:str, '\n\+$', '', '') 212 | endfunction 213 | 214 | function TempPath(...) 215 | let ext = (a:0 >= 1) ? a:1 : fnamemodify(bufname('%'), ':e') 216 | let random = Chomp(system('bash -c "echo \$RANDOM"')) 217 | return '/tmp/' . random . '.' . ext 218 | endfunction 219 | 220 | " Workaround: Disable clipboard support until wl-clipboard 221 | " doesn't create new windows with wlroots compositors. 222 | 223 | if !empty($WAYLAND_DISPLAY) 224 | let g:clipboard = { 225 | \ 'name': 'myClipboard', 226 | \ 'copy': { 227 | \ '+': ':', 228 | \ '*': ':', 229 | \ }, 230 | \ 'paste': { 231 | \ '+': ':', 232 | \ '*': ':', 233 | \ }, 234 | \ 'cache_enabled': 1, 235 | \ } 236 | endif 237 | -------------------------------------------------------------------------------- /dotfiles/kitty-config: -------------------------------------------------------------------------------- 1 | font_family Fira Code 2 | italic_font auto 3 | bold_font auto 4 | bold_italic_font auto 5 | 6 | font_size 9 7 | map ctrl+shift+equal change_font_size all +1.0 8 | map ctrl+shift+minus change_font_size all -1.0 9 | 10 | adjust_line_height 110% 11 | 12 | scrollback_lines 10000 13 | 14 | confirm_os_window_close 0 15 | 16 | # bell 17 | enable_audio_bell no 18 | 19 | # cursor colour 20 | cursor #93A1A1 21 | selection_background #91A1A1 22 | selection_foreground #161616 23 | # foreground colour 24 | foreground #ABB2BF 25 | # background colour 26 | background #101010 27 | dynamic_background_opacity yes 28 | background_opacity 0.85 29 | 30 | # black 31 | color0 #000000 32 | color8 #5C6370 33 | 34 | # red 35 | color1 #E06C75 36 | color9 #E06C75 37 | 38 | # green 39 | color2 #98C379 40 | color10 #98C379 41 | 42 | # yellow 43 | color3 #D19A66 44 | color11 #D19A66 45 | 46 | # blue 47 | color4 #61AFEF 48 | color12 #61AFEF 49 | 50 | # magenta 51 | color5 #C678DD 52 | color13 #C678DD 53 | 54 | # cyan 55 | color6 #56B6C2 56 | color14 #56B6C2 57 | 58 | # white 59 | color7 #ABB2BF 60 | color15 #FFFEFE 61 | 62 | # disable update checking 63 | update_check_interval 0 64 | -------------------------------------------------------------------------------- /dotfiles/mimeapps.list: -------------------------------------------------------------------------------- 1 | [Default Applications] 2 | inode/directory=thunar.desktop 3 | application/pdf=org.pwmt.zathura.desktop 4 | text/html=firefox.desktop 5 | image/svg+xml=firefox.desktop 6 | image/png=viewnior.desktop 7 | image/jpeg=viewnior.desktop 8 | image/gif=viewnior.desktop 9 | -------------------------------------------------------------------------------- /dotfiles/polybar-config: -------------------------------------------------------------------------------- 1 | ;===================================================== 2 | ; 3 | ; To learn more about how to configure Polybar 4 | ; go to https://github.com/jaagr/polybar 5 | ; 6 | ; The README contains alot of information 7 | ; 8 | ;===================================================== 9 | 10 | [colors] 11 | background = #aa222222 12 | background-alt = #aa444444 13 | foreground = #dfdfdf 14 | foreground-alt = #999999 15 | primary = #bbffb52a 16 | secondary = #bbf94444 17 | ternary = #bbf97444 18 | alert = #ccbd2c40 19 | border = #dd111111 20 | 21 | [bar/xenon] 22 | modules-left = bspwm volume 23 | modules-center = title 24 | modules-right = cpuload temperature_xenon wired date 25 | 26 | monitor = ${env:MONITOR:DisplayPort-0} 27 | width = 100% 28 | height = 20 29 | radius = 0 30 | fixed-center = true 31 | 32 | background = ${colors.background} 33 | foreground = ${colors.foreground} 34 | 35 | underline-size = 2 36 | underline-color = #F00 37 | 38 | border-size = 0 39 | border-color = ${colors.border} 40 | 41 | padding-left = 0 42 | padding-right = 0 43 | 44 | module-margin-left = 1 45 | module-margin-right = 1 46 | 47 | font-0 = FiraCode:size=9;3 48 | 49 | [bar/neon] 50 | modules-left = bspwm volume backlight 51 | modules-center = title 52 | modules-right = cpuload temperature wireless battery battery_usage date 53 | 54 | monitor = 55 | width = ${bar/xenon.width} 56 | height = ${bar/xenon.height} 57 | 58 | radius = ${bar/xenon.radius} 59 | fixed-center = ${bar/xenon.fixed-center} 60 | 61 | background = ${bar/xenon.background} 62 | foreground = ${bar/xenon.foreground} 63 | 64 | underline-size = ${bar/xenon.underline-size} 65 | underline-color = ${bar/xenon.underline-color} 66 | 67 | border-size = ${bar/xenon.border-size} 68 | border-color = ${bar/xenon.border-color} 69 | 70 | padding-left = ${bar/xenon.padding-left} 71 | padding-right = ${bar/xenon.padding-right} 72 | 73 | module-margin-left = ${bar/xenon.module-margin-left} 74 | module-margin-right = ${bar/xenon.module-margin-right} 75 | 76 | font-0 = ${bar/xenon.font-0} 77 | 78 | [bar/helium] 79 | modules-left = bspwm volume backlight 80 | modules-center = title 81 | modules-right = cpuload temperature wireless battery battery_usage date 82 | 83 | monitor = 84 | width = ${bar/xenon.width} 85 | height = ${bar/xenon.height} 86 | 87 | radius = ${bar/xenon.radius} 88 | fixed-center = ${bar/xenon.fixed-center} 89 | 90 | background = ${bar/xenon.background} 91 | foreground = ${bar/xenon.foreground} 92 | 93 | underline-size = ${bar/xenon.underline-size} 94 | underline-color = ${bar/xenon.underline-color} 95 | 96 | border-size = ${bar/xenon.border-size} 97 | border-color = ${bar/xenon.border-color} 98 | 99 | padding-left = ${bar/xenon.padding-left} 100 | padding-right = ${bar/xenon.padding-right} 101 | 102 | module-margin-left = ${bar/xenon.module-margin-left} 103 | module-margin-right = ${bar/xenon.module-margin-right} 104 | 105 | font-0 = ${bar/xenon.font-0} 106 | 107 | [bar/generic] 108 | modules-left = bspwm volume 109 | modules-center = title 110 | modules-right = cpuload date 111 | 112 | monitor = ${env:MONITOR:Virtual-1} 113 | monitor-fallback = ${env:MONITOR:eDP1} 114 | width = ${bar/xenon.width} 115 | height = ${bar/xenon.height} 116 | 117 | radius = ${bar/xenon.radius} 118 | fixed-center = ${bar/xenon.fixed-center} 119 | 120 | background = ${bar/xenon.background} 121 | foreground = ${bar/xenon.foreground} 122 | 123 | underline-size = ${bar/xenon.underline-size} 124 | underline-color = ${bar/xenon.underline-color} 125 | 126 | border-size = ${bar/xenon.border-size} 127 | border-color = ${bar/xenon.border-color} 128 | 129 | padding-left = ${bar/xenon.padding-left} 130 | padding-right = ${bar/xenon.padding-right} 131 | 132 | module-margin-left = ${bar/xenon.module-margin-left} 133 | module-margin-right = ${bar/xenon.module-margin-right} 134 | 135 | font-0 = ${bar/xenon.font-0} 136 | 137 | 138 | [module/bspwm] 139 | type = internal/bspwm 140 | 141 | pin-workspaces = false 142 | 143 | label-focused-background = ${colors.background-alt} 144 | label-focused-underline= ${colors.primary} 145 | label-focused-padding = 2 146 | 147 | label-occupied-padding = 1 148 | 149 | label-urgent-background = ${colors.alert} 150 | label-urgent-padding = 1 151 | 152 | label-empty-foreground = ${colors.foreground-alt} 153 | label-empty-padding = 1 154 | 155 | [module/cpugraph] 156 | type = internal/cpu 157 | interval = 1 158 | format = 159 | format-prefix = 160 | format-prefix-foreground = ${colors.foreground-alt} 161 | format-underline = ${colors.secondary} 162 | label = CPU %percentage-cores%% 163 | 164 | ramp-coreload-0 = ▁ 165 | ramp-coreload-1 = ▂ 166 | ramp-coreload-2 = ▃ 167 | ramp-coreload-3 = ▄ 168 | ramp-coreload-4 = ▅ 169 | ramp-coreload-5 = ▆ 170 | ramp-coreload-6 = ▇ 171 | ramp-coreload-7 = █ 172 | 173 | [module/cpuload] 174 | type = custom/script 175 | exec = cpu-usage 176 | format-prefix = "CPU " 177 | format-underline = ${colors.secondary} 178 | interval = 1 179 | 180 | [module/cpufreq] 181 | type = custom/script 182 | exec = sysinfo cpufreq 183 | format-underline = ${colors.secondary} 184 | interval = 1 185 | 186 | [module/memory] 187 | type = internal/memory 188 | interval = 1 189 | format-prefix = 190 | format-prefix-foreground = ${colors.foreground-alt} 191 | format-underline = ${colors.ternary} 192 | label = RAM %gb_used% 193 | 194 | [module/wireless] 195 | type = internal/network 196 | interface = wlp3s0 197 | interval = 1 198 | label-connected = NET %downspeed% %upspeed% 199 | format-connected-underline = ${colors.secondary} 200 | 201 | [module/wired] 202 | type = internal/network 203 | interface = enp4s0 204 | interval = 1 205 | label-connected = NET %downspeed% %upspeed% 206 | format-connected-underline = ${colors.secondary} 207 | 208 | [module/date] 209 | type = internal/date 210 | interval = 10 211 | 212 | time = %H:%M 213 | 214 | label = %time% 215 | 216 | [module/volume] 217 | type = internal/pulseaudio 218 | 219 | format-volume = 220 | format-volume-underline = ${colors.primary} 221 | label-volume = VOL %percentage%% 222 | label-volume-foreground = ${root.foreground} 223 | 224 | format-muted-prefix = 225 | format-muted-foreground = ${colors.foreground-alt} 226 | label-muted = MUTED 227 | 228 | [module/backlight] 229 | type = internal/backlight 230 | 231 | card = intel_backlight 232 | format =