omarchy是DHH发布的一款Arch内核的Linux发行版。最近安装了下,稍作记录

特色功能

命令行

  • 可以使用 eza替换ls

快捷键

我常用到的几个

  • super + space 唤起程序启动菜单
  • super对应的是win或者🅾️键
  • super+ B 打开浏览器
  • super+ W 关闭
  • super+ enter 打开控制台
  • super+ 1/2/3/4/5/6/7/8/9 切换到工作区

更多 omarchy 的快捷键,请参考 https://learn.omacom.io/2/the-omarchy-manual/53/hotkeys

遇见的坑

我的浏览器怎么了

我是vivaldi浏览器的忠实用户,在omarchy上安装了vivaldi以后发现浏览器文字超大,好像出了啥问题,但是omarchy自带的浏览器却又是正常的。后面找到设置 setup->monitors.将默认的GDK放大倍数修改为1即可。

其他IDE或者软件显示有问题,也可以参考这个方法

# Optimized for retina-class 2x displays, like 13" 2.8K, 27" 5K, 32" 6K.
env = GDK_SCALE,1
monitor=,preferred,auto,auto

我的屏幕是1920x1080分辨率的,所以看着很明显

Electron程序打开卡半天才显示

我的apifox打开老卡好几十秒,后面在ai的帮助下解决

问题原因

Apifox 启动慢的根本原因是 GPU 硬件加速初始化卡顿。在你的 Hyprland Wayland 环境下,即使使用 GDK_BACKEND=x11 强制使用 X11,GPU 初始化仍然会导致启动延迟。

解决方案

~/.local/share/applications/apifox.desktop 中添加了 --disable-gpu 参数:

  Exec=/opt/apifox/Apifox.AppImage --disable-gpu %U

完整的桌面快捷方式图标

[Desktop Entry]
Name=Apifox
Exec=/opt/apifox/Apifox.AppImage --disable-gpu %U
Comment=API 文档、API 调试、API Mock、API 自动化测试
Comment[zh_CN]=API 文档、API 调试、API Mock、API 自动化测试
Terminal=false
Icon=apifox
Type=Application
StartupNotify=true
StartupWMClass=Apifox
Categories=Network;Development;Utility;

然后 chmod +x ~/.local/share/applications/apifox.desktop即可

刷新程序快捷方式库 update-desktop-database ~/.local/share/applications 2>&1 这样做的好处:

  • 从桌面环境或应用启动器打开 Apifox 时会自动使用该参数
  • 启动速度大幅提升

命令行使用建议

如果你需要从命令行启动,可以创建一个别名:

添加到 ~/.zshrc 或 ~/.bashrc

alias apifox='/opt/apifox/Apifox.AppImage --disable-gpu'

或者创建一个启动脚本 ~/bin/apifox:

#!/bin/bash
exec /opt/apifox/Apifox.AppImage --disable-gpu "$@"

其他可选参数 如果将来遇到其他问题,可以尝试这些参数组合:

  • –disable-gpu - 禁用 GPU 加速(已使用)
  • –no-sandbox - 禁用沙箱(不推荐,有安全风险)
  • –disable-gpu-sandbox - 仅禁用 GPU 沙箱
  • –enable-features=UseOzonePlatform –ozone-platform=wayland - 强制使用 Wayland

alacritty字体设置

可以安装Maple Mono这个字体,可以安装 AUR 包maple-mono-nf-cn这个库。然后在~/.config/alacritty/alacritty.toml中修改字体设置:

[font]
normal = { family = "Maple Mono NF CN" }
bold = { family = "Maple Mono NF CN" }
italic = { family = "Maple Mono NF CN" }
size = 12

键盘默认关闭数字小键盘

Omarchy 安装后会默认开启小键盘的 numlock,可以在系统菜单 Setup - Input 中设置:

numlock_by_default = false

4K屏幕下的软件显示

在4k的显示屏下面,wps打开的文本大小像蚊子一样,完全看不清,需要打开monitors配置,加上qt的缩放设置,打开就稍微正常了

env = QT_AUTO_SCREEN_SCALE_FACTOR,1
env =  QT_SCALE_FACTOR,2

jetbrains如何强制使用wayland

此方法要求jetbrains软件版本至少为2024.2,参考官网文章 https://blog.jetbrains.com/platform/2024/07/wayland-support-preview-in-2024-2/ 通过菜单Help | Edit Custom VM Options… 打开虚拟机选项,然后追加

-Dawt.toolkit.name=WLToolkit

linuxqq不能使用中文输入法

以fcitx5为例,只需要在~/.config/qq-flags.conf里添加下面的参数:

--ozone-platform-hint=auto
--enable-wayland-ime

重启linuxqq即可正常使用输入

不能卸载的软件

omarchy里面可以方便地进行软件卸载,但是注意不要卸载alacritty,现阶段(3.0版本发布)很多脚本都依赖这个tty软件,卸载掉这个软件很多功能都会失效。

