75 Commits

Author SHA1 Message Date
Emre AKYÜZ
861c9a9eaf
Add setsid 2023-07-01 16:35:04 +03:00
Emre AKYÜZ
7e0a3c4bae
Update lfrc 2023-07-01 16:23:27 +03:00
Emre AKYÜZ
e2c750002f
sxiv correction 2023-07-01 05:13:12 +03:00
Emre AKYÜZ
0f5dcce49a
Minor Correction 2023-07-01 03:58:47 +03:00
Emre AKYÜZ
495a48b879
Another fix for sxiv | slideshow 2023-07-01 03:54:06 +03:00
Emre AKYÜZ
a8e31d6a1d
Fix for sxiv structure 2023-06-30 15:27:06 +03:00
Emre AKYÜZ
f2e89ab984
Fix the whitespace issue | get rid of ls and sort 2023-06-30 11:06:42 +03:00
Emre AKYÜZ
8a3cf1e6e0
remove 'rotdir' | simplify and improve directory rotation
This method reads image files directly from the current directory $PWD and then uses an array to keep track of all the images. The use of Bash built-in commands like for loop and if condition ensure a faster execution because there is no need to create a subprocess for each image file. The sxiv command is run only once when the selected image is found.

Furthermore, this method takes advantage of array slicing in Bash ("${images[@]:i}" "${images[@]:0:i}"). This feature allows the program to pass the images that come after the selected image (including the selected image) and before the selected image, to sxiv in correct order. This maintains the file order of the directory. The use of sort -V (version sort) also contributes to maintaining the file order as it sorts version numbers within text.

In terms of efficiency, using Bash built-in operations with arrays should consume less system resources compared to lots of pipelines with multiple processes.

The old method uses the rotdir script which, when combined with awk, ls, grep, setsid, and sxiv, creates multiple subprocesses. This increases the overhead for context switching between these processes, leading to more system resource usage and a slower operation than the first method.

Moreover, the use of setsid -f sxiv -aio 2>/dev/null might launch sxiv multiple times, increasing the number of processes and resource usage.

In terms of file ordering, the rotdir script doesn't have explicit sorting. This might not necessarily match the desired order in some cases.

Lastly, the second method uses lf -remote to interact with the lf file manager. The command is run each time a new image is selected, adding an additional level of complexity and overhead to the process.

The first method is more readable and maintainable due to its use of simple Bash constructs. The logic is straightforward and doesn't involve external scripts.

On the other hand, the second method requires understanding the rotdir script, making it more complex to read and understand. The maintenance of this script would also need to be considered alongside the lfrc file, adding an extra layer of complexity.

We can even get rid of ls and sort by using bash globbing alone but then the files are ordered lexicographically, not numerically. Meaning they would go to 10th after 1st rather than 2nd. There could be a workaround though with naming the files with leading zeroes such as 01, 02 and so on.

# Detailed Explanation

shopt -s nullglob

This line tells bash to treat patterns which don't match any files (globs) as expanding to a null string, rather than themselves. This avoids problems in case there are no image files in the directory.

dir="$0"
selected_file="$1"

Here, dir and selected_file are being set to the two arguments that are passed to the bash script at the end ("$PWD" and "$fx"). They are the working directory and the selected file, respectively.

