-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: adjust fidget notification window offset when xcodebuild test drawer is open #207
Comments
Really? Why would you want this? I am genuinely curious. Because unless I'm missing something (e.g., you often edit text that is somehow aligned to right side of your editor window), left-aligning the Fidget window is invariably going to lead to its text clashing with the text at the bottom of your buffer. For what it's worth this is the change: diff --git i/lua/fidget/notification/window.lua w/lua/fidget/notification/window.lua
index 3d8d7b1..80fc1c1 100644
--- i/lua/fidget/notification/window.lua
+++ w/lua/fidget/notification/window.lua
@@ -265,7 +265,7 @@ function M.get_window_position()
row = math.min(row_max, row + M.options.y_padding)
end
- return row, col, (align_bottom and "S" or "N") .. "E"
+ return row, M.options.x_padding + state.x_offset, (align_bottom and "S" or "N") .. "W"
end
--- Set local options on a window. The implementation is really easy, but I'm hesitant to introduce a feature that will basically render the bottom-left corner of your editor unusable. Is there a particular use case you have in mind? (Perhaps this might look more usable when the Fidget window is given an opaque background or something. If that's what you had in mind, please let me know (: ) |
Got it, that makes sense. What plugin are you using for the unit tests? Another solution is to dynamically adjust the |
It’s actually my own plugin :D it’s configurable, I can open it on the left side if needed. However, I like having it on the right side so I thought that maybe I could move Fidget on the other side where normally you see messages. Maybe I will just use changes you posted and see what works best for me. However, I think that opaque background would be useful anyway. |
You should already be able to make the window opaque by setting I’ll package up the left-aligned notification window as well… I just need to figure out whether to introduce a new option or expand the Also, I just saw your plugin, it looks awesome! If you give Fidget a way to register a callback every time the side tray is opened or resized, and some way to query the tray width, I can write an integration to dynamically reposition the notification window, like I do for nvim-tree. |
Dynamic repositioning could be probably the best solution, I guess just a simple API method to dynamically set the offset would be enough. Regarding |
Ah yeah, you can check https://github.com/j-hui/fidget.nvim/blob/main/lua/fidget/integration/nvim-tree.lua for how I integrate with nvim-tree, which has a similar layout and buffer lifecycle. The only odd thing is that they have their own callback registration system. You can get away with just sending autocmd events.
You're definitely right in general! But I want to avoid adding this feature if it's not going to be often used because (1) it adds complexity for other parts of the code that are reliant on window positioning (such as the nvim-tree integration!), and (2) it is another potential source of breaking changes, e.g., if I decide to move Fidget in some direction that is fundamentally incompatible with left-aligned notifications or something. So I don't want to give flexibility---which is why I ask whether there's a specific use case you had in mind, that can't be fixed through other features/workarounds (: |
Ok, I was planning to add events anyway to my plugin to provide more customizability, so once it's done I can let you know if you are willing to add the integration. Or I can try creating a pull request if you prefer this way. |
I’m fine with either! If you want to do it, the nvim-tree integration
should be a good enough template to work off of, since the mechanics are
basically same on the Fidget.
…On Sun, Feb 4, 2024 at 1:17 PM Wojciech Kulik ***@***.***> wrote:
Ok, I was planning to add events anyway to my plugin to provide more
customizability, so once it's done I can let you know if you are willing to
add the integration. Or I can try creating a pull request if you prefer
this way.
—
Reply to this email directly, view it on GitHub
<#207 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2A5DGPMUHOVW4YWVGEMDDYR7GC3AVCNFSM6AAAAABCS3X626VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRVHA3TAOBVGY>
.
You are receiving this because you commented.Message ID: <j-hui/fidget.
***@***.***>
|
@j-hui I finished the integration, but I noticed that one thing is missing. Once all messages are gone and I trigger fidget again it starts again at previous offset. How can I subscribe to the event when fidget window is configured? I guess the same problem is with nvim-tree? Unless I missed something |
This is causing the issue, I guess. Shouldn't the offset be preserved?
|
Ah good catch. I'll push a change that fixes that behavior. |
It's already in my pull request, you can check it out :). |
It would be great to be able to configure fidget so that it shows up on the left side
The text was updated successfully, but these errors were encountered: