diff --git a/common/bin/bspwm_load_state b/common/bin/bspwm_load_state deleted file mode 100755 index 5a36b1c..0000000 --- a/common/bin/bspwm_load_state +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -f="$DOTFILES_PATH/.bspwm-state.json.tmp" -c="$DOTFILES_PATH/.bspwm-canvas.json.tmp" -bspwm_load_state_canvas "$f" > "$c" -chmod 600 "$c" -bspc wm -l "$c" -rm "$c" -bspwm_load_state_rules "$f" | bash diff --git a/common/bin/bspwm_load_state_canvas b/common/bin/bspwm_load_state_canvas deleted file mode 100755 index 09e4902..0000000 --- a/common/bin/bspwm_load_state_canvas +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env python3 - -import sys -import json - -source = open(sys.argv[1]) if len(sys.argv) > 1 else sys.stdin -state = json.load(source) - -def nullify_clients(node): - if node is None: - return - elif node['client'] is None: - nullify_clients(node['firstChild']) - nullify_clients(node['secondChild']) - else: - node['client'] = None - -state['clientsCount'] = 0 -state['focusHistory'] = [] -state['stackingList'] = [] - -for monitor in state['monitors']: - for desktop in monitor['desktops']: - desktop['focusedNodeId'] = 0 - nullify_clients(desktop['root']) - -print(json.dumps(state)) diff --git a/common/bin/bspwm_load_state_rules b/common/bin/bspwm_load_state_rules deleted file mode 100755 index f4f2f54..0000000 --- a/common/bin/bspwm_load_state_rules +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import json -import os - -file = os.environ['DOTFILES_PATH'] + '/.bspwm-state.json.tmp' - -source = open(sys.argv[1]) if len(sys.argv) > 1 else sys.stdin -state = json.load(source) - -def print_rules(prefix, node, path): - if node is None: - return - elif node['client'] is None: - print_rules(prefix, node['firstChild'], path+['1']) - print_rules(prefix, node['secondChild'], path+['2']) - else: - client = node['client'] - print('bspc rule -a {}:{} -o node={}{}'.format(client['className'], - client['instanceName'], - prefix, '/'.join(path))) - -for i, monitor in enumerate(state['monitors']): - for j, desktop in enumerate(monitor['desktops']): - print_rules('@^{}:^{}:/'.format(i+1, j+1), desktop['root'], []) diff --git a/common/bin/bspwm_save_state b/common/bin/bspwm_save_state deleted file mode 100755 index 595a119..0000000 --- a/common/bin/bspwm_save_state +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -f="$DOTFILES_PATH/.bspwm-state.json.tmp" -bspc wm -d > "$f" -chmod 600 "$f" diff --git a/common/bin/init-dotfiles b/common/bin/dotfiles-init similarity index 100% rename from common/bin/init-dotfiles rename to common/bin/dotfiles-init diff --git a/common/bin/dotfiles-setup b/common/bin/dotfiles-setup new file mode 100755 index 0000000..abf4a9e --- /dev/null +++ b/common/bin/dotfiles-setup @@ -0,0 +1,64 @@ +#!/usr/bin/env fish + +# TODO: init from curl + +set dfp (realpath (dirname (status -f))/../..) +set lock_file $HOME/.using-lytedev-dotfiles.lock +set -q XDG_CONFIG_HOME || set XDG_CONFIG_HOME $HOME/.config +source $dfp/common/bin/lib/meta/setup/helpers +dotfiles_setup_check_agreement $lock_file || begin + echo Quitting due to lack of user agreement. && exit 1 +end + +# test ! -d "$HOME/.env" && $dfp/common/bin/lib/meta/setup/select-os-env.bash + +set h $HOME; set c $XDG_CONFIG_HOME +echo yo +l common/tmux/conf $h/.tmux.conf +l common/fish $c/fish +l common/neovim $c/nvim +l common/colors/vim $c/nvim/colors/base16-donokai.vim +l common/weechat $h/.weechat +l common/scim/rc $h/.scimrc +l common/scim/lua $h/.scim/lua +l common/nnn $c/nnn +l common/kak $c/kak +l common/gpg/agent.conf $h/.gnupg/gpg-agent.conf +l common/htop/rc $c/htop/htoprc +l common/kitty $c/kitty +l common/mutt/rc $c/.muttrc +l common/git/config $h/.gitconfig +l common/elixir/iex.exs $h/.iex.exs + +# desktop environment files +# "apps/de/sway/config" "$XDG_CONFIG_HOME/sway/config" +# "apps/de/sway/lock" "$XDG_CONFIG_HOME/swaylock/config" +# "apps/de/mako/" "$XDG_CONFIG_HOME/mako" +# "apps/de/sway/mimeapps.list" "$XDG_CONFIG_HOME/mimeapps.list" +# "apps/de/sway/mimeapps.list" "$XDG_CONFIG_HOME/sway-mimeapps.list" +# "apps/de/sway/mimeapps.list" "$HOME/.local/share/applications/mimeapps.list" + +# gtk configuration files +# "apps/de/gtk/2rc" "$HOME/.gtkrc-2.0" +# "apps/de/gtk/2rc" "$HOME/.gtkrc" +# "apps/de/gtk/3settings.ini" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" + +# bar files +# "apps/de/waybar/" "$XDG_CONFIG_HOME/waybar" + +# libinput configuration +# "apps/de/libinput/gestures.conf" "$XDG_CONFIG_HOME/libinput-gestures.conf" + +# document viewer +# "apps/zathura/" "$XDG_CONFIG_HOME/zathura" + +# XDG user directories +# "apps/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs" + +# Kanshi configuration +# "apps/de/kanshi" "$XDG_CONFIG_HOME/kanshi" + +# execute the user's shell +set ush (getent passwd $LOGNAME | cut -d: -f7) +echo Dotfiles Installed! Running $ush +exec $ush diff --git a/common/bin/sudo_setup b/common/bin/dotfiles-setup-for-root similarity index 100% rename from common/bin/sudo_setup rename to common/bin/dotfiles-setup-for-root diff --git a/common/bin/lib/meta/setup/helpers b/common/bin/lib/meta/setup/helpers new file mode 100644 index 0000000..6f11e37 --- /dev/null +++ b/common/bin/lib/meta/setup/helpers @@ -0,0 +1,50 @@ +#!/usr/bin/env fish + +set USER_DISAGREE_CODE 120 +set NO_AGREEMENT_CODE 121 + +function dotfiles_setup_check_agreement + set -l lock_file $argv[1] + + # Let user know that this script will delete their current configuration and + # that they should read this script before running. We'll use a lock file so + # the user only needs to agree once. + if test -f $lock_file + # User agreed already - do nothing + echo Lock file exists \($lock_file\) + echo Linking files... + else + echo This will delete existing files. Make sure you know what you\'re doing. + read -r -p "Are you sure you want to continue? [y/N] " response + set response (string lower $response) + if string match $response y + echo "agreed" > "$lock_file" + else + return $USER_DISAGREE_CODE + end + end +end + +function l + set i $argv[2] + if test -L $i || test -f $i || test -d $i + rm -rf "$i" + end + # check if the directory that will contain the link exists + set -l d (dirname $i) + test -d $d || mkdir -p $d + ln -s $dfp/$argv[1] $i + echo Linked $argv[1] to $i +end + +function dotfiles_setup_link_files + for i in $argv + if set -q source_file + l $source_file $i + set -e source_file + else + set source_file $i + end + end + echo Done. +end diff --git a/common/bin/lib/setup_helpers.bash b/common/bin/lib/setup_helpers.bash deleted file mode 100644 index b0dde91..0000000 --- a/common/bin/lib/setup_helpers.bash +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env bash - -dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/../../" && pwd) - -USER_DISAGREE_CODE=120 -NO_AGREEMENT_CODE=121 - -_dotfiles_setup_check_agreement() { - local -r lock_file="$1" - - # Let user know that this script will delete their current configuration and - # that they should read this script before running. We'll use a lock file so - # the user only needs to agree once. - if [ -f "$lock_file" ]; then - # User agreed already - do nothing - echo -e "\nLinking files...\n" - else - echo -e "\nRunning this script may delete existing personal configuration files." - echo "Please view this script's source, fully understand it, and backup any" - echo "files before continuing." - echo -e "\nSeriously. Like... entire directories. Just gone. Completely.\n" - read -r -p "Are you sure you want to continue? [y/N] " response - response=${response,,} # to lower case - if [[ $response =~ ^(yes|y)$ ]]; then - echo "agreed" > "$lock_file" - else - return "${USER_DISAGREE_CODE}" - fi - fi -} -export -f _dotfiles_setup_check_agreement - -_dotfiles_setup_link_files() { - local links=("$@") - - source_file="" - for i in "${links[@]}"; do - if [ -n "$source_file" ]; then - if [ -L "$i" ]; then # if symlink exists, delete it - rm -rf "$i" - fi - if [ -f "$i" ]; then # if file exists, delete it - rm -rf "$i" - fi - if [ -d "$i" ]; then # if directory exists, delete it - rm -rf "$i" - fi - # check if the directory that will contain the link exists - DIR_TO_LINK=$(dirname "$i") - if [ -d "$DIR_TO_LINK" ]; then - : - else - mkdir -p "$DIR_TO_LINK" - fi - ln -s "$source_file" "$i" - echo -e " Linking (from/to):\n ~/$(realpath --relative-to="$HOME" "$source_file")\n $i" - source_file="" - else - source_file="$dfp/$i" - fi - done - echo -e "\nDone.\n" -} -export -f _dotfiles_setup_link_files - -_dotfiles_setup_run_setup() { - local -r lock_file="$1" && shift - - if _dotfiles_setup_check_agreement "$lock_file"; then - _dotfiles_setup_link_files "$@" - else - echo "Quitting due to lack of user agreement." - return "${NO_AGREEMENT_CODE}" - fi - -} -export -f _dotfiles_setup_run_setup diff --git a/common/bin/murxvt b/common/bin/murxvt deleted file mode 100755 index ad4ef0e..0000000 --- a/common/bin/murxvt +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# TODO: migrate to alacritty? -font="xft:Iosevka:pixelsize=16" - -urxvtc -fb "$font" -fi "$font" -fn "$font" -letsp "-1" diff --git a/common/bin/qute b/common/bin/qute deleted file mode 100755 index 1dcbf71..0000000 --- a/common/bin/qute +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -exec qutebrowser --backend webengine diff --git a/common/bin/reload-xresources b/common/bin/reload-xresources deleted file mode 100755 index 8d9e6a2..0000000 --- a/common/bin/reload-xresources +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -"$DOTFILES_PATH/apps/de/x/loadresources" diff --git a/common/bin/setup-dotfiles b/common/bin/setup-dotfiles deleted file mode 100755 index fbfd20e..0000000 --- a/common/bin/setup-dotfiles +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/env bash - -# TODO: quiet/auto-agree mode for curl | bash automagic? - -dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/.." && pwd) -source "${dfp}/env/common/setup_helpers.bash" -export DOTFILES_PATH="${DOTFILES_PATH:-$dfp}" -export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" -test ! -d "$HOME/.env" && "$dfp/bin/choose-common-env" - -INTERACTIVE=1 - -while test $# -gt 0; do - case "$1" in - -x|--non-interactive) - INTERACTIVE=0 - shift - ;; - esac -done - -links=( - # desktop environment files - "apps/de/sway/config" "$XDG_CONFIG_HOME/sway/config" - "apps/de/sway/lock" "$XDG_CONFIG_HOME/swaylock/config" - "apps/de/mako/" "$XDG_CONFIG_HOME/mako" - "apps/de/sway/mimeapps.list" "$XDG_CONFIG_HOME/mimeapps.list" - "apps/de/sway/mimeapps.list" "$XDG_CONFIG_HOME/sway-mimeapps.list" - "apps/de/sway/mimeapps.list" "$HOME/.local/share/applications/mimeapps.list" - - # shell files - "apps/shell/tmux/conf" "$HOME/.tmux.conf" - "apps/shell/tmux/layouts" "$HOME/.tmux/layouts" - "apps/shell/fish/" "$XDG_CONFIG_HOME/fish" - - # text editor files - "apps/neovim/" "$XDG_CONFIG_HOME/nvim" - "env/common/colors/vim" "$XDG_CONFIG_HOME/nvim/colors/base16-donokai.vim" - "apps/emacs/" "$HOME/.emacs.lytedev" - - # gtk configuration files - "apps/de/gtk/2rc" "$HOME/.gtkrc-2.0" - "apps/de/gtk/2rc" "$HOME/.gtkrc" - "apps/de/gtk/3settings.ini" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" - - # bar files - "apps/de/waybar/" "$XDG_CONFIG_HOME/waybar" - - # irc files - "apps/weechat/" "$HOME/.weechat" - - # qutebrowser config files - "apps/qutebrowser/qutebrowser.conf" "$XDG_CONFIG_HOME/qutebrowser/qutebrowser.conf" - "apps/qutebrowser/keys.conf" "$XDG_CONFIG_HOME/qutebrowser/keys.conf" - - # sc-im config files and scripts - "apps/scim/rc" "$HOME/.scimrc" - "apps/scim/lua" "$HOME/.scim/lua" - - # libinput configuration - "apps/de/libinput/gestures.conf" "$XDG_CONFIG_HOME/libinput-gestures.conf" - - # nnn configuration - "apps/nnn/" "$XDG_CONFIG_HOME/nnn" - - # kakoune editor configuration - "apps/kak/" "$XDG_CONFIG_HOME/kak" - - # gpg config - "apps/gpg/agent.conf" "$HOME/.gnupg/gpg-agent.conf" - - # document viewer - "apps/zathura/" "$XDG_CONFIG_HOME/zathura" - - # htop - "apps/htop/rc" "$XDG_CONFIG_HOME/htop/htoprc" - - # terminal emulator - "apps/alacritty/" "$XDG_CONFIG_HOME/alacritty" - - # kitty config - "apps/kitty/" "$XDG_CONFIG_HOME/kitty" - - # ranger config - "apps/ranger/" "$XDG_CONFIG_HOME/ranger" - - # mutt config - "apps/mutt/rc" "$XDG_CONFIG_HOME/.muttrc" - "apps/mutt/rc" "$HOME/.muttrc" - - # git config - "apps/git/config" "$HOME/.gitconfig" - - # fontconfig - "apps/de/fontconfig/" "$XDG_CONFIG_HOME/fontconfig" - - # fontconfig - "apps/elixir/iex.exs" "$HOME/.iex.exs" - - # XDG user directories - "apps/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs" - - # Music Player Daemon - "apps/mpd" "$XDG_CONFIG_HOME/mpd" - - # MPD client - "apps/ncmpcpp" "$HOME/.ncmpcpp" - - # XDG user directories - "env/nix/pkgs" "$XDG_CONFIG_HOME/nixpkgs" - - # Kanshi configuration - "apps/de/kanshi" "$XDG_CONFIG_HOME/kanshi" -) - -# TODO: pass interactive? -_dotfiles_setup_run_setup "$HOME/.using-lytedev-dotfiles.lock" "${links[@]}" - -if [[ "$INTERACTIVE" = 1 ]]; then - echo -n -e "Do you want to run the env/common/sudo_setup script for changes to /etc" - echo -n -e "\nand other root directories?" - read -r -p " [y/N] " response - response=${response,,} # to lower case - if [[ $response =~ ^(yes|y)$ ]]; then - "$dfp/env/common/sudo_setup" - fi - - # execute the user's shell - ush="$(getent passwd $LOGNAME | cut -d: -f7)" - echo -e "Dotfiles Installed! Running 'exec $ush'...\n" - exec "$ush" -fi diff --git a/common/shell/fish/.gitignore b/common/fish/.gitignore similarity index 100% rename from common/shell/fish/.gitignore rename to common/fish/.gitignore diff --git a/common/shell/fish/aliases.fish b/common/fish/aliases.fish similarity index 100% rename from common/shell/fish/aliases.fish rename to common/fish/aliases.fish diff --git a/common/shell/fish/colors.fish b/common/fish/colors.fish similarity index 100% rename from common/shell/fish/colors.fish rename to common/fish/colors.fish diff --git a/common/shell/fish/completions/fisher.fish b/common/fish/completions/fisher.fish similarity index 100% rename from common/shell/fish/completions/fisher.fish rename to common/fish/completions/fisher.fish diff --git a/common/shell/fish/completions/kubectl.fish b/common/fish/completions/kubectl.fish similarity index 100% rename from common/shell/fish/completions/kubectl.fish rename to common/fish/completions/kubectl.fish diff --git a/common/shell/fish/config.fish b/common/fish/config.fish similarity index 94% rename from common/shell/fish/config.fish rename to common/fish/config.fish index f39e33b..a3b3b6b 100755 --- a/common/shell/fish/config.fish +++ b/common/fish/config.fish @@ -3,15 +3,16 @@ set -Ux XDG_CONFIG_HOME $HOME/.config set -Ux DOTFILES_PATH $XDG_CONFIG_HOME/lytedev-dotfiles set -Ux ENV_PATH $HOME/.env +set -Ux FISH_PATH $XDG_CONFIG_HOME/fish -source $DOTFILES_PATH/apps/shell/fish/paths.fish -source $DOTFILES_PATH/apps/nnn/config.fish +source $FISH_PATH/paths.fish status --is-interactive || exit for f in key-bindings colors prompt aliases - source $DOTFILES_PATH/apps/shell/fish/$f.fish + source $FISH_PATH/$f.fish end +source $DOTFILES_PATH/common/nnn/config.fish set -Ux _JAVA_AWT_WM_NONREPARENTING 1 set -Ux TERMINAL kitty diff --git a/common/shell/fish/fish_plugins b/common/fish/fish_plugins similarity index 100% rename from common/shell/fish/fish_plugins rename to common/fish/fish_plugins diff --git a/common/shell/fish/key-bindings.fish b/common/fish/key-bindings.fish similarity index 100% rename from common/shell/fish/key-bindings.fish rename to common/fish/key-bindings.fish diff --git a/common/shell/fish/paths.fish b/common/fish/paths.fish similarity index 98% rename from common/shell/fish/paths.fish rename to common/fish/paths.fish index 8a63aae..0de978d 100755 --- a/common/shell/fish/paths.fish +++ b/common/fish/paths.fish @@ -5,7 +5,7 @@ set -Ux GOPATH $HOME/.go set -U fish_user_paths \ $HOME/.go \ $GOPATH/bin \ - $DOTFILES_PATH/bin \ + $DOTFILES_PATH/common/bin \ $ENV_PATH/bin \ $ENV_PATH/.hidden/bin \ $HOME/.bin \ diff --git a/common/shell/fish/prompt.fish b/common/fish/prompt.fish similarity index 100% rename from common/shell/fish/prompt.fish rename to common/fish/prompt.fish diff --git a/common/shell/tmux/conf b/common/tmux/conf similarity index 100% rename from common/shell/tmux/conf rename to common/tmux/conf diff --git a/common/shell/tmux/layouts/dev.tmux b/common/tmux/layouts/dev.tmux similarity index 100% rename from common/shell/tmux/layouts/dev.tmux rename to common/tmux/layouts/dev.tmux diff --git a/common/bin/work-mode b/host/laptop/third/work-mode similarity index 100% rename from common/bin/work-mode rename to host/laptop/third/work-mode diff --git a/os/linux/arch-linux/provision.d/00-add-user.bash b/os/linux/arch/provision.d/00-add-user.bash similarity index 100% rename from os/linux/arch-linux/provision.d/00-add-user.bash rename to os/linux/arch/provision.d/00-add-user.bash diff --git a/os/linux/arch-linux/provision.d/10-install-yay.bash b/os/linux/arch/provision.d/10-install-yay.bash similarity index 100% rename from os/linux/arch-linux/provision.d/10-install-yay.bash rename to os/linux/arch/provision.d/10-install-yay.bash diff --git a/os/linux/arch-linux/provision.d/20-install-packages.bash b/os/linux/arch/provision.d/20-install-packages.bash similarity index 100% rename from os/linux/arch-linux/provision.d/20-install-packages.bash rename to os/linux/arch/provision.d/20-install-packages.bash diff --git a/os/linux/arch-linux/provision.d/50-install-tmux-plugins.bash b/os/linux/arch/provision.d/50-install-tmux-plugins.bash similarity index 100% rename from os/linux/arch-linux/provision.d/50-install-tmux-plugins.bash rename to os/linux/arch/provision.d/50-install-tmux-plugins.bash diff --git a/os/linux/arch-linux/provision.d/optional/amd-cpu.bash b/os/linux/arch/provision.d/optional/amd-cpu.bash similarity index 100% rename from os/linux/arch-linux/provision.d/optional/amd-cpu.bash rename to os/linux/arch/provision.d/optional/amd-cpu.bash diff --git a/os/linux/arch-linux/provision.d/optional/amd-gpu.bash b/os/linux/arch/provision.d/optional/amd-gpu.bash similarity index 100% rename from os/linux/arch-linux/provision.d/optional/amd-gpu.bash rename to os/linux/arch/provision.d/optional/amd-gpu.bash diff --git a/os/linux/arch-linux/provision.sh b/os/linux/arch/provision.sh similarity index 100% rename from os/linux/arch-linux/provision.sh rename to os/linux/arch/provision.sh diff --git a/common/bin/app-launcher b/os/linux/bin/app-launcher similarity index 100% rename from common/bin/app-launcher rename to os/linux/bin/app-launcher diff --git a/common/bin/floating-term b/os/linux/bin/floating-term similarity index 100% rename from common/bin/floating-term rename to os/linux/bin/floating-term diff --git a/common/bin/wifi-list b/os/linux/bin/wifi-list similarity index 100% rename from common/bin/wifi-list rename to os/linux/bin/wifi-list diff --git a/common/bin/wm b/os/linux/bin/wm similarity index 100% rename from common/bin/wm rename to os/linux/bin/wm diff --git a/common/bin/lyte-nixos-cleanup b/os/linux/nix/lyte-nixos-cleanup similarity index 100% rename from common/bin/lyte-nixos-cleanup rename to os/linux/nix/lyte-nixos-cleanup