1
0
Ondřej Súkup 2015-11-10 21:39:55 +00:00 committed by Git OBS Bridge
parent 6034049850
commit c34790c84f
2 changed files with 115 additions and 26 deletions

View File

@ -0,0 +1,91 @@
--- a/freedesktop/desktop.lua
+++ b/freedesktop/desktop.lua
@@ -6,7 +6,7 @@ local button = button
local table = table
local ipairs = ipairs
local awful = require("awful")
-local utils = require("freedesktop.utils")
+local utils = require("menubar.utils")
module("freedesktop.desktop")
@@ -76,14 +76,7 @@ end
-- @param dir The directory to parse, (default is ~/Desktop)
-- @param showlabels Shows icon captions (default is false)
function add_applications_icons(arg)
- for i, program in ipairs(utils.parse_desktop_files({
- dir = arg.dir or '~/Desktop/',
- icon_sizes = {
- iconsize.width .. "x" .. iconsize.height,
- "128x128", "96x96", "72x72", "64x64", "48x48",
- "36x36", "32x32", "24x24", "22x22", "16x6"
- }
- })) do
+ for i, program in ipairs(utils.parse_dir(arg.dir or '~/Desktop/')) do
if program.show then
add_icon({
label = arg.showlabels and program.Name or nil,
@@ -101,14 +94,7 @@ end
-- @param open_with The program to use to open clicked files and dirs (i.e. xdg_open, thunar, etc.)
function add_dirs_and_files_icons(arg)
arg.open_with = arg.open_width or 'thunar'
- for i, file in ipairs(utils.parse_dirs_and_files({
- dir = arg.dir or '~/Desktop/',
- icon_sizes = {
- iconsize.width .. "x" .. iconsize.height,
- "128x128", "96x96", "72x72", "64x64", "48x48",
- "36x36", "32x32", "24x24", "22x22", "16x6"
- }
- })) do
+ for i, file in ipairs(utils.parse_dir(arg.dir or '~/Desktop/')) do
if file.show then
add_icon({
label = arg.showlabels and file.filename or nil,
--- a/freedesktop/menu.lua
+++ b/freedesktop/menu.lua
@@ -1,5 +1,5 @@
-- Grab environment
-local utils = require("freedesktop.utils")
+local utils = require("menubar.utils")
local io = io
local string = string
local table = table
@@ -39,7 +39,7 @@ function new(arg)
programs['Other'] = {}
for i, dir in ipairs(config.menu_dirs or all_menu_dirs) do
- local entries = utils.parse_desktop_files({dir = dir})
+ local entries = utils.parse_dir(dir)
for j, program in ipairs(entries) do
-- check whether to include in the menu
if program.show and program.Name and program.cmdline then
@@ -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('applications-accessories') },
+ { "Development", programs["Development"], utils.lookup_icon('applications-development') },
+ { "Education", programs["Education"], utils.lookup_icon('applications-science') },
+ { "Games", programs["Game"], utils.lookup_icon('applications-games') },
+ { "Graphics", programs["Graphics"], utils.lookup_icon('applications-graphics') },
+ { "Internet", programs["Network"], utils.lookup_icon('applications-internet') },
+ { "Multimedia", programs["AudioVideo"], utils.lookup_icon('applications-multimedia') },
+ { "Office", programs["Office"], utils.lookup_icon('applications-office') },
+ { "Other", programs["Other"], utils.lookup_icon('applications-other') },
+ { "Settings", programs["Settings"], utils.lookup_icon('preferences-desktop') },
+ { "System Tools", programs["System"], utils.lookup_icon('applications-system') },
}
-- Removing empty entries from menu
Only in a/freedesktop: utils.lua

View File

@ -1,7 +1,7 @@
# #
# spec file for package awesome-freedesktop # spec file for package awesome-freedesktop
# #
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -22,43 +22,41 @@ Release: 0
Summary: Desktop entries and menu for awesome Summary: Desktop entries and menu for awesome
License: GPL-2.0+ License: GPL-2.0+
Group: System/GUI/Other Group: System/GUI/Other
Url: https://github.com/terceiro/awesome-freedesktop.git Url: https://github.com/terceiro/awesome-freedesktop
Source: %name-%version.tar.xz Source: %{name}-%{version}.tar.xz
Requires: awesome >= 3.4.4 # PATCH-FIX-OPENSUSE awesome-freedesktop-3.5-compat.patch sor.alexei@meowr.ru -- Use upstream menubar.utils to gain awesome 3.5+ compatibility.
Patch0: awesome-freedesktop-3.5-compat.patch
Requires: awesome >= 3.5.0
BuildArch: noarch BuildArch: noarch
%description %description
This project aims to add support for freedesktop.org compliant desktop entries This project aims to add support for freedesktop.org compliant
and menu. desktop entries and menu.
Main features Main features:
============= * a freedesktop.org-compliant (or almost) applications menu.
* a freedesktop.org-compliant (or almost) desktop.
* a freedesktop.org-compliant (or almost) applications menu * a (yet limited) icon lookup function.
* a freedesktop.org-compliant (or almost) desktop
* a (yet limited) icon lookup function.
Icon themes
===========
You can choose any icon theme that's installed in /usr/share/icons/.
You can choose any icon theme that's installed in %{_datadir}/icons/.
%prep %prep
%setup -q -n %name %setup -q -n %{name}
%patch0 -p1
# Superseded by menubar.utils (doesn't work with awesome 3.5+).
rm -f freedesktop/utils.lua
%build %build
%install %install
mkdir -p %{buildroot}%{_datadir}/awesome/lib/freedesktop/
install -d %{buildroot}%{_datadir}/awesome/lib/freedesktop install -m 0644 freedesktop/*.lua %{buildroot}%{_datadir}/awesome/lib/freedesktop/.
install -D -m644 freedesktop/*.lua %{buildroot}%{_datadir}/awesome/lib/freedesktop/.
%files %files
%defattr(-,root,root,-) %defattr(-,root,root)
%{_datadir}/awesome/lib/ %doc README TODO
%dir %{_datadir}/awesome %dir %{_datadir}/awesome/
%dir %{_datadir}/awesome/lib/freedesktop %dir %{_datadir}/awesome/lib/
%doc README TODO awesome-freedesktop.png %{_datadir}/awesome/lib/freedesktop/
%changelog %changelog