Compare commits

..

4 Commits

Author SHA1 Message Date
7301a83a83 Rename DWL starter 2021-05-29 16:43:47 -07:00
381321a9d9 Import XDG env variables into DWL service 2021-05-29 16:43:05 -07:00
0e7225343f DWL clean up 2021-05-29 16:08:06 -07:00
f395651a46 DWL environment updates 2021-05-29 15:40:00 -07:00
6 changed files with 61 additions and 38 deletions

View File

@ -1,42 +1,44 @@
#!/usr/bin/env bash
echo "Entourage: $XDG_RUNTIME_DIR - $DWLTAGS_FILE" >> $XDG_RUNTIME_DIR/dwl.log
echo "Entourage: $XDG_RUNTIME_DIR - $DWL_TAGS_FILE" >> $DWL_LOG_FILE
# ----------------------------------------------------------
# Let DWL start
# ----------------------------------------------------------
while [ ! -e "$XDG_RUNTIME_DIR/wayland-0.lock" ]
do
echo "DWL getting ready..." >> $XDG_RUNTIME_DIR/dwl.log
echo "DWL getting ready..." >> $DWL_LOG_FILE
sleep 1
done
echo "DWL ready!" >> $XDG_RUNTIME_DIR/dwl.log
echo "Entourage: " $DWLTAGS_FILE >> $XDG_RUNTIME_DIR/dwl.log
echo "DWL ready!" >> $DWL_LOG_FILE
echo "Entourage: " $DWL_TAGS_FILE >> $DWL_LOG_FILE
# ----------------------------------------------------------
# Top bar for displaying DWL tags
# TODO: Dependency - needs inotify-tools package
touch $DWLTAGS_FILE
inotifywait -q -m -e close_write $DWLTAGS_FILE |
(cat $DWLTAGS_FILE ;
# ----------------------------------------------------------
# Dependency - needs inotify-tools package
touch $DWL_TAGS_FILE
inotifywait -q -m -e close_write $DWL_TAGS_FILE |
(cat $DWL_TAGS_FILE ;
while read -r filename event; do
cat $DWLTAGS_FILE
cat $DWL_TAGS_FILE
done) | dtao -z -z -ta l -h 22 -fn 'Iosevka Term:style=Regular:size=12' &
ps all >> $XDG_RUNTIME_DIR/dwl.log
export INOTIFYPID=$(ps all | grep inotifywait | grep -v grep | tail -1 | awk '{print $3}')
echo "inotifywait: " $INOTIFYPID >> $XDG_RUNTIME_DIR/dwl.log
# ----------------------------------------------------------
# Bottom bar for displaying context information
# ----------------------------------------------------------
(conky -c ~/.conkyrc) | dtao -b -z -z -ta r -h 20 -fn 'Iosevka Term:style=Regular:size=12' &
export CONKYPID=$!
echo "conky: " $CONKYPID >> $XDG_RUNTIME_DIR/dwl.log
# ----------------------------------------------------------
# Background
# ----------------------------------------------------------
swaybg --mode fill --image ~/.config/wallpaper.jpg &
echo "swaybg: " $! >> $XDG_RUNTIME_DIR/dwl.log
# ----------------------------------------------------------
# Redirect STDIN to STDOUT and pass along to tags script
# ----------------------------------------------------------
(while read line
do
echo $line
done) | dwltags.pl --file $DWLTAGS_FILE
done) | dwltags.pl --file $DWL_TAGS_FILE

View File

