Open 766F6964 opened 3 years ago
I am afraid I don't understand you in this case. ucollage
supports two different configuration file residing in $HOME/.config/ucollage
.
variables
to set the environment variables (see [1])scripts
to set the user defined scripts (see [2])Center images in the terminal when opened
This is a little more tricky. ueberzug
does not currently support centering of images. And ucollage
does not handle the size of the images. This is done automatically through ueberzug
depending on the available space. That is why all images are currently placed on the top left corner of the available space. I believe ueberzug
should be modified to provide alignment support.
Specify default image viewer (e.g. maybe people want to use ucollage only for previewing, but want to open the image in e.g. firefox)
This is an interesting idea. I am thinking about implementing in with the goto command. If ucollage
is selected then the image is viewed in monocle mode. If any other program is selected, then this image is opened with that. The thing is though that you can already define a script for that case.
For example in your $HOME/.config/ucollage/scripts
you can add the line
map="o" command="open" script="firefox %s"
I am afraid I don't understand you in this case.
ucollage
supports two different configuration file residing in$HOME/.config/ucollage
.
My bad, I simply missed that.
Center images in the terminal when opened
This is a little more tricky.
ueberzug
does not currently support centering of images. Anducollage
does not handle the size of the images. This is done automatically throughueberzug
depending on the available space. That is why all images are currently placed on the top left corner of the available space. I believeueberzug
should be modified to provide alignment support.
Fair point. This is something that should be added to ueberzug.
Specify default image viewer (e.g. maybe people want to use ucollage only for previewing, but want to open the image in e.g. firefox)
This is an interesting idea. I am thinking about implementing in with the goto command. If
ucollage
is selected then the image is viewed in monocle mode. If any other program is selected, then this image is opened with that. The thing is though that you can already define a script for that case.For example in your
$HOME/.config/ucollage/scripts
you can add the linemap="o" command="open" script="firefox %s"
Good point! nice. Maybe, it would be nice to have different behavior based on the file extension. For example, I can see that being especially useful for videos. Pressing enter over a video thumbnail could open vlc/mpv, and for a JPG image it opens it in firefox, and for a PNG image, it opens it in Gimp etc...
Maybe, it would be nice to have different behavior based on the file extension. For example, I can see that being especially useful for videos. Pressing enter over a video thumbnail could open vlc/mpv, and for a JPG image it opens it in firefox, and for a PNG image, it opens it in Gimp etc...
I could add support for that, but again the customization ability of ucollage
comes to the rescue. You can create your own script that does exactly that and then create the ucollage script
Something like
#media_open.sh
if [[ "$1" is video ]]
then
mpv "$1"
elif [[ "$1" is jpg ]]
then
firefox "$1"
elif [[ "$1" is png ]]
then
gimp "$1"
fi
and then do
map="o" command="open" script="path/to/media_open.sh %s"
I have written ucollage
with such cases in mind and I have made it to be as general as possible, so that each user can create what he likes without creating more source code on my part.
I tried your example, however, it always results in "No Executions" for me? Am I missing something?
The media_open.sh
is marked as executable, and the option in the mappings is set.
Well the script in not exactly correct. Its pseudo-code. You should implement the conditionals
Try that:
#media_open.sh
local mime type ext
mime=$(file --mime-type -b "$1")
type="${mime%/*}
ext="${mime#*/}
if [[ "$type" == "video" ]]
then
mpv "$1"
elif [[ "$ext" == "jpg" ]]
then
firefox "$1"
elif [[ "$ext" == "png" ]]
then
gimp "$1"
fi
In any case, you should first check that the script works on your command line before attempting to use it in ucollage
.
Sorry for the late reply. Thanks, that works well. I'd like to do some more customization tho, if possible. If the currently selected element is a video, I want to use the enter key to immediately open the video. There are two problems here:
Essentially, I wanna achieve a similar behavior for videos, that exists for pictures out of the box. When I press enter on a video thumbnail, the video should start playing immediately (like specified in the script). Keep in mind I still want to keep the default behavior for images, aka enter to view the image.
- Is there a way to skip the confirmation prompt? By default, the user is prompted if he wants to run the script. It would be nice if there is a flag to skip that prompt.
Check the UCOLLAGE_EXEC_PROMPT
config variable and also the set
command for on-the-fly changes.
- I can't seem to bind the enter key to a script, because by default it opens an image/video-thumbnail in the view mode. Can I overwrite that?
You can unmap any key binding. And then remap it. Check this. Implementing a hybrid solution is a little more tricky I guess, because the image selection is a builtin function and it would have to be combined with an external script somehow. I am little busy these days, so I cannot sit down and explore the options, but I hope that by following the links you will be able to find a solution of your own.
Hello,
I'd like to suggest adding support for a global configuration file (e.g.
~/.config/ucollage/ucollagerc
). With a configuration file, users would be able to transfer their defaults to other devices. Here are a couple of things, I'd love to be able to customize in that file: