aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-10 02:50:57 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-10 02:50:57 +0200
commitc9a38b22e7b5ea507352a170fd4cf3ea73acc2cd (patch)
tree2e53a8a0c152018c31abd89f59afd2583e8d9d33 /bin
parentb886c364aca56c684d91a2e6e9c823a50c8b692f (diff)
downloaddotfiles-c9a38b22e7b5ea507352a170fd4cf3ea73acc2cd.tar.gz
dotfiles-c9a38b22e7b5ea507352a170fd4cf3ea73acc2cd.tar.bz2
dotfiles-c9a38b22e7b5ea507352a170fd4cf3ea73acc2cd.zip
Added repo clone in project-open, cleaning installation script
Diffstat (limited to 'bin')
-rwxr-xr-xbin/battery-low-check5
-rwxr-xr-xbin/project-open27
2 files changed, 24 insertions, 8 deletions
diff --git a/bin/battery-low-check b/bin/battery-low-check
new file mode 100755
index 0000000..dbbdc6b
--- /dev/null
+++ b/bin/battery-low-check
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+capacity=$(cat /sys/class/power_supply/BAT0/capacity)
+
+[ "$capacity" -lt 10 ] && notify-send -u critical "Battery low $capacity%"
diff --git a/bin/project-open b/bin/project-open
index a4bf523..0dd5d31 100755
--- a/bin/project-open
+++ b/bin/project-open
@@ -10,22 +10,33 @@ dest=$(
[ -z "$dest" ] && exit 1
-if cd "$HOME/git/$dest" 2> /dev/null
+dest_path="$HOME/git/$dest"
+
+if cd "$dest_path" 2> /dev/null
then
- touch "$HOME/git/$dest"
+ touch "$dest_path"
st
else
while [ -z "$choice" ]
do
- choice=$(printf 'yes\nno\n' | dmenu -p "Create a repository at ~/git/$dest?")
+ choice=$(printf 'create\nclone\ncancel' | dmenu -p "New repository at ~/git/$dest?")
done
case "$choice" in
- "no") exit ;;
- "yes") mkdir -p "$HOME/git/$dest" ;;
- *) exit 1 ;;
+ "create")
+ mkdir -p "$dest_path"
+ cd "$dest_path" || exit 1
+ git init
+ ;;
+ "clone")
+ url="$(echo '' | dmenu -p "Entry repository url: ")"
+ notify-send "Cloning $url to $dest_path"
+ git clone --recursive "$url" "$dest_path" ||
+ (notify-send -u critical "Clone failed"; exit 1)
+ cd "$dest_path" || exit 1
+ ;;
+ "cancel") exit ;;
+ *) exit 1 ;;
esac
- cd "$HOME/git/$dest" || exit 1
- git init
st
fi