@ -1,5 +1,5 @@
# Systemd service to start DWL
# --
# ----------------------------------------------------------
#
# Put this file in following directory:
#
@ -12,20 +12,31 @@
# # Start DWL
# RUNTIME_DIR=$(mktemp --directory --suffix=.${USER})
#
# systemctl --user import-environment && \
# systemctl --wait --user start dwl@${RUNTIME_DIR}.service && \
# rm -rf ${RUNTIME_DIR}
# # Escape slashes in the path
# SNAME=$(systemd-escape ${RUNTIME_DIR}.service)
#
# # Start service blocking. Remove runtime directory upon completion.
# # Be sure to import XDG session variables for graphical-session to work
# systemctl --user import-environment XDG_SEAT && \
# systemctl --user import-environment XDG_SESSION_TYPE && \
# systemctl --user import-environment XDG_SESSION_CLASS && \
# systemctl --user import-environment XDG_VTNR && \
# systemctl --user import-environment XDG_SESSION_ID && \
# systemctl --wait --user start dwl@${SNAME} && \
# rm -rf ${RUNTIME_DIR}
[Unit]
Description=DWL service
Description=DWL session service
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
[Service]
Type=oneshot
EnvironmentFile=-%h/.config/dwl/env
ExecStart=/home/mahesh/bin/dwl.session %I
Environment=XDG_RUNTIME_DIR=%I
Environment=DWL_TAGS_FILE=%I/dwl.tags
Environment=DWL_LOG_FILE=%I/dwl.log
Environment=DWLTAGS_FMT=DZEN
ExecStart=/home/mahesh/bin/dwl.session
Restart=on-failure
RestartSec=1
TimeoutStopSec=10

View File

@ -1,16 +1,10 @@
#!/usr/bin/env bash
export XDG_RUNTIME_DIR=$1
echo $XDG_RUNTIME_DIR used for Wayland session
export WLR_LIBINPUT_NO_DEVICES=1
export PATH=~/bin:$PATH
export DWLTAGS_FILE=${XDG_RUNTIME_DIR}/dwl.tags.${USER}.out
# export DWLTAGS_FMT=TXT # Waybar uses this
export DWLTAGS_FMT=DZEN
echo "Session: in $1 " $DWLTAGS_FILE
echo "Session: " $DWLTAGS_FILE >> $XDG_RUNTIME_DIR/dwl.log
echo "Session: in $XDG_RUNTIME_DIR" >> $DWL_LOG_FILE
env
exec /usr/local/bin/dwl -s $HOME/bin/dwl.entourage

17
dwl.start Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Start DWL
RUNTIME_DIR=$(mktemp --directory --suffix=.${USER})
# Escape slashes in the path
SNAME=$(systemd-escape ${RUNTIME_DIR}.service)
# Start service blocking. Remove runtime directory upon completion.
# Be sure to import XDG session variables for graphical-session to work
systemctl --user import-environment XDG_SEAT && \
systemctl --user import-environment XDG_SESSION_TYPE && \
systemctl --user import-environment XDG_SESSION_CLASS && \
systemctl --user import-environment XDG_VTNR && \
systemctl --user import-environment XDG_SESSION_ID && \
systemctl --wait --user start dwl@${SNAME} && \
rm -rf ${RUNTIME_DIR}

View File

@ -8,8 +8,7 @@ use FileHandle;
use Getopt::Long;
my $info = {};
my $tags_file = $ENV{'DWLTAGS_FILE'};
my $log_file = $ENV{'XDG_RUNTIME_DIR'} . "/dwl.log";
my $tags_file = $ENV{'DWL_TAGS_FILE'};
GetOptions("file=s" => \$tags_file)
or die("Command line usage error");
@ -133,7 +132,7 @@ sub dzen_colored {
sub print_log {
my ($line) = @_;
my $fh = FileHandle->new(">> " . $ENV{'XDG_RUNTIME_DIR'} . "/dwl.log");
my $fh = FileHandle->new(">> " . $ENV{'DWL_LOG_FILE'});
if (defined $fh) {
print $fh $line . "\n";
$fh->close;

View File

@ -43,7 +43,7 @@ ${if_existing /sys/class/net/enp3s0/operstate up}🌐 ${addr enp3s0}${else}\
${if_existing /sys/class/net/wlp4s0/operstate up}📶 ${addr wlp4s0}${else}\
${if_up eth0}🌐 ${addr eth0}${else}\
network down ${endif}${endif}${endif} | \
${execi 600 curl wttr.in/45.54,-122.83?format="%c%t"} | \
${execi 600 curl wttr.in/~45.54,-122.83?format="%c%t"} | \
🔊 ${execi 10 amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/'} | \
🔋 ${battery_percent}% | \
${time %Y %h %d %I:%M%p %Z}