From 674fc08a5eeb2a92317a56c441c487ba3b8c6e35 Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Sun, 28 Jan 2024 15:39:43 -0800 Subject: [PATCH] feat: Add MOTD thanks to @bsherman and @castrojo (#717) --- .../shared/usr/etc/profile.d/user-motd.sh | 7 + .../desktop/shared/usr/libexec/ublue-motd | 9 + .../usr/share/ublue-os/motd/design/bazzite.md | 12 ++ .../usr/share/ublue-os/motd/design/dark.json | 195 ++++++++++++++++++ .../share/ublue-os/motd/tips/10-desktop-tips | 5 + 5 files changed, 228 insertions(+) create mode 100755 system_files/desktop/shared/usr/etc/profile.d/user-motd.sh create mode 100755 system_files/desktop/shared/usr/libexec/ublue-motd create mode 100644 system_files/desktop/shared/usr/share/ublue-os/motd/design/bazzite.md create mode 100644 system_files/desktop/shared/usr/share/ublue-os/motd/design/dark.json create mode 100644 system_files/desktop/shared/usr/share/ublue-os/motd/tips/10-desktop-tips diff --git a/system_files/desktop/shared/usr/etc/profile.d/user-motd.sh b/system_files/desktop/shared/usr/etc/profile.d/user-motd.sh new file mode 100755 index 0000000000..ebc347064a --- /dev/null +++ b/system_files/desktop/shared/usr/etc/profile.d/user-motd.sh @@ -0,0 +1,7 @@ +if test -d "$HOME"; then + if test ! -e "$HOME"/.config/no-show-user-motd; then + if test -x "/usr/libexec/ublue-motd"; then + /usr/libexec/ublue-motd + fi + fi +fi \ No newline at end of file diff --git a/system_files/desktop/shared/usr/libexec/ublue-motd b/system_files/desktop/shared/usr/libexec/ublue-motd new file mode 100755 index 0000000000..606e245381 --- /dev/null +++ b/system_files/desktop/shared/usr/libexec/ublue-motd @@ -0,0 +1,9 @@ +#!/usr/bin/bash +TIP_FILE=$(ls "/usr/share/ublue-os/motd/tips/"* | shuf -n 1) +if [[ -f "$TIP_FILE" ]]; then + IMAGE_INFO="/usr/share/ublue-os/image-info.json" + IMAGE_NAME=$(jq -r '."image-name"' < $IMAGE_INFO) + IMAGE_TAG=$(jq -r '."image-tag"' < $IMAGE_INFO) + TIP=$(shuf -n 1 "$TIP_FILE") + /usr/bin/glow -s /usr/share/ublue-os/motd/design/dark.json /usr/share/ublue-os/motd/design/bazzite.md | sed -e "s/%IMAGE_NAME%/$IMAGE_NAME/g" -e "s/%IMAGE_TAG%/$IMAGE_TAG/g" -e "s/%TIP%/$TIP/g" +fi \ No newline at end of file diff --git a/system_files/desktop/shared/usr/share/ublue-os/motd/design/bazzite.md b/system_files/desktop/shared/usr/share/ublue-os/motd/design/bazzite.md new file mode 100644 index 0000000000..46554b6580 --- /dev/null +++ b/system_files/desktop/shared/usr/share/ublue-os/motd/design/bazzite.md @@ -0,0 +1,12 @@ +# Welcome to Bazzite 󰊴 +󱋩 `%IMAGE_NAME%:%IMAGE_TAG%` + +| Command | Description | +| ------- | ----------- | +| `ujust` | List all available commands | +| `ujust toggle-user-motd` | Toggle this banner on/off | +| `neofetch` | View system information | + +*󰋼 %TIP%* +- [󰙯 Discord](https://discord.bazzite.gg/) +- [󰈙 Documentation](http://docs.bazzite.gg/) \ No newline at end of file diff --git a/system_files/desktop/shared/usr/share/ublue-os/motd/design/dark.json b/system_files/desktop/shared/usr/share/ublue-os/motd/design/dark.json new file mode 100644 index 0000000000..0ba3bd5a4c --- /dev/null +++ b/system_files/desktop/shared/usr/share/ublue-os/motd/design/dark.json @@ -0,0 +1,195 @@ +{ + "document": { + "block_prefix": "\n", + "block_suffix": "\n", + "color": "252", + "margin": 2 + }, + "block_quote": { + "indent": 1, + "indent_token": "│ " + }, + "paragraph": {}, + "list": { + "level_indent": 2 + }, + "heading": { + "block_suffix": "\n", + "color": "39", + "bold": true + }, + "h1": { + "prefix": " ", + "suffix": " ", + "color": "228", + "background_color": "63", + "bold": true + }, + "h2": { + "prefix": "## " + }, + "h3": { + "prefix": "### " + }, + "h4": { + "prefix": "#### " + }, + "h5": { + "prefix": "##### " + }, + "h6": { + "prefix": "###### ", + "color": "35", + "bold": false + }, + "text": {}, + "strikethrough": { + "crossed_out": true + }, + "emph": { + "italic": true + }, + "strong": { + "bold": true + }, + "hr": { + "color": "240", + "format": "\n--------\n" + }, + "item": { + "block_prefix": "• " + }, + "enumeration": { + "block_prefix": ". " + }, + "task": { + "ticked": "[✓] ", + "unticked": "[ ] " + }, + "link": { + "color": "30", + "underline": true + }, + "link_text": { + "color": "35", + "bold": true + }, + "image": { + "color": "212", + "underline": true + }, + "image_text": { + "color": "243", + "format": "Image: {{.text}} →" + }, + "code": { + "prefix": " ", + "suffix": " ", + "color": "203", + "background_color": "236" + }, + "code_block": { + "color": "244", + "margin": 2, + "chroma": { + "text": { + "color": "#C4C4C4" + }, + "error": { + "color": "#F1F1F1", + "background_color": "#F05B5B" + }, + "comment": { + "color": "#676767" + }, + "comment_preproc": { + "color": "#FF875F" + }, + "keyword": { + "color": "#00AAFF" + }, + "keyword_reserved": { + "color": "#FF5FD2" + }, + "keyword_namespace": { + "color": "#FF5F87" + }, + "keyword_type": { + "color": "#6E6ED8" + }, + "operator": { + "color": "#EF8080" + }, + "punctuation": { + "color": "#E8E8A8" + }, + "name": { + "color": "#C4C4C4" + }, + "name_builtin": { + "color": "#FF8EC7" + }, + "name_tag": { + "color": "#B083EA" + }, + "name_attribute": { + "color": "#7A7AE6" + }, + "name_class": { + "color": "#F1F1F1", + "underline": true, + "bold": true + }, + "name_constant": {}, + "name_decorator": { + "color": "#FFFF87" + }, + "name_exception": {}, + "name_function": { + "color": "#00D787" + }, + "name_other": {}, + "literal": {}, + "literal_number": { + "color": "#6EEFC0" + }, + "literal_date": {}, + "literal_string": { + "color": "#C69669" + }, + "literal_string_escape": { + "color": "#AFFFD7" + }, + "generic_deleted": { + "color": "#FD5B5B" + }, + "generic_emph": { + "italic": true + }, + "generic_inserted": { + "color": "#00D787" + }, + "generic_strong": { + "bold": true + }, + "generic_subheading": { + "color": "#777777" + }, + "background": { + "background_color": "#373737" + } + } + }, + "table": { + "center_separator": "┼", + "column_separator": "│", + "row_separator": "─" + }, + "definition_list": {}, + "definition_term": {}, + "definition_description": { + "block_prefix": "\n🠶 " + }, + "html_block": {}, + "html_span": {} +} diff --git a/system_files/desktop/shared/usr/share/ublue-os/motd/tips/10-desktop-tips b/system_files/desktop/shared/usr/share/ublue-os/motd/tips/10-desktop-tips new file mode 100644 index 0000000000..e6a4155e94 --- /dev/null +++ b/system_files/desktop/shared/usr/share/ublue-os/motd/tips/10-desktop-tips @@ -0,0 +1,5 @@ +It is always better to install packages with Distrobox than to layer them with rpm-ostree. +Packages installed in Distrobox can be exported to appear like any other application. +Update break something? You can roll back and pin the previous release or rebase by build date. +Lutris is pre-installed for better handling of non-Steam games. +BTRFS is used by default for external drives, and we recommend that or EXT4 over NTFS. \ No newline at end of file