Commit Graph
88 Commits
Author SHA1 Message Date
phundrak 9e6fecc94a Fix battery detection for non-Linux systems
Some non-Linux systems do not have a `/sys/` directory. Therefore,
check it only if we are in a Linux system.

Fixes #19
2022-01-05 19:02:05 +01:00
phundrak 20d0682f39 Separate functions getting memory info for Darwin and NetBSD systems
Fixes #17
2022-01-04 20:00:52 +01:00
phundrak d248447cb0 Add macOS versions
Add support for Mac OS X 10.0 to 10.4
Add support for macOS Monterey
2021-12-21 10:44:47 +01:00
phundrak 36b964a993 Merge fix/locale-non-posix-shells into master
commit 8a18bcd346fc146e104f77d3a3362a52db210bc3
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Tue Dec 21 00:06:45 2021 +0100

    Change `eshell-info-banner--shell-command-to-string' to function

    `eshell-info-banner--shell-command-to-string' being a macro causes
    problems in at least `eshell-info-banner--get-memory-unix'.
    This commit makes `eshell-info-banner--shell-command-to-string' a
    regular function.

commit 981b42c3f530a314990b0d69a6efa9f0bb4957dc
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Mon Dec 20 23:29:17 2021 +0100

    Fix variables preceeding commands on non-POSIX shells

    This commit introduces a fix to run commands only on POSIX-compliant
    shells defined in the new constant `eshell-info-banner--posix-shells'.
    If any is found on the machine, the command will be run through it,
    otherwise it will default to `sh'.

commit 364e0f5189471ca3d568638144c208a255808e76
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Mon Dec 20 23:12:15 2021 +0100

    Fix setting locale when the default shell is non-POSIX compliant

    In some cases, the default shell does not accept any environment
    variables preceeding the command, such as:

        LANG=C uptime

    For instance, tcsh on DragonFly BSD reports

        LANG=C: Command not found.

    This commit makes the command run on bash, zsh, or sh.
2021-12-21 00:12:41 +01:00
phundrak 661ae7c87d Remove REMOTE arg from `eshell-info-banner--executable-find'
`eshell-info-banner--executable-find' now only acts according to the
user’s preferences set with `eshell-info-banner-tramp-aware'.
2021-12-20 23:11:44 +01:00
phundrak 382bb55064 Add support for RAM detection in NetBSD
Squashed commit of the following:

commit e11e3cbbd04c9c693d6e48f72e9ea99b64a83556
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Sun Dec 19 18:34:09 2021 +0100

    Multiply by 2014 to go from Kilobytes to Bytes

commit 786c9bbfdfd8a1fc6d6b21ea92ac8252b9dd0a50
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Sun Dec 19 18:23:21 2021 +0100

    Read in /proc/meminfo to get used/available memory

    Apparently NetBSD doesn’t properly implement hw.usermem.
    Also it needs to read hw.physmem64 instead of hw.physmem with sysctl

commit c9e7b8cadfcbfb877f180a9c89ee9d87f271d17c
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Sun Dec 19 17:50:24 2021 +0100

    Why doesn’t `last' return the last /element/?

commit f2248810132813191ebdd11f739d24bcc49f3165
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Sun Dec 19 17:46:33 2021 +0100

    Fix RAM detection on NetBSD
2021-12-19 18:35:59 +01:00
phundrak a2f24e4633 Merge feature/file-size-flavor into master
commit 31684ffc39217b55f775bc35b7409baf2d394bcc
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Sun Dec 19 17:15:39 2021 +0100

    Fix usage of wrong types

    Use numbers and not human-readable file sizes

commit 4627e491bff2257cf37136f00fcd2b0d2bae7279
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Sun Dec 19 17:11:10 2021 +0100

    Remove unused function

commit aea999276baad7112feb3e7868be4881af362240
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Sun Dec 19 17:11:00 2021 +0100

    Fix undefined function

