This commit is contained in:
Stephan Raabe 2024-05-23 15:42:03 +02:00
parent 004702f450
commit 150616996f
12 changed files with 65 additions and 35 deletions

Binary file not shown.

Binary file not shown.

View File

@ -70,31 +70,31 @@
;; powermenus ;; powermenus
(defwidget logout [] (defwidget logout []
(box :class "winbox" (box :class "winbox"
(button :tooltip "Logout" :style "background-image: url('../assets/application-exit-symbolic-rtl.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system.sh logout &") (button :tooltip "Logout" :style "background-image: url('../assets/application-exit-symbolic-rtl.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../../hypr/scripts/power.sh exit &")
) )
) )
(defwidget suspend [] (defwidget suspend []
(box :class "winbox" (box :class "winbox"
(button :tooltip "Suspend" :style "background-image: url('../assets/media-playback-pause-symbolic.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system.sh suspend &") (button :tooltip "Suspend" :style "background-image: url('../assets/media-playback-pause-symbolic.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../../hypr/scripts/power.sh suspend &")
) )
) )
(defwidget lock [] (defwidget lock []
(box :class "winbox" (box :class "winbox"
(button :tooltip "Lock" :style "background-image: url('../assets/system-lock-screen-symbolic.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system.sh lock &") (button :tooltip "Lock" :style "background-image: url('../assets/system-lock-screen-symbolic.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../../hypr/scripts/power.sh lock &")
) )
) )
(defwidget reboot [] (defwidget reboot []
(box :class "winbox" (box :class "winbox"
(button :tooltip "Reboot" :style "background-image: url('../assets/system-reboot-symbolic.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system.sh reboot &") (button :tooltip "Reboot" :style "background-image: url('../assets/system-reboot-symbolic.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../../hypr/scripts/power.sh reboot &")
) )
) )
(defwidget shutdown [] (defwidget shutdown []
(box :class "winbox" (box :class "winbox"
(button :tooltip "Shutdown" :style "background-image: url('../assets/system-shutdown-symbolic.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system.sh shutdown &") (button :tooltip "Shutdown" :style "background-image: url('../assets/system-shutdown-symbolic.svg');" :class "powericons" :valign "center" :halign "center" :onclick "../../hypr/scripts/power.sh shutdown &")
) )
) )

View File

@ -1,3 +0,0 @@
#!/bin/bash
sleep 0.5
killall -9 Hyprland sleep 2

View File

@ -1,3 +0,0 @@
#!/bin/bash
sleep 0.5
hyprlock

43
hypr/scripts/power.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# ____
# | _ \ _____ _____ _ __
# | |_) / _ \ \ /\ / / _ \ '__|
# | __/ (_) \ V V / __/ |
# |_| \___/ \_/\_/ \___|_|
#
if [[ "$1" == "exit" ]]; then
echo ":: Exit"
sleep 0.5
killall -9 Hyprland sleep 2
fi
if [[ "$1" == "lock" ]]; then
echo ":: Lock"
sleep 0.5
hyprlock
fi
if [[ "$1" == "reboot" ]]; then
echo ":: Reboot"
sleep 0.5
systemctl reboot
fi
if [[ "$1" == "shutdown" ]]; then
echo ":: Shutdown"
sleep 0.5
systemctl poweroff
fi
if [[ "$1" == "suspend" ]]; then
echo ":: Suspend"
sleep 0.5
systemctl suspend
fi
if [[ "$1" == "hibernate" ]]; then
echo ":: Hibernate"
sleep 1;
systemctl hibernate
fi

View File

@ -1,3 +0,0 @@
#!/bin/bash
sleep 0.5
systemctl reboot

View File

@ -1,3 +0,0 @@
#!/bin/bash
sleep 0.5
systemctl poweroff

View File

@ -1,3 +0,0 @@
#!/bin/bash
sleep 0.5
systemctl suspend

View File

@ -14,8 +14,6 @@ wallpaper_folder="$HOME/wallpaper"
if [ -f ~/dotfiles/.settings/wallpaper-folder.sh ] ;then if [ -f ~/dotfiles/.settings/wallpaper-folder.sh ] ;then
source ~/dotfiles/.settings/wallpaper-folder.sh source ~/dotfiles/.settings/wallpaper-folder.sh
fi fi
echo $wallpaper_folder
cache_file="$HOME/.cache/current_wallpaper" cache_file="$HOME/.cache/current_wallpaper"
blurred="$HOME/.cache/blurred_wallpaper.png" blurred="$HOME/.cache/blurred_wallpaper.png"
square="$HOME/.cache/square_wallpaper.png" square="$HOME/.cache/square_wallpaper.png"

View File

