Hide layouts that aren't available, remove layout code that wasn't

being used
This commit is contained in:
speedie 2022-09-03 19:57:49 +02:00
parent 8c350e1749
commit 6989e5153c
4 changed files with 117 additions and 83 deletions

View file

@ -99,57 +99,6 @@ grid(Monitor *m)
} }
#endif #endif
#if LAYOUT_GLGRID
void
gaplessgrid(Monitor *m)
{
unsigned int i, n;
int x, y, cols, rows, ch, cw, cn, rn, rrest, crest; // counters
int oh, ov, ih, iv;
Client *c;
getgaps(m, &oh, &ov, &ih, &iv, &n);
if (n == 0)
return;
/* grid dimensions */
for (cols = 0; cols <= n/2; cols++)
if (cols*cols >= n)
break;
if (n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
cols = 2;
rows = n/cols;
cn = rn = 0; // reset column no, row no, client count
ch = (m->wh - 2*oh - ih * (rows - 1)) / rows;
cw = (m->ww - 2*ov - iv * (cols - 1)) / cols;
rrest = (m->wh - 2*oh - ih * (rows - 1)) - ch * rows;
crest = (m->ww - 2*ov - iv * (cols - 1)) - cw * cols;
x = m->wx + ov;
y = m->wy + oh;
for (i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
if (i/rows + 1 > cols - n%cols) {
rows = n/cols + 1;
ch = (m->wh - 2*oh - ih * (rows - 1)) / rows;
rrest = (m->wh - 2*oh - ih * (rows - 1)) - ch * rows;
}
resize(c,
x,
y + rn*(ch + ih) + MIN(rn, rrest),
cw + (cn < crest ? 1 : 0) - 2*c->bw,
ch + (rn < rrest ? 1 : 0) - 2*c->bw,
0);
rn++;
if (rn >= rows) {
rn = 0;
x += cw + ih + (cn < crest ? 1 : 0);
cn++;
}
}
}
#endif
#if LAYOUT_FIBO #if LAYOUT_FIBO
void void
fibonacci(Monitor *m, int s) fibonacci(Monitor *m, int s)

View file

@ -48,16 +48,6 @@ if [ "$LAYOUT_GRID" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Grid\n")" AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Grid\n")"
fi fi
# Gapless Grid
if [ "$LAYOUT_GLGRID" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Gapless Grid\n")"
fi
# Fibonacci
if [ "$LAYOUT_FIBO" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Fibonacci\n")"
fi
# Dwindle # Dwindle
if [ "$LAYOUT_DWINDLE" = "1" ]; then if [ "$LAYOUT_DWINDLE" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Dwindle\n")" AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Dwindle\n")"
@ -84,12 +74,12 @@ if [ "$LAYOUT_BSTACKH" = "1" ]; then
fi fi
# Horizontal Grid # Horizontal Grid
if [ "$LAYOUT_HSTACK" = "1" ]; then if [ "$LAYOUT_HGRID" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Horizontal Grid\n")" AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Horizontal Grid\n")"
fi fi
# Dynamic Grid # Dynamic Grid
if [ "$LAYOUT_DSTACK" = "1" ]; then if [ "$LAYOUT_DGRID" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Dynamic Grid\n")" AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Dynamic Grid\n")"
fi fi

View file

@ -100,8 +100,103 @@ HELP() {
pgrep -x $RUNLAUNCHER && cat /tmp/speedwm-printed-help | $RUNLAUNCHER -p 'speedwmutils help' $GRIDARG $GRIDNUM -l 20 pgrep -x $RUNLAUNCHER && cat /tmp/speedwm-printed-help | $RUNLAUNCHER -p 'speedwmutils help' $GRIDARG $GRIDNUM -l 20
} }
# Source layout data
if [ -e "/usr/share/speedwm-layouts" ]; then
. /usr/share/speedwm-layouts
fi
# Tile
if [ "$LAYOUT_TILE" = "1" ]; then
L1="$(printf "L1: Tiling\n")"
fi
# Tile (5:4)
if [ "$LAYOUT_TILE54" = "1" ]; then
L17="$(printf "L17: Tiling (5:4)\n")"
fi
# Monocle
if [ "$LAYOUT_MONOCLE" = "1" ]; then
L3="$(printf "L3: Monocle\n")"
fi
# Grid
if [ "$LAYOUT_GRID" = "1" ]; then
L4="$(printf "L4: Grid\n")"
fi
# Dwindle
if [ "$LAYOUT_DWINDLE" = "1" ]; then
L9="$(printf "L8: Dwindle\n")"
fi
# Spiral
if [ "$LAYOUT_SPIRAL" = "1" ]; then
L8="$(printf "L8: Spiral\n")"
fi
# Three Columns
if [ "$LAYOUT_TCL" = "1" ]; then
L10="$(printf "L10: Three Columns\n")"
fi
# Bottom Stack
if [ "$LAYOUT_BSTACK" = "1" ]; then
L11="$(printf "L11: Bottom Stack Vertical\n")"
fi
# Horizontal Bottom Stack
if [ "$LAYOUT_BSTACKH" = "1" ]; then
L12="$(printf "L12: Bottom Stack Horizontal\n")"
fi
# Horizontal Grid
if [ "$LAYOUT_HGRID" = "1" ]; then
L13="$(printf "L13: Horizontal Grid\n")"
fi
# Dynamic Grid
if [ "$LAYOUT_DGRID" = "1" ]; then
L19="$(printf "L19: Dynamic Grid\n")"
fi
# Tatami
if [ "$LAYOUT_TATAMI" = "1" ]; then
L14="$(printf "L14: Tatami\n")"
fi
# Tilewide
if [ "$LAYOUT_TW" = "1" ]; then
L15="$(printf "L15: Tilewide\n")"
fi
# Centered Master
if [ "$LAYOUT_CM" = "1" ]; then
L6="$(printf "L6: Centered Master\n")"
fi
# Centered Floating Master
if [ "$LAYOUT_CFM" = "1" ]; then
L7="$(printf "L7: Centered Floating Master\n")"
fi
# Deck
if [ "$LAYOUT_DECK" = "1" ]; then
L5="$(printf "L5: Deck\n")"
fi
# Columns
if [ "$LAYOUT_COL" = "1" ]; then
L18="$(printf "L18: Column\n")"
fi
# Stairs
if [ "$LAYOUT_STAIRS" = "1" ]; then
L16="$(printf "L16: Stairs\n")"
fi
case "$1" in case "$1" in
"-layout") SEL_LAYOUT=$(printf "L1: Tiling\nL2: Floating\nL3: Monocle\nL4: Grid\nL5: Deck\nL6: Centered Master\nL7: Centered Floating Master\nL8: Fibonacci Spiral\nL9: Fibonacci Dwindle\nL10: Three Column\nL11: Bottom Stack Vertical\nL12: Bottom Stack Horizontal\nL13: Horizontal Grid\nL14: Tatami\nL15: Tilewide\nL16: Stairs\nL17: Tiling (5:4)\nL18: Column\nL19: Dynamic Grid\nPrevious Layout\nNext Layout" | $RUNLAUNCHER -l 21 -p "Pick a layout: ") ;; "-layout") SEL_LAYOUT=$(printf "${L1}\nL2: Floating\n${L3}\n${L4}\n${L5}\n${L6}\n${L7}\n${L8}\n${L9}\n${L10}\n${L11}\n${L12}\n${L13}\n${L14}\n${L15}\n${L16}\n${L17}\n${L18}\n${L19}\nPrevious Layout\nNext Layout" | $RUNLAUNCHER -l 21 -p "Pick a layout: ") ;;
"-spawn") printf "Not complete" ;; "-spawn") printf "Not complete" ;;
"-list") sed 's|xsetroot -name "fsignal:||g' /usr/share/speedwm-fsignal | sed 's|"||g' ;; "-list") sed 's|xsetroot -name "fsignal:||g' /usr/share/speedwm-fsignal | sed 's|"||g' ;;
"-reloadxrdb") xsetroot -name "fsignal:$SIGNAL_18" ;; "-reloadxrdb") xsetroot -name "fsignal:$SIGNAL_18" ;;

