Skip to content

Commit a2208da

Browse files
committed
code simplification: merge /usr/libexec/default-editor/default_editor.sh into /etc/profile.d/50_default_editor.sh
1 parent ecd8d66 commit a2208da

File tree

2 files changed

+34
-38
lines changed

2 files changed

+34
-38
lines changed

etc/profile.d/50_default_editor.sh

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,44 @@
1414
## <code>XDG_CONFIG_DIRS</code> environment variable.
1515
#### meta end
1616

17-
if [ -x /usr/libexec/default-editor/default_editor.sh ]; then
18-
. /usr/libexec/default-editor/default_editor.sh || true >/dev/null 2>/dev/null
19-
fi
17+
## Sets mousepad as the default editor for environment variable 'VISUAL'
18+
## is unset and if mousepad is installed.
19+
20+
## Environment variable 'VISUAL' will also be honored by 'sudoedit'.
21+
22+
## https://forums.whonix.org/t/use-sudoedit-in-whonix-documentation/7599
23+
24+
## please provide /usr/bin/visual
25+
## https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758228
2026

2127
if [ -z "$XDG_DATA_DIRS" ]; then
2228
XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
2329
fi
2430
if ! printf '%s\n' "$XDG_DATA_DIRS" | grep -- "/usr/share/usability-misc/xdg-override/" >/dev/null 2>/dev/null ; then
2531
export XDG_DATA_DIRS="/usr/share/usability-misc/xdg-override/:$XDG_DATA_DIRS"
2632
fi
33+
34+
if [ "$XDG_SESSION_TYPE" = "tty" ]; then
35+
true "$0: INFO: Running inside tty. Stop."
36+
return 0
37+
exit 0
38+
fi
39+
40+
if [ ! "$VISUAL" = "" ]; then
41+
return 0
42+
exit 0
43+
fi
44+
45+
if command -v featherpad 1>/dev/null 2>/dev/null ; then
46+
VISUAL="featherpad"
47+
export VISUAL
48+
return 0
49+
exit 0
50+
fi
51+
if command -v mousepad 1>/dev/null 2>/dev/null ; then
52+
VISUAL="mousepad"
53+
export VISUAL
54+
return 0
55+
exit 0
56+
fi
57+

usr/libexec/default-editor/default_editor.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)