TaDaa / vimade

Vimade let's you dim, fade, tint, animate, and customize colors in your windows and buffers
Apache License 2.0
540 stars 10 forks source link

Option to enable fading only for floating windows #82

Closed darianmorat closed 2 weeks ago

darianmorat commented 3 weeks ago

As the title says, is there any option for this? The reason I want to get this working only for floating windows is that I want to better focus on windows like Telescope, so that I don't have all the overlap with the text behind.

I got this workaround for now... But I would like to know if there's a better option for it:

vim.api.nvim_create_autocmd({"WinEnter"}, {
   callback = function()
      local win_config = vim.api.nvim_win_get_config(0)
      if win_config.zindex then
         vim.cmd("VimadeEnable")
      else
         vim.cmd("VimadeDisable")
      end
   end
})
TaDaa commented 3 weeks ago

Yep! Was planning this to address #44 as well, but you'll want the latest update so that named lists don't overwrite the default rules.

The only_behind_float_windows is just an arbitrary rule name. Using default as the rule name will override the default rule found in globals.lua

require('vimade').setup({
  blocklist = {
    only_behind_float_windows = function (win, current)
      -- current can be nil
      if (win.win_config.relative == '') and (current and current.win_config.relative ~= '') then
        return false
      end
      return true
    end
  }
})

works in python as well:

from vimade import vimade
def only_behind_float_windows (win, current):
  if (win.win_config['relative'] == '') and (current and current.win_config['relative'] != ''):
    return False
  return True

vimade.setup(blocklist = {
    'only_behind_float_windows': only_behind_float_windows,
})
darianmorat commented 2 weeks ago

Thank you, that's exactly what I was looking for