2bwm border colors script - Programming On Unix

Users browsing this thread: 2 Guest(s)
dkeg
Members
Purpose: When you change your color palette do you change colors elsewhere to keep the consistency? It can be a bit of a chore to change your config.h.
I put togehter a script that when run will take your current xcolors and change your config.h, then reload using xdotool. The script takes the color options into an array, so the base script can easily be altered to choose which colors act as which border.
I have found it to be super useful. I hope you do too.
Code:
#! /bin/bash

## dkeg 2015
## 2bwmColor
## Whenever you change your xcolor run this and your 2bwm borders will keep with you chosen color scheme!
## requires xdotool

. $HOME/bin/colr

# get current xcolors
  BG="#$bg"
  FG="#$fg"
  BLK="#$blk"
  BBLK="#$bblk"
  RED="#$red"
  GRN="#$grn"
  YLW="#$ylw"
  BLU="#$blu"
  MAG="#$mag"
  CYN="#$cyn"
  WHT="#$wht"

# wm border color options; allter to your liking
  foc=$FG
  unfoc=$BLK
  fixc=$RED
  unkil=$YLW
  fixunk=$MAG
  outr=$BLK
  emp=$BG

# set paths
  dir=$HOME/git/2bwm
  file=$HOME/git/2bwm/config.h

# take the colors from the config.h and place into an array  
  wmcol=$(cat $file|grep "*colors"|awk '{print $6}'|cut -d '}' -f1|awk '{gsub(/"/," ");print $2,$4,$6,$8,$10,$12,$14}')
  arr=($wmcol)

# action
   sed -i "s/${arr[0]}/"$foc"/;
           s/${arr[1]}/"$unfoc"/;
           s/${arr[2]}/"$fixc"/;
           s/${arr[3]}/"$unkil"/;
           s/${arr[4]}/"$fixunk"/;
           s/${arr[5]}/"$outr"/;
           s/${arr[6]}/"$emp"/" $file

# compile
  cd $dir && make && sudo make install

# reload
  xdotool key "super+ctrl+r"
or grab it from github
work hard, complain less


Messages In This Thread
2bwm border colors script - by dkeg - 05-07-2015, 04:28 PM
RE: 2bwm border colors script - by enephst - 05-07-2015, 05:41 PM
RE: 2bwm border colors script - by dkeg - 05-07-2015, 06:09 PM
RE: 2bwm border colors script - by enephst - 05-07-2015, 06:11 PM
RE: 2bwm border colors script - by venam - 06-07-2015, 03:32 AM
RE: 2bwm border colors script - by enephst - 06-07-2015, 10:09 AM
RE: 2bwm border colors script - by venam - 06-07-2015, 01:22 PM
RE: 2bwm border colors script - by dkeg - 18-07-2015, 04:57 PM