安装后的设置微调

快捷键

bindd = SUPER, R, WeRead, exec, omarchy-launch-webapp "https://weread.qq.com"
bindd = SUPER, E, Email, exec, omarchy-launch-webapp "https://mail.qq.com"

中文输入法

omarchy自带输入法,默认为fcitx5,可以使用fcitx5-config进行配置。 以雾凇拼音为例,需要安装基本的输入法框架

paru -S fcitx5 fcitx5-configtool fcitx5-chinese-addons fcitx5-qt fcitx5-gtk  fcitx5-rime

然后安装

paru -S rime-ice-git

并以补丁方式启用雾凇拼音,具体方法是在 mkdir -p $HOME/.local/share/fcitx5/rime/后,在该文件夹下创建default.custom.yaml文件,输入下面的内容

patch:
  # 仅使用「雾凇拼音」的默认配置,配置此行即可
  __include: rime_ice_suggestion:/
  # 以下根据自己所需自行定义,仅做参考。
  # 针对对应处方的定制条目,请使用 <recipe>.custom.yaml 中配置,例如 rime_ice.custom.yaml
  __patch:
    key_binder/bindings/+:
      # 开启逗号句号翻页
      - { when: paging, accept: comma, send: Page_Up }
      - { when: has_menu, accept: period, send: Page_Down }

添加输入法的时候查找Rime即可。其他输入法,比如 白霜操作应该类似。

starship美化

omarchy集成了startship,修改配置文件 ~/.config/starship.toml 为下面这个gruvbox-rainbow主题

如果你修改了不同的shell,我这里修改的是zsh,只需要在~/.zshrc中加上eval "$(starship init zsh)"即可。其他的shell参考 官方文档

"$schema" = 'https://starship.rs/config-schema.json'

format = """
[](color_orange)\
$os\
$username\
[](bg:color_yellow fg:color_orange)\
$directory\
[](fg:color_yellow bg:color_aqua)\
$git_branch\
$git_status\
[](fg:color_aqua bg:color_blue)\
$c\
$rust\
$golang\
$nodejs\
$php\
$java\
$kotlin\
$haskell\
$python\
[](fg:color_blue bg:color_bg3)\
$docker_context\
[](fg:color_bg3 bg:color_bg1)\
$time\
[ ](fg:color_bg1)\
$line_break$character"""

palette = 'gruvbox_dark'

[palettes.gruvbox_dark]
color_fg0 = '#fbf1c7'
color_bg1 = '#3c3836'
color_bg3 = '#665c54'
color_blue = '#458588'
color_aqua = '#689d6a'
color_green = '#98971a'
color_orange = '#d65d0e'
color_purple = '#b16286'
color_red = '#cc241d'
color_yellow = '#d79921'

[os]
disabled = false
style = "bg:color_orange fg:color_fg0"

[os.symbols]
Windows = "󰍲"
Ubuntu = "󰕈"
SUSE = ""
Raspbian = "󰐿"
Mint = "󰣭"
Macos = "󰀵"
Manjaro = ""
Linux = "󰌽"
Gentoo = "󰣨"
Fedora = "󰣛"
Alpine = ""
Amazon = ""
Android = ""
Arch = "󰣇"
Artix = "󰣇"
CentOS = ""
Debian = "󰣚"
Redhat = "󱄛"
RedHatEnterprise = "󱄛"
Pop = ""

[username]
show_always = true
style_user = "bg:color_orange fg:color_fg0"
style_root = "bg:color_orange fg:color_fg0"
format = '[ $user ]($style)'

[directory]
style = "fg:color_fg0 bg:color_yellow"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"

[directory.substitutions]
"Documents" = "󰈙 "
"Downloads" = " "
"Music" = "󰝚 "
"Pictures" = " "
"Developer" = "󰲋 "

[git_branch]
symbol = ""
style = "bg:color_aqua"
format = '[[ $symbol $branch ](fg:color_fg0 bg:color_aqua)]($style)'

[git_status]
style = "bg:color_aqua"
format = '[[($all_status$ahead_behind )](fg:color_fg0 bg:color_aqua)]($style)'

[nodejs]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[c]
symbol = " "
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[rust]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[golang]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[php]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[java]
symbol = " "
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[kotlin]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[haskell]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[python]
symbol = ""
style = "bg:color_blue"
format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)'

[docker_context]
symbol = ""
style = "bg:color_bg3"
format = '[[ $symbol( $context) ](fg:#83a598 bg:color_bg3)]($style)'

[time]
disabled = false
time_format = "%R"
style = "bg:color_bg1"
format = '[[  $time ](fg:color_fg0 bg:color_bg1)]($style)'

[line_break]
disabled = false

