daily configuration optimization

Fix
- airplay: systemd wantedBy target
- fcitx5: remove redundant systemd service

Remove
- move scripts into configuration

Style
- ghostty: add more transparency to background

Add
- zellij
This commit is contained in:
danny 2025-08-27 22:38:40 +08:00
parent 44c152fdc9
commit 9c9acc3494
24 changed files with 941 additions and 856 deletions

View file

@ -56,4 +56,4 @@ vim.g.clipboard = {
-- (instead of interacting with the "+" and/or "*" registers explicitly):
vim.opt.clipboard = "unnamedplus"
vim.g.gruvbox_material_transparent_background = 2
vim.opt.spelllang = { "en", "cjk" }

View file

@ -1,22 +0,0 @@
#!/usr/bin/env bash
SERVICE="gamemode"
if [ "$1" = "toggle" ]; then
if systemctl --user is-active --quiet "$SERVICE"; then
systemctl --user stop "$SERVICE"
notify-send "󰊗 Gamemode" "off" >/dev/null 2>&1
else
systemctl --user start "$SERVICE"
notify-send "󰊗 Gamemode" "on" >/dev/null 2>&1
fi
exit 0
fi
if ! systemctl --user is-active --quiet "$SERVICE"; then
echo "{\"text\": \"inactive\", \"tooltip\": \"gamemoded is inactive\", \"alt\": \"inactive\", \"class\": \"inactive\"}"
exit 0
fi
echo "{\"text\": \"active\", \"tooltip\": \"gamemoded is running\", \"alt\": \"active\", \"class\": \"active\"}"
exit 0

View file

@ -1,24 +0,0 @@
#!/usr/bin/env bash
get_icons() {
local session_name="$1"
local result=""
local panes=($(tmux list-panes -t "$session_name" -F '#{pane_current_command}'))
for i in "${panes[@]}"; do
case "$i" in
nvim) result+=" " ;;
zsh | *) result+=" " ;;
esac
done
echo "$result"
}
if (($# != 1)); then
echo "Usage: $0 <session-name>"
exit 1
fi
get_icons "$1"

View file

@ -1,33 +0,0 @@
#!/usr/bin/env bash
#Taken from JaKoolit's dotfiles
bar="▁▂▃▄▅▆▇█"
dict="s/;//g"
bar_length=${#bar}
for ((i = 0; i < bar_length; i++)); do
dict+=";s/$i/${bar:$i:1}/g"
done
config_file="/tmp/bar_cava_config"
cat >"$config_file" <<EOF
[general]
bars = 10
[input]
method = pulse
source = auto
[output]
method = raw
raw_target = /dev/stdout
data_format = ascii
channels = mono
ascii_max_range = 7
EOF
pkill -f "cava -p $config_file"
cava -p "$config_file" | sed -u "$dict"

View file

@ -1,20 +0,0 @@
#!/usr/bin/env bash
INTERFACE="wg0"
if [ "$1" = "toggle" ]; then
if ip link show "$INTERFACE" >/dev/null 2>&1; then
pkexec systemctl stop wg-quick-wg0.service
else
pkexec systemctl start wg-quick-wg0.service
fi
exit 0
fi
if ! ip link show "$INTERFACE" >/dev/null 2>&1; then
echo "{\"text\": \"Not Connected\", \"tooltip\": \"WireGuard is down\", \"alt\": \"disconnected\", \"class\": \"disconnected\"}"
exit 0
fi
echo "{\"text\": \"Connected\", \"tooltip\": \"WireGuard connected\", \"alt\": \"connected\", \"class\": \"connected\"}"
exit 0

View file

@ -16,5 +16,6 @@
../user/virtualization.nix
../user/vscode.nix
../user/yazi.nix
../user/zellij.nix
];
}

View file

@ -5,51 +5,60 @@
let
record = pkgs.writeShellScript "toggle-wf-record" ''
PID_FILE="/tmp/wf-recorder.pid"
OUTPUT_DIR="$HOME/Videos/recordings"
FILENAME="$OUTPUT_DIR/recording_$(date +%Y%m%d_%H%M%S).mp4"
SINK_DEV="$(${pkgs.pulseaudio.out}/bin/pactl get-default-sink).monitor"
declare -A recordOptions=(
[Monitor]="${pkgs.slurp}/bin/slurp -o"
[Area]="${pkgs.slurp}/bin/slurp"
)
if [[ $1 = "toggle" ]]; then
OUTPUT_DIR="$HOME/Videos/recordings"
FILENAME="$OUTPUT_DIR/recording_$(date +%Y%m%d_%H%M%S).mp4"
SINK_DEV="$(${pkgs.pulseaudio.out}/bin/pactl get-default-sink).monitor"
if [[ -f "$PID_FILE" ]]; then
pid=$(cat "$PID_FILE")
declare -A recordOptions=(
[Monitor]="${pkgs.slurp}/bin/slurp -o"
[Area]="${pkgs.slurp}/bin/slurp"
)
if kill "$pid" 2>/dev/null; then
rm "$PID_FILE"
echo "Stopped recording"
notify-send "󰑋 RECORD" "Recording saved to $FILENAME"
if [[ -f "$PID_FILE" ]]; then
pid=$(cat "$PID_FILE")
if kill "$pid" 2>/dev/null; then
rm "$PID_FILE"
echo "Stopped recording"
notify-send "󰑋 RECORD" "Recording saved to $FILENAME"
else
echo "No process found, cleaning up"
notify-send "󰑋 RECORD" "Failed: No process found, cleaning up"
rm "$PID_FILE"
fi
else
echo "No process found, cleaning up"
notify-send "󰑋 RECORD" "Failed: No process found, cleaning up"
rm "$PID_FILE"
# Start recording
choice=$(printf "%s\n" "''\${!recordOptions[@]}" | rofi -i -dmenu -config ~/.config/rofi/config.rasi -p "Which mode")
if [[ -z "$choice" ]]; then
notify-send "󰑋 RECORD" "Cancelled"
exit 1
fi
mkdir -p "$OUTPUT_DIR"
geometry="$(''\${recordOptions[$choice]})"
if [[ -z "$geometry" ]]; then
notify-send "󰑋 RECORD" "Cancelled"
exit 1
fi
${pkgs.wf-recorder}/bin/wf-recorder -y \
-g "$geometry" \
--audio="$SINK_DEV" \
-f "$FILENAME" &
echo $! > "$PID_FILE"
echo "Started recording: $FILENAME"
fi
fi
if [ -f "$PID_FILE" ]; then
jq -nc --arg text "on" --arg class "on" '{text: $text, class: $class, alt: $class}'
else
# Start recording
choice=$(printf "%s\n" "''\${!recordOptions[@]}" | rofi -i -dmenu -config ~/.config/rofi/config.rasi -p "Which mode")
if [[ -z "$choice" ]]; then
notify-send "󰑋 RECORD" "Cancelled"
exit 1
fi
mkdir -p "$OUTPUT_DIR"
geometry="$(''\${recordOptions[$choice]})"
if [[ -z "$geometry" ]]; then
notify-send "󰑋 RECORD" "Cancelled"
exit 1
fi
${pkgs.wf-recorder}/bin/wf-recorder -y \
-g "$geometry" \
--audio="$SINK_DEV" \
-f "$FILENAME" &
echo $! > "$PID_FILE"
echo "Started recording: $FILENAME"
jq -nc --arg text "off" --arg class "off" '{text: $text, class: $class, alt: $class}'
fi
'';
in

View file

@ -13,9 +13,9 @@ let
notransTag = "notrans";
browser-bin = "zen";
prefix = if nvidia-offload-enabled then "nvidia-offload" else "";
browser = "${prefix} ${browser-bin}";
terminal = "ghostty";
prefix = if nvidia-offload-enabled then "nvidia-offload " else "";
browser = "${prefix}${browser-bin}";
terminal = "${prefix}ghostty";
filemanager = "${terminal} -e yazi";
screenshotFolder = "--output-folder ~/Pictures/Screenshots";

View file

@ -36,8 +36,12 @@ in
"fullscreen, initialClass:^(cs2)$"
# Zen browser
"opacity 0.9999 override, initialClass:^(zen)(.*)"
# Ghostty
"opacity 0.9999 override, initialClass:^(com.mitchellh.ghostty)$"
# Picture in picture windows
"float, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"
@ -53,10 +57,6 @@ in
"move ${right} 8%, class: ^(localsend_app)$"
"size 20% 80%, class: ^(localsend_app)$"
# Airplay
"move ${right} 10%, class: ^(GStreamer)$"
"size 21% 80%, class: ^(GStreamer)$"
# Bluetooth
"move ${right} ${top}, class: ^(blueberry.py)$"
"size 25% 45%, class: ^(blueberry.py)$"
@ -72,6 +72,8 @@ in
"animation slide right 20%, class: ^(localsend_app)$"
# Airplay
"move ${right} 10%, class: ^(GStreamer)$"
"size 21% 80%, class: ^(GStreamer)$"
"pin, class: ^(GStreamer)$"
"float, class: ^(GStreamer)$"
"opacity 1.0 override 1.0 override, class: ^(GStreamer)$"

View file

@ -12,7 +12,6 @@ let
fcitx5-rime # Bopomofo
rime-data
];
in
{
i18n = {
@ -33,27 +32,54 @@ in
MenuFont = lib.mkForce font;
TrayFont = lib.mkForce font;
};
inputMethod = {
GroupOrder."0" = "Default";
"Groups/0" = {
Name = "Default";
"Default Layout" = "us";
DefaultIM = "rime";
};
"Groups/0/Items/0".Name = "keyboard-us";
"Groups/0/Items/1".Name = "rime";
"Groups/0/Items/2".Name = "mozc";
};
globalOptions = {
Hotkey = {
EnumerateWithRiggerKeys = true;
EnumerateSkipFirst = false;
ModifierOnlyKeyTimeout = 250;
};
"Hotkey/TriggerKeys" = {
"0" = "Super+space";
};
"Hotkey/AltTriggerKeys" = {
"0" = "Shift_L";
};
"Hotkey/EnumerateGroupForwardKeys" = {
"0" = "Super+space";
};
"Hotkey/PrevPage" = {
"0" = "Up";
};
"Hotkey/NextPage" = {
"0" = "Down";
};
Behavior = {
ActiveByDefault = false;
resetStateWhenFocusIn = "no";
ShareInputState = "no";
PreeditEnabledByDefault = true;
ShowInputMethodInformation = true;
ShowInputMethodInformationWhenFocusIn = false;
CompactInputMethodInformation = true;
DefaultPageSize = 5;
PreloadInputMethod = true;
};
};
};
};
};
};
systemd.user.services.fcitx5 = {
Unit = {
WantedBy = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
Description = "Fcitx5 Input Method";
};
Service = {
Type = "simple";
Restart = "always";
RestartSec = 2;
ExecStart = "${pkgs.fcitx5}/bin/fcitx5";
Environment = [
"GTK_IM_MODULE="
"XMODIFIERS=@im=fcitx"
"QT_IM_MODULE=fcitx"
];
};
};
}

View file

@ -31,6 +31,8 @@
settings = {
unfocused-split-opacity = 0.85;
desktop-notifications = false;
background-opacity = 0.1;
background-blur = false;
wait-after-command = false;
shell-integration = "detect";

File diff suppressed because it is too large Load diff

6
home/user/zellij.nix Normal file
View file

@ -0,0 +1,6 @@
{ ... }:
{
programs.zellij = {
enable = true;
};
}

View file

@ -23,6 +23,7 @@ in
"zen.view.compact.show-sidebar-and-toolbar-on-hover" = false;
"zen.tabs.vertical.right-side" = true;
"zen.urlbar.behavior" = "float";
"nebula-tab-loading-animation" = 0;
"app.update.auto" = false;
"app.normandy.first_run" = false;