Multi monitor support in DWL

This commit is contained in:
Mahesh Asolkar 2021-05-31 22:23:35 -07:00
parent b84e9ff6ee
commit d89f1eb34b
3 changed files with 40 additions and 21 deletions

View File

@ -2,6 +2,12 @@
echo "Entourage: $XDG_RUNTIME_DIR - $DWL_TAGS_FILE" >> $DWL_LOG_FILE echo "Entourage: $XDG_RUNTIME_DIR - $DWL_TAGS_FILE" >> $DWL_LOG_FILE
# Dual screen
wlr-randr --output HDMI-A-1 --on --pos 0,0 --output eDP-1 --on --pos 1680,0
# Single laptop screen
# wlr-randr --output HDMI-A-1 --off --output eDP-1 --on --pos 0,0
# ---------------------------------------------------------- # ----------------------------------------------------------
# Let DWL start # Let DWL start
# ---------------------------------------------------------- # ----------------------------------------------------------
@ -13,21 +19,28 @@ done
echo "DWL ready!" >> $DWL_LOG_FILE echo "DWL ready!" >> $DWL_LOG_FILE
echo "Entourage: " $DWL_TAGS_FILE >> $DWL_LOG_FILE echo "Entourage: " $DWL_TAGS_FILE >> $DWL_LOG_FILE
DISPLAYS=$(wlr-randr | perl -ne 'print "$1 " if /^([\w-]+)/')
DISP_NUM=$(expr 0)
for DISP in $DISPLAYS; do
DISP_NUM=$(expr $DISP_NUM + 1)
TF=${DWL_TAGS_FILE}.${DISP}
# ---------------------------------------------------------- # ----------------------------------------------------------
# Top bar for displaying DWL tags # Top bar for displaying DWL tags
# ---------------------------------------------------------- # ----------------------------------------------------------
# Dependency - needs inotify-tools package # Dependency - needs inotify-tools package
touch $DWL_TAGS_FILE echo "Entourage: Monitor - ${DISP_NUM} ${DISP}, new tags file " ${TF} >> $DWL_LOG_FILE
inotifywait -q -m -e close_write $DWL_TAGS_FILE | touch ${TF}
(cat $DWL_TAGS_FILE ; inotifywait -q -m -e close_write ${TF} |
(cat ${TF} ;
while read -r filename event; do while read -r filename event; do
cat $DWL_TAGS_FILE cat ${TF}
done) | dtao -z -z -ta l -tw 100 -expand r -h 22 -fn 'Iosevka Term:style=Regular:size=12' & done) | dtao -z -z -xs ${DISP_NUM} -ta l -tw 100 -expand r -h 22 -fn 'Iosevka Term:style=Regular:size=12' &
# ---------------------------------------------------------- # ----------------------------------------------------------
# Bottom bar for displaying context information # Bottom bar for displaying context information
# ---------------------------------------------------------- # ----------------------------------------------------------
(conky -c ~/.conkyrc) | dtao -ta r -tw 100 -expand l -h 22 -fn 'Iosevka Term:style=Regular:size=12' & (conky -c ~/.conkyrc) | dtao -xs ${DISP_NUM} -ta r -tw 100 -expand l -h 22 -fn 'Iosevka Term:style=Regular:size=12' &
done
# ---------------------------------------------------------- # ----------------------------------------------------------
# Background # Background

View File

@ -2,6 +2,7 @@
echo $XDG_RUNTIME_DIR used for Wayland session echo $XDG_RUNTIME_DIR used for Wayland session
export WLR_LIBINPUT_NO_DEVICES=1 export WLR_LIBINPUT_NO_DEVICES=1
# export DWLTAGS_SHOW_MON=1
export PATH=~/bin:$PATH export PATH=~/bin:$PATH
echo "Session: in $XDG_RUNTIME_DIR" >> $DWL_LOG_FILE echo "Session: in $XDG_RUNTIME_DIR" >> $DWL_LOG_FILE

View File

@ -10,6 +10,8 @@ use Getopt::Long;
my $info = {}; my $info = {};
my $tags_file = $ENV{'DWL_TAGS_FILE'}; my $tags_file = $ENV{'DWL_TAGS_FILE'};
my @mons = map { /^([\w-]+)/; $1 } grep { /^([\w-]+)/ } `wlr-randr`;
GetOptions("file=s" => \$tags_file) GetOptions("file=s" => \$tags_file)
or die("Command line usage error"); or die("Command line usage error");
@ -40,12 +42,15 @@ my $colorscheme = {
print_log("DWLTAGS: $tags_file"); print_log("DWLTAGS: $tags_file");
for my $mon (@mons) {
print_tags({ print_tags({
'selmon' => '1', 'selmon' => '1',
'mon' => $mon,
'tags' => '1 1', 'tags' => '1 1',
'title' => '', 'title' => '',
'layout' => '[]=' 'layout' => '[]='
}, $tags_file); }, $tags_file . "." . $mon);
}
while (<>) { while (<>) {
my $line = $_; my $line = $_;
@ -59,7 +64,7 @@ while (<>) {
# Commit a status # Commit a status
# Assumption: layout is the last piece of information dumped by DWL # Assumption: layout is the last piece of information dumped by DWL
$info->{'mon'} = $mon; $info->{'mon'} = $mon;
print_tags($info, $tags_file); print_tags($info, $tags_file.".".$mon);
$info = {}; $info = {};
} }