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
a173afb6
Commit
a173afb6
authored
Dec 12, 2016
by
Dylan Araps
Committed by
GitHub
Dec 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #519 from dylanaraps/main_cleanup
General: Cleanup main
parents
4ef8c36f
0e8f6637
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
30 deletions
+18
-30
neofetch
neofetch
+18
-30
No files found.
neofetch
View file @
a173afb6
...
@@ -1934,6 +1934,10 @@ get_image_backend() {
...
@@ -1934,6 +1934,10 @@ get_image_backend() {
"ascii"
)
get_ascii 2>/dev/null
;;
"ascii"
)
get_ascii 2>/dev/null
;;
esac
esac
# Set cursor position next to ascii art.
[[
"
$image_backend
"
!=
"off"
]]
&&
\
printf
"%b"
"
\0
33[
$((${
lines
:-
0
}
-
${
prompt_loc
:-
0
}))
A
\0
33[9999999D"
}
}
get_ascii
()
{
get_ascii
()
{
...
@@ -2944,12 +2948,15 @@ get_term_padding() {
...
@@ -2944,12 +2948,15 @@ get_term_padding() {
}
}
dynamic_prompt
()
{
dynamic_prompt
()
{
if
[[
"
$image_backend
"
==
"image"
]]
;
then
case
"
$image_backend
"
in
get_term_padding 2>/dev/null
"image"
)
get_term_padding 2>/dev/null
# Calculate image height in terminal cells.
# Calculate image height in terminal cells.
lines
=
"
$((
(
height
+
(
${
border
:-
0
}
*
2
)
+
${
yoffset
:-
0
}
)
/
font_height
))
"
lines
=
"
$((
(
height
+
(
${
border
:-
0
}
*
2
)
+
${
yoffset
:-
0
}
)
/
font_height
))
"
fi
;;
"off"
)
return
;;
esac
# If the info is higher than the ascii/image place the prompt
# If the info is higher than the ascii/image place the prompt
# based on the info height instead of the ascii/image height.
# based on the info height instead of the ascii/image height.
...
@@ -3327,42 +3334,23 @@ main() {
...
@@ -3327,42 +3334,23 @@ main() {
get_bold
get_bold
get_distro_colors
get_distro_colors
# Restore cursor and clear screen on ctrl+c
trap
'printf "\033[?25h"; clear; exit'
2
# If the script exits for any reason, unhide the cursor.
# If the script exits for any reason, unhide the cursor.
trap
'printf "\033[?25h"'
EXIT
trap
'printf "\033[?25h
\033[?7h
"'
EXIT
# Hide the cursor and disable line wrap
# Hide the cursor and disable line wrap
printf
"
\0
33[?25l
\0
33[?7l"
printf
"
\0
33[?25l
\0
33[?7l"
get_image_backend
get_image_backend
if
[[
"
$image_backend
"
!=
"off"
]]
;
then
# Set cursor position next to ascii art
printf
"%b"
"
\0
33[
$((${
lines
:-
0
}
-
${
prompt_loc
:-
0
}))
A"
# Reset horizontal cursor position
printf
"
\0
33[9999999D"
fi
# Print the info
old_functions
old_functions
get_cache_dir
get_cache_dir
print_info 2>/dev/null
print_info 2>/dev/null
dynamic_prompt
# Prompt calculation
# w3m-img: Draw the image a second time to fix
if
[[
"
$image_backend
"
!=
"off"
]]
;
then
# rendering issues in specific terminal emulators.
dynamic_prompt
[[
"
$image_backend
"
==
"image"
&&
"
$image_program
"
==
"w3m"
]]
&&
display_image
# w3m-img: Draw the image a second time to fix
# rendering issues in specific terminal emulators.
[[
"
$image_backend
"
==
"image"
&&
"
$image_program
"
==
"w3m"
]]
&&
display_image
fi
# Re-enable line wrap
printf
"%b"
"
\0
33[?7h"
# Take a screenshot
[[
"
$scrot
"
==
"on"
]]
&&
take_scrot
[[
"
$scrot
"
==
"on"
]]
&&
take_scrot
# Show error messages
# Show error messages
...
...
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