Kaynağa Gözat

statusbar and dwm improvements

laptop
Immanuel 4 yıl önce
ebeveyn
işleme
f74dbd3677
7 değiştirilmiş dosya ile 179 ekleme ve 1 silme
  1. +3
    -0
      cvpn
  2. +34
    -0
      dwm-statusbar
  3. +22
    -0
      dwmstart
  4. +1
    -1
      ewrap
  5. +24
    -0
      syn.sh
  6. +93
    -0
      util
  7. +2
    -0
      util-audio

+ 3
- 0
cvpn Dosyayı Görüntüle

@@ -0,0 +1,3 @@
#!/bin/sh



+ 34
- 0
dwm-statusbar Dosyayı Görüntüle

@@ -0,0 +1,34 @@
#!/bin/sh

speaker_muted=🔇
speaker_low=🔈
speaker_medium=🔉
speaker_high=🔊
brightness_symbol=🔅
# Statusbar loop
while true; do
bat_state=$(acpi | awk 'NR==1{print $3}')
if [ $bat_state == 'Charging,' ]; then
bat_state='🠝'
else
bat_state='🠟'
fi

volume=$(amixer sget Master | awk -F"[][]" 'END{ print $2 }')
volume_amount=$(printf $volume | tr -d %)
if [ $volume_amount == 0 ]; then
volume_symbol=$speaker_muted
elif [ $volume_amount -lt 30 ]; then
volume_symbol=$speaker_low
elif [ $volume_amount -lt 70 ]; then
volume_symbol=$speaker_medium
else
volume_symbol=$speaker_high
fi

bat_percentage=$(acpi | awk 'NR==1{print $4}' | tr -d [,])

brightness=$(xbacklight -get | grep -o '^..')
xsetroot -name "$brightness_symbol$brightness% | $volume_symbol$volume | 🔋$bat_state$bat_percentage | $(date +"%c")"
sleep 1m # Update time every minute
done

+ 22
- 0
dwmstart Dosyayı Görüntüle

@@ -0,0 +1,22 @@
#!/bin/sh
setxkbmap -option caps:swapescape
picom -b
~/.fehbg

# relaunch DWM if the binary changes, otherwise bail
csum=$(sha1sum $(which dwm.winkey))
new_csum=""
while true
do
if [ "$csum" != "$new_csum" ]
then
csum=$new_csum
dwm-statusbar &
xbindkeys -f "$XDG_CONFIG_HOME"/xbindkeys/config
dwm.winkey
else
exit 0
fi
new_csum=$(sha1sum $(which dwm.winkey))
sleep 0.5
done

+ 1
- 1
ewrap Dosyayı Görüntüle

@@ -5,6 +5,6 @@ if ! { [ "$TERM" = "tmux-256color" ] && [ -n "$TMUX" ]; } then
st -e vim "$*"
else
# tmux session running
tmux split-window -h "vim \"$*\""
tmux -u split-window "vim \"$*\""
fi


+ 24
- 0
syn.sh Dosyayı Görüntüle

@@ -0,0 +1,24 @@
REMOTE_USER="immanuel"
REMOTE_DIRECTORY="/home/immanuel/Dropoff/"
LOCAL_DIR=$HOME/Dropoff

pull () {
rsync -aP "$REMOTE_USER@$1:$REMOTE_DIRECTORY " "$LOCAL_DIR"
}

push () {
rsync -a "$LOCAL_DIR" "ssh://$REMOTE_USER@$1:$REMOTE_DIRECTORY"
}

while getopts a:u: option
do
case "${option}" in
a) destination=$OPTARG
echo $destination
pull $destination;;
u) destination=$OPTARG
push $destination;;

esac
done


+ 93
- 0
util Dosyayı Görüntüle

@@ -0,0 +1,93 @@
#!/bin/sh
BACKUPS_PATH=$HOME/Backups
gitcmd() {
#First arg should be the name of the subdirectory, second arg should be command
check_args $# 2
if [ ! -d "$BACKUPS_PATH/$1" ]; then
invalid_path_msg "$1"
return 1;
fi

git -C $BACKUPS_PATH/$1 $2
printf "The command succeded\n"
}

git_clone_backup() {
check_args $# 2
git -C $BACKUPS_PATH clone $1:Backups/$2
}

git_clone_proj() {
check_args $# 2
git -C $HOME/Projects clone ssh://$1/~/Projects/$2
}

bdiff() {
check_args $# 2
if [ ! -d "$BACKUPS_PATH/$1" ]; then
invalid_path_msg "$1"
return 1;
fi
case "$1" in
configs) vimdiff "$BACKUPS_PATH/$1/$2" "$XDG_CONFIG_HOME/$2";;
macros) vimdiff "$BACKUPS_PATH/$1/$2" "$HOME/Macros/$2";;
global_vim) vimdiff "$BACKUPS_PATH/$1/$2" "/usr/share/vim/$2";;
*) invalid_path_msg "$1"; return 1;;
esac
}

overwrite_local() {
if [ ! -e $BACKUPS_PATH/$1/$2 ]; then
printf "The backup path $BACKUPS_PATH/$1/$2 does not exist\n"
return 1;
fi
case "$1" in
configs) cp -r "$BACKUPS_PATH/$1/$2" "$XDG_CONFIG_HOME/";;
macros) cp -r "$BACKUPS_PATH/$1/$2" "$HOME/Macros/";;
*) invalid_path_msg "$1"; return 1;;
esac
printf "local overwrite successful\n"
}

overwrite_backup() {
if [ git diff --stat $BACKUPS_PATH/$1 ]; then
printf "There are uncommited changes in $1\n"
return 1
fi
case "$1" in
config) cp -r "$XDG_CONFIG_HOME/$2" "$BACKUPS_PATH/$1/$2";;
macros) cp -r "$HOME/Macros/$2" "$BACKUPS_PATH/$1/$2";;
*) invalid_path_msg "$1"; return 1;;
esac
printf "backup overwrite successful\n"
}

invalid_path_msg() {
printf "That path is invalid. $@\n"
}

check_args() {
if [ $1 -ne $2 ]; then
printf "Invalid number of arguments. Expected $2\n"
exit;
fi
return 0;
}


case "$1" in
pull-backup)
case "$2" in
configs) pull_backup configs;;
macros) pull_backup macros;;
esac
;;
overwrite-local) overwrite_local $2 $3;;
overwrite-backup) overwrite_backup $2 $3;;
gitcmd) gitcmd "$2" "$3";;
push-backup) overwrite_backup $2 $3;;
bclone) git_clone_backup "$2" "$3";;
pclone) git_clone_proj "$2" "$3";;
bdiff) bdiff $2 "$3";;
*) printf "No such option\n";;
esac

+ 2
- 0
util-audio Dosyayı Görüntüle

@@ -0,0 +1,2 @@
#!/bin/sh


Yükleniyor…
İptal
Kaydet