merge master

This commit is contained in:
Dylan Araps 2016-10-19 20:54:30 +11:00
commit 0e87355eb0
13 changed files with 595 additions and 383 deletions

View file

@ -14,16 +14,8 @@ suggesting a new feature then just a description will suffice.
## Verbose log
**Neofetch 1.6**
1. Add `set -x` to a new line near the top of the script.
2. Run `neofetch 2> neofetchlog`
3. Upload the contents of `neofetchlog` to pastebin, gist or equivalent.
**Neofetch 1.7**
2. Run `neofetch -vv 2> neofetchlog`
3. Upload the contents of `neofetchlog` to pastebin, gist or equivalent.
1. Run `neofetch -vv 2> neofetchlog`
2. Upload the contents of `neofetchlog` to pastebin, gist or equivalent.

View file

@ -10,5 +10,6 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install screenresolution; fi
script:
- sudo make install
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then PREFIX=/usr/local make install ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo make install ; fi
- time neofetch --ascii --config off --ascii_distro travis -v --test

163
1.8.md
View file

@ -1,163 +0,0 @@
# Neofetch 1.8
### Contributers
- **[@hashhar](https://github.com/hashhar)**
- **[@williamkray](https://github.com/williamkray)**
- **[@dar-irl](https://github.com/dar-irl)**
- **[@gabe565](https://github.com/gabe565)**
- **[@maddcoder](https://github.com/maddcoder)**
- **[@iandrewt](https://github.com/iandrewt)**
- **[@aranega](https://github.com/aranega)**
- **[@vendion](https://github.com/vendion)**
- **[@konimex](https://github.com/konimex)**
### General
- Moved all whitespace trimming to a dedicated function.
- Neofetch will no longer have any whitespace issues in the output.
- See [trim()](https://github.com/dylanaraps/neofetch/commit/d3c87cdaacf1ea9fbf245146c910dc53b49dba08#diff-e863270127ca6116fd30e708cdc582fcR2789)
- Only call `tput` when we really need to.
- Supress `getconfig` and `getscriptdir` errors.
- Removed `stdout` mode since it's been broken for a while now and I don't see the<br\>
point in fixing it.
- Fix issue when title and background were both color `7`.
- Added `--version` to print the neofetch version.
- The title at the top is now much more colorful.
- Supress `xprop` errors since it's now an optional dependency.
- Fix lint errors.
- Remove all instances of `! -z` since they're pointless.
- Quote all variable/command substitutions.
- Remove all `bc` usage by simplifying math.
- The prompt is now dynamically set in image mode instead of being anchored to the<br \>
bottom of the window. See [#279](https://github.com/dylanaraps/neofetch/pull/279) and [#299](https://github.com/dylanaraps/neofetch/pull/299) for examples.
- Removed `line_wrap` as having it set to `on` broke the output.
- Minor text fixes.
- Fix issue with incorrect text color when `barinfo` is set.
- Fixed various Travis.ci bugs.
- `-v` now shows where the config files were sourced from.
- Removed in-script config in favor of sourcing the default user config.
- Moved commands near the bottom of the script to a new function called `main`.
- Use `read -s` instead of `stty -echo` and `stty +echo`.
- Cleanup
### OS
- Added support for Devuan Linux.
- Added support for GalliumOS.
- Added support for Openwrt.
- Added support for PacBSD. **[@vendion](https://github.com/vendion)**
- Added support for Rosa.
- Added support for Solaris (Oracle / OpenIndiana). **[@konimex](https://github.com/konimex)**
- Added support for macOS Sierra. **[@iandrewt](https://github.com/iandrewt)**
- Fixed various iOS related issues.
### Packages
- Added Cydia package for iOS.
- See https://github.com/dylanaraps/neofetch#ios-1
### Terminal and Terminal Font
![img](https://ipfs.pics/ipfs/QmR39ScLi56Yt73pA3YWri9ayatN6mpwSTEmM8RVdeRsB1)
- Added `term` function to display current terminal emulator. \[1\]
- Added `termfont` function to display current terminal font. \[2\]
\[1\] Both of these functions are enabled by default.<br \>
\[2\] See this wiki page for more info about the functions: [Link](https://github.com/dylanaraps/neofetch/wiki/Terminal-and-Terminal-Font-detection)
### Info
- Use faster `$(())` syntax for index variables.
**Model**<br \>
- Added `model` a new function which displays your device's product vendor/name.
![Mode](https://ipfs.pics/ipfs/Qmcy2o5xZCELxroNLHAhY96ZsrwBFR86NGDCu5e2UPVn4b)
**Title**<br \>
- Added additional fallback which gets the current username from `$HOME`.
**Color Blocks**<br \>
- Added `--block_height` / `$block_height` to change the number of lines high each<br \>
block will be.
![Big Blocks](https://ipfs.pics/ipfs/QmZpR8ukZNfGXkhXjTwAy3eWVRCeHdrurhgAdV5CSiTVvR)
**Resolution**<br \>
- [Windows] Fix resolution on Windows 10. **[@dar-irl](https://github.com/dar-irl)**
- [Mac OS X] Hide refresh rate if `0`. **[@iandrewt](https://github.com/iandrewt)**
- Fixed `xrandr` output on systems not using gawk.
- [Linux / BSD] Shortened refresh rate output.
**Shell**<br \>
- Show `fish` shell version. **[@maddcoder](https://github.com/maddcoder)**
**Song**<br \>
- [Cmus] Prevent `tag artistsort` from showing up in song title. **[@williamkray](https://github.com/williamkray)**
- [Cmus] Fix order of music tags. **[@iandrewt](https://github.com/iandrewt)**
- [Cmus] The function now works on both OS X and Linux.
- [iTunes] Fix song not displaying. **[@iandrewt](https://github.com/iandrewt)**
**CPU**<br \>
- Simplify CPU Core command.
**CPU Usage**<br \>
- Fixed broken CPU usage output on BSD and Windows.
- Fixed misleading output on Linux / Mac OS X.
- Moved CPU Usage to its own dedicated function.
### Image
![terminology](https://ipfs.pics/ipfs/QmbVEUREBg4hMG22WrQ2bkt2sZZzyTEP5EEXmHRw7MHD6A)
- Added image support for terminology with `tycat`. **[@aranega](https://github.com/aranega)** \[1\]
- Fixed issues with lines getting drawn through images. See [#296](https://github.com/dylanaraps/neofetch/pull/296)
- Added `--crop_mode none` / `crop_mode=none` to disable cropping the images.
- Added `--size none` / `size=none` to disable resizing / cropping the images.
- Removed `image_position`
- `--image off` now behaves like the other image modes.
\[1\] `tycat` is a terminology builtin that works similarly to w3m-img. Those using terminology<br \>
now have working image support.
##### Shuffle mode
- Fixed directory going out of bounds causing a fallback to ascii mode. **[@gabe565](https://github.com/gabe565)**
- Simplified shuffle function.
- Path no longer requires a `/` at the end. **[@aranega](https://github.com/aranega)**
### Ascii
- Add `ascii_bold` which allows you to bold the ascii art.
- Custom ascii files (`--ascii path/to/ascii_file`) now follow the same format as the<br\>
distro ascii files. See this wiki page that explains the syntax. [Link](https://github.com/dylanaraps/neofetch/wiki/Custom-Ascii-art-file-format)
- Better `Ubuntu-GNOME` ascii art. **[@hashhar](https://github.com/hashhar)**
- Fix a color issue with Debian's ascii logo.
- Added `--ascii_distro mac` as a shorter way of using the OS X ascii.
- Added missing `$ascii_distro` config option.
- Use a pure bash solution to getting ascii size.

103
Changelog.md Normal file
View file

@ -0,0 +1,103 @@
## Contributors
- **[@konimex](https://github.com/konimex)**
- **[@iandrewt](https://github.com/iandrewt)**
- **[@coypoop](https://github.com/coypoop)**
<br \>
## General
- Added new function called `checkoldflags` which informs users about deprecated config options.
- Change all `OS X` references to `macOS`. **[@iandrewt](https://github.com/iandrewt)**
- Fix corrupted text when long lines are cut-off.
## Operating System
- Added support for Bitrig. **[@konimex](https://github.com/konimex)**
- Added support for Sparky Linux.
## Packages
- Neofetch is now in Gentoo's official repos.
## Images
**Fixed rendering issues in URxvt when using an XFT font.**
![scrot](https://i.sli.mg/6qp9Cg.png)
This was first thought to be an issue between URxvt and W3m-img and I apologize for immediately closing bug reports and dismissing comments about this.
I spent yesterday trying to fix this issue and found out that launching neofetch with `--bold off`
reduced the rendering problems. I did more digging and found out that removing all text formatting fixes the issue entirely. I later found out that adding a single unformatted character before the formatted text fixed the issue while keeping the formatting the same.
I opened up this PR https://github.com/dylanaraps/neofetch/pull/358 which added options to enable a border between the image and the text to fix the issue. **[@konimex](https://github.com/konimex)** later commented informing me that we could just use a `zero-width space` to fix the issue and that we didn't need a new function/args/ugly border. doh
The final fix was as simple as adding a zero-width space before the info, here's the commit.
https://github.com/dylanaraps/neofetch/commit/3e9c3d648cb4c6f0d5fe5f0b96f9e29429af39d9
## Ascii
- Bold ascii art by default.
- Fixed incorrect prompt location when using `ascii_logo_size small`.
## Info
**Distro**<br \>
- Expanded `distro_shorthand` to macOS and Solaris. **[@konimex](https://github.com/konimex)**
- Removed `osx_buildversion` and `osx_codename` in favour of `distro_shorthand`. **[@konimex](https://github.com/konimex)**
**Window Manager**<br \>
- [Windows] Added support for custom WMs/Shells.
- Neofetch now detects `blackbox`, `bugn`, `Windawesome`, `emerge` and `litestep`.
- Uppercase first letter of `wm` output.
**Window Manager Theme**<br \>
- [Windows] Added support for Blackbox themes.
**CPU**<br \>
- [macOS] Print physical cores instead of hyper-threaded cores. **[@iandrewt](https://github.com/iandrewt)**
**Resolution**<br \>
- [macOS] Add @2x label for retina resolutions. **[@iandrewt](https://github.com/iandrewt)**
**Memory**<br \>
- [NetBSD] Fix memory output for sizes over 4GB. **[@coypoop](https://github.com/coypoop)**
**Shell**<br \>
- Hide shell path by default.
- Show shell version by default.
**Theme Font**<br \>
- [XFCE] Fixed incorrect font output.
**Color Blocks**<br \>
- Fixed `block_width` not working.
- Fixed `% s` appearing in color blocks when neofetch is run from `tty`
- Fixed `block_width` being off by one. A value of `2` made the blocks `3` wide instead of `2` wide.
- Show 16 colors by default instead of 8.
**Terminal and Terminal Font**<br \>
- Uppercase first letter of `term` and `termfont` outputs.
- Remove path from output.
**Song**<br \>
- [macOS] Fix iTunes automatically opening. **[@iandrewt](https://github.com/iandrewt)**

View file

@ -29,8 +29,9 @@ Have a look at the wiki, I've updated/added some new pages!<br \>
- [Fedora / RHEL / CentOS](#fedora--rhel--centos)
- [Void Linux](#void-linux)
- [BunsenLabs](#bunsenlabs)
- [Solus](#solus)
- [Slackware](#slackware)
- [Mac OS X](#mac-os-x)
- [macOS](#mac-os-x)
- [iOS](#ios-1)
- [Others](#others)
- [Post Install](#post-install)
@ -50,7 +51,7 @@ Have a look at the wiki, I've updated/added some new pages!<br \>
![Linux](https://ipfs.pics/ipfs/QmRRYwcSRz1FHNx8VQiBixZq3qvBNk487fKGwUNTs7GQjA)
![Windows](https://ipfs.pics/ipfs/Qmf5GpmqnMRhEzC1qoQ2tM4699tEXLManZTs5pz4mWJbCg)
![Mac OS X](https://ipfs.pics/ipfs/QmWA8XX6pFkEuLLcrq5JZBx1KFEUaXanTy1jMxzKVRpwaT)
![macOS](https://ipfs.pics/ipfs/QmWA8XX6pFkEuLLcrq5JZBx1KFEUaXanTy1jMxzKVRpwaT)
![bsd](https://ipfs.pics/ipfs/QmSpyCGzSgYnyfbMetKqxy9cU3UFbneS3G8JrbdxkiNLgm)
![bsd](https://ipfs.pics/ipfs/QmeZhs3CwGtM8CSVoorA2d2CqLxRzbJkdD7aYxa4Dixsea)
@ -63,7 +64,7 @@ Have a look at the wiki, I've updated/added some new pages!<br \>
## Features
- Supports **Linux**, **Mac OS X**, **iOS**, **BSD**, **Solaris** and **Windows** (Cygwin)
- Supports **Linux**, **macOS**, **iOS**, **BSD**, **Solaris** and **Windows** (Cygwin/Windows 10 Linux subsystem)
- Display a **full color image**, a file containing **ascii art** or your **distro's logo** in ascii next to the info.
- The script is **fast**. We use bash builtins wherever possible and only spawn external processes when necessary.
- Take a screenshot of your desktop on script finish.
@ -105,7 +106,7 @@ Note: The cydia package installs these dependencies for you.
- Thumbnail creation: `imagemagick`
- Displaying song information from Google Play Music Desktop Player: [`gpmdp-remote`](https://github.com/iAndrewT/gpmdp-remote)
##### Linux / BSD
##### Linux / BSD / Solaris
- Wallpaper: `feh`, `nitrogen` or `gsettings`
- Current Song: `mpc`, `cmus`, `moc`, `spotify`, `gpmdc`
@ -116,7 +117,7 @@ Note: The cydia package installs these dependencies for you.
- Resolution (quicker): `screenresolution`
##### BSD
##### BSD / Solaris
- GPU: `glxinfo`
- Not required on FreeBSD.
@ -163,8 +164,9 @@ https://github.com/dylanaraps/neofetch/wiki/Following-HEAD
- [Fedora / RHEL / CentOS](#fedora--rhel--centos)
- [Void Linux](#void-linux)
- [BunsenLabs](#bunsenlabs)
- [Solus](#solus)
- [Slackware](#slackware)
- [Mac OS X](#mac-os-x)
- [macOS](#mac-os-x)
- [iOS](##ios-1)
- [Others](#others)
@ -176,35 +178,27 @@ https://github.com/dylanaraps/neofetch/wiki/Following-HEAD
### Gentoo / Funtoo
1. Add the 3rd party repo
- `# wget -O /etc/portage/repos.conf/konimex.conf https://git.io/vocNV`
2. Sync the repo
- `# emerge --sync konimex`
3. To enable additional features such as w3m and music support, enable the appropriate USE flags. For example:
- `# echo "app-misc/neofetch X -moc" >> /etc/portage/package.use`
4. Install the package
- `# emerge -a app-misc/neofetch`
To install the git version, just add `app-misc/neofetch ~<your architecture>` to `package.accept_keywords`
You can install `app-misc/neofetch` from Gentoo/Funtoo's official repositories.
To install the git version of neofetch, use `=app-misc/neofetch-9999` instead.
### CRUX
1. Install git and the git ports(8) driver
- `sudo prt-get depinst git`
2. Add the 3rd party repo
- `sudo wget -O /etc/ports/tudurom.git https://git.io/vV46y`
2. Add the `6c36-git` repository
- `sudo wget -O /etc/ports/6c37-git.git "https://raw.githubusercontent.com/6c37/cross/master/git-driver/6c37-git.git"`
3. Sync the repos
- `sudo ports -u`
4. Add the repo to /etc/prt-get.conf with your text editor of choice
- `prtdir /usr/ports/tudurom`
- `prtdir /usr/ports/6c37-git`
5. Install the package
- `sudo prt-get depinst neofetch`
Or alternatively use the [port](https://github.com/tudurom/crux-ports/blob/master/neofetch/Pkgfile):
Or alternatively use the [port](https://raw.githubusercontent.com/6c37/crux-ports-git/3.2/neofetch/Pkgfile):
1. Download port
- `wget -O ~/work/neofetch/Pkgfile https://raw.githubusercontent.com/tudurom/crux-ports/master/neofetch/Pkgfile`
- `wget -O ~/work/neofetch/Pkgfile "https://raw.githubusercontent.com/6c37/crux-ports-git/3.2/neofetch/Pkgfile"`
2. Build the package
- `fakeroot pkgmk -d`
3. Install the package
@ -261,11 +255,15 @@ Neofetch is available in the official repos.
1. `sudo apt-get update`
2. `sudo apt-get install neofetch`
### Solus
Use the Software Center or type `sudo eopkg it neofetch`.
### Slackware
Download the files from [SlackBuilds](https://slackbuilds.org/repository/14.2/desktop/neofetch/) and follow [their instructions](https://slackbuilds.org/howto/).
### Mac OS X
### macOS
1. Install `neofetch` with Homebrew
- `brew install neofetch`
@ -359,9 +357,7 @@ alias neofetch2="neofetch \
in the output.
NOTE: You can supply multiple args. eg.
'neofetch --disable cpu gpu disk shell'
--osx_buildversion on/off Hide/Show Mac OS X build version.
--osx_codename on/off Hide/Show Mac OS X codename.
--os_arch on/off Hide/Show Windows architecture.
--os_arch on/off Hide/Show OS architecture.
--speed_type type Change the type of cpu speed to display.
Possible values: current, min, max, bios,
scaling_current, scaling_min, scaling_max
@ -369,11 +365,14 @@ alias neofetch2="neofetch \
--cpu_shorthand type Shorten the output of CPU
Possible values: name, speed, tiny, on, off
--cpu_cores on/off Whether or not to display the number of CPU cores
--distro_shorthand on/off Shorten the output of distro (tiny, on, off)
NOTE: This is only possible on Linux, macOS, and Solaris
--kernel_shorthand on/off Shorten the output of kernel
--uptime_shorthand on/off Shorten the output of uptime (tiny, on, off)
--refresh_rate on/off Whether to display the refresh rate of each monitor
Unsupported on Windows
--gpu_shorthand on/off Shorten the output of GPU (tiny, on, off)
--gpu_brand on/off Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel)
--gtk_shorthand on/off Shorten output of gtk theme/icons
--gtk2 on/off Enable/Disable gtk2 theme/icons output
--gtk3 on/off Enable/Disable gtk3 theme/icons output
@ -445,10 +444,13 @@ alias neofetch2="neofetch \
--ascii_logo_size Size of ascii logo.
Supported distros: Arch, Gentoo, Crux, OpenBSD.
--ascii_bold on/off Whether or not to bold the ascii logo.
--logo | -L Hide the info text and only show the ascii logo.
Screenshot:
--scrot /path/to/img Take a screenshot, if path is left empty the screen-
shot function will use \$scrot_dir and \$scrot_name.
--upload | -su /pth/t/img Same as --scrot but uploads the scrot to a website.
--image_host Website to upload scrots to. Takes: imgur, teknik
--scrot_cmd cmd Screenshot program to launch
Other:

20
ascii/distro/bitrig Normal file
View file

@ -0,0 +1,20 @@
"\
${c1} \`hMMMMN+
-MMo-dMd\`
oMN- oMN\`
yMd /NM:
.mMmyyhMMs
:NMMMhsmMh
+MNhNNoyMm-
hMd.-hMNMN:
mMmsssmMMMo
.MMdyyhNMMMd
oMN.\`/dMddMN\`
yMm/hNm+./MM/
.dMMMmo.\`\`.NMo
:NMMMNmmmmmMMh
/MN/-------oNN:
hMd. .dMh
sm/ /ms
"

12
ascii/distro/guixsd Normal file
View file

@ -0,0 +1,12 @@
"\
${c1} .. \`.
\`--..\`\`\`..\` \`..\`\`\`..--\`
.-:///-:::. \`-:::///:-.
\`\`\`\`.:::\` \`:::.\`\`\`\`
-//:\` -::-
://: -::-
\`///- .:::\`
-+++-:::.
:+/:::-
\`-....\`
"

View file

@ -1,20 +1,20 @@
"\
${c1} e e
eee ee
eeee eee
${c2} wwwwwwwww${c1}eeeeee
${c2} wwwwwwwwwwwwwww${c1}eee
${c2} wwwwwwwwwwwwwwwwwww${c1}eeeeeeee
${c2} wwwww ${c1}eeeee${c2}wwwwww${c1}eeee
${c2}www ${c1}eeee${c2}wwwwww${c1}e
${c2}ww ${c1}ee${c2}wwwwww
w wwwww
wwwww
wwwww
wwwww
wwww
wwww
wwww
www
ww
${c3}......
.'${c1}D${c3}lddddddddddd'.
.'ddd${c1}XM${c3}xdddddddddddddd.
.dddddx${c1}MMM0${c3};dddddddddddddd.
'dddddl${c1}MMMMMN${c3}cddddddddddddddd.
ddddddc${c1}WMMMMMMW${c3}lddddddddddddddd.
ddddddc${c1}WMMMMMMMMO${c3}ddoddddddddddddd.
.ddddd:${c1}NMMMMMMMMMK${c3}dd${c1}NX${c3}od;c${c1}lxl${c3}dddddd
dddddc${c1}WMMMMMMMMMMNN${c3}dd${c1}MMXl${c3};d${c1}00xl;${c3}ddd.
ddddl${c1}WMMMMMMMMMMMMM${c3}d;${c1}MMMM0${c3}:dl${c1}XMMXk:${c3}'
dddo${c1}WMMMMMMMMMMMMMM${c3}dd${c1}MMMMMW${c3}od${c3};${c1}XMMMOd
${c3}.dd${c1}MMMMMMMMMMMMMMMM${c3}d:${c1}MMMMMMM${c3}kd${c1}lMKll
${c3}.;dk0${c1}KXNWWMMMMMMMMM${c3}dx${c1}MMMMMMM${c3}Xl;lxK;
${c3} 'dddddddd;:cclodcddxddolloxO0O${c1}d'
${c1} ckkxxxddddddddxxkOOO000Okdool.
${c2}.lddddxxxxxxddddooooooooood
.:oooooooooooooooooooc'
.,:looooooooooc;.
"

23
ascii/distro/sparky Normal file
View file

@ -0,0 +1,23 @@
"\
${c1}
. \`-:-\`
.o\` .-///-\`
\`oo\` .:/++:.
os+\` -/+++:\` \`\`.........\`\`\`
/ys+\`./+++/-.-::::::----......\`\`
\`syyo\`++o+--::::-::/+++/-\`\`
-yyy+.+o+\`:/:-:sdmmmmmmmmdy+-\`
::-\` :yyy/-oo.-+/\`ymho++++++oyhdmdy/\`
\`/yy+-\`.syyo\`+o..o--h..osyhhddhs+//osyy/\`
-ydhs+-oyy/.+o.-: \` \` :/::+ydhy+\`\`\`-os-
.sdddy::syo--/:. \`.:dy+-ohhho ./:
:yddds/:+oo+//:-\`- /+ +hy+.shhy: \`\`
\`:ydmmdysooooooo-.ss\`/yss--oyyo
\`./ossyyyyo+:-/oo:.osso- .oys
\`\`..-------::////.-oooo/ :so
\`...----::::::::--.\`/oooo: .o:
\`\`\`\`\`\`\` ++o+:\` \`:\`
./+/-\` \`
\`-:-.
\`\`
"

View file

@ -3,7 +3,7 @@ ${c1} ,.=:!!t3Z3z.,
:tt:::tt333EE3
${c1} Et:::ztt33EEEL${c2} @Ee., ..,
${c1} ;tt:::tt333EE7${c2} ;EEEEEEttttt33#
${c1} :Et:::zt333EEQ.${c2} $EEEEEttttt33QL
${c1} :Et:::zt333EEQ.${c2} \$EEEEEttttt33QL
${c1} it::::tt333EEF${c2} @EEEEEEttttt33F
${c1} ;3=*^\`\`\`\"*4EEV${c2} :EEEEEEttttt33@.
${c3} ,.=::::!t=., ${c1}\`${c2} @EEEEEEtttz33QF

View file

@ -61,13 +61,9 @@ kernel_shorthand="on"
# Distro
# Mac OS X hide/show build version
# --osx_buildversion on/off
osx_buildversion="on"
# Mac OS X hide/show codename
# --osx_codename on/off
osx_codename="on"
# Shorten the output of distro (tiny, on, off)
# NOTE: This is only possible on Linux, macOS, and Solaris
distro_shorthand="off"
# Show 'x86_64' and 'x86' in 'Distro:' output.
# --os_arch on/off
@ -89,7 +85,7 @@ shell_path="off"
# Show $SHELL's version
# --shell_version on/off
shell_version="off"
shell_version="on"
# CPU
@ -122,6 +118,10 @@ cpu_cores="on"
# --gpu_shorthand on/off/tiny
gpu_shorthand="on"
# Enable/Disable GPU Brand
# --gpu_brand on/off
gpu_brand="on"
# Resolution
# Display refresh rate next to each monitor
@ -233,7 +233,7 @@ underline_char="-"
# Color block range
# --block_range start end
start=0
end=7
end=15
# Toggle color blocks
# --color_blocks on/off
@ -241,7 +241,7 @@ color_blocks="on"
# Color block width in spaces
# --block_width num
block_width=2
block_width=3
# Color block height in lines
# --block_height num
@ -258,7 +258,7 @@ block_height=1
progress_char_elapsed="-"
progress_char_total="="
# Progress vorder
# Progress border
# --progress_border on/off
progress_border="on"
@ -370,7 +370,7 @@ ascii_logo_size="normal"
# Bold ascii logo
# Whether or not to bold the ascii logo.
# --ascii_bold on/off
ascii_bold="off"
ascii_bold="on"
# }}}
@ -394,7 +394,17 @@ scrot_dir="$HOME/Pictures/"
# Scrot filename
# What to name the screenshots
# --scrot_name str
scrot_name="neofetch-$(date +%F-%T).png"
scrot_name="neofetch-$(date +%F-%I-%M-%S-${RANDOM}).png"
# Image upload host
# Where to upload the image.
# Possible values: imgur, teknik
image_host="imgur"
# Imgur api key
# This is an api key for neofetch, you can sign up for your own
# here: http://api.imgur.com/oauth2/addclient
imgur_client_id="0e8b44d15e9fc95"
# }}}

485
neofetch
View file

@ -27,7 +27,7 @@ getos() {
case "$(uname)" in
"Linux") os="Linux" ;;
"Darwin") os="$(sw_vers -productName)" ;;
*"BSD" | "DragonFly") os="BSD" ;;
*"BSD" | "DragonFly" | "Bitrig") os="BSD" ;;
"CYGWIN"*) os="Windows" ;;
"SunOS") os="Solaris" ;;
*) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;;
@ -104,6 +104,7 @@ getmodel() {
model="$(wmic computersystem get manufacturer,model /value)"
model="${model/Manufacturer'='}"
model="${model/Model'='}"
model="${model//*To Be Filled*}"
;;
"Solaris")
@ -121,24 +122,59 @@ getdistro() {
case "$os" in
"Linux" )
if type -p lsb_release >/dev/null 2>&1; then
distro="$(lsb_release -d 2>/dev/null | awk -F ':' '/Description/ {printf $2}')"
if grep -q 'Microsoft' /proc/version >/dev/null 2>&1 || \
grep -q 'Microsoft' /proc/sys/kernel/osrelease >/dev/null 2>&1; then
case "$distro_shorthand" in
"on") distro="$(lsb_release -sir 2>/dev/null) [Windows 10]" ;;
"tiny") distro="Windows 10" ;;
*) distro="$(lsb_release -sd 2>/dev/null) on Windows 10" ;;
esac
ascii_distro="Windows 10"
elif type -p lsb_release >/dev/null 2>&1; then
case "$distro_shorthand" in
"on") distro="$(lsb_release -sir 2>/dev/null)" ;;
"tiny") distro="$(lsb_release -si 2>/dev/null)" ;;
*) distro="$(lsb_release -sd 2>/dev/null)" ;;
esac
elif type -p guix >/dev/null 2>&1; then
distro="GuixSD"
elif type -p crux >/dev/null 2>&1; then
distro="$(crux)"
case "$distro_shorthand" in
"on") distro="${distro//version}" ;;
"tiny") distro="${distro//version*}" ;;
esac
elif [ -d "/system/app/" ] && [ -d "/system/priv-app" ]; then
distro="Android $(getprop ro.build.version.release)"
else
distro="$(awk -F 'NAME=' '/^NAME=/ {printf $2}' /etc/*ease)"
distro="${distro//\"}"
# Workarounds are included in every shorthand option
case "$distro_shorthand" in
"on")
distro="$(awk -F'=' '/^NAME|VERSION_ID=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)"
[ -z "$distro" ] && distro="$(awk -F'=' '/^DISTRIB_ID|DISTRIB_RELEASE=/ {print $2}' /etc/openwrt_release)"
;;
# Workaround for distros that store the value differently.
[ -z "$distro" ] && distro="$(awk -F 'TAILS_PRODUCT_NAME="|"' '/^TAILS_PRODUCT_NAME=/ {printf $2}' /etc/*ease)"
[ -z "$distro" ] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease)"
[ -z "$distro" ] && distro="$(awk -F "'" '/^DISTRIB_DESCRIPTION/ {print $2}' /etc/openwrt_release)"
"tiny")
distro="$(awk -F'=' '/^NAME=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)"
[ -z "$distro" ] && distro="$(awk -F'=' '/^TAILS_PRODUCT_NAME=/ {print $2}' /etc/*ease)"
[ -z "$distro" ] && distro="$(awk -F'=' '/^DISTRIB_ID=/ {print $2}' /etc/openwrt_release)"
;;
*)
distro="$(awk -F'=' '/^PRETTY_NAME=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)"
[ -z "$distro" ] && distro="$(awk -F'=' '{print $2}' /etc/*ease)"
[ -z "$distro" ] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease)"
[ -z "$distro" ] && distro="$(awk -F'=' '/^DISTRIB_DESCRIPTION=/ {print $2}' /etc/openwrt_release)"
;;
esac
fi
distro="${distro//\"}"
distro="${distro//\'}"
;;
"Mac OS X")
@ -155,9 +191,21 @@ getdistro() {
"10.10"*) codename="OS X Yosemite" ;;
"10.11"*) codename="OS X El Capitan" ;;
"10.12"*) codename="macOS Sierra" ;;
*) codename="Mac OS X" ;;
*) codename="macOS" ;;
esac
distro="$codename $osx_version $osx_build"
case "$distro_shorthand" in
"on") distro="${distro/ ${osx_build}}" ;;
"tiny")
case "$osx_version" in
"10."[4-7]*) distro="${distro/${codename}/Mac OS X}" ;;
"10."[8-9]* | "10.1"[0-1]*) distro="${distro/${codename}/OS X}" ;;
"10.12"*) distro="${distro/${codename}/macOS}" ;;
esac
distro="${distro/ ${osx_build}}"
;;
esac
;;
"iPhone OS")
@ -187,7 +235,10 @@ getdistro() {
;;
"Solaris")
distro="$(nawk 'NR==1{gsub(/^ \t]+|[ \t]+$/,""); printf $1 " " $2;}' /etc/release)"
case "$distro_shorthand" in
"on" | "tiny") distro="$(awk 'NR==1{print $1 " " $2;}' /etc/release)" ;;
*) distro="$(awk 'NR==1{print $1 " " $2 " " $3;}' /etc/release)" ;;
esac
;;
esac
@ -195,12 +246,6 @@ getdistro() {
[ "$os_arch" == "on" ] && \
distro+=" $(uname -m)"
[ "$osx_codename" == "off" ] && \
distro="${distro/${codename}/Mac OS X}"
[ "$osx_buildversion" == "off" ] && \
distro="${distro/ ${osx_build}}"
[ "${ascii_distro:-auto}" == "auto" ] && \
ascii_distro="$(trim "$distro")"
}
@ -363,6 +408,9 @@ getpackages() {
type -p nix-env >/dev/null 2>&1 && \
packages="$((packages+=$(ls -d -1 /nix/store/*/ | wc -l)))"
type -p guix >/dev/null 2>&1 && \
packages="$((packages+=$(ls -d -1 /gnu/store/*/ | wc -l)))"
type -p apk >/dev/null 2>&1 && \
packages="$((packages+=$(apk info | wc -l)))"
@ -481,7 +529,7 @@ getde() {
case "$de" in
"KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;;
*"TDE_FULL_SESSION"*) de="Trinity" ;;
*"MUFFIN"*) de="Cinnamon" ;;
*"MUFFIN"*) de="$(cinnamon --version 2>/dev/null)"; de="${de:-Cinnamon}" ;;
*"xfce4"*) de="XFCE4" ;;
*"xfce5"*) de="XFCE5" ;;
esac
@ -502,18 +550,29 @@ getwm() {
# Fallback for Wayland wms
case "$wm" in
"xwlc")
wm="$(ps -e | grep -m 1 -oE "sway|orbment|velox|orbital")"
[ "$version" -ge 4 ] && wm="${wm^}"
;;
"xwlc") wm="$(ps -e | grep -m 1 -oE "sway|orbment|velox|orbital")" ;;
esac
else
case "$os" in
"Mac OS X") wm="Quartz Compositor" ;;
"Windows") wm="Explorer" ;;
"Windows")
wm="$(tasklist | grep -m 1 -o "bugn\|Windawesome\|blackbox\|emerge\|litestep")"
[ "$wm" == "blackbox" ] && wm="bbLean (Blackbox)"
if [ "$wm" ]; then
wm="$wm, Explorer"
else
wm="Explorer"
fi
;;
esac
fi
# Don't uppercase i3
[ "$version" -ge 4 ] && \
[ "$wm" != "i3" ] && \
wm="${wm^}"
}
# }}}
@ -537,7 +596,10 @@ getwmtheme() {
'Compiz' | 'Mutter'* | 'GNOME Shell' | 'Gala')
if type -p gsettings >/dev/null 2>&1; then
wmtheme="$(gsettings get org.gnome.desktop.wm.preferences theme)"
wmtheme="$(gsettings get org.gnome.shell.extensions.user-theme name)"
[ -z "$wmtheme" ] && \
wmtheme="$(gsettings get org.gnome.desktop.wm.preferences theme)"
elif type -p gconftool-2 >/dev/null 2>&1; then
wmtheme="$(gconftool-2 -g /apps/metacity/general/theme)"
@ -613,7 +675,7 @@ getwmtheme() {
fi
;;
'Explorer')
*'Explorer')
path="/proc/registry/HKEY_CURRENT_USER/Software/Microsoft"
path+="/Windows/CurrentVersion/Themes/CurrentTheme"
@ -622,6 +684,15 @@ getwmtheme() {
wmtheme="${wmtheme%.*}"
;;
'Blackbox' | "bbLean"*)
path="$(wmic process get ExecutablePath | grep "blackbox")"
path="${path//'\'/'/'}"
wmtheme="$(grep "^session\.styleFile:" ${path/\.exe/.rc})"
wmtheme="${wmtheme/'session.styleFile: '}"
wmtheme="${wmtheme##*\\}"
wmtheme="${wmtheme%.*}"
;;
esac
wmtheme="${wmtheme//\'}"
@ -647,9 +718,10 @@ getcpu() {
"Android"*) cpu="$(getprop ro.product.board)" ;;
*) cpu="$(awk -F ': | @' '/model name|Processor/ {printf $2; exit}' /proc/cpuinfo)" ;;
esac
cpu_dir="/sys/devices/system/cpu/cpu0/cpufreq"
# Get cpu speed
if [ -d "/sys/devices/system/cpu/cpu0/cpufreq" ]; then
if [ -d "$cpu_dir" ]; then
case "$speed_type" in
current) speed_type="scaling_cur_freq" ;;
min) speed_type="scaling_min_freq" ;;
@ -660,8 +732,9 @@ getcpu() {
scaling_max) speed_type="scaling_max_freq" ;;
esac
read -t 1 -r speed < \
/sys/devices/system/cpu/cpu0/cpufreq/${speed_type}
# Fallback to cpuinfo_max_freq if $speed_type fails
read -t 1 -r speed < "${cpu_dir}/${speed_type}" || \
read -t 1 -r speed < "${cpu_dir}/cpuinfo_max_freq"
speed="$((speed / 100000))"
else
@ -673,9 +746,9 @@ getcpu() {
# Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then
speed="0.${speed}"
speed="0.${speed}"
else
speed="${speed:0:1}.${speed:1}"
speed="${speed:0:1}.${speed:1}"
fi
cpu="$cpu @ ${speed}GHz"
@ -683,7 +756,7 @@ getcpu() {
"Mac OS X")
cpu="$(sysctl -n machdep.cpu.brand_string)"
cores="$(sysctl -n hw.ncpu)"
cores="$(sysctl -n hw.physicalcpu)"
;;
"iPhone OS")
@ -811,9 +884,9 @@ getcpu() {
# Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then
speed="0.${speed}"
speed="0.${speed}"
else
speed="${speed:0:1}.${speed:1}"
speed="${speed:0:1}.${speed:1}"
fi
cpu="$cpu @ ${speed}GHz"
@ -834,9 +907,9 @@ getcpu() {
# Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then
speed="0.${speed}"
speed="0.${speed}"
else
speed="${speed:0:1}.${speed:1}"
speed="${speed:0:1}.${speed:1}"
fi
cpu="$cpu @ ${speed}GHz"
@ -908,10 +981,10 @@ getcpu_usage() {
# Print the bar
case "$cpu_display" in
"info") cpu_usage="${cpu_usage}%" ;;
"bar") cpu_usage="$(bar $cpu_usage 100)" ;;
"infobar") cpu_usage="${cpu_usage}% $(bar $cpu_usage 100)" ;;
"barinfo") cpu_usage="$(bar $cpu_usage 100) ${cpu_usage}%" ;;
*) cpu_usage="${cpu_usage}%" ;;
esac
}
@ -920,8 +993,8 @@ getcpu_usage() {
# GPU {{{
getgpu() {
case "$os" in
"Linux")
case "$os" in
"Linux")
gpu="$(PATH="/sbin:$PATH" lspci | grep -F "3D")"
# If a GPU with a prefix of '3D' doesn't exist
@ -958,23 +1031,11 @@ getgpu() {
gpu="${gpu/Advanced Micro Devices, Inc\. }"
gpu="${gpu/'[AMD/ATI]' }"
gpu="${gpu/Tahiti PRO}"
gpu="${gpu/Seymour}"
gpu="${gpu/Cayman}"
gpu="${gpu/Richland}"
gpu="${gpu/Pitcairn}"
gpu="${gpu/Broadway}"
gpu="${gpu/XTMobility}"
gpu="${gpu/Mobility}"
gpu="${gpu/Hawaii}"
gpu="${gpu/Tobago}"
gpu="${gpu/Thames}"
gpu="${gpu/Kabini}"
gpu="${gpu/Bonaire}"
gpu="${gpu/XTX}"
gpu="${gpu/ OEM}"
gpu="${gpu/ Cape Verde}"
gpu="${gpu/ \[}"
gpu="${gpu/\]}"
gpu="${gpu/*Radeon/Radeon}"
brand="AMD "
;;
@ -1105,6 +1166,12 @@ getgpu() {
;;
esac
if [ "$gpu_brand" == "off" ]; then
gpu="${gpu/AMD}"
gpu="${gpu/NVIDIA}"
gpu="${gpu/Intel}"
fi
gpu="${gpu}${count}"
}
@ -1141,7 +1208,10 @@ getmemory() {
*) memfree="$(($(vmstat | awk 'END{printf $5}') / 1024))" ;;
esac
memtotal="$(($(sysctl -n hw.physmem) / 1024 / 1024))"
case "$distro" in
"NetBSD"*) memtotal="$(($(sysctl -n hw.physmem64) / 1024 / 1024))" ;;
*) memtotal="$(($(sysctl -n hw.physmem) / 1024 / 1024))" ;;
esac
memused="$((memtotal - memfree))"
;;
@ -1208,20 +1278,42 @@ getsong() {
song="$(gpmdp-remote current)"
state="$(gpmdp-remote status)"
elif [ -n "$(ps x | awk '!(/awk/ || /Helper/) && /iTunes/')" ]; then
elif [ -n "$(ps x | awk '!(/awk/ || /Helper/ || /Cache/) && /iTunes.app/')" ]; then
song="$(osascript -e 'tell application "iTunes" to artist of current track as string & " - " & name of current track as string')"
state="$(osascript -e 'tell application "iTunes" to player state as string')"
elif [ -n "$(ps x | awk '!(/awk/) && /rhythmbox/')" ]; then
song="$(rhythmbox-client --print-playing)"
# Well, what can you expect? It's dbus after all.
state="$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 \
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string: 'PlayBackStatus' |\
awk -F 'string "' '{printf $2}')"
state="${state//\"}"
elif [ -n "$(ps x | awk '!(/awk/) && /banshee/')" ]; then
artist="$(banshee --query-artist | awk -F':' '{print $2}')"
title="$(banshee --query-title | awk -F':' '{print $2}')"
song="$artist - $title"
state="$(banshee --query-current-state | awk -F':' '{print $2}')"
elif [ -n "$(ps x | awk '!(/awk/) && /amarok/')" ]; then
artist="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {print $2}')"
title="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/title/ {print $2}')"
song="$artist - $title"
elif [ -n "$(ps x | awk '!(/awk/) && /deadbeef/')" ]; then
song="$(deadbeef --nowplaying '%a - %t')"
else
song="Not Playing"
fi
case "$state" in
"paused" | "PAUSE")
"paused" | "PAUSE" | "Paused")
song="Paused"
;;
"stopped" | "STOP")
"stopped" | "STOP" | "Stopped")
song="Stopped"
;;
esac
@ -1271,6 +1363,11 @@ getresolution() {
awk '/Resolution:/ {printf $2"x"$4" @ "$6"Hz, "}')"
fi
scale_factor="$(/usr/libexec/PlistBuddy -c "Print DisplayAnyUserSets:0:0:Resolution" /Library/Preferences/com.apple.windowserver.plist)"
[ "${scale_factor%.*}" == "2" ] && \
resolution="${resolution// @/@2x @}"
if [ "$refresh_rate" == "off" ]; then
resolution="${resolution// @ [0-9][0-9]Hz}"
resolution="${resolution// @ [0-9][0-9][0-9]Hz}"
@ -1309,7 +1406,7 @@ getstyle() {
name="gtk-theme-name"
gsettings="gtk-theme"
gconf="gtk_theme"
xfconf="ThemeName"
xfconf="/Net/ThemeName"
kde="widgetStyle"
;;
@ -1317,7 +1414,7 @@ getstyle() {
name="gtk-icon-theme-name"
gsettings="icon-theme"
gconf="icon_theme"
xfconf="IconThemeName"
xfconf="/Net/IconThemeName"
kde="Theme"
;;
@ -1325,7 +1422,7 @@ getstyle() {
name="gtk-font-name"
gsettings="font-name"
gconf="font_theme"
xfconf="FontName"
xfconf="/Gtk/FontName"
kde="font"
;;
esac
@ -1374,7 +1471,7 @@ getstyle() {
"Xfce"*)
type -p xfconf-query >/dev/null 2>&1 && \
gtk2theme="$(xfconf-query -c xsettings -p /Net/"$xfconf")"
gtk2theme="$(xfconf-query -c xsettings -p "$xfconf")"
;;
esac
@ -1474,7 +1571,7 @@ getterm() {
# Check $PPID for terminal emulator.
case "$os" in
"Mac OS X")
# Workaround for OS X systems that
# Workaround for macOS systems that
# don't support the block below.
case "$TERM_PROGRAM" in
"iTerm.app") term="iTerm2" ;;
@ -1500,12 +1597,14 @@ getterm() {
esac
case "${name// }" in
"${SHELL/*\/}" | *"sh" | "tmux" | "screen") getterm "$parent" ;;
"login" | "init") term="$(tty)"; term="${term/*\/}" ;;
"${SHELL/*\/}" | *"sh" | "tmux"* | "screen") getterm "$parent" ;;
"login" | "init") term="$(tty)" ;;
"ruby" | "1" | "systemd" | "sshd"* | "python"*) unset term ;;
"gnome-terminal-") term="gnome-terminal" ;;
*) term="$name" ;;
*) term="${name##*/}" ;;
esac
[ "$version" -ge 4 ] && term="${term^}"
}
# }}}
@ -1537,7 +1636,7 @@ gettermfont() {
;;
"termite")
termfont="$(awk -F '= ' '!/^($|#)/ && /font/ {printf $2; exit}' "${XDG_CONFIG_HOME}/termite/config")"
termfont="$(awk -F '= ' '!/^($|#|;)/ && /font/ {printf $2; exit}' "${XDG_CONFIG_HOME}/termite/config")"
;;
"mintty")
@ -1554,6 +1653,8 @@ gettermfont() {
termfont="${termfont/:*}"
;;
esac
[ "$version" -ge 4 ] && termfont="${termfont^}"
}
# }}}
@ -1575,7 +1676,7 @@ getdisk() {
"Mac OS X" | "BSD")
case "$distro" in
"FreeBSD"* | *"OS X"* )
"FreeBSD"* | *"OS X"* | "Mac"* )
df_flags="-l -H /"
df_dir="/"
;;
@ -1679,20 +1780,20 @@ getbattery() {
battery="$(envstat | awk '\\(|\\)' '/charge:/ {print $2}')"
battery="${battery/\.*/%}"
;;
"OpenBSD"* | "Bitrig"*)
battery0full="$(sysctl -n hw.sensors.acpibat0.watthour0)"
battery0full="${battery0full/ Wh*}"
battery0now="$(sysctl -n hw.sensors.acpibat0.watthour3)"
battery0now="${battery0now/ Wh*}"
[ "$battery0full" ] && \
battery="$((100 * ${battery0now/\.} / ${battery0full/\.}))%"
;;
esac
;;
"OpenBSD")
battery0full="$(sysctl -n hw.sensors.acpibat0.watthour0)"
battery0full="${battery0full/ Wh*}"
battery0now="$(sysctl -n hw.sensors.acpibat0.watthour3)"
battery0now="${battery0now/ Wh*}"
[ "$battery0full" ] && \
battery="$((100 * ${battery0now/\.} / ${battery0full/\.}))%"
;;
"Mac OS X")
battery="$(pmset -g batt | grep -o '[0-9]*%')"
battery_state="$(pmset -g batt | awk 'NR==2 {print $3}')"
@ -1793,7 +1894,7 @@ getbirthday() {
"BSD")
case "$distro" in
"OpenBSD"*)
"OpenBSD"* | "Bitrig"*)
birthday="$(ls -alctT / | awk '/lost\+found/ {printf $6 " " $7 " " $9 " " $8}')"
birthday_shorthand="on"
;;
@ -1840,14 +1941,15 @@ getbirthday() {
getcols() {
if [ "$color_blocks" == "on" ]; then
# Convert the width to space chars.
block_width="$(printf "%$((block_width-=1))s")"
block_width="$(printf "%${block_width}s")"
block_width="${block_width// /█}"
# Generate the string.
while [ $start -le $end ]; do
case "$start" in
[0-6]) blocks+="${reset}\033[3${start}m\033[4${start}m%${block_width}s" ;;
7) blocks+="${reset}\033[3${start}m\033[4${start}m%${block_width}s" ;;
*) blocks2+="\033[38;5;${start}m\033[48;5;${start}m%${block_width}s" ;;
[0-6]) blocks+="${reset}\033[3${start}m\033[4${start}m${block_width}" ;;
7) blocks+="${reset}\033[3${start}m\033[4${start}m${block_width}" ;;
*) blocks2+="\033[38;5;${start}m\033[48;5;${start}m${block_width}" ;;
esac
start="$((start+=1))"
done
@ -1861,7 +1963,7 @@ getcols() {
# Add newlines to the string.
cols="${cols%%'nl'}"
cols="${cols//nl/\\n${padding}}"
cols="${cols//nl/\\n${padding}}"
fi
}
@ -1894,6 +1996,7 @@ getwallpaper() {
# Strip quotes etc from the path.
img="${img/'file://'}"
img="${img//\'}"
img="${img//\%20/ }"
fi
;;
@ -1941,8 +2044,10 @@ getascii() {
ascii="${ascii_distro,,}"
fi
[ "$ascii_logo_size" == "small" ] && \
if [ "$ascii_logo_size" == "small" ]; then
ascii="${ascii/ *}_small"
prompt_loc="3"
fi
if [ -f "/usr/share/neofetch/ascii/distro/${ascii/ *}" ]; then
ascii="/usr/share/neofetch/ascii/distro/${ascii/ *}"
@ -2057,6 +2162,8 @@ getimage() {
[ "${#term_size}" -le 5 ] && err "Your terminal doesn't support \\\033[14t, falling back to ascii mode."
return
else
clear
fi
# Get terminal lines and columns
@ -2170,10 +2277,6 @@ getimage() {
img="$thumbnail_dir/$imgname"
}
takescrot() {
$scrot_cmd "${scrot_dir}${scrot_name}"
}
# }}}
# Find w3m-img {{{
@ -2209,6 +2312,9 @@ displayimage() {
if [ "$image" != "ascii" ]; then
case "$image_backend" in
"w3m")
# Add a tiny delay to fix issues with images not
# appearing in specific terminal emulators.
sleep 0.05
printf "%b%s\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$img\n4;\n3;" |\
$w3m_img_path 2>/dev/null || padding="\033[0C"
;;
@ -2242,6 +2348,48 @@ getimagebackend() {
# }}}
# Screenshot {{{
takescrot() {
$scrot_cmd "${scrot_dir}${scrot_name}"
[ "$scrot_upload" == "on" ] && scrot_upload
}
# }}}
# Screenshot Upload {{{
scrot_upload() {
if ! type -p curl >/dev/null 2>&1; then
printf "%s\n" "[!] Install curl to upload images"
return
fi
image_file="${scrot_dir}${scrot_name}"
printf "%s\n" "Uploading image..."
case "$image_host" in
"teknik")
image_url="$(curl -sf -F file="@${image_file}" "https://api.teknik.io/v1/Upload")"
image_url="$(awk -F 'url:|,' '{printf $2}' <<< "${image_url//\"}")"
;;
"imgur")
image_url="$(curl -sH "Authorization: Client-ID $imgur_client_id" -F image="@${image_file}" "https://api.imgur.com/3/upload")"
image_url="$(awk -F 'id:|,' '{printf $2}' <<< "${image_url//\"}")"
[ "$image_url" ] && image_url="https://i.imgur.com/${image_url}.png"
;;
esac
if [ "$image_url" ]; then
printf "%s\n" "$image_url"
else
printf "%s\n" "[!] Image failed to upload"
fi
}
# }}}
# }}}
# Text Formatting {{{
@ -2268,14 +2416,6 @@ info() {
# Trim whitespace
output="$(trim "$output")"
# Fix rendering issues with w3m and lines that
# wrap to the next line by adding a max line
# length.
if [ "$image" != "off" ] && [ "$image" != "ascii" ] && [ "$1" != "cols" ]; then
padding_num="${padding/\\033\[}"
output="$(printf "%.$((columns - ${padding_num/C} - gap - ${#subtitle}))s" "$output")"
fi
case "$1" in
title)
string="${title_color}${bold}${output}"
@ -2298,7 +2438,18 @@ info() {
[ -z "$2" ] && string="${string/*: }"
# Print the string
printf "%b%s\n" "${padding}${string}${reset}"
printf "%b%s\n" "${padding}${string}${reset} "
# Calculate info height
info_height="$((info_height+=1))"
# Fix rendering issues with w3m and lines that
# wrap to the next line by adding a max line
# length.
if [ "$image" != "off" ] && [ "$image" != "ascii" ] && [ "$1" != "cols" ]; then
padding_num="${padding/\\033\[}"
output="$(printf "%.$((columns - ${padding_num/C} - gap - ${#subtitle}))s" "$output")"
fi
}
# }}}
@ -2308,14 +2459,6 @@ info() {
prin() {
string="$1${2:+: $2}"
# Fix rendering issues with w3m and lines that
# wrap to the next line by adding a max line
# length.
if [ "$image" != "off" ] && [ "$image" != "ascii" ]; then
padding_num="${padding/\\033\[}"
string="$(printf "%.$((columns - ${padding_num/C} - gap))s" "$string")"
fi
# If $2 doesn't exist we format $1 as info
if [ -z "$2" ]; then
subtitle_color="$info_color"
@ -2330,7 +2473,18 @@ prin() {
string="$(trim "$string")"
# Print the info
printf "%b%s\n" "${padding}${string}${reset}"
printf "%b%s\n" "${padding}${string}${reset} "
# Calculate info height
info_height="$((info_height+=1))"
# Fix rendering issues with w3m and lines that
# wrap to the next line by adding a max line
# length.
if [ "$image" != "off" ] && [ "$image" != "ascii" ]; then
padding_num="${padding/\\033\[}"
string="$(printf "%.$((columns - ${padding_num/C} - gap))s" "$string")"
fi
}
# }}}
@ -2342,7 +2496,7 @@ getunderline() {
"on")
underline="$(printf %"$length"s)"
underline="${underline// /$underline_char}"
;;
;;
"off") underline="" ;;
esac
}
@ -2431,7 +2585,7 @@ colors() {
ascii_distro="mint"
;;
"LMDE"* | "Chapeau"* | "Android"*)
"LMDE"* | "Chapeau"* | "Bitrig"* | "Android"*)
setcolors 2 7
;;
@ -2439,7 +2593,7 @@ colors() {
setcolors 5 7
;;
"OpenBSD"*)
"OpenBSD"* | "GuixSD"*)
setcolors 3 7 6 1 8
;;
@ -2456,12 +2610,17 @@ colors() {
ascii_distro="puppy"
;;
"Sparky"*)
setcolors 1 7
ascii_distro="sparky"
;;
"Scientific"*)
setcolors 4 1 7
;;
"Solus"*)
setcolors 7 8
setcolors 7 4 0
;;
"Trisquel"* | "NixOS"* | "Zorin"*)
@ -2566,7 +2725,7 @@ bold() {
# Linebreak {{{
getlinebreak() {
linebreak=" "
linebreak=" "
}
# }}}
@ -2603,6 +2762,15 @@ err() {
# }}}
# Check for old flags {{{
checkoldflags() {
[ -n "$osx_buildversion" ] && err "\$osx_buildversion is deprecated, use \$distro_shorthand instead."
[ -n "$osx_codename" ] && err "\$osx_codename is deprecated, use \$distro_shorthand instead."
}
# }}}
# Get script directory {{{
getscriptdir() {
@ -2741,20 +2909,41 @@ kdeconfigdir() {
# Dynamic prompt location {{{
dynamicprompt() {
# Get cursor position
info_height="$(IFS=';' builtin read -srdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}")"
# Calculate image height in terminal cells.
# The '+ 3' adds a gap between the prompt and the content.
# The '+ 4' adds a gap between the prompt and the content.
[ "$image" != "ascii" ] && [ "$image" != "off" ] && \
lines="$((${height:-1} / ${font_height:-1} + 3))"
lines="$((${height:-1} / ${font_height:-1} + 4))"
# If the info is higher than the ascii/image place the prompt
# based on the info height instead of the ascii/image height.
[ "${lines:-0}" -lt "${info_height:-0}" ] && lines="$info_height"
if [ "${lines:-0}" -lt "${info_height:-0}" ]; then
lines="0"
else
lines="$((lines - info_height - 4))"
fi
# Set the prompt location
[ "$image" != "off" ] && printf "%b%s" "\033[${lines:-0}H"
[ "$image" != "off" ] && printf "\033[${lines/-*/0}B"
# Add some padding if the lines are above 0
if [ "$lines" -gt 0 ]; then
printf "\n\n"
fi
}
# }}}
# Scrot args {{{
scrot_args() {
scrot="on"
case "$2" in
"-"* | "") ;;
*)
scrot_name="${2##*/}"
scrot_dir="${2/$scrot_name}"
;;
esac
}
# }}}
@ -2774,9 +2963,7 @@ usage() { cat << EOF
in the output.
NOTE: You can supply multiple args. eg.
'neofetch --disable cpu gpu disk shell'
--osx_buildversion on/off Hide/Show Mac OS X build version.
--osx_codename on/off Hide/Show Mac OS X codename.
--os_arch on/off Hide/Show Windows architecture.
--os_arch on/off Hide/Show OS architecture.
--speed_type type Change the type of cpu speed to display.
Possible values: current, min, max, bios,
scaling_current, scaling_min, scaling_max
@ -2784,11 +2971,14 @@ usage() { cat << EOF
--cpu_shorthand type Shorten the output of CPU
Possible values: name, speed, tiny, on, off
--cpu_cores on/off Whether or not to display the number of CPU cores
--distro_shorthand on/off Shorten the output of distro (tiny, on, off)
NOTE: This is only possible on Linux, macOS, and Solaris
--kernel_shorthand on/off Shorten the output of kernel
--uptime_shorthand on/off Shorten the output of uptime (tiny, on, off)
--refresh_rate on/off Whether to display the refresh rate of each monitor
Unsupported on Windows
--gpu_shorthand on/off Shorten the output of GPU (tiny, on, off)
--gpu_brand on/off Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel)
--gtk_shorthand on/off Shorten output of gtk theme/icons
--gtk2 on/off Enable/Disable gtk2 theme/icons output
--gtk3 on/off Enable/Disable gtk3 theme/icons output
@ -2860,10 +3050,13 @@ usage() { cat << EOF
--ascii_logo_size Size of ascii logo.
Supported distros: Arch, Gentoo, Crux, OpenBSD.
--ascii_bold on/off Whether or not to bold the ascii logo.
--logo | -L Hide the info text and only show the ascii logo.
Screenshot:
--scrot /path/to/img Take a screenshot, if path is left empty the screen-
--scrot | -s /path/to/img Take a screenshot, if path is left empty the screen-
shot function will use \$scrot_dir and \$scrot_name.
--upload | -su /pth/t/img Same as --scrot but uploads the scrot to a website.
--image_host Website to upload scrots to. Takes: imgur, teknik
--scrot_cmd cmd Screenshot program to launch
Other:
@ -2892,7 +3085,7 @@ getargs() {
config="off"
;;
*"--config --"*) ;;
*"--config -"*) ;;
*"--config"*) config="off" ;;
esac
@ -2902,14 +3095,14 @@ getargs() {
case $1 in
# Info
--os_arch) os_arch="$2" ;;
--osx_buildversion) osx_buildversion="$2" ;;
--osx_codename) osx_codename="$2" ;;
--cpu_cores) cpu_cores="$2" ;;
--speed_type) speed_type="$2" ;;
--distro_shorthand) distro_shorthand="$2" ;;
--kernel_shorthand) kernel_shorthand="$2" ;;
--uptime_shorthand) uptime_shorthand="$2" ;;
--cpu_shorthand) cpu_shorthand="$2" ;;
--gpu_shorthand) gpu_shorthand="$2" ;;
--gpu_brand) gpu_brand="$2" ;;
--refresh_rate) refresh_rate="$2" ;;
--gtk_shorthand) gtk_shorthand="$2" ;;
--gtk2) gtk2="$2" ;;
@ -2927,7 +3120,7 @@ getargs() {
for func in "$@"; do
case "$func" in
"--disable") continue ;;
"--"*) return ;;
"-"*) return ;;
*) unset -f "get$func" ;;
esac
done
@ -2938,7 +3131,7 @@ getargs() {
unset colors
for arg in "$2" "$3" "$4" "$5" "$6" "$7"; do
case "$arg" in
"--"*) break ;;
"-"*) break ;;
*) colors+=($arg)
esac
done
@ -2975,10 +3168,10 @@ getargs() {
# Image
--image)
image="$2"
case "$2" in "--"* | "") image="ascii" ;; esac
case "$2" in "-"* | "") image="ascii" ;; esac
;;
--size) image_size="$2" ;;
--image_size | --size) image_size="$2" ;;
--crop_mode) crop_mode="$2" ;;
--crop_offset) crop_offset="$2" ;;
--xoffset) xoffset="$2" ;;
@ -2994,14 +3187,14 @@ getargs() {
--ascii)
image="ascii"
ascii="$2"
case "$2" in "--"* | "") ascii="distro" ;; esac
case "$2" in "-"* | "") ascii="distro" ;; esac
;;
--ascii_colors)
unset ascii_colors
for arg in "$2" "$3" "$4" "$5" "$6" "$7"; do
case "$arg" in
"--"*) break ;;
"-"*) break ;;
*) ascii_colors+=($arg)
esac
done
@ -3010,20 +3203,27 @@ getargs() {
--ascii_distro)
ascii_distro="$2"
case "$2" in "--"* | "") ascii_distro="$distro" ;; esac
case "$2" in "-"* | "") ascii_distro="$distro" ;; esac
;;
--ascii_logo_size) ascii_logo_size="$2" ;;
--ascii_bold) ascii_bold="$2" ;;
--logo | -L)
image="ascii"
printinfo() { info linebreak; }
;;
# Screenshot
--scrot | -s)
scrot="on"
if [ "$2" ]; then
scrot_name="${2##*/}"
scrot_dir="${2/$scrot_name}"
fi
scrot_args "$@"
;;
--upload | -su)
scrot_upload="on"
scrot_args "$@"
;;
--image_host) image_host="$2" ;;
--scrot_cmd) scrot_cmd="$2" ;;
# Other
@ -3062,7 +3262,7 @@ getargs() {
-v) verbose="on" ;;
-vv) set -x; verbose="on" ;;
--help) usage ;;
--version) printf "%s\n" "Neofetch 1.8"; exit ;;
--version) printf "%s\n" "Neofetch 1.9"; exit ;;
esac
shift
@ -3076,6 +3276,7 @@ getargs() {
main() {
getos
getdefaultconfig 2>/dev/null
checkoldflags
getargs "$@"
getdistro
@ -3089,9 +3290,6 @@ main() {
# If the script exits for any reason, unhide the cursor.
trap 'printf "\033[?25h"' EXIT
# Clear the scren
clear
# Hide the cursor and disable line wrap
printf "\033[?25l\033[?7l"
@ -3111,8 +3309,11 @@ main() {
displayimage
fi
# Move cursor to the top
printf "\033[0H"
# Set cursor position next to ascii art
printf "\033[$((${lines:-4} - ${prompt_loc:-4}))A"
# Reset horizontal cursor position
printf "\033[9999999D"
# Print the info
printinfo

View file

@ -19,14 +19,8 @@ NOTE: You can supply multiple args. eg.
.br
\'neofetch --disable cpu gpu disk shell\'
.TP
.B \--osx_buildversion 'on/off'
Hide/Show Mac OS X build version.
.TP
.B \--osx_codename 'on/off'
Hide/Show Mac OS X codename.
.TP
.B \--os_arch 'on/off'
Hide/Show Windows architecture.
Hide/Show OS architecture.
.TP
.B \--speed_type 'type'
Change the type of cpu speed to display.
@ -44,6 +38,11 @@ Possible values: name, speed, tiny, on, off
.B \--cpu_cores 'on/off'
Whether or not to display the number of CPU cores
.TP
.B \--distro_shorthand 'on/off'
Shorten the output of distro (tiny, on, off)
.br
NOTE: This is only possible on Linux, macOS, and Solaris
.TP
.B \--kernel_shorthand 'on/off'
Shorten the output of kernel
.TP
@ -57,6 +56,9 @@ Unsupported on Windows
.B \--gpu_shorthand 'on/off'
Shorten the output of GPU (tiny, on, off)
.TP
.B \--gpu_brand on/off
Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel)
.TP
.B \--gtk_shorthand 'on/off'
Shorten output of gtk theme/icons
.TP
@ -67,10 +69,10 @@ Enable/Disable GTK2 theme/icons output
Enable/Disable gtk3 theme/icons output
.TP
.B \--shell_path 'on/off'
Enable/Disable showing \$SHELL path
Enable/Disable showing $SHELL path
.TP
.B \--shell_version 'on/off'
Enable/Disable showing \$SHELL version
Enable/Disable showing $SHELL version
.TP
.B \--battery_num 'num'
Which battery to display, default value is 'all'
@ -222,12 +224,21 @@ Possible values: small, normal
.TP
.B \--ascii_bold 'on/off'
Whether or not to bold the ascii logo.
.TP
.B \--logo | -L
Hide the info text and only show the ascii logo.
.SH SCREENSHOT
.TP
.B \--scrot 'path'
Take a screenshot, if path is left empty the screenshot
function will use \$scrot_dir and \$scrot_name.
function will use $scrot_dir and $scrot_name.
.TP
.B \--upload | -su 'path'
Same as --scrot but uploads the scrot to a website.
.TP
.B \--image_host 'host'
Website to upload scrots to. Takes: imgur, teknik
.TP
.B \--scrot_cmd 'cmd'
Screenshot program to launch