diff options
Diffstat (limited to 'config/hypr/scripts')
23 files changed, 171 insertions, 402 deletions
diff --git a/config/hypr/scripts/AirplaneMode.sh b/config/hypr/scripts/AirplaneMode.sh index 428a09bd..f3a50629 100755 --- a/config/hypr/scripts/AirplaneMode.sh +++ b/config/hypr/scripts/AirplaneMode.sh @@ -1,12 +1,14 @@ #!/bin/bash -dunst_notif="$HOME/.config/dunst/images/bell.png" +notif="$HOME/.config/swaync/images/bell.png" -wifi="$(nmcli r wifi | awk 'FNR = 2 {print $1}')" -if [ "$wifi" == "enabled" ]; then - rfkill block all & - dunstify -u normal -i "$dunst_notif" -t 1000 'airplane mode: active' +# 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 unblock all & - dunstify -u normal -i "$dunst_notif" -t 1000 'airplane mode: inactive' + rfkill block wifi + notify-send -u low -i "$notif" 'Airplane mode: ON' fi diff --git a/config/hypr/scripts/Brightness.sh b/config/hypr/scripts/Brightness.sh index c5c0b80f..14c03da5 100755 --- a/config/hypr/scripts/Brightness.sh +++ b/config/hypr/scripts/Brightness.sh @@ -1,6 +1,6 @@ #!/bin/bash -iDIR="$HOME/.config/dunst/icons" +iDIR="$HOME/.config/swaync/icons" notification_timeout=1000 # Get brightness @@ -26,7 +26,7 @@ get_icon() { # Notify notify_user() { - dunstify -h string:x-dunst-stack-tag: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 diff --git a/config/hypr/scripts/BrightnessKbd.sh b/config/hypr/scripts/BrightnessKbd.sh index c6d6afd3..3bdcebcb 100755 --- a/config/hypr/scripts/BrightnessKbd.sh +++ b/config/hypr/scripts/BrightnessKbd.sh @@ -1,6 +1,6 @@ #!/bin/bash -iDIR="$HOME/.config/dunst/icons" +iDIR="$HOME/.config/swaync/icons" # Get keyboard brightness get_kbd_backlight() { @@ -24,7 +24,7 @@ get_icon() { } # Notify notify_user() { - dunstify -h string:x-dunst-stack-tag:brightness_notif -h int:value:$current -u low -i "$icon" "Keyboard Brightness : $current%" + notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Keyboard Brightness : $current%" } # Change brightness diff --git a/config/hypr/scripts/ChangeBlur.sh b/config/hypr/scripts/ChangeBlur.sh index 891e22eb..95789f5c 100755 --- a/config/hypr/scripts/ChangeBlur.sh +++ b/config/hypr/scripts/ChangeBlur.sh @@ -1,15 +1,15 @@ #!/bin/bash -dunst_notif="$HOME/.config/dunst/images/bell.png" +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 - dunstify -u low -i "$dunst_notif" "Less blur" + notify-send -e -u low -i "$notif" "Less blur" else hyprctl keyword decoration:blur:size 5 hyprctl keyword decoration:blur:passes 2 - dunstify -u low -i "$dunst_notif" "Normal blur" + notify-send -e -u low -i "$notif" "Normal blur" fi diff --git a/config/hypr/scripts/ChangeLayout.sh b/config/hypr/scripts/ChangeLayout.sh index 28b72035..93bc2fe9 100755 --- a/config/hypr/scripts/ChangeLayout.sh +++ b/config/hypr/scripts/ChangeLayout.sh @@ -1,6 +1,6 @@ #!/bin/bash -dunst_notif="$HOME/.config/dunst/images/bell.png" +notif="$HOME/.config/swaync/images/bell.png" LAYOUT=$(hyprctl -j getoption general:layout | jq '.str' | sed 's/"//g') @@ -12,7 +12,7 @@ case $LAYOUT in hyprctl keyword bind SUPER,J,cyclenext hyprctl keyword bind SUPER,K,cyclenext,prev hyprctl keyword bind SUPER,O,togglesplit - dunstify -u low -i "$dunst_notif" "Dwindle Layout" + notify-send -e -u low -i "$notif" "Dwindle Layout" ;; "dwindle") hyprctl keyword general:layout master @@ -21,7 +21,7 @@ case $LAYOUT in hyprctl keyword unbind SUPER,O hyprctl keyword bind SUPER,J,layoutmsg,cyclenext hyprctl keyword bind SUPER,K,layoutmsg,cycleprev - dunstify -u low -i "$dunst_notif" "Master Layout" + notify-send -e -u low -i "$notif" "Master Layout" ;; *) ;; diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index 612540b8..ec8c4473 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -1,13 +1,13 @@ #!/bin/bash -#set -x +set -x # Paths wallpaper_base_path="$HOME/Pictures/wallpapers/Dynamic-Wallpapers" dark_wallpapers="$wallpaper_base_path/Dark" light_wallpapers="$wallpaper_base_path/Light" hypr_config_path="$HOME/.config/hypr" -dunst_config="$HOME/.config/dunst" +swaync_style="$HOME/.config/swaync/style.css" SCRIPTSDIR="$HOME/.config/hypr/scripts" -dunst_notif="$HOME/.config/dunst/images/bell.png" +notif="$HOME/.config/swaync/images/bell.png" dark_rofi_pywal="$HOME/.cache/wal/colors-rofi-dark.rasi" light_rofi_pywal="$HOME/.cache/wal/colors-rofi-light.rasi" @@ -38,7 +38,7 @@ update_theme_mode() { # Function to notify user notify_user() { - dunstify -u low -i "$dunst_notif" "Switching to $1 mode" + notify-send -u low -i "$notif" "Switching to $1 mode" } # Function to set Waybar style @@ -61,13 +61,14 @@ set_waybar_style() { set_waybar_style "$next_mode" notify_user "$next_mode" -# Change background for dunst + +# swaync color change if [ "$next_mode" = "Dark" ]; then - sed -i '/background = /s/.*/ background = "#00000095"/' "${dunst_config}/dunstrc" - sed -i '/foreground = /s/.*/ foreground = "#fafafa"/' "${dunst_config}/dunstrc" + sed -i '/@define-color noti-bg/s/rgba([0-9]*,\s*[0-9]*,\s*[0-9]*,\s*[0-9.]*);/rgba(0, 0, 0, 0.8);/' "${swaync_style}" + sed -i '/@define-color noti-bg-alt/s/#.*;/#111111;/' "${swaync_style}" else - sed -i '/background = /s/.*/ background = "#ffffff99"/' "${dunst_config}/dunstrc" - sed -i '/foreground = /s/.*/ foreground = "#00000095"/' "${dunst_config}/dunstrc" + sed -i '/@define-color noti-bg/s/rgba([0-9]*,\s*[0-9]*,\s*[0-9]*,\s*[0-9.]*);/rgba(255, 255, 255, 0.9);/' "${swaync_style}" + sed -i '/@define-color noti-bg-alt/s/#.*;/#F0F0F0;/' "${swaync_style}" fi # Set Dynamic Wallpaper for Dark or Light Mode @@ -186,8 +187,7 @@ sleep 1 ${SCRIPTSDIR}/Refresh.sh # Display notifications for theme and icon changes -dunstify -u normal -i "$dunst_notif" "Themes are set to $selected_theme" -dunstify -u normal -i "$dunst_notif" "Icon themes set to $selected_icon" +notify-send -u normal -i "$notif" "Themes in $next_mode Mode" exit 0 diff --git a/config/hypr/scripts/GameMode.sh b/config/hypr/scripts/GameMode.sh index 0e6f83af..d53ec7d3 100755 --- a/config/hypr/scripts/GameMode.sh +++ b/config/hypr/scripts/GameMode.sh @@ -1,6 +1,6 @@ #!/bin/bash -dunst_notif="$HOME/.config/dunst/images/bell.png" +notif="$HOME/.config/swaync/images/bell.png" SCRIPTSDIR="$HOME/.config/hypr/scripts" @@ -15,7 +15,7 @@ if [ "$HYPRGAMEMODE" = 1 ] ; then keyword general:border_size 1;\ keyword decoration:rounding 0" swww kill - dunstify -u low -i "$dunst_notif" "gamemode enabled. All animations off" + notify-send -e -u low -i "$notif" "gamemode enabled. All animations off" exit else swww init && swww img "$HOME/.config/rofi/.current_wallpaper" @@ -23,7 +23,7 @@ else ${SCRIPTSDIR}/PywalSwww.sh sleep 0.5 ${SCRIPTSDIR}/Refresh.sh - dunstify -u normal -i "$dunst_notif" "gamemode disabled. All animations normal" + notify-send -e -u normal -i "$notif" "gamemode disabled. All animations normal" exit fi hyprctl reload diff --git a/config/hypr/scripts/KeyHints.sh b/config/hypr/scripts/KeyHints.sh index 7bb80e18..180befa1 100755 --- a/config/hypr/scripts/KeyHints.sh +++ b/config/hypr/scripts/KeyHints.sh @@ -34,7 +34,6 @@ yad --width=$dynamic_width --height=$dynamic_height \ --column=Key: \ --column=Description: \ --column=Command: \ - --timeout=60 \ --timeout-indicator=bottom \ "ESC" "close this app" "" "=" "SUPER KEY (Windows Key)" "(SUPER KEY)" \ " enter" "Terminal" "(kitty)" \ @@ -45,13 +44,15 @@ yad --width=$dynamic_width --height=$dynamic_height \ " Alt V" "Clipboard Manager" "(cliphist)" \ " W" "Choose wallpaper" "(swww)" \ "CTRL ALT W" "Random wallpaper" "(swww)" \ -" CTRL B" "Choose waybar styles" "(waybar styles)" \ " B" "Hide/UnHide Waybar" "waybar" \ +" CTRL B" "Choose waybar styles" "(waybar styles)" \ " ALT B" "Choose waybar layout" "(waybar layout)" \ -" ALT R" "Reload Waybar Dunst Rofi" "" \ +" ALT R" "Reload Waybar swaync Rofi" "CHECK NOTIFICATION FIRST!!!" \ +" SHIFT N" "Launch Notification Panel" "swaync Notification Center" \ " Print" "screenshot" "(grim)" \ " Shift Print" "screenshot region" "(grim + slurp)" \ " Shift S" "screenshot region" "(swappy)" \ +"ALT Print" "Screenshot active window" "active window only" \ "CTRL ALT P" "power-menu" "(wlogout)" \ "CTRL ALT L" "screen lock" "(swaylock)" \ "CTRL ALT Del" "Hyprland Exit" "(SAVE YOUR WORK!!!)" \ @@ -64,8 +65,7 @@ yad --width=$dynamic_width --height=$dynamic_height \ " H" "Launch this app" "" \ " E" "View or EDIT Keybinds, Settings, Monitor" "" \ "" "" "" \ -"" "More tips on Hyprland-Dots github wiki page" ""\ -"" "" "" \ -"" "" "This window will auto-close in 60 secs" ""\ +"More tips:" "https://github.com/JaKooLit/Hyprland-Dots/wiki" ""\ + diff --git a/config/hypr/scripts/MediaCtrl.sh b/config/hypr/scripts/MediaCtrl.sh index f9611523..9d970443 100755 --- a/config/hypr/scripts/MediaCtrl.sh +++ b/config/hypr/scripts/MediaCtrl.sh @@ -1,6 +1,6 @@ #!/bin/bash -music_icon="$HOME/.config/dunst/icons/music.png" +music_icon="$HOME/.config/swaync/icons/music.png" # Play the next track play_next() { @@ -23,18 +23,18 @@ toggle_play_pause() { # Stop playback stop_playback() { playerctl stop - dunstify -r 123 -i "$music_icon" "Playback Stopped" + notify-send -e -u low -i "$music_icon" "Playback Stopped" } -# Display Dunst notification with song information +# 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) - dunstify -r 123 -i "$music_icon" "Now Playing:" "$song_title\nby $song_artist" + notify-send -e -u low -i "$music_icon" "Now Playing:" "$song_title\nby $song_artist" elif [[ "$status" == "Paused" ]]; then - dunstify -r 123 -i "$music_icon" "Playback Paused" + notify-send -e -u low -i "$music_icon" "Playback Paused" fi } diff --git a/config/hypr/scripts/PywalDunst.sh b/config/hypr/scripts/PywalDunst.sh deleted file mode 100755 index 1c9398f2..00000000 --- a/config/hypr/scripts/PywalDunst.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# -lf/nf/cf color -# Defines the foreground color for low, normal and critical notifications respectively. -# -# -lb/nb/cb color -# Defines the background color for low, normal and critical notifications respectively. -# -# -lfr/nfr/cfr color -# Defines the frame color for low, normal and critical notifications respectively. - -[ -f "$HOME/.cache/wal/colors.sh" ] && . "$HOME/.cache/wal/colors.sh" - -pkill dunst - -DUNST_FILE=~/.config/dunst/dunstrc - -# update dunst based on pywal colors. -#sed -i '/background = /s/.*/ background = "$color0"/' $DUNST_FILE -#sed -i '/foreground = /s/.*/ foreground = "'$color7'"/' $DUNST_FILE -sed -i '/frame_color = /s/.*/ frame_color = "'$color2'"/' $DUNST_FILE - -sleep 0.3 -dunst -config ~/.config/dunst/dunstrc > /dev/null 2>&1 &
\ No newline at end of file diff --git a/config/hypr/scripts/QuickEdit.sh b/config/hypr/scripts/QuickEdit.sh index 7e9d67fc..9c7cdffc 100755 --- a/config/hypr/scripts/QuickEdit.sh +++ b/config/hypr/scripts/QuickEdit.sh @@ -1,40 +1,49 @@ #!/bin/bash -hyprDir="$HOME/.config/hypr/configs" +defaultDir="$HOME/.config/hypr/configs" +userDir="$HOME/.config/hypr/UserConfigs" menu(){ printf "1. view Env-variables\n" - printf "2. view Rules\n" - printf "3. view Execs (startup)\n" - printf "4. view KeyBinds\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 Hyprland-Settings\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-compact.rasi | cut -d. -f1) case $choice in 1) - kitty -e nano "$hyprDir/ENVariables.conf" + kitty -e nano "$userDir/ENVariables.conf" ;; 2) - kitty -e nano "$hyprDir/WindowRules.conf" + kitty -e nano "$userDir/WindowRules.conf" ;; 3) - kitty -e nano "$hyprDir/Execs.conf" + kitty -e nano "$userDir/Startup_Apps.conf" ;; 4) - kitty -e nano "$hyprDir/Keybinds.conf" + kitty -e nano "$userDir/UserKeybinds.conf" ;; 5) - kitty -e nano "$hyprDir/Monitors.conf" + kitty -e nano "$userDir/Monitors.conf" ;; 6) - kitty -e nano "$hyprDir/Laptops.conf" + kitty -e nano "$userDir/Laptops.conf" ;; 7) - kitty -e nano "$hyprDir/Settings.conf" + kitty -e nano "$userDir/UserSettings.conf" + ;; + 8) + kitty -e nano "$defaultDir/Settings.conf" + ;; + 9) + kitty -e nano "$defaultDir/Keybinds.conf" ;; *) ;; diff --git a/config/hypr/scripts/RainbowBorders.sh b/config/hypr/scripts/RainbowBorders.sh deleted file mode 100755 index 1f5e6cdb..00000000 --- a/config/hypr/scripts/RainbowBorders.sh +++ /dev/null @@ -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
\ No newline at end of file diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index 0d91de8d..b5e0f556 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -1,26 +1,40 @@ #!/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) +_ps=(waybar rofi swaync) for _prs in "${_ps[@]}"; do if pidof "${_prs}" >/dev/null; then pkill "${_prs}" fi done -sleep 0.1 +sleep 0.3 # Relaunch waybar waybar & -sleep 0.1 -# Relaunch dunst with pywal-borders -${SCRIPTSDIR}/PywalDunst.sh & +# relaunch swaync +sleep 0.5 +swaync > /dev/null 2>&1 & -# Relaunching rainbow borders +# Relaunching rainbow borders if the script exists sleep 1 -${SCRIPTSDIR}/RainbowBorders.sh & +if file_exists "${UserSCRIPTSDIR}/RainbowBorders.sh"; then + ${UserSCRIPTSDIR}/RainbowBorders.sh & +fi # for cava-pywal (note, need to manually restart cava once wallpaper changes) -ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true
\ No newline at end of file +ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true + +exit 0
\ No newline at end of file diff --git a/config/hypr/scripts/RefreshNoWaybar.sh b/config/hypr/scripts/RefreshNoWaybar.sh index c834a531..be06167c 100755 --- a/config/hypr/scripts/RefreshNoWaybar.sh +++ b/config/hypr/scripts/RefreshNoWaybar.sh @@ -5,6 +5,16 @@ # Modified inorder to refresh rofi background, Pywal 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=(rofi) @@ -17,13 +27,13 @@ done # Pywal refresh ${SCRIPTSDIR}/PywalSwww.sh & -sleep 0.5 -# Relaunch dunst with pywal-borders -${SCRIPTSDIR}/PywalDunst.sh & - -# Relaunching rainbow borders +# Relaunching rainbow borders if the script exists sleep 1 -${SCRIPTSDIR}/RainbowBorders.sh & +if file_exists "${UserSCRIPTSDIR}/RainbowBorders.sh"; then + ${UserSCRIPTSDIR}/RainbowBorders.sh & +fi # for cava-pywal (note, need to manually restart cava once wallpaper changes) -ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true
\ No newline at end of file +ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true + +exit 0
\ No newline at end of file diff --git a/config/hypr/scripts/RofiBeats.sh b/config/hypr/scripts/RofiBeats.sh index e0cc6f74..405451f5 100755 --- a/config/hypr/scripts/RofiBeats.sh +++ b/config/hypr/scripts/RofiBeats.sh @@ -1,7 +1,7 @@ #!/bin/bash # Directory for icons -iDIR="$HOME/.config/dunst/icons" +iDIR="$HOME/.config/swaync/icons" # Note: You can add more options below with the following format: # ["TITLE"]="link" @@ -21,7 +21,7 @@ declare -A menu_options=( # Function for displaying notifications notification() { - dunstify -u normal -i "$iDIR/music.png" "Playing now: $@" + notify-send -u normal -i "$iDIR/music.png" "Playing now: $@" } # Main function @@ -45,4 +45,4 @@ main() { } # Check if an online music process is running and send a notification, otherwise run the main function -pkill -f http && dunstify -u low -i "$iDIR/music.png" "Online Music stopped" || main +pkill -f http && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || main diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 29fe776a..1d5eeacf 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -1,27 +1,40 @@ #!/bin/bash -iDIR="$HOME/.config/dunst/icons" +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 +%Y-%m-%d-%H-%M-%S) +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_cmd_shot="dunstify -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png" notify_view() { - ${notify_cmd_shot} "Copied to clipboard." -## viewnior ${dir}/"$file" - if [[ -e "$dir/$file" ]]; then - ${notify_cmd_shot} "Screenshot Saved." - else - ${notify_cmd_shot} "Screenshot Deleted." - fi + 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 - dunstify -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec" + notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec" sleep 1 done } @@ -59,6 +72,17 @@ shotarea() { 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 @@ -73,8 +97,10 @@ 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" + echo -e "Available Options : --now --in5 --in10 --win --area --active" fi exit 0 diff --git a/config/hypr/scripts/Sunset.sh b/config/hypr/scripts/Sunset.sh deleted file mode 100755 index 96c27c5b..00000000 --- a/config/hypr/scripts/Sunset.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -wlsunset -t 4000 -T 6500 -d 900 -S 07:00 -s 19:00
\ No newline at end of file diff --git a/config/hypr/scripts/SwitchKeyboardLayout.sh b/config/hypr/scripts/SwitchKeyboardLayout.sh index 9d1ee844..a53a567d 100755 --- a/config/hypr/scripts/SwitchKeyboardLayout.sh +++ b/config/hypr/scripts/SwitchKeyboardLayout.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash layout_f="$HOME/.cache/kb_layout" -settings_file="$HOME/.config/hypr/configs/Settings.conf" -dunst_notif="$HOME/.config/dunst/images/bell.png" +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 @@ -40,4 +40,4 @@ hyprctl keyword input:kb_layout "$new_layout" echo "$new_layout" > "$layout_f" # Notification for the new keyboard layout -dunstify -u low -i "$dunst_notif" "Keyboard layout set to $new_layout"
\ No newline at end of file +notify-send -u low -i "$notif" "new KB_Layout: $new_layout"
\ No newline at end of file diff --git a/config/hypr/scripts/TouchPad.sh b/config/hypr/scripts/TouchPad.sh index 8f633ee0..1fcb3249 100755 --- a/config/hypr/scripts/TouchPad.sh +++ b/config/hypr/scripts/TouchPad.sh @@ -1,38 +1,22 @@ #!/bin/bash -dunst_notif="$HOME/.config/dunst/images/bell.png" +HYPRLAND_DEVICE="asue1209:00-04f3:319f-touchpad" +notif="$HOME/.config/swaync/images/bell.png" -# NOTE: find the right device using hyprctl devices - HYPRLAND_DEVICE="asue1209:00-04f3:319f-touchpad" +XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)} +STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" -if [ -z "$XDG_RUNTIME_DIR" ]; then - export XDG_RUNTIME_DIR=/run/user/$(id -u) -fi - -export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" - -enable_touchpad() { - printf "true" > "$STATUS_FILE" - - dunstify -u low -i "$dunst_notif" "Enabling Touchpad" - - hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" true -} - -disable_touchpad() { - printf "false" > "$STATUS_FILE" - - dunstify -u low -i "$dunst_notif" "Disabling Touchpad" +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 - hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" false + notify-send -u low -i "$notif" "Touchpad $action" + hyprctl keyword "device:$HYPRLAND_DEVICE:enabled" "$(cat "$STATUS_FILE")" } -if ! [ -f "$STATUS_FILE" ]; then - enable_touchpad -else - if [ $(cat "$STATUS_FILE") = "true" ]; then - disable_touchpad - elif [ $(cat "$STATUS_FILE") = "false" ]; then - enable_touchpad - fi -fi +toggle_touchpad diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh index d0eb0b68..f68491cf 100755 --- a/config/hypr/scripts/Volume.sh +++ b/config/hypr/scripts/Volume.sh @@ -1,6 +1,6 @@ #!/bin/bash -iDIR="$HOME/.config/dunst/icons" +iDIR="$HOME/.config/swaync/icons" # Get Volume get_volume() { @@ -29,9 +29,9 @@ get_icon() { # Notify notify_user() { if [[ "$(get_volume)" == "Muted" ]]; then - dunstify -h string:x-dunst-stack-tag:volume_notif -u low -i "$(get_icon)" "Volume: Muted" + notify-send -e -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" "Volume: Muted" else - dunstify -h int:value:"$(get_volume | sed 's/%//')" -h string:x-dunst-stack-tag:volume_notif -u low -i "$(get_icon)" "Volume: $(get_volume)" + 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 } @@ -54,18 +54,18 @@ dec_volume() { # Toggle Mute toggle_mute() { if [ "$(pamixer --get-mute)" == "false" ]; then - pamixer -m && dunstify -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF" + pamixer -m && notify-send -e -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF" elif [ "$(pamixer --get-mute)" == "true" ]; then - pamixer -u && dunstify -u low -i "$(get_icon)" "Volume Switched ON" + 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 && dunstify -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF" + 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 && dunstify -u low -i "$iDIR/microphone.png" "Microphone Switched ON" + pamixer -u --default-source u && notify-send -e -u low -i "$iDIR/microphone.png" "Microphone Switched ON" fi } # Get Mic Icon @@ -92,7 +92,7 @@ get_mic_volume() { notify_mic_user() { volume=$(get_mic_volume) icon=$(get_mic_icon) - dunstify -h int:value:"$volume" -h "string:x-dunst-stack-tag:volume_notif" -u low -i "$icon" "Mic-Level: $volume" + 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 diff --git a/config/hypr/scripts/Weather.py b/config/hypr/scripts/Weather.py deleted file mode 100755 index 154c1589..00000000 --- a/config/hypr/scripts/Weather.py +++ /dev/null @@ -1,122 +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 "" -city = "" -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(f"https://wttr.in/{city}?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)) diff --git a/config/hypr/scripts/Weather.sh b/config/hypr/scripts/Weather.sh deleted file mode 100755 index 40048710..00000000 --- a/config/hypr/scripts/Weather.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -city= -cachedir=~/.cache/rbn -cachefile=${0##*/}-$1 - -if [ ! -d $cachedir ]; then - mkdir -p $cachedir -fi - -if [ ! -f $cachedir/$cachefile ]; then - touch $cachedir/$cachefile -fi - -# Save current IFS -SAVEIFS=$IFS -# Change IFS to new line. -IFS=$'\n' - -cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile"))) -if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then - data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1)) - echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile - echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile - echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile -fi - -weather=($(cat $cachedir/$cachefile)) - -# Restore IFSClear -IFS=$SAVEIFS - -temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g') - -#echo ${weather[1]##*,} - -# https://fontawesome.com/icons?s=solid&c=weather -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="" - echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" - ;; -esac - -#echo $temp $condition - -echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" diff --git a/config/hypr/scripts/ZshChangeTheme.sh b/config/hypr/scripts/ZshChangeTheme.sh deleted file mode 100755 index 7057ed2e..00000000 --- a/config/hypr/scripts/ZshChangeTheme.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -themes_dir="$HOME/.oh-my-zsh/themes" -file_extension=".zsh-theme" - -themes_array=($(find "$themes_dir" -type f -name "*$file_extension" -exec basename {} \; | sed -e "s/$file_extension//")) - -rofi_command="rofi -dmenu -config ~/.config/rofi/config-zsh-theme.rasi" - -menu() { - for theme in "${themes_array[@]}"; do - echo "$theme" - done -} - -main() { - choice=$(menu | ${rofi_command}) - - # if nothing selected, script wont change anything - if [ -z "$choice" ]; then - exit 0 - fi - - zsh_path="$HOME/.zshrc" - var_name="ZSH_THEME" - for i in "${themes_array[@]}"; do - if [[ "$i" == "$choice"* ]]; then - if [ -f "$zsh_path" ]; then - sed -i "s/^$var_name=.*/$var_name=\"$i\"/" "$zsh_path" - else - echo "File not found" - fi - break - fi - done -} - -main |
