huge update
This commit is contained in:
1 parent
29529d651b
commit
54b7bd8dbd
69 files changed
+1199
-1956
No files matched your search
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Airplane Mode. Turning on or off all wifi using rfkill.
|
||||
|
||||
notif="$HOME/.config/swaync/images/bell.png"
|
||||
|
||||
# Check if any wireless device is blocked
|
||||
wifi_blocked=$(rfkill list wifi | grep -o "Soft blocked: yes")
|
||||
|
||||
if [ -n "$wifi_blocked" ]; then
|
||||
rfkill unblock wifi
|
||||
notify-send -u low -i "$notif" 'Airplane mode: OFF'
|
||||
else
|
||||
rfkill block wifi
|
||||
notify-send -u low -i "$notif" 'Airplane mode: ON'
|
||||
fi
|
||||
@@ -1,52 +1,59 @@
|
||||
#!/bin/bash
|
||||
# Script for Monitor backlights (if supported) using brightnessctl
|
||||
|
||||
# Script for keyboard backlights (if supported) & screen using brightnessctl
|
||||
|
||||
iDIR="$HOME/.config/swaync/icons"
|
||||
notification_timeout=1000
|
||||
|
||||
# Get brightness
|
||||
get_backlight() {
|
||||
echo $(brightnessctl -m | cut -d, -f4)
|
||||
echo $(brightnessctl -m | cut -d, -f4)
|
||||
}
|
||||
|
||||
get_kbd_backlight() {
|
||||
brightnessctl -d '*::kbd_backlight' -m | cut -d, -f4 | tr -d '%'
|
||||
}
|
||||
|
||||
# Get icons
|
||||
get_icon() {
|
||||
current=$(get_backlight | sed 's/%//')
|
||||
if [ "$current" -le "20" ]; then
|
||||
icon="$iDIR/brightness-20.png"
|
||||
elif [ "$current" -le "40" ]; then
|
||||
icon="$iDIR/brightness-40.png"
|
||||
elif [ "$current" -le "60" ]; then
|
||||
icon="$iDIR/brightness-60.png"
|
||||
elif [ "$current" -le "80" ]; then
|
||||
icon="$iDIR/brightness-80.png"
|
||||
else
|
||||
icon="$iDIR/brightness-100.png"
|
||||
fi
|
||||
current=$(get_backlight | sed 's/%//')
|
||||
[ "$current" -le "20" ] && icon="$iDIR/brightness-20.png" ||
|
||||
[ "$current" -le "40" ] && icon="$iDIR/brightness-40.png" ||
|
||||
[ "$current" -le "60" ] && icon="$iDIR/brightness-60.png" ||
|
||||
[ "$current" -le "80" ] && icon="$iDIR/brightness-80.png" ||
|
||||
icon="$iDIR/brightness-100.png"
|
||||
}
|
||||
|
||||
# Notify
|
||||
notify_user() {
|
||||
notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness : $current%"
|
||||
notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness: $current%"
|
||||
}
|
||||
|
||||
# Change brightness
|
||||
change_backlight() {
|
||||
brightnessctl set "$1" && get_icon && notify_user
|
||||
brightnessctl set "$1" && get_icon && notify_user
|
||||
}
|
||||
|
||||
change_kbd_backlight() {
|
||||
brightnessctl -d '*::kbd_backlight' set "$1" && get_icon && notify_user
|
||||
}
|
||||
|
||||
# Execute accordingly
|
||||
case "$1" in
|
||||
"--get")
|
||||
get_backlight
|
||||
;;
|
||||
"--inc")
|
||||
change_backlight "+10%"
|
||||
;;
|
||||
"--dec")
|
||||
change_backlight "10%-"
|
||||
;;
|
||||
*)
|
||||
get_backlight
|
||||
;;
|
||||
"--get")
|
||||
get_backlight
|
||||
;;
|
||||
"--inc")
|
||||
change_backlight "+10%"
|
||||
;;
|
||||
"--dec")
|
||||
change_backlight "10%-"
|
||||
;;
|
||||
"--get-kbd")
|
||||
get_kbd_backlight
|
||||
;;
|
||||
"--inc-kbd")
|
||||
change_kbd_backlight "+30%"
|
||||
;;
|
||||
"--dec-kbd")
|
||||
change_kbd_backlight "30%-"
|
||||
;;
|
||||
*)
|
||||
get_backlight
|
||||
;;
|
||||
esac
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script for keyboard backlights (if supported) using b
|
||||
|
||||
iDIR="$HOME/.config/swaync/icons"
|
||||
|
||||
# Get keyboard brightness
|
||||
get_kbd_backlight() {
|
||||
echo $(brightnessctl -d '*::kbd_backlight' -m | cut -d, -f4)
|
||||
}
|
||||
|
||||
# Get icons
|
||||
get_icon() {
|
||||
current=$(get_kbd_backlight | sed 's/%//')
|
||||
if [ "$current" -le "20" ]; then
|
||||
icon="$iDIR/brightness-20.png"
|
||||
elif [ "$current" -le "40" ]; then
|
||||
icon="$iDIR/brightness-40.png"
|
||||
elif [ "$current" -le "60" ]; then
|
||||
icon="$iDIR/brightness-60.png"
|
||||
elif [ "$current" -le "80" ]; then
|
||||
icon="$iDIR/brightness-80.png"
|
||||
else
|
||||
icon="$iDIR/brightness-100.png"
|
||||
fi
|
||||
}
|
||||
# Notify
|
||||
notify_user() {
|
||||
notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Keyboard Brightness : $current%"
|
||||
}
|
||||
|
||||
# Change brightness
|
||||
change_kbd_backlight() {
|
||||
brightnessctl -d *::kbd_backlight set "$1" && get_icon && notify_user
|
||||
}
|
||||
|
||||
# Execute accordingly
|
||||
case "$1" in
|
||||
"--get")
|
||||
get_kbd_backlight
|
||||
;;
|
||||
"--inc")
|
||||
change_kbd_backlight "+30%"
|
||||
;;
|
||||
"--dec")
|
||||
change_kbd_backlight "30%-"
|
||||
;;
|
||||
*)
|
||||
get_kbd_backlight
|
||||
;;
|
||||
esac
|
||||
@@ -3,9 +3,9 @@
|
||||
# Nuke all internal spawns when script dies
|
||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
||||
|
||||
BARS=8
|
||||
FRAMERATE=60
|
||||
EQUILIZER=1
|
||||
BARS=8;
|
||||
FRAMERATE=60;
|
||||
EQUILIZER=1;
|
||||
|
||||
# Get script options
|
||||
while getopts 'b:f:m:eh' flag; do
|
||||
@@ -31,7 +31,8 @@ dict="s/;//g;"
|
||||
|
||||
# creating "dictionary" to replace char with bar + thin space " "
|
||||
i=0
|
||||
while [ $i -lt ${#bar} ]; do
|
||||
while [ $i -lt ${#bar} ]
|
||||
do
|
||||
dict="${dict}s/$i/${bar:$i:1} /g;"
|
||||
i=$((i=i+1))
|
||||
done
|
||||
@@ -40,17 +41,17 @@ done
|
||||
dict="${dict}s/.$//;"
|
||||
|
||||
clean_create_pipe() {
|
||||
if [ -p "$1" ]; then
|
||||
unlink "$1"
|
||||
if [ -p $1 ]; then
|
||||
unlink $1
|
||||
fi
|
||||
mkfifo "$1"
|
||||
mkfifo $1
|
||||
}
|
||||
|
||||
kill_pid_file() {
|
||||
if [[ -f "$1" ]]; then
|
||||
while read -r pid; do
|
||||
kill "$pid" && wait "$pid" 2>/dev/null
|
||||
done < "$1"
|
||||
if [[ -f $1 ]]; then
|
||||
while read pid; do
|
||||
{ kill "$pid" && wait "$pid"; } 2>/dev/null
|
||||
done < $1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -59,11 +60,11 @@ cava_waybar_pid="/tmp/cava_waybar_pid"
|
||||
|
||||
# Clean pipe for cava
|
||||
cava_waybar_pipe="/tmp/cava_waybar.fifo"
|
||||
clean_create_pipe "$cava_waybar_pipe"
|
||||
clean_create_pipe $cava_waybar_pipe
|
||||
|
||||
# Custom cava config
|
||||
cava_waybar_config="/tmp/cava_waybar_config"
|
||||
cat > "$cava_waybar_config" <<EOF
|
||||
echo "
|
||||
[general]
|
||||
mode = normal
|
||||
framerate = $FRAMERATE
|
||||
@@ -74,11 +75,11 @@ method = raw
|
||||
raw_target = $cava_waybar_pipe
|
||||
data_format = ascii
|
||||
ascii_max_range = 7
|
||||
EOF
|
||||
" > $cava_waybar_config
|
||||
|
||||
# Clean pipe for playerctl
|
||||
playerctl_waybar_pipe="/tmp/playerctl_waybar.fifo"
|
||||
clean_create_pipe "$playerctl_waybar_pipe"
|
||||
clean_create_pipe $playerctl_waybar_pipe
|
||||
|
||||
# playerctl output into playerctl_waybar_pipe
|
||||
playerctl -a metadata --format '{"tooltip": "{{playerName}} : {{markup_escape(artist)}} - {{markup_escape(title)}}", "alt": "{{status}}", "class": "{{status}}"}' -F > "$playerctl_waybar_pipe" &
|
||||
@@ -86,35 +87,29 @@ playerctl -a metadata --format '{"tooltip": "{{playerName}} : {{markup_escape(ar
|
||||
# Read the playerctl o/p via its fifo pipe
|
||||
while read -r line; do
|
||||
# Kill the cava process to stop the input to cava_waybar_pipe
|
||||
kill_pid_file "$cava_waybar_pid"
|
||||
kill_pid_file $cava_waybar_pid
|
||||
|
||||
# Move these outside the loop
|
||||
cava_cmd="cava -p $cava_waybar_config > $cava_waybar_pipe &"
|
||||
jq_cmd="jq --arg a \$(echo \$cmd2 | sed \"$dict\") '.text = \$a' --unbuffered --compact-output"
|
||||
|
||||
echo "$line" | eval "$jq_cmd"
|
||||
echo "$line" | jq --unbuffered --compact-output
|
||||
|
||||
# If the class says "Playing" and equilizer is enabled
|
||||
# then show the cava equilizer
|
||||
if [ "$EQUILIZER" == 1 ] && [ "$(echo "$line" | jq -r '.class')" == 'Playing' ]; then
|
||||
if [[ $EQUILIZER == 1 && $(echo $line | jq -r '.class') == 'Playing' ]]; then
|
||||
# Show the playing title for 2 seconds
|
||||
sleep 2
|
||||
|
||||
# cava output into cava_waybar_pipe
|
||||
eval "$cava_cmd"
|
||||
cava -p $cava_waybar_config >$cava_waybar_pipe &
|
||||
|
||||
# Save the PID of child process
|
||||
echo $! > "$cava_waybar_pid"
|
||||
echo $! > $cava_waybar_pid
|
||||
|
||||
# Read the cava o/p via its fifo pipe
|
||||
cava_output() {
|
||||
while read -r cmd2; do
|
||||
# Change the "text" key to bars
|
||||
echo "$line" | eval "$jq_cmd"
|
||||
done < "$cava_waybar_pipe" &
|
||||
}
|
||||
|
||||
cava_output &
|
||||
while read -r cmd2; do
|
||||
# Change the "text" key to bars
|
||||
echo "$line" | jq --arg a $(echo $cmd2 | sed "$dict") '.text = $a' --unbuffered --compact-output
|
||||
done < $cava_waybar_pipe & # Do this fifo read in background
|
||||
|
||||
# Save the while loop PID into the file as well
|
||||
echo $! >> "$cava_waybar_pid"
|
||||
echo $! >> $cava_waybar_pid
|
||||
fi
|
||||
done < "$playerctl_waybar_pipe"
|
||||
done < $playerctl_waybar_pipe
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
## Script for changing blurs on the fly
|
||||
|
||||
notif="$HOME/.config/swaync/images/bell.png"
|
||||
|
||||
STATE=$(hyprctl -j getoption decoration:blur:passes | jq ".int")
|
||||
|
||||
if [ "${STATE}" == "2" ]; then
|
||||
hyprctl keyword decoration:blur:size 2
|
||||
hyprctl keyword decoration:blur:passes 1
|
||||
notify-send -e -u low -i "$notif" "Less blur"
|
||||
else
|
||||
hyprctl keyword decoration:blur:size 5
|
||||
hyprctl keyword decoration:blur:passes 2
|
||||
notify-send -e -u low -i "$notif" "Normal blur"
|
||||
fi
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
# for changing Hyprland Layouts (Master or Dwindle) on the fly
|
||||
|
||||
notif="$HOME/.config/swaync/images/bell.png"
|
||||
|
||||
LAYOUT=$(hyprctl -j getoption general:layout | jq '.str' | sed 's/"//g')
|
||||
|
||||
case $LAYOUT in
|
||||
"master")
|
||||
hyprctl keyword general:layout dwindle
|
||||
hyprctl keyword unbind SUPER,J
|
||||
hyprctl keyword unbind SUPER,K
|
||||
hyprctl keyword bind SUPER,J,cyclenext
|
||||
hyprctl keyword bind SUPER,K,cyclenext,prev
|
||||
hyprctl keyword bind SUPER,O,togglesplit
|
||||
notify-send -e -u low -i "$notif" "Dwindle Layout"
|
||||
;;
|
||||
"dwindle")
|
||||
hyprctl keyword general:layout master
|
||||
hyprctl keyword unbind SUPER,J
|
||||
hyprctl keyword unbind SUPER,K
|
||||
hyprctl keyword unbind SUPER,O
|
||||
hyprctl keyword bind SUPER,J,layoutmsg,cyclenext
|
||||
hyprctl keyword bind SUPER,K,layoutmsg,cycleprev
|
||||
notify-send -e -u low -i "$notif" "Master Layout"
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Clipboard Manager. This script uses cliphist, rofi, and wl-copy.
|
||||
|
||||
# Actions:
|
||||
# CTRL Del to delete an entry
|
||||
# ALT Del to wipe clipboard contents
|
||||
|
||||
while true; do
|
||||
result=$(
|
||||
rofi -dmenu \
|
||||
-kb-custom-1 "Control-Delete" \
|
||||
-kb-custom-2 "Alt-Delete" \
|
||||
-p "CTRL Del - Cliphist del || Alt Del - cliphist wipe" \
|
||||
-config ~/.config/rofi/config-long.rasi < <(cliphist list)
|
||||
)
|
||||
|
||||
case "$?" in
|
||||
1)
|
||||
exit
|
||||
;;
|
||||
0)
|
||||
case "$result" in
|
||||
"")
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
cliphist decode <<<"$result" | wl-copy
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
10)
|
||||
cliphist delete <<<"$result"
|
||||
;;
|
||||
11)
|
||||
cliphist wipe
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Executable
+154
@@ -0,0 +1,154 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source the configuration file.
|
||||
CONFIG_FILE=~/.config/hypr/scripts/Ref.sh
|
||||
source "$CONFIG_FILE"
|
||||
|
||||
|
||||
# Toggle touchpad state. (SUPER SHIFT D)
|
||||
touchpad() {
|
||||
local status_file="$STATUS_FILE"
|
||||
local action
|
||||
|
||||
if [[ ! -e "$status_file" ]] || ! $(<"$status_file"); then
|
||||
echo "true" > "$status_file"
|
||||
action="enabled"
|
||||
else
|
||||
echo "false" > "$status_file"
|
||||
action="disabled"
|
||||
fi
|
||||
|
||||
notify-send -u low -i "$notif" "Touchpad $action"
|
||||
hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" "$(cat "$status_file")"
|
||||
}
|
||||
|
||||
|
||||
# Toggle Wifi
|
||||
wifi() {
|
||||
wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')"
|
||||
if [ -n "$wifi" ]; then
|
||||
rfkill block all &
|
||||
notify-send -u low -i "$notif" 'Airplane mode: OFF'
|
||||
else
|
||||
rfkill unblock all &
|
||||
notify-send -u low -i "$notif" 'Airplane mode: ON'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Reload Waybar, Rofi, Swaync, and Rainbowborder.sh (SHIFT ALT R)
|
||||
reload() {
|
||||
file_exists() {
|
||||
[ -e "$1" ]
|
||||
}
|
||||
|
||||
processes=("waybar" "rofi" "swaync")
|
||||
|
||||
for process in "${processes[@]}"; do
|
||||
pid=$(pidof "$process")
|
||||
if [ -n "$pid" ]; then
|
||||
pkill "$process"
|
||||
fi
|
||||
done
|
||||
|
||||
sleep 0.3
|
||||
waybar &
|
||||
sleep 0.5
|
||||
swaync > /dev/null 2>&1 &
|
||||
sleep 1
|
||||
|
||||
script_path="${UserSCRIPTSDIR}/RainbowBorders.sh"
|
||||
if file_exists "$script_path"; then
|
||||
"$script_path" &
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# LockScreen with swaylock
|
||||
lockscreen() {
|
||||
LOCKCONFIG="$HOME/.config/swaylock/config"
|
||||
sleep 0.5s
|
||||
swaylock --config ${LOCKCONFIG} &
|
||||
disown
|
||||
}
|
||||
|
||||
|
||||
# Switch Keyboard Layout (ALT F1)
|
||||
kb() {
|
||||
layout_f="$HOME/.keyboard_layout"
|
||||
settings_file="$HOME/.config/your_settings_file" # Replace with the actual path
|
||||
notif="path_to_notification_icon" # Replace with the actual path
|
||||
|
||||
if [ ! -f "$layout_f" ]; then
|
||||
default_layout=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2 | cut -d ',' -f 1 2>/dev/null)
|
||||
default_layout=${default_layout:-"us"}
|
||||
echo "$default_layout" > "$layout_f"
|
||||
fi
|
||||
|
||||
current_layout=$(cat "$layout_f")
|
||||
|
||||
if [ -f "$settings_file" ]; then
|
||||
kb_layout_line=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2)
|
||||
IFS=',' read -ra layout_mapping <<< "$kb_layout_line"
|
||||
else
|
||||
layout_mapping=()
|
||||
fi
|
||||
|
||||
layout_count=${#layout_mapping[@]}
|
||||
|
||||
for ((i = 0; i < layout_count; i++)); do
|
||||
[ "$current_layout" == "${layout_mapping[i]}" ] && current_index=$i && break
|
||||
done
|
||||
|
||||
next_index=$(( (current_index + 1) % layout_count ))
|
||||
new_layout="${layout_mapping[next_index]}"
|
||||
hyprctl keyword input:kb_layout "$new_layout"
|
||||
echo "$new_layout" > "$layout_f"
|
||||
notify-send -u low -i "$notif" "Keyboard Layout Changed to $new_layout"
|
||||
}
|
||||
|
||||
disable_edp1() {
|
||||
enable_edp1
|
||||
sleep 1
|
||||
hyprctl keyword monitor eDP-1,disable
|
||||
}
|
||||
enable_edp1() {
|
||||
hyprctl keyword monitor eDP-1,preferred,auto,1
|
||||
}
|
||||
|
||||
weather() {
|
||||
city=kohalpur
|
||||
cachedir=~/.cache/rbn
|
||||
cachefile=${0##*/}-$1
|
||||
|
||||
mkdir -p $cachedir
|
||||
touch $cachedir/$cachefile
|
||||
|
||||
SAVEIFS=$IFS;IFS=$'\n'
|
||||
cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
|
||||
[ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ] && {
|
||||
data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1))
|
||||
for i in {1..2}; do echo ${data[$i]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile; done
|
||||
}
|
||||
IFS=$SAVEIFS
|
||||
|
||||
weather=($(cat $cachedir/$cachefile))
|
||||
temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g')
|
||||
|
||||
case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
|
||||
clear|sunny) condition="" ;;
|
||||
partly\ cloudy) condition="" ;;
|
||||
cloudy) condition="" ;;
|
||||
overcast) condition="" ;;
|
||||
fog|freezing\ fog) condition="" ;;
|
||||
patchy\ rain\ possible|patchy\ light\ drizzle|light\ drizzle|patchy\ light\ rain|light\ rain|light\ rain\ shower|mist|rain) condition="" ;;
|
||||
moderate\ rain\ at\ times|moderate\ rain|heavy\ rain\ at\ times|heavy\ rain|moderate\ or\ heavy\ rain\ shower|torrential\ rain\ shower|rain\ shower) condition="" ;;
|
||||
patchy\ snow\ possible|patchy\ sleet\ possible|patchy\ freezing\ drizzle\ possible|freezing\ drizzle|heavy\ freezing\ drizzle|light\ freezing\ rain|moderate\ or\ heavy\ freezing\ rain|light\ sleet|ice\ pellets|light\ sleet\ showers|moderate\ or\ heavy\ sleet\ showers) condition="" ;;
|
||||
blowing\ snow|moderate\ or\ heavy\ sleet|patchy\ light\ snow|light\ snow|light\ snow\ showers) condition="" ;;
|
||||
blizzard|patchy\ moderate\ snow|moderate\ snow|patchy\ heavy\ snow|heavy\ snow|moderate\ or\ heavy\ snow\ with\ thunder|moderate\ or\ heavy\ snow\ showers) condition="" ;;
|
||||
thundery\ outbreaks\ possible|patchy\ light\ rain\ with\ thunder|moderate\ or\ heavy\ rain\ with\ thunder|patchy\ light\ snow\ with\ thunder) condition="" ;;
|
||||
*) condition="" ;;
|
||||
esac
|
||||
|
||||
echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
if [ ! -z "$@" ]; then
|
||||
QUERY=$@
|
||||
|
||||
# Check if the query starts with "/"
|
||||
if [[ "$@" == /* ]]; then
|
||||
if [[ "$@" == *\?\? ]]; then
|
||||
# If the query ends with "??", open the directory
|
||||
coproc ( exo-open "${QUERY%\/* \?\?}" > /dev/null 2>&1 )
|
||||
exec 1>&-
|
||||
exit;
|
||||
else
|
||||
# Open the file or directory
|
||||
coproc ( exo-open "$@" > /dev/null 2>&1 )
|
||||
exec 1>&-
|
||||
exit;
|
||||
fi
|
||||
elif [[ "$@" == \!\!* ]]; then
|
||||
# Display help messages
|
||||
echo "!!-- Type your search query to find files"
|
||||
echo "!!-- To search again type !<search_query>"
|
||||
echo "!!-- To search parent directories type ?<search_query>"
|
||||
echo "!!-- You can print this help by typing !!"
|
||||
elif [[ "$@" == \?* ]]; then
|
||||
# Display search results for parent directories, including hidden files
|
||||
echo "!!-- Type another search query"
|
||||
while read -r line; do
|
||||
echo "$line" \?\?
|
||||
done <<< $(find ~ -type d -o -type f -iname *"${QUERY#\?}"* -print)
|
||||
else
|
||||
# Display search results for files, including hidden files
|
||||
echo "!!-- Type another search query"
|
||||
find ~ -type d -o -type f -iname *"${QUERY#!}"* -print
|
||||
fi
|
||||
else
|
||||
# Display initial help messages
|
||||
echo "!!-- Type your search query to find files"
|
||||
echo "!!-- To search again type !<search_query>"
|
||||
echo "!!-- To search parent directories type ?<search_query>"
|
||||
echo "!!-- You can print this help by typing !!"
|
||||
fi
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/bin/bash
|
||||
#playerctl
|
||||
|
||||
music_icon="$HOME/.config/swaync/icons/music.png"
|
||||
|
||||
# Play the next track
|
||||
play_next() {
|
||||
playerctl next
|
||||
show_music_notification
|
||||
}
|
||||
|
||||
# Play the previous track
|
||||
play_previous() {
|
||||
playerctl previous
|
||||
show_music_notification
|
||||
}
|
||||
|
||||
# Toggle play/pause
|
||||
toggle_play_pause() {
|
||||
playerctl play-pause
|
||||
show_music_notification
|
||||
}
|
||||
|
||||
# Stop playback
|
||||
stop_playback() {
|
||||
playerctl stop
|
||||
notify-send -e -u low -i "$music_icon" "Playback Stopped"
|
||||
}
|
||||
|
||||
# Display notification with song information
|
||||
show_music_notification() {
|
||||
status=$(playerctl status)
|
||||
if [[ "$status" == "Playing" ]]; then
|
||||
song_title=$(playerctl metadata title)
|
||||
song_artist=$(playerctl metadata artist)
|
||||
notify-send -e -u low -i "$music_icon" "Now Playing:" "$song_title\nby $song_artist"
|
||||
elif [[ "$status" == "Paused" ]]; then
|
||||
notify-send -e -u low -i "$music_icon" "Playback Paused"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get media control action from command line argument
|
||||
case "$1" in
|
||||
"--nxt")
|
||||
play_next
|
||||
;;
|
||||
"--prv")
|
||||
play_previous
|
||||
;;
|
||||
"--pause")
|
||||
toggle_play_pause
|
||||
;;
|
||||
"--stop")
|
||||
stop_playback
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [--nxt|--prv|--pause|--stop]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1,63 +0,0 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Control music using keyboard
|
||||
|
||||
|
||||
# M should open the rofi-music menu
|
||||
# i should increase volume
|
||||
# u should decrease volume
|
||||
# n should trigger next track
|
||||
# p should trigger previous track
|
||||
# k should pause resume music
|
||||
# s should stop music
|
||||
|
||||
function open_rofi_music(){
|
||||
exec $HOME/.config/hypr/scripts/RofiMusic.sh
|
||||
}
|
||||
|
||||
function increase_volume(){
|
||||
current_volume=$(playerctl --player=mpv volume)
|
||||
new_volume=$(echo "$current_volume + 0.1" | bc)
|
||||
playerctl --player=mpv volume $new_volume && notify-send "🔊 Increasing track volume"
|
||||
}
|
||||
|
||||
function decrease_volume(){
|
||||
current_volume=$(playerctl --player=mpv volume)
|
||||
new_volume=$(echo "$current_volume - 0.1" | bc)
|
||||
playerctl --player=mpv volume $new_volume && notify-send "🔉 Decreasing track volume"
|
||||
}
|
||||
|
||||
function next_track(){
|
||||
playerctl --player=mpv next && notify-send "⏭️ Next track playing"
|
||||
}
|
||||
|
||||
function prev_track(){
|
||||
playerctl --player=mpv previous && notify-send "⏮️ Previous track playing"
|
||||
}
|
||||
|
||||
function play_pause(){
|
||||
status=$(playerctl --player=mpv status)
|
||||
if [[ "$status" == "Playing" ]]
|
||||
then
|
||||
playerctl --player=mpv pause && notify-send "⏸️ Music paused"
|
||||
else
|
||||
playerctl --player=mpv play && notify-send "▶️ Resuming music"
|
||||
fi
|
||||
}
|
||||
|
||||
function stop_music(){
|
||||
kill $(pidof "rofi-music") && notify-send "🛑 Music stopped"
|
||||
}
|
||||
|
||||
while getopts midnpks flag
|
||||
do
|
||||
case "${flag}" in
|
||||
m) open_rofi_music ;;
|
||||
i) increase_volume ;;
|
||||
d) decrease_volume ;;
|
||||
s) stop_music ;;
|
||||
n) next_track ;;
|
||||
p) prev_track ;;
|
||||
k) play_pause ;;
|
||||
esac
|
||||
done
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
iDIR="$HOME/.config/swaync/icons"
|
||||
LOFI_STREAM="https://www.youtube.com/watch?v=jfKfPfyJRdk"
|
||||
NEPALI_OLD_SONG="https://youtube.com/playlist?list=PLXuVG9D9JQ8RAhpH2TyISgBgEmXONIhGY&si=SLyxb2vxaE0XuXsz"
|
||||
BOLLYWOOD_LOVE_SONG="https://youtube.com/playlist?list=PL9bw4S5ePsEEqCMJSiYZ-KTtEjzVy0YvK&si=J0gPvKL4R4fIlPz9"
|
||||
TOP_50_BOLLYWOOD="https://youtube.com/playlist?list=PLHuHXHyLu7BEnMJNeVvkXpxapvDSp5UdI&si=-TBeeNJ28NqVcnKu"
|
||||
BHAJAN="https://youtube.com/playlist?list=PLwIh-QEhrDJDM8IF3gLUgnEyZm6dBgr_n&si=_RDHngYobHlcxaJW"
|
||||
|
||||
play=" Play music"
|
||||
pause=" Pause music"
|
||||
stop=" Stop music"
|
||||
next_track=" Next track"
|
||||
prev_track=" Previous track"
|
||||
increase_volume=" Increase volume"
|
||||
decrease_volume=" Decrease volume"
|
||||
|
||||
play_bhajan=" Play Bhajan"
|
||||
play_lofi=" Play lofi girl"
|
||||
play_old_nepali="1. Play Nepali Old Song"
|
||||
play_bollywood_love="2. Play BollyWood Love"
|
||||
play_TOP_50_BOLLYWOOD="3. Play Top 50 BollyWood"
|
||||
|
||||
notify() { notify-send -u normal -i "$iDIR/music.png" "$1"; }
|
||||
|
||||
music() {
|
||||
if pgrep -x "mpv" > /dev/null; then
|
||||
controls
|
||||
else
|
||||
local chosen=$(printf "%s\n%s\n%s\n%s\n" "$play_bhajan" "$play_lofi" "$play_old_nepali" "$play_bollywood_love" "$play_TOP_50_BOLLYWOOD" | rofi -dmenu -i -l 5 -p "Music Time:" -config ~/.config/rofi/config.rasi)
|
||||
|
||||
case "$chosen" in
|
||||
"$play_bhajan") notify "Playing Bhajan"; exec -a "rofi-music" mpv --no-video "$BHAJAN" --shuffle --no-resume-playback ;;
|
||||
"$play_lofi") notify "🎹 Playing lofi girl"; exec -a "rofi-music" mpv --no-video "$LOFI_STREAM" --no-resume-playback ;;
|
||||
"$play_old_nepali") notify "🎹 Playing nepali old song"; exec -a "rofi-music" mpv --no-video "$NEPALI_OLD_SONG" --shuffle --no-resume-playback ;;
|
||||
"$play_bollywood_love") notify "🎹 Playing bollywood love"; exec -a "rofi-music" mpv --no-video "$BOLLYWOOD_LOVE_SONG" --shuffle --no-resume-playback ;;
|
||||
"$play_TOP_50_BOLLYWOOD") notify "🎹 Playing top 50 bollywood"; exec -a "rofi-music" mpv --no-video "$TOP_50_BOLLYWOOD" --shuffle --no-resume-playback ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
controls() {
|
||||
local chosen=$(printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n" "$play" "$pause" "$stop" "$next_track" "$prev_track" "$increase_volume" "$decrease_volume" | rofi -dmenu -i -l 7 -p "Music Controls:" -config ~/.config/rofi/config.rasi)
|
||||
|
||||
case "$chosen" in
|
||||
"$play") playerctl --player=mpv play && notify-send -u normal -i "$1" "▶️ Resuming music" ;;
|
||||
"$pause") playerctl --player=mpv pause && notify-send -u normal -i "$1" "⏸️ Music paused" ;;
|
||||
"$stop") kill $(pidof "rofi-music") && notify-send -u normal -i "$1" "🛑 Music stopped" ;;
|
||||
"$next_track") playerctl --player=mpv next && notify-send -u normal -i "$1" "⏭️ Next track playing" ;;
|
||||
"$prev_track") playerctl --player=mpv previous && notify-send -u normal -i "$1" "⏮️ Previous track playing" ;;
|
||||
"$increase_volume") adjust_volume 0.1 "🔊 Increasing track volume" ;;
|
||||
"$decrease_volume") adjust_volume -0.1 "🔉 Decreasing track volume" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
adjust_volume() {
|
||||
current_volume=$(playerctl --player=mpv volume)
|
||||
new_volume=$(echo "$current_volume + $1" | bc)
|
||||
playerctl --player=mpv volume "$new_volume"
|
||||
notify-send -u normal -i "$iDIR/music.png" "$2"
|
||||
}
|
||||
|
||||
while getopts midnpks flag; do
|
||||
case "${flag}" in
|
||||
m) music ;;
|
||||
i) adjust_volume 0.1 "🔊 Increasing track volume" ;;
|
||||
d) adjust_volume -0.1 "🔉 Decreasing track volume" ;;
|
||||
s) kill $(pidof "rofi-music") && notify-send "🛑 Music stopped" ;;
|
||||
n) playerctl --player=mpv next && notify-send "⏭️ Next track playing" ;;
|
||||
p) playerctl --player=mpv previous && notify-send "⏮️ Previous track playing" ;;
|
||||
k) play_pause ;;
|
||||
esac
|
||||
done
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
# For TouchPad
|
||||
HYPRLAND_DEVICE="dll07a7:01-044e:120b"
|
||||
DIR=$HOME/.cache
|
||||
STATUS_FILE="$DIR/touchpad.status"
|
||||
|
||||
# For Notification icon
|
||||
notif="$HOME/.config/swaync/images/bell.png"
|
||||
|
||||
# Scripts DIR
|
||||
SCRIPTSDIR="$HOME/.config/hypr/scripts"
|
||||
UserSCRIPTSDIR="$HOME/.config/hypr/UserScripts"
|
||||
linker="$SCRIPTSDIR/Linker.sh"
|
||||
|
||||
|
||||
# For Tmux Sessions
|
||||
ADD=" Add new session"
|
||||
DELETE=" Delete a session"
|
||||
QUIT=" Quit"
|
||||
|
||||
|
||||
# For Random Wallpaper
|
||||
wallDIR="$HOME/Pictures/wallpapers"
|
||||
FPS=60
|
||||
TYPE="random"
|
||||
DURATION=1
|
||||
BEZIER=".43,1.19,1,.4"
|
||||
SWWW_PARAMS="--transition-fps ${FPS} --transition-type ${TYPE} --transition-duration ${DURATION} --transition-bezier ${BEZIER}"
|
||||
|
||||
# For Select Wallpaper
|
||||
FPS1=30
|
||||
TYPE1="wipe"
|
||||
DURATION1=1
|
||||
BEZIER1=".43,1.19,1,.4"
|
||||
SWWW_PARAMS1="--transition-fps $FPS1 --transition-type $TYPE1 --transition-duration $DURATION1"
|
||||
|
||||
|
||||
# For Keyboard Layout Switcher
|
||||
layout_f="$HOME/.cache/kb_layout"
|
||||
settings_file="$HOME/.config/hypr/UserConfigs/UserSettings.conf"
|
||||
|
||||
|
||||
# For Quickedit
|
||||
configs="$HOME/.config/hypr/configs"
|
||||
UserConfigs="$HOME/.config/hypr/UserConfigs"
|
||||
|
||||
|
||||
# For TODO
|
||||
file="$HOME/Documents/Notes/.rofi_todo"
|
||||
touch "$file"
|
||||
prompt="Add/delete a task: "
|
||||
height=$(wc -l "$file" | awk '{print $1}')
|
||||
|
||||
|
||||
# For Waybar Layout
|
||||
config_dir="$HOME/.config/waybar/configs"
|
||||
waybar_config="$HOME/.config/waybar/config"
|
||||
CMD="$SCRIPTSDIR/RunCMD.sh reload"
|
||||
|
||||
|
||||
# For Note
|
||||
NOTES_AUTHOR="$(whoami)"
|
||||
NOTES_FOLDER="$HOME/Documents/Notes"
|
||||
NOTES_EDITOR="kitty nvim"
|
||||
|
||||
# Misc
|
||||
lock="$SCRIPTSDIR/device_cmd.sh lockscreen"
|
||||
|
||||
|
||||
# Wallpaper Downloader
|
||||
CATEGORIES=100
|
||||
FILTER=100
|
||||
RESOLUTION=1920x1080
|
||||
ATLEAST=1920x1080
|
||||
ASPECTRATIO=16x9
|
||||
TOPRANGE=1y
|
||||
ORDER=desc
|
||||
COLLECTION="Default"
|
||||
COLOR=""
|
||||
PARALLEL=1
|
||||
THUMBS=24
|
||||
LOCATION=$HOME/Pictures/Wallpapers
|
||||
APIKEY="u4YNdj6N0M7nkrM2Pbz7fHAY0EYIT5WL"
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Scripts for refreshing waybar, rofi, swaync
|
||||
|
||||
SCRIPTSDIR=$HOME/.config/hypr/scripts
|
||||
UserSCRIPTSDIR=$HOME/.config/hypr/UserScripts
|
||||
|
||||
# Define file_exists function
|
||||
file_exists() {
|
||||
if [ -e "$1" ]; then
|
||||
return 0 # File exists
|
||||
else
|
||||
return 1 # File does not exist
|
||||
fi
|
||||
}
|
||||
|
||||
# Kill already running processes
|
||||
_ps=(waybar rofi swaync)
|
||||
for _prs in "${_ps[@]}"; do
|
||||
if pidof "${_prs}" >/dev/null; then
|
||||
pkill "${_prs}"
|
||||
fi
|
||||
done
|
||||
|
||||
sleep 0.3
|
||||
# Relaunch waybar
|
||||
waybar &
|
||||
|
||||
# relaunch swaync
|
||||
sleep 0.5
|
||||
swaync > /dev/null 2>&1 &
|
||||
|
||||
# Relaunching rainbow borders if the script exists
|
||||
sleep 1
|
||||
if file_exists "${UserSCRIPTSDIR}/RainbowBorders.sh"; then
|
||||
${UserSCRIPTSDIR}/RainbowBorders.sh &
|
||||
fi
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# A rofi mode script that allows calculations to be done
|
||||
# by Adnan Shameem (adnan360). License: MIT (Expat)
|
||||
#
|
||||
# Usage:
|
||||
# - Download this into a dir
|
||||
# - Make sure it's executable: chmod +x rofi-calc.sh
|
||||
# - Make sure you have at least one of these:
|
||||
# - bc
|
||||
# - python (v2 or v3)
|
||||
# - bcalc (curl -LO https://github.com/Phate6660/bcalc/blob/master/bcalc && chmod +x bcalc)
|
||||
# - Run: rofi -modi "calc:./rofi-calc.sh" -show calc
|
||||
# or, use this to have both run and calc options: rofi -combi-modi "calc:./rofi-calc.sh",run -show combi
|
||||
# - Enter expressions like "2+2", "15-5", "10*2", "3^2" to get results
|
||||
|
||||
# Handle input
|
||||
# Important! It has to be before anything else is done in the script.
|
||||
# Otherwise it will keep reopening the menu indefinitely!
|
||||
if [ ! -z "$@" ]; then
|
||||
# To strip spaces
|
||||
input=$(echo "$@" | sed 's/[[:space:]]*//g')
|
||||
# If input has numbers and symbols, process it
|
||||
if grep -q '+\|-[[:digit:]]\|\*\|\/\|\^' <<<"$input"; then
|
||||
if [ ! -z "$(command -v bc)" ]; then # has bc package on system
|
||||
# If there is an equal sign (=) at the end, get rid of it.
|
||||
input=$(echo "$input" | sed 's/\=//g')
|
||||
# Show the result in a notification.
|
||||
echo "$input = "$( echo $input | bc )
|
||||
elif [ ! -z "$(command -v python)" ]; then # has python package on system
|
||||
# If there is an equal sign (=) at the end, get rid of it.
|
||||
# Replace "^" with "**" so that it can calculate powers.
|
||||
input=$(echo "$input" | sed 's/\=//g;s/\^/**/g')
|
||||
# Show the result in a notification.
|
||||
# The "float(1)*" part is so that Python 2 returns decimal places.
|
||||
echo "$input = "$( python -c "print( float(1)*$input )" )
|
||||
elif [ -f "$(dirname $0)/bcalc" ]; then # has bcalc
|
||||
# If there is an equal sign (=) at the end, get rid of it.
|
||||
input=$(echo "$input" | sed 's/\=//g')
|
||||
echo "$input = "$($(dirname $0)/bcalc "$input")
|
||||
else
|
||||
echo 'Error: No calculation utility found.'
|
||||
echo 'Please install bc, python or bcalc.'
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Change prompt
|
||||
echo -en "\0prompt\x1fcalc\n"
|
||||
@@ -1,133 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# <<--------- Settings --------->> #
|
||||
|
||||
# Set the directory where the notes are stored
|
||||
NOTES_DIR="$HOME/Documents/Notes"
|
||||
# Set the editor to use
|
||||
EDITOR=nvim
|
||||
TERMINAL=kitty
|
||||
|
||||
# <<--------- Choosing Templates --------->> #
|
||||
Basic() {
|
||||
|
||||
notify-send "Basic Document Created!"
|
||||
cp $NOTES_DIR/Templates/SimpleNote.md $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
$TERMINAL -e $EDITOR $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
}
|
||||
|
||||
LaTeX() {
|
||||
|
||||
notify-send "LaTeX Document Created!"
|
||||
cp $NOTES_DIR/Templates/LaTeX.tex $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
$TERMINAL -e $EDITOR $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
}
|
||||
|
||||
Beamer() {
|
||||
|
||||
notify-send "Beamer Presentation Created!"
|
||||
cp $NOTES_DIR/Templates/Presentation.tex $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
$TERMINAL -e $EDITOR $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
}
|
||||
|
||||
RMark() {
|
||||
|
||||
notify-send "R Markdown Document Created!"
|
||||
cp $NOTES_DIR/Templates/RMarkdown.rmd $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
$TERMINAL -e $EDITOR $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
}
|
||||
|
||||
template() {
|
||||
|
||||
tm_chosen=$(cat $HOME/Documents/Notes/Templates/temp_options.md | rofi -dmenu -i -p "Choose Template")
|
||||
|
||||
if [ "$tm_chosen" = "Basic" ]; then
|
||||
EXTENSION="md"
|
||||
check
|
||||
Basic
|
||||
elif [ "$tm_chosen" = "LaTeX" ]; then
|
||||
EXTENSION="tex"
|
||||
check
|
||||
LaTeX
|
||||
elif [ "$tm_chosen" = "RMark" ]; then
|
||||
EXTENSION="rmd"
|
||||
check
|
||||
RMark
|
||||
elif [ "$tm_chosen" = "Beamer" ]; then
|
||||
EXTENSION="tex"
|
||||
check
|
||||
Beamer
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
check() {
|
||||
|
||||
if [ -f $NOTES_DIR/"$cn_name".$EXTENSION ]; then
|
||||
cn_exist=$(rofi -dmenu -i -p "Note already exists! Do you want to overwrite it?")
|
||||
if [ "$cn_exist" = "y" ]; then
|
||||
notify-send "New Note Created!" && $TERMINAL -e $EDITOR $NOTES_DIR/"$cn_name".$EXTENSION
|
||||
exit 0
|
||||
elif [ "$cn_exist" = "n" ]; then
|
||||
create_note
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
create_note() {
|
||||
|
||||
cn_name=$(rofi -dmenu -i -p "Enter the note name")
|
||||
if [ -z "$cn_name" ]; then
|
||||
exit 0
|
||||
else
|
||||
template
|
||||
fi
|
||||
}
|
||||
|
||||
view_note() {
|
||||
|
||||
selected=$(find $NOTES_DIR -type f -name "*" | rofi -dmenu -i -p "Open")
|
||||
if [ -z "$selected" ]; then
|
||||
exit 0
|
||||
else
|
||||
$TERMINAL -e $EDITOR $selected
|
||||
fi
|
||||
}
|
||||
|
||||
delete_note() {
|
||||
|
||||
selected=$(find $NOTES_DIR -type f -name "*" | rofi -dmenu -i -p "Delete")
|
||||
rm $selected
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
# Check if the note directory exists
|
||||
if [ ! -d $NOTES_DIR ]; then
|
||||
mk_chosen=$(rofi -dmenu -i -p "Notes directory not found! Do you want to create it?")
|
||||
if [ "$mk_chosen" = "y" ]; then
|
||||
mkdir $NOTES_DIR
|
||||
elif [ "$mk_chosen" = "n" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
main_chosen=$(cat $HOME/Documents/Notes/Templates/main_options.md | rofi -dmenu -i -p "Choose an option")
|
||||
if [ -z "$main_chosen" ]; then
|
||||
exit 0
|
||||
else
|
||||
if [ "$main_chosen" = "Create a new note" ]; then
|
||||
create_note
|
||||
elif [ "$main_chosen" = "View notes" ]; then
|
||||
view_note
|
||||
elif [ "$main_chosen" = "Delete a note" ]; then
|
||||
delete_note
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Powermenu using rofi (Power, Screen Lock, Suspend, etc)
|
||||
|
||||
# CMDs
|
||||
uptime_info=$(uptime -p | sed -e 's/up //g')
|
||||
host=$(hostnamectl hostname)
|
||||
|
||||
# Options with Icons and Text
|
||||
options=("Lock(l)" "Suspend(u)" "Logout(e)" "Reboot(r)" "Shutdown(s)" "Hibernate(h)")
|
||||
icons=("" "" "" "" "" "")
|
||||
|
||||
# Rofi CMD
|
||||
rofi_cmd() {
|
||||
options_with_icons=()
|
||||
for ((i = 0; i < ${#options[@]}; i++)); do
|
||||
options_with_icons+=("${icons[$i]} ${options[$i]}")
|
||||
done
|
||||
|
||||
chosen_option=$(printf "%s\n" "${options_with_icons[@]}" | \
|
||||
rofi -dmenu -i -p " $USER@$host" -mesg " Uptime: $uptime_info" \
|
||||
-kb-select-1 "l" \
|
||||
-kb-select-2 "u" \
|
||||
-kb-select-3 "e" \
|
||||
-kb-select-4 "r" \
|
||||
-kb-select-5 "s" \
|
||||
-kb-select-6 "h" \
|
||||
-theme ~/.config/rofi/config-powermenu.rasi | awk '{print $1}')
|
||||
echo "$chosen_option"
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
case $1 in
|
||||
"")
|
||||
swaylock &
|
||||
;;
|
||||
"")
|
||||
swaylock -f && systemctl suspend
|
||||
;;
|
||||
"")
|
||||
hyprctl dispatch exit 0
|
||||
;;
|
||||
"")
|
||||
systemctl reboot
|
||||
;;
|
||||
"")
|
||||
systemctl poweroff
|
||||
;;
|
||||
"")
|
||||
swaylock -f && systemctl hibernate
|
||||
;;
|
||||
*)
|
||||
echo "choose: $1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen_option=$(rofi_cmd)
|
||||
run_cmd "${chosen_option% *}"
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function tmux_sessions() {
|
||||
tmux list-sessions | sed 's/: /| /' | column -t -s'|' -o' | '
|
||||
}
|
||||
|
||||
ROFI_THEME="$HOME/.config/rofi/config.rasi"
|
||||
ADD=" Add new session"
|
||||
DELETE=" Delete a session"
|
||||
QUIT=" Quit"
|
||||
|
||||
TMUX_SESSION=$(
|
||||
(printf "%s\n" "$ADD" "$DELETE" "$QUIT"; tmux_sessions) |
|
||||
rofi -theme "$ROFI_THEME" -dmenu -p " Tmux" -no-show-icons
|
||||
)
|
||||
|
||||
if [[ "$ADD" = "$TMUX_SESSION" ]]; then
|
||||
kitty -e tmux new-session &
|
||||
elif [[ "$DELETE" = "$TMUX_SESSION" ]]; then
|
||||
SESSION_TO_DELETE=$(tmux_sessions | rofi -dmenu -p "Select session to delete" | awk '{print $1}')
|
||||
[ -n "$SESSION_TO_DELETE" ] && tmux kill-session -t "$SESSION_TO_DELETE"
|
||||
elif [[ "$QUIT" = "$TMUX_SESSION" ]]; then
|
||||
exit
|
||||
elif [[ -n "$TMUX_SESSION" ]]; then
|
||||
SESSION=$(echo "$TMUX_SESSION" | cut -d\ -f1)
|
||||
kitty -e tmux attach -t "$SESSION" &
|
||||
fi
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Set default todo file
|
||||
if [ -z ${TODO_FILE+x} ]; then
|
||||
TODO_FILE=~/.rofi_todos
|
||||
fi
|
||||
|
||||
if [[ ! -a "${TODO_FILE}" ]]; then
|
||||
touch "${TODO_FILE}"
|
||||
fi
|
||||
|
||||
function add_todo() {
|
||||
echo -e "`date +"%B %d %H:%M"` $*" >> "${TODO_FILE}"
|
||||
}
|
||||
|
||||
function remove_todo() {
|
||||
if [[ ! -z "$DONE_FILE" ]]; then
|
||||
echo "${*}" >> "${DONE_FILE}"
|
||||
fi
|
||||
sed -i "/^${*}$/d" "${TODO_FILE}"
|
||||
}
|
||||
|
||||
function get_todos() {
|
||||
echo "$(cat "${TODO_FILE}")"
|
||||
}
|
||||
|
||||
if [ -z "$@" ]; then
|
||||
get_todos
|
||||
else
|
||||
LINE=$(echo "${@}" | sed "s/\([^a-zA-Z0-9]\)/\\\\\\1/g")
|
||||
LINE_UNESCAPED=${@}
|
||||
if [[ $LINE_UNESCAPED == +* ]]; then
|
||||
LINE_UNESCAPED=$(echo $LINE_UNESCAPED | sed s/^+//g |sed s/^\s+//g )
|
||||
add_todo ${LINE_UNESCAPED}
|
||||
else
|
||||
MATCHING=$(grep "^${LINE_UNESCAPED}$" "${TODO_FILE}")
|
||||
if [[ -n "${MATCHING}" ]]; then
|
||||
remove_todo ${LINE_UNESCAPED}
|
||||
fi
|
||||
fi
|
||||
get_todos
|
||||
fi
|
||||
Executable
+228
@@ -0,0 +1,228 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# Source the configuration file.
|
||||
CONFIG_FILE=~/.config/hypr/scripts/Ref.sh
|
||||
source "$CONFIG_FILE"
|
||||
|
||||
|
||||
# Todo List (SHIFT ALT T)
|
||||
todo() {
|
||||
while cmd=$(rofi -dmenu -p "$prompt" -lines "$height" "$@" < "$file"); [ -n "$cmd" ]; do
|
||||
if grep -q "^$cmd\$" "$file"; then
|
||||
grep -v "^$cmd\$" "$file" > "$file.$$"
|
||||
mv "$file.$$" "$file"
|
||||
((height--))
|
||||
else
|
||||
echo "$cmd" >> "$file"
|
||||
((height++))
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
# Function For Calculator (ALT C)
|
||||
calc() {
|
||||
roficmd="rofi -dmenu -p Calc $@"
|
||||
|
||||
while true; do
|
||||
result=$(xsel -o -b | $roficmd | xargs echo | bc -l 2>&1)
|
||||
|
||||
if [[ $result ]]; then
|
||||
printf "$result" | xsel -b
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Funtion for Tmux Sessions (ALT t)
|
||||
tmux(){
|
||||
tmux_sessions() {
|
||||
tmux list-sessions | sed 's/: /| /' | column -t -s'|' -o' | '
|
||||
}
|
||||
add_session() {
|
||||
kitty -e tmux new-session
|
||||
}
|
||||
delete_session() {
|
||||
SESSION_TO_DELETE=$(tmux_sessions | rofi -dmenu -p "Select session to delete" | awk '{print $1}')
|
||||
[ -n "$SESSION_TO_DELETE" ] && tmux kill-session -t "$SESSION_TO_DELETE"
|
||||
}
|
||||
main() {
|
||||
if pgrep -x rofi > /dev/null; then
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
TMUX_SESSION=$(
|
||||
(printf "%s\n" "$ADD" "$DELETE" "$QUIT"; tmux_sessions) |
|
||||
rofi -dmenu -p " Tmux" -no-show-icons
|
||||
)
|
||||
case "$TMUX_SESSION" in
|
||||
"$ADD") add_session ;;
|
||||
"$DELETE") delete_session ;;
|
||||
"$QUIT") exit ;;
|
||||
*)
|
||||
if [ -n "$TMUX_SESSION" ]; then
|
||||
SESSION=$(echo "$TMUX_SESSION" | cut -d\ -f1)
|
||||
kitty -e tmux attach -t "$SESSION"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
main
|
||||
}
|
||||
|
||||
|
||||
# Take note (ALT B)
|
||||
note() {
|
||||
[ ! -d "$NOTES_FOLDER" ] && mkdir -p "$NOTES_FOLDER"
|
||||
}
|
||||
get_notes() {
|
||||
ls "$NOTES_FOLDER"
|
||||
}
|
||||
edit_note() {
|
||||
$NOTES_EDITOR "$1"
|
||||
}
|
||||
delete_note() {
|
||||
note=$1
|
||||
action=$(echo -e "Yes\nNo" | rofi -dmenu -p "Delete $note? ")
|
||||
|
||||
case $action in
|
||||
"Yes")
|
||||
rm "$NOTES_FOLDER/$note"
|
||||
main ;;
|
||||
"No")
|
||||
main ;;
|
||||
esac
|
||||
}
|
||||
note_context() {
|
||||
note=$1
|
||||
note_location="$NOTES_FOLDER/$note"
|
||||
action=$(echo -e "Edit\nDelete" | rofi -dmenu -p "$note > ")
|
||||
|
||||
case $action in
|
||||
"Edit") edit_note "$note_location"; exit 0 ;;
|
||||
"Delete") delete_note "$note"; exit 0 ;;
|
||||
esac
|
||||
|
||||
exit 1
|
||||
}
|
||||
new_note() {
|
||||
title=$(echo -e "Cancel" | rofi -dmenu -p "Input title: ")
|
||||
|
||||
case "$title" in
|
||||
"Cancel") main ;;
|
||||
*)
|
||||
file=$(echo "$title" | sed 's/ /_/g;s/\(.*\)/\L\1/g')
|
||||
template="---\ntitle: $title\ndate: $(date --rfc-3339=seconds)\nauthor: $NOTES_AUTHOR\n---\n"
|
||||
note_location="$NOTES_FOLDER/$file.md"
|
||||
|
||||
[ "$title" != "" ] && echo -e "$template" > "$note_location" | edit_note "$note_location"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
main() {
|
||||
all_notes="$(get_notes)"
|
||||
first_menu="New Note"
|
||||
|
||||
[ "$all_notes" ] && first_menu="New Note\n$all_notes"
|
||||
|
||||
note=$(echo -e "$first_menu" | rofi -dmenu -i -p "Note: ")
|
||||
|
||||
case $note in
|
||||
"New Note") new_note ;;
|
||||
"") exit 1 ;;
|
||||
*) note_context "$note" & ;;
|
||||
esac
|
||||
exit 1
|
||||
main
|
||||
}
|
||||
|
||||
|
||||
# Clipboard Manager. This script uses cliphist, rofi, and wl-copy. (SHIFT ALT C)
|
||||
clip() {
|
||||
while true; do
|
||||
result=$(rofi -dmenu -kb-custom-1 "Control-Delete" -kb-custom-2 "Alt-Delete" -p "CTRL Del - Cliphist del || Alt Del - cliphist wipe" -config ~/.config/rofi/config-long.rasi < <(cliphist list))
|
||||
|
||||
case "$?" in
|
||||
1) exit ;;
|
||||
0) [ -n "$result" ] && cliphist decode <<<"$result" | wl-copy; exit ;;
|
||||
10) cliphist delete <<<"$result" ;;
|
||||
11) cliphist wipe ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Rofi menu for Quick Edit / View of Settings (SUPER E)
|
||||
edit() {
|
||||
menu() {
|
||||
options=("Env-variables" "Window-Rules" "Startup_Apps" "User-Keybinds" "Monitors" "Laptop-Keybinds" "User-Settings" "Default-Settings" "Default-Keybinds")
|
||||
for ((i = 0; i < ${#options[@]}; i++)); do
|
||||
printf "%d. view %s\n" "$((i + 1))" "${options[i]}"
|
||||
done
|
||||
}
|
||||
main() {
|
||||
options=("ENVariables.conf" "WindowRules.conf" "Startup_Apps.conf" "UserKeybinds.conf" "Monitors.conf" "Laptops.conf" "UserSettings.conf" "Settings.conf" "Keybinds.conf")
|
||||
choice=$(menu | rofi -dmenu -i -l 9 -p " View / Edit Hyprland Configs:" | cut -d. -f1)
|
||||
[[ $choice =~ ^[1-9]$ ]] && kitty -e nano "$UserConfigs/${options[choice - 1]}"
|
||||
}
|
||||
main
|
||||
}
|
||||
|
||||
|
||||
# Powermenu (SUPER X)
|
||||
powermenu() {
|
||||
uptime_info=$(uptime -p | sed -e 's/up //g')
|
||||
host=$(hostnamectl hostname)
|
||||
options=("Lock(l)" "Suspend(u)" "Logout(e)" "Reboot(r)" "Shutdown(s)" "Hibernate(h)")
|
||||
icons=("" "" "" "" "" "")
|
||||
|
||||
chosen_option=$(printf "%s\n" "${options[@]}" | \
|
||||
rofi -dmenu -i -p " $USER@$host" -mesg " Uptime: $uptime_info" \
|
||||
-kb-select-1 "l" \
|
||||
-kb-select-2 "u" \
|
||||
-kb-select-3 "e" \
|
||||
-kb-select-4 "r" \
|
||||
-kb-select-5 "s" \
|
||||
-kb-select-6 "h" \
|
||||
-theme ~/.config/rofi/config-powermenu.rasi | awk '{print $1}')
|
||||
|
||||
case $chosen_option in
|
||||
"Lock(l)") swaylock & ;;
|
||||
"Suspend(u)") swaylock -f && systemctl suspend ;;
|
||||
"Logout(e)") hyprctl dispatch exit 0 ;;
|
||||
"Reboot(r)") systemctl reboot ;;
|
||||
"Shutdown(s)") systemctl poweroff ;;
|
||||
"Hibernate(h)") swaylock -f && systemctl hibernate ;;
|
||||
*) echo "choose: $chosen_option" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Keybinds (SUPER F1 )
|
||||
keybind() {
|
||||
CONFIG=$(rofi -show file-browser-extended -file-browser-stdout -file-browser-dir "$HOME"/.config/keyb/bindings -config ~/.config/rofi/config-long.rasi)
|
||||
|
||||
hyprctl dispatch exec "[float;size 45% 80%;center 1] kitty keyb -k '$CONFIG'"
|
||||
}
|
||||
|
||||
# Emoji (ALT SLASH)
|
||||
emoji() {
|
||||
emojis_file="$HOME/.config/hypr/scripts/emoji.txt"
|
||||
|
||||
show_emoji_menu() {
|
||||
awk '{print $1, substr($0, index($0,$2))}' "$emojis_file" | rofi -dmenu -p "🔎 Search" -config ~/.config/rofi/config-long.rasi
|
||||
}
|
||||
|
||||
emojis=$(awk '{print $1}' "$emojis_file" | tr '\n' ' ')
|
||||
selected_emoji=$(show_emoji_menu)
|
||||
|
||||
if [ -n "$selected_emoji" ]; then
|
||||
emoji=$(grep "$selected_emoji" "$emojis_file" | awk '{print $1}')
|
||||
echo -n "$emoji" | wl-copy
|
||||
fi
|
||||
}
|
||||
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ~/.config/hypr/scripts/Ui_cmd.sh
|
||||
source ~/.config/hypr/scripts/Device_cmd.sh
|
||||
source ~/.config/hypr/scripts/Rofi_cmd.sh
|
||||
source ~/.config/hypr/scripts/Music_cmd.sh
|
||||
|
||||
help() {
|
||||
declare -F
|
||||
}
|
||||
if [[ ! -z "$1" ]]; then
|
||||
$1 "${@:2}"
|
||||
fi
|
||||
@@ -1,108 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Screenshots scripts
|
||||
|
||||
iDIR="$HOME/.config/swaync/icons"
|
||||
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png"
|
||||
|
||||
time=$(date "+%d-%b_%H-%M-%S")
|
||||
dir="$(xdg-user-dir)/Pictures/Screenshots"
|
||||
file="Screenshot_${time}_${RANDOM}.png"
|
||||
active_window_path="${dir}/Screenshot_${time}_$(hyprctl -j activewindow | jq -r '(.class)').png"
|
||||
|
||||
active_window_class=$(hyprctl -j activewindow | jq -r '(.class)')
|
||||
active_window_file="Screenshot_${time}_${active_window_class}.png"
|
||||
active_window_path="${dir}/${active_window_file}"
|
||||
|
||||
# notify and view screenshot
|
||||
notify_view() {
|
||||
if [[ "$1" == "active" ]]; then
|
||||
if [[ -e "${active_window_path}" ]]; then
|
||||
${notify_cmd_shot} "Screenshot of '${active_window_class}' Saved."
|
||||
else
|
||||
${notify_cmd_shot} "Screenshot of '${active_window_class}' not Saved"
|
||||
fi
|
||||
else
|
||||
local check_file="$dir/$file"
|
||||
if [[ -e "$check_file" ]]; then
|
||||
${notify_cmd_shot} "Screenshot Saved."
|
||||
else
|
||||
${notify_cmd_shot} "Screenshot NOT Saved."
|
||||
fi
|
||||
fi
|
||||
local msg="Screenshot Saved."
|
||||
[[ "$1" == "active" && ! -e "${active_window_path}" ]] && msg="Screenshot NOT Saved."
|
||||
${notify_cmd_shot} "$msg"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# countdown
|
||||
countdown() {
|
||||
for sec in $(seq $1 -1 1); do
|
||||
notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
|
||||
sleep 1
|
||||
done
|
||||
for sec in $(seq $1 -1 1); do
|
||||
notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
# take shots
|
||||
shotnow() {
|
||||
cd ${dir} && grim - | tee "$file" | wl-copy
|
||||
sleep 2
|
||||
notify_view
|
||||
take_shot() {
|
||||
cd ${dir} && grim - | tee "$file" | wl-copy
|
||||
sleep 2
|
||||
notify_view "$1"
|
||||
}
|
||||
|
||||
shot5() {
|
||||
countdown '5'
|
||||
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
|
||||
sleep 1
|
||||
notify_view
|
||||
shotnow() { take_shot; }
|
||||
shot5() { countdown '5'; sleep 1 && take_shot; }
|
||||
shot10() { countdown '10'; take_shot; }
|
||||
shotarea() { cd ${dir} && grim -g "$(slurp)" - | tee "$file" | wl-copy; notify_view; }
|
||||
shotactive() { hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | grim -g - "${active_window_path}" && sleep 1 && notify_view "active"; }
|
||||
|
||||
}
|
||||
[[ ! -d "$dir" ]] && mkdir -p "$dir"
|
||||
|
||||
shot10() {
|
||||
countdown '10'
|
||||
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
|
||||
notify_view
|
||||
}
|
||||
|
||||
shotwin() {
|
||||
w_pos=$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1)
|
||||
w_size=$(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)
|
||||
cd ${dir} && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy
|
||||
notify_view
|
||||
}
|
||||
|
||||
shotarea() {
|
||||
cd ${dir} && grim -g "$(slurp)" - | tee "$file" | wl-copy
|
||||
notify_view
|
||||
}
|
||||
|
||||
shotactive() {
|
||||
active_window_class=$(hyprctl -j activewindow | jq -r '(.class)')
|
||||
active_window_file="Screenshot_${time}_${active_window_class}.png"
|
||||
active_window_path="${dir}/${active_window_file}"
|
||||
|
||||
hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | grim -g - "${active_window_path}"
|
||||
sleep 1
|
||||
notify_view "active"
|
||||
}
|
||||
|
||||
|
||||
if [[ ! -d "$dir" ]]; then
|
||||
mkdir -p "$dir"
|
||||
fi
|
||||
|
||||
if [[ "$1" == "--now" ]]; then
|
||||
shotnow
|
||||
elif [[ "$1" == "--in5" ]]; then
|
||||
shot5
|
||||
elif [[ "$1" == "--in10" ]]; then
|
||||
shot10
|
||||
elif [[ "$1" == "--win" ]]; then
|
||||
shotwin
|
||||
elif [[ "$1" == "--area" ]]; then
|
||||
shotarea
|
||||
elif [[ "$1" == "--active" ]]; then
|
||||
shotactive
|
||||
else
|
||||
echo -e "Available Options : --now --in5 --in10 --win --area --active"
|
||||
fi
|
||||
case "$1" in
|
||||
--now) shotnow ;;
|
||||
--in5) shot5 ;;
|
||||
--in10) shot10 ;;
|
||||
--area) shotarea ;;
|
||||
--active) shotactive ;;
|
||||
*) echo -e "Available Options: --now --in5 --in10 --area --active"
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This is for changing kb_layouts. Set kb_layouts in $settings_file
|
||||
|
||||
layout_f="$HOME/.cache/kb_layout"
|
||||
settings_file="$HOME/.config/hypr/UserConfigs/UserSettings.conf"
|
||||
notif="$HOME/.config/swaync/images/bell.png"
|
||||
|
||||
# Check if ~/.cache/kb_layout exists and create it with a default layout from Settings.conf if not found
|
||||
if [ ! -f "$layout_f" ]; then
|
||||
default_layout=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2 | cut -d ',' -f 1 2>/dev/null)
|
||||
if [ -z "$default_layout" ]; then
|
||||
default_layout="us" # Default to 'us' layout if Settings.conf or 'kb_layout' is not found
|
||||
fi
|
||||
echo "$default_layout" > "$layout_f"
|
||||
fi
|
||||
|
||||
current_layout=$(cat "$layout_f")
|
||||
|
||||
# Read keyboard layout settings from Settings.conf
|
||||
if [ -f "$settings_file" ]; then
|
||||
kb_layout_line=$(grep 'kb_layout=' "$settings_file" | cut -d '=' -f 2)
|
||||
IFS=',' read -ra layout_mapping <<< "$kb_layout_line"
|
||||
fi
|
||||
|
||||
layout_count=${#layout_mapping[@]}
|
||||
|
||||
# Find the index of the current layout in the mapping
|
||||
for ((i = 0; i < layout_count; i++)); do
|
||||
if [ "$current_layout" == "${layout_mapping[i]}" ]; then
|
||||
current_index=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Calculate the index of the next layout
|
||||
next_index=$(( (current_index + 1) % layout_count ))
|
||||
new_layout="${layout_mapping[next_index]}"
|
||||
|
||||
# Update the keyboard layout
|
||||
hyprctl keyword input:kb_layout "$new_layout"
|
||||
echo "$new_layout" > "$layout_f"
|
||||
|
||||
# Notification for the new keyboard layout
|
||||
notify-send -u low -i "$notif" "Keyboad Layout Changed to $new_layout"
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
notif="$HOME/.config/swaync/images/bell.png"
|
||||
|
||||
# Script to toggle animations in hyprland
|
||||
|
||||
# Function to toggle animations
|
||||
function toggle_mode() {
|
||||
status=$(hyprctl getoption animations:enabled -j | jq ".int")
|
||||
if [[ $status -eq 1 ]]; then
|
||||
notify-send -e -u low -i "$notif" "All animations off"
|
||||
hyprctl keyword animations:enabled 0
|
||||
swww kill
|
||||
else
|
||||
notify-send -e -u normal -i "$notif" "All animations normal"
|
||||
hyprctl keyword animations:enabled 1
|
||||
swww init && swww img "$HOME/.config/hypr/.current_wallpaper"
|
||||
fi
|
||||
}
|
||||
|
||||
# Parse options
|
||||
while getopts t flag; do
|
||||
case "${flag}" in
|
||||
t) toggle_mode ;;
|
||||
esac
|
||||
done
|
||||
Executable
+174
@@ -0,0 +1,174 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source the configuration file.
|
||||
CONFIG_FILE=~/.config/hypr/scripts/Ref.sh
|
||||
source "$CONFIG_FILE"
|
||||
|
||||
|
||||
# Change blur (SUPER SHIFT Q)
|
||||
blur (){
|
||||
STATE=$(hyprctl -j getoption decoration:blur:passes | jq ".int")
|
||||
|
||||
if [ "${STATE}" == "2" ]; then
|
||||
hyprctl keyword decoration:blur:size 2
|
||||
hyprctl keyword decoration:blur:passes 1
|
||||
notify-send -e -u low -i "$notif" "Less blur"
|
||||
else
|
||||
hyprctl keyword decoration:blur:size 5
|
||||
hyprctl keyword decoration:blur:passes 2
|
||||
notify-send -e -u low -i "$notif" "Normal blur"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
rainbowborder() {
|
||||
function random_hex() {
|
||||
random_hex=("0xff$(openssl rand -hex 3)")
|
||||
echo $random_hex
|
||||
}
|
||||
|
||||
hyprctl keyword general:col.active_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
|
||||
|
||||
hyprctl keyword general:col.inactive_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
|
||||
}
|
||||
|
||||
# Change layout to master & dwindle (SUPER SPACE)
|
||||
layout() {
|
||||
LAYOUT=$(hyprctl -j getoption general:layout | jq -r '.str')
|
||||
|
||||
case $LAYOUT in
|
||||
"master")
|
||||
hyprctl keyword general:layout dwindle
|
||||
hyprctl keyword unbind SUPER,J
|
||||
hyprctl keyword unbind SUPER,K
|
||||
hyprctl keyword bind SUPER,J,cyclenext
|
||||
hyprctl keyword bind SUPER,K,cyclenext,prev
|
||||
hyprctl keyword bind SUPER,O,togglesplit
|
||||
notify-send -u low -i "$notif" "Dwindle Layout"
|
||||
;;
|
||||
"dwindle")
|
||||
hyprctl keyword general:layout master
|
||||
hyprctl keyword unbind SUPER,J
|
||||
hyprctl keyword unbind SUPER,K
|
||||
hyprctl keyword unbind SUPER,O
|
||||
hyprctl keyword bind SUPER,J,layoutmsg,cyclenext
|
||||
hyprctl keyword bind SUPER,K,layoutmsg,cycleprev
|
||||
notify-send -u low -i "$notif" "Master Layout"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# Script for Random Wallpaper ( SHIFT ALT W)
|
||||
|
||||
randomwall() {
|
||||
swww query || swww init
|
||||
PICS=("${wallDIR}"/*.{jpg,jpeg,png,gif}) # Array of image files in wallDIR
|
||||
|
||||
if [[ ${#PICS[@]} -gt 0 ]]; then
|
||||
RANDOMPICS=${PICS[RANDOM % ${#PICS[@]}]} # Select a random image
|
||||
swww img "${RANDOMPICS}" ${SWWW_PARAMS} # Set the randomly selected wallpaper
|
||||
$linker
|
||||
else
|
||||
echo "No images found in ${wallDIR}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Change Wallpaper automatically after 30min
|
||||
|
||||
autowall() {
|
||||
INTERVAL=1800 # This controls (in seconds) when to switch to the next image
|
||||
|
||||
while true; do
|
||||
find "$wallDIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \) -print0 \
|
||||
| shuf -z -n 1 \
|
||||
| xargs -0 -I {} swww img "{}" ${SWWW_PARAMS} && $linker
|
||||
|
||||
sleep $INTERVAL
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
# selecting wallpapers (SUPER W)
|
||||
selectwall() {
|
||||
build_theme() {
|
||||
rows="$1"
|
||||
cols="$1"
|
||||
icon_size="$3"
|
||||
echo "element{orientation:vertical;}element-text{horizontal-align:0.5;}element-icon{size:${icon_size}.0000em;}listview{lines:${rows};columns:${cols};}"
|
||||
}
|
||||
if [ ! -d "$wallDIR" ]; then
|
||||
echo "Error: Wallpaper directory not found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
images=$(find "$wallDIR" -maxdepth 1 -type f -printf "%f\x00icon\x1f$wallDIR/%f\n" | sort -n)
|
||||
choice=$(echo -en "$images\nRandom Choice" | rofi -dmenu -i -show-icons -theme-str "$(build_theme 3 5 6)" -config ~/.config/rofi/config-wallpaper.rasi)
|
||||
|
||||
if [ -n "$choice" ]; then
|
||||
if [ "$choice" = "Random Choice" ]; then
|
||||
choice=$(find "$wallDIR" -type f -maxdepth 1 -printf "%f\n" | shuf -n1)
|
||||
fi
|
||||
wallpaper="$wallDIR/${choice#*icon\x1f}"
|
||||
swww img $SWWW_PARAMS1 "$wallpaper" && $linker
|
||||
else
|
||||
echo "No wallpaper selected. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
sr() {
|
||||
if pgrep -x "wf-recorder" > /dev/null; then
|
||||
pkill -SIGTERM wf-recorder
|
||||
wait "$(pgrep -o wf-recorder)" || true
|
||||
notify-send "Screen recording stopped."
|
||||
else
|
||||
wf-recorder --force-yuv -c libx264rgb -t -f "$HOME/Videos/sr--$(date +'%I:%M:%S_%p_%d-%m-%Y.mp4')" --audio=alsa_output.pci-0000_03_00.6.analog-stereo.monitor &
|
||||
disown
|
||||
notify-send "Screen recording started."
|
||||
fi
|
||||
}
|
||||
|
||||
# Waybar Layout (ALT W)
|
||||
waybarl() {
|
||||
menu() {
|
||||
find "$config_dir" -maxdepth 1 -type f -exec basename {} \; | sort
|
||||
}
|
||||
apply_config() {
|
||||
ln -sf "$config_dir/$1" "$waybar_config"
|
||||
pkill -x waybar && sleep 0.1
|
||||
$CMD &
|
||||
}
|
||||
main() {
|
||||
choice=$(menu | rofi -dmenu -p " Choose Waybar Layout")
|
||||
|
||||
[[ -z "$choice" ]] && { echo "No option selected. Exiting."; exit 0; }
|
||||
|
||||
case $choice in
|
||||
"no panel") pkill -x waybar || true ;;
|
||||
*) apply_config "$choice" ;;
|
||||
esac
|
||||
}
|
||||
pgrep -x rofi && { pkill rofi; exit 0; }
|
||||
main
|
||||
}
|
||||
|
||||
# Toggle animations (SUPER SHIFT A)
|
||||
gamemode() {
|
||||
status=$(hyprctl getoption animations:enabled -j | jq ".int")
|
||||
if [[ $status -eq 1 ]]; then
|
||||
notify-send -e -u low -i "$notif" "All animations off"
|
||||
hyprctl keyword animations:enabled 0
|
||||
swww kill
|
||||
else
|
||||
notify-send -e -u normal -i "$notif" "All animations normal"
|
||||
hyprctl keyword animations:enabled 1
|
||||
swww init && swww img "$HOME/.config/rofi/.current_wallpaper"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script for waybar layout or configs
|
||||
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Define directories
|
||||
config_dir="$HOME/.config/waybar/configs"
|
||||
waybar_config="$HOME/.config/waybar/config"
|
||||
scripts_dir="$HOME/.config/hypr/scripts"
|
||||
rofi_config="$HOME/.config/rofi/config.rasi"
|
||||
|
||||
# Function to display menu options
|
||||
menu() {
|
||||
options=()
|
||||
while IFS= read -r file; do
|
||||
options+=("$(basename "$file")")
|
||||
done < <(find "$config_dir" -maxdepth 1 -type f -exec basename {} \; | sort)
|
||||
|
||||
printf '%s\n' "${options[@]}"
|
||||
}
|
||||
|
||||
# Apply selected configuration
|
||||
apply_config() {
|
||||
ln -sf "$config_dir/$1" "$waybar_config"
|
||||
restart_waybar_if_needed
|
||||
}
|
||||
|
||||
# Restart Waybar
|
||||
restart_waybar_if_needed() {
|
||||
if pgrep -x "waybar" >/dev/null; then
|
||||
pkill waybar
|
||||
sleep 0.1 # Delay for Waybar to completely terminate
|
||||
fi
|
||||
"${scripts_dir}/Refresh.sh" &
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
choice=$(menu | rofi -dmenu -p " Choose Waybar Layout" -config "$rofi_config")
|
||||
|
||||
if [[ -z "$choice" ]]; then
|
||||
echo "No option selected. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case $choice in
|
||||
"no panel")
|
||||
pgrep -x "waybar" && pkill waybar || true
|
||||
;;
|
||||
*)
|
||||
apply_config "$choice"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Kill Rofi if already running before execution
|
||||
if pgrep -x "rofi" >/dev/null; then
|
||||
pkill rofi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
main
|
||||
Executable
+109
@@ -0,0 +1,109 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Directory for icons
|
||||
iDIR="$HOME/.config/swaync/icons"
|
||||
scriptsDir="$HOME/.config/hypr/scripts"
|
||||
RunCMD="$scriptsDir/RunCMD.sh"
|
||||
yes='Yes'
|
||||
no='No'
|
||||
# Note: You can add more options below with the following format:
|
||||
# ["TITLE"]="link"
|
||||
|
||||
# Define menu options as an associative array
|
||||
declare -A menu_options=(
|
||||
|
||||
|
||||
#waybar
|
||||
["wbt ToggleWaybar"]="killall -SIGUSR1 waybar"
|
||||
["wbl WaybarLayout"]="$RunCMD waybarl"
|
||||
#hypr
|
||||
["hpr Reload hyprland"]="hyprctl reload"
|
||||
["cl ChangeLayout"]="$RunCMD layout"
|
||||
["rld Reload All"]="$RunCMD reload"
|
||||
["gm GameMode"]="$RunCMD gamemode"
|
||||
["bl ChangeBlur"]="$RunCMD blur"
|
||||
["flt Float all window"]="hyprctl dispatch workspaceopt allfloat"
|
||||
#wallpaper
|
||||
["ws Wallpaper Select"]="$RunCMD selectwall"
|
||||
["wc Random Wallpaper"]="$RunCMD randomwall"
|
||||
#RunCMD
|
||||
["; Launcher"]="rofi -show drun -modi drun,filebrowser,run,window -theme $HOME/.config/rofi/launcher.rasi"
|
||||
["cb Clipboard"]="$RunCMD clip"
|
||||
["rm RunCMDMusic"]="$scriptsDir/Music_cmd.sh -m"
|
||||
["emj RunCMDEmoji"]="$RunCMD emoji"
|
||||
["cc Calculator"]="$RunCMD calc"
|
||||
["td Todo"]="$RunCMD todo"
|
||||
["tx Tmux"]="$RunCMD tmux"
|
||||
["nt Note"]="$RunCMD note"
|
||||
["kb Kebinds"]="$RunCMD keybind"
|
||||
["qe Edits"]="$RunCMD edit"
|
||||
#System
|
||||
["QQ Shutdown"]="needConfim "poweroff""
|
||||
["RR Reboot"]="needConfim "reboot""
|
||||
["pm Powermenu"]="$RunCMD powermenu"
|
||||
["cn Close Notifactions"]="swaync-client -C"
|
||||
["dm0"]="$RunCMD enable_edp1"
|
||||
["dm1"]="$RunCMD enable_edp1"
|
||||
["tt Touchpad"]="$RunCMD touchpad"
|
||||
["tw Wifi"]="$RunCMD wifi"
|
||||
["kb Keyboard switcher"]="$RunCMD kb"
|
||||
#Misc
|
||||
["ff Firefox"]="firefox"
|
||||
["sr ScreenRecord"]="$RunCMD sr"
|
||||
["lg Lazygit"]="kitty lazygit"
|
||||
["vi Nvim"]="kitty nvim"
|
||||
["yz Yazi"]="kitty yazi"
|
||||
["cd Codium"]="codium"
|
||||
)
|
||||
|
||||
# Function for displaying notifications
|
||||
notification() {
|
||||
notify-send -e -u low "$@"
|
||||
}
|
||||
|
||||
confirm_cmd() {
|
||||
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \
|
||||
-theme-str 'mainbox {children: [ "message", "listview" ];}' \
|
||||
-theme-str 'listview {columns: 2; lines: 1;}' \
|
||||
-theme-str 'element-text {horizontal-align: 0.5;}' \
|
||||
-theme-str 'textbox {horizontal-align: 0.5;}' \
|
||||
-kb-accept-entry 'Return,space' \
|
||||
-dmenu \
|
||||
-p 'Confirmation' \
|
||||
-mesg 'Are you Sure?'
|
||||
# -theme ${dir}/${theme}.rasi
|
||||
}
|
||||
|
||||
# Ask for confirmation
|
||||
confirm_exit() {
|
||||
echo -e "$no\n$yes" | confirm_cmd
|
||||
}
|
||||
needConfim() {
|
||||
selected="$(confirm_exit)"
|
||||
if [[ "$selected" == "$yes" ]]; then
|
||||
$1
|
||||
fi
|
||||
}
|
||||
# myt="$(notification number)"
|
||||
# Main function
|
||||
main() {
|
||||
choice=$(
|
||||
printf "%s\n" "${!menu_options[@]}" |
|
||||
rofi -dmenu -config ~/.config/rofi/config-long.rasi \
|
||||
-p "Rofi" \
|
||||
-mesg "Hello" \
|
||||
-max-history-size 0 \
|
||||
-auto-select
|
||||
)
|
||||
|
||||
if [ -z "$choice" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
link="${menu_options[$choice]}"
|
||||
$link
|
||||
# notification "$choice"
|
||||
# test_cmd
|
||||
}
|
||||
|
||||
main
|
||||
Executable → Regular
-10
@@ -1,13 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Rofi Emoticons. Not my own. Cant remember the source
|
||||
|
||||
sed '1,/^### DATA ###$/d' $0 |
|
||||
rofi -dmenu -p "🔎 Search" -config ~/.config/rofi/config-long.rasi|
|
||||
cut -d ' ' -f 1 | tr -d '\n' | wl-copy
|
||||
|
||||
exit
|
||||
### DATA ###
|
||||
😀 grinning face, grin
|
||||
😃 grinning face with big eyes, mouth open smile
|
||||
😄 grinning face with smiling eyes eye, mouth open smile
|
||||
Reference in new issue
Block a user