#!/bin/bash
# simple Puppy Linux control panel for
# the labwc/sfwbar desktop environment
# 250811 radky: initial release
# 251112 radky: add desktop_icons_dialog by wizard

export TEXTDOMAIN=desktopcontrol
export OUTPUT_CHARSET=UTF-8

[ ! -f /usr/share/icons/hicolor/48x48/apps/desktop-control.png ] && \
ln -sf /usr/share/icons/desktop-control.png /usr/share/icons/hicolor/48x48/apps && gtk-update-icon-cache -f -i /usr/share/icons/hicolor 2>/dev/null

# stop conky display
function conky_stop() {
    [ -n "$(pidof conky 2>/dev/null)" ] && killall conky &
}

# lock desktop icons
function desktop_icons_lock() {
    chattr +i ~/.config/zzzfm/desktop0
}

# unlock desktop icons
function desktop_icons_unlock() {
    chattr -i ~/.config/zzzfm/desktop0
}

export -f conky_stop desktop_icons_lock desktop_icons_unlock

# dialog for desktop icon management
function desktop_icons_dialog() { # adapted from wizard's wayland desktop control panel
    yad 2>/dev/null \
    --title="Icons" \
    --borders=10 \
    --text-align=center \
    --text="<b>Manage desktop icons</b>\n" \
    --button="Theme":1 \
    --button="Padding":2 \
    --button="DPI Scale":3 \
    --button="Layout":4 \
    --button="Locking":5 \
    --button="Drive Icons":6

    ret=$?
    if [ "$ret" == 1 ]; then
        icon_switcher &
        exit
    elif [ "$ret" == 2 ]; then
        zzzfm --show-pref=1 &
        exit
    elif [ "$ret" == 3 ]; then
        wdisplays-wrapper
        particons
    elif [ "$ret" == 4 ]; then
        yad 2>/dev/null --title="Desktop Application Icons" \
            --borders=10 \
            --text-align=center \
            --text="Choose a layout for desktop application icons. 
\nThe current application icons will be replaced 
including save2flash and custom icon layouts.
\nThe selected layout will be locked to prevent
modification, followed by restart of Wayland.\n" \
            --button="No Icons":1 \
            --button="Minimal":2 \
            --button="Modern":3 \
            --button="Retro":4 \
            --button="Cancel":0
            ret=$?

            if [ "$ret" == 1 ]; then
                conky_stop
                desktop_icons_unlock # unlock desktop icons
                rm -f ~/Desktop/*
                echo -n > ~/.config/zzzfm/desktop0
                desktop_icons_lock # lock ~/Desktop folder
                restartwm
                particons
                exit
            elif [ "$ret" == 2 ]; then
                conky_stop
                desktop_icons_unlock # unlock desktop icons
                rm -f ~/Desktop/*

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=File
Icon=/usr/local/lib/X11/pixmaps/home48.png
Exec=defaultfilemanager' > ~/Desktop/file.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Terminal
Icon=/usr/local/lib/X11/pixmaps/console48.png
Exec=defaultterminal' > ~/Desktop/terminal.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Browse
Icon=/usr/local/lib/X11/pixmaps/www48.png
Exec=defaultbrowser' > ~/Desktop/browse.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Settings
Icon=/usr/local/lib/X11/pixmaps/configuration48.png
Exec=pupcontrol' > ~/Desktop/settings.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Trash
Icon=/usr/local/lib/X11/pixmaps/trashcan_empty48.png
Exec=spacefm ~/.local/share/Trash/files' > ~/Desktop/trash.desktop

                echo '1=file.desktop
2=terminal.desktop
3=browse.desktop
4=settings.desktop
5=trash.desktop' > ~/.config/zzzfm/desktop0

                desktop_icons_lock # lock new icons
                restartwm
                particons
                exit
            elif [ "$ret" == 3 ]; then
                conky_stop
                desktop_icons_unlock # unlock desktop icons
                rm -f ~/Desktop/*

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=File
Icon=/usr/local/lib/X11/pixmaps/home48.png
Exec=defaultfilemanager' > ~/Desktop/file.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Write
Icon=/usr/local/lib/X11/pixmaps/word48.png
Exec=defaultwordprocessor' > ~/Desktop/write.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Browse
Icon=/usr/local/lib/X11/pixmaps/www48.png
Exec=defaultbrowser' > ~/Desktop/browse.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Terminal
Icon=/usr/local/lib/X11/pixmaps/console48.png
Exec=defaultterminal' > ~/Desktop/terminal.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Help
Icon=/usr/local/lib/X11/pixmaps/help48.png
Exec=defaultbrowser file:///usr/share/doc/index.html' > ~/Desktop/help.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Calc
Icon=/usr/local/lib/X11/pixmaps/spread48.png
Exec=defaultspreadsheet' > ~/Desktop/calc.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Email
Icon=/usr/local/lib/X11/pixmaps/email48.png
Exec=defaultemail' > ~/Desktop/email.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Run
Icon=/usr/share/icons/run48.png
Exec=defaultrun' > ~/Desktop/run.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Mount
Icon=/usr/local/lib/X11/pixmaps/drive48.png
Exec=pmount' > ~/Desktop/mount.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Edit
Icon=/usr/local/lib/X11/pixmaps/edit48.png
Exec=defaulttexteditor' > ~/Desktop/edit.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Chat
Icon=/usr/local/lib/X11/pixmaps/chat48.png
Exec=defaultchat' > ~/Desktop/chat.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Zip
Icon=/usr/local/lib/X11/pixmaps/archive48.png
Exec=defaultarchiver' > ~/Desktop/archive.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Install
Icon=/usr/share/icons/install48.png
Exec=dotpup' > ~/Desktop/install.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Paint
Icon=/usr/local/lib/X11/pixmaps/paint48.png
Exec=defaultpaint' > ~/Desktop/paint.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Connect
Icon=/usr/local/lib/X11/pixmaps/connect48.png
Exec=defaultconnect' > ~/Desktop/connect.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Lock
Icon=/usr/local/lib/X11/pixmaps/lock-screen48.png
Exec=puplock' > ~/Desktop/lock.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Setup
Icon=/usr/local/lib/X11/pixmaps/configuration48.png
Exec=pupcontrol' > ~/Desktop/setup.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Play
Icon=/usr/local/lib/X11/pixmaps/multimedia48.png
Exec=defaultmediaplayer' > ~/Desktop/play.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Plan
Icon=/usr/local/lib/X11/pixmaps/date48.png
Exec=osmo-wrapper' > ~/Desktop/contact.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Trash
Icon=/usr/local/lib/X11/pixmaps/trashcan_empty48.png
Exec=spacefm ~/.local/share/Trash/files' > ~/Desktop/trash.desktop

ypix=$(wlr-randr | grep current | cut -d'x' -f2 | cut -d' ' -f1)
yicons=$(($ypix / 108))
col2="$yicons"
col3=$(($yicons * 2))
col4=$(($yicons * 3))
col5=$(($yicons * 4))
help=$(($col2 + 1))
calc=$(($col2 + 2))
email=$(($col2 + 3))
run=$(($col2 + 4))
mount=$(($col3 + 1))
edit=$(($col3 + 2))
chat=$(($col3 + 3))
archive=$(($col3 + 4))
install=$(($col4 + 1))
paint=$(($col4 + 2))
connect=$(($col4 + 3))
lock=$(($col4 + 4))
setup=$(($col5 + 1))
play=$(($col5 + 2))
contact=$(($col5 + 3))
trash=$(($col5 + 4))

                echo "1=file.desktop
2=write.desktop
3=browse.desktop
4=terminal.desktop
$help=help.desktop
$calc=calc.desktop
$email=email.desktop
$run=run.desktop
$mount=mount.desktop
$edit=edit.desktop
$chat=chat.desktop
$archive=archive.desktop
$install=install.desktop
$paint=paint.desktop
$connect=connect.desktop
$lock=lock.desktop
$setup=setup.desktop
$play=play.desktop
$contact=contact.desktop
$trash=trash.desktop" > ~/.config/zzzfm/desktop0

                desktop_icons_lock # lock new icons
                restartwm
                particons
                exit
            elif [ "$ret" == 4 ]; then
                conky_stop
                desktop_icons_unlock # unlock desktop icons
                rm -f ~/Desktop/*

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=File
Icon=/usr/local/lib/X11/pixmaps/home48.png
Exec=defaultfilemanager' > ~/Desktop/file.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Write
Icon=/usr/local/lib/X11/pixmaps/word48.png
Exec=defaultwordprocessor' > ~/Desktop/write.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Browse
Icon=/usr/local/lib/X11/pixmaps/www48.png
Exec=defaultbrowser' > ~/Desktop/browse.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Plan
Icon=/usr/local/lib/X11/pixmaps/date48.png
Exec=osmo-wrapper' > ~/Desktop/contact.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Connect
Icon=/usr/local/lib/X11/pixmaps/connect48.png
Exec=defaultconnect' > ~/Desktop/connect.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Help
Icon=/usr/local/lib/X11/pixmaps/help48.png
Exec=defaultbrowser file:///usr/share/doc/index.html' > ~/Desktop/help.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Calc
Icon=/usr/local/lib/X11/pixmaps/spread48.png
Exec=defaultspreadsheet' > ~/Desktop/calc.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Email
Icon=/usr/local/lib/X11/pixmaps/email48.png
Exec=defaultemail' > ~/Desktop/email.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Play
Icon=/usr/local/lib/X11/pixmaps/multimedia48.png
Exec=defaultmediaplayer' > ~/Desktop/play.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Mount
Icon=/usr/local/lib/X11/pixmaps/drive48.png
Exec=pmount' > ~/Desktop/mount.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Paint
Icon=/usr/local/lib/X11/pixmaps/paint48.png
Exec=defaultpaint' > ~/Desktop/paint.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Chat
Icon=/usr/local/lib/X11/pixmaps/chat48.png
Exec=defaultchat' > ~/Desktop/chat.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Install
Icon=/usr/share/icons/install48.png
Exec=dotpup' > ~/Desktop/install.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Edit
Icon=/usr/local/lib/X11/pixmaps/edit48.png
Exec=defaulttexteditor' > ~/Desktop/edit.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Setup
Icon=/usr/local/lib/X11/pixmaps/configuration48.png
Exec=pupcontrol' > ~/Desktop/setup.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Terminal
Icon=/usr/local/lib/X11/pixmaps/console48.png
Exec=defaultterminal' > ~/Desktop/terminal.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Lock
Icon=/usr/local/lib/X11/pixmaps/lock-screen48.png
Exec=puplock' > ~/Desktop/lock.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Zip
Icon=/usr/local/lib/X11/pixmaps/archive48.png
Exec=defaultarchiver' > ~/Desktop/archive.desktop

                echo '[Desktop Entry]
Encoding=UTF-8
Type=Application
NoDisplay=true
Name=Trash
Icon=/usr/local/lib/X11/pixmaps/trashcan_empty48.png
Exec=spacefm ~/.local/share/Trash/files' > ~/Desktop/trash.desktop

ypix=$(wlr-randr | grep current | cut -d'x' -f2 | cut -d' ' -f1)
yicons=$(($ypix / 108))
col2="$yicons"
col3=$(($yicons * 2))
col4=$(($yicons * 3))
col5=$(($yicons * 4))
col6=$(($yicons * 5))
col7=$(($yicons * 6))
col8=$(($yicons * 7))
help=$(($col2 + 1))
calc=$(($col2 + 2))
email=$(($col2 + 3))
play=$(($col2 + 4))
mount=$(($col3 + 1))
paint=$(($col3 + 2))
chat=$(($col3 + 3))
install=$(($col4 + 1))
edit=$(($col4 + 2))
setup=$(($col5 + 1))
terminal=$(($col5 + 2))
lock=$(($col6 + 1))
archive=$(($col7 + 1))
trash=$(($col8 + 1))

                echo "1=file.desktop
2=write.desktop
3=browse.desktop
4=contact.desktop
5=connect.desktop
$help=help.desktop
$calc=calc.desktop
$email=email.desktop
$play=play.desktop
$mount=mount.desktop
$paint=paint.desktop
$chat=chat.desktop
$install=install.desktop
$edit=edit.desktop
$setup=setup.desktop
$terminal=terminal.desktop
$lock=lock.desktop
$archive=archive.desktop
$trash=trash.desktop" > ~/.config/zzzfm/desktop0

                desktop_icons_lock # lock new icons
                restartwm
                particons
                exit
            fi
            desktop_icons_dialog
            exit
    elif [ "$ret" == 5 ]; then
        # check if desktop0 is locked (i.e. check if immutable attribute is set)
        locked=$(lsattr ~/.config/zzzfm/desktop0 | grep -o -- 'i-')
        if [ -z $locked ]; then
            lockstate="unlocked"
        else
            lockstate="locked"  
        fi       

        # display window
        yad 2>/dev/null --title="Icon Lockstate" \
            --borders=10 \
            --text-align=center \
            --text="<b>Icon layout is $lockstate</b>\n" \
            --button="Lock":1 \
            --button="Unlock":2 \
            --button="Cancel":0 

            ret=$?
            # set attr for desktop0
            if [ "$ret" == 1 ]; then
                desktop_icons_lock
                desktop_icons_dialog
                exit
            elif [ "$ret" == 2 ]; then
                desktop_icons_unlock
                desktop_icons_dialog
                exit
            fi     
            desktop_icons_dialog
            exit
    elif [ "$ret" == 6 ]; then

        # drive icon status
        yad 2>/dev/null --title="Drive Icons" \
            --borders=10 \
            --text-align=center \
            --text="\n <b>Configure drive icons</b>\n" \
            --button="On/Off":1 \
            --button="Position on Screen":2 \
            --button="Cancel":0 

            ret=$?
            if [ "$ret" == 1 ]; then
                # check if drive icons are on/off
                [ -f ~/.config/zzzfm/particons_off ] && driveicons=off || driveicons=on
                if [ "$driveicons" = "off" ]; then
                    drive_icons="Disabled"
                else
                    drive_icons="Enabled"  
                fi 
                # display window
                yad 2>/dev/null --title="Drive Icons On/Off" \
                    --borders=10 \
                    --text-align=center \
                    --text="\n Drives icons are currently <b>$drive_icons</b>\n\nThe Enable button restarts Wayland\n" \
                    --button="Enable":1 \
                    --button="Disable":2 \
                    --button="Cancel":0 

                    ret=$?
                    if [ "$ret" == 1 ]; then
                        rm ~/.config/zzzfm/particons_off
                        restartwm
                        particons
                        exit
                    elif [ "$ret" == 2 ]; then
                        touch ~/.config/zzzfm/particons_off
                        rm ~/Desktop/particon*.desktop
                        desktop_icons_dialog
                        exit
                    fi
                    desktop_icons_dialog
                    exit 
            elif [ "$ret" == 2 ]; then
                # set screen position of drive icons
                MAXROW=$(cat ~/.config/zzzfm/row-max)
                SELROW=$(cat ~/.config/zzzfm/row-selected 2>/dev/null)
                [ -z "$SELROW" ] && SELROW=$MAXROW
                RETURN=$(yad 2>/dev/null --form --field=" Grid Number:NUM" "$SELROW"\!1..$MAXROW\!1.0\!0 \
                    --title="Screen Position of Drive Icons" \
                    --borders=20 \
                    --text-align=center \
                    --text="Select the <b>y-axis grid number</b> for drive icon position.\n \
Lower values will align the icons higher on the screen.\n \
Very high values will wrap drive icons to top of screen.\n\n \
Adjusting the screen <b>fontsize</b> or using <b>wdisplays</b> will\n \
change the screen view requiring a correction below.\n \
High DPI scaling values will require lower grid values.\n\n \
<b>Current Drive Icon Position:</b>  Grid $SELROW of $MAXROW\n" \
                    --button="Rescan Screen":1 \
                    --button="Apply":0 \
                    --button="Cancel":2
                    ) ret=$?
                    if [ "$ret" == 0 ]; then
                        echo "$RETURN" | cut -d "|" -f1 > ~/.config/zzzfm/row-selected
                        particons
                        desktop_icons_dialog
                        exit
                    elif [ "$ret" == 1 ]; then
                        rm -f ~/.config/zzzfm/row-selected 2>/dev/null
                        particons
                        desktop_icons_dialog
                        exit
                    else
                        desktop_icons_dialog
                        exit
                    fi
                    exit
            fi       
            desktop_icons_dialog
            exit
    fi           
    exit
}

export -f desktop_icons_dialog

# desktop font manager
function desktop_fonts() {
	if [ -f ~/.config/autostart/zzzfm.desktop ]; then
		yad 2>/dev/null --title="Font Manager" \
		--text="<b>Adjust screen font size</b>\n" \
		--text-align=center \
		--borders=20 \
		--button="Taskbar":1 \
		--button="DPI Scale":2 \
		--button="Desktop":3

		ret=$?
		if [ $ret == 1 ]; then
	   		sfwbar-config.sh
			particons
		elif [ $ret == 2 ]; then
	   		wdisplays-wrapper
			particons
		elif [ $ret == 3 ]; then
	   		zzzfm --show-pref=1
		fi
		exit
	else
		yad 2>/dev/null --title="Font Manager" \
		--text="<b>Adjust screen font size</b>\n" \
		--text-align=center \
		--borders=20 \
		--button="Taskbar":1 \
		--button="DPI Scale":2 \
		--button="Cancel":0

		ret=$?
		if [ $ret == 1 ]; then
	   		sfwbar-config.sh
			particons
		elif [ $ret == 2 ]; then
	   		wdisplays-wrapper
			particons
		fi
		exit
	fi
}

export -f desktop_fonts

# set alternate variables of main dialog
if [ -f ~/.config/autostart/zzzfm.desktop ]; then
   STATE=true
   TOOLTIP="$(gettext 'Desktop preferences')"
   LABEL="<label>"$(gettext 'Icon Manager')"</label>"
   ACTION="<action>desktop_icons_dialog &</action>"
else
   STATE=false
   TOOLTIP="$(gettext 'SpaceFM desktop disabled')"
   LABEL="<label>"$(gettext 'Icon Theme')"</label>"
   ACTION="<action>icon_switcher &</action>"
fi

# set gui header of main dialog
mkdir -p /tmp/sfwbar
XML_INFO_COLOR='#EDEBD7' # background color
XML_INFO_OPACITY=0.5 # background opacity
. $HOME/.config/sfwbar/xml_info_sfwbar gtk > /dev/null # build bg_pixmap for gtk-theme

BOX_HEIGHT=90 # HEADER
ICON=/usr/share/icons/desktop-control.png
ICON_HEIGHT=70
MSG_1="<b><span size='"'x-large'"'>$(gettext "Desktop Control")</span></b>"
MSG_2="<b>$(gettext "Basic Desktop Configuration")</b>"
ALIGN=center # center or left
HEADER="
   <hbox space-expand="'"false"'" space-fill="'"false"'" height-request="'"${BOX_HEIGHT}"'">
   $(. $HOME/.config/sfwbar/xml_info_sfwbar "$ICON" "$ICON_HEIGHT" "$MSG_1" "$MSG_2" "$ALIGN")
   </hbox>"

# MAIN DIALOG
export DESKTOP_CONTROL='
<window title="'$(gettext 'Desktop Control')'" icon-name="/usr/share/icons/desktop-control.png" resizable="true">
<vbox width-request="600" space-expand="true" space-fill="true">

  '$HEADER'
      
  <vbox space-expand="true" space-fill="true">

      <text use-markup="true"><label>"<b><big>'$(gettext 'Settings')'</big></b>"</label></text>

      <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
        <button sensitive="'$STATE'" image-position="2" tooltip-text="'$TOOLTIP'">
          <label>'$(gettext 'Desktop Settings')'</label>
          <input file>/usr/share/icons/hicolor/48x48/apps/spacefm-48-pyramid-blue.png</input><height>56</height><width>56</width>
          <action>zzzfm --show-pref=1 &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Desktop appearance and input device configuration')'">
          <label>'$(gettext 'Desktop Tweaks')'</label>
          <input file>/usr/share/pixmaps/puppy/execute_add.svg</input><height>56</height><width>56</width>
          <action>labwc-tweaks-gtk-wrapper &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Taskbar and launchbar configuration')'">
          <label>'$(gettext 'TaskBar Settings')'</label>
          <input file>/usr/share/pixmaps/puppy/desktop_tray_config.svg</input><height>56</height><width>56</width>
          <action>sfwbar-config.sh &</action>
        </button>
      </hbox>

      <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
        <button image-position="2" tooltip-text="'$(gettext 'Screen tint and brightness control')'">
          <label>'$(gettext 'Display Control')'</label>
          <input file>/usr/local/dcontrol/icons/monitor.svg</input><height>56</height><width>56</width>
          <action>/usr/local/dcontrol/dcontrol &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Screen layout manager')'">
          <label>'$(gettext 'Display Manager')'</label>
          <input file>/usr/share/icons/wdisplays.svg</input><height>56</height><width>56</width>
          <action>wdisplays-wrapper &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Conky system information manager')'">
          <label>'$(gettext 'System Monitor')'</label>
          <input file>/usr/share/icons/conky.svg</input><height>56</height><width>56</width>
          <action>conky-gtk &</action>
        </button>
      </hbox>

      <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
        <button image-position="2" tooltip-text="'$(gettext 'Desktop wallpaper manager')'">
          <label>'$(gettext 'Background')'</label>
          <input file>/usr/local/qwallpaper/icons/wallpaper.svg</input><height>56</height><width>56</width>
          <action>qwallpaper &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Desktop font manager')'">
          <label>'$(gettext 'Font Manager')'</label>
          <input file>/usr/share/icons/Puppy Standard/scalable/actions/select-font.svg</input><height>56</height><width>56</width>
          <action>desktop_fonts &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Desktop icon manager')'">
          '$LABEL'
          <input file>/usr/share/pixmaps/puppy/desktop_icons.svg</input><height>56</height><width>56</width>
          '$ACTION'
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Desktop global theme manager')'">
          <label>'$(gettext 'System Theme')'</label>
          <input file>/usr/share/icons/global_themes.png</input><height>56</height><width>56</width>
          <action>ptheme_gtk_globalthemes &</action>
        </button>
      </hbox>

      <text use-markup="true"><label>"<b><big>'$(gettext 'Setup')'</big></b>"</label></text>

      <hbox spacing="10" homogeneous="true" space-expand="true" space-fill="true">
        <button image-position="2" tooltip-text="'$(gettext 'Desktop setup guide')'">
          <label>'$(gettext 'Quick Setup')'</label>
          <input file>/usr/share/pixmaps/puppy/computer.svg</input><height>56</height><width>56</width>
          <action>quicksetup &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Desktop configuration guide')'">
          <label>'$(gettext 'Puppy Setup')'</label>
          <input file>/usr/share/pixmaps/puppy/execute_yes.svg</input><height>56</height><width>56</width>
          <action>wizardwizard &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Desktop keyboard shortcuts')'">
          <label>'$(gettext 'Hotkeys')'</label>
          <input file>/usr/share/pixmaps/puppy/keyboard_shortcut.svg</input><height>56</height><width>56</width>
          <action>hotkey.sh &</action>
        </button>
        <button image-position="2" tooltip-text="'$(gettext 'Default desktop applications')'">
          <label>'$(gettext 'Default Apps')'</label>
          <input file>/usr/share/pixmaps/puppy/execute_inspect.svg</input><height>56</height><width>56</width>
          <action>puppyapps &</action>
        </button>
      </hbox>
  </vbox>
</vbox>
<action signal="key-press-event" condition="command_is_true([ $KEY_SYM = Escape ] && echo true )">exit:EXIT</action>
</window>'

gtkdialog -p DESKTOP_CONTROL --geometry +50+50 --styles=/tmp/sfwbar/gtkrc_xml_info.css
unset DESKTOP_CONTROL
