-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
menubar: consider XDG_HOME_DIR and XDG_DATA_DIRS #1639
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1639 +/- ##
==========================================
+ Coverage 81.77% 81.81% +0.04%
==========================================
Files 301 301
Lines 18695 18722 +27
==========================================
+ Hits 15287 15318 +31
+ Misses 3408 3404 -4
Continue to review full report at Codecov.
|
Your For modules in PR waiting: Then add the few requires() and this would be as simple as: local gtable = require("gears.table")
local gstring = require("gears.string")
local gfs = require("gears.filesystem")
menu_gen.all_menu_dirs = gtable.map (
function(dir) return dir .. '/applications/' end,
gstring.split(gfs.get_xdg_data_home() .. ':' .. gfs.get_xdg_data_dirs(), ':')) with the added benefit of everybody else getting to use it if they need. :) |
@romildo Don't forget the documentation! 😁 |
The freedesktop specifications let desktop files be stored in different directories indicated by the environment variables XDG_DATA_HOME and XDG_DATA_DIRS. Only use the default value for these variables if the variables are not defined. This is important for systmes like NixOS which does not follow the LFS and installs files differently.
@Veratil I have reworked the PR so that the helper functions are defined in the appropriate module in the |
The CI found 1 problem
|
-- @tparam function f the function to be applied to each value on the table | ||
-- @tparam table tbl the container table whose values will be operated on | ||
-- @treturn table Return a table of the results | ||
function gtable.map(f, tbl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you swap both parameters for consistency with the other function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In defense of the argument order, this is traditionally the way the map function arguments are in all languages.
Python: map(function_to_apply, list_of_inputs)
Haskell: map :: (a -> b) -> [a] -> [b]
PHP: array array_map ( callable $callback , array $array1 [, array $... ] )
Even the Lua example has (func, tbl)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, then
Merged |
The freedesktop specifications let desktop files to be stored in
different directories indicated by the environment variables
XDG_DATA_HOME and XDG_DATA_DIRS. Only use the default value for these
variables if the variables are not defined.
This is important for systmes like NixOS which does not follow the LFS
and installs files differently.