[character]
disabled = false
success_symbol = '[](bold fg:color_green)'
error_symbol = '[](bold fg:color_red)'
vimcmd_symbol = '[](bold fg:color_green)'
vimcmd_replace_one_symbol = '[](bold fg:color_purple)'
vimcmd_replace_symbol = '[](bold fg:color_purple)'
vimcmd_visual_symbol = '[](bold fg:color_yellow)'

配置备份和迁移

omadot

omadot是一个简单、强大的点文件管理工具,作为 GNU Stow 的简单包装器构建而成。轻松管理您的配置文件!

屏保文字自定义

通过super+alt+ space打开选项菜单,选择style->screen saver,打开以后,在下面的网站https://patorjk.com/software/taag/ 输入文字,字体选择Delta Corps Priest 1,生成完毕以后,粘贴即可。比如我生成的logo

▄████████  ▄██████▄  ████████▄     ▄████████    ▄████████       ▄████████  ▄███████▄  ▄██   ▄       ███
███    ███ ███    ███ ███   ▀███   ███    ███   ███    ███      ███    ███ ██▀     ▄██ ███   ██▄ ▀█████████▄
███    █▀  ███    ███ ███    ███   ███    █▀    ███    ███      ███    █▀        ▄███▀ ███▄▄▄███    ▀███▀▀██
███        ███    ███ ███    ███  ▄███▄▄▄      ▄███▄▄▄▄██▀      ███         ▀█▀▄███▀▄▄ ▀▀▀▀▀▀███     ███   ▀
███        ███    ███ ███    ███ ▀▀███▀▀▀     ▀▀███▀▀▀▀▀        ███          ▄███▀   ▀ ▄██   ███     ███
███    █▄  ███    ███ ███    ███   ███    █▄  ▀███████████      ███    █▄  ▄███▀       ███   ███     ███
███    ███ ███    ███ ███   ▄███   ███    ███   ███    ███      ███    ███ ███▄     ▄█ ███   ███     ███
████████▀   ▀██████▀  ████████▀    ██████████   ███    ███      ████████▀   ▀████████▀  ▀█████▀     ▄████▀
                                               ███    ███

貌似可以通过连接快速生成

https://patorjk.com/software/taag/?p=display&f=Delta%20Corps%20Priest%201&t=coder%20czyt&x=none

omarchy的启动logo是在主题omarchy中定义的。主题的路径是 /usr/share/plymouth/themes/omarchy,你需要替换或者创建一个新的主题,如果是替换,则只需要替换logo.png文件,更换logo后,可以通过命令配置或切换主题,下面是相关的命令。

查看当前正在使用的主题

plymouth-set-default-theme

该命令会直接输出当前默认的Plymouth主题名称。我这返回的信息

omarchy

查看系统所有可用的主题

plymouth-set-default-theme --list

或者更简化的

plymouth-set-default-theme -l

我这边返回的列表

bgrt
details
fade-in
glow
omarchy
script
solar
spinfinity
spinner
text
tribar

要设置默认的主题,我这还是选择omarchy主题

sudo update-alternatives --config omarchy.plymouth

应用以后,刷新Plymouth缓存:

sudo mkinitcpio -P
sudo  limine-update

sudo limine-update 主要用于更新引导加载器本身的程序文件如果只是修改主题、logo 或配置文件,通常不需要运行只有在以下情况才需要:

  • 升级了 Limine 软件包
  • 更改了引导加载器的安装位置
  • 系统提示需要更新引导记录

最后重启系统,就能看到新的logo显示在开机动画里。

Terminal和文件管理器的集成

omarchy使用的是Nautilus文件管理器,

warp terminal

我日常使用warp terminal比较多,所以这里提供warp terminal的集成方式。默认的是

bindd = SUPER, return, Terminal, exec, $terminal --working-directory="$(omarchy-cmd-terminal-cwd)"

替换默认的super+enter 快捷键打开Warp terminal bindd = SUPER, return, Warp Terminal, exec, uwsm app -- xdg-open warp://action/new_tab?path="$(omarchy-cmd-terminal-cwd)"

先创建Nautilus 脚本文件

mkdir -p ~/.local/share/nautilus/scripts
touch ~/.local/share/nautilus/scripts/open-in-warp.sh

然后编辑脚本文件

#!/bin/bash
# Open current directory in Warp Terminal

# 获取当前目录路径
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
    # 如果选中了文件,获取第一个选中文件所在的目录
    SELECTED_PATH=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | head -n1)
    if [ -d "$SELECTED_PATH" ]; then
        # 如果选中的是目录,直接使用
        CURRENT_DIR="$SELECTED_PATH"
    else
        # 如果选中的是文件,获取其父目录
        CURRENT_DIR=$(dirname "$SELECTED_PATH")
    fi
