
    Vh                     z    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZmZ  G d de
      Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functiona  
module: xfconf_info
author:
  - "Alexei Znamensky (@russoz)"
short_description: Retrieve XFCE4 configurations
version_added: 3.5.0
description:
  - This module allows retrieving Xfce 4 configurations with the help of C(xfconf-query).
extends_documentation_fragment:
  - community.general.attributes
  - community.general.attributes.info_module
attributes:
  check_mode:
    version_added: 3.3.0
    # This was backported to 2.5.4 and 1.3.11 as well, since this was a bugfix
options:
  channel:
    description:
      - A Xfconf preference channel is a top-level tree key, inside of the Xfconf repository that corresponds to the location
        for which all application properties/keys are stored.
      - If not provided, the module lists all available channels.
    type: str
  property:
    description:
      - A Xfce preference key is an element in the Xfconf repository that corresponds to an application preference.
      - If provided, then O(channel) is required.
      - If not provided and a O(channel) is provided, then the module lists all available properties in that O(channel).
    type: str
notes:
  - See man xfconf-query(1) for more details.
a  
- name: Get list of all available channels
  community.general.xfconf_info: {}
  register: result

- name: Get list of all properties in a specific channel
  community.general.xfconf_info:
    channel: xsettings
  register: result

- name: Retrieve the DPI value
  community.general.xfconf_info:
    channel: xsettings
    property: /Xft/DPI
  register: result

- name: Get workspace names (4)
  community.general.xfconf_info:
    channel: xfwm4
    property: /general/workspace_names
  register: result
a  
channels:
  description:
    - List of available channels.
    - Returned when the module receives no parameter at all.
  returned: success
  type: list
  elements: str
  sample:
    - xfce4-desktop
    - displays
    - xsettings
    - xfwm4
properties:
  description:
    - List of available properties for a specific channel.
    - Returned by passing only the O(channel) parameter to the module.
  returned: success
  type: list
  elements: str
  sample:
    - /Gdk/WindowScalingFactor
    - /Gtk/ButtonImages
    - /Gtk/CursorThemeSize
    - /Gtk/DecorationLayout
    - /Gtk/FontName
    - /Gtk/MenuImages
    - /Gtk/MonospaceFontName
    - /Net/DoubleClickTime
    - /Net/IconThemeName
    - /Net/ThemeName
    - /Xft/Antialias
    - /Xft/Hinting
    - /Xft/HintStyle
    - /Xft/RGBA
is_array:
  description:
    - Flag indicating whether the property is an array or not.
  returned: success
  type: bool
value:
  description:
    - The value of the property. Empty if the property is of array type.
  returned: success
  type: str
  sample: Monospace 10
value_array:
  description:
    - The array value of the property. Empty if the property is not of array type.
  returned: success
  type: list
  elements: str
  sample:
    - Main
    - Work
    - Tmp
version:
  description:
    - The version of the C(xfconf-query) command.
  returned: success
  type: str
  sample: 4.18.1
  version_added: 10.2.0
)ModuleHelper)xfconf_runnerget_xfconf_versionc                       e Zd Z e e ed       ed             edg      d      ZdZd	 Zd
 Zd Zd Z	d Z
y)
XFConfInfostr)type)channelpropertyr   )r   T)argument_specrequired_bysupports_check_modeFc                     t        | j                  d      | _        t        | j                        | j                  _        | j                  j                  ddd       | j                  j                  dd       y )NT)check_rclist_argF)outputis_array)r   modulerunnerr   varsversionset)selfs    q/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/xfconf_info.py__init_module__zXFConfInfo.__init_module__   sQ    #DKK$?.t{{;				j%6		j%(    c                     |j                         }d|v rD|j                  d      }|j                  d       |j                  d       d| j                  _        |S )NzValue is an array with
r   T)rstripsplitpopr   r   )r   rcouterrresults        r   process_command_outputz!XFConfInfo.process_command_output   sJ    #v-\\$'FJJqMJJqM!%DIIr   c                 "    |j                         S N)
splitlines)r   r%   r&   r'   s       r   _process_list_propertiesz#XFConfInfo._process_list_properties   s    ~~r   c                     |j                         }|j                  d       |D cg c]  }|j                          }}|S c c}w )Nr   )r,   r$   lstrip)r   r%   r&   r'   linesss         r   _process_list_channelsz!XFConfInfo._process_list_channels   s<     		!%*+++ ,s   Ac                    t        | j                  j                        xr t        | j                  j                         | j                  _        d}| j
                  }| j                  j                  d}| j                  }n$| j                  j                  d}| j                  }| j                  j                  d|      5 } |j                  di | j                  j                         }d d d        | j                  j                  s| j                  j                  rd}| j                  j                  |       y # 1 sw Y   TxY w)Nvaluechannels
propertieszlist_arg channel property)output_processvalue_array )boolr   r   r   r   r)   r2   r-   r   contextrunas_dictr   r   )r   r   procctxr(   s        r   __run__zXFConfInfo.__run__   s   "&tyy'8'8"9"Vd499CUCU>VW		**99$F..DYY'!F00D[[  !<T R 	4VYSWW3tyy0023F	4 yy!!dii&8&8"F		ff%	4 	4s   +EEN)__name__
__module____qualname__dictr   use_old_vardictr   r)   r-   r2   r@   r9   r   r   r
   r
      sX    e$u%
 [
 !	F O) &r   r
   c                  ,    t         j                          y r+   )r
   executer9   r   r   mainrH      s    r   __main__N)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNHansible_collections.community.general.plugins.module_utils.module_helperr   Aansible_collections.community.general.plugins.module_utils.xfconfr   r   r
   rH   rA   r9   r   r   <module>rQ      sY    A @@.?
B b o6& 6&r zF r   