平铺式界面问题

问题就是没有桌面了,打开软件只能靠指令,有些时候挺麻烦的,尤其是打开了 terminal 后没法关闭了,对于平铺式白白占了空间。

wofi

这是一个 app launcher,专门用来启动软件的。

安装

sudo pacman -S wofi

配置快捷键

bind = $mainMod, D, exec, wofi --show drun

这样就可以通过 win + D 召出一个界面,输入软件名字,然后按下 enter 就可以打开软件了。

按下 tab 可以上下移动。

当然其实也不用配置,hyprland 其实默认了 win + R 打开 wofi。

美化

需要创建 .config 文件夹下面的 wofi 文件夹。

然后创建两个文件:

  1. ~/.config/wofi/config,配置文件
  2. ~/.config/wofi/style.css,核心美化

config

# ~/.config/wofi/config
 
# 模式,drun 是应用启动器模式
mode=drun
# 允许显示图片(应用图标)
allow_images=true
# 忽略大小写
insensitive=true
# 隐藏滚动条
hide_scroll=true
 
# --- 尺寸和位置 ---
# 宽度可以设置百分比或像素
width=40%
# 高度
height=50%
# 位置 (top, center, bottom)
location=center
# 水平对齐 (left, center, right)
halign=center
# 垂直对齐 (top, center, bottom)
valign=center
 
# --- 外观和布局 ---
# 提示文字
prompt=Search...
# 列表条目方向 (vertical 或 horizontal)
orientation=vertical
# 显示行数
lines=8
# 显示列数
columns=1
 
# --- 终端设置 ---
# 如果要在终端中运行程序,指定使用的终端
term=kitty

css

/* ~/.config/wofi/style.css */
 
/* --- 基础窗口 --- */
window {
    background-color: #2E3440; /* 背景色 */
    border: 2px solid #4C566A;  /* 边框颜色 */
    border-radius: 15px;      /* 圆角 */
    font-family: "JetBrainsMono Nerd Font"; /* 字体 */
    font-size: 16px;
}
 
/* --- 输入框 --- */
#input {
    margin: 10px;
    padding: 8px;
    background-color: #3B4252;
    color: #ECEFF4; /* 输入文字颜色 */
    border: none;
    border-radius: 10px;
}
 
/* --- 结果列表外部容器 --- */
#inner-box {
    margin: 5px;
}
 
/* --- 滚动区域 --- */
#scroll {
    margin-top: 10px;
}
 
/* --- 结果条目 --- */
#entry {
    padding: 10px;
    border-radius: 8px;
    color: #D8DEE9; /* 默认条目文字颜色 */
}
 
/* --- 选中的结果条目 --- */
#entry:selected {
    background-color: #88C0D0; /* 选中项背景色 */
    color: #2E3440; /* 选中项文字颜色 */
}
 
/* --- 条目中的文字 --- */
#text {
    color: #D8DEE9; /* 默认文字颜色 */
    margin-left: 10px;
}
 
/* 选中条目中的文字 */
#entry:selected #text {
    color: #2E3440; /* 确保选中时文字颜色也改变 */
}
 
/* --- 条目中的图标 --- */
#image {
    margin-left: 10px;
}