Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image preview related options should not be set if image preview is not requested #156

Open
097115 opened this issue Sep 8, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@097115
Copy link

097115 commented Sep 8, 2023

May be something like this could help:

-        [ -z "$preview_window_size" ] && preview_window_size=up:60%:wrap
-        [ -z "$ueberzug_x" ] && ueberzug_x=10
-        [ -z "$ueberzug_y" ] && ueberzug_y=3
-        [ -z "$ueberzug_max_width" ] && ueberzug_max_width=$(($(tput lines) / 2))
-        [ -z "$ueberzug_max_height" ] && ueberzug_max_height=$(($(tput lines) / 2))
+        ! [ "$image_preview" -eq 0 ] && [ -z "$preview_window_size" ] && preview_window_size=up:60%:wrap
+        ! [ "$image_preview" -eq 0 ] && [ -z "$ueberzug_x" ] && ueberzug_x=10
+        ! [ "$image_preview" -eq 0 ] && [ -z "$ueberzug_y" ] && ueberzug_y=3
+        ! [ "$image_preview" -eq 0 ] && [ -z "$ueberzug_max_width" ] && ueberzug_max_width=$(($(tput lines) / 2))
+        ! [ "$image_preview" -eq 0 ] && [ -z "$ueberzug_max_height" ] && ueberzug_max_height=$(($(tput lines) / 2))

Or, more probably, there's a better way :)

Of course, setting those even if not specifically requested may not seem that harmful at first but a) with no terminal available, using tput results in further calculations may lead to an error (you can't divide nothing by 2) and b) why really do it if there's no need? :)

@justchokingaround justchokingaround added the bug Something isn't working label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants