Add layout order selection for seasonal prompts
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
"PS1 only / Banner only / Both",
|
"PS1 only / Banner only / Both",
|
||||||
"PS1 mode: Single season / Dynamic / Contest / Holidays / Custom (if PS1 selected)",
|
"PS1 mode: Single season / Dynamic / Contest / Holidays / Custom (if PS1 selected)",
|
||||||
"Season pick (if single season)",
|
"Season pick (if single season)",
|
||||||
"Contest layout selection (if contest/holidays)",
|
"Layout order selection (seasonal/contest/holidays)",
|
||||||
"Style preset selection (if contest)",
|
"Style preset selection (if contest)",
|
||||||
"Holiday selection (if holidays)",
|
"Holiday selection (if holidays)",
|
||||||
"Custom style selection (if custom)",
|
"Custom style selection (if custom)",
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
"prompts": [
|
"prompts": [
|
||||||
"PS1 mode: Single season / Dynamic / Contest / Holidays / Custom",
|
"PS1 mode: Single season / Dynamic / Contest / Holidays / Custom",
|
||||||
"Season pick (if single season)",
|
"Season pick (if single season)",
|
||||||
"Contest layout selection (if contest/holidays)",
|
"Layout order selection (seasonal/contest/holidays)",
|
||||||
"Style preset selection (if contest)",
|
"Style preset selection (if contest)",
|
||||||
"Holiday selection (if holidays)",
|
"Holiday selection (if holidays)",
|
||||||
"Custom style selection (if custom)",
|
"Custom style selection (if custom)",
|
||||||
|
|||||||
@@ -79,11 +79,13 @@ Linux/WSL:
|
|||||||
- PS1 only / Banner only / Both
|
- PS1 only / Banner only / Both
|
||||||
- PS1 modes: Single season, Dynamic season, Contest pack, Holidays pack, Custom pack
|
- PS1 modes: Single season, Dynamic season, Contest pack, Holidays pack, Custom pack
|
||||||
- Dynamic season auto-switches by time of year (Spring: Mar–May, Summer: Jun–Aug, Autumn: Sep–Nov 14, Winter: Nov 15–Feb)
|
- Dynamic season auto-switches by time of year (Spring: Mar–May, Summer: Jun–Aug, Autumn: Sep–Nov 14, Winter: Nov 15–Feb)
|
||||||
|
- Layout order (day-time-user, user-time, time-user, day-time) for seasonal and contest modes
|
||||||
|
|
||||||
macOS:
|
macOS:
|
||||||
|
|
||||||
- PS1 modes: Single season, Dynamic season, Contest pack, Holidays pack, Custom pack
|
- PS1 modes: Single season, Dynamic season, Contest pack, Holidays pack, Custom pack
|
||||||
- Dynamic season auto-switches by time of year (same ranges as Linux)
|
- Dynamic season auto-switches by time of year (same ranges as Linux)
|
||||||
|
- Layout order (day-time-user, user-time, time-user, day-time) for seasonal and contest modes
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -70,10 +70,38 @@ if [[ -t 0 ]]; then
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
style_pack="standard"
|
style_pack="standard"
|
||||||
|
contest_layout="day-time-user"
|
||||||
|
echo "Layout order:"
|
||||||
|
echo " 1) day-time-user"
|
||||||
|
echo " 2) user-time"
|
||||||
|
echo " 3) time-user"
|
||||||
|
echo " 4) day-time"
|
||||||
|
read -r -p "Choose [1]: " layout_pick
|
||||||
|
case "${layout_pick}" in
|
||||||
|
2) contest_layout="user-time" ;;
|
||||||
|
3) contest_layout="time-user" ;;
|
||||||
|
4) contest_layout="day-time" ;;
|
||||||
|
""|1) contest_layout="day-time-user" ;;
|
||||||
|
*) echo "Invalid choice, using day-time-user."; contest_layout="day-time-user" ;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
season_mode="dynamic"
|
season_mode="dynamic"
|
||||||
style_pack="standard"
|
style_pack="standard"
|
||||||
|
contest_layout="day-time-user"
|
||||||
|
echo "Layout order:"
|
||||||
|
echo " 1) day-time-user"
|
||||||
|
echo " 2) user-time"
|
||||||
|
echo " 3) time-user"
|
||||||
|
echo " 4) day-time"
|
||||||
|
read -r -p "Choose [1]: " layout_pick
|
||||||
|
case "${layout_pick}" in
|
||||||
|
2) contest_layout="user-time" ;;
|
||||||
|
3) contest_layout="time-user" ;;
|
||||||
|
4) contest_layout="day-time" ;;
|
||||||
|
""|1) contest_layout="day-time-user" ;;
|
||||||
|
*) echo "Invalid choice, using day-time-user."; contest_layout="day-time-user" ;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
""|3)
|
""|3)
|
||||||
season_mode="static"
|
season_mode="static"
|
||||||
@@ -284,7 +312,7 @@ if [[ "$install_ps1" -eq 1 ]]; then
|
|||||||
{
|
{
|
||||||
printf 'PS1_STYLE=%s\n' "$style_choice"
|
printf 'PS1_STYLE=%s\n' "$style_choice"
|
||||||
printf 'PS1_STYLE_PACK=%s\n' "$style_pack"
|
printf 'PS1_STYLE_PACK=%s\n' "$style_pack"
|
||||||
if [[ "$style_pack" == "contest" || "$style_pack" == "holiday" ]]; then
|
if [[ "$style_pack" == "contest" || "$style_pack" == "holiday" || "$style_pack" == "standard" ]]; then
|
||||||
printf 'PS1_CONTEST_LAYOUT=%s\n' "$contest_layout"
|
printf 'PS1_CONTEST_LAYOUT=%s\n' "$contest_layout"
|
||||||
fi
|
fi
|
||||||
if [[ "$style_pack" == "holiday" ]]; then
|
if [[ "$style_pack" == "holiday" ]]; then
|
||||||
|
|||||||
@@ -46,10 +46,38 @@ if [[ -t 0 ]]; then
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
style_pack="standard"
|
style_pack="standard"
|
||||||
|
contest_layout="day-time-user"
|
||||||
|
echo "Layout order:"
|
||||||
|
echo " 1) day-time-user"
|
||||||
|
echo " 2) user-time"
|
||||||
|
echo " 3) time-user"
|
||||||
|
echo " 4) day-time"
|
||||||
|
read -r -p "Choose [1]: " layout_pick
|
||||||
|
case "${layout_pick}" in
|
||||||
|
2) contest_layout="user-time" ;;
|
||||||
|
3) contest_layout="time-user" ;;
|
||||||
|
4) contest_layout="day-time" ;;
|
||||||
|
""|1) contest_layout="day-time-user" ;;
|
||||||
|
*) echo "Invalid choice, using day-time-user."; contest_layout="day-time-user" ;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
season_mode="dynamic"
|
season_mode="dynamic"
|
||||||
style_pack="standard"
|
style_pack="standard"
|
||||||
|
contest_layout="day-time-user"
|
||||||
|
echo "Layout order:"
|
||||||
|
echo " 1) day-time-user"
|
||||||
|
echo " 2) user-time"
|
||||||
|
echo " 3) time-user"
|
||||||
|
echo " 4) day-time"
|
||||||
|
read -r -p "Choose [1]: " layout_pick
|
||||||
|
case "${layout_pick}" in
|
||||||
|
2) contest_layout="user-time" ;;
|
||||||
|
3) contest_layout="time-user" ;;
|
||||||
|
4) contest_layout="day-time" ;;
|
||||||
|
""|1) contest_layout="day-time-user" ;;
|
||||||
|
*) echo "Invalid choice, using day-time-user."; contest_layout="day-time-user" ;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
""|3)
|
""|3)
|
||||||
season_mode="static"
|
season_mode="static"
|
||||||
@@ -205,7 +233,7 @@ chmod 0644 "$SEASON_FILE"
|
|||||||
{
|
{
|
||||||
printf 'PS1_STYLE=%s\n' "$style_choice"
|
printf 'PS1_STYLE=%s\n' "$style_choice"
|
||||||
printf 'PS1_STYLE_PACK=%s\n' "$style_pack"
|
printf 'PS1_STYLE_PACK=%s\n' "$style_pack"
|
||||||
if [[ "$style_pack" == "contest" || "$style_pack" == "holiday" ]]; then
|
if [[ "$style_pack" == "contest" || "$style_pack" == "holiday" || "$style_pack" == "standard" ]]; then
|
||||||
printf 'PS1_CONTEST_LAYOUT=%s\n' "$contest_layout"
|
printf 'PS1_CONTEST_LAYOUT=%s\n' "$contest_layout"
|
||||||
fi
|
fi
|
||||||
if [[ "$style_pack" == "holiday" ]]; then
|
if [[ "$style_pack" == "holiday" ]]; then
|
||||||
|
|||||||
@@ -622,14 +622,16 @@ _ps1_set_prompt() {
|
|||||||
local PATH_PART="${__PS1_PATH}"
|
local PATH_PART="${__PS1_PATH}"
|
||||||
local PATH_SEP=" "
|
local PATH_SEP=" "
|
||||||
local END_PAD=" "
|
local END_PAD=" "
|
||||||
if [[ "$__PS1_STYLE_PACK" == "contest" || "$__PS1_STYLE_PACK" == "holiday" ]]; then
|
|
||||||
local layout="${__PS1_CONTEST_LAYOUT:-day-time-user}"
|
local layout="${__PS1_CONTEST_LAYOUT:-day-time-user}"
|
||||||
|
if [[ "$__PS1_STYLE_PACK" == "contest" || "$__PS1_STYLE_PACK" == "holiday" || "$__PS1_STYLE_PACK" == "standard" ]]; then
|
||||||
case "$layout" in
|
case "$layout" in
|
||||||
user-time) L1="\\u \\A" ;;
|
user-time) L1="\\u \\A" ;;
|
||||||
time-user) L1="\\A \\u" ;;
|
time-user) L1="\\A \\u" ;;
|
||||||
day-time) L1="\\d \\A" ;;
|
day-time) L1="\\d \\A" ;;
|
||||||
*) L1="\\d \\A \\u" ;;
|
*) L1="\\d \\A \\u" ;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
|
if [[ "$__PS1_STYLE_PACK" == "contest" || "$__PS1_STYLE_PACK" == "holiday" ]]; then
|
||||||
HOST_PART="@\\h - ${__PS1_PATH}"
|
HOST_PART="@\\h - ${__PS1_PATH}"
|
||||||
PATH_PART=""
|
PATH_PART=""
|
||||||
PATH_SEP=""
|
PATH_SEP=""
|
||||||
|
|||||||
Reference in New Issue
Block a user