Add automatic feature detection to personalizer
This commit is contained in:
parent
3b1aea5159
commit
69f5dd0ca6
@ -221,11 +221,8 @@ function prompt_optional_additions ()
|
||||
--checklist "Select any additional configuration changes that you would like applied to the system:" 0 0 0 \
|
||||
"Xournal++" "Install Xournal++ for taking handwritten notes" OFF \
|
||||
"EasyEffects" "Install EasyEffects for applying effects (e.g. equalizers) to system audio devices" OFF \
|
||||
"Media Control Key Shortcuts" "Set up media control keyboard shortcuts (for keyboards without dedicated media control keys)" OFF \
|
||||
"Touchpad Lock Toggle Shortcut" "Set up a touchpad lock toggle keyboard shortcut (for systems with touchpads)" OFF \
|
||||
"Power Button Screen Lock Override" "Override the power button's default behavior with a screen lock shortcut (for tablets or convertibles)" OFF \
|
||||
'"Reboot to Windows" Launcher' "Install a desktop entry that reboots the system to Microsoft Windows (for systems that multi-boot with Windows)" OFF )
|
||||
|
||||
"Media Control Key Shortcuts" "Set up media control keyboard shortcuts (for systems without dedicated media control keys)" OFF \
|
||||
"Power Button Screen Lock Override" "Override the power button's default behavior with a screen lock shortcut (for tablets and some convertibles)" OFF )
|
||||
|
||||
case "${ENTRY}" in
|
||||
"")
|
||||
@ -254,6 +251,28 @@ function prompt_optional_additions ()
|
||||
# Repeatedly show the prompt until we receive valid input
|
||||
until prompt_optional_additions; do : ; done
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Feature detection
|
||||
#
|
||||
################################################################################
|
||||
|
||||
detected_features=()
|
||||
|
||||
# Touchpad detection
|
||||
if
|
||||
cat /proc/bus/input/devices | grep -i Touchpad
|
||||
then
|
||||
detected_features+=('Touchpad')
|
||||
fi
|
||||
|
||||
# Windows multi-boot detection
|
||||
if
|
||||
sudo grep menuentry /boot/grub2/grub.cfg | grep -Po ".*Windows.*"
|
||||
then
|
||||
detected_features+=('Windows')
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package setup
|
||||
@ -395,7 +414,7 @@ add_custom_gnome_keybinding "Launch Terminal" "gnome-terminal" "<Super>Return"
|
||||
add_custom_gnome_keybinding "Toggle Night Light" "gnome-toggle-night-light" "<Alt><Super>n"
|
||||
|
||||
# (OPTIONAL) Add custom shortcuts
|
||||
if [[ "${optional_additions}" == *"Touchpad Lock Toggle Shortcut"* ]]; then
|
||||
if [[ "${detected_features[@]}" == *"Touchpad"* ]]; then
|
||||
add_custom_gnome_keybinding "Toggle Touchpad Lock" "gnome-toggle-touchpad-lock" "<Alt><Super>t"
|
||||
fi
|
||||
if [[ "${optional_additions}" == *"Power Button Screen Lock Override"* ]]; then
|
||||
@ -506,11 +525,11 @@ echo "Installing scripts..."
|
||||
# Clone personalizer repo containing scripts, desktop entries, etc. to temporary folder
|
||||
git clone "${PERSONALIZER_REPO_URL}" "${PERSONALIZER_REPO_DIR}"
|
||||
|
||||
if [[ "${optional_additions}" != *'Touchpad Lock Toggle Shortcut'* ]]; then
|
||||
if [[ "${detected_features[@]}" != *'Touchpad'* ]]; then
|
||||
rm ${PERSONALIZER_REPO_DIR}/scripts/gnome-toggle-touchpad-lock
|
||||
fi
|
||||
|
||||
if [[ "${optional_additions}" != *'"Reboot to Windows" Launcher'* ]]; then
|
||||
if [[ "${detected_features[@]}" != *'Windows'* ]]; then
|
||||
rm ${PERSONALIZER_REPO_DIR}/scripts/reboot-windows
|
||||
fi
|
||||
|
||||
@ -522,7 +541,7 @@ sudo cp ${PERSONALIZER_REPO_DIR}/scripts/* /usr/bin
|
||||
|
||||
echo "Installing desktop entries..."
|
||||
|
||||
if [[ "${optional_additions}" != *'"Reboot to Windows" Launcher'* ]]; then
|
||||
if [[ "${detected_features[@]}" != *'Windows'* ]]; then
|
||||
rm ${PERSONALIZER_REPO_DIR}/desktop_entries/windows.desktop
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user