Feature request - different border colors/width for different workspaces
Last one for now.
This is actually a mistake on my part. I jumbled the gap and border commands when skimming dkrc. You can different gaps for different workspaces. I think I misremembered it as different border colors for different workspaces.
That sounds like a cool feature though. Could we have that? It could be a useful indicator of which workspace you’re on.
Comments (7)
-
repo owner -
reporter Gotcha. Now that you spell it out like that though, would this make more sense as a separate command in my sxhkdrc? It doesn’t really need to read out the status and fire off a hook.
-
repo owner I don't think so.
Here's the script to do just this but I won't be adding it as an internal thing, I've also added the script to the examples in
doc/
#!/bin/bash # simple script to change dk border colour based on the workspace # written by Nathaniel Maia, 2020 # example usage bind with sxhkd # alt + {_,shift + ,ctrl + }{1-9,0} # /path/to/script ws {view,send,follow} {1-9,10} if (( $# == 0 )); then echo "usage: $0 [action] <gap_width>" exit 2 fi currentws() { awk '{ if (!s && $1 == "workspaces:") { for (i = 1; i <= NF; i++) { if ($i ~ "*") { sub(/\*/, ""); gsub(/:[a-z]* /, " "); s = $i; } } } else if (s && $1 == s) { sub(/:.*/, ""); print $0; exit; } }' <(dkcmd status type=full num=1) } if [[ $1 =~ (view|send|follow) ]]; then [[ $1 == send ]] && { dkcmd ws "$1" "$2"; exit; } action="$1" shift else action="send" fi (( $1 == $(currentws) )) && exit 0 case "$1" in [1-5]) typeset -A col=( [f]='#6699cc' [u]='#ee5555' [uf]='#444444' [of]='#222222' [ou]='#222222' [ouf]='#222222' ) ;; [6-9]|0) typeset -A col=( [f]='#ee5555' [u]='#6699cc' [uf]='#444444' [of]='#222222' [ou]='#222222' [ouf]='#222222' ) ;; esac dkcmd set border colour focus="${col[f]}" urgent="${col[u]}" unfocus="${col[uf]}" \ outer_focus="${col[of]}" outer_urgent="${col[ou]}" outer_unfocus="${col[ouf]}" || exit dkcmd ws "$action" "$1"
-
reporter
TY for this. It’s also inspiring me to put more effort into learning awk.
-
repo owner Glad it solves the issue.
awk is by far one of the greatest programs ever created, I use it a ton, it mixes a bit of shell with a bit of C. It's very good at text/files where simple stuff like grep/sed aren't powerful enough to do things like loops and general programming.
-
repo owner I did notice one issue with my script implementation, multi-mon setups will always have one border colour across borders depending on which workspace is active. Not ideal but for now I'm willing to put up with it given the use case.
-
repo owner - changed status to resolved
- Log in to comment
It definitely could be added as an internal setting but I feel it would get messy having to specify X border colours for X workspaces or defining a default to use when unspecified. I'll definitely think about it more before coming to a conclusion but this seems like a good candidate for a little scripting. Most users won't need it anyhow so something that defines it externally and just calls out to dkcmd set border colour each time a workspace switch occurs.
I can probably whip up something tonight just as a proof of concept and see if it actually works properly. I don't see why not as the status command allows scripts to stay up to date on the wm state, see some of the example scripts for an idea.