Added data files

This commit is contained in:
Keith Bowes 2022-02-22 20:29:04 -05:00
parent 0f612080fa
commit c4e224d5fa
53 changed files with 713 additions and 54 deletions

32
data/autostart Normal file
View file

@ -0,0 +1,32 @@
#
# These things are run when a Waybox Wayland session is started.
# Copy to $XDG_CONFIG_HOME/waybox/autostart to customize.
#
#
# Change from Openbox: the desktop environment's config tools should begin
# through autostart elements (e.g. /etc/xdg/autostart); there's no need to
# specify them here.
#
# Update the DBus environment
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE
# Start a dock
cairo-dock &
# Start a panel
(waybar || yambar) &
# Load a random wallpaper
oldifs=$IFS
IFS=:
for wpdir in ${XDG_DATA_DIRS:-${datadir:-/usr/share}}:${XDG_DATA_HOME:-~/.local/share};
do
find $wpdir -path '*/backgrounds/*.jpg' -o -path '*/backgrounds/*.png' -o -path '*/backgrounds/*.svg' \
-o -path '*/wallpapers/*.jpg' -o -path '*/wallpapers/*.png' -o -path '*/wallpapers/*.svg';
done | (shuf -n 1 || tail -n 1) | xargs swaybg -m fill -i &
IFS=$oldifs
# vim: ft=sh

46
data/environment Normal file
View file

@ -0,0 +1,46 @@
#
# Environment variables here for Waybox
# Copy to $XDG_CONFIG_HOME/waybox/environment to customize
#
# To set your language for displaying messages and time/date formats, use the following:
#LANG=en_CA.UTF8
# To set your keyboard layout, use something like (see `man xkeyboard-config`
# for more information):
#export XKB_DEFAULT_LAYOUT=us
#export XKB_DEFAULT_MODEL=pc105
#export XKB_DEFAULT_OPTIONS=ctrl:swapcaps,esperanto:dvorak,lv3:ralt_switch_multikey
#export XKB_DEFAULT_RULES=evdev
#export XKB_DEFAULT_VARIANT=dvorak
#
# UIM for typing non-English characters
#export XMODIFIERS=@im=uim
#export GTK_IM_MODULE=uim
#export QT_IM_MODULE=uim
#export ECORE_IMF_MODULE=uim
# Current compositor. Needed for Wayland security negotiation.
export XDG_CURRENT_DESKTOP=waybox
export XDG_SESSION_TYPE=wayland
# Make sure to run the X initialization if started through a display manager
# It must go here instead of in autostart so that the environment variables will get set
if test -n "$DISPLAY" && test -d /etc/X11/xinit/xinitrc.d;
then
for f in /etc/X11/xinit/xinitrc.d/*.sh;
do
test -f "$f" && . "$f"
done
fi
# Get the preferred terminal from GNOME (if you use mostly GTK apps)
TERMINAL=$(gsettings get org.gnome.desktop.default-applications.terminal exec | tr -d \')
# Get the preferred terminal from KDE (if you use mostly Qt apps)
#TERMINAL=$(kreadconfig5 --file kdeglobals --group General --key TerminalApplication --default "konsole")
# Or just set it hard:
#TERMINAL=kitty
export TERMINAL
# Use autostart scripts for these environments
export WB_AUTOSTART_ENVIRONMENT=GNOME:KDE

40
data/meson.build Normal file
View file

@ -0,0 +1,40 @@
cfdata = configuration_data()
cfdata.set('libexecdir', get_option('prefix') / get_option('libexecdir'))
cfdata.set('localedir', get_option('prefix') / get_option('localedir'))
cfdata.set('sysconfdir', get_option('prefix') / get_option('sysconfdir'))
cfdata.set('package', meson.project_name())
configure_file(
configuration: cfdata,
input: 'waybox.sh',
output: 'waybox',
install: true,
install_dir: get_option('prefix') / get_option('bindir'),
install_mode: 'rwxr-xr-x',
)
scripts = files(
'autostart',
'environment',
'xdg-autostart',
)
wb_xdg_dir = get_option('prefix') / get_option('sysconfdir') + '/xdg/waybox'
install_data(
scripts,
install_dir: wb_xdg_dir,
install_mode: 'rwxr-xr-x',
)
install_data(
'rc.xml',
install_dir: wb_xdg_dir,
install_mode: 'rw-r--r--',
)
install_data(
'waybox.desktop',
install_dir: get_option('prefix') / get_option('datadir') + '/wayland-sessions',
install_mode: 'rw-r--r--',
)

84
data/rc.xml Normal file
View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<keyboard>
<!-- Keyboard layout. See `man xkeyboard-config` for more information -->
<!-- You can use the XKB_* environment variables instead -->
<!-- <keyboardLayout>
<model>105</model>
<layout>us</layout>
<options>ctrl:swapcaps,esperanto:dvorak,lv3:ralt_switch_multikey</options>
<rules>evdev</rules>
<variant>dvorak</variant>
</keyboardLayout> -->
<keybind key="W-Return">
<action name="Execute">
<execute>terminal</execute>
</action>
</keybind>
<!-- Keybindings for windows -->
<keybind key="A-F4">
<action name="Close"/>
</keybind>
<keybind key="C-Escape">
<action name="Exit"/>
</keybind>
<keybind key="Print">
<action name="Execute">
<execute>grim "$(xdg-user-dir PICTURES)/$(date +'%Y-%m-%d-%H%M%S_grim_fs.png')"</execute>
</action>
</keybind>
<!-- Keybindings for window switching -->
<keybind key="A-Tab">
<action name="NextWindow">
</action>
</keybind>
<keybind key="A-S-ISO_Left_Tab">
<action name="PreviousWindow">
</action>
</keybind>
<keybind key="C-A-Tab">
<action name="NextWindow">
</action>
</keybind>
<!-- Keybindings for running applications -->
<keybind key="A-F2">
<action name="Execute">
<execute>obrun l</execute>
</action>
</keybind>
<keybind key="W-c">
<action name="Reconfigure"/>
</keybind>
<keybind key="W-e">
<action name="Execute">
<execute>konqueror || falkon</execute>
</action>
</keybind>
<keybind key="W-o">
<action name="Execute">
<execute>terminal -e mc</execute>
</action>
</keybind>
<keybind key="W-w">
<action name="Execute">
<execute>x-www-browser</execute>
</action>
</keybind>
<!-- Media keys -->
<keybind key="XF86AudioMute">
<action name="Execute">
<execute>amixer -c 0 -D pulse -q sset Master toggle</execute>
</action>
</keybind>
<keybind key="XF86AudioLowerVolume">
<action name="Execute">
<execute>amixer -c 0 -q set Master 3%-</execute>
</action>
</keybind>
<keybind key="XF86AudioRaiseVolume">
<action name="Execute">
<execute>amixer -c 0 -q set Master 3%+</execute>
</action>
</keybind>
</keyboard>
</openbox_config>

7
data/waybox.desktop Normal file
View file

@ -0,0 +1,7 @@
[Desktop Entry]
Name=Waybox
Comment=An Openbox-like compositor for Wayland
Comment[de]=Ein Wayland-Compositor ähnlich zu Openbox
Comment[eo]=Komponilo de Wayland, kiu similas je Openbox
Exec=waybox
Type=Application

100
data/waybox.sh Normal file
View file

@ -0,0 +1,100 @@
#!/bin/sh
if test -z "$XDG_CONFIG_HOME";
then
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
export XDG_CONFIG_HOME
fi
WB_USER_CONF_DIR=$XDG_CONFIG_HOME/waybox
WB_SYS_CONF_DIR=@sysconfdir@/xdg/waybox
# Seemingly, Openbox hard-coded ~/.config/openbox rather than using
# $XDG_CONFIG_HOME. Older versions of Openbox used ~/.openbox and would
# continue to use it if available.
test -d ~/.openbox && OB_USER_CONF_DIR=~/.openbox || OB_USER_CONF_DIR=~/.config/openbox
OB_SYS_CONF_DIR=@sysconfdir@/xdg/openbox
_()
{
if which gettext.sh >/dev/null 2>&1;
then
. gettext.sh
TEXTDOMAIN=@package@
export TEXTDOMAIN
TEXTDOMAINDIR=@localedir@
export TEXTDOMAINDIR
eval_gettext "$1"
else
printf "$1"
fi
}
# Load the environment variables
if test -f $WB_USER_CONF_DIR/environment;
then
. $WB_USER_CONF_DIR/environment;
elif test -f $WB_SYS_CONF_DIR/environment;
then
. $WB_SYS_CONF_DIR/environment
elif test -f $OB_USER_CONF_DIR/environment;
then
_ "WARNING: Using files from Openbox. These may not work correctly."
. $OB_USER_CONF_DIR/environment;
elif test -f $OB_SYS_CONF_DIR/environment;
then
_ "WARNING: Using files from Openbox. These may not work correctly."
. $OB_SYS_CONF_DIR/environment;
fi
# Get the autostart script to use
#
# Openbox calls the autostart script from the XDG autostart script, so we don't
# need to run the autostart script twice if only the Openbox scripts are
# available
if test -x $WB_USER_CONF_DIR/autostart;
then
WB_AUTOSTART=$WB_USER_CONF_DIR/autostart;
elif test -x $WB_SYS_CONF_DIR/autostart;
then
WB_AUTOSTART=$WB_SYS_CONF_DIR/autostart
fi
# And the XDG autostart script
if test -x $WB_USER_CONF_DIR/xdg-autostart;
then
WB_XDG_AUTOSTART=$WB_USER_CONF_DIR/xdg-autostart;
elif test -x $WB_SYS_CONF_DIR/xdg-autostart;
then
WB_XDG_AUTOSTART=$WB_SYS_CONF_DIR/xdg-autostart
elif test -x "@libexecdir@/openbox-autostart";
then
_ "WARNING: Using files from Openbox. These may not work correctly."
WB_XDG_AUTOSTART="@libexecdir@/openbox-autostart OPENBOX";
fi
if test -f $WB_USER_CONF_DIR/rc.xml;
then
WB_RC_XML=$WB_USER_CONF_DIR/rc.xml
elif test -f $WB_SYS_CONF_DIR/rc.xml;
then
WB_RC_XML=$WB_SYS_CONF_DIR/rc.xml
elif test -f $OB_USER_CONF_DIR/rc.xml;
then
WB_RC_XML=$OB_USER_CONF_DIR/rc.xml
elif test -f $OB_SYS_CONF_DIR/rc.xml;
then
WB_RC_XML=$OB_SYS_CONF_DIR/rc.xml;
else
_ "ERROR: No configuration file found."
exit 1
fi
export WB_RC_XML
if which dbus-launch >/dev/null 2>&1;
then
DBUS_LANCH="dbus-launch --exit-with-session"
fi
# No need to export these to Waybox
unset TEXTDOMAIN TEXTDOMAINDIR
$DBUS_LAUNCH @libexecdir@/waybox --startup "${WB_AUTOSTART:-true}; ${WB_XDG_AUTOSTART:-true}" "$@"

98
data/xdg-autostart Normal file
View file

@ -0,0 +1,98 @@
#!/bin/sh
# Autostart script
#
# I've tried to make it compatible with the specification, but YMMV
#
# Start autostart programs for the following environments:
# WB_AUTOSTART_ENVIRONMENT= # No environment
# WB_AUTOSTART_ENVIRONMENT=all # All environments
# WB_AUTOSTART_ENVIRONMENT=GNOME:KDE # GNOME and KDE only
# Using the old set hack rather than ksh arrays, which some shells don't
# implement correctly or at all
set --
oldifs=$IFS
IFS=:
for d in ${XDG_CONFIG_HOME:-~/.config}:${XDG_CONFIG_DIRS:-${sysconfdir:-/etc}/xdg};
do
for f in $d/autostart/*.desktop;
do
# Skip this entry if this file doesn't exist (e.g. if there are no
# desktop files in that directory)
if test ! -f "$f";
then
continue
# Hidden key; must not be shown
elif cat "$f" | grep -q "^Hidden\s*=\s*true$";
then
show_in=0
# Value of WAYBOX: run all programs
elif test "$WB_AUTOSTART_ENVIRONMENT" = "all";
then
show_in=1
# No OnlyShowIn or NotShowIn key, so show regardless of the value of
# WB_AUTOSTART_ENVIRONMENT
elif ! (cat "$f" | grep -q '^\(Only\|Not\)ShowIn\s*=\s*');
then
show_in=1
# No WB_AUTOSTART_ENVIRONMENT specified, so don't run any programs that
# specify a special environment
elif test -z "$WB_AUTOSTART_ENVIRONMENT";
then
cat "$f" | grep -q '^OnlyShowIn\s*=\s*' && show_in=0
else
# Run programs only in the specified autostart environments
IFS=:
show_in=0
for autostart_environment in $WB_AUTOSTART_ENVIRONMENT;
do
IFS=\;
ONLY_SHOW_IN=$(cat "$f" | grep '^OnlyShowIn\s*=\s*' | sed -e 's/^OnlyShowIn\s*=\s*//g')
for only_show_in in $ONLY_SHOW_IN;
do
if test "$only_show_in" = "$autostart_environment";
then
show_in=1
break 2
fi
done
# But don't show in these environments
NOT_SHOW_IN=$(cat "$f" | grep '^NotShowIn\s*=\s*' | sed -e 's/^NotShowIn\s*=\s*//g')
for not_show_in in $NOT_SHOW_IN;
do
if test "$not_show_in" = "$autostart_environment";
then
show_in=0
break 2
fi
done
done
fi
fn=$(basename "$f")
# Don't use if a desktop entry with the same name has already been used
for df in "$@";
do
if test "$df" = "$fn";
then
show_in=0
fi
done
# Must be set back before executing the program
IFS=$oldifs
set -- $@ "$fn"
if test $show_in -ne 0;
then
# Don't run the Exec key if a non-empty TryExec command can't be found
TRY_EXEC=$(cat "$f" | grep '^TryExec\s*=\s*\S' | sed -e 's/^TryExec\s*=\s*//g');
if test -n "$TRY_EXEC" && ! which $TRY_EXEC;
then
continue
fi
$(cat "$f" | grep '^Exec\s*=\s*' | sed -e 's/^Exec\s*=\s*//g') &
fi
done
done