Compare commits

..

5 Commits

16 changed files with 225 additions and 66 deletions

View File

@ -5,35 +5,7 @@ function log_this() {
echo "$TSTMP : " $1 >> $DWL_LOG_FILE
}
log_this "Entourage: $XDG_RUNTIME_DIR - $DWL_TAGS_FILE"
NUM_DISPS=$(wlr-randr | grep -E "^\w+" | wc -l)
log_this "Entourage: Configuring ${NUM_DISPS} displays"
if [[ $NUM_DISPS > 1 ]]; then
# Dual screen
# wlr-randr --output HDMI-A-1 --on --pos 0,0 --output eDP-1 --on --pos 0,1050
# wlr-randr --output HDMI-A-1 --on --pos 0,0 --output eDP-1 --on --pos 2560,0
# With Dell 1920x1200 display - vertical arrangement
#
# .--------------------------------.
# | |
# | DELL 24" 1920x1200 |
# | (HDMI-A-1) |
# | |
# `--------------------------------'
# | |
# | LAPTOP 13" 1366x768 |
# | (eDP-1) |
# | |
# `-------------------------'
#
wlr-randr --output HDMI-A-1 --on --pos 0,0 --output eDP-1 --on --pos 300,1200
else
# Single laptop screen
wlr-randr --output HDMI-A-1 --off --output eDP-1 --on --pos 0,0
fi
log_this "Entourage: $XDG_RUNTIME_DIR"
# ----------------------------------------------------------
# Let DWL start
@ -44,32 +16,24 @@ do
sleep 1
done
log_this "DWL ready!"
log_this "Entourage: $DWL_TAGS_FILE"
# ----------------------------------------------------------
# Background
# Background and support tasks
# ----------------------------------------------------------
# TODO: Consuimng too much CPU - keeps fan spinning
# swaybg --mode fill --image ~/.config/wallpaper.jpg &
# source ~/bin/dwl.wallpaper_setup
# ----------------------------------------------------------
# Lock when idle
# ----------------------------------------------------------
log_this "Entourage: Starting screen locker with 10min idle time"
swayidle -w timeout 600 swaylock &
source ~/bin/dwl.idle_setup
# ----------------------------------------------------------
# Redirect STDIN to STDOUT and pass along to tags script
# ----------------------------------------------------------
DWL_BAR=$DWL_BAR_PATH/somebar
log_this "Entourage: Configuring $(wlr-randr | grep -E "^\w+" | wc -l) displays"
source ~/bin/dwl.randr_setup
log_this "Entourage: Setting up notification"
source ~/bin/dwl.notification_setup
log_this "Entourage: Setting up MPD support"
source ~/bin/dwl.mpd_support_setup
export SOMEBAR_FIFO=$XDG_RUNTIME_DIR/somebar.fifo
mkfifo $SOMEBAR_FIFO -m666
log_this "Entourage: Starting somebar using $SOMEBAR_FIFO"
conky -c ~/.conkyrc > $SOMEBAR_FIFO &
(while read line
do
echo $line
done) | ($DWL_BAR -s $SOMEBAR_FIFO > $XDG_RUNTIME_DIR/somebar.log 2>&1)
source ~/bin/dwl.bar_setup

View File

@ -1,9 +1,12 @@
# Systemd service to start DWL
# ----------------------------------------------------------
#
# Put this file in following directory:
# Symlink this file in following directory as follows:
#
# ~/.config/systemd/user
# $ cd ~/.config/systemd/user
# $ ln -s <snips>/dwl.service dwl@.service
#
# Be sure to link it as a named service with (@.service)
#
# Start this service with something like this:
#

View File

@ -7,6 +7,8 @@ export DWL_PATH=/usr/local/bin
# export DWL_PATH=/home/mahesh/git/furnish/heshapps_dwl
export DWL_BAR_PATH=/usr/local/bin
# export DWL_BAR_PATH=/home/mahesh/git/somebar_20240217/build
export DWL_BAR=$DWL_BAR_PATH/somebar
export SOMEBAR_FIFO=$XDG_RUNTIME_DIR/somebar.fifo
# export DWLTAGS_SHOW_MON=1
export PATH=~/bin:$PATH