commit 8afaabd33f1e7a7f0d991b72a1e4f8cb492c153b
Author: Lucien Cartier-Tilet <lucien@phundrak.com>
Date:   Sun Dec 19 16:53:16 2021 +0100

    Introduce `eshell-info-banner-file-size-flavor' custom option

    This custom variable can hold three different values:
    - nil
    - si
    - iec
    This value is passed to `file-size-human-readable', see its
    documentation for more information on the effect of this variable.

    Since the value `iec' introduces an additional character in the size
    displayed, some code is reorganized in order to keep the banner’s size
    by reducing the length of the progress bar.

    Some duplicate code is also merged in the new
    `eshell-info-banner--progress-bar-without-prefix' function.

    Update the README to reflect these changes.

    The `Customizing' heading is now separated in two:
    - one subheading for custom variables
    - one subheading for faces
2021-12-19 17:19:42 +01:00
phundrak 89f78f023a Fix uptime detection on NetBSD 2021-12-19 13:48:34 +01:00
phundrak 6ec3280a8d Add documentation on new function 2021-12-19 00:17:27 +01:00
phundrak 257ece43e6 Fix extra argument for executable-find with older versions of Emacs 2021-12-19 00:15:06 +01:00
phundrak 0c9e6de3ee Add Android Support 2021-12-18 18:46:11 +01:00
phundrak 76d87e4325 Fix error when directory /sys is not readable by the user 2021-12-18 17:48:26 +01:00
phundrak 6e90f02988 Bump version, change homepage 2021-12-18 16:31:27 +01:00
phundrak 08d7bc42da Add Melpa Stable badge 2021-12-18 16:30:27 +01:00
phundrak c8073faa88 Add support for Bedrock Linux and Proxmox 2021-12-18 16:24:32 +01:00
phundrak 9b75d19451 Add new macOS Big Sur versions 2021-11-19 19:06:43 +01:00
phundrak 81181090df Bump version 2021-11-19 18:55:26 +01:00
phundrak 0bd70d0d0f Fix df-related code 2021-11-19 18:38:24 +01:00
phundrak 312f1e3da3 Update link in REAMDE 2021-11-15 10:14:29 +01:00
phundrak a43818569d Fix value type issue in `eshell-info-banner--get-memory-gnu' 2021-11-15 10:14:29 +01:00
phundrak 517b9d705c Update README, package is now in melpa
Update recipes for installing package

Add MELPA badge
2021-11-15 10:14:29 +01:00
phundrak 33684943c3 Fix license issue
While the code indicates its license is GLP-3.0-or-later, the
LICENSE.md file indicated GPL-3.0-only. This commit changes the
LICENSE file so make it compatible with the code’s license.
2021-11-11 00:07:13 +01:00
phundrak 60daf22d32 Remove dash.el dependency 2021-11-10 19:52:15 +01:00
phundrak 36d1b981be Fix package-lint, checkdoc and byte-compile errors
Fix byte-compile and package-lint errors as mentionned here
https://github.com/melpa/melpa/pull/7790#issuecomment-962727545

Fix a docstring that was too long, quoted `eshell-info-banner' in
three other docstrings.

Renaming functions may have introduced some breaking changes, hence
the update on the REAME. Since these were breaking changes, this
commit removes two functions as well which weren’t used internally
anymore.
2021-11-08 13:41:41 +01:00
phundrak 6dc46a1ab9 Merge pull request #13 from syohex/byte-compile-warning
Fix byte-compile issues
2021-11-07 12:58:43 +01:00
phundrak 48470a4b85 Simplify code retrieving partitions between GNU and Darwin systems
Also bump revision number
2021-11-07 00:08:08 +01:00
phundrak b2eff90711 Enforce LANG=C for all shell-command-to-string calls 2021-11-07 00:08:08 +01:00
phundrak 0a8a340260 Add OS name detection for BSD OSes, memory improvements for UNIX
Simpler function for UNIX systems, including macOS.

Bump to 0.6
2021-11-07 00:08:01 +01:00
phundrak 41222b5f89 Add error handling in case of an unknown OS, warn instead of message
Warn the user if something goes wrong instead of just a message in the
minibuffer and the *Message* buffer.
2021-11-06 23:09:54 +01:00
phundrak 27ae353336 Add installation method in the README 2021-07-13 17:57:09 +02:00
phundrak cebb21818e Add macOS versions and fallback value, close #11 2021-07-09 19:22:52 +02:00
phundrak 718663f50d Better memory display 2021-06-18 19:29:06 +02:00
phundrak d35516a354 Better Windows support for partition detection with duf 2021-06-18 19:26:16 +02:00
phundrak 1635241762 Add new partitions detection method through duf
eshell-info-banner will now default to duf if it is installed and
avaliable on the system, otherwise it will default to
platform-specific implementation.
2021-06-18 18:38:11 +02:00
phundrak 6a043f6c19 Add versions custom variables were introduced in, minor fixes
All custom variables now have the package version in which they were
introduced specified.

This commit fixes a small typo in the documentation of
`eshell-info-banner--abbr-path'

