Fix modify rc.xorg for wayland

master
Dmitry Razumov 4 months ago
parent 41aaad8505
commit 676d454108
Signed by: asmeron
GPG Key ID: 50BC1DB583B79706

@ -74,7 +74,7 @@ BACKGROUND_RES=1920x1080
#SSSYSDIR=/usr/share/ublinux/screensaver/Default
#WPDEFFILE=/usr/share/ublinux/wallpapers/default.jpg
## /rc.xorg/01-background
## /rc.profile/01-de-background
BACKGROUND_DE=/usr/share/backgrounds/background.jpg
## /rc.post.d/12-dm-background
@ -122,7 +122,7 @@ HARDCONF=/etc/ublinux/service.conf
## Настройка параметров раскладки
## /rc.post.d/11-xorg
## /rc.xorg/10-fixkeyboard_layout
## /rc.profile/10-fixkeyboard_layout
XKBMODEL[ar]=pc105
XKBMODEL[fr]=pc105
XKBMODEL[de]=pc105

@ -963,7 +963,7 @@ ubconfig_exec_system(){
XORG_MONITOR\[*\]) ${ROOTFS}/usr/lib/ublinux/rc.post.d/11-xorg exec_xorg_monitor ;;
XORG_EXT) ${ROOTFS}/usr/lib/ublinux/rc.post.d/11-xorg exec_xorg_ext;;
XORG_DPI) ${ROOTFS}/usr/lib/ublinux/rc.preinit.d/63-xorg-dpi
${ROOTFS}/usr/lib/ublinux/rc.xorg/20-video-xorg-dpi ;;
${ROOTFS}/usr/lib/ublinux/rc.profile/20-video-xorg-dpi ;;
*) NO_FIND_EXCUTE=1 ;;
esac
;;
@ -1039,7 +1039,7 @@ ubconfig_exec_system(){
;;
"[${SYSCONF}/keyboard]"|"[keyboard]")
case "${NAME_VAR}" in
NUMLOCK) ${ROOTFS}/usr/lib/ublinux/rc.xorg/10-fixkeyboard_layout ;;
NUMLOCK) ${ROOTFS}/usr/lib/ublinux/rc.profile/10-fixkeyboard_layout ;;
XKBMODEL) ${ROOTFS}/usr/lib/ublinux/rc.post.d/11-xorg exec_mkkbdfxorg ;;
XKBLAYOUT) ${ROOTFS}/usr/lib/ublinux/rc.post.d/11-xorg exec_mkkbdfxorg ;;
XKBVARIANT) ${ROOTFS}/usr/lib/ublinux/rc.post.d/11-xorg exec_mkkbdfxorg ;;

@ -7,11 +7,11 @@
#
ENABLED=yes
[[ ${ENABLED} == "yes" ]] || { return 0 2>/dev/null && return 0 || exit 0; }
PATH_FIND="/usr/lib/ublinux/rc.xorg"
if [[ ${ENABLED} == "yes" ]]; then
PATH_FIND="/usr/lib/ublinux/rc.profile"
while IFS= LC_ALL=C read -ru3 -d '' SELECT_FILE; do
. ${SELECT_FILE} 2>/dev/null
done 3< <(find "${PATH_FIND}" -type f -executable -print0 | sort -Vz)
fi
true

