This commit is contained in:
Luca 2022-11-22 13:25:44 +01:00
parent 8268fba83d
commit 7ed2a6e110
9565 changed files with 1315332 additions and 90 deletions

View file

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

20
home/.local/bin/scripts/chwall Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
# Wallpaper Directory :
walldir="/mnt/Data/Pictures/Wallpaper/"
# Choose Wallpaper Dirs :
chosen="$(echo -e "$(ls $walldir | rofi -dmenu -i -selected-row 1 -p "Choose a Dir :" )")"
# Choose Wallpaper :
chosenwall="$(echo -e "$(ls $walldir$chosen/ | rofi -dmenu -i -selected-row 1 -p "Choose a Wallpaper :" )")"
# Set Wallpaper :
wallset=$(feh --bg-fill "$walldir$chosen/$chosenwall")
#echo "feh --bg-fill $walldir$chosen/$chosenwall &" >> ~/.xprofile
# xprofile :
sed -i "/\# Wallpaper :/a feh --bg-fill $walldir$chosen/$chosenwall &" ~/.xprofile
# xinitrc :
sed -i "/\# Wallpaper :/a feh --bg-fill $walldir$chosen/$chosenwall &" ~/.xinitrc

17
home/.local/bin/scripts/color Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
## Simple Script To Pick Color Quickly.
color=$(gpick -pso --no-newline)
main() {
if [[ "$color" ]]; then
# copy color code to clipboard
echo "$color" | tr -d "\n" | xclip -selection clipboard
# notify about it
dunstify -u low --replace=69 -i /usr/share/icons/Papirus-Dark/symbolic/status/notification-symbolic.svg "$color, copied to clipboard."
fi
}
# Run the script
main

18
home/.local/bin/scripts/demoji Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
# The famous "get a menu of emojis to copy" script.
# Get user selection via dmenu from emoji file.
chosen=$(cut -d ';' -f1 ~/.local/share/emoji | dmenu -i -l 20 | sed "s/ .*//")
# Exit if none chosen.
[ -z "$chosen" ] && exit
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
xdotool type "$chosen"
else
printf "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
fi

View file

@ -0,0 +1,72 @@
#!/bin/sh
#===============================================================================
# FILE: dmenumount
#
# ORIGINAL AUTHOR: Luke Smith
# AUTHOR: Gavin Jaeger-Freeborn gavinfreeborn@gmail.com
#===============================================================================
# Gives a dmenu prompt to mount unmounted drives and Android phones. If
# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll
# be prompted to give a mountpoint from already existsing directories. If you
# input a novel directory, it will prompt you to create that directory.
getmount() { \
[ -z "$chosen" ] && exit 1
# shellcheck disable=SC2086
mp="$(find $1 2>/dev/null | dmenu -i -l 10 -p "Type in mount point.")" || exit 1
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -l 10 -p "$mp does not exist. Create it?") || exit 1
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -l 10 -p "Mount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}')
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
esac
notify-send "💻 USB mounting" "$chosen mounted to $mp."
}
mountandroid() { \
chosen="$(echo "$anddrives" | dmenu -i -l 10 -p "Which Android device?")" || exit 1
chosen="$(echo "$chosen" | cut -d : -f 1)"
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
simple-mtpfs --device "$chosen" "$mp"
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
}
asktype() { \
choice="$(printf "USB\\nAndroid" | dmenu -i -l 10 -p "Mount a USB drive or Android device?")" || exit 1
case $choice in
USB) mountusb ;;
Android) mountandroid ;;
esac
}
anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
echo "Android device(s) detected."
mountandroid
else
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected."
mountusb
else
echo "Mountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

120
home/.local/bin/scripts/dpass Executable file
View file