elif [ -n "$NAUTILUS_SCRIPT_CURRENT_URI" ]; then
    # 使用当前浏览的目录
    CURRENT_DIR="$NAUTILUS_SCRIPT_CURRENT_URI"
    # 移除 file:// 前缀并进行 URL 解码
    CURRENT_DIR=${CURRENT_DIR#file://}
    CURRENT_DIR=$(python3 -c "import urllib.parse; print(urllib.parse.unquote('$CURRENT_DIR'))" 2>/dev/null)
else
    # 备用方案:使用 pwd
    CURRENT_DIR=$(pwd)
fi

# 确保路径存在且不为空
if [ -z "$CURRENT_DIR" ] || [ ! -d "$CURRENT_DIR" ]; then
    CURRENT_DIR=$(pwd)
fi

# 调试输出(可选,用于排查问题)
# echo "Current directory: $CURRENT_DIR" > /tmp/nautilus-warp-debug.log

# 启动 Warp Terminal
warp-terminal "$CURRENT_DIR" 2>/dev/null || xdg-open "warp://action/new_tab?path=$CURRENT_DIR"

Ghostty

创建文件 ~/.local/share/nautilus/scripts/open-in-ghostty.sh

#!/bin/bash
# Open current directory in Ghostty Terminal

# 获取当前目录
if [ -n "$NAUTILUS_SCRIPT_CURRENT_URI" ]; then
    CURRENT_DIR=$(echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed 's|file://||' | python3 -c "import sys, urllib.parse; print(urllib.parse.unquote(sys.stdin.read().strip()))")
else
    CURRENT_DIR="$PWD"
fi

# 启动 Ghostty 并切换到当前目录
ghostty --working-directory="$CURRENT_DIR" &

剪切板

截止omarchy 3.0.2 官方还没出内置的剪切板管理器,但是根据github issue,官方大概率会walker 2.0发布的时候采用walker来作为剪切板管理器

clipse

要使用clipse-bin这个软件,先安装

paru -S clipse-bin

然后打开hyperland的配置文件,添加下面的行

exec-once = clipse -listen # run listener on startup

然后再到快捷键配置里面加上下面的内容

bindd = SUPER, V, Clipse, exec, $terminal -e 'clipse'

oma-clipmanager

社区 提供了 oma-clipmanager,这个依赖下面的组件

  • kitty - Terminal emulator with image support
  • fzf - Fuzzy finder for quick searching
  • cliphist - Clipboard history manager for Wayland
  • wl-clipboard - Wayland clipboard utilities
  • wtype - Wayland keyboard input emulator
  • bat - Syntax highlighting for text preview
  • imagemagick - Image manipulation (for the convert command)

clipboard-manager

这个是一个rust版本的剪切板管理器github

天气插件

shell版本

网上找了一圈,没找到好用的waybar的天气插件,于是让ai写了一个,创建 ~/.config/waybar/scripts/weather.sh,写入下面的内容

apikey需要到 https://openweathermap.org/api去申请,然后替换下面脚本的apikey

#!/bin/bash
# 配置
API_KEY="${OPENWEATHER_API_KEY:-<你的apikey>}"
CITY="${CITY:-Chengdu}"
UNITS="${UNITS:-metric}"
LANG="${LANG:-zh_cn}"
CACHE_FILE="/tmp/waybar_weather_cache.json"

# 检查依赖
if ! command -v jq &> /dev/null; then
    printf '{"text":"❌ jq missing","tooltip":"jq is not installed"}\n'
    exit 0
fi

if ! command -v curl &> /dev/null; then
    printf '{"text":"❌ curl missing","tooltip":"curl is not installed"}\n'
    exit 0
fi

# 检查API密钥
if [[ -z "$API_KEY" ]]; then
    printf '{"text":"❌ No API Key","tooltip":"Please set OPENWEATHER_API_KEY"}\n'
    exit 0
fi

# 获取天气数据
fetch_weather_data() {
    local max_retries=3
    local retry_delay=2
    local attempt=1

    while [[ $attempt -le $max_retries ]]; do
        local weather_data=$(curl -s --connect-timeout 5 --max-time 15 \
            "https://api.openweathermap.org/data/2.5/weather?q=${CITY}&appid=${API_KEY}&units=${UNITS}&lang=${LANG}")
        local curl_exit_code=$?

        if [[ $curl_exit_code -eq 0 ]] && [[ -n "$weather_data" ]]; then
            local api_error=$(echo "$weather_data" | jq -r '.cod // empty' 2>/dev/null)
            if [[ "$api_error" == "200" ]]; then
                echo "$weather_data"
                return 0
            fi
        fi

        if [[ $attempt -lt $max_retries ]]; then
            sleep $retry_delay
            retry_delay=$((retry_delay * 2))
        fi

        attempt=$((attempt + 1))
    done

    return 1
}

# 解析天气数据
parse_weather_data() {
    local weather_data="$1"

    # 解析数据
    local temp=$(echo "$weather_data" | jq -r '.main.temp | round')
    local feels_like=$(echo "$weather_data" | jq -r '.main.feels_like | round')
    local temp_min=$(echo "$weather_data" | jq -r '.main.temp_min | round')
    local temp_max=$(echo "$weather_data" | jq -r '.main.temp_max | round')
    local humidity=$(echo "$weather_data" | jq -r '.main.humidity')
    local description=$(echo "$weather_data" | jq -r '.weather[0].description')
    local icon_code=$(echo "$weather_data" | jq -r '.weather[0].icon')
    local wind_speed=$(echo "$weather_data" | jq -r '.wind.speed')
    local visibility=$(echo "$weather_data" | jq -r '.visibility // 0 | . / 1000 | . * 10 | round / 10')

    # 图标和class映射
    local icon weather_class
    case "$icon_code" in
        "01d") icon="☀️"; weather_class="sunnyDay" ;;
        "01n") icon="🌙"; weather_class="clearNight" ;;
        "02d") icon="⛅"; weather_class="sunnyDay" ;;
        "02n") icon="⛅"; weather_class="clearNight" ;;
        "03d"|"04d") icon="☁️"; weather_class="cloudyFoggyDay" ;;
        "03n"|"04n") icon="☁️"; weather_class="cloudyFoggyNight" ;;
        "09d"|"10d") icon="🌧️"; weather_class="rainyDay" ;;
        "09n"|"10n") icon="🌧️"; weather_class="rainyNight" ;;
        "11d"|"11n") icon="⛈️"; weather_class="severe" ;;
        "13d") icon="❄️"; weather_class="snowyIcyDay" ;;
        "13n") icon="❄️"; weather_class="snowyIcyNight" ;;
        "50d") icon="🌫️"; weather_class="cloudyFoggyDay" ;;
        "50n") icon="🌫️"; weather_class="cloudyFoggyNight" ;;
        *) icon="🌤️"; weather_class="default" ;;
    esac

    # 单位符号
    local unit wind_unit
    case "$UNITS" in
        "metric") unit="°C"; wind_unit="m/s" ;;
        "imperial") unit="°F"; wind_unit="mph" ;;
        "kelvin") unit="K"; wind_unit="m/s" ;;
        *) unit="°C"; wind_unit="m/s" ;;
    esac

    # 构建tooltip文本
    local tooltip_text="<span size=\"xx-large\">${temp}${unit}</span>
