add ximper-create-configs

parent 23dcb0a6
......@@ -10,8 +10,11 @@ The set of utilities used in Ximper Linux includes various tools that help speed
## Available utilities
### wm-xdg-autostart
Script for automatically starting applications that support XDG Autostart.
Necessary for window managers that do not support this specification.
A script for automatically launching applications that support XDG Autostart.
Required for window managers that do not support this specification.
### ximper-create-configs
A script for creating symbolic links to the basic Ximper configuration
## License
......
#!/bin/bash
create_base () {
echo "Создаётся базовая конфигурация..."
SYS_CONF="/etc/ximperdistro/environment.d/ximper-qt.conf"
USER_CONF="$HOME/.config/environment.d/ximper-qt.conf"
create_link_if_missing "$SYS_CONF" "$USER_CONF"
}
create_hyprland () {
echo "Создаётся конфигурация Hyprland..."
# hypr
for i in hyprlock hypridle hyprpaper; do
if command -v $i >/dev/null 2>&1; then
USER_CONF="$HOME/.config/hypr/$i.conf"
SYS_CONF="/etc/ximperdistro/hyprland/hypr/$i.conf"
create_link_if_missing "$SYS_CONF" "$USER_CONF"
fi
done
# swappy wlogout wofi
for i in swappy wlogout wofi; do
if command -v $i >/dev/null 2>&1; then
USER_CONF="$HOME/.config/$i"
SYS_CONF="/etc/ximperdistro/hyprland/$i"
create_link_if_missing "$SYS_CONF" "$USER_CONF"
fi
done
}
create_link_if_missing () {
local src="$1"
local dest="$2"
if [ ! -e "$src" ]; then
return
fi
if [ ! -e "$dest" ]; then
mkdir -p "$(dirname "$dest")"
ln -s "$src" "$dest"
echo "Создана ссылка: $dest$src"
else
echo "Уже существует: $dest — пропущено"
fi
}
OPTS=$(getopt -o h --long base,hyprland,help -- "$@") || {
echo "Ошибка обработки опций."
exit 1
}
eval set -- "$OPTS"
while true; do
case "$1" in
--base)
create_base
shift
;;
--hyprland)
create_hyprland
shift
;;
-h|--help)
echo "Использование: $(basename $0) [--base] [--hyprland]"
exit 0
;;
--)
shift
break
;;
*)
echo "Неверная опция: $1"
shift
;;
esac
done
[Unit]
Description=Скрипт настройки конфигураций Ximper
After=graphical.target
[Service]
Type=oneshot
ExecStart=/usr/bin/ximper-create-configs --base
RemainAfterExit=yes
[Install]
WantedBy=default.target
prefix ?= /usr
bindir ?= $(prefix)/bin
userunitdir ?= $(prefix)/lib/systemd/user
DESTDIR ?=
EXECUTABLES = wm-xdg-autostart
EXECUTABLES = wm-xdg-autostart ximper-create-configs
USERUNITS = ximper-create-configs
all: install
install:
@mkdir -p $(DESTDIR)$(bindir)
@mkdir -p $(DESTDIR)$(userunitdir)
@for file in $(EXECUTABLES); do \
install -Dm755 bin/$$file $(DESTDIR)$(bindir)/$$file; \
done
@for file in $(USERUNITS); do \
install -Dm755 data/userunits/$$file.service $(DESTDIR)$(userunitdir)/$$file.service; \
done
clean:
@for file in $(EXECUTABLES); do \
rm -f $(DESTDIR)$(bindir)/$$file; \
done
@for file in $(USERUNITS); do \
rm -f $(DESTDIR)$(userunitdir)/$$file.service; \
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment