| ofs | hex dump | ascii |
|---|
| 0000 | 56 69 6d 9f 55 6e 44 6f e5 00 03 f6 e3 1e 34 14 38 d6 39 04 8c c6 a9 c2 0a a9 1d 3a 5a 11 f3 cc | Vim.UnDo......4.8.9........:Z... |
| 0020 | 3d ad d2 ee 1c 23 3e 26 48 cd 02 00 00 00 4d 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 | =....#>&H.....M................. |
| 0040 | 00 00 0a 00 00 00 00 00 00 00 0a 00 00 00 0a 00 00 00 0a 00 00 00 00 69 a1 13 48 04 01 00 00 00 | .......................i..H..... |
| 0060 | 07 00 5f d0 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 | .._............................. |
| 0080 | 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0100 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0120 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0140 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0160 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0180 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 01a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 01c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 01e0 | 00 00 00 00 00 00 69 a1 12 c1 04 01 00 00 00 01 00 f5 18 00 00 00 5a 00 00 00 00 00 00 00 00 00 | ......i...............Z......... |
| 0200 | 00 00 01 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5a 00 00 00 4a 2d 2d 20 | ........................Z...J--. |
| 0220 | 4c 75 61 20 73 63 72 69 70 74 20 74 6f 20 6c 61 75 6e 63 68 20 61 70 70 6c 69 63 61 74 69 6f 6e | Lua.script.to.launch.application |
| 0240 | 73 20 75 73 69 6e 67 20 64 6d 65 6e 75 20 77 69 74 68 20 63 75 73 74 6f 6d 20 63 6f 6e 66 69 67 | s.using.dmenu.with.custom.config |
| 0260 | 75 72 61 74 69 6f 6e 00 00 00 00 00 00 00 1d 2d 2d 20 43 75 73 74 6f 6d 20 64 6d 65 6e 75 20 63 | uration........--.Custom.dmenu.c |
| 0280 | 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 13 6c 6f 63 61 6c 20 64 6d 65 6e 75 5f 63 6d 64 20 | onfiguration....local.dmenu_cmd. |
| 02a0 | 3d 20 7b 00 00 00 0d 09 22 64 6d 65 6e 75 5f 72 75 6e 22 2c 00 00 00 07 09 22 2d 66 6e 22 2c 00 | =.{....."dmenu_run",....."-fn",. |
| 02c0 | 00 00 18 09 22 46 69 72 61 20 43 6f 64 65 2d 31 30 22 2c 20 2d 2d 20 66 6f 6e 74 00 00 00 07 09 | ...."Fira.Code-10",.--.font..... |
| 02e0 | 22 2d 6e 62 22 2c 00 00 00 1a 09 22 23 31 65 31 65 31 65 22 2c 20 2d 2d 20 6e 6f 72 6d 62 67 63 | "-nb",....."#1e1e1e",.--.normbgc |
| 0300 | 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 1a 09 22 23 63 63 63 63 63 63 22 2c 20 2d | olor....."-nf",....."#cccccc",.- |
| 0320 | 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 73 62 22 2c 00 00 00 19 09 22 23 32 | -.normfgcolor....."-sb",....."#2 |
| 0340 | 34 37 32 63 38 22 2c 20 2d 2d 20 73 65 6c 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 73 66 22 2c | 472c8",.--.selbgcolor....."-sf", |
| 0360 | 00 00 00 19 09 22 23 65 35 65 35 65 35 22 2c 20 2d 2d 20 73 65 6c 66 67 63 6f 6c 6f 72 00 00 00 | ....."#e5e5e5",.--.selfgcolor... |
| 0380 | 06 09 22 2d 6c 22 2c 00 00 00 26 09 22 31 30 22 2c 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 6c | .."-l",...&."10",.--.number.of.l |
| 03a0 | 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 00 00 00 01 7d 00 00 00 00 00 00 00 2d 2d 2d | ines.in.the.dmenu....}.......--- |
| 03c0 | 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 2e 64 65 | .Function.to.get.the.list.of..de |
| 03e0 | 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 00 22 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 67 65 | sktop.files..."local.function.ge |
| 0400 | 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 19 09 6c 6f 63 61 6c 20 64 65 73 6b | t_desktop_files().....local.desk |
| 0420 | 74 6f 70 5f 66 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5e 09 6c 6f 63 61 6c 20 64 69 72 73 20 3d 20 | top_files.=.{}...^.local.dirs.=. |
| 0440 | 7b 20 6f 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 29 20 2e 2e 20 22 2f 2e 6c 6f 63 61 6c 2f | {.os.getenv("HOME")...."/.local/ |
| 0460 | 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 2c 20 22 2f 75 73 72 2f 73 68 61 72 65 | share/applications",."/usr/share |
| 0480 | 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 20 7d 00 00 00 00 00 00 00 1e 09 66 6f 72 20 5f 2c 20 | /applications".}.........for._,. |
| 04a0 | 64 69 72 20 69 6e 20 69 70 61 69 72 73 28 64 69 72 73 29 20 64 6f 00 00 00 40 09 09 6c 6f 63 61 | dir.in.ipairs(dirs).do...@..loca |
| 04c0 | 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 22 66 69 6e 64 20 22 20 2e 2e 20 64 69 | l.pfile.=.io.popen("find."....di |
| 04e0 | 72 20 2e 2e 20 27 20 2d 6e 61 6d 65 20 22 2a 2e 64 65 73 6b 74 6f 70 22 27 29 00 00 00 1e 09 09 | r....'.-name."*.desktop"')...... |
| 0500 | 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a 6c 69 6e 65 73 28 29 20 64 6f 00 00 00 24 | for.file.in.pfile:lines().do...$ |
| 0520 | 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 2c 20 66 | ...table.insert(desktop_files,.f |
| 0540 | 69 6c 65 29 00 00 00 05 09 09 65 6e 64 00 00 00 0f 09 09 70 66 69 6c 65 3a 63 6c 6f 73 65 28 29 | ile)......end......pfile:close() |
| 0560 | 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 15 09 72 65 74 75 72 6e 20 64 65 73 6b 74 6f 70 5f | .....end.........return.desktop_ |
| 0580 | 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 50 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 | files....end.......P--.Function. |
| 05a0 | 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6e 61 6d 65 20 | to.extract.the.application.name. |
| 05c0 | 61 6e 64 20 65 78 65 63 20 63 6f 6d 6d 61 6e 64 20 66 72 6f 6d 20 61 20 64 65 73 6b 74 6f 70 20 | and.exec.command.from.a.desktop. |
| 05e0 | 66 69 6c 65 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 78 74 72 61 63 74 5f 69 | file....local.function.extract_i |
| 0600 | 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 28 09 6c 6f 63 61 6c | nfo_from_desktop(file)...(.local |
| 0620 | 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6e 69 6c 2c 20 6e | .app_name,.exec_command.=.nil,.n |
| 0640 | 69 6c 00 00 00 00 00 00 00 1e 09 66 6f 72 20 6c 69 6e 65 20 69 6e 20 69 6f 2e 6c 69 6e 65 73 28 | il.........for.line.in.io.lines( |
| 0660 | 66 69 6c 65 29 20 64 6f 00 00 00 1e 09 09 69 66 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 5e 4e 61 | file).do......if.line:match("^Na |
| 0680 | 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 19 09 09 09 61 70 70 5f 6e 61 6d 65 20 3d 20 6c 69 6e 65 | me=").then.......app_name.=.line |
| 06a0 | 3a 73 75 62 28 36 29 00 00 00 22 09 09 65 6c 73 65 69 66 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 | :sub(6)..."..elseif.line:match(" |
| 06c0 | 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 1d 09 09 09 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 | ^Exec=").then.......exec_command |
| 06e0 | 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 05 09 09 65 6e 64 00 00 00 00 00 00 00 23 09 | .=.line:sub(6)......end.......#. |
| 0700 | 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 74 68 | .if.app_name.and.exec_command.th |
| 0720 | 65 6e 00 00 00 08 09 09 09 62 72 65 61 6b 00 00 00 05 09 09 65 6e 64 00 00 00 04 09 65 6e 64 00 | en.......break......end.....end. |
| 0740 | 00 00 00 00 00 00 1e 09 72 65 74 75 72 6e 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f | ........return.app_name,.exec_co |
| 0760 | 6d 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 | mmand....end........--.Function. |
| 0780 | 74 6f 20 72 75 6e 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 | to.run.the.application.using.dme |
| 07a0 | 6e 75 00 00 00 23 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c | nu...#local.function.launch_appl |
| 07c0 | 69 63 61 74 69 6f 6e 28 29 00 00 00 2a 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 | ication()...*.local.desktop_file |
| 07e0 | 73 20 3d 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 14 09 6c 6f 63 61 | s.=.get_desktop_files().....loca |
| 0800 | 6c 20 61 70 70 5f 6c 69 73 74 20 3d 20 7b 7d 00 00 00 18 09 6c 6f 63 61 6c 20 61 70 70 5f 63 6f | l.app_list.=.{}.....local.app_co |
| 0820 | 6d 6d 61 6e 64 73 20 3d 20 7b 7d 00 00 00 00 00 00 00 21 09 2d 2d 20 47 61 74 68 65 72 20 61 70 | mmands.=.{}.......!.--.Gather.ap |
| 0840 | 70 20 6e 61 6d 65 73 20 61 6e 64 20 63 6f 6d 6d 61 6e 64 73 00 00 00 28 09 66 6f 72 20 5f 2c 20 | p.names.and.commands...(.for._,. |
| 0860 | 66 69 6c 65 20 69 6e 20 69 70 61 69 72 73 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f | file.in.ipairs(desktop_files).do |
| 0880 | 00 00 00 40 09 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 | ...@..local.app_name,.exec_comma |
| 08a0 | 6e 64 20 3d 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 | nd.=.extract_info_from_desktop(f |
| 08c0 | 69 6c 65 29 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 | ile)...#..if.app_name.and.exec_c |
| 08e0 | 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 23 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 61 | ommand.then...#...table.insert(a |
| 0900 | 70 70 5f 6c 69 73 74 2c 20 61 70 70 5f 6e 61 6d 65 29 00 00 00 28 09 09 09 61 70 70 5f 63 6f 6d | pp_list,.app_name)...(...app_com |
| 0920 | 6d 61 6e 64 73 5b 61 70 70 5f 6e 61 6d 65 5d 20 3d 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 | mands[app_name].=.exec_command.. |
| 0940 | 00 05 09 09 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 17 09 69 66 20 23 61 70 70 5f | ....end.....end.........if.#app_ |
| 0960 | 6c 69 73 74 20 3d 3d 20 30 20 74 68 65 6e 00 00 00 21 09 09 70 72 69 6e 74 28 22 4e 6f 20 61 70 | list.==.0.then...!..print("No.ap |
| 0980 | 70 6c 69 63 61 74 69 6f 6e 73 20 66 6f 75 6e 64 2e 22 29 00 00 00 08 09 09 72 65 74 75 72 6e 00 | plications.found.")......return. |
| 09a0 | 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 35 09 2d 2d 20 4a 6f 69 6e 20 74 68 65 20 61 70 70 20 | ....end.......5.--.Join.the.app. |
| 09c0 | 6e 61 6d 65 73 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c 65 20 73 74 72 69 6e 67 20 66 6f 72 20 64 | names.into.a.single.string.for.d |
| 09e0 | 6d 65 6e 75 00 00 00 2a 09 6c 6f 63 61 6c 20 61 70 70 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 | menu...*.local.apps.=.table.conc |
| 0a00 | 61 74 28 61 70 70 5f 6c 69 73 74 2c 20 22 5c 6e 22 29 00 00 00 00 00 00 00 26 09 2d 2d 20 55 73 | at(app_list,."\n").......&.--.Us |
| 0a20 | 65 20 64 6d 65 6e 75 20 74 6f 20 73 65 6c 65 63 74 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e | e.dmenu.to.select.an.application |
| 0a40 | 00 00 00 51 09 6c 6f 63 61 6c 20 68 61 6e 64 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 | ...Q.local.handle.=.io.popen(tab |
| 0a60 | 6c 65 2e 63 6f 6e 63 61 74 28 64 6d 65 6e 75 5f 63 6d 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c | le.concat(dmenu_cmd,.".")....".< |
| 0a80 | 3c 3c 20 27 22 20 2e 2e 20 61 70 70 73 20 2e 2e 20 22 27 22 29 00 00 00 37 09 6c 6f 63 61 6c 20 | <<.'"....apps...."'")...7.local. |
| 0aa0 | 73 65 6c 65 63 74 65 64 5f 61 70 70 20 3d 20 68 61 6e 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 | selected_app.=.handle:read("*a") |
| 0ac0 | 3a 67 73 75 62 28 22 5c 6e 24 22 2c 20 22 22 29 00 00 00 0f 09 68 61 6e 64 6c 65 3a 63 6c 6f 73 | :gsub("\n$",."").....handle:clos |
| 0ae0 | 65 28 29 00 00 00 00 00 00 00 3a 09 69 66 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 | e().......:.if.selected_app.~=." |
| 0b00 | 22 20 61 6e 64 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d | ".and.app_commands[selected_app] |
| 0b20 | 20 74 68 65 6e 00 00 00 22 09 09 2d 2d 20 52 75 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 | .then..."..--.Run.the.correspond |
| 0b40 | 69 6e 67 20 63 6f 6d 6d 61 6e 64 00 00 00 28 09 09 6f 73 2e 65 78 65 63 75 74 65 28 61 70 70 5f | ing.command...(..os.execute(app_ |
| 0b60 | 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 29 00 00 00 04 09 65 6e 64 00 | commands[selected_app]).....end. |
| 0b80 | 00 00 03 65 6e 64 00 00 00 00 00 00 00 11 2d 2d 20 4d 61 69 6e 20 65 78 65 63 75 74 69 6f 6e 00 | ...end........--.Main.execution. |
| 0ba0 | 00 00 14 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e 28 29 f5 18 00 00 00 04 00 00 00 | ...launch_application()......... |
| 0bc0 | 57 00 00 00 54 00 00 00 4c 00 00 00 10 20 20 20 20 22 64 6d 65 6e 75 5f 72 75 6e 22 2c 00 00 00 | W...T...L........"dmenu_run",... |
| 0be0 | 23 20 20 20 20 22 2d 66 6e 22 2c 20 22 46 69 72 61 20 43 6f 64 65 2d 31 30 22 2c 20 20 2d 2d 20 | #...."-fn",."Fira.Code-10",..--. |
| 0c00 | 66 6f 6e 74 00 00 00 25 20 20 20 20 22 2d 6e 62 22 2c 20 22 23 31 65 31 65 31 65 22 2c 20 20 2d | font...%...."-nb",."#1e1e1e",..- |
| 0c20 | 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 25 20 20 20 20 22 2d 6e 66 22 2c 20 22 23 63 63 | -.normbgcolor...%...."-nf",."#cc |
| 0c40 | 63 63 63 63 22 2c 20 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 24 20 20 20 20 22 2d | cccc",..--.normfgcolor...$...."- |
| 0c60 | 73 62 22 2c 20 22 23 32 34 37 32 63 38 22 2c 20 20 2d 2d 20 73 65 6c 62 67 63 6f 6c 6f 72 00 00 | sb",."#2472c8",..--.selbgcolor.. |
| 0c80 | 00 24 20 20 20 20 22 2d 73 66 22 2c 20 22 23 65 35 65 35 65 35 22 2c 20 20 2d 2d 20 73 65 6c 66 | .$...."-sf",."#e5e5e5",..--.self |
| 0ca0 | 67 63 6f 6c 6f 72 00 00 00 2f 20 20 20 20 22 2d 6c 22 2c 20 22 31 30 22 20 20 2d 2d 20 6e 75 6d | gcolor.../...."-l",."10"..--.num |
| 0cc0 | 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 00 00 00 01 7d 00 00 | ber.of.lines.in.the.dmenu....}.. |
| 0ce0 | 00 00 00 00 00 2d 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 74 68 65 20 6c 69 73 | .....---.Function.to.get.the.lis |
| 0d00 | 74 20 6f 66 20 2e 64 65 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 00 22 6c 6f 63 61 6c 20 66 75 6e | t.of..desktop.files..."local.fun |
| 0d20 | 63 74 69 6f 6e 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 1c 20 20 20 | ction.get_desktop_files()....... |
| 0d40 | 20 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5f 20 20 20 | .local.desktop_files.=.{}..._... |
| 0d60 | 20 6c 6f 63 61 6c 20 64 69 72 73 20 3d 20 7b 6f 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 29 | .local.dirs.=.{os.getenv("HOME") |
| 0d80 | 20 2e 2e 20 22 2f 2e 6c 6f 63 61 6c 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 | ...."/.local/share/applications" |
| 0da0 | 2c 20 22 2f 75 73 72 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 7d 00 00 00 04 | ,."/usr/share/applications"}.... |
| 0dc0 | 20 20 20 20 00 00 00 21 20 20 20 20 66 6f 72 20 5f 2c 20 64 69 72 20 69 6e 20 69 70 61 69 72 73 | .......!....for._,.dir.in.ipairs |
| 0de0 | 28 64 69 72 73 29 20 64 6f 00 00 00 46 20 20 20 20 20 20 20 20 6c 6f 63 61 6c 20 70 66 69 6c 65 | (dirs).do...F........local.pfile |
| 0e00 | 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 27 66 69 6e 64 20 27 20 2e 2e 20 64 69 72 20 2e 2e 20 27 20 | .=.io.popen('find.'....dir....'. |
| 0e20 | 2d 6e 61 6d 65 20 22 2a 2e 64 65 73 6b 74 6f 70 22 27 29 00 00 00 24 20 20 20 20 20 20 20 20 66 | -name."*.desktop"')...$........f |
| 0e40 | 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a 6c 69 6e 65 73 28 29 20 64 6f 00 00 00 2d 20 | or.file.in.pfile:lines().do...-. |
| 0e60 | 20 20 20 20 20 20 20 20 20 20 20 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 73 6b 74 6f 70 5f | ...........table.insert(desktop_ |
| 0e80 | 66 69 6c 65 73 2c 20 66 69 6c 65 29 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 15 20 | files,.file)............end..... |
| 0ea0 | 20 20 20 20 20 20 20 70 66 69 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 07 20 20 20 20 65 6e 64 00 | .......pfile:close()........end. |
| 0ec0 | 00 00 00 00 00 00 18 20 20 20 20 72 65 74 75 72 6e 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 00 | ...........return.desktop_files. |
| 0ee0 | 00 00 03 65 6e 64 00 00 00 00 00 00 00 50 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 78 74 | ...end.......P--.Function.to.ext |
| 0f00 | 72 61 63 74 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6e 61 6d 65 20 61 6e 64 20 65 78 | ract.the.application.name.and.ex |
| 0f20 | 65 63 20 63 6f 6d 6d 61 6e 64 20 66 72 6f 6d 20 61 20 64 65 73 6b 74 6f 70 20 66 69 6c 65 00 00 | ec.command.from.a.desktop.file.. |
| 0f40 | 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 | ..local.function.extract_info_fr |
| 0f60 | 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 2b 20 20 20 20 6c 6f 63 61 6c 20 61 70 | om_desktop(file)...+....local.ap |
| 0f80 | 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6e 69 6c 2c 20 6e 69 6c 00 | p_name,.exec_command.=.nil,.nil. |
| 0fa0 | 00 00 00 00 00 00 21 20 20 20 20 66 6f 72 20 6c 69 6e 65 20 69 6e 20 69 6f 2e 6c 69 6e 65 73 28 | ......!....for.line.in.io.lines( |
| 0fc0 | 66 69 6c 65 29 20 64 6f 00 00 00 24 20 20 20 20 20 20 20 20 69 66 20 6c 69 6e 65 3a 6d 61 74 63 | file).do...$........if.line:matc |
| 0fe0 | 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 22 20 20 20 20 20 20 20 20 20 20 20 20 | h("^Name=").then..."............ |
| 1000 | 61 70 70 5f 6e 61 6d 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 28 20 20 20 20 20 20 | app_name.=.line:sub(6)...(...... |
| 1020 | 20 20 65 6c 73 65 69 66 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 5e 45 78 65 63 3d 22 29 20 74 68 | ..elseif.line:match("^Exec=").th |
| 1040 | 65 6e 00 00 00 26 20 20 20 20 20 20 20 20 20 20 20 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d | en...&............exec_command.= |
| 1060 | 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 00 00 | .line:sub(6)............end..... |
| 1080 | 00 00 29 20 20 20 20 20 20 20 20 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f | ..)........if.app_name.and.exec_ |
| 10a0 | 63 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 11 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 | command.then................brea |
| 10c0 | 6b 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 00 00 | k............end........end..... |
| 10e0 | 00 00 21 20 20 20 20 72 65 74 75 72 6e 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d | ..!....return.app_name,.exec_com |
| 1100 | 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 | mand....end........--.Function.t |
| 1120 | 6f 20 72 75 6e 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 6e | o.run.the.application.using.dmen |
| 1140 | 75 00 00 00 23 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c 69 | u...#local.function.launch_appli |
| 1160 | 63 61 74 69 6f 6e 28 29 00 00 00 2d 20 20 20 20 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 | cation()...-....local.desktop_fi |
| 1180 | 6c 65 73 20 3d 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 17 20 20 20 | les.=.get_desktop_files()....... |
| 11a0 | 20 6c 6f 63 61 6c 20 61 70 70 5f 6c 69 73 74 20 3d 20 7b 7d 00 00 00 1b 20 20 20 20 6c 6f 63 61 | .local.app_list.=.{}........loca |
| 11c0 | 6c 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 20 3d 20 7b 7d 00 00 00 00 00 00 00 24 20 20 20 20 2d | l.app_commands.=.{}.......$....- |
| 11e0 | 2d 20 47 61 74 68 65 72 20 61 70 70 20 6e 61 6d 65 73 20 61 6e 64 20 63 6f 6d 6d 61 6e 64 73 00 | -.Gather.app.names.and.commands. |
| 1200 | 00 00 2b 20 20 20 20 66 6f 72 20 5f 2c 20 66 69 6c 65 20 69 6e 20 69 70 61 69 72 73 28 64 65 73 | ..+....for._,.file.in.ipairs(des |
| 1220 | 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 00 46 20 20 20 20 20 20 20 20 6c 6f 63 61 6c 20 | ktop_files).do...F........local. |
| 1240 | 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 65 78 74 72 61 63 74 | app_name,.exec_command.=.extract |
| 1260 | 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 29 20 20 20 20 | _info_from_desktop(file)...).... |
| 1280 | 20 20 20 20 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 | ....if.app_name.and.exec_command |
| 12a0 | 20 74 68 65 6e 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 74 61 62 6c 65 2e 69 6e 73 65 72 | .then...,............table.inser |
| 12c0 | 74 28 61 70 70 5f 6c 69 73 74 2c 20 61 70 70 5f 6e 61 6d 65 29 00 00 00 31 20 20 20 20 20 20 20 | t(app_list,.app_name)...1....... |
| 12e0 | 20 20 20 20 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 61 70 70 5f 6e 61 6d 65 5d 20 3d 20 65 78 | .....app_commands[app_name].=.ex |
| 1300 | 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 07 20 20 20 | ec_command............end....... |
| 1320 | 20 65 6e 64 00 00 00 00 00 00 00 1a 20 20 20 20 69 66 20 23 61 70 70 5f 6c 69 73 74 20 3d 3d 20 | .end............if.#app_list.==. |
| 1340 | 30 20 74 68 65 6e 00 00 00 27 20 20 20 20 20 20 20 20 70 72 69 6e 74 28 22 4e 6f 20 61 70 70 6c | 0.then...'........print("No.appl |
| 1360 | 69 63 61 74 69 6f 6e 73 20 66 6f 75 6e 64 2e 22 29 00 00 00 0e 20 20 20 20 20 20 20 20 72 65 74 | ications.found.")............ret |
| 1380 | 75 72 6e 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 00 00 00 00 38 20 20 20 20 2d 2d 20 4a 6f 69 | urn........end.......8....--.Joi |
| 13a0 | 6e 20 74 68 65 20 61 70 70 20 6e 61 6d 65 73 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c 65 20 73 74 | n.the.app.names.into.a.single.st |
| 13c0 | 72 69 6e 67 20 66 6f 72 20 64 6d 65 6e 75 00 00 00 2d 20 20 20 20 6c 6f 63 61 6c 20 61 70 70 73 | ring.for.dmenu...-....local.apps |
| 13e0 | 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 61 70 70 5f 6c 69 73 74 2c 20 22 5c 6e 22 29 00 | .=.table.concat(app_list,."\n"). |
| 1400 | 00 00 00 00 00 00 29 20 20 20 20 2d 2d 20 55 73 65 20 64 6d 65 6e 75 20 74 6f 20 73 65 6c 65 63 | ......)....--.Use.dmenu.to.selec |
| 1420 | 74 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 00 00 00 54 20 20 20 20 6c 6f 63 61 6c 20 68 61 | t.an.application...T....local.ha |
| 1440 | 6e 64 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 64 6d 65 | ndle.=.io.popen(table.concat(dme |
| 1460 | 6e 75 5f 63 6d 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c 3c 3c 20 27 22 20 2e 2e 20 61 70 70 73 | nu_cmd,.".")....".<<<.'"....apps |
| 1480 | 20 2e 2e 20 22 27 22 29 00 00 00 3a 20 20 20 20 6c 6f 63 61 6c 20 73 65 6c 65 63 74 65 64 5f 61 | ...."'")...:....local.selected_a |
| 14a0 | 70 70 20 3d 20 68 61 6e 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 67 73 75 62 28 22 5c 6e 24 | pp.=.handle:read("*a"):gsub("\n$ |
| 14c0 | 22 2c 20 22 22 29 00 00 00 12 20 20 20 20 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 00 | ",."")........handle:close().... |
| 14e0 | 00 00 00 3d 20 20 20 20 69 66 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 61 6e | ...=....if.selected_app.~=."".an |
| 1500 | 64 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 68 65 | d.app_commands[selected_app].the |
| 1520 | 6e 00 00 00 28 20 20 20 20 20 20 20 20 2d 2d 20 52 75 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f | n...(........--.Run.the.correspo |
| 1540 | 6e 64 69 6e 67 20 63 6f 6d 6d 61 6e 64 00 00 00 2e 20 20 20 20 20 20 20 20 6f 73 2e 65 78 65 63 | nding.command............os.exec |
| 1560 | 75 74 65 28 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 29 00 | ute(app_commands[selected_app]). |
| 1580 | 00 00 07 20 20 20 20 65 6e 64 35 81 f5 18 00 00 00 00 04 00 00 00 00 00 00 00 4b 00 00 00 04 00 | .......end5...............K..... |
| 15a0 | 00 00 51 00 00 00 01 00 00 00 7e 00 00 00 00 00 00 00 d9 08 00 00 00 00 00 00 e2 07 00 00 00 00 | ..Q.......~..................... |
| 15c0 | 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 59 00 00 00 14 00 00 00 5a 00 00 00 00 00 00 00 | ................Y.......Z....... |
| 15e0 | 00 00 00 00 00 00 00 00 8f 08 00 00 00 00 00 00 9f 08 00 00 00 00 00 00 f5 18 00 00 00 00 5a 00 | ..............................Z. |
| 1600 | 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9f 08 00 00 00 00 00 00 01 00 | ................................ |
| 1620 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 01 00 00 00 03 00 00 00 00 00 00 | ..............5._............... |
| 1640 | 00 00 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 | ................................ |
| 1660 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1680 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1700 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1720 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1740 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1760 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1780 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 17a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 69 a1 12 c2 04 01 00 00 00 02 00 f5 | ....................i........... |
| 17c0 | 18 00 00 00 5a 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 | ....Z........................... |
| 17e0 | 00 00 00 00 00 00 5a 00 00 00 4a 2d 2d 20 4c 75 61 20 73 63 72 69 70 74 20 74 6f 20 6c 61 75 6e | ......Z...J--.Lua.script.to.laun |
| 1800 | 63 68 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 64 6d 65 6e 75 20 77 69 74 68 | ch.applications.using.dmenu.with |
| 1820 | 20 63 75 73 74 6f 6d 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 00 00 00 00 1d 2d 2d 20 | .custom.configuration........--. |
| 1840 | 43 75 73 74 6f 6d 20 64 6d 65 6e 75 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 13 6c 6f | Custom.dmenu.configuration....lo |
| 1860 | 63 61 6c 20 64 6d 65 6e 75 5f 63 6d 64 20 3d 20 7b 00 00 00 0d 09 22 64 6d 65 6e 75 5f 72 75 6e | cal.dmenu_cmd.=.{....."dmenu_run |
| 1880 | 22 2c 00 00 00 07 09 22 2d 66 6e 22 2c 00 00 00 18 09 22 46 69 72 61 20 43 6f 64 65 2d 31 30 22 | ",....."-fn",....."Fira.Code-10" |
| 18a0 | 2c 20 2d 2d 20 66 6f 6e 74 00 00 00 07 09 22 2d 6e 62 22 2c 00 00 00 1a 09 22 23 31 65 31 65 31 | ,.--.font....."-nb",....."#1e1e1 |
| 18c0 | 65 22 2c 20 2d 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 | e",.--.normbgcolor....."-nf",... |
| 18e0 | 1a 09 22 23 63 63 63 63 63 63 22 2c 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 07 09 | .."#cccccc",.--.normfgcolor..... |
| 1900 | 22 2d 73 62 22 2c 00 00 00 19 09 22 23 32 34 37 32 63 38 22 2c 20 2d 2d 20 73 65 6c 62 67 63 6f | "-sb",....."#2472c8",.--.selbgco |
| 1920 | 6c 6f 72 00 00 00 07 09 22 2d 73 66 22 2c 00 00 00 19 09 22 23 65 35 65 35 65 35 22 2c 20 2d 2d | lor....."-sf",....."#e5e5e5",.-- |
| 1940 | 20 73 65 6c 66 67 63 6f 6c 6f 72 00 00 00 06 09 22 2d 6c 22 2c 00 00 00 26 09 22 31 30 22 2c 20 | .selfgcolor....."-l",...&."10",. |
| 1960 | 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 00 | --.number.of.lines.in.the.dmenu. |
| 1980 | 00 00 01 7d 00 00 00 00 00 00 00 2d 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 74 | ...}.......---.Function.to.get.t |
| 19a0 | 68 65 20 6c 69 73 74 20 6f 66 20 2e 64 65 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 00 22 6c 6f 63 | he.list.of..desktop.files..."loc |
| 19c0 | 61 6c 20 66 75 6e 63 74 69 6f 6e 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 | al.function.get_desktop_files(). |
| 19e0 | 00 00 19 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5e | ....local.desktop_files.=.{}...^ |
| 1a00 | 09 6c 6f 63 61 6c 20 64 69 72 73 20 3d 20 7b 20 6f 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 | .local.dirs.=.{.os.getenv("HOME" |
| 1a20 | 29 20 2e 2e 20 22 2f 2e 6c 6f 63 61 6c 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 | )...."/.local/share/applications |
| 1a40 | 22 2c 20 22 2f 75 73 72 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 20 7d 00 00 | ",."/usr/share/applications".}.. |
| 1a60 | 00 00 00 00 00 1e 09 66 6f 72 20 5f 2c 20 64 69 72 20 69 6e 20 69 70 61 69 72 73 28 64 69 72 73 | .......for._,.dir.in.ipairs(dirs |
| 1a80 | 29 20 64 6f 00 00 00 40 09 09 6c 6f 63 61 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e | ).do...@..local.pfile.=.io.popen |
| 1aa0 | 28 22 66 69 6e 64 20 22 20 2e 2e 20 64 69 72 20 2e 2e 20 27 20 2d 6e 61 6d 65 20 22 2a 2e 64 65 | ("find."....dir....'.-name."*.de |
| 1ac0 | 73 6b 74 6f 70 22 27 29 00 00 00 1e 09 09 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a | sktop"')......for.file.in.pfile: |
| 1ae0 | 6c 69 6e 65 73 28 29 20 64 6f 00 00 00 24 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 | lines().do...$...table.insert(de |
| 1b00 | 73 6b 74 6f 70 5f 66 69 6c 65 73 2c 20 66 69 6c 65 29 00 00 00 05 09 09 65 6e 64 00 00 00 0f 09 | sktop_files,.file)......end..... |
| 1b20 | 09 70 66 69 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 15 09 72 | .pfile:close().....end.........r |
| 1b40 | 65 74 75 72 6e 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 | eturn.desktop_files....end...... |
| 1b60 | 00 50 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 70 70 | .P--.Function.to.extract.the.app |
| 1b80 | 6c 69 63 61 74 69 6f 6e 20 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 20 63 6f 6d 6d 61 6e 64 20 66 | lication.name.and.exec.command.f |
| 1ba0 | 72 6f 6d 20 61 20 64 65 73 6b 74 6f 70 20 66 69 6c 65 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 | rom.a.desktop.file....local.func |
| 1bc0 | 74 69 6f 6e 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 | tion.extract_info_from_desktop(f |
| 1be0 | 69 6c 65 29 00 00 00 28 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f | ile)...(.local.app_name,.exec_co |
| 1c00 | 6d 6d 61 6e 64 20 3d 20 6e 69 6c 2c 20 6e 69 6c 00 00 00 00 00 00 00 1e 09 66 6f 72 20 6c 69 6e | mmand.=.nil,.nil.........for.lin |
| 1c20 | 65 20 69 6e 20 69 6f 2e 6c 69 6e 65 73 28 66 69 6c 65 29 20 64 6f 00 00 00 1e 09 09 69 66 20 6c | e.in.io.lines(file).do......if.l |
| 1c40 | 69 6e 65 3a 6d 61 74 63 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 19 09 09 09 61 | ine:match("^Name=").then.......a |
| 1c60 | 70 70 5f 6e 61 6d 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 22 09 09 65 6c 73 65 69 | pp_name.=.line:sub(6)..."..elsei |
| 1c80 | 66 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 1d 09 | f.line:match("^Exec=").then..... |
| 1ca0 | 09 09 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 05 | ..exec_command.=.line:sub(6).... |
| 1cc0 | 09 09 65 6e 64 00 00 00 00 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 | ..end.......#..if.app_name.and.e |
| 1ce0 | 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 08 09 09 09 62 72 65 61 6b 00 00 00 05 | xec_command.then.......break.... |
| 1d00 | 09 09 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 1e 09 72 65 74 75 72 6e 20 61 70 70 | ..end.....end.........return.app |
| 1d20 | 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 | _name,.exec_command....end...... |
| 1d40 | 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 72 75 6e 20 74 68 65 20 61 70 70 6c 69 63 61 | ..--.Function.to.run.the.applica |
| 1d60 | 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 6e 75 00 00 00 23 6c 6f 63 61 6c 20 66 75 6e 63 74 69 | tion.using.dmenu...#local.functi |
| 1d80 | 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e 28 29 00 00 00 2a 09 6c 6f 63 61 | on.launch_application()...*.loca |
| 1da0 | 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 | l.desktop_files.=.get_desktop_fi |
| 1dc0 | 6c 65 73 28 29 00 00 00 14 09 6c 6f 63 61 6c 20 61 70 70 5f 6c 69 73 74 20 3d 20 7b 7d 00 00 00 | les().....local.app_list.=.{}... |
| 1de0 | 18 09 6c 6f 63 61 6c 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 20 3d 20 7b 7d 00 00 00 00 00 00 00 | ..local.app_commands.=.{}....... |
| 1e00 | 21 09 2d 2d 20 47 61 74 68 65 72 20 61 70 70 20 6e 61 6d 65 73 20 61 6e 64 20 63 6f 6d 6d 61 6e | !.--.Gather.app.names.and.comman |
| 1e20 | 64 73 00 00 00 28 09 66 6f 72 20 5f 2c 20 66 69 6c 65 20 69 6e 20 69 70 61 69 72 73 28 64 65 73 | ds...(.for._,.file.in.ipairs(des |
| 1e40 | 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 00 40 09 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 | ktop_files).do...@..local.app_na |
| 1e60 | 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f | me,.exec_command.=.extract_info_ |
| 1e80 | 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e | from_desktop(file)...#..if.app_n |
| 1ea0 | 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 23 09 09 09 | ame.and.exec_command.then...#... |
| 1ec0 | 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 61 70 70 5f 6c 69 73 74 2c 20 61 70 70 5f 6e 61 6d 65 29 | table.insert(app_list,.app_name) |
| 1ee0 | 00 00 00 28 09 09 09 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 61 70 70 5f 6e 61 6d 65 5d 20 3d 20 | ...(...app_commands[app_name].=. |
| 1f00 | 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 05 09 09 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 | exec_command......end.....end... |
| 1f20 | 00 00 00 00 17 09 69 66 20 23 61 70 70 5f 6c 69 73 74 20 3d 3d 20 30 20 74 68 65 6e 00 00 00 21 | ......if.#app_list.==.0.then...! |
| 1f40 | 09 09 70 72 69 6e 74 28 22 4e 6f 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 66 6f 75 6e 64 2e 22 | ..print("No.applications.found." |
| 1f60 | 29 00 00 00 08 09 09 72 65 74 75 72 6e 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 35 09 2d 2d | )......return.....end.......5.-- |
| 1f80 | 20 4a 6f 69 6e 20 74 68 65 20 61 70 70 20 6e 61 6d 65 73 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c | .Join.the.app.names.into.a.singl |
| 1fa0 | 65 20 73 74 72 69 6e 67 20 66 6f 72 20 64 6d 65 6e 75 00 00 00 2a 09 6c 6f 63 61 6c 20 61 70 70 | e.string.for.dmenu...*.local.app |
| 1fc0 | 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 61 70 70 5f 6c 69 73 74 2c 20 22 5c 6e 22 29 | s.=.table.concat(app_list,."\n") |
| 1fe0 | 00 00 00 00 00 00 00 26 09 2d 2d 20 55 73 65 20 64 6d 65 6e 75 20 74 6f 20 73 65 6c 65 63 74 20 | .......&.--.Use.dmenu.to.select. |
| 2000 | 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 00 00 00 51 09 6c 6f 63 61 6c 20 68 61 6e 64 6c 65 20 | an.application...Q.local.handle. |
| 2020 | 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 64 6d 65 6e 75 5f 63 6d | =.io.popen(table.concat(dmenu_cm |
| 2040 | 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c 3c 3c 20 27 22 20 2e 2e 20 61 70 70 73 20 2e 2e 20 22 | d,.".")....".<<<.'"....apps...." |
| 2060 | 27 22 29 00 00 00 37 09 6c 6f 63 61 6c 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 3d 20 68 61 6e | '")...7.local.selected_app.=.han |
| 2080 | 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 67 73 75 62 28 22 5c 6e 24 22 2c 20 22 22 29 00 00 | dle:read("*a"):gsub("\n$",."").. |
| 20a0 | 00 0f 09 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 00 00 00 00 3a 09 69 66 20 73 65 6c | ...handle:close().......:.if.sel |
| 20c0 | 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 61 6e 64 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 | ected_app.~=."".and.app_commands |
| 20e0 | 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 68 65 6e 00 00 00 22 09 09 2d 2d 20 52 75 6e 20 | [selected_app].then..."..--.Run. |
| 2100 | 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 6f 6d 6d 61 6e 64 00 00 00 28 09 09 6f | the.corresponding.command...(..o |
| 2120 | 73 2e 65 78 65 63 75 74 65 28 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f | s.execute(app_commands[selected_ |
| 2140 | 61 70 70 5d 29 00 00 00 04 09 65 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 11 2d 2d 20 4d | app]).....end....end........--.M |
| 2160 | 61 69 6e 20 65 78 65 63 75 74 69 6f 6e 00 00 00 14 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 | ain.execution....launch_applicat |
| 2180 | 69 6f 6e 28 29 f5 18 00 00 00 08 00 00 00 12 00 00 00 5a 00 00 00 09 00 00 00 1c 09 22 23 31 65 | ion().............Z........."#1e |
| 21a0 | 31 65 31 65 22 2c 20 20 20 2d 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 | 1e1e",...--.normbgcolor....."-nf |
| 21c0 | 22 2c 00 00 00 1c 09 22 23 63 63 63 63 63 63 22 2c 20 20 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c | ",....."#cccccc",...--.normfgcol |
| 21e0 | 6f 72 00 00 00 07 09 22 2d 73 62 22 2c 00 00 00 1b 09 22 23 32 34 37 32 63 38 22 2c 20 20 20 2d | or....."-sb",....."#2472c8",...- |
| 2200 | 2d 20 73 65 6c 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 73 66 22 2c 00 00 00 1b 09 22 23 65 35 | -.selbgcolor....."-sf",....."#e5 |
| 2220 | 65 35 65 35 22 2c 20 20 20 2d 2d 20 73 65 6c 66 67 63 6f 6c 6f 72 00 00 00 06 09 22 2d 6c 22 2c | e5e5",...--.selfgcolor....."-l", |
| 2240 | 00 00 00 2d 09 22 31 30 22 2c 20 20 20 20 20 20 20 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 6c | ...-."10",........--.number.of.l |
| 2260 | 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 35 81 f5 18 00 00 00 00 08 00 00 00 0c 00 00 | ines.in.the.dmenu5.............. |
| 2280 | 00 08 00 00 00 0d 00 00 00 08 00 00 00 06 00 00 00 c1 00 00 00 00 00 00 00 92 00 00 00 00 00 00 | ................................ |
| 22a0 | 00 83 00 00 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 59 00 00 00 14 00 00 00 5a | .......................Y.......Z |
| 22c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8f 08 00 00 00 00 00 00 9f 08 00 00 00 00 00 00 f5 | ................................ |
| 22e0 | 18 00 00 00 00 5a 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9f 08 00 | .....Z.......................... |
| 2300 | 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 02 00 00 00 | .....................5._........ |
| 2320 | 04 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 | ................................ |
| 2340 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2360 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2380 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 23a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 23c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 23e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2400 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2420 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2440 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2460 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2480 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 69 a1 12 de 04 | ...........................i.... |
| 24a0 | 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 5a 00 00 00 4a 2d 2d 20 4c | .......................Z...J--.L |
| 24c0 | 75 61 20 73 63 72 69 70 74 20 74 6f 20 6c 61 75 6e 63 68 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 | ua.script.to.launch.applications |
| 24e0 | 20 75 73 69 6e 67 20 64 6d 65 6e 75 20 77 69 74 68 20 63 75 73 74 6f 6d 20 63 6f 6e 66 69 67 75 | .using.dmenu.with.custom.configu |
| 2500 | 72 61 74 69 6f 6e 00 00 00 00 00 00 00 1d 2d 2d 20 43 75 73 74 6f 6d 20 64 6d 65 6e 75 20 63 6f | ration........--.Custom.dmenu.co |
| 2520 | 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 13 6c 6f 63 61 6c 20 64 6d 65 6e 75 5f 63 6d 64 20 3d | nfiguration....local.dmenu_cmd.= |
| 2540 | 20 7b 00 00 00 0d 09 22 64 6d 65 6e 75 5f 72 75 6e 22 2c 00 00 00 07 09 22 2d 66 6e 22 2c 00 00 | .{....."dmenu_run",....."-fn",.. |
| 2560 | 00 18 09 22 46 69 72 61 20 43 6f 64 65 2d 31 30 22 2c 20 2d 2d 20 66 6f 6e 74 00 00 00 07 09 22 | ..."Fira.Code-10",.--.font....." |
| 2580 | 2d 6e 62 22 2c 00 00 00 1c 09 22 23 31 65 31 65 31 65 22 2c 20 20 20 2d 2d 20 6e 6f 72 6d 62 67 | -nb",....."#1e1e1e",...--.normbg |
| 25a0 | 63 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 1c 09 22 23 63 63 63 63 63 63 22 2c 20 | color....."-nf",....."#cccccc",. |
| 25c0 | 20 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 73 62 22 2c 00 00 00 1b 09 | ..--.normfgcolor....."-sb",..... |
| 25e0 | 22 23 32 34 37 32 63 38 22 2c 20 20 20 2d 2d 20 73 65 6c 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 | "#2472c8",...--.selbgcolor....." |
| 2600 | 2d 73 66 22 2c 00 00 00 1b 09 22 23 65 35 65 35 65 35 22 2c 20 20 20 2d 2d 20 73 65 6c 66 67 63 | -sf",....."#e5e5e5",...--.selfgc |
| 2620 | 6f 6c 6f 72 00 00 00 06 09 22 2d 6c 22 2c 00 00 00 2d 09 22 31 30 22 2c 20 20 20 20 20 20 20 20 | olor....."-l",...-."10",........ |
| 2640 | 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 00 | --.number.of.lines.in.the.dmenu. |
| 2660 | 00 00 01 7d 00 00 00 00 00 00 00 2d 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 74 | ...}.......---.Function.to.get.t |
| 2680 | 68 65 20 6c 69 73 74 20 6f 66 20 2e 64 65 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 00 22 6c 6f 63 | he.list.of..desktop.files..."loc |
| 26a0 | 61 6c 20 66 75 6e 63 74 69 6f 6e 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 | al.function.get_desktop_files(). |
| 26c0 | 00 00 19 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5e | ....local.desktop_files.=.{}...^ |
| 26e0 | 09 6c 6f 63 61 6c 20 64 69 72 73 20 3d 20 7b 20 6f 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 | .local.dirs.=.{.os.getenv("HOME" |
| 2700 | 29 20 2e 2e 20 22 2f 2e 6c 6f 63 61 6c 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 | )...."/.local/share/applications |
| 2720 | 22 2c 20 22 2f 75 73 72 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 20 7d 00 00 | ",."/usr/share/applications".}.. |
| 2740 | 00 00 00 00 00 1e 09 66 6f 72 20 5f 2c 20 64 69 72 20 69 6e 20 69 70 61 69 72 73 28 64 69 72 73 | .......for._,.dir.in.ipairs(dirs |
| 2760 | 29 20 64 6f 00 00 00 40 09 09 6c 6f 63 61 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e | ).do...@..local.pfile.=.io.popen |
| 2780 | 28 22 66 69 6e 64 20 22 20 2e 2e 20 64 69 72 20 2e 2e 20 27 20 2d 6e 61 6d 65 20 22 2a 2e 64 65 | ("find."....dir....'.-name."*.de |
| 27a0 | 73 6b 74 6f 70 22 27 29 00 00 00 1e 09 09 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a | sktop"')......for.file.in.pfile: |
| 27c0 | 6c 69 6e 65 73 28 29 20 64 6f 00 00 00 24 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 | lines().do...$...table.insert(de |
| 27e0 | 73 6b 74 6f 70 5f 66 69 6c 65 73 2c 20 66 69 6c 65 29 00 00 00 05 09 09 65 6e 64 00 00 00 0f 09 | sktop_files,.file)......end..... |
| 2800 | 09 70 66 69 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 15 09 72 | .pfile:close().....end.........r |
| 2820 | 65 74 75 72 6e 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 | eturn.desktop_files....end...... |
| 2840 | 00 50 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 70 70 | .P--.Function.to.extract.the.app |
| 2860 | 6c 69 63 61 74 69 6f 6e 20 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 20 63 6f 6d 6d 61 6e 64 20 66 | lication.name.and.exec.command.f |
| 2880 | 72 6f 6d 20 61 20 64 65 73 6b 74 6f 70 20 66 69 6c 65 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 | rom.a.desktop.file....local.func |
| 28a0 | 74 69 6f 6e 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 | tion.extract_info_from_desktop(f |
| 28c0 | 69 6c 65 29 00 00 00 28 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f | ile)...(.local.app_name,.exec_co |
| 28e0 | 6d 6d 61 6e 64 20 3d 20 6e 69 6c 2c 20 6e 69 6c 00 00 00 00 00 00 00 1e 09 66 6f 72 20 6c 69 6e | mmand.=.nil,.nil.........for.lin |
| 2900 | 65 20 69 6e 20 69 6f 2e 6c 69 6e 65 73 28 66 69 6c 65 29 20 64 6f 00 00 00 1e 09 09 69 66 20 6c | e.in.io.lines(file).do......if.l |
| 2920 | 69 6e 65 3a 6d 61 74 63 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 19 09 09 09 61 | ine:match("^Name=").then.......a |
| 2940 | 70 70 5f 6e 61 6d 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 22 09 09 65 6c 73 65 69 | pp_name.=.line:sub(6)..."..elsei |
| 2960 | 66 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 1d 09 | f.line:match("^Exec=").then..... |
| 2980 | 09 09 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 05 | ..exec_command.=.line:sub(6).... |
| 29a0 | 09 09 65 6e 64 00 00 00 00 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 | ..end.......#..if.app_name.and.e |
| 29c0 | 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 08 09 09 09 62 72 65 61 6b 00 00 00 05 | xec_command.then.......break.... |
| 29e0 | 09 09 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 1e 09 72 65 74 75 72 6e 20 61 70 70 | ..end.....end.........return.app |
| 2a00 | 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 | _name,.exec_command....end...... |
| 2a20 | 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 72 75 6e 20 74 68 65 20 61 70 70 6c 69 63 61 | ..--.Function.to.run.the.applica |
| 2a40 | 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 6e 75 00 00 00 23 6c 6f 63 61 6c 20 66 75 6e 63 74 69 | tion.using.dmenu...#local.functi |
| 2a60 | 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e 28 29 00 00 00 2a 09 6c 6f 63 61 | on.launch_application()...*.loca |
| 2a80 | 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 | l.desktop_files.=.get_desktop_fi |
| 2aa0 | 6c 65 73 28 29 00 00 00 14 09 6c 6f 63 61 6c 20 61 70 70 5f 6c 69 73 74 20 3d 20 7b 7d 00 00 00 | les().....local.app_list.=.{}... |
| 2ac0 | 18 09 6c 6f 63 61 6c 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 20 3d 20 7b 7d 00 00 00 00 00 00 00 | ..local.app_commands.=.{}....... |
| 2ae0 | 21 09 2d 2d 20 47 61 74 68 65 72 20 61 70 70 20 6e 61 6d 65 73 20 61 6e 64 20 63 6f 6d 6d 61 6e | !.--.Gather.app.names.and.comman |
| 2b00 | 64 73 00 00 00 28 09 66 6f 72 20 5f 2c 20 66 69 6c 65 20 69 6e 20 69 70 61 69 72 73 28 64 65 73 | ds...(.for._,.file.in.ipairs(des |
| 2b20 | 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 00 40 09 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 | ktop_files).do...@..local.app_na |
| 2b40 | 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f | me,.exec_command.=.extract_info_ |
| 2b60 | 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e | from_desktop(file)...#..if.app_n |
| 2b80 | 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 23 09 09 09 | ame.and.exec_command.then...#... |
| 2ba0 | 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 61 70 70 5f 6c 69 73 74 2c 20 61 70 70 5f 6e 61 6d 65 29 | table.insert(app_list,.app_name) |
| 2bc0 | 00 00 00 28 09 09 09 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 61 70 70 5f 6e 61 6d 65 5d 20 3d 20 | ...(...app_commands[app_name].=. |
| 2be0 | 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 05 09 09 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 | exec_command......end.....end... |
| 2c00 | 00 00 00 00 17 09 69 66 20 23 61 70 70 5f 6c 69 73 74 20 3d 3d 20 30 20 74 68 65 6e 00 00 00 21 | ......if.#app_list.==.0.then...! |
| 2c20 | 09 09 70 72 69 6e 74 28 22 4e 6f 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 66 6f 75 6e 64 2e 22 | ..print("No.applications.found." |
| 2c40 | 29 00 00 00 08 09 09 72 65 74 75 72 6e 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 35 09 2d 2d | )......return.....end.......5.-- |
| 2c60 | 20 4a 6f 69 6e 20 74 68 65 20 61 70 70 20 6e 61 6d 65 73 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c | .Join.the.app.names.into.a.singl |
| 2c80 | 65 20 73 74 72 69 6e 67 20 66 6f 72 20 64 6d 65 6e 75 00 00 00 2a 09 6c 6f 63 61 6c 20 61 70 70 | e.string.for.dmenu...*.local.app |
| 2ca0 | 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 61 70 70 5f 6c 69 73 74 2c 20 22 5c 6e 22 29 | s.=.table.concat(app_list,."\n") |
| 2cc0 | 00 00 00 00 00 00 00 26 09 2d 2d 20 55 73 65 20 64 6d 65 6e 75 20 74 6f 20 73 65 6c 65 63 74 20 | .......&.--.Use.dmenu.to.select. |
| 2ce0 | 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 00 00 00 51 09 6c 6f 63 61 6c 20 68 61 6e 64 6c 65 20 | an.application...Q.local.handle. |
| 2d00 | 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 64 6d 65 6e 75 5f 63 6d | =.io.popen(table.concat(dmenu_cm |
| 2d20 | 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c 3c 3c 20 27 22 20 2e 2e 20 61 70 70 73 20 2e 2e 20 22 | d,.".")....".<<<.'"....apps...." |
| 2d40 | 27 22 29 00 00 00 37 09 6c 6f 63 61 6c 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 3d 20 68 61 6e | '")...7.local.selected_app.=.han |
| 2d60 | 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 67 73 75 62 28 22 5c 6e 24 22 2c 20 22 22 29 00 00 | dle:read("*a"):gsub("\n$",."").. |
| 2d80 | 00 0f 09 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 00 00 00 00 3a 09 69 66 20 73 65 6c | ...handle:close().......:.if.sel |
| 2da0 | 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 61 6e 64 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 | ected_app.~=."".and.app_commands |
| 2dc0 | 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 68 65 6e 00 00 00 22 09 09 2d 2d 20 52 75 6e 20 | [selected_app].then..."..--.Run. |
| 2de0 | 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 6f 6d 6d 61 6e 64 00 00 00 28 09 09 6f | the.corresponding.command...(..o |
| 2e00 | 73 2e 65 78 65 63 75 74 65 28 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f | s.execute(app_commands[selected_ |
| 2e20 | 61 70 70 5d 29 00 00 00 04 09 65 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 11 2d 2d 20 4d | app]).....end....end........--.M |
| 2e40 | 61 69 6e 20 65 78 65 63 75 74 69 6f 6e 00 00 00 14 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 | ain.execution....launch_applicat |
| 2e60 | 69 6f 6e 28 29 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 5a 00 00 00 00 00 00 00 01 00 00 | ion()5...............Z.......... |
| 2e80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 9f 08 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 5f | .............................5._ |
| 2ea0 | d0 00 00 00 03 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 | ................................ |
| 2ec0 | 00 ff ff ff ff 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2ee0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2f00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2f20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2f40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2f60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2f80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2fa0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2fc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 2fe0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 3000 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 3020 | 00 00 00 69 a1 12 df 04 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 | ...i............................ |
| 3040 | 00 00 00 00 f5 18 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 18 00 00 00 00 00 00 | ......................5......... |
| 3060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5b 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 | ..............[................. |
| 3080 | 00 00 00 00 00 00 fd 0a 00 00 00 00 00 00 35 81 5f d0 00 00 00 04 00 00 00 06 00 00 00 00 00 00 | ..............5._............... |
| 30a0 | 00 00 00 00 00 05 00 00 00 5c 00 00 00 13 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 | .........\...................... |
| 30c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 30e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 3100 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 3120 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 3140 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 3160 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 3180 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 31a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 31c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 31e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 3200 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 69 a1 12 e0 04 01 00 00 00 03 00 f5 | ....................i........... |
| 3220 | 18 00 00 00 62 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 | ....b........................... |
| 3240 | 00 00 00 00 00 00 62 00 00 00 4a 2d 2d 20 4c 75 61 20 73 63 72 69 70 74 20 74 6f 20 6c 61 75 6e | ......b...J--.Lua.script.to.laun |
| 3260 | 63 68 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 64 6d 65 6e 75 20 77 69 74 68 | ch.applications.using.dmenu.with |
| 3280 | 20 63 75 73 74 6f 6d 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 00 00 00 00 1d 2d 2d 20 | .custom.configuration........--. |
| 32a0 | 43 75 73 74 6f 6d 20 64 6d 65 6e 75 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 13 6c 6f | Custom.dmenu.configuration....lo |
| 32c0 | 63 61 6c 20 64 6d 65 6e 75 5f 63 6d 64 20 3d 20 7b 00 00 00 0d 09 22 64 6d 65 6e 75 5f 72 75 6e | cal.dmenu_cmd.=.{....."dmenu_run |
| 32e0 | 22 2c 00 00 00 07 09 22 2d 66 6e 22 2c 00 00 00 18 09 22 46 69 72 61 20 43 6f 64 65 2d 31 30 22 | ",....."-fn",....."Fira.Code-10" |
| 3300 | 2c 20 2d 2d 20 66 6f 6e 74 00 00 00 07 09 22 2d 6e 62 22 2c 00 00 00 1a 09 22 23 31 65 31 65 31 | ,.--.font....."-nb",....."#1e1e1 |
| 3320 | 65 22 2c 20 2d 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 | e",.--.normbgcolor....."-nf",... |
| 3340 | 1a 09 22 23 63 63 63 63 63 63 22 2c 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 07 09 | .."#cccccc",.--.normfgcolor..... |
| 3360 | 22 2d 73 62 22 2c 00 00 00 19 09 22 23 32 34 37 32 63 38 22 2c 20 2d 2d 20 73 65 6c 62 67 63 6f | "-sb",....."#2472c8",.--.selbgco |
| 3380 | 6c 6f 72 00 00 00 07 09 22 2d 73 66 22 2c 00 00 00 19 09 22 23 65 35 65 35 65 35 22 2c 20 2d 2d | lor....."-sf",....."#e5e5e5",.-- |
| 33a0 | 20 73 65 6c 66 67 63 6f 6c 6f 72 00 00 00 06 09 22 2d 6c 22 2c 00 00 00 26 09 22 31 30 22 2c 20 | .selfgcolor....."-l",...&."10",. |
| 33c0 | 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 00 | --.number.of.lines.in.the.dmenu. |
| 33e0 | 00 00 01 7d 00 00 00 00 00 00 00 2d 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 74 | ...}.......---.Function.to.get.t |
| 3400 | 68 65 20 6c 69 73 74 20 6f 66 20 2e 64 65 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 00 22 6c 6f 63 | he.list.of..desktop.files..."loc |
| 3420 | 61 6c 20 66 75 6e 63 74 69 6f 6e 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 | al.function.get_desktop_files(). |
| 3440 | 00 00 19 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5e | ....local.desktop_files.=.{}...^ |
| 3460 | 09 6c 6f 63 61 6c 20 64 69 72 73 20 3d 20 7b 20 6f 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 | .local.dirs.=.{.os.getenv("HOME" |
| 3480 | 29 20 2e 2e 20 22 2f 2e 6c 6f 63 61 6c 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 | )...."/.local/share/applications |
| 34a0 | 22 2c 20 22 2f 75 73 72 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 20 7d 00 00 | ",."/usr/share/applications".}.. |
| 34c0 | 00 00 00 00 00 1e 09 66 6f 72 20 5f 2c 20 64 69 72 20 69 6e 20 69 70 61 69 72 73 28 64 69 72 73 | .......for._,.dir.in.ipairs(dirs |
| 34e0 | 29 20 64 6f 00 00 00 40 09 09 6c 6f 63 61 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e | ).do...@..local.pfile.=.io.popen |
| 3500 | 28 22 66 69 6e 64 20 22 20 2e 2e 20 64 69 72 20 2e 2e 20 27 20 2d 6e 61 6d 65 20 22 2a 2e 64 65 | ("find."....dir....'.-name."*.de |
| 3520 | 73 6b 74 6f 70 22 27 29 00 00 00 1e 09 09 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a | sktop"')......for.file.in.pfile: |
| 3540 | 6c 69 6e 65 73 28 29 20 64 6f 00 00 00 24 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 | lines().do...$...table.insert(de |
| 3560 | 73 6b 74 6f 70 5f 66 69 6c 65 73 2c 20 66 69 6c 65 29 00 00 00 05 09 09 65 6e 64 00 00 00 0f 09 | sktop_files,.file)......end..... |
| 3580 | 09 70 66 69 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 15 09 72 | .pfile:close().....end.........r |
| 35a0 | 65 74 75 72 6e 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 | eturn.desktop_files....end...... |
| 35c0 | 00 50 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 70 70 | .P--.Function.to.extract.the.app |
| 35e0 | 6c 69 63 61 74 69 6f 6e 20 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 20 63 6f 6d 6d 61 6e 64 20 66 | lication.name.and.exec.command.f |
| 3600 | 72 6f 6d 20 61 20 64 65 73 6b 74 6f 70 20 66 69 6c 65 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 | rom.a.desktop.file....local.func |
| 3620 | 74 69 6f 6e 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 | tion.extract_info_from_desktop(f |
| 3640 | 69 6c 65 29 00 00 00 28 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f | ile)...(.local.app_name,.exec_co |
| 3660 | 6d 6d 61 6e 64 20 3d 20 6e 69 6c 2c 20 6e 69 6c 00 00 00 00 00 00 00 1e 09 66 6f 72 20 6c 69 6e | mmand.=.nil,.nil.........for.lin |
| 3680 | 65 20 69 6e 20 69 6f 2e 6c 69 6e 65 73 28 66 69 6c 65 29 20 64 6f 00 00 00 1e 09 09 69 66 20 6c | e.in.io.lines(file).do......if.l |
| 36a0 | 69 6e 65 3a 6d 61 74 63 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 19 09 09 09 61 | ine:match("^Name=").then.......a |
| 36c0 | 70 70 5f 6e 61 6d 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 22 09 09 65 6c 73 65 69 | pp_name.=.line:sub(6)..."..elsei |
| 36e0 | 66 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 1d 09 | f.line:match("^Exec=").then..... |
| 3700 | 09 09 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 05 | ..exec_command.=.line:sub(6).... |
| 3720 | 09 09 65 6e 64 00 00 00 00 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 | ..end.......#..if.app_name.and.e |
| 3740 | 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 08 09 09 09 62 72 65 61 6b 00 00 00 05 | xec_command.then.......break.... |
| 3760 | 09 09 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 1e 09 72 65 74 75 72 6e 20 61 70 70 | ..end.....end.........return.app |
| 3780 | 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 | _name,.exec_command....end...... |
| 37a0 | 00 44 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 73 63 61 70 65 20 73 70 65 63 69 61 6c 20 | .D--.Function.to.escape.special. |
| 37c0 | 63 68 61 72 61 63 74 65 72 73 20 28 73 70 61 63 65 73 2c 20 70 61 72 65 6e 74 68 65 73 65 73 2c | characters.(spaces,.parentheses, |
| 37e0 | 20 65 74 63 2e 29 00 00 00 31 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 73 63 61 70 65 5f | .etc.)...1local.function.escape_ |
| 3800 | 73 70 65 63 69 61 6c 5f 63 68 61 72 61 63 74 65 72 73 28 63 6f 6d 6d 61 6e 64 29 00 00 00 36 09 | special_characters(command)...6. |
| 3820 | 2d 2d 20 45 73 63 61 70 65 20 73 70 61 63 65 73 20 61 6e 64 20 70 61 72 65 6e 74 68 65 73 65 73 | --.Escape.spaces.and.parentheses |
| 3840 | 20 66 6f 72 20 70 72 6f 70 65 72 20 65 78 65 63 75 74 69 6f 6e 00 00 00 2a 09 72 65 74 75 72 6e | .for.proper.execution...*.return |
| 3860 | 20 63 6f 6d 6d 61 6e 64 3a 67 73 75 62 28 22 28 5b 25 73 25 28 25 29 5d 29 22 2c 20 22 5c 5c 25 | .command:gsub("([%s%(%)])",."\\% |
| 3880 | 31 22 29 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f | 1")....end........--.Function.to |
| 38a0 | 20 72 75 6e 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 6e 75 | .run.the.application.using.dmenu |
| 38c0 | 00 00 00 23 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 | ...#local.function.launch_applic |
| 38e0 | 61 74 69 6f 6e 28 29 00 00 00 2a 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 | ation()...*.local.desktop_files. |
| 3900 | 3d 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 14 09 6c 6f 63 61 6c 20 | =.get_desktop_files().....local. |
| 3920 | 61 70 70 5f 6c 69 73 74 20 3d 20 7b 7d 00 00 00 18 09 6c 6f 63 61 6c 20 61 70 70 5f 63 6f 6d 6d | app_list.=.{}.....local.app_comm |
| 3940 | 61 6e 64 73 20 3d 20 7b 7d 00 00 00 00 00 00 00 21 09 2d 2d 20 47 61 74 68 65 72 20 61 70 70 20 | ands.=.{}.......!.--.Gather.app. |
| 3960 | 6e 61 6d 65 73 20 61 6e 64 20 63 6f 6d 6d 61 6e 64 73 00 00 00 28 09 66 6f 72 20 5f 2c 20 66 69 | names.and.commands...(.for._,.fi |
| 3980 | 6c 65 20 69 6e 20 69 70 61 69 72 73 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 | le.in.ipairs(desktop_files).do.. |
| 39a0 | 00 40 09 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 | .@..local.app_name,.exec_command |
| 39c0 | 20 3d 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c | .=.extract_info_from_desktop(fil |
| 39e0 | 65 29 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d | e)...#..if.app_name.and.exec_com |
| 3a00 | 6d 61 6e 64 20 74 68 65 6e 00 00 00 23 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 61 70 70 | mand.then...#...table.insert(app |
| 3a20 | 5f 6c 69 73 74 2c 20 61 70 70 5f 6e 61 6d 65 29 00 00 00 28 09 09 09 61 70 70 5f 63 6f 6d 6d 61 | _list,.app_name)...(...app_comma |
| 3a40 | 6e 64 73 5b 61 70 70 5f 6e 61 6d 65 5d 20 3d 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 05 | nds[app_name].=.exec_command.... |
| 3a60 | 09 09 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 17 09 69 66 20 23 61 70 70 5f 6c 69 | ..end.....end.........if.#app_li |
| 3a80 | 73 74 20 3d 3d 20 30 20 74 68 65 6e 00 00 00 21 09 09 70 72 69 6e 74 28 22 4e 6f 20 61 70 70 6c | st.==.0.then...!..print("No.appl |
| 3aa0 | 69 63 61 74 69 6f 6e 73 20 66 6f 75 6e 64 2e 22 29 00 00 00 08 09 09 72 65 74 75 72 6e 00 00 00 | ications.found.")......return... |
| 3ac0 | 04 09 65 6e 64 00 00 00 00 00 00 00 35 09 2d 2d 20 4a 6f 69 6e 20 74 68 65 20 61 70 70 20 6e 61 | ..end.......5.--.Join.the.app.na |
| 3ae0 | 6d 65 73 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c 65 20 73 74 72 69 6e 67 20 66 6f 72 20 64 6d 65 | mes.into.a.single.string.for.dme |
| 3b00 | 6e 75 00 00 00 2a 09 6c 6f 63 61 6c 20 61 70 70 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 | nu...*.local.apps.=.table.concat |
| 3b20 | 28 61 70 70 5f 6c 69 73 74 2c 20 22 5c 6e 22 29 00 00 00 00 00 00 00 26 09 2d 2d 20 55 73 65 20 | (app_list,."\n").......&.--.Use. |
| 3b40 | 64 6d 65 6e 75 20 74 6f 20 73 65 6c 65 63 74 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 00 00 | dmenu.to.select.an.application.. |
| 3b60 | 00 51 09 6c 6f 63 61 6c 20 68 61 6e 64 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 6c 65 | .Q.local.handle.=.io.popen(table |
| 3b80 | 2e 63 6f 6e 63 61 74 28 64 6d 65 6e 75 5f 63 6d 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c 3c 3c | .concat(dmenu_cmd,.".")....".<<< |
| 3ba0 | 20 27 22 20 2e 2e 20 61 70 70 73 20 2e 2e 20 22 27 22 29 00 00 00 37 09 6c 6f 63 61 6c 20 73 65 | .'"....apps...."'")...7.local.se |
| 3bc0 | 6c 65 63 74 65 64 5f 61 70 70 20 3d 20 68 61 6e 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 67 | lected_app.=.handle:read("*a"):g |
| 3be0 | 73 75 62 28 22 5c 6e 24 22 2c 20 22 22 29 00 00 00 0f 09 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 | sub("\n$",."").....handle:close( |
| 3c00 | 29 00 00 00 00 00 00 00 3a 09 69 66 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 | ).......:.if.selected_app.~=."". |
| 3c20 | 61 6e 64 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 | and.app_commands[selected_app].t |
| 3c40 | 68 65 6e 00 00 00 43 09 09 2d 2d 20 45 73 63 61 70 65 20 61 6e 79 20 73 70 65 63 69 61 6c 20 63 | hen...C..--.Escape.any.special.c |
| 3c60 | 68 61 72 61 63 74 65 72 73 20 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 62 65 66 6f 72 65 20 | haracters.in.the.command.before. |
| 3c80 | 72 75 6e 6e 69 6e 67 20 69 74 00 00 00 4e 09 09 6c 6f 63 61 6c 20 63 6f 6d 6d 61 6e 64 5f 74 6f | running.it...N..local.command_to |
| 3ca0 | 5f 72 75 6e 20 3d 20 65 73 63 61 70 65 5f 73 70 65 63 69 61 6c 5f 63 68 61 72 61 63 74 65 72 73 | _run.=.escape_special_characters |
| 3cc0 | 28 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 29 00 00 00 22 | (app_commands[selected_app])..." |
| 3ce0 | 09 09 2d 2d 20 52 75 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 6f 6d 6d 61 | ..--.Run.the.corresponding.comma |
| 3d00 | 6e 64 00 00 00 1c 09 09 6f 73 2e 65 78 65 63 75 74 65 28 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 75 | nd......os.execute(command_to_ru |
| 3d20 | 6e 29 00 00 00 04 09 65 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 11 2d 2d 20 4d 61 69 6e | n).....end....end........--.Main |
| 3d40 | 20 65 78 65 63 75 74 69 6f 6e 00 00 00 14 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e | .execution....launch_application |
| 3d60 | 28 29 f5 18 00 00 00 04 00 00 00 5f 00 00 00 5c 00 00 00 54 00 00 00 10 20 20 20 20 22 64 6d 65 | ()........._...\...T........"dme |
| 3d80 | 6e 75 5f 72 75 6e 22 2c 00 00 00 23 20 20 20 20 22 2d 66 6e 22 2c 20 22 46 69 72 61 20 43 6f 64 | nu_run",...#...."-fn",."Fira.Cod |
| 3da0 | 65 2d 31 30 22 2c 20 20 2d 2d 20 66 6f 6e 74 00 00 00 25 20 20 20 20 22 2d 6e 62 22 2c 20 22 23 | e-10",..--.font...%...."-nb",."# |
| 3dc0 | 31 65 31 65 31 65 22 2c 20 20 2d 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 25 20 20 20 20 | 1e1e1e",..--.normbgcolor...%.... |
| 3de0 | 22 2d 6e 66 22 2c 20 22 23 63 63 63 63 63 63 22 2c 20 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f | "-nf",."#cccccc",..--.normfgcolo |
| 3e00 | 72 00 00 00 24 20 20 20 20 22 2d 73 62 22 2c 20 22 23 32 34 37 32 63 38 22 2c 20 20 2d 2d 20 73 | r...$...."-sb",."#2472c8",..--.s |
| 3e20 | 65 6c 62 67 63 6f 6c 6f 72 00 00 00 24 20 20 20 20 22 2d 73 66 22 2c 20 22 23 65 35 65 35 65 35 | elbgcolor...$...."-sf",."#e5e5e5 |
| 3e40 | 22 2c 20 20 2d 2d 20 73 65 6c 66 67 63 6f 6c 6f 72 00 00 00 2f 20 20 20 20 22 2d 6c 22 2c 20 22 | ",..--.selfgcolor.../...."-l",." |
| 3e60 | 31 30 22 20 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 68 65 20 64 | 10"..--.number.of.lines.in.the.d |
| 3e80 | 6d 65 6e 75 00 00 00 01 7d 00 00 00 00 00 00 00 2d 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 | menu....}.......---.Function.to. |
| 3ea0 | 67 65 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 2e 64 65 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 | get.the.list.of..desktop.files.. |
| 3ec0 | 00 22 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c | ."local.function.get_desktop_fil |
| 3ee0 | 65 73 28 29 00 00 00 1c 20 20 20 20 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 | es()........local.desktop_files. |
| 3f00 | 3d 20 7b 7d 00 00 00 5f 20 20 20 20 6c 6f 63 61 6c 20 64 69 72 73 20 3d 20 7b 6f 73 2e 67 65 74 | =.{}..._....local.dirs.=.{os.get |
| 3f20 | 65 6e 76 28 22 48 4f 4d 45 22 29 20 2e 2e 20 22 2f 2e 6c 6f 63 61 6c 2f 73 68 61 72 65 2f 61 70 | env("HOME")...."/.local/share/ap |
| 3f40 | 70 6c 69 63 61 74 69 6f 6e 73 22 2c 20 22 2f 75 73 72 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 | plications",."/usr/share/applica |
| 3f60 | 74 69 6f 6e 73 22 7d 00 00 00 04 20 20 20 20 00 00 00 21 20 20 20 20 66 6f 72 20 5f 2c 20 64 69 | tions"}...........!....for._,.di |
| 3f80 | 72 20 69 6e 20 69 70 61 69 72 73 28 64 69 72 73 29 20 64 6f 00 00 00 46 20 20 20 20 20 20 20 20 | r.in.ipairs(dirs).do...F........ |
| 3fa0 | 6c 6f 63 61 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 27 66 69 6e 64 20 27 20 2e | local.pfile.=.io.popen('find.'.. |
| 3fc0 | 2e 20 64 69 72 20 2e 2e 20 27 20 2d 6e 61 6d 65 20 22 2a 2e 64 65 73 6b 74 6f 70 22 27 29 00 00 | ..dir....'.-name."*.desktop"').. |
| 3fe0 | 00 24 20 20 20 20 20 20 20 20 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a 6c 69 6e 65 | .$........for.file.in.pfile:line |
| 4000 | 73 28 29 20 64 6f 00 00 00 2d 20 20 20 20 20 20 20 20 20 20 20 20 74 61 62 6c 65 2e 69 6e 73 65 | s().do...-............table.inse |
| 4020 | 72 74 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 2c 20 66 69 6c 65 29 00 00 00 0b 20 20 20 20 20 | rt(desktop_files,.file)......... |
| 4040 | 20 20 20 65 6e 64 00 00 00 15 20 20 20 20 20 20 20 20 70 66 69 6c 65 3a 63 6c 6f 73 65 28 29 00 | ...end............pfile:close(). |
| 4060 | 00 00 07 20 20 20 20 65 6e 64 00 00 00 00 00 00 00 18 20 20 20 20 72 65 74 75 72 6e 20 64 65 73 | .......end............return.des |
| 4080 | 6b 74 6f 70 5f 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 50 2d 2d 20 46 75 6e 63 | ktop_files....end.......P--.Func |
| 40a0 | 74 69 6f 6e 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 | tion.to.extract.the.application. |
| 40c0 | 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 20 63 6f 6d 6d 61 6e 64 20 66 72 6f 6d 20 61 20 64 65 73 | name.and.exec.command.from.a.des |
| 40e0 | 6b 74 6f 70 20 66 69 6c 65 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 78 74 72 | ktop.file....local.function.extr |
| 4100 | 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 2b 20 | act_info_from_desktop(file)...+. |
| 4120 | 20 20 20 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 | ...local.app_name,.exec_command. |
| 4140 | 3d 20 6e 69 6c 2c 20 6e 69 6c 00 00 00 00 00 00 00 21 20 20 20 20 66 6f 72 20 6c 69 6e 65 20 69 | =.nil,.nil.......!....for.line.i |
| 4160 | 6e 20 69 6f 2e 6c 69 6e 65 73 28 66 69 6c 65 29 20 64 6f 00 00 00 24 20 20 20 20 20 20 20 20 69 | n.io.lines(file).do...$........i |
| 4180 | 66 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 22 20 | f.line:match("^Name=").then...". |
| 41a0 | 20 20 20 20 20 20 20 20 20 20 20 61 70 70 5f 6e 61 6d 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 | ...........app_name.=.line:sub(6 |
| 41c0 | 29 00 00 00 28 20 20 20 20 20 20 20 20 65 6c 73 65 69 66 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 | )...(........elseif.line:match(" |
| 41e0 | 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 26 20 20 20 20 20 20 20 20 20 20 20 20 65 78 65 | ^Exec=").then...&............exe |
| 4200 | 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 0b 20 20 20 20 20 | c_command.=.line:sub(6)......... |
| 4220 | 20 20 20 65 6e 64 00 00 00 00 00 00 00 29 20 20 20 20 20 20 20 20 69 66 20 61 70 70 5f 6e 61 6d | ...end.......)........if.app_nam |
| 4240 | 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 11 20 20 20 20 20 | e.and.exec_command.then......... |
| 4260 | 20 20 20 20 20 20 20 62 72 65 61 6b 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 07 20 | .......break............end..... |
| 4280 | 20 20 20 65 6e 64 00 00 00 00 00 00 00 21 20 20 20 20 72 65 74 75 72 6e 20 61 70 70 5f 6e 61 6d | ...end.......!....return.app_nam |
| 42a0 | 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 44 2d 2d | e,.exec_command....end.......D-- |
| 42c0 | 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 73 63 61 70 65 20 73 70 65 63 69 61 6c 20 63 68 61 72 | .Function.to.escape.special.char |
| 42e0 | 61 63 74 65 72 73 20 28 73 70 61 63 65 73 2c 20 70 61 72 65 6e 74 68 65 73 65 73 2c 20 65 74 63 | acters.(spaces,.parentheses,.etc |
| 4300 | 2e 29 00 00 00 31 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 73 63 61 70 65 5f 73 70 65 63 | .)...1local.function.escape_spec |
| 4320 | 69 61 6c 5f 63 68 61 72 61 63 74 65 72 73 28 63 6f 6d 6d 61 6e 64 29 00 00 00 39 20 20 20 20 2d | ial_characters(command)...9....- |
| 4340 | 2d 20 45 73 63 61 70 65 20 73 70 61 63 65 73 20 61 6e 64 20 70 61 72 65 6e 74 68 65 73 65 73 20 | -.Escape.spaces.and.parentheses. |
| 4360 | 66 6f 72 20 70 72 6f 70 65 72 20 65 78 65 63 75 74 69 6f 6e 00 00 00 2d 20 20 20 20 72 65 74 75 | for.proper.execution...-....retu |
| 4380 | 72 6e 20 63 6f 6d 6d 61 6e 64 3a 67 73 75 62 28 22 28 5b 25 73 25 28 25 29 5d 29 22 2c 20 22 5c | rn.command:gsub("([%s%(%)])",."\ |
| 43a0 | 5c 25 31 22 29 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 | \%1")....end........--.Function. |
| 43c0 | 74 6f 20 72 75 6e 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 | to.run.the.application.using.dme |
| 43e0 | 6e 75 00 00 00 23 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c | nu...#local.function.launch_appl |
| 4400 | 69 63 61 74 69 6f 6e 28 29 00 00 00 2d 20 20 20 20 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 | ication()...-....local.desktop_f |
| 4420 | 69 6c 65 73 20 3d 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 17 20 20 | iles.=.get_desktop_files()...... |
| 4440 | 20 20 6c 6f 63 61 6c 20 61 70 70 5f 6c 69 73 74 20 3d 20 7b 7d 00 00 00 1b 20 20 20 20 6c 6f 63 | ..local.app_list.=.{}........loc |
| 4460 | 61 6c 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 20 3d 20 7b 7d 00 00 00 00 00 00 00 24 20 20 20 20 | al.app_commands.=.{}.......$.... |
| 4480 | 2d 2d 20 47 61 74 68 65 72 20 61 70 70 20 6e 61 6d 65 73 20 61 6e 64 20 63 6f 6d 6d 61 6e 64 73 | --.Gather.app.names.and.commands |
| 44a0 | 00 00 00 2b 20 20 20 20 66 6f 72 20 5f 2c 20 66 69 6c 65 20 69 6e 20 69 70 61 69 72 73 28 64 65 | ...+....for._,.file.in.ipairs(de |
| 44c0 | 73 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 00 46 20 20 20 20 20 20 20 20 6c 6f 63 61 6c | sktop_files).do...F........local |
| 44e0 | 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 65 78 74 72 61 63 | .app_name,.exec_command.=.extrac |
| 4500 | 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 29 20 20 20 | t_info_from_desktop(file)...)... |
| 4520 | 20 20 20 20 20 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e | .....if.app_name.and.exec_comman |
| 4540 | 64 20 74 68 65 6e 00 00 00 2c 20 20 20 20 20 20 20 20 20 20 20 20 74 61 62 6c 65 2e 69 6e 73 65 | d.then...,............table.inse |
| 4560 | 72 74 28 61 70 70 5f 6c 69 73 74 2c 20 61 70 70 5f 6e 61 6d 65 29 00 00 00 31 20 20 20 20 20 20 | rt(app_list,.app_name)...1...... |
| 4580 | 20 20 20 20 20 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 61 70 70 5f 6e 61 6d 65 5d 20 3d 20 65 | ......app_commands[app_name].=.e |
| 45a0 | 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 07 20 20 | xec_command............end...... |
| 45c0 | 20 20 65 6e 64 00 00 00 00 00 00 00 1a 20 20 20 20 69 66 20 23 61 70 70 5f 6c 69 73 74 20 3d 3d | ..end............if.#app_list.== |
| 45e0 | 20 30 20 74 68 65 6e 00 00 00 27 20 20 20 20 20 20 20 20 70 72 69 6e 74 28 22 4e 6f 20 61 70 70 | .0.then...'........print("No.app |
| 4600 | 6c 69 63 61 74 69 6f 6e 73 20 66 6f 75 6e 64 2e 22 29 00 00 00 0e 20 20 20 20 20 20 20 20 72 65 | lications.found.")............re |
| 4620 | 74 75 72 6e 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 00 00 00 00 38 20 20 20 20 2d 2d 20 4a 6f | turn........end.......8....--.Jo |
| 4640 | 69 6e 20 74 68 65 20 61 70 70 20 6e 61 6d 65 73 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c 65 20 73 | in.the.app.names.into.a.single.s |
| 4660 | 74 72 69 6e 67 20 66 6f 72 20 64 6d 65 6e 75 00 00 00 2d 20 20 20 20 6c 6f 63 61 6c 20 61 70 70 | tring.for.dmenu...-....local.app |
| 4680 | 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 61 70 70 5f 6c 69 73 74 2c 20 22 5c 6e 22 29 | s.=.table.concat(app_list,."\n") |
| 46a0 | 00 00 00 00 00 00 00 29 20 20 20 20 2d 2d 20 55 73 65 20 64 6d 65 6e 75 20 74 6f 20 73 65 6c 65 | .......)....--.Use.dmenu.to.sele |
| 46c0 | 63 74 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 00 00 00 54 20 20 20 20 6c 6f 63 61 6c 20 68 | ct.an.application...T....local.h |
| 46e0 | 61 6e 64 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 64 6d | andle.=.io.popen(table.concat(dm |
| 4700 | 65 6e 75 5f 63 6d 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c 3c 3c 20 27 22 20 2e 2e 20 61 70 70 | enu_cmd,.".")....".<<<.'"....app |
| 4720 | 73 20 2e 2e 20 22 27 22 29 00 00 00 3a 20 20 20 20 6c 6f 63 61 6c 20 73 65 6c 65 63 74 65 64 5f | s...."'")...:....local.selected_ |
| 4740 | 61 70 70 20 3d 20 68 61 6e 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 67 73 75 62 28 22 5c 6e | app.=.handle:read("*a"):gsub("\n |
| 4760 | 24 22 2c 20 22 22 29 00 00 00 12 20 20 20 20 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 | $",."")........handle:close()... |
| 4780 | 00 00 00 00 3d 20 20 20 20 69 66 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 61 | ....=....if.selected_app.~=."".a |
| 47a0 | 6e 64 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 68 | nd.app_commands[selected_app].th |
| 47c0 | 65 6e 00 00 00 49 20 20 20 20 20 20 20 20 2d 2d 20 45 73 63 61 70 65 20 61 6e 79 20 73 70 65 63 | en...I........--.Escape.any.spec |
| 47e0 | 69 61 6c 20 63 68 61 72 61 63 74 65 72 73 20 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 62 65 | ial.characters.in.the.command.be |
| 4800 | 66 6f 72 65 20 72 75 6e 6e 69 6e 67 20 69 74 00 00 00 54 20 20 20 20 20 20 20 20 6c 6f 63 61 6c | fore.running.it...T........local |
| 4820 | 20 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 75 6e 20 3d 20 65 73 63 61 70 65 5f 73 70 65 63 69 61 6c | .command_to_run.=.escape_special |
| 4840 | 5f 63 68 61 72 61 63 74 65 72 73 28 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 | _characters(app_commands[selecte |
| 4860 | 64 5f 61 70 70 5d 29 00 00 00 28 20 20 20 20 20 20 20 20 2d 2d 20 52 75 6e 20 74 68 65 20 63 6f | d_app])...(........--.Run.the.co |
| 4880 | 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 6f 6d 6d 61 6e 64 00 00 00 22 20 20 20 20 20 20 20 20 6f | rresponding.command..."........o |
| 48a0 | 73 2e 65 78 65 63 75 74 65 28 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 75 6e 29 00 00 00 07 20 20 20 | s.execute(command_to_run)....... |
| 48c0 | 20 65 6e 64 35 81 f5 18 00 00 00 00 04 00 00 00 00 00 00 00 53 00 00 00 04 00 00 00 59 00 00 00 | .end5...............S.......Y... |
| 48e0 | 01 00 00 00 7e 00 00 00 00 00 00 00 50 0a 00 00 00 00 00 00 47 09 00 00 00 00 00 00 f5 18 00 00 | ....~.......P.......G........... |
| 4900 | 00 00 00 00 00 00 00 00 00 00 61 00 00 00 14 00 00 00 62 00 00 00 00 00 00 00 00 00 00 00 00 00 | ..........a.......b............. |
| 4920 | 00 00 f4 09 00 00 00 00 00 00 04 0a 00 00 00 00 00 00 f5 18 00 00 00 00 62 00 00 00 00 00 00 00 | ........................b....... |
| 4940 | 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 0a 00 00 00 00 00 00 01 00 00 00 00 00 00 00 | ................................ |
| 4960 | 00 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 05 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 06 | ........5._..................... |
| 4980 | 00 00 00 62 00 00 00 13 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ...b............................ |
| 49a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 49c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 49e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4a00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4a20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4a40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4a60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4a80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4aa0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4ac0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4ae0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 69 a1 12 e0 04 01 00 00 00 04 00 f5 18 00 00 00 62 00 | ..............i...............b. |
| 4b00 | 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 4b20 | 62 00 00 00 4a 2d 2d 20 4c 75 61 20 73 63 72 69 70 74 20 74 6f 20 6c 61 75 6e 63 68 20 61 70 70 | b...J--.Lua.script.to.launch.app |
| 4b40 | 6c 69 63 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 64 6d 65 6e 75 20 77 69 74 68 20 63 75 73 74 6f | lications.using.dmenu.with.custo |
| 4b60 | 6d 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 00 00 00 00 1d 2d 2d 20 43 75 73 74 6f 6d | m.configuration........--.Custom |
| 4b80 | 20 64 6d 65 6e 75 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 13 6c 6f 63 61 6c 20 64 6d | .dmenu.configuration....local.dm |
| 4ba0 | 65 6e 75 5f 63 6d 64 20 3d 20 7b 00 00 00 0d 09 22 64 6d 65 6e 75 5f 72 75 6e 22 2c 00 00 00 07 | enu_cmd.=.{....."dmenu_run",.... |
| 4bc0 | 09 22 2d 66 6e 22 2c 00 00 00 18 09 22 46 69 72 61 20 43 6f 64 65 2d 31 30 22 2c 20 2d 2d 20 66 | ."-fn",....."Fira.Code-10",.--.f |
| 4be0 | 6f 6e 74 00 00 00 07 09 22 2d 6e 62 22 2c 00 00 00 1a 09 22 23 31 65 31 65 31 65 22 2c 20 2d 2d | ont....."-nb",....."#1e1e1e",.-- |
| 4c00 | 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 1a 09 22 23 63 63 | .normbgcolor....."-nf",....."#cc |
| 4c20 | 63 63 63 63 22 2c 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 73 62 22 2c | cccc",.--.normfgcolor....."-sb", |
| 4c40 | 00 00 00 19 09 22 23 32 34 37 32 63 38 22 2c 20 2d 2d 20 73 65 6c 62 67 63 6f 6c 6f 72 00 00 00 | ....."#2472c8",.--.selbgcolor... |
| 4c60 | 07 09 22 2d 73 66 22 2c 00 00 00 19 09 22 23 65 35 65 35 65 35 22 2c 20 2d 2d 20 73 65 6c 66 67 | .."-sf",....."#e5e5e5",.--.selfg |
| 4c80 | 63 6f 6c 6f 72 00 00 00 06 09 22 2d 6c 22 2c 00 00 00 26 09 22 31 30 22 2c 20 2d 2d 20 6e 75 6d | color....."-l",...&."10",.--.num |
| 4ca0 | 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 00 00 00 01 7d 00 00 | ber.of.lines.in.the.dmenu....}.. |
| 4cc0 | 00 00 00 00 00 2d 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 74 68 65 20 6c 69 73 | .....---.Function.to.get.the.lis |
| 4ce0 | 74 20 6f 66 20 2e 64 65 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 00 22 6c 6f 63 61 6c 20 66 75 6e | t.of..desktop.files..."local.fun |
| 4d00 | 63 74 69 6f 6e 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 19 09 6c 6f | ction.get_desktop_files().....lo |
| 4d20 | 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5e 09 6c 6f 63 61 6c | cal.desktop_files.=.{}...^.local |
| 4d40 | 20 64 69 72 73 20 3d 20 7b 20 6f 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 29 20 2e 2e 20 22 | .dirs.=.{.os.getenv("HOME")...." |
| 4d60 | 2f 2e 6c 6f 63 61 6c 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 2c 20 22 2f 75 | /.local/share/applications",."/u |
| 4d80 | 73 72 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 20 7d 00 00 00 00 00 00 00 1e | sr/share/applications".}........ |
| 4da0 | 09 66 6f 72 20 5f 2c 20 64 69 72 20 69 6e 20 69 70 61 69 72 73 28 64 69 72 73 29 20 64 6f 00 00 | .for._,.dir.in.ipairs(dirs).do.. |
| 4dc0 | 00 40 09 09 6c 6f 63 61 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 22 66 69 6e 64 | .@..local.pfile.=.io.popen("find |
| 4de0 | 20 22 20 2e 2e 20 64 69 72 20 2e 2e 20 27 20 2d 6e 61 6d 65 20 22 2a 2e 64 65 73 6b 74 6f 70 22 | ."....dir....'.-name."*.desktop" |
| 4e00 | 27 29 00 00 00 1e 09 09 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a 6c 69 6e 65 73 28 | ')......for.file.in.pfile:lines( |
| 4e20 | 29 20 64 6f 00 00 00 24 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 73 6b 74 6f 70 5f | ).do...$...table.insert(desktop_ |
| 4e40 | 66 69 6c 65 73 2c 20 66 69 6c 65 29 00 00 00 05 09 09 65 6e 64 00 00 00 0f 09 09 70 66 69 6c 65 | files,.file)......end......pfile |
| 4e60 | 3a 63 6c 6f 73 65 28 29 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 15 09 72 65 74 75 72 6e 20 | :close().....end.........return. |
| 4e80 | 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 50 2d 2d 20 46 | desktop_files....end.......P--.F |
| 4ea0 | 75 6e 63 74 69 6f 6e 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 | unction.to.extract.the.applicati |
| 4ec0 | 6f 6e 20 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 20 63 6f 6d 6d 61 6e 64 20 66 72 6f 6d 20 61 20 | on.name.and.exec.command.from.a. |
| 4ee0 | 64 65 73 6b 74 6f 70 20 66 69 6c 65 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 | desktop.file....local.function.e |
| 4f00 | 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 | xtract_info_from_desktop(file).. |
| 4f20 | 00 28 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 | .(.local.app_name,.exec_command. |
| 4f40 | 3d 20 6e 69 6c 2c 20 6e 69 6c 00 00 00 00 00 00 00 1e 09 66 6f 72 20 6c 69 6e 65 20 69 6e 20 69 | =.nil,.nil.........for.line.in.i |
| 4f60 | 6f 2e 6c 69 6e 65 73 28 66 69 6c 65 29 20 64 6f 00 00 00 1e 09 09 69 66 20 6c 69 6e 65 3a 6d 61 | o.lines(file).do......if.line:ma |
| 4f80 | 74 63 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 19 09 09 09 61 70 70 5f 6e 61 6d | tch("^Name=").then.......app_nam |
| 4fa0 | 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 22 09 09 65 6c 73 65 69 66 20 6c 69 6e 65 | e.=.line:sub(6)..."..elseif.line |
| 4fc0 | 3a 6d 61 74 63 68 28 22 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 1d 09 09 09 65 78 65 63 | :match("^Exec=").then.......exec |
| 4fe0 | 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 05 09 09 65 6e 64 00 | _command.=.line:sub(6)......end. |
| 5000 | 00 00 00 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f | ......#..if.app_name.and.exec_co |
| 5020 | 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 08 09 09 09 62 72 65 61 6b 00 00 00 05 09 09 65 6e 64 00 | mmand.then.......break......end. |
| 5040 | 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 1e 09 72 65 74 75 72 6e 20 61 70 70 5f 6e 61 6d 65 2c | ....end.........return.app_name, |
| 5060 | 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 44 2d 2d 20 46 | .exec_command....end.......D--.F |
| 5080 | 75 6e 63 74 69 6f 6e 20 74 6f 20 65 73 63 61 70 65 20 73 70 65 63 69 61 6c 20 63 68 61 72 61 63 | unction.to.escape.special.charac |
| 50a0 | 74 65 72 73 20 28 73 70 61 63 65 73 2c 20 70 61 72 65 6e 74 68 65 73 65 73 2c 20 65 74 63 2e 29 | ters.(spaces,.parentheses,.etc.) |
| 50c0 | 00 00 00 31 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 73 63 61 70 65 5f 73 70 65 63 69 61 | ...1local.function.escape_specia |
| 50e0 | 6c 5f 63 68 61 72 61 63 74 65 72 73 28 63 6f 6d 6d 61 6e 64 29 00 00 00 36 09 2d 2d 20 45 73 63 | l_characters(command)...6.--.Esc |
| 5100 | 61 70 65 20 73 70 61 63 65 73 20 61 6e 64 20 70 61 72 65 6e 74 68 65 73 65 73 20 66 6f 72 20 70 | ape.spaces.and.parentheses.for.p |
| 5120 | 72 6f 70 65 72 20 65 78 65 63 75 74 69 6f 6e 00 00 00 2a 09 72 65 74 75 72 6e 20 63 6f 6d 6d 61 | roper.execution...*.return.comma |
| 5140 | 6e 64 3a 67 73 75 62 28 22 28 5b 25 73 25 28 25 29 5d 29 22 2c 20 22 5c 5c 25 31 22 29 00 00 00 | nd:gsub("([%s%(%)])",."\\%1")... |
| 5160 | 03 65 6e 64 00 00 00 00 00 00 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 72 75 6e 20 74 | .end........--.Function.to.run.t |
| 5180 | 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 6e 75 00 00 00 23 6c 6f | he.application.using.dmenu...#lo |
| 51a0 | 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e 28 | cal.function.launch_application( |
| 51c0 | 29 00 00 00 2a 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 67 65 74 5f | )...*.local.desktop_files.=.get_ |
| 51e0 | 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 14 09 6c 6f 63 61 6c 20 61 70 70 5f 6c 69 | desktop_files().....local.app_li |
| 5200 | 73 74 20 3d 20 7b 7d 00 00 00 18 09 6c 6f 63 61 6c 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 20 3d | st.=.{}.....local.app_commands.= |
| 5220 | 20 7b 7d 00 00 00 00 00 00 00 21 09 2d 2d 20 47 61 74 68 65 72 20 61 70 70 20 6e 61 6d 65 73 20 | .{}.......!.--.Gather.app.names. |
| 5240 | 61 6e 64 20 63 6f 6d 6d 61 6e 64 73 00 00 00 28 09 66 6f 72 20 5f 2c 20 66 69 6c 65 20 69 6e 20 | and.commands...(.for._,.file.in. |
| 5260 | 69 70 61 69 72 73 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 00 40 09 09 6c 6f | ipairs(desktop_files).do...@..lo |
| 5280 | 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 65 78 74 | cal.app_name,.exec_command.=.ext |
| 52a0 | 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 23 | ract_info_from_desktop(file)...# |
| 52c0 | 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 74 | ..if.app_name.and.exec_command.t |
| 52e0 | 68 65 6e 00 00 00 23 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 61 70 70 5f 6c 69 73 74 2c | hen...#...table.insert(app_list, |
| 5300 | 20 61 70 70 5f 6e 61 6d 65 29 00 00 00 28 09 09 09 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 61 70 | .app_name)...(...app_commands[ap |
| 5320 | 70 5f 6e 61 6d 65 5d 20 3d 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 05 09 09 65 6e 64 00 | p_name].=.exec_command......end. |
| 5340 | 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 17 09 69 66 20 23 61 70 70 5f 6c 69 73 74 20 3d 3d 20 | ....end.........if.#app_list.==. |
| 5360 | 30 20 74 68 65 6e 00 00 00 21 09 09 70 72 69 6e 74 28 22 4e 6f 20 61 70 70 6c 69 63 61 74 69 6f | 0.then...!..print("No.applicatio |
| 5380 | 6e 73 20 66 6f 75 6e 64 2e 22 29 00 00 00 08 09 09 72 65 74 75 72 6e 00 00 00 04 09 65 6e 64 00 | ns.found.")......return.....end. |
| 53a0 | 00 00 00 00 00 00 35 09 2d 2d 20 4a 6f 69 6e 20 74 68 65 20 61 70 70 20 6e 61 6d 65 73 20 69 6e | ......5.--.Join.the.app.names.in |
| 53c0 | 74 6f 20 61 20 73 69 6e 67 6c 65 20 73 74 72 69 6e 67 20 66 6f 72 20 64 6d 65 6e 75 00 00 00 2a | to.a.single.string.for.dmenu...* |
| 53e0 | 09 6c 6f 63 61 6c 20 61 70 70 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 61 70 70 5f 6c | .local.apps.=.table.concat(app_l |
| 5400 | 69 73 74 2c 20 22 5c 6e 22 29 00 00 00 00 00 00 00 26 09 2d 2d 20 55 73 65 20 64 6d 65 6e 75 20 | ist,."\n").......&.--.Use.dmenu. |
| 5420 | 74 6f 20 73 65 6c 65 63 74 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 00 00 00 51 09 6c 6f 63 | to.select.an.application...Q.loc |
| 5440 | 61 6c 20 68 61 6e 64 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 6c 65 2e 63 6f 6e 63 61 | al.handle.=.io.popen(table.conca |
| 5460 | 74 28 64 6d 65 6e 75 5f 63 6d 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c 3c 3c 20 27 22 20 2e 2e | t(dmenu_cmd,.".")....".<<<.'"... |
| 5480 | 20 61 70 70 73 20 2e 2e 20 22 27 22 29 00 00 00 37 09 6c 6f 63 61 6c 20 73 65 6c 65 63 74 65 64 | .apps...."'")...7.local.selected |
| 54a0 | 5f 61 70 70 20 3d 20 68 61 6e 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 67 73 75 62 28 22 5c | _app.=.handle:read("*a"):gsub("\ |
| 54c0 | 6e 24 22 2c 20 22 22 29 00 00 00 0f 09 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 00 00 | n$",."").....handle:close()..... |
| 54e0 | 00 00 3a 09 69 66 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 61 6e 64 20 61 70 | ..:.if.selected_app.~=."".and.ap |
| 5500 | 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 68 65 6e 00 00 00 | p_commands[selected_app].then... |
| 5520 | 43 09 09 2d 2d 20 45 73 63 61 70 65 20 61 6e 79 20 73 70 65 63 69 61 6c 20 63 68 61 72 61 63 74 | C..--.Escape.any.special.charact |
| 5540 | 65 72 73 20 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 62 65 66 6f 72 65 20 72 75 6e 6e 69 6e | ers.in.the.command.before.runnin |
| 5560 | 67 20 69 74 00 00 00 4e 09 09 6c 6f 63 61 6c 20 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 75 6e 20 3d | g.it...N..local.command_to_run.= |
| 5580 | 20 65 73 63 61 70 65 5f 73 70 65 63 69 61 6c 5f 63 68 61 72 61 63 74 65 72 73 28 61 70 70 5f 63 | .escape_special_characters(app_c |
| 55a0 | 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 29 00 00 00 22 09 09 2d 2d 20 52 | ommands[selected_app])..."..--.R |
| 55c0 | 75 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 6f 6d 6d 61 6e 64 00 00 00 1c | un.the.corresponding.command.... |
| 55e0 | 09 09 6f 73 2e 65 78 65 63 75 74 65 28 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 75 6e 29 00 00 00 04 | ..os.execute(command_to_run).... |
| 5600 | 09 65 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 11 2d 2d 20 4d 61 69 6e 20 65 78 65 63 75 | .end....end........--.Main.execu |
| 5620 | 74 69 6f 6e 00 00 00 14 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e 28 29 f5 18 00 00 | tion....launch_application().... |
| 5640 | 00 08 00 00 00 12 00 00 00 62 00 00 00 09 00 00 00 1c 09 22 23 31 65 31 65 31 65 22 2c 20 20 20 | .........b........."#1e1e1e",... |
| 5660 | 2d 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 1c 09 22 23 | --.normbgcolor....."-nf",....."# |
| 5680 | 63 63 63 63 63 63 22 2c 20 20 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d | cccccc",...--.normfgcolor....."- |
| 56a0 | 73 62 22 2c 00 00 00 1b 09 22 23 32 34 37 32 63 38 22 2c 20 20 20 2d 2d 20 73 65 6c 62 67 63 6f | sb",....."#2472c8",...--.selbgco |
| 56c0 | 6c 6f 72 00 00 00 07 09 22 2d 73 66 22 2c 00 00 00 1b 09 22 23 65 35 65 35 65 35 22 2c 20 20 20 | lor....."-sf",....."#e5e5e5",... |
| 56e0 | 2d 2d 20 73 65 6c 66 67 63 6f 6c 6f 72 00 00 00 06 09 22 2d 6c 22 2c 00 00 00 2d 09 22 31 30 22 | --.selfgcolor....."-l",...-."10" |
| 5700 | 2c 20 20 20 20 20 20 20 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 | ,........--.number.of.lines.in.t |
| 5720 | 68 65 20 64 6d 65 6e 75 35 81 f5 18 00 00 00 00 08 00 00 00 0c 00 00 00 08 00 00 00 0d 00 00 00 | he.dmenu5....................... |
| 5740 | 08 00 00 00 06 00 00 00 c1 00 00 00 00 00 00 00 92 00 00 00 00 00 00 00 83 00 00 00 00 00 00 00 | ................................ |
| 5760 | f5 18 00 00 00 00 00 00 00 00 00 00 00 00 61 00 00 00 14 00 00 00 62 00 00 00 00 00 00 00 00 00 | ..............a.......b......... |
| 5780 | 00 00 00 00 00 00 f4 09 00 00 00 00 00 00 04 0a 00 00 00 00 00 00 f5 18 00 00 00 00 62 00 00 00 | ............................b... |
| 57a0 | 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 0a 00 00 00 00 00 00 01 00 00 00 | ................................ |
| 57c0 | 00 00 00 00 00 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 06 00 00 00 08 00 00 00 00 00 00 00 00 | ............5._................. |
| 57e0 | 00 00 00 07 00 00 00 62 00 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 | .......b........................ |
| 5800 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 5820 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 5840 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 5860 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 5880 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 58a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 58c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 58e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 5900 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 5920 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 5940 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 69 a1 12 fc 04 01 00 00 00 05 00 f5 18 00 | ..................i............. |
| 5960 | 00 00 62 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 | ..b............................. |
| 5980 | 00 00 00 00 62 00 00 00 4a 2d 2d 20 4c 75 61 20 73 63 72 69 70 74 20 74 6f 20 6c 61 75 6e 63 68 | ....b...J--.Lua.script.to.launch |
| 59a0 | 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 64 6d 65 6e 75 20 77 69 74 68 20 63 | .applications.using.dmenu.with.c |
| 59c0 | 75 73 74 6f 6d 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 00 00 00 00 1d 2d 2d 20 43 75 | ustom.configuration........--.Cu |
| 59e0 | 73 74 6f 6d 20 64 6d 65 6e 75 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 00 00 00 13 6c 6f 63 61 | stom.dmenu.configuration....loca |
| 5a00 | 6c 20 64 6d 65 6e 75 5f 63 6d 64 20 3d 20 7b 00 00 00 0d 09 22 64 6d 65 6e 75 5f 72 75 6e 22 2c | l.dmenu_cmd.=.{....."dmenu_run", |
| 5a20 | 00 00 00 07 09 22 2d 66 6e 22 2c 00 00 00 18 09 22 46 69 72 61 20 43 6f 64 65 2d 31 30 22 2c 20 | ....."-fn",....."Fira.Code-10",. |
| 5a40 | 2d 2d 20 66 6f 6e 74 00 00 00 07 09 22 2d 6e 62 22 2c 00 00 00 1a 09 22 23 31 65 31 65 31 65 22 | --.font....."-nb",....."#1e1e1e" |
| 5a60 | 2c 20 2d 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 1a 09 | ,.--.normbgcolor....."-nf",..... |
| 5a80 | 22 23 63 63 63 63 63 63 22 2c 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d | "#cccccc",.--.normfgcolor....."- |
| 5aa0 | 73 62 22 2c 00 00 00 19 09 22 23 32 34 37 32 63 38 22 2c 20 2d 2d 20 73 65 6c 62 67 63 6f 6c 6f | sb",....."#2472c8",.--.selbgcolo |
| 5ac0 | 72 00 00 00 07 09 22 2d 73 66 22 2c 00 00 00 19 09 22 23 65 35 65 35 65 35 22 2c 20 2d 2d 20 73 | r....."-sf",....."#e5e5e5",.--.s |
| 5ae0 | 65 6c 66 67 63 6f 6c 6f 72 00 00 00 06 09 22 2d 6c 22 2c 00 00 00 26 09 22 31 30 22 2c 20 2d 2d | elfgcolor....."-l",...&."10",.-- |
| 5b00 | 20 6e 75 6d 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 00 00 00 | .number.of.lines.in.the.dmenu... |
| 5b20 | 01 7d 00 00 00 00 00 00 00 2d 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 74 68 65 | .}.......---.Function.to.get.the |
| 5b40 | 20 6c 69 73 74 20 6f 66 20 2e 64 65 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 00 22 6c 6f 63 61 6c | .list.of..desktop.files..."local |
| 5b60 | 20 66 75 6e 63 74 69 6f 6e 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 | .function.get_desktop_files()... |
| 5b80 | 19 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5e 09 6c | ..local.desktop_files.=.{}...^.l |
| 5ba0 | 6f 63 61 6c 20 64 69 72 73 20 3d 20 7b 20 6f 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 29 20 | ocal.dirs.=.{.os.getenv("HOME"). |
| 5bc0 | 2e 2e 20 22 2f 2e 6c 6f 63 61 6c 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 2c | ..."/.local/share/applications", |
| 5be0 | 20 22 2f 75 73 72 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 20 7d 00 00 00 00 | ."/usr/share/applications".}.... |
| 5c00 | 00 00 00 1e 09 66 6f 72 20 5f 2c 20 64 69 72 20 69 6e 20 69 70 61 69 72 73 28 64 69 72 73 29 20 | .....for._,.dir.in.ipairs(dirs). |
| 5c20 | 64 6f 00 00 00 40 09 09 6c 6f 63 61 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 22 | do...@..local.pfile.=.io.popen(" |
| 5c40 | 66 69 6e 64 20 22 20 2e 2e 20 64 69 72 20 2e 2e 20 27 20 2d 6e 61 6d 65 20 22 2a 2e 64 65 73 6b | find."....dir....'.-name."*.desk |
| 5c60 | 74 6f 70 22 27 29 00 00 00 1e 09 09 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a 6c 69 | top"')......for.file.in.pfile:li |
| 5c80 | 6e 65 73 28 29 20 64 6f 00 00 00 24 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 73 6b | nes().do...$...table.insert(desk |
| 5ca0 | 74 6f 70 5f 66 69 6c 65 73 2c 20 66 69 6c 65 29 00 00 00 05 09 09 65 6e 64 00 00 00 0f 09 09 70 | top_files,.file)......end......p |
| 5cc0 | 66 69 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 15 09 72 65 74 | file:close().....end.........ret |
| 5ce0 | 75 72 6e 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 50 | urn.desktop_files....end.......P |
| 5d00 | 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 70 70 6c 69 | --.Function.to.extract.the.appli |
| 5d20 | 63 61 74 69 6f 6e 20 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 20 63 6f 6d 6d 61 6e 64 20 66 72 6f | cation.name.and.exec.command.fro |
| 5d40 | 6d 20 61 20 64 65 73 6b 74 6f 70 20 66 69 6c 65 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 74 69 | m.a.desktop.file....local.functi |
| 5d60 | 6f 6e 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c | on.extract_info_from_desktop(fil |
| 5d80 | 65 29 00 00 00 28 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d | e)...(.local.app_name,.exec_comm |
| 5da0 | 61 6e 64 20 3d 20 6e 69 6c 2c 20 6e 69 6c 00 00 00 00 00 00 00 1e 09 66 6f 72 20 6c 69 6e 65 20 | and.=.nil,.nil.........for.line. |
| 5dc0 | 69 6e 20 69 6f 2e 6c 69 6e 65 73 28 66 69 6c 65 29 20 64 6f 00 00 00 1e 09 09 69 66 20 6c 69 6e | in.io.lines(file).do......if.lin |
| 5de0 | 65 3a 6d 61 74 63 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 19 09 09 09 61 70 70 | e:match("^Name=").then.......app |
| 5e00 | 5f 6e 61 6d 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 22 09 09 65 6c 73 65 69 66 20 | _name.=.line:sub(6)..."..elseif. |
| 5e20 | 6c 69 6e 65 3a 6d 61 74 63 68 28 22 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 1d 09 09 09 | line:match("^Exec=").then....... |
| 5e40 | 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 05 09 09 | exec_command.=.line:sub(6)...... |
| 5e60 | 65 6e 64 00 00 00 00 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 | end.......#..if.app_name.and.exe |
| 5e80 | 63 5f 63 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 08 09 09 09 62 72 65 61 6b 00 00 00 05 09 09 | c_command.then.......break...... |
| 5ea0 | 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 1e 09 72 65 74 75 72 6e 20 61 70 70 5f 6e | end.....end.........return.app_n |
| 5ec0 | 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 44 | ame,.exec_command....end.......D |
| 5ee0 | 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 73 63 61 70 65 20 73 70 65 63 69 61 6c 20 63 68 | --.Function.to.escape.special.ch |
| 5f00 | 61 72 61 63 74 65 72 73 20 28 73 70 61 63 65 73 2c 20 70 61 72 65 6e 74 68 65 73 65 73 2c 20 65 | aracters.(spaces,.parentheses,.e |
| 5f20 | 74 63 2e 29 00 00 00 31 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 73 63 61 70 65 5f 73 70 | tc.)...1local.function.escape_sp |
| 5f40 | 65 63 69 61 6c 5f 63 68 61 72 61 63 74 65 72 73 28 63 6f 6d 6d 61 6e 64 29 00 00 00 36 09 2d 2d | ecial_characters(command)...6.-- |
| 5f60 | 20 45 73 63 61 70 65 20 73 70 61 63 65 73 20 61 6e 64 20 70 61 72 65 6e 74 68 65 73 65 73 20 66 | .Escape.spaces.and.parentheses.f |
| 5f80 | 6f 72 20 70 72 6f 70 65 72 20 65 78 65 63 75 74 69 6f 6e 00 00 00 2a 09 72 65 74 75 72 6e 20 63 | or.proper.execution...*.return.c |
| 5fa0 | 6f 6d 6d 61 6e 64 3a 67 73 75 62 28 22 28 5b 25 73 25 28 25 29 5d 29 22 2c 20 22 5c 5c 25 31 22 | ommand:gsub("([%s%(%)])",."\\%1" |
| 5fc0 | 29 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 72 | )....end........--.Function.to.r |
| 5fe0 | 75 6e 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 6e 75 00 00 | un.the.application.using.dmenu.. |
| 6000 | 00 23 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 | .#local.function.launch_applicat |
| 6020 | 69 6f 6e 28 29 00 00 00 2a 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 | ion()...*.local.desktop_files.=. |
| 6040 | 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 14 09 6c 6f 63 61 6c 20 61 70 | get_desktop_files().....local.ap |
| 6060 | 70 5f 6c 69 73 74 20 3d 20 7b 7d 00 00 00 18 09 6c 6f 63 61 6c 20 61 70 70 5f 63 6f 6d 6d 61 6e | p_list.=.{}.....local.app_comman |
| 6080 | 64 73 20 3d 20 7b 7d 00 00 00 00 00 00 00 21 09 2d 2d 20 47 61 74 68 65 72 20 61 70 70 20 6e 61 | ds.=.{}.......!.--.Gather.app.na |
| 60a0 | 6d 65 73 20 61 6e 64 20 63 6f 6d 6d 61 6e 64 73 00 00 00 28 09 66 6f 72 20 5f 2c 20 66 69 6c 65 | mes.and.commands...(.for._,.file |
| 60c0 | 20 69 6e 20 69 70 61 69 72 73 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 00 40 | .in.ipairs(desktop_files).do...@ |
| 60e0 | 09 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d | ..local.app_name,.exec_command.= |
| 6100 | 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 | .extract_info_from_desktop(file) |
| 6120 | 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 | ...#..if.app_name.and.exec_comma |
| 6140 | 6e 64 20 74 68 65 6e 00 00 00 23 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 61 70 70 5f 6c | nd.then...#...table.insert(app_l |
| 6160 | 69 73 74 2c 20 61 70 70 5f 6e 61 6d 65 29 00 00 00 28 09 09 09 61 70 70 5f 63 6f 6d 6d 61 6e 64 | ist,.app_name)...(...app_command |
| 6180 | 73 5b 61 70 70 5f 6e 61 6d 65 5d 20 3d 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 05 09 09 | s[app_name].=.exec_command...... |
| 61a0 | 65 6e 64 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 17 09 69 66 20 23 61 70 70 5f 6c 69 73 74 | end.....end.........if.#app_list |
| 61c0 | 20 3d 3d 20 30 20 74 68 65 6e 00 00 00 21 09 09 70 72 69 6e 74 28 22 4e 6f 20 61 70 70 6c 69 63 | .==.0.then...!..print("No.applic |
| 61e0 | 61 74 69 6f 6e 73 20 66 6f 75 6e 64 2e 22 29 00 00 00 08 09 09 72 65 74 75 72 6e 00 00 00 04 09 | ations.found.")......return..... |
| 6200 | 65 6e 64 00 00 00 00 00 00 00 35 09 2d 2d 20 4a 6f 69 6e 20 74 68 65 20 61 70 70 20 6e 61 6d 65 | end.......5.--.Join.the.app.name |
| 6220 | 73 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c 65 20 73 74 72 69 6e 67 20 66 6f 72 20 64 6d 65 6e 75 | s.into.a.single.string.for.dmenu |
| 6240 | 00 00 00 2a 09 6c 6f 63 61 6c 20 61 70 70 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 61 | ...*.local.apps.=.table.concat(a |
| 6260 | 70 70 5f 6c 69 73 74 2c 20 22 5c 6e 22 29 00 00 00 00 00 00 00 26 09 2d 2d 20 55 73 65 20 64 6d | pp_list,."\n").......&.--.Use.dm |
| 6280 | 65 6e 75 20 74 6f 20 73 65 6c 65 63 74 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 00 00 00 51 | enu.to.select.an.application...Q |
| 62a0 | 09 6c 6f 63 61 6c 20 68 61 6e 64 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 6c 65 2e 63 | .local.handle.=.io.popen(table.c |
| 62c0 | 6f 6e 63 61 74 28 64 6d 65 6e 75 5f 63 6d 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c 3c 3c 20 27 | oncat(dmenu_cmd,.".")....".<<<.' |
| 62e0 | 22 20 2e 2e 20 61 70 70 73 20 2e 2e 20 22 27 22 29 00 00 00 37 09 6c 6f 63 61 6c 20 73 65 6c 65 | "....apps...."'")...7.local.sele |
| 6300 | 63 74 65 64 5f 61 70 70 20 3d 20 68 61 6e 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 67 73 75 | cted_app.=.handle:read("*a"):gsu |
| 6320 | 62 28 22 5c 6e 24 22 2c 20 22 22 29 00 00 00 0f 09 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 29 00 | b("\n$",."").....handle:close(). |
| 6340 | 00 00 00 00 00 00 3a 09 69 66 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 61 6e | ......:.if.selected_app.~=."".an |
| 6360 | 64 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 68 65 | d.app_commands[selected_app].the |
| 6380 | 6e 00 00 00 43 09 09 2d 2d 20 45 73 63 61 70 65 20 61 6e 79 20 73 70 65 63 69 61 6c 20 63 68 61 | n...C..--.Escape.any.special.cha |
| 63a0 | 72 61 63 74 65 72 73 20 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 62 65 66 6f 72 65 20 72 75 | racters.in.the.command.before.ru |
| 63c0 | 6e 6e 69 6e 67 20 69 74 00 00 00 4e 09 09 6c 6f 63 61 6c 20 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 | nning.it...N..local.command_to_r |
| 63e0 | 75 6e 20 3d 20 65 73 63 61 70 65 5f 73 70 65 63 69 61 6c 5f 63 68 61 72 61 63 74 65 72 73 28 61 | un.=.escape_special_characters(a |
| 6400 | 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 29 00 00 00 22 09 09 | pp_commands[selected_app])...".. |
| 6420 | 2d 2d 20 52 75 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 6f 6d 6d 61 6e 64 | --.Run.the.corresponding.command |
| 6440 | 00 00 00 1c 09 09 6f 73 2e 65 78 65 63 75 74 65 28 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 75 6e 29 | ......os.execute(command_to_run) |
| 6460 | 00 00 00 04 09 65 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 11 2d 2d 20 4d 61 69 6e 20 65 | .....end....end........--.Main.e |
| 6480 | 78 65 63 75 74 69 6f 6e 00 00 00 14 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e 28 29 | xecution....launch_application() |
| 64a0 | f5 18 00 00 00 08 00 00 00 12 00 00 00 62 00 00 00 09 00 00 00 1c 09 22 23 31 65 31 65 31 65 22 | .............b........."#1e1e1e" |
| 64c0 | 2c 20 20 20 2d 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 | ,...--.normbgcolor....."-nf",... |
| 64e0 | 1c 09 22 23 63 63 63 63 63 63 22 2c 20 20 20 2d 2d 20 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 | .."#cccccc",...--.normfgcolor... |
| 6500 | 07 09 22 2d 73 62 22 2c 00 00 00 1b 09 22 23 32 34 37 32 63 38 22 2c 20 20 20 2d 2d 20 73 65 6c | .."-sb",....."#2472c8",...--.sel |
| 6520 | 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 73 66 22 2c 00 00 00 1b 09 22 23 65 35 65 35 65 35 22 | bgcolor....."-sf",....."#e5e5e5" |
| 6540 | 2c 20 20 20 2d 2d 20 73 65 6c 66 67 63 6f 6c 6f 72 00 00 00 06 09 22 2d 6c 22 2c 00 00 00 2d 09 | ,...--.selfgcolor....."-l",...-. |
| 6560 | 22 31 30 22 2c 20 20 20 20 20 20 20 20 2d 2d 20 6e 75 6d 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 | "10",........--.number.of.lines. |
| 6580 | 69 6e 20 74 68 65 20 64 6d 65 6e 75 35 81 f5 18 00 00 00 00 08 00 00 00 0c 00 00 00 08 00 00 00 | in.the.dmenu5................... |
| 65a0 | 0d 00 00 00 08 00 00 00 06 00 00 00 c1 00 00 00 00 00 00 00 92 00 00 00 00 00 00 00 83 00 00 00 | ................................ |
| 65c0 | 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 61 00 00 00 14 00 00 00 62 00 00 00 00 00 | ..................a.......b..... |
| 65e0 | 00 00 00 00 00 00 00 00 00 00 f4 09 00 00 00 00 00 00 04 0a 00 00 00 00 00 00 f5 18 00 00 00 00 | ................................ |
| 6600 | 62 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 0a 00 00 00 00 00 00 | b............................... |
| 6620 | 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 07 00 00 00 09 00 00 00 00 | ................5._............. |
| 6640 | 00 00 00 00 00 00 00 08 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 | ................................ |
| 6660 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 6680 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 66a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 66c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 66e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 6700 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 6720 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 6740 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 6760 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 6780 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 67a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 69 a1 13 45 04 01 00 00 00 00 | ......................i..E...... |
| 67c0 | 00 f5 18 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 62 00 00 00 4a 2d 2d 20 4c 75 61 20 73 63 | ..................b...J--.Lua.sc |
| 67e0 | 72 69 70 74 20 74 6f 20 6c 61 75 6e 63 68 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 75 73 69 6e | ript.to.launch.applications.usin |
| 6800 | 67 20 64 6d 65 6e 75 20 77 69 74 68 20 63 75 73 74 6f 6d 20 63 6f 6e 66 69 67 75 72 61 74 69 6f | g.dmenu.with.custom.configuratio |
| 6820 | 6e 00 00 00 00 00 00 00 1d 2d 2d 20 43 75 73 74 6f 6d 20 64 6d 65 6e 75 20 63 6f 6e 66 69 67 75 | n........--.Custom.dmenu.configu |
| 6840 | 72 61 74 69 6f 6e 00 00 00 13 6c 6f 63 61 6c 20 64 6d 65 6e 75 5f 63 6d 64 20 3d 20 7b 00 00 00 | ration....local.dmenu_cmd.=.{... |
| 6860 | 0d 09 22 64 6d 65 6e 75 5f 72 75 6e 22 2c 00 00 00 07 09 22 2d 66 6e 22 2c 00 00 00 18 09 22 46 | .."dmenu_run",....."-fn",....."F |
| 6880 | 69 72 61 20 43 6f 64 65 2d 31 30 22 2c 20 2d 2d 20 66 6f 6e 74 00 00 00 07 09 22 2d 6e 62 22 2c | ira.Code-10",.--.font....."-nb", |
| 68a0 | 00 00 00 1c 09 22 23 31 65 31 65 31 65 22 2c 20 20 20 2d 2d 20 6e 6f 72 6d 62 67 63 6f 6c 6f 72 | ....."#1e1e1e",...--.normbgcolor |
| 68c0 | 00 00 00 07 09 22 2d 6e 66 22 2c 00 00 00 1c 09 22 23 63 63 63 63 63 63 22 2c 20 20 20 2d 2d 20 | ....."-nf",....."#cccccc",...--. |
| 68e0 | 6e 6f 72 6d 66 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 73 62 22 2c 00 00 00 1b 09 22 23 32 34 37 | normfgcolor....."-sb",....."#247 |
| 6900 | 32 63 38 22 2c 20 20 20 2d 2d 20 73 65 6c 62 67 63 6f 6c 6f 72 00 00 00 07 09 22 2d 73 66 22 2c | 2c8",...--.selbgcolor....."-sf", |
| 6920 | 00 00 00 1b 09 22 23 65 35 65 35 65 35 22 2c 20 20 20 2d 2d 20 73 65 6c 66 67 63 6f 6c 6f 72 00 | ....."#e5e5e5",...--.selfgcolor. |
| 6940 | 00 00 06 09 22 2d 6c 22 2c 00 00 00 2d 09 22 31 30 22 2c 20 20 20 20 20 20 20 20 2d 2d 20 6e 75 | ...."-l",...-."10",........--.nu |
| 6960 | 6d 62 65 72 20 6f 66 20 6c 69 6e 65 73 20 69 6e 20 74 68 65 20 64 6d 65 6e 75 00 00 00 01 7d 00 | mber.of.lines.in.the.dmenu....}. |
| 6980 | 00 00 00 00 00 00 2d 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 74 68 65 20 6c 69 | ......---.Function.to.get.the.li |
| 69a0 | 73 74 20 6f 66 20 2e 64 65 73 6b 74 6f 70 20 66 69 6c 65 73 00 00 00 22 6c 6f 63 61 6c 20 66 75 | st.of..desktop.files..."local.fu |
| 69c0 | 6e 63 74 69 6f 6e 20 67 65 74 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 19 09 6c | nction.get_desktop_files().....l |
| 69e0 | 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5e 09 6c 6f 63 61 | ocal.desktop_files.=.{}...^.loca |
| 6a00 | 6c 20 64 69 72 73 20 3d 20 7b 20 6f 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 29 20 2e 2e 20 | l.dirs.=.{.os.getenv("HOME").... |
| 6a20 | 22 2f 2e 6c 6f 63 61 6c 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 2c 20 22 2f | "/.local/share/applications",."/ |
| 6a40 | 75 73 72 2f 73 68 61 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 20 7d 00 00 00 00 00 00 00 | usr/share/applications".}....... |
| 6a60 | 1e 09 66 6f 72 20 5f 2c 20 64 69 72 20 69 6e 20 69 70 61 69 72 73 28 64 69 72 73 29 20 64 6f 00 | ..for._,.dir.in.ipairs(dirs).do. |
| 6a80 | 00 00 40 09 09 6c 6f 63 61 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 22 66 69 6e | ..@..local.pfile.=.io.popen("fin |
| 6aa0 | 64 20 22 20 2e 2e 20 64 69 72 20 2e 2e 20 27 20 2d 6e 61 6d 65 20 22 2a 2e 64 65 73 6b 74 6f 70 | d."....dir....'.-name."*.desktop |
| 6ac0 | 22 27 29 00 00 00 1e 09 09 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c 65 3a 6c 69 6e 65 73 | "')......for.file.in.pfile:lines |
| 6ae0 | 28 29 20 64 6f 00 00 00 24 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 73 6b 74 6f 70 | ().do...$...table.insert(desktop |
| 6b00 | 5f 66 69 6c 65 73 2c 20 66 69 6c 65 29 00 00 00 05 09 09 65 6e 64 00 00 00 0f 09 09 70 66 69 6c | _files,.file)......end......pfil |
| 6b20 | 65 3a 63 6c 6f 73 65 28 29 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 15 09 72 65 74 75 72 6e | e:close().....end.........return |
| 6b40 | 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 50 2d 2d 20 | .desktop_files....end.......P--. |
| 6b60 | 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 70 70 6c 69 63 61 74 | Function.to.extract.the.applicat |
| 6b80 | 69 6f 6e 20 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 20 63 6f 6d 6d 61 6e 64 20 66 72 6f 6d 20 61 | ion.name.and.exec.command.from.a |
| 6ba0 | 20 64 65 73 6b 74 6f 70 20 66 69 6c 65 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 | .desktop.file....local.function. |
| 6bc0 | 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 | extract_info_from_desktop(file). |
| 6be0 | 00 00 28 09 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 | ..(.local.app_name,.exec_command |
| 6c00 | 20 3d 20 6e 69 6c 2c 20 6e 69 6c 00 00 00 00 00 00 00 1e 09 66 6f 72 20 6c 69 6e 65 20 69 6e 20 | .=.nil,.nil.........for.line.in. |
| 6c20 | 69 6f 2e 6c 69 6e 65 73 28 66 69 6c 65 29 20 64 6f 00 00 00 1e 09 09 69 66 20 6c 69 6e 65 3a 6d | io.lines(file).do......if.line:m |
| 6c40 | 61 74 63 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 19 09 09 09 61 70 70 5f 6e 61 | atch("^Name=").then.......app_na |
| 6c60 | 6d 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 22 09 09 65 6c 73 65 69 66 20 6c 69 6e | me.=.line:sub(6)..."..elseif.lin |
| 6c80 | 65 3a 6d 61 74 63 68 28 22 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 1d 09 09 09 65 78 65 | e:match("^Exec=").then.......exe |
| 6ca0 | 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 05 09 09 65 6e 64 | c_command.=.line:sub(6)......end |
| 6cc0 | 00 00 00 00 00 00 00 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 | .......#..if.app_name.and.exec_c |
| 6ce0 | 6f 6d 6d 61 6e 64 20 74 68 65 6e 00 00 00 08 09 09 09 62 72 65 61 6b 00 00 00 05 09 09 65 6e 64 | ommand.then.......break......end |
| 6d00 | 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 1e 09 72 65 74 75 72 6e 20 61 70 70 5f 6e 61 6d 65 | .....end.........return.app_name |
| 6d20 | 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 44 2d 2d 20 | ,.exec_command....end.......D--. |
| 6d40 | 46 75 6e 63 74 69 6f 6e 20 74 6f 20 65 73 63 61 70 65 20 73 70 65 63 69 61 6c 20 63 68 61 72 61 | Function.to.escape.special.chara |
| 6d60 | 63 74 65 72 73 20 28 73 70 61 63 65 73 2c 20 70 61 72 65 6e 74 68 65 73 65 73 2c 20 65 74 63 2e | cters.(spaces,.parentheses,.etc. |
| 6d80 | 29 00 00 00 31 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 65 73 63 61 70 65 5f 73 70 65 63 69 | )...1local.function.escape_speci |
| 6da0 | 61 6c 5f 63 68 61 72 61 63 74 65 72 73 28 63 6f 6d 6d 61 6e 64 29 00 00 00 36 09 2d 2d 20 45 73 | al_characters(command)...6.--.Es |
| 6dc0 | 63 61 70 65 20 73 70 61 63 65 73 20 61 6e 64 20 70 61 72 65 6e 74 68 65 73 65 73 20 66 6f 72 20 | cape.spaces.and.parentheses.for. |
| 6de0 | 70 72 6f 70 65 72 20 65 78 65 63 75 74 69 6f 6e 00 00 00 2a 09 72 65 74 75 72 6e 20 63 6f 6d 6d | proper.execution...*.return.comm |
| 6e00 | 61 6e 64 3a 67 73 75 62 28 22 28 5b 25 73 25 28 25 29 5d 29 22 2c 20 22 5c 5c 25 31 22 29 00 00 | and:gsub("([%s%(%)])",."\\%1").. |
| 6e20 | 00 03 65 6e 64 00 00 00 00 00 00 00 2e 2d 2d 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 72 75 6e 20 | ..end........--.Function.to.run. |
| 6e40 | 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 75 73 69 6e 67 20 64 6d 65 6e 75 00 00 00 23 6c | the.application.using.dmenu...#l |
| 6e60 | 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e | ocal.function.launch_application |
| 6e80 | 28 29 00 00 00 2a 09 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 67 65 74 | ()...*.local.desktop_files.=.get |
| 6ea0 | 5f 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 28 29 00 00 00 14 09 6c 6f 63 61 6c 20 61 70 70 5f 6c | _desktop_files().....local.app_l |
| 6ec0 | 69 73 74 20 3d 20 7b 7d 00 00 00 18 09 6c 6f 63 61 6c 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 20 | ist.=.{}.....local.app_commands. |
| 6ee0 | 3d 20 7b 7d 00 00 00 00 00 00 00 21 09 2d 2d 20 47 61 74 68 65 72 20 61 70 70 20 6e 61 6d 65 73 | =.{}.......!.--.Gather.app.names |
| 6f00 | 20 61 6e 64 20 63 6f 6d 6d 61 6e 64 73 00 00 00 28 09 66 6f 72 20 5f 2c 20 66 69 6c 65 20 69 6e | .and.commands...(.for._,.file.in |
| 6f20 | 20 69 70 61 69 72 73 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 00 40 09 09 6c | .ipairs(desktop_files).do...@..l |
| 6f40 | 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 65 78 | ocal.app_name,.exec_command.=.ex |
| 6f60 | 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 00 00 | tract_info_from_desktop(file)... |
| 6f80 | 23 09 09 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 | #..if.app_name.and.exec_command. |
| 6fa0 | 74 68 65 6e 00 00 00 23 09 09 09 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 61 70 70 5f 6c 69 73 74 | then...#...table.insert(app_list |
| 6fc0 | 2c 20 61 70 70 5f 6e 61 6d 65 29 00 00 00 28 09 09 09 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 61 | ,.app_name)...(...app_commands[a |
| 6fe0 | 70 70 5f 6e 61 6d 65 5d 20 3d 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 05 09 09 65 6e 64 | pp_name].=.exec_command......end |
| 7000 | 00 00 00 04 09 65 6e 64 00 00 00 00 00 00 00 17 09 69 66 20 23 61 70 70 5f 6c 69 73 74 20 3d 3d | .....end.........if.#app_list.== |
| 7020 | 20 30 20 74 68 65 6e 00 00 00 21 09 09 70 72 69 6e 74 28 22 4e 6f 20 61 70 70 6c 69 63 61 74 69 | .0.then...!..print("No.applicati |
| 7040 | 6f 6e 73 20 66 6f 75 6e 64 2e 22 29 00 00 00 08 09 09 72 65 74 75 72 6e 00 00 00 04 09 65 6e 64 | ons.found.")......return.....end |
| 7060 | 00 00 00 00 00 00 00 35 09 2d 2d 20 4a 6f 69 6e 20 74 68 65 20 61 70 70 20 6e 61 6d 65 73 20 69 | .......5.--.Join.the.app.names.i |
| 7080 | 6e 74 6f 20 61 20 73 69 6e 67 6c 65 20 73 74 72 69 6e 67 20 66 6f 72 20 64 6d 65 6e 75 00 00 00 | nto.a.single.string.for.dmenu... |
| 70a0 | 2a 09 6c 6f 63 61 6c 20 61 70 70 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 61 70 70 5f | *.local.apps.=.table.concat(app_ |
| 70c0 | 6c 69 73 74 2c 20 22 5c 6e 22 29 00 00 00 00 00 00 00 26 09 2d 2d 20 55 73 65 20 64 6d 65 6e 75 | list,."\n").......&.--.Use.dmenu |
| 70e0 | 20 74 6f 20 73 65 6c 65 63 74 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 00 00 00 51 09 6c 6f | .to.select.an.application...Q.lo |
| 7100 | 63 61 6c 20 68 61 6e 64 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 74 61 62 6c 65 2e 63 6f 6e 63 | cal.handle.=.io.popen(table.conc |
| 7120 | 61 74 28 64 6d 65 6e 75 5f 63 6d 64 2c 20 22 20 22 29 20 2e 2e 20 22 20 3c 3c 3c 20 27 22 20 2e | at(dmenu_cmd,.".")....".<<<.'".. |
| 7140 | 2e 20 61 70 70 73 20 2e 2e 20 22 27 22 29 00 00 00 37 09 6c 6f 63 61 6c 20 73 65 6c 65 63 74 65 | ..apps...."'")...7.local.selecte |
| 7160 | 64 5f 61 70 70 20 3d 20 68 61 6e 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 67 73 75 62 28 22 | d_app.=.handle:read("*a"):gsub(" |
| 7180 | 5c 6e 24 22 2c 20 22 22 29 00 00 00 0f 09 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 00 | \n$",."").....handle:close().... |
| 71a0 | 00 00 00 3a 09 69 66 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 61 6e 64 20 61 | ...:.if.selected_app.~=."".and.a |
| 71c0 | 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 68 65 6e 00 00 | pp_commands[selected_app].then.. |
| 71e0 | 00 43 09 09 2d 2d 20 45 73 63 61 70 65 20 61 6e 79 20 73 70 65 63 69 61 6c 20 63 68 61 72 61 63 | .C..--.Escape.any.special.charac |
| 7200 | 74 65 72 73 20 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 62 65 66 6f 72 65 20 72 75 6e 6e 69 | ters.in.the.command.before.runni |
| 7220 | 6e 67 20 69 74 00 00 00 4e 09 09 6c 6f 63 61 6c 20 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 75 6e 20 | ng.it...N..local.command_to_run. |
| 7240 | 3d 20 65 73 63 61 70 65 5f 73 70 65 63 69 61 6c 5f 63 68 61 72 61 63 74 65 72 73 28 61 70 70 5f | =.escape_special_characters(app_ |
| 7260 | 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 5d 29 00 00 00 22 09 09 2d 2d 20 | commands[selected_app])..."..--. |
| 7280 | 52 75 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 6f 6d 6d 61 6e 64 00 00 00 | Run.the.corresponding.command... |
| 72a0 | 1c 09 09 6f 73 2e 65 78 65 63 75 74 65 28 63 6f 6d 6d 61 6e 64 5f 74 6f 5f 72 75 6e 29 00 00 00 | ...os.execute(command_to_run)... |
| 72c0 | 04 09 65 6e 64 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 11 2d 2d 20 4d 61 69 6e 20 65 78 65 63 | ..end....end........--.Main.exec |
| 72e0 | 75 74 69 6f 6e 00 00 00 14 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e 28 29 35 81 f5 | ution....launch_application()5.. |
| 7300 | 18 00 00 00 00 00 00 00 00 00 00 00 00 62 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 | .............b.................. |
| 7320 | 00 00 00 00 00 04 0a 00 00 00 00 00 00 01 00 00 00 00 00 00 00 35 81 5f d0 00 00 00 08 00 00 00 | .....................5._........ |
| 7340 | 0a 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 01 00 00 00 00 00 00 00 00 ff ff ff ff 00 03 00 | ................................ |
| 7360 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7380 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 73a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 73c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 73e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7400 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7420 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7440 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7460 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7480 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 74a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 69 a1 13 46 04 | ...........................i..F. |
| 74c0 | 01 00 00 00 00 00 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 f5 18 00 00 | ................................ |
| 74e0 | 00 01 00 00 00 00 00 00 00 00 00 00 00 00 35 81 f5 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ..............5................. |
| 7500 | 00 00 00 00 00 00 46 00 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 75 09 | ......F.......................u. |
| 7520 | 00 00 00 00 00 00 35 81 5f d0 00 00 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 | ......5._....................... |
| 7540 | 00 47 00 00 00 13 00 00 00 00 ff ff ff ff 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .G.............................. |
| 7560 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7580 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 75a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 75c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 75e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7600 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7620 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7640 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7660 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 7680 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 76a0 | 00 00 00 00 00 00 00 00 00 00 00 00 69 a1 13 47 04 01 00 00 00 07 00 f5 18 00 00 00 03 00 00 00 | ............i..G................ |
| 76c0 | 4b 00 00 00 47 00 00 00 41 00 00 00 1c 20 20 20 20 6c 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 | K...G...A........local.desktop_f |
| 76e0 | 69 6c 65 73 20 3d 20 7b 7d 00 00 00 5f 20 20 20 20 6c 6f 63 61 6c 20 64 69 72 73 20 3d 20 7b 6f | iles.=.{}..._....local.dirs.=.{o |
| 7700 | 73 2e 67 65 74 65 6e 76 28 22 48 4f 4d 45 22 29 20 2e 2e 20 22 2f 2e 6c 6f 63 61 6c 2f 73 68 61 | s.getenv("HOME")...."/.local/sha |
| 7720 | 72 65 2f 61 70 70 6c 69 63 61 74 69 6f 6e 73 22 2c 20 22 2f 75 73 72 2f 73 68 61 72 65 2f 61 70 | re/applications",."/usr/share/ap |
| 7740 | 70 6c 69 63 61 74 69 6f 6e 73 22 7d 00 00 00 21 20 20 20 20 66 6f 72 20 5f 2c 20 64 69 72 20 69 | plications"}...!....for._,.dir.i |
| 7760 | 6e 20 69 70 61 69 72 73 28 64 69 72 73 29 20 64 6f 00 00 00 52 20 20 20 20 20 20 20 20 6c 6f 63 | n.ipairs(dirs).do...R........loc |
| 7780 | 61 6c 20 70 66 69 6c 65 20 3d 20 69 6f 2e 70 6f 70 65 6e 28 22 66 69 6e 64 20 22 20 2e 2e 20 64 | al.pfile.=.io.popen("find."....d |
| 77a0 | 69 72 20 2e 2e 20 22 20 2d 6e 61 6d 65 20 27 2a 2e 64 65 73 6b 74 6f 70 27 20 32 3e 2f 64 65 76 | ir....".-name.'*.desktop'.2>/dev |
| 77c0 | 2f 6e 75 6c 6c 22 29 00 00 00 15 20 20 20 20 20 20 20 20 69 66 20 70 66 69 6c 65 20 74 68 65 6e | /null")............if.pfile.then |
| 77e0 | 00 00 00 28 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 20 66 69 6c 65 20 69 6e 20 70 66 69 6c | ...(............for.file.in.pfil |
| 7800 | 65 3a 6c 69 6e 65 73 28 29 20 64 6f 00 00 00 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e:lines().do...1................ |
| 7820 | 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 2c 20 66 69 6c 65 | table.insert(desktop_files,.file |
| 7840 | 29 00 00 00 0f 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 19 20 20 20 20 20 20 20 20 | )................end............ |
| 7860 | 20 20 20 20 70 66 69 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 | ....pfile:close()............end |
| 7880 | 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 18 20 20 20 20 72 65 74 75 72 6e 20 64 65 73 6b 74 6f | ........end........return.deskto |
| 78a0 | 70 5f 66 69 6c 65 73 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 2e 6c 6f 63 61 6c 20 66 75 6e 63 | p_files....end........local.func |
| 78c0 | 74 69 6f 6e 20 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 | tion.extract_info_from_desktop(f |
| 78e0 | 69 6c 65 29 00 00 00 20 20 20 20 20 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 | ile)........local.app_name,.exec |
| 7900 | 5f 63 6f 6d 6d 61 6e 64 00 00 00 2b 20 20 20 20 6c 6f 63 61 6c 20 6f 6b 2c 20 6c 69 6e 65 73 20 | _command...+....local.ok,.lines. |
| 7920 | 3d 20 70 63 61 6c 6c 28 69 6f 2e 6c 69 6e 65 73 2c 20 66 69 6c 65 29 00 00 00 26 20 20 20 20 69 | =.pcall(io.lines,.file)...&....i |
| 7940 | 66 20 6e 6f 74 20 6f 6b 20 74 68 65 6e 20 72 65 74 75 72 6e 20 6e 69 6c 2c 20 6e 69 6c 20 65 6e | f.not.ok.then.return.nil,.nil.en |
| 7960 | 64 00 00 00 18 20 20 20 20 66 6f 72 20 6c 69 6e 65 20 69 6e 20 6c 69 6e 65 73 20 64 6f 00 00 00 | d........for.line.in.lines.do... |
| 7980 | 35 20 20 20 20 20 20 20 20 69 66 20 6e 6f 74 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 6c 69 6e | 5........if.not.app_name.and.lin |
| 79a0 | 65 3a 6d 61 74 63 68 28 22 5e 4e 61 6d 65 3d 22 29 20 74 68 65 6e 00 00 00 22 20 20 20 20 20 20 | e:match("^Name=").then..."...... |
| 79c0 | 20 20 20 20 20 20 61 70 70 5f 6e 61 6d 65 20 3d 20 6c 69 6e 65 3a 73 75 62 28 36 29 00 00 00 3d | ......app_name.=.line:sub(6)...= |
| 79e0 | 20 20 20 20 20 20 20 20 65 6c 73 65 69 66 20 6e 6f 74 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 | ........elseif.not.exec_command. |
| 7a00 | 61 6e 64 20 6c 69 6e 65 3a 6d 61 74 63 68 28 22 5e 45 78 65 63 3d 22 29 20 74 68 65 6e 00 00 00 | and.line:match("^Exec=").then... |
| 7a20 | 69 20 20 20 20 20 20 20 20 20 20 20 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 6c 69 6e 65 | i............exec_command.=.line |
| 7a40 | 3a 73 75 62 28 36 29 3a 67 73 75 62 28 22 25 73 2a 25 25 5b 66 46 75 55 64 44 6e 4e 69 63 6b 76 | :sub(6):gsub("%s*%%[fFuUdDnNickv |
| 7a60 | 6d 5d 22 2c 20 22 22 29 3a 67 73 75 62 28 22 5e 25 73 2b 22 2c 20 22 22 29 3a 67 73 75 62 28 22 | m]",.""):gsub("^%s+",.""):gsub(" |
| 7a80 | 25 73 2b 24 22 2c 20 22 22 29 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 33 20 20 20 | %s+$",."")............end...3... |
| 7aa0 | 20 20 20 20 20 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f 63 6f 6d 6d 61 6e | .....if.app_name.and.exec_comman |
| 7ac0 | 64 20 74 68 65 6e 20 62 72 65 61 6b 20 65 6e 64 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 21 20 | d.then.break.end........end...!. |
| 7ae0 | 20 20 20 72 65 74 75 72 6e 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 | ...return.app_name,.exec_command |
| 7b00 | 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 32 6c 6f 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 69 73 | ....end.......2local.function.is |
| 7b20 | 5f 76 61 6c 69 64 5f 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 28 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 | _valid_exec_command(exec_command |
| 7b40 | 29 00 00 00 52 20 20 20 20 66 6f 72 20 5f 2c 20 69 6e 76 61 6c 69 64 20 69 6e 20 69 70 61 69 72 | )...R....for._,.invalid.in.ipair |
| 7b60 | 73 28 7b 22 77 69 6e 65 22 2c 20 22 77 73 63 72 69 70 74 22 2c 20 22 72 75 6e 64 6c 6c 33 32 22 | s({"wine",."wscript",."rundll32" |
| 7b80 | 2c 20 22 77 69 6e 68 6c 70 33 32 22 2c 20 22 68 68 22 7d 29 20 64 6f 00 00 00 33 20 20 20 20 20 | ,."winhlp32",."hh"}).do...3..... |
| 7ba0 | 20 20 20 69 66 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 3a 6c 6f 77 65 72 28 29 3a 6d 61 74 63 68 | ...if.exec_command:lower():match |
| 7bc0 | 28 69 6e 76 61 6c 69 64 29 20 74 68 65 6e 00 00 00 18 20 20 20 20 20 20 20 20 20 20 20 20 72 65 | (invalid).then................re |
| 7be0 | 74 75 72 6e 20 66 61 6c 73 65 00 00 00 0b 20 20 20 20 20 20 20 20 65 6e 64 00 00 00 07 20 20 20 | turn.false............end....... |
| 7c00 | 20 65 6e 64 00 00 00 1d 20 20 20 20 72 65 74 75 72 6e 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 | .end........return.exec_command. |
| 7c20 | 7e 3d 20 22 22 00 00 00 03 65 6e 64 00 00 00 00 00 00 00 23 6c 6f 63 61 6c 20 66 75 6e 63 74 69 | ~=.""....end.......#local.functi |
| 7c40 | 6f 6e 20 6c 61 75 6e 63 68 5f 61 70 70 6c 69 63 61 74 69 6f 6e 28 29 00 00 00 2d 20 20 20 20 6c | on.launch_application()...-....l |
| 7c60 | 6f 63 61 6c 20 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 20 3d 20 67 65 74 5f 64 65 73 6b 74 6f 70 | ocal.desktop_files.=.get_desktop |
| 7c80 | 5f 66 69 6c 65 73 28 29 00 00 00 17 20 20 20 20 6c 6f 63 61 6c 20 61 70 70 5f 6c 69 73 74 20 3d | _files()........local.app_list.= |
| 7ca0 | 20 7b 7d 00 00 00 1b 20 20 20 20 6c 6f 63 61 6c 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 20 3d 20 | .{}........local.app_commands.=. |
| 7cc0 | 7b 7d 00 00 00 00 00 00 00 2b 20 20 20 20 66 6f 72 20 5f 2c 20 66 69 6c 65 20 69 6e 20 69 70 61 | {}.......+....for._,.file.in.ipa |
| 7ce0 | 69 72 73 28 64 65 73 6b 74 6f 70 5f 66 69 6c 65 73 29 20 64 6f 00 00 00 46 20 20 20 20 20 20 20 | irs(desktop_files).do...F....... |
| 7d00 | 20 6c 6f 63 61 6c 20 61 70 70 5f 6e 61 6d 65 2c 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 20 3d 20 | .local.app_name,.exec_command.=. |
| 7d20 | 65 78 74 72 61 63 74 5f 69 6e 66 6f 5f 66 72 6f 6d 5f 64 65 73 6b 74 6f 70 28 66 69 6c 65 29 00 | extract_info_from_desktop(file). |
| 7d40 | 00 00 70 20 20 20 20 20 20 20 20 69 66 20 61 70 70 5f 6e 61 6d 65 20 61 6e 64 20 65 78 65 63 5f | ..p........if.app_name.and.exec_ |
| 7d60 | 63 6f 6d 6d 61 6e 64 20 61 6e 64 20 69 73 5f 76 61 6c 69 64 5f 65 78 65 63 5f 63 6f 6d 6d 61 6e | command.and.is_valid_exec_comman |
| 7d80 | 64 28 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 29 20 61 6e 64 20 6e 6f 74 20 61 70 70 5f 63 6f 6d 6d | d(exec_command).and.not.app_comm |
| 7da0 | 61 6e 64 73 5b 61 70 70 5f 6e 61 6d 65 5d 20 74 68 65 6e 00 00 00 2c 20 20 20 20 20 20 20 20 20 | ands[app_name].then...,......... |
| 7dc0 | 20 20 20 74 61 62 6c 65 2e 69 6e 73 65 72 74 28 61 70 70 5f 6c 69 73 74 2c 20 61 70 70 5f 6e 61 | ...table.insert(app_list,.app_na |
| 7de0 | 6d 65 29 00 00 00 31 20 20 20 20 20 20 20 20 20 20 20 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b | me)...1............app_commands[ |
| 7e00 | 61 70 70 5f 6e 61 6d 65 5d 20 3d 20 65 78 65 63 5f 63 6f 6d 6d 61 6e 64 00 00 00 0b 20 20 20 20 | app_name].=.exec_command........ |
| 7e20 | 20 20 20 20 65 6e 64 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 00 00 00 00 1a 20 20 20 20 69 66 | ....end........end............if |
| 7e40 | 20 23 61 70 70 5f 6c 69 73 74 20 3d 3d 20 30 20 74 68 65 6e 00 00 00 39 20 20 20 20 20 20 20 20 | .#app_list.==.0.then...9........ |
| 7e60 | 69 6f 2e 73 74 64 65 72 72 3a 77 72 69 74 65 28 22 4e 6f 20 76 61 6c 69 64 20 61 70 70 6c 69 63 | io.stderr:write("No.valid.applic |
| 7e80 | 61 74 69 6f 6e 73 20 66 6f 75 6e 64 2e 5c 6e 22 29 00 00 00 0e 20 20 20 20 20 20 20 20 72 65 74 | ations.found.\n")............ret |
| 7ea0 | 75 72 6e 00 00 00 07 20 20 20 20 65 6e 64 00 00 00 00 00 00 00 2d 20 20 20 20 6c 6f 63 61 6c 20 | urn........end.......-....local. |
| 7ec0 | 61 70 70 73 20 3d 20 74 61 62 6c 65 2e 63 6f 6e 63 61 74 28 61 70 70 5f 6c 69 73 74 2c 20 22 5c | apps.=.table.concat(app_list,."\ |
| 7ee0 | 6e 22 29 00 00 00 57 20 20 20 20 6c 6f 63 61 6c 20 68 61 6e 64 6c 65 20 3d 20 69 6f 2e 70 6f 70 | n")...W....local.handle.=.io.pop |
| 7f00 | 65 6e 28 22 65 63 68 6f 20 22 20 2e 2e 20 73 74 72 69 6e 67 2e 66 6f 72 6d 61 74 28 22 25 71 22 | en("echo."....string.format("%q" |
| 7f20 | 2c 20 61 70 70 73 29 20 2e 2e 20 22 20 7c 20 22 20 2e 2e 20 64 6d 65 6e 75 5f 63 6d 64 29 00 00 | ,.apps)....".|."....dmenu_cmd).. |
| 7f40 | 00 21 20 20 20 20 69 66 20 6e 6f 74 20 68 61 6e 64 6c 65 20 74 68 65 6e 20 72 65 74 75 72 6e 20 | .!....if.not.handle.then.return. |
| 7f60 | 65 6e 64 00 00 00 3d 20 20 20 20 6c 6f 63 61 6c 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 3d 20 | end...=....local.selected_app.=. |
| 7f80 | 68 61 6e 64 6c 65 3a 72 65 61 64 28 22 2a 61 22 29 3a 6d 61 74 63 68 28 22 5e 28 2e 2d 29 25 73 | handle:read("*a"):match("^(.-)%s |
| 7fa0 | 2a 24 22 29 00 00 00 12 20 20 20 20 68 61 6e 64 6c 65 3a 63 6c 6f 73 65 28 29 00 00 00 00 00 00 | *$")........handle:close()...... |
| 7fc0 | 00 4e 20 20 20 20 69 66 20 73 65 6c 65 63 74 65 64 5f 61 70 70 20 61 6e 64 20 73 65 6c 65 63 74 | .N....if.selected_app.and.select |
| 7fe0 | 65 64 5f 61 70 70 20 7e 3d 20 22 22 20 61 6e 64 20 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 | ed_app.~=."".and.app_commands[se |
| 8000 | 6c 65 63 74 65 64 5f 61 70 70 5d 20 74 68 65 6e 00 00 00 36 20 20 20 20 20 20 20 20 6f 73 2e 65 | lected_app].then...6........os.e |
| 8020 | 78 65 63 75 74 65 28 61 70 70 5f 63 6f 6d 6d 61 6e 64 73 5b 73 65 6c 65 63 74 65 64 5f 61 70 70 | xecute(app_commands[selected_app |
| 8040 | 5d 20 2e 2e 20 22 20 26 22 29 00 00 00 07 20 20 20 20 65 6e 64 35 81 f5 18 00 00 00 00 03 00 00 | ]....".&")........end5.......... |
| 8060 | 00 00 00 00 00 40 00 00 00 04 00 00 00 46 00 00 00 01 00 00 00 93 00 00 00 00 00 00 00 c5 08 00 | .....@.......F.................. |
| 8080 | 00 00 00 00 00 d2 07 00 00 00 00 00 00 35 81 e7 aa | .............5... |