#!/bin/bash

# Define your list of commands
commands=(
    "Disable:bsp-layout remove"
    "Tile:bsp-layout set tiled"
    "Tall:bsp-layout set tall"
    "Grid:bsp-layout set grid"
    "Even:bsp-layout set even"
    "Random paper:nitrogen --random --set-scaled ~/Pictures/Wallpapers"
)

# Create a formatted list for Rofi
formatted_commands=()
for cmd in "${commands[@]}"; do
    IFS=":" read -r name command <<< "$cmd"
    formatted_commands+=("$name")
done

# Use Rofi to display the list and get the selected command
selected_command=$(printf '%s\n' "${formatted_commands[@]}" | rofi -dmenu -p "Tiling settings" -theme ".config/rofi/launchers/type-1/style-3.rasi")

# Execute the selected command
for cmd in "${commands[@]}"; do
    IFS=":" read -r name command <<< "$cmd"
    if [[ "$name" == "$selected_command" ]]; then
        eval "$command" &
        break
    fi
done

