From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: desktop-background.el as a new library? Date: Mon, 15 Nov 2021 21:51:13 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25802"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 15 22:12:16 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmjGy-0006US-8L for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Nov 2021 22:12:16 +0100 Original-Received: from localhost ([::1]:47498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmjGx-000520-38 for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Nov 2021 16:12:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmjFu-0003zS-Cw for emacs-devel@gnu.org; Mon, 15 Nov 2021 16:11:10 -0500 Original-Received: from mail-oln040092074021.outbound.protection.outlook.com ([40.92.74.21]:29062 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmjFo-0000Fe-Qn for emacs-devel@gnu.org; Mon, 15 Nov 2021 16:11:10 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QmeMc7e94UIdCPAe3rOcSSGDp6uBXJWAcGin21TF9ySyfVBAYcQMjabekodaBerRbgbE5HZ5u9+Ac4IQQgRyP6pu9JfI8caXKJ+OgQmDvUoWweRPm73jk4jOBwutC87qUOdG81yKLW2UYSLkpAZ1D15d7P4CgCnSl2/y1h8JQwb0xWvmkAroli0Q+qNzw5NcelRb/mBLBpLI5IzNJhyB3V/WjB7GPH3T2cd0t/hRjBnlUfiqkY+9Rc8EAtcTnBsTtUh9g88J8+Dz78DrvumfGhOhWtBPP5KAmCYlzGLfbzbkvu70m/xm+gh5o/3CJAFEfJ50SaFbHicW17qpC+7luQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HYmf7NAt8y1JXZZRoi1IT2yFJA4xi6uvf4aadwjbAnE=; b=TbyOapuwfJMpOqvp2hexjcz2Y28wilseW4KXybiwKj2kigHyja8bdU674rk6YlbjTh3kVOmNIWTGy/0Xh9jqc6A5ea1wzeQB/5EutIvvdKoJ/LkEFyrRtQ8Hx7CaZ34cIPypwW+Ycl22le0YFOwm/T2F1l3+ZJgqk+9XkxGddZgPk/hCfMNlmHA+uzCyitlriiC4ApCbfgJ6/qV8ihUkRL3yfLcW3+mfXLPpX1gKXUg7cdIyz2mmYuQ85JyId/ZNzyexERu1ERCCVfKCnuqsdH5XrrCC/QEbF32wO77uRqF5LU1HafvzE7Ia2FmuADRgBwvao29Ok/btupMhUG6E8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HYmf7NAt8y1JXZZRoi1IT2yFJA4xi6uvf4aadwjbAnE=; b=EoEFDFpvLGvt9iyI9CTFj1xW4vLDty2q9AiuuHK4BCCrS+m9+PMFCSiQdxBK5Ga3UkaGHCJnOLxKAqgENoIrzQ5+fTKby6Bw01ipE43uNjvKkxWgOIZTHzqvngXM5e/yNN2x0hBhjvaBccccndRWa9QSlZDp6JpBza44I76uS4Z0FI4PtZC9h/Q9H+3OWR+d+vr/1WbpvoM5hbOvMwWbjorf5OyFnJfBqj8lXeaCk8XtlWE0VsCI9d/yAbqkgXZ2U+OZ7xNePlJq4LZPYURvDANiTDUsulncxo7pfPYGGVt0VqM6IxgmSm4rS5a4eyvZJLRAaL18dEEh/Scxj9CJVQ== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM4PR0902MB1683.eurprd09.prod.outlook.com (2603:10a6:200:96::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Mon, 15 Nov 2021 20:51:14 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2%8]) with mapi id 15.20.4690.027; Mon, 15 Nov 2021 20:51:14 +0000 In-Reply-To: (Stefan Kangas's message of "Fri, 29 Oct 2021 10:44:01 -0700") X-TMN: [oFr/DYKXCTtG8Q6LvbDiduLWpbQ4fW0O] X-ClientProxiedBy: AM5PR0502CA0005.eurprd05.prod.outlook.com (2603:10a6:203:91::15) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87h7cdf8hq.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM5PR0502CA0005.eurprd05.prod.outlook.com (2603:10a6:203:91::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15 via Frontend Transport; Mon, 15 Nov 2021 20:51:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8c98167-b029-4d05-f9d3-08d9a879a9a1 X-MS-TrafficTypeDiagnostic: AM4PR0902MB1683: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7eO7FPuH02s93NbN0KB9puKUC5K07SdncT6rX1vUb6UgF4vSbX6eBufnNnk5siVcdm9tafOns72bjUb0+aYsWeiYPG3Qa3GOaww7Q8QtGRTh2HvCDvQRdDmd3yT50UDdkRzP63uYb2HT0PAT/Z6qDwjHw5YjPeyIZUi1b8ePNjL3uV4yjMBMAVTJn4iiOWVAAZ0c5AZKNT+qqAQaT3iZqG/rqnV9JafLXOxv4QcPnnigPGGIqXuah43qXq49RVTQ6Gq1qlM1GJ4LAYaauywqmhbFq702adADM8QKrxFEzBQbXhVpTmsP3+2zcU7IHyPSsj49St2fZ1q3pbNnjgvsOIkvZPoB9tEWTrfdOXLvLk2VmqcVILe1XDbKXrPZKNH5nKbbMnOyf4QbYWuCbLeJitKVG/c/nh8BNQLTfuFmwQJFCsaDYn4OboOxKMvs2ttiZxLuSIeP3kypqe83mf2UXDKW/afeB0XGX9vOKByzsT4jaPNDPfT5zPs1XEt1hk7SpqZysm38AyrmJeJuRiySY+ENmgo2YuLtaMK0Cm/pFRw= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QaHTRqa1DezrZw2zK6A8HRHm+vvcVV7SBjZufn7Xu86tDdZwRXxppbdUYOn/KTpzmUBJEhquWx+jzS0hZ1MizhNqSNXmMVfivg97Yjrd1VwW+7f2UaqQ6HKQBzIWXt8Q9DzyzkEVR2R5Ki3p5RnpBDcHqMcQs2oyokhOao8zW0vdNItKA7EF+7lJvCMINOXdDDc31hLeroJg3b5oVn+JsUPmjolgACqE/7/axAEcP95W2Tv63Nwj+qmRPnaX9tRb2BIP60ekeL6xr6kot+PxgbNerMbWWHo+WlLzVqVtjeplydvcoV82y8jjs3DIMQxWSJ9YkskLpoAbSbkYxOez8ZM/DX3/hSyZaFIsP71LadK9M9wzd0kRNM/AJQmHFgL1MDUEvkl1eSe850HfSq4eUPB0BCA6UK9rMZTd9AtgOCsSBum6PrEsiz30uthc5NiGcD3BFsc+4fAACZ9EScosRCBXy5oAp2JGyg5Pe4PAszPonveAJ0F+s1P9X/eDA1ojKbWz4vDxoWnw59HmlpscrubaL3SVZvdnqdvlXsuVnZbo9D/TRHLhBCZp9dq4xh38bJkcgOXqyWgD2AWK+jj/y1k/L6eL1lxDd5kYZuxIGJUKd/5VIR3hI/DQ7xn9zyjCp+/Fl3S2B87AQiVqiizSedFbrvETmiiy/OOGKshfoV1V5wKprFsiw2psm73alXxw8eVV9vpvfZyuup8EnK0x+g== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: e8c98167-b029-4d05-f9d3-08d9a879a9a1 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2021 20:51:14.5526 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0902MB1683 Received-SPF: pass client-ip=40.92.74.21; envelope-from=arthur.miller@live.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:279518 Archived-At: --=-=-= Content-Type: text/plain Stefan Kangas writes: > Arthur Miller writes: > >> Are you sure this is really interesting to people who use some kind of DE? > > No, that's why I'm asking the question. But I note that other image > viewers has such functionality. > >> Have you thought about doing it all with Emacs only. > > Not really, no. It sounds like a lot of work. :-) :-) Njah ... :-) Sorry for little bit late answer on this; but didn't have time to do it back then, and later I forgott it. But I did a little test/sketch, it isn't very difficult to get up a frame with a background image. It was really just 10 nin thing, so no checking for errors, nils etc; just as a demo of the idea. It has hardcoded path to a directory "~/wallpapers" from which it will choose a random wallpaper. My wallpapers are all scaled to my desktop size, but it wouldn't be much work to add like check for scaling and request image to be rescaled. I do see some problems, not sure if it is my wm (compiz) or Emacs: If I add (fullscreen . t) for the frame parameter, Emacs goes nuts: I can't move or rescale other frames despite frame parameter being only for the background frame. Without fullscreen parameter there is tiny strip on the right and bottom edges where real background comes through, and a tiny borders despite me setting borders to nil. I have tried to make frame slightly bigger then my desk and to move image to the right and down but those strips are still there. Besides that, it seems to work fine. As extra bonus user could use "easy menu" to create desktop menus with elisp and emacs. Could be usable for setups with simple WMs without wallpaper and desktop menu features. No extra libraries needed, just plain frame and Emacs compiled with image support. More work required, if anyone is interested, I am not gonna work more on it myself. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=background.el ;;; background.el --- -*- lexical-binding: t; -*- ;; Copyright (C) 2021 Arthur Miller ;; Author: Arthur Miller ;; 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 . ;;; Commentary: ;; ;;; Code: (defvar bg-walpaper-dir (expand-file-name "~/wallpapers")) (defvar bg-img-list nil) (defvar bg-frame nil) (defvar bg-buffer nil) (defvar bg-curr-image nil) (defvaralias 'bg-nd 'directory-files-no-dot-files-regexp) (defun bg-init-buffer () (unless bg-buffer (setq bg-buffer (get-buffer-create " *bg-buffer*"))) (with-current-buffer bg-buffer (with-silent-modifications (erase-buffer) (setq mode-line-format nil) (insert-image (create-image bg-curr-image))))) (defun bg-init-frame () (if (display-graphic-p) (unless bg-frame (let ((w (+ (display-pixel-width) 2)) (h (+ (display-pixel-height) 2))) (setq bg-frame (make-frame `((name . "bg-frame") (width . ,w) (height . ,h) (visibility . t) (auto-raise . nil) (skip-taskbar . t) (no-focus-on-map . t) (no-accept-focus . t) (undecorated . t) (unsplittable . t) (z-group . below) (no-other-frame . t) (minibuffer . nil) (tool-bar-lines . 0) (menu-bar-lines . 0) (left-fringe . 0) (right-fringe . 0) (border-width . 0) (internal-border-width . 0) (vertical-scroll-bars . nil) (horizontal-scroll-bars . nil)))))))) (defun bg-kill-frame () (when bg-frame (delete-frame bg-frame) (setq bg-frame nil) (kill-buffer bg-buffer) (setq bg-buffer nil))) (defun bg-get-random-image () (when bg-walpaper-dir (unless bg-img-list (setq bg-img-list (directory-files bg-walpaper-dir t bg-nd t))) (let ((index (random (length bg-img-list)))) (if (not (equal (nth index bg-img-list) bg-curr-image)) (nth index bg-img-list) (bg-get-random-image))))) (defun bg-show-background (&optional image-name) (interactive) (setq bg-curr-image (or image-name (bg-get-random-image))) (bg-init-buffer) (unless bg-frame (bg-init-frame)) (with-selected-frame bg-frame (switch-to-buffer bg-buffer)) (unless (frame-visible-p bg-frame) (make-frame-visible bg-frame))) (defun bg-hide-background () (interactive) (bg-kill-frame)) (provide 'background) ;;; background.el ends here --=-=-=--