View file

@ -27,22 +27,22 @@
* If you don't use a layout, you can remove it to keep the speedwm binary small. * If you don't use a layout, you can remove it to keep the speedwm binary small.
*/ */
#define LAYOUT_TILE 1 /* Whether or not to include the tiling layout */ #define LAYOUT_TILE 1 /* Whether or not to include the tiling layout */
#define LAYOUT_TILE54 1 /* Whether or not to include hte 5:4 tiling layout */ #define LAYOUT_TILE54 0 /* Whether or not to include hte 5:4 tiling layout */
#define LAYOUT_MONOCLE 1 /* Whether or not to include the monocle layout */ #define LAYOUT_MONOCLE 0 /* Whether or not to include the monocle layout */
#define LAYOUT_GRID 1 /* Whether or not to include the grid layout */ #define LAYOUT_GRID 0 /* Whether or not to include the grid layout */
#define LAYOUT_GLGRID 1 /* Whether or not to include the gapless grid layout */ #define LAYOUT_GLGRID 0 /* Whether or not to include the gapless grid layout */
#define LAYOUT_FIBO 1 /* Whether or not to include the fibonacci layout */ #define LAYOUT_FIBO 0 /* Whether or not to include the fibonacci layout */
#define LAYOUT_DWINDLE 1 /* Whether or not to include the dwindle layout */ #define LAYOUT_DWINDLE 0 /* Whether or not to include the dwindle layout */
#define LAYOUT_SPIRAL 1 /* Whether or not to include the spiral layout */ #define LAYOUT_SPIRAL 0 /* Whether or not to include the spiral layout */
#define LAYOUT_TCL 1 /* Whether or not to include the three column layout */ #define LAYOUT_TCL 0 /* Whether or not to include the three column layout */
#define LAYOUT_BSTACK 1 /* Whether or not to include the bottom stack layout */ #define LAYOUT_BSTACK 0 /* Whether or not to include the bottom stack layout */
#define LAYOUT_BSTACKH 1 /* Whether or not to include the horizontal bottom stack layout */ #define LAYOUT_BSTACKH 0 /* Whether or not to include the horizontal bottom stack layout */
#define LAYOUT_HGRID 1 /* Whether or not to include the horizontal grid layout */ #define LAYOUT_HGRID 0 /* Whether or not to include the horizontal grid layout */
#define LAYOUT_DGRID 1 /* Whether or not to include the dynamic grid layout */ #define LAYOUT_DGRID 0 /* Whether or not to include the dynamic grid layout */
#define LAYOUT_TATAMI 1 /* Whether or not to include the tatami layout */ #define LAYOUT_TATAMI 0 /* Whether or not to include the tatami layout */
#define LAYOUT_TW 1 /* Whether or not to include the wide tiling layout */ #define LAYOUT_TW 0 /* Whether or not to include the wide tiling layout */
#define LAYOUT_CM 1 /* Whether or not to include the centered master layout */ #define LAYOUT_CM 0 /* Whether or not to include the centered master layout */
#define LAYOUT_CFM 1 /* Whether or not to include the centered floating master layout */ #define LAYOUT_CFM 0 /* Whether or not to include the centered floating master layout */
#define LAYOUT_DECK 1 /* Whether or not to include the deck layout */ #define LAYOUT_DECK 0 /* Whether or not to include the deck layout */
#define LAYOUT_COL 1 /* Whether or not to include the column layout */ #define LAYOUT_COL 0 /* Whether or not to include the column layout */
#define LAYOUT_STAIRS 1 /* Whether or not to include the stairs layout */ #define LAYOUT_STAIRS 0 /* Whether or not to include the stairs layout */