1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#!/usr/bin/env bash
add() { yadm add "$@"; }
add-public-config() {
# Base config
add ~/README.md;
add ~/.work-config;
add ~/.gitmodules ~/.config/git-config;
add ~/.config/linkedconf;
#add ~/.config/vimwiki;
#add ~/.config/password-store;
add ~/.config/sitesettings;
add ~/.config/crontab;
add ~/.config/gnupg/gpg-agent.conf;
# X and DM
add ~/.config/{bspwm,sxhkd}
add ~/.config/compton.conf;
add ~/.config/sx;
add ~/.config/xresources-schemes;
add ~/.config/dunst;
add ~/.config/xconfig;
add ~/.config/autostart.sh;
# Other config
add ~/.config/{gtk-3.0,mimeapps.list};
# Terminal and shell
add ~/.bashrc ~/.profile;
add ~/.zshrc ~/.zprofile ~/.config/{zshconf,zshplugins};
# Dev
add ~/scripts ~/.bin;
add ~/.config/nvim;
# Applications
add ~/.config/suckless;
add ~/.config/qutebrowser;
add ~/.config/{lf,mpv,sxiv,zathura,newsboat,neofetch};
add ~/.config/transmission-daemon/settings.json;
add ~/.config/{transmission-remote-cli,stig,tremc,udiskie};
add ~/.config/{calcurse,pet,shell-macros};
add ~/.config/neomutt;
add ~/.config/{ncmpcpp,mopidy,mpd};
# Wallpapers
add ~/.fehbg;
add ~/Pictures/wallpapers;
}
should_run() { [[ -z "$2" ]] || [[ "$2" == _ ]] || [[ "$1" == "$2" ]]; } # Should run command
should_push() { [[ -z "$1" ]]; } # Should sync with remote
commit-push-all() {
local oldir=$(pwd);
cd "$1";
git add .;
git commit -m "$2";
should_push "$3" && git push;
cd $oldir;
}
# Sync dotfiles to github (uses yadm)
update-dotfiles() {
# Passwords push
if (should_run pass "$1"); then
echo -e "\n\n##### Pushing passwords";
should_push "$2" && pass git push;
fi;
# Vim wiki push
if (should_run notes "$1"); then
echo -e "\n\n##### Pushing vimwiki";
commit-push-all ~/.config/vimwiki "Notes updated" "$2";
fi;
# Push private config
if (should_run work "$1"); then
echo -e "\n\n##### Pushing private config";
commit-push-all ~/.work-config "Updated private config" "$2";
fi;
# Dotfiles
if (should_run dot "$1"); then
echo -e "\n\n##### Pushing public dotfiles";
yadm status;
add-public-config;
yadm commit -m "Updates dotfiles" && \
should_push "$2" && yadm push -u origin master;
fi;
}
update-dotfiles "$@";
|