python-rofi-menu icon indicating copy to clipboard operation
python-rofi-menu copied to clipboard

DesktopEntry item

Open dnalor opened this issue 3 years ago • 2 comments

  • added DesktopEntry class to create a menu item from a .desktop file
  • create_appmenu_flat /create_appmenu_categories function to create a menu from a directory of .desktop files (flat or hierarchical by app category)

dnalor avatar Mar 01 '21 10:03 dnalor

@dnalor, thanks for your contribution

The idea of generating menu based on *.desktop files definitely makes sense.

I'll be quite busy this week, sorry in advance that the code review may take longer than expected.

Meantime I've got a couple suggestions:

  • would be great to use spaces instead of tabs (ideally, would be great to apply black code formatter to rofi_menu/contrib/desktopentry.py)
  • we can use python's glob or even better Path.glob for walking through the file tree

miphreal avatar Mar 02 '21 08:03 miphreal

While I can easily replace os.walk with Path.glob, I'm not sure I see the point - a quick benchmark suggests Path.glob is slower. Finding all *.h files in /usr/include and /usr/local/include: walk: 10494 files: 0.072s / glob: 10494 files :0.194s

Admittedly, for this use case performance is probably irrelevant, but still...

dnalor avatar Mar 03 '21 12:03 dnalor