[Share Experiences] Display Poetry on Login Lock Screen, Refreshing Every Boot
Tofloor
poster avatar
SuperDavid
Moderator
2024-09-12 16:52
Author

Display Ancient Chinese Poetry on Login Lock Screen, Refreshing Every Boot

Effect as shown above, only two steps required:

  1. Configure the script;
  2. Set up boot trigger.

**Script Content:**I placed it in the path: /home/cold/Documents/, make sure it matches the desktop file configuration for boot trigger.

#!/bin/bash

showTopTip=$(dde-dconfig --get -a org.deepin.dde.lock -r org.deepin.dde.lock -k showTopTip)

echo $showTopTip

if [ "$showTopTip" = 'false' ]; then

dde-dconfig --set -a org.deepin.dde.lock -r org.deepin.dde.lock -k showTopTip -v true

dde-dconfig --set -a org.deepin.dde.lightdm-deepin-greeter -r org.deepin.dde.lightdm-deepin-greeter -k showTopTip -v true

fi

topTipTextFont=$(dde-dconfig --get -a org.deepin.dde.lock -r org.deepin.dde.lock -k topTipTextFont)

echo $topTipTextFont

if [ $topTipTextFont -ne 10 ]; then

dde-dconfig --set -a org.deepin.dde.lock -r org.deepin.dde.lock -k topTipTextFont -v 10

dde-dconfig --set -a org.deepin.dde.lightdm-deepin-greeter -r org.deepin.dde.lightdm-deepin-greeter -k topTipTextFont -v 10

fi

tokenfile=~/.config/tokenfile/config

if [ -e "$tokenfile" ]; then

echo "File exists"

else

mkdir ~/.config/tokenfile/

touch $tokenfile

fi

token=$(cat $tokenfile)

echo $token

if [ -z "$token" ]; then

echo "Token is empty"

curl -X GET -H 'Accept: application/json' https://v2.jinrishici.com/token | jq -r '.data' > "$tokenfile"

token=$(cat $tokenfile)

echo $token

else

echo "Token exists"

fi

shici=$(curl -X GET -H 'Accept: application/json' -H "X-User-Token: $token" https://v2.jinrishici.com/sentence | jq -r '.data.content')

dde-dconfig --set -a org.deepin.dde.lock -r org.deepin.dde.lock -k topTipText -v $shici

dde-dconfig --set -a org.deepin.dde.lightdm-deepin-greeter -r org.deepin.dde.lightdm-deepin-greeter -k topTipText -v $shici

Desktop File for Boot Trigger

Place this in the user's autostart directory: ~/.config/autostart

[Desktop Entry]

Encoding=UTF-8

Type=Application

# Application Name

Name=SHICHI

# Icon Path

Icon=deepin-image-viewer

# Start Without Terminal

Terminal=false

# File Path

Exec=/home/cold/Documents/jinrishici.sh %U

StartupNotify=true

X-Deepin-CreatedBy=com.deepin.SessionManager

X-Deepin-AppID=SHICI

Hidden=false

Reply Favorite View the author
All Replies

No replies yet