Building MMview, a universal file viewer
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Building MMview, a universal file viewer
This recent thread about the undocumented chooser widget brought up the question: What can it be used for?
Not much, as it seems. Among the only 7 scripts in Slacko 5.6 which use it, only Nathan's wallpaper app uses it for image previews. All others use it as a simple file picker.
I take this as a challenge to build something more useful.
Ever since I used TotalCommander, a 2-pane file manager, I liked the Quickview feature: A file list in one pane and the content of the selected file in the other pane. For image files it would be a representation of the image, for text files it would be the file content, for zip files the content of the zip container. With add-ons other file formats may be readable/viewable.
Main Features of MMview
Supports common text formats
Supports most image formats, incl. RAW formats
Supports common audio/video formats (displays metadata, requires ffprobe or avprobe)
Supports common file compression formats
Supports eBook format EPUB
Supports directories (displays disk usage, sizes of subdirectories)
Supports executables (displays usage message)
Supports virtual files in /proc and /sys (for geeks!)
Search text in files
Command line interface
File create/rename/move/copy/delete
Horizontal or vertical layout
Fullscreen mode
Line wrapping
Line numbers
Can display character codes and Unicode names of any text selection
Can display file properties, MD5 checksums, ID3 tags of audio files
Can display image metadata (Exif, IPTC , XMP)
Can play audio files (requires ffplay or avplay)
Can play video files in separate window (requires ffplay or avplay)
Displays full paths, MIME types and charsets
Starts with last used directory and last used window size
Provides keyboard shortcuts for most actions
ROX-Filer compatible: "Open With ..." menu
ROX-Filer compatible: Shift+! opens shell command box
ROX-Filer compatible: Dblclick or Enter/Space key opens file in its default application
Built-in standard features (but nevertheless noteworthy)
Drag'n'drop from Chooser to Desktop: Creates desktop shortcut
Drag'n'drop from Chooser to ROX-Filer: Copies file (while pressing Shift: moves file)
Drag'n'drop from ROX-Filer to Chooser: Jumps to the file in list (changes chooser's directory as needed)
Entering first letter of a file name jumps to the file in list
Changelog
Not much, as it seems. Among the only 7 scripts in Slacko 5.6 which use it, only Nathan's wallpaper app uses it for image previews. All others use it as a simple file picker.
I take this as a challenge to build something more useful.
Ever since I used TotalCommander, a 2-pane file manager, I liked the Quickview feature: A file list in one pane and the content of the selected file in the other pane. For image files it would be a representation of the image, for text files it would be the file content, for zip files the content of the zip container. With add-ons other file formats may be readable/viewable.
Main Features of MMview
Supports common text formats
Supports most image formats, incl. RAW formats
Supports common audio/video formats (displays metadata, requires ffprobe or avprobe)
Supports common file compression formats
Supports eBook format EPUB
Supports directories (displays disk usage, sizes of subdirectories)
Supports executables (displays usage message)
Supports virtual files in /proc and /sys (for geeks!)
Search text in files
Command line interface
File create/rename/move/copy/delete
Horizontal or vertical layout
Fullscreen mode
Line wrapping
Line numbers
Can display character codes and Unicode names of any text selection
Can display file properties, MD5 checksums, ID3 tags of audio files
Can display image metadata (Exif, IPTC , XMP)
Can play audio files (requires ffplay or avplay)
Can play video files in separate window (requires ffplay or avplay)
Displays full paths, MIME types and charsets
Starts with last used directory and last used window size
Provides keyboard shortcuts for most actions
ROX-Filer compatible: "Open With ..." menu
ROX-Filer compatible: Shift+! opens shell command box
ROX-Filer compatible: Dblclick or Enter/Space key opens file in its default application
Built-in standard features (but nevertheless noteworthy)
Drag'n'drop from Chooser to Desktop: Creates desktop shortcut
Drag'n'drop from Chooser to ROX-Filer: Copies file (while pressing Shift: moves file)
Drag'n'drop from ROX-Filer to Chooser: Jumps to the file in list (changes chooser's directory as needed)
Entering first letter of a file name jumps to the file in list
Changelog
- Attachments
-
- mm_view_20200709.gz
- Uncompress gzipped file and make script executable
- (25.52 KiB) Downloaded 1900 times
-
- mm_quickview.png
- Screenshot shows older version 2017-02-09
- (233.85 KiB) Downloaded 4442 times
Last edited by MochiMoppel on Thu 09 Jul 2020, 04:17, edited 76 times in total.
Nice. Looks handy. I will give this a workout over the next few days. So far a couple of comments:
1) I navigated to a .wav and clicked it - it played in pmusic but then the "NAD5" theme of pmusic disappeared and returned to a default theme. I guess this is nothing to do with navigating via mm_quickview - just some peculiarity of my system but thought I would mention it anyway. Will post back if I find the trigger for this behaviour.
2) I felt it would have been nice to have an "up" arrow or "back arrow". Of course it is possible to click on the directory titles shown above the "places" pane, but it would have been more natural to have an arrow if poss.
Looks good!
EDIT ps: I did not understand what is meant by "Drag'n'drop Chooser => ROX-Filer: Copies file " (will try more tomorrow)
1) I navigated to a .wav and clicked it - it played in pmusic but then the "NAD5" theme of pmusic disappeared and returned to a default theme. I guess this is nothing to do with navigating via mm_quickview - just some peculiarity of my system but thought I would mention it anyway. Will post back if I find the trigger for this behaviour.
2) I felt it would have been nice to have an "up" arrow or "back arrow". Of course it is possible to click on the directory titles shown above the "places" pane, but it would have been more natural to have an arrow if poss.
Looks good!
EDIT ps: I did not understand what is meant by "Drag'n'drop Chooser => ROX-Filer: Copies file " (will try more tomorrow)
This is a great initiative. Maybe we will for the first time see a workable filemanager based on gtkdialog.
Maybe the quickview feature could embed a simple audioplayer as well. The following commands will both play most audio. The latter will play video too...
This beats RoxEntering first letter of a file name jumps to the file in list
Maybe the quickview feature could embed a simple audioplayer as well. The following commands will both play most audio. The latter will play video too...
Code: Select all
ffmpeg -i /path/input_file.mp3" -f au - | aplay
ffplay -i /path/input_file.mp3
Wow, mochi, this thing is something! I am always fooling with simple scripts and/or setting up *.desktop files w/ them, and Quickview lets me see all this stuff immediately. Plus, upon re-opening, it remembers where I left off. That is awesome! What would be incredible is what I wrote in the pic I put below (the highlighted). Still, Quickview is already good, and I am in the process of replacing ROX (I usually have 2 file mgrs always, usually PCManFM or Thunar along with ROX). Now ROX is getting removed and replaced by this! I love it. I hope it keeps moving forward and more new features are added. Thank you, Mochi!!
Here it is working in X-tahr-2.0:
Here it is working in X-tahr-2.0:
- Attachments
-
- quickview1.png
- (206.65 KiB) Downloaded 4180 times
@MochiMoppel
I have it working in the latest version of Lucid 5287 s2. Very fast. However it does not work in Wary 5.5. I used the same file for both and put it in the same place in both. Here is the output of running it in Wary in a terminal.
I'm not sure what this means but I hope it means something to you. Any hope of getting it to work in wary?
Regards,
Ken.
I have it working in the latest version of Lucid 5287 s2. Very fast. However it does not work in Wary 5.5. I used the same file for both and put it in the same place in both. Here is the output of running it in Wary in a terminal.
Code: Select all
# mm_quickview
/root/my-applications/bin/mm_quickview: line 57: unexpected argument `(' to conditional binary operator
/root/my-applications/bin/mm_quickview: line 57: syntax error near `(^'
/root/my-applications/bin/mm_quickview: line 57: ` if [[ $vCHOOSER =~ (^/sys/) ]] ;then '
Regards,
Ken.
- Rattlehead
- Posts: 368
- Joined: Thu 11 Sep 2008, 11:40
Hi MochiMoppel,
Great coding again friend.
Thanks mate.
Great thing about these simple codes, they work on both 32 and 64bit...
It's a forked branch by Jun7 or something similar, I don't remember exactly.
Great coding again friend.
Thanks mate.
Great thing about these simple codes, they work on both 32 and 64bit...
ROX in Fatdog does this.zigbert wrote:This beats RoxEntering first letter of a file name jumps to the file in list
It's a forked branch by Jun7 or something similar, I don't remember exactly.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Thank you all for the unexpected feedback. I hope not to raise too high expectations with this little exercise. After all gtkdialog's toolkit is quite limited, and so is the chooser widget.
My intention is to keep it simple and fast. Speed benchmark: Scrolling through chooser's file list with the UP and DOWN keys on my old Atom netbook. This requires a lot of refreshes and calculations. If scrolling stutters and doesn't feel snappy anymore, I don't implement it - at least not for this auto viewing mode. On demand viewing options for processor intensive tasks may come later.
@greekgeek: I'm sure you will figure it all out when you play with it
@zigbert: I have no intention to turn this into a file manager. I have to be careful not to let it head too far into that direction. My conscience forbids me to build something even less feeble than ROX-Filer .
Playing audio files is not a problem. The problem is chooser's event handling. You will not care and not even notice when text in the viewer pane is refreshed twice, but you will be utterly annoyed when audio is refreshed repeatedly.
@vovchik: Thank you for your kind encouragement.
@belham2: Good idea. Text in the viewer can be edited, so why not save it? This was one of the first thoughts that came to my mind. 2 reasons why I gave up on it:
1) Conceptually this should remain a viewer. The user should have confidence that no action will change the source data. Allowing saving or even auto-saving would not fit into this concept.
2) Theoretical it would be possible only for smaller files. There is a limit of ~128K for variable size, which will cause chooser to freeze when you attempt to read files bigger than that. I avoid this limitation by setting the variable to export="false", but his makes saving impossible.
Of course you are right that there should be an easy way to edit and save a script that you see in the viewer. One way that already works: drag&drop the file to a Leafpad desktop icon or whatever you want to edit it with (it is not possible to "embed" Leafpad into the viewer pane).
ROX-Filer has a nice solution: When you Shift+click on a text file, the file will open in the default editor. I like that. Gtkdialog does not support mouse+key combinations, but I will implement it somehow. Maybe I should give this priority.
@keniv: Looks like an old bash version in Wary 5.5. Try to steal /bin/bash from a newer Puppy and copy it to Wary 5.5.
@Rattlehead: Aspirin is not good for you. A glass of Rioja Gran Reserva works better!
@slavvo67: Trying to view PDFs in anything else than a dedicated PDF viewer is a waste of time. This goes for many other formats.
@drunkjedi: Thanks for testing in 64bit Puppies.
[Edit] Removed reference to bash with regard to 128k variable limit.
My intention is to keep it simple and fast. Speed benchmark: Scrolling through chooser's file list with the UP and DOWN keys on my old Atom netbook. This requires a lot of refreshes and calculations. If scrolling stutters and doesn't feel snappy anymore, I don't implement it - at least not for this auto viewing mode. On demand viewing options for processor intensive tasks may come later.
@greekgeek: I'm sure you will figure it all out when you play with it
@zigbert: I have no intention to turn this into a file manager. I have to be careful not to let it head too far into that direction. My conscience forbids me to build something even less feeble than ROX-Filer .
Playing audio files is not a problem. The problem is chooser's event handling. You will not care and not even notice when text in the viewer pane is refreshed twice, but you will be utterly annoyed when audio is refreshed repeatedly.
@vovchik: Thank you for your kind encouragement.
@belham2: Good idea. Text in the viewer can be edited, so why not save it? This was one of the first thoughts that came to my mind. 2 reasons why I gave up on it:
1) Conceptually this should remain a viewer. The user should have confidence that no action will change the source data. Allowing saving or even auto-saving would not fit into this concept.
2) Theoretical it would be possible only for smaller files. There is a limit of ~128K for variable size, which will cause chooser to freeze when you attempt to read files bigger than that. I avoid this limitation by setting the variable to export="false", but his makes saving impossible.
Of course you are right that there should be an easy way to edit and save a script that you see in the viewer. One way that already works: drag&drop the file to a Leafpad desktop icon or whatever you want to edit it with (it is not possible to "embed" Leafpad into the viewer pane).
ROX-Filer has a nice solution: When you Shift+click on a text file, the file will open in the default editor. I like that. Gtkdialog does not support mouse+key combinations, but I will implement it somehow. Maybe I should give this priority.
@keniv: Looks like an old bash version in Wary 5.5. Try to steal /bin/bash from a newer Puppy and copy it to Wary 5.5.
@Rattlehead: Aspirin is not good for you. A glass of Rioja Gran Reserva works better!
@slavvo67: Trying to view PDFs in anything else than a dedicated PDF viewer is a waste of time. This goes for many other formats.
@drunkjedi: Thanks for testing in 64bit Puppies.
[Edit] Removed reference to bash with regard to 128k variable limit.
Last edited by MochiMoppel on Tue 05 Sep 2017, 16:27, edited 1 time in total.
Acknowledged. One note, at least in 64 bit, the viewer seems to zoom jpg photos at maybe a 200 % or more. Not sure if it was intended to view photos but just a comment. In that light, it also doesn't adjust with the window size of the file viewer so it will look like maybe a 300% zoom when the file viewer is not full screen and maybe 200% when the file viewer is maximized.
I used something similar in Windows quite a while back. Has anyone tested this with files like .eml for example?
I used something similar in Windows quite a while back. Has anyone tested this with files like .eml for example?
- Rattlehead
- Posts: 368
- Joined: Thu 11 Sep 2008, 11:40
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
I find it hard to believe that this works. ROX-Filer uses single characters !,? or = as shortcuts and the user can define more single letters as menu shortcuts. It has to be either jump to file or honor shortcut. ROX-Filer can hardly do both at the same time.drunkjedi wrote:ROX in Fatdog does this.zigbert wrote:This beats RoxEntering first letter of a file name jumps to the file in list
It's a forked branch by Jun7 or something similar, I don't remember exactly.
In latest Fatdog64 710, when you click a button, say 'b'.
Rox will select all files that has 'b' in it's name, also a dialogue appears at bottom of rox window showing, "Reg Select (i):" and 'b' is typed in it.
Then say you type 'u', it gets typed into that dialogue after 'b' and the selection gets shorter to show files with 'bu' in their name.
I have not seen this function in rox in other pups.
I read somewhere I can set a shortcut in rox by hovering mouse pointer over a menu item and clicking key or combination of keys you want to assign as shortcut.
Anyway I found this accidentally....
Now that I have /bin open in rox and files with 'bu' in their names selected...
Now If I middle click mouse any text field, I get...
/bin/bashbug /bin/bunzip2 /bin/busybox /bin/busybox-applet-list /bin/busybox-cron /bin/busybox-init /bin/busybox-inotifyd /bin/busybox-logger /bin/busybox-login
The selected files with their path... I didn't know that. Lol.
Edit: Just adding gif screen capture of rox. Sorry for image quality. Just learning to make gif.
Rox will select all files that has 'b' in it's name, also a dialogue appears at bottom of rox window showing, "Reg Select (i):" and 'b' is typed in it.
Then say you type 'u', it gets typed into that dialogue after 'b' and the selection gets shorter to show files with 'bu' in their name.
I have not seen this function in rox in other pups.
How to set shortcuts in Rox? In what file do they get saved? So that I can inspect that file in Fatdog.MochiMoppel wrote:I find it hard to believe that this works. ROX-Filer uses single characters !,? or = as shortcuts and the user can define more single letters as menu shortcuts. It has to be either jump to file or honor shortcut. ROX-Filer can hardly do both at the same time.
I read somewhere I can set a shortcut in rox by hovering mouse pointer over a menu item and clicking key or combination of keys you want to assign as shortcut.
Anyway I found this accidentally....
Now that I have /bin open in rox and files with 'bu' in their names selected...
Now If I middle click mouse any text field, I get...
/bin/bashbug /bin/bunzip2 /bin/busybox /bin/busybox-applet-list /bin/busybox-cron /bin/busybox-init /bin/busybox-inotifyd /bin/busybox-logger /bin/busybox-login
The selected files with their path... I didn't know that. Lol.
Edit: Just adding gif screen capture of rox. Sorry for image quality. Just learning to make gif.
Last edited by drunkjedi on Fri 03 Feb 2017, 13:24, edited 2 times in total.
I only tested in Fatdog.MochiMoppel wrote:@drunkjedi: Thanks for testing in 64bit Puppies.
In Fatdog xclip is not present.
But still it works.
Only thing is when I open the wallpaper folder on my drive and browse 1920x1080 images, the previews are shown zoomed original size, so only part of image is viewed.
Is it because of xclip?
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Explained by disciple here (a thread you visited and bookmarked )drunkjedi wrote:How to set shortcuts in Rox?
/root/.config/rox.sourceforge.net/ROX-Filer/menus2In what file do they get saved?
I tried to explain that in the Technical Notes and I also tried to explain why I don't scale images to fit the viewer pane. Nothing is zoomed. You will see more/less of the image when you resize the QuickViewer window.Only thing is when I open the wallpaper folder on my drive and browse 1920x1080 images, the previews are shown zoomed original size, so only part of image is viewed.
Ok In Fatdog's /root/.config/rox.sourceforge.net/ROX-Filer/menus2 I see following lineDo you think that's it?
Code: Select all
; (gtk_accel_path "<filer>/Select/Reg Select..." "asciicircum")