<big>${icon} ${description}</big>
<small>Feels like ${feels_like}${unit}</small>

🔻 ${temp_min}${unit}  🔺 ${temp_max}${unit}
💨 ${wind_speed} ${wind_unit}  💧 ${humidity}%
👁 ${visibility} km"

    # 使用jq安全构建JSON (紧凑格式)
    jq -nc \
        --arg text "${icon} ${temp}${unit}" \
        --arg alt "$description" \
        --arg tooltip "$tooltip_text" \
        --arg class "$weather_class" \
        '{text: $text, alt: $alt, tooltip: $tooltip, class: $class}'
}

# 主逻辑(简化版,移除复杂的缓存时间检查)
main() {
    local weather_data
    weather_data=$(fetch_weather_data)

    if [[ $? -eq 0 ]]; then
        local output=$(parse_weather_data "$weather_data")
        echo "$output" > "$CACHE_FILE" 2>/dev/null  # 静默保存缓存
        printf '%s\n' "$output"
    else
        # 尝试读取缓存(如果存在)
        if [[ -f "$CACHE_FILE" ]]; then
            local cached_output=$(cat "$CACHE_FILE" 2>/dev/null)
            if [[ -n "$cached_output" ]]; then
                echo "$cached_output" | jq -c '.tooltip += "\n\n⚠️ Using cached data"' 2>/dev/null || echo "$cached_output"
            else
                printf '{"text":"❌ Offline","tooltip":"Network error, no cached data","class":"default"}\n'
            fi
        else
            printf '{"text":"❌ Offline","tooltip":"Network error, no cached data","class":"default"}\n'
        fi
    fi
}

main

~/.config/waybar/style.css添加样式

/* 天气模块基础样式 */
#custom-weather {
    margin: 0 8px; /* 左右边距 8px */
    padding: 0 6px; /* 内边距 */
    border-radius: 4px; /* 可选:圆角 */
    font-weight: 500;
}

/* 不同天气状况的颜色样式 */
#custom-weather.severe {
    color: #eb937d;
}

#custom-weather.sunnyDay {
    color: #c2ca76;
}

#custom-weather.clearNight {
    color: #2b2b2a;
}

#custom-weather.cloudyFoggyDay,
#custom-weather.cloudyFoggyNight {
    color: #c2ddda;
}

#custom-weather.rainyDay,
#custom-weather.rainyNight {
    color: #5aaca5;
}

#custom-weather.snowyIcyDay,
#custom-weather.snowyIcyNight {
    color: #d6e7e5;
}

