#!/bin/sh LOCK_FILE="$HOME/.config/gnome-flavour-selector/timestamp" EXTENSIONS_SWITCHER="/etc/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