[Share Experiences] 登录锁屏古诗词,每次开机触发刷新
Tofloor
poster avatar
yicold
deepin product team
2023-10-20 22:37
Author

截图_dde-desktop_20231018094343.png

效果如上,只需两步:1、配置脚本;2、开机触发;

脚本内容如下,我这边放在路径:/home/cold/Documents/,注意与开机触发的desktop文件配置一致。

#!/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 "文件存在"
else
    mkdir ~/.config/tokenfile/
    touch $tokenfile
fi

token=$(cat $tokenfile)
echo $token

if [ -z "$token" ]; then
    echo "token为空"
    curl -X GET -H 'Accept: application/json' https://v2.jinrishici.com/token | jq -r '.data' > "$tokenfile"
    token=$(cat $tokenfile)
    echo $token
else
    echo "token存在"
fi

#token=$(cat $tokenfile)
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文件如下,需要放入用户自启目录中:~/.config/autostart

[Desktop Entry]
Encoding=UTF-8
Type=Application
#应用名称
Name=SHICHI
#图标路径
Icon=deepin-image-viewer
#启动是否开启终端
Terminal=false
#文件路径
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
1 / 2
To page
deepin-superuser
deepin
2023-10-20 22:41
#1

秀啊

Reply View the author
阿尼樱奈奈
Moderator
2023-10-20 22:43
#2

like

Reply View the author
liwl
deepin
2023-10-20 22:50
#3

applaud 可以,学到,又多了一个姿势

Reply View the author
神末shenmo
deepin
Spark-App
2023-10-20 22:51
#4

可以改改做成指定内容的哇~我要改成 欢迎主人之类的(滑稽

Reply View the author
liwl
deepin
2023-10-20 23:06
#5
神末shenmo

可以改改做成指定内容的哇~我要改成 欢迎主人之类的(滑稽

applaud

666

Reply View the author
蓝鲸
deepin
2023-10-20 23:11
#6

学到了!!!

感觉瞬间高大上了!!!like

Reply View the author
vivian_me
deepin testing team
2023-10-20 23:12
#7

哇塞,666666yeah

Reply View the author
好聚好散
deepin
2023-10-20 23:14
#8

有点像OK的屏保呢tail

Reply View the author
花雨落逝
Moderator
2023-10-21 00:08
#9

这个不错诶agree

Reply View the author
waittingsummer
deepin
2023-10-21 00:18
#10

字体能不能大一点

Reply View the author
yanjuner
Super Moderator
2023-10-21 00:19
#11

优秀啊

感觉还能再深挖

做更多个性化设置

Reply View the author
aurora
deepin
2023-10-21 01:00
#12
❯ dde-dconfig set -a org.deepin.dde.lock -r org.deepin.dde.lock -k showTopTip -v true
value error key: "showTopTip" , error message: "[dde-dconfig get -a org.deepin.dde.lock -r org.deepin.dde.lock -k showTopTip] Requires Non-existent configure item [showTopTip] in [/org.deepin.dde.lock/org.deepin.dde.lock/1000]."
setValue error key: "showTopTip" , value: QVariant(QString, "true") , error message: "[dde-dconfig get -a org.deepin.dde.lock -r org.deepin.dde.lock -k showTopTip] Requires Non-existent configure item [showTopTip] in [/org.deepin.dde.lock/org.deepin.dde.lock/1000].
Reply View the author
fslong
deepin beta test group
2023-10-21 01:01
#13

本来锁屏就有欢迎语这个设计,但不知道为啥没有开放或者宣传。

有个dde-editor的包,有个欢迎语的选项,可以打开欢迎语,想写啥写啥。

Reply View the author
hotime
deepin
2023-10-21 01:21
#14

这个确实秀!收藏了!kissing_heart

Reply View the author
yicold
deepin product team
2023-10-21 01:30
#15
aurora
❯ dde-dconfig set -a org.deepin.dde.lock -r org.deepin.dde.lock -k showTopTip -v true
value error key: "showTopTip" , error message: "[dde-dconfig get -a org.deepin.dde.lock -r org.deepin.dde.lock -k showTopTip] Requires Non-existent configure item [showTopTip] in [/org.deepin.dde.lock/org.deepin.dde.lock/1000]."
setValue error key: "showTopTip" , value: QVariant(QString, "true") , error message: "[dde-dconfig get -a org.deepin.dde.lock -r org.deepin.dde.lock -k showTopTip] Requires Non-existent configure item [showTopTip] in [/org.deepin.dde.lock/org.deepin.dde.lock/1000].

set 这个参数少了两个横杠--

Reply View the author
把一切操作变成GUI
deepin
Backbone of ecological co-construction group
2023-10-21 23:20
#16

感觉系统变得高级了很多!

Reply View the author
出售星辰之书的书商
Moderator
2023-10-22 23:50
#17

学到了学到了 感谢大佬smirk

Reply View the author
tomcat_888
deepin
2023-10-25 03:27
#18

能不能修改锁屏界面左下角的logo啊,大佬指条路

Reply View the author
yicold
deepin product team
2023-10-25 19:16
#19
tomcat_888

能不能修改锁屏界面左下角的logo啊,大佬指条路

折腾默认,理解默认,成为默认
applaud

Reply View the author
简单的很潇洒、
deepin
2023-10-30 22:49
#20

好神奇的样子~

Reply View the author
1 / 2
To page