nixers
2bwm border colors script - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Development & Graphics (https://nixers.net/Forum-Development-Graphics)
+--- Forum: Programming On Unix (https://nixers.net/Forum-Programming-On-Unix)
+--- Thread: 2bwm border colors script (/Thread-2bwm-border-colors-script)


2bwm border colors script - dkeg - 05-07-2015

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


RE: 2bwm border colors script - enephst - 05-07-2015

Looks good!
Would you recommend 2bwm? I've seen lots of people using it and it looks really nice.
Im thinking about switching now...


RE: 2bwm border colors script - dkeg - 05-07-2015

Persnally, yes, I would recommend. But my needs I'm sure are different from yours. For me it has been the most comfortble invisible wm. It was a lot to knock cwm off that perch, but it seems it has. Its my goto wm.


RE: 2bwm border colors script - enephst - 05-07-2015


What needs does it not fulfill?


RE: 2bwm border colors script - venam - 06-07-2015

(05-07-2015, 06:11 PM)enephst Wrote: What needs does it not fulfill?

It's missing good multiple monitors workflow. Probably because I stopped using multiple monitors and didn't care about it.

At the moment it just extends the current workspace across the monitors and you can teleport the window from one workspace to another.

What I want to implement, and didn't work on, is a different set of workspaces per monitor by splitting the 10 workspaces across them. For example, if you have 2 monitors then workspaces 1 to 5 are mapped to the first monitor and 6 to 0 for the other one. This leaves the problem that you can't have more than 10 monitors but I guess that's not a big issue.


RE: 2bwm border colors script - enephst - 06-07-2015


Doesn't matter to me because I'm on a laptop!
I gave up my multi monitor battle station in favor of a laptop because I love to walk around and do computing on the go.
Based on the readme on github: you mention that its buggy, anything I need to look out for?


RE: 2bwm border colors script - venam - 06-07-2015

(06-07-2015, 10:09 AM)enephst Wrote: Doesn't matter to me because I'm on a laptop!
I gave up my multi monitor battle station in favor of a laptop because I love to walk around and do computing on the go.
Based on the readme on github: you mention that its buggy, anything I need to look out for?
Nothing specific, no. It used to be buggy and I just left that mention to avoid having to deal with nagging.


RE: 2bwm border colors script - dkeg - 18-07-2015

I had to update the OP. I found a flaw. It seems to working correctly now. If you try it out I would be happy to hear any feedback.