@ -0,0 +1,120 @@
#!/bin/sh
# path: /home/klassiker/.local/share/repos/dmenu/scripts/dmenu_pass.sh
# author: klassiker [mrdotx]
# github: https://github.com/mrdotx/dmenu
# date: 2022-01-28T21:44:18+0100
# config
password_store="${PASSWORD_STORE_DIR-~/.password-store}"
file_type=".gpg"
clipboard_timeout=45
generate_password_chars=16
select=$(printf "== Generate Password ==\n%s" \
"$(find "$password_store" -iname "*$file_type" -printf "%P\n" \
| sed "s/$file_type$//" \
| sort)" \
| dmenu -l 15 -c -bw 2 -r -i -p "pass »" \
)
[ -z "$select" ] \
&& exit 0
get_entry() {
entry=$(gpg --quiet --decrypt "$password_store/$select$file_type")
username() {
printf "%s" "$entry" \
| grep "^username:" \
| sed "s/^username://; s/^[ \t]*//; s/[ \t]*$//" \
| tr -d "\n"
}
password() {
printf "%s" "$entry" \
| head -n 1 \
| tr -d "\n"
}
generate_password() {
printf "%s" "$(tr -dc A-Za-z0-9 < /dev/urandom \
| head -c"$generate_password_chars")"
}
case "$1" in
type)
# workaround for mismatched keyboard layouts
setxkbmap -synch
eval "$2" \
| xdotool type \
--clearmodifiers \
--file -
;;
copy)
eval "$2" \
| xsel \
--input \
--selectionTimeout "$((clipboard_timeout * 1000))" \
--clipboard
;;
esac
}
case "$select" in
"== Generate Password ==")
case $(printf "%s\n" \
"1) copy password ($clipboard_timeout sec)" \
"2) type password" \
| dmenu -l 2 -c -bw 2 -r -i -p "Generate Password »" \
) in
"1) copy password ($clipboard_timeout sec)")
get_entry "copy" "generate_password"
;;
"2) type password")
get_entry "type" "generate_password"
;;
*)
exit 0
;;
esac
;;
*)
case $(printf "%s\n" \
"1) copy username ($clipboard_timeout sec)" \
"2) copy password ($clipboard_timeout sec)" \
"3) type username, tab, password" \
"4) type username, 2xtab, password" \
"5) type username" \
"6) type password" \
| dmenu -l 6 -c -bw 2 -r -i -p "$select »" \
) in
"1) copy username ($clipboard_timeout sec)")
get_entry "copy" "username"
;;
"2) copy password ($clipboard_timeout sec)")
get_entry "copy" "password"
;;
"3) type username, tab, password")
get_entry "type" "username"
xdotool key Tab
get_entry "type" "password"
;;
"4) type username, 2xtab, password")
get_entry "type" "username"
xdotool key Tab Tab
get_entry "type" "password"
;;
"5) type username")
get_entry "type" "username"
;;
"6) type password")
get_entry "type" "password"
;;
*)
exit 0
;;
esac
;;
esac

View file

@ -0,0 +1,37 @@
#!/bin/sh
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
if [[ -n $WAYLAND_DISPLAY ]]; then
dmenu=dmenu-wl
xdotool="ydotool type --file -"
elif [[ -n $DISPLAY ]]; then
dmenu=dmenu
xdotool="xdotool type --clearmodifiers --file -"
else
echo "Error: No Wayland or X11 display detected" >&2
exit 1
fi
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
password=$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@")
[[ -n $password ]] || exit
if [[ $typeit -eq 0 ]]; then
pass show -c "$password" 2>/dev/null
else
pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool
fi

