From 40352a0e4f3634e9341bcd124b4dd147245be629 Mon Sep 17 00:00:00 2001 From: Arkaprabha Chakraborty Date: Fri, 29 Sep 2023 03:25:39 +0530 Subject: [PATCH] Initial commit --- backlight | 29 +++++++++++++++++++++++++ screenshot | 18 ++++++++++++++++ upcord | 23 ++++++++++++++++++++ volume | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ wal | 17 +++++++++++++++ 5 files changed, 150 insertions(+) create mode 100755 backlight create mode 100755 screenshot create mode 100755 upcord create mode 100755 volume create mode 100755 wal diff --git a/backlight b/backlight new file mode 100755 index 0000000..9ed440b --- /dev/null +++ b/backlight @@ -0,0 +1,29 @@ +#!/usr/bin/sh + +# Script: backlight +# License: MIT +# Author: Arkaprabha Chakraborty +# Created: 02-10-23 +# Dependencies: acpilight, dunstify +# +# Copyright (C) 2023 Arkaprabha Chakraborty + +PROG=xbacklight +NOTIPROG=dunstify + +case $1 in +-i) + # Set the bval on (if it was muted) + $PROG -inc 10 + ;; +-d) + if [ $($PROG -getf | awk '{print substr($1, 1, length($1)-2)}') -le 20 ]; then + $PROG -set 10 + else + $PROG -dec 10 + fi + ;; +esac + +bval=$($PROG -getf | awk '{print substr($1, 1, length($1)-2)}') # brightness value +$NOTIPROG -a "brictl" -u low -r "9997" -h int:value:"$bval" -i "bright-$1" "Brightness: ${bval}%" -t 2000 diff --git a/screenshot b/screenshot new file mode 100755 index 0000000..56c545a --- /dev/null +++ b/screenshot @@ -0,0 +1,18 @@ +#!/usr/bin/sh + +# Script: screenshot +# License: MIT +# Author: Arkaprabha Chakraborty +# Created: 27-09-23 +# Dependencies: maim, dunstify +# +# Copyright (C) 2023 Arkaprabha Chakraborty + +PROG=maim +NOTIPROG=dunstify + +timestamp=$(date +%F-%T) +PROG -u -s "$HOME/Pictures/Screenshots/$timestamp-screenshot.png" + +NOTIPROG "Captured" -a "maim" -u "low" -t "2000" -I "$HOME/Pictures/\ +Screenshots/$timestamp-screenshot.png" diff --git a/upcord b/upcord new file mode 100755 index 0000000..0abd700 --- /dev/null +++ b/upcord @@ -0,0 +1,23 @@ +#!/usr/bin/sh + +# Script: upcord +# License: MIT +# Author: Arkaprabha Chakraborty +# Created: 26-02-23 +# Dependencies: curl, tar +# +# Copyright (C) 2023 Arkaprabha Chakraborty + +if [ -d "/opt/Discord" ]; then + sudo rm -rf /opt/Discord +fi + +if [ -L "/bin/discord" ]; then + sudo rm -f /bin/discord +fi + +curl -Lfo "Discord.tar.gz" "https://discord.com/api/download?platform=linux&format=tar.gz" +tar xzvf Discord.tar.gz +sudo mv Discord /opt +sudo ln -s /opt/Discord/Discord /bin/discord +rm Discord.tar.gz diff --git a/volume b/volume new file mode 100755 index 0000000..737bd1e --- /dev/null +++ b/volume @@ -0,0 +1,63 @@ +#!/usr/bin/sh + +# Script: volume +# License: MIT +# Author: Arkaprabha Chakraborty +# Created: 27-9-23 +# Dependencies: pipewire-pulseaudio, pamixer, dunstify +# +# Copyright (C) 2023 Arkaprabha Chakraborty + +# semicolon separated volume rules for multiple sinks +rules=" ; ; " + +max=80 # default max volume +step=5 # volume change step + +shopt -s lastpipe # run last pipe-element in the shell process +# set max volume for default sink +echo -e $rules | tr ';' '\n' | while read rule; do + if [ $(pactl get-default-sink) = $(echo $rule | awk '{ print $1 }') ]; then + max=$(echo $rule | awk '{ print $2 }') + fi +done + +case $1 in # pattern match option +-i) + pamixer -u # unmute if muted + + # set max volume if intended increase step exceeds max volume + if [ $(pamixer --get-volume) -ge $max ]; then + pamixer --allow-boost --set-volume $max + elif [ $(pamixer --get-volume) -le $max ] && [ $(pamixer --get-volume) -ge $((max - step)) ]; then + pamixer --allow-boost --set-volume $max + else + pamixer -i $step --allow-boost # increase volume + fi + volume=$(pamixer --get-volume) # get current volume + + # send notification with current volume + dunstify -a "volume" -u low -r "9993" -h int:value:"$volume" -i "volume-$1" "Volume: ${volume}%" -t 2000 + ;; +-d) + pamixer -u # unmute if muted + pamixer -d $step --allow-boost # decrease volume + + if [ $(pamixer --get-volume) -ge $max ]; then + pamixer --allow-boost --set-volume $max + fi + + volume=$(pamixer --get-volume) # get current volume + + # send notification with current volume + dunstify -a "volume" -u low -r "9993" -h int:value:"$volume" -i "volume-$1" "Volume: ${volume}%" -t 2000 + ;; +-m) + pamixer -t # toggle mute + if $(pamixer --get-mute); then # send notification with mute status + dunstify -i volume-mute -a "volume" -t 2000 -r 9993 -u low "Muted" + else + dunstify -i volume-mute -a "volume" -t 2000 -r 9993 -u low "Unmuted" + fi + ;; +esac diff --git a/wal b/wal new file mode 100755 index 0000000..931bcef --- /dev/null +++ b/wal @@ -0,0 +1,17 @@ +#!/usr/bin/sh + +# Script: wal +# License: MIT +# Author: Arkaprabha Chakraborty +# Created: 28-07-23 +# Dependencies: feh +# +# Copyright (C) 2023 Arkaprabha Chakraborty + +PROG=feh # program +FLAGS=--bg-fill # program flags +WALL=$1 # original image +REST=$HOME/.wall # duplicate image + +cp $WALL $REST # make a copy +$PROG $FLAGS $REST # set background