summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2024-07-20 20:18:30 +0400
committerSuleyman Farajli <suleyman@farajli.net>2024-07-20 20:18:30 +0400
commit73e31b79de25298a519671ef8b6c2ab68af9c87e (patch)
treefafbc2e405247cd1c9b1106d6346a5767071e14f /scripts
parentac76d8699e3979353cd82136323e1e0afee4bba2 (diff)
directory layout changed
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/border5
-rwxr-xr-xscripts/gap3
-rwxr-xr-xscripts/nocomment6
-rwxr-xr-xscripts/nospac5
-rwxr-xr-xscripts/sBrightness13
-rwxr-xr-xscripts/sScreenshot7
-rwxr-xr-xscripts/sTouchpad15
-rwxr-xr-xscripts/sVolume11
-rwxr-xr-xscripts/setwp18
9 files changed, 83 insertions, 0 deletions
diff --git a/scripts/border b/scripts/border
new file mode 100755
index 0000000..6738acd
--- /dev/null
+++ b/scripts/border
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+bspc config border_width $1
+
+[ $1 = "blue" ] && bspc config focused_border_color "#099999"
diff --git a/scripts/gap b/scripts/gap
new file mode 100755
index 0000000..c094380
--- /dev/null
+++ b/scripts/gap
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+bspc config window_gap $1
diff --git a/scripts/nocomment b/scripts/nocomment
new file mode 100755
index 0000000..cd5f0c2
--- /dev/null
+++ b/scripts/nocomment
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Remove all the commments in the given file
+# Comments are considered to start with "#"
+
+sed -i "s/\s*#.*//g; /^$/ d" $1
diff --git a/scripts/nospac b/scripts/nospac
new file mode 100755
index 0000000..3dee5de
--- /dev/null
+++ b/scripts/nospac
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Replace all the spaces in file names with "_" in the current working directory
+
+for file in *; do mv "$file" `echo $file | tr ' ' '_'` ; done
diff --git a/scripts/sBrightness b/scripts/sBrightness
new file mode 100755
index 0000000..9f2363a
--- /dev/null
+++ b/scripts/sBrightness
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Wrapper script for backlight control
+
+arg=$1
+
+[ $# -eq 0 ] && { echo "Error: No argument" ; exit 2 ;}
+
+[ $# -gt 1 ] && { echo Too much arguments ; exit 2 ; }
+
+[ $arg -lt 0 ] && positive_arg=$(echo $arg | tr -d "-") && brightnessctl -c backlight set $positive_arg%- && exit 0
+
+brightnessctl -c backlight set $arg%
diff --git a/scripts/sScreenshot b/scripts/sScreenshot
new file mode 100755
index 0000000..33fda01
--- /dev/null
+++ b/scripts/sScreenshot
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Wrapper script for screenshots
+
+[ -d ~/Pictures/screenshots ] || mkdir -p ~/Pictures/screenshots
+
+maim ~/Pictures/screenshots/$(date +%s).png
diff --git a/scripts/sTouchpad b/scripts/sTouchpad
new file mode 100755
index 0000000..87c0000
--- /dev/null
+++ b/scripts/sTouchpad
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Wrapper script for activating and deactivating touchpad
+
+[ -d ~/.cache ] || { mkdir ~/.cache || { echo "Couldn't create ~/.cache " && exit 2; };}
+
+file=~/.cache/touchpad_on
+
+if [ -f $file ];then
+ rm $file
+ xinput disable "$(xinput list --name-only | grep Touchpad)" && nsend Touchpad Disabled
+else
+ touch $file
+ xinput enable "$(xinput list --name-only | grep Touchpad)" && nsend Touchpad Enabled
+fi
diff --git a/scripts/sVolume b/scripts/sVolume
new file mode 100755
index 0000000..1a433d4
--- /dev/null
+++ b/scripts/sVolume
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Wrapper script for volume control
+
+arg=$1
+[ $# = 0 ] && { echo ERROR: No argument ; exit 2; }
+[ $# -gt 1 ] && { echo Too much arguments ; exit 2 ; }
+
+[ $arg = '--toggle' ] && { pactl set-sink-mute @DEFAULT_SINK@ toggle ; exit 0 ;}
+
+pactl set-sink-volume @DEFAULT_SINK@ $1%
diff --git a/scripts/setwp b/scripts/setwp
new file mode 100755
index 0000000..d80c10e
--- /dev/null
+++ b/scripts/setwp
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Wrapper script for setting wallpaper
+
+program_name=setwp
+
+for argument in $@;
+do
+ [ ! -e $argument ] && { echo $program_name: cannot access "'$argument'": No such file or directory && exit 2; }
+
+ [ -d $argument ] && wallpaper_list="$wallpaper_list $(ls -d $argument/*)"
+
+ [ -f $argument ] && wallpaper_list="$wallpaper_list $argument"
+
+done
+
+
+xwallpaper --zoom $(shuf -en 1 $wallpaper_list)