Giter Club home page Giter Club logo

Comments (13)

stardiviner avatar stardiviner commented on July 26, 2024 1

I tried following settings, but none of them works.

  (add-to-list 'company-box-frame-parameters
               '(font . "-SRC-Hack-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"))
  (add-to-list 'company-box-frame-parameters
               '(font-parameter . "-SRC-Hack-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"))
  (add-to-list 'company-box-frame-parameters
               '(border-width . 2))
  (add-to-list 'company-box-frame-parameters
               '(border-color . "red"))
  (add-to-list 'company-box-frame-parameters
               '(scroll-bar-width . 2))

EDITED
After restart Emacs, now those settings like font seems worked. But border width and border color still does not work.

from company-box.

tam5 avatar tam5 commented on July 26, 2024 1

I know this not really about original issue, but stumbled upon this looking for a way to change the border color.

Actually what I was after was something similar to Sublime Text's version of popups:

image

I think I have achieved something very close, but it seems like kind of a hack. I'll share it, in case it is helpful. Here is what mine looks like:

image

First, set the value for undecorated to nil in company-box-frame-parameters, then add this code somewhere which will turn it back to t after the frame has already been created.

(defun add-ui-frame-hack (orig-fun &rest args)
  "Set some frame parameters AFTER the frame has already been created."
  (let ((frame (apply orig-fun args)))
    (set-frame-parameter frame 'undecorated t)
    (set-frame-parameter frame 'ns-appearance 'light)
    frame))
(advice-add 'company-box--make-frame :around #'add-ui-frame-hack)

The ultimate result is you get the shadow around the frame which gives a nice border, without the title bar and buttons at the top.

This does it for me.

(Emacs 26.1, Max OS 10.14)

from company-box.

sebastiencs avatar sebastiencs commented on July 26, 2024

The font used in the frame is the one specified in default-frame-alist, you can either change this variable or company-box-frame-parameters

For the scrollbar it should be fixed in a recent commit, from yesterday

from company-box.

stardiviner avatar stardiviner commented on July 26, 2024

About the scrollbar, it is fixed. Then I found it is little kind of thick. Can it be thinner? Sorry I raise so many requests. Because I try to figure out company-box child-frame code, but can't understand them enough. If I can I might PR by myself. And thanks for this great package.

from company-box.

 avatar commented on July 26, 2024

I also tried to change the scroll-bar width but noticed that while I could make it larger, I couldn't make it any smaller than its original size.

from company-box.

stardiviner avatar stardiviner commented on July 26, 2024

@nealot I checked out (current-frame-configuration), found company-box-scrollbar value is a buffer: (company-box-scrollbar . #<buffer *company-box-60817588-scrollbar*>). In function company-box--update-scrollbar, The scrollbar-pixels in let-binding seems decide the scrollbar width.

from company-box.

stardiviner avatar stardiviner commented on July 26, 2024

You're right, after I changed code

(setq
       company-box--scrollbar-window
       (with-selected-frame (company-box--get-frame)
         (display-buffer-in-side-window
          (company-box--update-scrollbar-buffer height-blank height-scrollbar percent buffer)
          '((side . right) (window-width . 2)))))

In function company-box--update-scrollbar, the scrollbar get larger, and can't get back smaller anymore no matter I re-evaluate function definition. Weird.

from company-box.

sebastiencs avatar sebastiencs commented on July 26, 2024

Sorry I raise so many requests.

No problem, you're raising issues others might have too :)

The scrollbar can't be smaller. It has its own window and the minimum width of a window is hardcoded in the emacs source code:
https://github.com/emacs-mirror/emacs/blob/6e362a32bc9d21f73a0f29ca6f45481edeea6f29/src/window.c#L3970
I didn't try to change this hardcoded value, it might work.

The scrollbar-pixels in let-binding seems decide the scrollbar width.

This value is the scrollbar height, in pixel.

from company-box.

sebastiencs avatar sebastiencs commented on July 26, 2024

border width and border color still does not work.

You can't define "normal" borders with child frames, you need to use internal border with the frame parameter internal-border-width

(add-to-list 'company-box-frame-parameters '(internal-border-width . 10))

from company-box.

 avatar commented on July 26, 2024

@sebastiencs Would it be possible to define faces specifically for company-box borders? I know you can set the global internal border face but that makes some other components look ugly.

from company-box.

sebastiencs avatar sebastiencs commented on July 26, 2024

@nealot I think that you can use the function set-face-attribute to change faces on a specific frame

from company-box.

ig-perez avatar ig-perez commented on July 26, 2024

I also wanted to change the font face of the documentation and candidates list. I thought that was defined by company but it seems company-box overrides those faces, so thanks to the code snippet of @stardiviner I was able to make the adjustment like this:

(use-package company-box
  :after company
  :ensure t
  :hook (company-mode . company-box-mode)
  :config
  (setq company-box-show-single-candidate t)
  (setq x-gtk-resize-child-frames 'hide)  ;; This solves the variable scrollbar width. This is probably related to Wayland

  (add-to-list
   'company-box-frame-parameters
   '(font . "JetBrains Mono-11")
   )
  )

I'm not quite happy with that since I was using a default face setting like this:

(set-face-attribute 'default nil :family "JetBrains Mono" :height 130)

Then inheriting from it to adjust the font height of other faces. Using add-to-list makes me add a hardcoded style in the configuration.

Is there another way to set the font size?

Thanks!

from company-box.

stardiviner avatar stardiviner commented on July 26, 2024

@ig-perez You can define a variable of cons like '("JetBrains Mono" . 130), And use this variable in font setting to avoid hardcoded style.

from company-box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.