refactor: sway: make snip_cmd be an actual shell script

This commit is contained in:
Colin 2023-09-05 00:29:13 +00:00
parent 7f5811db9a
commit e198c49a96

View File

@ -14,11 +14,12 @@ let
screenshot_cmd = "${pkgs.sway-contrib.grimshot}/bin/grimshot copy area"; screenshot_cmd = "${pkgs.sway-contrib.grimshot}/bin/grimshot copy area";
# "bookmarking"/snippets inspired by Luke Smith: # "bookmarking"/snippets inspired by Luke Smith:
# - <https://www.youtube.com/watch?v=d_11QaTlf1I> # - <https://www.youtube.com/watch?v=d_11QaTlf1I>
# TODO: snip_cmd is complex enough it should be its own package and not embedded -- pipes and all -- into the sway config snip_cmd = pkgs.writeShellScript "type_snippet.sh" ''
snip_file = ../snippets.txt; snippet=$(cat ${../snippets.txt} ~/.config/sane-sway/snippets.txt | \
list_snips = "cat ${snip_file} ~/.config/sane-sway/snippets.txt"; ${fuzzel} -d -i -w 60 | \
strip_comments = "${sed} 's/ #.*$//'"; ${sed} 's/ #.*$//')
snip_cmd = "${wtype} $(${list_snips} | ${fuzzel} -d -i -w 60 | ${strip_comments})"; ${wtype} "$snippet"
'';
# TODO: splatmoji release > 1.2.0 should allow `-s none` to disable skin tones # TODO: splatmoji release > 1.2.0 should allow `-s none` to disable skin tones
emoji_cmd = "${pkgs.splatmoji}/bin/splatmoji -s medium-light type"; emoji_cmd = "${pkgs.splatmoji}/bin/splatmoji -s medium-light type";