Compare commits

..

No commits in common. "7301a83a835b64f84fd5db38f860fe5efc8e0772" and "3adcb1e58be5447871bd51de98ae443f700a1d55" have entirely different histories.

6 changed files with 38 additions and 61 deletions

View File

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

View File

@ -1,5 +1,5 @@
# Systemd service to start DWL # Systemd service to start DWL
# ---------------------------------------------------------- # --
# #
# Put this file in following directory: # Put this file in following directory:
# #
@ -12,31 +12,20 @@
# # Start DWL # # Start DWL
# RUNTIME_DIR=$(mktemp --directory --suffix=.${USER}) # RUNTIME_DIR=$(mktemp --directory --suffix=.${USER})
# #
# # Escape slashes in the path # systemctl --user import-environment && \
# SNAME=$(systemd-escape ${RUNTIME_DIR}.service) # systemctl --wait --user start dwl@${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} # rm -rf ${RUNTIME_DIR}
#
[Unit] [Unit]
Description=DWL session service Description=DWL service
BindsTo=graphical-session.target BindsTo=graphical-session.target
Wants=graphical-session-pre.target Wants=graphical-session-pre.target
After=graphical-session-pre.target After=graphical-session-pre.target
[Service] [Service]
Type=oneshot Type=oneshot
Environment=XDG_RUNTIME_DIR=%I EnvironmentFile=-%h/.config/dwl/env
Environment=DWL_TAGS_FILE=%I/dwl.tags ExecStart=/home/mahesh/bin/dwl.session %I
Environment=DWL_LOG_FILE=%I/dwl.log
Environment=DWLTAGS_FMT=DZEN
ExecStart=/home/mahesh/bin/dwl.session
Restart=on-failure Restart=on-failure
RestartSec=1 RestartSec=1
TimeoutStopSec=10 TimeoutStopSec=10

View File

@ -1,10 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export XDG_RUNTIME_DIR=$1
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 PATH=~/bin:$PATH export PATH=~/bin:$PATH
echo "Session: in $XDG_RUNTIME_DIR" >> $DWL_LOG_FILE export DWLTAGS_FILE=${XDG_RUNTIME_DIR}/dwl.tags.${USER}.out
env # 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
exec /usr/local/bin/dwl -s $HOME/bin/dwl.entourage exec /usr/local/bin/dwl -s $HOME/bin/dwl.entourage

View File

@ -1,17 +0,0 @@
#!/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,7 +8,8 @@ use FileHandle;
use Getopt::Long; use Getopt::Long;
my $info = {}; my $info = {};
my $tags_file = $ENV{'DWL_TAGS_FILE'}; my $tags_file = $ENV{'DWLTAGS_FILE'};
my $log_file = $ENV{'XDG_RUNTIME_DIR'} . "/dwl.log";
GetOptions("file=s" => \$tags_file) GetOptions("file=s" => \$tags_file)
or die("Command line usage error"); or die("Command line usage error");
@ -132,7 +133,7 @@ sub dzen_colored {
sub print_log { sub print_log {
my ($line) = @_; my ($line) = @_;
my $fh = FileHandle->new(">> " . $ENV{'DWL_LOG_FILE'}); my $fh = FileHandle->new(">> " . $ENV{'XDG_RUNTIME_DIR'} . "/dwl.log");
if (defined $fh) { if (defined $fh) {
print $fh $line . "\n"; print $fh $line . "\n";
$fh->close; $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_existing /sys/class/net/wlp4s0/operstate up}📶 ${addr wlp4s0}${else}\
${if_up eth0}🌐 ${addr eth0}${else}\ ${if_up eth0}🌐 ${addr eth0}${else}\
network down ${endif}${endif}${endif} | \ 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/'} | \ 🔊 ${execi 10 amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/'} | \
🔋 ${battery_percent}% | \ 🔋 ${battery_percent}% | \
${time %Y %h %d %I:%M%p %Z} ${time %Y %h %d %I:%M%p %Z}