dotfiles/scripts/mark-as-recently-used

17 lines
349 B
Text
Raw Normal View History

2021-04-26 07:20:57 +00:00
#!/usr/bin/env python3
# Taken from <https://unix.stackexchange.com/a/509417/411555>
import gi
import sys
2021-04-26 07:20:57 +00:00
gi.require_version("Gtk", "3.0")
2021-04-26 07:20:57 +00:00
from gi.repository import Gtk, Gio, GLib
rec_mgr = Gtk.RecentManager.get_default()
for arg in sys.argv[1:]:
2021-04-26 07:20:57 +00:00
rec_mgr.add_item(Gio.File.new_for_path(arg).get_uri())
GLib.idle_add(Gtk.main_quit)
Gtk.main()