Ticket #4571 (new enhancement)
Modernize user menu
Reported by: | eugenesan | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 4.8.33 |
Component: | mc-core | Version: | master |
Keywords: | Cc: | ||
Blocked By: | Blocking: | #2701, #3290, #3442 | |
Branch state: | no branch | Votes for changeset: |
Description
I've been working on modernizing the default user menu and decided to share it here.
First patch changes the default spacing in menu items.
The second patch:
- Removes archaic news and latex related items
- Reworks tarball options to support bare tarball, improve compressed tarballs
- Add support for regular archives (supported by 7z, which is most of them)
- Add support for compressing/un-compressing of more variants
- Add compression conversion
- Add hashing, git, vidir, ncdu, tail and mcdiff options
Feel free to adjust if I removed something people actually.
P.S.
From my previous experience using this ticket tracker, I never get notifications.
Do I need to do anything special to enable mail notifications for tickets?
P.P.S.
I chose mc-skin as a component. Wasn't sure where user menu fits.
Attachments
Change History
Changed 7 weeks ago by eugenesan
- Attachment 0001-menu-Reduce-menu-ittems-width-to-allow-longer-text.patch added
Changed 7 weeks ago by eugenesan
- Attachment 0001-menu-drop-archaic-and-add-modern-archival-options.patch added
comment:3 follow-up: ↓ 5 Changed 7 weeks ago by zaytsev
From my previous experience using this ticket tracker, I never get notifications.
I have fixed them in #4557 - are you still not getting anything?
comment:4 follow-up: ↓ 6 Changed 7 weeks ago by zaytsev
Few comments:
Compress the current subdirectory (tar.xz using 7z)
Why do you want to offer this alternative? (honest question)
sha512sum
At least on Mac this doesn't exist, can you use a fallback to shasum -a512 ?
comment:6 in reply to: ↑ 4 ; follow-up: ↓ 9 Changed 7 weeks ago by eugenesan
Replying to zaytsev:
Few comments:
Compress the current subdirectory (tar.xz using 7z)
Why do you want to offer this alternative? (honest question)
Some systems still use older XZ that is not multi-threaded. But even on systems with newer XZ, 7z is sill faster (especially if you use the "ASMC" compiled version). Also, in my local menu I add "-slp -m0=lzma2 -mx=9 -mfb=256 -md=256m -mlc=4 -ms=on" and get better compression but it was too much for default config ;-)
sha512sum
At least on Mac this doesn't exist, can you use a fallback to shasum -a512 ?
It should be trivial, assuming MacOS has the "which" command.
Is sha256sum also missing?
comment:7 Changed 7 weeks ago by eugenesan
Everyone,
If you look closely you will see that I switched to using "7z" instead of '7za', '7zz' etc.
The main reason is that Debian/Ubuntu? already switched from p7zip to 7zip and provide cli only using wrappers (7z, 7za, 7zr, p7zip), actual binaries are not even in the path.
Since I can't check all other Distros and OS's, could you please report which variants of '7z' are available on you system.
Thanks.
comment:8 Changed 7 weeks ago by zaytsev
It should be trivial, assuming MacOS has the "which" command. Is sha256sum also missing?
zaytsev@Yurys-MBP % which sha256sum sha256sum not found
Since I can't check all other Distros and OS's, could you please report which variants of '7z' are available on you system.
On macOS only 7zz is provided via the sevenzip homebrew package:
https://formulae.brew.sh/formula/sevenzip
On BSD I think 7z is provided via the p7zip port.
On Red Hat you have 7za via p7zip package.
You can check other distros yourself using the service from our friend Mykola:
comment:9 in reply to: ↑ 6 Changed 7 weeks ago by eugenesan
Attaching an updated version of the 2nd patch which minor fix and shasum hashing as a default, since it is a part of Perl and should be available by default on more systems(shaXXXsum is the fallback).
Will start working on 7z support on "all" systems.
Changed 7 weeks ago by eugenesan
- Attachment 0001-menu-drop-archaic-items-modernize-archival-options-v2.patch added
comment:10 Changed 7 weeks ago by eugenesan
I just reviewed all 7zip related code and '7za' is used in most places with fallback to 7z in some places and 7z/7zz/7zr in other.
This is what 7zip doc say:
Alone 7za.exe: Standalone version of 7-Zip console that supports only 7z/xz/cab/zip/gzip/bzip2/tar. Alone2 7zz.exe: Standalone version of 7-Zip console that supports all formats. Alone7z 7zr.exe: Standalone version of 7-Zip console that supports only 7z (reduced version)
Should we unify that with something like:
P7ZIP=`which 7zz 2>/dev/null` || P7ZIP=`which 7z 2>/dev/null` || P7ZIP=`which 7za 2>/dev/null`
Here is my reasoning:
'7zz' should be the first option since it is an ASM optimized pre-built binary with complete format support
'7z' Non-ASM built equivalent of 7zz and is the default on most modern Linux systems
'7za' if available, is the binary that should support all uses on older and systems with p7zip systems
I think we can drop '7zr' since it is only suitable for .7z archives and I believe no distro/os shipping it alone.
P.S.
I am suprised Fedora and Arch do not ship 7zip package...
comment:11 Changed 7 weeks ago by eugenesan
I am attaching a new version of the main (second) patch.
It still uses the default '7z' (until we decide which variant to use).
I also added an option to use ENV variable for compression options.
Those are the values I set in my .profile if anyone is interested:
export COMPRESS_OPTS_7Z="-slp -myx=9 -mx=9 -mfb=256 -md=256m -mlc=4" export COMPRESS_OPTS_ZSTD="--long --ultra -22"
P.S.
I am having difficulties understanding what "+' and '=' conditions are supposed to do.
By reading documentation, it looks like '+' is only for "showing" menu items and '=' enables/disables the item. But, it doesn't work as I understand it.
It would be nice if anyone could explain how those should be used.
Changed 7 weeks ago by eugenesan
- Attachment 0001-menu-drop-archaic-items-modernize-archival-options-v4.patch added
Changed 6 weeks ago by eugenesan
- Attachment 0001-menu-drop-archaic-items-modernize-archival-options-v5.patch added
New version of the patch with 7z binary detection and various fixes
Changed 6 weeks ago by eugenesan
- Attachment 0001-menu-drop-archaic-items-modernize-archival-options-v6.patch added
Updated version of the main patch with more compression options, fixes, improvments and shortcuts reorganization
Changed 6 weeks ago by eugenesan
- Attachment 0001-menu-optional-gui-tools.patch added
Optional patch to add various GUI tools
comment:12 Changed 5 weeks ago by andrew_b
Related to #3290.
Changed 2 weeks ago by eugenesan
- Attachment 0001-menu-drop-archaic-items-modernize-archival-options-v7.patch added
Updated version of the main patch with various fixes
comment:16 Changed 2 weeks ago by zaytsev
We had a discussion recently about using command -v instead of which:
https://github.com/search?q=repo%3AMidnightCommander%2Fmc%20%22command%20-v%22&type=code
Otherwise I don't have much to say / strong opinions about menus. I use them very rarely. Are you finished with your work eugenesan?
Andrew, maybe we can take it, apparently it will close a number of open requests like you linked. I can make a branch.
Changed 2 weeks ago by eugenesan
- Attachment 0001-menu-drop-archaic-items-modernize-archival-options-v8.patch added
Updated version of the main patch with "which" replacement and shasum preference reversal (non-perl version is 2x faster)
comment:17 Changed 2 weeks ago by eugenesan
@zaytsev
I've uploaded a new version with "which" replaced.
I believe the patch is ready and tested.
We still have time before next release, in case people will report bugs.
P.S.
I was wondering, can anyone think of a simple way to pass a shell variable from menu "scriptlet" to input dialog (https://github.com/MidnightCommander/mc/blob/449917f5a4198cc881463e29a5f7b1d0a3e9d19e/src/usermenu.c#L489)?
That would allow to replace all the "echo"/"read" interactions for menu commands with proper input dialog.
comment:18 Changed 2 weeks ago by zaytsev
I was wondering, can anyone think of a simple way to pass a shell variable from menu "scriptlet" to input dialog
The dialogs are shown before the script is "compiled" to run in the shell. So you cannot do it unless we make a "zenity" mode for mc and the scripts can call mc to show an overlay dialog :) But I'm not sure this is really necessary. You can just say something like press enter for default (basename)... I don't think the variable values add much value.
comment:19 follow-up: ↓ 20 Changed 2 weeks ago by zaytsev
Those are the values I set in my .profile if anyone is interested
Actually there are official variables XZ_OPT & ZSTD_OPT - is there any particular reason why you use your own?
comment:20 in reply to: ↑ 19 Changed 2 weeks ago by eugenesan
Replying to zaytsev:
Those are the values I set in my .profile if anyone is interested
Actually there are official variables XZ_OPT & ZSTD_OPT - is there any particular reason why you use your own?
Good point.
According to https://github.com/facebook/zstd/blob/dev/programs/README.md ZSTD offers only ZSTD_CLEVEL and I needed to pass other options. 7zip lacks envvar support completely.
I'd name those differently but didn't want interference and variables cannot start with a number so 7Z_OPT wasn't an option.
I needed a way to be able to change default compression options but didn't want to push those in usermenu directly. Those variable are harmless but can be very useful in usermenu context.
Maybe we should rename those to MC_MENU_*_OPT?
Also, I found a last minute bug and will be pushing a new patch momentarily.
Changed 2 weeks ago by eugenesan
- Attachment 0001-menu-drop-archaic-items-modernize-archival-options-v9.patch added
Last minute fix
Changed 2 weeks ago by eugenesan
Latest optional patch with addition of GUI tools