11
dwl_act
View File

@ -14,14 +14,19 @@ case $act in
vol_mute) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle;;
vol_lower) wpctl set-volume --limit 1.0 @DEFAULT_AUDIO_SINK@ 10%-;;
vol_raise) wpctl set-volume --limit 1.0 @DEFAULT_AUDIO_SINK@ 10%+;;
# mic_mute) ;;
# bright_low) ;;
# bright_high) ;;
mic_mute) rofi -show sound -modes "sound:~/bin/rofi_sound.pl";;
bright_low) echo 20 >> /sys/class/backlight/intel_backlight/brightness;;
bright_high) echo 200 >> /sys/class/backlight/intel_backlight/brightness;;
media_toggle) mpc toggle;; # XF86AudioPlay
media_stop) mpc stop;; # XF86AudioStop
media_prev) mpc prev;; # XF86AudioPrev
media_next) mpc next;; # XF86AudioNext
# disp) ;;
# wlan) ;;
# tools) ;;
# search) ;;
launch) wldash;;
# explore) ;;
# print) grim -g "$(slurp)" -t png "$(date +/tmp/grim_%d%b%Y_%H_%M_%S.png)" ;;
*) echo "Unknown action '$act'";;
esac

View File

@ -0,0 +1,9 @@
killall conky
killall somebar
mkfifo $SOMEBAR_FIFO -m666
conky -c ~/.conkyrc > $SOMEBAR_FIFO &
$DWL_BAR -s $SOMEBAR_FIFO > $XDG_RUNTIME_DIR/somebar.log 2>&1

View File

@ -0,0 +1,3 @@
swayidle -w \
timeout 600 'systemctl hybrid-sleep' &

View File

@ -0,0 +1,2 @@
musnify-mpd -h localhost -p 6600 &

View File

@ -0,0 +1,7 @@
mako --font "Iosevka Term" \
--background-color "#777777AA" \
--text-color "#EEEEEE" \
--border-color "#777777AA" \
--border-radius 5 \
--default-timeout 5000 &

View File

@ -0,0 +1,3 @@
cmd=$(get_randr.pl)
$cmd

View File

@ -0,0 +1,3 @@
swaybg --mode fill --image ~/.config/wallpaper.jpg &

View File

@ -12,7 +12,7 @@ TMP_FILE=$(mktemp $FILE_DIR/nvim.XXXXXX.appimage)
echo "Downloading latest nightly $FILE_NAME to $TMP_FILE"
# curl -L -o $TMP_FILE $FILE_URL/$FILE_NAME || die "Can't cURL $FILE_NAME"
wget -O $TMP_FILE $FILE_URL/$FILE_NAME || die "Can't cURL $FILE_NAME"
wget -O $TMP_FILE $FILE_URL/$FILE_NAME > /dev/null 2>&1 || die "Can't cURL $FILE_NAME"
chmod +x $TMP_FILE || die "Can't chmod $TMP_FILE"
@ -41,7 +41,8 @@ else
cd $FILE_DIR
$TMP_FILE --appimage-extract || die "Can't extract appimage $FILE_NAME"
echo "Extracting $NEWVER"
$TMP_FILE --appimage-extract > /dev/null 2>&1 || die "Can't extract appimage $FILE_NAME"
if [ -L "$FILE_DIR/nvim" ]; then
rm $FILE_DIR/nvim || die "Can't remove $FILE_DIR/nvim"
fi

152
get_randr.pl Executable file
View File

