aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-10 14:04:29 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-10 14:04:29 +0200
commit7e1ae8bf92d08665a647422071e6d92a4aca3456 (patch)
treec6278ad782a5fa7d1de31566e8b4a75e9faf6189 /bin
parent1b1369ce79dcb6e1dcb8ba1bc21cf22220ef52fe (diff)
parent5f97842b01d98c586d3b6bc0834ec6704a2b1d3a (diff)
downloaddotfiles-7e1ae8bf92d08665a647422071e6d92a4aca3456.tar.gz
dotfiles-7e1ae8bf92d08665a647422071e6d92a4aca3456.tar.bz2
dotfiles-7e1ae8bf92d08665a647422071e6d92a4aca3456.zip
Merge branch 'carbon'
Diffstat (limited to 'bin')
-rwxr-xr-xbin/backlight-ctl11
-rwxr-xr-xbin/battery-low-check5
-rwxr-xr-xbin/project-open27
-rwxr-xr-xbin/volume-ctl12
4 files changed, 47 insertions, 8 deletions
diff --git a/bin/backlight-ctl b/bin/backlight-ctl
new file mode 100755
index 0000000..7153276
--- /dev/null
+++ b/bin/backlight-ctl
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+[ "$#" -ne 1 ] && exit 1;
+
+case "$1" in
+ "up") xbacklight -inc 5 ;;
+ "down") xbacklight -dec 5 ;;
+ *) exit 1 ;;
+esac
+
+notify-send "backlight $(xbacklight | cut -d '.' -f 1)"
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
diff --git a/bin/volume-ctl b/bin/volume-ctl
new file mode 100755
index 0000000..7e3ec83
--- /dev/null
+++ b/bin/volume-ctl
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+[ "$#" -ne 1 ] && exit 1;
+
+case "$1" in
+ "up") pulseaudio-ctl up ;;
+ "down") pulseaudio-ctl down ;;
+ "mute") pulseaudio-ctl mute ;;
+ *) exit 1 ;;
+esac
+
+notify-send "volume $(pulseaudio-ctl full-status | cut -d ' ' -f 1)"