diff --git a/.img/screenshot.png b/.img/screenshot.png deleted file mode 100644 index f8cf17a..0000000 Binary files a/.img/screenshot.png and /dev/null differ diff --git a/README.md b/README.md index 73c100e..84c6bed 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,14 @@ # My dotfiles -This is a collection of some of my dotfiles for my Artix Linux system. +This is a collection of some of my dotfiles for my Linux systems. I personally use these on Artix Linux and Fedora Workstation. -![Screenshot](./.img/screenshot.png) - -You can install these dotfiles by cloning this repository and executing `install.sh`: +If you're on Artix Linux, you can install these dotfiles by cloning this repository and executing `artix-install.sh`: ```bash $ git clone https://github.com/theanonymousexyz/dotfiles.git $ cd dotfiles -$ chmod +x install.sh -$ ./install.sh +$ chmod +x artix-install.sh +$ ./artix-install.sh ``` Note that I use `doas` instead of `sudo`. If you prefer `sudo`, then change all instances of `doas` to `sudo`, or simply create a symlink `doas` pointing to `sudo`: @@ -23,5 +21,5 @@ sudo ln -s $(which sudo) /usr/bin/doas - You need to make `doas`/`sudo` rules that allow you to execute, `poweroff` and `reboot` (and additionally `ivpn-service` and `pkill "^ivpn-service$"` if you use IVPN) without a password, otherwise the keybindings and scripts for those won't work. - The install script requires GNU Stow to work. - Make sure to thoroughly examine these dotfiles and change them to your needs before using them. -- See the READMEs for some of the packages here for special notes. -- Optionally, fork this repository to make maintenance easier. +- See the READMEs in the individual subfolders here for special notes. +- I've installed `dash` and symlinked `/bin/sh` to it for faster execution of shell scripts. As such, all my scripts try to be as POSIX compliant as possible. If you're on an Arch based distro, you can install `dashbinsh` from the AUR to automatically keep `/bin/sh` symlinked to `dash`. diff --git a/install.sh b/artix-install.sh similarity index 65% rename from install.sh rename to artix-install.sh index d9c47f2..8ba31b3 100755 --- a/install.sh +++ b/artix-install.sh @@ -1,19 +1,27 @@ #!/bin/sh +if [ "$(lsb_release -si)" != "Artix" ]; then + echo "This script is only intended to be used for a full setup on Artix Linux. Quitting..." + exit 1 +fi + echo "Configuring directories..." cd -- "$(dirname -- $0)" ZDOTDIR="$HOME/.config/zsh" mkdir -p "$ZDOTDIR" # Symlink only the individual files instead of the entire directory - sleep 0.5 + echo "Creating the symlinks with stow..." -for dir in * -do - [ -d "$dir" ] && stow -t "$HOME" --ignore="README.md" "$dir" +for dir in *; do + if [ -d "$dir" ]; then + echo "* Symlinking $dir" + stow -t "$HOME" --ignore="README.md" "$dir" + sleep 0.1 + fi done -sleep 0.5 +sleep 0.4 echo "Making scripts executable..." chmod +x scripts/.local/bin/clear-clipboard.sh @@ -23,6 +31,6 @@ chmod +x sway/.config/sway/autostart.sh chmod +x waybar/.config/waybar/ivpn-reconnect.sh chmod +x waybar/.config/waybar/ivpn-status.sh chmod +x waybar/.config/waybar/mediaplayer.py - sleep 0.5 + echo "Done!" diff --git a/scripts/.local/bin/update.sh b/scripts/.local/bin/update.sh index 24c4c0a..39bd909 100755 --- a/scripts/.local/bin/update.sh +++ b/scripts/.local/bin/update.sh @@ -6,3 +6,5 @@ command -v flatpak >/dev/null 2>&1 && { echo; flatpak update; } command -v npm >/dev/null 2>&1 && { echo; npm up -g; } command -v docker >/dev/null 2>&1 && { echo; docker images | awk '(NR>1) && ($2!~/none/) {print $1":"$2}' | xargs -l docker pull; } + +return 0 diff --git a/scripts/.local/bin/vfio.sh b/scripts/.local/bin/vfio.sh index 6bc2789..98738a9 100755 --- a/scripts/.local/bin/vfio.sh +++ b/scripts/.local/bin/vfio.sh @@ -1,5 +1,9 @@ #!/bin/sh +if [ "$(lsb_release -si)" = "Arch" ] || [ "$(lsb_release -si)" = "Artix" ]; then + echo "This script must be run on either Arch Linux or Artix Linux. Quitting..." +fi + if [ $(id -u) -ne 0 ]; then echo "This script must be run as root. Quitting..." exit 1 diff --git a/zsh/.config/zsh/.aliases.zsh b/zsh/.config/zsh/.aliases.zsh deleted file mode 100644 index 29af8bf..0000000 --- a/zsh/.config/zsh/.aliases.zsh +++ /dev/null @@ -1,28 +0,0 @@ -# Shortcuts -alias btctl="bluetoothctl" -alias code="codium --enable-features=UseOzonePlatform --ozone-platform=wayland" -alias cl="clear" -alias exa="exa -aFghl --color=always --git --icons" -alias grep="grep --color=always" -alias l="lsd -hlA --color=always" -alias la="lsd -hl --color=always" -alias ll="lsd -hlaF --color=always" -alias ls="ls --color=always" -alias q="exit" -alias tree="exa --color=always --tree -I '.git'" -alias u="paru; echo; npm up -g" -alias zgrep="zgrep --color=always" - -# File management -alias cp="cp -iv" -alias mkdir="mkdir -pv" -alias mv="mv -iv" -alias rm="rm -iv" -alias srm="srm -iv" - -# Passwordless doas -alias poweroff="doas poweroff" -alias reboot="doas reboot" - -# sudoedit for doas (hacky solution) -alias doasedit="doas -L; doas sh -c '$EDITOR /etc/doas.conf; doas -C /etc/doas.conf && echo ok || echo error'; doas -L" diff --git a/zsh/.config/zsh/.zlogout b/zsh/.config/zsh/.zlogout index 4ec8594..fe97b95 100644 --- a/zsh/.config/zsh/.zlogout +++ b/zsh/.config/zsh/.zlogout @@ -1,10 +1,11 @@ -if [ "$(tty)" = "/dev/tty1" ]; then - pgrep "^ivpn-service$" &> /dev/null && - ivpn disconnect &> /dev/null - doas pkill "^ivpn-service$" &> /dev/null +if [[ $(tty) == /dev/tty1 ]] && [[ $(lsb_release -si) == Artix ]]; then + { + pgrep "^ivpn-service$" && ivpn disconnect + doas pkill "^ivpn-service$" - pkill "^mako$" &> /dev/null - pkill "^pipewire$" &> /dev/null - pkill "^pipewire-pulse$" &> /dev/null - pkill "^wireplumber$" &> /dev/null + pkill "^mako$" + pkill "^pipewire$" + pkill "^pipewire-pulse$" + pkill "^wireplumber$" + } &> /dev/null fi diff --git a/zsh/.config/zsh/.zprofile b/zsh/.config/zsh/.zprofile index 7389984..2b21955 100644 --- a/zsh/.config/zsh/.zprofile +++ b/zsh/.config/zsh/.zprofile @@ -1,4 +1,4 @@ -if [ "$(tty)" = "/dev/tty1" ]; then +if [[ $(tty) == /dev/tty1 ]] && [[ $(lsb_release -si) == Artix ]]; then export $(gnome-keyring-daemon --start) export XDG_CURRENT_DESKTOP=Unity export GTK_USE_PORTAL=1 @@ -6,6 +6,4 @@ if [ "$(tty)" = "/dev/tty1" ]; then dbus-launch --sh-syntax --exit-with-session sway &> /dev/null exit -else - neofetch fi diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 252408f..8bc73d5 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -7,9 +7,12 @@ export LANG="en_DK.UTF-8" export EDITOR="nvim" export PAGER="less" -# Settings +# Less export LESS="-R" export LESSHISTFILE="/dev/null" +# Tmux +[[ -z $TMUX ]] || export TERM="xterm-256color" + # Secret variables -[[ -f $ZDOTDIR/.env ]] && source $ZDOTDIR/.env +[[ -f $ZDOTDIR/.env.zsh ]] && source $ZDOTDIR/.env.zsh diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 4197d48..f0010ff 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -7,8 +7,8 @@ PZ_PLUGIN_HOME="$ZDOTDIR/plugins" ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern regexp root line) # Load the .zsh files -for file in $ZDOTDIR/.*.zsh; do - [[ $file == $ZDOTDIR/.p10k.zsh ]] || source $file +for file in $ZDOTDIR/*.zsh; do + source $file done # Initialize PZ diff --git a/zsh/.config/zsh/aliases.zsh b/zsh/.config/zsh/aliases.zsh new file mode 100644 index 0000000..47a7c1c --- /dev/null +++ b/zsh/.config/zsh/aliases.zsh @@ -0,0 +1,26 @@ +# Common aliases +alias btctl="bluetoothctl" +alias cl="clear" +alias cp="cp -i" +alias exa="exa -aFghl --color=always --git --icons" +alias grep="grep --color=always" +alias l="lsd -hlA --color=always" +alias la="lsd -hl --color=always" +alias ll="lsd -hlaF --color=always" +alias ls="ls --color=always" +alias mkdir="mkdir -p" +alias mv="mv -i" +alias q="exit" +alias rm="rm -i" +alias srm="srm -i" +alias tmux="tmux -2u" +alias tree="exa --tree -I '.git'" +alias wl-copy="wl-copy -n" +alias zgrep="zgrep --color=always" + +if [[ $(lsb_release -si) == Artix ]]; then + alias code="codium --enable-features=UseOzonePlatform --ozone-platform=wayland" + alias doasedit="doas -L; doas sh -c '$EDITOR /etc/doas.conf; doas -C /etc/doas.conf && echo ok || echo error'; doas -L" + alias poweroff="doas poweroff" + alias reboot="doas reboot" +fi diff --git a/zsh/.config/zsh/.completion.zsh b/zsh/.config/zsh/completion.zsh similarity index 100% rename from zsh/.config/zsh/.completion.zsh rename to zsh/.config/zsh/completion.zsh diff --git a/zsh/.config/zsh/.gpg.zsh b/zsh/.config/zsh/gpg.zsh similarity index 100% rename from zsh/.config/zsh/.gpg.zsh rename to zsh/.config/zsh/gpg.zsh diff --git a/zsh/.config/zsh/.history.zsh b/zsh/.config/zsh/history.zsh similarity index 100% rename from zsh/.config/zsh/.history.zsh rename to zsh/.config/zsh/history.zsh diff --git a/zsh/.zshenv b/zsh/.zshenv index e831684..8ade373 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,2 +1,2 @@ -ZDOTDIR="$HOME/.config/zsh" +export ZDOTDIR="$HOME/.config/zsh" source $ZDOTDIR/.zshenv