added nautilus scripts (needs nautilus-python package)
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2086
|
||||
# install_keyboard_shortcut=F3
|
||||
|
||||
# Source the script 'common-functions.sh'.
|
||||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||
source "$ROOT_DIR/common-functions.sh"
|
||||
|
||||
_main() {
|
||||
local input_files=""
|
||||
|
||||
# Execute initial checks.
|
||||
_check_dependencies ""
|
||||
input_files=$(_get_files "par_type=all; par_max_items=20; par_get_pwd=true")
|
||||
_unset_global_variables_file_manager
|
||||
|
||||
# Check if the first file is a binary file.
|
||||
local file_1=""
|
||||
file_1=$(cut -d "$FIELD_SEPARATOR" -f 1 <<<"$input_files")
|
||||
if ! [[ -d "$file_1" ]]; then
|
||||
if [[ "$(_get_file_encoding "$file_1")" == "binary" ]] && [[ -s "$file_1" ]]; then
|
||||
case "${XDG_CURRENT_DESKTOP,,}" in
|
||||
*"kde"* | *"lxqt"*)
|
||||
_check_dependencies "command=okteta"
|
||||
okteta -- $input_files &
|
||||
;;
|
||||
*)
|
||||
_check_dependencies "command=ghex"
|
||||
ghex -- $input_files &
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run the main process.
|
||||
if _command_exists "code"; then
|
||||
code -- $input_files &
|
||||
elif _command_exists "geany"; then
|
||||
geany -- $input_files &
|
||||
else
|
||||
_check_dependencies "command=xdg-open; package=xdg-utils"
|
||||
$(_xdg_get_default_app "text/plain") -- $input_files &
|
||||
fi
|
||||
}
|
||||
|
||||
_main "$@"
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
# install_keyboard_shortcut=F7
|
||||
|
||||
# Source the script 'common-functions.sh'.
|
||||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||
source "$ROOT_DIR/common-functions.sh"
|
||||
|
||||
_main() {
|
||||
local input_files=""
|
||||
|
||||
# Execute initial checks.
|
||||
case "${XDG_CURRENT_DESKTOP,,}" in
|
||||
*"kde"* | *"lxqt"*)
|
||||
_check_dependencies "command=filelight"
|
||||
;;
|
||||
*)
|
||||
_check_dependencies "command=baobab"
|
||||
;;
|
||||
esac
|
||||
input_files=$(_get_files "par_type=directory; par_max_items=20; par_get_pwd=true")
|
||||
_unset_global_variables_file_manager
|
||||
|
||||
_open_app "$input_files"
|
||||
}
|
||||
|
||||
_open_app() {
|
||||
local input_files=$1
|
||||
local input_file=""
|
||||
|
||||
for input_file in $input_files; do
|
||||
# Run the main process.
|
||||
if _command_exists "baobab"; then
|
||||
baobab -- "$input_file" &
|
||||
elif _command_exists "filelight"; then
|
||||
filelight -- "$input_file" &
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_main "$@"
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
# install_keyboard_shortcut=F4
|
||||
|
||||
# Source the script 'common-functions.sh'.
|
||||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
|
||||
source "$ROOT_DIR/common-functions.sh"
|
||||
|
||||
_main() {
|
||||
local input_files=""
|
||||
|
||||
# Execute initial checks.
|
||||
_check_dependencies ""
|
||||
input_files=$(_get_files "par_type=directory; par_max_items=20; par_get_pwd=true")
|
||||
_unset_global_variables_file_manager
|
||||
|
||||
_open_app "$input_files"
|
||||
}
|
||||
|
||||
_open_app() {
|
||||
local input_files=$1
|
||||
local input_file=""
|
||||
|
||||
for input_file in $input_files; do
|
||||
# Run the main process.
|
||||
cd "$input_file" || exit 1
|
||||
if _command_exists "alacritty"; then
|
||||
alacritty &
|
||||
elif _command_exists "kitty"; then
|
||||
kitty &
|
||||
elif _command_exists "terminology"; then
|
||||
terminology &
|
||||
elif _command_exists "terminator"; then
|
||||
terminator &
|
||||
elif _command_exists "kgx"; then
|
||||
kgx &
|
||||
elif _command_exists "gnome-terminal"; then
|
||||
gnome-terminal &
|
||||
elif _command_exists "konsole"; then
|
||||
konsole &
|
||||
elif _command_exists "mate-terminal"; then
|
||||
mate-terminal &
|
||||
elif _command_exists "xfce4-terminal"; then
|
||||
xfce4-terminal &
|
||||
elif _command_exists "qterminal"; then
|
||||
qterminal &
|
||||
elif _command_exists "deepin-terminal"; then
|
||||
deepin-terminal &
|
||||
elif _command_exists "termit"; then
|
||||
termit &
|
||||
elif _command_exists "uxterm"; then
|
||||
uxterm &
|
||||
elif _command_exists "xterm"; then
|
||||
xterm &
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_main "$@"
|
||||
Reference in New Issue
Block a user