Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-tools
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-tools
Commits
8bb340ce
Verified
Commit
8bb340ce
authored
Aug 15, 2025
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ximper-create-configs -> ximperconf
parent
b923299a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
248 additions
and
84 deletions
+248
-84
README.md
README.md
+2
-2
ximper-create-configs
bin/ximper-create-configs
+0
-80
ximperconf
bin/ximperconf
+244
-0
ximper-create-configs.service
data/userunits/ximper-create-configs.service
+1
-1
makefile
makefile
+1
-1
No files found.
README.md
View file @
8bb340ce
...
...
@@ -13,8 +13,8 @@ The set of utilities used in Ximper Linux includes various tools that help speed
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
### ximper
conf
Ximper Linux configuration management utility.
## License
...
...
bin/ximper-create-configs
deleted
100755 → 0
View file @
b923299a
#!/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
bin/ximperconf
0 → 100755
View file @
8bb340ce
#!/usr/bin/env bash
set
-euo
pipefail
SCRIPT_NAME
=
"
$(
basename
"
$0
"
)
"
print_error
()
{
printf
"
\0
33[1;31m%s
\0
33[0m
\n
"
"
$1
"
exit
1
}
print_green
()
{
printf
"
\0
33[1;32m%s
\0
33[0m
\n
"
"
$1
"
;
}
print_yellow
()
{
printf
"
\0
33[1;33m%s
\0
33[0m
\n
"
"
$1
"
;
}
print_blue
()
{
printf
"
\0
33[1;34m%s
\0
33[0m
\n
"
"
$1
"
;
}
print_red
()
{
printf
"
\0
33[1;31m%s
\0
33[0m
\n
"
"
$1
"
;
}
print_white
()
{
printf
"
\0
33[0m%s
\0
33[0m
\n
"
"
$1
"
;
}
show_help
()
{
print_green
"Использование:"
print_white
"
$SCRIPT_NAME
<команда> [аргументы]"
print_white
""
print_blue
"Общие команды:"
print_white
" help | -h | --help Показать эту справку"
print_white
""
print_blue
"Доступные команды:"
print_white
" create Создать конфигурацию"
print_yellow
" base Базовую конфигурацию"
print_yellow
" hyprland Конфигурацию Hyprland"
print_white
""
print_white
" hyprland Управление модулями Hyprland"
print_blue
" Флаги:"
print_yellow
" --user Использовать пользовательские модули"
print_yellow
" enable <модуль> Включить модуль"
print_yellow
" disable <модуль> Отключить модуль"
print_yellow
" status <модуль> Статус модуля"
print_yellow
" list Список модулей"
print_blue
" Флаги:"
print_yellow
" --enabled Вывести включенные модули"
print_yellow
" --disabled Вывести отключенные модули"
print_white
""
print_blue
"Примеры:"
print_white
"
$SCRIPT_NAME
create base"
print_white
"
$SCRIPT_NAME
create hyprland"
print_white
"
$SCRIPT_NAME
hyprland enable theme"
print_white
"
$SCRIPT_NAME
hyprland enable --user theme"
print_white
"
$SCRIPT_NAME
hyprland disable theme"
print_white
"
$SCRIPT_NAME
hyprland status theme"
print_white
"
$SCRIPT_NAME
hyprland list"
print_white
"
$SCRIPT_NAME
hyprland list --user"
print_white
"
$SCRIPT_NAME
hyprland list --user --enabled"
exit
0
}
create_base
()
{
print_green
"Создаётся базовая конфигурация..."
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
()
{
print_green
"Создаётся конфигурация Hyprland..."
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
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
"
[
!
-e
"
$src
"
]
&&
return
if
[
!
-e
"
$dest
"
]
;
then
mkdir
-p
"
$(
dirname
"
$dest
"
)
"
ln
-s
"
$src
"
"
$dest
"
print_blue
"Создана ссылка:
$dest
→
$src
"
else
print_yellow
"Уже существует:
$dest
— пропущено"
fi
}
hyprland_get_module_file
()
{
local
module
=
"
$1
"
local
user
=
"
${
2
:-
false
}
"
if
[
"
$user
"
=
true
]
;
then
echo
"
$HOME
/.config/hypr/
${
module
}
.conf"
else
echo
"/etc/ximperdistro/hyprland/hypr/
${
module
}
.conf"
fi
}
hyprland_module_status
()
{
local
module
=
"
$1
"
local
user
=
"
${
2
:-
false
}
"
local
conf
=
"
$HOME
/.config/hypr/hyprland.conf"
local
sys_file
sys_file
=
$(
hyprland_get_module_file
"
$module
"
"
$user
"
)
local
line_full
=
"source =
$sys_file
"
local
line_tilde
=
"source = ~
${
sys_file
#
$HOME
}
"
[
!
-f
"
$sys_file
"
]
&&
{
print_red
"Модуль '
$module
' не найден:
$sys_file
"
return
}
[
!
-f
"
$conf
"
]
&&
{
echo
"disabled"
return
}
if
grep
-qE
"^[[:space:]]*
${
line_full
}
"
"
$conf
"
||
grep
-qE
"^[[:space:]]*
${
line_tilde
}
"
"
$conf
"
;
then
echo
"enabled"
else
echo
"disabled"
fi
}
hyprland_toggle_module
()
{
local
action
=
"
$1
"
local
module
=
"
$2
"
local
user
=
"
${
3
:-
false
}
"
local
conf
=
"
$HOME
/.config/hypr/hyprland.conf"
local
sys_file
sys_file
=
$(
hyprland_get_module_file
"
$module
"
"
$user
"
)
local
line_full
=
"source =
$sys_file
"
local
line_tilde
=
"source = ~
${
sys_file
#
$HOME
}
"
[
!
-f
"
$sys_file
"
]
&&
print_error
"Модуль '
$module
' не найден:
$sys_file
"
mkdir
-p
"
$(
dirname
"
$conf
"
)
"
touch
"
$conf
"
if
[
"
$action
"
=
"enable"
]
;
then
if
grep
-qE
"^[[:space:]]*
${
line_full
}
"
"
$conf
"
||
grep
-qE
"^[[:space:]]*
${
line_tilde
}
"
"
$conf
"
;
then
print_yellow
"Модуль '
$module
' уже включён"
return
fi
if
grep
-qE
"^[[:space:]]*#
\s
*
${
line_full
}
"
"
$conf
"
;
then
sed
-i
"s|^[[:space:]]*#
\s
*
${
line_full
}
|
${
line_full
}
|"
"
$conf
"
elif
grep
-qE
"^[[:space:]]*#
\s
*
${
line_tilde
}
"
"
$conf
"
;
then
sed
-i
"s|^[[:space:]]*#
\s
*
${
line_tilde
}
|
${
line_full
}
|"
"
$conf
"
else
echo
"
$line_tilde
"
>>
"
$conf
"
fi
print_green
"Модуль '
$module
' включён"
elif
[
"
$action
"
=
"disable"
]
;
then
if
grep
-qE
"^[[:space:]]*#
\s
*
${
line_full
}
"
"
$conf
"
||
grep
-qE
"^[[:space:]]*#
\s
*
${
line_tilde
}
"
"
$conf
"
;
then
print_yellow
"Модуль '
$module
' уже отключён"
return
fi
if
grep
-qE
"^[[:space:]]*
${
line_full
}
"
"
$conf
"
;
then
sed
-i
"s|^[[:space:]]*
${
line_full
}
|#
${
line_full
}
|"
"
$conf
"
elif
grep
-qE
"^[[:space:]]*
${
line_tilde
}
"
"
$conf
"
;
then
sed
-i
"s|^[[:space:]]*
${
line_tilde
}
|#
${
line_full
}
|"
"
$conf
"
else
print_yellow
"Модуль '
$module
' не найден в конфигурации"
fi
print_green
"Модуль '
$module
' отключён"
fi
}
hyprland_list_modules
()
{
local
user
=
"
${
1
:-
false
}
"
local
filter
=
"
${
2
:-
all
}
"
# all | enabled | disabled
local dir
if
[
"
$user
"
=
true
]
;
then
dir
=
"
$HOME
/.config/hypr"
else
dir
=
"/etc/ximperdistro/hyprland/hypr"
fi
[
!
-d
"
$dir
"
]
&&
print_error
"Каталог с модулями не найден:
$dir
"
for
f
in
"
$dir
"
/
*
.conf
;
do
[
-e
"
$f
"
]
||
continue
local
module
module
=
$(
basename
"
$f
"
.conf
)
case
"
$module
"
in
hyprland
|
hypridle
|
hyprlock
|
hyprpaper
|
hyprsunset
)
continue
;;
esac
local
status
status
=
$(
hyprland_module_status
"
$module
"
"
$user
"
)
if
[
"
$filter
"
=
"enabled"
]
&&
[
"
$status
"
!=
"enabled"
]
;
then continue
;
fi
if
[
"
$filter
"
=
"disabled"
]
&&
[
"
$status
"
!=
"disabled"
]
;
then continue
;
fi
case
"
$status
"
in
enabled
)
print_green
"
$module
"
;;
disabled
)
print_yellow
"
$module
"
;;
*
)
print_red
"
$module
"
;;
esac
done
}
cmd
=
"
${
1
:-}
"
subcmd
=
"
${
2
:-}
"
shift
2
||
true
case
"
$cmd
"
in
create
)
case
"
$subcmd
"
in
base
)
create_base
;;
hyprland
)
create_hyprland
;;
""
)
print_error
"Ошибка: не указано, что создавать"
;;
*
)
print_error
"Неизвестная конфигурация:
$subcmd
"
;;
esac
;;
hyprland
)
user_flag
=
false
if
[
"
${
1
:-}
"
=
"--user"
]
;
then
user_flag
=
true
shift
fi
case
"
$subcmd
"
in
enable
)
hyprland_toggle_module
enable
"
$1
"
"
$user_flag
"
;;
disable
)
hyprland_toggle_module disable
"
$1
"
"
$user_flag
"
;;
status
)
hyprland_module_status
"
$1
"
"
$user_flag
"
;;
list
)
list_filter
=
"all"
for
arg
in
"
$@
"
;
do
case
"
$arg
"
in
--user
)
user_flag
=
true
;;
--enabled
)
list_filter
=
"enabled"
;;
--disabled
)
list_filter
=
"disabled"
;;
esac
done
hyprland_list_modules
"
$user_flag
"
"
$list_filter
"
;;
esac
;;
help
|
-h
|
--help
)
show_help
;;
*
)
echo
"Неизвестная команда:
$cmd
"
show_help
exit
1
;;
esac
data/userunits/ximper-create-configs.service
View file @
8bb340ce
...
...
@@ -4,7 +4,7 @@ After=graphical.target
[Service]
Type=oneshot
ExecStart=/usr/bin/ximper
-create-configs --
base
ExecStart=/usr/bin/ximper
conf create
base
RemainAfterExit=yes
[Install]
...
...
makefile
View file @
8bb340ce
...
...
@@ -3,7 +3,7 @@ bindir ?= $(prefix)/bin
userunitdir
?=
$(prefix)
/lib/systemd/user
DESTDIR
?=
EXECUTABLES
=
wm-xdg-autostart ximper
-create-configs
EXECUTABLES
=
wm-xdg-autostart ximper
conf
USERUNITS
=
ximper-create-configs
all
:
install
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment