From 870c9fc72c0a6966625ad65df7eaf6ac11c33c75 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Tue, 13 Mar 2018 15:05:31 -0700 Subject: [PATCH] Position the close button on right for Linux and macOS --- journal/unix/journal.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/journal/unix/journal.py b/journal/unix/journal.py index e7b60f7..a9fd09b 100644 --- a/journal/unix/journal.py +++ b/journal/unix/journal.py @@ -16,6 +16,9 @@ else: pipe_path = '/tmp/oneshot-pipe' documents_path = os.path.expanduser('~/Documents') +left_close = False +if sys.platform == "darwin": left_close = True + try: base_path = sys._MEIPASS except AttributeError: base_path = os.path.abspath('.') @@ -62,6 +65,7 @@ class Journal(QWidget): self.close_label = QLabel(self) self.close_label.setPixmap(QPixmap(os.path.join(base_path, 'images', 'close.png'))) + if not left_close: self.close_label.move(776, 0) # X = 800-24 if "linux" in sys.platform: self.setWindowFlags(Qt.FramelessWindowHint) else: self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint) @@ -77,7 +81,7 @@ class Journal(QWidget): self.mousedown = True self.mousedownpos = event.pos() - if self.mousedownpos.x() <= 24 and self.mousedownpos.y() < 24: + if ((left_close and self.mousedownpos.x() <= 24) or (not left_close and self.mousedownpos.x() >= 776)) and self.mousedownpos.y() < 24: self.app.quit() def mouseReleaseEvent(self, event):