Massive Updates

This commit is contained in:
sankalp committed 2024-01-07 22:32:54 +05:45
1 parent 007c2f8edb
commit 5f37d6c0ec
109 files changed
+7670 -3972

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
# Clipboard Manager. This needed cliphist & wl-copy and of course rofi
if [[ ! $(pidof rofi) ]]; then
cliphist list | rofi -dmenu -config ~/.config/rofi/config-clipboard.rasi | cliphist decode | wl-copy
cliphist list | rofi -dmenu -config ~/.config/rofi/config-long.rasi | cliphist decode | wl-copy
else
pkill rofi
fi
-5
View File
@@ -1,5 +0,0 @@
#!/usr/bin/env bash
CONFIG=$(rofi -show file-browser-extended -file-browser-stdout -file-browser-dir "$HOME"/.config/keyb/bindings -config ~/.config/rofi/keybinds.rasi)
hyprctl dispatch exec "[float;size 45% 80%;center 1] kitty keyb -k '$CONFIG'"
-47
View File
@@ -1,47 +0,0 @@
#!/bin/bash
# Rofi menu for Quick Edit / View of Settings (ALT E)
userDir="$HOME/.config/hypr/configs"
menu(){
printf "1. view Env-variables\n"
printf "2. view Window-Rules\n"
printf "3. view Startup_Apps\n"
printf "4. view Keybinds\n"
printf "5. view Monitors\n"
printf "6. view Laptop-Keybinds\n"
printf "7. view Settings\n"
}
main() {
choice=$(menu | rofi -dmenu -config ~/.config/rofi/config-quickedit.rasi | cut -d. -f1)
case $choice in
1)
kitty -e nano "$userDir/ENVariables.conf"
;;
2)
kitty -e nano "$userDir/WindowRules.conf"
;;
3)
kitty -e nano "$userDir/Startup_Apps.conf"
;;
4)
kitty -e nano "$userDir/Keybinds.conf"
;;
5)
kitty -e nano "$userDir/Monitors.conf"
;;
6)
kitty -e nano "$userDir/Laptops.conf"
;;
7)
kitty -e nano "$userDir/Settings.conf"
;;
*)
;;
esac
}
main
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
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
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# A rofi mode script that allows calculations to be done
#
# 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"
File diff suppressed because it is too large. Load diff
-84
View File
@@ -1,84 +0,0 @@
#!/usr/bin/env bash
# Directory for icons
iDIR="$HOME/.config/swaync/icons"
LOFI_STREAM="https://www.youtube.com/watch?v=jfKfPfyJRdk"
ALL_TIME_CHILL_HITS="https://www.youtube.com/playlist?list=PL1FPWPLPHKhysG2trm9RKV8FG3eQ7J4VN"
ALL_TIME_MALAYALAM_HITS="https://www.youtube.com/playlist?list=PL1FPWPLPHKhyZeoBv-Ws_eRiWiUYKkuDz"
HAND_PICKED_HITS="https://music.youtube.com/playlist?list=PLAj6caR1_EYHevz9nP5CzbE-z8viVAyI3&feature=share"
BHAJAN="https://youtube.com/playlist?list=PLwIh-QEhrDJDM8IF3gLUgnEyZm6dBgr_n&si=_RDHngYobHlcxaJW"
# Player menu controls
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"
# Music menu controls
play_bhajan="󰥳 Play Bhajan"
play_lofi=" Play lofi girl"
play_chill_hits="1.  Play All time chill hits"
play_malayalam_hits="2.  Play All time malayalam hits"
play_hand_picked_hits="3.  Play hand picked hits"
function notify() {
notify-send -u normal -i "$iDIR/music.png" "$1"
}
function music() {
local chosen=$(printf "%s\n%s\n%s\n%s\n" "$play_bhajan" "$play_lofi" "$play_chill_hits" "$play_malayalam_hits" "$play_hand_picked_hits" | rofi -dmenu -i -l 6 -config ~/.config/rofi/config-rofi-music.rasi)
if [[ "$chosen" == "$play_bhajan" ]]; then
notify "Playing Bhajan"
exec -a "rofi-music" mpv --no-video "$BHAJAN" --shuffle --no-resume-playback
elif [[ "$chosen" == "$play_lofi" ]]; then
notify "🎹 Playing lofi girl"
exec -a "rofi-music" mpv --no-video "$LOFI_STREAM" --no-resume-playback
elif [[ "$chosen" == "$play_chill_hits" ]]; then
notify "🎹 Playing all time chill hits"
exec -a "rofi-music" mpv --no-video "$ALL_TIME_CHILL_HITS" --shuffle --no-resume-playback
elif [[ "$chosen" == "$play_malayalam_hits" ]]; then
notify "🎹 Playing malayalam hits"
exec -a "rofi-music" mpv --no-video "$ALL_TIME_MALAYALAM_HITS" --shuffle --no-resume-playback
elif [[ "$chosen" == "$play_hand_picked_hits" ]]; then
notify "🎹 Playing hand picked hits"
exec -a "rofi-music" mpv --no-video "$HAND_PICKED_HITS" --shuffle --no-resume-playback
fi
}
function 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 -config ~/.config/rofi/config-rofi-music.rasi)
if [[ "$chosen" == "$play" ]]; then
playerctl --player=mpv play && notify-send -u normal -i "$1" "▶️ Resuming music"
elif [[ "$chosen" == "$pause" ]]; then
playerctl --player=mpv pause && notify-send -u normal -i "$1" "⏸️ Music paused"
elif [[ "$chosen" == "$stop" ]]; then
kill $(pidof "rofi-music") && notify-send -u normal -i "$1" "🛑 Music stopped"
elif [[ "$chosen" == "$next_track" ]]; then
playerctl --player=mpv next && notify-send -u normal -i "$1" "⏭️ Next track playing"
elif [[ "$chosen" == "$prev_track" ]]; then
playerctl --player=mpv previous && notify-send -u normal -i "$1" "⏮️ Previous track playing"
elif [[ "$chosen" == "$increase_volume" ]]; then
current_volume=$(playerctl --player=mpv volume)
new_volume=$(echo "$current_volume + 0.1" | bc)
playerctl --player=mpv volume $new_volume && notify-send -u normal -i "$1" "🔊 Increasing track volume"
elif [[ "$chosen" == "$decrease_volume" ]]; then
current_volume=$(playerctl --player=mpv volume)
new_volume=$(echo "$current_volume - 0.1" | bc)
playerctl --player=mpv volume $new_volume && notify-send -u normal -i "$1" "🔉 Decreasing track volume"
fi
}
# Check if music is running
if pidof "rofi-music" > /dev/null; then
controls
else
music
fi
+133
View File
@@ -0,0 +1,133 @@
#!/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
-70
View File
@@ -1,70 +0,0 @@
#!/usr/bin/env bash
# A bash script to record screen using rofi
# Kill if any other rofi instance is running
if pgrep -x "rofi"; then
killall rofi
exit
fi
OUTPUT_DIR="$HOME/Videos/ScreenRecord/"
OUTPUT_FILE="$OUTPUT_DIR$(date +%Y-%m-%d_%I-%M-%p).mp4"
record_screen_with_audio="󰽟 Record screen with audio"
record_screen_without_audio="󰽠 Record screen without audio"
record_selection_with_audio="󰒉 Record selection with audio"
record_selection_without_audio="󱟃 Record selection without audio"
stop_recording=" Stop recording"
chosen=$(printf "%s\n%s\n%s\n%s\n%s\n" "$record_screen_with_audio" "$record_screen_without_audio" "$record_selection_with_audio" "$record_selection_without_audio" "$stop_recording"\
| rofi -dmenu -config ~/.config/rofi/config-record.rasi \
)
function stop_recording(){
pkill wf-recorder --signal SIGINT && notify-send "🛑 Recording stopped" && pkill -RTMIN+8 waybar
exit
}
function count_down(){
COUNT_DOWN=3
while [[ $COUNT_DOWN -ne 0 ]]; do
echo "$COUNT_DOWN"
notify-send -t 450 "⏺️ Recording in $COUNT_DOWN"
(( COUNT_DOWN-- ))
sleep 0.5
done
if [[ ! -d "$OUTPUT_DIR" ]]; then
mkdir -p "$OUTPUT_DIR"
fi
notify-send -t 450 "🎥 Starting recording"
sleep 0.5
}
function start_recording(){
if [[ "$chosen" == "$record_screen_with_audio" ]]; then
count_down
pkill -RTMIN+8 waybar
wf-recorder --force-yuv -c libx264rgb -t -f "$OUTPUT_FILE" --audio=alsa_output.pci-0000_03_00.6.analog-stereo.monitor
elif [[ "$chosen" == "$record_screen_without_audio" ]]; then
count_down
pkill -RTMIN+8 waybar
wf-recorder --force-yuv -c libx264rgb -t -f "$OUTPUT_FILE"
elif [[ "$chosen" == "$record_selection_with_audio" ]]; then
geometry="$(slurp)"
count_down
pkill -RTMIN+8 waybar
wf-recorder --force-yuv -c libx264rgb -t -g "$geometry" -f "$OUTPUT_FILE" --audio=alsa_output.pci-0000_03_00.6.analog-stereo.monitor
elif [[ "$chosen" == "$record_selection_without_audio" ]]; then
geometry="$(slurp)"
count_down
pkill -RTMIN+8 waybar
wf-recorder --force-yuv -c libx264rgb -t -g "$geometry" -f "$OUTPUT_FILE"
elif [[ "$chosen" == "$stop_recording" ]]; then
stop_recording
fi
}
if [[ ! -z $chosen ]]; then
start_recording
fi
-23
View File
@@ -1,23 +0,0 @@
#! /usr/bin/env bash
# Control Tmux Session using rofi
TERMINAL="kitty"
function tmux_sessions() {
tmux list-session -F '#S'
}
theme=~/.config/rofi/config-tmux.rasi
TMUX_SESSION=$( (echo new; tmux_sessions) | rofi -dmenu -p "󰆍 Tmux" -theme $theme)
if [[ x"new" = x"${TMUX_SESSION}" ]]; then
$TERMINAL -e tmux new-session &
exit 0
elif [[ -z "${TMUX_SESSION}" ]]; then
exit 1
else
$TERMINAL -e tmux attach -t "${TMUX_SESSION}" &
exit 0
fi
+27
View File
@@ -0,0 +1,27 @@
#!/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
+41
View File
@@ -0,0 +1,41 @@
#!/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
-6
View File
@@ -1,6 +0,0 @@
#!/bin/bash
# wlsunset project page
# https://sr.ht/~kennylevinsen/wlsunset/
wlsunset -t 4000 -T 6500 -d 900 -S 07:00 -s 19:00
-27
View File
@@ -1,27 +0,0 @@
#!/bin/bash
# For disabling touchpad.
notif="$HOME/.config/swaync/images/bell.png"
# NOTE: find the right device using hyprctl devices
HYPRLAND_DEVICE="dll07a7:01-044e:120b"
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}
STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status"
toggle_touchpad() {
if [ ! -f "$STATUS_FILE" ] || [ "$(cat "$STATUS_FILE")" = "false" ]; 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_touchpad
@@ -1,36 +0,0 @@
#!/bin/bash
# source https://wiki.archlinux.org/title/Hyprland#Using_a_script_to_change_wallpaper_every_X_minutes
# This script will randomly go through the files of a directory, setting it
# up as the wallpaper at regular intervals
#
# NOTE: this script uses bash (not POSIX shell) for the RANDOM variable
if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then
echo "Usage:
$0 <dir containing images>"
exit 1
fi
# Edit below to control the images transition
export SWWW_TRANSITION_FPS=60
export SWWW_TRANSITION_TYPE=simple
# This controls (in seconds) when to switch to the next image
INTERVAL=1800
while true; do
find "$1" \
| while read -r img; do
echo "$((RANDOM % 1000)):$img"
done \
| sort -n | cut -d':' -f2- \
| while read -r img; do
# Create symbolic link to the current image
ln -sf "$img" $HOME/.config/hypr/.current_wallpaper
swww img "$img"
sleep $INTERVAL
done
done
-22
View File
@@ -1,22 +0,0 @@
#!/bin/bash
# Script for Random Wallpaper ( CTRL ALT W)
wallDIR="$HOME/Pictures/wallpapers"
scriptsDir="$HOME/.config/hypr/scripts"
PICS=($(find ${wallDIR} -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \)))
RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]}
# Transition config
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"
swww query || swww init && swww img ${RANDOMPICS} $SWWW_PARAMS
# Create symbolic link to the selected wallpaper
ln -sf "${RANDOMPICS}" "$HOME/.config/hypr/.current_wallpaper"
-87
View File
@@ -1,87 +0,0 @@
#!/bin/bash
# This script for selecting wallpapers (SUPER W)
SCRIPTSDIR="$HOME/.config/hypr/scripts"
# WALLPAPERS PATH
DIR="$HOME/Pictures/wallpapers"
# Transition config
FPS=30
TYPE="wipe"
DURATION=1
BEZIER=".43,1.19,1,.4"
SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION"
# Check if swaybg is running
if pidof swaybg > /dev/null; then
pkill swaybg
fi
# Retrieve image files
PICS=($(ls "${DIR}" | grep -E ".jpg$|.jpeg$|.png$|.gif$"))
RANDOM_PIC="${PICS[$((RANDOM % ${#PICS[@]}))]}"
RANDOM_PIC_NAME="${#PICS[@]}. random"
# Rofi command
rofi_command="rofi -show -dmenu -config ~/.config/rofi/config-wallpaper.rasi"
menu() {
for i in "${!PICS[@]}"; do
# Displaying .gif to indicate animated images
if [[ -z $(echo "${PICS[$i]}" | grep .gif$) ]]; then
printf "$(echo "${PICS[$i]}" | cut -d. -f1)\x00icon\x1f${DIR}/${PICS[$i]}\n"
else
printf "${PICS[$i]}\n"
fi
done
printf "$RANDOM_PIC_NAME\n"
}
swww query || swww init
main() {
choice=$(menu | ${rofi_command})
# No choice case
if [[ -z $choice ]]; then
exit 0
fi
# Random choice case
if [ "$choice" = "$RANDOM_PIC_NAME" ]; then
swww img "${DIR}/${RANDOM_PIC}" $SWWW_PARAMS
# Create symbolic link
ln -sf "${DIR}/${RANDOM_PIC}" "$HOME/.config/hypr/.current_wallpaper"
notify-send "Wallpaper Changed" -i "${DIR}/${RANDOM_PIC}"
exit 0
fi
# Find the index of the selected file
pic_index=-1
for i in "${!PICS[@]}"; do
filename=$(basename "${PICS[$i]}")
if [[ "$filename" == "$choice"* ]]; then
pic_index=$i
break
fi
done
if [[ $pic_index -ne -1 ]]; then
swww img "${DIR}/${PICS[$pic_index]}" $SWWW_PARAMS
# Create symbolic link
ln -sf "${DIR}/${PICS[$pic_index]}" "$HOME/.config/hypr/.current_wallpaper"
notify-send "Wallpaper Changed" -i "${DIR}/${PICS[$pic_index]}"
else
notify-send "Wallpaper Changed" -i "Image not found."
exit 1
fi
}
main
+2 -2
View File
@@ -9,7 +9,7 @@ IFS=$'\n\t'
config_dir="$HOME/.config/waybar/configs"
waybar_config="$HOME/.config/waybar/config"
scripts_dir="$HOME/.config/hypr/scripts"
rofi_config="$HOME/.config/rofi/config-waybar-layout.rasi"
rofi_config="$HOME/.config/rofi/config.rasi"
# Function to display menu options
menu() {
@@ -38,7 +38,7 @@ restart_waybar_if_needed() {
# Main function
main() {
choice=$(menu | rofi -dmenu -config "$rofi_config")
choice=$(menu | rofi -dmenu -p " Choose Waybar Layout" -config "$rofi_config")
if [[ -z "$choice" ]]; then
echo "No option selected. Exiting."
-121
View File
@@ -1,121 +0,0 @@
#!/usr/bin/env python3
# From https://raw.githubusercontent.com/rxyhn/dotfiles/main/home/rxyhn/modules/desktop/waybar/scripts/waybar-wttr.py
## ensure to insert city inside ""
import json
import requests
from datetime import datetime
WEATHER_CODES = {
'113': '',
'116': '󰖕 ',
'119': '',
'122': '',
'143': '',
'176': '',
'179': '',
'182': '',
'185': '',
'200': '⛈️',
'227': '🌨️',
'230': '🌨️',
'248': '☁️',
'260': '☁️',
'263': '🌧️',
'266': '🌧️',
'281': '🌧️',
'284': '🌧️',
'293': '🌧️',
'296': '🌧️',
'299': '🌧️',
'302': '🌧️',
'305': '🌧️',
'308': '🌧️',
'311': '🌧️',
'314': '🌧️',
'317': '🌧️',
'320': '🌨️',
'323': '🌨️',
'326': '🌨️',
'329': '❄️',
'332': '❄️',
'335': '❄️',
'338': '❄️',
'350': '🌧️',
'353': '🌧️',
'356': '🌧️',
'359': '🌧️',
'362': '🌧️',
'365': '🌧️',
'368': '🌧️',
'371': '❄️',
'374': '🌨️',
'377': '🌨️',
'386': '🌨️',
'389': '🌨️',
'392': '🌧️',
'395': '❄️'
}
data = {}
weather = requests.get("https://wttr.in/Kohalpur?format=j1").json()
def format_time(time):
return time.replace("00", "").zfill(2)
def format_temp(temp):
return (hour['FeelsLikeC']+"°").ljust(3)
def format_chances(hour):
chances = {
"chanceoffog": "Fog",
"chanceoffrost": "Frost",
"chanceofovercast": "Overcast",
"chanceofrain": "Rain",
"chanceofsnow": "Snow",
"chanceofsunshine": "Sunshine",
"chanceofthunder": "Thunder",
"chanceofwindy": "Wind"
}
conditions = []
for event in chances.keys():
if int(hour[event]) > 0:
conditions.append(chances[event]+" "+hour[event]+"%")
return ", ".join(conditions)
tempint = int(weather['current_condition'][0]['FeelsLikeC'])
extrachar = ''
if tempint > 0 and tempint < 10:
extrachar = '+'
data['text'] = ' '+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \
" "+extrachar+weather['current_condition'][0]['FeelsLikeC']+"°"
data['tooltip'] = f"<b>{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°</b>\n"
data['tooltip'] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°\n"
data['tooltip'] += f"Wind: {weather['current_condition'][0]['windspeedKmph']}Km/h\n"
data['tooltip'] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n"
for i, day in enumerate(weather['weather']):
data['tooltip'] += f"\n<b>"
if i == 0:
data['tooltip'] += "Today, "
if i == 1:
data['tooltip'] += "Tomorrow, "
data['tooltip'] += f"{day['date']}</b>\n"
data['tooltip'] += f"⬆️{day['maxtempC']}° ⬇️{day['mintempC']}° "
data['tooltip'] += f"🌅{day['astronomy'][0]['sunrise']} 🌇{day['astronomy'][0]['sunset']}\n"
for hour in day['hourly']:
if i == 0:
if int(format_time(hour['time'])) < datetime.now().hour-2:
continue
data['tooltip'] += f"{format_time(hour['time'])} {WEATHER_CODES[hour['weatherCode']]} {format_temp(hour['FeelsLikeC'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n"
print(json.dumps(data))
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
# Requirements:
# rofi
# Description:
# Use rofi to search the web.
# Usage:
# web-search.sh
# -----------------------------------------------------------------------------
# Script:
declare -A URLS
URLS=(
["google"]="https://www.google.com/search?q="
["bing"]="https://www.bing.com/search?q="
["yahoo"]="https://search.yahoo.com/search?p="
["duckduckgo"]="https://www.duckduckgo.com/?q="
["yandex"]="https://yandex.ru/yandsearch?text="
["github"]="https://github.com/search?q="
["goodreads"]="https://www.goodreads.com/search?q="
["stackoverflow"]="http://stackoverflow.com/search?q="
["symbolhound"]="http://symbolhound.com/?q="
["searchcode"]="https://searchcode.com/?q="
["openhub"]="https://www.openhub.net/p?ref=homepage&query="
["superuser"]="http://superuser.com/search?q="
["askubuntu"]="http://askubuntu.com/search?q="
["imdb"]="http://www.imdb.com/find?ref_=nv_sr_fn&q="
["rottentomatoes"]="https://www.rottentomatoes.com/search/?search="
["piratebay"]="https://thepiratebay.org/search/"
["youtube"]="https://www.youtube.com/results?search_query="
["vimawesome"]="http://vimawesome.com/?q="
)
# List for rofi
gen_list() {
for i in "${!URLS[@]}"
do
echo "$i"
done
}
main() {
# Pass the list to rofi
platform=$( (gen_list) | rofi -dmenu -matching fuzzy -no-custom -location 0 -p "Search > " )
if [[ -n "$platform" ]]; then
query=$( (echo ) | rofi -dmenu -matching fuzzy -location 0 -p "Query > " )
if [[ -n "$query" ]]; then
url=${URLS[$platform]}$query
xdg-open "$url"
else
exit
fi
else
exit
fi
}
main
exit 0