diff --git a/Classic_2.png b/Classic_2.png new file mode 100644 index 0000000..986aebf Binary files /dev/null and b/Classic_2.png differ diff --git a/Modern_2.png b/Modern_2.png new file mode 100644 index 0000000..55c7743 Binary files /dev/null and b/Modern_2.png differ diff --git a/gnome-flavour-selector.desktop b/gnome-flavour-selector.desktop new file mode 100644 index 0000000..2c1d408 --- /dev/null +++ b/gnome-flavour-selector.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Choose Desktop +GenericName=Choose Desktop Design +Exec=/usr/bin/gnome-flavour-selector +Terminal=false +Icon=org.gnome.tweaks.svg +Categories=GNOME;GTK;System; +Type=Application +StartupNotify=false +X-GNOME-Autostart-enabled=true +X-GNOME-Autostart-Delay=10 diff --git a/gnome-flavour-selector.sh b/gnome-flavour-selector.sh new file mode 100755 index 0000000..a9dad3c --- /dev/null +++ b/gnome-flavour-selector.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +LOCK_FILE="$HOME/.config/gnome-flavour-selector/timestamp" +EXTENSIONS_SWITCHER="/usr/share/gnome-flavour-selector/extensions.json" + +mkdir -p $HOME/.config/gnome-flavour-selector + +if [ -f "$LOCK_FILE" -a -f "$EXTENSIONS_SWITCHER" ]; then + _timestamps="$(cat $EXTENSIONS_SWITCHER | jq -r '. | keys | .[]')" + _lastrun_timestamps="$(cat $LOCK_FILE )" + + for ts in $_timestamps; do + if [ $(echo $ts | sed 's@^T@@') -gt $_lastrun_timestamps ]; then + EXT_2_ENABLE=$(cat $EXTENSIONS_SWITCHER | jq -r ".${ts}.enable") + EXT_2_DISABLE=$(cat $EXTENSIONS_SWITCHER | jq -r ".${ts}.disable") + + if [ "$EXT_2_ENABLE" != "null" ]; then + EXT_2_ENABLE=$(echo $EXT_2_ENABLE | jq -r .[] ) + + for ext in $EXT_2_ENABLE; do + echo gnome-extensions enable $ext + done + fi + + if [ "$EXT_2_DISABLE" != "null" ]; then + EXT_2_DISABLE=$(echo $EXT_2_DISABLE | jq -r .[] ) + + for ext in $EXT_2_DISABLE; do + echo gnome-extensions disable $ext + done + fi + + date +%Y%m%d%H%M > $LOCK_FILE + fi + done +fi + +if [ -f "$LOCK_FILE" ]; then + exit 0 +fi + +EXTENSIONS="arcmenu@arcmenu.com ding@rastersoft.com dash-to-panel@jderose9.github.com" +for ext in $EXTENSIONS; do + gnome-extensions disable $ext +done + +if [ "$(echo $LANG)" = "ru_RU.UTF-8" ]; then + CLASSIC="Классический вид c панелью и меню" + MODERN="GNOME Shell с доком и верхней панелью" + TITLE="Выбор оформления рабочего стола" + TEXT="Выберете дизайн оформления рабочего стола GNOME" +else + CLASSIC="Classic mode with panel and menu" + MODERN="GNOME Shell with dock and upper panel" + TITLE="Desktop design selector" + TEXT="Choose design of GNOME desktop" +fi + +table=( + /usr/share/gnome-flavour-selector/Classic_2.png "Classic" "$CLASSIC" + /usr/share/gnome-flavour-selector/Modern_2.png "Shell" "$MODERN" +) + +MODE=$(GDK_BACKEND=x11 yad \ + --center \ + --no-escape \ + --on-top \ + --list \ + --no-headers \ + --title="$TITLE" \ + --text="$TEXT" \ + --text-width=60 \ + --borders=20 \ + --print-column=2 \ + --hide-column=2 \ + --separator=' ' \ + --width=1000 \ + --height=675 \ + --column="Изображение:IMG" \ + --column="Описание:HD" \ + --column="Описание" \ + --button="Применить":20 \ + --response=20 \ + --auto-kill \ + "${table[@]}" +) + +if [ -z $MODE ]; then + exit 1 +fi + +if [ $MODE = "Classic" ]; then + for ext in $EXTENSIONS; do + gnome-extensions enable $ext + done +elif [ $MODE = "Shell" ]; then + gnome-extensions enable dash-to-dock@micxgx.gmail.com +else + echo "Unknown" +fi + +date +%Y%m%d%H%M > $LOCK_FILE