tilda配置

tilda配置

上篇Linux笔记 - inotifywait + rsync 同步文件夹提到的tilda配置,现在接着写:

需求:

  • 按F12运行tilda终端,并同时启动sdcv。这个其实在Linux笔记 - 翻译软件:星际译王(Stardict)中已经实现。
  • 按F7、F8、F9、F10分别在屏幕不同位置开大概1/4屏幕大小的终端,按F3、F4在屏幕上下各开半屏幕大小的终端。

生成配置文件:

将以下代码保存为 tilda_config.sh,并运行。

#!/bin/bash
# 负责生成tilda配置文件。

# xrandr 查看当前屏幕分辨率
which xrandr
if [ $? == '1' ]; then
sudo dnf install -y xrandr
fi
screenWight=`xrandr | grep current | cut -d, -f2 | cut -d" " -f3`
screenHeight=`xrandr | grep current | cut -d, -f2 | cut -d" " -f5`

# sdcv + tilda
which sdcv tilda
if [ $? == '1' -o $? == '2' ]; then
sudo dnf install -y sdcv tilda 
fi
# tilda config:
if [ ! -d ~/.config/tilda ]; then
mkdir -pv ~/.config/tilda
fi
#
if [ ! -f ~/.config/tilda/config_F12 ] ; then
cat >~/.config/tilda/config_F12<<EOF
command="sdcv"
run_command=true
key="F12"
x_pos=$[$screenWight*7/10]
y_pos=$[$screenHeight*6/10]
width_percentage=644245094
height_percentage=858993458
auto_hide_on_focus_lost=true
auto_hide_on_mouse_leave=true
hidden=true
# enable_transparency=true
# back_alpha=52428
EOF
fi


# tilda left, right, top, bottom
# 111....111 (31bit)
w=2147483647

# F7
if [ ! -f ~/.config/tilda/config_F7 ] ; then
cat >~/.config/tilda/config_F7<<EOF
key="F7"
x_pos=$[$screenWight*0/10]
y_pos=$[$screenHeight*0/10]
width_percentage=$[$w*45/100]
height_percentage=$[$w*45/100]
hidden=true
above=false
EOF
fi

# F8:
if [ ! -f ~/.config/tilda/config_F8 ] ; then
cat >~/.config/tilda/config_F8<<EOF
key="F8"
x_pos=$[$screenWight*5/10]
y_pos=$[$screenHeight*0/10]
width_percentage=$[$w*45/100]
height_percentage=$[$w*45/100]
hidden=true
above=false
EOF
fi

# F9
if [ ! -f ~/.config/tilda/config_F9 ] ; then
cat >~/.config/tilda/config_F9<<EOF
key="F9"
x_pos=$[$screenWight*0/10]
y_pos=$[$screenHeight*5/10]
width_percentage=$[$w*45/100]
height_percentage=$[$w*45/100]
hidden=true
above=false
EOF
fi

# F10
if [ ! -f ~/.config/tilda/config_F10 ] ; then
cat >~/.config/tilda/config_F10<<EOF
key="F10"
x_pos=$[$screenWight*5/10]
y_pos=$[$screenHeight*5/10]
width_percentage=$[$w*45/100]
height_percentage=$[$w*45/100]
hidden=true
above=false
EOF
fi

# F3
if [ ! -f ~/.config/tilda/config_F3 ] ; then
cat >~/.config/tilda/config_F3<<EOF
key="F3"
x_pos=$[$screenWight*0/10]
y_pos=$[$screenHeight*0/10]
width_percentage=$[$w*99/100]
height_percentage=$[$w*45/100]
hidden=true
above=false
EOF
fi

# F4
if [ ! -f ~/.config/tilda/config_F4 ] ; then
cat >~/.config/tilda/config_F4<<EOF
key="F4"
x_pos=$[$screenWight*0/10]
y_pos=$[$screenHeight*51/100]
width_percentage=$[$w*99/100]
height_percentage=$[$w*45/100]
hidden=true
above=false
EOF
fi

gnome自启动

上篇已经提到,这里再简单讲讲:

  • 运行gnome-tweak,自启动那里添加终端。如有,忽略。
  • 修改.config/autostart/org.gnome.Terminal.desktop中的一行:Exec=/home/xxxx/bin/gnome-start.sh
  • 将以下代码添加到 gnome-start.sh中:
# 由于之前我已经设置好了sdcv+tilda,这里注释掉。
# tilda -g ~/.config/tilda/config_F12 >> /dev/null&
tilda -g ~/.config/tilda/config_F7 >> /dev/null&
tilda -g ~/.config/tilda/config_F8 >> /dev/null&
tilda -g ~/.config/tilda/config_F9 >> /dev/null&
tilda -g ~/.config/tilda/config_F10 >> /dev/null&
tilda -g ~/.config/tilda/config_F3 >> /dev/null&
tilda -g ~/.config/tilda/config_F4 >> /dev/null&
posted @ 2021-12-05 15:42  qydw007  阅读(224)  评论(0编辑  收藏  举报