#custom-weather.default {
    color: #dbd9d8;
}

在waybar的配置config.jsonc中启用

"custom/weather": {
    "exec": "~/.config/waybar/scripts/weather.sh",
    "format": "{text}",
    "format-alt": "{alt}",
    "return-type": "json",
    "interval": 600,
    "restart-interval": 300,
    "tooltip": true,
    "signal": 9,
  },

配置显示位置

"modules-right": [
  "custom/weather",
  .......
],

wttrbar

使用wttrbar也可以实现类似的功能,需要先安装 wttrbar这个包,使用命令安装

paru -S wttrbar

在配置中添加

"custom/weather": {
    "format": "{}°",
    "tooltip": true,
    "interval": 3600,
    "exec": "wttrbar --lang zh",
    "return-type": "json"
},

参数说明

--ampm - display time in AM/PM format
--location STRING - pass a specific location to wttr.in
--main-indicator - decide which current_conditions key will be shown on waybar. defaults to temp_C
--date-format - defaults to %Y-%m-%d, formats the date next to the days. see reference
--nerd - use nerd font symbols instead of emojis
--hide-conditions - show a shorter descrpition next to each hour, like 7° Mist instead of 7° Mist, Overcast 81%, Sunshine 17%, Frost 15%
--fahrenheit - use fahrenheit instead of celsius
--mph - use mph instead of km/h for wind speed
--custom-indicator STRING - optional expression that will be shown instead of main indicator. current_conditions and nearest_area keys surrounded by {} can be used. For example, "{ICON} {FeelsLikeC} ({areaName})" will be transformed to "text":"🌧️ -4 (Amsterdam)" in the output
--lang LANG - set language (currently en, de, pl, tr, fr, ru, zh, be, es, pt, it, ja, uk, sv; submit a PR to add yours)
--observation-time - show the time the current weather conditions were measured
e.g. wttrbar --date-format "%m/%d" --location Paris --hide-conditions

放在waybar的中间,显示效果不错

"modules-center": [
    "custom/weather",
    "clock",
    "custom/update",
    "custom/screenrecording-indicator",
  ],

可以调整相关的样式

#custom-weather.sunny {
  background-color: yellow;
}

使用quickshell

我这里安装了 caelestia这个版本的quickshell的配置

paru -S caelestia-shell

安装完毕以后,创建配置文件~/.config/caelestia/shell.json

