fix: import envs in ghostty

This commit is contained in:
2025-12-01 01:14:16 +01:00
parent 34a2f71c6d
commit 8f9df4c730
7 changed files with 34 additions and 10 deletions

View File

@@ -38,7 +38,7 @@ binds {
// Actions // Actions
Mod+V { spawn-sh "pkill -x rofi || rofi-cliphist"; } Mod+V { spawn-sh "pkill -x rofi || rofi-cliphist"; }
Mod+Period { spawn-sh "pkill -x rofi || rofi-emoji"; } Mod+Period { spawn-sh "pkill -x rofi || rofi-emoji"; }
Ctrl+Alt+Delete { spawn "pkill -x wlogout || wlogout -p layer-shell"; } Ctrl+Alt+Delete { spawn-sh "pkill -x wlogout || wlogout -p layer-shell"; }
Print { spawn "niri" "msg" "action" "screenshot-screen"; } Print { spawn "niri" "msg" "action" "screenshot-screen"; }
Mod+Shift+S { spawn "niri" "msg" "action" "screenshot"; } Mod+Shift+S { spawn "niri" "msg" "action" "screenshot"; }
Mod+Ctrl+Shift+S { spawn "niri" "msg" "action" "screenshot-window"; } Mod+Ctrl+Shift+S { spawn "niri" "msg" "action" "screenshot-window"; }

View File

@@ -35,3 +35,5 @@ spawn-at-startup "quickshell"
// According to (https://ghostty.org/docs/linux/systemd#starting-ghostty-at-login) // According to (https://ghostty.org/docs/linux/systemd#starting-ghostty-at-login)
spawn-sh-at-startup "systemctl start --user app-com.mitchellh.ghostty.service" spawn-sh-at-startup "systemctl start --user app-com.mitchellh.ghostty.service"
// No, do not do this, otherwise the envs defined in envs.kdl won't be applied to ghostty.
// Unless you have something like "config/shell/.config/fish/prev.d/niri-env.fish"

View File

@@ -1,10 +1,9 @@
screenshot-path "~/Pictures/Screenshots/niri_screenshot_%Y-%m-%d_%H-%M-%S.png"
debug { debug {
render-drm-device "/dev/dri/card0" render-drm-device "/dev/dri/card0"
} }
screenshot-path "~/Pictures/Screenshots/niri_screenshot_%Y-%m-%d_%H-%M-%S.png"
// screenshot-path "~/Pictures/Screenshots/.niri_screenshot.png"
// gestures { // gestures {
// hot-corners { // hot-corners {
// off // off

View File

@@ -2,6 +2,10 @@
# Description: # Description:
# Select which GPU to use for rendering for Hyprland and Niri. # Select which GPU to use for rendering for Hyprland and Niri.
#
# envs exported:
# HYPR_AQ_DRM_DEVICES - Colon-separated list of DRM device paths for Hyprland's aq_drm
# BRIGHTNESSCTL_DEVICE - Device identifier for brightnessctl
# AMD -> Nvidia -> Intel # AMD -> Nvidia -> Intel
prefer_order=(amd nvidia intel) prefer_order=(amd nvidia intel)
@@ -59,7 +63,7 @@ for who in "${prefer_order[@]}"; do
done done
# Update niri config # Update niri config
for file in "$HOME/.config/niri/config.kdl" "$HOME/.config/niri/config.kdl.template"; do for file in "$HOME/.config/niri/config/misc.kdl" "$HOME/.config/niri/config.kdl.template"; do
[[ -f "$file" ]] || continue [[ -f "$file" ]] || continue
if grep -qE '^\s*render-drm-device\s+"[^"]+"' "$file"; then if grep -qE '^\s*render-drm-device\s+"[^"]+"' "$file"; then

View File

@@ -3,3 +3,4 @@
!prompt.fish !prompt.fish
!theme.fish !theme.fish
!env.fish !env.fish
!niri-env.fish

View File

@@ -0,0 +1,22 @@
if test $XDG_CURRENT_DESKTOP = "niri"
set -l env_config "$HOME/.config/niri/config/envs.kdl"
if test -f "$env_config"
while read -la line
# Remove comments
set line (string replace -r '//.*' '' -- "$line")
# Trim whitespace
set line (string trim -- "$line")
# Skip "environment" block lines
if test -z "$line"; or string match -q "environment*" -- "$line"; or test "$line" = "}"
continue
end
# Match lines like: VARIABLE "value" where VARIABLE is alphanumeric/underscore
set -l matches (string match -r '^([0-9A-Za-z_]+)\s+"(.*)"$' -- "$line")
# If have a matches, set the environment variable
if test (count $matches) -eq 3
set -xg $matches[2] $matches[3]
end
end < "$env_config"
end
end

View File

@@ -1,11 +1,7 @@
{ {
"wallpaper": { "wallpaper": {
"dirs": ["~/Pictures/backgrounds", "/media/Beta/壁纸/库"], "dirs": ["~/Pictures/backgrounds", "/media/Beta/壁纸/库"],
"excludes": [ "excludes": ["~/Pictures/backgrounds/nao-stars-crop-adjust-flop.jpg", "~/Pictures/backgrounds/miku-gate.jpg"]
"~/Pictures/backgrounds/nao-stars-crop-adjust-flop.jpg",
"~/Pictures/backgrounds/miku-gate.jpg",
"~/Pictures/backgrounds/README.md"
]
}, },
"action": { "action": {
"confirm": "change-wallpaper \"%1\" 2560 1600" "confirm": "change-wallpaper \"%1\" 2560 1600"