💄 style(rofi): scripts indentation

This commit is contained in:
Sergio Laín 2024-07-30 19:07:48 +02:00
parent d43014b6f4
commit 03e5dbd9ca
No known key found for this signature in database
GPG key ID: 8429B2EE312F8150
4 changed files with 72 additions and 72 deletions

View file

@ -11,70 +11,70 @@ yes='󰸞'
no='󱎘'
rofi_cmd() {
rofi -dmenu \
-p "Uptime: $uptime" \
-mesg "Uptime: $uptime" \
-theme ~/.config/rofi/scripts/powermenu/style.rasi
rofi -dmenu \
-p "Uptime: $uptime" \
-mesg "Uptime: $uptime" \
-theme ~/.config/rofi/scripts/powermenu/style.rasi
}
confirm_cmd() {
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 350px;}' \
-theme-str 'mainbox {children: [ "message", "listview" ];}' \
-theme-str 'listview {columns: 2; lines: 1;}' \
-theme-str 'element-text {horizontal-align: 0.5;}' \
-theme-str 'textbox {horizontal-align: 0.5;}' \
-dmenu \
-p 'Confirmation' \
-mesg 'Are you sure?' \
-theme ~/.config/rofi/scripts/powermenu/style.rasi
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 350px;}' \
-theme-str 'mainbox {children: [ "message", "listview" ];}' \
-theme-str 'listview {columns: 2; lines: 1;}' \
-theme-str 'element-text {horizontal-align: 0.5;}' \
-theme-str 'textbox {horizontal-align: 0.5;}' \
-dmenu \
-p 'Confirmation' \
-mesg 'Are you sure?' \
-theme ~/.config/rofi/scripts/powermenu/style.rasi
}
confirm_exit() {
echo -e "$yes\n$no" | confirm_cmd
echo -e "$yes\n$no" | confirm_cmd
}
run_rofi() {
echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd
echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd
}
# Execute Command
run_cmd() {
selected="$(confirm_exit)"
if [[ "$selected" == "$yes" ]]; then
if [[ $1 == '--shutdown' ]]; then
systemctl poweroff
elif [[ $1 == '--reboot' ]]; then
systemctl reboot
elif [[ $1 == '--suspend' ]]; then
mpc -q pause
hyprlock
systemctl suspend
elif [[ $1 == '--logout' ]]; then
hyprctl dispatch exit
elif [[ $1 == '--lock' ]]; then
hyprlock
fi
else
exit 0
fi
selected="$(confirm_exit)"
if [[ "$selected" == "$yes" ]]; then
if [[ $1 == '--shutdown' ]]; then
systemctl poweroff
elif [[ $1 == '--reboot' ]]; then
systemctl reboot
elif [[ $1 == '--suspend' ]]; then
mpc -q pause
hyprlock
systemctl suspend
elif [[ $1 == '--logout' ]]; then
hyprctl dispatch exit
elif [[ $1 == '--lock' ]]; then
hyprlock
fi
else
exit 0
fi
}
# Actions
chosen="$(run_rofi)"
case ${chosen} in
$shutdown)
run_cmd --shutdown
;;
run_cmd --shutdown
;;
$reboot)
run_cmd --reboot
;;
run_cmd --reboot
;;
$lock)
run_cmd --lock
;;
run_cmd --lock
;;
$suspend)
run_cmd --suspend
;;
run_cmd --suspend
;;
$logout)
run_cmd --logout
;;
run_cmd --logout
;;
esac

View file

@ -1,7 +1,7 @@
#!/bin/bash
if [ "$1" = "--freeze" ]; then
extra_args="--freeze"
extra_args="--freeze"
fi
# variables
@ -20,15 +20,15 @@ folder=""
selected="$(echo -e "$region\n$output\n$window\n$folder" | rofi -dmenu -theme "${theme}")"
case $selected in
$region)
$command -m region
;;
$command -m region
;;
$output)
$command -m output
;;
$command -m output
;;
$window)
$command -m window
;;
$command -m window
;;
$folder)
~/.config/rofi/scripts/screenshot/screenshot_selection
;;
~/.config/rofi/scripts/screenshot/screenshot_selection
;;
esac

View file

@ -4,25 +4,25 @@ screenshots_dir=$HOME/Pictures/Screenshots/PC
theme="$HOME/.config/rofi/scripts/wallpaper/style.rasi"
build_theme() {
rows=$1
cols=$2
icon_size=$3
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;}"
echo "element{orientation:vertical;}element-text{horizontal-align:0.5;}element-icon{size:$icon_size.0000em;}listview{lines:$rows;columns:$cols;}"
}
rofi_cmd="rofi -dmenu -i -show-icons -theme-str $(build_theme 5 4 10) -theme ${theme}"
choice=$(
ls -t --escape "$screenshots_dir" -p | grep -v / |
while read A; do echo -en "$A\x00icon\x1f$screenshots_dir/$A\n"; done |
$rofi_cmd
ls -t --escape "$screenshots_dir" -p | grep -v / |
while read A; do echo -en "$A\x00icon\x1f$screenshots_dir/$A\n"; done |
$rofi_cmd
)
screenshot="$screenshots_dir/$choice"
if command -v satty &>/dev/null; then
satty -f "$screenshot"
satty -f "$screenshot"
else
xdg-open "$screenshot"
xdg-open "$screenshot"
fi

View file

@ -3,11 +3,11 @@
wallpapers_dir="$HOME/.config/hypr/theme/walls/"
build_theme() {
rows=$1
cols=$2
icon_size=$3
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;}"
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/scripts/wallpaper/style.rasi"
@ -15,17 +15,17 @@ theme="$HOME/.config/rofi/scripts/wallpaper/style.rasi"
rofi_cmd="rofi -dmenu -i -show-icons -theme-str $(build_theme 4 3 12) -theme ${theme}"
choice=$(
ls --escape "$wallpapers_dir" |
while read A; do echo -en "$A\x00icon\x1f$wallpapers_dir/$A\n"; done |
$rofi_cmd
ls --escape "$wallpapers_dir" |
while read A; do echo -en "$A\x00icon\x1f$wallpapers_dir/$A\n"; done |
$rofi_cmd
)
wallpaper="$wallpapers_dir/$choice"
swww img "$wallpaper" \
--transition-bezier 0.5,1.19,.8,.4 \
--transition-type wipe \
--transition-duration 2 \
--transition-fps 75 && notify-send "Wallpaper Changed" -i "$wallpaper" --app-name=Wallpaper
--transition-bezier 0.5,1.19,.8,.4 \
--transition-type wipe \
--transition-duration 2 \
--transition-fps 75 && notify-send "Wallpaper Changed" -i "$wallpaper" --app-name=Wallpaper
exit 1