make-desktopitem: minor fixes and code style

This commit is contained in:
piegames 2020-10-14 01:19:43 +02:00
parent 51cc553307
commit 3a76d4caea

View File

@ -6,7 +6,7 @@
, exec , exec
, icon ? null , icon ? null
, comment ? null , comment ? null
, terminal ? "false" , terminal ? false
, desktopName # The name of the application , desktopName # The name of the application
, genericName ? null , genericName ? null
, mimeType ? null , mimeType ? null
@ -19,20 +19,22 @@
let let
# like builtins.toString, but null -> null instead of null -> "" # like builtins.toString, but null -> null instead of null -> ""
nullableToString = value: if value == null then null else builtins.toString value; nullableToString = value: if value == null then null
else if builtins.isBool value then lib.boolToString value
else builtins.toString value;
# The [Desktop entry] section of the desktop file, as attribute set. # The [Desktop entry] section of the desktop file, as attribute set.
mainSection = { mainSection = {
"Type" = toString type; "Type" = toString type;
"Exec" = (nullableToString exec); "Exec" = nullableToString exec;
"Icon" = (nullableToString icon); "Icon" = nullableToString icon;
"Comment" = (nullableToString comment); "Comment" = nullableToString comment;
"Terminal" = (nullableToString terminal); "Terminal" = nullableToString terminal;
"Name" = toString name; "Name" = toString name;
"GenericName" = (nullableToString genericName); "GenericName" = nullableToString genericName;
"MimeType" = (nullableToString mimeType); "MimeType" = nullableToString mimeType;
"Categories" = (nullableToString categories); "Categories" = nullableToString categories;
"StartupNotify" = (nullableToString startupNotify); "StartupNotify" = nullableToString startupNotify;
} // extraDesktopEntries; } // extraDesktopEntries;
# Map all entries to a list of lines # Map all entries to a list of lines