Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-unified-theme-switcher
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
1
Merge Requests
1
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-unified-theme-switcher
Commits
8cbcef24
Commit
8cbcef24
authored
Jul 20, 2024
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added reaction mode: after changes in config file
parent
cac35223
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
15 deletions
+44
-15
ximper-unified-theme-switcher-service
service/bin/ximper-unified-theme-switcher-service
+44
-15
No files found.
service/bin/ximper-unified-theme-switcher-service
View file @
8cbcef24
...
@@ -28,6 +28,23 @@ cfg_check() {
...
@@ -28,6 +28,23 @@ cfg_check() {
fi
fi
}
}
check_gsettings_schema
()
{
local
SCHEMA
=
"org.gnome.desktop.interface"
local
KEY
=
"color-scheme"
if
gsettings list-schemas |
grep
-q
"
$SCHEMA
"
;
then
if
gsettings list-keys
"
$SCHEMA
"
|
grep
-q
"
$KEY
"
;
then
echo
"Schema '
$SCHEMA
' and KEY '
$KEY
' exist."
return
0
else
echo
"Schema '
$SCHEMA
' exists, but KEY '
$KEY
' not found."
return
1
fi
else
echo
"Schema '
$SCHEMA
' not found."
return
1
fi
}
update_kv_theme
()
{
update_kv_theme
()
{
echo
"Updating Kvantum theme to
$1
..."
echo
"Updating Kvantum theme to
$1
..."
...
@@ -80,21 +97,32 @@ check_and_update_themes() {
...
@@ -80,21 +97,32 @@ check_and_update_themes() {
check_and_update_themes
check_and_update_themes
main
()
{
main
()
{
local
COUNT
=
0
if
check_gsettings_schema
;
then
dbus-monitor
"interface='org.freedesktop.portal.Settings',member=SettingChanged"
|
\
echo
"reaction mode: after dbus signal"
while
IFS
=
read
-r
LINE
;
do
local
COUNT
=
0
local
THEME
dbus-monitor
"interface='org.freedesktop.portal.Settings',member=SettingChanged"
|
\
THEME
=
$(
echo
"
$LINE
"
|
grep
-E
-o
'string "(prefer-dark|default)"'
)
while
IFS
=
read
-r
LINE
;
do
local
THEME
if
[
-n
"
$THEME
"
]
;
then
THEME
=
$(
echo
"
$LINE
"
|
grep
-E
-o
'string "(prefer-dark|default)"'
)
((
COUNT++
))
if
[
-n
"
$THEME
"
]
;
then
if
[
$((
$COUNT
%
2
))
=
0
]
;
then
((
COUNT++
))
echo
"
$THEME
"
check_and_update_themes
if
[
$((
$COUNT
%
2
))
=
0
]
;
then
COUNT
=
0
echo
"
$THEME
"
check_and_update_themes
COUNT
=
0
fi
fi
fi
fi
done
done
else
echo
"reaction mode: after changes in config file"
local
CONFIG_FILE
=
$(
cfg_check
)
inotifywait
-m
-e
modify
"
$CONFIG_FILE
"
|
\
while
read
-r
directory events filename
;
do
check_and_update_themes
done
fi
}
}
main
main
\ No newline at end of file
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