Remove a leftover line used for debugging
2021-06-18 18:11:02 +02:00
phundrak e3461e6f99 README update, add CONTRIBUTING
Remove upcoming changes since nothing backward-incompatible is
upcoming, and OS and Linux distro support is already specified in
pinned issue.
2021-05-23 02:15:12 +02:00
phundrak 8b72edda09 Upgrade Emacs minimum version required
seq.el became part of Emacs with Emacs 25.1 and is used in the code,
hence the upgrade
2021-05-23 00:32:18 +02:00
phundrak 913120fae5 Rename function, and set locale for `vm_stat' 2021-05-23 00:07:00 +02:00
phundrak 46ada1b264 Add RAM detection support for macOS 2021-05-22 23:48:36 +02:00
phundrak 508c6883fe Bump revision version, fix newline display after memory
If memory usage is not displayed, a newline was still inserted. This
commit fixes this.
2021-05-22 04:30:34 +02:00
phundrak 3934c4e472 Add partition detection to macOS and OSX 2021-05-22 04:26:33 +02:00
phundrak 2a6f8bea29 Manage one more case of -p' not accepted as uptime' switch 2021-05-22 04:15:27 +02:00
phundrak 0f39c31884 Add partial support for Mac, Guix, improve Windows OS detection
This commit adds detection of the current OSX or macOS version.

It also adds support for non-standard Guix SD Linux distribution.

Windows OS detection is improved, with a separation of the name of the
version of Windows and its build number, the latter is treated as the
kernel version of Windows.
2021-05-22 03:59:08 +02:00
phundrak f5b5ebccc7 Preliminary rewrite of OS detection 2021-05-22 01:29:12 +02:00
phundrak e78aaa41f9 Handle case where battery is incorrectly detected
On my Windows VM, `battery' reported a battery as present but with a
charge of `N/A' percents. This commit handle this case as no battery
present.
2021-05-22 01:25:42 +02:00
phundrak be0c8859d6 Simpler way of getting the kernel name 2021-05-22 00:31:11 +02:00
phundrak 964d4bfe4c Make uptime detection more portable 2021-05-22 00:20:46 +02:00
phundrak 84294cb12c Code formatting, version revision bump
Making shorter lines
2021-05-22 00:20:35 +02:00
phundrak e9136b77cd Better regex for battery level detection
Detect the battery level, whether or not it is followed by decimals
2021-05-21 21:12:27 +02:00
phundrak 763d459a9e Make eshell-info-banner more portable
Memory detection and partition detection now relies of the operating
system detection of Emacs to know whether it can run or not. Also,
this is cleaning up a lot the function `eshell-info-banner', and I
think I will continue cleaning it up even more in the future.
2021-05-17 17:58:37 +02:00
phundrak a3e6aebac3 Reorganize comments, add page breaks, swap from variable to function
Old one-line comments that used to separate parts of the file are now
on three lines, while one-line comments are a sort of subsection of
these new big sections.

Page breaks will make it easier to navigate the code source.

Variable `system-name' is obsolete and is replaced by a function with
the same name.
2021-05-17 17:42:44 +02:00
phundrak 1b06956235 Mark custom variables with :safe option 2021-05-17 17:14:43 +02:00
phundrak 6463265938 Merge branch 'main' of github.com:Phundrak/eshell-info-banner.el 2021-05-15 21:04:37 +02:00
phundrak 6ea9c74a4e Remove paragraph on upcoming changes already made 2021-05-15 21:03:23 +02:00
phundrak 7ddb41ed3e Merge pull request #8 from juergenhoetzel/leverage-reduce
Leverage -reduce-from function
2021-05-15 21:00:25 +02:00
phundrak e3b230f881 Bump version 2021-05-15 20:56:47 +02:00
phundrak 94ebf5b5cc README formatting fix 2021-05-15 20:40:55 +02:00
phundrak e7092c5846 Customize which partitions to show, close #9
New variable `eshell-info-banner-partition-prefixes' now allows for
finer filtering of user partitions.
2021-05-15 20:35:22 +02:00
phundrak 624256442f Fix documentation formatting 2021-05-15 20:34:17 +02:00
phundrak 999f170337 README update
Update information on OS support

