summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/XFCE.hs
blob: a1b9d7d73db37e431ca85b47c53088d75757490c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Propellor.Property.XFCE where

import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.File as File
import qualified Propellor.Property.User as User

installed :: Property DebianLike
installed = Apt.installed ["task-xfce-desktop"]
	`describe` "XFCE desktop installed"

-- | Minimal install of XFCE, with a terminal emulator and panel,
-- and X, but not any of the extras.
installedMin :: Property DebianLike
installedMin = Apt.installedMin ["xfce4", "xfce4-terminal", "task-desktop"]
	`describe` "minimal XFCE desktop installed"

-- | Normally at first login, XFCE asks what kind of panel the user wants.
-- This enables the default configuration noninteractively.
--
-- If the user subsequently modifies their panel, their modifications will
-- not be overwritten by this property.
defaultPanelFor :: User -> Property DebianLike
defaultPanelFor u@(User username) = property' desc $ \w -> do
	home <- liftIO $ User.homedir u
	ensureProperty w (go home)
  where
	desc = "default XFCE panel for " ++ username
	basecf = ".config" </> "xfce4" </> "xfconf"
		</> "xfce-perchannel-xml" </> "xfce4-panel.xml"
	-- This location is probably Debian-specific.
	defcf = "/etc/xdg/xfce4/panel/default.xml"
	go :: FilePath -> Property DebianLike
	go home = tightenTargets $ check (not <$> doesFileExist cf) $
		cf `File.isCopyOf` defcf
			`before` File.applyPath home basecf
				(\f -> File.ownerGroup f u (userGroup u))
			`requires` Apt.installed ["xfce4-panel"]
	  where
		cf = home </> basecf