tumashu / posframe

Pop a posframe (just a child-frame) at point, posframe is a **GNU ELPA** package!
453 stars 58 forks source link

Feature Request: Can't the posframe have rounded corner? #125

Open SATYADAHAL opened 1 year ago

SATYADAHAL commented 1 year ago

I was wandering if it is possible to remove pointed corner and add something like rouneded corner?

tumashu commented 1 year ago

i do not know :)

SATYADAHAL commented 1 year ago

I don't know much about Emacs lisp. But I assume you created a frame using make-frame. And the make-frame adapts the shape given by the window manager. So getting rounded corner on OS where WM provides rectangular shape is not possible. But my Window Manager(WM) provides rounded corner. I just created a rounded corner using make-frame , the code and screenshot of frame is below. Can it be somehow made compatible for Window Managers that support rounded corner?

(make-frame 
'((fullscreen . nil)
 (parent-frame . (selected-frame))
 (width . 80) (height . 20)
 (title . "posframe")
 (keep-ratio ,keep-ratio)
 (min-width  . 0)
 (min-height . 0)
 (border-width . 0)
 (menu-bar-lines . 0)
 (tool-bar-lines . 0)
 (tab-bar-lines . 0)
 (line-spacing . 0)
 (unsplittable . t)
 (no-other-frame . t)
(undecorated . t)
 (minibuffer . nil)
 (no-special-glyphs . t)
 (skip-taskbar . t)
 (desktop-dont-save . t)
 (left-fringe . 0)
 (right-fringe . 0)))

Screenshot_20230304_091415

tumashu commented 1 year ago

@SATYADAHAL which frame para control rounded corner?

SATYADAHAL commented 1 year ago

@tumashu I am not sure which one does. But default (make-frame) without any parameters gives me rounded corner. All the parameters that I mentioned above didn't seem to change the roundness. If you can provide all the params you have used i can test them out. I don't have good knowledge on lisp to extract all params from your code.

tumashu commented 1 year ago

https://github.com/tumashu/posframe/blob/dace2dcf105e9685b4085836645b3392dc7e2211/posframe.el#L657

woolsweater commented 1 year ago

Although you have passed (parent-frame . (selected-frame)) in the parameters, you've quoted the entire set of parameters without unquoting (selected-frame). This means that you have not created a child frame, but a regular frame (since the parent-frame value is not a valid frame). Notice that if you drag the original frame, the new frame does not move along with it.

With the corrected quoting below, do you still get rounded corners?

(make-frame 
 `((fullscreen . nil)
   (parent-frame . ,(selected-frame))
   (width . 80) (height . 20)
   (title . "posframe")
   (keep-ratio . t)
   (min-width  . 0)
   (min-height . 0)
   (border-width . 0)
   (menu-bar-lines . 0)
   (tool-bar-lines . 0)
   (tab-bar-lines . 0)
   (line-spacing . 0)
   (unsplittable . t)
   (no-other-frame . t)
   (undecorated . t)
   (minibuffer . nil)
   (no-special-glyphs . t)
   (skip-taskbar . t)
   (desktop-dont-save . t)
   (left-fringe . 0)
   (right-fringe . 0)))

If so, what Mac OS version are you running?

SATYADAHAL commented 1 year ago

Rounded corner is given by some DesktopEnvironment to its window's. But since DE doesnot consider child frame as a window its not possible to give child frame a rounded corner. Only option is to make this possible to make frame independent i.e creating a new window. But doing so would not be wise in case of posframe. And with your code I didn't get the rounded corner since its just a child frame. I am not on Mac. I am on fedora KDE spin.

woolsweater commented 1 year ago

Oh, sorry, I mistook those icons at the bottom of the screenshot for Mac icons. It looks like they were designed to be very similiar 🙂

JoshTRN commented 10 months ago

@SATYADAHAL I was able to achieve this on mac os using emacs-plus29 by modifying the following line in posframe.el from:

(undecorated . t)

to:

(undecorated-rounded . t)

https://github.com/tumashu/posframe/blob/017deece88360c7297265680d78a0bb316470716/posframe.el#L693

Note that this is a very mac-specific solve. I was not able to do it on my linux machine.