feat: nb change sway config to nautilus

This commit is contained in:
2025-10-02 19:45:58 +02:00
parent 6339b733c4
commit 15f6b2edd0
2 changed files with 44 additions and 2 deletions

View File

@@ -70,7 +70,7 @@ bindsym $mod+d exec foot -a launcher -e env TERMINAL_COMMAND="foot -c /etc/xdg/f
#bindsym $mod+d exec --no-startup-id bemenu --dmenu="dmenu -i -fn 'Source Sans Pro-10' -nb '#212121' -sb '#2b83a6' -sf '#ffffff'
# start an explorer
bindsym $mod+e exec --no-startup-id thunar
bindsym $mod+e exec --no-startup-id nautilus
# switching window with win+tab
bindsym $mod+Tab exec --no-startup-id wofi -show window
@@ -260,7 +260,7 @@ assign [app_id="foot" title="^(?!terminal-sway)$"] → $ws2
assign [app_id="chromium"] → $ws3
assign [app_id="firefox"] → $ws3
assign [app_id="librewolf"] → $ws3
assign [app_id="pcmanfm"] → $ws4
assign [app_id="nautilus"] → $ws4
assign [app_id="libreoffice-calc"] → $ws5
assign [app_id="libreoffice-writer"] → $ws5
assign [class="vlc"] → $ws6
@@ -310,6 +310,9 @@ exec dunst
exec 'sleep 2; swaymsg workspace "$ws8"; swaymsg layout tabbed'
exec mako --default-timeout=5000
# Battery low warning every minute
exec_always sh -c 'while :; do battery-alert-swaynag; sleep 60; done' &
# wallpaper
# output eDP-1 scale 2 scale_filter linear
output eDP-1 mode 2880x1920 scale 2 scale_filter linear

View File

@@ -17,6 +17,44 @@ let
'';
};
battery-alert-swaynag = pkgs.writeShellScriptBin "battery-alert-swaynag" ''
#!/usr/bin/env bash
set -euo pipefail
# Detect a battery
cap_file=""
status_file=""
for d in /sys/class/power_supply/BAT*; do
if [[ -f "$d/capacity" ]]; then
cap_file="$d/capacity"
status_file="$d/status"
break
fi
done
if [[ -z "$cap_file" ]]; then
exit 0
fi
capacity=$(cat "$cap_file")
status=$(cat "$status_file" 2>/dev/null || echo "Unknown")
if [[ "$capacity" -lt 20 && "$status" != "Charging" && "$status" != "Full" ]]; then
stamp="/run/user/$(id -u)/.battery_swaynag_stamp"
now=$(date +%s)
last=0
if [[ -f "$stamp" ]]; then
last=$(cat "$stamp" 2>/dev/null || echo 0)
fi
# Avoid spamming: at most once every 5 minutes
if (( now - last >= 300 )); then
echo "$now" > "$stamp"
swaynag -t warning -m "Battery low: ''${capacity}% - plug in the charger." -b "Dismiss" "true" &
disown || true
fi
fi
'';
sway-conf = builtins.readFile ./sway.conf + ''
exec swaybg -m center -c 252525 -i ~/.wallpaper.png
@@ -32,6 +70,7 @@ in {
waybar
wayland
wofi
battery-alert-swaynag
];
programs.sway = {