Advertisement
constantin-net

add sxiv's marked item in gtk recent used list

Aug 27th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # run python3 ~/.bin/add_item_gtk3.py after exiting sxiv
  3. import gi
  4. gi.require_version('Gtk', '3.0')
  5. from gi.repository import GLib, Gtk
  6.  
  7. f = open('/tmp/sxiv-marked')
  8. recent_mgr = Gtk.RecentManager.get_default()
  9. for files in f:
  10.     line = r'file://'+str(files)
  11.     line = ('%r' % line)[1:-3]
  12.     recent_mgr.add_item(line)
  13.  
  14. GLib.idle_add(Gtk.main_quit)
  15. Gtk.main()
  16. f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement