Compare commits

..

51 Commits

Author SHA1 Message Date
jay 45e1e6f235 feat(config): add ghostty terminal and refactor neovim configuration
- Add ghostty terminal configuration with custom themes and settings
- Add multiple color themes (ayu-dark, catppuccin variants, moonfly)
- Configure ghostty appearance: font, opacity, keybindings
- Refactor nvim basic setup to use modern vim.opt API
- Modernize LSP configuration with LspAttach autocmd
- Update nvim-tree configuration for latest API
- Simplify codecompanion plugin setup
- Pin nvim-treesitter to main branch
- Improve sway-dbus script with XDG runtime checks
2026-05-12 11:14:13 +08:00
jay 36a51d8127 update 2026-04-06 01:21:30 +08:00
jay 35abfa07bc update 2026-03-22 20:46:20 +08:00
jay a4faab3db1 update 2026-03-21 11:25:39 +08:00
jay c2377c584e update config 2026-03-21 11:03:56 +08:00
jay d82b37376e update 2026-01-14 21:22:00 +08:00
jay f98883bf34 update 2025-11-14 15:00:23 +08:00
jay 4f595cae5b update 2025-11-04 23:07:08 +08:00
jay 28d7111aee update 2025-05-15 11:22:56 +08:00
jay 89fb2a1b56 update 2025-05-13 23:59:07 +08:00
jay 1dd35ed47a Refactor: Update neovim configuration
This commit refactors the neovim configuration to include several updates:

