[Feature]: Use same directory to resotore config file of termux, not seperately
Feature description
Now, config file of termux has many paths:
- ~/.termux
- ~/bin: termux hook use it
- ~/shortcuts: termux-widgets use it
- ~/.termuxrc: termux-packages use it
Why not use a same directory? Such as ~/.termux, Or ${XDG_CONFIG_HOME:-$HOME/.config}/termux? Use a same directory is more convenient for user to backup their config file by VCS, and respect some standard.
Thanks.
Additional information
Most of app/terminal emulators use ${XDG_CONFIG_HOME:-$HOME/.config}/appname to restore their config files.
~~Configuration files for most software are located in $PREFIX/etc, $HOME/.config and $HOME,~~
~~if you want to change them, it will take a lot of work.~~
Termux can be backed up via termux-backup, but it is sometimes too large. Need to make a script specifically for backing up configuration files for termux?
@2096779623 It sounds more like to me that the user just wants the configs in another basically catchall location so as to do less and that's it. Not that the user needs a script.
@Freed-Wu The path is hardcoded but it shouldn't take more than some minutes to switch it over to a setting with user specified path unless there's something else going on. I don't know why they hardcoded it. Could just be that's how they did it or there could be a difficult reason.
@Freed-Wu The path is hardcoded but it shouldn't take more than some minutes to switch it over to a setting with user specified path unless there's something else going on. I don't know why they hardcoded it. Could just be that's how they did it or there could be a difficult reason.
So need a script to backup them.
It sounds more like to me that the user just wants the configs in another basically catchall location so as to do less
I think termux can:
${XDG_CONFIG_HOME:-$HOME/.config}/termuxstorecolors.properties,termux.properties, etc.${XDG_CONFIG_HOME:-$HOME/.config}/termux/binstoretermux-file-editor,termux-url-opener, etc.${XDG_CONFIG_HOME:-$HOME/.config}/termux/shortcutsstore termux-widgets's shortcuts.${XDG_CONFIG_HOME:-$HOME/.config}/termux/termuxrc.shstore the config of termux-packages like
# shellcheck shell=bash disable=SC2034
JAVA_HOME="$(command ls -d /usr/lib/jvm/java-*-openjdk 2> /dev/null||return 0)"
if [ "${TERMUX_PACKAGES_OFFLINE-false}" = false ]; then
if [ -d /opt/android-sdk ]; then
ANDROID_HOME=/opt/android-sdk
fi
if [ -d /opt/android-ndk ]; then
NDK=/opt/android-ndk
fi
fi
# ex: filetype=bash
I hope it is suffixed with .sh because the original name ~/.termuxrc let me
must write some shell=bash and filetype=bash to let editor and other tools know it is a bash script.
So I can add ${XDG_CONFIG_HOME:-$HOME/.config}/termux to my dotfiles easily, not search many different paths.
The path is hardcoded but it shouldn't take more than some minutes to switch it over to a setting with user specified path
Sounds it can be realized, right?
May the PR about this feature be accepted?
Primary paths will be changed to the following with the next update.
~/.termux/termux-widget/shortcut/{launcher,dynamic,device_control,icon}~/.termux/termux-widget/termux-widget.properties~/.termux/termux-float/termux-float.properties
The termux-tasker paths can be changed in future, currently defaults to ~/.termux/tasker for non absolute paths so changing directory may require work.
The .config directly can used as secondary path for properties files but shortcuts/binaries won't be stored there. Having multiple directories complicates things and increases I/O for execution for checking if canonical paths are under allowed directories.
I can change ~/.termux/termux.properties primary path to ~/.termux/termux/termux.properties but then will have 3 paths, but since more properties files are planned to be added in future, it may be a good idea to move now.
The ~/bin paths would be good to be moved to ~/.termux/termux/bin, will look into that.
Primary paths will be changed to the following with the next update.
:+1: And README.md should be updated.
termux-app docs for properties and termux-widget docs will be available on the new site.
I found termux-boot uses
~/.termux/boot. It looks a little inconsistent because
- termux-app (or just name it termux) use
~/.termux/termux - termux-widget use
~/.termux/termux-widget - termux-float use
~/.termux/termux-float
They are prefixed by ~/.termux/termux-*, so it looks like ~/.termux/boot is an inconsistent design?
termux-boot is EOL and boot event support has been added directly into termux-app with a different path and will be available in next version as a beta feature, have talked about it on our matrix dev channel.
termux-bootis EOL and boot event support has been added directly intotermux-appwith a different path and will be available in next version as a beta feature, have talked about it on our matrix dev channel.
It would be good to make an official statement regarding that. Most users don't frequent the developer chatroom. This probably isn't anything urgent, but it should be mentioned with a future release.
Yeah, I plan to do that when I push out the update.