diff --git a/config/X11/xinitrc b/config/X11/xinitrc index c3a0da3..8d3f2c3 100644 --- a/config/X11/xinitrc +++ b/config/X11/xinitrc @@ -8,7 +8,7 @@ fi x setup x mon -x bg ~/Pictures/wp/one/progress.jpg ~/Pictures/wp/one/lilies.jpg +x bg "${XDG_PICTURES_DIR:-$HOME/Pictures}/wp/one/progress.jpg" "${XDG_PICTURES_DIR:-$HOME/Pictures}/wp/one/lilies.jpg" setxkbmap -layout us -variant colemak & pgrep -u "$USER" -f clipmenud >/dev/null || clipmenud & # dwmblocks & diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index b906baf..f0a240c 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -36,9 +36,9 @@ unbind Up; bind k selectp -U unbind Right; bind l selectp -R unbind :; bind : display-popup -E 'mux cmd'\; refresh -S -unbind s; bind s display-popup -E 'mux pick-session'\; refresh -S -unbind w; bind w display-popup -E 'mux pick-window'\; refresh -S -unbind p; bind p display-popup -E 'mux pick-pane'\; refresh -S +unbind S; bind S display-popup -E 'mux pick-session'\; refresh -S +unbind W; bind W display-popup -E 'mux pick-window'\; refresh -S +unbind P; bind P display-popup -E 'mux pick-pane'\; refresh -S bind -r Left resizep -L 5 bind -r Right resizep -R 5 @@ -77,7 +77,7 @@ run 'tmux source "$XDG_CONFIG_HOME/tmux/themes/${THEME:-midnight}.conf"' unbind a; bind a run 'mux ai' unbind c; bind c run 'mux code' unbind r; bind r run 'mux run' -unbind t; bind t run 'mux shell' +unbind s; bind s run 'mux shell' unbind g; bind g run 'mux git' unbind m; bind m run 'mux misc' diff --git a/flake.nix b/flake.nix index 3af2134..4349512 100644 --- a/flake.nix +++ b/flake.nix @@ -41,8 +41,7 @@ import nixpkgs { inherit system; config.allowUnfreePredicate = - pkg: - builtins.elem (nixpkgs.lib.getName pkg) (sharedUnfree ++ extraUnfree); + pkg: builtins.elem (nixpkgs.lib.getName pkg) (sharedUnfree ++ extraUnfree); inherit overlays; }; diff --git a/home/home.nix b/home/home.nix index 314be8a..c0fafe7 100644 --- a/home/home.nix +++ b/home/home.nix @@ -7,32 +7,51 @@ }: { - imports = - [ - ./modules/bootstrap.nix - ./modules/theme.nix - ./modules/shell.nix - ./modules/terminal.nix - ./modules/git.nix - ./modules/editor.nix - ./modules/packages.nix - ] - ++ lib.optionals hostConfig.isLinux [ - ./modules/hyprland.nix - ./modules/ui.nix - ]; + imports = [ + ./modules/bootstrap.nix + ./modules/theme.nix + ./modules/shell.nix + ./modules/terminal.nix + ./modules/git.nix + ./modules/editor.nix + ./modules/packages.nix + ] + ++ lib.optionals hostConfig.isLinux [ + ./modules/hyprland.nix + ./modules/ui.nix + ]; config = { theme = "midnight"; home.username = "barrett"; home.homeDirectory = - if hostConfig.isDarwin - then "/Users/${config.home.username}" - else "/home/${config.home.username}"; + if hostConfig.isDarwin then "/Users/${config.home.username}" else "/home/${config.home.username}"; home.stateVersion = "24.11"; xdg.enable = true; + xdg.userDirs = lib.mkIf hostConfig.isLinux { + enable = true; + createDirectories = true; + desktop = "${config.home.homeDirectory}/Desktop"; + documents = "${config.home.homeDirectory}/Documents"; + download = "${config.home.homeDirectory}/Downloads"; + music = "${config.home.homeDirectory}/Music"; + pictures = "${config.home.homeDirectory}/Pictures"; + publicShare = "${config.home.homeDirectory}/Public"; + templates = "${config.home.homeDirectory}/Templates"; + videos = "${config.home.homeDirectory}/Videos"; + }; + home.sessionVariables = lib.mkIf hostConfig.isLinux { + XDG_DESKTOP_DIR = config.xdg.userDirs.desktop; + XDG_DOCUMENTS_DIR = config.xdg.userDirs.documents; + XDG_DOWNLOAD_DIR = config.xdg.userDirs.download; + XDG_MUSIC_DIR = config.xdg.userDirs.music; + XDG_PICTURES_DIR = config.xdg.userDirs.pictures; + XDG_PUBLICSHARE_DIR = config.xdg.userDirs.publicShare; + XDG_TEMPLATES_DIR = config.xdg.userDirs.templates; + XDG_VIDEOS_DIR = config.xdg.userDirs.videos; + }; targets.genericLinux.enable = hostConfig.isLinux && !hostConfig.isNixOS; news.display = "silent"; diff --git a/home/modules/bootstrap.nix b/home/modules/bootstrap.nix index 03a525c..986f995 100644 --- a/home/modules/bootstrap.nix +++ b/home/modules/bootstrap.nix @@ -9,24 +9,27 @@ let homeDir = config.home.homeDirectory; repoDir = "${homeDir}/.config/nix"; - directories = - [ - "dev" - "Downloads" - "Pictures" - ] - ++ lib.optionals hostConfig.isLinux [ - "Pictures/Screensavers" - "Pictures/Screenshots" - "Pictures/wp" - ]; + directories = [ "dev" ]; + + pictureSubdirs = [ + "Screensavers" + "Screenshots" + "wp" + ]; in { - home.activation.createDirectories = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - for dir in ${lib.concatStringsSep " " directories}; do - run mkdir -p "$HOME/$dir" - done - ''; + home.activation.createDirectories = lib.hm.dag.entryAfter [ "writeBoundary" ] ( + '' + for dir in ${lib.concatStringsSep " " directories}; do + run mkdir -p "$HOME/$dir" + done + '' + + lib.optionalString hostConfig.isLinux '' + for dir in ${lib.concatStringsSep " " pictureSubdirs}; do + run mkdir -p "${config.xdg.userDirs.pictures}/$dir" + done + '' + ); home.activation.cleanDanglingLinks = lib.hm.dag.entryAfter [ "writeBoundary" ] '' for link in "$HOME/.nix-profile" "$HOME/.nix-defexpr"; do @@ -37,7 +40,7 @@ in home.activation.linkWallpapers = lib.mkIf hostConfig.isLinux ( lib.hm.dag.entryAfter [ "createDirectories" ] '' src="${repoDir}/config/screen" - dest="$HOME/Pictures/Screensavers" + dest="${config.xdg.userDirs.pictures}/Screensavers" if [ -d "$src" ]; then for f in "$src"/*; do [ -f "$f" ] || continue diff --git a/home/modules/hyprland.nix b/home/modules/hyprland.nix index 936451e..f38b349 100644 --- a/home/modules/hyprland.nix +++ b/home/modules/hyprland.nix @@ -61,7 +61,7 @@ in xdg.configFile."hypr/hyprpaper.conf".text = '' wallpaper { monitor = - path = ${config.home.homeDirectory}/Pictures/Screensavers/wallpaper.jpg + path = ${config.xdg.userDirs.pictures}/Screensavers/wallpaper.jpg } splash = false @@ -75,7 +75,7 @@ in background { monitor = - path = ${config.home.homeDirectory}/Pictures/Screensavers/lock.jpg + path = ${config.xdg.userDirs.pictures}/Screensavers/lock.jpg } animations { diff --git a/home/modules/theme.nix b/home/modules/theme.nix index 30504b9..dfef37b 100644 --- a/home/modules/theme.nix +++ b/home/modules/theme.nix @@ -88,8 +88,7 @@ in }; home.file.".local/share/fonts" = lib.mkIf hostConfig.isLinux { - source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/fonts"; + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/fonts"; }; home.activation.checkFonts = lib.hm.dag.entryAfter [ "writeBoundary" ] '' diff --git a/home/modules/ui.nix b/home/modules/ui.nix index 66a8497..d553332 100644 --- a/home/modules/ui.nix +++ b/home/modules/ui.nix @@ -170,7 +170,13 @@ in format = "{icon}"; format-charging = "{icon}"; format-full = "{icon}"; - format-icons = ["" "" "" "" ""]; + format-icons = [ + "" + "" + "" + "" + "" + ]; states = { hi = 30; mid = 20; diff --git a/scripts/ctl b/scripts/ctl index ad4052b..e8189a6 100755 --- a/scripts/ctl +++ b/scripts/ctl @@ -11,7 +11,7 @@ require() { case "$1" in screenshot) - dir="$HOME/Pictures/Screenshots" + dir="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots" mkdir -p "$dir" file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png" if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then @@ -24,7 +24,7 @@ screenshot) ;; ocr) require tesseract - dir="$HOME/Pictures/Screenshots" + dir="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots" mkdir -p "$dir" file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png" if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then @@ -187,37 +187,40 @@ wifi) media) if pgrep -x wf-recorder >/dev/null 2>&1; then pkill -INT wf-recorder - notify-send -a ctl -t 2500 "recording saved" + file=$(cat "${XDG_RUNTIME_DIR:-/tmp}/ctl-recording" 2>/dev/null) + rm -f "${XDG_RUNTIME_DIR:-/tmp}/ctl-recording" + notify-send -a ctl -t 2500 "Recording saved to ~${file#"$HOME"}" exit 0 fi - require fuzzel grim slurp wl-copy wf-recorder hyprctl jq - ss_dir="$HOME/Pictures/Screenshots" - rec_dir="$HOME/Pictures/Recordings" + require fuzzel grim slurp wl-copy wf-recorder + ss_dir="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots" + rec_dir="${XDG_VIDEOS_DIR:-$HOME/Videos}" mkdir -p "$ss_dir" "$rec_dir" desktop=" Capture Desktop" area=" Capture Area" rec_desktop=" Record Desktop" - rec_window=" Record Window" - chosen="$(printf '%s\n' "$desktop" "$area" "$rec_desktop" "$rec_window" | fuzzel --dmenu --hide-prompt --lines=4 --width=25 --no-icons)" + rec_area=" Record Area" + chosen="$(printf '%s\n' "$desktop" "$area" "$rec_desktop" "$rec_area" | fuzzel --dmenu --hide-prompt --lines=4 --width=25 --no-icons)" case "$chosen" in "$desktop") file="$ss_dir/$(date +'%Y-%m-%d_%H-%M-%S').png" - grim "$file" && wl-copy < "$file" + grim "$file" && wl-copy < "$file" && echo "$file" && notify-send -a ctl -t 2500 "Screenshot saved to ~${file#"$HOME"}" ;; "$area") file="$ss_dir/$(date +'%Y-%m-%d_%H-%M-%S').png" - grim -g "$(slurp)" "$file" && wl-copy < "$file" + grim -g "$(slurp)" "$file" && wl-copy < "$file" && echo "$file" && notify-send -a ctl -t 2500 "Screenshot saved to ~${file#"$HOME"}" ;; "$rec_desktop") file="$rec_dir/$(date +'%Y-%m-%d_%H-%M-%S').mp4" - notify-send -a ctl -t 2500 "recording started" + echo "$file" > "${XDG_RUNTIME_DIR:-/tmp}/ctl-recording" + notify-send -a ctl -t 2500 "Recording started" wf-recorder -f "$file" & ;; - "$rec_window") - geom=$(hyprctl activewindow -j | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"') + "$rec_area") file="$rec_dir/$(date +'%Y-%m-%d_%H-%M-%S').mp4" - notify-send -a ctl -t 2500 "recording started" - wf-recorder -g "$geom" -f "$file" & + echo "$file" > "${XDG_RUNTIME_DIR:-/tmp}/ctl-recording" + notify-send -a ctl -t 2500 "Recording started" + wf-recorder -g "$(slurp)" -f "$file" & ;; esac ;;