Skip to content

Instantly share code, notes, and snippets.

@CIAvash
Last active December 5, 2016 11:49
Show Gist options
  • Save CIAvash/729c3ef0a30938e88cdbb8e195f3d1a0 to your computer and use it in GitHub Desktop.
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.
#!/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