Miscellaneous DWL and Update changes

This commit is contained in:
Mahesh Asolkar 2024-04-07 13:07:53 -07:00
parent 5e56166650
commit 52e892a323
6 changed files with 141 additions and 9 deletions

View File

@ -36,6 +36,7 @@ Environment=XDG_RUNTIME_DIR=%I
Environment=DWL_TAGS_FILE=%I/dwl.tags Environment=DWL_TAGS_FILE=%I/dwl.tags
Environment=DWL_LOG_FILE=%I/dwl.log Environment=DWL_LOG_FILE=%I/dwl.log
Environment=DWLTAGS_FMT=DZEN Environment=DWLTAGS_FMT=DZEN
Environment=XDG_CURRENT_DESKTOP=DWL
Environment=PIPEWIRE_RUNTIME_DIR=/run/user/501 Environment=PIPEWIRE_RUNTIME_DIR=/run/user/501
ExecStart=%h/bin/dwl.session ExecStart=%h/bin/dwl.session
Restart=on-failure Restart=on-failure

View File

@ -4,7 +4,7 @@ echo $XDG_RUNTIME_DIR used for Wayland session
export WLR_LIBINPUT_NO_DEVICES=1 export WLR_LIBINPUT_NO_DEVICES=1
export DWL_PATH=/usr/local/bin export DWL_PATH=/usr/local/bin
# export DWL_PATH=/home/mahesh/git/dwl_20240101 # export DWL_PATH=/home/mahesh/git/furnish/heshapps_dwl
export DWL_BAR_PATH=/usr/local/bin export DWL_BAR_PATH=/usr/local/bin
# export DWL_BAR_PATH=/home/mahesh/git/somebar_20240217/build # export DWL_BAR_PATH=/home/mahesh/git/somebar_20240217/build

58
get_neovim.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
function die() {
echo "ERROR! $1" && exit 1
}
START_DIR=$(pwd)
FILE_DIR="/opt/neovim"
FILE_NAME="nvim.appimage"
FILE_URL="https://github.com/neovim/neovim/releases/download/nightly"
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"
chmod +x $TMP_FILE || die "Can't chmod $TMP_FILE"
NEWVER=$($TMP_FILE --version | head -1)
EXTVER=$(test -e $FILE_DIR/.version && cat $FILE_DIR/.version || echo "")
echo "Version check - New version ($NEWVER) =?= current ($EXTVER)"
if [ "$NEWVER" == "$EXTVER" ]; then
echo "Not updating. New version ($NEWVER) same as current ($EXTVER)"
else
if [ -e $FILE_NAME ]; then
rm $FILE_NAME || die "Can't remove $FILE_NAME"
echo "Removed $FILE_NAME"
fi
cp $TMP_FILE $FILE_DIR/$FILE_NAME || die "Can't copy $TMP_FILE to $FILE_NAME"
echo "Making $FILE_DIR/$FILE_NAME executable"
chmod +x $FILE_DIR/$FILE_NAME || die "Can't chmod $FILE_DIR/$FILE_NAME"
echo $NEWVER > $FILE_DIR/.version || die "Can't write $FILE_DIR/.version"
# Extract nvim for other (non-root) users to run
if [ -d "$FILE_DIR/squashfs-root" ]; then
rm -rf $FILE_DIR/squashfs-root || die "Can't delete $FILE_DIR/squashfs-root"
fi
cd $FILE_DIR
$TMP_FILE --appimage-extract || 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
if [ -x "$FILE_DIR/squashfs-root/AppRun" ]; then
ln -s $FILE_DIR/squashfs-root/AppRun nvim
else
die "$FILE_DIR/squash-root/AppRun not executable"
fi
cd $START_DIR
echo "Version $NEWVER ready!"
fi
rm $TMP_FILE || die "Can't delete $TMP_FILE"
echo "Done with Neovim"

