├── .github └── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── demonstration.gif ├── setup.sh ├── uninstall.sh └── wpblur.sh /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **Distribution name:** 4 | 5 | 6 | **Plasmashell version:** 7 | 8 | 9 | 10 | **Reproduces on clean user:** yes/no 11 | 12 | **Steps to reproduce:** 13 | 14 | 1. 15 | 2. 16 | 17 | 18 | **Configuration files:** 19 | 20 | **Logs:** 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Andrey Orst 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # THIS PROJECT IS NOT MAINTAINED ANYMORE 2 | 3 | KDE PLasma 5.13 now includes quite similar feature. Though it is not automatic, like this script, yet it is stock, and not as performance hungry as this realisation. **Use it at your own risk (as always)** 4 | 5 | # 6 | 7 | # KDE Wallpaper Blur 8 | 9 | This script automatically detects when you change wallpaper in KDE Plasma, blurs it, and sets it to your lockscreen and SDDM. 10 | 11 | ![Automatic Wallpaper Blur](demonstration.gif) 12 | 13 | ### Installation 14 | 15 | You will need `inotify-tools` and `imagemagick` packages. Arch linux users can install it via `pacman -S inotify-tools imagemagick`. Other distros may include it by default. If not, check your distro wiki on how to install them. 16 | 17 | Also you will need `dbus`, and the system should be installed on a filesystem with [ACL](https://wiki.archlinux.org/index.php/Access_Control_Lists). 18 | 19 | ```bash 20 | $ git clone https://github.com/andreyorst/kde_wallpaper_blur.git ~/.kde_wallpaper_blur 21 | $ cd ~/.kde_wallpaper_blur 22 | $ ./setup.sh # this will ask for password, because there are some manipulations with SDDM files, wich requires root access 23 | ``` 24 | 25 | Installation script will create image called `.bg.png` in your `$HOME` dir, and put a symlink to it into your current sddm theme folder. Then the blur script will be set to autostart, and started for current session. 26 | No further manipulations should be needed, but if you run into some kind of trouble, please open issue with step by step guide how to reproduce it. 27 | 28 | Installation script will create backup files called \*.prewpblur in various places. Check out script output. 29 | 30 | **Multi-monitor systems**: Please note that while different wallpapers can be set for different screens, only one background can be set for the lockscreen and SDDM. Therefore, this script will only use the wallpaper from your *Primary Display*. 31 | 32 | ### Uninstall 33 | 34 | To uninstall script simply run: 35 | 36 | ```bash 37 | $ cd ~/.kde_wallpaper_blur 38 | $ ./uninstall.sh 39 | ``` 40 | 41 | Or, if you choosen different path in installation section, execute script directly form there. 42 | 43 | ### This software comes with no warranty. Use at your own risk. 44 | 45 | --- 46 | 47 | Special thanks to [@agura-lex](https://github.com/agura-lex), for his patience and bash guidance, and [@kennethso168](https://github.com/kennethso168) for implementing activity detection, and lots of improvements. 48 | -------------------------------------------------------------------------------- /demonstration.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andreyorst/kde_wallpaper_blur/039b794eb6aceca508b2b163729d69e988c87c60/demonstration.gif -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # I AM BASH NOOB PLS DONT PUNCH ME HARD 4 | 5 | BIN_PATH="/usr/bin" 6 | 7 | if ! test -f "$BIN_PATH/inotifywait" ; then 8 | echo inotify-tools not found on your system, please install inotify-tools package. 9 | exit 10 | fi 11 | 12 | if ! test -f "$BIN_PATH/convert" ; then 13 | echo convert not found on your system, please install imagemagick package. 14 | exit 15 | fi 16 | 17 | if ! test -f ~/.bg.png; then 18 | CURRENT_WP_PATH=$(./wpblur.sh currentWpPath) 19 | if [ "$CURRENT_WP_PATH" ]; then 20 | echo blurring your current wallpaper 21 | echo 22 | ./wpblur.sh blurWp "$CURRENT_WP_PATH" 23 | sleep 10 24 | else 25 | PROMPT=1 26 | echo creating dummy .bg.png in $HOME 27 | echo 28 | touch ~/.bg.png 29 | fi 30 | fi 31 | 32 | SDDM_THEME_PATH=/usr/share/sddm/themes 33 | if [[ -f /etc/sddm.conf ]]; then 34 | SDDM_THEME=$(grep 'Current=' /etc/sddm.conf | cut -f 2 -d '=') 35 | else 36 | SDDM_THEME='' 37 | fi 38 | 39 | if [[ -z "$SDDM_THEME" ]]; then 40 | echo No theme found in /etc/sddm.conf 41 | echo You can find all theme names by executing $ ls $SDDM_THEME_PATH 42 | while true; do 43 | echo -n Please specify your theme name: ; read SDDM_THEME 44 | if ! test -d $SDDM_THEME_PATH/$SDDM_THEME; then 45 | echo No theme named $SDDM_THEME found at $SDDM_THEME_PATH/ 46 | else 47 | break 48 | fi 49 | done 50 | fi 51 | 52 | SDDM_THEME_PATH=$SDDM_THEME_PATH/$SDDM_THEME 53 | 54 | if ! test -f $SDDM_THEME_PATH/.bg.png; then 55 | echo creating symlink to .bg.png in $SDDM_THEME_PATH 56 | echo 57 | sudo ln -sf ~/.bg.png $SDDM_THEME_PATH/.bg.png 58 | fi 59 | sudo chmod 777 ~/.bg.png 60 | setfacl -m u:sddm:x ~ 61 | 62 | if ! test -f $SDDM_THEME_PATH/theme.conf.user.prewpblur; then 63 | echo backuping sddm configuration files 64 | SDDM_BACKUP=1 65 | sudo mv $SDDM_THEME_PATH/theme.conf.user $SDDM_THEME_PATH/theme.conf.user.prewpblur 66 | fi 67 | 68 | echo creating sddm config 69 | if [ ! -f $SDDM_THEME_PATH/theme.conf.user ]; then 70 | sudo cp $SDDM_THEME_PATH/theme.conf $SDDM_THEME_PATH/theme.conf.user 71 | fi 72 | cat $SDDM_THEME_PATH/theme.conf.user | sed -E 's/background=.*/background=.bg.png/' | sed -E 's/type=.*/type=image/' >> /tmp/theme.conf.user 73 | 74 | # checking if backup exists 75 | sudo mv /tmp/theme.conf.user $SDDM_THEME_PATH/ 76 | 77 | echo 78 | 79 | KSCREENLOCKER=~/.config/kscreenlockerrc 80 | 81 | if test -f ~/.config/kscreenlockerrc; then 82 | #checking for kscreenlockerrc backup 83 | if ! test -f $KSCREENLOCKER.prewpblur; then 84 | echo backuping kscreenlocker configuration files 85 | KSCREENLOCKER_BACKUP=1 86 | mv $KSCREENLOCKER $KSCREENLOCKER.prewpblur 87 | fi 88 | echo generating kscreenlockerrc file 89 | echo "[$Version]" > $KSCREENLOCKER 90 | echo $(grep "update_info" $KSCREENLOCKER.prewpblur) >> $KSCREENLOCKER 91 | else 92 | echo "[$Version]" > $KSCREENLOCKER 93 | echo "update_info=kscreenlocker.upd:0.1-autolock" >> $KSCREENLOCKER 94 | fi 95 | 96 | cat <> $KSCREENLOCKER 97 | 98 | [Greeter] 99 | WallpaperPlugin=org.kde.image 100 | 101 | [Greeter][Wallpaper][org.kde.image][General] 102 | FillMode=2 103 | Image=file:///home/$USER/.bg.png 104 | EOF 105 | 106 | if ! test -d ~/.config/autostart-scripts; then 107 | mkdir ~/.config/autostart-scripts 108 | fi 109 | 110 | if test -f ~/.config/autostart-scripts/wpblur.sh; then 111 | rm ~/.config/autostart-scripts/wpblur.sh 112 | fi 113 | 114 | echo enabling script autostart 115 | echo 116 | ln -sf $(pwd)/wpblur.sh ~/.config/autostart-scripts/wpblur.sh 117 | echo script will start automatically upon next login 118 | 119 | if [[ $SDDM_BACKUP || $KSCREENLOCKER_BACKUP ]]; then 120 | echo 121 | echo backups created: 122 | if [[ $SDDM_BACKUP ]]; then 123 | echo $SDDM_THEME_PATH/theme.conf.user.prewpblur 124 | fi 125 | if [[ $KSCREENLOCKER_BACKUP ]]; then 126 | echo $KSCREENLOCKER.prewpblur 127 | fi 128 | fi 129 | 130 | if ! pgrep -x "wpblur.sh" > /dev/null; then 131 | echo 132 | echo starting script for current session 133 | $(pwd)/wpblur.sh & 134 | fi 135 | 136 | if [ $PROMPT ]; then 137 | echo 138 | echo now please change your wallpaper 139 | else 140 | echo 141 | echo ready to use 142 | fi 143 | -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BIN_PATH="/usr/bin" 4 | 5 | if test -f ~/.bg.png; then 6 | UNINSTALL_PROMPT=1 7 | echo removing ~/.bg.png 8 | rm ~/.bg.png 9 | fi 10 | SDDM_THEME_PATH=/usr/share/sddm/themes 11 | if [[ -f /etc/sddm.conf ]]; then 12 | SDDM_THEME=$(grep 'Current=' /etc/sddm.conf | cut -f 2 -d '=') 13 | else 14 | SDDM_THEME='' 15 | fi 16 | 17 | if [[ -z "$SDDM_THEME" ]]; then 18 | echo No theme found in /etc/sddm.conf 19 | echo You can find all theme names by executing $ ls $SDDM_THEME_PATH 20 | while true; do 21 | echo -n Please specify your theme name: ; read SDDM_THEME 22 | if ! test -d $SDDM_THEME_PATH/$SDDM_THEME; then 23 | echo No theme named $SDDM_THEME found at $SDDM_THEME_PATH/ 24 | else 25 | break 26 | fi 27 | done 28 | fi 29 | 30 | SDDM_THEME_PATH=$SDDM_THEME_PATH/$SDDM_THEME 31 | 32 | if test -f $SDDM_THEME_PATH/.bg.png; then 33 | UNINSTALL_PROMPT=1 34 | echo removing $SDDM_THEME_PATH/.bg.png 35 | sudo rm $SDDM_THEME_PATH/.bg.png 36 | fi 37 | 38 | if [ -f $SDDM_THEME_PATH/theme.conf.user.prewpblur ]; then 39 | echo 40 | UNINSTALL_PROMPT=1 41 | echo restoring $SDDM_THEME_PATH/theme.conf.user from backup 42 | sudo mv $SDDM_THEME_PATH/theme.conf.user.prewpblur $SDDM_THEME_PATH/theme.conf.user 43 | echo 44 | fi 45 | 46 | KSCREENLOCKER=~/.config/kscreenlockerrc 47 | 48 | if test -f ~/.config/kscreenlockerrc.prewpblur; then 49 | UNINSTALL_PROMPT=1 50 | echo restoring $KSCREENLOCKER from backup 51 | mv $KSCREENLOCKER.prewpblur $KSCREENLOCKER 52 | echo 53 | fi 54 | 55 | if test -f ~/.config/autostart-scripts/wpblur.sh; then 56 | echo 57 | UNINSTALL_PROMPT=1 58 | echo disabling script autostart 59 | rm ~/.config/autostart-scripts/wpblur.sh 60 | fi 61 | 62 | if pgrep -x "wpblur.sh" > /dev/null; then 63 | UNINSTALL_PROMPT=1 64 | echo killing existing script instances 65 | sudo pkill wpblur.sh 66 | fi 67 | 68 | if [[ $UNINSTALL_PROMPT ]]; then 69 | echo 70 | echo uninstalled succesfully 71 | else 72 | echo nothing to do 73 | fi 74 | -------------------------------------------------------------------------------- /wpblur.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function currentWpPath { 4 | curActivityId=$(qdbus org.kde.ActivityManager /ActivityManager/Activities CurrentActivity) 5 | while read containmentId; do 6 | lastDesktop=$(kreadconfig5 --file ~/.config/plasma-org.kde.plasma.desktop-appletsrc --group Containments --group $containmentId --key lastScreen) 7 | activityId=$(kreadconfig5 --file ~/.config/plasma-org.kde.plasma.desktop-appletsrc --group Containments --group $containmentId --key activityId) 8 | if [[ $lastDesktop == "0" ]] && [[ $activityId == $curActivityId ]] ; then 9 | CURRENT_WP_PATH=$(kreadconfig5 --file ~/.config/plasma-org.kde.plasma.desktop-appletsrc --group Containments --group $containmentId --group Wallpaper --group org.kde.image --group General --key Image | sed -E 's/(file:\/\/)?//') 10 | fi 11 | done <<< "$(grep -e '\[Containments]\[[0-9]*]\[Wallpaper]\[org.kde.image]\[General]' ~/.config/plasma-org.kde.plasma.desktop-appletsrc | sed 's/\[Containments\]\[//;s/]\[Wallpaper]\[org.kde.image]\[General]//')" 12 | echo "$CURRENT_WP_PATH" 13 | } 14 | 15 | function blurWp { 16 | CURRENT_WP_PATH="$1" 17 | echo "Blurring the background" 18 | convert "$CURRENT_WP_PATH" -filter Gaussian -resize 5% -define filter:sigma=2.5 -resize 2000% -attenuate 0.2 +noise Gaussian ~/.bg.png 19 | echo "Background blurring finished" 20 | } 21 | 22 | function blur { 23 | CURRENT_WP_PATH=$(currentWpPath) 24 | blurWp "$CURRENT_WP_PATH" 25 | } 26 | 27 | function run { 28 | if [ $(pidof -x wpblur.sh| wc -w) -gt 2 ]; then 29 | echo wpblur already running, exiting 30 | exit 1 31 | fi 32 | 33 | while true; do 34 | inotifywait -q ~/.config/plasma-org.kde.plasma.desktop-appletsrc -e delete_self | while read; do 35 | echo "~/.config/plasma-org.kde.plasma.desktop-appletsrc modified" 36 | blur 37 | done 38 | done & 39 | 40 | interface=org.kde.ActivityManager.Activities 41 | member=CurrentActivityChanged 42 | 43 | dbus-monitor --profile "interface='$interface',member='$member'" | 44 | while read -r line; do 45 | if [[ $line = *"CurrentActivityChanged"* ]]; then 46 | echo "Activity changed" 47 | blur 48 | fi 49 | done & 50 | 51 | sleep infinity 52 | } 53 | 54 | if [ $# -eq 0 ]; then 55 | run 56 | else 57 | $1 $2 58 | fi 59 | --------------------------------------------------------------------------------