1778 Commits

Author SHA1 Message Date
Emre AKYÜZ
224ae5b406
Fix sorting with spaces 2023-07-05 23:11:14 +03:00
Emre AKYÜZ
dfeb8e2ecd
Add better sorting 2023-07-01 17:25:38 +03:00
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
appeasementPolitik
08639706a9
Make sure sb-volume module is updated when closed after opening (#1316) 2023-05-26 22:11:06 +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
Spenser Truex
ce1f0bfa05
Re-add whitespace to some buffer types as needed. (#1333)
Very arcane.

C ANSI standard requires a newline at the end. GCC will complain.

Email signatures should have a space after the -- according to the
standard. Neomutt does this automatically for you if you have a
signature.

Co-authored-by: Spenser Truex <truex@equwal.com>
2023-05-25 03:40:55 +00:00
Mahdi Nayef
0a29cfbf4f
Fix rename key bindings in lf (#1331) 2023-05-24 13:28:56 +00:00
appeasementPolitik
991b052a55
Don't wrap horizontally on short terminal (#1325) 2023-05-11 14:00:08 +00:00
pony-montana
b2833f8a67
change requested by lf-git after update. (#1319) 2023-05-02 19:49:56 +00:00
Austen
e1302c897e
dwmblocks update on song change (#1318) 2023-05-01 16:15:11 +00:00
Luke Smith
77fd62b9f3
Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-04-20 09:21:17 -04:00
Luke Smith
65378ab944
sb-price improvements 2023-04-20 08:48:34 -04:00
Luke Smith
b719590427
use built-ins, close #1297 2023-04-20 08:47:39 -04: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
snailed
d4ff2ebaf3
fix shellcheck (#1301)
Shellcheck wines when printf doesn't get an argument
2023-04-12 12:11:29 +00:00
Mathieu Rollet
5c92a1770f
Set GOMODCACHE to comply with XDG (#1299)
If GOMODCACHE is not set, it defaults to $GOPATH/pkg/mod
cf. https://go.dev/ref/mod#environment-variables
2023-04-12 12:10:42 +00:00
RealAestan
a94ee62680
dmenuunicode: don't use variables in the printf format string (#1284)
It works but the good practice is to use `printf "..%s.." "$foo"`
see https://www.shellcheck.net/wiki/SC2059
2023-04-03 14:07:54 +00:00
Luke Smith
5a6c56d565
efficiency and fail tweaks 2023-03-31 09:44:59 -04:00
Luke Smith
749f74f84e
Merge branch 'LalleSX-patch-1' 2023-03-24 17:49:43 -04:00
Luke Smith
07b0fbcce2
fix name 2023-03-24 17:49:38 -04:00
Lalle
a558356ecf
Added Larbs commits RSS 2023-03-24 21:10:26 +01:00
Luke Smith
4537bce2c2
check scripts to avoid rerunning remapd 2023-03-23 22:06:10 -04:00
Luke Smith
0e2cd987dc
Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-03-20 09:50:29 -04:00
Luke Smith
fd964d54b6
customizable wttr/rate urls, sb-price improvements 2023-03-20 09:50:18 -04:00
Axel
b394c5f772
Added video.desktop file. (#1288)
Updated mimeapps.list to include mp4 files.
Closes #1271
2023-03-20 12:11:07 +00:00
Luke Smith
37930fdf57
use stig over tremc by default 2023-03-01 13:38:22 -05:00
HelionSmoker
2062e8110c
SQLite ~/ cleanup (#1283) 2023-02-23 12:33:45 +00:00
appeasementPolitik
2e5226545b
maimpick: hide cursor when selecting area (#1282)
Normally when making a screenshot of an area there's still a bit of the cursor that can be seen, this hides it.
2023-02-22 22:21:55 +00:00
Luke Smith
6c92dfa4eb
Merge branch 'iStagnant-master' 2023-02-21 10:27:29 -05:00
Luke Smith
d292d927f1
use android name in fsname 2023-02-21 10:27:08 -05:00
iStagnant
89f8506d85 Made mounter not show already mounted android devices in the mounting prompt 2023-02-20 23:16:20 +02:00
Jameson
27c00576c2
update tutorialvids (#1276)
remove duplicate status bar and align
2023-02-20 12:01:52 +00:00
Luke Smith
762eadd9d1
fix #1275 2023-02-17 12:12:10 -05:00
Luke Smith
ad6ecdb3fc
Merge branch 'master' of github.com:LukeSmithxyz/voidrice 2023-02-17 11:01:19 -05:00
Luke Smith
b04d4c9ac8
mounter improvements, old scripts removed
now checks fstab for info, also one less android prompt
2023-02-17 11:01:07 -05:00
sudo-Tiz
8dce96b986
add dwmblock tutorial video to tutorialvids script (#1274) 2023-02-17 15:32:44 +00:00
Luke Smith
a2e767e4f4
other aliases 2023-02-17 10:18:01 -05:00
Luke Smith
185ac25e52
mount drives with user's ownership 2023-02-17 10:17:35 -05:00
Stagnant
335c1bc8af
Fixed android device not mounting to root owned directories (#1273) 2023-02-17 14:31:44 +00:00
Luke Smith
12167f3dda
fix #1268, use sudo -A, var rename 2023-02-13 08:12:40 -05:00
Luke Smith
537464795b
Merge branch 'HelionSmoker-master' 2023-02-12 09:00:31 -05:00