From 87793a390426c186e80d628c77fb118b39e55792 Mon Sep 17 00:00:00 2001 From: luke bonham Date: Sun, 18 Aug 2013 23:26:03 +0200 Subject: [PATCH] freedesktop: little improvements --- freedesktop/desktop.lua | 1 - freedesktop/freedesktop.lua | 12 ++++++------ freedesktop/menu.lua | 22 +++++++++++----------- freedesktop/utils.lua | 19 ++++++++++++++++--- themes/holo/icons/bg_focus_noline.png | Bin 396 -> 1175 bytes themes/rainbow/icons/awesome_icon.png | Bin 0 -> 188 bytes themes/rainbow/icons/square_sel2.png | Bin 0 -> 139 bytes themes/rainbow/theme.lua | 21 ++++++++++++++++++--- 8 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 themes/rainbow/icons/awesome_icon.png create mode 100644 themes/rainbow/icons/square_sel2.png diff --git a/freedesktop/desktop.lua b/freedesktop/desktop.lua index 6209ae3..53ab0ed 100644 --- a/freedesktop/desktop.lua +++ b/freedesktop/desktop.lua @@ -1,4 +1,3 @@ -local wibox = wibox local widget = widget local screen = screen local image = image diff --git a/freedesktop/freedesktop.lua b/freedesktop/freedesktop.lua index 04236b6..ad7c677 100644 --- a/freedesktop/freedesktop.lua +++ b/freedesktop/freedesktop.lua @@ -12,8 +12,8 @@ require('freedesktop.desktop') require('freedesktop.menu') -- require("debian.menu") -freedesktop.utils.terminal = terminal -freedesktop.utils.icon_theme = 'gnome' -- look inside /usr/share/icons/, default: nil (don't use icon theme) +freedesktop.utils.terminal = terminal -- defined in rc.lua, otherwise define it here (default: "xterm") +freedesktop.utils.icon_theme = 'gnome' -- choose your favourite from /usr/share/icons/ (default: nil) menu_items = freedesktop.menu.new() @@ -25,14 +25,14 @@ myawesomemenu = { } for s = 1, screen.count() do - freedesktop.desktop.add_applications_icons({screen = s, showlabels = true}) - freedesktop.desktop.add_dirs_and_files_icons({screen = s, showlabels = true}) + --freedesktop.desktop.add_application_icons({screen = s, showlabels = true}) + --freedesktop.desktop.add_dirs_and_file_icons({screen = s, showlabels = true}) + freedesktop.desktop.add_desktop_icons({screen = s, showlabels = true}) end table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon }) table.insert(menu_items, { "open terminal", terminal, freedesktop.utils.lookup_icon({icon = 'terminal'}) }) -- table.insert(menu_items, { "Debian", debian.menu.Debian_menu.Debian, freedesktop.utils.lookup_icon({ icon = 'debian-logo' }) }) -mymainmenu = awful.menu.new({ items = menu_items, width = 200 }) - +mymainmenu = awful.menu.new({ items = menu_items, theme = { width = 150 } }) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) diff --git a/freedesktop/menu.lua b/freedesktop/menu.lua index a465661..8595961 100644 --- a/freedesktop/menu.lua +++ b/freedesktop/menu.lua @@ -71,17 +71,17 @@ function new(arg) end local menu = { - { "Accessories", programs["Utility"], utils.lookup_icon({ icon = 'applications-accessories.png' }) }, - { "Development", programs["Development"], utils.lookup_icon({ icon = 'applications-development.png' }) }, - { "Education", programs["Education"], utils.lookup_icon({ icon = 'applications-science.png' }) }, - { "Games", programs["Game"], utils.lookup_icon({ icon = 'applications-games.png' }) }, - { "Graphics", programs["Graphics"], utils.lookup_icon({ icon = 'applications-graphics.png' }) }, - { "Internet", programs["Network"], utils.lookup_icon({ icon = 'applications-internet.png' }) }, - { "Multimedia", programs["AudioVideo"], utils.lookup_icon({ icon = 'applications-multimedia.png' }) }, - { "Office", programs["Office"], utils.lookup_icon({ icon = 'applications-office.png' }) }, - { "Other", programs["Other"], utils.lookup_icon({ icon = 'applications-other.png' }) }, - { "Settings", programs["Settings"], utils.lookup_icon({ icon = 'preferences-desktop.png' }) }, - { "System Tools", programs["System"], utils.lookup_icon({ icon = 'applications-system.png' }) }, + { "Accessories", programs["Utility"], utils.lookup_icon({ icon = 'applications-accessories' }) }, + { "Development", programs["Development"], utils.lookup_icon({ icon = 'applications-development' }) }, + { "Education", programs["Education"], utils.lookup_icon({ icon = 'applications-science' }) }, + { "Games", programs["Game"], utils.lookup_icon({ icon = 'applications-games' }) }, + { "Graphics", programs["Graphics"], utils.lookup_icon({ icon = 'applications-graphics' }) }, + { "Internet", programs["Network"], utils.lookup_icon({ icon = 'applications-internet' }) }, + { "Multimedia", programs["AudioVideo"], utils.lookup_icon({ icon = 'applications-multimedia' }) }, + { "Office", programs["Office"], utils.lookup_icon({ icon = 'applications-office' }) }, + { "Other", programs["Other"], utils.lookup_icon({ icon = 'applications-other' }) }, + { "Settings", programs["Settings"], utils.lookup_icon({ icon = 'preferences-desktop' }) }, + { "System Tools", programs["System"], utils.lookup_icon({ icon = 'applications-system' }) }, } -- Removing empty entries from menu diff --git a/freedesktop/utils.lua b/freedesktop/utils.lua index c5247c3..b20edc2 100644 --- a/freedesktop/utils.lua +++ b/freedesktop/utils.lua @@ -6,12 +6,15 @@ local table = table local type = type local ipairs = ipairs local pairs = pairs +local lgi = require('lgi') +local Gtk = lgi.Gtk module("freedesktop.utils") terminal = 'xterm' icon_theme = nil +local gtk_icon_theme = Gtk.IconTheme.get_default() all_icon_sizes = { '128x128', @@ -23,7 +26,9 @@ all_icon_sizes = { '32x32', '24x24', '22x22', - '16x16' + '16x16', + '8x8', + 'scalable' } all_icon_types = { 'apps', @@ -59,10 +64,16 @@ function file_exists(filename) end function lookup_icon(arg) - if arg.icon:sub(1, 1) == '/' and (arg.icon:find('.+%.png') or arg.icon:find('.+%.xpm')) then + if arg.icon:sub(1, 1) == '/' and (arg.icon:find('.+%.png') or arg.icon:find('.+%.xpm') or arg.icon:find('.+%.svg')) then -- icons with absolute path and supported (AFAICT) formats return arg.icon else + local gtk_icon_info = Gtk.IconTheme.lookup_icon(gtk_icon_theme, arg.icon, 48, 0) + if gtk_icon_info then + filename = Gtk.IconInfo.get_filename(gtk_icon_info) + if filename then return filename end + end + local icon_path = {} local icon_themes = {} local icon_theme_paths = {} @@ -97,12 +108,14 @@ function lookup_icon(arg) table.insert(icon_path, '/usr/share/app-install/icons/') for i, directory in ipairs(icon_path) do - if (arg.icon:find('.+%.png') or arg.icon:find('.+%.xpm')) and file_exists(directory .. arg.icon) then + if (arg.icon:find('.+%.png') or arg.icon:find('.+%.xpm') or arg.icon:find('.+%.svg')) and file_exists(directory .. arg.icon) then return directory .. arg.icon elseif file_exists(directory .. arg.icon .. '.png') then return directory .. arg.icon .. '.png' elseif file_exists(directory .. arg.icon .. '.xpm') then return directory .. arg.icon .. '.xpm' + elseif file_exists(directory .. arg.icon .. '.svg') then + return directory .. arg.icon .. '.svg' end end end diff --git a/themes/holo/icons/bg_focus_noline.png b/themes/holo/icons/bg_focus_noline.png index 5a43e8f20d32ae36788a0dbc85abfa1abbffeb1a..3126d98e2d78868294b589ae905d236ab9e8058d 100644 GIT binary patch literal 1175 zcmeAS@N?(olHy`uVBq!ia0y~yU~d4j6*$;{i(P=vF< zBeIx*fm;}a85w5HkpK#^mw5WRvft$p;xW)$G;i}A1_l-tPZ!6Kid%2*L%-wgcO2;@@U*s~@;Bx4QY+94)Sn_^NGIfd_ZI{|z(=1P+`x&t!ry8|-c{ zfSdyaFIspLzzl{4KZM|sAHRO>%7!Xwn14Q=ff=HxP(>+bBX zb<=$M@ZuctS~+iSOnYgpf9<7h zxqHN(yUsuQcX8~Zn%ud?zvJf?=gT}Z>qy^TJN5OCyC03te-2z1bZUdn>5p&9?o0`4 zi+X)=+E2;cJ3VHn9;eP)w(y#j&*hSuqqes<-ngdN-@W?h0wJA3J-O!_{#b630A=J)?8-%oHqZT;j_ zxo}TFoQD1s@l)LYXPbV1`t+&D?A!14_4SXx2L{=W@1ZvR*Ok^Cd4JI^_fN;;!m~E# zdy}feX+aDG6_4Zqf-*wx>fBKjx(YAg2_F&mXvH9C?8?x6Q{n7d9Nkzp}?jxIv z_MHFPbz^REW6ZXoQwF}5GvA(he)Pww+zIEium3VTf9}2Ox?79qieG$xdefYwl%AD) z?%g^4`d#lv`?;&*&VF~Vy}E1F<^5}~11&Dv5VPJU{+7&#z%}PKYOHq*|9ShW)YWs_ zBcgBZkh|{k-#*HE-LuLms*gPSmgh#UKXzdA^!M63lh$b8mt5RmbhN{}a-G}G^}j5p zTg(5yYZ>y#rtdK@YL=hxt-AZWM&W#;#rMtURX$l%wSB+z)*|P=ddyR^?~g7U*T#MD zG5is@H)-Cp(!W~rd7syxx0CL^vv!J6&*Av``nSUTkSxV8Z&p1cFNA%e^W*COpLigg thUd@p8yF#Mt3+l{*#HC!gw3!C{%5ebF5lnFw!H|H(?D8gCb z5n0T@z%2~Ij105pNB{-dOFVsD+3#{N^0S)kRX=CJz`!W!>EaktaqI0ZL%{FMg{vd$@? F2>|o4N-h8Z diff --git a/themes/rainbow/icons/awesome_icon.png b/themes/rainbow/icons/awesome_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..bd2bff13689b1fbdfb9523dd8a9a0f8c98b5036e GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|wj^(N7l!{JxM1({$v_d#0*}aI zppNSx%;=;sy8Er~7oCd*T6@P#IuP@>e z5KT=PZ}u5UgGKN%6^xFkKaT" +theme.ccol = "" +theme.tasklist_sticky = theme.ocol .. " [S]" .. theme.ccol +theme.tasklist_ontop = theme.ocol .. " [T]" .. theme.ccol +theme.tasklist_floating = theme.ocol .. " [F]" .. theme.ccol +theme.tasklist_maximized_horizontal = theme.ocol .. "[M] " .. theme.ccol +theme.tasklist_maximized_vertical = "" +theme.tasklist_disable_icon = true + +theme.awesome_icon = theme.dir .. "/icons/awesome_icon.png" theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png" theme.taglist_squares_sel = theme.dir .. "/icons/square_sel2.png" theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png" @@ -45,8 +55,13 @@ theme.layout_txt_fullscreen = "[F]" theme.layout_txt_magnifier = "[M]" theme.layout_txt_floating = "[*]" -theme.tasklist_floating = "" -theme.tasklist_maximized_horizontal = "" -theme.tasklist_maximized_vertical = "" +theme.layout_txt_tilegaps = "[tg]" +theme.layout_txt_tileleftgaps = "[tlg]" +theme.layout_txt_tilebottomgaps = "[tbg]" +theme.layout_txt_tiletopgaps = "[ttg]" +theme.layout_txt_fairhgaps = "[fhg]" +theme.layout_txt_fairvgaps = "[fvg]" +theme.layout_txt_spiralgaps = "[spg]" +theme.layout_txt_dwindlegaps = "[dwg]" return theme