summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/XFCE.hs
diff options
context:
space:
mode:
authorJoey Hess2017-07-05 16:01:55 -0400
committerJoey Hess2017-07-05 16:01:55 -0400
commitc282a894b56012ae4f68b518e5fad01052ac4f22 (patch)
treeda7e10201ef684efffefd8e10e59278fca3b565f /src/Propellor/Property/XFCE.hs
parent4cbaa3ac665786fb0be4aa3121c6e6c447142d24 (diff)
XFCE and applyPath properties
* Propellor.Property.XFCE added with some useful properties for the desktop environment. * Added File.applyPath property. This commit was sponsored by Riku Voipio.
Diffstat (limited to 'src/Propellor/Property/XFCE.hs')
-rw-r--r--src/Propellor/Property/XFCE.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Propellor/Property/XFCE.hs b/src/Propellor/Property/XFCE.hs
new file mode 100644
index 00000000..e75946a5
--- /dev/null
+++ b/src/Propellor/Property/XFCE.hs
@@ -0,0 +1,38 @@
+module Propellor.Property.XFCE where
+
+import Propellor.Base
+import Propellor.Types.Core (getSatisfy)
+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"]
+
+-- | 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"]
+
+-- | 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) = adjustPropertySatisfy baseprop $ \s -> do
+ home <- liftIO $ User.homedir u
+ s <> fromMaybe mempty (getSatisfy (go home))
+ where
+ cf = ".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 $
+ (home </> cf) `File.isCopyOf` defcf
+ `before` File.applyPath home cf
+ (\f -> File.ownerGroup f u (userGroup u))
+ `requires` Apt.installed ["xfce4-panel"]
+ baseprop :: Property DebianLike
+ baseprop = doNothing `describe` ("default XFCE panel for " ++ username)