From 06f03b4518360539c0fbee00b9b9750b0710b6bd Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 28 Aug 2024 14:53:58 +0300 Subject: feat(eaglemode/emacsclient): use actual Emacs icon for command Adds a new function that converts anything to a TGA image (imagemagick really is magic), with which arbitrary icons can be converted. This is demoed with the emacsclient command, which just takes the icon out of the Emacs package tree. Change-Id: I771bafed7b07a37c847bd07db986228b9fda60a0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12374 Autosubmit: tazjin Tested-by: BuildkiteCI Reviewed-by: azahi Reviewed-by: tazjin --- tools/eaglemode/commands/emacsclient.nix | 7 ++++++- tools/eaglemode/default.nix | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/eaglemode/commands/emacsclient.nix b/tools/eaglemode/commands/emacsclient.nix index d5aacd137fdc..bac3674120ee 100644 --- a/tools/eaglemode/commands/emacsclient.nix +++ b/tools/eaglemode/commands/emacsclient.nix @@ -1,8 +1,13 @@ { depot, pkgs, ... }: -depot.tools.eaglemode.mkCommand { +let + em = depot.tools.eaglemode; + icon = em.mkTGA "emacs" "${pkgs.emacs}/share/icons/hicolor/128x128/apps/emacs.png"; +in +em.mkCommand { name = "Emacsclient"; hotkey = "Ctrl+E"; + icon = "${icon}"; description = '' Open target in Emacsclient. diff --git a/tools/eaglemode/default.nix b/tools/eaglemode/default.nix index eade62c02898..0b0c0caa8ba8 100644 --- a/tools/eaglemode/default.nix +++ b/tools/eaglemode/default.nix @@ -63,6 +63,11 @@ rec { '') ); + # mkTGA converts the given image to a TGA image. + mkTGA = name: path: pkgs.runCommand "${name}.tga" { } '' + ${pkgs.imagemagick}/bin/convert ${path} $out + ''; + # etcDir creates a directory layout suitable for use in the EM_USER_CONFIG_DIR # environment variable. # -- cgit 1.4.1