tokyo-night-tmux icon indicating copy to clipboard operation
tokyo-night-tmux copied to clipboard

Widget Reordering Functionality

Open janoamaral opened this issue 10 months ago • 4 comments

As of now, our interface lacks the capability to reorder widgets, which we recognize as a valuable feature for personalization and efficiency. To address this, we propose an improvement that would allow users to specify their widget preferences and desired order.

This enhancement would enable users to:

  • Submit a list of widgets they wish to use.
  • Determine the sequence in which these widgets should appear.

By implementing this feature, we can streamline the user experience, allowing for a single, cohesive configuration that not only activates widgets but also arranges them according to individual preferences.

Setting proposal:

set -g @tokyo-night-tmux_show_right_widgets "music, netspeed, git, wbg, datetime"

janoamaral avatar Apr 14 '24 00:04 janoamaral

The only suggestion I have (looking at @gokayburuc's https://github.com/janoamaral/tokyo-night-tmux/issues/10#issuecomment-2046143010) is to have them space separated (easier to parse), such as:

set -g @tokyo-night-tmux_show_right_widgets "music netspeed git wbg battery datetime"

Also, if we're going with a new configuration format, would you consider keeping a consistent dashed notation for configuration names? Most other tmux plugins follow this style, and if we name widgets consistently configuration guesswork should be trivial (as an example):

set -g @tokyo-night-widgets "music netspeed git wbg datetime"
set -g @tokyo-night-music-maxsize 25
set -g @tokyo-night-music-style "colorscore"
set -g @tokyo-night-netspeed-iface "en0"
set -g @tokyo-night-battery-hide "full"
set -g @tokyo-night-datetime-format "YMD 24H"

This could help simplify config fetching for widgets, where a function can be provided to fetch these namespaced config options (with a default, similar to dracula):

source "$CURRENT_DIR/../lib/config"
# in widget/datetime:
FORMAT=$(get_widget_option format "YMD 24H")
# in widget/music:
MAX_LENGTH=$(get_widget_option maxsize "20%")
STYLE=$(get_widget_option style "bar")
TIME_STYLE=$(get_widget_option numstyle "digital")

Stealthii avatar Apr 17 '24 00:04 Stealthii

Also, if we're going with a new configuration format, would you consider keeping a consistent dashed notation for configuration names? Most other tmux plugins follow this style, and if we name widgets consistently configuration guesswork should be trivial

You're right, my mistake, we should keep the same naming pattern.

This could help simplify config fetching for widgets, where a function can be provided to fetch these namespaced config options

It could be feasible, we should make a roadmap support both config styles until deprecate the current one. But that's a decision that should be planned.

janoamaral avatar Apr 20 '24 19:04 janoamaral

I would also be nice if this feature could be extended to ordering of the window tabs icons/numbers, I understand these are not the same problem set but would allow for good customization. If a new issue is better for this I can open it.

alexguillamon avatar Jun 02 '24 00:06 alexguillamon

set -g @tokyo-night-tmux_show_right_widgets "music netspeed git wbg battery datetime"

I guess we can simply translate the spaces to $ and then pass this string to status-right. Something like:

$ echo "$""music netspeed git" | tr " " "$"
$music$netspeed$git

drdragon79 avatar Jul 16 '24 21:07 drdragon79