From 6d3e4723009c6ec9765eff02a5876cde7e095956 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Thu, 1 Dec 2022 16:38:19 +0100 Subject: [PATCH 1/3] Detect & handle alternative boot managers --- .bash_aliases | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.bash_aliases b/.bash_aliases index a427c9e..de4c168 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -64,7 +64,15 @@ alias xev='xev | grep -A2 ButtonPress' # Ignore mouse movements reboot_to_windows () { - windows_title=$(grep -i windows /boot/grub/grub.cfg | cut -d "'" -f 2) - sudo grub-reboot "$windows_title" && sudo reboot + # Check if grub is installed by checking if the command exists, if it does + # not, then assume that the system is using systemd-boot + if grub-install --version &>/dev/null; then + windows_title=$(grep -i windows /boot/grub/grub.cfg | cut -d "'" -f 2) + sudo grub-reboot "$windows_title" + echo "Grub set to reboot to Windows" + else + sudo bootctl set-oneshot windows.conf + echo "Systemd set to reboot to Windows" + fi } alias reboot-to-windows='reboot_to_windows' From 28a6f415857592a650e0737f8304f19c1935365c Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Sun, 26 Feb 2023 22:38:43 +0000 Subject: [PATCH 2/3] Add os-specific fzf setup --- .bashrc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.bashrc b/.bashrc index 7ef589e..2550c31 100644 --- a/.bashrc +++ b/.bashrc @@ -1,6 +1,8 @@ # If not running interactively, don't do anything [[ $- != *i* ]] && return +source /etc/os-release + # Load aliases dynamically [ -f "$HOME/.bash_aliases" ] && source "$HOME/.bash_aliases" @@ -40,11 +42,16 @@ export FZF_DEFAULT_OPTS=" --color=fg:-1,bg:-1" export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}" export FZF_CTRL_T_OPTS="--preview='bat {} | head -500'" -source /usr/share/fzf/completion.bash -source /usr/share/fzf/key-bindings.bash -_fzf_setup_completion path vim -_fzf_setup_completion path zathura -_fzf_setup_completion path xournalpp + +if [[ $ID == "raspbian" ]]; then + source /usr/share/doc/fzf/examples/completion.bash + source /usr/share/doc/fzf/examples/key-bindings.bash +elif [[ $ID == "arch" ]]; then + source /usr/share/fzf/completion.bash + source /usr/share/fzf/key-bindings.bash +fi + +_fzf_setup_completion path vimn zathura xournalpp # Nvm export PATH=~/.nvm/versions/node/v14.16.0/bin:$PATH From e6836424a81445e28926a6677e3acbfe4ffbe041 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Sun, 26 Feb 2023 22:59:09 +0000 Subject: [PATCH 3/3] Update fzf setup --- .bashrc | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/.bashrc b/.bashrc index c51ed41..80ce116 100644 --- a/.bashrc +++ b/.bashrc @@ -51,26 +51,6 @@ export EDITOR=nvim # Vim export EDITOR=vim -# Fuzzy finder setup -export FZF_COMPLETION_TRIGGER='**' -export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -t -g ""' -export FZF_DEFAULT_OPTS=" ---pointer="❭" ---height 10% ---color=fg:-1,bg:-1" -export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}" -export FZF_CTRL_T_OPTS="--preview='bat {} | head -500'" - -if [[ $ID == "raspbian" ]]; then - source /usr/share/doc/fzf/examples/completion.bash - source /usr/share/doc/fzf/examples/key-bindings.bash -elif [[ $ID == "arch" ]]; then - source /usr/share/fzf/completion.bash - source /usr/share/fzf/key-bindings.bash -fi - -_fzf_setup_completion path vimn zathura xournalpp - # Nvm export PATH=~/.nvm/versions/node/v14.16.0/bin:$PATH export NVM_DIR="$HOME/.nvm" @@ -98,13 +78,16 @@ if [ -f "/usr/bin/fzf" ]; then --color=fg:-1,bg:-1" export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}" export FZF_CTRL_T_OPTS="--preview='bat {} | head -500'" - source /usr/share/fzf/completion.bash - source /usr/share/fzf/key-bindings.bash - _fzf_setup_completion path vim - _fzf_setup_completion path zathura - _fzf_setup_completion path xournalpp - _fzf_setup_completion path nvim + if [[ $ID == "raspbian" ]]; then + source /usr/share/doc/fzf/examples/completion.bash + source /usr/share/doc/fzf/examples/key-bindings.bash + elif [[ $ID == "arch" ]]; then + source /usr/share/fzf/completion.bash + source /usr/share/fzf/key-bindings.bash + fi + + _fzf_setup_completion path vimn zathura xournalpp else echo "fzf not installed" fi