don't show same app twice in saturn
This commit is contained in:
parent
5e423fb8fd
commit
24ff1ab62d
@ -29,7 +29,7 @@
|
|||||||
vals))
|
vals))
|
||||||
|
|
||||||
(fn all-apps []
|
(fn all-apps []
|
||||||
(var apps-table [])
|
(var apps-table {})
|
||||||
;; for i in ${XDG_DATA_DIRS//:/ /} ; do ls $i/applications/*.desktop ;done
|
;; for i in ${XDG_DATA_DIRS//:/ /} ; do ls $i/applications/*.desktop ;done
|
||||||
(each [path (string.gmatch (os.getenv "XDG_DATA_DIRS") "[^:]*")]
|
(each [path (string.gmatch (os.getenv "XDG_DATA_DIRS") "[^:]*")]
|
||||||
(let [apps (.. path "/applications/")]
|
(let [apps (.. path "/applications/")]
|
||||||
@ -38,7 +38,7 @@
|
|||||||
(when (= (f:sub -8) ".desktop")
|
(when (= (f:sub -8) ".desktop")
|
||||||
(let [attrs (read-desktop-file (.. apps f))]
|
(let [attrs (read-desktop-file (.. apps f))]
|
||||||
(when (not attrs.NoDisplay)
|
(when (not attrs.NoDisplay)
|
||||||
(table.insert apps-table attrs))))))))
|
(tset apps-table attrs.Name attrs))))))))
|
||||||
apps-table)
|
apps-table)
|
||||||
|
|
||||||
;; Exec entries in desktop files may contain %u %f and other characters
|
;; Exec entries in desktop files may contain %u %f and other characters
|
||||||
@ -74,19 +74,21 @@
|
|||||||
(: :set_image app.IconImage)))
|
(: :set_image app.IconImage)))
|
||||||
|
|
||||||
(let [grid (Gtk.Grid {
|
(let [grid (Gtk.Grid {
|
||||||
; :orientation "vertical"
|
:column_spacing 5
|
||||||
:column_spacing 8
|
:row_spacing 5
|
||||||
:row_spacing 8
|
|
||||||
})
|
})
|
||||||
scrolled-window (Gtk.ScrolledWindow {})
|
scrolled-window (Gtk.ScrolledWindow {})
|
||||||
window (Gtk.Window {
|
window (Gtk.Window {
|
||||||
:title "Saturn V"
|
:title "Saturn V"
|
||||||
:default_width 720
|
:default_width 720
|
||||||
:default_height 800
|
:default_height 800
|
||||||
|
:on_destroy Gtk.main_quit
|
||||||
})]
|
})]
|
||||||
(each [i app (ipairs (all-apps))]
|
(var i 0)
|
||||||
(let [x (% (- i 1) 8)
|
(each [_ app (pairs (all-apps))]
|
||||||
y (// (- i 1) 8)]
|
(let [x (% i 4)
|
||||||
|
y (// i 4)]
|
||||||
|
(set i (+ i 1))
|
||||||
(grid:attach (button-for app) x y 1 1)))
|
(grid:attach (button-for app) x y 1 1)))
|
||||||
(scrolled-window:add grid)
|
(scrolled-window:add grid)
|
||||||
(window:add scrolled-window)
|
(window:add scrolled-window)
|
||||||
|
Loading…
Reference in New Issue
Block a user