Last active
December 5, 2016 11:49
-
-
Save CIAvash/729c3ef0a30938e88cdbb8e195f3d1a0 to your computer and use it in GitHub Desktop.
A simple script for printing bspwm workspaces with Pango markup, to be used with Yabar status bar.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use autodie; | |
open my $bspwm_data, '-|', 'bspc subscribe report'; | |
# Autoflush | |
$| = 1; | |
while (<$bspwm_data>) { | |
my @raw_workspaces = /[oOuUF][^:]+/g; | |
my @workspaces = map { | |
# Focused workspace | |
if (s/^[OFU]//) { | |
"<span color=\"#F03E46\">$_</span>"; | |
} | |
# Urgent workspace | |
elsif (s/^u//) { | |
"<span color=\"gold\">$_</span>"; | |
} else { | |
s/^.//r; | |
} | |
} @raw_workspaces; | |
print "@workspaces\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment