2021-01-28 21:29:00 +01:00
|
|
|
#!/bin/bash
|
2022-12-12 01:02:50 +01:00
|
|
|
# Daniel Napora 2021-22 <napcok@gmail.com>
|
2022-12-16 22:33:26 +01:00
|
|
|
#: mb-reset - reset/update user config files to (current) distro defaults.
|
2021-05-28 02:47:06 +02:00
|
|
|
#: It only affects files shipped with Mabox.
|
|
|
|
#: Be aware that you may loose your own customizations (if any).
|
2021-03-26 13:41:19 +01:00
|
|
|
#:
|
2021-01-28 21:29:00 +01:00
|
|
|
#: Usage: mb-reset option
|
|
|
|
#:
|
|
|
|
#: Options:
|
2021-05-28 02:47:06 +02:00
|
|
|
#: Compare mode:
|
|
|
|
#: -c - compare files using meld GUI (if installed)
|
|
|
|
#: It lets you see changes and decide which one to pick or not.
|
|
|
|
#: Works with rc.xml,bashrc and autostart files
|
|
|
|
#: Usage: mb-reset -c obrcxml | autostart | bashrc
|
|
|
|
#: Overwrite mode:
|
2021-04-24 20:18:07 +02:00
|
|
|
#: obrcxml - rc.xml default OpenBox configuration file
|
|
|
|
#: obautostart - default autostart file
|
|
|
|
#: bashrc - bash config file (~/.bashrc)
|
|
|
|
#: terminator - terminator config
|
|
|
|
#: conky - overwrite conky config files in ~/.config/conky/
|
2022-12-16 22:33:26 +01:00
|
|
|
#: glyphicons - override font settings for glyphicons
|
2021-02-14 13:39:21 +01:00
|
|
|
#: tint2 - overwrite tint2 panel config files in ~/.config/tint2/
|
2021-02-01 19:47:01 +01:00
|
|
|
#: jgthemes - overwrite menu/sidepanels color schemes in ~/.config/mabox/jgobthemes/
|
|
|
|
#: mainmenu - overwrite main menu files (favorites.csv)
|
|
|
|
#: leftpanel - left panel custom commands
|
|
|
|
#: rightpanel - right panel custom commands
|
2022-08-18 11:12:38 +02:00
|
|
|
#: allmenus - overvrite all menus, panels and exit dialog
|
2021-02-01 19:47:01 +01:00
|
|
|
#: logout - logout dialog
|
2022-12-16 22:33:26 +01:00
|
|
|
#: wrappers - nitrogen, xrandr and lxappearance Mabox wrappers
|
2021-04-24 20:18:07 +02:00
|
|
|
|
|
|
|
|
2021-01-28 21:29:00 +01:00
|
|
|
|
|
|
|
case $LANG in
|
|
|
|
pl*) LNGDIR="pl";;
|
|
|
|
es*) LNGDIR="es";;
|
|
|
|
*) LNGDIR="en";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
__usage() {
|
|
|
|
grep "^#:" $0 | while read DOC; do printf '%s\n' "${DOC###:}"; done
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2021-05-28 02:47:06 +02:00
|
|
|
__compare() {
|
|
|
|
command -v meld >/dev/null 2>&1 || { echo "mb-reset compare mode requires meld. Install it and try again. (yay -S meld)" >&2; exit 1; }
|
|
|
|
case "$1" in
|
|
|
|
obrcxml)
|
|
|
|
meld /usr/share/mabox/common/rc.xml ~/.config/openbox/rc.xml &
|
|
|
|
;;
|
|
|
|
autostart)
|
|
|
|
meld /usr/share/mabox/common/autostart ~/.config/openbox/autostart &
|
|
|
|
;;
|
|
|
|
bashrc)
|
|
|
|
meld /usr/share/mabox/common/.bashrc ~/.bashrc &
|
|
|
|
;;
|
|
|
|
conky)
|
|
|
|
meld /usr/share/mabox/lang/$LNGDIR/.config/conky/ ~/.config/conky/ &
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Compare "
|
|
|
|
echo "Usage: mb-reset -c obrcxml|autostart|bashrc"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-28 21:29:00 +01:00
|
|
|
__allmenus() {
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/settings* $HOME/.config/mabox/
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/jgmenu/*.csv $HOME/.config/jgmenu/
|
2021-03-26 13:41:19 +01:00
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/favorites.csv $HOME/.config/mabox/
|
2021-01-28 21:29:00 +01:00
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/places* $HOME/.config/mabox/
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/right* $HOME/.config/mabox/
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/exit.csv $HOME/.config/mabox/
|
2021-03-26 13:41:19 +01:00
|
|
|
mb-setvar places_menusettingspipe=true
|
|
|
|
mb-setvar places_sysinfopipe=true
|
|
|
|
mb-setvar places_keyspipe=true
|
|
|
|
mb-setvar places_sshpipe=true
|
2021-05-22 01:59:46 +02:00
|
|
|
mb-setvar places_conkypipe=true
|
|
|
|
mb-setvar places_tint2pipe=true
|
|
|
|
mb-setvar places_jgdesktops=true
|
|
|
|
mb-setvar places_jgdeskmngr=true
|
|
|
|
mb-setvar places_jgdeskgrid=true
|
2021-03-26 13:41:19 +01:00
|
|
|
mb-setvar places_softwarepipe=true
|
2021-05-22 01:59:46 +02:00
|
|
|
|
2021-01-28 21:29:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
__mainmenu() {
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/jgmenu/*.csv $HOME/.config/jgmenu/
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/favorites.csv $HOME/.config/mabox/
|
2021-08-12 13:23:31 +02:00
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/setting*.csv $HOME/.config/mabox/
|
2021-01-28 21:29:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
__leftpanel() {
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/places* $HOME/.config/mabox/
|
|
|
|
mb-setvar places_menusettingspipe=true
|
|
|
|
mb-setvar places_sysinfopipe=true
|
|
|
|
mb-setvar places_keyspipe=true
|
|
|
|
mb-setvar places_sshpipe=true
|
2021-05-22 01:59:46 +02:00
|
|
|
mb-setvar places_conkypipe=true
|
|
|
|
mb-setvar places_tint2pipe=true
|
|
|
|
mb-setvar places_jgdesktops=true
|
|
|
|
mb-setvar places_jgdeskmngr=true
|
|
|
|
mb-setvar places_jgdeskgrid=true
|
2021-01-28 21:29:00 +01:00
|
|
|
mb-setvar places_softwarepipe=true
|
|
|
|
}
|
|
|
|
|
|
|
|
__rightpanel() {
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/right* $HOME/.config/mabox/
|
|
|
|
}
|
|
|
|
|
|
|
|
__logout() {
|
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/mabox/exit.csv $HOME/.config/mabox/
|
|
|
|
}
|
|
|
|
|
2022-12-16 22:33:26 +01:00
|
|
|
__glyphicons () {
|
|
|
|
rm $HOME/.local/share/fonts/lucide.ttf
|
|
|
|
mkdir -p $HOME/.config/fontconfig/conf.d
|
|
|
|
rsync -a /usr/share/mabox/common/66-symbols.conf $HOME/.config/fontconfig/conf.d/
|
|
|
|
fc-cache
|
|
|
|
}
|
|
|
|
|
2021-01-28 21:29:00 +01:00
|
|
|
__tint2() {
|
2022-05-19 15:10:27 +02:00
|
|
|
mkdir -p $HOME/.config/fontconfig/conf.d
|
|
|
|
rsync -a /usr/share/mabox/common/66-symbols.conf $HOME/.config/fontconfig/conf.d/
|
2022-07-12 17:43:19 +02:00
|
|
|
fc-cache
|
2022-05-19 15:50:48 +02:00
|
|
|
rsync -a /usr/share/mabox/common/volumettf $HOME/.config/tint2/scripts/
|
2021-01-28 21:29:00 +01:00
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/tint2/*.tint2rc $HOME/.config/tint2/
|
2022-12-12 01:02:50 +01:00
|
|
|
TYPE=$(cat /sys/class/dmi/id/chassis_type)
|
|
|
|
case "$TYPE" in
|
|
|
|
8|9|10|14):;;
|
|
|
|
*)
|
|
|
|
# fix tint2 battery indicator bug spawning notifications even if there is no battery
|
|
|
|
sd "battery_low_cmd =.*$" "battery_low_cmd =" "$HOME"/.config/tint2/*.tint2rc
|
|
|
|
;;
|
|
|
|
esac
|
2021-01-28 21:29:00 +01:00
|
|
|
killall -SIGUSR1 tint2
|
|
|
|
}
|
|
|
|
|
|
|
|
__jgthemes() {
|
2022-08-18 11:12:38 +02:00
|
|
|
rm $HOME/.config/mabox/jgobthemes/*.bak
|
2021-01-28 21:29:00 +01:00
|
|
|
rsync -a /usr/share/mb-jgtools/jgobthemes/* $HOME/.config/mabox/jgobthemes/
|
|
|
|
}
|
|
|
|
|
2021-02-14 13:39:21 +01:00
|
|
|
__conky() {
|
2021-05-28 02:47:06 +02:00
|
|
|
cp $HOME/.config/conky/conky-sessionfile{,.bak."$(date +%Y%m%d-%H%M%S)"}
|
|
|
|
cp $HOME/.config/conky/saved-sessions{,.bak."$(date +%Y%m%d-%H%M%S)"}
|
2021-04-24 20:18:07 +02:00
|
|
|
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/conky/* $HOME/.config/conky/
|
|
|
|
killall -SIGUSR1 conky
|
2021-01-28 21:29:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
__maboxthemes() {
|
|
|
|
echo "Not implemented yet"
|
|
|
|
}
|
|
|
|
|
|
|
|
__obrcxml() {
|
2021-05-22 01:59:46 +02:00
|
|
|
cp $HOME/.config/openbox/rc.xml{,.bak."$(date +%Y%m%d-%H%M%S)"}
|
2021-02-01 19:47:01 +01:00
|
|
|
rsync -a /usr/share/mabox/common/rc.xml $HOME/.config/openbox/
|
2021-05-06 20:59:08 +02:00
|
|
|
openbox --reconfigure
|
2021-01-28 21:29:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
__obautostart() {
|
2021-05-28 02:47:06 +02:00
|
|
|
cp $HOME/.config/openbox/autostart{,.bak."$(date +%Y%m%d-%H%M%S)"}
|
2021-02-01 19:47:01 +01:00
|
|
|
rsync -a /usr/share/mabox/common/autostart $HOME/.config/openbox/
|
2021-01-28 21:29:00 +01:00
|
|
|
}
|
|
|
|
|
2021-04-24 20:18:07 +02:00
|
|
|
__bashrc() {
|
2021-05-22 01:59:46 +02:00
|
|
|
cp $HOME/.bashrc{,.bak."$(date +%Y%m%d-%H%M%S)"}
|
2021-04-24 20:18:07 +02:00
|
|
|
rsync -a /usr/share/mabox/common/.bashrc $HOME/
|
|
|
|
}
|
|
|
|
|
|
|
|
__terminator() {
|
|
|
|
rsync -a /usr/share/mabox/common/terminator/* $HOME/.config/terminator/
|
|
|
|
}
|
|
|
|
|
2022-07-12 17:43:19 +02:00
|
|
|
__wrappers() {
|
|
|
|
rm $HOME/bin/nitrogen
|
|
|
|
rsync -a /usr/share/mabox/common/wrappers/* $HOME/.local/bin/
|
|
|
|
}
|
|
|
|
|
2021-01-28 21:29:00 +01:00
|
|
|
case "$1" in
|
2021-05-28 02:47:06 +02:00
|
|
|
-c|check) __compare "$2";;
|
2021-01-28 21:29:00 +01:00
|
|
|
"allmenus") __allmenus ;;
|
|
|
|
"mainmenu") __mainmenu ;;
|
|
|
|
"leftpanel") __leftpanel ;;
|
|
|
|
"rightpanel") __rightpanel ;;
|
|
|
|
"logout") __logout ;;
|
2022-12-16 22:33:26 +01:00
|
|
|
"glyphicons") __glyphicons ;;
|
2021-01-28 21:29:00 +01:00
|
|
|
"tint2") __tint2 ;;
|
|
|
|
"jgthemes") __jgthemes ;;
|
2021-02-14 13:39:21 +01:00
|
|
|
"conky") __conky ;;
|
2021-01-28 21:29:00 +01:00
|
|
|
"maboxthemes") __maboxthemes ;;
|
|
|
|
"obrcxml") __obrcxml ;;
|
|
|
|
"obautostart") __obautostart ;;
|
2021-04-24 20:18:07 +02:00
|
|
|
"bashrc") __bashrc ;;
|
|
|
|
"terminator") __terminator ;;
|
2022-07-12 17:43:19 +02:00
|
|
|
"wrappers") __wrappers ;;
|
2021-01-28 21:29:00 +01:00
|
|
|
"-h|--help") __usage ;;
|
|
|
|
*) __usage ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|