aboutsummaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/dot_config/fcitx5/conf/private_notifications.conf2
-rw-r--r--home/dot_config/fcitx5/private_profile6
-rw-r--r--home/dot_config/git/config.tmpl1
-rw-r--r--home/dot_config/git/excludes2
-rw-r--r--home/dot_config/kitty/kitty.conf21
-rw-r--r--home/dot_config/mpd/mpd.conf.tmpl2
-rw-r--r--home/dot_config/npm/npmrc.tmpl1
-rw-r--r--home/dot_config/pip/user.conf (renamed from home/dot_config/pip/pip.conf)2
-rw-r--r--home/dot_config/private_homebrew/brew.env3
-rw-r--r--home/dot_local/share/Anki2/addons21/mode/__init__.py30
-rw-r--r--home/dot_local/share/bin/executable_=2
-rw-r--r--home/dot_local/share/bin/executable_dbg115
-rw-r--r--home/dot_local/share/bin/executable_fork2
-rw-r--r--home/dot_local/share/bin/executable_fork.tmpl2
-rw-r--r--home/dot_local/share/bin/executable_lsjlink11
-rw-r--r--home/dot_local/share/bin/executable_venvgen2
-rw-r--r--home/dot_profile19
-rw-r--r--home/dot_zshrc4
-rw-r--r--home/private_Library/private_Application Support/symlink_Anki21
19 files changed, 180 insertions, 48 deletions
diff --git a/home/dot_config/fcitx5/conf/private_notifications.conf b/home/dot_config/fcitx5/conf/private_notifications.conf
index 32460db..b4fe5d5 100644
--- a/home/dot_config/fcitx5/conf/private_notifications.conf
+++ b/home/dot_config/fcitx5/conf/private_notifications.conf
@@ -1,3 +1,3 @@
# 隠す通知
-HiddenNotifications=
+# HiddenNotifications=
diff --git a/home/dot_config/fcitx5/private_profile b/home/dot_config/fcitx5/private_profile
index a3e35fe..55a0a3f 100644
--- a/home/dot_config/fcitx5/private_profile
+++ b/home/dot_config/fcitx5/private_profile
@@ -10,19 +10,19 @@ DefaultIM=mozc
# Name
Name=keyboard-us
# Layout
-Layout=
+# Layout=
[Groups/0/Items/1]
# Name
Name=keyboard-us-intl
# Layout
-Layout=
+# Layout=
[Groups/0/Items/2]
# Name
Name=mozc
# Layout
-Layout=
+# Layout=
[GroupOrder]
0=Default
diff --git a/home/dot_config/git/config.tmpl b/home/dot_config/git/config.tmpl
index cbc2b81..51b207f 100644
--- a/home/dot_config/git/config.tmpl
+++ b/home/dot_config/git/config.tmpl
@@ -2,6 +2,7 @@
defaultBranch = {{ dig "git" "default_branch" "master" . }}
[core]
quotepath = off
+ excludesfile = {{ env "XDG_CONFIG_HOME" }}/git/excludes
[user]
{{- with (dig "git" "email" nil .) }}
email = {{ . }}
diff --git a/home/dot_config/git/excludes b/home/dot_config/git/excludes
new file mode 100644
index 0000000..e2419c8
--- /dev/null
+++ b/home/dot_config/git/excludes
@@ -0,0 +1,2 @@
+.DS_Store
+__MACOSX
diff --git a/home/dot_config/kitty/kitty.conf b/home/dot_config/kitty/kitty.conf
index 13039f1..2d1bc9a 100644
--- a/home/dot_config/kitty/kitty.conf
+++ b/home/dot_config/kitty/kitty.conf
@@ -18,7 +18,28 @@ remember_window_position no
remember_window_size no
initial_window_width 80c
initial_window_height 25c
+copy_on_select clipboard
placement_strategy top-left
window_margin_width 8
+map command+option+s no_op
+map command+t no_op
+map command+enter no_op
+map command+shift+d no_op
+map command+shift+w no_op
+map command+w close_os_window
+map command+option+r no_op
+map command+k no_op
+map command+option+k no_op
+map command+control+l no_op
+map command+l no_op
+map command+f no_op
+
+map kitty_mod+t no_op
+map kitty_mod+enter no_op
+map kitty_mod+w no_op
+map kitty_mod+q no_op
+map kitty_mod+delete no_op
+map kitty_mod+slash no_op
+
diff --git a/home/dot_config/mpd/mpd.conf.tmpl b/home/dot_config/mpd/mpd.conf.tmpl
index bf0cf3d..141a565 100644
--- a/home/dot_config/mpd/mpd.conf.tmpl
+++ b/home/dot_config/mpd/mpd.conf.tmpl
@@ -9,7 +9,7 @@
{{- $music_directory = . -}}
{{- end -}}
-{{- $playlist_directory := "{{ $base_dir }}/playlists" }}
+{{- $playlist_directory := printf "%s/playlists" $base_dir }}
{{- with (dig "mpd" "playlist_dir" nil .) -}}
{{- $playlist_directory = . -}}
{{- end -}}
diff --git a/home/dot_config/npm/npmrc.tmpl b/home/dot_config/npm/npmrc.tmpl
new file mode 100644
index 0000000..9b8548e
--- /dev/null
+++ b/home/dot_config/npm/npmrc.tmpl
@@ -0,0 +1 @@
+prefix={{ .chezmoi.homeDir }}/.local
diff --git a/home/dot_config/pip/pip.conf b/home/dot_config/pip/user.conf
index ebfb002..8538a1d 100644
--- a/home/dot_config/pip/pip.conf
+++ b/home/dot_config/pip/user.conf
@@ -2,3 +2,5 @@
break-system-packages = true
user = true
+[uninstall]
+break-system-packages = true
diff --git a/home/dot_config/private_homebrew/brew.env b/home/dot_config/private_homebrew/brew.env
index 9f42034..c3e0c10 100644
--- a/home/dot_config/private_homebrew/brew.env
+++ b/home/dot_config/private_homebrew/brew.env
@@ -1,4 +1,5 @@
+HOMEBREW_BAT=1
HOMEBREW_NO_AUTO_UPDATE=1
HOMEBREW_NO_ENV_HINTS=1
-HOMEBREW_BAT=1
HOMEBREW_NO_ANALYTICS=1
+HOMEBREW_NO_ASK=1
diff --git a/home/dot_local/share/Anki2/addons21/mode/__init__.py b/home/dot_local/share/Anki2/addons21/mode/__init__.py
index 071eb03..8eb3758 100644
--- a/home/dot_local/share/Anki2/addons21/mode/__init__.py
+++ b/home/dot_local/share/Anki2/addons21/mode/__init__.py
@@ -1,18 +1,26 @@
#!/usr/bin/env python3
from aqt import mw
-from aqt.utils import tr
from aqt.theme import Theme
-from os import environ
+from os import getenv
from pathlib import Path
+from sys import platform
-THEME_DARK = 2
-THEME_LIGHT = 1
+def set_theme_mode():
+ XDG_CACHE_HOME = Path(getenv('XDG_CACHE_HOME', Path.home().joinpath('.cache')))
+ path = XDG_CACHE_HOME.joinpath('mode/state/mode')
+ with path.open() as file:
+ mode = file.read().strip()
+ if mode == "dark":
+ mw.set_theme(Theme.DARK)
+ if mode == "light":
+ mw.set_theme(Theme.LIGHT)
-path = Path(environ['XDG_CACHE_HOME'], 'mode/state/mode')
-with path.open() as file:
- mode = file.read().strip()
- if mode == "dark":
- mw.set_theme(Theme(THEME_DARK))
- if mode == "light":
- mw.set_theme(Theme(THEME_LIGHT))
+def set_theme_system():
+ mw.set_theme(Theme.FOLLOW_SYSTEM)
+
+set_theme = {
+ "darwin": set_theme_system,
+ "linux": set_theme_mode,
+}.get(platform, lambda: None)
+set_theme()
diff --git a/home/dot_local/share/bin/executable_= b/home/dot_local/share/bin/executable_=
index 2c4ccf4..7474cf8 100644
--- a/home/dot_local/share/bin/executable_=
+++ b/home/dot_local/share/bin/executable_=
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3 --
+#!/usr/bin/env -S python3 --
from sys import argv as _argv
from os import environ as _environ, path as _path
from math import *
diff --git a/home/dot_local/share/bin/executable_dbg b/home/dot_local/share/bin/executable_dbg
index 7976162..51d9227 100644
--- a/home/dot_local/share/bin/executable_dbg
+++ b/home/dot_local/share/bin/executable_dbg
@@ -1,27 +1,104 @@
-#!/usr/bin/env sh
-GDB="arm-none-eabi-gdb"
+#!/usr/bin/env python3
-found_executable=false
+from argparse import ArgumentParser
+from dataclasses import dataclass
+from os import execvp
+from pathlib import Path
+import importlib.util
-while ! $found_executable ; do
- [ ! -e build/zephyr ] && break
- [ ! -e build/zephyr/zephyr.elf ] && break
- set -- --se="build/zephyr/zephyr.elf" "$@"
+@dataclass
+class Options:
+ args: list[str]
+ gdb: str
+ dev_id: str | None
- [ -e build/tfm/bin/tfm_s.elf ] && set -- "$@" --eval-command="add-symbol-file build/tfm/bin/tfm_s.elf"
+def parse_arguments() -> Options:
+ parser = ArgumentParser(prog="dbg", description="GDB wrapper with automatic stuff")
- found_executable=true
-done
+ parser.add_argument("--gdb", default="arm-none-eabi-gdb", help="GDB executable to use")
+ parser.add_argument("-i", "--dev-id", type=str, help="J-Link probe serial number to connect to (USB)")
-while ! $found_executable ; do
- exec="$(find . -maxdepth 3 -name '*.elf' | head -n1)"
- [ -n "$exec" ] && set -- "$@" --se="$exec"
- found_executable=true
- break
-done
+ options, remainder = parser.parse_known_args()
+ if len(remainder) > 0 and remainder[0] == "--":
+ del remainder[0]
+ return Options(**vars(options), args=remainder)
-set -- "$@" --eval-command="set jlink autoconnect on"
-set -- "$@" --eval-command="set jlink watchdog on"
+def gdbarg_eval(eval_command: str):
+ return "--eval-command=" + eval_command
-exec "$GDB" "$@"
+def gdbarg_exec(path: str, secondary: bool = False):
+ if not secondary:
+ return "--se=" + path
+ else:
+ return gdbarg_eval("add-symbol-file " + path)
+
+
+def find_zephyr_sysbuild_executable() -> list[str]:
+ # TODO
+ return [ ]
+
+def find_zephyr_executable() -> list[str]:
+ out = []
+
+ if not Path("build/zephyr").exists():
+ return out
+
+ if not out:
+ zephyr = Path("build/zephyr/zephyr.elf")
+ if zephyr.exists():
+ out.append(gdbarg_exec(str(zephyr), False))
+ tfm = Path("build/tfm/bin/tfm_s.elf")
+ if tfm.exists():
+ out.append(gdbarg_exec(str(tfm), True))
+
+ if not out:
+ out += find_zephyr_sysbuild_executable()
+
+ return out
+
+def find_generic_executable(base: Path = Path("."), maxdepth: int = 3) -> list[str]:
+ if maxdepth == 0:
+ return []
+ out = []
+ for child in base.iterdir():
+ if child.is_dir():
+ out += find_generic_executable(child, maxdepth - 1)
+ if out:
+ return out
+ elif child.is_file():
+ if not child.name.endswith(".elf"):
+ continue
+ return [gdbarg_exec(str(child))]
+ else:
+ continue
+ return []
+
+def find_executable() -> list[str]:
+ out = []
+
+ out += find_zephyr_executable()
+ if out:
+ return out
+
+ out += find_generic_executable()
+ if out:
+ return out
+
+ return out
+
+if __name__ == "__main__":
+ options = parse_arguments()
+
+ if len(options.args) == 0:
+ options.args += find_executable()
+
+ if importlib.util.find_spec("debug_renesas") is not None:
+ if options.dev_id is not None:
+ options.args.append(gdbarg_eval(f"jlink server usb {options.dev_id}"))
+ options.args += [
+ gdbarg_eval("set jlink autoconnect on"),
+ gdbarg_eval("set jlink watchdog on"),
+ ]
+
+ execvp(options.gdb, [options.gdb] + options.args)
diff --git a/home/dot_local/share/bin/executable_fork b/home/dot_local/share/bin/executable_fork
deleted file mode 100644
index 1b1d56d..0000000
--- a/home/dot_local/share/bin/executable_fork
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env sh
-(setsid "$@" > /dev/null 2> /dev/null &)
diff --git a/home/dot_local/share/bin/executable_fork.tmpl b/home/dot_local/share/bin/executable_fork.tmpl
new file mode 100644
index 0000000..419b1d3
--- /dev/null
+++ b/home/dot_local/share/bin/executable_fork.tmpl
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+({{- if eq .chezmoi.os "linux" }}setsid{{- else -}}nohup{{- end }} "$@" > /dev/null 2> /dev/null &)
diff --git a/home/dot_local/share/bin/executable_lsjlink b/home/dot_local/share/bin/executable_lsjlink
new file mode 100644
index 0000000..bb7d8ee
--- /dev/null
+++ b/home/dot_local/share/bin/executable_lsjlink
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+
+import pylink
+
+jlink = pylink.JLink()
+
+emulators = jlink.connected_emulators()
+
+for emu in emulators:
+ print(f"{emu.SerialNumber}: {emu.acProduct.decode('ascii')}")
+
diff --git a/home/dot_local/share/bin/executable_venvgen b/home/dot_local/share/bin/executable_venvgen
index f9cabac..3ce41ac 100644
--- a/home/dot_local/share/bin/executable_venvgen
+++ b/home/dot_local/share/bin/executable_venvgen
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
# check if the input is valid
for arg in "$@" ; do
diff --git a/home/dot_profile b/home/dot_profile
index eb22d01..06eb8c1 100644
--- a/home/dot_profile
+++ b/home/dot_profile
@@ -31,6 +31,8 @@ export COLORTERM="truecolor"
# colors
alias diff='diff --color=auto'
+alias ls='ls --color=auto'
+alias grep='grep --color=auto'
# xdg base directories
export XDG_CONFIG_HOME="$HOME/.config"
@@ -38,6 +40,9 @@ export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
+# python site.USER_SITE
+export PYTHONUSERBASE="$HOME/.local"
+
# ruby
export GEM_HOME="$XDG_DATA_HOME/gem/ruby/3.0.0"
@@ -66,7 +71,7 @@ export PASSWORD_STORE_EXTENSIONS_DIR="$XDG_DATA_HOME/pass-extensions"
export MOZ_USE_XINPUT2=1
export LIBVIRT_DEFAULT_URI='qemu:///system'
export WINEDEBUG='fixme-all,err-all'
-export INPUTRC="$XDG_CONFIG_HOME/inputrc"
+alias poke='poke --quiet'
# LS_COLORS
[ ! -e "$XDG_CACHE_HOME/dircolors" ] || [ "$XDG_CONFIG_HOME/dircolors" -nt "$XDG_CACHE_HOME/dircolors" ] && dircolors "$XDG_CONFIG_HOME/dircolors" > "$XDG_CACHE_HOME/dircolors"
@@ -86,15 +91,21 @@ export STACK_ROOT="$XDG_DATA_HOME/stack"
export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default"
export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv"
export CONAN_USER_HOME="$XDG_CONFIG_HOME/conan"
-alias nvidia-settings='nvidia-settings --config="$XDG_CONFIG_HOME/nvidia/settings"'
-alias gpg2="gpg2 --homedir $XDG_DATA_HOME/gnupg"
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass"
export NMPASS_FORMAT="net/{ssid}/passwd"
export WGETRC="$XDG_CONFIG_HOME/wgetrc"
export TEXMFHOME="$XDG_DATA_HOME/texmf"
export TEXMFVAR="$XDG_CACHE_HOME/texlive/texmf-var"
export TEXMFCONFIG="$XDG_CONFIG_HOME/texlive/texmf-config"
-alias poke="poke --quiet"
+export INPUTRC="$XDG_CONFIG_HOME/inputrc"
+alias nvidia-settings='nvidia-settings --config="$XDG_CONFIG_HOME/nvidia/settings"'
+alias gpg2='gpg2 --homedir "$XDG_DATA_HOME/gnupg"'
+_pip3_user() {
+ [ -n "$VIRTUAL_ENV" ] && PIP_CONFIG_FILE="$XDG_CONFIG_HOME/pip/user.conf"
+ pip3 "$@"
+}
+alias pip3=_pip3_user
+alias pip=pip3
# CMake
export CMAKE_BUILD_TYPE=Debug
diff --git a/home/dot_zshrc b/home/dot_zshrc
index b817e75..a44ac3f 100644
--- a/home/dot_zshrc
+++ b/home/dot_zshrc
@@ -4,10 +4,6 @@ export ZSH_COMPDUMP="$XDG_CACHE_HOME/zcompdump"
# do not glob for calculator command
aliases[=]="noglob ="
-# color aliases
-alias ls='ls --color=auto'
-alias grep='grep --color=auto'
-
# completion
autoload -U compinit
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
diff --git a/home/private_Library/private_Application Support/symlink_Anki2 b/home/private_Library/private_Application Support/symlink_Anki2
new file mode 100644
index 0000000..c9b40f5
--- /dev/null
+++ b/home/private_Library/private_Application Support/symlink_Anki2
@@ -0,0 +1 @@
+../../.local/share/Anki2