#!/bin/bash current_uid=$(id -u) if [ "$current_uid" -eq 0 ]; then echo "please run as a normal user" exit 1 fi tab=$'\t' kde_conf="${HOME}/.config/kwinrc" if [ -e "$kde_conf" ]; then true else echo "file $kde_conf not exist" exit 1 fi confline_Xrander="Backend=XRender" sed -in "/\[Compositing\]/,/^$/{/^[[:space:]]*Backend=/{d}}" ${kde_conf} sed -in "/\[Compositing\]/a\\${confline_Xrander}" ${kde_conf} echo "all changes have been made, please reboot to take effect"