pyqttoast icon indicating copy to clipboard operation
pyqttoast copied to clipboard

Toast allways centered on KDE-Wayland

Open fleixi opened this issue 1 year ago • 3 comments

the toast is always centered in screen on my arch-linux with kde and wayland. I have tested all 3 demo apps. How can i help you debugging the problem?

fleixi avatar Apr 23 '24 20:04 fleixi

That's really odd, I'll definitely look into it

Could you run this code and tell me where the toasts are being displayed?

import sys
from PyQt6.QtWidgets import QMainWindow, QPushButton, QApplication
from pyqttoast import Toast, ToastPreset, ToastPosition


class Window(QMainWindow):
    def __init__(self):
        super().__init__(parent=None)

        # Add button and connect click event
        self.button = QPushButton(self)
        self.button.setText('Show toast')
        self.button.clicked.connect(self.show_toast)

    # Shows a toast notification every time the button is clicked
    def show_toast(self):
        toast = Toast(self)
        toast.setDuration(5000)  # Hide after 5 seconds
        toast.setTitle('Success! Confirmation email sent.')
        toast.setText('Check your email to complete signup.')
        toast.applyPreset(ToastPreset.SUCCESS)  # Apply style preset
        toast.setPosition(ToastPosition.BOTTOM_RIGHT)
        toast.show()


# Run demo
if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Window()
    window.show()
    app.exec()

niklashenning avatar Apr 24 '24 21:04 niklashenning

the toast is being displayed in the center of the screen with our code.

fleixi avatar Apr 27 '24 12:04 fleixi

I found the issue. Wayland intentionally has no mechanism for applications to specify their window position, so it's not possible to move the toast into a specific position. Unfortunately, as far as I know, this cannot be fixed.

See https://github.com/libsdl-org/SDL/issues/7197 https://mir-server.io/docs/window-positions-under-wayland

niklashenning avatar Apr 30 '24 15:04 niklashenning

that is sad. Just to be curious: desktopenvironments like kde are able to pop up the notification on any place the like on wayland because ... ?

fleixi avatar Jun 12 '24 11:06 fleixi