18
home/.local/bin/scripts/dwifi Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
# Sending Notification With dunst :
notify-send "listing available Wi-Fi networks..."
status=$(nmcli -fields WIFI g)
if [[ "$status" =~ "enabled" ]]; then
toggle="睊 Disable Wi-Fi"
elif [[ "$status" =~ "disabled" ]]; then
toggle="直 Enable Wi-Fi"
fi
bssid=$(nmcli device wifi list | sed -n '1!p' | cut -b 9- | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d"| dmenu -i -l 20 -h 25 -p "Select Wifi 直:" | cut -d' ' -f1)
pass=$(echo"" | dmenu -l 20 -h 30 -i -p "Enter the password :")
nmcli device wifi connect $bssid password $pass

3
home/.local/bin/scripts/kldwm Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
killall -9 xcompmgr dwm dwmbar

23
home/.local/bin/scripts/now Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
# Colors
Black='\033[1;30m' # Black
Red='\033[1;31m' # Red
Yellow='\033[1;32m' # Yellow
Yellow='\033[1;33m' # Yellow
Blue='\033[1;34m' # Blue
Purple='\033[1;35m' # Purple
Cyan='\033[1;36m' # Cyan
White='\033[1;37m' # White
echo -e "$Yellow Date :$Cyan" $(date +"%a %d %b %H:%M"| sed 's/ / /g')
echo -e "$Yellow User :$Cyan" $(id -un)
echo -e "$Yellow OS : $Cyan" $(distro | grep "Name" | sed "s/Name\: //")
echo -e "$Yellow kernel :$Cyan" $(uname -r)
echo -e "$Yellow Disk :$Cyan" $(df -h "/" | awk ' /[0-9]/ {print $3 "/" $2}')
echo -e "$Yellow CPU : $Cyan" $(grep 'model name' /proc/cpuinfo | uniq | sed "s/model name[[:blank:]]:[[:blank:]]//")
echo -e "$Yellow CPU Temp :$Cyan" $(sensors | awk '/Core 0/ {print "" $3}' | sed "s/\.0//")
echo -e "$Yellow Memory :$Cyan" $(free --mebi | sed -n '2{p;q}' | awk '{printf ("%2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}')
echo -e "$Yellow Temp :$Cyan" $(curl -s wttr.in/Algeria\?format=1)

View file

@ -0,0 +1,5 @@
#!/bin/sh
passg=$(openssl rand -base64 $(($RANDOM % 6 + 15)))
printf $passg | xclip -selection clipboard
notify-send "🔒Generated Password copied to clipboard."

1975
home/.local/bin/scripts/pfetch Executable file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,47 @@
#!/usr/bin/env bash
dir="~/.config/rofi/themes"
uptime=$(uptime -p | sed -e 's/up //g')
rofi_command="rofi -theme $dir/powermenu.rasi"
# Options
shutdown=" Shutdown"
reboot=" Reboot"
lock=" Lock"
suspend="鈴 Sleep"
hibernate=" Hibernate"
logout=" Logout"
# Variable passed to rofi
options="$lock\n$logout\n$suspend\n$hibernate\n$reboot\n$shutdown"
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)"
case $chosen in
$shutdown)
notify-send "👉 Powering Off " && sleep 1 &&
systemctl poweroff
;;
$reboot)
notify-send "👉 Rebooting " && sleep 1 &&
systemctl reboot
;;
$lock)
notify-send "👉 Locking the screen " && sleep 1 &&
if [[ -f /usr/local/bin/slock ]]; then
slock
fi
;;
$suspend)
mpc -q pause
amixer set Master mute
systemctl suspend
;;
$hibernate)
notify-send "👉 Hibernateing " && sleep 1 &&
systemctl hibernate
;;
$logout)
loginctl terminate-session ${XDG_SESSION_ID-}
;;
esac

View file

@ -0,0 +1,2 @@
#!/bin/sh
redshift -l 0:0 -t 4500:4500 -r &>/dev/null &

18
home/.local/bin/scripts/remoji Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
# The famous "get a menu of emojis to copy" script.
# Get user selection via dmenu from emoji file.
chosen=$(cut -d ';' -f1 ~/.local/share/emoji | rofi -dmenu -i -selected-row 1 | sed "s/ .*//")
# Exit if none chosen.
[ -z "$chosen" ] && exit
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
xdotool type "$chosen"
else
printf "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
fi

View file

