tvl-depot/tools/eaglemode/commands/emacsclient.nix
Vincent Ambo 06f03b4518 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>
2024-08-30 18:05:59 +00:00

26 lines
513 B
Nix

{ depot, pkgs, ... }:
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.
Emacs server must be running already for this to have any effect.
'';
code = ''
ErrorIfNotSingleTarget();
my @tgt=GetTgt();
my $dir=$tgt[0];
ExecOrError('${pkgs.emacs}/bin/emacsclient', '-n', $dir);
'';
}