From fc08e510cfeffbdc2d343e9e62079669b4ca1191 Mon Sep 17 00:00:00 2001 From: unix121 Date: Mon, 1 May 2017 19:12:30 +0300 Subject: [PATCH] Script and README update --- README.md | 4 ++++ scripts/i3wmthemer | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/README.md b/README.md index 1fe52b16..56de0cab 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,10 @@ files are before you use it. ~/.dmenurc +You will still have to make some changes "by hand" even after using the script +once it's still under development and doesn't change everything on it's own. + +
  • For common issues check the issues section in the repository
  • How to use the scripts

    diff --git a/scripts/i3wmthemer b/scripts/i3wmthemer index 67ac8af6..fc87d20c 100755 --- a/scripts/i3wmthemer +++ b/scripts/i3wmthemer @@ -158,6 +158,51 @@ overwrite(){ } +# Added as a fast fix on the issue that the script would not +# Replace background and foreground in the polybar configuration +# Needs further improvements. +overwrite_exact(){ + + local f1=$1 + local f2=$2 + local l=$3 + + if local line1=$(cat $f1 | grep -w "^$l") + then + if [ ! -z "$line1" ] + then + #echo $line1 + if local line2=$(cat $f2 | grep -w "^$l") + then + if [ ! -z "$line2" ] + then + #echo $line2 + + #line=$( grep -w "$line2" $f2 ) + #replacement=$line1 + #echo $replacement + + if ! sed -i "s/$line2/$line1/g" $f2 + then + msg -f "Failed to apply change: Overwrite "$l" ." + else + msg -s "Applied change: Overwrite "$l" ." + fi + else + msg -f "Failed to apply change: Overwrite "$l" ." + fi + else + msg -f "Failed to apply change: Overwrite "$l" ." + fi + else + msg -f "Failed to apply change: Overwrite "$l" ." + fi + else + msg -f "Failed to apply change: Overwrite "$l" ." + fi + +} + configure(){ # This script will add the necessary lines to the configuration # Files in order to make those themes work. @@ -699,6 +744,8 @@ then overwrite $f1 $f2 "tray-detached" overwrite $f1 $f2 "tray-background" overwrite $f1 $f2 "wm-restack" + overwrite_exact $f1 $f2 "background" + overwrite_exact $f1 $f2 "foreground" else # Failed to located user's polybar configuration file.