695 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
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
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
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
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
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
HelionSmoker
2062e8110c
SQLite ~/ cleanup (#1283) 2023-02-23 12:33:45 +00:00
Luke Smith
a2e767e4f4
other aliases 2023-02-17 10:18:01 -05:00
HelionSmoker
ca000f5fe4
Python ~/ cleanup (#1264) 2023-02-09 14:37:31 +00:00
Luke Smith
a4784f9faa
silent sourcing error if absent 2023-02-09 09:19:49 -05: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
Luke Smith
6d75bbdf8c
remaps run by remapd automatically on startup 2023-02-06 20:45:11 -05:00
Luke Smith
37d26eccd8
Merge branch 'master' of https://github.com/ssnailed/voidrice into ssnailed-master 2023-02-06 18:11:39 -05:00
snailed
32a896ffdf
Make xprofile automatically start remapd 2023-02-06 21:11:01 +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
3cee7b8844
update for name change 2023-02-01 13:32:50 -05:00
Luke Smith
6e2de6f4f6
remove firefox sync 2023-02-01 09:29:24 -05:00
Amy
191d8617e2
remove adding newline (#1257)
eol is set on by default
2023-01-28 16:21:14 +00:00
Luke Smith
f30078225e resolve #1249 2023-01-27 19:16:27 -05:00
Amy
6e75e3a3bf
add TERMINAL_PROG variable (#1237)
used in programs like `xtrace` (line 172 `/usr/bin/xtrace`)
2023-01-20 21:10:47 +00:00
Luke Smith
ab8f99cb71 lax for logins 2023-01-19 12:50:17 -05:00
Luke Smith
a247e3e851 enable custom userChrome.js 2023-01-19 09:11:18 -05:00
Luke Smith
56b61ca1d5 add larbs user.js additions 2023-01-17 16:20:27 -05: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
Jameson
9068ccd66c
Use g instead of gg in zathura (#1246) 2023-01-15 05:27:25 +00: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