-- | Freedesktop.org configuration file properties.

module Propellor.Property.FreeDesktop where

import Propellor.Base
import Propellor.Property.ConfFile

desktopFile :: String -> FilePath
desktopFile :: String -> String
desktopFile String
s = String
s forall a. [a] -> [a] -> [a]
++ String
".desktop"

-- | Name used in a desktop file; user visible. 
type Name = String

-- | Command that a dekstop file runs. May include parameters.
type Exec = String

-- | Specifies an autostart file. By default it will be located in the
-- system-wide autostart directory.
autostart :: FilePath -> Name -> Exec -> RevertableProperty UnixLike UnixLike
autostart :: String -> String -> String -> RevertableProperty UnixLike UnixLike
autostart String
f String
n String
e = (String
"/etc/xdg/autostart" String -> String -> String
</> String
f) String
-> [(String, [(String, String)])]
-> RevertableProperty UnixLike UnixLike
`iniFileContains` 
	[ (String
"Desktop Entry",
		[ (String
"Type", String
"Application")
		, (String
"Version", String
"1.0")
		, (String
"Name", String
n)
		, (String
"Comment", String
"Autostart")
		, (String
"Terminal", String
"False")
		, (String
"Exec", String
e)
		] )
	]