{
    "appearance": {
        "anim": {
            "durations": {
                "scale": 1
            }
        },
        "font": {
            "family": {
                "clock": "Rubik",
                "material": "Material Symbols Rounded",
                "mono": "CaskaydiaCove NF",
                "sans": "Rubik"
            },
            "size": {
                "scale": 1
            }
        },
        "padding": {
            "scale": 1
        },
        "rounding": {
            "scale": 1
        },
        "spacing": {
            "scale": 1
        },
        "transparency": {
            "enabled": false,
            "base": 0.85,
            "layers": 0.4
        }
    },
    "general": {
        "apps": {
            "terminal": ["foot"],
            "audio": ["pavucontrol"],
            "playback": ["mpv"],
            "explorer": ["thunar"]
        },
        "battery": {
            "warnLevels": [
                {
                    "level": 20,
                    "title": "Low battery",
                    "message": "You might want to plug in a charger",
                    "icon": "battery_android_frame_2"
                },
                {
                    "level": 10,
                    "title": "Did you see the previous message?",
                    "message": "You should probably plug in a charger <b>now</b>",
                    "icon": "battery_android_frame_1"
                },
                {
                    "level": 5,
                    "title": "Critical battery level",
                    "message": "PLUG THE CHARGER RIGHT NOW!!",
                    "icon": "battery_android_alert",
                    "critical": true
                }
            ],
            "criticalLevel": 3
        },
        "idle": {
            "lockBeforeSleep": true,
            "inhibitWhenAudio": true,
            "timeouts": [
                {
                    "timeout": 180,
                    "idleAction": "lock"
                },
                {
                    "timeout": 300,
                    "idleAction": "dpms off",
                    "returnAction": "dpms on"
                },
                {
                    "timeout": 600,
                    "idleAction": ["systemctl", "suspend-then-hibernate"]
                }
            ]
        }
    },
    "background": {
        "desktopClock": {
            "enabled": false
        },
        "enabled": true,
        "visualiser": {
            "blur": false,
            "enabled": false,
            "autoHide": true,
            "rounding": 1,
            "spacing": 1
        }
    },
    "bar": {
        "clock": {
            "showIcon": true
        },
        "dragThreshold": 20,
        "entries": [
            {
                "id": "logo",
                "enabled": true
            },
            {
                "id": "workspaces",
                "enabled": true
            },
            {
                "id": "spacer",
                "enabled": true
            },
            {
                "id": "activeWindow",
                "enabled": true
            },
            {
                "id": "spacer",
                "enabled": true
            },
            {
                "id": "tray",
                "enabled": true
            },
            {
                "id": "clock",
                "enabled": true
            },
            {
                "id": "statusIcons",
                "enabled": true
            },
            {
                "id": "power",
                "enabled": true
            }
        ],
        "persistent": true,
        "scrollActions": {
            "brightness": true,
            "workspaces": true,
            "volume": true
        },
        "showOnHover": true,
        "status": {
            "showAudio": false,
            "showBattery": true,
            "showBluetooth": true,
            "showKbLayout": false,
            "showMicrophone": false,
            "showNetwork": true,
            "showLockStatus": true
        },
        "tray": {
            "background": false,
            "compact": false,
            "iconSubs": [],
            "recolour": false
        },
        "workspaces": {
            "activeIndicator": true,
            "activeLabel": "󰮯",
            "activeTrail": false,
            "label": "  ",
            "occupiedBg": false,
            "occupiedLabel": "󰮯",
            "perMonitorWorkspaces": true,
            "showWindows": true,
            "shown": 5,
            "specialWorkspaceIcons": [
                {
                    "name": "steam",
                    "icon": "sports_esports"
                }
            ]
        }
    },
    "border": {
        "rounding": 25,
        "thickness": 10
    },
    "dashboard": {
        "enabled": true,
        "dragThreshold": 50,
        "mediaUpdateInterval": 500,
        "showOnHover": true
    },
    "launcher": {
        "actionPrefix": ">",
        "actions": [
            {
                "name": "Calculator",
                "icon": "calculate",
                "description": "Do simple math equations (powered by Qalc)",
                "command": ["autocomplete", "calc"],
                "enabled": true,
                "dangerous": false
            },
            {
                "name": "Scheme",
                "icon": "palette",
                "description": "Change the current colour scheme",
                "command": ["autocomplete", "scheme"],
                "enabled": true,
                "dangerous": false
            },
            {
                "name": "Wallpaper",
                "icon": "image",
                "description": "Change the current wallpaper",
                "command": ["autocomplete", "wallpaper"],
                "enabled": true,
                "dangerous": false
            },
            {
                "name": "Variant",
                "icon": "colors",
                "description": "Change the current scheme variant",
                "command": ["autocomplete", "variant"],
                "enabled": true,
                "dangerous": false
            },
            {
                "name": "Transparency",
                "icon": "opacity",
                "description": "Change shell transparency",
                "command": ["autocomplete", "transparency"],
                "enabled": false,
                "dangerous": false
            },
            {
                "name": "Random",
                "icon": "casino",
                "description": "Switch to a random wallpaper",
                "command": ["caelestia", "wallpaper", "-r"],
                "enabled": true,
                "dangerous": false
            },
            {
                "name": "Light",
                "icon": "light_mode",
                "description": "Change the scheme to light mode",
                "command": ["setMode", "light"],
                "enabled": true,
                "dangerous": false
            },
            {
                "name": "Dark",
                "icon": "dark_mode",
                "description": "Change the scheme to dark mode",
                "command": ["setMode", "dark"],
                "enabled": true,
                "dangerous": false
            },
            {
                "name": "Shutdown",
                "icon": "power_settings_new",
                "description": "Shutdown the system",
                "command": ["systemctl", "poweroff"],
                "enabled": true,
                "dangerous": true
            },
            {
                "name": "Reboot",
                "icon": "cached",
                "description": "Reboot the system",
                "command": ["systemctl", "reboot"],
                "enabled": true,
                "dangerous": true
            },
            {
                "name": "Logout",
                "icon": "exit_to_app",
                "description": "Log out of the current session",
                "command": ["loginctl", "terminate-user", ""],
                "enabled": true,
                "dangerous": true
            },
            {
                "name": "Lock",
                "icon": "lock",
                "description": "Lock the current session",
                "command": ["loginctl", "lock-session"],
                "enabled": true,
                "dangerous": false
            },
            {
                "name": "Sleep",
                "icon": "bedtime",
                "description": "Suspend then hibernate",
                "command": ["systemctl", "suspend-then-hibernate"],
                "enabled": true,
                "dangerous": false
            }
        ],
        "dragThreshold": 50,
        "vimKeybinds": false,
        "enableDangerousActions": false,
        "maxShown": 7,
        "maxWallpapers": 9,
        "specialPrefix": "@",
        "useFuzzy": {
            "apps": false,
            "actions": false,
            "schemes": false,
            "variants": false,
            "wallpapers": false
        },
        "showOnHover": false,
        "hiddenApps": []
    },
    "lock": {
        "recolourLogo": false
    },
    "notifs": {
        "actionOnClick": false,
        "clearThreshold": 0.3,
        "defaultExpireTimeout": 5000,
        "expandThreshold": 20,
        "expire": false
    },
    "osd": {
        "enabled": true,
        "enableBrightness": true,
        "enableMicrophone": false,
        "hideDelay": 2000
    },
    "paths": {
        "mediaGif": "root:/assets/bongocat.gif",
        "sessionGif": "root:/assets/kurukuru.gif",
        "wallpaperDir": "~/Pictures/Wallpapers"
    },
    "services": {
        "audioIncrement": 0.1,
        "maxVolume": 1.0,
        "defaultPlayer": "Spotify",
        "gpuType": "",
        "playerAliases": [{ "from": "com.github.th_ch.youtube_music", "to": "YT Music" }],
        "weatherLocation": "",
        "useFahrenheit": false,
        "useTwelveHourClock": false,
        "smartScheme": true,
        "visualiserBars": 45
    },
    "session": {
        "dragThreshold": 30,
        "enabled": true,
        "vimKeybinds": false,
        "commands": {
            "logout": ["loginctl", "terminate-user", ""],
            "shutdown": ["systemctl", "poweroff"],
            "hibernate": ["systemctl", "hibernate"],
            "reboot": ["systemctl", "reboot"]
        }
    },
    "sidebar": {
        "dragThreshold": 80,
        "enabled": true
    },
    "utilities": {
        "enabled": true,
        "maxToasts": 4,
        "toasts": {
            "audioInputChanged": true,
            "audioOutputChanged": true,
            "capsLockChanged": true,
            "chargingChanged": true,
            "configLoaded": true,
            "dndChanged": true,
            "gameModeChanged": true,
            "kbLayoutChanged": true,
            "numLockChanged": true,
            "vpnChanged": true,
            "nowPlaying": false
        },
        "vpn": {
            "enabled": false,
            "provider": [
                {
                    "name": "wireguard",
                    "interface": "your-connection-name",
                    "displayName": "Wireguard (Your VPN)"
                }
            ]
        }
    }
}