@ -0,0 +1,152 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
unless (exists $ENV{'WAYLAND_DISPLAY'}) {
die "Not running in WAYLAND";
}
my $app = {};
$app->{'displays'} = {};
get_display_info($app);
show_debug(Data::Dumper->Dump([$app]));
my $wlr_line = get_wlr_line($app);
print "${wlr_line}\n";
# -----------
# Subroutines
# -----------
sub get_display_info {
my ($app) = @_;
open (my $RANDRH, "wlr-randr |") or die "Couldn't run wlr-randr";
my @lines = map { chomp(); $_ } <$RANDRH>;
close ($RANDRH);
my $state = "IDLE";
my $curr_disp = "UNDEF";
my $disp_info = {};
foreach my $ln (@lines) {
if (my ($dn, $dd) = $ln =~ /^(\S+)\s+"([^"]+)"$/) {
$state = "IN_DISP";
unless (exists $disp_info->{$dn}) {
$disp_info->{$dn} = {};
$disp_info->{$dn}->{'name'} = $dn;
$curr_disp = $dn;
$disp_info->{$dn}->{'desc'} = $dd;
}
}
if (($state eq "IN_DISP") || ($state eq "IN_MODES")) {
if (my ($k,$v) = $ln =~ /\s+(\w+)\s*:\s*(.*)?$/) {
if ($k eq "Modes") {
$state = "IN_MODES";
$disp_info->{$curr_disp}->{'modes'} = [];
} else {
$disp_info->{$curr_disp}->{$k} = $v;
$state = "IN_DISP"
}
}
}
if ($state eq "IN_MODES") {
if (my ($mode_string) = $ln =~ /\s+(.+)$/) {
# 1920x1080 px, 60.000999 Hz (preferred, current)
my ($h, $v, $f, $a) = $mode_string =~ /(\d+)x(\d+)\s*px,\s*(\S+)\s*Hz\s*\((.*)\)$/;
my $mode_info = {};
$mode_info->{'horizontal'} = $h;
$mode_info->{'vertical'} = $v;
$mode_info->{'refresh_freq'} = $f;
if (defined $a) {
$mode_info->{'attributes'} = [split (/\s*,\s*/, $a)];
if ($a =~ /current/) {
$disp_info->{$curr_disp}->{'current_mode'} = $mode_info;
}
if ($a =~ /preferred/) {
$disp_info->{$curr_disp}->{'preferred_mode'} = $mode_info;
}
}
push(@{$disp_info->{$curr_disp}->{'modes'}}, $mode_info);
}
}
# show_debug("$state: $ln");
}
$app->{'displays'} = $disp_info;
}
# -----------
sub get_wlr_line {
my ($app) = @_;
my $wlr_line = "UNKNOWN";
my $num_disps = scalar(keys(%{$app->{'displays'}}));
if ($num_disps == 1) {
show_debug("Single display configuration");
$wlr_line = "wlr-randr --output HDMI-A-1 --off --output eDP-1 --on --pos 0,0"
} elsif ($num_disps > 1) {
# Determine setup (Custom)
#
# - Den room (DELL 27" monitor on the left of laptop display)
my $matching_disps = has_display_with_name($app, "DELL U27");
if (scalar (@{$matching_disps}) == 1) {
my ($h, $v) = get_display_current_dimensions($app, $matching_disps->[0]);
my $disp_name = $matching_disps->[0]->{'name'};
show_debug("Multiple display configuration: Den room");
$wlr_line = "wlr-randr --output ${disp_name} --on --pos 0,0 --output eDP-1 --on --pos ${h},0";
}
#
# - Media room (DELL 24" monitor above laptop display)
$matching_disps = has_display_with_name($app, "DELL U24");
if (scalar (@{$matching_disps}) == 1) {
my ($h, $v) = get_display_current_dimensions($app, $matching_disps->[0]);
my $disp_name = $matching_disps->[0]->{'name'};
show_debug("Multiple display configuration: Media room");
$wlr_line = "wlr-randr --output ${disp_name} --on --pos 0,0 --output eDP-1 --on --pos 0,${v}";
}
} else {
show_debug("No displays?!");
}
return $wlr_line;
}
# -----------
sub has_display_with_name {
my ($app, $name) = @_;
my $found = [];
foreach my $k (keys %{$app->{'displays'}}) {
if ($app->{'displays'}->{$k}->{'desc'} =~ /$name/) {
push(@{$found}, $app->{'displays'}->{$k});
}
}
return $found;
}
# -----------
sub get_display_current_dimensions {
my ($app, $disp) = @_;
return ($disp->{'current_mode'}->{'horizontal'}, $disp->{'current_mode'}->{'vertical'});
}
# -----------
sub show_debug {
my ($str) = @_;
# UNCOMMENT TO DEBUG # print "[DEBUG] $str\n";
}

