This commit is contained in:
sankalp committed 2023-12-30 21:19:06 +05:45
commit 0cbbf662e3
473 files changed
+40489

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
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
+51
View File
@@ -0,0 +1,51 @@
#!/bin/bash
iDIR="$HOME/.config/swaync/icons"
notification_timeout=1000
# Get brightness
get_backlight() {
echo $(brightnessctl -m | cut -d, -f4)
}
# 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
}
# Notify
notify_user() {
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
}
# Execute accordingly
case "$1" in
"--get")
get_backlight
;;
"--inc")
change_backlight "+10%"
;;
"--dec")
change_backlight "10%-"
;;
*)
get_backlight
;;
esac
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
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
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
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
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
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
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
#
# Clipboard Manager
if [[ ! $(pidof rofi) ]]; then
cliphist list | rofi -dmenu -config ~/.config/rofi/config-clipboard.rasi | cliphist decode | wl-copy
else
pkill rofi
fi
+65
View File
@@ -0,0 +1,65 @@
#!/bin/sh
#####################################
# #
# @author : 00xZ4CKX #
#  GitHub : @S4NKALP #
#  Developer : Sankalp Tharu #
# 﫥 Copyright : Sankalp Tharu #
# #
#####################################
# Select the right temperature file. #
for temp_dir in /sys/class/hwmon/*; do
[[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && {
temp_dirs=("$temp_dir"/temp*_input)
temp_dir=${temp_dirs[0]}
break
}
done
# Get CPU temp. #
[[ -f "$temp_dir" ]] && deg="$(($(< "$temp_dir") * 100 / 10000))"
# Add CPU temp to the output. #
if [[ "$cpu_temp" != "off" && "$deg" ]]; then
deg="${deg//.}"
# Convert to Fahrenheit if enabled
[[ "$cpu_temp" == "F" ]] && deg="$((deg * 90 / 50 + 320))"
deg_no_format="${deg/${deg: -1}}"
# Format the output
deg="${deg/${deg: -1}}°${cpu_temp:-C}"
fi
# from 0°C to 40°C print -> 
if [[ "$deg_no_format" -le 40 ]]
then
echo -e "$deg"
# from 40°C to 60°C print -> 
elif [[ "$deg_no_format" -le 60 ]]
then
echo -e "$deg"
# from 60°C to 85°C print -> 
elif [[ "$deg_no_format" -le 85 ]]
then
echo -e "$deg"
# from 85°C to +... print -> 
elif [[ "$deg_no_format" -gt 85 ]]
then
# the ' -n "%{F#FF0008}" ' -> red font as 85°C to +... is the default warn temperature
echo -e "${BRed}$deg"
fi
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
yad --width=850 --height=950 \
--center \
--title="Keybindings" \
--no-buttons \
--list \
--column=Key: \
--column=Description: \
--column=Command: \
"ESC" "close this app" "" "=" "SUPER KEY" "(SUPER KEY)" \
" ENTER" "Terminal" "(kitty)" \
"ALT ENTeR" "FullScreen Terminal" "(all_kitty)" \
"ALT SHIFT enter" "Float Terminal" "(kitty_float)" \
" D" "App Launcher" "(rofi)" \
" " "App Launcher" "(rofi)" \
" E" "Open File Manager" "(Thunar)" \
" C" "close focused app" "(kill)" \
" SHIFT W" "Wallpaper Select" "(swww)" \
"ALT SHIFT W" "Random Wallpaper" "(swww)" \
"CTRL E" "RofiEmoji" "" \
" N" "ROfiNotes" "" \
" T" "RofiTmux" "" \
"ALT M" "RofiMusic" "" \
" SHIFT T" "RofiTodo" ""\
"ALT S" "Stop" "(ROfi Music)" \
"ALT N" "Next track" "(ROfi Music)" \
"ALT P" "Previous Track" "(ROfi Music)" \
"ALT R" "Resume" "(ROfi Music)" \
"ALT W" "Choose waybar layout" "(waybar layout)" \
"PRINT" "screenshot now" "(grim)" \
" Z" "screenshot area" "(grim + slurp)" \
"CTRL PRINT" "screenshot win" "(grim)" \
" X" "power-menu" "(rofi)" \
"CTRL ALT Del" "Hyprland Exit" "(SAVE YOUR WORK!!!)" \
" SHIFT SPACE" "Fullscreen" "(Toggles to full screen)" \
" A" "Toggle Dwindle | Master Layout" "(Hyprland Layout)" \
" P" "Toggle Dwindle" "(Pseudo)" \
" F" "Toggle float" "(single window)" \
" SHIFT F" "Toggle all windows to float" "(all windows)" \
"CTRL 1" "cava" "(fly_is_kitty)" \
"CTRL 2" "donut" "(donut_is_kitty)" \
"CTRL 3" "tty-clock" "(clock_is_kitty)" \
" SHIFT A" "All animations off" "" \
" Shift Q" "Toggle Blur" "normal or less blur" \
" R" "Record Screen" "(wf-recorder)" \
" SHIFT R" "Stop Recording" "" \
" SHIFT O" "Opaque" "" \
" G" "Toggle Group" "" \
" U" "Toggle Special Workspace" "" \
" SHIFT U" "Move Toward Special" "" \
" F1" "Launch this app" "" \
"ALT E" "View or EDIT Keybinds, Settings, Monitor" "" \
"" "" "" \
"" "For other you can find in ~/.config/hypr/configs/keybind.conf" ""\
+59
View File
@@ -0,0 +1,59 @@
#!/bin/bash
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
+63
View File
@@ -0,0 +1,63 @@
#! /usr/bin/env bash
# Control moosic using keyboard
# SUPER + M should open a submap
# 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
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
# Polkit possible paths files to check
polkit=(
"/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
"/usr/lib/polkit-kde-authentication-agent-1"
"/usr/lib/polkit-gnome-authentication-agent-1"
"/usr/libexec/polkit-gnome-authentication-agent-1"
"/usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1"
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
)
executed=false # Flag to track if a file has been executed
# Loop through the list of files
for file in "${polkit[@]}"; do
if [ -e "$file" ]; then
echo "File $file found, executing command..."
exec "$file"
executed=true
break
fi
done
# If none of the files were found, you can add a fallback command here
if [ "$executed" == false ]; then
echo "None of the specified files were found. Install a Polkit"
fi
+53
View File
@@ -0,0 +1,53 @@
#!/bin/bash
defaultDir="$HOME/.config/hypr/configs"
userDir="$HOME/.config/hypr/UserConfigs"
menu(){
printf "1. view Env-variables\n"
printf "2. view Window-Rules\n"
printf "3. view Startup_Apps\n"
printf "4. view User-Keybinds\n"
printf "5. view Monitors\n"
printf "6. view Laptop-Keybinds\n"
printf "7. view User-Settings\n"
printf "8. view Default-Settings\n"
printf "9. view Default-Keybinds\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/UserKeybinds.conf"
;;
5)
kitty -e nano "$userDir/Monitors.conf"
;;
6)
kitty -e nano "$userDir/Laptops.conf"
;;
7)
kitty -e nano "$userDir/UserSettings.conf"
;;
8)
kitty -e nano "$defaultDir/Settings.conf"
;;
9)
kitty -e nano "$defaultDir/Keybinds.conf"
;;
*)
;;
esac
}
main
+98
View File
@@ -0,0 +1,98 @@
#!/usr/bin/env bash
# Import Theme
theme="$HOME/.config/rofi/config-quicklink.rasi"
# Theme Elements
prompt="Quick Links: Using '$BROWSER' as web browser"
# Check if the theme variable is not empty
if [ -n "$theme" ]; then
list_col='6'
list_row='1'
fi
# Options
if [ -z "$BROWSER" ]; then
BROWSER="firefox" # Set your default browser here
prompt="Quick Links: Using '$BROWSER' as web browser"
else
prompt="Quick Links: Using '$BROWSER' as web browser"
fi
layout=$(grep 'USE_ICON' "$theme" | cut -d'=' -f2)
if [ "$layout" == 'NO' ]; then
option_1=" Google"
option_2=" Gmail"
option_3=" Youtube"
option_4=" Github"
option_5=" Reddit"
option_6="󰈌 Facebook"
else
option_1=""
option_2=""
option_3=""
option_4=""
option_5=""
option_6="󰈌"
fi
# Define the font variable
efonts="Fira Code SemiBold 28"
# Rofi CMD
rofi_cmd() {
rofi -theme-str "listview {columns: $list_col; lines: $list_row;}" \
-theme-str 'textbox-prompt-colon {str: "";}' \
-theme-str "element-text {font: \"$efonts\";}" \
-dmenu \
-p "$prompt" \
-markup-rows \
-theme "$theme"
}
# Pass variables to rofi dmenu
run_rofi() {
echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6" | rofi_cmd
}
# Execute Command
run_cmd() {
if [ "$1" == '--opt1' ]; then
xdg-open 'https://www.google.com/'
elif [ "$1" == '--opt2' ]; then
xdg-open 'https://mail.google.com/'
elif [ "$1" == '--opt3' ]; then
xdg-open 'https://www.youtube.com/'
elif [ "$1" == '--opt4' ]; then
xdg-open 'https://www.github.com/'
elif [ "$1" == '--opt5' ]; then
xdg-open 'https://www.reddit.com/'
elif [ "$1" == '--opt6' ]; then
xdg-open 'https://www.facebook.com/'
fi
}
# Actions
chosen="$(run_rofi)"
case $chosen in
$option_1)
run_cmd --opt1
;;
$option_2)
run_cmd --opt2
;;
$option_3)
run_cmd --opt3
;;
$option_4)
run_cmd --opt4
;;
$option_5)
run_cmd --opt5
;;
$option_6)
run_cmd --opt6
;;
esac
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
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
+1544
View File
File diff suppressed because it is too large. Load diff
+84
View File
@@ -0,0 +1,84 @@
#!/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
elif [[ "$chosen" == "$play_lofi" ]]; then
notify "🎹 Playing lofi girl"
exec -a "rofi-music" mpv --no-video $LOFI_STREAM
elif [[ "$chosen" == "$play_chill_hits" ]]; then
notify "🎹 Playing all time chill hits"
exec -a "rofi-music" mpv --no-video "$ALL_TIME_CHILL_HITS" --shuffle
elif [[ "$chosen" == "$play_malayalam_hits" ]]; then
notify "🎹 Playing malayalam hits"
exec -a "rofi-music" mpv --no-video "$ALL_TIME_MALAYALAM_HITS" --shuffle
elif [[ "$chosen" == "$play_hand_picked_hits" ]]; then
notify "🎹 Playing hand picked hits"
exec -a "rofi-music" mpv --no-video "$HAND_PICKED_HITS" --shuffle
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
+109
View File
@@ -0,0 +1,109 @@
#!/bin/bash
# https://github.com/christianholman/rofi_notes
# default values
AUTHOR=$(whoami)
NOTES_FOLDER="$HOME/Documents/.notes"
NOTES_EDITOR='mousepad'
theme=~/.config/rofi/config-notes.rasi
if [[ ! -d "${NOTES_FOLDER}" ]]; then
mkdir -p "$NOTES_FOLDER"
fi
get_notes() {
ls "${NOTES_FOLDER}"
}
edit_note() {
note_location=$1
$NOTES_EDITOR "$note_location"
}
delete_note() {
local note=$1
local action=$(echo -e "Yes\nNo" | rofi -theme $theme -dmenu -p "Are you sure you want to delete $note? ")
case $action in
"Yes")
rm "$NOTES_FOLDER/$note"
main
;;
"No")
main
esac
}
note_context() {
local note=$1
local note_location="$NOTES_FOLDER/$note"
local action=$(echo -e "Edit\nDelete" | rofi -theme $theme -dmenu -p "$note > ")
case $action in
"Edit")
edit_note "$note_location"
exit 0;;
"Delete")
delete_note "$note"
exit 0;;
esac
exit 1
}
new_note() {
local title=$(echo -e "Cancel" | rofi -theme $theme -dmenu -p "Input title: ")
case "$title" in
"Cancel")
main
;;
*)
local file=$(echo "$title" | sed 's/ /_/g;s/\(.*\)/\L\1/g')
local template=$(cat <<- END
---
title: $title
date: $(date --rfc-3339=seconds)
author: $AUTHOR
---
# $title
END
)
note_location="$NOTES_FOLDER/$file.md"
if [ "$title" != "" ]; then
echo "$template" > "$note_location" | edit_note "$note_location"
exit 0
fi
;;
esac
}
main()
{
local all_notes="$(get_notes)"
local first_menu="New"
if [ "$all_notes" ];then
first_menu="New\n${all_notes}"
fi
local note=$(echo -e "$first_menu" | rofi -theme $theme -dmenu -p "󰚸 Notes")
case $note in
"New")
new_note
;;
"")
exit 1;;
*)
note_context "$note" && exit 0 # handle esc key in note_context
esac
exit 1
}
main
+60
View File
@@ -0,0 +1,60 @@
#!/bin/bash
# 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 &
;;
"")
systemctl suspend
;;
"󰿅")
hyprctl dispatch exit 0
;;
"󱄌")
systemctl reboot
;;
"")
systemctl poweroff
;;
"󰒲")
systemctl hibernate
;;
*)
echo "choose: $1"
;;
esac
}
# Actions
chosen_option=$(rofi_cmd)
run_cmd "${chosen_option% *}"
+70
View File
@@ -0,0 +1,70 @@
#!/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
+21
View File
@@ -0,0 +1,21 @@
#! /usr/bin/env bash
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
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
#
theme=~/.config/rofi/config-todo.rasi
rofi -modi TODO:$HOME/.config/hypr/scripts/TodoList.sh -show TODO -theme $theme
exit 0
+106
View File
@@ -0,0 +1,106 @@
#!/bin/bash
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_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
}
# 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
}
# take shots
shotnow() {
cd ${dir} && grim - | tee "$file" | wl-copy
sleep 2
notify_view
}
shot5() {
countdown '5'
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
sleep 1
notify_view
}
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
exit 0
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
layout_f="$HOME/.cache/kb_layout"
settings_file="$HOME/.config/hypr/configs/Settings.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" "new KB_Layout: $new_layout"
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
#
# https://github.com/claudiodangelis/rofi-todo
#
# this script manages a simple to-do list stored locally
# it allows adding and removing to-do entries
#
# dependencies: rofi
TODO_FILE="${TODO_FILE:-$HOME/Documents/.rofi-todo}"
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 "Refresh List"
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
+26
View File
@@ -0,0 +1,26 @@
#!/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
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
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
+135
View File
@@ -0,0 +1,135 @@
#!/bin/bash
iDIR="$HOME/.config/swaync/icons"
# Get Volume
get_volume() {
volume=$(pamixer --get-volume)
if [[ "$volume" -eq "0" ]]; then
echo "Muted"
else
echo "$volume%"
fi
}
# Get icons
get_icon() {
current=$(get_volume)
if [[ "$current" == "Muted" ]]; then
echo "$iDIR/volume-mute.png"
elif [[ "${current%\%}" -le 30 ]]; then
echo "$iDIR/volume-low.png"
elif [[ "${current%\%}" -le 60 ]]; then
echo "$iDIR/volume-mid.png"
else
echo "$iDIR/volume-high.png"
fi
}
# Notify
notify_user() {
if [[ "$(get_volume)" == "Muted" ]]; then
notify-send -e -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: Muted"
else
notify-send -e -h int:value:"$(get_volume | sed 's/%//')" -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: $(get_volume)"
fi
}
# Increase Volume
inc_volume() {
if [ "$(pamixer --get-mute)" == "true" ]; then
pamixer -u && notify_user
fi
pamixer -i 5 && notify_user
}
# Decrease Volume
dec_volume() {
if [ "$(pamixer --get-mute)" == "true" ]; then
pamixer -u && notify_user
fi
pamixer -d 5 && notify_user
}
# Toggle Mute
toggle_mute() {
if [ "$(pamixer --get-mute)" == "false" ]; then
pamixer -m && notify-send -e -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF"
elif [ "$(pamixer --get-mute)" == "true" ]; then
pamixer -u && notify-send -e -u low -i "$(get_icon)" "Volume Switched ON"
fi
}
# Toggle Mic
toggle_mic() {
if [ "$(pamixer --default-source --get-mute)" == "false" ]; then
pamixer --default-source -m && notify-send -e -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then
pamixer -u --default-source u && notify-send -e -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
fi
}
# Get Mic Icon
get_mic_icon() {
current=$(pamixer --default-source --get-volume)
if [[ "$current" -eq "0" ]]; then
echo "$iDIR/microphone-mute.png"
else
echo "$iDIR/microphone.png"
fi
}
# Get Microphone Volume
get_mic_volume() {
volume=$(pamixer --default-source --get-volume)
if [[ "$volume" -eq "0" ]]; then
echo "Muted"
else
echo "$volume%"
fi
}
# Notify for Microphone
notify_mic_user() {
volume=$(get_mic_volume)
icon=$(get_mic_icon)
notify-send -e -h int:value:"$volume" -h "string:x-canonical-private-synchronous:volume_notif" -u low -i "$icon" "Mic-Level: $volume"
}
# Increase MIC Volume
inc_mic_volume() {
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
pamixer --default-source -u && notify_mic_user
fi
pamixer --default-source -i 5 && notify_mic_user
}
# Decrease MIC Volume
dec_mic_volume() {
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
pamixer --default-source -u && notify_mic_user
fi
pamixer --default-source -d 5 && notify_mic_user
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_volume
elif [[ "$1" == "--inc" ]]; then
inc_volume
elif [[ "$1" == "--dec" ]]; then
dec_volume
elif [[ "$1" == "--toggle" ]]; then
toggle_mute
elif [[ "$1" == "--toggle-mic" ]]; then
toggle_mic
elif [[ "$1" == "--get-icon" ]]; then
get_icon
elif [[ "$1" == "--get-mic-icon" ]]; then
get_mic_icon
elif [[ "$1" == "--mic-inc" ]]; then
inc_mic_volume
elif [[ "$1" == "--mic-dec" ]]; then
dec_mic_volume
else
get_volume
fi
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
DIR="$HOME/Pictures/wallpapers"
PICS=($(find ${DIR} -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
ln -sf "$RANDOMPICS" "$HOME/.config/hypr/.current_wallpaper"
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
DIR="$HOME/Pictures/wallpapers/"
PICS=($(find "${DIR}" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \)))
RANDOMPICS=${PICS[$RANDOM % ${#PICS[@]}]}
# Create symbolic link to the selected wallpaper
ln -sf "${RANDOMPICS}" "$HOME/.config/hypr/.current_wallpaper"
# Check if swww is initialized
swww query || swww init
# Set the wallpaper
swww img "$HOME/.config/hypr/.current_wallpaper"
if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then
exit 1
fi
export SWWW_TRANSITION_TYPE=random
# This controls (in seconds) when to switch to the next image
INTERVAL=1800
while true; do
find "$1" -type f \
| shuf \
| while read -r img; do
# Update the symbolic link to the new wallpaper
ln -sf "$img" "$HOME/.config/hypr/.current_wallpaper"
# Set the new wallpaper
swww img "$HOME/.config/hypr/.current_wallpaper"
sleep $INTERVAL
done
done
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
WALLPAPERS_DIR="$HOME/Pictures/wallpapers/"
# find image size to display (very slow)
#echo $(identify -format '%[fx:w]x%[fx:h]\' $HOME/Pictures/wallpapers/$A 2>/dev/null)
build_theme() {
rows=$1
cols=$2
icon_size=$3
echo "element{orientation:vertical;}element-text{horizontal-align:0.5;}element-icon{size:$icon_size.0000em;}listview{lines:$rows;columns:$cols;}"
}
theme="$HOME/.config/rofi/config-wallpaper.rasi"
ROFI_CMD="rofi -dmenu -i -show-icons -theme-str $(build_theme 3 5 6) -theme ${theme}"
choice=$(ls --escape "$WALLPAPERS_DIR" | xargs -I {} printf "{}\x00icon\x1f$WALLPAPERS_DIR/{}\n" | $ROFI_CMD -p "󰸉 Wallpaper")
wallpaper="$WALLPAPERS_DIR/$choice"
set_wallpaper_kde() {
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript \
"var allDesktops = desktops(); for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = \"org.kde.image\";d.currentConfigGroup = Array(\"Wallpaper\", \"org.kde.image\", \"General\");d.writeConfig(\"Image\", \"file:$1\")}"
}
set_wallpaper_gnome() {
gsettings set org.gnome.desktop.background picture-uri "file://$1"
gsettings set org.gnome.desktop.background picture-uri-dark "file://$1"
}
set_wallpaper_sway() {
swaymsg output "*" bg "$1" "stretch"
}
set_wallpaper_default() {
swww img -t any --transition-bezier 0,.53,1,.48 --transition-duration 1 --transition-fps 60 "$1" &&
ln -sf "$1" "$HOME/.config/hypr/.current_wallpaper"
}
if [ -n "$choice" ]; then
case "$XDG_CURRENT_DESKTOP" in
"KDE") set_wallpaper_kde "$wallpaper" ;;
"GNOME") set_wallpaper_gnome "$wallpaper" ;;
"sway") set_wallpaper_sway "$wallpaper" ;;
*) set_wallpaper_default "$wallpaper" ;;
esac
exit 0
fi
exit 1