From 6de1ddf4a8b21b72da3b934cc327c49f123d2c9f Mon Sep 17 00:00:00 2001 From: Mahesh Asolkar Date: Mon, 20 Dec 2021 14:44:41 -0800 Subject: [PATCH 1/2] DWL updates * Added support for displaying unoccupied tags * DWL log file writing * Added support for locking screan after 10 min idle --- dwl.entourage | 5 +++++ dwl.session | 1 + dwltags.pl | 44 ++++++++++++++++++++++++++------------------ 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/dwl.entourage b/dwl.entourage index 5bbb9ac..7f9e261 100755 --- a/dwl.entourage +++ b/dwl.entourage @@ -52,6 +52,11 @@ done # ---------------------------------------------------------- swaybg --mode fill --image ~/.config/wallpaper.jpg & +# ---------------------------------------------------------- +# Lock when idle +# ---------------------------------------------------------- +swayidle -w timeout 600 swaylock & + # ---------------------------------------------------------- # Redirect STDIN to STDOUT and pass along to tags script # ---------------------------------------------------------- diff --git a/dwl.session b/dwl.session index a0ab200..df9ed96 100755 --- a/dwl.session +++ b/dwl.session @@ -4,6 +4,7 @@ echo $XDG_RUNTIME_DIR used for Wayland session export WLR_LIBINPUT_NO_DEVICES=1 # export DWLTAGS_SHOW_MON=1 export PATH=~/bin:$PATH +# export DWL_LOG_VERBOSE=1 echo "Session: in $XDG_RUNTIME_DIR" >> $DWL_LOG_FILE env diff --git a/dwltags.pl b/dwltags.pl index 546aede..b9b2ab3 100755 --- a/dwltags.pl +++ b/dwltags.pl @@ -9,6 +9,9 @@ use Getopt::Long; my $info = {}; my $tags_file = $ENV{'DWL_TAGS_FILE'}; +my $dwl_log_h = FileHandle->new(">> " . $ENV{'DWL_LOG_FILE'}); +die "Could not open $ENV{'DWL_LOG_FILE'} to append" unless (defined $dwl_log_h); +$dwl_log_h->autoflush(); my @mons = map { /^([\w-]+)/; $1 } grep { /^([\w-]+)/ } `wlr-randr`; @@ -18,18 +21,22 @@ GetOptions("file=s" => \$tags_file) # Color scheme is only used in ANSI mode # _f/_g: class is used in JSON mode to be used in style.css for styling my $colorscheme = { - 'norm_f' => '#ffffff', - 'norm_b' => '#111111', - 'sel_f' => '#ffffff', - 'sel_b' => '#aa4444', + 'occ_f' => '#ffffff', + 'occ_b' => '#111111', + 'occsel_f' => '#ffffff', + 'occsel_b' => '#aa4444', + 'unocc_f' => '#ffffff', + 'unocc_b' => '#888888', + 'unoccsel_f' => '#ffffff', + 'unoccsel_b' => '#aa8888', 'mon_f' => '#000000', 'mon_b' => '#777777', 'lay_f' => '#111111', 'lay_b' => '#77aaaa', 'title_f' => '#ffcccc', 'title_b' => '#111111' - # 'norm_f' => 'white', - # 'norm_b' => 'black', + # 'occ_f' => 'white', + # 'occ_b' => 'black', # 'sel_f' => 'black', # 'sel_b' => 'red', # 'mon_f' => 'black', @@ -46,7 +53,7 @@ for my $mon (@mons) { print_tags({ 'selmon' => '1', 'mon' => $mon, - 'tags' => '1 1', + 'tags' => '0 1', 'title' => '', 'layout' => '[]=' }, $tags_file . "." . $mon); @@ -56,7 +63,9 @@ while (<>) { my $line = $_; chomp $line; - # print_log("DWLTAGS [VV] : $line"); + if (exists $ENV{'DWL_LOG_VERBOSE'}) { + print_log("DWLTAGS [VV] : $line"); + } if (my ($mon, $key, $val) = $line =~ /^(\S+)\s+(\S+)\s(.*)$/) { $info->{$key} = $val; @@ -82,14 +91,15 @@ sub print_tags { if (my ($tuse, $tsel) = $info->{'tags'} =~ /(\d+)\s+(\d+)/) { my $tags = ""; - for (my $i = 0; $i < $numtags; $i++) { - my $sel = "norm"; + for (my $i = 0; $i < ($numtags-1); $i++) { + my $sel = "unocc"; if (($tuse & (1 << $i))) { - if ($tsel & (1 << $i)) { - $sel = "sel"; - } - $tags .= getformatted($sel, " ". ($i+1) . " "); + $sel = "occ"; } + if ($tsel & (1 << $i)) { + $sel .= "sel"; + } + $tags .= getformatted($sel, " ". ($i+1) . " "); } if (exists $ENV{'DWLTAGS_SHOW_MON'}) { @@ -137,9 +147,7 @@ sub dzen_colored { sub print_log { my ($line) = @_; - my $fh = FileHandle->new(">> " . $ENV{'DWL_LOG_FILE'}); - if (defined $fh) { - print $fh $line . "\n"; - $fh->close; + if (defined $dwl_log_h) { + print $dwl_log_h $line . "\n"; } } From ebd4c493c76e34a1aeba2e39fd5d3a16771c8cce Mon Sep 17 00:00:00 2001 From: Mahesh Asolkar Date: Mon, 20 Dec 2021 14:46:29 -0800 Subject: [PATCH 2/2] Added ligature prints --- colors.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/colors.sh b/colors.sh index 7a27842..8d6844b 100755 --- a/colors.sh +++ b/colors.sh @@ -29,6 +29,13 @@ U+E0B2 \xee\x82\xb2 Leftwards black arrowhead (U+2B82 \xe2\xae\x82 ) U+E0B3 \xee\x82\xb3 Leftwards arrowhead (U+2B83 \xe2\xae\x83 )\n\ " +echo -e "Ligature support:\n\ + -> -----> ----------> <---------- <----- <-\n\ + => =====> ==========> <========== <===== <=\n\ + +++++\n\ + >= <= !=\n\ +" + echo -e "Default \e[39mDefault\e[0m" echo -e "Default \e[30mBlack\e[0m" echo -e "Default \e[31mRed\e[0m"