DWL environment updates
This commit is contained in:
parent
3adcb1e58b
commit
f395651a46
@ -1,42 +1,46 @@
|
||||
#!/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
|
||||
# ----------------------------------------------------------
|
||||
export DWLTAGS_FMT=DZEN
|
||||
|
||||
(while read line
|
||||
do
|
||||
echo $line
|
||||
done) | dwltags.pl --file $DWLTAGS_FILE
|
||||
done) | dwltags.pl --file $DWL_TAGS_FILE
|
||||
|
||||
|
16
dwl.service
16
dwl.service
@ -1,5 +1,5 @@
|
||||
# Systemd service to start DWL
|
||||
# --
|
||||
# ----------------------------------------------------------
|
||||
#
|
||||
# Put this file in following directory:
|
||||
#
|
||||
@ -7,24 +7,30 @@
|
||||
#
|
||||
# Start this service with something like this:
|
||||
#
|
||||
# #
|
||||
# #!/usr/bin/env bash
|
||||
#
|
||||
# # Start DWL
|
||||
# RUNTIME_DIR=$(mktemp --directory --suffix=.${USER})
|
||||
#
|
||||
# systemctl --user import-environment && \
|
||||
# systemctl --wait --user start dwl@${RUNTIME_DIR}.service && \
|
||||
# # Escape slashes in the path
|
||||
# SNAME=$(systemd-escape ${RUNTIME_DIR}.service)
|
||||
#
|
||||
# # Start service blocking. Remove runtime directory upon completion
|
||||
# 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
|
||||
Environment=XDG_RUNTIME_DIR=%I
|
||||
Environment=DWL_TAGS_FILE=%I/dwl.tags
|
||||
Environment=DWL_LOG_FILE=%I/dwl.log
|
||||
ExecStart=/home/mahesh/bin/dwl.session %I
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
|
@ -1,16 +1,9 @@
|
||||
#!/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
|
||||
|
||||
exec /usr/local/bin/dwl -s $HOME/bin/dwl.entourage
|
||||
|
@ -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;
|
||||
|
11
start.dwl
Executable file
11
start.dwl
Executable file
@ -0,0 +1,11 @@
|
||||
#!/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
|
||||
systemctl --wait --user start dwl@${SNAME} && \
|
||||
rm -rf ${RUNTIME_DIR}
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user