View File

@ -12,7 +12,7 @@ TMP_FILE=$(mktemp $FILE_DIR/wezterm.XXXXXX.appimage)
echo "Downloading latest nightly $FILE_NAME to $TMP_FILE"
# curl -L -o $TMP_FILE $FILE_URL/$FILE_NAME || die "Can't cURL $FILE_NAME"
wget -O $TMP_FILE $FILE_URL/$FILE_NAME || die "Can't cURL $FILE_NAME"
wget -O $TMP_FILE $FILE_URL/$FILE_NAME > /dev/null 2>&1 || die "Can't cURL $FILE_NAME"
chmod +x $TMP_FILE || die "Can't chmod $TMP_FILE"
@ -41,7 +41,8 @@ else
cd $FILE_DIR
$TMP_FILE --appimage-extract || die "Can't extract appimage $FILE_NAME"
echo "Extracting $NEWVER"
$TMP_FILE --appimage-extract > /dev/null 2>&1 || die "Can't extract appimage $FILE_NAME"
if [ -L "$FILE_DIR/wezterm" ]; then
rm $FILE_DIR/wezterm || die "Can't remove $FILE_DIR/wezterm"
fi

View File

@ -117,7 +117,7 @@ require('onedark').load()
-- See `:help vim.o`
if vim.g.neovide then
vim.o.guifont = "Iosevka Term:h12"
vim.o.guifont = "Iosevka Term:h13"
vim.g.neovide_scale_factor = 1.0
end

View File

@ -8,18 +8,18 @@
if [ -f /etc/bash_completion.d/git-prompt ]; then
source /etc/bash_completion.d/git-prompt
fi
if [ -f ~/bin/git-prompt.sh ]; then
source ~/bin/git-prompt.sh
if [ -f /usr/share/git/git-prompt.sh ]; then
source /usr/share/git/git-prompt.sh
fi
export GIT_PS1_SHOWDIRTYSTATE=1
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;92m\]$(hostname)\[\033[01;34m\] \w\[\033[01;35m\]$(__git_ps1 "  %s") \[\033[0m\]$ '
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;92m\]$(hostnamectl hostname)\[\033[01;34m\] \w\[\033[01;35m\]$(__git_ps1 "  %s") \[\033[0m\]$ '
#
# Variables
#
#export EDITOR=vim
export EDITOR=nvim
export PATH=~/bin:$PATH
export PATH=~/bin:~/.local/bin:$PATH
#
# Aliases
@ -30,7 +30,7 @@ alias a=clear
alias h=history
alias e=$EDITOR
alias n=$EDITOR
alias gn=neovide
alias gn='neovide --fork'
#
# Functions

View File

@ -41,13 +41,16 @@ conky.text = [[
${if_existing /usr/local/bin/somebar}status${endif} \
💻 ${cpu}% \
💾 ${memperc}% \
${if_existing /sys/class/net/enp0s20f0u1u1u2/operstate up}🌎 ${addr enp0s20f0u1u1u2}${else}\
${if_existing /sys/class/net/enp0s20f0u1u1/operstate up}🌎 ${addr enp0s20f0u1u1}${else}\
${if_existing /sys/class/net/wlp0s20f3/operstate up}📶 ${addr wlp0s20f3}${else}\
${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} \
network down ${endif}${endif}${endif}${endif}${endif}${endif} \
${execi 600 curl 'wttr.in/~45.54,-122.83?u&format=%c%t'} \
🔊 ${execi 10 wpctl get-volume 54 | tail -1 | perl -ne 'm/([\d\.]+)/; print scalar (($1>1) ? 100 : ($1*100))'} \
🔋 ${battery_percent}% \
${if_existing /sys/class/power_supply/ADP0/online 1}🔌${else}🔋${endif} ${battery_percent}% \
📅 ${time %Y %h %d} \
🕑 ${time %I:%M%p %Z}
]]
@ -80,3 +83,4 @@ ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
]]