Closed FalconSN closed 1 year ago
Run termux-wallpaper
command with RUN_COMMAND
intent, otherwise socket connection to termux-api app will fail, lot of duplicate issues for that.
https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent
And just running with root will not keep process alive, check https://www.reddit.com/r/termux/comments/yuwr4f/keeping_the_script_alive_even_after_termux_app_is/
lot of duplicate issues for that.
Apologizes, I initially intented to open a discussion for this and not issue, but seemingly there's no way to ask questions without opening issues. Can you maybe consider this?
And just running with root will not keep process alive, check
Yes, I was turning the script into root mode after I saw this reddit post.
There's one another issue, though, and I don't want to open another issue for I'm quite inexperienced in Github. When the phone is in landscape mode in an app, termux-wallpaper is changing the image's aspect ratio to landscape too, thus causing a 1080x2340 image to be cropped to 1080x640˜ and stretched. What should be done for this?
You can open a discussion at https://github.com/termux/termux-api/discussions
When the phone is in landscape mode in an app, termux-wallpaper is changing the image's aspect ratio to landscape too, thus causing a 1080x2340 image to be cropped to 1080x640˜ and stretched. What should be done for this?
Termux only provides image to android and there doesn't seem to be any rotation argument, so if your phone is in landscape, wallpaper is likely going to be set in that way, might be a launcher issue. Either rotate phone to portrait before setting wallpaper or try rotating image file before passing to termux.
there doesn't seem to be any rotation argument
When we dumpsys display | grep 'DisplayInfo'
;
we get 3 different informations: mStaticDisplayInfo
, mBaseDisplayInfo
, mOverrideDisplayInfo
So, to my understanding, getApplicationContext()
in:
Returns the third one, which probably, again to my understanding, only refers to current layer, such as when in a landscape only app, while getBaseContext()
returns the second one, which is most likely default layer. I have changed that part to getBaseContext()
and it's working as I desired. There are some other examples of using it like getBaseContext().getWallpaper()
, but I should leave it to someone who knows what they are doing.
I don't know how to use code snippets, sorry.
Are you saying that if you change
Context context = getApplicationContext();
WallpaperManager wallpaperManager = WallpaperManager.getInstance(context);
to
Context context = getBaseContext();
WallpaperManager wallpaperManager = WallpaperManager.getInstance(context);
and then recompile the app and install it, it fixes the aspect ratio issue?
Provide screenshots of normal and landscape wallpapers states, the image file, and which launcher you are using. And what do you mean by landscape mode, rotation locked in landscape or auto rotate enabled and phone in landscape. Launchers also have their own orientation setting. By default nova does not rotate launcher homescreen or wallpaper, unless look and feel -> screen orientation is changed to Auto rotate
.
Well, this got confusing. Yesterday it was setting the wallpaper in portrait when phone was brought to landscape mode by auto-rotation or apps/games, and today it doesn't. I will look for a better solution in Java, but cannot make any promises.
The Context
type wouldn't have any effect on wallpaper orientation. All it is used is to get the wallpaper
service, and context type wouldn't change behaviour of wallpaper setting, that's why I asked to confirm.
That dumpsys
Base
reference doesn't have anything to do with base Context
.
Problem description I wrote a small script to change the wallpaper at specific times, and need to run it as root to avoid it getting killed when Termux closes. However, it does not change the wallpaper when run with
sudo -E -u 10176
. 10176 is Termux UID. It does make exit immediately with error code 1.Steps to reproduce
sudo -E -u $(id -u) termux-wallpaper -f <file>
Expected behavior Change the wallpaper.
Additional information I don't know if this is a problem on tsu side or termux-wallpaper. I will report this in tsu repo if I'm being told so.