@ -26,13 +26,23 @@ exec_02_install_pkg_tar(){
local FIND_PATH="/memory/layer-base/*/install"
local FIND_PATH_ONCE="/memory/layer-base/*/install/once"
local FIND_PKG_TAR=$(find ${FIND_PATH} ${FIND_PATH_ONCE} -maxdepth 1 -type f -name "*.pkg.tar.*" -print 2>/dev/null)
#local FIND_PKG_TAR=$(find ${FIND_PATH} -maxdepth 1 -type f -name "*.pkg.tar.*" -print 2>/dev/null)
if [[ -n ${FIND_PKG_TAR} ]]; then
pacsync --updated
pacinstall --yolo --file ${FIND_PKG_TAR}
fi
}
exec_03_remove_once_pkg_tar(){
exec_03_install_once_pkg_tar(){
#find /memory/layer-base/*/install -maxdepth 1 -type f -name "*.pkg.tar.*" -exec pacman -U --noprogressbar --noconfirm {} + 2>/dev/null
local FIND_PATH_ONCE="/memory/layer-base/*/install/once"
local FIND_PKG_TAR=$(find ${FIND_PATH_ONCE} -maxdepth 1 -type f -name "*.pkg.tar.*" -print 2>/dev/null)
if [[ -n ${FIND_PKG_TAR} ]]; then
pacman -U --needed --noprogressbar --noconfirm ${FIND_PKG_TAR} + 2>/dev/null
fi
}
exec_04_remove_once_pkg_tar(){
local FIND_PATH="/memory/layer-base/*/install/once"
local PKG_TAR_REMOVE=
while IFS= read -ru3 -d '' SELECT_PKG_TAR; do
@ -55,4 +65,5 @@ exec_03_remove_once_pkg_tar(){
exec_01_init_pacman_gpg $@
exec_02_install_pkg_tar $@
exec_03_remove_once_pkg_tar $@
#exec_03_install_once_pkg_tar $@
exec_04_remove_once_pkg_tar $@

@ -26,7 +26,7 @@ SOURCE=${SYSCONF}/theme; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null
BACKGROUND_DE_DEFAULT="/usr/share/backgrounds/background.jpg"
lightdm_gtk_greeter_background(){
[[ -f /etc/lightdm/lightdm-gtk-greeter.conf ]] || return 0
[[ -f /usr/bin/lightdm ]] || return 0
FILE_LIGHTDM_GTK_GREATER_CONF="/etc/lightdm/lightdm-gtk-greeter.conf.d/101-background-ubconfig.conf"
rm -f ${FILE_LIGHTDM_GTK_GREATER_CONF}
#Глобально заменить фон: install -Dm0644 ${BACKGROUND_DM} ${BACKGROUND_DM_DEFAULT}
@ -64,8 +64,37 @@ EOF
fi
}
gdm_background(){
[[ -f /usr/bin/gdm ]] || return 0
PATH_TEMP="$(mktemp --directory --tmpdir gnome-theme-ubconfig.XXXX)"
trap 'rm -rf "${PATH_TEMP}"' EXIT
cd ${PATH_TEMP}
SOURCE_GRESOURCE=/usr/share/gnome-shell/gnome-shell-theme.gresource
for SELECT_FILE in $(gresource list ${SOURCE_GRESOURCE}); do
gresource extract ${SOURCE_GRESOURCE} ${SELECT_FILE} > ${PATH_TEMP}/${SELECT_FILE#"/org/gnome/shell/theme"/}
done
## Make list files gresource 'gnome-shell-theme.gresource.xml'
LIST_FILE_XML="$(find "${PATH_TEMP}" -type f -printf " <file>%P</file>\n")"
cat <<EOF >"${PATH_TEMP}/gnome-shell-theme.gresource.xml"
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell/theme">
${LIST_FILE_XML}
</gresource>
</gresources>
EOF
# Modify .css
LINE_1='background: #282828 url("file:///usr/share/backgrounds/dm.jpg"); background-size: cover; background-repeat: no-repeat; background-position: center;'
#LINE_2='background: #282828 url("resource:///org/gnome/shell/theme/dm.jpg"); background-size: cover; background-repeat: no-repeat; background-position: center;'
for SELECT_CSS in ${PATH_TEMP}/*.css; do
sed -Ez "s/#lockDialogGroup \{[^}]+/#lockDialogGroup \{$(ere_quote_sed ${LINE_1})/g" -i "${SELECT_CSS}"
done
glib-compile-resources --sourcedir "${PATH_TEMP}" "${PATH_TEMP}/gnome-shell-theme.gresource.xml"
mv "${PATH_TEMP}/gnome-shell-theme.gresource" "${SOURCE_GRESOURCE}"
}
sddm_background(){
[[ -f /etc/sddm/sddm.conf ]] || return 0
[[ -f /usr/bin/sddm ]] || return 0
}
@ -86,4 +115,5 @@ sddm_background(){
[[ -f ${BACKGROUND_DM} ]] && file "${BACKGROUND_DM}" 2>/dev/null | grep -qE 'image|bitmap' || BACKGROUND_DM=${BACKGROUND_DM_DEFAULT}
lightdm_gtk_greeter_background
io_elementary_greeter_background
gdm_background
sddm_background

@ -28,15 +28,16 @@ SOURCE=${SYSCONF}/desktop; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null
AUTOLOGINUSER_CMDLINE=$(cmdline_value autologin) && [[ -n ${AUTOLOGINUSER_CMDLINE} ]] && AUTOLOGINUSER=${AUTOLOGINUSER_CMDLINE}
FILE_LIGHTDM_CONF="${ROOTFS}/etc/lightdm/lightdm.conf"
FILE_LIGHTDM_AUTOLOGIN_CONF="${ROOTFS}/etc/lightdm/lightdm.conf.d/100-autologin-ubconfig.conf"
FILE_GDM_AUTOLOGIN_CONF=("${ROOTFS}/etc/X11/gdm/custom.conf" "${ROOTFS}/etc/gdm/custom.conf")
FILE_SDDM_CONF=("${ROOTFS}/etc/sddm.conf.d/" "${ROOTFS}/etc/sddm.conf")
FILE_SDDM_AUTOLOGIN_CONF="${ROOTFS}/etc/sddm.conf.d/autologin-ubconfig.conf"
autologin_enable(){
grep -q "^${AUTOLOGINUSER}:" ${ROOTFS}/etc/passwd 2>/dev/null || exit 0
[[ -f ${ROOTFS}/etc/X11/gdm/custom.conf ]] && sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${AUTOLOGINUSER}/g" ${ROOTFS}/etc/X11/gdm/custom.conf
[[ -f ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc ]] && sed -i "s/^AutoLoginUser=.*/AutoLoginUser=${AUTOLOGINUSER}/g" ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc
[[ -f ${ROOTFS}/etc/sddm.conf ]] && sed -i "s/^User=.*/User=${AUTOLOGINUSER}/g" ${ROOTFS}/etc/sddm.conf
[[ -f ${ROOTFS}/etc/slim.conf ]] && sed -i "s/^default_user[[:space:]].*/default_user ${AUTOLOGINUSER}/g" ${ROOTFS}/etc/slim.conf
[[ -f ${ROOTFS}/etc/X11/slim/slim.conf ]] && sed -i "s/^default_user[[:space:]].*/default_user ${AUTOLOGINUSER}/g" ${ROOTFS}/etc/X11/slim/slim.conf
[[ -f ${ROOTFS}/etc/lxdm/lxdm.conf ]] && sed -i "s/^#autologin=.*/autologin=${AUTOLOGINUSER}/g" ${ROOTFS}/etc/lxdm/lxdm.conf
# Lightdm
if [[ -f ${FILE_LIGHTDM_CONF} ]]; then
sed "/^autologin-user=.*/d" -i ${FILE_LIGHTDM_CONF}
mkdir -p ${FILE_LIGHTDM_AUTOLOGIN_CONF%/*}
@ -49,18 +50,49 @@ EOF
${CMD_CHROOT} /usr/bin/groupadd -f ${ARG_AUTOLOGIN_IDGROUP} autologin >/dev/null 2>&1
${CMD_CHROOT} /usr/bin/gpasswd -M ${AUTOLOGINUSER} autologin >/dev/null 2>&1
fi
# GDM
for SELECT_FILE_GDM_AUTOLOGIN_CONF in ${FILE_GDM_AUTOLOGIN_CONF[@]}; do
[[ -f ${SELECT_FILE_GDM_AUTOLOGIN_CONF} ]] || continue
sed -E "/^[[:blank:]]*AutomaticLogin=.*/d; /^[[:blank:]]*AutomaticLoginEnable=.*/d" -i ${SELECT_FILE_GDM_AUTOLOGIN_CONF}
sed -E "/[daemon]/aAutomaticLogin=${AUTOLOGINUSER}" -i ${FILE_CUSTOM_CONF}
sed -E "/[daemon]/aAutomaticLoginEnable=True" -i ${FILE_CUSTOM_CONF}
done
# SDDM
find ${FILE_SDDM_CONF[0]} -type f -name "*.conf" -exec sed -E "s/^[[:blank:]]*User=.*/d" -i {} \;
[[ -f ${FILE_SDDM_CONF[1]} ]] && sed -E "s/^[[:blank:]]*User=.*/d" -i ${FILE_SDDM_CONF[1]}
install -d755 ${FILE_SDDM_AUTOLOGIN_CONF%/*}
cat <<-EOF | sed 's/^\s*\t*//' > "${FILE_SDDM_AUTOLOGIN_CONF}"
[Autologin]
User=${AUTOLOGINUSER}
Session=default
EOF
# KDE4
[[ -f ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc ]] && sed -i "s/^AutoLoginUser=.*/AutoLoginUser=${AUTOLOGINUSER}/g" ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc
}
autologin_disable(){
[[ -f ${ROOTFS}/etc/X11/gdm/custom.conf ]] && sed -i "s/^AutomaticLogin=.*//g" ${ROOTFS}/etc/X11/gdm/custom.conf
[[ -f ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc ]] && sed -i "s/^AutoLoginUser=.*//g" ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc
[[ -f ${ROOTFS}/etc/sddm.conf ]] && sed -i "s/^User=.*//g" ${ROOTFS}/etc/sddm.conf
for SELECT_FILE_GDM_AUTOLOGIN_CONF in ${FILE_GDM_AUTOLOGIN_CONF[@]}; do
[[ -f ${SELECT_FILE_GDM_AUTOLOGIN_CONF} ]] || continue
sed -E "/^[[:blank:]]*AutomaticLogin=.*/d; /^[[:blank:]]*AutomaticLoginEnable=.*/d" -i ${SELECT_FILE_GDM_AUTOLOGIN_CONF}
done
[[ -f ${ROOTFS}/etc/slim.conf ]] && sed -i "s/^default_user[[:space:]].*//g" ${ROOTFS}/etc/slim.conf
[[ -f ${ROOTFS}/etc/X11/slim/slim.conf ]] && sed -i "s/^default_user[[:space:]].*//g" ${ROOTFS}/etc/X11/slim/slim.conf
[[ -f ${ROOTFS}/etc/lxdm/lxdm.conf ]] && sed -i "s/^autologin=.*//g" ${ROOTFS}/etc/lxdm/lxdm.conf
# Lightdm
if [[ -f ${FILE_LIGHTDM_CONF} ]]; then
sed "/^autologin-user=.*/d" -i ${FILE_LIGHTDM_CONF}
rm -f "${FILE_LIGHTDM_AUTOLOGIN_CONF}"
fi
# GDM
for SELECT_FILE_GDM_AUTOLOGIN_CONF in ${FILE_GDM_AUTOLOGIN_CONF[@]}; do
[[ -f ${SELECT_FILE_GDM_AUTOLOGIN_CONF} ]] || continue
sed -E "/^[[:blank:]]*AutomaticLogin=.*/d; /^[[:blank:]]*AutomaticLoginEnable=.*/d" -i ${SELECT_FILE_GDM_AUTOLOGIN_CONF}
done
# SDDM
find ${FILE_SDDM_CONF[0]} -type f -name "*.conf" -exec sed -E "s/^[[:blank:]]*User=.*/d" -i {} \;
[[ -f ${FILE_SDDM_CONF[1]} ]] && sed -E "s/^[[:blank:]]*User=.*/d" -i ${FILE_SDDM_CONF[1]}
[[ -f ${FILE_SDDM_AUTOLOGIN_CONF} ]] && rm -f ${FILE_SDDM_AUTOLOGIN_CONF}
# KDE4
[[ -f ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc ]] && sed -i "s/^AutoLoginUser=.*//g" ${ROOTFS}/usr/share/ublinux/kde4/share/config/kdm/kdmrc
}
if [[ -z ${AUTOLOGINUSER} ]]; then

@ -0,0 +1,21 @@
#!/usr/bin/bash
#
# Author: Dmitry Razumov <asmeron@ublinux.com>
# Copyright (c) 2021-2025 UBLinux <support@ublinux.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Used as a source
ENABLED=yes
if [[ ${ENABLED} == "yes" ]]; then
if [[ $(readlink -fq /usr/bin/init 2>/dev/null) =~ "lib/systemd/systemd"$ ]]; then
set -a
eval "$(systemctl --user show-environment)"
set +a
systemctl --user import-environment DISPLAY XAUTHORITY
fi
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fi
fi

@ -8,10 +8,11 @@
# Used as a source
ENABLED=yes
[[ ${ENABLED} == "yes" ]] || { return 0 2>/dev/null && return 0 || exit 0; }
if [[ ${ENABLED} == "yes" ]]; then
DEFAULT_CONF=$(< /usr/lib/ublinux/default)
[[ ${DEFAULT_CONF} =~ (^|$'\n')[[:blank:]]*SYSCONF=([^$|$'\n']+)[[:blank:]]*($|$'\n') ]] && SYSCONF=${BASH_REMATCH[2]} || SYSCONF="/etc/sysconf"
[[ ${DEFAULT_CONF} =~ (^|$'\n')[[:blank:]]*BACKGROUND_DE=([^$|$'\n']+)[[:blank:]]*($|$'\n') ]] && BACKGROUND_DE=${BASH_REMATCH[2]} || BACKGROUND_DE=
SOURCE=${SYSCONF}/config; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null
SOURCE=${SYSCONF}/desktop; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null
@ -60,13 +61,14 @@ gnome_background(){
[[ -f /usr/share/xsessions/gnome.desktop ]] || return 0
# Определяет способ отрисовки изображения для фона рабочего стола. Возможные значения: «none», «wallpaper», «centered», «scaled», «stretched», «zoom», «spanned».
case ${BACKGROUND_DE_MODE} in
0) BACKGROUND_DE_MODE_PANTHEON="zoom" ;;
1) BACKGROUND_DE_MODE_PANTHEON="scaled" ;;
2) BACKGROUND_DE_MODE_PANTHEON="stretched" ;;
*) BACKGROUND_DE_MODE_PANTHEON="zoom" ;;
0) BACKGROUND_DE_MODE_GNOME="zoom" ;;
1) BACKGROUND_DE_MODE_GNOME="scaled" ;;
2) BACKGROUND_DE_MODE_GNOME="stretched" ;;
*) BACKGROUND_DE_MODE_GNOME="zoom" ;;
esac
gsettings set org.gnome.desktop.background picture-uri "file://${BACKGROUND_DE}"
gsettings set org.gnome.desktop.background picture-options "${BACKGROUND_DE_MODE_PANTHEON}"
gsettings set org.gnome.desktop.background picture-uri-dark "file://${BACKGROUND_DE}"
gsettings set org.gnome.desktop.background picture-options "${BACKGROUND_DE_MODE_GNOME}"
}
pantheon_background(){
[[ -f /usr/share/xsessions/pantheon.desktop ]] || return 0
@ -78,6 +80,7 @@ pantheon_background(){
*) BACKGROUND_DE_MODE_PANTHEON="zoom" ;;
esac
gsettings set org.gnome.desktop.background picture-uri "file://${BACKGROUND_DE}"
gsettings set org.gnome.desktop.background picture-uri-dark "file://${BACKGROUND_DE}"
gsettings set org.gnome.desktop.background picture-options "${BACKGROUND_DE_MODE_PANTHEON}"
}
lxde_background(){
@ -97,7 +100,7 @@ cinammon_background(){
##### MAIN #####
################
if [[ -n ${BACKGROUND_DE} && ${BACKGROUND_DE} != @(none|no|disable) ]]; then
if [[ -n ${BACKGROUND_DE} && ${BACKGROUND_DE} != @(none|no|disable|" ") ]]; then
if [[ -d ${BACKGROUND_DE} ]]; then
BACKGROUND_DE=$(ls -p ${BACKGROUND_DE} | grep -v / | shuf -n 1)
elif [[ ${BACKGROUND_DE} =~ ^'#'......$ ]]; then
@ -116,7 +119,7 @@ cinammon_background(){
mate_background
cinammon_background
fi
fi

@ -0,0 +1,112 @@
#!/usr/bin/bash
#
# Author: Dmitry Razumov <asmeron@ublinux.com>
# Copyright (c) 2021-2025 UBLinux <support@ublinux.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Used as a source
ENABLED=yes
if [[ ${ENABLED} == "yes" ]]; then
DEFAULT_CONF=$(< /usr/lib/ublinux/default)
[[ ${DEFAULT_CONF} =~ (^|$'\n')[[:blank:]]*SYSCONF=([^$|$'\n']+)[[:blank:]]*($|$'\n') ]] && SYSCONF=${BASH_REMATCH[2]} || SYSCONF="/etc/sysconf"
SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
SOURCE=${SYSCONF}/video; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
##
##XFCE x11
## SESSION_MANAGER=local/ubpc-1:@/tmp/.ICE-unix/12234,unix/ubpc-1:/tmp/.ICE-unix/12234
## DESKTOP_SESSION=xfce
## DESKTOP_SESSION=gnome-flashback-metacity
## XDG_MENU_PREFIX=gnome-
## XDG_SEAT=seat0
## XDG_SESSION_DESKTOP=xfce
## XDG_SESSION_DESKTOP=gnome-flashback-metacity
## XDG_SESSION_TYPE=x11
## XDG_CURRENT_DESKTOP=XFCE
## XDG_CURRENT_DESKTOP=GNOME-Flashback:GNOME
## XDG_VTNR=2
## XDG_SESSION_ID=28
## XAUTHORITY=/run/user/1000/gdm/Xauthority
## DISPLAY=:0
##Gnome wayland
## SESSION_MANAGER=local/ubpc-1:@/tmp/.ICE-unix/12234,unix/ubpc-1:/tmp/.ICE-unix/12234
## DESKTOP_SESSION=gnome
## XDG_MENU_PREFIX=gnome-
## XDG_SEAT=seat0
## XDG_SESSION_DESKTOP=gnome
## XDG_SESSION_TYPE=wayland
## XDG_CURRENT_DESKTOP=GNOME
## XDG_VTNR=2
## XDG_SESSION_ID=8
##TTY
## XDG_SESSION_TYPE=tty
## TERM=xterm-256color
## XDG_SESSION_ID=24
##
if [[ -n ${XDG_SESSION_DESKTOP} && ${XDG_SESSION_TYPE} == "x11" && -n ${DISPLAY} ]]; then
## Parametrs:
## cvt , gtf , reduced|r , auto , preferred , off , primary , mode:1920x1080
## lo|LeftOf:{name} , ro|RightOf:{name} , ab|Above:{name} , be|Below:{name} , rotate:normal|left|right|invert
[[ $(declare -p XRANDR_MONITOR 2>/dev/null) =~ ^"declare -A" ]] || declare -gA XRANDR_MONITOR
[[ ${#XRANDR_MONITOR[@]} -ne 0 ]] && for VIDEO_PORT in "${!XRANDR_MONITOR[@]}"; do
SOFT_MODELINE="gtf"
SOFT_MODELINE_R=
while read VIDEO_PORT_PARAM; do
MODELINE=
if grep -Eiq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
if [[ -n ${SOFT_MODELINE_R} ]]; then
MODELINE=$(cvt -r $(sed 's/\([0-9]* [0-9]*\) .*/\1/' <<< ${VIDEO_PORT_PARAM//x/ }) | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //')
SOFT_MODELINE_R=
elif [[ ${SOFT_MODELINE} == "cvt" ]]; then
MODELINE=$(cvt ${VIDEO_PORT_PARAM//x/ } | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //')
else
if grep -Eiq "^[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
MODELINE=$(gtf ${VIDEO_PORT_PARAM//x/ } 60 | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //')
else
MODELINE=$(gtf ${VIDEO_PORT_PARAM//x/ } | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //')
fi
fi
elif grep -Eiq "^cvt$" <<< "${VIDEO_PORT_PARAM}"; then
SOFT_MODELINE="cvt"
elif grep -Eiq "^gtf$" <<< "${VIDEO_PORT_PARAM}"; then
SOFT_MODELINE="gtf"
elif grep -Eiq "^reduced|r$" <<< "${VIDEO_PORT_PARAM}"; then
SOFT_MODELINE_R="reduced"
elif grep -Eiq "^auto$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --auto
elif grep -Eiq "^preferred$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --preferred
elif grep -Eiq "^off$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --off
elif grep -Eiq "^primary$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --primary
elif grep -Eiq "^mode:[0-9x_]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM})
elif grep -Eiq "^mode:[0-9x_]*:[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM}) --rate $(cut -d: -f3 <<< ${VIDEO_PORT_PARAM})
elif grep -Eiq "^lo:[[:alnum:]]*$|^LeftOf:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --left-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
elif grep -Eiq "^ro:[[:alnum:]]*$|^RightOf:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --right-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
elif grep -Eiq "^ab:[[:alnum:]]*$|^Above:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --above $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
elif grep -Eiq "^be:[[:alnum:]]*$|^Below:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --below $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
elif grep -Eiq "^Rotate:[[:alpha:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --rotate $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
fi
if [[ -n ${MODELINE} ]]; then
xrandr --newmode ${MODELINE}
xrandr --addmode ${VIDEO_PORT^^} $(cut -d" " -f1 <<< ${MODELINE})
xrandr --output ${VIDEO_PORT^^} --mode $(cut -d" " -f1 <<< ${MODELINE})
fi
done < <(tr ',' '\n' <<< "${XRANDR_MONITOR[${VIDEO_PORT}]}")
done
fi
fi

@ -0,0 +1,33 @@
#!/usr/bin/bash
#
# Author: Dmitry Razumov <asmeron@ublinux.com>
# Copyright (c) 2021-2025 UBLinux <support@ublinux.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Used as a source
ENABLED=yes
#[[ ${ENABLED} == "yes" ]] || { return 0 2>/dev/null && return 0 || exit 0; }
if [[ ${ENABLED} == "yes" ]]; then
## Если в профиле пользователя имеется файл "${XDG_CONFIG_HOME}/locale.conf" или "${HOME}/.config/locale.conf",
## то установить указанною локаль на терущую сессию и обновить пути XDG каталогов под локаль
set_user_locale(){
[[ -n $1 ]] && LOCALE_USER_FILE=$1 || return 0
[[ $(< "${LOCALE_USER_FILE}") =~ (^|$'\n')LANG=([^$|$'\n']+)($|$'\n') ]] && LANG_USER=${BASH_REMATCH[2],,}
LOCALEDEF_LIST="$(localedef --list-archive)"
LOW_LOCALEDEF_LIST="${LOCALEDEF_LIST,,}"
if [[ "${LOW_LOCALEDEF_LIST//-/}" =~ (^|$'\n')"${LANG_USER//-/}"($|$'\n') ]]; then
unset LANG
source /etc/profile.d/locale.sh
command -v xdg-user-dirs-update &>/dev/null && xdg-user-dirs-update --force
fi
}
if [[ -n "${XDG_CONFIG_HOME}" && -r "${XDG_CONFIG_HOME}/locale.conf" ]]; then
set_user_locale "${XDG_CONFIG_HOME}/locale.conf"
elif [[ -n "${HOME}" && -r "${HOME}/.config/locale.conf" ]]; then
set_user_locale "${HOME}/.config/locale.conf"
fi
fi

@ -3,6 +3,6 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# rc.xorg
# Во время запуска X, но до загрузки DE
# rc.profile
# Во время запуска /etc/profile.d/, в момент загрузки DE DM
# Выполняются в порядке очереди отсортированной по именам файлов, от имени авторизируемого пользователя

@ -1,22 +0,0 @@
#!/usr/bin/bash
#
# Author: Dmitry Razumov <asmeron@ublinux.com>
# Copyright (c) 2021-2025 UBLinux <support@ublinux.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Used as a source
ENABLED=yes
[[ ${ENABLED} == "yes" ]] || { return 0 2>/dev/null && return 0 || exit 0; }
if [[ $(readlink -fq /usr/bin/init 2>/dev/null) =~ "lib/systemd/systemd"$ ]]; then
set -a
eval "$(systemctl --user show-environment)"
set +a
systemctl --user import-environment DISPLAY XAUTHORITY
fi
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fi

@ -1,77 +0,0 @@
#!/usr/bin/bash
#
# Author: Dmitry Razumov <asmeron@ublinux.com>
# Copyright (c) 2021-2025 UBLinux <support@ublinux.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Used as a source
ENABLED=yes
[[ ${ENABLED} == "yes" ]] || { return 0 2>/dev/null && return 0 || exit 0; }
DEFAULT_CONF=$(< /usr/lib/ublinux/default)
[[ ${DEFAULT_CONF} =~ (^|$'\n')[[:blank:]]*SYSCONF=([^$|$'\n']+)[[:blank:]]*($|$'\n') ]] && SYSCONF=${BASH_REMATCH[2]} || SYSCONF="/etc/sysconf"
SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
SOURCE=${SYSCONF}/video; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null
## Parametrs:
## cvt , gtf , reduced|r , auto , preferred , off , primary , mode:1920x1080
## lo|LeftOf:{name} , ro|RightOf:{name} , ab|Above:{name} , be|Below:{name} , rotate:normal|left|right|invert
[[ $(declare -p XRANDR_MONITOR 2>/dev/null) =~ ^"declare -A" ]] || declare -gA XRANDR_MONITOR
[[ ${#XRANDR_MONITOR[@]} -ne 0 ]] && for VIDEO_PORT in "${!XRANDR_MONITOR[@]}"; do
SOFT_MODELINE="gtf"
SOFT_MODELINE_R=
while read VIDEO_PORT_PARAM; do
MODELINE=
if grep -Eiq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
if [[ -n ${SOFT_MODELINE_R} ]]; then
MODELINE=$(cvt -r $(sed 's/\([0-9]* [0-9]*\) .*/\1/' <<< ${VIDEO_PORT_PARAM//x/ }) | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //')
SOFT_MODELINE_R=
elif [[ ${SOFT_MODELINE} == "cvt" ]]; then
MODELINE=$(cvt ${VIDEO_PORT_PARAM//x/ } | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //')
else
if grep -Eiq "^[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
MODELINE=$(gtf ${VIDEO_PORT_PARAM//x/ } 60 | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //')
else
MODELINE=$(gtf ${VIDEO_PORT_PARAM//x/ } | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //')
fi
fi
elif grep -Eiq "^cvt$" <<< "${VIDEO_PORT_PARAM}"; then
SOFT_MODELINE="cvt"
elif grep -Eiq "^gtf$" <<< "${VIDEO_PORT_PARAM}"; then
SOFT_MODELINE="gtf"
elif grep -Eiq "^reduced|r$" <<< "${VIDEO_PORT_PARAM}"; then
SOFT_MODELINE_R="reduced"
elif grep -Eiq "^auto$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --auto
elif grep -Eiq "^preferred$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --preferred
elif grep -Eiq "^off$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --off
elif grep -Eiq "^primary$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --primary
elif grep -Eiq "^mode:[0-9x_]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM})
elif grep -Eiq "^mode:[0-9x_]*:[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM}) --rate $(cut -d: -f3 <<< ${VIDEO_PORT_PARAM})
elif grep -Eiq "^lo:[[:alnum:]]*$|^LeftOf:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --left-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
elif grep -Eiq "^ro:[[:alnum:]]*$|^RightOf:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --right-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
elif grep -Eiq "^ab:[[:alnum:]]*$|^Above:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --above $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
elif grep -Eiq "^be:[[:alnum:]]*$|^Below:[[:alnum:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --below $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
elif grep -Eiq "^Rotate:[[:alpha:]]*$" <<< "${VIDEO_PORT_PARAM}"; then
xrandr --output ${VIDEO_PORT^^} --rotate $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^})
fi
if [[ -n ${MODELINE} ]]; then
xrandr --newmode ${MODELINE}
xrandr --addmode ${VIDEO_PORT^^} $(cut -d" " -f1 <<< ${MODELINE})
xrandr --output ${VIDEO_PORT^^} --mode $(cut -d" " -f1 <<< ${MODELINE})
fi
done < <(tr ',' '\n' <<< "${XRANDR_MONITOR[${VIDEO_PORT}]}")
done

@ -1,31 +0,0 @@
#!/usr/bin/bash
#
# Author: Dmitry Razumov <asmeron@ublinux.com>
# Copyright (c) 2021-2025 UBLinux <support@ublinux.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Used as a source
ENABLED=yes
[[ ${ENABLED} == "yes" ]] || { return 0 2>/dev/null && return 0 || exit 0; }
## Если в профиле пользователя имеется файл "${XDG_CONFIG_HOME}/locale.conf" или "${HOME}/.config/locale.conf",
## то установить указанною локаль на терущую сессию и обновить пути XDG каталогов под локаль
set_user_locale(){
[[ -n $1 ]] && LOCALE_USER_FILE=$1 || return 0
[[ $(< "${LOCALE_USER_FILE}") =~ (^|$'\n')LANG=([^$|$'\n']+)($|$'\n') ]] && LANG_USER=${BASH_REMATCH[2],,}
LOCALEDEF_LIST="$(localedef --list-archive)"
LOW_LOCALEDEF_LIST="${LOCALEDEF_LIST,,}"
if [[ "${LOW_LOCALEDEF_LIST//-/}" =~ (^|$'\n')"${LANG_USER//-/}"($|$'\n') ]]; then
unset LANG
source /etc/profile.d/locale.sh
command -v xdg-user-dirs-update &>/dev/null && xdg-user-dirs-update --force
fi
}
if [[ -n "${XDG_CONFIG_HOME}" && -r "${XDG_CONFIG_HOME}/locale.conf" ]]; then
set_user_locale "${XDG_CONFIG_HOME}/locale.conf"
elif [[ -n "${HOME}" && -r "${HOME}/.config/locale.conf" ]]; then
set_user_locale "${HOME}/.config/locale.conf"
fi

@ -32,7 +32,17 @@ if [[ -d ${SYSTEMDFILES} && -d ${ROOTFS}/usr/lib/ublinux/systemd ]]; then
done 3< <(ls -1d ${ROOTFS}/usr/lib/ublinux/systemd/*.wants | sed "s%${ROOTFS}/usr/lib/ublinux/systemd/%%")
fi
ln -sf /usr/lib/ublinux/rc.d/rc.xorg ${ROOTFS}/etc/X11/xinit/xinitrc.d/00-ublinux-rc-xorg
#ln -sf /usr/lib/ublinux/rc.d/rc.profile ${ROOTFS}/etc/X11/xinit/xinitrc.d/00-ublinux-rc-profile
cat > ${ROOTFS}/etc/profile.d/zzz-ublinux-rc.profile.sh << EOF
#
# Author: Dmitry Razumov <asmeron@ublinux.com>
# Copyright (c) 2021-2025 UBLinux <support@ublinux.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
/usr/lib/ublinux/rc.d/rc.profile "$@"
EOF
cat > ${ROOTFS}/etc/xdg/autostart/ublinux-rc.desktop << EOF
[Desktop Entry]

@ -1528,6 +1528,8 @@ VERSION=
## org.freedesktop.login1.reboot
## org.freedesktop.login1.reboot-multiple-sessions
## org.freedesktop.login1.reboot-ignore-inhibit
## org.freedesktop.login1.power-off
## org.freedesktop.login1.power-off-multiple-sessions
## org.freedesktop.login1.set-reboot-parameter
## org.freedesktop.login1.set-reboot-to-boot-loader-entry
## org.freedesktop.login1.set-reboot-to-boot-loader-menu
@ -1883,7 +1885,7 @@ VERSION=
# Доступные темы: ublinux(по умолчанию) ublinux-green ublinux-dark
#THEME=ublinux
## Выбор обоев рабочего стола: XFCE4, Plasma
## Выбор обоев рабочего стола: XFCE4, Plasma, Gnome, Pantheon
## BACKGROUND_DE=none|no|disable|</dir/file>|</dir/subdir>
## none|no|disable # Отключить сборку векторных фирменных обоев /usr/share/backgrounds/background.jpg
## </dir/file> # Выбранный файл установить как обои
@ -1892,7 +1894,7 @@ VERSION=
## Если параметр не задан, то фирменные обои по умолчанию собираются в /usr/share/backgrounds/background.jpg
#BACKGROUND_DE=/mnt/livedata/ublinux-data/backgrounds/wallpapers/
## Метод масштабирования: XFCE4, Plasma
## Метод масштабирования: XFCE4, Plasma, Gnome, Pantheon
## * =0 # Растянуть с обрезкой (по умолчанию)
## =1 # Растянуть пропорционально
## =2 # Растянуть с нарушением пропорций

Loading…
Cancel
Save