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

patch: vertical mode #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SimonTeixidor
Copy link
Contributor

This PR introduces a flag (-v) and Xresource (xnotify.vertical), which causes the image to be placed on top of the text instead of to the left of it.

This introduces quite some changes, I hope I didn't break anything. I have tried to test it in all combinations I could think of (with/without image, vertical/not vertical, shrink/not shrink).

xnotify.c Outdated
@@ -931,7 +931,7 @@ additem(struct Queue *queue, struct Itemspec *itemspec)
if(config.vertical) {
item->textw = queue->w - config.padding_pixels * 2;
} else {
item->textw = queue->w - config.image_pixels - config.padding_pixels * 3;
item->textw = MAX(1, queue->w - config.image_pixels - config.padding_pixels * 3);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this issue, which was already there on master. Basically, if you specify an image wider than the width of the notification, item->textw goes negative, and XCreatePixmap fails. I work around this by adding an extra 1 pixel for this scenario, but feel free to suggest a more elegant solution!

@phillbush
Copy link
Owner

This introduces quite some changes, I hope I didn't break anything. I have tried to test it in all combinations I could think of (with/without image, vertical/not vertical, shrink/not shrink).

So I think I'll do like herbe and keep big patches as pull requests.
If more people ask for it, I'll merge into master.

I'll fix that bug, thanks for finding it!

@phillbush phillbush changed the title Introduce vertical mode patch: vertical mode Feb 21, 2021
@phillbush
Copy link
Owner

I did another change and I could not reproduce the bug here, can you try if the bug persists?
The change broke the patch, however, the conflicts must be resolved.

@SimonTeixidor
Copy link
Contributor Author

I did another change and I could not reproduce the bug here, can you try if the bug persists?
The change broke the patch, however, the conflicts must be resolved.

Seems fixed.

I've resolved the conflict as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants