source code moved here from PKGBUILDS

This commit is contained in:
manuel-192
2023-06-12 19:31:49 +03:00
parent 01ceb4697c
commit 8f0c4b912a
23 changed files with 2734 additions and 1 deletions
+271
View File
@@ -0,0 +1,271 @@
**Table of Contents**
- [Personalizing Welcome](#Personalizing-Welcome)
- [Overview](#Overview)
- [Command syntax](#Command-syntax)
- [The **name** element and aligning](#The-name-element-and-aligning)
- [Example](#Example)
- [Example (advanced, assumes knowledge about bash language)](#Example-advanced-assumes-knowledge-about-bash-language)
- [Example: field to run commands in terminal with `RunInTerminal`](#Example-field-to-run-commands-in-terminal-with-RunInTerminal)
- [Drag & drop items into the configuration file!](#Drag--drop-items-into-the-configuration-file)
- [New simpler API](#New-simpler-API)
- [Parameters for `personal_commands_init`](#Parameters-for-personal_commands_init)
- [Parameters for `personal_commands_add`](#Parameters-for-personal_commands_add)
- [Example: using the new API](#Example-using-the-new-API)
# Personalizing Welcome
## Overview
You can personalize Welcome by adding new command buttons in the Welcome app. They will appear under tab **Personal Commands**.<br>
To personalize Welcome, add your new commands into file
```
$HOME/.config/welcome-own-cmds.conf
```
## Command syntax
The Welcome app uses **yad forms** and bash language to create a simple GUI.
<br>
<sup>Note that you don't need to be familiar with yad nor bash (but it may help!) to add your own commands.
Simply follow this short tutorial.<br>
(More info with terminal commands: `man yad`, `man bash`).
</sup>
Let's start with a simple Firefox example (this already works for Welcome!):
```
local welcome_own_commands=(
--field=" Firefox web browser!!":fbtn "firefox"
)
```
You will add commands to Welcome by adding <u>yad form fields</u> to a bash array variable named
```
welcome_own_commands
```
This variable (and possible other variables in this file) <u>should</u> be marked as a *local* variable in bash.<br>
Buttons for Welcome are defined using specially crafted *fields*. Each field defines a command for a button, for example:
```
--field=" Firefox web browser!firefox-default!Browse the web with Firefox":fbtn "firefox"
```
A field definition consists of the following *elements*:
Element | Purpose | Value in the example above
:--- | :--- | :---
name | button name | Firefox web browser
icon | name of an icon on the button (optional) | firefox-default
description | useful info for the user (optional) | Browse the web with Firefox
command string | actual command the button executes (can have parameters) | firefox
As you see, yad (together with bash) wants the field to be in a specific format.<br>
Between `--field=` and `:fbtn` you'll write most of the button information.
The name, icon, and description are separated with exclamation (!) marks.<br>
And because the added strings may contain space characters, always use quotes ("a string") around the strings.
<sup>*Tip*: to find useful icon names you can use e.g. command **yad-icon-browser**. It is included in the yad package.</sup><br>
<sup>*Tip (advanced)*: the command string can be e.g. a bash function with parameters (see the examples below).
</sup><br>
<sup>*Tip (more advanced)*: take a look at file /usr/bin/eos-welcome about using bash functions in the command strings.
</sup>
### The **name** element and aligning
Older versions of the `yad` program didn't support aligning text properly on buttons, so we used `_align(text)` marking for the text.<br>
This is no more needed, but you may see old definitions using it, and it can be ignored and/or safely removed.
An example field about the parameters (using the obsolete _align() marking) in the command string:
```
# _align() is no more required
--field="_align(EndeavourOS forum)!web-browser!Discussions at the EndeavourOS forum":fbtn
"xdg-open https://forum.endeavouros.com"
```
Other supported (but optional) variables are
- `activate_own_commands_tab`: specifies whether the active tab in Welcome is your personal commands (instead of Welcome's default) when Welcome is started.
- `columns_for_own_commands`: specifies the layout (specifically: number of columns) of the buttons under the Personal Commands tab. Note: the layout is managed by **yad** and may *not* contain exactly the specified number of columns!
- `show_predefined_buttons_at_own_commands`: specifies whether to show (yes) or not (no) the two predefined buttons as the first buttons of the Personal Commands tab.
Note that the same two buttons exist on the **Tips** tab.
For example:
```
local activate_own_commands_tab=yes # "yes" or "no" (default: no)
local columns_for_own_commands=4 # a small positive number (default: 2)
local show_predefined_buttons_at_own_commands=no # "yes" or "no" (default:yes)
```
## Example
Here is a full *example* file containing three commands/buttons, and activating personal commands tab when starting Welcome:
```
#!/bin/bash
# Contents of file $HOME/.config/welcome-own-cmds.conf.
# Own commands:
# - Create a local array variable 'welcome_own_commands'.
# - Add yad form fields as in the example below.
# - To have own commands activated initially, set local variable 'activate_own_commands_tab' to "yes";
# otherwise the default tab is initially active.
# - Layout: specify the number of columns for the buttons on the Personal Commands tab.
local welcome_own_commands=(
# Legend: --field=" name!icon!description":fbtn "command"
--field=" A Kernel Manager!system-software-install!Simple kernel manager and info source":fbtn "akm"
--field=" Mousepad!accessories-text-editor!Mousepad text editor":fbtn "mousepad"
--field=" Firefox web browser!firefox-default!Browse the web with Firefox":fbtn "firefox"
)
local activate_own_commands_tab=yes
local columns_for_own_commands=2
local show_predefined_buttons_at_own_commands=no
```
## Example (advanced, assumes knowledge about bash language)
This example shows how to use bash functions in the command string.<br>
After writing your bash function, there are two "additional" things to remember:
- export your bash function with: `export -f`
- command string structure changes to: `"bash -c 'MyBashFunction parameters'"`
```
Install_with_pacman() {
# This bash function installs one or more given packages. Does not reinstall any packages.
local yadcmd="eos_yad --text-info --title=Installer --wrap --tail --width=600 --height=500 --button=yad-quit:0"
local pkg pkgs=()
# Check if given package(s) are already installed:
for pkg in "$@" ; do
pacman -Q "$pkg" >& /dev/null || pkgs+=("$pkg")
done
test -z "$pkgs" && {
echo "$*: already installed" | $yadcmd
return
}
# Install packages:
while true ; do
echo "Installing ${pkgs[*]} ..."
pkexec pacman -S --noconfirm "${pkgs[@]}"
echo "Finished."
break
done |& $yadcmd
}
export -f Install_with_pacman # Mandatory to export the function!
local welcome_own_commands=(
# When using a bash function, the command string must be changed like this:
# "bash -c 'MyBashFunction parameters'"
--field=" Install example!system-software-install!Install some popular packages":fbtn "bash -c 'Install_with_pacman code vlc'"
)
```
<sup>Tip: If you start Welcome from the terminal with command `eos-welcome`, you can get some "debugging" output to the terminal that may be useful for later analysis.</sup>
## Example: field to run commands in terminal with `RunInTerminal`
```
--field=" Update system!system-software-install!":fbtn \
"RunInTerminal 'checkupdates && sudo pacman -Syu || echo No updates.'"
```
## Drag & drop items into the configuration file!
Starting with Welcome version 3.2-1 you may also drag & drop items like URLs, documents, files, and launchers (= .desktop files).
Welcome has a new button **Personal Commands drag&drop** under the Tips tab:
![](welcome-dnd-tips.png)
Click that button, and it shows a new drag & drop window:
![](welcome-dnd-window.png)
Now you can drop items onto that window, and they will find their place as fields in your Personal Commands configuration file.<br>
And if you didn't have a configuration file, it will be automatically created when dropping an item onto this window!
The new command will also appear on the Welcome app shortly (this feature was added to Welcome version 3.2.6-1)!
Feel free to copy these examples and modify them to match your needs.<br>
If you have any questions about the syntax, please go to https://forum.endeavouros.com.
<br>
## New simpler API
<small>
- Added in Welcome 3.12-1 at 23-Apr-2021
- The *drag&drop* support for the new API was added in Welcome version 3.12.4-1.
</small>
A new function based API for defining personal commands is described below.
Personal commands user interface consists of the following functions:
```
personal_commands_init Determines how personal commands will be shown.
personal_commands_add Adds a new personal command.
```
### Parameters for `personal_commands_init`
Description | Values | Default
:------ | :---- | :----
Activate the personal commands tab at start | "yes" or "no" | no
Columns for the personal commands tab | Small positive integer | 2
Show predefined buttons in the personal commands tab | "yes" or "no" | yes
If `personal_commands_init` is *not* called, then default values will be used.
Note that if `personal_commands_init` is called with "empty" parameters, then respective default values will be used. For example:
```
personal_commands_init "" "" no
```
will preserve the defaults for the first two parameters, and change only the third.
<br>
### Parameters for `personal_commands_add`
Description | Example value | Required?
:----- | :------ | :-----
A command line (including parameters, if any) | mousepad --line=5 | yes
The button label ("button name") | Mousepad | yes
Name of an icon (that exists in the system) | accessories-text-editor | no (but recommended)
A more detailed description for the button | Mousepad text editor | no
Actual program name (use only if first parameter is ambiguous) | mousepad | no
<br>
Note about the first and the fifth parameter:<br>The actual program name will be parsed from the first parameter (i.e. the first word of it). After parsing, the personal command is handled as follows:
- If the parsed program exists, the command will be accepted to the list of personal commands.
- Otherwise, if the fifth parameter is used and it contains an existing program, the command will be accepted.
- If both the first and the fifth parameter "fail", Welcome reports this in file<br>`/tmp/welcome-personal-commands.log`.
<br>
### Example: using the new API
File `~/.config/welcome-own-commands.conf` might look like this:
```
personal_commands_init yes "" no
personal_commands_add "akm" \
"A Kernel Manager" \
"system-software-install" \
"Simple kernel manager and info source"
personal_commands_add "firefox" \
"Firefox web browser" \
"firefox-default" \
"Browse the web with Firefox"
personal_commands_add "xed --new-window" \
"Xed" \
"accessories-text-editor" \
"Xed text editor with new window" \
"xed"
```
Note the last line of the example, the 5th parameter `"xed"`. Actually, in this particular case, it is not really needed, but serves only as an example.
+18 -1
View File
@@ -1,2 +1,19 @@
# welcome
# Welcome
Source code for the Welcome app
File name | Description
:---- | :-------
Adding-own-commands.md | Tutorial about adding personal commands to Welcome
eos-kill-yad-zombies | Kills possible yad processes left by the session save feature
wallpaper-once | Sets the initial EOS wallpaper
wallpaper-once.desktop | A launcher for wallpaper-once
welcome | The welcome greeter app for both install phase and on the installed system
welcome.desktop | A launcher for Welcome
welcome-dnd | Support drag&drop for the Personal Commands
## Known issues
Welcome does not work well in a KDE/Wayland environment. The reason seems to be related to yad tabs.<br>
See https://github.com/v1cont/yad/issues/109 and https://github.com/frostworx/steamtinkerlaunch/issues/118.
+91
View File
@@ -0,0 +1,91 @@
#!/bin/bash
PROBLEM() {
local msg="$1"
local problem=(
eos_yad --form --image=$WELCOME_ICON_ERROR
--title="ARM installer problem"
--text="$msg"
--button=yad-quit:1
)
"${problem[@]}"
}
ARM_installer_in_terminal() {
local urls=(
https://github.com/endeavouros-arm/images.git
# https://github.com/pudges-place/exper-images.git
)
local url ix count=${#urls[@]}
local errcode
local msg
local targetdir=/tmp/arm-install
rm -rf $targetdir
for ((ix=0; ix < $count; ix++)) ; do
url="${urls[$ix]}"
git clone $url $targetdir 2>/dev/null
errcode=$?
if [ $errcode -eq 0 ] ; then
if [ "$Manuels_internal_testing" = "yes" ] ; then
PROBLEM "$FUNCNAME called for testing only."
return
fi
cd $targetdir
chmod +x image-install-calamares.sh # sudo not needed here?
xfce4-terminal --maximize -e "sudo ./image-install-calamares.sh"
return
else
msg="ARM installer fetch failed (git code $errcode) from\n<tt>$url</tt>\n\n"
if [ $ix -lt $((count - 1)) ] ; then
PROBLEM "${msg}Next URL to try:\n<tt>${urls[$((ix+1))]}</tt>\n"
else
PROBLEM "${msg}Bailing out.\n"
return
fi
fi
done
}
export -f ARM_installer_in_terminal
InfoPage() {
local browser="firefox"
[ -x /usr/bin/$browser ] || browser="xdg-open"
$browser https://arm.endeavouros.com/installation
}
export -f InfoPage
Main() {
source /usr/share/endeavouros/scripts/eos-script-lib-yad || return 1
local info_url="https://arm.endeavouros.com/installation"
local icon=$WELCOME_ICON_INSTALL_OFFICIAL
local title="EndeavourOS ARM image installer"
local text=""
text+="Starting to install the EndeavourOS ARM image\n"
text+="to your external storage device.\n"
text+="Please follow the instructions in the terminal window.\n"
text+="\n"
text+="Before starting the ARM Installer, ensure you have a storage device\n"
text+="plugged into a USB port to receive the image.\n"
text+="Note that the download size of the image is about 1.5 GB.\n"
text+="Click <b>More Info</b> for further details.\n"
local cmd=(
eos_yad
--form --align-buttons --use-interp --image=$icon
--title="$title"
--text="$text"
--button="Start ARM Installer!$icon!Install EndeavourOS ARM image":5
--button='More Info!user-info!More details on the wiki page':"InfoPage"
--button=yad-cancel:1
)
"${cmd[@]}"
case "$?" in
5) ARM_installer_in_terminal ;;
esac
return 0
}
Main "$@"
+323
View File
@@ -0,0 +1,323 @@
#!/bin/bash
# New script for using calamares.
#
# Note that this script can be called directly from the terminal,
# or it can be called from the Welcome app.
GUIDIE() {
# show error in the terminal and log
echo "$progname: $1" | sed -e 's|<tt>||g' -e 's|</tt>||g' # remove some formatting tags
# show the error in a yad window
local cmd=(
eos_yad --form --title="Error detected" --text="<tt>$progname</tt>:\n$1\n"
--image=dialog-error
--button=yad-quit:1
)
"${cmd[@]}"
exit 1
}
### Provides the install log contents. ###
FollowFile() {
local tailfile="$1"
local term_title="$2"
local xpos="$3"
local ypos="$4"
xfce4-terminal -T "$term_title" --geometry=120x20+$xpos+$ypos -x tail -f "$tailfile" &
}
### Provides the pacman log. ###
CatchChrootedPacmanLog() {
local pacmanlog=""
local lockfile="$HOME/.$progname.lck"
# wait until pacman.log is available in the chrooted system, then follow the log in background
while true ; do
sleep 2
pacmanlog="$(/usr/bin/ls -1 /tmp/calamares-root-*/var/log/pacman.log 2>/dev/null | /usr/bin/tail -n 1)"
if [ -n "$pacmanlog" ] ; then
# pacman.log detected!
[ -r "$lockfile" ] && return
/usr/bin/touch "$lockfile"
FollowFile "$pacmanlog" "Pacman log" 400 50
break
fi
done
}
inxi_output() {
if [ -x /usr/bin/inxi ] ; then
local inxiout="$(inxi -Czc0 ; inxi -Gnmzac0)"
cat <<EOF >> $log
########## inxi:
$inxiout
EOF
fi
}
os-prober_output() {
if [ -x /usr/bin/os-prober ] ; then
local os_prober_out="$(sudo os-prober)"
cat <<EOF >> $log
########## os-prober:
$os_prober_out
EOF
fi
}
LogHeader() {
local ISO_version=$(cat /usr/lib/endeavouros-release | cut -d'=' -f2)
local calamares="$(pacman -Qs calamares | grep ^local/ | head -n1 | sed -E 's|^local/([^ ]+).*|\1|')"
local calamares_version="$(pacman -Q $calamares 2>/dev/null | awk '{print $NF}')"
local date=$(date -u "+%x %X")
cat <<EOF > $log
########## $log by $progname
########## Started (UTC): $date
########## Install mode: $mode
########## ISO version: $ISO_version
########## Calamares version: $calamares_version
EOF
inxi_output
os-prober_output
}
PreliminaryLogFile() {
local preprelogfile="$(eos-select-file-server --logfilename)"
local output=""
if [ -r "$preprelogfile" ] ; then
output=$(cat "$preprelogfile")
cat <<EOF >> $log
## >>> Preliminary log before starting calamares:
$output
EOF
fi
if [ -r "$prelogfile" ] ; then
output=$(cat "$prelogfile")
cat <<EOF >> $log
$output
## <<< End of preliminary log.
EOF
fi
rm -f "$prelogfile"
rm -f "$preprelogfile"
}
### Starts logging into the install log. ###
InstallLog_Start() {
LogHeader
PreliminaryLogFile
if [ "$ShowInstallLog" = "TRUE" ] ; then
FollowFile "$log" "Install log" 20 20
fi
}
### Starts calamares and runs it in the background. ###
Calamares_Start() {
pkexec calamares -style kvantum -D8 >> $log &
}
### Dialog that asks for the online or offline edition. ###
AskMode() {
local ret=0
local cmd=(
eos_yad --form
--title="$(ltr cal_choose)"
--text="$(ltr cal_choose)"
--image=$WELCOME_ICON_INSTALL_OFFICIAL
--columns=2
--height=200 --width=500 --scroll
--buttons-layout=spread
)
if [ $has_connection = yes ] ; then
cmd+=(
--field="$(ltr cal_info3)":LBL ""
--field="$(ltr cal_info2)":LBL ""
--button="Online!!Vanilla theming, internet required":11
--button="Offline!!Xfce, EndeavourOS theming, internet not required":13
)
else
# without connection only offline is possible
cmd+=(
--field="$(ltr cal_info2)":LBL ""
--button="Offline!!Xfce, EndeavourOS theming, internet not required":13
)
fi
local result
result="$("${cmd[@]}")" # ask mode from the user
ret=$?
# set the install mode, or exit on error
case "$ret" in
11|12) mode=online ;;
13|14) mode=offline ;;
252|*) exit $ret ;;
esac
}
### Starts the calamares installer process and logging. ###
InstallWithLogs() {
InstallLog_Start
Calamares_Start
if [ "$ShowPacmanLog" = "FALSE" ] ; then
sleep 5
return
fi
case "$mode" in
online | community)
CatchChrootedPacmanLog
;;
offline)
# no pacman log for offline install
CatchChrootedPacmanLog
;;
esac
}
run_hotfix_start() {
local file=hotfix-start.bash
local url=$(eos-github2gitlab https://raw.githubusercontent.com/endeavouros-team/ISO-hotfixes/main/$file)
if Wget2Curl --timeout=30 -q -O "$workdir/$file" "$url" ; then
sudo bash "$workdir/$file" >> "$prelogfile"
PreLog "Hotfixes definition file from $url executed."
else
PreLog "Fetching $url failed!"
fi
}
BootloaderId() {
local blid="endeavouros-$(shuf -i 1000-9999 -n1)"
PreLog "New bootloader id: '$blid'"
sudo sed -i $cfolder/modules/bootloader.conf -e "s|^efiBootloaderId:.*|efiBootloaderId: \"$blid\"|"
}
PreLog() {
# Some logs before we can use endeavour-install.log.
echo "==> $1" >> "$prelogfile"
}
CheckUserPkglist() {
local userlistfile="$Home/user_pkglist.txt"
if [ -r "$userlistfile" ] ; then
# Remove comments (sed), empty lines (grep), and trim lines from spaces (sed):
local user_pkgs=$(cat "$userlistfile" | sed 's|\([^#]*\)#.*|\1|' | grep -Pv "^[ \t]*$" | sed -e 's|^[ \t]*||' -e 's|[ \t]*$||')
local up up2
local failed=()
local aur=()
local has_spaces=no
local txt=""
# allow only one pkgname per line
readarray -t user_pkgs <<< $(echo "$user_pkgs")
for up in "${user_pkgs[@]}" ; do
[ -n "$up" ] || continue
if ! pacman -Si "$up" >& /dev/null ; then
if [ "$up" != "$(echo "$up" | sed 's|[ \t]||g')" ] ; then
has_spaces=yes
fi
up2="\t'$up'"
if yay -Sia "$up" >& /dev/null ; then
aur+=("$up2")
else
failed+=("$up2")
fi
fi
done
if [ -n "$failed" ] ; then
txt+="The following package names listed in <b>$userlistfile</b> do not exist:\n$(printf "<tt>%s</tt>\n" "${failed[@]}")\n\n"
fi
if [ -n "$aur" ] ; then
txt+="AUR packages listed in <b>$userlistfile</b> are not supported:\n$(printf "<tt>%s</tt>\n" "${aur[@]}")\n\n"
fi
if [ "$has_spaces" = "yes" ] ; then
txt+="Note that only one package name per line is allowed and a package name cannot include white space characters.\n"
fi
if [ -n "$txt" ] ; then
GUIDIE "$txt"
fi
fi
}
### Everything starts in the Main function. ###
Main() {
local progname="$(basename "$0")" # for help and messages
local has_connection=no
eos-connection-checker && has_connection=yes
source /usr/share/endeavouros/scripts/eos-script-lib-yad || exit 1
export -f eos_yad
if [ ! -x /usr/bin/calamares ] ; then
GUIDIE "this program is only for installing EndeavourOS with calamares"
fi
source /usr/share/endeavouros/scripts/translations.bash || exit 1
local lang="$1"
local mode="$2" # 'community' or '' (empty)
local ShowInstallLog="FALSE" # TRUE --> show install log terminal window
local ShowPacmanLog="FALSE" # TRUE --> show pacman log terminal window
local Home=/home/liveuser # liveuser's home folder
local log=$Home/endeavour-install.log # install log
local cfolder=/etc/calamares # folder for calamares configuration files
local workdir=""
local prelogfile=""
CheckUserPkglist
workdir="$Home/work.$progname.xyz"
mkdir -p "$workdir"
prelogfile="$workdir/preliminary.log"
rm -f "$prelogfile"
# BootloaderId
_init_translations $lang || GUIDIE "language init failed"
case "$mode" in
"" | test) AskMode ;; # ask the value for $mode
esac
if [ $has_connection = yes ] ; then
run_hotfix_start # run possible hotfixes before copying settings.conf file
fi
case "$mode" in
online | offline | community)
sudo cp $cfolder/settings_$mode.conf $cfolder/settings.conf
PreLog "File settings.conf updated."
sudo bash /home/$EOS_LIVEUSER/user_commands.bash --iso-config $mode
;;
*)
GUIDIE "unsupported mode '$mode'"
;;
esac
if [ "$I_am_only_testing" = "true" ] ; then
return
fi
# finally: run calamares with logs (install, pacman)
InstallWithLogs
}
Main "$@"
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
# Kill yad processes that have no options ("--notebook" or "--plug" etc.).
Printf() {
[ "$silent" = "no" ] && /usr/bin/printf "$@"
}
Main()
{
local silent=no
case "$1" in
--silent) silent=yes ;;
esac
sleep 0.1
local bad="$(/usr/bin/pgrep -u "$LOGNAME" -a yad | /usr/bin/grep -P "^[0-9]* /usr/bin/yad[ ]*$|^[0-9]* yad[ ]*$")"
if [ -n "$bad" ] ; then
Printf "Killing yad zombies:\n%s\n" "$bad"
kill $(echo "$bad" | awk '{print $1}')
Printf "%s: killed yad zombies:\n%s\n" "$(date '+%x %X%p')" "$bad"
else
Printf "No yad zombies.\n"
fi
}
Main "$@"
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

+158
View File
@@ -0,0 +1,158 @@
# welcome (also: eos-welcome)
Welcome is an application that helps users by providing
- tools for system management and customization
- links for additional information
and more.
Welcome has two main uses:
- helps in the install phase
- helps in the system usage phase
<br>
![](welcome-man.png)
## Synopsis
eos-welcome [options]
## Options
```
--enable | -f Enable this Welcome app.
--disable Disable this Welcome app.
--once | -1 Allow to run Welcome even if disabled.
--lang=X Use language X on the user interface. Default for X: 'en'
--version Show the version of this app.
--startdelay=X Wait before actually starting this app.
X value syntax is the same as in the 'sleep' command.
--changelog Show the changelog of this package.
```
## Description
### Enabling or disabling Welcome
To have Welcome app started when you log in, make sure
- Welcome app is selected in the Autostart feature of the DE<br>
or
- `Hidden=false` is set in file `/etc/xdg/autostart/welcome.desktop`
On DEs that do not work well with system's *Autostart* feature, you may also disable the Welcome app from the app itself
- with the `--disable` option
- with a button in the app (some DEs only)
To re-enable the app, click the Welcome app icon, or use the terminal command
```
eos-welcome --enable
```
To run Welcome *once* even if it is already disabled, use option `--once`:
```
eos-welcome --once
```
Welcome will stay disabled after using option `--once`.
Note: check also settings in the configuration file `~/.config/EOS-greeter.conf`.
### Personalizing Welcome
User may add own buttons into the Welcome app. The buttons will appear under the **Personal Commands** tab.
### Language support
Option `--lang=X` currently supports a small set of languages.<br>
The X should consist of two (or more) letters (like 'en' for English or 'pt_BR' for Brazilian Portuguese).
See the supported languages (the X) e.g. by terminal command
```
ls -1 /usr/share/endeavouros/scripts/translation-*.bash | \
sed 's|.*/translation-\([a-zA-Z_]*\)\.bash|\1|'
```
If option `--lang` is not given, the language value is extracted from
the first letters of the environment variable LANG.<br>
If the extracted value is not supported by Welcome, English will be used.
## Tips
### <b>Software news</b>
Welcome app window includes a button **Software News** on the lower left corner.<br>
It contains useful and important news for the user about the EndeavourOS software, e.g. manual interventions or important code changes.
Make sure you click that button regularly!
### <b>Critical info area</b>
Welcome has an info area for critical or very important news near the upper edge of the window.<br>This will used for the uttermost important messages that affect all or most EndeavourOS users.<br>When this area contains text, it is a very good idea to read it!
### Add favorite packages at install time
To customize the *online* mode install phase, you can directly modify file `$HOME/user_pkglist.txt` and add package names to that file. Note that only Arch and EndeavourOS packages are supported, but not AUR packages.
### Add commands at install time (*Advanced*)
To customize the *online* mode install phase, you can directly modify file<br>
```
/home/liveuser/user_commands.bash
```
and add almost any commands to that file. See more instructions in this file.
Examples of things you can do with the commands in `user_commands.bash`:
- install or remove packages
- enable or disable systemd services
- customize new user's personal files at $HOME
- and more!
Here's an example code for `user_commands.bash`. It will be called with the bash interpreter, so it must have bash syntax:
```
#!/bin/bash
pacman -R --noconfirm xed # uninstall packages
pacman -S --noconfirm --needed geany gufw # install packages
systemctl enable ufw # enable a systemd service
user=$(cat /tmp/new_username.txt) # get the new username!
home=/home/$user # get the $HOME folder path
if [ "$user" != "" ] ; then
cat <<EOF >> $home/.bashrc # add more configuration to your ~/.bashrc
alias pacdiff=eos-pacdiff
alias df='df -hT'
EOF
chown $user:$user $home/.bashrc # make sure ~/.bashrc has the right owner
fi
```
Yet another tip: download *your* `user_commands.bash` from your website! For example:
```
$ pwd
/home/liveuser
$ wget -O user_commands.bash https://<your-website>/user_commands.bash
```
Examples of commands that *cannot* be used here:
- yay
- makepkg
## Examples
```
eos-welcome --lang=en # use English instead of the local language
eos-welcome --disable # disable Welcome from starting automatically
eos-welcome --enable # re-enable Welcome after disabling it
# Adding packages at install. Close Welcome app first, then commmand:
cat <<EOF >> ~/user_pkglist.txt
gufw
emacs
EOF
eos-welcome &
```
## See also
https://discovery.endeavouros.com/endeavouros-tools/welcome
Executable
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
#
# EndeavourOS initial wallpaper installer for a user.
#
#################################################################################
EOS_SCRIPTS_YAD=/usr/share/endeavouros/scripts/eos-script-lib-yad
source $EOS_SCRIPTS_YAD || {
echo "ERROR: cannot find $EOS_SCRIPTS_YAD" >&2
exit 1
}
unset EOS_SCRIPTS_YAD
export -f eos_yad
export -f eos_yad_terminal
export -f eos_yad_check_internet_connection
export -f eos_yad_GetArgVal
export -f eos_yad_RunCmdTermBash
export -f eos_yad_problem
export -f eos_yad_DIE
export -f eos_yad_WARN
export -f eos_yad__detectDE
export -f eos_yad_GetDesktopName
#################################################################################
Main() {
test -x /usr/bin/calamares && return # don't change wallpaper while installing system
local EOS_version=$(cat /usr/lib/endeavouros-release | cut -d'=' -f2 | cut -d' ' -f1)
[ $(vercmp "$EOS_version" "2022.11.15") -ge 0 ] && return # wallpaper already set by calamares
local DE="$(eos_GetDeOrWm)"
local conf="$HOME/.config/EOS-initial-wallpaper.$DE"
case "$DE" in
SWAY | BSPWM | QTILE | OPENBOX)
return ;; # don't change wallpaper on community editions
XFCE)
local pkg=endeavouros-skel-xfce4
local ver=$(pacman -Q $pkg 2>/dev/null | awk '{print $2}')
if [ $(vercmp "$ver" "2.17-1") -gt 0 ] ; then
return # new $pkg will handle the wallpaper
fi
;;
esac
case "$1" in
-r) /usr/bin/rm -f "$conf" ;; # -r re-installs the default wallpaper now
-rr) /usr/bin/rm -f "$conf" ; return ;; # same as -r, but not now
esac
# Set default wallpaper only if no DE specific config file is found.
[ -r "$conf" ] && return
sleep 3
eos-wallpaper-set DEFAULT-2021
touch "$conf"
}
Main "$@"
+13
View File
@@ -0,0 +1,13 @@
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=wallpaper-once
Comment=EndeavourOS initial wallpaper installer
Exec=sh /usr/share/endeavouros/scripts/wallpaper-once
Icon=endeavouros-icon
# StartupNotify=false
# Terminal=False
Hidden=false
X-GNOME-Autostart-enabled=true
X-KDE-autostart-after=panel
Executable
+1577
View File
File diff suppressed because it is too large Load Diff
Executable
+174
View File
@@ -0,0 +1,174 @@
#!/bin/bash
# A config file helper for Welcome's Personal Commands.
# User can drag&drop e.g. .desktop or document files onto this window.
#
# Assumes config file's welcome_own_commands variable has
# the ending parenthesis ')' as the FIRST and ONLY character on a line.
DndDIE() {
echo "Error: $1" >&2
exit 1
}
source /usr/share/endeavouros/scripts/eos-script-lib-yad || DndDIE "source failed."
export -f eos_yad
DndCreateConfigFile() {
if [ ! -r "$configfile" ] ; then
cat <<EOF > $configfile
#!/bin/bash
local welcome_own_commands=(
# --field=" Pamac!system-software-install!GUI package manager":fbtn 'pamac-manager'
)
# Note: leave the ')' character above as the first and only character on that line!
EOF
fi
}
DndAddField() {
local configfile="$HOME/.config/welcome-own-cmds.conf"
local mode=""
# Check definitions (old or new). If you have both old and new definitions, then assume new.
if [ -r "$configfile" ] ; then
/usr/bin/grep "^[ \t]*local[ \t][ \t]*welcome_own_commands" "$configfile" && mode=old
/usr/bin/grep "^[ \t]*personal_commands_init" "$configfile" && mode=new
/usr/bin/grep "^[ \t]*personal_commands_add" "$configfile" && mode=new
fi
case "$mode" in
old)
local field=" --field=' $name!$icon!$description':fbtn '$command'"
# make sure the config file exists in a proper format
DndCreateConfigFile
# add a field line in the end of variable welcome_own_commands
sed -i "$configfile" -e "/^)$/i\ $field"
;;
*)
# new or empty
cat <<EOF >> "$configfile"
personal_commands_add "$command" \\
"$name" \\
"$icon" \\
"$description"
EOF
;;
esac
}
DndDesktopFile() {
local file="${arg#file://}"
local icon="$(grep "^Icon=" "$file" | head -n 1 | cut -d '=' -f 2)"
local name="$(grep "^Name=" "$file" | head -n 1 | cut -d '=' -f 2)"
local generic_name="$(grep "^GenericName=" "$file" | head -n 1 | cut -d '=' -f 2)"
local comment="$(grep "^Comment=" "$file" | head -n 1 | cut -d '=' -f 2)"
local description="Description not available."
local command="xdg-open '$file'"
if [ -n "$generic_name" ] ; then
description="$generic_name"
elif [ -n "$comment" ] ; then
description="$comment"
fi
DndAddField
}
DndDocumentFile() {
local file="${arg#file://}"
local desktopfile="$(xdg-mime query default $(xdg-mime query filetype "$file"))"
local dt2="$(find /usr/share/applications -name "$desktopfile")"
test -n "$dt2" || dt2="$(find "$HOME/.local/share/applications" -name "$desktopfile")"
case "$file" in
/*) ;;
*) file="$PWD/$file" ;;
esac
local ending="${file##*.}"
local name="$(basename "$file")"
local description="A $ending file"
local command="xdg-open '$file'"
local icon="$(grep "^Icon=" "$dt2" | head -n 1 | cut -d '=' -f 2)"
DndAddField
}
DndUrl() {
local file="${arg}"
local name="$file"
local description="A URL"
local command="xdg-open '$file'"
local icon="web-browser"
#local desktopfile="$(xdg-mime query default $(xdg-mime query filetype $file))"
DndAddField
}
DndServerStart() {
local handler="command=/usr/bin/$progname"
if [ -n "$(ps -ef | grep "$handler" | grep -v "grep $handler")" ] ; then
echo "$progname server is already running!" >&2
return
fi
local text="Drop item(s) into this window:\n"
text+="- URL shortcut from the address line of a web browser\n"
text+="- document and file shortcuts from a file manager\n"
text+="- .desktop file (=launcher) shortcut from the start menu"
local yadcmd=(eos_yad --dnd
--$handler
--title="Welcome: Personal Commands drag & drop support"
--text="$text"
--width=500 --height=200
# --posx=5 --posy=5
)
"${yadcmd[@]}" &
}
RestartWelcomeAndDndServer() {
local progname2=eos-welcome
local restart_welcome=no
pkill -f "$progname2" && restart_welcome=yes
pkill -f "/usr/bin/yad --window-icon=$EOS_WICON"
sleep 0.5
if [ "$restart_welcome" = "yes" ] ; then
$progname2 &
sleep 1
fi
DndServerStart
}
DndMain()
{
local progname=welcome-dnd
if [ "$1" = "" ] ; then
DndServerStart
return
fi
local arg
for arg in "$@" ; do
echo "Dropping '$arg'." >&2
case "$arg" in
https://* | http://*) DndUrl ;;
*.desktop) DndDesktopFile ;;
/* | file://*) DndDocumentFile ;;
*) DndDIE "'$arg' not supported." ;;
esac
sleep 0.5
done
RestartWelcomeAndDndServer
}
DndMain "$@"
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+18
View File
@@ -0,0 +1,18 @@
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Welcome
Comment=EndeavourOS Welcome launcher
Comment[fi]=EndeavourOS:n Welcome-ohjelman käynnistin
Comment[sk]=Spúšťač privítania v systéme EndeavourOS
# for autostart:
Exec=sh /usr/share/endeavouros/scripts/welcome --startdelay=3
# for desktop launcher:
#Exec=sh /usr/share/endeavouros/scripts/welcome --once
Icon=endeavouros-icon
# StartupNotify=false
# Terminal=False
Hidden=false
X-GNOME-Autostart-enabled=true
X-KDE-autostart-after=panel
Categories=System
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB