speedwm-personal/scripts/speedwm-dm

133 lines
3.6 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# speedwm-dm
# Create a .desktop file for people who use display managers.
# Delete the topbar file
2022-09-21 19:49:54 +02:00
rm -f /usr/share/speedwm/topbar
# Delete the padding file
2022-09-21 19:49:54 +02:00
rm -f /usr/share/speedwm/nopadding
# Make the directory for the .desktop file if it does not exist
mkdir -p /usr/share/xsessions
# Write the .desktop entry
2022-09-21 19:49:54 +02:00
printf "[Desktop Entry]\nEncoding=UTF-8\nName=speedwm\nComment=speedwm: speedie's window manager\nExec=/usr/bin/speedwm_run\nIcon=speedwm\nType=XSession" > /usr/share/xsessions/speedwm.desktop
2022-09-21 19:49:54 +02:00
# If the bar is on the top, touch /usr/share/speedwm/topbar
TOPBAR=$(grep "barposition" options.h | grep "1" | awk '{ print $5 }')
2022-09-21 19:49:54 +02:00
# If we have no padding, touch /usr/share/speedwm/nopadding
PADDING=$(grep "barpaddingv" options.h | grep "0" | awk '{ print $5 }')
2022-09-21 19:49:54 +02:00
# Write the compositor to /usr/share/speedwm/compositor
2022-09-01 10:02:28 +02:00
COMPOSITOR=$(grep "define COMPOSITOR " options.h | awk '{ print $3 }' | sed 's/"//g')
2022-09-03 19:34:19 +02:00
2022-09-21 19:49:54 +02:00
# Print all of it
echo $TOPBAR | grep "1" && touch /usr/share/speedwm/topbar
echo $PADDING | grep "0" && touch /usr/share/speedwm/nopadding
echo $COMPOSITOR > /usr/share/speedwm/compositor
echo $(pwd) > /usr/share/speedwm/sourcedir
sed "s/#define //g" toggle.h | grep LAYOUT | sed "s|/[*]|#|g; s|[*]/||g; s/ //g; s/1/=1/g; s/0/=0/g; s/#/ # /g" > /usr/share/speedwm/layouts
. /usr/share/speedwm/layouts
2022-09-03 19:34:19 +02:00
2022-09-21 19:49:54 +02:00
AVAILABLE_LAYOUTS="$(printf "$AVAILABLE_LAYOUTS")"
2022-09-03 19:34:19 +02:00
# Tile
if [ "$LAYOUT_TILE" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Tiling\n")"
fi
# Tile (5:4)
if [ "$LAYOUT_TILE54" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Tiling 5:4\n")"
fi
# Monocle
if [ "$LAYOUT_MONOCLE" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Monocle\n")"
fi
# Grid
if [ "$LAYOUT_GRID" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Grid\n")"
fi
# Dwindle
if [ "$LAYOUT_DWINDLE" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Dwindle\n")"
fi
# Spiral
if [ "$LAYOUT_SPIRAL" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Spiral\n")"
fi
# Three Columns
if [ "$LAYOUT_TCL" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Three Columns\n")"
fi
# Bottom Stack
if [ "$LAYOUT_BSTACK" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Bottom Stack\n")"
fi
# Horizontal Bottom Stack
if [ "$LAYOUT_BSTACKH" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Horizontal Bottom Stack\n")"
fi
# Horizontal Grid
if [ "$LAYOUT_HGRID" = "1" ]; then
2022-09-03 19:34:19 +02:00
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Horizontal Grid\n")"
fi
# Dynamic Grid
if [ "$LAYOUT_DGRID" = "1" ]; then
2022-09-03 19:34:19 +02:00
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Dynamic Grid\n")"
fi
# Tatami
if [ "$LAYOUT_TATAMI" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Tatami\n")"
fi
# Tilewide
if [ "$LAYOUT_TW" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Tilewide\n")"
fi
# Centered Master
if [ "$LAYOUT_CM" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Centered Master\n")"
fi
# Centered Floating Master
if [ "$LAYOUT_CFM" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Centered Floating Master\n")"
fi
# Deck
if [ "$LAYOUT_DECK" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Deck\n")"
fi
# Columns
if [ "$LAYOUT_COL" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Columns\n")"
fi
# Stairs
if [ "$LAYOUT_STAIRS" = "1" ]; then
AVAILABLE_LAYOUTS="$(printf "${AVAILABLE_LAYOUTS} Stairs\n")"
fi
printf "\n\nAvailable layouts: $AVAILABLE_LAYOUTS\n\n"
# Copy .Xresources file
cp docs/example.Xresources /usr/share/example.Xresources
exit 0