Linux port of Far Manager: progress in 4 years

The first publication of the source code of far2l, a port of Far Manager for Linux - a piece that was once considered fundamentally impossible - took place on August 10, 2016. Since the main developer is talking about the transition of the project to beta status , I decided to write a review post on how things are going there and what they have achieved over the past four years.



Console version



The first question that everyone asked here , on the opennet , and on the lore - why not in the console? Originally far2l really only worked in graphical mode, via wxWidgets. This turned out to be the easiest way to quickly get a working port with all user conveniences: an X clipboard and all keyboard shortcuts, and with support for events not only KeyDown, but also KeyUp.



This limitation is now a thing of the past: far2l feels great in the console . Moreover, the so-called far2l terminal extensions appeared there ., so if you run the console far2l inside the graphical one (for example, by going somewhere via ssh), they "connect" to each other, and the internal far2l will also see the clipboard (with the user's permission, of course) and all possible hotkeys. Moreover, even a special putty assembly has been made , allowing you to enjoy all these tricks from Windows.



Here, look, this is far2l in GNOME Terminal







But in putty







Russian letters in .zip "from Windows"



Believe it or not, Windows, up to at least seven, created .zip archives, writing there filenames in OEM (DOS) encoding! Compatibility is scary. As a result, StackOverflow is full of questions "how can I properly unpack a zip with krakozyabrami".



In far2l we fixed it. In the process, a demo utility was born , which shows how to work correctly with encodings in .zips so that there are no "krakozyabrs" (useful for the authors of archivers), as well as a patch for p7zip that uses a similar algorithm. The p7zip-with-patch is even packed into a .deb (ubuntu 20.04+, amd64), the installation of which fixes the zip support, for example, in Engrampa used in MATE.







Tidying up dependencies



Initially, the port carried a bunch of library code, and so are present in the Linux world in system packages: pcre, minizip, universal charset detector. Now all this has been replaced by a competent use of dependencies: system libraries are used wherever possible (exception: 7z and unrar, the latest libraries are statically compiled there to support the latest features of the formats).



Human support .tar.gz



The multiarc plugin that far2l uses to access archives came to us from the Windows world, and did not know how to perceive .tar.gz as one archive. He saw .gz and inside it .tar. Therefore, to get a list of files, you had to do a full decompression. Such an experience. Over the past month, multiarc has been significantly improved and this problem has disappeared.



Beautiful console window



There was a problem in the graphical version of far2l: the border-drawing symbols were shown with an annoying dotted line.



image



It took us a long time to find the cause or find the rendering settings that fix this endless bug, until I looked into the source code of the GNOME and KDE terminals. And there, it turns out, a long time ago, the symbols for drawing frames are rendered not from the font, but manually, so that the lines are clear and beautiful.



As a result, we did the same in far2l, only a little better: adding anti-aliasing. Otherwise, in the KDE and GNOME terminals, the most contrasting lines are too distracting to themselves next to antialiased text.



In the process, I had to figure out the psycho-visual nuances of anti-aliasing, catching non-existent โ€œtoo bright pixelsโ€ that the eyes stubbornly saw. Details .



image



Distribution packages



We have not yet got into the repositories of many distributions ( and some have already got there !). But for a long time there have been packages in all major formats . There is even a build script for Amazon Linux! And, of course, there is a ppa for * buntu - the most convenient way to "just put the headlights" for most users.



Fresh Colorer



far2l forked from the Far 2 branch, so some plugins there required urgent updates. Recently, such an update was carried out: we updated the unpacking code of 7z and unrar, as well as the color scheme of the Colorer syntax. The rest of the ported plugins do not contain any regularly updated pieces, but the old "coloring" and the new archives not opening were a real problem. That's it, she's gone!







Net box rocks



This was the second question that was usually asked in kamenty: "and netboooox buuooooooooo?". No, there will be no netbox! There is putty inside, and dragging its linux version into far2l seemed like a strange idea. And the netbox code itself was not very suitable for porting.



Therefore, the author of the port, the excellent elfmz, made his own version of the network plugin: NetRocks. There is everything you may need - ftp [s], and scp, and sftp, and nfs, and webdav, and even samba! Everything works on native Linux libraries. In sftp, you can even run remote commands and go to the remote console.



NetRocks also has a pseudo-network file plugin that allows you to work with the local file system. What for? Because NetRocks is good at background operations. And the usual copying of Far files cannot.







What about plugins in general?



In addition to NetRocks, the kit includes:



colorer (syntax highlighting, fresh!)

Multiarc (working with archives, modified, fresh archivers!)

Tmppanel (temporary panel)

align block (formatting blocks for the editor)

autowrap (auto-

wrap in the editor) drawline (drawing lines in the editor)

editcase (convert case in the editor)

SimpleIndent (work with indentation in the editor)

compare (advanced version of "compare folders")

editor autocomplete (autocomplete in the editor)

filecase (convert the case of file names)

incremental search ("quick search" in editor)

inside (shows what is inside ELF and some other formats)

and even a plugin for writing other plugins in Python!



There are a couple of third-party ones, far2-gvfs and far2l-fuse , but after the appearance of NetRocks, they have somewhat lost their relevance.



In general, a basic set for comfortable working with local and remote files and archives, as well as writing code directly in the far2l editor is available :)



How about stability? When is the release already?



With stability, everything is fine: for 4 years of use in work (webdev + any office) I have not "caught" any data loss with far2l. The author of the port is ready to gradually change the status from alpha to beta, if critical errors do not come out within a month or two. Then one might think about submitting packages to a distribution repository, for example.



Bonus # 1. Is there really Wine under the hood?



Partly :) Some pieces of WinApi translation into the native Linux API were pulled from Wine (encoding conversion, for example; by the way, they recently tried to rewrite this piece to iconv, but it turned out that the code from Wine does the same thing 4 times faster ). Over time, calls to these functions, scattered throughout the far2l code, can be gradually replaced by direct calls to native functions. In the meantime, this design also works very quickly (the slowest thing they tried to run on -  raspberry pi , the flight is normal) and quite reliable.



Bonus # 2. Stop suffering bullshit, teach the console, you fools!



During my work on far2l (a tester, and sometimes I send simple patches) I learned more about the Linux console than in my entire life before :) And I am also gradually mastering C, on which I have not had to code since the institute - there was no reason (at the same time , by the way, switched to "you" with git). So wait soon for an article "how the web macaque si taught at open source"!



Bonus # 3. Are there any boring wallpapers?



A few years ago, I would have rather laughed at this question. But yes, if you look in blue all day long, it somehow becomes uncomfortable (and you can directly feel how a beard and a sweater with deer grow back). Therefore, in the end I made myself a coloring in the spirit of Monokai, and laid it out for everyone , of course. We have opensource, after all.







Bonus # 4. Will it take off on a poppy?



Take off. Half of the tickets are written to the bugtracker from poppies. And yes, it works on BSD too.



All Articles