Fix weird flux menu
Some distro’s just add all the items under single menu and thus the menu itself becomes unusable because of the number of items in the submenu and this I did not like and hence ceated this simply python script to fix that. For using the script, back up you “menu” file, redirect the output of this script to ‘menu’ file again.
#!/bin/python F = open("~/.fluxbox/menu", "r") count=0 mkc=1 started=0 for line in F: print line.rstrip() if '[submenu]' in line.lower() and started == 1: print '[end]' if '[end]' in line.lower(): count=0 mkc=1 if started > 0: started=0 # print "Count is {}".format(count) # print "Started is {}".format(started) print '[end]' if '[exec]' in line.lower(): if count > 15 : if started > 0: started=0 print '[end]' # print "Count is {}".format(count) # print "Started is {}".format(started) print '[submenu] ({})'.format(mkc) started=1 mkc+=1 count=0 # print count count+=1
Related articles across the web
Related Articles:
- 2012/10/22 Xnest – XDMCP protocol and virtual DM
- 2010/11/03 Announcing the release of Fedora 14 and upgrade procedure.
- 2010/06/05 How To Install Ailurus On Fedora
- 2010/04/28 String and Array Creation
- 2017/04/10 scapy packet dump to packet
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.