darkman: use /etc/os-release instead of lsb_release for distribution ID and RELEASE_ID

This commit is contained in:
Aminda Suomalainen 2024-08-14 13:02:59 +03:00
parent 4893c54c33
commit 63d7930002
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q
5 changed files with 24 additions and 20 deletions

View File

@ -2,12 +2,12 @@
set -x set -x
if ! hash lsb_release 2> /dev/null; then #if ! hash lsb_release 2> /dev/null; then
ERRORMESSAGE="lsb_release was not found, the wallpaper scripts cannot figure out the distribution" # ERRORMESSAGE="lsb_release was not found, the wallpaper scripts cannot figure out the distribution"
echo "$ERRORMESSAGE" # echo "$ERRORMESSAGE"
notify-send --app-name=darkman --icon=error "$ERRORMESSAGE" # notify-send --app-name=darkman --icon=error "$ERRORMESSAGE"
exit 0 # exit 0
fi #fi
#if ! hash kvantummanager 2> /dev/null; then #if ! hash kvantummanager 2> /dev/null; then
# ERRORMESSAGE="kvantummanager wasn't found, Qt theme switching won't work!" # ERRORMESSAGE="kvantummanager wasn't found, Qt theme switching won't work!"
@ -16,12 +16,16 @@ fi
# exit 0 # exit 0
#fi #fi
export DISTROID="$(lsb_release -si)" #export DISTROID="$(lsb_release -si)"
export DISTROREL="$(lsb_release -sr)" #export DISTROREL="$(lsb_release -sr)"
if [ -f /etc/os-release ]; then
. /etc/os-release
fi
export DARKMANGET="$(darkman get)" export DARKMANGET="$(darkman get)"
printf "Distribution: $DISTROID\nRelease: $DISTROREL\nMode: $DARKMANGET\n" printf "Distribution: $ID\nRelease: $VERSION_ID\nMode: $DARKMANGET\n"
if [[ "$DARKMANGET" -eq "light" ]]; then if [[ "$DARKMANGET" -eq "light" ]]; then
notify-send --app-name="darkman" --urgency=low --icon=weather-clear-night "Teema: $DARKMANGET" notify-send --app-name="darkman" --urgency=low --icon=weather-clear-night "Teema: $DARKMANGET"

View File

@ -2,6 +2,6 @@
. ~/.local/share/dark-mode.d/00-do-not-repeat-yourself.bash . ~/.local/share/dark-mode.d/00-do-not-repeat-yourself.bash
if [[ "$DISTROID" == "Kali" ]]; then if [[ "$ID" == "kali" ]]; then
lookandfeeltool --platform offscreen --apply "Kali-Purple-Dark" lookandfeeltool --platform offscreen --apply "Kali-Purple-Dark"
fi fi

View File

@ -4,15 +4,15 @@
if [ -f ~/.wallpaper.dark ]; then if [ -f ~/.wallpaper.dark ]; then
export WALLPAPER_PATH="$HOME/.wallpaper.dark" export WALLPAPER_PATH="$HOME/.wallpaper.dark"
elif [ "$DISTROID" == "Fedora" ]; then elif [ "$ID" == "fedora" ]; then
export WALLPAPER_PATH="/usr/share/wallpapers/F$DISTROREL/contents/images_dark/3840x2160.png" export WALLPAPER_PATH="/usr/share/wallpapers/F$VERSION_ID/contents/images_dark/3840x2160.png"
elif [ "$DISTROID" == "Kali" ]; then elif [ "$ID" == "kali" ]; then
export WALLPAPER_PATH="/usr/share/wallpapers/KaliMetalDark/contents/images/3840x2160.png" export WALLPAPER_PATH="/usr/share/wallpapers/KaliMetalDark/contents/images/3840x2160.png"
fi fi
echo "Wallpaper: $WALLPAPER_PATH" echo "Wallpaper: $WALLPAPER_PATH"
if [ "$DISTROID" == "Arch" ]; then if [ "$ID" == "arch" ]; then
qdbus6 org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://'$WALLPAPER_PATH'")}' qdbus6 org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://'$WALLPAPER_PATH'")}'
else else
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://'$WALLPAPER_PATH'")}' qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://'$WALLPAPER_PATH'")}'

View File

@ -2,8 +2,8 @@
. ~/.local/share/dark-mode.d/00-do-not-repeat-yourself.bash . ~/.local/share/dark-mode.d/00-do-not-repeat-yourself.bash
if [[ "$DISTROID" == "Kali" ]]; then if [[ "$ID" == "kali" ]]; then
lookandfeeltool --platform offscreen --apply "Kali-Purple-Light" lookandfeeltool --platform offscreen --apply "Kali-Purple-Light"
elif [[ "$DISTROID" == "Fedora" ]]; then elif [[ "$ID" == "fedora" ]]; then
lookandfeeltool --platform offscreen --apply "org.fedoraproject.fedora.desktop" lookandfeeltool --platform offscreen --apply "org.fedoraproject.fedora.desktop"
fi fi

View File

@ -4,15 +4,15 @@
if [ -f ~/.wallpaper.light ]; then if [ -f ~/.wallpaper.light ]; then
export WALLPAPER_PATH="$HOME/.wallpaper.light" export WALLPAPER_PATH="$HOME/.wallpaper.light"
elif [ "$DISTROID" == "Fedora" ]; then elif [ "$ID" == "fedora" ]; then
export WALLPAPER_PATH="/usr/share/wallpapers/F$DISTROREL/contents/images/3840x2160.png" export WALLPAPER_PATH="/usr/share/wallpapers/F$RELEASE_ID/contents/images/3840x2160.png"
elif [ "$DISTROID" == "Kali" ]; then elif [ "$ID" == "kali" ]; then
export WALLPAPER_PATH="/usr/share/wallpapers/KaliMetal/contents/images/3840x2160.jpg" export WALLPAPER_PATH="/usr/share/wallpapers/KaliMetal/contents/images/3840x2160.jpg"
fi fi
echo "Wallpaper: $WALLPAPER_PATH" echo "Wallpaper: $WALLPAPER_PATH"
if [ "$DISTROID" == "Arch" ]; then if [ "$ID" == "arch" ]; then
qdbus6 org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://'$WALLPAPER_PATH'")}' qdbus6 org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://'$WALLPAPER_PATH'")}'
else else
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://'$WALLPAPER_PATH'")}' qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://'$WALLPAPER_PATH'")}'