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
e4567c33
Commit
e4567c33
authored
Jun 11, 2024
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
unified-theme-switcher-service.sh
unified-theme-switcher-service.sh
+52
-0
No files found.
unified-theme-switcher-service.sh
0 → 100755
View file @
e4567c33
#!/bin/bash
updateKvantumTheme
()
{
echo
"Updating Kvantum theme to
$1
..."
if
[
"
$1
"
==
"light"
]
;
then
kvantummanager
--set
KvGnome
elif
[
"
$1
"
==
"dark"
]
;
then
kvantummanager
--set
KvGnomeDark
fi
}
updateGTK3Theme
()
{
echo
"Updating GTK3 theme to
$1
..."
if
[
"
$1
"
==
"light"
]
;
then
gsettings
set
org.gnome.desktop.interface gtk-theme
'adw-gtk3'
elif
[
"
$1
"
==
"dark"
]
;
then
gsettings
set
org.gnome.desktop.interface gtk-theme
'adw-gtk3-dark'
fi
}
# Function to check and update the theme
checkAndUpdateTheme
()
{
currentTheme
=
$(
gsettings get org.gnome.desktop.interface color-scheme |
awk
-F
"'"
'{print $2}'
)
if
[
"
$currentTheme
"
==
"default"
]
;
then
updateKvantumTheme
"light"
updateGTK3Theme
"light"
else
updateKvantumTheme
"dark"
updateGTK3Theme
"dark"
fi
}
# Initial check and update
checkAndUpdateTheme
count
=
0
dbus-monitor
"interface='org.freedesktop.portal.Settings',member=SettingChanged"
|
\
while
IFS
=
read
-r
line
;
do
theme
=
$(
echo
"
$line
"
|
grep
-E
-o
'string "(prefer-dark|default)"'
)
if
[
-n
"
$theme
"
]
;
then
((
count++
))
if
[
$((
$count
%
2
))
=
0
]
;
then
echo
"
$theme
"
checkAndUpdateTheme
count
=
0
fi
fi
done
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