diff --git a/src/layout.sh b/src/layout.sh index 88767cc..a5ef45a 100755 --- a/src/layout.sh +++ b/src/layout.sh @@ -235,6 +235,79 @@ reload_layouts() { done } +# () -> () +select_layout_with_rofi() { + # Determine the directory of the executable + DIR="$LAYOUTS" + + ICON_DIR="$DIR/images" + ROFI_CONFIG="$DIR/config-rofi/config.rasi" + # Opciones de layout con iconos (usando el formato de iconos de rofi) + + IMAGES=("tall:$ICON_DIR/tall.jpeg" + "rtall:$ICON_DIR/rtall.jpeg" + "wide:$ICON_DIR/wide.jpeg" + "rwide:$ICON_DIR/rwide.jpeg" + "grid:$ICON_DIR/grid.jpeg" + "rgrid:$ICON_DIR/rgrid.jpeg" + "even:$ICON_DIR/even.jpeg" + "tiled:$ICON_DIR/tiled.jpeg" + "monocle:$ICON_DIR/monocle.jpeg") + + + # Crear el menú de opciones para rofi + MENU="" + for LAYOUT in "${IMAGES[@]}"; do + NAME=$(echo $LAYOUT | cut -d':' -f1) + ICON=$(echo $LAYOUT | cut -d':' -f2) + MENU="${MENU}${NAME}\x00icon\x1f${ICON}\n" + done + + # Selección de layout usando rofi + SELECTED_LAYOUT=$(echo -e "$MENU" | rofi -dmenu -theme "$ROFI_CONFIG" -p "Selecciona un layout" -format "i s" -no-lazy-grab | awk '{print $2}') + + # Cambiar el layout en bspwm + case $SELECTED_LAYOUT in + tall) + bsp-layout set tall + ;; + rtall) + bsp-layout set rtall + ;; + wide) + bsp-layout set wide + ;; + rwide) + bsp-layout set rwide + ;; + grid) + bsp-layout set grid + ;; + rgrid) + bsp-layout set rgrid + ;; + even) + bsp-layout set even + ;; + tiled) + bsp-layout set tiled + ;; + monocle) + bsp-layout set monocle + ;; + *) + echo "Layout no válido" + ;; + esac + + # Cerrar el programa después de aplicar el layout + exit 0 + +} > /dev/null + + + + # List[args] -> () main () { check_dependencies @@ -250,6 +323,7 @@ main () { get) get_layout "$1" ;; remove) remove_listener "$1" ;; layouts) list_layouts ;; + select) select_layout_with_rofi ;; # Nuevo comando para seleccionar layout con rofi -h|--help|help) man bsp-layout ;; -v|version) echo "$VERSION" ;; *) echo -e "Unknown subcommand. Run bsp-layout help" && exit 1 ;; @@ -257,3 +331,4 @@ main () { } main "$@" + diff --git a/src/layouts/config-rofi/config.rasi b/src/layouts/config-rofi/config.rasi new file mode 100644 index 0000000..ed7bfd9 --- /dev/null +++ b/src/layouts/config-rofi/config.rasi @@ -0,0 +1,175 @@ +/*****----- Configuration -----*****/ +configuration { + modi: "drun,run,filebrowser,window"; + show-icons: true; +} + +/*****----- Global Properties -----*****/ +* { + font: "JetBrains Mono Nerd Font 10"; + background: #1B3A61; /* Azul oscuro */ + background-alt: #4169E1; /* Azul claro */ + foreground: #FFFFFF; /* Blanco */ + selected: #FFD700; /* Amarillo dorado */ + active: #32CD32; /* Verde */ + urgent: #FF6347; /* Rojo suave */ +} + +/*****----- Main Window -----*****/ +window { + /* properties for window widget */ + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 800px; + x-offset: 0px; + y-offset: 0px; + + /* properties for all widgets */ + enabled: true; + border-radius: 20px; + cursor: "default"; + background-color: @background; +} + +/*****----- Main Box -----*****/ +mainbox { + enabled: true; + spacing: 0px; + background-color: transparent; + orientation: vertical; + children: [ "inputbar", "listbox" ]; +} + +listbox { + spacing: 20px; + padding: 20px; + background-color: transparent; + orientation: vertical; + children: [ "message", "listview" ]; +} + +/*****----- Inputbar -----*****/ +inputbar { + enabled: true; + spacing: 10px; + padding: 20px 20px; + background-color: transparent; + text-color: @foreground; + orientation: horizontal; + children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ]; +} +textbox-prompt-colon { + enabled: true; + expand: false; + str: ""; + padding: 12px 15px; + border-radius: 100%; + background-color: @background-alt; + text-color: inherit; +} +entry { + enabled: true; + expand: false; + width: 700px; + padding: 12px 16px; + border-radius: 100%; + background-color: @background-alt; + text-color: inherit; + cursor: text; + placeholder: "Search"; + placeholder-color: inherit; +} +dummy { + expand: true; + background-color: transparent; +} + +/*****----- Mode Switcher -----*****/ +mode-switcher{ + enabled: true; + spacing: 10px; + background-color: transparent; + text-color: @foreground; +} +button { + width: 45px; + padding: 12px; + border-radius: 100%; + background-color: @background-alt; + text-color: inherit; + cursor: pointer; +} +button selected { + background-color: @selected; + text-color: @foreground; +} + +/*****----- Listview -----*****/ +listview { + enabled: true; + columns: 3; /* Número de columnas */ + lines: 3; /* Número de filas */ + cycle: true; + dynamic: true; + scrollbar: false; + layout: vertical; /* Layout horizontal para mostrar en cuadrícula */ + reverse: false; + fixed-height: true; + fixed-columns: true; + + spacing: 10px; + background-color: transparent; + text-color: @foreground; + cursor: "default"; +} + +/*****----- Elements -----*****/ +element { + enabled: true; + spacing: 10px; + padding: 4px; + border-radius: 10px; + background-color: transparent; + text-color: @foreground; + cursor: pointer; +} +element normal.normal { + background-color: inherit; + text-color: inherit; +} +element normal.urgent { + background-color: @urgent; + text-color: @foreground; +} +element normal.active { + background-color: @active; + text-color: @foreground; +} +element selected.normal { + background-color: @selected; + text-color: @foreground; +} +element selected.urgent { + background-color: @urgent; + text-color: @foreground; +} +element selected.active { + background-color: @urgent; + text-color: @foreground; +} +element-icon { + background-color: transparent; + text-color: inherit; + size: 128px; /* Tamaño grande para las imágenes */ + cursor: inherit; +} +element-text { + background-color: transparent; + text-color: inherit; + cursor: inherit; + vertical-align: 0.5; + horizontal-align: 0.0; +} + diff --git a/src/layouts/images/even.jpeg b/src/layouts/images/even.jpeg new file mode 100644 index 0000000..d0bd2da Binary files /dev/null and b/src/layouts/images/even.jpeg differ diff --git a/src/layouts/images/grid.jpeg b/src/layouts/images/grid.jpeg new file mode 100644 index 0000000..994a8e6 Binary files /dev/null and b/src/layouts/images/grid.jpeg differ diff --git a/src/layouts/images/monocle.jpeg b/src/layouts/images/monocle.jpeg new file mode 100644 index 0000000..644befc Binary files /dev/null and b/src/layouts/images/monocle.jpeg differ diff --git a/src/layouts/images/rgrid.jpeg b/src/layouts/images/rgrid.jpeg new file mode 100644 index 0000000..332a7da Binary files /dev/null and b/src/layouts/images/rgrid.jpeg differ diff --git a/src/layouts/images/rtall.jpeg b/src/layouts/images/rtall.jpeg new file mode 100644 index 0000000..e0592f5 Binary files /dev/null and b/src/layouts/images/rtall.jpeg differ diff --git a/src/layouts/images/rwide.jpeg b/src/layouts/images/rwide.jpeg new file mode 100644 index 0000000..e99160f Binary files /dev/null and b/src/layouts/images/rwide.jpeg differ diff --git a/src/layouts/images/tall.jpeg b/src/layouts/images/tall.jpeg new file mode 100644 index 0000000..f21d817 Binary files /dev/null and b/src/layouts/images/tall.jpeg differ diff --git a/src/layouts/images/tiled.jpeg b/src/layouts/images/tiled.jpeg new file mode 100644 index 0000000..64b342f Binary files /dev/null and b/src/layouts/images/tiled.jpeg differ diff --git a/src/layouts/images/wide.jpeg b/src/layouts/images/wide.jpeg new file mode 100644 index 0000000..0047a49 Binary files /dev/null and b/src/layouts/images/wide.jpeg differ