可以通过caelestia shell -d 或者 qs -c caelestia查看效果,如果要开机启动,则需要修改hyperland的相关文件.

多显示器位置调整

最便捷的可能是试试 nwg-displays,你可以通过paru -S nwg-displays安装即可,下面是手动设置的方法。 我有两个显示器:

  • 外置 2K 显示器(2560x1440)物理放置在左边
  • 笔记本内置屏幕(1920x1080)物理放置在右边

需要让鼠标移动方向与物理布局一致,即从左边的外置显示器向右移动鼠标能到达右边的笔记本屏幕。可以通过omarchy的monitors修改显示器配置。通过手动指定坐标,可以精确控制多显示器的排列方式,让鼠标移动方向与物理布局保持一致。

设置步骤

查看当前显示器状态

hyprctl monitors

输出显示:

  • eDP-1 (笔记本): 1920x1080@60,位置在 0x0
  • HDMI-A-1 (外置): 2560x1440@60,位置在 1920x0

此时鼠标需要向左移动才能从外置显示器到笔记本,与物理布局相反。

尝试使用 auto 参数 最初尝试通过调整配置顺序来改变布局:

monitor = HDMI-A-1, 2560x1440@60, auto, 1
monitor = eDP-1, 1920x1080@60, auto, 1

结果:使用 auto 参数时,Hyprland 仍然保持原有的逻辑排列,无法满足需求。

手动指定坐标

# 外置显示器在左边,从 0x0 开始
monitor = HDMI-A-1, 2560x1440@60, 0x0, 1

# 笔记本屏幕在右边,X坐标为外置显示器的宽度 2560
monitor = eDP-1, 1920x1080@60, 2560x0, 1

配置说明

monitor 参数格式
monitor = [端口名], [分辨率@刷新率], [位置], [缩放]
位置坐标计算
  • 格式:XxY
  • 左边显示器:0x0(起始位置)
  • 右边显示器:[左边显示器宽度]x0
  • 本例中:右边显示器 X 坐标 = 2560(左边显示器宽度)
应用配置
  1. 修改 Hyprland 配置文件
  2. 保存更改
  3. 重启 Hyprland:Super+EscRelaunch

多显示器的workspace设置

我需要外置显示器管控我的1-5号workspace,那么同样地,在monitor配置文件里面进行设置

# 指定工作区到显示器的绑定
workspace = 1, monitor:HDMI-A-1
workspace = 2, monitor:HDMI-A-1
workspace = 3, monitor:HDMI-A-1
workspace = 4, monitor:HDMI-A-1
workspace = 5, monitor:HDMI-A-1
workspace = 6, monitor:HDMI-A-1
workspace = 7, monitor:HDMI-A-1
workspace = 8, monitor:eDP-1
workspace = 9, monitor:eDP-1

然后通过hyprctl reload重新加载配置或者重启 Hyprland即可。可以通过hyprctl workspaces 查看当前工作区状态。

完全禁用笔记本屏幕 monitor = eDP-1, disable(以我设备为例,具体名称自行修改)

有用的链接