images=($(ls "$dir"/*.{jpg,jpeg,png,webp,bmp,tiff,tif,raw,ico,exif,heic,heif,gif,avif,jxl} | sort -V))

The ls command lists all the files in the directory that have certain image extensions. This list of files is piped (|) to sort -V, which sorts the list in version number order (which is similar to natural order for filenames). This sorted list of images is stored in the images array.

 [[ "${images[i]}" = "$selected_file" ]] && {
        sxiv -abiof "${images[@]:i}" "${images[@]:0:i}"
        break
    }
done

This is a for loop that iterates over each image in the images array. For each image, it checks if the image equals the selected file. If it does, the sxiv command is executed with all images from the selected one to the end of the list, followed by all images from the start of the list to the selected one. This makes it possible to navigate through the images both forward and backward, preserving the order from lf. After this, the break command is used to exit the for loop because we've found our selected image.

The "$PWD" and "$fx" at the end are the arguments that are passed to the bash script. "$PWD" is the current working directory in lf, and "$fx" is the currently selected file in lf.
2023-06-22 09:57:15 +03:00
Luke Smith
07de33840d
Revert "application/octet-stream is for arbitrary binary files (#1321)" (#1336)
This reverts commit af2710799b069486d04ba23c5bdab9cf6c4d6b04.
2023-05-27 01:46:54 +00:00
poeplva
af2710799b
application/octet-stream is for arbitrary binary files (#1321)
application/octet-stream mime-type is used for arbitrary binary files, so the best guess at opening those kind of should be based on the extension. before this all of this kind of files were tried to be opened with zathura, now it is the last resort in case the file extension is unknown.
2023-05-26 22:10:29 +00:00
Mahdi Nayef
1633233c9d
bulkrename using built-ins instead of using a completely separate program (#1330)
* bulkrename using bult-ins instead of using a completely separate program

* Make it more efficient
2023-05-26 22:08:43 +00:00
Mahdi Nayef
0a29cfbf4f
Fix rename key bindings in lf (#1331) 2023-05-24 13:28:56 +00:00
pony-montana
b2833f8a67
change requested by lf-git after update. (#1319) 2023-05-02 19:49:56 +00:00
anggatd
c08949ebd2
Change LibreOffice binaries to libreoffice (#1294)
In the current update, the libreoffice package doesn't have any binary for libreoffice writer, calc, impress, draw, etc. So it's better to open all of the document using the 'libreoffice' binary as it can work in the old version of libreoffice as well as the new one.
2023-04-20 12:32:31 +00:00
PrivateLalle
88748a4800
Add support for avif in lf (#1262)
Co-authored-by: Victor Risgaard <victor@risgaard.xyz>
2023-02-07 13:51:00 +00:00
PrivateLalle
81456798ae
Fix mouse issue in firefox, add avif icon and add DK & SE to dopplar (#1259)
* Fix mouse issue in firefox, add avif icon and add DK & SE to dopplar

* Update sb-doppler

* Scandinavian countries listed

---------

Co-authored-by: Victor Risgaard <victor@risgaard.xyz>
2023-02-06 18:28:08 +00:00
Luke Smith
9385a569fe Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-01-15 08:23:54 -05:00
Luke Smith
5c52bd6339 tweaks 2023-01-15 08:23:06 -05:00
Adrian Wijaya
450745a467
fix epub preview not working (#1238) 2022-11-19 21:46:38 +00:00
Luke Smith
cffb196a45 Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2022-11-16 11:24:35 -05:00
Luke Smith
d266ca3517 fix #1236 2022-11-16 11:23:03 -05:00
Gioele De Vitti
2361187598
Avoid expansion of file path containing spaces (#1230) 2022-11-16 16:15:57 +00:00
Luke Smith
ffb557119a close #1234 2022-11-16 11:07:53 -05:00
Luke Smith
d8b5f16c20 lf previews with gnome-epub-thumbnailer 2022-10-17 09:09:59 -04:00
Luke Smith
3901bc0f1b set autoquit 2022-09-27 21:32:47 -04:00
Ian Breckenridge
10f4372326
Remove permissions
After testing they weren't needed after all
2022-08-21 10:09:41 -04:00
Ian Breckenridge
aeb20f0c34
Change file permissions 2022-08-21 09:54:38 -04:00
Ian Breckenridge
ceca1e8ad1
Support lf icons file 2022-08-21 09:44:15 -04:00
Luke Smith
606905268f libreoffice programs, close #1155 2022-08-05 08:38:22 -04:00
Andrew
09ca9e57ac
Fix fzf select in lf (#1126)
Without double quotes, fzf-select fails when selecting a file whose path contains whitespace.
2022-06-17 16:36:14 +00:00
Rokosun
09af0a77b3
Numerous improvements to scope (#1088)
fallback to using mediainfo when ffmpegthumbnailer or pdftoppm is not available.
correct terminal width for bat.
use cut instead of awk for efficiency.
improve spacing/indentation for the sake of consistency in code.
2022-04-27 16:47:35 +00:00
i-c-u-p
c38de1d262
fix "extention" typo (#1103)
replaces all appearances of "extention" with "extension"
2022-04-10 12:39:05 +00:00
Oscar Lastra
0daa4d3450
feat(lf): Add JSON preview (#1090) 2022-03-13 19:52:08 +00:00
Luke Smith
fe4ea560ac
Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2022-03-12 16:44:31 -05:00
Luke Smith
a2d716606e
scope-lol 2022-03-12 16:44:11 -05:00
Coco
20364cb9ef
fixed typo (#1084)
lfup -> lfub on line 13
2022-03-12 18:47:45 +00:00
Luke Smith
42987c2d64
lf cleanup 2022-03-11 18:32:19 -05:00
Luke Smith
21bbe35ae3
needed for lf images 2022-03-06 13:27:22 -05:00
Luke Smith
148f1432e6
lf tweaks included ueberzug images 2022-03-06 13:19:51 -05:00
i-c-u-p
07df38c057
typos (#1067) 2022-01-26 15:07:42 +00:00
Future is FOSS
ed9a67ed6d
follow symlinks when detecting filetype in lf (#1052)
fix bug in lf where symlinked files don't open in the expected program
2021-12-04 08:47:35 -05:00
Luke Smith
ee0203f2ac
lf tweaks 2021-11-12 17:02:41 -05:00
krisdoodle45
714aa92a95
ext: Remove in favor of atool (#1013)
* ext: Give the ability to extract multiple files and wildcards

* Variable renaming

* Make user get prompted if extracted file overwrites another file

* Deleted ext

We have atool

* Replace ext with aunpack
2021-10-20 10:27:40 -04:00
Luke Smith
a3a630a3e8
avoid the lf/sxiv resize bug by not swallowing 2021-10-02 11:53:16 -04:00
Luke Smith
f42cb321f0
close #996 2021-09-23 12:40:12 -04:00
Luke Smith
347716361b
close #1002 2021-09-23 11:30:23 -04:00
krisdoodle45
05aa7d1182
Fix & improve lf's moveto, copyto and cd to bm-dir (#994)
* Changed paru to yay due to new LARBS changes

* Fix & improve lf's moveto, copyto and cd to bm-dir

When using any of the above functions they returned exit code 1. This was due to the cut command having tab as the delimiter, but spaces are used in the bm-dirs file. 
As an improvement comments are now automatically removed from the fzf options, because selecting those wouldn't work anyway.
The final sed command substituting "~" for "$HOME" is also removed because that doesn't seem to do anything looking at the current structure of the bm-dirs file.
The J bind needed more parsing and environment variable substitution because cd didn't work by default with values from a subshell.
2021-08-31 09:28:33 -04:00
Luke Smith
1c676c7cf2
close #971 2021-08-25 08:02:39 -04:00
Luke Smith
9dec1225a4
fix #956 2021-05-30 20:55:28 -04:00
Janik Kemnade
56046c5cda
Create and source bookmarks for/by lf (#917)
Co-authored-by: Kemmojo <kemnadej80@yahoo.de>
2021-04-06 14:52:18 -04:00