Files
sxmo-utils/scripts/core/sxmo_xinit.sh
Maarten van Gompel ab56046aee Added support for wofi as a dmenu/bemenu alternative
I refactored some code to make exchanging menus a little bit easier
and I added wofi as new menu option.

The menu to use can be configured via the new environment variable
SXMO_MENU. Its value may be bemenu, dmenu, or wofi, *NOT* any arbitrary
binary. This variable will be automatically populated if not set, based on if
you're on wayland or Xorg.

setup_config_version.sh was extended to allow a configversion in CSS
comments (needed for wofi). I designed a theme that mimicks the default
style we have for bemenu/dmenu, with slightly more spacing perhaps.

Wofi can scan *.desktop files (drun mode), so I added an "All Apps" option that
makes use of that. Some further work is still required there however
to get wofi to properly launch terminal apps from there.

Wofi also has some issues positioning in landscape mode after the screen
was rotated, so my solution there is a bit hacky. May be an upstream
issue.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2024-10-15 13:21:28 +02:00

64 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
envvars() {
export SXMO_WM=dwm
export XDG_CURRENT_DESKTOP=dwm
[ -z "$SXMO_MENU" ] && export SXMO_MENU=dmenu
# shellcheck disable=SC2086
command -v $SXMO_TERMINAL "" >/dev/null || export SXMO_TERMINAL="st"
command -v "$KEYBOARD" >/dev/null || defaultkeyboard
[ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1
}
defaults() {
xmodmap "$(xdg_data_path sxmo/appcfg/xmodmap_caps_esc)"
xsetroot -mod 29 29 -fg '#0b3a4c' -bg '#082430'
xset s off -dpms
[ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources
SCREENWIDTH=$(xrandr | grep "Screen 0" | cut -d" " -f 8)
SCREENHEIGHT=$(xrandr | grep "Screen 0" | cut -d" " -f 10 | tr -d ",")
if [ "$SCREENWIDTH" -lt 1024 ] || [ "$SCREENHEIGHT" -lt 768 ]; then
gsettings set org.gtk.Settings.FileChooser window-size "($SCREENWIDTH,$((SCREENHEIGHT / 2)))"
fi
}
defaultkeyboard() {
if command -v svkbd-mobile-intl >/dev/null; then
export KEYBOARD=svkbd-mobile-intl
elif command -v svkbd-mobile-plain >/dev/null; then
export KEYBOARD=svkbd-mobile-plain
else
#legacy
export KEYBOARD=svkbd-sxmo
fi
}
with_dbus() {
echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
# shellcheck source=configs/appcfg/xinit_template
. "$XDG_CONFIG_HOME"/sxmo/xinit
exec dwm
}
cleanup() {
sxmo_jobs.sh stop all
pkill svkbd
case "$SXMO_MENU" in
dmenu)
pkill dmenu
;;
bemenu)
pkill bemenu
;;
esac
pkill superd
}
# shellcheck source=scripts/core/sxmo_init.sh
. sxmo_init.sh