-   Added LSP support for Zig (`zls`).
-   Added `analyzer` and `zls` to `ale` linters.
-   Added `zigfmt` to `ale` fixers.
-   Added `towolf/vim-helm` as a plugin.
-   Added configuration for `lualine` to display Treesitter status.
-   Included SSH config from `conf.d/*.conf`.
-   Updated keymaps for LSP formatting.
-   Modified tabwidth and shiftwidth for rust files.
2025-04-07 12:24:11 +08:00
jay c93c4e25d7 update 2024-12-25 21:36:50 +08:00
jay 232952f9ec update 2024-09-01 09:12:53 +08:00
jay 69d4a237e9 update 2024-06-26 00:41:20 +08:00
jay 99fe1caf19 update 2024-06-26 00:25:23 +08:00
jay 4464b3ad06 update 2024-04-20 10:23:30 +08:00
jay acab55b91e update 2024-04-20 00:44:49 +08:00
jay cc52d282be update 2024-04-19 17:08:06 +08:00
jay 4146633c84 update 2024-04-19 17:04:03 +08:00
jay 16915d86a0 update 2024-04-19 17:00:31 +08:00
jay 50c21d3233 update 2024-03-30 22:41:35 +08:00
jay 95ad4c7c5f update 2024-03-05 23:36:54 +08:00
jay 6aa8d00242 update 2024-02-13 00:34:57 +08:00
jay e2cf533da4 update 2024-01-13 23:53:13 +08:00
jay b38320b190 update 2024-01-09 01:21:16 +08:00
jay 2598bcef39 update 2023-12-31 22:45:19 +08:00
jay 0b612782bf remove nvim plugin copilot 2023-11-11 21:40:44 +08:00
jay cf35805f68 update 2023-10-27 22:56:05 +08:00
jay 12bcba518d update 2023-09-11 08:20:07 +08:00
jay 874f14afee update 2023-09-10 22:35:43 +08:00
jay 68ffd61147 update 2023-09-01 22:41:00 +08:00
jay 4fd1b70a5c [feat] change nvim config from vimscript to lua 2023-08-28 02:22:29 +08:00
jay 009c896650 [feat] update env 2023-08-28 01:25:52 +08:00
jay 4e7bcf405e [feat] update 2023-08-26 01:14:03 +08:00
jay a2acab1fed update 2023-07-04 02:24:34 +08:00
jay d683a0698a update 2023-06-23 14:53:33 +08:00
jay 6e285c455c update 2023-06-23 14:35:31 +08:00
jay d15b486a6f update 2023-06-13 13:59:47 +08:00
jay 4c7a3c1a95 update 2023-06-01 11:49:33 +08:00
jay a2d8cddefe update 2023-05-30 01:26:05 +08:00
jay ae1ee3bcfc update 2023-05-12 01:04:19 +08:00
jay d798128e2c update 2023-05-07 10:19:41 +08:00
jay 26df51eb9d [update 2023-04-26 14:01:54 +08:00
jay fbcdaa4c0e update 2023-04-19 10:41:55 +08:00
jay 350aaf8690 update 2023-04-19 00:29:36 +08:00
jay f69fcdf744 add hypr / sway startup script 2023-04-17 02:20:22 +08:00
jay c6ce0dd503 [feat] add hyprland config 2023-04-17 02:19:30 +08:00
jay 896ca95ce1 update 2023-04-17 01:53:49 +08:00
jay 1b3afa092b update 2023-04-09 17:08:55 +08:00
jay 099d617895 Merge branch 'master' of ssh://git.trj.tw:10022/jay/dotfiles 2023-04-09 16:53:52 +08:00
jay bc79913088 update 2023-04-09 16:53:38 +08:00
80 changed files with 3017 additions and 1943 deletions
+12
View File
@@ -27,6 +27,14 @@
{{- $installRust := promptBoolOnce . "installRust" "install rust bin" true -}} {{- $installRust := promptBoolOnce . "installRust" "install rust bin" true -}}
{{- $enableTmux := promptBoolOnce . "enableTmux" "install enable tmux autostart" true -}} {{- $enableTmux := promptBoolOnce . "enableTmux" "install enable tmux autostart" true -}}
{{- $enableSSHAgent := promptBoolOnce . "enableSSHAgent" "install enable ssh agent autostart" true -}} {{- $enableSSHAgent := promptBoolOnce . "enableSSHAgent" "install enable ssh agent autostart" true -}}
{{- $enableUI := promptBoolOnce . "enableUI" "install enable ui" true -}}
{{- $systemd := promptBoolOnce . "systemd" "is systemd init" true -}}
[data.settings]
systemd = {{ $systemd }}
[data.ui]
enable = {{ $enableUI }}
[data.shell] [data.shell]
tmux = {{ $enableTmux }} tmux = {{ $enableTmux }}
@@ -44,3 +52,7 @@
golang = {{ $installGo }} golang = {{ $installGo }}
nodejs = {{ $installNode }} nodejs = {{ $installNode }}
rust = {{ $installRust }} rust = {{ $installRust }}
[merge]
command = "nvim"
args = ["-d", "{{ "{{" }} .Destination {{ "}}" }}", "{{ "{{" }} .Source {{ "}}" }}", "{{ "{{" }} .Target {{ "}}" }}"]
+15 -1
View File
@@ -1,5 +1,19 @@
# ignore template # ignore template
{{- if not .shell.tmux }} {{- if not .shell.tmux }}
.tmix.conf .tmux.conf
{{- end }}
{{- if not .ui.enable }}
.pam_environment
.config/alacrtty/
.config/environment.d/
.config/hypr/
.config/mako/
.config/sway/
.config/swaylock/
.config/systemd/
.config/waybar/
.config/wofi/
.config/xdg-desktop-portal-wlr/
{{- end }} {{- end }}
@@ -3,12 +3,11 @@
PATH="$HOME/apps/go/bin:$HOME/apps/node/bin:$PATH" PATH="$HOME/apps/go/bin:$HOME/apps/node/bin:$PATH"
if command -v npm > /dev/null; then if command -v npm > /dev/null; then
npm i -g typescript typescript-language-server jsctags dockerfile-language-server-nodejs npm i -g typescript typescript-language-server dockerfile-language-server-nodejs svelte-language-server
fi fi
if command -v go > /dev/null; then if command -v go > /dev/null; then
go install github.com/sourcegraph/go-langserver@latest go install github.com/sourcegraph/go-langserver@latest
go install github.com/jstemmer/gotags@latest
go install github.com/cweill/gotests/gotests@latest go install github.com/cweill/gotests/gotests@latest
fi fi
@@ -2,8 +2,9 @@
set -x set -x
GO_VERSION="1.20.1" GO_VERSION="1.22.0"
NODE_VERSION="18.14.2" NODE_VERSION="20.5.1"
ARCH="{{ .chezmoi.arch }}" ARCH="{{ .chezmoi.arch }}"
OSTYPE="{{ .chezmoi.os }}" OSTYPE="{{ .chezmoi.os }}"
@@ -16,9 +17,9 @@ if [ ! -d "$HOME/apps" ]; then
fi fi
function install_golang { function install_golang {
if command -v go ; then #if command -v go ; then
return 0 # return 0
fi #fi
local tmpDir=$(mktemp -d) local tmpDir=$(mktemp -d)
local url="https://go.dev/dl/go$GO_VERSION.$OSTYPE-$ARCH.tar.gz" local url="https://go.dev/dl/go$GO_VERSION.$OSTYPE-$ARCH.tar.gz"
@@ -38,15 +39,20 @@ function install_golang {
mv "$tmpDir/go" "$HOME/apps/go-${GO_VERSION}" mv "$tmpDir/go" "$HOME/apps/go-${GO_VERSION}"
if [ -L "$HOME/apps/go" ]; then
#rm -rf `readlink -f "$HOME/apps/go"`
unlink "$HOME/apps/go"
fi
ln -sf "$HOME/apps/go-${GO_VERSION}" "$HOME/apps/go" ln -sf "$HOME/apps/go-${GO_VERSION}" "$HOME/apps/go"
rm -rf "$tmpDir" rm -rf "$tmpDir"
} }
function install_nodejs { function install_nodejs {
if command -v node ; then #if command -v node ; then
return 0 # return 0
fi #fi
local tmpDir=$(mktemp -d) local tmpDir=$(mktemp -d)
local arch="" local arch=""
@@ -82,6 +88,11 @@ function install_nodejs {
mv "$dirs" "$HOME/apps/node-v${NODE_VERSION}" mv "$dirs" "$HOME/apps/node-v${NODE_VERSION}"
if [ -L "$HOME/apps/node" ]; then
#rm -rf `readlink -f "$HOME/apps/node"`
unlink "$HOME/apps/node"
fi
ln -sf "$HOME/apps/node-v${NODE_VERSION}" "$HOME/apps/node" ln -sf "$HOME/apps/node-v${NODE_VERSION}" "$HOME/apps/node"
rm -rf "$tmpDir" rm -rf "$tmpDir"
@@ -0,0 +1,30 @@
#!/bin/sh -e
# filename format datetime YYYYMMDD-HHMMSS.png
filename=$(date +%Y%m%d-%H%M%S).png
# Get the picture from maim
# flameshot gui -r > $HOME/.cache/src.png &
grim -g "0,0 1920x1200" "$HOME/ramdisk/$filename" &
wait $!
# add shadow, round corner, border and watermark
# convert $HOME/ramdisk/src.png \
# \( +clone -alpha extract \
# -draw 'fill black polygon 0,0 0,8 8,0 fill white circle 8,8 8,0' \
# \( +clone -flip \) -compose Multiply -composite \
# \( +clone -flop \) -compose Multiply -composite \
# \) -alpha off -compose CopyOpacity -composite $HOME/ramdisk/output.png
# convert $HOME/ramdisk/output.png -bordercolor none -border 20 \( +clone -background black -shadow 80x8+15+15 \) \
# +swap -background transparent -layers merge +repage $HOME/ramdisk/des.png
# # composite -gravity South ~/.local/bin/watermark.png $HOME/ramdisk/des.png $HOME/ramdisk/des.png
# # Send the Picture to clipboard
# # xclip -selection clipboard -t image/png -i $HOME/ramdisk/des.png
# wl-copy -t image/png < $HOME/ramdisk/des.png
# # remove the other pictures
# rm $HOME/ramdisk/src.png $HOME/ramdisk/output.png
notify-send "screenshot success"
+38
View File
@@ -0,0 +1,38 @@
#!/bin/bash
if [ -z "$1" ]; then
echo "請輸入檔案名稱"
exit 1
fi
if [ ! -f "$1" ]; then
echo "file not exists"
exit 1
fi
FILENAME="${1##*/}"
DIRNAME="${FILENAME%.*}"
EXTNAME="${FILENAME##*.}"
echo "$DIRNAME"
mkdir "$DIRNAME"
# gen key
openssl rand 16 > "$DIRNAME/enc.key"
# new key info file
echo "enc.key" > keyinfo
echo "$DIRNAME/enc.key" >> keyinfo
openssl rand 16 -hex >> keyinfo
# convert
ffmpeg -i "$1" -f hls -hls_time 10 -hls_list_size 0 -vn -hls_segment_filename "$DIRNAME/segment%d.ts" -hls_key_info_file keyinfo -hls_playlist_type vod "$DIRNAME/playlist.m3u8"
# move origin file
cp "$1" "$DIRNAME/origin.$EXTNAME"
# clean tmp file
rm keyinfo
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
set -ex
if [ -z "$1" ]; then
echo "Usage: $0 <go-version>"
exit 1
fi
# chezmoi will replace the OS and ARCH variables
ARCH="{{ .chezmoi.arch }}"
OS="{{ .chezmoi.os }}"
if [ ! -d "$HOME/apps" ]; then
if ! mkdir -p "$HOME/apps"; then
>&2 echo "Failed to create $HOME/apps"
exit 1
fi
fi
deleteTmpDir() {
if [ -d "$1" ]; then
rm -rf "$1"
fi
}
TMP_DIR=$(mktemp -d)
trap 'deleteTmpDir '"$TMP_DIR"'' EXIT
install_go() {
local url="https://go.dev/dl/go$1.$OS-$ARCH.tar.gz"
if ! wget -O "$TMP_DIR/go.tar.gz" "$url"; then
>&2 echo "Failed to download $url"
return 1
fi
if ! tar zxf "$TMP_DIR/go.tar.gz" -C "$TMP_DIR"; then
>&2 echo "Failed to extract $TMP_DIR/go.tar.gz"
return 1
fi
mv "$TMP_DIR/go" "$HOME/apps/go-$1"
# relink go folder to the new version
if [ -L "$HOME/apps/go" ]; then
unlink "$HOME/apps/go"
fi
ln -s "$HOME/apps/go-$1" "$HOME/apps/go"
return 0
}
install_go "$1"
+87
View File
@@ -0,0 +1,87 @@
#!/bin/bash
set -xe
if [ -z "$1" ]; then
echo "Usage: $0 <node-version>"
exit 1
fi
# chezmoi will replace the OS and ARCH variables
ARCH="{{ .chezmoi.arch }}"
OS="{{ .chezmoi.os }}"
if [ ! -d "$HOME/apps" ]; then
if ! mkdir -p "$HOME/apps"; then
>&2 echo "Failed to create $HOME/apps"
exit 1
fi
fi
deleteTmpDir() {
if [ -d "$1" ]; then
rm -rf "$1"
fi
}
TMP_DIR=$(mktemp -d)
trap 'deleteTmpDir '"$TMP_DIR"'' EXIT
install_nodejs() {
local arch=""
NODE_VERSION=$1
case "$ARCH" in
"amd64")
arch="x64"
;;
"arm64")
arch="arm64"
;;
*)
>&2 echo "arch ($ARCH) not support"
return 1
;;
esac
local url="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-${OS}-${arch}.tar.xz"
if ! wget -O "$TMP_DIR/node.tar.xz" "$url"; then
>&2 echo "Failed to download $url"
return 1
fi
if ! tar xf "$TMP_DIR/node.tar.xz" -C "$TMP_DIR"; then
>&2 echo "Failed to extract $TMP_DIR/node.tar.xz"
return 1
fi
dirs=$(find "$TMP_DIR" -maxdepth 1 -type d -name "node*")
if [ -z "$dirs" ]; then
>&2 echo "Failed to find node folder"
return 1
fi
mv "$dirs" "$HOME/apps/node-v$NODE_VERSION"
if [ -L "$HOME/apps/node" ]; then
unlink "$HOME/apps/node"
fi
ln -s "$HOME/apps/node-v$NODE_VERSION" "$HOME/apps/node"
return 0
}
install_require_dep() {
PATH="$HOME/apps/go/bin:$HOME/apps/node/bin:$PATH"
if command -v npm > /dev/null; then
npm i -g typescript typescript-language-server dockerfile-language-server-nodejs svelte-language-server
fi
}
install_nodejs "$1"
install_require_dep
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
set -xe
set -o pipefail
if [ -z "$1" ]; then
echo "Usage: $0 <src-folder-path>"
exit 1
fi
tmpFolder=$(mktemp -d)
deleteTmpFolder() {
rm -rf $tmpFolder
}
trap deleteTmpFolder EXIT
wd=$(pwd)
encName="lbk-$(date +%Y%m%d)-enc.zip"
# 7z a -tzip -p -mem=AES256 archive.zip file1 file2 directory/
# compress Source.zip without encryption
cd $1
zip -r "$tmpFolder/Source.zip" .
# generate Source.zip md5
md5sum "$tmpFolder/Source.zip" | cut -d' ' -f1 | tee "$tmpFolder/Vendor_Src_MD5.txt"
# compress with encryption
cd $tmpFolder
7z a -tzip -pLb1234567890 -mem=AES256 "$tmpFolder/$encName" Source.zip Vendor_Src_MD5.txt
# copy to pwd folder
cp "$tmpFolder/$encName" $wd
cd $wd
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -xe
# usage: pack-magneto2-source <image repo> [output folder]
if [ $# -lt 1 ]; then
echo "Usage: $0 <image repo> [output folder]"
exit 1
fi
IMAGE_REPO=$1
OUTPUT_FOLDER=$(realpath "${2:-.}")
# echo "Packing Magento 2 source code from $IMAGE_REPO to $OUTPUT_FOLDER"
uid=$(id -u)
docker run -it --rm -v "$OUTPUT_FOLDER:/out" -e "HOST_UID=$uid" \
"$IMAGE_REPO" \
bash -c 'cd /app && \
find /app -type f -iname "*test*" -exec rm -f {} \; && \
rm -rf /app/node_modules && \
rm -rf /app/system/modules/swagger/public/swagger-ui/* && \
chown -R $HOST_UID /app && \
tar -cvf /out/magneto2.tar . && \
chown $HOST_UID /out/magneto2.tar'
# vim : set ft=sh :
+1
View File
@@ -24,3 +24,4 @@ wl-copy -t image/png < $HOME/ramdisk/des.png
# remove the other pictures # remove the other pictures
rm $HOME/ramdisk/src.png $HOME/ramdisk/output.png rm $HOME/ramdisk/src.png $HOME/ramdisk/output.png
notify-send "screenshot success"
+1
View File
@@ -24,3 +24,4 @@ wl-copy -t image/png < $HOME/ramdisk/des.png
# remove the other pictures # remove the other pictures
rm $HOME/ramdisk/src.png $HOME/ramdisk/output.png rm $HOME/ramdisk/src.png $HOME/ramdisk/output.png
notify-send "screenshot success"
+88
View File
@@ -0,0 +1,88 @@
#!/bin/bash
# 檢查是否為 root user,如果不是則使用 sudo 切換
if [[ $EUID -ne 0 ]]; then
exec sudo "$0" "$@"
exit
fi
# WireGuard 設定檔案資料夾
wg_conf_folder="/etc/wireguard/"
# 列出所有可使用的設定檔案
function list_conf_files() {
echo "可用的 WireGuard 設定檔案:"
ls -1 $wg_conf_folder | grep ".conf$"
}
# 連線到指定的 VPN
function connect() {
local intf=$1
# 切斷其他已連線的 VPN
if [[ $1 == "--disconnect-others" ]] || [[ $1 == "-d" ]] ; then
wg-quick down "$(wg show | grep "interface:" | awk '{print $2}')"
intf=$2
fi
# 確認設定檔案是否存在
if [[ ! -f "$wg_conf_folder/$intf.conf" ]]; then
echo "找不到 $wg_conf_folder/$intf.conf"
exit
fi
# 連線 VPN
wg-quick up "$wg_conf_folder/$intf.conf"
echo "已連線到 $intf"
}
# 斷開指定的 VPN,若未指定則斷開所有 VPN
function disconnect() {
if [[ -n "$1" ]]; then
wg-quick down "$1"
echo "已斷開 $1"
else
wg-quick down "$(wg show | grep "interface:" | awk '{print $2}')"
echo "已斷開所有 VPN"
fi
}
# 列出已連線的 VPN
function list_connections() {
echo "已連線的 VPN"
wg show | grep "interface:" | awk '{print $2}'
}
# 判斷參數是否為空
if [[ -z $1 ]]; then
echo "使用方式:"
echo " $0 list - 列出所有可使用的設定檔案"
echo " $0 connect [-d|--disconnect-others] <config> - 連線到指定的 VPN"
echo " $0 disconnect [interface] - 斷開指定的 VPN,若未指定則斷開所有 VPN"
echo " $0 list-connections - 列出已連線的 VPN"
exit
fi
case "$1" in
list)
list_conf_files
;;
connect)
if [[ -n $2 ]]; then
connect "$2" "$3"
else
echo "請輸入要連線的 VPN 設定檔案名稱"
fi
;;
disconnect)
disconnect "$2"
;;
list-connections)
list_connections
;;
*)
echo "無效的參數:$1"
exit
;;
esac
# vim: set ft=sh :
+87
View File
@@ -0,0 +1,87 @@
[colors.bright]
black = "#6272a4"
blue = "#d6acff"
cyan = "#a4ffff"
green = "#69ff94"
magenta = "#ff92df"
red = "#ff6e6e"
white = "#ffffff"
yellow = "#ffffa5"
[colors.cursor]
cursor = "CellForeground"
text = "CellBackground"
[colors.footer_bar]
background = "#282a36"
foreground = "#f8f8f2"
[colors.hints.end]
background = "#282a36"
foreground = "#f1fa8c"
[colors.hints.start]
background = "#f1fa8c"
foreground = "#282a36"
[colors.line_indicator]
background = "None"
foreground = "None"
[colors.normal]
black = "#21222c"
blue = "#bd93f9"
cyan = "#8be9fd"
green = "#50fa7b"
magenta = "#ff79c6"
red = "#ff5555"
white = "#f8f8f2"
yellow = "#f1fa8c"
[colors.primary]
bright_foreground = "#ffffff"
foreground = "#f8f8f2"
[colors.search.focused_match]
background = "#ffb86c"
foreground = "#44475a"
[colors.search.matches]
background = "#50fa7b"
foreground = "#44475a"
[colors.selection]
background = "#5e68ab"
text = "CellForeground"
[colors.vi_mode_cursor]
cursor = "CellForeground"
text = "CellBackground"
[env]
TERM = "xterm-256color"
[font]
size = 12.0
[font.normal]
family = "Agave Nerd Font"
[font.offset]
x = 0
y = 0
[scrolling]
history = 20000
multiplier = 3
[window]
opacity = 0.85
[window.padding]
x = 5
y = 5
[general]
live_config_reload = true
-874
View File
@@ -1,874 +0,0 @@
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Import additional configuration files
#
# Imports are loaded in order, skipping all missing files, with the importing
# file being loaded last. If a field is already present in a previous import, it
# will be replaced.
#
# All imports must either be absolute paths starting with `/`, or paths relative
# to the user's home directory starting with `~/`.
#import:
# - /path/to/alacritty.yml
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
# check the local terminfo database and use `alacritty` if it is
# available, otherwise `xterm-256color` is used.
TERM: xterm-256color
window:
# Window dimensions (changes require restart)
#
# Number of lines/columns (not pixels) in the terminal. The number of columns
# must be at least `2`, while using a value of `0` for columns and lines will
# fall back to the window manager's recommended size.
#dimensions:
# columns: 210
# lines: 65
# Window position (changes require restart)
#
# Specified in number of pixels.
# If the position is not set, the window manager will handle the placement.
#position:
# x: 0
# y: 0
# Window padding (changes require restart)
#
# Blank space added around the window in pixels. This padding is scaled
# by DPI and the specified value is always added at both opposing sides.
padding:
x: 1
y: 1
# Spread additional padding evenly around the terminal content.
#dynamic_padding: false
# Window decorations
#
# Values for `decorations`:
# - full: Borders and title bar
# - none: Neither borders nor title bar
#
# Values for `decorations` (macOS only):
# - transparent: Title bar, transparent background and title bar buttons
# - buttonless: Title bar, transparent background and no title bar buttons
#decorations: full
# Startup Mode (changes require restart)
#
# Values for `startup_mode`:
# - Windowed
# - Maximized
# - Fullscreen
#
# Values for `startup_mode` (macOS only):
# - SimpleFullscreen
#startup_mode: Windowed
opacity: 0.85
# Window title
#title: Alacritty
# Allow terminal applications to change Alacritty's window title.
#dynamic_title: true
# Window class (Linux/BSD only):
#class:
# Application instance name
#instance: Alacritty
# General application class
#general: Alacritty
# GTK theme variant (Linux/BSD only)
#
# Override the variant of the GTK theme. Commonly supported values are `dark`
# and `light`. Set this to `None` to use the default theme variant.
#gtk_theme_variant: None
scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
history: 10000
# Scrolling distance multiplier.
multiplier: 3
# Font configuration
font:
# Normal (roman) font face
normal:
# Font family
#
# Default:
# - (macOS) Menlo
# - (Linux/BSD) monospace
# - (Windows) Consolas
family: JetBrainsMono Nerd Font
# The `style` can be specified to pick a specific face.
#style: Regular
# Bold font face
#bold:
# Font family
#
# If the bold family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Bold
# Italic font face
#italic:
# Font family
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Italic
# Bold italic font face
#bold_italic:
# Font family
#
# If the bold italic family is not specified, it will fall back to the
# value specified for the normal font.
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Bold Italic
# Point size
size: 7.0
# Offset is the extra space around each character. `offset.y` can be thought
# of as modifying the line spacing, and `offset.x` as modifying the letter
# spacing.
offset:
x: 0
y: 0
# Glyph offset determines the locations of the glyphs within their cells with
# the default being at the bottom. Increasing `x` moves the glyph to the
# right, increasing `y` moves the glyph upward.
#glyph_offset:
# x: 0
# y: 0
# Thin stroke font rendering (macOS only)
#
# Thin strokes are suitable for retina displays, but for non-retina screens
# it is recommended to set `use_thin_strokes` to `false`.
#use_thin_strokes: true
# If `true`, bold text is drawn using the bright color variants.
#draw_bold_text_with_bright_colors: false
# Colors (Tomorrow Night)
#colors:
# Default colors
#primary:
# background: '#1d1f21'
# foreground: '#c5c8c6'
# Bright and dim foreground colors
#
# The dimmed foreground color is calculated automatically if it is not
# present. If the bright foreground color is not set, or
# `draw_bold_text_with_bright_colors` is `false`, the normal foreground
# color will be used.
#dim_foreground: '#828482'
#bright_foreground: '#eaeaea'
# Cursor colors
#
# Colors which should be used to draw the terminal cursor.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#cursor:
# text: CellBackground
# cursor: CellForeground
# Vi mode cursor colors
#
# Colors for the cursor when the vi mode is active.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#vi_mode_cursor:
# text: CellBackground
# cursor: CellForeground
# Search colors
#
# Colors used for the search bar and match highlighting.
#search:
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#matches:
# foreground: '#000000'
# background: '#ffffff'
#focused_match:
# foreground: '#ffffff'
# background: '#000000'
#bar:
# background: '#c5c8c6'
# foreground: '#1d1f21'
# Keyboard regex hints
#hints:
# First character in the hint label
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#start:
# foreground: '#1d1f21'
# background: '#e9ff5e'
# All characters after the first one in the hint label
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#end:
# foreground: '#e9ff5e'
# background: '#1d1f21'
# Line indicator
#
# Color used for the indicator displaying the position in history during
# search and vi mode.
#
# By default, these will use the opposing primary color.
#line_indicator:
# foreground: None
# background: None
# Selection colors
#
# Colors which should be used to draw the selection area.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
#selection:
# text: CellBackground
# background: CellForeground
# Normal colors
#normal:
# black: '#1d1f21'
# red: '#cc6666'
# green: '#b5bd68'
# yellow: '#f0c674'
# blue: '#81a2be'
# magenta: '#b294bb'
# cyan: '#8abeb7'
# white: '#c5c8c6'
# Bright colors
#bright:
# black: '#666666'
# red: '#d54e53'
# green: '#b9ca4a'
# yellow: '#e7c547'
# blue: '#7aa6da'
# magenta: '#c397d8'
# cyan: '#70c0b1'
# white: '#eaeaea'
# Dim colors
#
# If the dim colors are not set, they will be calculated automatically based
# on the `normal` colors.
#dim:
# black: '#131415'
# red: '#864343'
# green: '#777c44'
# yellow: '#9e824c'
# blue: '#556a7d'
# magenta: '#75617b'
# cyan: '#5b7d78'
# white: '#828482'
# Indexed Colors
#
# The indexed colors include all colors from 16 to 256.
# When these are not set, they're filled with sensible defaults.
#
# Example:
# `- { index: 16, color: '#ff00ff' }`
#
#indexed_colors: []
# Bell
#
# The bell is rung every time the BEL control character is received.
#bell:
# Visual Bell Animation
#
# Animation effect for flashing the screen when the visual bell is rung.
#
# Values for `animation`:
# - Ease
# - EaseOut
# - EaseOutSine
# - EaseOutQuad
# - EaseOutCubic
# - EaseOutQuart
# - EaseOutQuint
# - EaseOutExpo
# - EaseOutCirc
# - Linear
#animation: EaseOutExpo
# Duration of the visual bell flash in milliseconds. A `duration` of `0` will
# disable the visual bell animation.
#duration: 0
# Visual bell animation color.
#color: '#ffffff'
# Bell Command
#
# This program is executed whenever the bell is rung.
#
# When set to `command: None`, no command will be executed.
#
# Example:
# command:
# program: notify-send
# args: ["Hello, World!"]
#
#command: None
#selection:
# This string contains all characters that are used as separators for
# "semantic words" in Alacritty.
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard.
#save_to_clipboard: false
#cursor:
# Cursor style
#style:
# Cursor shape
#
# Values for `shape`:
# - ▇ Block
# - _ Underline
# - | Beam
#shape: Block
# Cursor blinking state
#
# Values for `blinking`:
# - Never: Prevent the cursor from ever blinking
# - Off: Disable blinking by default
# - On: Enable blinking by default
# - Always: Force the cursor to always blink
#blinking: Off
# Vi mode cursor style
#
# If the vi mode cursor style is `None` or not specified, it will fall back to
# the style of the active value of the normal cursor.
#
# See `cursor.style` for available options.
#vi_mode_style: None
# Cursor blinking interval in milliseconds.
#blink_interval: 750
# If this is `true`, the cursor will be rendered as a hollow box when the
# window is not focused.
#unfocused_hollow: true
# Thickness of the cursor relative to the cell width as floating point number
# from `0.0` to `1.0`.
#thickness: 0.15
# Live config reload (changes require restart)
live_config_reload: true
# Shell
#
# You can set `shell.program` to the path of your favorite shell, e.g.
# `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the
# shell.
#
# Default:
# - (macOS) /bin/bash --login
# - (Linux/BSD) user login shell
# - (Windows) powershell
#shell:
# program: /bin/bash
# args:
# - --login
# Startup directory
#
# Directory the shell is started in. If this is unset, or `None`, the working
# directory of the parent process will be used.
#working_directory: None
# Send ESC (\x1b) before characters when alt is pressed.
#alt_send_esc: true
#mouse:
# Click settings
#
# The `double_click` and `triple_click` settings control the time
# alacritty should wait for accepting multiple clicks as one double
# or triple click.
#double_click: { threshold: 300 }
#triple_click: { threshold: 300 }
# If this is `true`, the cursor is temporarily hidden when typing.
#hide_when_typing: false
# Regex hints
#
# Terminal hints can be used to find text in the visible part of the terminal
# and pipe it to other applications.
#hints:
# Keys used for the hint labels.
#alphabet: "jfkdls;ahgurieowpq"
# List with all available hints
#
# Each hint must have a `regex` and either an `action` or a `command` field.
# The fields `mouse`, `binding` and `post_processing` are optional.
#
# The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and
# `mouse.mods` accept the same values as they do in the `key_bindings` section.
#
# The `mouse.enabled` field controls if the hint should be underlined while
# the mouse with all `mouse.mods` keys held or the vi mode cursor is above it.
#
# If the `post_processing` field is set to `true`, heuristics will be used to
# shorten the match if there are characters likely not to be part of the hint
# (e.g. a trailing `.`). This is most useful for URIs.
#
# Values for `action`:
# - Copy
# Copy the hint's text to the clipboard.
# - Paste
# Paste the hint's text to the terminal or search.
# - Select
# Select the hint's text.
# - MoveViModeCursor
# Move the vi mode cursor to the beginning of the hint.
#enabled:
# - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\
# [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+"
# command: xdg-open
# post_processing: true
# mouse:
# enabled: true
# mods: None
# binding:
# key: U
# mods: Control|Shift
# Mouse bindings
#
# Mouse bindings are specified as a list of objects, much like the key
# bindings further below.
#
# To trigger mouse bindings when an application running within Alacritty
# captures the mouse, the `Shift` modifier is automatically added as a
# requirement.
#
# Each mouse binding will specify a:
#
# - `mouse`:
#
# - Middle
# - Left
# - Right
# - Numeric identifier such as `5`
#
# - `action` (see key bindings)
#
# And optionally:
#
# - `mods` (see key bindings)
#mouse_bindings:
# - { mouse: Middle, action: PasteSelection }
# Key bindings
#
# Key bindings are specified as a list of objects. For example, this is the
# default paste binding:
#
# `- { key: V, mods: Control|Shift, action: Paste }`
#
# Each key binding will specify a:
#
# - `key`: Identifier of the key pressed
#
# - A-Z
# - F1-F24
# - Key0-Key9
#
# A full list with available key codes can be found here:
# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants
#
# Instead of using the name of the keys, the `key` field also supports using
# the scancode of the desired key. Scancodes have to be specified as a
# decimal number. This command will allow you to display the hex scancodes
# for certain keys:
#
# `showkey --scancodes`.
#
# Then exactly one of:
#
# - `chars`: Send a byte sequence to the running application
#
# The `chars` field writes the specified string to the terminal. This makes
# it possible to pass escape sequences. To find escape codes for bindings
# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside
# of tmux. Note that applications use terminfo to map escape sequences back
# to keys. It is therefore required to update the terminfo when changing an
# escape sequence.
#
# - `action`: Execute a predefined action
#
# - ToggleViMode
# - SearchForward
# Start searching toward the right of the search origin.
# - SearchBackward
# Start searching toward the left of the search origin.
# - Copy
# - Paste
# - IncreaseFontSize
# - DecreaseFontSize
# - ResetFontSize
# - ScrollPageUp
# - ScrollPageDown
# - ScrollHalfPageUp
# - ScrollHalfPageDown
# - ScrollLineUp
# - ScrollLineDown
# - ScrollToTop
# - ScrollToBottom
# - ClearHistory
# Remove the terminal's scrollback history.
# - Hide
# Hide the Alacritty window.
# - Minimize
# Minimize the Alacritty window.
# - Quit
# Quit Alacritty.
# - ToggleFullscreen
# - SpawnNewInstance
# Spawn a new instance of Alacritty.
# - ClearLogNotice
# Clear Alacritty's UI warning and error notice.
# - ClearSelection
# Remove the active selection.
# - ReceiveChar
# - None
#
# - Vi mode exclusive actions:
#
# - Open
# Perform the action of the first matching hint under the vi mode cursor
# with `mouse.enabled` set to `true`.
# - ToggleNormalSelection
# - ToggleLineSelection
# - ToggleBlockSelection
# - ToggleSemanticSelection
# Toggle semantic selection based on `selection.semantic_escape_chars`.
#
# - Vi mode exclusive cursor motion actions:
#
# - Up
# One line up.
# - Down
# One line down.
# - Left
# One character left.
# - Right
# One character right.
# - First
# First column, or beginning of the line when already at the first column.
# - Last
# Last column, or beginning of the line when already at the last column.
# - FirstOccupied
# First non-empty cell in this terminal row, or first non-empty cell of
# the line when already at the first cell of the row.
# - High
# Top of the screen.
# - Middle
# Center of the screen.
# - Low
# Bottom of the screen.
# - SemanticLeft
# Start of the previous semantically separated word.
# - SemanticRight
# Start of the next semantically separated word.
# - SemanticLeftEnd
# End of the previous semantically separated word.
# - SemanticRightEnd
# End of the next semantically separated word.
# - WordLeft
# Start of the previous whitespace separated word.
# - WordRight
# Start of the next whitespace separated word.
# - WordLeftEnd
# End of the previous whitespace separated word.
# - WordRightEnd
# End of the next whitespace separated word.
# - Bracket
# Character matching the bracket at the cursor's location.
# - SearchNext
# Beginning of the next match.
# - SearchPrevious
# Beginning of the previous match.
# - SearchStart
# Start of the match to the left of the vi mode cursor.
# - SearchEnd
# End of the match to the right of the vi mode cursor.
#
# - Search mode exclusive actions:
# - SearchFocusNext
# Move the focus to the next search match.
# - SearchFocusPrevious
# Move the focus to the previous search match.
# - SearchConfirm
# - SearchCancel
# - SearchClear
# Reset the search regex.
# - SearchDeleteWord
# Delete the last word in the search regex.
# - SearchHistoryPrevious
# Go to the previous regex in the search history.
# - SearchHistoryNext
# Go to the next regex in the search history.
#
# - macOS exclusive actions:
# - ToggleSimpleFullscreen
# Enter fullscreen without occupying another space.
#
# - Linux/BSD exclusive actions:
#
# - CopySelection
# Copy from the selection buffer.
# - PasteSelection
# Paste from the selection buffer.
#
# - `command`: Fork and execute a specified command plus arguments
#
# The `command` field must be a map containing a `program` string and an
# `args` array of command line parameter strings. For example:
# `{ program: "alacritty", args: ["-e", "vttest"] }`
#
# And optionally:
#
# - `mods`: Key modifiers to filter binding actions
#
# - Command
# - Control
# - Option
# - Super
# - Shift
# - Alt
#
# Multiple `mods` can be combined using `|` like this:
# `mods: Control|Shift`.
# Whitespace and capitalization are relevant and must match the example.
#
# - `mode`: Indicate a binding for only specific terminal reported modes
#
# This is mainly used to send applications the correct escape sequences
# when in different modes.
#
# - AppCursor
# - AppKeypad
# - Search
# - Alt
# - Vi
#
# A `~` operator can be used before a mode to apply the binding whenever
# the mode is *not* active, e.g. `~Alt`.
#
# Bindings are always filled by default, but will be replaced when a new
# binding with the same triggers is defined. To unset a default binding, it can
# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for
# a no-op if you do not wish to receive input characters for that binding.
#
# If the same trigger is assigned to multiple actions, all of them are executed
# in the order they were defined in.
# key_bindings:
# - { key: A, mods: Alt, chars: '\x1ba' }
# - { key: B, mods: Alt, chars: '\x1bb' }
# - { key: C, mods: Alt, chars: '\x1bc' }
# - { key: D, mods: Alt, chars: '\x1bd' }
# - { key: E, mods: Alt, chars: '\x1be' }
# - { key: F, mods: Alt, chars: '\x1bf' }
# - { key: G, mods: Alt, chars: '\x1bg' }
# - { key: H, mods: Alt, chars: '\x1bh' }
# - { key: I, mods: Alt, chars: '\x1bi' }
# - { key: J, mods: Alt, chars: '\x1bj' }
# - { key: K, mods: Alt, chars: '\x1bk' }
# - { key: L, mods: Alt, chars: '\x1bl' }
# - { key: M, mods: Alt, chars: '\x1bm' }
# - { key: N, mods: Alt, chars: '\x1bn' }
# - { key: O, mods: Alt, chars: '\x1bo' }
# - { key: P, mods: Alt, chars: '\x1bp' }
# - { key: Q, mods: Alt, chars: '\x1bq' }
# - { key: R, mods: Alt, chars: '\x1br' }
# - { key: S, mods: Alt, chars: '\x1bs' }
# - { key: T, mods: Alt, chars: '\x1bt' }
# - { key: U, mods: Alt, chars: '\x1bu' }
# - { key: V, mods: Alt, chars: '\x1bv' }
# - { key: W, mods: Alt, chars: '\x1bw' }
# - { key: X, mods: Alt, chars: '\x1bx' }
# - { key: Y, mods: Alt, chars: '\x1by' }
# - { key: Z, mods: Alt, chars: '\x1bz' }
#- { key: Paste, action: Paste }
#- { key: Copy, action: Copy }
#- { key: L, mods: Control, action: ClearLogNotice }
#- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp, }
#- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown }
#- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop, }
#- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom }
# Vi Mode
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Escape, mode: Vi|~Search, action: ClearSelection }
#- { key: I, mode: Vi|~Search, action: ToggleViMode }
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
#- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
#- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
#- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }
#- { key: G, mode: Vi|~Search, action: ScrollToTop }
#- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom }
#- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp }
#- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown }
#- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp }
#- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown }
#- { key: Y, mode: Vi|~Search, action: Copy }
#- { key: Y, mode: Vi|~Search, action: ClearSelection }
#- { key: Copy, mode: Vi|~Search, action: ClearSelection }
#- { key: V, mode: Vi|~Search, action: ToggleNormalSelection }
#- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection }
#- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection }
#- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection }
#- { key: Return, mode: Vi|~Search, action: Open }
#- { key: K, mode: Vi|~Search, action: Up }
#- { key: J, mode: Vi|~Search, action: Down }
#- { key: H, mode: Vi|~Search, action: Left }
#- { key: L, mode: Vi|~Search, action: Right }
#- { key: Up, mode: Vi|~Search, action: Up }
#- { key: Down, mode: Vi|~Search, action: Down }
#- { key: Left, mode: Vi|~Search, action: Left }
#- { key: Right, mode: Vi|~Search, action: Right }
#- { key: Key0, mode: Vi|~Search, action: First }
#- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last }
#- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied }
#- { key: H, mods: Shift, mode: Vi|~Search, action: High }
#- { key: M, mods: Shift, mode: Vi|~Search, action: Middle }
#- { key: L, mods: Shift, mode: Vi|~Search, action: Low }
#- { key: B, mode: Vi|~Search, action: SemanticLeft }
#- { key: W, mode: Vi|~Search, action: SemanticRight }
#- { key: E, mode: Vi|~Search, action: SemanticRightEnd }
#- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft }
#- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight }
#- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd }
#- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket }
#- { key: Slash, mode: Vi|~Search, action: SearchForward }
#- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }
#- { key: N, mode: Vi|~Search, action: SearchNext }
#- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious }
# Search Mode
#- { key: Return, mode: Search|Vi, action: SearchConfirm }
#- { key: Escape, mode: Search, action: SearchCancel }
#- { key: C, mods: Control, mode: Search, action: SearchCancel }
#- { key: U, mods: Control, mode: Search, action: SearchClear }
#- { key: W, mods: Control, mode: Search, action: SearchDeleteWord }
#- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious }
#- { key: N, mods: Control, mode: Search, action: SearchHistoryNext }
#- { key: Up, mode: Search, action: SearchHistoryPrevious }
#- { key: Down, mode: Search, action: SearchHistoryNext }
#- { key: Return, mode: Search|~Vi, action: SearchFocusNext }
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
# (Windows, Linux, and BSD only)
#- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
#- { key: C, mods: Control|Shift, action: Copy }
#- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward }
#- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward }
#- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection }
#- { key: Insert, mods: Shift, action: PasteSelection }
#- { key: Key0, mods: Control, action: ResetFontSize }
#- { key: Equals, mods: Control, action: IncreaseFontSize }
#- { key: Plus, mods: Control, action: IncreaseFontSize }
#- { key: NumpadAdd, mods: Control, action: IncreaseFontSize }
#- { key: Minus, mods: Control, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize }
# (Windows only)
#- { key: Return, mods: Alt, action: ToggleFullscreen }
# (macOS only)
#- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory }
#- { key: Key0, mods: Command, action: ResetFontSize }
#- { key: Equals, mods: Command, action: IncreaseFontSize }
#- { key: Plus, mods: Command, action: IncreaseFontSize }
#- { key: NumpadAdd, mods: Command, action: IncreaseFontSize }
#- { key: Minus, mods: Command, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize }
#- { key: V, mods: Command, action: Paste }
#- { key: C, mods: Command, action: Copy }
#- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection }
#- { key: H, mods: Command, action: Hide }
#- { key: H, mods: Command|Alt, action: HideOtherApplications }
#- { key: M, mods: Command, action: Minimize }
#- { key: Q, mods: Command, action: Quit }
#- { key: W, mods: Command, action: Quit }
#- { key: N, mods: Command, action: SpawnNewInstance }
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
#- { key: F, mods: Command, mode: ~Search, action: SearchForward }
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
#debug:
# Display the time it takes to redraw each frame.
#render_timer: false
# Keep the log file after quitting Alacritty.
#persistent_logging: false
# Log level
#
# Values for `log_level`:
# - Off
# - Error
# - Warn
# - Info
# - Debug
# - Trace
#log_level: Warn
# Print all received window events.
#print_events: false
+9
View File
@@ -0,0 +1,9 @@
# Sway essential session variables
XDG_CURRENT_DESKTOP=sway
XDG_SESSION_DESKTOP=sway
XDG_SESSION_TYPE=wayland
# Toolkits and Compatibility
ELECTRON_OZONE_PLATFORM_HINT=auto
_JAVA_AWT_WM_NONREPARENTING=1
QT_WAYLAND_DISABLE_WINDOWDECORATION=1
+9 -3
View File
@@ -1,10 +1,16 @@
XIM=fcitx
GTK_IM_MODULE=fcitx GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx XMODIFIERS=@im=fcitx
GLFW_IM_MODULE=fcitx GLFW_IM_MODULE=fcitx
SDL_IM_MODULE=fcitx SDL_IM_MODULE=fcitx
MOZ_ENABLE_WAYLAND=1 MOZ_ENABLE_WAYLAND=1
#XDG_CURRENT_DESKTOP=sway
#XDG_SESSION_DESKTOP=sway
RTC_USE_PIPEWIRE=true RTC_USE_PIPEWIRE=true
IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext
GDK_BACKEND=wayland,x11
QT_QPA_PLATFORM=wayland;xcb
CLUTTER_BACKEND=wayland
SDL_VIDEODRIVER=wayland
EDITOR=nvim
ELECTRON_OZONE_PLATFORM_HINT=auto
+158
View File
@@ -0,0 +1,158 @@
$bg: #1e1e2e;
$fg: #cdd6f4;
$blue: #89b4fa;
$surface: #313244;
$crust: #11111b;
$yellow: #f9e2af;
* {
font-family: "sans-serif";
font-size: 14px;
}
window {
background-color: transparent;
}
button {
all: unset;
}
.main-container {
background-color: $bg;
color: $fg;
border-radius: 8px;
padding: 2px 5px;
margin: 1px;
}
.ws-focused {
background-color: $blue;
color: $crust;
padding: 0 8px;
border-radius: 6px;
font-weight: bold;
}
.ws-inactive {
color: #cdd6f4;
padding: 0 8px;
border-radius: 6px;
border: 1px solid #ffffff;
}
.ws-inactive:hover {
background-color: $surface;
border-radius: 6px;
}
.date-time {
padding: 0 10px;
}
.date-time:hover {
background-color: $surface;
border-radius: 6px;
}
.battery-widget, .volume-widget, .brightness-widget, .caffeine {
padding: 0 2px;
}
.tray-button {
padding: 0 8px;
border-radius: 6px;
transition: background-color 0.2s;
}
.tray-button:hover {
background-color: $surface;
}
.popup-box {
background-color: $bg;
color: $fg;
padding: 15px;
border: 1px solid $blue;
border-radius: 8px;
}
.vol-bar trough, .br-bar trough {
background-color: $surface;
border-radius: 10px;
min-height: 4px;
}
.vol-bar highlight {
background-color: $blue;
border-radius: 10px;
}
.br-bar highlight {
background-color: $yellow;
border-radius: 10px;
}
.caffeine {
padding: 0 5px;
}
.caffeine-on {
color: $yellow;
font-weight: bold;
}
.caffeine-off {
color: $fg;
opacity: 0.6;
}
.tray-container {
padding-left: 10px;
}
.calendar-box {
background-color: $bg;
color: $fg;
padding: 15px;
border: 1px solid $blue;
border-radius: 12px;
}
calendar {
padding: 5px;
}
.popup-title {
font-size: 16px;
font-weight: bold;
color: $blue;
margin-bottom: 5px;
}
.popup-subtitle {
font-size: 12px;
color: $fg;
opacity: 0.8;
margin-top: 5px;
}
.profile-active {
background-color: $blue;
color: $crust;
padding: 8px 12px;
border-radius: 6px;
font-weight: bold;
}
.profile-inactive {
background-color: $surface;
color: $fg;
padding: 8px 12px;
border-radius: 6px;
}
.profile-inactive:hover {
background-color: lighten($surface, 5%);
border: 1px solid $blue;
}
+124
View File
@@ -0,0 +1,124 @@
(defpoll time :interval "1s" "date '+%Y/%m/%d %H:%M:%S'")
(defpoll inhibit_status :interval "1s" "[ -f /tmp/eww-inhibit.pid ] && echo 'on' || echo 'off'")
(defpoll vol :interval "1s" :initial "0" "bash ~/.config/eww/scripts/volume.sh get")
(defpoll vol_icon :interval "1s" :initial "🔉" "bash ~/.config/eww/scripts/volume.sh icon")
(defpoll br :interval "1s" :initial "50" "bash ~/.config/eww/scripts/brightness.sh get")
(defpoll br_icon :interval "1s" :initial "☀️" "bash ~/.config/eww/scripts/brightness.sh icon")
(defpoll battery :interval "10s" :initial "100" "cat /sys/class/power_supply/BAT*/capacity 2>/dev/null || echo 100")
(defpoll battery_status :interval "10s" :initial "Unknown" "cat /sys/class/power_supply/BAT*/status 2>/dev/null || echo Unknown")
(defpoll power_profile :interval "5s" :initial "balanced" "bash ~/.config/eww/scripts/power-profile.sh get")
(defpoll power_profile_icon :interval "5s" :initial "⚖️" "bash ~/.config/eww/scripts/power-profile.sh icon")
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces.sh")
(defwidget workspaces_widget []
(box :class "workspaces" :orientation "h" :space-evenly false :spacing 5
(for ws in workspaces
(button :onclick "swaymsg workspace ${ws.name}"
:class {ws.focused ? "ws-focused" : "ws-inactive"}
"${ws.name}"))))
(defwidget date_widget []
(box :class "date-time"
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh calendar"
time)))
(defwidget volume_widget []
(box :class "volume-widget"
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh volume_popup"
:onrightclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
:class "tray-button"
"${vol_icon} ${vol}%")))
(defwidget brightness_widget []
(box :class "brightness-widget"
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh brightness_popup"
:class "tray-button"
"${br_icon} ${br}%")))
(defwidget caffeine_widget []
(box :class "caffeine"
(button :onclick "bash ~/.config/eww/scripts/toggle-inhibit.sh"
:class "tray-button ${inhibit_status == 'on' ? 'caffeine-on' : 'caffeine-off'}"
{inhibit_status == "on" ? "☕" : "🌙"})))
(defwidget battery_widget []
(box :class "battery-widget"
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh power_profile_popup"
:tooltip "Battery: ${battery}% (${battery_status})\nPower Profile: ${power_profile}"
:class "tray-button"
"${battery_status == 'Charging' ? '🔌' :
battery >= 80 ? '🔋' :
battery >= 50 ? '🔋' :
battery >= 20 ? '🪫' :
'🪫'} ${battery}% ${power_profile_icon}")))
(defwidget tray_widget []
(box :halign "end" :class "tray-container" :space-evenly false :spacing 10
(battery_widget)
(brightness_widget)
(volume_widget)
(caffeine_widget)
(systray :orientation "h" :spacing 5 :icon-size 20 :prepend-new true)))
(defwidget bar_layout []
(box :class "main-container"
(centerbox :orientation "h"
(workspaces_widget)
(date_widget)
(tray_widget))))
(defwindow bar
:monitor "eDP-1"
:geometry (geometry :x "0%" :y "0%" :width "99%" :height "30px" :anchor "top center")
:stacking "fg"
:exclusive true
:focusable false
(bar_layout))
(defwindow calendar
:monitor "eDP-1"
:geometry (geometry :x "0%" :y "15px" :width "250px" :height "250px" :anchor "top center")
:stacking "fg"
:focusable false
(box :class "calendar-box"
(calendar)))
(defwindow volume_popup
:monitor "eDP-1"
:geometry (geometry :x "15px" :y "15px" :width "300px" :height "60px" :anchor "top right")
:stacking "fg"
:focusable false
(box :class "popup-box" :space-evenly false :spacing 15
(button :onclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" vol_icon)
(scale :class "vol-bar" :min 0 :max 101 :value {vol == "" ? 0 : vol} :width 150 :onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%")
(label :text "${vol}%")))
(defwindow brightness_popup
:monitor "eDP-1"
:geometry (geometry :x "15px" :y "15px" :width "300px" :height "60px" :anchor "top right")
:stacking "fg"
:focusable false
(box :class "popup-box" :space-evenly false :spacing 15
(label :text br_icon)
(scale :class "br-bar" :min 0 :max 101 :value {br == "" ? 0 : br} :width 150 :onchange "brightnessctl s {}%")
(label :text "${br}%")))
(defwindow power_profile_popup
:monitor "eDP-1"
:geometry (geometry :x "15px" :y "15px" :width "300px" :height "180px" :anchor "top right")
:stacking "fg"
:focusable false
(box :class "popup-box" :orientation "v" :space-evenly false :spacing 10
(label :class "popup-title" :text "Power Profile")
(box :orientation "v" :spacing 8
(button :class {power_profile == "power-saver" ? "profile-active" : "profile-inactive"}
:onclick "bash ~/.config/eww/scripts/power-profile.sh set power-saver && bash ~/.config/eww/scripts/toggle-window.sh power_profile_popup"
"🐢 Power Saver")
(button :class {power_profile == "balanced" ? "profile-active" : "profile-inactive"}
:onclick "bash ~/.config/eww/scripts/power-profile.sh set balanced && bash ~/.config/eww/scripts/toggle-window.sh power_profile_popup"
"⚖️ Balanced")
(button :class {power_profile == "performance" ? "profile-active" : "profile-inactive"}
:onclick "bash ~/.config/eww/scripts/power-profile.sh set performance && bash ~/.config/eww/scripts/toggle-window.sh power_profile_popup"
"🚀 Performance"))
(label :class "popup-subtitle" :text "Current: ${power_profile}")))
@@ -0,0 +1,8 @@
#!/bin/bash
if ! eww ping >/dev/null 2>&1; then
eww daemon
fi
eww close-all
eww open bar --screen 'eDP-1'
@@ -0,0 +1,18 @@
#!/bin/bash
# 獲取目前亮度百分比
get_brightness() {
brightnessctl -m | awk -F, '{print substr($4, 0, length($4)-1)}'
}
case $1 in
get)
get_brightness
;;
icon)
BR=$(get_brightness)
if [ "$BR" -gt 66 ]; then echo "☀️";
elif [ "$BR" -gt 33 ]; then echo "🌤️";
else echo "🔅"; fi
;;
esac
@@ -0,0 +1,13 @@
#!/bin/bash
# 需安裝 jq
get_workspaces() {
swaymsg -t get_workspaces | jq -c 'sort_by(.num)'
}
# 初始輸出
get_workspaces
# 監聽事件並更新
swaymsg -t subscribe '["workspace"]' -m | while read -r line; do
get_workspaces
done
@@ -0,0 +1,15 @@
#!/bin/bash
# 定義 PID 檔案路徑
PID_FILE="/tmp/eww-inhibit.pid"
if [ -f "$PID_FILE" ]; then
# 讀取 PID 並殺掉程序
PID=$(cat "$PID_FILE")
kill "$PID" 2>/dev/null
rm "$PID_FILE"
else
# 啟動並記錄 PID
systemd-inhibit --what=idle --mode=block sleep infinity &
echo $! > "$PID_FILE"
fi
@@ -0,0 +1,24 @@
#!/bin/bash
# 目標視窗名稱
TARGET=$1
# 獲取目前所有已開啟的視窗名稱 (提取冒號前文字並去空格)
OPENED_WINDOWS=$(eww active-windows | cut -d: -f1 | tr -d ' ')
# 所有受管理的彈出視窗清單
MANAGED_WINDOWS=("calendar" "volume_popup" "brightness_popup")
# 遍歷目前已開啟的視窗
for win in $OPENED_WINDOWS; do
# 檢查該視窗是否在受管名單內,且不是目標視窗
# 我們不關閉 "bar" 視窗
if [[ " ${MANAGED_WINDOWS[@]} " =~ " ${win} " ]] && [ "$win" != "$TARGET" ]; then
eww close "$win"
fi
done
# 如果有目標視窗,則切換其顯示狀態
if [ -n "$TARGET" ]; then
eww open --toggle "$TARGET"
fi
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# 獲取預設輸出裝置的音量資訊 (輸出範例: Volume: 0.50 [MUTED])
GET_VOL=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
# 提取數值並轉換為百分比 (0-100)
# 使用 printf %.0f 將小數四捨五入為整數
VOL=$(echo "$GET_VOL" | awk '{print $2 * 100}' | xargs printf "%.0f")
if [ "$1" == "get" ]; then
echo "$VOL"
elif [ "$1" == "icon" ]; then
# 檢查是否含有 [MUTED] 字樣
if echo "$GET_VOL" | grep -q "\[MUTED\]"; then
echo "🔇"
else
if [ "$VOL" -gt 60 ]; then echo "🔊";
elif [ "$VOL" -gt 30 ]; then echo "🔉";
else echo "🔈"; fi
fi
fi
+63
View File
@@ -0,0 +1,63 @@
# This is the configuration file for Ghostty.
#
# This template file has been automatically created at the following
# path since Ghostty couldn't find any existing config files on your system:
#
# /home/jay/.config/ghostty/config
#
# The template does not set any default options, since Ghostty ships
# with sensible defaults for all options. Users should only need to set
# options that they want to change from the default.
#
# Run `ghostty +show-config --default --docs` to view a list of
# all available config options and their default values.
#
# Additionally, each config option is also explained in detail
# on Ghostty's website, at https://ghostty.org/docs/config.
#
# Ghostty can reload the configuration while running by using the menu
# options or the bound key (default: Command + Shift + comma on macOS and
# Control + Shift + comma on other platforms). Not all config options can be
# reloaded while running; some only apply to new windows and others may require
# a full restart to take effect.
# Config syntax crash course
# ==========================
# # The config file consists of simple key-value pairs,
# # separated by equals signs.
font-family = "FiraMono Nerd Font Mono"
font-size = 10
#window-padding-x = 2
#window-padding-y = 2
#
# # Spacing around the equals sign does not matter.
# # All of these are identical:
# key=value
# key= value
# key =value
# key = value
#
# # Any line beginning with a # is a comment. It's not possible to put
# # a comment after a config option, since it would be interpreted as a
# # part of the value. For example, this will have a value of "#123abc":
# background = #123abc
#
# # Empty values are used to reset config keys to default.
# key =
#
# # Some config options have unique syntaxes for their value,
# # which is explained in the docs for that config option.
# # Just for example:
# resize-overlay-duration = 4s 200ms
theme = "moonfly-default"
background-opacity = 0.9
confirm-close-surface = false
app-notifications = no-clipboard-copy,config-reload
keybind = ctrl+,=unbind
+22
View File
@@ -0,0 +1,22 @@
background = #0b0e14
foreground = #bfbdb6
selection-background = #1b3a5b
selection-foreground = #bfbdb6
cursor-color = #bfbdb6
cursor-text = #0b0e14
palette = 0=#1e232b
palette = 1=#ea6c73
palette = 2=#7fd962
palette = 3=#f9af4f
palette = 4=#53bdfa
palette = 5=#cda1fa
palette = 6=#90e1c6
palette = 7=#c7c7c7
palette = 8=#686868
palette = 9=#f07178
palette = 10=#aad94c
palette = 11=#ffb454
palette = 12=#59c2ff
palette = 13=#d2a6ff
palette = 14=#95e6cb
palette = 15=#ffffff
@@ -0,0 +1,23 @@
palette = 0=#51576d
palette = 1=#e78284
palette = 2=#a6d189
palette = 3=#e5c890
palette = 4=#8caaee
palette = 5=#f4b8e4
palette = 6=#81c8be
palette = 7=#a5adce
palette = 8=#626880
palette = 9=#e78284
palette = 10=#a6d189
palette = 11=#e5c890
palette = 12=#8caaee
palette = 13=#f4b8e4
palette = 14=#81c8be
palette = 15=#b5bfe2
background = 303446
foreground = c6d0f5
cursor-color = f2d5cf
cursor-text = 232634
selection-background = 44495d
selection-foreground = c6d0f5
split-divider-color = 414559
@@ -0,0 +1,23 @@
palette = 0=#5c5f77
palette = 1=#d20f39
palette = 2=#40a02b
palette = 3=#df8e1d
palette = 4=#1e66f5
palette = 5=#ea76cb
palette = 6=#179299
palette = 7=#acb0be
palette = 8=#6c6f85
palette = 9=#d20f39
palette = 10=#40a02b
palette = 11=#df8e1d
palette = 12=#1e66f5
palette = 13=#ea76cb
palette = 14=#179299
palette = 15=#bcc0cc
background = eff1f5
foreground = 4c4f69
cursor-color = dc8a78
cursor-text = eff1f5
selection-background = d8dae1
selection-foreground = 4c4f69
split-divider-color = ccd0da
@@ -0,0 +1,23 @@
palette = 0=#494d64
palette = 1=#ed8796
palette = 2=#a6da95
palette = 3=#eed49f
palette = 4=#8aadf4
palette = 5=#f5bde6
palette = 6=#8bd5ca
palette = 7=#a5adcb
palette = 8=#5b6078
palette = 9=#ed8796
palette = 10=#a6da95
palette = 11=#eed49f
palette = 12=#8aadf4
palette = 13=#f5bde6
palette = 14=#8bd5ca
palette = 15=#b8c0e0
background = 24273a
foreground = cad3f5
cursor-color = f4dbd6
cursor-text = 181926
selection-background = 3a3e53
selection-foreground = cad3f5
split-divider-color = 363a4f
@@ -0,0 +1,23 @@
palette = 0=#45475a
palette = 1=#f38ba8
palette = 2=#a6e3a1
palette = 3=#f9e2af
palette = 4=#89b4fa
palette = 5=#f5c2e7
palette = 6=#94e2d5
palette = 7=#a6adc8
palette = 8=#585b70
palette = 9=#f38ba8
palette = 10=#a6e3a1
palette = 11=#f9e2af
palette = 12=#89b4fa
palette = 13=#f5c2e7
palette = 14=#94e2d5
palette = 15=#bac2de
background = 1e1e2e
foreground = cdd6f4
cursor-color = f5e0dc
cursor-text = 11111b
selection-background = 353749
selection-foreground = cdd6f4
split-divider-color = 313244
@@ -0,0 +1,22 @@
background = #080808
foreground = #bdbdbd
selection-background = #b2ceee
selection-foreground = #080808
cursor-color = #9e9e9e
cursor-text = #080808
palette = 0=#323437
palette = 1=#ff5454
palette = 2=#8cc85f
palette = 3=#e3c78a
palette = 4=#80a0ff
palette = 5=#cf87e8
palette = 6=#79dac8
palette = 7=#c6c6c6
palette = 8=#949494
palette = 9=#ff5189
palette = 10=#36c692
palette = 11=#c6c684
palette = 12=#74b2ff
palette = 13=#ae81ff
palette = 14=#85dc85
palette = 15=#e4e4e4
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 MiB

+324
View File
@@ -0,0 +1,324 @@
# This is an example Hyprland config file.
# Refer to the wiki for more information.
# https://wiki.hyprland.org/Configuring/
# Please note not all available settings / options are set here.
# For a full list, see the wiki
# You can split this configuration into multiple files
# Create your files separately and then link them to this file like this:
# source = ~/.config/hypr/myColors.conf
################
### MONITORS ###
################
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,auto
monitor=eDP-1,preferred,auto,1.2
###################
### MY PROGRAMS ###
###################
# See https://wiki.hyprland.org/Configuring/Keywords/
# Set programs that you use
$terminal = alacritty
$fileManager = dolphin
$menu = wofi --show drun
#################
### AUTOSTART ###
#################
# Autostart necessary processes (like notifications daemons, status bars, etc.)
# Or execute your favorite apps at launch like this:
# exec-once = $terminal
# exec-once = nm-applet &
# exec-once = waybar & hyprpaper & firefox
#############################
### ENVIRONMENT VARIABLES ###
#############################
# See https://wiki.hyprland.org/Configuring/Environment-variables/
env = XCURSOR_SIZE,24
env = HYPRCURSOR_SIZE,24
###################
### PERMISSIONS ###
###################
# See https://wiki.hyprland.org/Configuring/Permissions/
# Please note permission changes here require a Hyprland restart and are not applied on-the-fly
# for security reasons
# ecosystem {
# enforce_permissions = 1
# }
# permission = /usr/(bin|local/bin)/grim, screencopy, allow
# permission = /usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland, screencopy, allow
# permission = /usr/(bin|local/bin)/hyprpm, plugin, allow
#####################
### LOOK AND FEEL ###
#####################
# Refer to https://wiki.hyprland.org/Configuring/Variables/
# https://wiki.hyprland.org/Configuring/Variables/#general
general {
gaps_in = 5
gaps_out = 20
border_size = 2
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = rgba(595959aa)
# Set to true enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = false
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false
layout = dwindle
}
# https://wiki.hyprland.org/Configuring/Variables/#decoration
decoration {
rounding = 10
rounding_power = 2
# Change transparency of focused and unfocused windows
active_opacity = 1.0
inactive_opacity = 1.0
shadow {
enabled = true
range = 4
render_power = 3
color = rgba(1a1a1aee)
}
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur {
enabled = true
size = 3
passes = 1
vibrancy = 0.1696
}
}
# https://wiki.hyprland.org/Configuring/Variables/#animations
animations {
enabled = yes, please :)
# Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = easeOutQuint,0.23,1,0.32,1
bezier = easeInOutCubic,0.65,0.05,0.36,1
bezier = linear,0,0,1,1
bezier = almostLinear,0.5,0.5,0.75,1.0
bezier = quick,0.15,0,0.1,1
animation = global, 1, 10, default
animation = border, 1, 5.39, easeOutQuint
animation = windows, 1, 4.79, easeOutQuint
animation = windowsIn, 1, 4.1, easeOutQuint, popin 87%
animation = windowsOut, 1, 1.49, linear, popin 87%
animation = fadeIn, 1, 1.73, almostLinear
animation = fadeOut, 1, 1.46, almostLinear
animation = fade, 1, 3.03, quick
animation = layers, 1, 3.81, easeOutQuint
animation = layersIn, 1, 4, easeOutQuint, fade
animation = layersOut, 1, 1.5, linear, fade
animation = fadeLayersIn, 1, 1.79, almostLinear
animation = fadeLayersOut, 1, 1.39, almostLinear
animation = workspaces, 1, 1.94, almostLinear, fade
animation = workspacesIn, 1, 1.21, almostLinear, fade
animation = workspacesOut, 1, 1.94, almostLinear, fade
}
# Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/
# "Smart gaps" / "No gaps when only"
# uncomment all if you wish to use that.
# workspace = w[tv1], gapsout:0, gapsin:0
# workspace = f[1], gapsout:0, gapsin:0
# windowrule = bordersize 0, floating:0, onworkspace:w[tv1]
# windowrule = rounding 0, floating:0, onworkspace:w[tv1]
# windowrule = bordersize 0, floating:0, onworkspace:f[1]
# windowrule = rounding 0, floating:0, onworkspace:f[1]
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
dwindle {
pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true # You probably want this
}
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
master {
new_status = master
}
# https://wiki.hyprland.org/Configuring/Variables/#misc
misc {
force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers
disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :(
}
#############
### INPUT ###
#############
# https://wiki.hyprland.org/Configuring/Variables/#input
input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse = 1
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
touchpad {
scroll_factor = 0.6
natural_scroll = false
tap-to-click = true
drag_lock = true
}
}
# https://wiki.hyprland.org/Configuring/Variables/#gestures
gestures {
workspace_swipe = false
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
device {
name = epic-mouse-v1
sensitivity = -0.5
}
###################
### KEYBINDINGS ###
###################
# See https://wiki.hyprland.org/Configuring/Keywords/
$mainMod = SUPER
$altMod = ALT
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $altMod SHIFT, C, exec, ~/bin/screenshot
bind = $altMod SHIFT, M, exec, ~/bin/screenshot-monitor
bind = $mainMod, Return, exec, alacritty
bind = $mainMod SHIFT, Q, killactive,
bind = $mainMod SHIFT, E, exit,
bind = $mainMod SHIFT, SPACE, togglefloating,
bind = $mainMod, D, exec, wofi --show drun
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod SHIFT, J, togglesplit, # dwindle
bind = $mainMod SHIFT, P, exec, ~/.config/wofi/wofi-power.sh
bind = $mainMod SHIFT, X, exec, swaylock -f -i ~/.config/swaylock/bg.png -s fill
bind = $mainMod, F, fullscreen, 1
bind = $mainMod SHIFT, F, fullscreen, 0
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# when move focus key released, set active window to top
bindr = $mainMod, left, bringactivetotop
bindr = $mainMod, right, bringactivetotop
bindr = $mainMod, up, bringactivetotop
bindr = $mainMod, down, bringactivetotop
binde = $mainMod SHIFT, left, movewindow, l
binde = $mainMod SHIFT, right, movewindow, r
binde = $mainMod SHIFT, up, movewindow, u
binde = $mainMod SHIFT, down, movewindow, d
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Example special workspace (scratchpad)
bind = $mainMod, S, togglespecialworkspace, magic
bind = $mainMod SHIFT, S, movetoworkspace, special:magic
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
# Laptop multimedia keys for volume and LCD brightness
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-
# Requires playerctl
bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous
##############################
### WINDOWS AND WORKSPACES ###
##############################
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules
# Example windowrule
# windowrule = float,class:^(kitty)$,title:^(kitty)$
# Ignore maximize requests from apps. You'll probably like this.
windowrule = suppressevent maximize, class:.*
# Fix some dragging issues with XWayland
windowrule = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0
+2
View File
@@ -0,0 +1,2 @@
font=JetBrainsMono Nerd Font 10
default-timeout=5000
+9
View File
@@ -0,0 +1,9 @@
-- HELPERS ----------------------------------------------------
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
local g = vim.g -- a table to access global variables
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
-- Set CMD ----------------------------------------------------
require("basic")
-- Load Plugins ------------------------------------------------
require("plugins")
-622
View File
@@ -1,622 +0,0 @@
"*****************************************************************************
""" Vim-Plug core
"*****************************************************************************
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
let curl_exists=expand('curl')
if !filereadable(vimplug_exists)
if !executable(curl_exists)
echoerr "You have to install curl or first install vim-plug yourself!"
execute "q!"
endif
echo "Installing Vim-Plug..."
echo ""
silent exec "!"curl_exists" -fLo " . shellescape(vimplug_exists) . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
let g:not_finish_vimplug = "yes"
autocmd VimEnter * PlugInstall
endif
" Required:
call plug#begin(expand('~/.config/nvim/plugged'))
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
" For vsnip users.
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'ray-x/lsp_signature.nvim'
Plug 'tomasr/molokai'
Plug 'scrooloose/nerdcommenter'
Plug 'vim-scripts/DrawIt'
Plug 'easymotion/vim-easymotion'
Plug 'mattn/emmet-vim'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'pangloss/vim-javascript'
" tagbar
" golang install go get -u github.com/jstemmer/gotags
Plug 'majutsushi/tagbar'
Plug 'w0rp/ale'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'kyazdani42/nvim-web-devicons' " for file icons
Plug 'kyazdani42/nvim-tree.lua'
Plug 'kien/tabman.vim'
" for git
Plug 'tpope/vim-fugitive'
Plug 'christoomey/vim-conflicted'
" for mark
Plug 'inkarkat/vim-ingo-library'
Plug 'inkarkat/vim-mark'
Plug 'rking/ag.vim'
Plug 'terryma/vim-multiple-cursors'
" Plug 'vim-airline/vim-airline'
Plug 'nvim-lualine/lualine.nvim'
Plug 'lukas-reineke/indent-blankline.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'codota/tabnine-nvim', { 'do': './dl_binaries.sh' }
Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
" temp plugin
Plug 'tpope/vim-surround'
Plug 'buoto/gotests-vim'
Plug 'chr4/nginx.vim'
Plug 'cespare/vim-toml'
Plug 'zah/nim.vim'
Plug 'rust-lang/rust.vim'
Plug 'danilo-augusto/vim-afterglow'
Plug 'vim-scripts/TaskList.vim'
Plug 'google/vim-jsonnet'
call plug#end()
syntax on
set number
set tabstop=2
set shiftwidth=2
set expandtab
set nofoldenable
set pastetoggle=<F2>
" always show status
set laststatus=2
" show cursor position
set ruler
set cursorline
set cursorcolumn
set hlsearch
" no wrap line
set nowrap
" enable backspace
set backspace=indent,eol,start
set encoding=utf-8
set completeopt=menu,menuone,noselect
set noswapfile
set mouse=
" set guifont=Hack\ Nerd\ Font:h11
set background=dark
function! AdaptColorscheme()
highlight clear CursorLine
highlight Normal ctermbg=none
highlight LineNr ctermbg=none
highlight Folded ctermbg=none
highlight NonText ctermbg=none
highlight SpecialKey ctermbg=none
highlight VertSplit ctermbg=none
highlight SignColumn ctermbg=none
endfunction
autocmd ColorScheme * call AdaptColorscheme()
" colorscheme turtles
" colorscheme afterglow
" define leader key
let mapleader=";"
filetype indent on
" 開啟檔案類型偵測
filetype on
" 根據檔案類型載入plugin
filetype plugin on
" split window
nmap <leader>sw <c-w>
nmap <leader>sww <c-w>k
nmap <leader>sws <c-w>j
nmap <leader>swa <c-w>h
nmap <leader>swd <c-w>l
nnoremap <leader>fl :Lines
nnoremap <leader>fb :BLines
nnoremap <leader>ff :Files
nnoremap <leader>fg :GFiles
nnoremap <leader>f? :GFiles?
nnoremap <leader>ft :Tags<cr>
nnoremap <leader>fa :Ag
nnoremap <leader>fc :Commits
nmap <leader>aa gT
nmap <leader>dd gt
nnoremap <leader>me :NvimTreeToggle<CR>
nnoremap <F3> :NvimTreeToggle<CR>
function! TabCloseRight(bang)
let cur=tabpagenr()
while cur < tabpagenr('$')
exe 'tabclose' . a:bang . ' ' . (cur + 1)
endwhile
endfunction
function! TabCloseLeft(bang)
while tabpagenr() > 1
exe 'tabclose' . a:bang . ' 1'
endwhile
endfunction
command! -bang Tabcloseright call TabCloseRight('<bang>')
command! -bang Tabcloseleft call TabCloseLeft('<bang>')
" tagbar
nmap <F8> :TagbarToggle<CR>
nmap <F9> :%!jq .<CR>
" NeoComplete
let g:neocomplete#enable_at_startup = 1
let g:airline_powerline_fonts = 1
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" s{char}{char} to move to {char}{char}
nmap s <Plug>(easymotion-overwin-f2)
" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
" Move to word
map <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)
" lint
let g:ale_linters = {
\ 'javascript': ["{{ if .nvim.js_linter }}{{- .nvim.js_linter }}{{ else }}standard{{ end }}"],
\ 'go': ['gopls'],
\ 'rust': ['analyzer'],
\}
let g:ale_fixers = {'javascript': ["{{ if .nvim.js_fixer }}{{- .nvim.js_fixer }}{{ else }}standard{{ end }}"]}
let g:ale_linters_explicit = 1
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
nmap <leader>= <Plug>(ale_fix)
" NERDCommenter
let g:NERDSpaceDelims=1
let g:NERDDefaultAlign='left'
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
" copilot setup
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
" vim-go setting
autocmd FileType go nmap <leader>err <Plug>(go-iferr)
let g:go_fmt_fail_silently = 1
let g:go_fmt_command = "goimports"
let g:go_def_mode = 'godef'
let g:go_decls_includes = "func,type"
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
" for rust-vim
let g:rust_recommended_style = 0
let g:rustfmt_autosave = 1
let g:syntastic_rust_checkers = ['cargo']
" let g:airline#extensions#tabline#enabled = 1
" let g:airline#extensions#tabline#show_buffers = 0
" let g:airline#extensions#tabline#show_splits = 0
" let g:airline#extensions#tabline#show_tabs = 1
" let g:airline#extensions#tabline#show_tab_nr = 0
" let g:airline#extensions#tabline#show_tab_type = 0
" let g:airline#extensions#tabline#close_symbol = '×'
" let g:airline#extensions#tabline#show_close_button = 0
let g:multi_cursor_use_default_mapping=0
" Default mapping
let g:multi_cursor_start_word_key = "<C-n>"
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = "g<C-n>"
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = "<C-n>"
" let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
let g:javascript_plugin_jsdoc = 1
" fzf settings
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'down': '~40%' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Enable per-command history.
" CTRL-N and CTRL-P will be automatically bound to next-history and
" previous-history instead of down and up. If you don't like the change,
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
let g:fzf_history_dir = '~/.local/share/fzf-history'
lua << EOF
require("tokyonight").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
style = "moon", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
transparent = true, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
-- Style to be applied to different syntax groups
-- Value is any valid attr-list value for `:help nvim_set_hl`
comments = { italic = true },
keywords = { italic = true },
functions = {},
variables = {},
-- Background styles. Can be "dark", "transparent" or "normal"
sidebars = "dark", -- style for sidebars, see below
floats = "dark", -- style for floating windows
},
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
dim_inactive = false, -- dims inactive windows
lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
--- You can override specific color groups to use other groups or a hex color
--- function will be called with a ColorScheme table
---@param colors ColorScheme
on_colors = function(colors) end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
---@param highlights Highlights
---@param colors ColorScheme
on_highlights = function(highlights, colors)
highlights.CursorLineNr = {
fg = colors.blue5,
bold = true,
}
highlights.LineNr = {
fg = colors.blue,
}
end,
})
vim.cmd[[colorscheme tokyonight]]
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {
{
'filename',
file_status = true,
newfile_status = true,
path = 1,
},
},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {
lualine_a = {
{
"tabs",
mode = 2,
}
},
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {}
},
winbar = {},
inactive_winbar = {},
extensions = {}
}
require('tabnine').setup({
disable_auto_comment=true,
accept_keymap="<C-J>",
dismiss_keymap = "<C-]>",
debounce_ms = 600,
suggestion_color = {gui = "#808080", cterm = 244},
exclude_filetypes = {"TelescopePrompt"}
})
vim.opt.list = true
vim.opt.listchars:append "eol:↴"
require("indent_blankline").setup {
show_end_of_line = true,
show_current_context = true,
show_current_context_start = true,
}
local nvlsp = require'lspconfig'
local lspSig = require'lsp_signature'
lspSig.setup{
hint_enable = true,
}
-- Add additional capabilities supported by nvim-cmp
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
lspSig.on_attach()
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
-- See `:help vim.lsp.*` for documentation on any of the below functions
-- buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', '<leader>gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', '<leader>gt', '<cmd>tab split<CR><cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', '<leader>gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-- buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', '<leader>gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<leader>ge', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
-- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
-- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
-- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
-- buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
nvlsp['gopls'].setup{
capabilities = capabilities,
on_attach = on_attach,
}
nvlsp['tsserver'].setup{
capabilities = capabilities,
on_attach = on_attach,
}
nvlsp['rust_analyzer'].setup{
capabilities = capabilities,
on_attach = on_attach,
}
nvlsp['bashls'].setup{
capabilities = capabilities,
on_attach = on_attach,
}
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({
-- behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
['<C-e>'] = cmp.mapping.abort(),
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
}),
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
-- require'snippy'.expand_snippet(args.body) -- For `snippy` users.
end,
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
}, {
{name = 'buffer'},
}),
}
require'nvim-tree'.setup {
auto_reload_on_write = true,
disable_netrw = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
ignore_buffer_on_setup = false,
open_on_setup = false,
open_on_setup_file = false,
open_on_tab = false,
sort_by = "name",
update_cwd = false,
view = {
width = 40,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
mappings = {
custom_only = false,
list = {
-- user mappings go here
},
},
},
renderer = {
indent_markers = {
enable = false,
icons = {
corner = "└ ",
edge = "│ ",
none = " ",
},
},
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = false,
update_cwd = false,
ignore_list = {},
},
ignore_ft_on_setup = {},
system_open = {
cmd = nil,
args = {},
},
filters = {
dotfiles = false,
custom = {},
exclude = {},
},
git = {
enable = true,
ignore = true,
timeout = 400,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
},
open_file = {
quit_on_open = false,
resize_window = false,
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
}
EOF
+2
View File
@@ -0,0 +1,2 @@
require("basic.setup")
require('basic.mapping')
@@ -0,0 +1,27 @@
-- HELPERS ----------------------------------------------------
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
local g = vim.g -- a table to access global variables
local keymap = vim.keymap -- keymap
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
g.mapleader = ';'
keymap.set('n', '<leader>sw', '<c-w>')
keymap.set('n', '<leader>sww', '<c-w>k')
keymap.set('n', '<leader>sws', '<c-w>j')
keymap.set('n', '<leader>swa', '<c-w>h')
keymap.set('n', '<leader>swd', '<c-w>l')
keymap.set('n', '<leader><leader>a', 'gT')
keymap.set('n', '<leader><leader>d', 'gt')
keymap.set('n', '<F9>', ':%!jq .<CR>')
keymap.set('n', '<leader>sg', ':lua vim.diagnostic.open_float(0, {scope="line"})<CR>')
if vim.api.nvim_win_get_option(0, "diff") then
keymap.set('n', '<leader>1', ':diffget LOCAL<CR>')
keymap.set('n', '<leader>2', ':diffget REMOTE<CR>')
keymap.set('n', '<leader>3', ':%diffget LOCAL<CR>')
end
+66
View File
@@ -0,0 +1,66 @@
-- HELPERS ----------------------------------------------------
local opt = vim.opt
-- SYNTAX & FILETYPE ------------------------------------------
vim.cmd "syntax on"
vim.cmd "filetype plugin indent on"
-- BASIC SETTINGS ---------------------------------------------
opt.number = true -- 顯示行號
opt.relativenumber = true -- 顯示相對行號
opt.tabstop = 2 -- Tab 寬度
opt.shiftwidth = 2 -- 縮排寬度
opt.expandtab = true -- 將 Tab 轉為空格
opt.foldenable = false -- 預設不折疊
opt.laststatus = 2 -- 始終顯示狀態列
opt.ruler = true -- 顯示游標位置
opt.cursorline = true -- 高亮當前行
opt.cursorcolumn = true -- 高亮當前列
opt.hlsearch = true -- 高亮搜尋結果
opt.wrap = false -- 不自動換行
opt.backspace = { "indent", "eol", "start" }
opt.encoding = "utf-8"
opt.completeopt = { "menu", "menuone", "noselect" }
opt.swapfile = false -- 不產生 swap 檔案
opt.mouse = "" -- 禁用滑鼠
opt.background = "dark"
-- 自動命令 (Auto-commands) -----------------------------------
-- 處理配色方案與背景透明度
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "*",
callback = function()
vim.cmd([[
highlight clear CursorLine
highlight Normal ctermbg=none
highlight LineNr ctermbg=none
highlight Folded ctermbg=none
highlight NonText ctermbg=none
highlight SpecialKey ctermbg=none
highlight VertSplit ctermbg=none
highlight SignColumn ctermbg=none
]])
end,
})
-- chezmoi 自動套用
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = vim.fn.expand("~/.local/share/chezmoi/*"),
command = [[ ! chezmoi apply --source-path % ]],
})
-- 診斷設定
vim.diagnostic.config({ virtual_text = false, signs = true })
-- 特定語言設定
vim.api.nvim_create_autocmd("FileType", {
pattern = "rust",
callback = function()
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
end
})
@@ -0,0 +1,48 @@
return {
"stevearc/aerial.nvim",
keys = {
{'<F8>', '<cmd>AerialToggle<CR>', desc = 'toggle aerial window', mode = 'n'},
},
opts = {
backends = {"lsp", "treesitter"},
-- optionally use on_attach to set keymaps when aerial has attached to a buffer
on_attach = function(bufnr)
-- Jump forwards/backwards with '{' and '}'
vim.keymap.set('n', '{', '<cmd>AerialPrev<CR>', {buffer = bufnr})
vim.keymap.set('n', '}', '<cmd>AerialNext<CR>', {buffer = bufnr})
end,
-- filter_kind = false,
filter_kind = {
"Class",
"Constructor",
"Enum",
"Function",
"Interface",
"Module",
"Method",
"Struct",
"Variable",
"Namespace",
"Package",
"Field",
"Constant",
},
--manage_folds = true,
link_tree_to_folds = false,
-- Show box drawing characters for the tree hierarchy
show_guides = true,
-- Customize the characters used when show_guides = true
guides = {
-- When the child item has a sibling below it
mid_item = "├─",
-- When the child item is the last in the list
last_item = "└─",
-- When there are nested child guides to the right
nested_top = "",
-- Raw indentation
whitespace = " ",
},
}
}
@@ -0,0 +1,31 @@
return {
"w0rp/ale",
lazy = false,
keys = {
{'<leader>=', '<Plug>(ale_fix)', mode = 'n'},
},
config = function ()
local g = vim.g
g.ale_linters = {
javascript = {'{{ if .nvim.js_linter }}{{ .nvim.js_linter }}{{ else }}eslint{{ end }}'},
typescript = {'{{ if .nvim.js_linter }}{{ .nvim.js_linter }}{{ else }}eslint{{ end }}'},
go = {'gopls'},
rust = {'analyzer'},
sh = {'shellcheck'},
zig = {'zls'},
}
g.ale_fixers = {
javascript = {'{{ if .nvim.js_fixer }}{{ .nvim.js_fixer }}{{ else }}eslint{{ end }}'},
typescript = {'{{ if .nvim.js_fixer }}{{ .nvim.js_fixer }}{{ else }}eslint{{ end }}'},
zig = {'zigfmt'},
c = {'clang-format'},
sh = {'shfmt'},
}
g.ale_linters_explicit = 1
g.ale_lint_on_save = 1
g.ale_fix_on_save = 1
end
}
@@ -0,0 +1,10 @@
return {
"akinsho/bufferline.nvim",
version = "v4.*",
opts = {
options = {
mode = 'tabs',
diagnostics = 'nvim_lsp',
},
},
}
@@ -0,0 +1,81 @@
return {
"olimorris/codecompanion.nvim",
opts = {},
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
{
"MeanderingProgrammer/render-markdown.nvim",
ft = { "markdown", "codecompanion" }
},
{
"echasnovski/mini.diff",
config = function()
local diff = require("mini.diff")
diff.setup({
-- Disabled by default
source = diff.gen_source.none(),
})
end,
},
{
"HakonHarnes/img-clip.nvim",
opts = {
filetypes = {
codecompanion = {
prompt_for_file_name = false,
template = "[Image]($FILE_PATH)",
use_absolute_path = true,
},
},
},
},
},
config = function ()
local codecompanion = require("codecompanion")
codecompanion.setup({
ignore_warnings = true,
display = {
action_palette = {
width = 95,
height = 10,
prompt = "Prompt ",
provider = "default",
opts = {
show_default_actions = true,
show_default_prompt_library = true,
title = "CodeCompanion actions",
},
},
},
memory = {
opts = {
chat = { enabled = true, },
},
},
strategies = {
chat = {
adapter = "copilot",
},
inline = {
adapter = "copilot",
},
},
adapters = {
http = {
copilot = function()
return require('codecompanion.adapters').extend('copilot', {
schema = {
model = {
default = 'claude-sonnet-4.5',
-- default = 'claude-haiku-4.5',
},
},
})
end,
}
},
})
end,
}
+42
View File
@@ -0,0 +1,42 @@
return {
"junegunn/fzf.vim",
dependencies = {
"junegunn/fzf",
},
config = function ()
local g = vim.g
local keymap = vim.keymap
g.fzf_action = {
['ctrl-t'] = 'tab split',
['ctrl-x'] = 'split',
['ctrl-v'] = 'vsplit',
}
g.fzf_colors = {
fg = {'fg', 'Normal'},
bg = {'bg', 'Normal'},
hl = {'fg', 'Comment'},
['fg+'] = {'fg', 'CursorLine', 'CursorColumn', 'Normal'},
['bg+'] = {'bg', 'CursorLine', 'CursorColumn'},
['hl+'] = {'fg', 'Statement'},
info = {'fg', 'PreProc'},
prompt = {'fg', 'Conditional'},
pointer = {'fg', 'Exception'},
marker = {'fg', 'Keyword'},
spinner = {'fg', 'Label'},
header = {'fg', 'Comment'},
}
g.fzf_history_dir = '~/.local/share/fzf-history'
keymap.set('n', '<leader>fl', ':Lines ')
keymap.set('n', '<leader>fb', ':BLines ')
keymap.set('n', '<leader>ff', ':Files ')
keymap.set('n', '<leader>fg', ':GFiles ')
keymap.set('n', '<leader>f?', ':GFiles? ')
keymap.set('n', '<leader>ft', ':Tags<cr>')
keymap.set('n', '<leader>fa', ':Ag ')
keymap.set('n', '<leader>fc', ':Commits ')
end
}
+31
View File
@@ -0,0 +1,31 @@
return {
"fatih/vim-go",
lazy = false,
keys = {},
config = function ()
vim.api.nvim_create_autocmd("FileType", {
pattern = 'go',
callback = function ()
vim.keymap.set('n', '<leader>err', '<Plug>(go-iferr)')
end
})
local g = vim.g
g.go_gopls_enabled = 0
g.go_def_mapping_enabled = 0
g.go_code_completion_enabled = 0
g.go_doc_keywordprg_enabled = 0
g.go_fmt_fail_silently = 1
g.go_fmt_command = "goimports"
g.go_def_mode = ''
g.go_info_mode = ''
g.go_decls_includes = "func,type"
g.go_highlight_types = 1
g.go_highlight_fields = 1
g.go_highlight_functions = 1
g.go_highlight_function_calls = 1
g.go_highlight_operators = 1
g.go_highlight_extra_types = 1
end
}
+19
View File
@@ -0,0 +1,19 @@
return {
"phaazon/hop.nvim",
config = function ()
local hop = require('hop')
local keymap = vim.keymap
hop.setup()
keymap.set('', '<leader><leader>f', function ()
hop.hint_char1()
end)
keymap.set('', '<leader><leader>s', function ()
hop.hint_char2()
end)
keymap.set('', '<leader><leader>w', function ()
hop.hint_words()
end)
end
}
@@ -0,0 +1,11 @@
return {
"lukas-reineke/indent-blankline.nvim",
opts = {
show_end_of_line = true,
show_current_context = true,
show_current_context_start = true,
},
config = function ()
vim.opt.list = true
end
}
+18
View File
@@ -0,0 +1,18 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup("plugins.list", {
defaults = {
lazy = false
},
})
+153
View File
@@ -0,0 +1,153 @@
return {
require('plugins.nvim_cmp'),
require('plugins.lsp'),
{
"ray-x/lsp_signature.nvim",
opts = {
hint_enable = true,
},
},
{
"scrooloose/nerdcommenter",
config = function ()
vim.g.NERDSpaceDelims=1
vim.g.NERDDefaultAlign='left'
end
},
"vim-scripts/DrawIt",
-- easymotion alternative
require('plugins.hop'),
require('plugins.ale'),
"mattn/emmet-vim",
require('plugins.go'),
{
"pangloss/vim-javascript",
config = function ()
vim.g.javascript_plugin_jsdoc = 1
end
},
"godlygeek/tabular",
"plasticboy/vim-markdown",
-- fzf
require('plugins.fzf'),
"kyazdani42/nvim-web-devicons",
require('plugins.nvim_tree'),
"kien/tabman.vim",
-- for git
"tpope/vim-fugitive",
"christoomey/vim-conflicted",
"sindrets/diffview.nvim",
-- for mark
"inkarkat/vim-ingo-library",
"inkarkat/vim-mark",
"rking/ag.vim",
{
"terryma/vim-multiple-cursors",
config = function ()
local g = vim.g
g.multi_cursor_use_default_mapping=0
-- Default mapping
g.multi_cursor_start_word_key = "<C-n>"
g.multi_cursor_select_all_word_key = '<A-n>'
g.multi_cursor_start_key = "g<C-n>"
g.multi_cursor_select_all_key = 'g<A-n>'
g.multi_cursor_next_key = "<C-n>"
g.multi_cursor_skip_key = '<C-x>'
g.multi_cursor_quit_key = '<Esc>'
end
},
require('plugins.lualine'),
require('plugins.bufferline'),
--require('plugins.indent_blankline'),
{
"nvim-treesitter/nvim-treesitter",
branch = "main",
},
{
"bluz71/vim-nightfly-colors",
config = function ()
vim.g.nightflyTransparent = true
vim.cmd[[ colorscheme nightfly ]]
end
},
{
"folke/tokyonight.nvim",
branch = "main",
},
"norcalli/nvim-colorizer.lua",
-- code outline
require('plugins.aerial'),
"tpope/vim-surround",
-- "buoto/gotests-vim",
"cespare/vim-toml",
{
"rust-lang/rust.vim",
config = function ()
local g = vim.g
g.rust_recommended_style = 0
g.rustfmt_autosave = 1
g.syntastic_rust_checkers = {'cargo'}
end
},
"vim-scripts/TaskList.vim",
"google/vim-jsonnet",
{
"github/copilot.vim",
keys = {
{'<c-j>', 'copilot#Accept("<CR>")', mode = 'i', silent = true, expr = true, noremap = true, replace_keycodes = false},
},
lazy = false,
init = function ()
vim.g.copilot_no_tab_map = true
end
},
-- temp plugins
"elkowar/yuck.vim",
"towolf/vim-helm",
"evanleck/vim-svelte",
"AndrewRadev/linediff.vim",
-- themes
"tomasr/molokai",
{
"vimwiki/vimwiki",
init = function ()
vim.g.vimwiki_list = {
{
path = '~/vimwiki/',
syntax = 'markdown',
ext = '.md',
custom_wiki2html = "~/bin/wiki2html.sh",
}
}
end
},
-- require('plugins.vim-ai'),
-- ai 助手
-- require('plugins.avante'),
require('plugins.codecompanion'),
}
+60
View File
@@ -0,0 +1,60 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
},
config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- 統一處理 LspAttach (當 LSP 連接到緩衝區時觸發)
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
local bufnr = ev.buf
local client = vim.lsp.get_client_by_id(ev.data.client_id)
-- 啟動 lsp_signature
require('lsp_signature').on_attach({}, bufnr)
-- 啟用 omnifunc
vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- 按鍵對映優化
local opts = { buffer = bufnr, noremap = true, silent = true }
local map = vim.keymap.set
map('n', '<leader>gd', vim.lsp.buf.definition, opts)
map('n', '<leader>gt', '<cmd>tab split<CR><cmd>lua vim.lsp.buf.definition()<CR>', opts)
map('n', '<leader>gv', '<cmd>vsplit<CR><cmd>lua vim.lsp.buf.definition()<CR>', opts)
map('n', 'K', vim.lsp.buf.hover, opts)
map('n', '<leader>gi', vim.lsp.buf.implementation, opts)
map('n', '<C-k>', vim.lsp.buf.signature_help, opts)
map('n', '<leader>D', vim.lsp.buf.type_definition, opts)
map('n', '<leader>rn', vim.lsp.buf.rename, opts)
map('n', '<leader>ca', vim.lsp.buf.code_action, opts)
map('n', '<leader>gr', vim.lsp.buf.references, opts)
map('n', '<leader>ge', vim.diagnostic.open_float, opts) -- 使用現代 API
map('n', '<leader>do', vim.diagnostic.open_float, opts)
map('n', '<leader>d[', vim.diagnostic.goto_prev, opts)
map('n', '<leader>d]', vim.diagnostic.goto_next, opts)
map('n', '<leader>gf', function() vim.lsp.buf.format { async = true } end, opts)
end,
})
-- 伺服器列表
local servers = {
'gopls', 'ts_ls', 'rust_analyzer', 'bashls', 'svelte',
'pylsp', 'zls', 'lua_ls', 'clangd', 'pyright'
}
-- 批量配置伺服器能力
for _, lsp in ipairs(servers) do
vim.lsp.config(lsp, {
capabilities = capabilities,
})
end
-- 批量啟用伺服器
vim.lsp.enable(servers)
end
}
@@ -0,0 +1,54 @@
return {
"nvim-lualine/lualine.nvim",
opts = {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {
{
'filename',
file_status = true,
newfile_status = true,
path = 1,
},
},
lualine_x = {
function()
return require('nvim-treesitter').statusline({
})
end,
'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
winbar = {},
inactive_winbar = {},
extensions = {}
}
}
@@ -0,0 +1,40 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
-- for vsnip users
"hrsh7th/cmp-vsnip",
"hrsh7th/vim-vsnip",
},
opts = function ()
local cmp = require('cmp')
return {
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({
-- behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
['<C-e>'] = cmp.mapping.abort(),
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
}),
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
-- require'snippy'.expand_snippet(args.body) -- For `snippy` users.
end,
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
}, {
{name = 'buffer'},
}),
}
end
}
@@ -0,0 +1,72 @@
return {
"nvim-tree/nvim-tree.lua",
keys = {
{"<leader>me", '<cmd>NvimTreeToggle<CR>', desc = 'open / close nvim tree', mode = 'n'},
{"<F3>", '<cmd>NvimTreeToggle<CR>', desc = 'open / close nvim tree', mode = 'n'}
},
opts = {
disable_netrw = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
sort = {
sorter = "name",
},
view = {
width = 40,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
},
renderer = {
indent_markers = {
enable = false,
icons = {
corner = "",
edge = "",
item = "",
none = " ",
},
},
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = false,
update_root = false,
ignore_list = {},
},
filters = {
dotfiles = false,
custom = {},
exclude = {},
},
git = {
enable = true,
ignore = true,
timeout = 400,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
},
open_file = {
quit_on_open = true,
resize_window = false,
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
}
}
@@ -0,0 +1,99 @@
return {
"madox2/vim-ai",
config = function ()
vim.g.vim_ai_roles_config_file = '/home/jay/.config/nvim/vim-ai-roles.ini'
local vim_ai_endpoint_url = "http://localhost:11434/v1/chat/completions"
-- local vim_ai_endpoint_url = "http://192.168.88.11:11434/v1/chat/completions"
local vim_ai_model = "gemma3:12b"
local vim_ai_model_large = "deepseek-r1"
local vim_ai_temperature = 0.3
local vim_ai_chat_config = {
engine = "chat",
options = {
model = vim_ai_model,
temperature = vim_ai_temperature,
endpoint_url = vim_ai_endpoint_url,
auth_type = "none",
max_tokens = 0,
request_timeout = 180,
},
ui = {
code_syntax_enabled = 1,
},
}
local vim_ai_edit_config = {
engine = "chat",
options = {
model = vim_ai_model,
temperature = vim_ai_temperature,
endpoint_url = vim_ai_endpoint_url,
auth_type = "none",
max_tokens = 0,
request_timeout = 180,
},
ui = {
paste_mode = 1,
},
}
vim.g.vim_ai_chat = vim_ai_chat_config
vim.g.vim_ai_complete = vim_ai_edit_config
vim.g.vim_ai_edit = vim_ai_edit_config
function git_commit_message_fn(model, intent)
model = model or vim_ai_model
intent = intent or ""
local diff = vim.fn.system('git --no-pager diff --staged')
local initial_prompt = [[
You are a Senior Software Engineer responsible for crafting clear and informative Git commit messages. Your goal is to ensure that every commit message contributes to the maintainability and understandability of the codebase. A well-written commit message allows other developers to quickly grasp the purpose and impact of the changes.
**Here's the structure we'll use for all commit messages:**
1. **Subject Line (Required):**
* Use a conventional prefix: `feat:`, `fix:`, `chore:`, `refactor:`, `docs:`, `test:`, `style:`, `perf:`, `build:`
* Keep it concise 50 characters or less.
* Use an imperative verb (e.g., "Add...", "Fix...", "Update...", "Remove...").
2. **Body (Optional, but recommended):**
* Start with a blank line after the subject line.
* Provide a brief explanation (3-4 bullet points) of *why* the change was made, not *what* was changed.
* Keep lines under 72 characters.
* Avoid implementation details.
**Do not include:** Markdown, emojis, or overly detailed code descriptions.
]]
local prompt = [["\n" .. "**Now, generate a Git commit message based on the following changes:**\n```" ]] .. diff .. [[```]]
local range = 0
if not (intent == "")
then
prompt = [[Short Description:\n"]] .. intent .. prompt
end
local config = {
engine = "chat",
options = {
model = model,
initial_prompt = initial_prompt,
endpoint_url = vim_ai_endpoint_url,
auth_type = "none",
temperature = 0.8,
request_timeout = 240,
},
}
vim.api.nvim_call_function("vim_ai#AIRun", { range, config, prompt })
end
vim.api.nvim_create_user_command("GitCommitMessage", function(opts)
git_commit_message_fn(vim_ai_model, opts.args)
end, {nargs = '?'})
vim.api.nvim_create_user_command("GitCommitMessageL", function(opts)
git_commit_message_fn(vim_ai_model_large, opts.args)
end, {nargs = '?'})
end
}
+5 -1
View File
@@ -153,7 +153,7 @@ multiline_continuation_char = ''
null_string = '<null>' null_string = '<null>'
# manage pager on startup # manage pager on startup
enable_pager = True enable_pager = False
# Use keyring to automatically save and load password in a secure manner # Use keyring to automatically save and load password in a secure manner
keyring = True keyring = True
@@ -200,9 +200,13 @@ output.null = "#808080"
[alias_dsn] [alias_dsn]
# example_dsn = postgresql://[user[:password]@][netloc][:port][/dbname] # example_dsn = postgresql://[user[:password]@][netloc][:port][/dbname]
local = postgresql://postgres:chuxu7ec@localhost local = postgresql://postgres:chuxu7ec@localhost
home-lab = postgresql://postgres:pass.ok=1@192.168.200.16
ln-prod = postgresql://postgres:CyMrS127VIx@10.140.0.90 ln-prod = postgresql://postgres:CyMrS127VIx@10.140.0.90
ln-lab = postgresql://postgres:eKZJFdG9L5vaREXN@192.168.88.15:32014
professorx-dev = postgresql://postgres:e8b960296e22@192.168.88.6 professorx-dev = postgresql://postgres:e8b960296e22@192.168.88.6
k8s-gcp-dev = postgresql://postgres:eKZJFdG9L5vaREXN@10.140.0.51:32008 k8s-gcp-dev = postgresql://postgres:eKZJFdG9L5vaREXN@10.140.0.51:32008
k8s-log-collector = postgresql://postgres:j88ArUndbrAe@192.168.88.23:5432
lab-pg = postgresql://postgres:f87fa2a74009f9b63acf65762b89b411@192.168.200.71:32750
# Format for number representation # Format for number representation
# for decimal "d" - 12345678, ",d" - 12,345,678 # for decimal "d" - 12345678, ",d" - 12,345,678
+24
View File
@@ -0,0 +1,24 @@
# vim: ft=swayconfig
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
input type:touchpad {
drag enabled
drag_lock enabled
tap enabled
scroll_factor 0.6
}
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
+171
View File
@@ -0,0 +1,171 @@
# vim: ft=swayconfig
### Key bindings
#
# Basics:
#
bindsym $alt+Shift+c exec ~/bin/screenshot
bindsym $alt+Shift+m exec ~/bin/screenshot-monitor
# Start a terminal
bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+Shift+q kill
# Find cursor
bindsym $mod+Shift+f exec ~/.config/sway/scripts/scale-cursor.sh $cursor_theme $cursor_big_size $cursor_size
# Start your launcher
bindsym $mod+d exec $menu
bindsym $alt+space exec $menu
bindsym $mod+Shift+w exec $window_switcher
bindsym $mod+w exec $window_workspace_switcher
bindsym $mod+Shift+v exec ~/.config/wofi/wofi-control-panel.sh
bindsym $mod+Shift+t exec ~/.config/wofi/wofi-totp-menu.sh
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
bindsym $mod+Shift+x exec swaylock -f -i ~/.config/sway/bg2.png -s fill
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
bindsym $mod+Shift+p exec ~/.config/wofi/wofi-power.sh
bindsym XF86AudioRaiseVolume exec "pactl set-sink-volume @DEFAULT_SINK@ +5%; pkill -RTMIN+8 waybar"
bindsym XF86AudioLowerVolume exec "pactl set-sink-volume @DEFAULT_SINK@ -5%; pkill -RTMIN+8 waybar"
bindsym XF86AudioMute exec "pactl set-sink-mute @DEFAULT_SINK@ toggle; pkill -RTMIN+8 waybar"
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym XF86MonBrightnessUp exec "brightnessctl set 5%+"
bindsym XF86MonBrightnessDown exec "brightnessctl set 5%-"
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+t layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# show sov
#bindsym --no-repeat $mod+Shift+w exec "echo 1 > /tmp/sovpipe"
#bindsym --release $mod+Shift+w exec "echo 0 > /tmp/sovpipe"
# show bindsym help
bindsym $mod+Ctrl+h exec cat ~/.config/sway/conf.d/keybinding.conf |grep bindsym |grep -v "#"| sed 's/^[[:space:]]*//'| wofi --dmenu
+13
View File
@@ -0,0 +1,13 @@
# vim: ft=swayconfig
output eDP-1 scale 1.3
# set workspace monitor
workspace 1 output eDP-1
workspace 2 output eDP-1
workspace 3 output eDP-1
workspace 4 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 5 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 6 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 7 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 8 output HDMI-A-1 DP-1 DP-9 eDP-1
workspace 9 output eDP-1
workspace 10 output eDP-1
+43 -206
View File
@@ -4,6 +4,8 @@
# #
# Read `man 5 sway` for a complete reference. # Read `man 5 sway` for a complete reference.
font Agave Nerd Font 12
### Variables ### Variables
# #
# Logo key. Use Mod1 for Alt. # Logo key. Use Mod1 for Alt.
@@ -15,18 +17,27 @@ set $down j
set $up k set $up k
set $right l set $right l
# Your preferred terminal emulator # Your preferred terminal emulator
set $term env WINIT_UNIX_BACKEND=x11 alacritty # set $term env WAYLAND_DISPLAY= WINIT_X11_SCALE_FACTOR=1.0 alacritty
# set $term alacritty
set $term ghostty
# set $term env WAYLAND_DISPLAY= WINIT_X11_SCALE_FACTOR=1.0 WINIT_UNIX_BACKEND=x11 alacritty
# Your preferred application launcher # Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened # Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on. # on the original workspace that the command was run on.
# set $menu dmenu_path | dmenu | xargs swaymsg exec -- # set $menu dmenu_path | dmenu | xargs swaymsg exec --
set $menu wofi --show drun set $menu wofi --show drun
set $window_switcher ~/.config/wofi/wofi-window-switch.sh
set $window_workspace_switcher ~/.config/wofi/wofi-current-workspace.sh
set $cursor_theme Sweet-cursors
set $cursor_size 24
set $cursor_big_size 64
### Output configuration ### Output configuration
# #
# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) # Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/)
# output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
output * bg ~/.config/sway/bg.png fill output * bg /home/jay/.config/sway/wallpaper.png fill
# #
# Example configuration: # Example configuration:
# #
@@ -34,231 +45,56 @@ output * bg ~/.config/sway/bg.png fill
# #
# You can get the names of your outputs by running: swaymsg -t get_outputs # You can get the names of your outputs by running: swaymsg -t get_outputs
exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
# exec systemctl --user restart xdg-desktop-portal xdg-desktop-portal-wlr
# exec_always xdg-desktop-portal -r # exec_always xdg-desktop-portal -r
# exec_always xdg-desktop-portal-wlr # exec_always /usr/libexec/xdg-desktop-portal-wlr
exec --no-startup-id dbus-update-activation-environment --all # exec env XDG_CONFIG_HOME=/home/jay/.config gentoo-pipewire-launcher restart &
exec_always kanshi exec_always kanshi
exec dex -a -e sway exec dex -a -e sway -s /etc/xdg/autostart/:~/.config/autostart/
exec mako
exec udiskie -t
exec_always ~/.config/eww/open-main.sh
# for sway overview # for sway overview
# exec_always rm -f /tmp/sovpipe && mkfifo /tmp/sovpipe && tail -f /tmp/sovpipe | sov -t 100 #exec_always rm -f /tmp/sovpipe && mkfifo /tmp/sovpipe && tail -f /tmp/sovpipe | sov -t 100
### Idle configuration ### Idle configuration
# #
# Example configuration: # Example configuration:
# #
exec swayidle -w \ exec swayidle -w \
timeout 300 'swaylock -f -i ~/.config/swaylock/bg.png -s fill' \ timeout 300 'swaylock -f -i ~/.config/sway/bg2.png -s fill' \
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
before-sleep 'swaylock -f -i ~/.config/swaylock/bg.png -s fill' before-sleep 'swaylock -f -i ~/.config/sway/bg2.png -s fill'
# This will lock your screen after 300 seconds of inactivity, then turn off # This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when # your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep. # resumed. It will also lock your screen before your computer goes to sleep.
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
input type:touchpad {
drag enabled
drag_lock enabled
tap enabled
scroll_factor 0.6
}
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
### Key bindings
#
# Basics:
#
bindsym $alt+Shift+c exec ~/bin/screenshot
bindsym $alt+Shift+m exec ~/bin/screenshot-monitor
# Start a terminal
bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+Shift+q kill
# Start your launcher
bindsym $mod+d exec $menu
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
bindsym $mod+Shift+x exec swaylock -f -i ~/.config/swaylock/bg.png -s fill
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
bindsym $mod+Shift+p exec ~/.config/wofi/wofi-power.sh
bindsym XF86AudioRaiseVolume exec "pactl set-sink-volume @DEFAULT_SINK@ +10%; pkill -RTMIN+8 waybar"
bindsym XF86AudioLowerVolume exec "pactl set-sink-volume @DEFAULT_SINK@ -10%; pkill -RTMIN+8 waybar"
bindsym XF86AudioMute exec "pactl set-sink-mute @DEFAULT_SINK@ toggle; pkill -RTMIN+8 waybar"
bindsym XF86MonBrightnessUp exec "/home/jay/bin/backlight-control --path /sys/class/backlight/intel_backlight set +10%"
bindsym XF86MonBrightnessDown exec "/home/jay/bin/backlight-control --path /sys/class/backlight/intel_backlight set -- -10%"
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# set workspace monitor
workspace 1 output eDP-1
workspace 2 output HDMI-A-1 DP-1 eDP-1
workspace 3 output HDMI-A-1 DP-1 eDP-1
workspace 4 output HDMI-A-1 DP-1 eDP-1
workspace 5 output HDMI-A-1 DP-1 eDP-1
workspace 6 output HDMI-A-1 DP-1 eDP-1
workspace 7 output eDP-1
workspace 8 output eDP-1
workspace 9 output eDP-1
workspace 10 output eDP-1
# #
# Status Bar: # Status Bar:
# #
# Read `man 5 sway-bar` for more information about this section. # Read `man 5 sway-bar` for more information about this section.
bar { # bar {
# position top # # position top
# When the status_command prints a new line to stdout, swaybar updates. # # When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time. # # The default just shows the current date and time.
# status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done # # status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
# status_command ~/.config/waybar/launch.sh # # status_command ~/.config/waybar/launch.sh
swaybar_command waybar # swaybar_command waybar
colors { # colors {
statusline #ffffff # statusline #ffffff
background #323232 # background #323232
inactive_workspace #32323200 #32323200 #5c5c5c # inactive_workspace #32323200 #32323200 #5c5c5c
} # }
# }
seat seat0 {
xcursor_theme Adwaita 24
} }
gaps outer 5 gaps outer 5
@@ -268,9 +104,10 @@ gaps inner 5
for_window [app_id="^.*"] border pixel 4 for_window [app_id="^.*"] border pixel 4
for_window [class="^.*"] border pixel 4 for_window [class="^.*"] border pixel 4
for_window [workspace=8] floating enable for_window [workspace=8] floating enable
for_window [workspace=6] floating enable for_window [workspace=9] floating enable
focus_follows_mouse no focus_follows_mouse no
xwayland enable xwayland enable
# include @sysconfdir@/sway/config.d/* # include @sysconfdir@/sway/config.d/*
include ~/.config/sway/conf.d/*
@@ -0,0 +1,6 @@
#!/bin/bash
cursorTheme=$(swaymsg -t get_inputs | jq -r '.[] | select(.type == "pointer") | .xcursor_theme' | head -n 1)
echo "Current cursor theme: $cursorTheme"
# swaymsg "seat seat0 xcursor_theme "
@@ -0,0 +1,15 @@
#!/bin/bash
# usage: scale-cursor.sh <cursor-theme> <bigSize> <originalSize>
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <cursor-theme> <bigSize> <originalSize>"
exit 1
fi
CURSOR_THEME="$1"
BIG_SIZE="$2"
ORIGINAL_SIZE="$3"
swaymsg "seat seat0 xcursor_theme $CURSOR_THEME $BIG_SIZE"
sleep 1
swaymsg "seat seat0 xcursor_theme $CURSOR_THEME $ORIGINAL_SIZE"
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

+45 -92
View File
@@ -1,36 +1,28 @@
// vim: set ft=jsonc: // vim: set ft=jsonc :
{ {
// "layer": "top", // Waybar at top layer "layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right) "position": "top", // Waybar position (top|bottom|left|right)
"height": 30, // Waybar height (to be removed for auto height) // "height": 30, // Waybar height (to be removed for auto height)
"margin": "3 3 0 3",
// "width": 1280, // Waybar width // "width": 1280, // Waybar width
"spacing": 2, // Gaps between modules (4px) // "spacing": 1, // Gaps between modules (4px)
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"], // "modules-left": ["wlr/workspaces", "custom/sep", "hyprland/window", "hyprland/submap"],
"modules-center": [], "modules-left": ["sway/workspaces", "custom/sep", "sway/window", "sway/mode"],
"modules-center": ["clock"],
"modules-right": [ "modules-right": [
"idle_inhibitor", "idle_inhibitor",
"custom/sep", "custom/sep",
"custom/pipewire",
"custom/sep",
"network", "network",
"custom/sep", "custom/sep",
"bluetooth",
"custom/sep",
"custom/pipewire",
"cpu", "cpu",
"custom/sep",
"memory", "memory",
"custom/sep",
"disk",
"custom/sep",
"temperature",
"custom/sep",
"backlight", "backlight",
"custom/sep",
"keyboard-state",
"custom/sep",
"battery", "battery",
"custom/sep", "custom/sep",
"clock",
"custom/sep",
"tray" "tray"
], ],
// Modules configuration // Modules configuration
@@ -39,9 +31,17 @@
"interval": "once", "interval": "once",
"tooltip": false "tooltip": false
}, },
"wlr/workspaces": {
"format": "{name}",
// "on-click": "activate",
"disable-scroll": true
},
"sway/window": {
"max-length": 100
},
"custom/pipewire": { "custom/pipewire": {
"exec": "/home/jay/bin/get-volume.sh", "exec": "/home/jay/bin/get-volume.sh",
"interval": "once", "interval": 2,
"return-type": "json", "return-type": "json",
"signal": 8, "signal": 8,
"format": "{icon} {percentage}%", "format": "{icon} {percentage}%",
@@ -51,61 +51,19 @@
}, },
"on-click": "pavucontrol" "on-click": "pavucontrol"
}, },
"sway/window": { "hyprland/window": {
"max-length": 40 "max-length": 30
}, },
"sway/workspaces": { "hyprland/submap": {
"disable-scroll": true, "format": "{}",
// "all-outputs": true, "tooltip": false
// "persistent_workspaces": {
// "1": [],
// "2": [],
// "3": [],
// "4": [],
// "5": [],
// "6": [],
// "7": [],
// "8": [],
// "9": [],
// "10": [],
// },
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
},
"keyboard-state": {
// "numlock": true,
"capslock": true,
"format": "{name} {icon}",
"format-icons": {
"locked": "",
"unlocked": ""
}
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"sway/scratchpad": {
"format": "{icon} {count}",
"show-empty": false,
"format-icons": ["", ""],
"tooltip": true,
"tooltip-format": "{app}: {title}"
}, },
"idle_inhibitor": { "idle_inhibitor": {
"format": "{icon}", "format": "{icon}",
"format-icons": { "format-icons": {
"activated": "", "activated": "",
"deactivated": "" "deactivated": ""
} }
}, },
"tray": { "tray": {
// "icon-size": 21, // "icon-size": 21,
@@ -115,23 +73,23 @@
"clock": { "clock": {
// "timezone": "America/New_York", // "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>", "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format": "{:%Y-%m-%d %H:%M:%S}", "format": "{:%Y-%m-%d %H:%M:%S %a}",
"format-alt": "{:%Y-%m-%d}", "format-alt": "{:%Y-%m-%d}",
"interval": 1 "interval": 1
}, },
"cpu": { "cpu": {
"format": " {usage}%({load})", "format": " {usage}%({load})",
"interval": 2, "interval": 2,
"tooltip": false "tooltip": false
}, },
"memory": { "memory": {
"interval": 10, "interval": 10,
"format": " {used}G/{total}G", "format": " {used}G",
"tooltip-format": "{percentage}% used" "tooltip-format": "{percentage}% used"
}, },
"temperature": { "temperature": {
// "thermal-zone": 2, // "thermal-zone": 2,
"hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon4/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}", // "format-critical": "{temperatureC}°C {icon}",
"format": " {temperatureC}°C", "format": " {temperatureC}°C",
@@ -143,21 +101,21 @@
"format-icons": ["", "", "", "", "", "", "", "", ""] "format-icons": ["", "", "", "", "", "", "", "", ""]
}, },
"battery": { "battery": {
"states": { "states": {
// "good": 95, // "good": 95,
"warning": 30, "warning": 30,
"critical": 15 "critical": 15
}, },
"format": "{capacity}% {icon}", "format": "{icon} {capacity}%",
"format-charging": "{capacity}%", "format-charging": "󰂄 {capacity}%",
"format-plugged": "{capacity}%", "format-plugged": "{capacity}%",
"format-alt": "{time} {icon}", "format-alt": "{icon} {time}",
// "format-good": "", // An empty format will hide the module // "format-good": "", // An empty format will hide the module
// "format-full": "", // "format-full": "",
"format-icons": ["", "", "", "", ""] "format-icons": ["", "", "", "", ""]
}, },
"battery#bat2": { "battery#bat2": {
"bat": "BAT2" "bat": "BAT2"
}, },
"network": { "network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface // "interface": "wlp2*", // (Optional) To force the use of this interface
@@ -167,11 +125,6 @@
"format-linked": "{ifname} (No IP) ", "format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠", "format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}" "format-alt": "{ifname}: {ipaddr}/{cidr}"
}, }
"disk": {
"interval": 30,
"path": "/",
"format": " {used}/{total}"
},
} }
+141 -70
View File
@@ -1,99 +1,170 @@
* { * {
font-family: "Ubuntu Mono Nerd Font"; border: none;
font-size: 13px; border-radius: 0;
min-height: 0; font-family: 'Agave Nerd Font';
font-size: 14px;
} }
window#waybar { window#waybar {
/* background: transparent; */ background: transparent;
/* background: black; */
background: rgba(40, 44, 52, 0.85);
color: white;
border: 1px solid #8fd4ff;
border-radius: 5px;
} }
#window { window#waybar.hidden {
font-family: "Ubuntu Mono"; opacity: 0.1;
padding: 0 5px;
border: 1px solid #8fd4ff;
border-radius: 5px;
} }
window#waybar.empty #window { #custom-sep {
padding: 0px; color: #9399b2;
margin: 0px; background: rgba(17, 17, 27, 0.9);
border: 0px; }
/* background-color: rgba(66,66,66,0.5); */ /* transparent */
background-color: transparent; #workspaces {
padding-left: 5px;
transition: none;
border-radius: 15px 0px 0px 15px;
background: rgba(17, 17, 27, 0.9);
} }
#workspaces button { #workspaces button {
color: gray; transition: ease-out;
/* border: 1px solid #8fd4ff; */ transition-duration: 0.1s;
/* border-radius: 5px; */ color: #6c7086;
background: transparent;
padding-left: 5px;
padding-right: 5px;
} }
#workspaces button.focused { #workspaces button.persistent {
color: white; color: #6c7086;
border: 1px solid #8fd4ff; }
border-radius: 5px; /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
box-shadow: inherit;
text-shadow: inherit;
transition: ease-in;
transition-duration: 0.1s;
color: #f5c2e7;
}
#workspaces button.active, #workspaces button.focused {
color: #ea76cb;
}
#workspaces button.urgent {
color: #d20f39;
}
#window {
margin-right: 3px;
padding-left: 5px;
padding-right: 10px;
border-radius: 0px 15px 15px 0px;
transition: none;
background: rgba(17, 17, 27, 0.9);
color: #eee;
}
#submap, #mode {
padding-left: 5px;
padding-right: 5px;
margin-right: 3px;
border-radius: 15px 15px 15px 15px;
transition: none;
background: #f38ba8;
color: #313244;
}
#clock {
padding-left: 10px;
padding-right: 5px;
border-radius: 15px 15px 15px 15px;
transition: none;
color: #ffffff;
background: rgba(17, 17, 27, 0.9);
}
#custom-pipewire, #wireplumber {
padding-left: 10px;
padding-right: 5px;
transition: ease-in;
transition-duration: 0.2s;
color: white;
background: rgba(17, 17, 27, 0.9);
}
#custom-pipewire.muted, #wireplumber.muted {
background-color: rgba(17, 17, 27, 0.9);
color: #ffffff;
}
#backlight {
padding-left: 5px;
transition: none;
color: white;
background: rgba(17, 17, 27, 0.9);
}
#idle_inhibitor {
border-radius: 15px 0px 0px 15px;
padding-left: 10px;
padding-right: 10px;
transition: ease-in;
transition-duration: 0.1s;
color: white;
background: rgba(17, 17, 27, 0.9);
}
#idle_inhibitor.activated {
background-color: #ff4879;
} }
#tray,
#custom-japan,
#custom-germany,
#temperature,
#clock,
#battery,
#cpu, #cpu,
#memory, #memory,
#network, #network,
#pulseaudio { #bluetooth {
padding: 0 5px; padding-left: 5px;
margin-right: 5px; padding-right: 5px;
margin-top: 5px; transition: none;
margin-bottom: 5px; color: #ffffff;
background: rgba(17, 17, 27, 0.9);
} }
#temperature.critical { #battery {
color: #b62d66; padding-left: 10px;
} padding-right: 10px;
transition: none;
#battery icon { color: white;
color: #b62d66; background: rgba(17, 17, 27, 0.9);
} }
#battery.charging { #battery.charging {
border-bottom: 1px dotted #8fd4ff; color: #f38ba8;
}
#battery.warning:not(.charging) {
color: #cba6f7;
} }
@keyframes blink { @keyframes blink {
to { to {
background-color: #8fd4ff; background-color: #11111b;
color: black; color: #f38ba8;
} }
} }
#battery.warning:not(.charging) { #battery.critical:not(.charging) {
color: white; background-color: #f38ba8;
animation-name: blink; color: #313244;
animation-duration: 2s; animation-name: blink;
animation-timing-function: linear; animation-duration: 0.2s;
animation-iteration-count: infinite; animation-timing-function: linear;
animation-direction: alternate; animation-iteration-count: infinite;
border-radius: 5px; animation-direction: alternate;
} }
#tray {
#battery.warning:not(.charging) { padding-left: 5px;
color: white; padding-right: 10px;
animation-name: blink; border-radius: 0px 15px 15px 0px;
animation-duration: 1s; transition: none;
animation-timing-function: linear; color: #ffffff;
animation-iteration-count: infinite; background: rgba(17, 17, 27, 0.9);
animation-direction: alternate;
border-radius: 5px;
}
#network.disconnected {
color: #b62d66;
} }
@@ -0,0 +1,32 @@
#!/bin/bash
# 1. 取得目前 focused workspace 的名稱
CURRENT_WS=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused).name')
# 如果沒抓到 workspace,直接退出
if [ -z "$CURRENT_WS" ]; then
exit 0
fi
# 2. 列出該 workspace 內的所有視窗 (con 與 floating_con)
# 直接從 get_tree 找對應名稱的 workspace 節點並遞迴出視窗資訊
entries=$(swaymsg -t get_tree | jq -r --arg WS "$CURRENT_WS" '
.. |
select(.type? == "workspace" and .name == $WS) |
recurse(.nodes[]?, .floating_nodes[]?) |
select(.type == "con" or .type == "floating_con") |
select(.name != null) |
(.id | tostring) + " [" + (.app_id // .window_properties.class // "Unknown") + "] " + .name')
# 如果沒有視窗,直接結束
if [ -z "$entries" ]; then
exit 0
fi
# 3. 透過 wofi 顯示選單,並取得選擇視窗的 id (第一個欄位)
selected=$(echo "$entries" | wofi --width 600 --height 400 --dmenu --cache-file /dev/null | awk '{print $1}')
# 如果有選擇,則切換焦點到該視窗
if [ -n "$selected" ]; then
swaymsg "[con_id=$selected]" focus
fi
@@ -4,13 +4,15 @@ entries="⇠ Logout\n⏾ Suspend\n⭮ Reboot\n⏻ Shutdown"
selected=$(echo -e $entries|wofi --width 350 --height 250 --dmenu --cache-file /dev/null | awk '{print tolower($2)}') selected=$(echo -e $entries|wofi --width 350 --height 250 --dmenu --cache-file /dev/null | awk '{print tolower($2)}')
cmd="{{- if .settings.systemd }}systemctl{{ else }}loginctl{{ end }}"
case $selected in case $selected in
logout) logout)
swaymsg exit;; swaymsg exit;;
suspend) suspend)
exec systemctl suspend;; exec ${cmd} suspend;;
reboot) reboot)
exec systemctl reboot;; exec ${cmd} reboot;;
shutdown) shutdown)
exec systemctl poweroff -i;; exec ${cmd} poweroff -i;;
esac esac
@@ -0,0 +1,15 @@
#!/bin/bash
entries=$(swaymsg -t get_tree | jq -r -c '
recurse(.nodes[]?) |
recurse(.floating_nodes[]?) |
select(.type=="con"), select(.type=="floating_con") |
(.id | tostring) + " " + (.window_properties.class // .app_id) + ": " + .name')
echo "$entries"
selected=$(echo -e "$entries" | wofi --width 450 --height 350 --dmenu --cache-file /dev/null | awk '{print $1}')
if [ -n "$selected" ]; then
swaymsg "[con_id=$selected]" focus
fi
+29 -17
View File
@@ -1,11 +1,11 @@
--langmap=javascript:.js.es6.es.jsx.mjs --langmap=javascript:.js.es6.es.jsx.mjs
--javascript-kinds=-c-f-m-p-v --javascript-kinds=-mpvC
--regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b --regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b
--regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b --regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b
--regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b --regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\[/\1/A,Array,Arrays/b
--regex-javascript=/^[ \t]*class[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/C,Class,Classes/b --regex-javascript=/^[ \t]*class[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/c,Class,Classes/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}\({[ \t]*\)*\([A-Za-z0-9_\*]*[ \t]as[ \t]\)\([A-Za-z0-9_]\{1,\}\)/\3/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}\({[ \t]*\)*\([A-Za-z0-9_\*]*[ \t]as[ \t]\)\([A-Za-z0-9_]\{1,\}\)/\3/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}\({[ \t]*\)*\([A-Za-z0-9_\*]*[ \t]as[ \t]\)*\([A-Za-z0-9_]\{1,\}\),[ \t]*\([A-Za-z0-9_\*]*[ \t]as[ \t]\)\([A-Za-z0-9_]\{1,\}\)/\5/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}\({[ \t]*\)*\([A-Za-z0-9_\*]*[ \t]as[ \t]\)*\([A-Za-z0-9_]\{1,\}\),[ \t]*\([A-Za-z0-9_\*]*[ \t]as[ \t]\)\([A-Za-z0-9_]\{1,\}\)/\5/E,Export,Exports/b
@@ -14,7 +14,7 @@
--regex-javascript=/^[ \t]*export[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}async[ \t]function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}async[ \t]\{1,\}function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
@@ -29,7 +29,6 @@
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}async[ \t]function[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)/\1/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\2/E,Export,Exports/b
@@ -37,19 +36,19 @@
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t]*,[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\3/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t]*,[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\3/E,Export,Exports/b
--regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t]*,[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\3/E,Export,Exports/b --regex-javascript=/^[ \t]*export[ \t]\{1,\}default[ \t]\{1,\}const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*[^,]\{1,\},[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t]*,[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\3/E,Export,Exports/b
--regex-javascript=/^[ \t]*function[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t(]/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*function[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t(]/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*[(]function[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t(]/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*[(]function[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t(]/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*async[ \t]function[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t(]/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*async[ \t]function[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t(]/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*[(]async[ \t]function[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t(]/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*[(]async[ \t]function[ \t]*\([A-Za-z0-9_$]\{1,\}\)[ \t(]/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\(async[ \t]\{1,\}\)*function[^\*][^\*]/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\(async[ \t]\{1,\}\)*function[^\*][^\*]/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\(async[ \t]\{1,\}\)*function[^\*][^\*]/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\(async[ \t]\{1,\}\)*function[^\*][^\*]/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\(async[ \t]\{1,\}\)*function[^\*][^\*]/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*\(async[ \t]\{1,\}\)*function[^\*][^\*]/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*([^)]*$/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*([^)]*$/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*([^)]*$/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*([^)]*$/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*([^)]*$/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*([^)]*$/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=.\{1,\}=>/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=.\{1,\}=>/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=.\{1,\}=>/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*let[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=.\{1,\}=>/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=.\{1,\}=>/\1/F,Function,Functions/b --regex-javascript=/^[ \t]*const[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=.\{1,\}=>/\1/f,Function,Functions/b
--regex-javascript=/^[ \t]*function[ \t]*\*[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\1/G,Generator,Generators/b --regex-javascript=/^[ \t]*function[ \t]*\*[ \t]*\([A-Za-z0-9_$]\{1,\}\)/\1/G,Generator,Generators/b
--regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*function\([ \t]*\*\)/\1/G,Generator,Generators/b --regex-javascript=/^[ \t]*var[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)[ \t]*=[ \t]*function\([ \t]*\*\)/\1/G,Generator,Generators/b
@@ -144,3 +143,16 @@
--regex-javascript=/^[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\),$/\1/V,Variable,Variables/b --regex-javascript=/^[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\),$/\1/V,Variable,Variables/b
--regex-javascript=/^[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)$/\1/V,Variable,Variables/b --regex-javascript=/^[ \t]\{1,\}\([A-Za-z0-9_$]\{1,\}\)$/\1/V,Variable,Variables/b
--langmap=typescript:.ts.tsx
--regex-typescript=/^[ \t]*(export[ \t]+([a-z]+[ \t]+)?)?class[ \t]+([a-zA-Z0-9_$]+)/\3/c,classes/
--regex-typescript=/^[ \t]*(declare[ \t]+)?namespace[ \t]+([a-zA-Z0-9_$]+)/\2/c,modules/
--regex-typescript=/^[ \t]*(export[ \t]+)?module[ \t]+([a-zA-Z0-9_$]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export[ \t]+)?(default[ \t]+)?(async[ \t]+)?function(\*)?[ \t]+([a-zA-Z0-9_$]+)/\5/f,functions/
--regex-typescript=/^[ \t]*export[ \t]+(var|let|const)[ \t]+([a-zA-Z0-9_$]+)/\2/v,variables/
--regex-typescript=/^[ \t]*(var|let|const)[ \t]+([a-zA-Z0-9_$]+)[ \t]*=[ \t]*function[ \t]*[*]?[ \t]*\(\)/\2/v,varlambdas/
--regex-typescript=/^[ \t]*(export[ \t]+)?(public|protected|private)?[ \t]*(static[ \t]+)?(abstract[ \t]+)?(((get|set|readonly)[ \t]+)|(async[ \t]+[*]*[ \t]*))?(#?[a-zA-Z1-9_$]+)[ \t]*[:(]/\9/m,members/
--regex-typescript=/^[ \t]*(export[ \t]+)?interface[ \t]+([a-zA-Z0-9_$]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export[ \t]+)?type[ \t]+([a-zA-Z0-9_$]+)/\2/t,types/
--regex-typescript=/^[ \t]*(export[ \t]+)?enum[ \t]+([a-zA-Z0-9_$]+)/\2/e,enums/
--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_$]+)/\1/I,imports/
+6
View File
@@ -22,9 +22,15 @@
wtl = worktree list wtl = worktree list
[mergetool] [mergetool]
keepBackup = false keepBackup = false
prompt = true
[mergetool "vimdiff"] [mergetool "vimdiff"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J' cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[core] [core]
editor = nvim editor = nvim
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
# vim: ft=gitconfig # vim: ft=gitconfig
+18
View File
@@ -0,0 +1,18 @@
XIM=fcitx
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
GLFW_IM_MODULE=fcitx
SDL_IM_MODULE=fcitx
MOZ_ENABLE_WAYLAND=1
RTC_USE_PIPEWIRE=true
IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext
GDK_BACKEND=wayland,x11
QT_QPA_PLATFORM=wayland;xcb
CLUTTER_BACKEND=wayland
SDL_VIDEODRIVER=wayland
EDITOR=nvim
WINEPREFIX=/home/jay/.wine
+21 -2
View File
@@ -10,6 +10,10 @@ run-shell "tmux setenv -g TMUX_VERSION_29 $(awk 'BEGIN {print (\"'$(tmux -V | se
set -g default-terminal screen-256color set -g default-terminal screen-256color
set-option -ga terminal-overrides ",*256col*:Tc" set-option -ga terminal-overrides ",*256col*:Tc"
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
# scrollback buffer n lines # scrollback buffer n lines
set -g history-limit 10000 set -g history-limit 10000
@@ -138,10 +142,24 @@ if-shell -b '[ "$TMUX_VERSION_29" = 0 ]' \
if-shell -b '[ "$TMUX_VERSION_29" = 1 ]' \ if-shell -b '[ "$TMUX_VERSION_29" = 1 ]' \
"set -g message-style fg=white,bg=black,bright" "set -g message-style fg=white,bg=black,bright"
set -g @batt_icon_charge_tier8 '🌕'
set -g @batt_icon_charge_tier7 '🌖'
set -g @batt_icon_charge_tier6 '🌖'
set -g @batt_icon_charge_tier5 '🌗'
set -g @batt_icon_charge_tier4 '🌗'
set -g @batt_icon_charge_tier3 '🌘'
set -g @batt_icon_charge_tier2 '🌘'
set -g @batt_icon_charge_tier1 '🌑'
set -g @batt_icon_status_charged '🔋'
set -g @batt_icon_status_charging '⚡'
set -g @batt_icon_status_discharging '👎'
set -g @batt_color_status_primary_charged '#3daee9'
set -g @batt_color_status_primary_charging '#3daee9'
# what to be displayed on the right status # what to be displayed on the right status
set -g status-interval 1 set -g status-interval 1
set -g status-right ' } %Y-%m-%d %H:%M:%S' set -g status-right ' } Batt: #{battery_icon} #{battery_percentage} | #( ~/bin/tmux-right.sh ) | %Y-%m-%d %H:%M:%S'
set -g status-right-length 60 set -g status-right-length 80
# what to be displayed on the left status # what to be displayed on the left status
set -g status-left-length 30 set -g status-left-length 30
@@ -157,6 +175,7 @@ if-shell "hash reattach-to-user-namespace 2> /dev/null" 'set-option -g default-c
# Plugins # Plugins
#----------------------------- #-----------------------------
set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-battery'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm' run '~/.tmux/plugins/tpm/tpm'
+23 -20
View File
@@ -1,6 +1,15 @@
# vim: set ft=zsh :
# `$HOME/bin/start-agent` # `$HOME/bin/start-agent`
SSH_ENV="$HOME/.ssh/agent-environment" SSH_ENV="$HOME/.ssh/agent-environment"
function escapeStr {
if [ -z "$1" ]; then
echo "usage: escapeStr <string>"
return 1
fi
echo $1 | sed -r 's/([\$"])/\\\1/g'
}
function start_agent { function start_agent {
echo "Initialising new SSH agent..." echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
@@ -32,19 +41,6 @@ function envf {
export $(cat $1 | grep -v '^#' | xargs) export $(cat $1 | grep -v '^#' | xargs)
} }
function save-image {
if [ -z "$1" ]; then
echo "usage: save-image <image-name>"
exit 1
fi
imageName=$(echo ${1##*/} | sed 's/:/_/' | xargs -I {} echo "{}.tar")
lima nerdctl pull $1
lima nerdctl image save -o $imageName $1
lima nerdctl image rm $1
}
function ttySize { function ttySize {
echo "-e COLUMNS=$(tput cols) -e LINES=$(tput lines)" echo "-e COLUMNS=$(tput cols) -e LINES=$(tput lines)"
} }
@@ -80,23 +76,30 @@ function ln-image-tags {
function ln-save-image { function ln-save-image {
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "usage: ln-save-image <image-name:tag>" echo "usage: ln-save-image <image-name:tag>"
exit 1 return 1
fi fi
docker-save --rm -p -o . -i registry.lawsnote.com/$1 docker-save --rm -p -o . -i registry.lawsnote.com/$1
} }
function save-image {
if [ -z "$1" ]; then
echo "usage: save-image <image-name>"
return 1
fi
tag=$(ln-image-tags "$1" | jq -c -r 'del(.tags[] | select(. == "latest")) | .tags | sort | last') || return 1
ln-save-image "$1:$tag"
}
function minio-size { function minio-size {
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "usage: minio-size <alias or alias/bucket-path>" echo "usage: minio-size <alias or alias/bucket-path>"
exit 1 return 1
fi fi
mc ls -r --json $1 | jq -s 'map(.size) | add' | numfmt --to=iec-i --suffix=B --padding=7 mc ls -r --json $1 | jq -s 'map(.size) | add' | numfmt --to=iec-i --suffix=B --padding=7
} }
# The next line updates PATH for the Google Cloud SDK. function zfs-usage {
if [ -f '/home/jay/apps/google-cloud-sdk/path.zsh.inc' ]; then . '/home/jay/apps/google-cloud-sdk/path.zsh.inc'; fi awk '/^size/ { print $1 " " $3 / 1048576 }' < /proc/spl/kstat/zfs/arcstats
}
# The next line enables shell command completion for gcloud.
if [ -f '/home/jay/apps/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/jay/apps/google-cloud-sdk/completion.zsh.inc'; fi
+3 -1
View File
@@ -7,5 +7,7 @@ alias ls="ls --color=auto"
alias wgup="sudo wg-quick up" alias wgup="sudo wg-quick up"
alias wgdown="sudo wg-quick down" alias wgdown="sudo wg-quick down"
alias wgc="wgvpn connect"
alias wgd="wgvpn disconnect"
alias lg="lazygit" alias vm-system="virt-viewer -c qemu:///system"
+2 -2
View File
@@ -123,7 +123,7 @@ setopt share_history
setopt hist_reduce_blanks setopt hist_reduce_blanks
# Write to the history file immediately, not when the shell exits. # Write to the history file immediately, not when the shell exits.
setopt inc_append_history # setopt inc_append_history
# Remove comannd of 'hostory' or 'fc -l' from history list # Remove comannd of 'hostory' or 'fc -l' from history list
setopt hist_no_store setopt hist_no_store
@@ -138,7 +138,7 @@ setopt extended_history
setopt hist_ignore_space setopt hist_ignore_space
# Append to history file # Append to history file
setopt append_history # setopt append_history
# Edit history file during call history before executing # Edit history file during call history before executing
setopt hist_verify setopt hist_verify
+7 -3
View File
@@ -3,12 +3,17 @@ export ZSH_TMUX_AUTOSTART=true
export ZSH_TMUX_AUTOSTART_ONCE=true export ZSH_TMUX_AUTOSTART_ONCE=true
export ZSH_TMUX_AUTOCONNECT=true export ZSH_TMUX_AUTOCONNECT=true
{{ end }} {{ end }}
export HISTFILE="$HOME/.zsh_history"
#export HISTFILESIZE=100000
export HISTSIZE=100000
export SAVEHIST=100
# install zinit # install zinit
# git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin # git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin
source ~/.zinit/bin/zinit.zsh source ~/.zinit/bin/zinit.zsh
zinit light zsh-users/zsh-completions zinit light zsh-users/zsh-completions
zinit snippet OMZ::lib/async_prompt.zsh
zinit light zsh-users/zsh-autosuggestions zinit light zsh-users/zsh-autosuggestions
zinit light mattbangert/kubectl-zsh-plugin zinit light mattbangert/kubectl-zsh-plugin
@@ -21,7 +26,6 @@ zinit snippet OMZ::lib/completion.zsh
zinit snippet OMZ::lib/git.zsh zinit snippet OMZ::lib/git.zsh
zinit snippet OMZ::lib/theme-and-appearance.zsh zinit snippet OMZ::lib/theme-and-appearance.zsh
zinit ice as="completion" zinit ice as="completion"
zinit snippet OMZ::plugins/docker/_docker
zinit snippet OMZP::composer zinit snippet OMZP::composer
zinit snippet OMZP::aws zinit snippet OMZP::aws
zinit snippet OMZ::plugins/sudo/sudo.plugin.zsh zinit snippet OMZ::plugins/sudo/sudo.plugin.zsh
@@ -30,9 +34,9 @@ zinit ice lucid wait='1'
zinit snippet OMZ::plugins/git/git.plugin.zsh zinit snippet OMZ::plugins/git/git.plugin.zsh
# Load OMZ extract folder # Load OMZ extract folder
zinit ice svn #zinit ice svn
zinit snippet OMZ::plugins/extract zinit snippet OMZ::plugins/extract
zinit ice svn #zinit ice svn
zinit snippet OMZ::plugins/tmux zinit snippet OMZ::plugins/tmux
# theme # theme
+1 -16
View File
@@ -3,19 +3,4 @@ Host *
UserKnownHostsFile /dev/null UserKnownHostsFile /dev/null
ForwardAgent yes ForwardAgent yes
Host git.lawsnote.com Include conf.d/*.conf
Port 2222
User git
HostName git.lawsnote.com
Host dev
User jay
HostName 192.168.200.15
Host vpn
User root
HostName 192.168.201.254
Host lndev
User jay
HostName 192.168.88.12
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env sh
set -eu
export XDG_CURRENT_DESKTOP=Hyprland # xdg-desktop-portal
export XDG_SESSION_DESKTOP=Hyprland # systemd
export XDG_SESSION_TYPE=wayland # xdg/systemd
if command -v dbus-update-activation-environment >/dev/null; then
dbus-update-activation-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
fi
# without this, systemd starts xdg-desktop-portal without these environment variables,
# and the xdg-desktop-portal does not start xdg-desktop-portal-wrl as expected
# https://github.com/emersion/xdg-desktop-portal-wlr/issues/39#issuecomment-638752975
systemctl --user import-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
# use systemd-run here, because systemd units inherit variables from ~/.config/environment.d
# shellcheck disable=SC2068
systemd-run --quiet --unit=hypr --user --wait Hyprland $@
systemctl --user stop hypr-session.target
# this teardown makes it easier to switch between compositors
unset DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
systemctl --user unset-environment DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
if command -v dbus-update-activation-environment >/dev/null; then
dbus-update-activation-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
fi
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env sh
set -eu
export XDG_CURRENT_DESKTOP=sway # xdg-desktop-portal
export XDG_SESSION_DESKTOP=sway # systemd
export XDG_SESSION_TYPE=wayland # xdg/systemd
if [ -d "$HOME/.config/environment.d" ]; then
for f in "$HOME"/.config/environment.d/*.conf; do
[ -f "$f" ] || continue
while IFS= read -r line || [ -n "$line" ]; do
# Skip empty lines and comments
case "$line" in
'' | '#'*) continue ;;
esac
# Export the variable
export "$line"
done <"$f"
done
fi
max_attempts=50
attempt=0
while [ ! -d "/run/user/$(id -u)" ]; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Error: XDG_RUNTIME_DIR not available after $max_attempts attempts" >&2
exit 1
fi
sleep 0.2
attempt=$((attempt + 1))
done
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
dbus-run-session sway "$@"
# this teardown makes it easier to switch between compositors
unset DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env sh
set -eu
export XDG_CURRENT_DESKTOP=sway # xdg-desktop-portal
export XDG_SESSION_DESKTOP=sway # systemd
export XDG_SESSION_TYPE=wayland # xdg/systemd
if command -v dbus-update-activation-environment >/dev/null; then
dbus-update-activation-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
fi
# without this, systemd starts xdg-desktop-portal without these environment variables,
# and the xdg-desktop-portal does not start xdg-desktop-portal-wrl as expected
# https://github.com/emersion/xdg-desktop-portal-wlr/issues/39#issuecomment-638752975
systemctl --user import-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
# use systemd-run here, because systemd units inherit variables from ~/.config/environment.d
# shellcheck disable=SC2068
systemd-run --quiet --unit=sway --user --wait sway $@
systemctl --user stop sway-session.target
# this teardown makes it easier to switch between compositors
unset DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
systemctl --user unset-environment DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
if command -v dbus-update-activation-environment >/dev/null; then
dbus-update-activation-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE
fi