@ -10,6 +10,10 @@
# ----------------------------------------------------- # -----------------------------------------------------
# Cache file for holding the current wallpaper # Cache file for holding the current wallpaper
wallpaper_folder="$HOME/wallpaper"
if [ -f ~/dotfiles/.settings/wallpaper-folder.sh ] ;then
source ~/dotfiles/.settings/wallpaper-folder.sh
fi
cache_file="$HOME/.cache/current_wallpaper" cache_file="$HOME/.cache/current_wallpaper"
blurred="$HOME/.cache/blurred_wallpaper.png" blurred="$HOME/.cache/blurred_wallpaper.png"
rasi_file="$HOME/.cache/current_wallpaper.rasi" rasi_file="$HOME/.cache/current_wallpaper.rasi"
@ -17,13 +21,13 @@ rasi_file="$HOME/.cache/current_wallpaper.rasi"
# Create cache file if not exists # Create cache file if not exists
if [ ! -f $cache_file ] ;then if [ ! -f $cache_file ] ;then
touch $cache_file touch $cache_file
echo "$HOME/wallpaper/default.jpg" > "$cache_file" echo "$wallpaper_folder/default.jpg" > "$cache_file"
fi fi
# Create rasi file if not exists # Create rasi file if not exists
if [ ! -f $rasi_file ] ;then if [ ! -f $rasi_file ] ;then
touch $rasi_file touch $rasi_file
echo "* { current-image: url(\"$HOME/wallpaper/default.jpg\", height); }" > "$rasi_file" echo "* { current-image: url(\"$wallpaper_folder/default.jpg\", height); }" > "$rasi_file"
fi fi
current_wallpaper=$(cat "$cache_file") current_wallpaper=$(cat "$cache_file")
@ -35,26 +39,26 @@ case $1 in
if [ -f $cache_file ]; then if [ -f $cache_file ]; then
wal -q -i $current_wallpaper wal -q -i $current_wallpaper
else else
wal -q -i ~/wallpaper/ wal -q -i $wallpaper_folder
fi fi
;; ;;
# Select wallpaper with rofi # Select wallpaper with rofi
"select") "select")
selected=$( find "$HOME/wallpaper" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -exec basename {} \; | sort -R | while read rfile selected=$( find "$wallpaper_folder" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -exec basename {} \; | sort -R | while read rfile
do do
echo -en "$rfile\x00icon\x1f$HOME/wallpaper/${rfile}\n" echo -en "$rfile\x00icon\x1f$wallpaper_folder/${rfile}\n"
done | rofi -dmenu -replace -l 6 -config ~/dotfiles/rofi/config-wallpaper.rasi) done | rofi -dmenu -replace -l 6 -config ~/dotfiles/rofi/config-wallpaper.rasi)
if [ ! "$selected" ]; then if [ ! "$selected" ]; then
echo "No wallpaper selected" echo "No wallpaper selected"
exit exit
fi fi
wal -q -i ~/wallpaper/$selected wal -q -i $wallpaper_folder/$selected
;; ;;
# Randomly select wallpaper # Randomly select wallpaper
*) *)
wal -q -i ~/wallpaper/ wal -q -i $wallpaper_folder/
;; ;;
esac esac

View File

@ -1,36 +1,36 @@
{ {
"label" : "lock", "label" : "lock",
"action" : "$HOME/dotfiles/hypr/scripts/lock.sh", "action" : "$HOME/dotfiles/hypr/scripts/power.sh lock",
"text" : "Lock", "text" : "Lock",
"keybind" : "l" "keybind" : "l"
} }
{ {
"label" : "hibernate", "label" : "hibernate",
"action" : "sleep 1; systemctl hibernate", "action" : "$HOME/dotfiles/hypr/scripts/power.sh hibernate",
"text" : "Hibernate", "text" : "Hibernate",
"keybind" : "h" "keybind" : "h"
} }
{ {
"label" : "logout", "label" : "logout",
"action" : "$HOME/dotfiles/hypr/scripts/exit.sh", "action" : "$HOME/dotfiles/hypr/scripts/power.sh exit",
"text" : "Exit", "text" : "Exit",
"keybind" : "e" "keybind" : "e"
} }
{ {
"label" : "shutdown", "label" : "shutdown",
"action" : "$HOME/dotfiles/hypr/scripts/shutdown.sh", "action" : "$HOME/dotfiles/hypr/scripts/power.sh shutdown",
"text" : "Shutdown", "text" : "Shutdown",
"keybind" : "s" "keybind" : "s"
} }
{ {
"label" : "suspend", "label" : "suspend",
"action" : "$HOME/dotfiles/hypr/scripts/suspend.sh", "action" : "$HOME/dotfiles/hypr/scripts/power.sh suspend",
"text" : "Suspend", "text" : "Suspend",
"keybind" : "u" "keybind" : "u"
} }
{ {
"label" : "reboot", "label" : "reboot",
"action" : "$HOME/dotfiles/hypr/scripts/reboot.sh", "action" : "$HOME/dotfiles/hypr/scripts/power.sh reboot",
"text" : "Reboot", "text" : "Reboot",
"keybind" : "r" "keybind" : "r"
} }