Add information on new custom variable
2021-05-14 10:33:07 +02:00
phundrak c2c7093c58 Merge pull request #7 from juergenhoetzel/tramp
Use tramp aware functions and paths
2021-05-14 10:24:57 +02:00
phundrak 6217784057 Merge pull request #6 from bkaestner/main
Add Windows version detection
2021-05-07 15:19:06 +02:00
phundrak 5841c7f711 Remove leftover from debugging 2021-05-02 18:15:09 +02:00
phundrak bb7cf0eab4 Merge pull request #5 from juergenhoetzel/locale
Use C locale for external processes to prevent parsing issues
2021-05-02 18:14:17 +02:00
phundrak b5f6d66578 Add gitignore 2021-05-02 17:59:32 +02:00
phundrak 2ed6b68d1a Bump version, add Github link 2021-05-02 17:57:35 +02:00
phundrak 3ebb3a65fe Merge pull request #2 from bkaestner/main
Use alternatives for /etc/os-release
2021-05-02 14:02:01 +02:00
phundrak 1c3c31ace7 Merge pull request #3 from juergenhoetzel/undefine-funtions
Replace undefined functions length= and length> with Emacs builtins
2021-05-01 15:34:46 +02:00
phundrak 6ad83f2a0d Bump package version, add upcoming changes in README
I forgot to bump the package version in the previous commits orz
2021-04-30 16:59:42 +02:00
phundrak 1b7ed9e9c8 Add battery level to header 2021-04-29 23:59:56 +02:00
phundrak 7054b08123 Some more instructions on customization 2021-04-29 23:05:31 +02:00
phundrak 77f90dd35e Update screenshot to fixed version of package 2021-04-29 22:03:17 +02:00
phundrak eaddd07e87 Fix shortening paths 2021-04-29 22:00:54 +02:00
phundrak ba99c6cfa7 Fix README’s headings 2021-04-29 21:58:20 +02:00
phundrak d780c3ffde Add README 2021-04-29 21:57:30 +02:00
phundrak 872bee6a9f Add GPL-3.0 License 2021-04-29 21:57:19 +02:00
phundrak 4f34968363 Remove unused variable, fix default values, add autoload 2021-04-29 21:56:53 +02:00
phundrak 0974464af2 Fix package requirements 2021-04-29 21:56:30 +02:00
phundrak ccb4bf0c36 Add autoload, banner updater and correct require 2021-04-29 20:07:16 +02:00
phundrak 3d3e2b3bbe Display of memory and partitions added!
FIXME: Wrong face used, warning instead of critical
2021-04-29 20:03:02 +02:00
phundrak 4b592a1f9e Preliminary banner written, rest should be written easily
Ensures there will always be space for OS, kernel, uptime and hostname
information. Padding works well.

Now, I need to work on the progress bars with the memory and the
partitions.

I might add later a bar for the battery.
2021-04-29 19:42:18 +02:00
phundrak f6caf18f19 Actually respect user’s choice of percentages 2021-04-29 14:19:24 +02:00
phundrak a7017ac0e1 Shorten paths only when needed 2021-04-29 14:19:05 +02:00
phundrak 1914b7d0c2 Fix issue with last element in path shortened 2021-04-29 14:18:34 +02:00
phundrak c40d13a0fd Add constant for path shortening 2021-04-29 14:17:51 +02:00
phundrak dab66a1c92 Add FIXME 2021-04-29 12:30:08 +02:00
phundrak 37656ed83c Better string formatting, add partition display
FIXME: All elements in a path are shortened even if not necessary
2021-04-29 12:28:07 +02:00
phundrak ed7319bd09 Initial commit, most code is already written 2021-04-29 12:08:52 +02:00