reddit / emacs

png to icns (Emacs DWIM style) via script - last one, promise

xenodium · 2022-07-09 13:11
xenodium · 2022-07-09 13:12
[https://xenodium.com/png-to-icns-emacs-dwim-style/](https://xenodium.com/png-to-icns-emacs-dwim-style/) Another usage of `dwim-shell-command--on-marked-files`. It's pretty simple to also invoke short inline scripts using command line utilities: (defun dwim-shell-command-convert-image-to-icns () "Convert png to icns icon." (interactive) (dwim-shell-command--on-marked-files "Convert png to icns icon" "mkdir <<fne>>.iconset sips -z 16 16 <<f>> --out <<fne>>.iconset/icon_16x16.png sips -z 32 32 <<f>> --out <<fne>>.iconset/icon_16x16@2x.png sips -z 32 32 <<f>> --out <<fne>>.iconset/icon_32x32.png sips -z 64 64 <<f>> --out <<fne>>.iconset/icon_32x32@2x.png sips -z 128 128 <<f>> --out <<fne>>.iconset/icon_128x128.png sips -z 256 256 <<f>> --out <<fne>>.iconset/icon_128x128@2x.png sips -z 256 256 <<f>> --out <<fne>>.iconset/icon_256x256@2x.png sips -z 512 512 <<f>> --out <<fne>>.iconset/icon_512x512.png sips -z 512 512 <<f>> --out <<fne>>.iconset/icon_256x256@2x.png sips -z 1024 1024 <<f>> --out <<fne>>.iconset/icon_512x512@2x.png iconutil -c icns <<fne>>.iconset " :utils '("sips" "iconutil") :extensions "png"))
IfThisIsntBeautiful · 2022-07-09 15:39
Nice job op. What modeline are you using?
anuctal · 2022-07-09 15:44
And what Emacs theme do you use? It's very nice
xenodium · 2022-07-09 16:20
Moody and some other tweaks. All ui config at https://github.com/xenodium/dotsies/blob/main/emacs/features/fe-ui.el
Ghosty141 · 2022-07-09 16:21
Shoold be this one: https://github.com/tarsius/moody
xenodium · 2022-07-09 16:23
Material with some additional tweaks. All ui config at https://github.com/xenodium/dotsies/blob/main/emacs/features/fe-ui.el
IfThisIsntBeautiful · 2022-07-09 16:28
Great thank you
anuctal · 2022-07-09 16:39
Thank you!
ftrx · 2022-07-09 17:48
Very nice alternative to personal script for unix shell, but why DWIM? DWIM is normally associated to something where arguments are auto-guessed instead of being passed, like "move file" and dired seen another dired buffer on sight offer to move them there. Your collection is more `dired-action-do-something-on-marked-files` :-)
xenodium · 2022-07-09 17:55
Details of why DWIM at https://xenodium.com/emacs-dwim-shell-command but the gist is: 1. If invoked from dired, operate on dired files. 2. If invoked on a buffer with a file associated, it operates on that instead. 3. If the command generates a file in current directory, show me the file in dired (a la `dired-jump`). 4. If the command generates an error, offer to show the entire shell command output. 5. If the command generates no new file but was successful, show me all shell output instead.