Merge remote-tracking branch 'upstream/minix2' into minix (#549)

This commit is contained in:
Muhammad Herdiansyah 2016-12-19 10:38:12 +07:00
commit 61f21f8762
2 changed files with 32 additions and 13 deletions

View file

@ -3,7 +3,7 @@
- **[@konimex](https://github.com/konimex)**
- **[@iandrewt](https://github.com/iandrewt)**
- **[@jorgegonzalez](https://github.com/jorgegonzalez)**
- **[@z33ky](https://github.com/z33ky)**
## IRC
@ -69,7 +69,7 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques
**~~Birthday~~ Install Date**<br \>
- Renamed `get_birthday()` -- > `get_install_date()`
- Removed all `date` usage from `get_install_date()`.
- Removed all `date` usage from `get_install_date()`.
- Added a new function called `convert_time()` which takes the time stamped `ls` output and converts it to a pretty format. The function only uses bash so its much faster than calling `date`. This makes things simple and keeps the output consistent across all Operating Systems. Example: `2016-12-06 16:58:58.000000000` --> `Tue 06 Dec 2016 4:58 PM`
**Disk**<br \>
@ -93,6 +93,7 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques
- [cmus] Simplify block and fix `artistsort` bug.
- Removed `state` detection.
- Removed duplicate `dbus-send` commands.
- Added support for xmms2. **[@z33ky](https://github.com/z33ky)**
**Battery**<br \>

View file

@ -16,9 +16,8 @@ XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}"
export LC_ALL=C
export LANG=C
# Set PATH to binary directories only
# This solves issues with neofetch opening the pacman game.
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
# Add /usr/sbin and /sbin to PATH.
export PATH="/usr/sbin:/sbin:${PATH}"
# Set no case match.
shopt -s nocasematch
@ -379,6 +378,14 @@ get_uptime() {
}
get_packages() {
# Remove /usr/games from $PATH.
# This solves issues with neofetch opening the
# 'pacman' game.
local PATH=":${PATH}:"
local PATH="${PATH/':/usr/games:'/:}"
local PATH="${PATH%:}"
local PATH="${PATH#:}"
case "$os" in
"Linux" | "iPhone OS" | "Solaris")
type -p pacman >/dev/null && \
@ -498,6 +505,7 @@ get_shell() {
if [[ "$shell_version" == "on" ]]; then
case "${SHELL##*/}" in
"bash") shell+="${BASH_VERSION/-*}" ;;
"sh") ;;
"mksh" | "ksh")
shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')"
@ -1144,7 +1152,7 @@ get_memory() {
get_song() {
# This is absurdly long.
player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious|gnome-music|lollypop|clementine|pragha/ {printf $5 " " $6; exit}')"
player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious|xmms2d|gnome-music|lollypop|clementine|pragha/ {printf $5 " " $6; exit}')"
get_song_dbus() {
# Multiple players use an almost identical dbus command to get the information.
@ -1165,6 +1173,7 @@ get_song() {
"rhythmbox"*) song="$(rhythmbox-client --print-playing)" ;;
"deadbeef"*) song="$(deadbeef --nowplaying '%a - %t')" ;;
"audacious"*) song="$(audtool current-song)" ;;
"xmms2d"*) song="$(xmms2 current -f '${artist} - ${title}')" ;;
"gnome-music"*) get_song_dbus "GnomeMusic" ;;
"lollypop"*) get_song_dbus "Lollypop" ;;
"clementine"*) get_song_dbus "clementine" ;;
@ -1272,7 +1281,7 @@ get_resolution() {
height="$(wmic path Win32_VideoController get CurrentVerticalResolution /value)"
height="${height//CurrentVerticalResolution'='/}"
[[ "$width" ]] && resolution="${width}x${height}"
[[ "$(trim "$width")" ]] && resolution="${width}x${height}"
;;
"Haiku")
@ -1482,7 +1491,7 @@ get_term() {
case "${name// }" in
"${SHELL/*\/}" | *"sh" | "tmux"* | "screen" | "su") get_term "$parent" ;;
"login"* | *"Login"* | "init") term="$(tty)" ;;
"login"* | *"Login"* | "init" | "(init)") term="$(tty)" ;;
"ruby" | "1" | "systemd" | "sshd"* | "python"* | "USER"*"PID"*) unset term ;;
"gnome-terminal-") term="gnome-terminal" ;;
*) term="${name##*/}" ;;
@ -1543,10 +1552,16 @@ get_term_font() {
get_disk() {
type -p df >/dev/null 2>&1 || { err "Disk requires 'df' to function. Install 'df' to get disk info."; return; }
[[ "$os" == "Haiku" ]] && { err "Disk doesn't work on Haiku due to the non-standard 'df'"; return; }
# Get 'df' flags.
case "$os" in
"Haiku") err "Disk doesn't work on Haiku due to the non-standard 'df'"; return ;;
"Minix") df_flags=(-h) ;;
*) df_flags=(-P -h) ;;
esac
# Get the info for /
disks=($(df -P -h /)) || { err "Disk: 'df' exited with error code 1"; return; }
disks=($(df "${df_flags[@]}" /)) || { err "Disk: 'df' exited with error code 1"; return; }
# Put it all together
disk_perc="${disks[11]/'%'}"
@ -1622,7 +1637,7 @@ get_battery() {
"Windows")
battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining /value)"
battery="${battery/EstimatedChargeRemaining'='}"
[[ "$battery" ]] && battery+="%"
[[ "$(trim "$battery")" ]] && battery="%"
;;
"Haiku")
@ -1648,6 +1663,10 @@ get_local_ip() {
[[ -z "$local_ip" ]] && local_ip="$(ifconfig | awk '/broadcast/ {print $2}')"
;;
"MINIX")
local_ip="$(ifconfig | awk '{printf $3; exit}')"
;;
"Mac OS X" | "iPhone OS")
local_ip="$(ipconfig getifaddr en0)"
[[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)"
@ -2791,8 +2810,7 @@ get_term_padding() {
case "$term" in
"URxvt"*)
border="$(xrdb -query | grep -i "\(URxvt\|\*\)\.InternalBorder")"
border="${border/*:}"
border="$(xrdb -query | awk -F ':' '/^(URxvt|\*).internalBorder/ {printf $2; exit}')"
;;
esac
}