@ -0,0 +1,295 @@
#!/usr/bin/env bash
# Constants
divider="---------"
goback="Back"
# Checks if bluetooth controller is powered on
power_on() {
if bluetoothctl show | grep -q "Powered: yes"; then
return 0
else
return 1
fi
}
# Toggles power state
toggle_power() {
if power_on; then
bluetoothctl power off
show_menu
else
if rfkill list bluetooth | grep -q 'blocked: yes'; then
rfkill unblock bluetooth && sleep 3
fi
bluetoothctl power on
show_menu
fi
}
# Checks if controller is scanning for new devices
scan_on() {
if bluetoothctl show | grep -q "Discovering: yes"; then
echo "Scan: on"
return 0
else
echo "Scan: off"
return 1
fi
}
# Toggles scanning state
toggle_scan() {
if scan_on; then
kill $(pgrep -f "bluetoothctl scan on")
bluetoothctl scan off
show_menu
else
bluetoothctl scan on &
echo "Scanning..."
sleep 5
show_menu
fi
}
# Checks if controller is able to pair to devices
pairable_on() {
if bluetoothctl show | grep -q "Pairable: yes"; then
echo "Pairable: on"
return 0
else
echo "Pairable: off"
return 1
fi
}
# Toggles pairable state
toggle_pairable() {
if pairable_on; then
bluetoothctl pairable off
show_menu
else
bluetoothctl pairable on
show_menu
fi
}
# Checks if controller is discoverable by other devices
discoverable_on() {
if bluetoothctl show | grep -q "Discoverable: yes"; then
echo "Discoverable: on"
return 0
else
echo "Discoverable: off"
return 1
fi
}
# Toggles discoverable state
toggle_discoverable() {
if discoverable_on; then
bluetoothctl discoverable off
show_menu
else
bluetoothctl discoverable on
show_menu
fi
}
# Checks if a device is connected
device_connected() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Connected: yes"; then
return 0
else
return 1
fi
}
# Toggles device connection
toggle_connection() {
if device_connected $1; then
bluetoothctl disconnect $1
device_menu "$device"
else
bluetoothctl connect $1
device_menu "$device"
fi
}
# Checks if a device is paired
device_paired() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Paired: yes"; then
echo "Paired: yes"
return 0
else
echo "Paired: no"
return 1
fi
}
# Toggles device paired state
toggle_paired() {
if device_paired $1; then
bluetoothctl remove $1
device_menu "$device"
else
bluetoothctl pair $1
device_menu "$device"
fi
}
# Checks if a device is trusted
device_trusted() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Trusted: yes"; then
echo "Trusted: yes"
return 0
else
echo "Trusted: no"
return 1
fi
}
# Toggles device connection
toggle_trust() {
if device_trusted $1; then
bluetoothctl untrust $1
device_menu "$device"
else
bluetoothctl trust $1
device_menu "$device"
fi
}
# Prints a short string with the current bluetooth status
# Useful for status bars like polybar, etc.
print_status() {
if power_on; then
printf ''
mapfile -t paired_devices < <(bluetoothctl paired-devices | grep Device | cut -d ' ' -f 2)
counter=0
for device in "${paired_devices[@]}"; do
if device_connected $device; then
device_alias=$(bluetoothctl info $device | grep "Alias" | cut -d ' ' -f 2-)
if [ $counter -gt 0 ]; then
printf ", %s" "$device_alias"
else
printf " %s" "$device_alias"
fi
((counter++))
fi
done
printf "\n"
else
echo ""
fi
}
# A submenu for a specific device that allows connecting, pairing, and trusting
device_menu() {
device=$1
# Get device name and mac address
device_name=$(echo $device | cut -d ' ' -f 3-)
mac=$(echo $device | cut -d ' ' -f 2)
# Build options
if device_connected $mac; then
connected="Connected: yes"
else
connected="Connected: no"
fi
paired=$(device_paired $mac)
trusted=$(device_trusted $mac)
options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit"
# Open rofi menu, read chosen option
chosen="$(echo -e "$options" | $rofi_command "$device_name")"
# Match chosen option to command
case $chosen in
"" | $divider)
echo "No option chosen."
;;
$connected)
toggle_connection $mac
;;
$paired)
toggle_paired $mac
;;
$trusted)
toggle_trust $mac
;;
$goback)
show_menu
;;
esac
}
# Opens a rofi menu with current bluetooth status and options to connect
show_menu() {
# Get menu options
if power_on; then
power="Power: on"
# Human-readable names of devices, one per line
# If scan is off, will only list paired devices
devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-)
# Get controller flags
scan=$(scan_on)
pairable=$(pairable_on)
discoverable=$(discoverable_on)
# Options passed to rofi
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit"
else
power="Power: off"
options="$power\nExit"
fi
# Open rofi menu, read chosen option
chosen="$(echo -e "$options" | $rofi_command "Bluetooth")"
# Match chosen option to command
case $chosen in
"" | $divider)
echo "No option chosen."
;;
$power)
toggle_power
;;
$scan)
toggle_scan
;;
$discoverable)
toggle_discoverable
;;
$pairable)
toggle_pairable
;;
*)
device=$(bluetoothctl devices | grep "$chosen")
# Open a submenu if a device is selected
if [[ $device ]]; then device_menu "$device"; fi
;;
esac
}
# Rofi command to pipe into, can add any options here
rofi_command="rofi -dmenu -no-fixed-num-lines -yoffset -100 -i -p $@"
case "$1" in
--status)
print_status
;;
*)
show_menu
;;
esac

View file

@ -0,0 +1,72 @@
#!/bin/sh
#===============================================================================
# FILE: dmenumount
#
# ORIGINAL AUTHOR: Luke Smith
# AUTHOR: Gavin Jaeger-Freeborn gavinfreeborn@gmail.com
#===============================================================================
# Gives a dmenu prompt to mount unmounted drives and Android phones. If
# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll
# be prompted to give a mountpoint from already existsing directories. If you
# input a novel directory, it will prompt you to create that directory.
getmount() { \
[ -z "$chosen" ] && exit 1
# shellcheck disable=SC2086
mp="$(find $1 2>/dev/null | rofi -dmenu -i -selected-row 1 -p "Type in mount point.")" || exit 1
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | rofi -dmenu -i -selected-row 1 -p "$mp does not exist. Create it?") || exit 1
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
mountusb() { \
chosen="$(echo "$usbdrives" | rofi -dmenu -i -selected-row 1 -p "Mount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}')
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
esac
notify-send "💻 USB mounting" "$chosen mounted to $mp."
}
mountandroid() { \
chosen="$(echo "$anddrives" | rofi -dmenu -i -selected-row 1 -p "Which Android device?")" || exit 1
chosen="$(echo "$chosen" | cut -d : -f 1)"
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
simple-mtpfs --device "$chosen" "$mp"
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
}
asktype() { \
choice="$(printf "USB\\nAndroid" | rofi -dmenu -i -selected-row 1 "Mount a USB drive or Android device?")" || exit 1
case $choice in
USB) mountusb ;;
Android) mountandroid ;;
esac
}
anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
echo "Android device(s) detected."
mountandroid
else
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected."
mountusb
else
echo "Mountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

38
home/.local/bin/scripts/rwifi Executable file
View file

@ -0,0 +1,38 @@
#!/bin/sh
notify-send "Getting list of available Wi-Fi networks..."
# Get a list of available wifi connections and morph it into a nice-looking list
wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed 's/ */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d")
connected=$(nmcli -fields WIFI g)
if [[ "$connected" =~ "enabled" ]]; then
toggle="睊 Disable Wi-Fi"
elif [[ "$connected" =~ "disabled" ]]; then
toggle="直 Enable Wi-Fi"
fi
# Use rofi to select wifi network
chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: " )
# Get name of connection
chosen_id=$(echo "${chosen_network:3}" | xargs)
if [ "$chosen_network" = "" ]; then
exit
elif [ "$chosen_network" = "直 Enable Wi-Fi" ]; then
nmcli radio wifi on
elif [ "$chosen_network" = "睊 Disable Wi-Fi" ]; then
nmcli radio wifi off
else
# Message to show when connection is activated successfully
success_message="You are now connected to the Wi-Fi network \"$chosen_id\"."
# Get saved connections
saved_connections=$(nmcli -g NAME connection)
if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then
nmcli connection up id "$chosen_id" | grep "successfully" && notify-send "Connection Established" "$success_message"
else
if [[ "$chosen_network" =~ "" ]]; then
wifi_password=$(rofi -dmenu -p "Password: " )
fi
nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && notify-send "Connection Established" "$success_message"
fi
fi

View file