58
get_wezterm.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
function die() {
echo "ERROR! $1" && exit 1
}
START_DIR=$(pwd)
FILE_DIR="/opt/wezterm"
FILE_NAME="WezTerm-nightly-Ubuntu20.04.AppImage"
FILE_URL="https://github.com/wez/wezterm/releases/download/nightly"
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"
chmod +x $TMP_FILE || die "Can't chmod $TMP_FILE"
NEWVER=$($TMP_FILE --version | head -1)
EXTVER=$(test -e $FILE_DIR/.version && cat $FILE_DIR/.version || echo "")
echo "Version check - New version ($NEWVER) =?= current ($EXTVER)"
if [ "$NEWVER" == "$EXTVER" ]; then
echo "Not updating. New version ($NEWVER) same as current ($EXTVER)"
else
if [ -e $FILE_NAME ]; then
rm $FILE_NAME || die "Can't remove $FILE_NAME"
echo "Removed $FILE_NAME"
fi
cp $TMP_FILE $FILE_DIR/$FILE_NAME || die "Can't copy $TMP_FILE to $FILE_NAME"
echo "Making $FILE_DIR/$FILE_NAME executable"
chmod +x $FILE_DIR/$FILE_NAME || die "Can't chmod $FILE_DIR/$FILE_NAME"
echo $NEWVER > $FILE_DIR/.version || die "Can't write $FILE_DIR/.version"
# Extract wezterm for other (non-root) users to run
if [ -d "$FILE_DIR/squashfs-root" ]; then
rm -rf $FILE_DIR/squashfs-root || die "Can't delete $FILE_DIR/squashfs-root"
fi
cd $FILE_DIR
$TMP_FILE --appimage-extract || 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
if [ -x "$FILE_DIR/squashfs-root/AppRun" ]; then
ln -s $FILE_DIR/squashfs-root/AppRun wezterm
else
die "$FILE_DIR/squash-root/AppRun not executable"
fi
cd $START_DIR
echo "Version $NEWVER ready!"
fi
rm $TMP_FILE || die "Can't delete $TMP_FILE"
echo "Done with Wezterm"

View File

@ -8,7 +8,7 @@ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;41m\]$(hostname)\[\033[00m\]\[\
# #
# Variables # Variables
# #
export EDITOR=nvim export EDITOR=n
export PATH=~/bin:$PATH export PATH=~/bin:$PATH
# #
@ -19,7 +19,6 @@ alias q=exit
alias a=clear alias a=clear
alias h=history alias h=history
alias e=$EDITOR alias e=$EDITOR
alias n=nvim
# #
# Functions # Functions
@ -29,6 +28,10 @@ function myvim () {
disown %1 disown %1
} }
function n () {
/opt/neovim/nvim $* || nvim $*
}
function hgrep () { function hgrep () {
history | grep $1 history | grep $1
} }
@ -38,5 +41,15 @@ function pgrep () {
} }
function u2d () { function u2d () {
~mahesh/git/snips/get_neovim.sh
~mahesh/git/snips/get_wezterm.sh
cd
if [ -e /etc/arch-release ]; then
pacman -Syu
elif [ -e /etc/debian_release ]; then
apt update && apt full-upgrade -y && apt autoremove -y apt update && apt full-upgrade -y && apt autoremove -y
else
echo "Auto update not supported."
exit 1
fi
} }

View File

@ -29,7 +29,8 @@ alias q=exit
alias a=clear alias a=clear
alias h=history alias h=history
alias e=$EDITOR alias e=$EDITOR
alias n=nvim alias n=$EDITOR
alias gn=neovide
# #
# Functions # Functions
@ -38,6 +39,7 @@ function myvim () {
gvim $1 >& /dev/null & gvim $1 >& /dev/null &
disown %1 disown %1
} }
function pyedit () { function pyedit () {
gedit $1 >& /dev/null & gedit $1 >& /dev/null &
disown %1 disown %1