You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sphere-desktop-selector/gnome-flavour-selector.sh

105 lines
2.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/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
gnome-extensions disable dash-to-dock@gnome-shell-extensions.gcampax.github.com
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@gnome-shell-extensions.gcampax.github.com
else
echo "Unknown"
fi
date +%Y%m%d%H%M > $LOCK_FILE