termux / termux-widget

Termux add-on app which adds shortcuts to commands on the home screen.
https://f-droid.org/en/packages/com.termux.widget
Other
976 stars 113 forks source link

Add ~/.termux/shortcuts as an alternative to ~/.shortcuts #49

Open SeerLite opened 3 years ago

SeerLite commented 3 years ago

Feature description

I'd like to be able to use an alternative to the ~/.shortcuts location for 2 reasons:

  1. I like ~/.termux because it already has other Termux configuration. Having all Termux related things together inside the same directory would help keeping the home directory organized and less filled with random dotfiles.
  2. Currently I'm already using ~/.shortcuts for something more general (and less Termux-specific) in my dotfiles, and it conflicts with Termux-Widget asking me to use the same directory. I know I can always work around it but it's still a bit annoying.

To not cause problems with existing Termux setups I propose adding ~/.termux/shortcuts as an alternative to the current ~/.shortcuts. Creating the one inside ~/.termux would override/disable the one in ~.

I can understand if it isn't possible to change it, or if it isn't worth it. I can work around it (or just rename my personal .shortcuts dir). Still, I wanted to give it a shot cause I like the organization aspect of using ~/.termux.

Thank you for making and maintaining Termux <3

RalfWerner commented 3 years ago

Use:s=.shortcuts; t=.termux; mv $s $t; ln -s $t/$s $s to meet your desire. Thus are various Widget tables possible.

Sepero commented 3 years ago

Agree with the OP. It's preferable to not have another ~/. directory for every possible Termux addon. Placing everything in ~/.termux is better organization. Just as the reason ~/.config was created on Desktop Linux

RalfWerner commented 3 years ago

@Sepero If you installed version 0.13, my proposal is no longer possible. I also change my multi-table. In 0.13 $s will created from the app if it does not exist. Your request of the organization is possible because $t and $s match the canonical restriction, which allows symlinks between the two paths. So if your $ts path (below) exists with all your scripts, you should only add the following script:

s=.shortcuts t=.termux ts=$t/shortcuts; rm $s/*;cd $ts
for f in `ls`; do ln -s ~/$ts/$f ~/$s/$f; done; id="--ei appWidgetId 2" w=com.termux.widget
am broadcast -n $w/.TermuxWidgetProvider -a $w.ACTION_REFRESH_WIDGET $id

All links will be up-to-date and if you call it actualize, it will probably be top of the table. The value at the end of id you get when you press the Reload button. All single shortcuts to which you have a file in $ts/icons you must re-create.

Freed-Wu commented 1 year ago

Same as https://github.com/termux/termux-app/issues/2826

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

So you just need to wait a new released version of termux-widget.

PS: The lastest release is on 2021, (now is 2023), maybe we need a new release :smile:

agnostic-apollo commented 1 year ago

PS: The lastest release is on 2021, (now is 2023), maybe we need a new release

Ping me next year! Hopefully, updates should be ready by then.

Iey4iej3 commented 1 year ago

Ping me next year!

@agnostic-apollo

agnostic-apollo commented 1 year ago

I commented in january of 2023, there are a good 11 months left before next year.