Skip to content
Luca CPZ edited this page Oct 7, 2017 · 4 revisions

Freedesktop.org-compliant desktop icons.

freedesktop.desktop.add_icons(args)

Usage

First, define an icon_theme variable string in your theme.lua, for instance:

theme.icon_theme = "Adwaita"

Then, add the following to your rc.lua:

for s in screen do
    freedesktop.desktop.add_icons({screen = s})
end

the input argument is a table which can contain the following variables, all optional:

Variable Meaning Type Default
screen Screen where to show icons int mouse.screen
dir Directory to lookup string "~/Desktop"
showlabels Define whether to show labels or not booblean true
open_with Define file manager to use string "xdg_open"
baseicons Base icons to show table see default base icons
iconsize Icons size table see default icons size
labelsize Labels size table see default labels size
margin Margin between icons table see default margin size

Default tables

Base icons

baseicons = {
    [1] = {
        label = "This PC",
        icon  = "computer",
        onclick = "computer://"
    },
    [2] = {
       label = "Home",
       icon  = "user-home",
       onclick = os.getenv("HOME")
    },
    [3] = {
       label = "Trash",
       icon  = "user-trash",
       onclick = "trash://"
    }
}

You can redefine baseicons using the same style (index array), in order to preserve the entries order.

For every entry, label is the label, icon is the icon name (alternatively, you can use an absolute path), and onclick is the argument for args.open_with. All three are strings.

Icons size

iconsize = { width = 48, height = 48 }

Labels size

labelsize = { width = 140, height = 20 }

Margin

margin = { x = 20, y = 20 }
Clone this wiki locally