Last active
January 9, 2019 20:00
-
-
Save shitpoet/02791968d0f62d8d78df2ef2645f64b1 to your computer and use it in GitHub Desktop.
Add a file to GNOME's recent files list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
f=~/.local/share/recently-used.xbel | |
s=`cat $f` | |
t=`echo "$s" | sed 's/<\/xbel>//g'` | |
target="$@" | |
dt=`date '+%Y-%m-%dT%H:%M:%SZ'` | |
mime=`file -b --mime-type "$target"` | |
b=" | |
<bookmark href=\"file://$target\" added=\"$dt\" modified=\"$dt\" visited=\"$dt\"> | |
<info> | |
<metadata owner=\"http://freedesktop.org\"> | |
<mime:mime-type type=\"$mime\"/> | |
</metadata> | |
</info> | |
</bookmark> | |
</xbel> | |
" | |
echo "$t" "$b" > $f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment