-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Added: Add support for using image as background #3079
base: master
Are you sure you want to change the base?
Conversation
Could the notch (aka the display cutout) also be filled in landscape? |
I think leaving the notch as is would be better, considering not all devices have notch and the transparency would be enough to fill the gap to make the background consistent in the terminal. |
Yeah nevermind, Termux is not fully full screen so that looks a bit odd |
termux-shared/src/main/java/com/termux/shared/image/ImageUtils.java
Outdated
Show resolved
Hide resolved
4be45f6
to
2b88003
Compare
can you check if background files are generated properly at What is the status in setting, is the switch enabled at |
perfectly available |
Fixed the issue, |
It amazing feature thank you man |
@rihaq Actually, I have implemented it. But, there are several issues with it. To make an Activity transparent, Activity needs to be But, it leads to Another problem is, the method to change Activity from It might create problems for Android 8 devices, because of this Prevent non-fullscreen activities from influencing orientation which was fixed in Android 8.1. Will see if this can be figured out. Also, it looks a little bit uncomfortable on Android. Maybe playing with some alpha value and blur effect can help.
I am not much familiar with Terminal code, But will see if I can help there. |
Here's a suggestion: You could implement background blur along with transparent background that works on Android <11 with RealtimeBlurView lib. (suggesting mine because official one is very outdated and doesn't build anymore) And then, it would look like just as windows' cmd blur But of course, there would be some performance impact, so this could be an optional setting |
I tried it (on Android 12 btw). Looks pretty cool with the blur effect. But as I said have to make the activity
Yes, I have noticed that causing some performance drawbacks. |
What I'd do for these cases is have 2 Activities that only differ in the translucency, and make the launcher icon start an invisible helper Activity that starts the translucent or opaque Activity depending on the setting. When you make the original Activity a base class it should be possible without much code duplication. I don't know if Termux can manage having 2 terminal activities, and changing the setting would have to finish the old Activity, so there aren't 2 at the same time. |
I will try to do that. and i think new pr would be better for this since many changes would require. |
Can't find the set background option |
Make sure to download from GitHub Action build. |
Use Termux:Float for this |
|
Hold up what, you should be the person getting this advice |
It would be cool if there's an alpha option |
That what "Overlay Color" is mentioned in PR i guess. |
When it will be push? |
Patiently waiting for your pr 🤗 |
I can see in the OP screenshot, keyboard is also transparent. How? |
Hello, |
This ain't the place to learn fam, its in beta, its also unrecommended, so instead use the stable one and wait for this to get pushed |
It's better to stick with stable version of Termux. If you still want that background support badly, you can grab it from artifacts. |
Unfortunately, builds with background image support are no longer available for download in GitHub Action build |
This method allows to launch an Activity for result.
The `ImageUtils` class includes utility functions for image manipulation and storage. It provides functions for loading bitmap or drawable, storing, resizing and compressing images.
`getIntColorFromString()` can be used to get an int color by parsing the string color. Color can be in the form of `#AARRGGBB` or `#RRGGBB`. `swap()` can be used to exchange x and y value present in `Point`.
This change allows the user to use an image as the terminal's background. Add option to select or remove the background image in the context menu -> style. `TermuxBackgroundManager` holds the responsibility of making background changes. It provides functionalities: - Change the background color. - Set or remove the background image. - Selecting an image from the gallery. - Restore the image if available. - Notify about the changes made to the background. `updateBackgroundColor()` is moved from `TermuxTerminalSessionActivityClient` to `TermuxBackgroundManager`. Images are stored in the termux data home directory. The image is resized corresponding to the display resolution and compressed before saving. Background overlay color is read from the `termux.properties` file with the key `background-overlay-color`. The default value is set to `#59000000`. To change the background overlay color, add `background-overlay-color=<color>` to `termux.properties` file. Supported color formats are `#AARRGGBB` or `#RRGGBB`.
The user can enable or disable background image loading from the termux setting available in `Termux Style` preferences with this commit. If some malformed image is stored as background, disable image loading in the setting. Disabling the image from the setting will not delete image files and can be restored.
Change comment for landscape background from `background.jpeg` to `background_landscape.jpeg`.
… the preference Set overlay color to the `TerminalToolbarViewPager` background when the image is background. And set the `ExtraKeysView` button to transparent. If the background is color, then set it to the default value.
Co-authored-by: Susko3 <[email protected]>
Add `TERMUX_BACKGROUND_DIR_PATH` and `TERMUX_BACKGROUND_DIR` to store background images. Use `TERMUX_BACKGROUND_IMAGE_PATH` and `TERMUX_BACKGROUND_IMAGE_FILE` to store original compressed image. Change `TERMUX_BACKGROUND_IMAGE_PORTRAIT_PATH` and `TERMUX_BACKGROUND_IMAGE_PORTRAIT_FILE` to store portrait image.
Compress to jpeg and store original image to `TERMUX_BACKGROUND_DIR`. Use `Activity` size instead of display size. If portrait and landcape files are deleted or `Activity` size is changed, then regenerate images using original image.
For Android <= 9, `PorterDuff.Mode.MULTIPLY` causing unusable screen lag. Change to `PorterDuff.Mode.DARKEN`.
@snooppr As you can see, this PR is not merged to master yet. So it's obvious Termux 0.118.1 does not contain this functionality. |
and 0.119 also. It's frustrating to see new versions being released for the sake of releasing new versions without proper documentation. |
Well, in this case it's fornwall's fault that a release had to be made just for the sake of a new release. |
Additionally, 0.118.1 already does provide a changelog and 0.119.0-beta.1 a link to its git history. Just gotta read. I didn't write a changelog for beta.1 because there wasn't enough time to write it for hundreds of commits, where many of the changes will change in the next major beta anyways from many of my local changes. |
This changes allows the user to use an image as the terminal's background.
Background Image
To set an image as a background, open the context menu by long clicking on the terminal and select Menu -> Style -> Set background image.
To remove background image Menu -> Style -> Remove background image (It will also delete generated image files).
When an image is selected from the gallery, it is resized corresponding to device resolution and then compressed into a jpeg. Three image files,
background.jpeg
,background_portrait.jpeg
, andbackground_landscape.jpeg
are generated. The original source image is compressed intobackground.jpeg
and can be used to regenerate portrait and landscape files in case of display size change or files get deleted.Overlay Color
The overlay color is loaded from the
termux.properties
file with the keybackground-overlay-color
. The default value is set to#59000000
. To change the overlay color, addbackground-overlay-color=<color>
to thetermux.properties
file. Supported color formats are#AARRGGBB
and#RRGGBB
. If the color is in #RRGGBB format then the alpha value of default color 0x59 (35%) is used.Termux Settings
Background image loading can also be enabled/disabled from settings. From Termux Settings -> Termux -> Termux Style -> Background Image. If some malformed image is stored as background image and not letting open termux, then setting can be used to disable image loading.
Setting can also be used to temporarily disable image loading. You can enable it until and unless you delete image files from
.termux/background
folder.Backup
Image files are stored in
.termux/background
folder, and overlay color value is stored intermux.properties
and both are part of the backup, so you can easily Backup them.However, the preference for background, whether it's image or color is stored and read from
com.termux_preference.xml
which is not part of the backup. The default value set for thebackground_image_enabled
isfalse
.To overcome this issue, if
background.jpeg
is present, then the user can restore them. When again selecting an image from the gallery usingSet background image
, the alert is shown to restore images. If files for both orientation are present, It can also be done from the setting by enabling background image loading.