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 <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: azahi <azat@bahawi.net>
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2024-08-28 14:53:58 +03:00 committed by tazjin
parent 91e76a90a0
commit 06f03b4518
2 changed files with 11 additions and 1 deletions

View file

@ -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.

View file

@ -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.
#