At least got the shell usable
This commit is contained in:
parent
065ba07b53
commit
cfcc9b5942
|
@ -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
|
|
|
@ -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))
|
|
|
@ -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'], [])
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
f="$DOTFILES_PATH/.bspwm-state.json.tmp"
|
|
||||||
bspc wm -d > "$f"
|
|
||||||
chmod 600 "$f"
|
|
64
common/bin/dotfiles-setup
Executable file
64
common/bin/dotfiles-setup
Executable file
|
@ -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
|
50
common/bin/lib/meta/setup/helpers
Normal file
50
common/bin/lib/meta/setup/helpers
Normal file
|
@ -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
|
|
@ -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
|
|
|
@ -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"
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
exec qutebrowser --backend webengine
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
"$DOTFILES_PATH/apps/de/x/loadresources"
|
|
|
@ -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
|
|
|
@ -3,15 +3,16 @@
|
||||||
set -Ux XDG_CONFIG_HOME $HOME/.config
|
set -Ux XDG_CONFIG_HOME $HOME/.config
|
||||||
set -Ux DOTFILES_PATH $XDG_CONFIG_HOME/lytedev-dotfiles
|
set -Ux DOTFILES_PATH $XDG_CONFIG_HOME/lytedev-dotfiles
|
||||||
set -Ux ENV_PATH $HOME/.env
|
set -Ux ENV_PATH $HOME/.env
|
||||||
|
set -Ux FISH_PATH $XDG_CONFIG_HOME/fish
|
||||||
|
|
||||||
source $DOTFILES_PATH/apps/shell/fish/paths.fish
|
source $FISH_PATH/paths.fish
|
||||||
source $DOTFILES_PATH/apps/nnn/config.fish
|
|
||||||
|
|
||||||
status --is-interactive || exit
|
status --is-interactive || exit
|
||||||
|
|
||||||
for f in key-bindings colors prompt aliases
|
for f in key-bindings colors prompt aliases
|
||||||
source $DOTFILES_PATH/apps/shell/fish/$f.fish
|
source $FISH_PATH/$f.fish
|
||||||
end
|
end
|
||||||
|
source $DOTFILES_PATH/common/nnn/config.fish
|
||||||
|
|
||||||
set -Ux _JAVA_AWT_WM_NONREPARENTING 1
|
set -Ux _JAVA_AWT_WM_NONREPARENTING 1
|
||||||
set -Ux TERMINAL kitty
|
set -Ux TERMINAL kitty
|
|
@ -5,7 +5,7 @@ set -Ux GOPATH $HOME/.go
|
||||||
set -U fish_user_paths \
|
set -U fish_user_paths \
|
||||||
$HOME/.go \
|
$HOME/.go \
|
||||||
$GOPATH/bin \
|
$GOPATH/bin \
|
||||||
$DOTFILES_PATH/bin \
|
$DOTFILES_PATH/common/bin \
|
||||||
$ENV_PATH/bin \
|
$ENV_PATH/bin \
|
||||||
$ENV_PATH/.hidden/bin \
|
$ENV_PATH/.hidden/bin \
|
||||||
$HOME/.bin \
|
$HOME/.bin \
|
Reference in a new issue