Skip to content
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

Add the ability to display line mode on the left side of the pane. #1656

Closed
2 of 3 tasks
ze0987 opened this issue Sep 18, 2024 · 4 comments · Fixed by #1667
Closed
2 of 3 tasks

Add the ability to display line mode on the left side of the pane. #1656

ze0987 opened this issue Sep 18, 2024 · 4 comments · Fixed by #1667
Labels
feature New feature request

Comments

@ze0987
Copy link

ze0987 commented Sep 18, 2024

yazi --debug output

Yazi
    Version: 0.3.3 (Arch Linux 2024-09-16)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.3 (Arch Linux 2024-09-16)

Emulator
    Emulator.via_env: ("foot-extra", "")
    Emulator.via_csi: Ok(Foot)
    Emulator.detect : Foot

Adapter
    Adapter.matches: Sixel

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : Some(":0")
    SWAYSOCK                   : Some("/run/user/1001/sway-ipc.1001.288373.sock")
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : Some("/bin/bash")
    EDITOR             : Some("nvim")
    VISUAL             : Some("nvim")
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

Text Opener
    default: Some(Opener { run: "${EDITOR:=nvim} \"$@\"", block: true, orphan: false, desc: "Edit with nvim", for_: None, spread: true })
    block  : Some(Opener { run: "${EDITOR:=nvim} \"$@\"", block: true, orphan: false, desc: "Edit with nvim", for_: None, spread: true })

Multiplexers
    TMUX               : false
    tmux version       : 3.4
    ZELLIJ_SESSION_NAME: None
    Zellij version     : 0.40.1

Dependencies
    file             : 5.45
    ueberzugpp       : No such file or directory (os error 2)
    ffmpegthumbnailer: 2.2.3
    magick           : 7.1.1-38
    fzf              : 0.55.0
    fd               : 10.2.0
    rg               : 14.1.1
    chafa            : 1.14.2
    zoxide           : 0.9.5
    7z               : 17.05
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1

Please describe the problem you're trying to solve

The current layout for displaying filenames with corresponding information on the opposite side of the pane may not be optimal on large, high res screens and tilling window managers.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

The ability to display line mode to the left of the filename would make eye tracking much easier in the above cases.

Additional context

yazi_layout

Validations

  • I have searched the existing issues
  • The latest nightly build of Yazi doesn't already have this feature
@sxyazi
Copy link
Owner

sxyazi commented Sep 20, 2024

With #1667, you can achieve it by overwriting the Current:render() method with the following code:

-- ~/.config/yazi/init.lua
local current_render = Current.render
function Current:render()
  local t = current_render(self)
  if #t < 2 then
    return t
  end

  local area, width = t[1]:area(), t[2]:max_width()
  t[1] = t[1]:area(ui.Rect { x = area.x + width, y = area.y, w = math.max(0, area.w - width), h = area.h })
  t[2] = t[2]:align(ui.Paragraph.LEFT)
  return t
end

Set linemode to mtime:

screenshot-002015

Set linemode to permissions:

screenshot-002016

Set linemode to owner:

screenshot-002017

@ze0987
Copy link
Author

ze0987 commented Sep 21, 2024

Thank you! Is it possible to right align?

y

@sxyazi
Copy link
Owner

sxyazi commented Sep 21, 2024

It's possible, just a small change based on #1656 (comment)

-  t[2] = t[2]:align(ui.Paragraph.LEFT)
+  t[2] = t[2]:area(ui.Rect { x = area.x, y = area.y, w = math.min(width, area.w), h = area.h })

screenshot-002020

Yazi offers a rich layout API, allowing you to implement just about any functionality you want. Check out the layout API doc here: https://yazi-rs.github.io/docs/plugins/layout

Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳
This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants