Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
8c277ac7
Commit
8c277ac7
authored
Dec 25, 2017
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
general: Swap sequences from \033 to \e
parent
f2300d33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
30 deletions
+30
-30
neofetch
neofetch
+30
-30
No files found.
neofetch
View file @
8c277ac7
...
@@ -27,7 +27,7 @@ export PATH="/usr/xpg4/bin:/usr/sbin:/sbin:/usr/etc:/usr/libexec:${PATH}"
...
@@ -27,7 +27,7 @@ export PATH="/usr/xpg4/bin:/usr/sbin:/sbin:/usr/etc:/usr/libexec:${PATH}"
shopt
-s
nocasematch
shopt
-s
nocasematch
# Reset colors and bold.
# Reset colors and bold.
reset
=
"
\
0
33
[0m"
reset
=
"
\
\
e
[0m"
# DETECT INFORMATION
# DETECT INFORMATION
...
@@ -2356,9 +2356,9 @@ get_cols() {
...
@@ -2356,9 +2356,9 @@ get_cols() {
# Generate the string.
# Generate the string.
for
((
start
;
start<
=
end
;
start++
))
;
do
for
((
start
;
start<
=
end
;
start++
))
;
do
case
"
$start
"
in
case
"
$start
"
in
[
0-6]
)
blocks+
=
"
${
reset
}
\
0
33[3
${
start
}
m
\0
33
[4
${
start
}
m
${
block_width
}
"
;;
[
0-6]
)
blocks+
=
"
${
reset
}
\
\
e[3
${
start
}
m
\\
e
[4
${
start
}
m
${
block_width
}
"
;;
7
)
blocks+
=
"
${
reset
}
\
0
33[3
${
start
}
m
\0
33
[4
${
start
}
m
${
block_width
}
"
;;
7
)
blocks+
=
"
${
reset
}
\
\
e[3
${
start
}
m
\\
e
[4
${
start
}
m
${
block_width
}
"
;;
*
)
blocks2+
=
"
\
0
33[38;5;
${
start
}
m
\0
33
[48;5;
${
start
}
m
${
block_width
}
"
;;
*
)
blocks2+
=
"
\
\
e[38;5;
${
start
}
m
\\
e
[48;5;
${
start
}
m
${
block_width
}
"
;;
esac
esac
done
done
...
@@ -2371,12 +2371,12 @@ get_cols() {
...
@@ -2371,12 +2371,12 @@ get_cols() {
# Add newlines to the string.
# Add newlines to the string.
cols
=
"
${
cols
%%
'nl'
}
"
cols
=
"
${
cols
%%
'nl'
}
"
cols
=
"
${
cols
//nl/\\n\\
033
[
${
text_padding
}
C
${
zws
}}
"
cols
=
"
${
cols
//nl/\\n\\
\e
[
${
text_padding
}
C
${
zws
}}
"
# Add block height to info height.
# Add block height to info height.
info_height
=
"
$((
info_height+
=
block_height+2
))
"
info_height
=
"
$((
info_height+
=
block_height+2
))
"
printf
"%b
\n
"
"
\
0
33
[
${
text_padding
}
C
${
zws
}${
cols
}
"
printf
"%b
\n
"
"
\
\
e
[
${
text_padding
}
C
${
zws
}${
cols
}
"
fi
fi
unset
-v
blocks blocks2 cols
unset
-v
blocks blocks2 cols
...
@@ -2433,7 +2433,7 @@ image_backend() {
...
@@ -2433,7 +2433,7 @@ image_backend() {
esac
esac
# Set cursor position next image/ascii.
# Set cursor position next image/ascii.
[[
"
$image_backend
"
!=
"off"
]]
&&
printf
"%b"
"
\
0
33[
${
lines
:-
0
}
A
\0
33
[9999999D"
[[
"
$image_backend
"
!=
"off"
]]
&&
printf
"%b"
"
\
\
e[
${
lines
:-
0
}
A
\\
e
[9999999D"
}
}
get_ascii
()
{
get_ascii
()
{
...
@@ -2621,14 +2621,14 @@ get_term_size() {
...
@@ -2621,14 +2621,14 @@ get_term_size() {
# so we have to use a slightly different sequence to
# so we have to use a slightly different sequence to
# get the terminal size.
# get the terminal size.
if
[[
-n
"
$TMUX
"
]]
;
then
if
[[
-n
"
$TMUX
"
]]
;
then
printf
"%b"
"
\
0
33Ptmux;
\0
33
\0
33[14t
\0
33
\0
33[c
\0
33
\\
"
printf
"%b"
"
\
\
ePtmux;
\\
e
\\
e[14t
\\
e
\\
e[c
\\
e
\\
"
read_flags
=(
-d
c
)
read_flags
=(
-d
c
)
elif
[[
"
$image_backend
"
==
"tycat"
]]
;
then
elif
[[
"
$image_backend
"
==
"tycat"
]]
;
then
printf
"%b"
"
\
0
33
}qs
\0
00"
printf
"%b"
"
\
\
e
}qs
\0
00"
else
else
printf
"%b"
"
\
0
33[14t
\0
33
[c"
printf
"%b"
"
\
\
e[14t
\\
e
[c"
read_flags
=(
-d
c
)
read_flags
=(
-d
c
)
fi
fi
...
@@ -2647,7 +2647,7 @@ get_term_size() {
...
@@ -2647,7 +2647,7 @@ get_term_size() {
term_width
=
"
${
term_size
[2]/t*
}
"
term_width
=
"
${
term_size
[2]/t*
}
"
fi
fi
# Get terminal width/height if \
033
[14t is unsupported.
# Get terminal width/height if \
\e
[14t is unsupported.
if
[[
-z
"
$term_width
"
]]
||
((
"
$term_width
"
< 50
))
;
then
if
[[
-z
"
$term_width
"
]]
||
((
"
$term_width
"
< 50
))
;
then
if
type
-p
xdotool
>
/dev/null 2>&1
;
then
if
type
-p
xdotool
>
/dev/null 2>&1
;
then
current_window
=
"
$(
xdotool getactivewindow
)
"
current_window
=
"
$(
xdotool getactivewindow
)
"
...
@@ -2845,10 +2845,10 @@ display_image() {
...
@@ -2845,10 +2845,10 @@ display_image() {
"iterm2"
)
"iterm2"
)
image
=
"
$(
base64
<
"
$image
"
)
"
image
=
"
$(
base64
<
"
$image
"
)
"
iterm_cmd
=
"
\
0
33
]1337;File=width=
${
width
}
px;height=
${
height
}
px;inline=1:
${
image
}
"
iterm_cmd
=
"
\
\
e
]1337;File=width=
${
width
}
px;height=
${
height
}
px;inline=1:
${
image
}
"
# Tmux requires an additional escape sequence for this to work.
# Tmux requires an additional escape sequence for this to work.
[[
-n
"
$TMUX
"
]]
&&
iterm_cmd
=
"
\
0
33Ptmux;
\0
33
${
iterm_cmd
}
\0
33
\\
"
[[
-n
"
$TMUX
"
]]
&&
iterm_cmd
=
"
\
\
ePtmux;
\\
e
${
iterm_cmd
}
\\
e
\\
"
printf
"%b
\a\n
"
"
$iterm_cmd
"
printf
"%b
\a\n
"
"
$iterm_cmd
"
;;
;;
...
@@ -2884,7 +2884,7 @@ to_ascii() {
...
@@ -2884,7 +2884,7 @@ to_ascii() {
get_ascii
get_ascii
# Set cursor position next image/ascii.
# Set cursor position next image/ascii.
printf
"%b"
"
\
0
33[
${
lines
:-
0
}
A
\0
33
[9999999D"
printf
"%b"
"
\
\
e[
${
lines
:-
0
}
A
\\
e
[9999999D"
}
}
to_off
()
{
to_off
()
{
...
@@ -3044,7 +3044,7 @@ prin() {
...
@@ -3044,7 +3044,7 @@ prin() {
string=
"
${
2
:-
$1
}
"
string=
"
${
2
:-
$1
}
"
local subtitle_color=
"
$info_color
"
local subtitle_color=
"
$info_color
"
fi
fi
string=
"
$(
trim
"
${
string
//
$'
\
0
33
[0m'
}
"
)
"
string=
"
$(
trim
"
${
string
//
$'
\
\
e
[0m'
}
"
)
"
# Log length if it doesn
't exist.
# Log length if it doesn
't exist.
if [[ -z "$length" ]]; then
if [[ -z "$length" ]]; then
...
@@ -3057,7 +3057,7 @@ prin() {
...
@@ -3057,7 +3057,7 @@ prin() {
string="${subtitle_color}${bold}${string}"
string="${subtitle_color}${bold}${string}"
# Print the info.
# Print the info.
printf "%b\n" "${text_padding:+\
033
[${text_padding}C}${zws}${string}${reset} "
printf "%b\n" "${text_padding:+\
\e
[${text_padding}C}${zws}${string}${reset} "
# Calculate info height.
# Calculate info height.
((++info_height))
((++info_height))
...
@@ -3069,7 +3069,7 @@ prin() {
...
@@ -3069,7 +3069,7 @@ prin() {
get_underline() {
get_underline() {
if [[ "$underline_enabled" == "on" ]]; then
if [[ "$underline_enabled" == "on" ]]; then
printf -v underline "%${length}s"
printf -v underline "%${length}s"
printf "%b%b\n" "${text_padding:+\
033
[${text_padding}C}${zws}${underline_color}" \
printf "%b%b\n" "${text_padding:+\
\e
[${text_padding}C}${zws}${underline_color}" \
"${underline// /$underline_char}${reset} "
"${underline// /$underline_char}${reset} "
unset -v length
unset -v length
fi
fi
...
@@ -3090,12 +3090,12 @@ get_line_break() {
...
@@ -3090,12 +3090,12 @@ get_line_break() {
get_bold() {
get_bold() {
case "$ascii_bold" in
case "$ascii_bold" in
"on") ascii_bold="\
033
[1m" ;;
"on") ascii_bold="\
\e
[1m" ;;
"off") ascii_bold="" ;;
"off") ascii_bold="" ;;
esac
esac
case "$bold" in
case "$bold" in
"on") bold="\
033
[1m" ;;
"on") bold="\
\e
[1m" ;;
"off") bold="" ;;
"off") bold="" ;;
esac
esac
}
}
...
@@ -3124,10 +3124,10 @@ trim_quotes() {
...
@@ -3124,10 +3124,10 @@ trim_quotes() {
}
}
strip_sequences() {
strip_sequences() {
strip="
${
1
//
$'
\
0
33
['
3
[0-9]m
}
"
strip="
${
1
//
$'
\
\
e
['
3
[0-9]m
}
"
strip="
${
strip
//
$'
\
0
33
['
38
\;5\;[0-9]m
}
"
strip="
${
strip
//
$'
\
\
e
['
38
\;5\;[0-9]m
}
"
strip="
${
strip
//
$'
\
0
33
['
38
\;5\;[0-9][0-9]m
}
"
strip="
${
strip
//
$'
\
\
e
['
38
\;5\;[0-9][0-9]m
}
"
strip="
${
strip
//
$'
\
0
33
['
38
\;5\;[0-9][0-9][0-9]m
}
"
strip="
${
strip
//
$'
\
\
e
['
38
\;5\;[0-9][0-9][0-9]m
}
"
printf "
%s
\n
" "
$strip
"
printf "
%s
\n
" "
$strip
"
}
}
...
@@ -3926,9 +3926,9 @@ set_text_colors() {
...
@@ -3926,9 +3926,9 @@ set_text_colors() {
color() {
color() {
case "
$1
" in
case "
$1
" in
[0-6]) printf "
%b
" "
${
reset
}
\
0
33
[3
${
1
}
m
" ;;
[0-6]) printf "
%b
" "
${
reset
}
\
\
e
[3
${
1
}
m
" ;;
7 | "
fg
") printf "
%b
" "
\
0
33
[37m
${
reset
}
" ;;
7 | "
fg
") printf "
%b
" "
\
\
e
[37m
${
reset
}
" ;;
*) printf "
%b
" "
\
0
33
[38
;
5
;
${
1
}
m
" ;;
*) printf "
%b
" "
\
\
e
[38
;
5
;
${
1
}
m
" ;;
esac
esac
}
}
...
@@ -3951,7 +3951,7 @@ stdout() {
...
@@ -3951,7 +3951,7 @@ stdout() {
}
}
err() {
err() {
err+="
$(
color 1
)
[!]
\
0
33
[0m
$1
\n
"
err+="
$(
color 1
)
[!]
\
\
e
[0m
$1
\n
"
}
}
get_full_path() {
get_full_path() {
...
@@ -4132,7 +4132,7 @@ dynamic_prompt() {
...
@@ -4132,7 +4132,7 @@ dynamic_prompt() {
fi
fi
# Set the prompt location.
# Set the prompt location.
((lines > 1)) && printf "
%b
" "
\
0
33
[
${
lines
}
B
"
((lines > 1)) && printf "
%b
" "
\
\
e
[
${
lines
}
B
"
}
}
old_functions() {
old_functions() {
...
@@ -4780,10 +4780,10 @@ main() {
...
@@ -4780,10 +4780,10 @@ main() {
# Minix doesn't support these sequences.
# Minix doesn't support these sequences.
if
[[
"
$TERM
"
!=
"minix"
&&
"
$stdout
"
!=
"on"
]]
;
then
if
[[
"
$TERM
"
!=
"minix"
&&
"
$stdout
"
!=
"on"
]]
;
then
# If the script exits for any reason, unhide the cursor.
# If the script exits for any reason, unhide the cursor.
trap
'printf "\
033[?25h\033
[?7h"'
EXIT
trap
'printf "\
\e[?25h\\e
[?7h"'
EXIT
# Hide the cursor and disable line wrap.
# Hide the cursor and disable line wrap.
printf
"
\
0
33[?25l
\0
33
[?7l"
printf
"
\
\
e[?25l
\\
e
[?7l"
fi
fi
image_backend
image_backend
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment