added permaclip and made macros more reproducable n stuff

This commit is contained in:
Schrottkatze 2022-09-12 17:00:34 +02:00
parent bd39e7bd6f
commit 88d91caaac
5 changed files with 50 additions and 1 deletions

View file

@ -0,0 +1,37 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "pc-set" ''
# create ~/permaclip if it doesnt exist already
mkdir -p $HOME/permaclip
tr_name=$(echo $@ | xargs)
if [ x"$tr_name" != x"" ]; then
tr_name="''${tr_name% (*}"
clipdata=$(xclip -selection c -o)
echo $clipdata > $HOME/permaclip/$tr_name
fi
echo -e "\0markup-rows\x1ftrue"
for reg in $(ls ~/permaclip); do
content=$(cat ~/permaclip/$reg)
echo -e "$reg (<i>''${content:0:30}</i>)"
done
'';
pkgs.writeShellScriptBin "pc-get" ''
# create ~/permaclip if it doesnt exist already
mkdir -p $HOME/permaclip
tr_name=$(echo ''${@% (*} | xargs)
if [ x"$tr_name" != x"" ]; then
xclip -selection c -i $HOME/permaclip/''${tr_name% (*} &> /dev/null
exit 0
fi
echo -e "\0markup-rows\x1ftrue"
for reg in $(ls ~/permaclip); do
content=$(cat ~/permaclip/$reg)
echo -e "$reg (<i>''${content:0:50}...</i>)"
done
'';