README.md | 8 ++++++-- noice.c | 27 +++++++++++++++++---------- diff --git a/README.md b/README.md index d4faa30d1a730b78ba365396ac220a7083f8f2da..3c1d664a07c2f1fd45f8863cfce442059e9440dd 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ - Open files with default-associated programs - Jump to home directory - Filter contents in current directory - Show/hide hidden files -- Sort entries by time modified (newest to oldest) +- Sort entries by modification time (newest to oldest) - Spawn a shell in current directory - Run `top` - Open a file with `vim` or `less` @@ -44,7 +44,11 @@ ### Fork toppings - Behaviour and navigation - - Detail view with file type, size and number of entries in dir (default: disabled) + - Detail view (default: disabled) with: + - file type + - modification time + - human-readable file size + - number of entries in current directory - Case-insensitive alphabetic content listing instead of upper case first - Roll over at the first and last entries of a directory (with Up/Down keys) - Sort entries by file size (largest to smallest) diff --git a/noice.c b/noice.c index 61af0e0a64f299b1c026ab6566755032c6d85bef..0446082f8b23d4b89420959045215ba8750c85d2 100644 --- a/noice.c +++ b/noice.c @@ -17,6 +17,7 @@ #include #include #include #include +#include #include "util.h" @@ -452,24 +453,30 @@ void printent_long(struct entry *ent, int active) { + static char buf[18]; + static struct tm *p; + + p = localtime(&ent->t); + strftime(buf, 18, "%b %d %H:%M %Y", p); + if (S_ISDIR(ent->mode)) - printw("%s%-32.32s D\n", active ? CURSR : EMPTY, ent->name); + printw("%s%-32.32s D %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf); else if (S_ISLNK(ent->mode)) - printw("%s%-32.32s L\n", active ? CURSR : EMPTY, ent->name); + printw("%s%-32.32s L %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf); else if (S_ISSOCK(ent->mode)) - printw("%s%-32.32s S\n", active ? CURSR : EMPTY, ent->name); + printw("%s%-32.32s S %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf); else if (S_ISFIFO(ent->mode)) - printw("%s%-32.32s F\n", active ? CURSR : EMPTY, ent->name); + printw("%s%-32.32s F %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf); else if (S_ISBLK(ent->mode)) - printw("%s%-32.32s B\n", active ? CURSR : EMPTY, ent->name); + printw("%s%-32.32s B %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf); else if (S_ISCHR(ent->mode)) - printw("%s%-32.32s C\n", active ? CURSR : EMPTY, ent->name); + printw("%s%-32.32s C %-18.18s\n", active ? CURSR : EMPTY, ent->name, buf); else if (ent->mode & S_IXUSR) - printw("%s%-32.32s E %s\n", active ? CURSR : EMPTY, ent->name, - coolsize(ent->size)); + printw("%s%-32.32s E %-18.18s %s\n", active ? CURSR : EMPTY, ent->name, + buf, coolsize(ent->size)); else - printw("%s%-32.32s R %s\n", active ? CURSR : EMPTY, ent->name, - coolsize(ent->size)); + printw("%s%-32.32s R %-18.18s %s\n", active ? CURSR : EMPTY, ent->name, + buf, coolsize(ent->size)); } int