From 03e5dbd9ca633ecb3756503253844fde21562479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Tue, 30 Jul 2024 19:07:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20style(rofi):=20scripts=20indenta?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/rofi/scripts/powermenu/powermenu | 86 +++++++++---------- .config/rofi/scripts/screenshot/screenshot | 18 ++-- .../scripts/screenshot/screenshot_selection | 18 ++-- .config/rofi/scripts/wallpaper/wallpaper | 22 ++--- 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/.config/rofi/scripts/powermenu/powermenu b/.config/rofi/scripts/powermenu/powermenu index bd7be1b0..cfc72122 100755 --- a/.config/rofi/scripts/powermenu/powermenu +++ b/.config/rofi/scripts/powermenu/powermenu @@ -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 diff --git a/.config/rofi/scripts/screenshot/screenshot b/.config/rofi/scripts/screenshot/screenshot index 2f9c13f0..32db531e 100755 --- a/.config/rofi/scripts/screenshot/screenshot +++ b/.config/rofi/scripts/screenshot/screenshot @@ -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 diff --git a/.config/rofi/scripts/screenshot/screenshot_selection b/.config/rofi/scripts/screenshot/screenshot_selection index 41d23223..fe5c91b5 100755 --- a/.config/rofi/scripts/screenshot/screenshot_selection +++ b/.config/rofi/scripts/screenshot/screenshot_selection @@ -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 diff --git a/.config/rofi/scripts/wallpaper/wallpaper b/.config/rofi/scripts/wallpaper/wallpaper index 46ffa203..4e3a3e8a 100755 --- a/.config/rofi/scripts/wallpaper/wallpaper +++ b/.config/rofi/scripts/wallpaper/wallpaper @@ -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