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)** - **[@konimex](https://github.com/konimex)**
- **[@iandrewt](https://github.com/iandrewt)** - **[@iandrewt](https://github.com/iandrewt)**
- **[@jorgegonzalez](https://github.com/jorgegonzalez)** - **[@jorgegonzalez](https://github.com/jorgegonzalez)**
- **[@z33ky](https://github.com/z33ky)**
## IRC ## IRC
@ -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. - [cmus] Simplify block and fix `artistsort` bug.
- Removed `state` detection. - Removed `state` detection.
- Removed duplicate `dbus-send` commands. - Removed duplicate `dbus-send` commands.
- Added support for xmms2. **[@z33ky](https://github.com/z33ky)**
**Battery**<br \> **Battery**<br \>

View File

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