unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: arthur miller <arthur.miller@live.com>
To: "Håkon Flatval" <hkon20@hotmail.com>,
	"Lars Ingebrigtsen" <larsi@gnus.org>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Sv: Support for background transparency
Date: Sun, 28 Nov 2021 00:35:41 +0000	[thread overview]
Message-ID: <AM9PR09MB4977510F2A0FCED31D55060996659@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <PRAP251MB06884841D6DE6564DD518FD5CF649@PRAP251MB0688.EURP251.PROD.OUTLOOK.COM>


[-- Attachment #1.1: Type: text/plain, Size: 4087 bytes --]

If it is of any help, I have just rebuild master with the attached patch. It applied cleanly, but I see some artifacts. If you check the attached screenshot, there are two clocks without calendar, these are produced by Emacs with your patch. There are thin lines on the left and right edges where the default background is visible (green from dark solarized theme I use). There is also a separate frame with an eshell window and top with transparent background where those edges are also visible.

These artifacts were not present in previous version of your patch, one that was on your github since ~19 days ago. I have rebuilt from master yesterday with the previous patch rebased, which also cleanly applied, and I have posted some screenshots to this mail list yesterday where one can see similar clock widget with transparency applied without those edges. I have also attached the code for one of clocks so you can see that I have turned off fringes, borders and anything I could.

For the Clock with a calendar is a conky with conky-vision script.

By the way, why can I not see Håkans mail in Gnus? I just see like xml/http headers and stuff, not the message. I had no problems opening any other email from the list that arrived today. I had to open this one  via web browser.

Thanks for the patch & best regards

________________________________
Från: Emacs-devel <emacs-devel-bounces+arthur.miller=live.com@gnu.org> för Håkon Flatval <hkon20@hotmail.com>
Skickat: den 28 november 2021 00:01
Till: Lars Ingebrigtsen <larsi@gnus.org>
Kopia: emacs-devel@gnu.org <emacs-devel@gnu.org>
Ämne: Re: Support for background transparency

Hi again - sorry for the long radio silence.

>Posting the resulting patch (or a series of patches, depending on how
>much code it is) is the preferred method to get code reviews.

I've attached a patch that implements basic support for background transparency. I have only considered GDK+Cairo build configurations here, as a start.

I believe the gui_set_alpha_background​ function in frame.c​ should return some error message when the frame does not support 32 bits of depth, but am not sure how to do this best. I considered adding a new error code similar to the one used by wrong_type_argument​ (also called from gui_set_...​), but it seemed to be a bit excessive to create a  specific "frame-does-not-support-adequate-bit-depth"-error type when most other error types are of the more general forms "value-out-of-range" or "wrong-length-argument". Does anyone have suggestions on how to best communicate failure in setting alpha to the user?

Newbie question: I can't guarantee that this patch works perfectly with all build variations using GDK+Cairo, nor in all (desktop) environments where Emacs might be used. How, in general, is Emacs tested before release to ensure (most) such edge cases are caught?

I'm currently working on implementing this feature for other XLib-based build configurations too, offline, planning to submit another patch for those in the not-so-distant future.

Best,
Håkon Flatval

________________________________
Fra: Lars Ingebrigtsen <larsi@gnus.org>
Sendt: torsdag 4. november 2021 21:17
Til: Håkon Flatval <hkon20@hotmail.com>
Kopi: emacs-devel@gnu.org <emacs-devel@gnu.org>
Emne: Re: Support for background transparency

Håkon Flatval <hkon20@hotmail.com> writes:

> I have implemented partial support for background transparency in Emacs.

Great!  It's a feature that has been requested many times.

> As I'm completely new to the community, I'd also like some input as to how
> one proceeds with planning and implementation given there is interest for
> this to be made reality. I would be happy to work on this, but not sure I feel
> comfortable / knowledgable enough to do everything on my own.

Posting the resulting patch (or a series of patches, depending on how
much code it is) is the preferred method to get code reviews.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

[-- Attachment #1.2: Type: text/html, Size: 8424 bytes --]

[-- Attachment #2: alpha-patch-screenshot-nov-28.png --]
[-- Type: image/png, Size: 515521 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: emacs-vision-clock.el --]
[-- Type: text/x-emacs-lisp; name="emacs-vision-clock.el", Size: 4577 bytes --]

;;; emacs-vision-clock.el ---  -*- lexical-binding: t; -*-

;; Copyright (C) 2021  Arthur Miller

;; Author: Arthur Miller <arthur.miller@live.com>
;; Keywords: 

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; https://github.com/BobbyBakes/conky-Vision
\f
;;; Code:
(require 'time-stamp)

(defgroup emacs-vision-clock nil
  "Conky like clock application written in Emacs Lisp."
  :prefix "evc--"
  :prefix "emacs-vision-clock-"
  :tag "Conky-Vision style clock as Emacs application."
  :group 'applications)
\f
;;; Customize
(defcustom emacs-vision-clock-x -100
  "Frame width"
  :type 'fixnum
  :group 'emacs-vision-clock)

(defcustom emacs-vision-clock-y 100
  "Frame width"
  :type 'fixnum
  :group 'emacs-vision-clock)

(defface emacs-vision-clock-date-face
  '((t :weight light :family "Poiret One" :default nil
       :foreground "white" :height 280))
  "Default face for emacs-vision-clock frame."
  :group 'emacs-vision-clock)

(defface emacs-vision-clock-time-face
  '((t :weight light :family "Poiret One" :default nil
       :foreground "white" :height 1000))
  "Default face for emacs-vision-clock frame."
  :group 'emacs-vision-clock)
\f
;;; Implementation
(defvar evc--frame nil)
(defvar evc--timer nil)
(defvar evc--buffer nil)

(defun evc--time ()
  (propertize
   (time-stamp-string "%H:%M") 'face 'emacs-vision-clock-time-face))

(defun evc--date ()
  (propertize
   (concat
    (capitalize (time-stamp-string "%A")) ". "
    (capitalize (time-stamp-string "%B %d")))
   'face 'emacs-vision-clock-date-face))

(defun evc--make-frame ()
  (make-frame `((name . "*emacs-vision-clock*")
                (left . ,emacs-vision-clock-x)
                (top . ,emacs-vision-clock-y)
                '(alpha-background . 0)
                (tool-bar-lines . 0)
                (menu-bar-lines . 0)
                (minibuffer . nil)
                (right-fringe . 0)
                (left-fringe . 0)
                (horizontal-scroll-bars . nil)
                (vertical-scroll-bars . nil)
                (border-width . 0)
                (internal-border-width . 0)
                (no-special-glyphs . t)
                (visibility . nil)
                (z-group . below)
                (auto-raise . nil)
                (skip-taskbar . t)
                (no-focus-on-map . t)
                (no-accept-focus . t)
                (unsplittable . t)
                (undecorated . t))))

(defun evc--update ()
  (let ((time (evc--time))
        (date (evc--date)))
    (when (frame-live-p evc--frame)
      (select-frame evc--frame))
    (with-current-buffer evc--buffer
      (erase-buffer)
      (let* ((tlen (* 0.5 (string-pixel-width time)))
             (dlen (* 0.5 (string-pixel-width date)))
             (spct (propertize " " 'display `(space :align-to (- center (,tlen)))))
             (spcd (propertize " " 'display `(space :align-to (- center (,dlen))))))
        (insert spct time "\n" spcd date)
        (goto-char 1)))))

(defun evc--make-buffer ()
  (with-current-buffer (get-buffer-create "  *emacs-vision-clock*")
    (setq cursor-in-non-selected-windows nil mode-line-format nil)
    (setq evc--buffer (current-buffer))))

(defun evc--make-widget ()
  (let ((frame (evc--make-frame)))
    (evc--make-buffer)
    (select-frame frame)
    (switch-to-buffer evc--buffer)
    (delete-other-windows)
    (evc--update)
    (fit-frame-to-buffer)
    (make-frame-visible frame)
    (set-window-dedicated-p (selected-window) t)
    (setq evc--frame frame evc--timer (run-at-time nil 60 #'evc--update))))
\f
;;; Public commands
(defun emacs-vision-clock-run ()
  (interactive)
  (unless evc--frame
    (evc--make-widget)))

(defun emacs-vision-clock-stop ()
  (interactive)
  (if evc--timer (cancel-timer evc--timer))
  (if evc--frame (delete-frame evc--frame))
  (if evc--buffer (kill-buffer evc--buffer))
  (setq evc--buffer nil evc--frame nil evc--timer nil))

(provide 'emacs-vision-clock)
;;; emacs-vision-clock.el ends here

  reply	other threads:[~2021-11-28  0:35 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 19:45 Support for background transparency Håkon Flatval
2021-11-04 20:06 ` Eli Zaretskii
2021-11-04 20:17 ` Lars Ingebrigtsen
2021-11-27 23:01   ` Håkon Flatval
2021-11-28  0:35     ` arthur miller [this message]
2021-11-28 13:32       ` Sv: " Lars Ingebrigtsen
2021-11-28 16:04         ` Arthur Miller
2021-11-28 20:33           ` Håkon Flatval
2021-11-29  2:56             ` Arthur Miller
2021-11-28  7:41     ` Eli Zaretskii
2021-11-28  7:47       ` Po Lu
2021-11-28  8:27         ` Eli Zaretskii
2021-12-01 18:54       ` Sv: " Håkon Flatval
2021-12-09 17:13         ` Håkon Flatval
2021-12-10  0:40           ` Lars Ingebrigtsen
2022-01-19 17:26             ` Sv: " Håkon Flatval
2022-01-20  0:52               ` Po Lu
2022-01-20 19:52                 ` Sv: " Håkon Flatval
2022-01-21  0:59                   ` Po Lu
2022-01-23 13:48                     ` Håkon Flatval
2022-01-24  0:11                       ` Po Lu
2022-01-25 17:53                         ` Håkon Flatval
2022-01-26  1:00                           ` Po Lu
2022-01-24 10:22                       ` Po Lu
2022-01-25 19:47                         ` Håkon Flatval
2022-01-25 19:37                           ` Robert Pluim
2022-01-26 18:16                             ` Håkon Flatval
2022-01-26  1:05                           ` Po Lu
2022-01-26 11:11                             ` Robert Pluim
2022-01-26 18:34                             ` Håkon Flatval
2022-01-27  1:00                               ` Po Lu
2022-01-29  0:01                                 ` Håkon Flatval
2022-01-29  1:08                                   ` Po Lu
2022-01-20  9:12               ` Robert Pluim
2022-01-23 21:43                 ` Håkon Flatval
2022-01-24  9:14                   ` Robert Pluim
2022-01-25 20:00                     ` Håkon Flatval
2022-01-25 19:31                       ` Robert Pluim
2022-01-29 10:26                         ` Po Lu
2022-01-29 15:17                           ` Håkon Flatval
2022-01-30  0:53                             ` Po Lu
2021-11-28 13:41     ` Lars Ingebrigtsen
2021-11-28 15:05       ` Sv: " Håkon Flatval
2021-11-28 16:07         ` Gregor Zattler
2021-11-28 16:32         ` Lars Ingebrigtsen
2021-11-28 18:10     ` Jean Louis
2021-11-28 18:44       ` Sv: " Håkon Flatval

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM9PR09MB4977510F2A0FCED31D55060996659@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    --cc=hkon20@hotmail.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).