feat: use xdg config dirs
This commit is contained in:
parent
f9f756d80b
commit
da24197c65
9 changed files with 90 additions and 61 deletions
|
|
@ -8,7 +8,7 @@ fi
|
||||||
|
|
||||||
x setup
|
x setup
|
||||||
x mon
|
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 &
|
setxkbmap -layout us -variant colemak &
|
||||||
pgrep -u "$USER" -f clipmenud >/dev/null || clipmenud &
|
pgrep -u "$USER" -f clipmenud >/dev/null || clipmenud &
|
||||||
# dwmblocks &
|
# dwmblocks &
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ unbind Up; bind k selectp -U
|
||||||
unbind Right; bind l selectp -R
|
unbind Right; bind l selectp -R
|
||||||
|
|
||||||
unbind :; bind : display-popup -E 'mux cmd'\; refresh -S
|
unbind :; bind : display-popup -E 'mux cmd'\; refresh -S
|
||||||
unbind s; bind s display-popup -E 'mux pick-session'\; 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 W; bind W display-popup -E 'mux pick-window'\; refresh -S
|
||||||
unbind p; bind p display-popup -E 'mux pick-pane'\; refresh -S
|
unbind P; bind P display-popup -E 'mux pick-pane'\; refresh -S
|
||||||
|
|
||||||
bind -r Left resizep -L 5
|
bind -r Left resizep -L 5
|
||||||
bind -r Right resizep -R 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 a; bind a run 'mux ai'
|
||||||
unbind c; bind c run 'mux code'
|
unbind c; bind c run 'mux code'
|
||||||
unbind r; bind r run 'mux run'
|
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 g; bind g run 'mux git'
|
||||||
unbind m; bind m run 'mux misc'
|
unbind m; bind m run 'mux misc'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@
|
||||||
import nixpkgs {
|
import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
config.allowUnfreePredicate =
|
config.allowUnfreePredicate =
|
||||||
pkg:
|
pkg: builtins.elem (nixpkgs.lib.getName pkg) (sharedUnfree ++ extraUnfree);
|
||||||
builtins.elem (nixpkgs.lib.getName pkg) (sharedUnfree ++ extraUnfree);
|
|
||||||
inherit overlays;
|
inherit overlays;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports = [
|
||||||
[
|
|
||||||
./modules/bootstrap.nix
|
./modules/bootstrap.nix
|
||||||
./modules/theme.nix
|
./modules/theme.nix
|
||||||
./modules/shell.nix
|
./modules/shell.nix
|
||||||
|
|
@ -27,12 +26,32 @@
|
||||||
|
|
||||||
home.username = "barrett";
|
home.username = "barrett";
|
||||||
home.homeDirectory =
|
home.homeDirectory =
|
||||||
if hostConfig.isDarwin
|
if hostConfig.isDarwin then "/Users/${config.home.username}" else "/home/${config.home.username}";
|
||||||
then "/Users/${config.home.username}"
|
|
||||||
else "/home/${config.home.username}";
|
|
||||||
home.stateVersion = "24.11";
|
home.stateVersion = "24.11";
|
||||||
|
|
||||||
xdg.enable = true;
|
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;
|
targets.genericLinux.enable = hostConfig.isLinux && !hostConfig.isNixOS;
|
||||||
news.display = "silent";
|
news.display = "silent";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,24 +9,27 @@ let
|
||||||
homeDir = config.home.homeDirectory;
|
homeDir = config.home.homeDirectory;
|
||||||
repoDir = "${homeDir}/.config/nix";
|
repoDir = "${homeDir}/.config/nix";
|
||||||
|
|
||||||
directories =
|
directories = [ "dev" ];
|
||||||
[
|
|
||||||
"dev"
|
pictureSubdirs = [
|
||||||
"Downloads"
|
"Screensavers"
|
||||||
"Pictures"
|
"Screenshots"
|
||||||
]
|
"wp"
|
||||||
++ lib.optionals hostConfig.isLinux [
|
|
||||||
"Pictures/Screensavers"
|
|
||||||
"Pictures/Screenshots"
|
|
||||||
"Pictures/wp"
|
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.activation.createDirectories = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
home.activation.createDirectories = lib.hm.dag.entryAfter [ "writeBoundary" ] (
|
||||||
|
''
|
||||||
for dir in ${lib.concatStringsSep " " directories}; do
|
for dir in ${lib.concatStringsSep " " directories}; do
|
||||||
run mkdir -p "$HOME/$dir"
|
run mkdir -p "$HOME/$dir"
|
||||||
done
|
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" ] ''
|
home.activation.cleanDanglingLinks = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
for link in "$HOME/.nix-profile" "$HOME/.nix-defexpr"; do
|
for link in "$HOME/.nix-profile" "$HOME/.nix-defexpr"; do
|
||||||
|
|
@ -37,7 +40,7 @@ in
|
||||||
home.activation.linkWallpapers = lib.mkIf hostConfig.isLinux (
|
home.activation.linkWallpapers = lib.mkIf hostConfig.isLinux (
|
||||||
lib.hm.dag.entryAfter [ "createDirectories" ] ''
|
lib.hm.dag.entryAfter [ "createDirectories" ] ''
|
||||||
src="${repoDir}/config/screen"
|
src="${repoDir}/config/screen"
|
||||||
dest="$HOME/Pictures/Screensavers"
|
dest="${config.xdg.userDirs.pictures}/Screensavers"
|
||||||
if [ -d "$src" ]; then
|
if [ -d "$src" ]; then
|
||||||
for f in "$src"/*; do
|
for f in "$src"/*; do
|
||||||
[ -f "$f" ] || continue
|
[ -f "$f" ] || continue
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ in
|
||||||
xdg.configFile."hypr/hyprpaper.conf".text = ''
|
xdg.configFile."hypr/hyprpaper.conf".text = ''
|
||||||
wallpaper {
|
wallpaper {
|
||||||
monitor =
|
monitor =
|
||||||
path = ${config.home.homeDirectory}/Pictures/Screensavers/wallpaper.jpg
|
path = ${config.xdg.userDirs.pictures}/Screensavers/wallpaper.jpg
|
||||||
}
|
}
|
||||||
|
|
||||||
splash = false
|
splash = false
|
||||||
|
|
@ -75,7 +75,7 @@ in
|
||||||
|
|
||||||
background {
|
background {
|
||||||
monitor =
|
monitor =
|
||||||
path = ${config.home.homeDirectory}/Pictures/Screensavers/lock.jpg
|
path = ${config.xdg.userDirs.pictures}/Screensavers/lock.jpg
|
||||||
}
|
}
|
||||||
|
|
||||||
animations {
|
animations {
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".local/share/fonts" = lib.mkIf hostConfig.isLinux {
|
home.file.".local/share/fonts" = lib.mkIf hostConfig.isLinux {
|
||||||
source =
|
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/fonts";
|
||||||
config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/nix/fonts";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.activation.checkFonts = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
home.activation.checkFonts = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,13 @@ in
|
||||||
format = "{icon}";
|
format = "{icon}";
|
||||||
format-charging = "{icon}";
|
format-charging = "{icon}";
|
||||||
format-full = "{icon}";
|
format-full = "{icon}";
|
||||||
format-icons = ["" "" "" "" ""];
|
format-icons = [
|
||||||
|
""
|
||||||
|
""
|
||||||
|
""
|
||||||
|
""
|
||||||
|
""
|
||||||
|
];
|
||||||
states = {
|
states = {
|
||||||
hi = 30;
|
hi = 30;
|
||||||
mid = 20;
|
mid = 20;
|
||||||
|
|
|
||||||
33
scripts/ctl
33
scripts/ctl
|
|
@ -11,7 +11,7 @@ require() {
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
screenshot)
|
screenshot)
|
||||||
dir="$HOME/Pictures/Screenshots"
|
dir="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots"
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png"
|
file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png"
|
||||||
if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then
|
if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then
|
||||||
|
|
@ -24,7 +24,7 @@ screenshot)
|
||||||
;;
|
;;
|
||||||
ocr)
|
ocr)
|
||||||
require tesseract
|
require tesseract
|
||||||
dir="$HOME/Pictures/Screenshots"
|
dir="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots"
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png"
|
file="$dir/$(openssl rand -hex 10)-$(date +'%Y-%m-%d_%H-%M-%S').png"
|
||||||
if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then
|
if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then
|
||||||
|
|
@ -187,37 +187,40 @@ wifi)
|
||||||
media)
|
media)
|
||||||
if pgrep -x wf-recorder >/dev/null 2>&1; then
|
if pgrep -x wf-recorder >/dev/null 2>&1; then
|
||||||
pkill -INT wf-recorder
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
require fuzzel grim slurp wl-copy wf-recorder hyprctl jq
|
require fuzzel grim slurp wl-copy wf-recorder
|
||||||
ss_dir="$HOME/Pictures/Screenshots"
|
ss_dir="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots"
|
||||||
rec_dir="$HOME/Pictures/Recordings"
|
rec_dir="${XDG_VIDEOS_DIR:-$HOME/Videos}"
|
||||||
mkdir -p "$ss_dir" "$rec_dir"
|
mkdir -p "$ss_dir" "$rec_dir"
|
||||||
desktop=" Capture Desktop"
|
desktop=" Capture Desktop"
|
||||||
area=" Capture Area"
|
area=" Capture Area"
|
||||||
rec_desktop=" Record Desktop"
|
rec_desktop=" Record Desktop"
|
||||||
rec_window=" Record Window"
|
rec_area=" Record Area"
|
||||||
chosen="$(printf '%s\n' "$desktop" "$area" "$rec_desktop" "$rec_window" | fuzzel --dmenu --hide-prompt --lines=4 --width=25 --no-icons)"
|
chosen="$(printf '%s\n' "$desktop" "$area" "$rec_desktop" "$rec_area" | fuzzel --dmenu --hide-prompt --lines=4 --width=25 --no-icons)"
|
||||||
case "$chosen" in
|
case "$chosen" in
|
||||||
"$desktop")
|
"$desktop")
|
||||||
file="$ss_dir/$(date +'%Y-%m-%d_%H-%M-%S').png"
|
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")
|
"$area")
|
||||||
file="$ss_dir/$(date +'%Y-%m-%d_%H-%M-%S').png"
|
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")
|
"$rec_desktop")
|
||||||
file="$rec_dir/$(date +'%Y-%m-%d_%H-%M-%S').mp4"
|
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" &
|
wf-recorder -f "$file" &
|
||||||
;;
|
;;
|
||||||
"$rec_window")
|
"$rec_area")
|
||||||
geom=$(hyprctl activewindow -j | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')
|
|
||||||
file="$rec_dir/$(date +'%Y-%m-%d_%H-%M-%S').mp4"
|
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"
|
||||||
wf-recorder -g "$geom" -f "$file" &
|
notify-send -a ctl -t 2500 "Recording started"
|
||||||
|
wf-recorder -g "$(slurp)" -f "$file" &
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue