# 在这里找到一个解决方案 http://www.
# 不过几十个文件挨个改太麻烦了,用这个脚本可以自动修改,放在/usr/share/applications/kde4/里面运行
# 记得运行前备份kde4文件夹

import os
for f in os.listdir('.'):
    s = open(f).read()
    if not 'OnlyShowIn=KDE' in s:
        s = s + "\nOnlyShowIn=KDE"
        file(f, 'w').write(s)
        print f

# 下面是隐藏XFCE菜单的,让其只在XFCE环境下运行
# 记得在/usr/share/applications/目录下运行,同样建议先备份

import os
for f in os.listdir('.'):
    if f.startswith('xfce'):
        s = open(f).read()
        if not 'OnlyShowIn=XFCE' in s:
            s = s + "\nOnlyShowIn=XFCE"
            file(f, 'w').write(s)
            print f