    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 :: Property DebianLike
    installed = [Package] -> Property DebianLike
    Apt.installed ["task-xfce-desktop"]
    	Property DebianLike -> Package -> Property DebianLike
    forall p. IsProp p => p -> Package -> p
    `describe` "XFCE desktop installed"

    -- | Minimal install of XFCE, with a terminal emulator and panel,
    -- and X and network-manager, but not any of the extra apps.
    installedMin :: Property DebianLike
    installedMin :: Property DebianLike
    installedMin = [Package] -> Property DebianLike
    Apt.installedMin ["xfce4", "xfce4-terminal", "task-desktop"]
    	Property DebianLike -> Package -> Property DebianLike
    forall p. IsProp p => p -> Package -> p
    `describe` "minimal XFCE desktop installed"

    -- | Installs network-manager-gnome, which is the way to get
    -- network-manager to manage networking in XFCE too.
    networkManager :: Property DebianLike
    networkManager :: Property DebianLike
    networkManager = [Package] -> Property DebianLike
    Apt.installedMin ["network-manager-gnome"]

    -- | Normally at first login, XFCE asks what kind of panel the user wants.
    -- This enables the default configuration noninteractively.
    defaultPanelFor :: User -> File.Overwrite -> Property DebianLike
    defaultPanelFor :: User -> Overwrite -> Property DebianLike
    defaultPanelFor u :: User
    u@(User username :: Package
    username) overwrite :: Overwrite
    overwrite = Package
    -> (OuterMetaTypesWitness
          '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish]
        -> Propellor Result)
    -> Property DebianLike
    forall k (metatypes :: k).
    SingI metatypes =>
    Package
    -> (OuterMetaTypesWitness metatypes -> Propellor Result)
    -> Property (MetaTypes metatypes)
    property' Package
    desc ((OuterMetaTypesWitness
        '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish]
      -> Propellor Result)
     -> Property DebianLike)
    -> (OuterMetaTypesWitness
          '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish]
        -> Propellor Result)
    -> Property DebianLike
    forall a b. (a -> b) -> a -> b
    $ \w :: OuterMetaTypesWitness
      '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish]
    w -> do
    	Package
    home <- IO Package -> Propellor Package
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Package -> Propellor Package)
    -> IO Package -> Propellor Package
    forall a b. (a -> b) -> a -> b
    $ User -> IO Package
    User.homedir User
    u
    	OuterMetaTypesWitness
      '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish]
    -> Property DebianLike -> Propellor Result
    forall (inner :: [MetaType]) (outer :: [MetaType]).
    EnsurePropertyAllowed inner outer =>
    OuterMetaTypesWitness outer
    -> Property (MetaTypes inner) -> Propellor Result
    ensureProperty OuterMetaTypesWitness
      '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish]
    w (Package -> Property DebianLike
    go Package
    home)
      where
    	desc :: Package
    desc = "default XFCE panel for " Package -> Package -> Package
    forall a. [a] -> [a] -> [a]
    ++ Package
    username
    	basecf :: Package
    basecf = ".config" Package -> Package -> Package
    </> "xfce4" Package -> Package -> Package
    </> "xfconf"
    		Package -> Package -> Package
    </> "xfce-perchannel-xml" Package -> Package -> Package
    </> "xfce4-panel.xml"
    	-- This location is probably Debian-specific.
    	defcf :: Package
    defcf = "/etc/xdg/xfce4/panel/default.xml"
    	go :: FilePath -> Property DebianLike
    	go :: Package -> Property DebianLike
    go home :: Package
    home = Property DebianLike -> Property DebianLike
    forall (p :: * -> *) (untightened :: [MetaType])
           (tightened :: [MetaType]).
    (TightenTargets p, TightenTargetsAllowed untightened tightened,
     SingI tightened) =>
    p (MetaTypes untightened) -> p (MetaTypes tightened)
    tightenTargets (Property DebianLike -> Property DebianLike)
    -> Property DebianLike -> Property DebianLike
    forall a b. (a -> b) -> a -> b
    $
    		Overwrite
    -> Package
    -> (Package -> Property DebianLike)
    -> Property DebianLike
    forall i.
    Overwrite -> Package -> (Package -> Property i) -> Property i
    File.checkOverwrite Overwrite
    overwrite (Package
    home Package -> Package -> Package
    </> Package
    basecf) ((Package -> Property DebianLike) -> Property DebianLike)
    -> (Package -> Property DebianLike) -> Property DebianLike
    forall a b. (a -> b) -> a -> b
    $ \cf :: Package
    cf ->
    			Package
    cf Package
    -> Package
    -> Property
         (Sing
            '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
               'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD])
    `File.isCopyOf` Package
    defcf
    				Property
      (Sing
         '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
            'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD])
    -> Property
         (Sing
            '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
               'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD])
    -> CombinedType
         (Property
            (Sing
               '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
                  'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD]))
         (Property
            (Sing
               '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
                  'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD]))
    forall x y. Combines x y => x -> y -> CombinedType x y
    `before` Package
    -> Package
    -> (Package
        -> Property
             (Sing
                '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
                   'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD]))
    -> Property
         (Sing
            '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
               'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD])
    forall metatypes.
    Monoid (Property metatypes) =>
    Package
    -> Package -> (Package -> Property metatypes) -> Property metatypes
    File.applyPath Package
    home Package
    basecf
    					(\f :: Package
    f -> Package
    -> User
    -> Group
    -> Property
         (Sing
            '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
               'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD])
    File.ownerGroup Package
    f User
    u (User -> Group
    userGroup User
    u))
    				Property
      (Sing
         '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
            'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD])
    -> Property DebianLike
    -> CombinedType
         (Property
            (Sing
               '[ 'Targeting 'OSDebian, 'Targeting 'OSBuntish,
                  'Targeting 'OSArchLinux, 'Targeting 'OSFreeBSD]))
         (Property DebianLike)
    forall x y. Combines x y => x -> y -> CombinedType x y
    `requires` [Package] -> Property DebianLike
    Apt.installed ["xfce4-panel"]