regexghost-dotfiles

My dotfiles and scripts
git clone git@git.regexghost.com/regexghost-dotfiles.git
Log | Files | Refs | README

commit 4c7b64c5d9cb2ec5ffc84cd157c62811482be8d2
Author: regexghost <regexghost@protonmail.com>
Date:   Thu, 23 Apr 2026 11:34:12 +0100

started to add dotfiles

Diffstat:
AREADME.md | 18++++++++++++++++++
AarchInstallGuide.md | 222+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adotfiles/.bash_profile | 6++++++
Adotfiles/.bashrc | 500+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adotfiles/.inputrc | 14++++++++++++++
Adotfiles/.profile | 29+++++++++++++++++++++++++++++
Adotfiles/PDF VIEWER_SUBSTITUTION_Zathura_.bashrc | 6++++++
Adotfiles/POWER MANAGEMENT_SUBSTITUTION_i3_.bashrc | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 846 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -0,0 +1,18 @@ +# regexghost's dotfiles + +This repo contains all my dotfiles, including: +* Configuration for various programs +* Window manager and desktop environment setups +* Terminal, window manager and panel scripts +* Small programs I've written +* Install guides for various OS setups + +This repo is a work in progress, as well as standard dotfiles updates I also plan to add scripts which can be used to save/load the dotfiles + +More information about specific WM/DE setups can be found below, both the dotfiles themselves and relevant articles on my website + +## Window Managers/Desktop Environments + +* [i3](i3/README.md) - [Website](https://www.regexghost.com/linux/i3) +* [Awesome WM](awesome/README.md) - [Website](https://www.regexghost.com/linux/raspberry-pi-3) +* [KDE](kde/README.md) - [Website](https://www.regexghost.com/linux/kde) diff --git a/archInstallGuide.md b/archInstallGuide.md @@ -0,0 +1,222 @@ +# Arch Install Guide + +This install guide is mainly for my reference, specific to my normal setup process. Most of the commands below would likely be the same on any system, and I have included different commands for UEFI or BIOS, or for NVidia cards. + +It's recommanded you read [the Arch wiki install guide](https://wiki.archlinux.org/title/Installation_guide) if you are installing Arch for the first time. + +## Install + +### Keyboard layout + +`loadkeys uk` - Set console keyboard layout to UK + +### Check if EFI + +`ls /sys/firmware/efi/efivars` - If this returns loads of files, you are on UEFI system + +### Internet + +`iwctl` +`device list` + +`device *device* set-property Powered on` +`adapter *adapter* set-property Powered on` + +`station *device* scan` - Scan for networks +`station *device* get-networks` - List networks +`station *device* connect *SSID*` - Connect to network + +### Timezone + +`timedatectl set-timezone Europe/London` - Set timezone +`timedatectl` - Check it worked + +### Disc Partitioning + +`fdisk -l` +`fdisk /dev/DRIVE` + +#### Create new partition table + +> `o` - New partition table +> `w` - Write changes + +`fdisk /dev/DRIVE` + +#### Boot partition - Skip on BIOS MBR + +> `n` - New partition +> `p` - Type = Primary +> `1` - First partion +> Enter - Starts at first avalible space +> `+512M` - 512MB for boot partition + +Change type to EFI + +> `t` - Change type +> `ef` - Code ef is EFI boot type + +#### Swap Partition + +> `n` +> `p` +> `2` +> Enter +> `+18G` - 18GB for swap partition as I have 16GB of RAM, enough for hybernation + +Change type to swap + +> `t` +> `2` +> `82` - Code 82 is swap type + +#### Root Partition + +> `n` +> `p` +> `3` +> Enter +> Enter - Will take up entire rest of drive + +Make bootable + +> `a` - Set bootable flag +> `3` + +#### Write Changes + +> `w` - Write changes + +### Formatting + +`mkfs.ext4 /dev/ROOT_PARTITION` +`mkswap /dev/SWAP_PARTITION` +`mkfs.fat -F32 /dev/EFI_SYSTEM_PARTITION` # Skip on MBR + +### Mounting + +`mount /dev/ROOT_PARTITION /mnt` +`mount --mkdir /dev/EFI_SYSTEM_PARTITION /mnt/boot` # Skip on MBR +`swapon /dev/SWAP_PARTITION` + +### Install + +`pacstrap -K /mnt base linux linux-firmware nano networkmanager` + +### Fstab + +`genfstab -U /mnt >> /mnt/etc/fstab` + +### Chroot + +`arch-chroot /mnt` + +### Time Zone + +`ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime` +`hwclock --systohc` + +### Localization + +`nano /etc/locale.gen` +Uncomment `en_GB.UTF-8 UTF-8` + +`locale-gen` + +`nano /etc/locale.conf` +Add `LANG=en_GB.UTF-8` + +`nano /etc/vconsole.conf` +Add `KEYMAP=uk` + +### Hostname + +`nano /etc/hostname` +Add `MY_HOSTNAME` + +### Root Password + +`passwd` + +### Check Mirrors + +`nano /etc/pacman.d/mirrorlist` +`pacman -Syyu` + +### Microcode + +`pacman -Syu` +`pacman -S amd-ucode grub efibootmgr sudo` +or +`pacman -S intel-ucode grub efibootmgr sudo` + +replace `efibootmgr` with `mtools dosfstools` for BIOS MBR + +### Grub + +#### UEFI + +`grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB` +`grub-mkconfig -o /boot/grub/grub.cfg` + +#### BIOS MBR + +`grub-install --target=i386-pc /dev/sdX` +`grub-mkconfig -o /boot/grub/grub.cfg` + +### Exit and Reboot + +`exit` +`umount -R /mnt` +`reboot` + +## Post install + +### WiFi Setup and Connect + +`rfkill` +`rfkill unblock wlan` + +`systemctl enable NetworkManager.service` +`reboot` + +`nmtui` + +### Create User + +`useradd --create-home username` +`usermod -aG wheel username` +`passwd username` + +`nano /etc/sudoers` +Uncomment `%wheel ALL=(ALL) ALL` + +`reboot` + +### Install Things + +`sudo pacman -Syu` - Update system +`sudo pacman -S xfce4 xorg-server mousepad lightdm lightdm-gtk-greeter alacritty xfce4-pulseaudio-plugin xfce4-genmon-plugin git` - Install programs +`sudo systemctl enable lightdm.service` +`reboot` + +Enabled multilib by uncommenting: +``` +[multilib] +Include = /etc/pacman.d/mirrorlist +``` +in `/etc/pacman.conf` +`pacman -Syu` + +### Enable Hibernation + +Add `resume` before `fsck` in `/etc/mkinitcpio.conf` +`sudo mkinitcpio -P` + +### If on NVidia System + +`sudo pacman -S nvidia lib32-nvidia-utils` + +Remove `kms` from `HOOKS` array in `/etc/mkinitcpio.conf` +`sudo mkinitcpio -P` +`reboot` diff --git a/dotfiles/.bash_profile b/dotfiles/.bash_profile @@ -0,0 +1,6 @@ +# +# ~/.bash_profile +# + +[[ -f ~/.bashrc ]] && . ~/.bashrc +[[ -f ~/.profile ]] && . ~/.profile diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc @@ -0,0 +1,500 @@ +# regexghost's .bashrc file +# Hopefully in a coherent order + +PROMPT_COMMAND= +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# Load bash completion +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +# Add my directory_bookmarks program to the prompt when relevant +PS1='\[\033[1;30m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;34m\]$(directory_bookmarks current)\[\033[1;31m\]\$\[\033[0m\] ' + +## Function to remove things which aren't useful from bash history +trim_history () { + sed -i -r '/^(history|hs|qalc|vis|cava|nethogs|btop|htop|gitl|gitd|gits|x|rm|cd|c|exit|lsa|ls|l|q)$/d' ~/.bash_history + # Remove any usage of fasd z autojump command + sed -i '/^z .*/d' ~/.bash_history + sed -i '/^zz .*/d' ~/.bash_history + # Remove any usage of rm command + sed -i '/^rm .*/d' ~/.bash_history + sed -i '/^youtube .*/d' ~/.bash_history + sed -i '/^to .*/d' ~/.bash_history + + # Remove any usage of cd, ls and mpv when only going one folder deeper in file structure + sed -i -r '/^(cd|ls|mpv|mpv) [^\/\>\<|:&]*\/? ?$/d' ~/.bash_history + # Remove any usage of m, rs and pdf when not going into a different folder + sed -i -r '/^(m|rs|pdf) [^\/\>\<|:&]* ?$/d' ~/.bash_history + # Remove anything in all caps, as it will basically always be a mistype + sed -i '/^[A-Z0-9 ]*$/d' ~/.bash_history + # Remove all duplicates, keeping most recent + tac ~/.bash_history | awk '!x[$0]++' | tac > ~/.bash_history_no_dupes && command mv ~/.bash_history_no_dupes ~/.bash_history + #sed --in-place 's/[[:space:]]\+$//' .bash_history && awk -i inplace '!seen[$0]++' .bash_history +} + +# Basic Aliases +alias grep='grep -i --color=auto' +alias greps='/usr/bin/grep --color=auto' # Case sensitive +alias grepa='grep -i -I -A 5 -B 5 --color=auto' +alias diff='diff --color' +alias hs='history' +alias n='nnn' +alias py='python3' +alias nf='fastfetch' +alias sq='ncdu --color dark' # Not sure why this is "sq" but I'm used to it now +alias bat='bat --theme=base16' +alias mv='mv -i' +alias cp='cp -r -i' +alias cmatrix='cmatrix -u 6' # Cool fake hacker program +alias duf='duf -hide special' +alias gtop='sudo intel_gpu_top' +alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' +alias rm='rm-trash-cli' +alias cheat='cheat -c' +alias zbr='zig build run' +alias bluey='bluetui' +alias fontsreload='sudo fc-cache -fv' +alias rss='newsraft' +alias trash-size='du ~/.local/share/Trash/files/ -s -h | cut -f 1' +alias sync='echo "Syncing"; sync; echo "Done"; lsblk' + +# Aliases to Specific Commands + +alias x='chmod +x' +alias copy='xclip -selection c' +alias batl='find . -maxdepth 1 | sort | tail -n 1 | xargs bat --theme=base16' +alias watchlc="watch 'ls | wc -l'" +alias watchdu="watch 'du -s -h *'" +alias lastyear='log -d $(date -d "-1 year" +"%y%m%d")' # Interacts with my log program +alias fatmount='sudo mount -o rw,users,umask=000' # Mount FAT formatted drive correctly +alias rmedir='find . -type d -empty -delete' +alias balance='aacgain -r -m 1 *.m4a' +alias vol='pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | cut -d "/" -f 2 | sed "s/ //g"' +alias clearlogs='sudo journalctl --vacuum-time=2d' +alias q='trim_history && exit' +alias reload='. ~/.bashrc' + +# Git Aliases + +alias gitd='git diff' +alias gitdc='git diff --word-diff-regex=.' +alias gits='git status' +alias gpl='git pull' +alias gp='git push' +alias gitl='git log --reverse' +alias giturl='git config --get remote.origin.url' + + +#### SUBSTITUTE - PACKAGE MANAGER +alias install='sudo pacman -S' +alias remove='sudo pacman -Rs' +alias update='sudo pacman -Syu' +alias search='pacman -Ss' +alias paclog='cat /var/log/pacman.log | grep' + +function pacs() { + numberOfPackages="$(pacman -Q | wc -l)" + echo "${numberOfPackages} packages installed" +} +#### END SUBSTITUTE + +# Other random aliases + +alias as='echo "Use \as to run as command, disabled as too easy to type accidentally, creating unnecessary a.out file in home directory"' +alias todo='$VISUAL ~/Documents/todo.md' +alias durationr='media-file-duration . -r' +alias durationi='media-file-duration . -i' + +## Functions to basic programs + +# fzf -> editor +function qfi () { + file="$(find ~/* | grep -E '.py$|.go$|.txt$|.md$|.java$|.js$|.html$|.css$|.c$|.cc$|.conf$|.lua$|.rs$|.sh$|.bash$|.csv$' | sed 's|'"$HOME"'|~|g' | fzf --bind 'ctrl-backspace:backward-kill-word' --bind 'ctrl-delete:kill-word' --bind 'ctrl-right:forward-word' --bind 'ctrl-left:backward-word')" + [[ "$file" == "" ]] && return + $VISUAL "$file" +} + +alias m='micro -clipboard terminal' +alias v='vim' + +function batf () { + result=$(fasd -fi $@) + [ "$result" == "" ] && return + bat --theme=base16 "$result" +} + +function lsblk () { + if [[ "$1" == "-a" ]]; then + /usr/bin/lsblk -o NAME,MAJ:MIN,RM,SIZE,RO,TYPE,FSTYPE,MOUNTPOINTS + else + /usr/bin/lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS + fi +} + +function do_pkill () { + pkill "$@" + [ "$?" == "0" ] || echo "Program not found" +} + +alias pkill='do_pkill' + +function storage () { + root_line=$(df -h | grep ' /$' | tr -s " ") + used=$(echo "$root_line" | cut -d " " -f 3) + free=$(echo "$root_line" | cut -d " " -f 4) + echo "Used: ${used}" + echo "Free: ${free}" +} + +function trash-empty() { + echo "Trash is $(trash-size)" + /usr/bin/trash-empty +} + +# Only use this if the history in the current terminal is suddenly way shorter than it should be +function restorebashhistory () { + history | sed 's/^[ ]*[0-9]*[ ]*//g' > /tmp/new_history + cat "$HOME/Downloads/.bash_history_backup" /tmp/new_history > /tmp/all_history + mv /tmp/all_history "$HOME/.bash_history" +} + +function cal () { + MAGENTA_COLOUR='\033[0;35m\033[1m' + RED_COLOUR='\033[0;34m\033[1m' + BLUE_COLOUR='\033[0;36m\033[1m' + RESET_COLOUR='\033[0m' + + function suffix () { + if [[ "$1" == "1" ]] || [[ "$1" == "21" ]] || [[ "$1" == "31" ]]; then + echo "st" + elif [[ "$1" == "2" ]] || [[ "$1" == "22" ]]; then + echo "nd" + elif [[ "$1" == "3" ]] || [[ "$1" == "23" ]]; then + echo "rd" + else + echo "th" + fi + } + + unbuffer cal -w -n 3 "$@" | sed '/^ *$/d' + + day="$(date +'%A')" + date="$(date +'%d')" + week="$(date +'%W')" + + echo -e "${RED_COLOUR}Day:${RESET_COLOUR} ${day}" + echo -e "${BLUE_COLOUR}Date:${RESET_COLOUR} ${date}$(suffix $date)" + echo -e "${MAGENTA_COLOUR}Week:${RESET_COLOUR} ${week}" +} + +function pyweb () { + $(sleep 0.5 && firefox "http://0.0.0.0:8000/") & + python3 -m http.server -d "$1" +} + +## Function to show time in various locations +function t () { + MAGENTA_COLOUR='\033[0;35m\033[1m' + RESET_COLOUR='\033[0m' + curDateZone=$(date +"%a, %b %d (%Z)") + TZ="America/Los_Angeles" date +" Los Angeles: %H:%M:%S - %a, %b %d (%Z)" + TZ="America/New_York" date +" New York: %H:%M:%S - %a, %b %d (%Z)" + date -u +" UTC: %H:%M:%S - %a, %b %d (%Z)" + TZ="Europe/London" date +" London: %H:%M:%S - %a, %b %d (%Z)" + TZ="Europe/Paris" date +" Paris: %H:%M:%S - %a, %b %d (%Z)" + TZ="Asia/Seoul" date +" Seoul: %H:%M:%S - %a, %b %d (%Z)" + TZ="Australia/Sydney" date +" Sydney: %H:%M:%S - %a, %b %d (%Z)" +} + +# External program openers + +#### SUBSTITUTE - IMAGE VIEWER +# Open images in gwenview +# The alias is called "rs" as I originally used Xfce with Ristretto +rs () { + toOpen=$@ + if [[ "$toOpen" == "" ]]; then + gwenview . & disown + else + gwenview "$@" & disown + fi +} +#### END SUBSTITUTE + +#### SUBSTITUTE - VIDEO PLAYER +# Open video(s) with mpv +mp () { + /usr/bin/mpv --really-quiet --save-position-on-quit "$@" & disown +} +#### END SUBSTITUTE + +#### SUBSTITUTE - PDF VIEWER +# Open pdf files in Okular +pdf () { + for arg; do + okular "$arg" & disown + done +} +#### END SUBSTITUTE + +# Power Management Functions + +#### SUBSTITUTE - POWER MANAGEMENT +## Shutdown with confirmation +shutdown () { + read -p "Shutdown? (y/N) " yesOrNoShutdown + if [[ "$yesOrNoShutdown" == "y" ]]; then + tmux send-keys -t buffer_tmux.0 C-s + tmux send-keys -t buffer_tmux.0 C-q + tmux kill-session -t buffer_tmux + qdbus6 org.kde.LogoutPrompt /LogoutPrompt promptShutDown + fi +} + +## Reboot with confirmation +reboot () { + read -p "Reboot? (y/N) " yesOrNoReboot + if [[ "$yesOrNoReboot" == "y" ]]; then + tmux send-keys -t buffer_tmux.0 C-s + tmux send-keys -t buffer_tmux.0 C-q + tmux kill-session -t buffer_tmux + qdbus6 org.kde.LogoutPrompt /LogoutPrompt promptReboot + fi +} + +## Hibernate to disk with confirmation +hibernate () { + read -p "Hibernate? (y/N) " yesOrNoHibernate + [[ "$yesOrNoHibernate" == "y" ]] && qdbus6 org.kde.Solid.PowerManagement /org/freedesktop/PowerManagement Hibernate +} + +## Hybrid-Sleep with confirmation, i.e. sleep to RAM and disk in case battery dies +hybrid-sleep () { + read -p "Hybrid-Sleep? (y/N) " yesOrNoHybridSleep + [[ "$yesOrNoHybridSleep" == "y" ]] && systemctl hybrid-sleep +} + +## Sleep with confirmation (i.e. RAM only) +qsleep () { + read -p "Sleep? (y/N) " yesOrNoQSleep + [[ "$yesOrNoQSleep" == "y" ]] && qdbus6 org.kde.Solid.PowerManagement /org/freedesktop/PowerManagement Suspend +} + +## Log Out with confirmation +log-out () { + read -p "Log Out? (y/N) " yesOrNoLogOut + [[ "$yesOrNoLogOut" == "y" ]] && qdbus6 org.kde.LogoutPrompt /LogoutPrompt org.kde.LogoutPrompt.promptLogout +} + +## Lock screen with confirmation +lock () { + read -p "Lock Screen? (y/N) " yesOrNoLock + [[ "$yesOrNoLock" == "y" ]] && qdbus6 org.kde.screensaver /ScreenSaver Lock +} +#### END SUBSTITUTE + +# yt-dlp helper function +do_yt-dlp () { + local aria_args=() + local metadata_args=() + local cookies_args=() + local archive_args=() + local other_args=() + output_format_args=(-o "%(title)s.%(ext)s") + format_args=() + + while [[ $# -gt 0 ]]; do + case "$1" in + --aria) + aria_args+=("--external-downloader" "aria2c" "--external-downloader-args" "aria2c:-x 16 -j 16 -s 16 -k 1M") + shift + ;; + --aria-limit) + download_limit="3" + num_re='^[0-9]+M*$' + if [[ "$2" =~ $num_re ]]; then + download_limit="${2//M}" + shift + fi + aria_args+=("--external-downloader" "aria2c" "--external-downloader-args" "aria2c:-x 16 -j 16 -s 16 -k 1M --max-overall-download-limit=${download_limit}M") + shift + ;; + --all-metadata) + metadata_args+=("--embed-chapters" "--embed-thumbnail" "--embed-metadata") + shift + ;; + --music) + output_format_args=(-o "%(title)s - %(channel)s - %(album)s.%(ext)s") + format_args=(-f 140) + shift + ;; + --playlist-order) + output_format_args=(-o "%(playlist_index)s-%(title)s.%(ext)s") + shift + ;; + --standard) + format_args=(-f "22/bestvideo[height<=720]+bestaudio") + shift + ;; + --firefox-cookies) + cookies_args=("--cookies-from-browser" "firefox") + shift + ;; + --archive) + archive_args=("--download-archive" "archive.txt") + shift + ;; + --1080p) + format_args=("-f" "bestvideo[height<=1080][protocol=https][vcodec*=avc]+bestaudio[ext=m4a]") + shift + ;; + --720p) + format_args=("-f" "bestvideo[height<=720][protocol=https][vcodec*=avc]+bestaudio[ext=m4a]") + shift + ;; + --480p) + format_args=("-f" "bestvideo[height<=480][protocol=https][vcodec*=avc]+bestaudio[ext=m4a]") + shift + ;; + --360p) + format_args=("-f" "bestvideo[height<=360][protocol=https][vcodec*=avc]+bestaudio[ext=m4a]") + shift + ;; + *) + other_args+=("$1") + shift + ;; + esac + done + + local all_args=("${output_format_args[@]}" "${aria_args[@]}" "${metadata_args[@]}" "${cookies_args[@]}" "${format_args[@]}" "${archive_args[@]}" "${other_args[@]}" "$@") + /usr/bin/yt-dlp "${all_args[@]}" +} + +## Alias to allow escaping with backslash +alias yt-dlp='do_yt-dlp' + +function yt-playlist () { + quality_option="--720p" + if [[ "$1" == "--1080p" ]]; then + quality_option="--1080p" + shift + fi + do_yt-dlp --playlist-order --all-metadata --firefox-cookies --aria --archive "$quality_option" "$@" +} + +function archivevideo() { + for url in "$@"; do + yt-dlp --cookies-from-browser firefox -o "%(title)s.%(ext)s" --embed-chapters --embed-thumbnail --embed-metadata -f "bestvideo[protocol=https][vcodec*=avc]+bestaudio[ext=m4a]" "$url" + done +} + +function archiveplaylist() { + if [[ "$1" == "-t" ]]; then + yt-dlp --cookies-from-browser firefox --flat-playlist --skip-download -J "$2" | jq '{title, videos: [.entries[] | {title, channel, id}]}' | yq -t + else + yt-dlp --cookies-from-browser firefox -J --flat-playlist "$1" | jq '.entries[] | [.title,.channel,.url]| @csv' + fi +} + +# Search commands + +alias hs='history' +alias his='history | grep' + +## Search root directory +findr () { + find / -iname "$1" 2>&1 | grep -v 'Permission denied' +} + +alias findh='find ~ -iname' +alias fig='find . | sort | grep' +alias psg='ps -aux | grep' + +# Load my other aliases and functions + +source "$HOME/.local/share/regexghost/terminal/autocompletion.bash" +source "$HOME/.local/share/regexghost/terminal/ls_aliases.bash" +[ -f ~/Programs/localStuff/aliases.sh ] && source ~/Programs/localStuff/aliases.sh + +# Set variables + +HISTSIZE=80000 +HISTFILESIZE=80000 + +export HISTCONTROL=ignoreboth:erasedups +export MICRO_TRUECOLOR=1 +export PASSWORD_STORE_CLIP_TIME=120 + +# Quick file/directory access + +alias doc='cd ~/Documents/' +alias dow='cd ~/Downloads/' +alias mus='cd ~/Music/' +alias vid='cd ~/Videos/' +alias pic='cd ~/Pictures/' +alias pro='cd ~/Programs/' +alias wor='cd ~/Work/' +alias loc='cd ~/.local/share/' +alias bin='cd ~/.local/bin/' +alias con='cd ~/.config/' + +function to { + cd "$(directory_bookmarks get "$1")" +} +alias bm='directory_bookmarks add' +alias bmr='directory_bookmarks remove' +alias bml='directory_bookmarks list' +alias bmc='directory_bookmarks current' + +alias cdp='cd - > /dev/null' + +export _FASD_NOCASE=1 +eval "$(fasd --init auto)" + +function do_z () { + command="fasd_cd -d" + if [[ "$1" == "--choice" ]]; then + command="fasd_cd -d -i" + shift + fi + + if [[ "$1" == ".." ]]; then + last_dir="$(cat /tmp/fasd_last_dir)" + pwd > /tmp/fasd_last_dir + cd "$last_dir" + return + fi + pwd > /tmp/fasd_last_dir + $command "$1" +} + +function qf { + file="$(directory_bookmarks file get "$1")" + [[ "$file" == "" ]] && return + "${VISUAL:-${EDITOR}}" "$file" +} + +alias qfa="directory_bookmarks file add" +alias qfr="directory_bookmarks file remove" +alias qfl="directory_bookmarks file list" + +unalias z +unalias zz + +alias z='do_z' +alias zz='do_z --choice' + +unalias a +unalias s +unalias sd +unalias sf +unalias d +unalias f diff --git a/dotfiles/.inputrc b/dotfiles/.inputrc @@ -0,0 +1,14 @@ +# Make autocomplete case insensitive +set completion-ignore-case on + +# Ctrl-Delete: delete next word +"\e[3;5~": kill-word + +# Ctrl-Backspace +"\C-H": backward-kill-word + +"\e[1~": beginning-of-line +"\e[4~": end-of-line + +set colored-stats on +set colored-completion-prefix on diff --git a/dotfiles/.profile b/dotfiles/.profile @@ -0,0 +1,29 @@ +# Set XDG directories +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" + +# Move files out of home directory +export ICEAUTHORITY="$XDG_CACHE_HOME/ICEauthority" +export GNUPGHOME="$XDG_DATA_HOME/gnupg" +export WGETRC="$XDG_CONFIG_HOME/wgetrc" +export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass" +export GOPATH="$XDG_DATA_HOME/go" +export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history" +export GRIPHOME="$XDG_CONFIG_HOME/grip" +export RUSTUP_HOME="$XDG_DATA_HOME/rustup" +export CARGO_HOME="$XDG_DATA_HOME/cargo" +#export PYTHON_HISTORY="$XDG_STATE_HOME/python/history" +export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" +export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk2rc" +export NUGET_PACKAGES="$XDG_CACHE_HOME/NuGetPackages" + +#export _JAVA_OPTIONS=-"Djava.util.prefs.userRoot=$XDG_CONFIG_HOME/java" + +export EDITOR="nano" +export VISUAL="vim" +#export PAGER="bat --wrap auto" +export BROWSER="firefox" +export PATH=$PATH:~/.local/bin:~/.npm/bin:~/.local/share/npm/bin +export TERMINAL="kitty" diff --git a/dotfiles/PDF VIEWER_SUBSTITUTION_Zathura_.bashrc b/dotfiles/PDF VIEWER_SUBSTITUTION_Zathura_.bashrc @@ -0,0 +1,6 @@ +# Open pdf files in Zathura +pdf () { + for arg; do + zathura "$arg" & disown + done +} diff --git a/dotfiles/POWER MANAGEMENT_SUBSTITUTION_i3_.bashrc b/dotfiles/POWER MANAGEMENT_SUBSTITUTION_i3_.bashrc @@ -0,0 +1,51 @@ +## Shutdown with confirmation +shutdown () { + read -p "Shutdown? (y/N) " yesOrNoShutdown + if [[ "$yesOrNoShutdown" == "y" ]]; then + tmux send-keys -t buffer_tmux.0 C-s + tmux send-keys -t buffer_tmux.0 C-q + tmux kill-session -t buffer_tmux + /usr/bin/shutdown -h 0 + fi +} + +## Reboot with confirmation +reboot () { + read -p "Reboot? (y/N) " yesOrNoReboot + if [[ "$yesOrNoReboot" == "y" ]]; then + tmux send-keys -t buffer_tmux.0 C-s + tmux send-keys -t buffer_tmux.0 C-q + tmux kill-session -t buffer_tmux + /usr/bin/systemctl reboot + fi +} + +## Hibernate to disk with confirmation +hibernate () { + read -p "Hibernate? (y/N) " yesOrNoHibernate + [[ "$yesOrNoHibernate" == "y" ]] && systemctl hibernate +} + +## Hybrid-Sleep with confirmation, i.e. sleep to RAM and disk in case battery dies +hybrid-sleep () { + read -p "Hybrid-Sleep? (y/N) " yesOrNoHybridSleep + [[ "$yesOrNoHybridSleep" == "y" ]] && systemctl hybrid-sleep +} + +## Sleep with confirmation (i.e. RAM only) +qsleep () { + read -p "Sleep? (y/N) " yesOrNoQSleep + [[ "$yesOrNoQSleep" == "y" ]] && systemctl suspend +} + +## Log Out with confirmation +log-out () { + read -p "Log Out? (y/N) " yesOrNoLogOut + [[ "$yesOrNoLogOut" == "y" ]] && i3-msg exit +} + +## Lock screen with confirmation +lock () { + read -p "Lock Screen? (y/N) " yesOrNoLock + [[ "$yesOrNoLock" == "y" ]] && i3lock -i "$HOME/.config/regexghost/lock_screen_background.png" +}