Compare commits

..

No commits in common. "main" and "1.1" have entirely different histories.
main ... 1.1

View File

@ -66,7 +66,7 @@ fn allmode(args []bool){
fn buildcategory(args []bool, folder string, item string, catname string, mut linkslist []string) {
println('<Menu label="${item}">')
for mut elem in linkslist {
if !(elem.contains('/IM/')) && checktargetcategory(elem, catname) {
if !(elem.contains('/IM/')) && checktargetcategory(elem, item) {
println(buildprogram('${folder}${elem}', args))
elem = '/IM/'
}
@ -76,18 +76,18 @@ fn buildcategory(args []bool, folder string, item string, catname string, mut li
fn categorymode(args []bool) {
mut linkslist := os.ls('/usr/share/applications/') or { panic(err) }
println('<?xml version="1.0"?>\n<JWM>')
println('<?xml version="1.0"?>\n<JWM>\n<Menu label="Accessories">')
//Clean up trash
for mut item in linkslist {
if !(item.contains('.desktop')) || item.contains('krita_') { item = '/IM/' }
}
buildcategory(args, '/usr/share/applications/', "Accessories", "Utility", mut linkslist)
buildcategory(args, '/usr/share/applications/', "Utility", "Accessories", mut linkslist)
buildcategory(args, '/usr/share/applications/', "Office", "Office", mut linkslist)
buildcategory(args, '/usr/share/applications/', "Games", "Game", mut linkslist)
buildcategory(args, '/usr/share/applications/', "Game", "Games", mut linkslist)
buildcategory(args, '/usr/share/applications/', "Graphics", "Graphics", mut linkslist)
buildcategory(args, '/usr/share/applications/', "Internet", "Network", mut linkslist)
buildcategory(args, '/usr/share/applications/', "System Tools", "System", mut linkslist)
buildcategory(args, '/usr/share/applications/', "Network", "Internet", mut linkslist)
buildcategory(args, '/usr/share/applications/', "System", "System Tools", mut linkslist)
buildcategory(args, '/usr/share/applications/', "Other", "NaN", mut linkslist)
println('</JWM>')
@ -98,7 +98,9 @@ fn buildprogram(filename string, args []bool) string {
file := os.read_file(filename) or {
panic(err)
}
content := file.split_into_lines()
return '<Program ${optbuildicon(content, args[0])} label="${strfinder(content, 1)}" ${optbuildtooltip(content, args[1])}>${strfinder(content, 2)}</Program>'
}
@ -147,7 +149,7 @@ fn filter(strorig string, mode int) string {
fn checktargetcategory(filename string, check string) bool {
//println("checking")
if check == "NaN" {
if filename == "NaN" {
return true
}
for line in (os.read_file("/usr/share/applications/${filename}") or { panic(err) }).split_into_lines() {
@ -166,9 +168,9 @@ fn optbuildtooltip(data []string, tooltip bool) string {
return ('tooltip="${strfinder(data, 4)}"')
}
/*fn detectlang() string {
fn detectlang() string {
for item in (os.read_file('/etc/locale.conf') or { panic(err) }).split_into_lines() {
if item.contains('LANG=') { return item.substr(5, 10) }
}
return 'en_US'
}*/
}