true-zen.nvim icon indicating copy to clipboard operation
true-zen.nvim copied to clipboard

Atraxis doesn't hide lualine

Open bezlant opened this issue 2 years ago • 8 comments

The lualine gets hidden when using Minimalist mode, but stay when using atraxis. Is there a way to hide it in atraxis as well?

bezlant avatar Jul 31 '22 04:07 bezlant

I've tried adding the same "options" as in minimalist to atraxis, but it didn't help for some reason. Also tmux doesn't hide the status line with tmux enabled. Could it be because I use a plugin for tmux statusline?

bezlant avatar Jul 31 '22 04:07 bezlant

Same issue here. The statusline is also showing in minimalist, when windows are split horizontally. Also, my tabline is hidden in minimalist, but not in ataraxis.

Screen Shot 2022-07-31 at 12 17 16 AM

loqusion avatar Jul 31 '22 05:07 loqusion

Narrowing it down, I can say that the only plugins that seem at play here are truezen and lualine. Not sure what is going on.

TheCedarPrince avatar Aug 01 '22 23:08 TheCedarPrince

A small although inelegant workaround that almost gets the desired behavior is to:

  1. Call :TZMinimalist
  2. Call :TZFocus

And you get something like this:

image

And then call

  1. :TZFocus
  2. :TZMinimalist

To go back to your standard layout

TheCedarPrince avatar Aug 01 '22 23:08 TheCedarPrince

@TheCedarPrince thank you for the workaround, I've be using it until solved 👍 UPD: The only issue with it, it doesn't center the text.

bezlant avatar Aug 02 '22 04:08 bezlant

After briefly surveying the code, it seems that the statusline is hidden as follows:

  • Set 'laststatus' to 0
  • Set 'statusline' to ""
  • Change highlighting for StatusLine and StatusLineNC

However, lualine sets autocommands and timer handles that refresh 'statusline', thus it remains visible between horizontally split windows (as in ataraxis with the padding windows). It seems that we'd need to implement a fix targeting lualine specifically — i.e. clearing the autocommands and stopping the timer handles from modifying 'statusline'.

My initial thought is we should write/request a PR for lualine that allows us to disable or enable it after calling setup(). Then we can detect lualine with pcall(require, 'lualine') and toggle it in minimalist mode. But I'm not too familiar with the neovim ecosystem, so perhaps there is a better way.

loqusion avatar Aug 02 '22 16:08 loqusion

Hey @loqusion - I am very similar to you in that I am pretty new to engaging with the Neovim ecosystem, but the devs of lualine seem quite amenable to chatting about needs/issues other devs may have based on their contributing section. Perhaps start a discussion to see what they think?

Either way, no need to do this at all as I very much appreciate this plugin already! Totally up to your discretion/desire and thanks for checking this out already. :smile:

Have a great day!

TheCedarPrince avatar Aug 02 '22 20:08 TheCedarPrince

I'm sorry but I'm afraid lualine is not hideable. I checked the source code and can confirm what @loqusion mentioned.

What I've tried so far to hide it:

  • set laststatus=0
  • set statusline=""
  • disable all events (set ie=all)
  • disable all lualine augroups and events (i.e. au! lualine*)

But nothing works...

I opened an issue on their repo. Hopefully they'll expose an API to toggle on and off lualine.

pocco81 avatar Aug 02 '22 23:08 pocco81

@bezlant @loqusion Given that lualine enabled a way to show/hide lualine we can patch it with open_callback and close_callback for now Works pretty good

zen.setup {
  modes = {
    ataraxis = {
      -- …more configs
      open_callback = function()
        lualine.hide()
      end,
      close_callback = function()
        lualine.hide { unhide = true }
      end,
    },
    minimalist = {
      open_callback = function()
        lualine.hide()
      end,
      close_callback = function()
        lualine.hide { unhide = true }
      end,
    },
  },
 -- ...more configs
}

https://user-images.githubusercontent.com/91922543/182708360-01134031-3d67-49b4-b5af-4d2c239464a6.mov

andoArbST avatar Aug 03 '22 20:08 andoArbST

I still think we should support lualine by default so that true-zen works out-of-the-box rather than forcing users to do extra work for compatibility. Either that, or we could use integrations.lualine, but that might go against one of the goals of the rewrite.

If we go with the former approach, we can just use pcall(require, 'lualine') for detection. It should work as long as the user doesn't have a weird lazy load config for lualine.

loqusion avatar Aug 04 '22 02:08 loqusion

@andoArbST I'm going add lualine as an integration. No need for this workaround :)

pocco81 avatar Aug 04 '22 02:08 pocco81

Makes sense Just thought to point it out in the meantime Thanks for the plugin guys

andoArbST avatar Aug 04 '22 02:08 andoArbST

I know this will be addressed... but tmux integration isn't working for me either and i'm currently patching that with the callbacks as well. I'm using the same commands as the plugin which work so my guess is that it isn't being read properly from the config?

In case it's helpful @bezlant

local status_ok, zen = pcall(require, "true-zen")
if not status_ok then
  return
end

local lualine_ok, lualine = pcall(require, "lualine")


local function tmux_off()
  if vim.fn.exists "$TMUX" == 0 then
    return
  end
  vim.cmd [[silent !tmux set status off]]
end

local function tmux_on()
  if vim.fn.exists "$TMUX" == 0 then
    return
  end
  vim.cmd [[silent !tmux set status on]]
end

local function open_cb()
  if lualine_ok then
    lualine.hide()
  end
  tmux_off()
end

local function close_cb()
  if lualine_ok then
    lualine.hide { unhide = true }
  end
  tmux_on()
end

zen.setup {
  modes = {
    ataraxis = {
      shade = "dark", -- if `dark` then dim the padding windows, otherwise if it's `light` it'll brighten said windows
      backdrop = 0, -- percentage by which padding windows should be dimmed/brightened. Must be a number between 0 and 1. Set to 0 to keep the same background color
      minimum_writing_area = { -- minimum size of main window
        width = 70,
        height = 44,
      },
      quit_untoggles = true, -- type :q or :qa to quit Ataraxis mode
      padding = { -- padding windows
        left = 30,
        right = 30,
        top = 0,
        bottom = 0,
      },
      open_callback = open_cb,
      close_callback = close_cb,
    },
    minimalist = {
      options = { -- options to be disabled when entering Minimalist mode
        number = false,
        relativenumber = false,
        showtabline = 0,
        signcolumn = "yes",
        -- statusline = "",
        cmdheight = 1,
        -- laststatus = 0,
        showcmd = true,
        showmode = false,
        ruler = false,
        numberwidth = 1,
      },
      open_callback = open_cb,
      close_callback = close_cb,
    },
  },
  integrations = {
    tmux = true,
    kitty = {
      enabled = true,
      font = "+1",
    },
  },

}

andoArbST avatar Aug 04 '22 20:08 andoArbST

@andoArbST Huge thanks! I will give it a try :)

bezlant avatar Aug 05 '22 04:08 bezlant

@andoArbST could you open another issue for the tmux issue? It's working on my end so we'll have to analyze this one.

Also, true-zen doesn't forcefully hide tmux's statusline, it only hides it if it was showing before, so maybe the issue is here?

pocco81 avatar Aug 06 '22 15:08 pocco81

Thank you for fixing this @Pocco81 ! I shall use it everyday - it works beautifully on my end:

image

TheCedarPrince avatar Aug 08 '22 01:08 TheCedarPrince