Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions src/layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -250,10 +323,12 @@ 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 ;;
esac
}

main "$@"

175 changes: 175 additions & 0 deletions src/layouts/config-rofi/config.rasi
Original file line number Diff line number Diff line change
@@ -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;
}

Binary file added src/layouts/images/even.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/layouts/images/grid.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/layouts/images/monocle.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/layouts/images/rgrid.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/layouts/images/rtall.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/layouts/images/rwide.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/layouts/images/tall.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/layouts/images/tiled.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/layouts/images/wide.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.