mirror of
https://github.com/dylanaraps/pfetch.git
synced 2026-01-02 16:02:12 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b37bf9dd2 | ||
|
|
eb9c8a3cfe | ||
|
|
59340ff4ce | ||
|
|
68d2422a1b | ||
|
|
55b78b9e58 | ||
|
|
b7292e0cbc | ||
|
|
ba03cb3cf4 | ||
|
|
d91cd1c0bf |
@@ -32,9 +32,10 @@ _/\ __)/_) pkgs 130
|
||||
|
||||
- [ ] Add optional and additional information detection.
|
||||
- [ ] CPU
|
||||
- [ ] Terminal Emulator
|
||||
- [ ] Terminal Emulator ([#12](https://github.com/dylanaraps/pfetch/pull/12))
|
||||
- The way I implement this in `neofetch` is interesting.
|
||||
- [ ] Terminal colors
|
||||
- [x] Terminal colors ([commit](https://github.com/dylanaraps/pfetch/commit/ba03cb3cf4dfbc767abce6acd53c07ab5568e23d))
|
||||
- [ ] Window manager ([#13](https://github.com/dylanaraps/pfetch/pull/13))
|
||||
- [ ] ???
|
||||
- [ ] Expand operating system support.
|
||||
- [ ] Solaris ([#5](https://github.com/dylanaraps/pfetch/issues/5))
|
||||
@@ -46,7 +47,7 @@ _/\ __)/_) pkgs 130
|
||||
- [ ] CYGWIN
|
||||
- [ ] MSYS
|
||||
- [ ] MINGW
|
||||
- [ ] WSL (*this is fairly simple*)
|
||||
- [x] WSL (*this is fairly simple*)
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -58,7 +59,7 @@ _/\ __)/_) pkgs 130
|
||||
# Default: first example below
|
||||
# Valid: space separated string
|
||||
#
|
||||
# OFF by default: shell
|
||||
# OFF by default: shell palette
|
||||
PF_INFO="ascii title distro host kernel uptime pkgs memory"
|
||||
|
||||
# Example: Only ASCII.
|
||||
|
||||
68
pfetch
68
pfetch
@@ -154,6 +154,12 @@ get_os() {
|
||||
if command -v lsb_release; then
|
||||
distro=$(lsb_release -sd)
|
||||
|
||||
# lsb_release sometimes adds quotes around the output,
|
||||
# this simply remove quotes from the start/end if they
|
||||
# exist.
|
||||
distro=${distro##\"}
|
||||
distro=${distro%%\"}
|
||||
|
||||
else
|
||||
# Disable warning about shellcheck not being able
|
||||
# to read '/etc/os-release'. This is fine.
|
||||
@@ -165,6 +171,19 @@ get_os() {
|
||||
# don't follow any os-release/lsb standards whatsoever.
|
||||
command -v crux && distro=$(crux)
|
||||
command -v guix && distro='Guix System'
|
||||
|
||||
# Check to see if Linux is running in Windows 10 under
|
||||
# WSL (Windows subsystem for Linux) and append a string
|
||||
# accordingly.
|
||||
#
|
||||
# If the kernel version string ends in "-Microsoft",
|
||||
# we're very likely running under Windows 10 in WSL.
|
||||
#
|
||||
# This also acts as a means of allowing the user to
|
||||
# fake this by changing their kernel version to end in
|
||||
# "Microsoft".
|
||||
[ "${kernel%%*-Microsoft}" ] ||
|
||||
distro="$distro on Windows 10"
|
||||
;;
|
||||
|
||||
Darwin*)
|
||||
@@ -356,6 +375,10 @@ get_uptime() {
|
||||
}
|
||||
|
||||
get_pkgs() {
|
||||
# This is just a simple wrapper around 'command -v' to avoid
|
||||
# spamming '>/dev/null' throughout this function.
|
||||
has() { command -v "$1" >/dev/null; }
|
||||
|
||||
# This works by first checking for which package managers are
|
||||
# installed and finally by printing each package manager's
|
||||
# package list with each package one per line.
|
||||
@@ -376,27 +399,27 @@ get_pkgs() {
|
||||
case $os in
|
||||
Linux*)
|
||||
# Commands which print packages one per line.
|
||||
command -v kiss && kiss l
|
||||
command -v bonsai && bonsai list
|
||||
command -v pacman-key && pacman -Qq
|
||||
command -v dpkg && dpkg-query -f '.\n' -W
|
||||
command -v rpm && rpm -qa
|
||||
command -v xbps-query && xbps-query -l
|
||||
command -v apk && apk info
|
||||
has kiss && kiss l
|
||||
has bonsai && bonsai list
|
||||
has pacman-key && pacman -Qq
|
||||
has dpkg && dpkg-query -f '.\n' -W
|
||||
has rpm && rpm -qa
|
||||
has xbps-query && xbps-query -l
|
||||
has apk && apk info
|
||||
|
||||
# Directories containing packages.
|
||||
command -v brew && printf '%s\n' "$(brew --cellar)/"*
|
||||
command -v emerge && printf '%s\n' /var/db/pkg/*/*/
|
||||
command -v pkgtool && printf '%s\n' /var/log/packages/*
|
||||
has brew && printf '%s\n' "$(brew --cellar)/"*
|
||||
has emerge && printf '%s\n' /var/db/pkg/*/*/
|
||||
has pkgtool && printf '%s\n' /var/log/packages/*
|
||||
|
||||
# GUIX requires two commands.
|
||||
command -v guix && {
|
||||
has guix && {
|
||||
guix package -p /run/current-system/profile -I
|
||||
guix package -I
|
||||
}
|
||||
|
||||
# NIX requires two commands.
|
||||
command -v nix-store && {
|
||||
has nix-store && {
|
||||
nix-store -q --requisites /run/current-system/sw
|
||||
nix-store -q --requisites ~.nix-profile
|
||||
}
|
||||
@@ -404,11 +427,11 @@ get_pkgs() {
|
||||
|
||||
Darwin*)
|
||||
# Commands which print packages one per line.
|
||||
command -v pkgin && pkgin list
|
||||
command -v port && port installed
|
||||
has pkgin && pkgin list
|
||||
has port && port installed
|
||||
|
||||
# Directories containing packages.
|
||||
command -v brew && printf '%s\n' /usr/local/Cellar/*
|
||||
has brew && printf '%s\n' /usr/local/Cellar/*
|
||||
;;
|
||||
|
||||
FreeBSD*)
|
||||
@@ -576,6 +599,21 @@ get_memory() {
|
||||
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
|
||||
}
|
||||
|
||||
get_palette() {
|
||||
# Print the first 8 terminal colors. This uses the existing
|
||||
# sequences to change text color with a sequence prepended
|
||||
# to reverse the foreground and background colors.
|
||||
#
|
||||
# This allows us to save hardcoding a second set of sequences
|
||||
# for background colors.
|
||||
palette=" [7m$c1 $c2 $c3 $c4 $c5 $c6 $c7 "
|
||||
|
||||
# Print the palette with a newline before and after.
|
||||
# The '\033[%sC' moves the text to the right, the
|
||||
# length of the ascii art.
|
||||
printf '\n[%sC%s[m\n' "${ascii_width-1}" "$palette" >&6
|
||||
}
|
||||
|
||||
get_ascii() {
|
||||
# This is a simple function to read the contents of
|
||||
# an ascii file from 'stdin'. It allows for the use
|
||||
|
||||
Reference in New Issue
Block a user