diff --git a/.gitignore b/.gitignore index e6d9163..1e10d06 100644 --- a/.gitignore +++ b/.gitignore @@ -5,12 +5,6 @@ *.secret fishd.tmp.* -# keep the pipelines but hide their results -/env/common/data/pipelines/*/*/* - -# a place to keep secrets per-env -.hidden - # TODO: should be unnecessary once color generation is homegrown /colors/gen/vendor /colors/gen/tmp diff --git a/common/bin/choose-common-env b/common/bin/choose-common-env deleted file mode 100755 index 3819a61..0000000 --- a/common/bin/choose-common-env +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env sh - -. "$DOTFILES_PATH/bin/prelude" -machines_path="$DOTFILES_PATH/env/common/machines" -machine="$( - cd "$machines_path" && \ - find ./ -mindepth 1 -maxdepth 1 -type d | \ - cut -c3- | \ - fzf --prompt "Choose your machine > ")" -rm -f "$ENV_PATH" -ezln "$machines_path/$machine" "$ENV_PATH" && \ - echo "Symlinked '$(realpath "$machines_path/$machine")' to your ENV_PATH ('$ENV_PATH')" diff --git a/common/bin/dotfiles-setup b/common/bin/dotfiles-setup index abf4a9e..244a5f0 100755 --- a/common/bin/dotfiles-setup +++ b/common/bin/dotfiles-setup @@ -4,16 +4,36 @@ 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 + +if not test -f $lock_file + 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 + exit 1 + end end -# test ! -d "$HOME/.env" && $dfp/common/bin/lib/meta/setup/select-os-env.bash - +set -q XDG_CONFIG_HOME || set XDG_CONFIG_HOME $HOME/.config set h $HOME; set c $XDG_CONFIG_HOME -echo yo +if test -d $c/lytedev-env + echo "Warning: no environment-specific configuration detected!" +end + +function l -a dot -a target -d "Symlink a dotfile configuration file or directory" + if test -L $target || test -f $target || test -d $target + rm -rf "$target" + end + # check if the directory that will contain the link exists + set -l d (dirname $target) + test -d $d || mkdir -p $d + ln -s (pwd)/$dot $target + echo Linked $dot to $target +end + +pushd $dfp l common/tmux/conf $h/.tmux.conf l common/fish $c/fish l common/neovim $c/nvim @@ -29,34 +49,11 @@ 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 +popd -# 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" +for s in $c/lytedev-env/*/dotfiles-setup.d.fish + source $s $dfp $h $c +end # execute the user's shell set ush (getent passwd $LOGNAME | cut -d: -f7) diff --git a/common/bin/lib/meta/setup/choose-host b/common/bin/lib/meta/setup/choose-host deleted file mode 100644 index eba064d..0000000 --- a/common/bin/lib/meta/setup/choose-host +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env fish - -echo yo pick a host diff --git a/common/bin/lib/meta/setup/choose-os b/common/bin/lib/meta/setup/choose-os deleted file mode 100644 index a2d977d..0000000 --- a/common/bin/lib/meta/setup/choose-os +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env fish - -echo yo pick an os diff --git a/common/bin/lib/meta/setup/helpers b/common/bin/lib/meta/setup/helpers deleted file mode 100644 index 6f11e37..0000000 --- a/common/bin/lib/meta/setup/helpers +++ /dev/null @@ -1,50 +0,0 @@ -#!/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/prelude b/common/bin/prelude deleted file mode 100755 index 37ecd17..0000000 --- a/common/bin/prelude +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh - -# these are all paths used across many of the dotfiles and should be assumed to -# be loaded and properly set by every script - this means you are responsible -# for making sure they're loaded! -export XDG_CONFIG_HOME="$HOME/.config" -export DOTFILES_PATH="$XDG_CONFIG_HOME/lytedev-dotfiles" -export ENV_PATH="$HOME/.env" - -export TERMINAL="kitty" - -# TODO: better logic for auto-detecting alternative home directories? -# 1. check dirname(basename $HOME)) matches username -# 2. check /home/$username -NICE_HOME="$HOME" -[ "$(basename "${HOME}")" = ".home" ] && NICE_HOME="$(realpath "$HOME/..")" -[ -e "${HOME}/.nice_home" ] && NICE_HOME="$(cat "${HOME}/.nice_home")" -[ -e "${ENV_PATH}/.nice_home" ] && NICE_HOME="$(cat "${ENV_PATH}/.nice_home")" -export NICE_HOME - -# shellcheck disable=SC1090 -. "$DOTFILES_PATH/bin/paths" diff --git a/common/fish/aliases.fish b/common/fish/aliases.fish index 5fa0c19..b56ee72 100755 --- a/common/fish/aliases.fish +++ b/common/fish/aliases.fish @@ -31,7 +31,7 @@ end alias cd.. "d .." alias cdd "d $DOTFILES_PATH" -alias cde "d $ENV_PATH" +alias cde "d $XDG_CONFIG_HOME/lytedev-env" alias cdc "d $XDG_CONFIG_HOME" alias cdn "d $NOTES_PATH" alias cdl "d $XDG_DOWNLOAD_DIR" diff --git a/common/fish/config.fish b/common/fish/config.fish index e8b1c6d..757b0e4 100755 --- a/common/fish/config.fish +++ b/common/fish/config.fish @@ -2,18 +2,23 @@ set -Ux XDG_CONFIG_HOME $HOME/.config set -Ux DOTFILES_PATH $XDG_CONFIG_HOME/lytedev-dotfiles -set -Ux ENV_PATH $HOME/.env +set -Ux ENV_PATH $XDG_CONFIG_HOME/lytedev-env set -Ux FISH_PATH $XDG_CONFIG_HOME/fish -$DOTFILES_PATH/common/colors/vconsole source $FISH_PATH/paths.fish +for s in $ENV_PATH/*/config.d.fish + source $s (dirname $s) +end + status --is-interactive || exit +$DOTFILES_PATH/common/colors/vconsole for f in key-bindings colors prompt aliases source $FISH_PATH/$f.fish end -source $DOTFILES_PATH/common/nnn/config.fish + +has_command nnn && source $DOTFILES_PATH/common/nnn/config.fish set -Ux _JAVA_AWT_WM_NONREPARENTING 1 set -Ux TERMINAL kitty @@ -27,7 +32,7 @@ set -Ux VISUAL nvim set -Ux PAGER less set -Ux MANPAGER 'env MANWIDTH="" nvim --cmd "let g:prosession_on_startup=0" +Man!' -has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git' +# has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git' test -f ~/.fzf/shell/key-bindings.fish && source ~/.fzf/shell/key-bindings.fish @@ -39,7 +44,7 @@ function fish_greeting; test -f /proc/sys/kernel/pty/nr && printf "%6d PTYs open\n" (cat /proc/sys/kernel/pty/nr) end -# we assume the user uses "$HOME" to just store their mess of dotfiles and other +# assume the user uses "$HOME" to just store their mess of dotfiles and other # nonsense that clutters it up and that they have a preferred starting # directory where they keep the stuff they actually care about # we only do this if the user is opening a shell at $HOME @@ -52,30 +57,3 @@ if test -f $HOME/.asdf/asdf.fish else if test -f /opt/asdf-vm/asdf.fish source /opt/asdf-vm/asdf.fish end - -if set -q $__HM_SESS_VARS_SOURCED; and test -f $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh - exec bash -c "source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh; exec fish" -end - -# load a per-device, secret config last so anything can be overridden -for cf in config.fish .hidden/config.fish - set f $ENV_PATH/$cf - test -f $f && source $f -end - -# TODO: completion -function src-hidden-dir - not scount $argv && echo "No directory specified" && exit 1 - set f $ENV_PATH/.hidden/fish.d/$argv[1]/config.fish - echo "Checking $f..." - test -f $f && source $f -end -test -d $ENV_PATH/.hidden/fish.d && \ - complete --command src-hidden-dir -a \ - "(pushd $NICE_HOME && fd . $ENV_PATH/.hidden/fish.d/ --max-depth 1 --min-depth 1 -x ls -p && popd)" - -mkdir -p $NOTES_PATH $USER_LOGS_PATH $SCROTS_PATH - -# if status is-interactive; and not set -q TMUX -# exec tmux -# end diff --git a/common/fish/paths.fish b/common/fish/paths.fish index 0de978d..d6b06eb 100755 --- a/common/fish/paths.fish +++ b/common/fish/paths.fish @@ -20,10 +20,12 @@ test -d $HOME/.bin && set -U fish_user_paths $HOME/.local/bin $fish_user_paths has_command python && set -U fish_user_paths (python -m site --user-base)"/bin" $fish_user_paths has_command ruby && set -U fish_user_paths (ruby -e 'print Gem.user_dir')"/bin" $fish_user_paths -if test (dirname (basename $HOME)) = $USER - set -Ux NICE_HOME $HOME +if set -q NICE_HOME else - set -Ux NICE_HOME /home/$USER + set -Ux NICE_HOME $HOME + test (basename $HOME) = .home && set -Ux NICE_HOME (realpath $HOME/..) + test -f $HOME/.nice_home && set -Ux NICE_HOME (cat $HOME/.nice_home) + test -f $ENV_PATH/.nice_home && set -Ux NICE_HOME (cat $ENV_PATH/.nice_home) end for p in $NICE_HOME $HOME $ENV_PATH diff --git a/common/neovim/init.vim b/common/neovim/init.vim index b6dce2a..5c36ab2 100644 --- a/common/neovim/init.vim +++ b/common/neovim/init.vim @@ -12,14 +12,14 @@ let g:completion_enable_auto_popup = 0 let g:indent_guide_auto_colors = 1 let g:indent_guides_enable_on_vim_startup = 1 let g:jsonnet_fmt_on_save = 0 -let g:fzf_preview_window = ['down:40%:hidden', 'ctrl-/'] +" let g:fzf_preview_window = ['down:40%:hidden', 'ctrl-/'] call plug#begin($vimdir.'/plugged') Plug 'junegunn/vim-plug' " plugin manager should manage itself Plug 'sheerun/vim-polyglot' " handles language-specific configuration Plug 'neovim/nvim-lspconfig' " deeper language integration via language servers Plug 'nvim-lua/completion-nvim' " language server completion - Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } + Plug 'junegunn/fzf' " fzf Plug 'junegunn/fzf.vim' " helpers for using fzf in vim Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings Plug 'tpope/vim-sleuth' " try and detect indent method diff --git a/host/laptop/third/work-mode b/host/laptop/third/bin/work-mode similarity index 100% rename from host/laptop/third/work-mode rename to host/laptop/third/bin/work-mode diff --git a/host/laptop/third/config.d.fish b/host/laptop/third/config.d.fish new file mode 100644 index 0000000..956d991 --- /dev/null +++ b/host/laptop/third/config.d.fish @@ -0,0 +1,2 @@ +set e $argv[1] +set -Ua fish_user_paths $e/bin diff --git a/host/laptop/third/sway/main b/host/laptop/third/sway/config similarity index 100% rename from host/laptop/third/sway/main rename to host/laptop/third/sway/config diff --git a/os/linux/bin/app-launcher b/os/linux/bin/app-launcher index ef2bf01..7d93851 100755 --- a/os/linux/bin/app-launcher +++ b/os/linux/bin/app-launcher @@ -1,2 +1,2 @@ #!/usr/bin/env sh -"$(dirname "$0")/floating-term" sh -c "\"$(dirname "$0")/launch\" | xargs swaymsg exec --" +floating-term sh -c "launch | xargs swaymsg exec --" diff --git a/os/linux/bin/wm b/os/linux/bin/wm index 64f3591..bd3ce33 100755 --- a/os/linux/bin/wm +++ b/os/linux/bin/wm @@ -1,2 +1,2 @@ #!/usr/bin/env sh -"$(dirname $0)/../apps/de/sway/init" +"$(dirname $0)/../sway/init" diff --git a/os/linux/config.d.fish b/os/linux/config.d.fish new file mode 100644 index 0000000..956d991 --- /dev/null +++ b/os/linux/config.d.fish @@ -0,0 +1,2 @@ +set e $argv[1] +set -Ua fish_user_paths $e/bin diff --git a/os/linux/dotfiles-setup.d.fish b/os/linux/dotfiles-setup.d.fish new file mode 100644 index 0000000..b83cb7c --- /dev/null +++ b/os/linux/dotfiles-setup.d.fish @@ -0,0 +1,21 @@ +#!/usr/bin/env fish +set me (status -f) +set dfp $argv[1] +set h $argv[2] +set c $argv[3] + +pushd (dirname $me) +l sway/config $c/sway/config +l sway/mimeapps.list $c/mimeapps.list +l sway/mimeapps.list $c/sway-mimeapps.list +l sway/mimeapps.list $h/.local/share/applications/mimeapps.list +l sway/lock $c/swaylock/config +l mako $c/mako +l kanshi $c/kanshi +l gtk/2rc $h/.gtkrc-2.0 +l gtk/2rc $h/.gtkrc +l gtk/3settings.ini $c/gtk-3.0/settings.ini +l waybar $c/waybar +l libinput/gestures.conf $c/libinput-gestures.conf +l zathura $c/zathura +l user-dirs $c/user-dirs.dirs diff --git a/os/linux/sway/config b/os/linux/sway/config index 65f1d09..f5b5010 100644 --- a/os/linux/sway/config +++ b/os/linux/sway/config @@ -4,7 +4,6 @@ # + Super+Control+{1-9} should control the size of the preselect space. # + Super+Shift+b should balance the size of all selected nodes. -set $dfpbin $HOME/.config/lytedev-dotfiles/bin set $mod Mod4 set $default_gap 0 @@ -46,17 +45,17 @@ input type:touchpad { bindsym $mod+control+space exec makoctl dismiss bindsym $mod+shift+space exec makoctl invoke bindsym $mod+return exec kitty --single-instance -bindsym $mod+shift+return exec $dfpbin/floating-term +bindsym $mod+shift+return exec floating-term bindsym $mod+shift+alt+return exec kitty bindsym $mod+c kill bindsym $mod+shift+c kill # TODO: kill -9? -bindsym $mod+space exec $dfpbin/app-launcher -bindsym $mod+shift+s exec $dfpbin/clipshot +bindsym $mod+space exec app-launcher +bindsym $mod+shift+s exec clipshot bindsym $mod+e exec thunar bindsym $mod+shift+r reload bindsym $mod+control+Escape exit bindsym $mod+shift+e exit -bindsym $mod+shift+p exec $dfpbin/pass-chooser +bindsym $mod+shift+p exec pass-chooser bindsym $mod+control+j split v bindsym $mod+control+l split h bindsym $mod+control+f focus mode_toggle @@ -184,5 +183,4 @@ bar { exec gammastep -t 6500:3500 -l 39.0:-94.5 exec swayidle -w timeout 300 'swaylock -f -c 000000' timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -f -c 000000' -include $HOME/.env/sway/main -# include $HOME/.env/sway/config.d/* +include $XDG_CONFIG_HOME/lytedev-env/*/sway/config diff --git a/os/linux/sway/init b/os/linux/sway/init index 9058294..c809e36 100755 --- a/os/linux/sway/init +++ b/os/linux/sway/init @@ -1,12 +1,17 @@ -#!/usr/bin/env sh +#!/usr/bin/env fish -[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME="$HOME/.config" -[ -z "$DOTFILES_PATH" ] && export DOTFILES_PATH="$XDG_CONFIG_HOME/lytedev-dotfiles" +set -q XDG_CONFIG_HOME || begin + echo XDG_CONFIG_HOME not set + exit 1 +end -. "$DOTFILES_PATH/bin/prelude" +set -q DOTFILES_PATH || begin + echo DOTFILES_PATH not set + exit 1 +end -export CLUTTER_BACKEND=wayland -export SDL_VIDEODRIVER=wayland -export MOZ_ENABLE_WAYLAND=1 +set -Ux CLUTTER_BACKEND wayland +set -Ux SDL_VIDEODRIVER wayland +set -Ux MOZ_ENABLE_WAYLAND 1 exec sway