blob: f817c081d78851ff2299f3bc25d3009679dd1e17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/sh
default_basename=cutbuffer_grab
default_extension=txt
destdir=$HOME/$default_basename
chdir_to_destination()
{
[ -d "$destdir" ] || mkdir -p "$destdir"
cd "$destdir"
}
extract()
{
sort -z -k1,1 -r | head -z -n 1 | xargs -0 printf '%s\n' | cut -d' ' -f2
}
set -e
chdir_to_destination
f=$(find . -maxdepth 1 -type f -name 'cutbuffer_grab.*.txt' -printf "%C@ %h/%f\0" | extract)
xcb -s 0 < "$f"
xsel --input < "$f"
mkdir -p .popped
mv "$f" -t .popped
|