@ -0,0 +1,29 @@
#!/bin/sh
MONITORS=$(xrandr | grep -o '[0-9]*x[0-9]*[+-][0-9]*[+-][0-9]*')
# Get the location of the mouse
XMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $2}')
YMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $4}')
path="$HOME/Pictures/screenshots/$(date +%Y.%m.%d_%H:%M.%S).png"
for mon in ${MONITORS}; do
# Parse the geometry of the monitor
MONW=$(echo ${mon} | awk -F "[x+]" '{print $1}')
MONH=$(echo ${mon} | awk -F "[x+]" '{print $2}')
MONX=$(echo ${mon} | awk -F "[x+]" '{print $3}')
MONY=$(echo ${mon} | awk -F "[x+]" '{print $4}')
# Use a simple collision check
if (( ${XMOUSE} >= ${MONX} )); then
if (( ${XMOUSE} <= ${MONX}+${MONW} )); then
if (( ${YMOUSE} >= ${MONY} )); then
if (( ${YMOUSE} <= ${MONY}+${MONH} )); then
# We have found our monitor!
maim -g "${MONW}x${MONH}+${MONX}+${MONY}" $path && xclip -selection clipboard -t image/png $path && paplay /usr/share/sounds/freedesktop/stereo/camera-shutter.oga
notify-send -i $path "Screenshot " "Screenshot captured\nand copied to clipboard!"
fi
fi
fi
fi
done
exit 1

View file

@ -0,0 +1,3 @@
#!/bin/sh
#date +"%a_%d_%b_%H:%M"
maim -m 10 --select | tee ~/Pictures/screenshots/$(date +%Y.%m.%d_%H:%M.%S).png | xclip -sel c -t image/png

View file

@ -0,0 +1,2 @@
#!/bin/sh
/mnt/Data/Downloads/Linux/Arch/AppImages/session-desktop-linux-x86_64-1.8.6.AppImage

2
home/.local/bin/scripts/stacer Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
/mnt/Data/Downloads/Linux/Arch/AppImages/Stacer-1.1.0-x64.AppImage

View file

@ -0,0 +1,22 @@
#!/bin/sh
# Colors :
Green='\033[1;32m' # Green
Cyan='\033[1;36m' # Cyan
No='\e[0m'
url="https://www.islamicfinder.org"
# Today Prayer Time:
#Today=$(curl $url -s | sed -n -e '/todayPrayerName/{N;N;N;N;N;N;N;s/<[^>]*>//g;s/\s\s*/ /g;p}')
# Upcoming Prayer :
Upcoming=$(curl $url -s | sed -n -e '/Upcoming Prayer/{N;N;N;N;N;N;N;s/<[^>]*>//g;s/\s\s*/ /g;p}')
# Notfication :
upray=$(echo -e $Upcoming)
notify-send "📿 $upray"
echo -e "📿${Green}${Upcoming}${No}"
echo -e "📿 ${Cyan}Today Prayer Time :${No}"
curl $url -s | sed -n -e '/todayPrayerName/{N;N;N;N;N;N;N;s/<[^>]*>//g;s/\s\s*/ /g;p}'

View file

@ -0,0 +1,3 @@
#!/bin/bash
curl https://wttr.in/Algeria

2
home/.local/bin/scripts/webcam Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
mpv av://v4l2:/dev/video0 --profile=low-latency --untimed

6
home/.local/bin/scripts/ytlist Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
printf "Enter url : "
read url
yt-dlp -f 'bv*[height=1080][ext=mp4]+ba*[ext=m4a]/best[ext=mp4]/best' --download-archive videos.txt $url -o '%(channel_id)s/%(playlist_id)s/%(title)s.%(ext)s'

4
home/.local/bin/scripts/ytm Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
search=$(printf '%s' "$*" | tr ' ' '+')
mpv --no-video "https://youtube.com/$(curl -s "https://vid.puffyan.us/search?q=$search" | grep -Eo "watch\?v=.{11}" | head -n 1 )"

6
home/.local/bin/scripts/ytmp3 Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
printf "Enter url : "
read url
yt-dlp -f 'ba' -x --embed-thumbnail --audio-format mp3 $url -o '%(title)s.%(ext)s'

4
home/.local/bin/scripts/ytp Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
search=$(printf '%s' "$*" | tr ' ' '+')
mpv "https://youtube.com/$(curl -s "https://vid.puffyan.us/search?q=$search" | grep -Eo "watch\?v=.{11}" | head -n 1 )"

6
home/.local/bin/scripts/ytvid Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
printf "Enter url : "
read url
yt-dlp -f 'bv*[height=1080][ext=mp4]+ba*[ext=m4a]/best[ext=mp4]/best' $url -o '%(title)s.%(ext)s'