Pipe file containing list of images to sxiv and reflect changes immediadly
Clash Royale CLAN TAG#URR8PPP
Suppose I have a file images.txt
which contains for example
image1.jpg
image2.jpg
image3.jpg
Then I pipe the images.txt
to sxiv
and I want that the thumbnail view reflects the changes immediately. I tried this one:
watch -n 0.1 'cat images.txt | sxiv -i -t'
But if I change the images.txt
and save it (for example by adding or removing an image-filename), the thumbnail view in sxiv doesn't update.
I guess that there is something wrong with my pipe construction. What would be the correct way to do this?
command-line pipe cat watch
add a comment |
Suppose I have a file images.txt
which contains for example
image1.jpg
image2.jpg
image3.jpg
Then I pipe the images.txt
to sxiv
and I want that the thumbnail view reflects the changes immediately. I tried this one:
watch -n 0.1 'cat images.txt | sxiv -i -t'
But if I change the images.txt
and save it (for example by adding or removing an image-filename), the thumbnail view in sxiv doesn't update.
I guess that there is something wrong with my pipe construction. What would be the correct way to do this?
command-line pipe cat watch
Maybe add a-p
to tell sxiv not to cache the images? It would make a lot more sense to only run sxiv when something changes rather than 10 times a second.
– icarus
Dec 31 '18 at 23:04
Ah, I just noticed that I have to close thesxiv
window to update the changes in theimages.txt
file (then immediately a new window pops up with the updated content) if I use my pipe construct, but that's not exactly what I wanted.
– student
Dec 31 '18 at 23:22
add a comment |
Suppose I have a file images.txt
which contains for example
image1.jpg
image2.jpg
image3.jpg
Then I pipe the images.txt
to sxiv
and I want that the thumbnail view reflects the changes immediately. I tried this one:
watch -n 0.1 'cat images.txt | sxiv -i -t'
But if I change the images.txt
and save it (for example by adding or removing an image-filename), the thumbnail view in sxiv doesn't update.
I guess that there is something wrong with my pipe construction. What would be the correct way to do this?
command-line pipe cat watch
Suppose I have a file images.txt
which contains for example
image1.jpg
image2.jpg
image3.jpg
Then I pipe the images.txt
to sxiv
and I want that the thumbnail view reflects the changes immediately. I tried this one:
watch -n 0.1 'cat images.txt | sxiv -i -t'
But if I change the images.txt
and save it (for example by adding or removing an image-filename), the thumbnail view in sxiv doesn't update.
I guess that there is something wrong with my pipe construction. What would be the correct way to do this?
command-line pipe cat watch
command-line pipe cat watch
asked Dec 31 '18 at 22:45
studentstudent
6,9931763121
6,9931763121
Maybe add a-p
to tell sxiv not to cache the images? It would make a lot more sense to only run sxiv when something changes rather than 10 times a second.
– icarus
Dec 31 '18 at 23:04
Ah, I just noticed that I have to close thesxiv
window to update the changes in theimages.txt
file (then immediately a new window pops up with the updated content) if I use my pipe construct, but that's not exactly what I wanted.
– student
Dec 31 '18 at 23:22
add a comment |
Maybe add a-p
to tell sxiv not to cache the images? It would make a lot more sense to only run sxiv when something changes rather than 10 times a second.
– icarus
Dec 31 '18 at 23:04
Ah, I just noticed that I have to close thesxiv
window to update the changes in theimages.txt
file (then immediately a new window pops up with the updated content) if I use my pipe construct, but that's not exactly what I wanted.
– student
Dec 31 '18 at 23:22
Maybe add a
-p
to tell sxiv not to cache the images? It would make a lot more sense to only run sxiv when something changes rather than 10 times a second.– icarus
Dec 31 '18 at 23:04
Maybe add a
-p
to tell sxiv not to cache the images? It would make a lot more sense to only run sxiv when something changes rather than 10 times a second.– icarus
Dec 31 '18 at 23:04
Ah, I just noticed that I have to close the
sxiv
window to update the changes in the images.txt
file (then immediately a new window pops up with the updated content) if I use my pipe construct, but that's not exactly what I wanted.– student
Dec 31 '18 at 23:22
Ah, I just noticed that I have to close the
sxiv
window to update the changes in the images.txt
file (then immediately a new window pops up with the updated content) if I use my pipe construct, but that's not exactly what I wanted.– student
Dec 31 '18 at 23:22
add a comment |
1 Answer
1
active
oldest
votes
Your existing construction will attempt to run cat images.txt | sxiv -i -t
every tenth of a second. If sxiv
takes longer than that to do whatever it does, things could get quite messy. You might be better off looking at a hash of a checksum of all of the images:
$ md5sum *.jpg | md5sum
4a009e73fb133d2d103dd2e65ef8c605 -
This takes a hash of all of the .jpg
files, and makes a hash of that. This means that the sur-checksum will change if any of the images are changes, as well as if any are added or removed.
So we can do something like this:
#!/bin/bash
old_checksum="$(md5sum *.jpg | md5sum)"
while /bin/true; do
new_checksum="$(md5sum *.jpg | md5sum)"
if [[ "$new_checksum" != "$old_checksum" ]]; then
old_checksum="$new_checksum"
find . -maxdepth 1 -name *.jpg -print0 | xargs -0 sxiv -i -t
fi
sleep 1
done
Anytime anything changes, take a note of the new checksum, and re-run sxiv
.
If you still want to keep your catalog of .jpg
files in images.txt
, this can be easily modified to use the contents of that file for creating the checksum and for providing arguments to xargs
in lieu of find
.
Thanks. Yes indeed I want to keep the "catalog" in "images.txt". The file will be auto updated in another step. How would your solution look like using "images.txt"? Just calculate the md5sum of images.txt and replace the find command with cat images.txt?
– student
Dec 31 '18 at 23:25
I think you need akillall sxiv
before thefind
line to prevent that a new instance of sxiv is started and also a&
after-t
?
– student
Dec 31 '18 at 23:34
I don't use a&
to ensure that only one instance offind
and therefore only one instance ofsxiv
is ever running at a time, which means akill
should not be needed.
– DopeGhoti
Jan 1 at 21:44
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491834%2fpipe-file-containing-list-of-images-to-sxiv-and-reflect-changes-immediadly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your existing construction will attempt to run cat images.txt | sxiv -i -t
every tenth of a second. If sxiv
takes longer than that to do whatever it does, things could get quite messy. You might be better off looking at a hash of a checksum of all of the images:
$ md5sum *.jpg | md5sum
4a009e73fb133d2d103dd2e65ef8c605 -
This takes a hash of all of the .jpg
files, and makes a hash of that. This means that the sur-checksum will change if any of the images are changes, as well as if any are added or removed.
So we can do something like this:
#!/bin/bash
old_checksum="$(md5sum *.jpg | md5sum)"
while /bin/true; do
new_checksum="$(md5sum *.jpg | md5sum)"
if [[ "$new_checksum" != "$old_checksum" ]]; then
old_checksum="$new_checksum"
find . -maxdepth 1 -name *.jpg -print0 | xargs -0 sxiv -i -t
fi
sleep 1
done
Anytime anything changes, take a note of the new checksum, and re-run sxiv
.
If you still want to keep your catalog of .jpg
files in images.txt
, this can be easily modified to use the contents of that file for creating the checksum and for providing arguments to xargs
in lieu of find
.
Thanks. Yes indeed I want to keep the "catalog" in "images.txt". The file will be auto updated in another step. How would your solution look like using "images.txt"? Just calculate the md5sum of images.txt and replace the find command with cat images.txt?
– student
Dec 31 '18 at 23:25
I think you need akillall sxiv
before thefind
line to prevent that a new instance of sxiv is started and also a&
after-t
?
– student
Dec 31 '18 at 23:34
I don't use a&
to ensure that only one instance offind
and therefore only one instance ofsxiv
is ever running at a time, which means akill
should not be needed.
– DopeGhoti
Jan 1 at 21:44
add a comment |
Your existing construction will attempt to run cat images.txt | sxiv -i -t
every tenth of a second. If sxiv
takes longer than that to do whatever it does, things could get quite messy. You might be better off looking at a hash of a checksum of all of the images:
$ md5sum *.jpg | md5sum
4a009e73fb133d2d103dd2e65ef8c605 -
This takes a hash of all of the .jpg
files, and makes a hash of that. This means that the sur-checksum will change if any of the images are changes, as well as if any are added or removed.
So we can do something like this:
#!/bin/bash
old_checksum="$(md5sum *.jpg | md5sum)"
while /bin/true; do
new_checksum="$(md5sum *.jpg | md5sum)"
if [[ "$new_checksum" != "$old_checksum" ]]; then
old_checksum="$new_checksum"
find . -maxdepth 1 -name *.jpg -print0 | xargs -0 sxiv -i -t
fi
sleep 1
done
Anytime anything changes, take a note of the new checksum, and re-run sxiv
.
If you still want to keep your catalog of .jpg
files in images.txt
, this can be easily modified to use the contents of that file for creating the checksum and for providing arguments to xargs
in lieu of find
.
Thanks. Yes indeed I want to keep the "catalog" in "images.txt". The file will be auto updated in another step. How would your solution look like using "images.txt"? Just calculate the md5sum of images.txt and replace the find command with cat images.txt?
– student
Dec 31 '18 at 23:25
I think you need akillall sxiv
before thefind
line to prevent that a new instance of sxiv is started and also a&
after-t
?
– student
Dec 31 '18 at 23:34
I don't use a&
to ensure that only one instance offind
and therefore only one instance ofsxiv
is ever running at a time, which means akill
should not be needed.
– DopeGhoti
Jan 1 at 21:44
add a comment |
Your existing construction will attempt to run cat images.txt | sxiv -i -t
every tenth of a second. If sxiv
takes longer than that to do whatever it does, things could get quite messy. You might be better off looking at a hash of a checksum of all of the images:
$ md5sum *.jpg | md5sum
4a009e73fb133d2d103dd2e65ef8c605 -
This takes a hash of all of the .jpg
files, and makes a hash of that. This means that the sur-checksum will change if any of the images are changes, as well as if any are added or removed.
So we can do something like this:
#!/bin/bash
old_checksum="$(md5sum *.jpg | md5sum)"
while /bin/true; do
new_checksum="$(md5sum *.jpg | md5sum)"
if [[ "$new_checksum" != "$old_checksum" ]]; then
old_checksum="$new_checksum"
find . -maxdepth 1 -name *.jpg -print0 | xargs -0 sxiv -i -t
fi
sleep 1
done
Anytime anything changes, take a note of the new checksum, and re-run sxiv
.
If you still want to keep your catalog of .jpg
files in images.txt
, this can be easily modified to use the contents of that file for creating the checksum and for providing arguments to xargs
in lieu of find
.
Your existing construction will attempt to run cat images.txt | sxiv -i -t
every tenth of a second. If sxiv
takes longer than that to do whatever it does, things could get quite messy. You might be better off looking at a hash of a checksum of all of the images:
$ md5sum *.jpg | md5sum
4a009e73fb133d2d103dd2e65ef8c605 -
This takes a hash of all of the .jpg
files, and makes a hash of that. This means that the sur-checksum will change if any of the images are changes, as well as if any are added or removed.
So we can do something like this:
#!/bin/bash
old_checksum="$(md5sum *.jpg | md5sum)"
while /bin/true; do
new_checksum="$(md5sum *.jpg | md5sum)"
if [[ "$new_checksum" != "$old_checksum" ]]; then
old_checksum="$new_checksum"
find . -maxdepth 1 -name *.jpg -print0 | xargs -0 sxiv -i -t
fi
sleep 1
done
Anytime anything changes, take a note of the new checksum, and re-run sxiv
.
If you still want to keep your catalog of .jpg
files in images.txt
, this can be easily modified to use the contents of that file for creating the checksum and for providing arguments to xargs
in lieu of find
.
edited Jan 1 at 11:13
student
6,9931763121
6,9931763121
answered Dec 31 '18 at 23:02
DopeGhotiDopeGhoti
43.8k55382
43.8k55382
Thanks. Yes indeed I want to keep the "catalog" in "images.txt". The file will be auto updated in another step. How would your solution look like using "images.txt"? Just calculate the md5sum of images.txt and replace the find command with cat images.txt?
– student
Dec 31 '18 at 23:25
I think you need akillall sxiv
before thefind
line to prevent that a new instance of sxiv is started and also a&
after-t
?
– student
Dec 31 '18 at 23:34
I don't use a&
to ensure that only one instance offind
and therefore only one instance ofsxiv
is ever running at a time, which means akill
should not be needed.
– DopeGhoti
Jan 1 at 21:44
add a comment |
Thanks. Yes indeed I want to keep the "catalog" in "images.txt". The file will be auto updated in another step. How would your solution look like using "images.txt"? Just calculate the md5sum of images.txt and replace the find command with cat images.txt?
– student
Dec 31 '18 at 23:25
I think you need akillall sxiv
before thefind
line to prevent that a new instance of sxiv is started and also a&
after-t
?
– student
Dec 31 '18 at 23:34
I don't use a&
to ensure that only one instance offind
and therefore only one instance ofsxiv
is ever running at a time, which means akill
should not be needed.
– DopeGhoti
Jan 1 at 21:44
Thanks. Yes indeed I want to keep the "catalog" in "images.txt". The file will be auto updated in another step. How would your solution look like using "images.txt"? Just calculate the md5sum of images.txt and replace the find command with cat images.txt?
– student
Dec 31 '18 at 23:25
Thanks. Yes indeed I want to keep the "catalog" in "images.txt". The file will be auto updated in another step. How would your solution look like using "images.txt"? Just calculate the md5sum of images.txt and replace the find command with cat images.txt?
– student
Dec 31 '18 at 23:25
I think you need a
killall sxiv
before the find
line to prevent that a new instance of sxiv is started and also a &
after -t
?– student
Dec 31 '18 at 23:34
I think you need a
killall sxiv
before the find
line to prevent that a new instance of sxiv is started and also a &
after -t
?– student
Dec 31 '18 at 23:34
I don't use a
&
to ensure that only one instance of find
and therefore only one instance of sxiv
is ever running at a time, which means a kill
should not be needed.– DopeGhoti
Jan 1 at 21:44
I don't use a
&
to ensure that only one instance of find
and therefore only one instance of sxiv
is ever running at a time, which means a kill
should not be needed.– DopeGhoti
Jan 1 at 21:44
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491834%2fpipe-file-containing-list-of-images-to-sxiv-and-reflect-changes-immediadly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Maybe add a
-p
to tell sxiv not to cache the images? It would make a lot more sense to only run sxiv when something changes rather than 10 times a second.– icarus
Dec 31 '18 at 23:04
Ah, I just noticed that I have to close the
sxiv
window to update the changes in theimages.txt
file (then immediately a new window pops up with the updated content) if I use my pipe construct, but that's not exactly what I wanted.– student
Dec 31 '18 at 23:22