diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..b2dadf30 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 674e4c51..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "dotdrop"] - path = dotdrop - url = https://github.com/deadc0de6/dotdrop.git diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..79df10e4 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,50 @@ +#!/bin/sh + +# Source husky +# shellcheck disable=SC1091 +. "$(dirname -- "$0")/_/husky.sh" + +echo "FunctionalHacker's dotfile pre-commit hook start" +printf "Using shell: %s \n" "$(readlink /proc/$$/exe)" + +# All staged files +staged_files=$(git diff --name-only --cached --diff-filter=d) + +# Run taplo on staged TOML files +staged_toml=$(echo "$staged_files" | grep '.toml$' || true) +num_staged_toml=$(echo "$staged_toml" | grep -vce '^$' || true) +if [ "$num_staged_toml" -gt 0 ]; then + printf '\nFormatting %s staged TOML files with taplo\n' "$num_staged_toml" + taplo format "$staged_toml" + printf "Re-staging\n" + git add $staged_toml +fi + +# Run lua-format on staged Lua files +staged_lua=$(echo "$staged_files" | grep '.lua$' || true) +num_staged_lua=$(echo "$staged_lua" | grep -vce '^$' || true) +if [ "$num_staged_lua" -gt 0 ]; then + printf '\nFormatting %s staged Lua files with stylua\n' "$num_staged_lua" + + for file in $staged_lua; do + stylua "$file" + done + + printf "Re-staging\n\n" + git add $staged_lua +fi + +# Run shfmt on staged shell scripts +staged_sh=$(echo "$staged_files" | grep -E '(.sh$|pre-commit)' || true) +num_staged_sh=$(echo "$staged_sh" | grep -vce '^$' || true) +if [ "$num_staged_sh" -gt 0 ]; then + printf '\nFormatting %s staged shell scripts with shfmt\n' "$num_staged_sh" + shfmt -w $staged_sh + printf "Re-staging\n\n" + git add $staged_sh +fi + +# Run prettier on all other staged files +# that are supported +printf "\nRunning prettier on all supported files\n" +npx pretty-quick --staged diff --git a/.ignore b/.ignore new file mode 100644 index 00000000..6c41465d --- /dev/null +++ b/.ignore @@ -0,0 +1 @@ +dotdrop/ diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..2fd7d0d7 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +package-lock.json +lazy-lock.json +dotdrop/ diff --git a/.prettierrc.toml b/.prettierrc.toml new file mode 100644 index 00000000..30508e6c --- /dev/null +++ b/.prettierrc.toml @@ -0,0 +1,4 @@ +"$schema" = "https://json.schemastore.org/prettierrc.json" +trailingComma = "es5" +singleQuote = true +tabWidth = 2 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a5efa078..00000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Marko Korhonen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/LICENSE.adoc b/LICENSE.adoc new file mode 100644 index 00000000..276f8d35 --- /dev/null +++ b/LICENSE.adoc @@ -0,0 +1,14 @@ +== The MIT License (MIT) + +Copyright (c) {localyear} Marko Korhonen + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), +to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.adoc b/README.adoc new file mode 100644 index 00000000..5e0b5219 --- /dev/null +++ b/README.adoc @@ -0,0 +1,23 @@ += FunctionalHacker's dotfiles + +image:https://i.imgur.com/lz1Q4Zz.png?raw=true%22[screenshot of my +setup] + +My personal dotfiles for my workstations, mostly for easy access for +myself but feel free to steal them for yourself! + +I’m using https://github.com/deadc0de6/dotdrop[dotdrop] to manage and +ease deployment of my dotfiles. + +== Mirrors + +This repository lives at https://git.korhonen.cc/FunctionalHacker/dotfiles[my git server], +but it is also mirrored to: + +* https://gitlab.com/FunctionalHacker/dotfiles[GitLab] +* https://github.com/FunctionalHacker/dotfiles[GitHub] +* https://bitbucket.org/FunctionalHacker/dotfiles[Bitbucket] +* https://codeberg.org/FunctionalHacker/dotfiles[codeberg] + +If you have any ideas for improvements, questions or anything of this +sort, you can open an issue or a pull request at any of the mirrors. diff --git a/README.md b/README.md deleted file mode 100644 index 405eb8fc..00000000 --- a/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# FunctionalHacker's dotfiles -![screenshot of my setup](https://i.imgur.com/lz1Q4Zz.png?raw=true") - -My personal dotfiles for my workstations, mostly for easy access for myself -but feel free to steal them for yourself! - -I'm using [dotdrop](https://github.com/deadc0de6/dotdrop) to manage and ease deployment of my dotfiles. - -## Mirrors -This repository lives at [My git server](https://git.korhonen.cc/FunctionalHacker/dotfiles), but it is also mirrored to: -- [GitLab](https://gitlab.com/FunctionalHacker/dotfiles) -- [GitHub](https://github.com/FunctionalHacker/dotfiles) -- [Bitbucket](https://bitbucket.org/FunctionalHacker/dotfiles) -- [codeberg](https://codeberg.org/FunctionalHacker/dotfiles) - -If you have any ideas for improvements, questions or anything of this sort, you can open an issue or a pull request in either my git server (registrations open for anyone), or any of the mirrors. diff --git a/config-root.toml b/config-root.toml new file mode 100644 index 00000000..0faab602 --- /dev/null +++ b/config-root.toml @@ -0,0 +1,282 @@ +[actions] +mkinitcpio = "mkinitcpio -P" + +[config] +backup = true +banner = true +create = true +dotpath = "root" +ignoreempty = false +keepdot = true +link_dotfile_default = "nolink" +link_on_import = "nolink" +longkey = false +showdiff = false +workdir = "~/.config/sdotdrop" + +[dotfiles."f_60-uinput-permissions.rules"] +dst = "/etc/udev/rules.d/60-uinput-permissions.rules" +src = "etc/udev/rules.d/60-uinput-permissions.rules" + +[dotfiles."f_yubikey_udev.rules"] +dst = "/etc/udev/rules.d/20-yubikey.rules" +src = "etc/udev/rules.d/20-yubikey.rules" + +[dotfiles.d_bin] +dst = "/usr/local/bin" +src = "usr/local/bin" + +[dotfiles.d_network] +src = "etc/systemd/network" +dst = "/etc/systemd/network" + +[dotfiles."f_networkd.conf"] +src = "etc/systemd/networkd.conf" +dst = "/etc/systemd/networkd.conf" + +[dotfiles."f_99-sysctl.conf"] +dst = "/etc/sysctl.d/99-sysctl.conf" +src = "etc/sysctl.d/99-sysctl.conf" + +[dotfiles."f_adb.service"] +dst = "/etc/systemd/system/adb.service" +src = "etc/systemd/system/adb.service" + +[dotfiles."f_clamd.conf"] +dst = "/etc/clamav/clamd.conf" +src = "etc/clamav/clamd.conf" + +[dotfiles.f_cryptissue] +dst = "/etc/cryptissue" +src = "etc/cryptissue" + +[dotfiles."f_detected.sh"] +dst = "/etc/clamav/detected.sh" +src = "etc/clamav/detected.sh" + +[dotfiles."f_freetype2.sh"] +dst = "/etc/profile.d/freetype2.sh" +src = "etc/profile.d/freetype2.sh" + +[dotfiles."f_fonts.conf"] +dst = "/etc/fonts/local.conf" +src = "etc/fonts/local.conf" + +[dotfiles."f_locale.conf"] +dst = "/etc/locale.conf" +src = "etc/locale.conf" + +[dotfiles."f_locale.gen"] +dst = "/etc/locale.gen" +src = "etc/locale.gen" + +[dotfiles."f_logind.conf"] +dst = "/etc/systemd/logind.conf" +src = "etc/systemd/logind.conf" + +[dotfiles."f_bluetooth.conf"] +dst = "/etc/bluetooth/main.conf" +src = "etc/bluetooth/main.conf" + +[dotfiles."f_pacman.conf"] +dst = "/etc/pacman.conf" +src = "etc/pacman.conf" + +[dotfiles.f_pacman_zsh_hook] +dst = "/etc/pacman.d/hooks/zsh.hook" +src = "etc/pacman.d/hooks/zsh.hook" + +[dotfiles."f_plymouthd.conf"] +src = "etc/plymouth/plymouthd.conf" +dst = "/etc/plymouth/plymouthd.conf" + +[dotfiles.f_sshd_config] +dst = "/etc/ssh/sshd_config" +src = "etc/ssh/sshd_config" + +[dotfiles."f_welcomemessage.conf"] +dst = "/etc/welcomemessage.conf" +src = "etc/welcomemessage.conf" + +[dotfiles."f_99-conbee-usb-serial.rules"] +src = "etc/udev/rules.d/99-conbee-usb-serial.rules" +dst = "/etc/udev/rules.d/99-conbee-usb-serial.rules" + +[dotfiles."f_99-lowbat.rules"] +src = "etc/udev/rules.d/99-lowbat.rules" +dst = "/etc/udev/rules.d/99-lowbat.rules" + +[dotfiles."f_sleep.conf"] +src = "etc/systemd/sleep.conf" +dst = "/etc/systemd/sleep.conf" + +[dotfiles.f_fstab] +src = "etc/fstab" +dst = "/etc/fstab" + +[dotfiles.f_ignore] +src = ".ignore" +dst = "/.ignore" + +[dotfiles."f_mkinitcpio.conf"] +src = "etc/mkinitcpio.conf" +dst = "/etc/mkinitcpio.conf" +actions = ["mkinitcpio"] + +[dotfiles."f_vconsole.conf"] +src = "etc/vconsole.conf" +dst = "/etc/vconsole.conf" + +[dotfiles."f_20-quiet-printk.conf"] +src = "etc/sysctl.d/20-quiet-printk.conf" +dst = "/etc/sysctl.d/20-quiet-printk.conf" + +[dotfiles."f_system.conf"] +src = "etc/systemd/system.conf" +dst = "/etc/systemd/system.conf" + +[dotfiles.f_cpupower] +src = "etc/default/cpupower" +dst = "/etc/default/cpupower" + +[dotfiles."f_pacserve.service.conf"] +src = "etc/pacserve/pacserve.service.conf" +dst = "/etc/pacserve/pacserve.service.conf" + +[dotfiles."f_mkinitcpio_linux.preset"] +src = "etc/mkinitcpio.d/linux.preset" +dst = "/etc/mkinitcpio.d/linux.preset" + +[dotfiles.f_cmdline] +src = "etc/kernel/cmdline" +dst = "/etc/kernel/cmdline" +actions = ["mkinitcpio"] + +[dotfiles."f_timesyncd.conf"] +src = "etc/systemd/timesyncd.conf" +dst = "/etc/systemd/timesyncd.conf" + +[dotfiles.f_sudoers_pacman] +src = "etc/sudoers.d/pacman" +dst = "/etc/sudoers.d/pacman" + +[dotfiles."f_doas.conf"] +src = "etc/doas.conf" +dst = "/etc/doas.conf" + +[dotfiles."f_flexo.toml"] +src = "etc/flexo/flexo.toml" +dst = "/etc/flexo/flexo.toml" + +[profiles.locale] +dotfiles = ["f_locale.conf", "f_locale.gen"] + +[profiles.pacman] +dotfiles = [ + "f_pacman.conf", + "f_pacman_zsh_hook", + "f_pacserve.service.conf", + "f_sudoers_pacman", +] + +[profiles.Mirkwood] +dotfiles = [ + "d_bin", + "f_20-quiet-printk.conf", + "f_60-uinput-permissions.rules", + "f_99-lowbat.rules", + "f_adb.service", + "f_bluetooth.conf", + "f_cmdline", + "f_cpupower", + "f_cryptissue", + "f_doas.conf", + "f_fonts.conf", + "f_freetype2.sh", + "f_ignore", + "f_logind.conf", + "f_mkinitcpio.conf", + "f_mkinitcpio_linux.preset", + "f_plymouthd.conf", + "f_sshd_config", + "f_system.conf", + "f_timesyncd.conf", + "f_welcomemessage.conf", + "f_flexo.toml", +] +include = ["locale", "pacman"] + +[profiles.VentoyArch] +dotfiles = [ + "d_bin", + "f_cmdline", + "f_doas.conf", + "f_fonts.conf", + "f_freetype2.sh", + "f_ignore", + "f_logind.conf", + "f_mkinitcpio.conf", + "f_mkinitcpio_linux.preset", + "f_plymouthd.conf", + "f_system.conf", + "f_timesyncd.conf", +] +include = ["locale", "pacman"] + +[profiles.Shire] +dotfiles = [ + "d_bin", + "f_20-quiet-printk.conf", + "f_60-uinput-permissions.rules", + "f_99-lowbat.rules", + "f_adb.service", + "f_bluetooth.conf", + "f_cmdline", + "f_cpupower", + "f_doas.conf", + "f_fonts.conf", + "f_freetype2.sh", + "f_ignore", + "f_logind.conf", + "f_mkinitcpio.conf", + "f_mkinitcpio_linux.preset", + "f_plymouthd.conf", + "f_sshd_config", + "f_system.conf", +] +include = ["locale", "pacman"] + +[profiles.Moria] +include = ["locale", "pacman"] +dotfiles = [ + "f_99-sysctl.conf", + "f_cmdline", + "f_cpupower", + "f_doas.conf", + "f_adb.service", + "f_mkinitcpio.conf", + "f_mkinitcpio_linux.preset", + "f_plymouthd.conf", + "f_sshd_config", + "f_flexo.toml", +] + +[profiles.Tirion] +dotfiles = ["f_doas.conf", "f_ignore", "f_sshd_config"] + +[profiles.Gondor] +include = ["locale", "pacman"] +dotfiles = ["f_doas.conf", "f_sshd_config"] + +[profiles.localhost] +include = ["locale"] + +[profiles.Edoras] +include = ["pacman"] + +[profiles.mko-laptop] +dotfiles = ["f_cpupower", "f_doas.conf", "f_timesyncd.conf"] + +[profiles.Evendim] +include = ["locale", "pacman"] +dotfiles = ["f_doas.conf", "f_sshd_config"] diff --git a/config-root.yaml b/config-root.yaml deleted file mode 100644 index 0b292e37..00000000 --- a/config-root.yaml +++ /dev/null @@ -1,161 +0,0 @@ -config: - backup: true - banner: true - create: true - dotpath: root - ignoreempty: false - keepdot: true - link_dotfile_default: nolink - link_on_import: nolink - longkey: false - showdiff: false - workdir: ~/.config/sdotdrop -dotfiles: - f_60-uinput-permissions.rules: - dst: /etc/udev/rules.d/60-uinput-permissions.rules - src: etc/udev/rules.d/60-uinput-permissions.rules - d_bin: - dst: /usr/local/bin - src: usr/local/bin - d_network: - src: etc/systemd/network - dst: /etc/systemd/network - f_networkd.conf: - src: etc/systemd/networkd.conf - dst: /etc/systemd/networkd.conf - f_99-sysctl.conf: - dst: /etc/sysctl.d/99-sysctl.conf - src: etc/sysctl.d/99-sysctl.conf - f_adb.service: - dst: /etc/systemd/system/adb.service - src: etc/systemd/system/adb.service - f_clamd.conf: - dst: /etc/clamav/clamd.conf - src: etc/clamav/clamd.conf - f_cryptissue: - dst: /etc/cryptissue - src: etc/cryptissue - f_detected.sh: - dst: /etc/clamav/detected.sh - src: etc/clamav/detected.sh - f_freetype2.sh: - dst: /etc/profile.d/freetype2.sh - src: etc/profile.d/freetype2.sh - f_fonts.conf: - dst: /etc/fonts/local.conf - src: etc/fonts/local.conf - f_locale.conf: - dst: /etc/locale.conf - src: etc/locale.conf - f_locale.gen: - dst: /etc/locale.gen - src: etc/locale.gen - f_logind.conf: - dst: /etc/systemd/logind.conf - src: etc/systemd/logind.conf - f_bluetooth.conf: - dst: /etc/bluetooth/main.conf - src: etc/bluetooth/main.conf - f_pacman.conf: - dst: /etc/pacman.conf - src: etc/pacman.conf - f_sshd_config: - dst: /etc/ssh/sshd_config - src: etc/ssh/sshd_config - f_welcomemessage.conf: - dst: /etc/welcomemessage.conf - src: etc/welcomemessage.conf - f_getty.conf: - src: etc/systemd/system/getty@tty1.service.d/override.conf - dst: /etc/systemd/system/getty@tty1.service.d/override.conf - f_99-conbee-usb-serial.rules: - src: etc/udev/rules.d/99-conbee-usb-serial.rules - dst: /etc/udev/rules.d/99-conbee-usb-serial.rules - f_99-lowbat.rules: - src: etc/udev/rules.d/99-lowbat.rules - dst: /etc/udev/rules.d/99-lowbat.rules - f_sleep.conf: - src: etc/systemd/sleep.conf - dst: /etc/systemd/sleep.conf - f_fstab: - src: etc/fstab - dst: /etc/fstab - f_ignore: - src: .ignore - dst: /.ignore - f_mkinitcpio.conf: - src: etc/mkinitcpio.conf - dst: /etc/mkinitcpio.conf - f_vconsole.conf: - src: etc/vconsole.conf - dst: /etc/vconsole.conf - f_20-quiet-printk.conf: - src: etc/sysctl.d/20-quiet-printk.conf - dst: /etc/sysctl.d/20-quiet-printk.conf - f_system.conf: - src: etc/systemd/system.conf - dst: /etc/systemd/system.conf - f_cpupower: - src: etc/default/cpupower - dst: /etc/default/cpupower - f_pacserve.service.conf: - src: etc/pacserve/pacserve.service.conf - dst: /etc/pacserve/pacserve.service.conf -profiles: - Network: - dotfiles: - - d_network - - f_networkd.conf - Locale: - dotfiles: - - f_locale.conf - - f_locale.gen - Pacman: - dotfiles: - - f_pacman.conf - - f_pacserve.service.conf - Mirkwood: - dotfiles: - - f_getty.conf - - f_cryptissue - - f_welcomemessage.conf - - d_bin - - f_adb.service - - f_bluetooth.conf - - f_sshd_config - - f_logind.conf - - f_60-uinput-permissions.rules - - f_freetype2.sh - - f_fonts.conf - - f_99-lowbat.rules - - f_ignore - - f_mkinitcpio.conf - - f_vconsole.conf - - f_20-quiet-printk.conf - - f_system.conf - - f_cpupower - include: - - Locale - - Pacman - - Network - Moria: - include: - - Locale - - Pacman - - Network - dotfiles: - - f_sshd_config - - f_99-sysctl.conf - - f_cpupower - Gondor: - include: - - Locale - - Pacman - dotfiles: - - f_sshd_config - localhost: - include: - - Locale - Edoras: - include: - - Pacman diff --git a/config.toml b/config.toml new file mode 100644 index 00000000..2490cd9c --- /dev/null +++ b/config.toml @@ -0,0 +1,285 @@ +#:schema ../../dotdrop-config-schema.json + +[actions] +dconf-load = "dconf load / < ~/.config/dconf.ini" +kanagawa-compile = "vim +KanagawaCompile +qa" + +[config] +backup = true +banner = true +create = true +dotpath = "home" +ignoreempty = false +keepdot = true +link_dotfile_default = "nolink" +link_on_import = "nolink" +longkey = false +showdiff = false +workdir = "~/.config/dotdrop" + +[dotfiles.d_systemd] +dst = "~/.config/systemd/user" +src = ".config/systemd/user" + +[dotfiles.d_mpv] +dst = "~/.config/mpv" +src = ".config/mpv" + +[dotfiles.d_nvim] +dst = "~/.config/nvim" +src = ".config/nvim" +actions = ["kanagawa-compile"] +instignore = ["*-lock.json"] + +[dotfiles."f_abcde.conf"] +dst = "~/.abcde.conf" +src = ".abcde.conf" + +[dotfiles.d_ssh] +dst = "~/.ssh" +src = ".ssh" + +[dotfiles.f_beets_config] +dst = "~/.config/beets/config.yaml" +src = ".config/beets/config.yaml" + +[dotfiles.f_beets_whitelist] +dst = "~/.config/beets/whitelist" +src = ".config/beets/whitelist" + +[dotfiles.f_gitconfig] +dst = "~/.config/git/config" +src = ".config/git/config" + +[dotfiles.f_librewolf_overrides] +dst = "~/.librewolf/librewolf.overrides.cfg" +src = ".librewolf/librewolf.overrides.cfg" + +[dotfiles."f_makepkg.conf"] +dst = "~/.config/pacman/makepkg.conf" +src = ".config/pacman/makepkg.conf" + +[dotfiles."f_mpd.conf"] +dst = "~/.config/mpd/mpd.conf" +src = ".config/mpd/mpd.conf" + +[dotfiles."f_mpdris2.conf"] +dst = "~/.config/mpDris2/mpDris2.conf" +src = ".config/mpDris2/mpDris2.conf" + +[dotfiles.f_ncmpcpp_bindings] +dst = "~/.config/ncmpcpp/bindings" +src = ".config/ncmpcpp/bindings" + +[dotfiles."f_ranger.conf"] +dst = "~/.config/ranger/rc.conf" +src = ".config/ranger/rc.conf" + +[dotfiles."f_ranger_commands.py"] +dst = "~/.config/ranger/commands.py" +src = ".config/ranger/commands.py" + +[dotfiles."f_ssh.conf"] +dst = "~/.ssh/config" +src = ".ssh/config" + +[dotfiles.f_zprofile] +dst = "~/.zprofile" +src = ".zprofile" + +[dotfiles.f_zshrc] +dst = "~/.zshrc" +src = ".zshrc" + +[dotfiles.d_zsh] +src = ".config/zsh" +dst = "~/.config/zsh" + +[dotfiles."f_fonts.conf"] +src = ".config/fontconfig/fonts.conf" +dst = "~/.config/fontconfig/fonts.conf" + +[dotfiles.f_ignore] +src = ".ignore" +dst = "~/.ignore" + +[dotfiles."f_ncmpcpp.conf"] +src = ".config/ncmpcpp/config" +dst = "~/.config/ncmpcpp/config" + +[dotfiles.f_hushlogin] +src = ".hushlogin" +dst = "~/.hushlogin" + +[dotfiles."f_paru.conf"] +src = ".config/paru/paru.conf" +dst = "~/.config/paru/paru.conf" + +[dotfiles."f_foot.ini"] +src = ".config/foot/foot.ini" +dst = "~/.config/foot/foot.ini" + +[dotfiles."f_gpg-agent.conf"] +src = ".gnupg/gpg-agent.conf" +dst = "~/.gnupg/gpg-agent.conf" +chmod = "600" + +[dotfiles."f_gpg.conf"] +src = ".gnupg/gpg.conf" +dst = "~/.gnupg/gpg.conf" + +[dotfiles."f_gpg_scdaemon.conf"] +src = ".gnupg/scdaemon.conf" +dst = "~/.gnupg/scdaemon.conf" + +[dotfiles."f_electron-flags.conf"] +src = ".config/electron-flags.conf" +dst = "~/.config/electron-flags.conf" + +[dotfiles."f_electron12-flags.conf"] +src = ".config/electron12-flags.conf" +dst = "~/.config/electron12-flags.conf" + +[dotfiles.f_pam_environment] +src = ".pam_environment" +dst = "~/.pam_environment" + +[dotfiles."f_dconf.ini"] +src = ".config/dconf.ini" +dst = "~/.config/dconf.ini" +actions = ["dconf-load"] + +[dotfiles."f_docker-config.json"] +src = ".docker/config.json" +dst = "~/.docker/config.json" +chmod = "600" + +[dotfiles.f_npmrc] +src = ".npmrc" +dst = "~/.npmrc" +chmod = "600" + +[dotfiles.f_zellij] +src = ".config/zellij/config.kdl" +dst = "~/.config/zellij/config.kdl" + +[profiles.pacman] +dotfiles = ["f_makepkg.conf", "f_paru.conf"] + +[profiles.terminal] +dotfiles = [ + "d_nvim", + "d_ssh", + "d_zsh", + "f_gitconfig", + "f_hushlogin", + "f_ignore", + "f_ranger.conf", + "f_ranger_commands.py", + "f_zellij", + "f_zshrc", + "f_npmrc", +] + +[profiles.media] +dotfiles = [ + "d_mpv", + "f_abcde.conf", + "f_beets_config", + "f_beets_whitelist", + "f_mpd.conf", + "f_mpdris2.conf", + "f_ncmpcpp.conf", + "f_ncmpcpp_bindings", +] + +[profiles.gpg] +dotfiles = [ + "f_gpg-agent.conf", + "f_gpg.conf", + "f_gpg_scdaemon.conf", + "f_pam_environment", +] + +[profiles.Mirkwood] +include = ["pacman", "terminal", "media", "gpg"] +dotfiles = [ + "f_librewolf_overrides", + "f_dconf.ini", + "f_docker-config.json", + "f_fonts.conf", + "f_foot.ini", +] + +[profiles.Mirkwood.variables] +wayland = true + +[profiles.VentoyArch] +include = ["pacman", "terminal", "media", "gpg"] +dotfiles = [ + "f_dconf.ini", + "f_fonts.conf", +] + +[profiles.VentoyArch.variables] +wayland = true + +[profiles.Shire] +include = ["pacman", "terminal", "media", "gpg"] +dotfiles = [ + "f_dconf.ini", + "f_fonts.conf", +] + +[profiles.Shire.variables] +wayland = true + +[profiles.Moria] +include = ["pacman", "terminal", "media", "gpg"] +dotfiles = [ + "f_librewolf_overrides", + "f_dconf.ini", + "f_zprofile", + "f_fonts.conf", + "d_systemd", +] + +[profiles.Moria.variables] +wayland = true + +[profiles.Tirion] +include = ["terminal", "gpg"] + +[profiles.Gondor] +include = ["pacman", "terminal"] + +[profiles.mko-laptop] +include = ["terminal", "gpg"] +dotfiles = ["f_librewolf_overrides", "f_dconf.ini", "d_systemd"] + +[profiles.mko-laptop.variables] +wayland = true + +[profiles.Isengard] +include = ["terminal"] + +[profiles.Isengard.variables] +distro_id = "termux" + +[profiles.Edoras] +include = ["terminal"] + +[profiles.TakamakiPC] +include = ["terminal"] + +[profiles.TakamakiPC.variables] +wayland = false + +[profiles.localhost] +include = ["terminal"] + +[profiles.ViiruJaTeippi] +include = ["terminal"] + +[profiles.Evendim] +include = ["terminal", "pacman"] diff --git a/config.yaml b/config.yaml deleted file mode 100644 index dd2c6f0f..00000000 --- a/config.yaml +++ /dev/null @@ -1,257 +0,0 @@ -actions: - vim-plug: nvim +PlugInstall +qall -config: - backup: true - banner: true - create: true - dotpath: home - ignoreempty: false - keepdot: true - link_dotfile_default: nolink - link_on_import: nolink - longkey: false - showdiff: false - workdir: ~/.config/dotdrop -dotfiles: - d_systemd: - dst: ~/.config/systemd/user - src: .config/systemd/user - d_mpv: - dst: ~/.config/mpv - src: .config/mpv - d_neomutt: - dst: ~/.config/neomutt - src: .config/neomutt - d_imapnotify: - dst: ~/.config/imapnotify - src: .config/imapnotify - f_init.vim: - dst: ~/.config/nvim/init.vim - src: .config/nvim/init.vim - d_nvim_config: - actions: - - vim-plug - dst: ~/.config/nvim/conf.d - src: .config/nvim/conf.d - f_user-dirs.dirs: - dst: ~/.config/user-dirs.dirs - src: .config/user-dirs.dirs - f_coc-settings.json: - dst: ~/.config/nvim/coc-settings.json - src: .config/nvim/coc-settings.json - d_sway: - dst: ~/.config/sway - src: .config/sway - d_waybar: - dst: ~/.config/waybar - src: .config/waybar - d_wofi: - src: .config/wofi - dst: ~/.config/wofi - f_abcde.conf: - dst: ~/.abcde.conf - src: .abcde.conf - f_mbsyncrc: - dst: ~/.mbsyncrc - src: .mbsyncrc - f_alacritty.yml: - dst: ~/.config/alacritty/alacritty.yml - src: .config/alacritty/alacritty.yml - f_authorized_keys: - dst: ~/.ssh/authorized_keys - src: .ssh/authorized_keys - f_beets_config: - dst: ~/.config/beets/config.yaml - src: .config/beets/config.yaml - f_beets_whitelist: - dst: ~/.config/beets/whitelist - src: .config/beets/whitelist - f_bspwmrc: - dst: ~/.config/bspwm/bspwmrc - src: .config/bspwm/bspwmrc - f_gitconfig: - dst: ~/.gitconfig - src: .gitconfig - f_libra_config: - dst: ~/.config/libra/config.toml - src: .config/libra/config.toml - f_mailcap: - dst: ~/.mailcap - src: .mailcap - f_makepkg.conf: - dst: ~/.config/pacman/makepkg.conf - src: .config/pacman/makepkg.conf - f_mako_config: - dst: ~/.config/mako/config - src: .config/mako/config - f_mimeo_associations.txt: - dst: ~/.config/mimeo/associations.txt - src: .config/mimeo/associations.txt - f_mpd.conf: - dst: ~/.config/mpd/mpd.conf - src: .config/mpd/mpd.conf - f_mpdris2.conf: - dst: ~/.config/mpDris2/mpDris2.conf - src: .config/mpDris2/mpDris2.conf - f_mpdscribble.conf: - dst: ~/.mpdscribble/mpdscribble.conf - src: .mpdscribble/mpdscribble.conf - f_ncmpcpp_bindings: - dst: ~/.config/ncmpcpp/bindings - src: .config/ncmpcpp/bindings - f_ranger.conf: - dst: ~/.config/ranger/rc.conf - src: .config/ranger/rc.conf - f_ranger_commands.py: - dst: ~/.config/ranger/commands.py - src: .config/ranger/commands.py - f_redshift.conf: - dst: ~/.config/redshift/redshift.conf - src: .config/redshift/redshift.conf - f_rtv.cfg: - dst: ~/.config/rtv/rtv.cfg - src: .config/rtv/rtv.cfg - f_ssh.conf: - dst: ~/.ssh/config - src: .ssh/config - f_steam-native.desktop: - dst: ~/.local/share/applications/steam-native.desktop - src: .local/share/applications/steam-native.desktop - f_tdesktop_lang.strings: - dst: ~/.config/telegram-desktop/lang.strings - src: .config/telegram-desktop/lang.strings - f_tmux.conf: - dst: ~/.tmux.conf - src: .tmux.conf - f_youtube-dl_config: - dst: ~/.config/youtube-dl/config - src: .config/youtube-dl/config - f_zathurarc: - dst: ~/.config/zathura/zathurarc - src: .config/zathura/zathurarc - f_zshrc: - dst: ~/.zshrc - src: .zshrc - d_zsh: - src: .config/zsh - dst: ~/.config/zsh - f_fonts.conf: - src: .config/fontconfig/fonts.conf - dst: ~/.config/fontconfig/fonts.conf - f_ripgrep_ignore: - src: .ignore - dst: ~/.ignore - f_nvimpager: - src: .config/nvimpager/init.vim - dst: ~/.config/nvimpager/init.vim - f_ncmpcpp.conf: - src: .config/ncmpcpp/config - dst: ~/.config/ncmpcpp/config - f_hushlogin: - src: .hushlogin - dst: ~/.hushlogin - f_paru.conf: - src: .config/paru/paru.conf - dst: ~/.config/paru/paru.conf - f_msmtp_config: - src: .config/msmtp/config - dst: ~/.config/msmtp/config - f_foot.ini: - src: .config/foot/foot.ini - dst: ~/.config/foot/foot.ini -profiles: - base: - dotfiles: - - d_systemd - terminal: - dotfiles: - - f_nvimpager - - f_hushlogin - - f_ripgrep_ignore - - f_ranger_commands.py - - f_rtv.cfg - - f_mailcap - - d_zsh - - f_zshrc - - f_tmux.conf - - f_ranger.conf - - f_ssh.conf - - f_authorized_keys - - d_nvim_config - - f_init.vim - - f_coc-settings.json - - f_gitconfig - - f_alacritty.yml - email: - dotfiles: - - d_neomutt - - d_imapnotify - - f_mbsyncrc - - f_msmtp_config - media: - dotfiles: - - f_beets_config - - f_beets_whitelist - - f_abcde.conf - - d_mpv - - f_youtube-dl_config - - f_mpd.conf - - f_ncmpcpp_bindings - - f_ncmpcpp.conf - - f_libra_config - - f_mpdscribble.conf - - f_mpdris2.conf - sway: - dotfiles: - - d_sway - - d_waybar - - d_wofi - - f_mako_config - - f_redshift.conf - - f_zathurarc - - f_mimeo_associations.txt - - f_tdesktop_lang.strings - - f_fonts.conf - Pacman: - dotfiles: - - f_makepkg.conf - - f_paru.conf - Mirkwood: - include: - - base - - terminal - - email - - media - - sway - - Pacman - dotfiles: - - f_paru.conf - - f_user-dirs.dirs - - f_gitconfig - - f_foot.ini - Moria: - include: - - terminal - - media - - Pacman - Gondor: - include: - - terminal - - Pacman - mko-laptop: - include: - - terminal - Edoras: - include: - - terminal - - Pacman - TakamakiPC: - include: - - terminal - - Pacman - localhost: - include: - - terminal - ViiruJaTeippi: - include: - - terminal diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 2c63408e..00000000 --- a/deploy.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/zsh - -# This is a script that should be ran once -# on a new system. Dotdrop will take it from there. -# It is higly tailored to my own needs and -# you (the random person on the internet) should probably not run it - -export DOTREPO="$HOME/git/dotfiles" -DISTRO="$(lsb_release -ds | sed 's/"//g')" - -PKGLIST="python-ruamel-yaml python-magic-git python-jinja python-docopt" - -if [ -d $DOTREPO ]; then - print "Dotfile repository already exists, exiting..." - exit 1 -fi - -if [ "$DISTRO" -ne "Arch Linux" ]; then - print "Not running on Arch Linux" - print "Other distros not supported, exiting..." - exit 1 -fi - -# install neovim if not installed -if ! [ -x "$(command -v nvim)" ]; then - read -p "Install neovim? [Y/n] " -i "y" INVIM - if [ "$(tr '[:upper:]' ':lower:' $INVIM)" -eq "y" ]; then - print "Installing neovim" - PKGLIST=$PKGLIST + " neovim neovim-dropin" - fi -fi - -# install zsh if not installed -if ! [ -x "$(command -v zsh)" ]; then - read -p "Install zsh? [Y/n] " -i "y" IZSH - if [ "$(tr '[:upper:]' ':lower:' $INVIM)" -eq "y" ]; then - print "Installing zsh" - PKGLIST=$PKGLIST + " zsh" - fi -fi - -# install paru if not installed -if ! [ -x "$(command -v paru)" ]; then - read -p "Install paru? [Y/n] " -i "y" IYAY - if [ "$(tr '[:upper:]' ':lower:' $IYAY)" -eq "y" ]; then - print "Installing paru" - sudo pacman -Syu --needed --noconfirm git wget base-devel - cd - wget https://aur.archlinux.org/cgit/aur.git/snapshot/paru-bin.tar.gz - tar xfv paru-bin.tar.gz - cd paru-bin - makepkg -si --noconfirm - cd .. - rm -r paru* - fi -fi - -if [ $PKGLIST -ne "" ] - if ! [ -x "$(command -v paru)" ]; then - print "Can't continue without paru" - - paru -S $PKGLIST - fi -fi - -mkdir ~/git -git clone https://git.korhonen.cc/ReekyMarko/dotfiles.git $DOTREPO -cd ~/git/dotfiles -git submodule init -git submodule update -$DOTREPO/dotdrop.sh --cfg=$DOTREPO/config-home.yaml install -chsh -s /bin/zsh -zsh -c "source ~/.zshrc; sdotdrop install" diff --git a/docker/auth/docker-compose.yaml b/docker/auth/docker-compose.yaml deleted file mode 100644 index 7bbc62f1..00000000 --- a/docker/auth/docker-compose.yaml +++ /dev/null @@ -1,20 +0,0 @@ -version: "2" - -services: - openldap: - container_name: openldap - image: osixia/openldap:stable - environment: - - TZ=Europe/Helsinki - - LDAP_ORGANIZATION="Korhonen" - - LDAP_DOMAIN="korhonen.cc" - - LDAP_ADMIN_PASSWORD="${LDAP_ADMIN_PASSWORD}" - hostname: ldap.korhonen.cc - ports: - - 389:389 - - 636:636 - restart: unless-stopped - volumes: - - /docker/auth/openldap/ldap:/var/lib/ldap - - /docker/auth/openldap/slapd.d:/etc/ldap/slapd.d - - /etc/localtime:/etc/localtime:ro diff --git a/docker/auth/.gitignore b/docker/authentik/.gitignore similarity index 100% rename from docker/auth/.gitignore rename to docker/authentik/.gitignore diff --git a/docker/authentik/docker-compose.yaml b/docker/authentik/docker-compose.yaml new file mode 100644 index 00000000..a8831667 --- /dev/null +++ b/docker/authentik/docker-compose.yaml @@ -0,0 +1,75 @@ +volumes: + redis: {} + media: {} + custom_templates: {} + geoip: {} + backups: {} +services: + redis: + image: redis:alpine + container_name: authentik-redis + networks: + - authentik + restart: unless-stopped + volumes: + - redis:/data + healthcheck: + test: + - CMD-SHELL + - redis-cli ping | grep PONG + start_period: 20s + interval: 30s + retries: 5 + timeout: 3s + server: + image: ghcr.io/goauthentik/server + container_name: authentik + restart: unless-stopped + command: server + volumes: + - media:/media + - custom_templates:/templates + - geoip:/geoip + env_file: + - .env + networks: + - authentik + - postgres + - proxy + worker: + image: ghcr.io/goauthentik/server + container_name: authentik-worker + restart: unless-stopped + command: worker + user: root + volumes: + - backups:/backups + - custom_templates:/templates + - geoip:/geoip + - media:/media + - /var/run/docker.sock:/var/run/docker.sock + env_file: + - .env + networks: + - authentik + - postgres + geoipupdate: + image: maxmindinc/geoipupdate + container_name: authentik-geoipupdate + restart: unless-stopped + networks: + - authentik + volumes: + - geoip:/usr/share/GeoIP + env_file: + - .env + environment: + GEOIPUPDATE_EDITION_IDS: GeoLite2-City + GEOIPUPDATE_FREQUENCY: '8' +networks: + authentik: + external: true + postgres: + external: true + proxy: + external: true diff --git a/docker/backup/DISABLED b/docker/backup/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/backup/docker-compose.yaml b/docker/backup/docker-compose.yaml new file mode 100644 index 00000000..adc00671 --- /dev/null +++ b/docker/backup/docker-compose.yaml @@ -0,0 +1,33 @@ +volumes: + caddy_data: + external: true + caddy_config: + external: true + caddy_wkd: + external: true + homeautomation_hass: + external: true +services: + backup: + image: offen/docker-volume-backup:v2 + container_name: volume-backup + restart: unless-stopped + environment: + - AWS_ENDPOINT + - AWS_S3_BUCKET_NAME + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - GPG_PASSPHRASE + - EMAIL_SMTP_HOST + - EMAIL_SMTP_PASSWORD + - EMAIL_SMTP_USERNAME + - EMAIL_SMTP_PORT + - BACKUP_COMPRESSION=zst + - BACKUP_RETENTION_DAYS=7 + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - /etc/localtime:/etc/localtime:ro + - caddy_data:/backup/caddy_data:ro + - caddy_config:/backup/caddy_config:ro + - caddy_wkd:/backup/caddy_wkd:ro + - homeautomation_hass:/backup/homeautomation_hass:ro diff --git a/docker/caddy/Caddyfile b/docker/caddy/Caddyfile new file mode 100644 index 00000000..59bc7f7e --- /dev/null +++ b/docker/caddy/Caddyfile @@ -0,0 +1,177 @@ +{ + order umami first +} + +korhonen.cc, *.korhonen.cc { + encode zstd gzip + + tls { + dns cloudflare {$CF_API_TOKEN} + resolvers 1.1.1.1 + } + + header { + Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" + } + + @static { + file + path *.ico *.css *.js *.gif *.webp *.avif *.jpg *.jpeg *.png *.svg *.woff *.woff2 *.pdf *.webmanifest + } + + @homepage-www-redir host www.korhonen.cc + handle @homepage-www-redir { + redir https://korhonen.cc + } + + @homepage host korhonen.cc + handle @homepage { + # Redirect finnish WIP + # @redirFinnish { + # header Accept-Language *fi-FI* + # not path *.js *.css *.png *.jpg *.jpeg *.svg + # not path /en* /fi* + # } + # redir @redirFinnish /fi{uri} + # + # uri strip_prefix /en + + header @static Cache-Control max-age=5184000 + root * /var/www/korhonen.cc + file_server + } + + @wkd host openpgpkey.korhonen.cc + handle @wkd { + root * /var/www/wkd + file_server browse + header Access-Control-Allow-Origin "*" + } + + @index host index.korhonen.cc + handle @index { + umami { + event_endpoint "https://umami.korhonen.cc/api/send" + website_uuid "9fe4f5c0-8e63-4479-a58d-d399cdbc0a3a" + client_ip_header X-Real-IP + device_detection + allowed_extensions "" .tar.zst .json .html + } + root * /var/www/index.korhonen.cc + file_server browse + } + + @home-assistant host home.korhonen.cc + handle @home-assistant { + reverse_proxy home-assistant:8123 + } + + @authentik host sso.korhonen.cc + handle @authentik { + reverse_proxy authentik:9000 + } + + @forgejo host git.korhonen.cc + handle @forgejo { + rewrite /user/login /user/oauth2/Korhonen%20SSO + reverse_proxy forgejo:3000 + } + + @woodpecker host ci.korhonen.cc + handle @woodpecker { + reverse_proxy woodpecker:8000 + } + + @searx host dsearch.korhonen.cc + handle @searx { + reverse_proxy searx:8080 + } + + @freshrss host rss.korhonen.cc + handle @freshrss { + reverse_proxy freshrss + } + + @jellyfin host jellyfin.korhonen.cc + handle @jellyfin { + reverse_proxy jellyfin:8096 + } + + @pihole host pihole.korhonen.cc + handle @pihole { + reverse_proxy pihole + } + + @umami host umami.korhonen.cc + handle @umami { + reverse_proxy umami:3000 + } + + @nextcloud host cloud.korhonen.cc + handle @nextcloud { + # Redirect login page to Authentik + redir /login /apps/sociallogin/custom_oidc/korhonen-sso 301 + + # .htaccess / data / config / ... shouldn't be accessible from outside + @forbidden { + path /.htaccess + path /data/* + path /config/* + path /db_structure + path /.xml + path /README + path /3rdparty/* + path /lib/* + path /templates/* + path /occ + path /console.php + } + handle @forbidden { + respond 404 + } + + redir /.well-known/carddav /remote.php/dav 301 + redir /.well-known/caldav /remote.php/dav 301 + + root * /var/www/nextcloud + php_fastcgi nextcloud:9000 { + root /var/www/html + # Tells nextcloud to remove /index.php from URLs in links + env front_controller_active true + } + file_server + } + + @collabora host collabora.korhonen.cc + handle @collabora { + reverse_proxy collabora:9980 + } + + @drop host drop.korhonen.cc + handle @drop { + reverse_proxy drop:3000 + } + + @ipvX host ipv6.korhonen.cc ipv4.korhonen.cc + handle @ipvX { + respond {remote_host} + } + + handle { + respond "404 Not Found" 404 + } + + handle_errors { + @homepage_404 { + expression {http.error.status_code} == 404 + host korhonen.cc + } + handle @homepage_404 { + root * /var/www/korhonen.cc + rewrite * /404.html + file_server + } + + respond "{err.status_code} {err.status_text}" + } +} diff --git a/docker/caddy/docker-compose.yaml b/docker/caddy/docker-compose.yaml new file mode 100644 index 00000000..cb3936ef --- /dev/null +++ b/docker/caddy/docker-compose.yaml @@ -0,0 +1,35 @@ +volumes: + data: {} + config: {} + wkd: {} + korhonen_cc: {} + nextcloud_config: + external: true +services: + caddy: + image: git.korhonen.cc/functionalhacker/caddy + container_name: caddy + restart: unless-stopped + ports: + - 80:80 + - 443:443/tcp + - 443:443/udp + - 127.0.0.1:2019:2019 + networks: + - proxy + volumes: + - /etc/localtime:/etc/localtime:ro + - ./Caddyfile:/etc/caddy/Caddyfile + - data:/data + - config:/config + - wkd:/var/www/wkd + - korhonen_cc:/var/www/korhonen.cc + - nextcloud_config:/var/www/nextcloud + - /var/www/index.korhonen.cc:/var/www/index.korhonen.cc + env_file: + - .env + cap_add: + - NET_ADMIN +networks: + proxy: + external: true diff --git a/docker/cloudflared/docker-compose.yaml b/docker/cloudflared/docker-compose.yaml new file mode 100644 index 00000000..e4ea0f26 --- /dev/null +++ b/docker/cloudflared/docker-compose.yaml @@ -0,0 +1,19 @@ +services: + cloudflared: + image: cloudflare/cloudflared + container_name: cloudflared + restart: unless-stopped + networks: + - proxy + volumes: + - /etc/localtime:/etc/localtime:ro + entrypoint: + command: tunnel --no-autoupdate run + env_file: + - .env + extra_hosts: + - 'host.docker.internal:host-gateway' + +networks: + proxy: + external: true diff --git a/docker/ddns/DISABLED b/docker/ddns/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/ddns/docker-compose.yaml b/docker/ddns/docker-compose.yaml new file mode 100644 index 00000000..9c75b67e --- /dev/null +++ b/docker/ddns/docker-compose.yaml @@ -0,0 +1,13 @@ +services: + cloudflare-ddns: + image: timothyjmiller/cloudflare-ddns + container_name: cloudflare-ddns + security_opt: + - no-new-privileges:true + network_mode: host + environment: + - PUID=1000 + - PGID=1000 + volumes: + - /mnt/Storage/docker/ddns/config.json:/config.json + restart: unless-stopped diff --git a/docker/drop/DISABLED b/docker/drop/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/drop/docker-compose.yaml b/docker/drop/docker-compose.yaml new file mode 100644 index 00000000..e86bdd6f --- /dev/null +++ b/docker/drop/docker-compose.yaml @@ -0,0 +1,13 @@ +services: + drop: + image: lscr.io/linuxserver/pairdrop + container_name: drop + restart: unless-stopped + networks: + - proxy + - IPV6_LOCALIZE=4 + volumes: + - /etc/localtime:/etc/localtime:ro +networks: + proxy: + external: true diff --git a/docker/firefish/DISABLED b/docker/firefish/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/firefish/docker-compose.yaml b/docker/firefish/docker-compose.yaml new file mode 100644 index 00000000..de031490 --- /dev/null +++ b/docker/firefish/docker-compose.yaml @@ -0,0 +1,48 @@ +volumes: + files: {} + config: {} + redis: {} + db: {} +services: + firefish: + image: registry.firefish.dev/firefish/firefish + container_name: firefish + restart: unless-stopped + depends_on: + - redis + ports: + - 3084:3000 + networks: + - firefish + - proxy + environment: + NODE_ENV: production + volumes: + - files:/firefish/files + - config:/firefish/.config:ro + redis: + image: redis + container_name: redis-firefish + restart: unless-stopped + networks: + - firefish + volumes: + - redis:/data + db: + image: groonga/pgroonga:3.1.8-alpine-16-slim + container_name: firefish-db + restart: unless-stopped + networks: + - firefish + volumes: + - db:/var/lib/postgresql/data + healthcheck: + test: pg_isready --user="firefish" --dbname="firefish" + interval: 5s + timeout: 5s + retries: 5 +networks: + firefish: + internal: true + proxy: + external: true diff --git a/docker/forgejo/docker-compose.yaml b/docker/forgejo/docker-compose.yaml new file mode 100644 index 00000000..6add26f3 --- /dev/null +++ b/docker/forgejo/docker-compose.yaml @@ -0,0 +1,37 @@ +volumes: + data: {} + runner: {} +services: + forgejo: + image: git.korhonen.cc/functionalhacker/forgejo-asciidoc + container_name: forgejo + environment: + - USER_UID=1000 + - USER_GID=1000 + restart: unless-stopped + networks: + - postgres + - proxy + ports: + - '2882:22' + volumes: + - data:/data + - /etc/localtime:/etc/localtime:ro + runner: + image: code.forgejo.org/forgejo/runner:6 + container_name: forgejo-runner + user: root:root + volumes: + - runner:/data + - ./runner.yaml:/data/config.yaml + - /var/run/docker.sock:/var/run/docker.sock + - /etc/localtime:/etc/localtime:ro + environment: + - SOCKFILE=/var/run/docker.sock + restart: unless-stopped + command: forgejo-runner daemon -c /data/config.yaml +networks: + postgres: + external: true + proxy: + external: true diff --git a/docker/forgejo/runner.yaml b/docker/forgejo/runner.yaml new file mode 100644 index 00000000..bf5286bc --- /dev/null +++ b/docker/forgejo/runner.yaml @@ -0,0 +1,34 @@ +log: + level: info + +runner: + file: .runner + capacity: 2 + env_file: .env + timeout: 3h + insecure: false + fetch_timeout: 5s + fetch_interval: 2s + labels: + - 'docker:docker://git.korhonen.cc/functionalhacker/ubuntu-act:22.04' + +cache: + enabled: true + dir: '' + host: '' + port: 0 + external_server: '' + +container: + network: '' + enable_ipv6: false + privileged: false + options: + workdir_parent: + valid_volumes: + - 'caddy_korhonen_cc' + docker_host: 'automount' + force_pull: false + +host: + workdir_parent: diff --git a/docker/freshrss/DISABLED b/docker/freshrss/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/freshrss/docker-compose.yaml b/docker/freshrss/docker-compose.yaml new file mode 100644 index 00000000..af961c5d --- /dev/null +++ b/docker/freshrss/docker-compose.yaml @@ -0,0 +1,24 @@ +volumes: + config: {} +services: + freshrss: + image: linuxserver/freshrss + container_name: freshrss + restart: unless-stopped + networks: + - freshrss + - postgres + - proxy + environment: + - PUID=1000 + - PGID=985 + volumes: + - /etc/localtime:/etc/localtime:ro + - config:/config +networks: + freshrss: + external: false + postgres: + external: true + proxy: + external: true diff --git a/docker/freshrss/docker-compose.yml b/docker/freshrss/docker-compose.yml deleted file mode 100644 index 9d948bbb..00000000 --- a/docker/freshrss/docker-compose.yml +++ /dev/null @@ -1,96 +0,0 @@ -version: "2.1" -services: - freshrss: - image: linuxserver/freshrss - container_name: freshrss - restart: unless-stopped - networks: - - freshrss - - postgres - - proxy - environment: - - PUID=1000 - - PGID=985 - - TZ=Europe/Helsinki - depends_on: - - spotifeed - - bibliogram - volumes: - - /docker/freshrss/freshrss:/config - - /etc/localtime:/etc/localtime:ro - labels: - - "traefik.enable=true" - - - "traefik.http.routers.freshrss-redirect.entrypoints=http" - - "traefik.http.routers.freshrss-redirect.rule=Host(`rss.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.freshrss-redirect.middlewares=http2https" - - - "traefik.http.routers.freshrss.entrypoints=https" - - "traefik.http.routers.freshrss.rule=Host(`rss.korhonen.cc`)" - - "traefik.http.routers.freshrss.tls=true" - - "traefik.http.routers.freshrss.tls.certresolver=http" - - "traefik.http.routers.freshrss.service=freshrss" - - "traefik.docker.network=proxy" - - "traefik.http.services.freshrss.loadbalancer.server.port=80" - - spotifeed: - build: ./spotifeed - image: spotifeed - container_name: spotifeed - environment: - - SPOTIFY_CLIENT_ID=${SPOTIFY_CLIENT_ID} - - SPOTIFY_CLIENT_SECRET=${SPOTIFY_CLIENT_SECRET} - restart: unless-stopped - networks: - - freshrss - - proxy - labels: - - "traefik.enable=true" - - - "traefik.http.routers.spotifeed-redirect.entrypoints=http" - - "traefik.http.routers.spotifeed-redirect.rule=Host(`spotifeed.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.spotifeed-redirect.middlewares=http2https" - - - "traefik.http.routers.spotifeed.entrypoints=https" - - "traefik.http.routers.spotifeed.rule=Host(`spotifeed.korhonen.cc`)" - - "traefik.http.routers.spotifeed.tls=true" - - "traefik.http.routers.spotifeed.tls.certresolver=http" - - "traefik.http.routers.spotifeed.service=spotifeed" - - "traefik.docker.network=proxy" - - "traefik.http.services.spotifeed.loadbalancer.server.port=8083" - - bibliogram: - image: cloudrac3r/bibliogram - container_name: bibliogram - restart: unless-stopped - volumes: - - /docker/freshrss/bibliogram/db:/app/db - - /docker/freshrss/bibliogram/config.js:/app/config.js - networks: - - freshrss - - proxy - labels: - - "traefik.enable=true" - - - "traefik.http.routers.bibliogram-redirect.entrypoints=http" - - "traefik.http.routers.bibliogram-redirect.rule=Host(`bibliogram.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.bibliogram-redirect.middlewares=http2https" - - - "traefik.http.routers.bibliogram.entrypoints=https" - - "traefik.http.routers.bibliogram.rule=Host(`bibliogram.korhonen.cc`)" - - "traefik.http.routers.bibliogram.tls=true" - - "traefik.http.routers.bibliogram.tls.certresolver=http" - - "traefik.http.routers.bibliogram.service=bibliogram" - - "traefik.docker.network=proxy" - - "traefik.http.services.bibliogram.loadbalancer.server.port=10407" - -networks: - freshrss: - external: false - postgres: - external: true - proxy: - external: true diff --git a/docker/freshrss/spotifeed/Dockerfile b/docker/freshrss/spotifeed/Dockerfile deleted file mode 100644 index 63c1604d..00000000 --- a/docker/freshrss/spotifeed/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ruby:2.7.2 -RUN git clone https://github.com/timdorr/spotifeed -WORKDIR /spotifeed -RUN bundle install -EXPOSE 8083 -RUN apt-get update -RUN apt-get upgrade -RUN apt-get install redis-server -y -CMD puma -p 8083 & redis-server diff --git a/docker/gitea/docker-compose.yaml b/docker/gitea/docker-compose.yaml deleted file mode 100644 index b633d3e7..00000000 --- a/docker/gitea/docker-compose.yaml +++ /dev/null @@ -1,41 +0,0 @@ -version: "2" - -services: - gitea: - container_name: gitea - image: gitea/gitea:1 - environment: - - TZ=Europe/Helsinki - - USER_UID=1000 - - USER_GID=1000 - restart: unless-stopped - networks: - - postgres - - proxy - ports: - - "3000:3000" - - "222:22" - volumes: - - /docker/gitea:/data - - /etc/localtime:/etc/localtime:ro - labels: - - "traefik.enable=true" - - - "traefik.http.routers.gitea-redirect.entrypoints=http" - - "traefik.http.routers.gitea-redirect.rule=Host(`git.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.gitea-redirect.middlewares=http2https" - - - "traefik.http.routers.gitea.entrypoints=https" - - "traefik.http.routers.gitea.rule=Host(`git.korhonen.cc`)" - - "traefik.http.routers.gitea.tls=true" - - "traefik.http.routers.gitea.tls.certresolver=http" - - "traefik.http.routers.gitea.service=gitea" - - "traefik.docker.network=proxy" - - "traefik.http.services.gitea.loadbalancer.server.port=3000" - -networks: - postgres: - external: true - proxy: - external: true diff --git a/docker/headscale/DISABLED b/docker/headscale/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/headscale/docker-compose.yaml b/docker/headscale/docker-compose.yaml new file mode 100644 index 00000000..96d383b5 --- /dev/null +++ b/docker/headscale/docker-compose.yaml @@ -0,0 +1,23 @@ +volumes: + config: {} + data: {} +services: + headscale: + image: headscale/headscale:0 + container_name: headscale + volumes: + - config:/etc/headscale + - data:/var/lib/headscale + ports: + - 3478:3478/udp + command: headscale serve + restart: unless-stopped + networks: + - postgres + headscale-ui: + image: ghcr.io/gurucomputing/headscale-ui + container_name: headscale-ui + restart: unless-stopped +networks: + postgres: + external: true diff --git a/docker/homeautomation/docker-compose.yaml b/docker/homeautomation/docker-compose.yaml new file mode 100644 index 00000000..adbcb414 --- /dev/null +++ b/docker/homeautomation/docker-compose.yaml @@ -0,0 +1,80 @@ +volumes: + hass: {} + mosquitto: {} + piper_english: {} + whisper_english: {} + openwakeword_english: {} +services: + home-assistant: + container_name: home-assistant + image: homeassistant/home-assistant + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime:ro + - hass:/config + networks: + - homeautomation + - postgres + - proxy + ports: + - 8123:8123 + - 8300:8300 + extra_hosts: + - host.docker.internal:host-gateway + # mosquitto: + # container_name: mosquitto + # image: eclipse-mosquitto + # restart: unless-stopped + # environment: + # - TZ=Europe/Helsinki + # networks: + # - homeautomation + # ports: + # - 1883:1883 + # - 8866:8866 + # volumes: + # - mosquitto:/mosquitto + # - /etc/localtime:/etc/localtime:ro + piper_english: + container_name: piper_english + image: rhasspy/wyoming-piper + restart: unless-stopped + environment: + - TZ=Europe/Helsinki + ports: + - 10200:10200 + networks: + - homeautomation + command: + - --voice + - en_US-hfc_male-medium + volumes: + - piper_english:/data + - /etc/localtime:/etc/localtime:ro + whisper_english: + container_name: whisper_english + image: rhasspy/wyoming-whisper + restart: unless-stopped + environment: + - TZ=Europe/Helsinki + ports: + - 10300:10300 + networks: + - homeautomation + depends_on: + - home-assistant + command: + - --model + - tiny-int8 + - --language + - en + volumes: + - whisper_english:/data + - /etc/localtime:/etc/localtime:ro +networks: + homeautomation: + external: false + postgres: + external: true + proxy: + external: true diff --git a/docker/homeautomation/docker-compose.yml b/docker/homeautomation/docker-compose.yml deleted file mode 100644 index ea29011d..00000000 --- a/docker/homeautomation/docker-compose.yml +++ /dev/null @@ -1,136 +0,0 @@ -version: "3" -services: - home-assistant: - container_name: home-assistant - image: homeassistant/home-assistant - environment: - - TZ=Europe/Helsinki - devices: - - /dev/ttyACM0 - volumes: - - /docker/homeautomation/home-assistant:/config - - /etc/localtime:/etc/localtime:ro - restart: unless-stopped - networks: - - homeautomation - - postgres - - proxy - ports: - - "8123:8123" - depends_on: - - mosquitto - labels: - - "traefik.enable=true" - - - "traefik.http.routers.home-assistant-redirect.entrypoints=http" - - "traefik.http.routers.home-assistant-redirect.rule=Host(`home.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.home-assistant-redirect.middlewares=http2https" - - - "traefik.http.routers.home-assistant.entrypoints=https" - - "traefik.http.routers.home-assistant.rule=Host(`home.korhonen.cc`)" - - "traefik.http.routers.home-assistant.tls=true" - - "traefik.http.routers.home-assistant.tls.certresolver=http" - - "traefik.http.routers.home-assistant.service=home-assistant" - - "traefik.docker.network=proxy" - - "traefik.http.services.home-assistant.loadbalancer.server.port=8123" - - mosquitto: - container_name: mosquitto - image: eclipse-mosquitto - environment: - - TZ=Europe/Helsinki - ports: - - "1883:1883" - networks: - - homeautomation - volumes: - - /docker/homeautomation/mosquitto:/mosquitto - - /etc/localtime:/etc/localtime:ro - restart: unless-stopped - - rhasspy: - container_name: rhasspy - image: rhasspy/rhasspy - command: --profile en --user-profiles /profiles - volumes: - - /docker/homeautomation/rhasspy:/profiles - environment: - - TZ=Europe/Helsinki - ports: - - "12101:12101" - networks: - - homeautomation - restart: unless-stopped - depends_on: - - home-assistant - devices: - - "/dev/snd:/dev/snd" - - node-red: - container_name: node-red - image: nodered/node-red - environment: - - TZ=Europe/Helsinki - - proxy - ports: - - "1880:1880" - networks: - - homeautomation - volumes: - - /docker/homeautomation/node-red:/data - - /etc/localtime:/etc/localtime:ro - restart: unless-stopped - depends_on: - - home-assistant - labels: - - "traefik.enable=true" - - - "traefik.http.routers.node-red-redirect.entrypoints=http" - - "traefik.http.routers.node-red-redirect.rule=Host(`node.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.node-red-redirect.middlewares=http2https" - - - "traefik.http.routers.node-red.entrypoints=https" - - "traefik.http.routers.node-red.rule=Host(`node.korhonen.cc`)" - - "traefik.http.routers.node-red.tls=true" - - "traefik.http.routers.node-red.tls.certresolver=http" - - "traefik.http.routers.node-red.service=node-red" - - "traefik.docker.network=proxy" - - "traefik.http.services.node-red.loadbalancer.server.port=1880" - - gotify: - image: gotify/server - container_name: gotify - volumes: - - /docker/homeautomation/gotify:/app/data - environment: - - GOTIFY_DATABASE_DIALECT=postgres - - GOTIFY_DATABASE_CONNECTION="host=postgres port=5432 user=gotify dbname=gotify password=${GOTIFY_PGPASS} sslmode=disable" - networks: - - proxy - - postgres - restart: unless-stopped - labels: - - "traefik.enable=true" - - - "traefik.http.routers.gotify-redirect.entrypoints=http" - - "traefik.http.routers.gotify-redirect.rule=Host(`gotify.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.gotify-redirect.middlewares=http2https" - - - "traefik.http.routers.gotify.entrypoints=https" - - "traefik.http.routers.gotify.rule=Host(`gotify.korhonen.cc`)" - - "traefik.http.routers.gotify.tls=true" - - "traefik.http.routers.gotify.tls.certresolver=http" - - "traefik.http.routers.gotify.service=gotify" - - "traefik.docker.network=proxy" - - "traefik.http.services.gotify.loadbalancer.server.port=80" - -networks: - homeautomation: - external: false - postgres: - external: true - proxy: - external: true diff --git a/docker/index.korhonen.cc/docker-compose.yaml b/docker/index.korhonen.cc/docker-compose.yaml deleted file mode 100644 index 16ded23e..00000000 --- a/docker/index.korhonen.cc/docker-compose.yaml +++ /dev/null @@ -1,33 +0,0 @@ -version: "3" - -services: - nginx: - image: fraoustin/fancyindex - container_name: index.korhonen.cc - environment: - - DISABLE_AUTH=true - - CONTAINER_TIMEZONE="Europe/Helsinki" - volumes: - - /docker/index.korhonen.cc:/share - networks: - - proxy - restart: unless-stopped - labels: - - "traefik.enable=true" - - - "traefik.http.routers.index-redirect.entrypoints=http" - - "traefik.http.routers.index-redirect.rule=Host(`index.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.index-redirect.middlewares=http2https" - - - "traefik.http.routers.index.entrypoints=https" - - "traefik.http.routers.index.rule=Host(`index.korhonen.cc`)" - - "traefik.http.routers.index.tls=true" - - "traefik.http.routers.index.tls.certresolver=http" - - "traefik.http.routers.index.service=index" - - "traefik.docker.network=proxy" - - "traefik.http.services.index.loadbalancer.server.port=80" - -networks: - proxy: - external: true diff --git a/docker/jellyfin/DISABLED b/docker/jellyfin/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/jellyfin/docker-compose.yaml b/docker/jellyfin/docker-compose.yaml index e36f27f6..f617f28d 100644 --- a/docker/jellyfin/docker-compose.yaml +++ b/docker/jellyfin/docker-compose.yaml @@ -1,40 +1,31 @@ -version: "2.3" +volumes: + config: {} + cache: {} + media: + external: true + nextcloud_data: + external: true services: jellyfin: image: jellyfin/jellyfin container_name: jellyfin - environment: - - TZ=Europe/Helsinki - - NVIDIA_DRIVER_CAPABILITIES=all - - NVIDIA_VISIBLE_DEVICES=all ports: - - "8096:8096" + - 8096:8096 networks: - proxy + - authentik restart: unless-stopped volumes: - - /docker/jellyfin/config:/config - - /docker/jellyfin/cache:/cache - - /mnt/Storage/Media:/media - /etc/localtime:/etc/localtime:ro + - config:/config + - cache:/cache + - media:/media + - nextcloud_data:/nextcloud_data devices: - - /dev/dri:/dev/dri - labels: - - "traefik.enable=true" - - - "traefik.http.routers.jellyfin-redirect.entrypoints=http" - - "traefik.http.routers.jellyfin-redirect.rule=Host(`jellyfin.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.jellyfin-redirect.middlewares=http2https" - - - "traefik.http.routers.jellyfin.entrypoints=https" - - "traefik.http.routers.jellyfin.rule=Host(`jellyfin.korhonen.cc`)" - - "traefik.http.routers.jellyfin.tls=true" - - "traefik.http.routers.jellyfin.tls.certresolver=http" - - "traefik.http.routers.jellyfin.service=jellyfin" - - "traefik.docker.network=proxy" - - "traefik.http.services.jellyfin.loadbalancer.server.port=8096" - + - /dev/dri/renderD128:/dev/dri/renderD128 + - /dev/dri/card1:/dev/dri/card0 networks: proxy: external: true + authentik: + external: true diff --git a/docker/mumble/DISABLED b/docker/mumble/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/mumble/docker-compose.yaml b/docker/mumble/docker-compose.yaml index aaebe2e1..df0fe9c8 100644 --- a/docker/mumble/docker-compose.yaml +++ b/docker/mumble/docker-compose.yaml @@ -1,14 +1,11 @@ -version: "3" - +volumes: + config: {} services: mumble: container_name: mumble image: phlak/mumble - user: "1000:985" - environment: - - TZ=Europe/Helsinki network_mode: host volumes: - - /docker/mumble:/etc/mumble - /etc/localtime:/etc/localtime:ro + - config:/etc/mumble restart: unless-stopped diff --git a/docker/netbootxyz/DISABLED b/docker/netbootxyz/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/netbootxyz/docker-compose.yaml b/docker/netbootxyz/docker-compose.yaml new file mode 100644 index 00000000..b6cd5bea --- /dev/null +++ b/docker/netbootxyz/docker-compose.yaml @@ -0,0 +1,24 @@ +volumes: + config: {} + assets: {} +services: + netbootxyz: + image: lscr.io/linuxserver/netbootxyz + container_name: netbootxyz + restart: unless-stopped + environment: + - PUID=1000 + - PGID=1000 + - TZ=Etc/UTC + - MENU_VERSION=1.9.9 + - PORT_RANGE=30000:30010 + - SUBFOLDER=/ + - NGINX_PORT=80 + - WEB_APP_PORT=3000 + ports: + - 3000:3000 + - 69:69/udp + - 8081:80 + volumes: + - config:/config + - assets:/assets diff --git a/docker/nextcloud/.gitignore b/docker/nextcloud/.gitignore new file mode 100644 index 00000000..4c49bd78 --- /dev/null +++ b/docker/nextcloud/.gitignore @@ -0,0 +1 @@ +.env diff --git a/docker/nextcloud/docker-compose.yaml b/docker/nextcloud/docker-compose.yaml new file mode 100644 index 00000000..f22bc02a --- /dev/null +++ b/docker/nextcloud/docker-compose.yaml @@ -0,0 +1,84 @@ +volumes: + nextcloud_config: + external: true + nextcloud_data: + external: true +services: + nextcloud: + image: nextcloud:fpm-alpine + container_name: nextcloud + restart: unless-stopped + networks: + - nextcloud + - postgres + - proxy + volumes: + - nextcloud_config:/var/www/html + - nextcloud_data:/var/www/html/data + - /etc/localtime:/etc/localtime:ro + environment: + - REDIS_HOST=redis + - REDIS_HOST_PASSWORD=123 + - TRUSTED_PROXIES=caddy + - NEXTCLOUD_TRUSTED_DOMAINS=cloud.korhonen.cc + - OVERWRITEHOST=cloud.korhonen.cc + - OVERWRITEPROTOCOL=https + depends_on: + - redis + labels: + ofelia.enabled: true + ofelia.job-exec.nextcloud.schedule: 0 */5 * * * * + ofelia.job-exec.nextcloud.command: php /var/www/html/cron.php + ofelia.job-exec.nextcloud.user: www-data + ofelia.smtp-host: ${SMTP_HOST} + ofelia.smtp-port: ${SMTP_PORT} + ofelia.smtp-user: ${SMTP_USER} + ofelia.smtp-password: ${SMTP_PASSWORD} + ofelia.email-to: ${EMAIL_TO} + ofelia.email-from: ${EMAIL_FROM} + ofelia.mail-only-on-error: true + redis: + image: redis:alpine + container_name: redis-nextcloud + networks: + - nextcloud + restart: unless-stopped + command: redis-server --requirepass 123 + coturn: + image: instrumentisto/coturn + container_name: coturn + restart: unless-stopped + env_file: .env + ports: + - 3478:3478/tcp + - 3478:3478/udp + - 49160-49200:49160-49200/udp + networks: + - nextcloud + command: + - -n + - --log-file=stdout + - --min-port=49160 + - --max-port=49200 + - --realm=cloud.korhonen.cc + - --use-auth-secret + - --static-auth-secret=${STATIC_AUTH_SECRET} + collabora: + image: collabora/code + container_name: collabora + restart: unless-stopped + env_file: .env + environment: + - username=${COLLABORA_USERNAME} + - password=${COLLABORA_PASSWORD} + - domain=cloud.korhonen.cc + - extra_params=--o:ssl.enable=false --o:ssl.termination=true + networks: + - proxy +networks: + nextcloud: + external: false + postgres: + external: true + proxy: + external: true diff --git a/docker/nextcloud/docker-compose.yml b/docker/nextcloud/docker-compose.yml deleted file mode 100644 index 50275831..00000000 --- a/docker/nextcloud/docker-compose.yml +++ /dev/null @@ -1,66 +0,0 @@ -version: "3" - -services: - nextcloud: - image: nextcloud:apache - container_name: nextcloud - restart: always - ports: - - "1869:80" - networks: - - nextcloud - - postgres - - proxy - volumes: - - /docker/nextcloud:/var/www/html - - /mnt/Storage/Nextcloud:/var/www/html/data - - /mnt/Storage/Syncthing:/Syncthing - - /mnt/Storage/Media/Music:/Music - - /etc/localtime:/etc/localtime:ro - environment: - - TZ=Europe/Helsinki - - REDIS_HOST=redis - - REDIS_HOST_PASSWORD=123 - depends_on: - - redis - labels: - - "traefik.enable=true" - - - "traefik.http.routers.nextcloud-redirect.entrypoints=http" - - "traefik.http.routers.nextcloud-redirect.rule=Host(`cloud.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.nextcloud-redirect.middlewares=http2https" - - - "traefik.http.routers.nextcloud.entrypoints=https" - - "traefik.http.routers.nextcloud.rule=Host(`cloud.korhonen.cc`)" - - "traefik.http.routers.nextcloud.tls=true" - - "traefik.http.routers.nextcloud.tls.certresolver=http" - - "traefik.http.routers.nextcloud.service=nextcloud" - - "traefik.docker.network=proxy" - - "traefik.http.services.nextcloud.loadbalancer.server.port=80" - - redis: - image: redis:alpine - container_name: redis - networks: - - nextcloud - restart: always - command: redis-server --requirepass 123 - - cron: - image: nextcloud:apache - container_name: cron - restart: always - volumes: - - /docker/nextcloud:/var/www/html - entrypoint: /cron.sh - depends_on: - - redis - -networks: - nextcloud: - external: false - postgres: - external: true - proxy: - external: true diff --git a/docker/ofelia/docker-compose.yaml b/docker/ofelia/docker-compose.yaml new file mode 100644 index 00000000..00c4ba93 --- /dev/null +++ b/docker/ofelia/docker-compose.yaml @@ -0,0 +1,9 @@ +services: + ofelia: + image: mcuadros/ofelia + container_name: ofelia + restart: unless-stopped + volumes: + - /etc/localtime:/etc/localtime:ro + - /var/run/docker.sock:/var/run/docker.sock:ro + command: daemon --docker diff --git a/docker/opentogethertube/DISABLED b/docker/opentogethertube/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/opentogethertube/docker-compose.yaml b/docker/opentogethertube/docker-compose.yaml new file mode 100644 index 00000000..f4ed1f85 --- /dev/null +++ b/docker/opentogethertube/docker-compose.yaml @@ -0,0 +1,42 @@ +services: + opentogethertube: + image: dyc3/opentogethertube + container_name: opentogethertube + restart: unless-stopped + environment: + - PORT=8080 + - REDIS_HOST=redis + - REDIS_PORT=6379 + - FFPROBE_PATH=/usr/bin/ffprobe + - DB_MODE=postgres + - POSTGRES_USER=opentogethertube + - POSTGRES_DB=opentogethertube + - POSTGRES_HOST=postgres + - POSTGRES_PASSWORD + - DOCKER=1 + - OTT_HOSTNAME=ott.korhonen.cc + - YOUTUBE_API_KEY + - OPENTOGETHERTUBE_API_KEY + - SESSION_SECRET + ports: + - 8080:8080 + - 3002:3002 + networks: + - default + - postgres + - proxy + depends_on: + - redis + volumes: + - ./production.toml:/app/env/production.toml + redis: + container_name: redis-opentogethertube + image: redis:alpine + restart: unless-stopped + healthcheck: + test: redis-cli ping +networks: + postgres: + external: true + proxy: + external: true diff --git a/docker/opentogethertube/production.toml b/docker/opentogethertube/production.toml new file mode 100644 index 00000000..e60fec7e --- /dev/null +++ b/docker/opentogethertube/production.toml @@ -0,0 +1,5 @@ +log = { level = "info" } + +[room] +enable_create_temporary = false +enable_create_permanent = false diff --git a/docker/pihole/DISABLED b/docker/pihole/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/pihole/docker-compose.yaml b/docker/pihole/docker-compose.yaml new file mode 100644 index 00000000..8ce68ccd --- /dev/null +++ b/docker/pihole/docker-compose.yaml @@ -0,0 +1,29 @@ +volumes: + config: {} + dnsmasq: {} +services: + pihole: + container_name: pihole + image: pihole/pihole + ports: + - 53:53/tcp + - 53:53/udp + - 67:67/udp + - 8069:80/tcp + networks: + - proxy + volumes: + - config:/etc/pihole/ + - dnsmasq:/etc/dnsmasq.d/ + dns: + - 127.0.0.1 + - 1.1.1.1 + cap_add: + - NET_ADMIN + restart: unless-stopped + environment: + TZ: Europe/Helsinki + WEBPASSWORD: ${WEBPASSWORD} +networks: + proxy: + external: true diff --git a/docker/pihole/docker-compose.yml b/docker/pihole/docker-compose.yml deleted file mode 100644 index 1738d8f5..00000000 --- a/docker/pihole/docker-compose.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: "3" - -services: - pihole: - container_name: pihole - image: pihole/pihole:latest - ports: - - "53:53/tcp" - - "53:53/udp" - - "67:67/udp" - - "8069:80/tcp" - networks: - - proxy - environment: - TZ: "Europe/Helsinki" - WEBPASSWORD: "${WEBPASSWORD}" - volumes: - - "/docker/pihole/pihole:/etc/pihole/" - - "/docker/pihole/dnsmasq:/etc/dnsmasq.d/" - dns: - - 127.0.0.1 - - 1.1.1.1 - # Recommended but not required (DHCP needs NET_ADMIN) - # https://github.com/pihole/docker-pihole#note-on-capabilities - cap_add: - - NET_ADMIN - restart: unless-stopped - labels: - - "traefik.enable=true" - - - "traefik.http.routers.pihole-redirect.entrypoints=http" - - "traefik.http.routers.pihole-redirect.rule=Host(`pihole.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.pihole-redirect.middlewares=http2https" - - - "traefik.http.routers.pihole.entrypoints=https" - - "traefik.http.routers.pihole.rule=Host(`pihole.korhonen.cc`)" - - "traefik.http.routers.pihole.tls=true" - - "traefik.http.routers.pihole.tls.certresolver=http" - - "traefik.http.routers.pihole.service=pihole" - - "traefik.docker.network=proxy" - - "traefik.http.services.pihole.loadbalancer.server.port=80" - -networks: - proxy: - external: true diff --git a/docker/portainer/docker-compose.yaml b/docker/portainer/docker-compose.yaml deleted file mode 100644 index 4335bcfc..00000000 --- a/docker/portainer/docker-compose.yaml +++ /dev/null @@ -1,33 +0,0 @@ -version: '3' -services: - portainer: - image: portainer/portainer-ce - container_name: portainer - environment: - - TZ=Europe/Helsinki - restart: unless-stopped - networks: - - proxy - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - /docker/portainer:/data - - /etc/localtime:/etc/localtime:ro - labels: - - 'traefik.enable=true' - - - 'traefik.http.routers.portainer-redirect.entrypoints=http' - - 'traefik.http.routers.portainer-redirect.rule=Host(`portainer.korhonen.cc`)' - - 'traefik.http.middlewares.http2https.redirectscheme.scheme=https' - - 'traefik.http.routers.portainer-redirect.middlewares=http2https' - - - 'traefik.http.routers.portainer.entrypoints=https' - - 'traefik.http.routers.portainer.rule=Host(`portainer.korhonen.cc`)' - - 'traefik.http.routers.portainer.tls=true' - - 'traefik.http.routers.portainer.tls.certresolver=http' - - 'traefik.http.routers.portainer.service=portainer' - - 'traefik.docker.network=proxy' - - 'traefik.http.services.portainer.loadbalancer.server.port=9000' - -networks: - proxy: - external: true diff --git a/docker/postgres/docker-compose.yaml b/docker/postgres/docker-compose.yaml index 92942046..f51c542f 100644 --- a/docker/postgres/docker-compose.yaml +++ b/docker/postgres/docker-compose.yaml @@ -1,20 +1,17 @@ -version: "3" +volumes: + data: {} services: postgres: container_name: postgres - image: postgres:13 - environment: - - TZ=Europe/Helsinki - - POSTGRES_PASSWORD=12345 + image: postgres:16 ports: - - 5432:5432 + - 127.0.0.1:5432:5432 networks: - postgres volumes: - - /docker/postgres:/var/lib/postgresql/data - /etc/localtime:/etc/localtime:ro + - data:/var/lib/postgresql/data restart: unless-stopped - networks: postgres: external: true diff --git a/docker/searx/DISABLED b/docker/searx/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/searx/docker-compose.yaml b/docker/searx/docker-compose.yaml new file mode 100644 index 00000000..cd419ee4 --- /dev/null +++ b/docker/searx/docker-compose.yaml @@ -0,0 +1,46 @@ +volumes: + config: {} +services: + searx: + container_name: searx + image: searxng/searxng + restart: unless-stopped + networks: + - searx + - proxy + volumes: + - config:/etc/searxng + environment: + - SEARXNG_BASE_URL=https://search.korhonen.cc/ + cap_drop: + - ALL + cap_add: + - CHOWN + - SETGID + - SETUID + - DAC_OVERRIDE + logging: + driver: json-file + options: + max-size: 1m + max-file: '1' + redis: + container_name: redis-searx + image: redis:alpine + command: redis-server --save "" --appendonly "no" + networks: + - searx + tmpfs: + - /var/lib/redis + cap_drop: + - ALL + cap_add: + - SETGID + - SETUID + - DAC_OVERRIDE +networks: + searx: + ipam: + driver: default + proxy: + external: true diff --git a/docker/stats/DISABLED b/docker/stats/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/stats/docker-compose.yaml b/docker/stats/docker-compose.yaml new file mode 100644 index 00000000..f5b38202 --- /dev/null +++ b/docker/stats/docker-compose.yaml @@ -0,0 +1,30 @@ +services: + grafana: + image: grafana/grafana + container_name: grafana + volumes: + - grafana:/var/lib/grafana + networks: + - stats + - proxy + user: 1000:984 + env_file: + - .env + environment: + - GF_AUTH_GENERIC_OAUTH_CLIENT_ID + - GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET + - GF_AUTH_GENERIC_OAUTH_ENABLED=true + - GF_AUTH_GENERIC_OAUTH_NAME=authentik + - GF_AUTH_GENERIC_OAUTH_SCOPES=openid profile email + - GF_AUTH_GENERIC_OAUTH_AUTH_URL=https://sso.korhonen.cc/application/o/authorize/ + - GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://sso.korhonen.cc/application/o/token/ + - GF_AUTH_GENERIC_OAUTH_API_URL=https://sso.korhonen.cc/application/o/userinfo/ + - GF_AUTH_SIGNOUT_REDIRECT_URL=https://sso.korhonen.cc/application/o/grafana/end-session/ + - GF_AUTH_OAUTH_AUTO_LOGIN=true + - GF_SERVER_ROOT_URL=https://grafana.korhonen.cc + - GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH=contains(groups[*], 'Administrators') && 'Admin' || 'Viewer' +networks: + stats: + external: false + proxy: + external: true diff --git a/docker/tftp/DISABLED b/docker/tftp/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/tftp/docker-compose.yaml b/docker/tftp/docker-compose.yaml new file mode 100644 index 00000000..d266b8c2 --- /dev/null +++ b/docker/tftp/docker-compose.yaml @@ -0,0 +1,10 @@ +services: + tftp: + container_name: tftp + image: pghalliday/tftp + restart: unless-stopped + ports: + - 69:69/udp + volumes: + - /etc/localtime:/etc/localtime:ro + - /docker/tftp:/var/tftpboot diff --git a/docker/træfik/docker-compose.yaml b/docker/træfik/docker-compose.yaml deleted file mode 100644 index 1a4f7914..00000000 --- a/docker/træfik/docker-compose.yaml +++ /dev/null @@ -1,53 +0,0 @@ -version: '3' - -services: - traefik: - image: traefik:latest - container_name: traefik - restart: unless-stopped - ports: - - '80:80' - - '443:443' - environment: - - TZ=Europe/Helsinki - security_opt: - - no-new-privileges:true - networks: - - proxy - volumes: - - /etc/localtime:/etc/localtime:ro - - /var/run/docker.sock:/var/run/docker.sock:ro - - /docker/træfik/træfik/traefik.yml:/traefik.yml:ro - - /docker/træfik/træfik/dashboard-users:/dashboard-users:ro - - /docker/træfik/træfik/acme.json:/acme.json - - /docker/træfik/træfik/log:/var/log - labels: - - 'traefik.enable=true' - - - 'traefik.http.routers.redirect.entrypoints=http' - - 'traefik.http.routers.redirect.rule=Host(`traefik.korhonen.cc`)' - - 'traefik.http.middlewares.http2https.redirectscheme.scheme=https' - - 'traefik.http.routers.redirect.middlewares=http2https' - - - 'traefik.http.routers.dashboard.entrypoints=https' - - 'traefik.http.routers.dashboard.rule=Host(`traefik.korhonen.cc`)' - - 'traefik.http.middlewares.dashboard-auth.basicauth.usersfile=/dashboard-users' - - 'traefik.http.routers.dashboard.middlewares=dashboard-auth' - - 'traefik.http.routers.dashboard.tls=true' - - 'traefik.http.routers.dashboard.tls.certresolver=http' - - 'traefik.http.routers.dashboard.service=api@internal' - - fail2ban: - image: crazymax/fail2ban:latest - container_name: fail2ban - restart: unless-stopped - network_mode: "host" - cap_add: - - NET_ADMIN - - NET_RAW - volumes: - - /docker/træfik/træfik/log:/var/log/træfik:ro - - /docker/træfik/fail2ban:/data -networks: - proxy: - external: true diff --git a/docker/tvheadend/DISABLED b/docker/tvheadend/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/tvheadend/docker-compose.yaml b/docker/tvheadend/docker-compose.yaml index d4e4acd3..d6ac73d7 100644 --- a/docker/tvheadend/docker-compose.yaml +++ b/docker/tvheadend/docker-compose.yaml @@ -1,42 +1,26 @@ -version: "2" +volumes: + config: {} + picons: {} services: tvheadend: image: linuxserver/tvheadend container_name: tvheadend environment: - - TZ=Europe/Helsinki - PUID=1000 - PGID=985 volumes: - - /docker/tvheadend:/config - - /mnt/Storage/Media/PVR:/recordings - - /mnt/Storage/picons:/picons - /etc/localtime:/etc/localtime:ro + - config:/config + - picons:/picons + - /mnt/Storage/Media/PVR:/recordings ports: - 9981:9981 - 9982:9982 devices: - - /dev/dri:/dev/dri #hardware acceleration - - /dev/dvb:/dev/dvb #tuner card + - /dev/dvb:/dev/dvb restart: unless-stopped networks: - proxy - labels: - - "traefik.enable=true" - - - "traefik.http.routers.tvheadend-redirect.entrypoints=http" - - "traefik.http.routers.tvheadend-redirect.rule=Host(`tvheadend.korhonen.cc`)" - - "traefik.http.middlewares.http2https.redirectscheme.scheme=https" - - "traefik.http.routers.tvheadend-redirect.middlewares=http2https" - - - "traefik.http.routers.tvheadend.entrypoints=https" - - "traefik.http.routers.tvheadend.rule=Host(`tvheadend.korhonen.cc`)" - - "traefik.http.routers.tvheadend.tls=true" - - "traefik.http.routers.tvheadend.tls.certresolver=http" - - "traefik.http.routers.tvheadend.service=tvheadend" - - "traefik.docker.network=proxy" - - "traefik.http.services.tvheadend.loadbalancer.server.port=9981" - networks: proxy: external: true diff --git a/docker/umami/DISABLED b/docker/umami/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/umami/docker-compose.yaml b/docker/umami/docker-compose.yaml new file mode 100644 index 00000000..d92ff9d8 --- /dev/null +++ b/docker/umami/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + umami: + image: ghcr.io/umami-software/umami:postgresql-latest + container_name: umami + restart: unless-stopped + networks: + - postgres + - proxy + env_file: .env + environment: + DATABASE_URL: postgresql://umami:${POSTGRES_PASS}@postgres:5432/umami + HASH_SALT: ${HASH_SALT} + logging: + options: + max-size: 10m + max-file: '10' +networks: + postgres: + external: true + proxy: + external: true diff --git a/docker/watchtower/DISABLED b/docker/watchtower/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/watchtower/docker-compose.yaml b/docker/watchtower/docker-compose.yaml new file mode 100644 index 00000000..1429c1c4 --- /dev/null +++ b/docker/watchtower/docker-compose.yaml @@ -0,0 +1,18 @@ +services: + watchtower: + image: containrrr/watchtower + container_name: watchtower + restart: unless-stopped + environment: + - WATCHTOWER_CLEANUP=true + - WATCHTOWER_NOTIFICATION_EMAIL_FROM=watchtower@korhonen.cc + - WATCHTOWER_NOTIFICATION_EMAIL_TO=admin@korhonen.cc + - WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.migadu.com + - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT=587 + - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=${WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER} + - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=${WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD} + - WATCHTOWER_NOTIFICATION_EMAIL_DELAY=30 + - WATCHTOWER_NOTIFICATIONS=email + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /etc/localtime:/etc/localtime:ro diff --git a/docker/wireguard/docker-compose.yml b/docker/wireguard/docker-compose.yml deleted file mode 100644 index 41769138..00000000 --- a/docker/wireguard/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: "2.1" -services: - wireguard: - image: linuxserver/wireguard - container_name: wireguard - cap_add: - - NET_ADMIN - - SYS_MODULE - environment: - - TZ=Europe/Helsinki - - PEERS=4 - - SERVERURL=korhonen.cc - - SERVERPORT=48574 - - INTERNAL_SUBNET=10.200.200.0/24 - volumes: - - /docker/wireguard:/config - - /lib/modules:/lib/modules - ports: - - 48574:51820/udp - sysctls: - - net.ipv4.conf.all.src_valid_mark=1 - restart: unless-stopped diff --git a/docker/wud/DISABLED b/docker/wud/DISABLED new file mode 100644 index 00000000..e69de29b diff --git a/docker/wud/docker-compose.yaml b/docker/wud/docker-compose.yaml new file mode 100644 index 00000000..91bcbfd3 --- /dev/null +++ b/docker/wud/docker-compose.yaml @@ -0,0 +1,12 @@ +services: + whatsupdocker: + image: getwud/wud + container_name: wud + env_file: .env + environment: + - WUD_TRIGGER_SMTP_EMAIL_SIMPLETITLE=Container $${container.name} can be updated + - WUD_TRIGGER_SMTP_EMAIL_SIMPLEBODY=Container $${name} can be updated from $${local.substring(0, 15)} to $${remote.substring(0, 15)} + volumes: + - /var/run/docker.sock:/var/run/docker.sock + ports: + - 3000:3000 diff --git a/dotdrop b/dotdrop deleted file mode 160000 index 9ae90d51..00000000 --- a/dotdrop +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9ae90d51095b7fe9b26350c8dd33902e862466a5 diff --git a/dotdrop.sh b/dotdrop.sh deleted file mode 100755 index 8c458a5f..00000000 --- a/dotdrop.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# author: deadc0de6 (https://github.com/deadc0de6) -# Copyright (c) 2017, deadc0de6 - -# check for readlink/realpath presence -# https://github.com/deadc0de6/dotdrop/issues/6 -rl="readlink -f" - -if ! ${rl} "${0}" >/dev/null 2>&1; then - rl="realpath" - - if ! hash ${rl}; then - echo "\"${rl}\" not found!" && exit 1 - fi -fi - -# setup variables -args=("$@") -cur=$(dirname "$(${rl} "${0}")") -opwd=$(pwd) -cfg="${cur}/config.yaml" -sub="dotdrop" - -# pivot -cd "${cur}" || { echo "Directory \"${cur}\" doesn't exist, aborting." && exit 1; } -# init/update the submodule -if [ "${DOTDROP_AUTOUPDATE-yes}" = yes ] ; then - git submodule update --init --recursive - git submodule update --remote dotdrop -fi -# launch dotdrop -PYTHONPATH=dotdrop python3 -m dotdrop.dotdrop "${args[@]}" -ret="$?" -# pivot back -cd "${opwd}" || { echo "Directory \"${opwd}\" doesn't exist, aborting." && exit 1; } -# exit with dotdrop exit code -exit ${ret} diff --git a/efistub/arch.efi b/efistub/arch.efi deleted file mode 100755 index c0932d67..00000000 --- a/efistub/arch.efi +++ /dev/null @@ -1,12 +0,0 @@ -#/bin/bash -# vim:ft=sh - -sudo efibootmgr \ - --disk /dev/sda \ - --part 1 \ - --create \ - --quiet \ - --remove-dups \ - --label "Arch Linux" \ - --loader /vmlinuz-linux \ - --unicode 'initrd=\amd-ucode.img initrd=\initramfs-linux.img cryptdevice=UUID=19fa8fab-c5fe-454a-9a17-b7185ce975ea:cryptroot:allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root resume=/dev/mapper/cryptroot resume_offset=10530935 rw quiet splash vga=current idle=nomwait cpuidle.governor=teo' diff --git a/efistub/lts.efi b/efistub/lts.efi deleted file mode 100755 index 9a9d0613..00000000 --- a/efistub/lts.efi +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# vim:ft=sh - -sudo efibootmgr \ - --disk /dev/sda \ - --part 1 \ - --create \ - --quiet \ - --remove-dups \ - --label "Arch Linux LTS" \ - --loader /vmlinuz-linux-lts \ - --unicode 'initrd=\amd-ucode.img initrd=\initramfs-linux-lts.img cryptdevice=UUID=19fa8fab-c5fe-454a-9a17-b7185ce975ea:cryptroot:allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root resume=/dev/mapper/cryptroot resume_offset=10530935 rw quiet splash vga=current idle=nomwait cpuidle.governor=teo' diff --git a/efistub/update.sh b/efistub/update.sh deleted file mode 100755 index 19a17d85..00000000 --- a/efistub/update.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# remove old entries -for bootentry in $(efibootmgr | head -n 3 | tail -n 1 | cut -d' ' -f2- | sed 's/,/\n/g'); do - sudo efibootmgr -qBb $bootentry -done - -# add all entries back -for bootscript in *.efi; do - ./$bootscript -done - -# set bootorder -sudo efibootmgr --bootorder 0000,0001 diff --git a/home/.config/alacritty/alacritty.yml b/home/.config/alacritty/alacritty.yml index 5574fc86..39b80d7e 100644 --- a/home/.config/alacritty/alacritty.yml +++ b/home/.config/alacritty/alacritty.yml @@ -1,4 +1,5 @@ window: + opacity: 1.0 dimensions: columns: 0 lines: 0 @@ -29,42 +30,40 @@ font: colors: # Default colors primary: - background: "0x282c34" - foreground: "0xabb2bf" + background: '0x282c34' + foreground: '0xabb2bf' # Cursor colors cursor: - text: "0x282c34" - cursor: "0xabb2bf" + text: '0x282c34' + cursor: '0xabb2bf' # Normal colors normal: - black: "0x282c34" - red: "0xe06c75" - green: "0x98c379" - yellow: "0xe5c07b" - blue: "0x61afef" - magenta: "0xc678dd" - cyan: "0x56b6c2" - white: "0xabb2bf" + black: '0x282c34' + red: '0xe06c75' + green: '0x98c379' + yellow: '0xe5c07b' + blue: '0x61afef' + magenta: '0xc678dd' + cyan: '0x56b6c2' + white: '0xabb2bf' # Bright colors bright: - black: "0x3e4452" - red: "0xbe5046" - green: "0x98c379" - yellow: "0xd19a66" - blue: "0x61afef" - magenta: "0xc678dd" - cyan: "0x56b6c2" - white: "0x5c6370" + black: '0x3e4452' + red: '0xbe5046' + green: '0x98c379' + yellow: '0xd19a66' + blue: '0x61afef' + magenta: '0xc678dd' + cyan: '0x56b6c2' + white: '0x5c6370' bell: animation: EaseOutExpo duration: 0 - color: "#ffffff" - -background_opacity: 1.0 + color: '#ffffff' mouse_bindings: - { mouse: Middle, action: PasteSelection } @@ -73,8 +72,6 @@ mouse: double_click: { threshold: 300 } triple_click: { threshold: 300 } hide_when_typing: false - url: - modifiers: None selection: semantic_escape_chars: ',│`|:"'' ()[]{}<>' diff --git a/home/.config/asd b/home/.config/asd new file mode 100644 index 00000000..e69de29b diff --git a/home/.config/beets/config.yaml b/home/.config/beets/config.yaml index a3d863da..cea0277d 100644 --- a/home/.config/beets/config.yaml +++ b/home/.config/beets/config.yaml @@ -1,34 +1,31 @@ -directory: ~/music -library: ~/music/beets.db -plugins: -- acousticbrainz -- check -- edit -- fetchart -- follow -- fuzzy -- info -- lastgenre -- lyrics -- mbcollection -- mpdupdate -- play -- replaygain -- thumbnails -- web +directory: ~/Music +library: ~/Music/beets.db +plugins: + - edit + - fetchart + - fuzzy + - info + - lastgenre + - lyrics + # - mbcollection + - mpdupdate + - play + - replaygain + - thumbnails + - web import: - copy: no - move: yes - link: no + write: yes + copy: yes lastgenre: whitelist: ~/.config/beets/whitelist lyrics: fallback: '' play: - command: mpv + command: mpv --no-vid --no-resume-playback mpd: - host: localhost - port: 6600 + host: localhost + port: 6600 + password: "{{@@ env['PASS_MPD_ADMIN'] @@}}" follow: email: reekymarko@reekynet.com password: "{{@@ env['PASS_MUSPY'] @@}}" @@ -37,9 +34,6 @@ follow: replaygain: backend: gstreamer auto: yes -musicbrainz: - user: ReekyMarko - pass: "{{@@ env['PASS_MUSICBRAINZ'] @@}}" -mbcollection: - auto: "yes" - collection: "a4955b5c-db7f-4e27-9887-f77f820bad34" +#mbcollection: +# auto: 'yes' +# collection: 'a4955b5c-db7f-4e27-9887-f77f820bad34' diff --git a/home/.config/dconf.ini b/home/.config/dconf.ini new file mode 100644 index 00000000..19ccc814 --- /dev/null +++ b/home/.config/dconf.ini @@ -0,0 +1,88 @@ +[io/github/celluloid-player/celluloid] +dark-theme-enable=false +mpv-config-enable=true +mpv-config-file='file:///home/{{@@ env['USER'] @@}}/.config/mpv/mpv.conf' +mpv-input-config-enable=true +mpv-input-config-file='file:///home/{{@@ env['USER'] @@}}/.config/mpv/input.conf' +settings-migrated=true + +[org/gnome/Connections] +first-run=false + +[org/gnome/shell/weather] +automatic-location=false +locations=[<(uint32 2, <('Lappeenranta', 'EFLP', false, [(1.0654507804726074, 0.49128594181309354)], @a(dd) [])>)>] + +[org/gnome/Weather] +locations=[<(uint32 2, <('Lappeenranta', 'EFLP', false, [(1.0654507804726074, 0.49128594181309354)], @a(dd) [])>)>] + +[org/gnome/shell/world-clocks] +locations=[<(uint32 2, <('Bangkok', 'VTBD', true, [(0.24289166005364171, 1.7558012275062955)], [(0.23998277214922031, 1.754346792280731)])>)>, <(uint32 2, <('Lappeenranta', 'EFLP', true, [(1.0654507804726074, 0.49128594181309354)], [(1.065814402368968, 0.49189195503597105)])>)>] + +[org/gnome/clocks] +world-clocks=[{'location': <(uint32 2, <('Bangkok', 'VTBD', true, [(0.24289166005364171, 1.7558012275062955)], [(0.23998277214922031, 1.754346792280731)])>)>}, {'location': <(uint32 2, <('Lappeenranta', 'EFLP', true, [(1.0654507804726074, 0.49128594181309354)], [(1.065814402368968, 0.49189195503597105)])>)>}] + +[org/gnome/desktop/a11y/mouse] +dwell-click-enabled=false +dwell-threshold=10 +dwell-time=1.2 +secondary-click-enabled=true +secondary-click-time=1.2 + +[org/gnome/desktop/calendar] +show-weekdate=true + +[org/gnome/desktop/input-sources] +show-all-sources=true +sources=[('xkb', 'eu'), ('xkb', 'fi')] +xkb-options=['lv3:ralt_switch'] + +[org/gnome/desktop/peripherals/touchpad] +tap-to-click=true +two-finger-scrolling-enabled=true + +[org/gnome/desktop/privacy] +disable-microphone=false +old-files-age=uint32 14 +recent-files-max-age=-1 +remove-old-temp-files=true +remove-old-trash-files=true + +[org/gnome/desktop/wm/keybindings] +close=['w'] +move-to-workspace-down=['j'] +move-to-workspace-left=['h'] +move-to-workspace-right=['l'] +move-to-workspace-up=['k'] +switch-to-workspace-down=['j'] +switch-to-workspace-left=['h'] +switch-to-workspace-right=['l'] +switch-to-workspace-up=['k'] +toggle-fullscreen=@as [] +toggle-maximized=['f'] + +[org/gnome/settings-daemon/plugins/media-keys] +custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/'] +screensaver=['BackSpace'] +www=['b'] +volume-step=1 + +[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0] +binding='Return' +command='kgx' +name='Open terminal' + +[org/gnome/file-roller/dialogs/new] +default-extension='.tar.zst' + +[org/gnome/software] +check-timestamp=int64 1667730233 +download-updates=true +download-updates-notify=true +first-run=false + +[org/gnome/system/location] +enabled=true + +[org/gnome/tweaks] +show-extensions-notice=false diff --git a/home/.config/electron-flags.conf b/home/.config/electron-flags.conf new file mode 100644 index 00000000..51bdd86f --- /dev/null +++ b/home/.config/electron-flags.conf @@ -0,0 +1,2 @@ +--enable-features=UseOzonePlatform +--ozone-platform=wayland diff --git a/home/.config/electron12-flags.conf b/home/.config/electron12-flags.conf new file mode 100644 index 00000000..51bdd86f --- /dev/null +++ b/home/.config/electron12-flags.conf @@ -0,0 +1,2 @@ +--enable-features=UseOzonePlatform +--ozone-platform=wayland diff --git a/home/.config/fontconfig/fonts.conf b/home/.config/fontconfig/fonts.conf index 6118c70b..a12fa719 100644 --- a/home/.config/fontconfig/fonts.conf +++ b/home/.config/fontconfig/fonts.conf @@ -1,26 +1,22 @@ - - - sans-serif - - Overpass - - - - - serif - - Overpass - - - - - monospace - - Hack Nerd Font Mono - - - + + sans-serif + + Adwaita Sans + + + + serif + + Adwaita Sans + + + + monospace + + Adwaita mono + + diff --git a/home/.config/foot/foot-light.ini b/home/.config/foot/foot-light.ini new file mode 100644 index 00000000..47cc25dd --- /dev/null +++ b/home/.config/foot/foot-light.ini @@ -0,0 +1,45 @@ +pad=10x0 +dpi-aware=yes + +[scrollback] +lines=1000 + +[cursor] +blink=yes + +[mouse] +hide-when-typing=yes + +[colors] +foreground = 545464 +background = f2ecbc + +selection-foreground = 43436c +selection-background = c9cbd1 + +regular0 = 1F1F28 +regular1 = c84053 +regular2 = 6f894e +regular3 = 77713f +regular4 = 4d699b +regular5 = b35b79 +regular6 = 597b75 +regular7 = 545464 + +bright0 = 8a8980 +bright1 = d7474b +bright2 = 6e915f +bright3 = 836f4a +bright4 = 6693bf +bright5 = 624c83 +bright6 = 5e857a +bright7 = 43436c + + +16 = cc6d00 +17 = e82424 + +[csd] +color = fff2ecbc +button-color = ff545464 +hide-when-maximized = yes diff --git a/home/.config/foot/foot.ini b/home/.config/foot/foot.ini index 572268b4..eb9fd24c 100644 --- a/home/.config/foot/foot.ini +++ b/home/.config/foot/foot.ini @@ -1,4 +1,5 @@ -pad=20x20 +pad=10x0 +dpi-aware=yes [scrollback] lines=1000 @@ -10,21 +11,34 @@ blink=yes hide-when-typing=yes [colors] -background=282c34 -foreground=abb2bf -regular0=282c34 -regular1=e06c75 -regular2=98c379 -regular3=e5c07b -regular4=61afef -regular5=c678dd -regular6=56b6c2 -regular7=abb2bf -bright0=3e4452 -bright1=be5046 -bright2=98c379 -bright3=d19a66 -bright4=61afef -bright5=c678dd -bright6=56b6c2 -bright7=5c6370 +foreground = dcd7ba +background = 1f1f28 + +selection-foreground = c8c093 +selection-background = 2d4f67 + +regular0 = 090618 +regular1 = c34043 +regular2 = 76946a +regular3 = c0a36e +regular4 = 7e9cd8 +regular5 = 957fb8 +regular6 = 6a9589 +regular7 = c8c093 + +bright0 = 727169 +bright1 = e82424 +bright2 = 98bb6c +bright3 = e6c384 +bright4 = 7fb4ca +bright5 = 938aa9 +bright6 = 7aa89f +bright7 = dcd7ba + +16 = ffa066 +17 = ff5d62 + +[csd] +color = ff1f1f28 +button-color = ffdcd7ba +hide-when-maximized = yes diff --git a/home/.config/git/config b/home/.config/git/config new file mode 100644 index 00000000..9c8c391e --- /dev/null +++ b/home/.config/git/config @@ -0,0 +1,64 @@ +[user] +{%@@ if profile == "mko-laptop" @@%} +email = marko.korhonen@netforecast.com +{%@@ else @@%} +email = marko@korhonen.cc +{%@@ endif @@%} +name = Marko Korhonen +signingkey = F2B9F713E7ED627336DD85E444FA3F28CD931BB0 + +[commit] +signoff = true +gpgsign = true + +[tag] +gpgSign = true +signoff = true + +[format] +signoff = true + +[merge] +prompt = false +conflictstyle = diff3 +tool = nvim + +[mergetool] +keepBackup = false +prompt = false + +[mergetool "nvim"] +cmd = nvim +DiffviewOpen + +[pull] +rebase = merges + +[alias] +mergetest = !git switch test && git pull && git merge --no-ff -m \"Merge $1 features to test\" $1 +upstream = !git push -u origin HEAD +sync = !git pull && git push +recommit = !git commit -eF $(git rev-parse --git-dir)/COMMIT_EDITMSG +pull-merge = pull --no-rebase --no-ff --no-edit +log-merge = log -i --grep=merge --pretty=oneline +log-fp = log --first-parent --pretty=oneline +ll = log --pretty=oneline +dno = !git --no-pager diff --name-only + +[color] +pager = no + +[init] +defaultBranch = main + +[credential] +helper = cache --timeout=600 +helper = !pass-git-helper $@ + +[rerere] +enabled = true + +[submodule] +recurse = true + +[push] +recurseSubmodules = check diff --git a/home/.config/gtk-3.0/gtk.css b/home/.config/gtk-3.0/gtk.css index 97052376..da7a019d 100644 --- a/home/.config/gtk-3.0/gtk.css +++ b/home/.config/gtk-3.0/gtk.css @@ -1,3 +1,4 @@ -VteTerminal, vte-terminal { - padding: 40px; +VteTerminal, +vte-terminal { + padding: 40px; } diff --git a/home/.config/imapnotify/admin@korhonen.cc.js b/home/.config/imapnotify/admin@korhonen.cc.js index de3e0a53..40d02d17 100644 --- a/home/.config/imapnotify/admin@korhonen.cc.js +++ b/home/.config/imapnotify/admin@korhonen.cc.js @@ -1,19 +1,19 @@ -var child_process = require("child_process"); +var child_process = require('child_process'); function getStdout(cmd) { var stdout = child_process.execSync(cmd); return stdout.toString().trim(); } -exports.host = "imap.migadu.com"; +exports.host = 'imap.migadu.com'; exports.port = 993; exports.tls = true; exports.tlsOptions = { rejectUnauthorized: true, }; -exports.username = "admin@korhonen.cc"; +exports.username = 'admin@korhonen.cc'; exports.password = "{{@@ env['PASS_EMAIL_ADMIN'] @@}}"; -exports.onNewMail = "mbsync admin@korhonen.cc"; +exports.onNewMail = 'mbsync admin@korhonen.cc'; exports.onNewMailPost = - "~/git/dotfiles/scripts/mail/notify-new-mail.sh admin@korhonen.cc"; -exports.boxes = ["INBOX"]; + '~/git/dotfiles/scripts/mail/notify-new-mail.sh admin@korhonen.cc'; +exports.boxes = ['INBOX']; diff --git a/home/.config/imapnotify/functionalhacker@korhonen.cc.js b/home/.config/imapnotify/functionalhacker@korhonen.cc.js index 1ca0937d..50746dfd 100644 --- a/home/.config/imapnotify/functionalhacker@korhonen.cc.js +++ b/home/.config/imapnotify/functionalhacker@korhonen.cc.js @@ -1,19 +1,19 @@ -var child_process = require("child_process"); +var child_process = require('child_process'); function getStdout(cmd) { var stdout = child_process.execSync(cmd); return stdout.toString().trim(); } -exports.host = "imap.migadu.com"; +exports.host = 'imap.migadu.com'; exports.port = 993; exports.tls = true; exports.tlsOptions = { rejectUnauthorized: true, }; -exports.username = "functionalhacker@korhonen.cc"; +exports.username = 'functionalhacker@korhonen.cc'; exports.password = "{{@@ env['PASS_EMAIL_HACKER'] @@}}"; -exports.onNewMail = "mbsync functionalhacker@korhonen.cc"; +exports.onNewMail = 'mbsync functionalhacker@korhonen.cc'; exports.onNewMailPost = - "~/git/dotfiles/scripts/mail/notify-new-mail.sh functionalhacker@korhonen.cc"; -exports.boxes = ["INBOX"]; + '~/git/dotfiles/scripts/mail/notify-new-mail.sh functionalhacker@korhonen.cc'; +exports.boxes = ['INBOX']; diff --git a/home/.config/imapnotify/marko@korhonen.cc.js b/home/.config/imapnotify/marko@korhonen.cc.js index f86cca94..afac7b4c 100644 --- a/home/.config/imapnotify/marko@korhonen.cc.js +++ b/home/.config/imapnotify/marko@korhonen.cc.js @@ -1,19 +1,19 @@ -var child_process = require("child_process"); +var child_process = require('child_process'); function getStdout(cmd) { var stdout = child_process.execSync(cmd); return stdout.toString().trim(); } -exports.host = "imap.migadu.com"; +exports.host = 'imap.migadu.com'; exports.port = 993; exports.tls = true; exports.tlsOptions = { rejectUnauthorized: true, }; -exports.username = "marko@korhonen.cc"; +exports.username = 'marko@korhonen.cc'; exports.password = "{{@@ env['PASS_EMAIL_MARKO'] @@}}"; -exports.onNewMail = "mbsync marko@korhonen.cc"; +exports.onNewMail = 'mbsync marko@korhonen.cc'; exports.onNewMailPost = - "~/git/dotfiles/scripts/mail/notify-new-mail.sh marko@korhonen.cc"; -exports.boxes = ["INBOX"]; + '~/git/dotfiles/scripts/mail/notify-new-mail.sh marko@korhonen.cc'; +exports.boxes = ['INBOX']; diff --git a/home/.config/mako/config b/home/.config/mako/config index 791c9619..993dd074 100644 --- a/home/.config/mako/config +++ b/home/.config/mako/config @@ -1,7 +1,12 @@ -background-color=#282828 -text-color=#EBDBB2 -border-color=#D65D0E +background-color=#1E1D2F +text-color=#D9E0EE +border-color=#96CDFB +progress-color=over #302D41 + icons=1 default-timeout=5000 max-visible=6 layer=overlay + +[urgency=high] +border-color=#F8BD96 diff --git a/home/.config/mimeo/associations.txt b/home/.config/mimeo/associations.txt index c15f4260..d9a37f2d 100644 --- a/home/.config/mimeo/associations.txt +++ b/home/.config/mimeo/associations.txt @@ -17,7 +17,10 @@ mpvqueue %U ^https?://(?:[a-z0-9\-]+\.)+[a-z]{2,6}(?:/[^/#?]+)+\.(?:mp4|mkv|webm|avi|3gp|gif|gifv) mpvqueue %U - ^https://www.facebook.com/watch/?v=.* + ^https?://www.facebook.com/watch/?v=.* + +mpvqueue %U + ^https?://www.facebook.com/.*/videos/.* mpvqueue %U ^https://fb.watch/.* @@ -31,11 +34,8 @@ mpvqueue %U mpvqueue %U ^https?://v.redd.it/.* -imgurviewer %U - ^https?://(www.)?imgur.com/a/ - -imgurviewer %U - ^https?://(www.)?imgur.com/gallery/ +mpvqueue %U + ^https?://areena.yle.fi.* imageviewer %U ^https?://(?:[a-z0-9\-]+\.)+[a-z]{2,6}(?:/[^/#?]+)+\.(?:jpg|jpeg|png|svg) @@ -48,6 +48,3 @@ alacritty -e rtv "%U" alacritty -e rtv "%U" ^https?://redd.it.* - -mpv "$(yle-dl --showurl %U)" - ^https?://areena.yle.fi.* diff --git a/home/.config/mpd/mpd.conf b/home/.config/mpd/mpd.conf index 0e05ab85..38a2a616 100644 --- a/home/.config/mpd/mpd.conf +++ b/home/.config/mpd/mpd.conf @@ -1,25 +1,24 @@ -music_directory "~/music" -playlist_directory "~/music/Playlists" -db_file "~/.mpd/database" -log_file "~/.mpd/log" -pid_file "~/.mpd/pid" -state_file "~/.mpd/state" -sticker_file "~/.mpd/sticker.sql" +music_directory "~/Music" +playlist_directory "~/Music/Playlists" +db_file "~/.mpd/database" +log_file "~/.mpd/log" +state_file "~/.mpd/state" +sticker_file "~/.mpd/sticker.sql" -replaygain "track" +replaygain "track" -default_permissions "read" -password "{{@@ env['PASS_MPD'] @@}}@read,add,control" -password "{{@@ env['PASS_MPD_ADMIN'] @@}}@read,add,control,admin" +default_permissions "read,add,control" +password "{{@@ env['PASS_MPD'] @@}}@read,add,control" +password "{{@@ env['PASS_MPD_ADMIN'] @@}}@read,add,control,admin" audio_output { - type "fifo" - name "Visualizer" - path "/tmp/mpd.fifo" - format "44100:16:2" + type "fifo" + name "Visualizer" + path "/tmp/mpd.fifo" + format "44100:16:2" } audio_output { - type "pulse" - name "MPD PulseAudio" + type "pipewire" + name "MPD PipeWire" } diff --git a/home/.config/mpv/input.conf b/home/.config/mpv/input.conf index 4dc916fa..28f13934 100644 --- a/home/.config/mpv/input.conf +++ b/home/.config/mpv/input.conf @@ -22,3 +22,5 @@ MUTE cycle ao-mute = add audio-delay 0.100 - add audio-delay -0.100 + +s playlist-shuffle diff --git a/home/.config/mpv/mpv.conf b/home/.config/mpv/mpv.conf index be2d89c7..28e7c939 100644 --- a/home/.config/mpv/mpv.conf +++ b/home/.config/mpv/mpv.conf @@ -7,10 +7,8 @@ vo=gpu hwdec=vaapi hwdec-codecs=all -{%@@ if profile == "Mirkwood" @@%} +{%@@ if wayland @@%} gpu-context=wayland -{%@@ elif profile == "Rivendell" @@%} -ao=alsa {%@@ endif @@%} ############# @@ -27,8 +25,12 @@ replaygain=track # Start ipc server input-ipc-server=/tmp/mpvsocket -# set youtube-dl max res to 1080 +# set youtube-dl max res +{%@@ if profile == "Moria" @@%} +ytdl-format=bestvideo[height<=2160]+bestaudio/best[height<=2160] +{%@@ else @@%} ytdl-format=bestvideo[height<=1080]+bestaudio/best[height<=1080] +{%@@ endif @@%} # continue watching save-position-on-quit @@ -72,7 +74,7 @@ osd-bar-w=60 # width of " " " osd-shadow-color="#11000000" osd-fractions -# Protocol specific configuration +# Protocol specific configuration [protocol.https] cache=yes user-agent='Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0' @@ -104,8 +106,4 @@ ytdl-format="bestvideo[height<=2160]+bestaudio/best[height<=2160]" [best] ytdl-format="bestvideo+bestaudio" -# Vulkan hwdec profile -[vulkan] -gpu-api=vulkan -gpu-context=waylandvk -hwdec=vaapi-copy +script-opts-append=ytdl_hook-ytdl_path=yt-dlp diff --git a/home/.config/mpv/scripts/yledl_hook.lua b/home/.config/mpv/scripts/yledl_hook.lua new file mode 100644 index 00000000..1ff15ff1 --- /dev/null +++ b/home/.config/mpv/scripts/yledl_hook.lua @@ -0,0 +1,76 @@ +-- Copied from https://github.com/pekkarr/mpv-yledl +-- Copyright 2021 Pekka Ristola + +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +local msg = require 'mp.msg' +local utils = require 'mp.utils' + +local function add_series(data) + local playlist = { "#EXTM3U" } + for _, episode in pairs(data) do + table.insert(playlist, episode["webpage"]) + end + mp.set_property("stream-open-filename", "memory://" .. table.concat(playlist, "\n")) +end + +local function add_single_video(data) + local flavors = data["flavors"] + table.sort(flavors, function(a, b) return a["bitrate"] > b["bitrate"] end) + local best = flavors[1] + mp.set_property("stream-open-filename", best["url"]) + mp.set_property("file-local-options/force-media-title", data["title"]) + for _, sub in ipairs(data["subtitles"]) do + local lang = sub["language"] + msg.verbose("Adding subtitles for " .. lang) + mp.commandv("sub-add", sub["url"], "auto", sub["category"], lang) + end +end + +mp.add_hook("on_load", 9, function() + msg.verbose('yle-dl hook') + local url = mp.get_property("stream-open-filename", "") + if (url:find("https?://%a+%.yle%.fi/") == 1) or (url:find("https?://yle%.fi/") == 1) then + local start_time = os.clock() + local command = { "yle-dl", "--showmetadata", url } + msg.debug("Running: " .. table.concat(command, ' ')) + local ret = mp.command_native({name = "subprocess", + args = command, + capture_stdout = true, + capture_stderr = false}) + if ret.killed_by_us then + return + end + if (ret.status < 0) or (ret.stdout == nil) or (ret.stdout == "") then + msg.error("yle-dl failed to parse url") + return + end + + local json, err = utils.parse_json(ret.stdout) + if (json == nil) then + msg.error("failed to parse JSON: " .. err) + return + end + msg.verbose("yle-dl succeeded") + msg.debug("running yle-dl took " .. os.clock() - start_time .. " seconds") + + if #json == 1 then + add_single_video(json[1]) + else + add_series(json) + end + else + msg.verbose('not an areena url') + end +end) diff --git a/home/.config/mvi/input.conf b/home/.config/mvi/input.conf deleted file mode 100644 index 416eb1c2..00000000 --- a/home/.config/mvi/input.conf +++ /dev/null @@ -1,99 +0,0 @@ -SPACE repeatable playlist-next -alt+SPACE repeatable playlist-prev - -UP ignore -DOWN ignore -LEFT repeatable playlist-prev -RIGHT repeatable playlist-next - -# simple reminder of default bindings -#1 add contrast -1 -#2 add contrast 1 -#3 add brightness -1 -#4 add brightness 1 -#5 add gamma -1 -#6 add gamma 1 -#7 add saturation -1 -#8 add saturation 1 - -# mouse-centric bindings -MBTN_RIGHT script-binding image_viewer/drag-to-pan -MBTN_LEFT script-binding image_viewer/pan-follows-cursor -WHEEL_UP script-message cursor-centric-zoom 0.1 -WHEEL_DOWN script-message cursor-centric-zoom -0.1 - -# panning with the keyboard: -# pan-image takes the following arguments -# pan-image AXIS AMOUNT ZOOM_INVARIANT IMAGE_CONSTRAINED -# ^ ^ ^ -# x or y | | -# | | -# if yes, will pan by the same if yes, stops panning if the image -# amount regardless of zoom would go outside of the window - -ctrl+down repeatable script-message pan-image y -0.1 yes yes -ctrl+up repeatable script-message pan-image y +0.1 yes yes -ctrl+right repeatable script-message pan-image x -0.1 yes yes -ctrl+left repeatable script-message pan-image x +0.1 yes yes - -# now with more precision -alt+down repeatable script-message pan-image y -0.01 yes yes -alt+up repeatable script-message pan-image y +0.01 yes yes -alt+right repeatable script-message pan-image x -0.01 yes yes -alt+left repeatable script-message pan-image x +0.01 yes yes - -# replace at will with h,j,k,l if you prefer vim-style bindings - -# on a trackpad you may want to use these -#WHEEL_UP repeatable script-message pan-image y -0.02 yes yes -#WHEEL_DOWN repeatable script-message pan-image y +0.02 yes yes -#WHEEL_LEFT repeatable script-message pan-image x -0.02 yes yes -#WHEEL_RIGHT repeatable script-message pan-image x +0.02 yes yes - -# align the border of the image to the border of the window -# align-border takes the following arguments: -# align-border ALIGN_X ALIGN_Y -# any value for ALIGN_* is accepted, -1 and 1 map to the border of the window -ctrl+shift+right script-message align-border -1 "" -ctrl+shift+left script-message align-border 1 "" -ctrl+shift+down script-message align-border "" -1 -ctrl+shift+up script-message align-border "" 1 - -# reset the image -ctrl+0 no-osd set video-pan-x 0; no-osd set video-pan-y 0; no-osd set video-zoom 0 - -+ add video-zoom 0.5 -- add video-zoom -0.5; script-message reset-pan-if-visible -= no-osd set video-zoom 0; script-message reset-pan-if-visible - -# sxiv compatibility -w no-osd set video-unscaled yes; keypress = -e no-osd set video-unscaled no; keypress = - -h no-osd vf toggle hflip; show-text "Horizontal flip" -v no-osd vf toggle vflip; show-text "Vertical flip" - -r script-message rotate-video 90; show-text "Clockwise rotation" -R script-message rotate-video -90; show-text "Counter-clockwise rotation" -alt+r no-osd set video-rotate 0; show-text "Reset rotation" - -d script-message ruler - -# Toggling between pixel-exact reproduction and interpolation -a cycle-values scale nearest ewa_lanczossharp - -# Toggle color management on or off -c cycle icc-profile-auto - -# Screenshot of the window output -S screenshot window - -# Toggle aspect ratio information on and off -A cycle-values video-aspect "-1" "no" - -p script-message force-print-filename - -# ADVANCED: you can define bindings that belong to a "section" (named "image-viewer" here) like so: -#alt+SPACE {image-viewer} repeatable playlist-prev -#SPACE {image-viewer} repeatable playlist-next -# to load them conditionally with a command. See scripts-opts/image_viewer.conf for how you can do this diff --git a/home/.config/mvi/mpv.conf b/home/.config/mvi/mpv.conf deleted file mode 100644 index 5c5dcfbb..00000000 --- a/home/.config/mvi/mpv.conf +++ /dev/null @@ -1,46 +0,0 @@ -## IMAGE -# classic opengl-hq parameter, change at will -scale=spline36 -cscale=spline36 -dscale=mitchell -dither-depth=auto -correct-downscaling -sigmoid-upscaling -# debanding seems rarely useful with images -#deband - -## MISC -mute=yes -# the osc is mostly useful for videos -osc=no -# don't try to autoload subtitles or audio files -sub-auto=no -audio-file-auto=no -# get rid of the useless V: 00:00:00 / 00:00:00 line -term-status-msg= - -# replace mpv with mvi in the window title -title="${?media-title:${media-title}}${!media-title:No file} - mvi" - -# don't slideshow by default -image-display-duration=inf -# loop files in case of webms or gifs -loop-file=inf -# and loop the whole playlist -loop-playlist=inf - -# you need this if you plan to use drag-to-pan or pan-follows-cursor with MOUSE_LEFT -window-dragging=no - -#according to haasn, aspect ratio info for PNG and JPG is "universally bust" -[extension.png] -video-aspect=no - -[extension.jpg] -video-aspect=no - -[extension.jpeg] -profile=extension.jpg - -[silent] -msg-level=all=no diff --git a/home/.config/mvi/script-opts/image_viewer.conf b/home/.config/mvi/script-opts/image_viewer.conf deleted file mode 100644 index 4fe886fa..00000000 --- a/home/.config/mvi/script-opts/image_viewer.conf +++ /dev/null @@ -1,78 +0,0 @@ -## MISC -# size of the margins with pan-follows-cursor -pan_follows_cursor_margin=50 -# whether pan-follows-cursor should pan when the entire image is visible -pan_follows_cursor_move_if_full_view=no - -## STATUS LINE -# whether to show a status line -status_line_enabled=yes -# its position, possible values: (bottom|top)_(left|right) -status_line_position=bottom_left -# its font size -status_line_size=36 -# the text to be expanded -# see property expansion: https://mpv.io/manual/master/#property-expansion -# \N can be used for line breaks -# you can also use ass tags, see here: http://docs.aegisub.org/3.2/ASS_Tags/ -status_line=${filename} [${playlist-pos-1}/${playlist-count}] - -## MINIMAP -# whether to show a minimap -minimap_enabled=yes -# the position of the center of the minimap, in percentage of the window (x, y) -minimap_center=92,92 -# the scale of the minimap (i.e. the view rectangle is scale / 100 times the size of the window) -minimap_scale=12 -# the cutoff size of the minimap (i.e. the image rectangle is clipped if it falls outside of the this zone) -minimap_max_size=16,16 -# opacity of the "image" (from 00=opaque to FF=transparent) -minimap_image_opacity=88 -# color of the "image" (#BBGGRR where each component rages from 00 to FF) -minimap_image_color=BBBBBB -# opacity of the "view" -minimap_view_opacity=BB -minimap_view_color=222222 -# whether the view should be drawn above the image -minimap_view_above_image=yes -# whether to show the minimap if the current image is fully visible -minimap_hide_when_full_image_in_view=yes - -## RULER -# whether to show the length of the lines between the two points -ruler_show_distance=yes -# whether to show the coordinates of the two points -ruler_show_coordinates=yes -# the coordinate space of the text shown. Can be "image", "window", "both" -ruler_coordinates_space=image -# can be "degrees", "radians", "both", or "no" -ruler_show_angles=degrees -ruler_line_width=2 -ruler_dots_radius=3 -ruler_font_size=36 -# ranges from 00 (black) to FF (white) -ruler_line_color=33 -# bindings used to set points. The binding to trigger ruler mode can also be used. Comma-separated list -ruler_confirm_bindings=MBTN_LEFT,ENTER -# bindings used to set points. The binding to trigger ruler mode can also be used. Comma-separated list -ruler_exit_bindings=ESC -# if yes, the first point will be immediately set at the cursor position when calling 'ruler' -ruler_set_first_point_on_begin=no -# if yes, the ruler overlay will be immediately cleared when setting the second point -ruler_clear_on_second_point_set=no - -## HOOKS -# commands to execute when a file detected as an image (1 frame, no audio) is loaded or unloaded -# an image was loaded, and the previous file was not an image (or there was no previous file) -command_on_first_image_loaded= -# an image was loaded (regardless of what the previous file was) -command_on_image_loaded= -# a non-image was loaded, and the previous file was an image -command_on_non_image_loaded= -# the purpose of these "hooks" is to let you change bindings, profiles, reset properties... -# see https://mpv.io/manual/master/#list-of-input-commands for general command information -# note that there is no such thing as "unloading a profile", to emulate this you must create an opposite profile and load that -# example possible values: -#command_on_first_image_loaded=apply-profile image; enable-section image-viewer; script-message enable-status-line -#command_on_image_loaded=no-osd set video-pan-x 0; script-message align-border "" -1 -#command_on_non_image_loaded=disable-section image-viewer; no-osd set video-pan-x 0; no-osd set video-pan-y 0; no-osd set video-zoom 0; script-message disable-status-line diff --git a/home/.config/mvi/scripts/image-viewer.lua b/home/.config/mvi/scripts/image-viewer.lua deleted file mode 100644 index 9e1ec11b..00000000 --- a/home/.config/mvi/scripts/image-viewer.lua +++ /dev/null @@ -1,953 +0,0 @@ -local opts = { - pan_follows_cursor_margin = 50, - pan_follows_cursor_move_if_full_view = false, - - status_line_enabled = false, - status_line_position = "bottom_left", - status_line_size = 36, - status_line = "${filename} [${playlist-pos-1}/${playlist-count}]", - - minimap_enabled = true, - minimap_center = "92,92", - minimap_scale = 12, - minimap_max_size = "16,16", - minimap_image_opacity = "88", - minimap_image_color = "BBBBBB", - minimap_view_opacity = "BB", - minimap_view_color = "222222", - minimap_view_above_image = true, - minimap_hide_when_full_image_in_view = true, - - ruler_show_distance=true, - ruler_show_coordinates=true, - ruler_coordinates_space="both", - ruler_show_angles="degrees", - ruler_line_width=2, - ruler_dots_radius=3, - ruler_font_size=36, - ruler_line_color="33", - ruler_confirm_bindings="MBTN_LEFT,ENTER", - ruler_exit_bindings="ESC", - ruler_set_first_point_on_begin=false, - ruler_clear_on_second_point_set=false, - - command_on_first_image_loaded="", - command_on_image_loaded="", - command_on_non_image_loaded="", -} -(require 'mp.options').read_options(opts) -function split(input) - local ret = {} - for str in string.gmatch(input, "([^,]+)") do - ret[#ret + 1] = str - end - return ret -end -function str_to_num(array) - local ret = {} - for _, v in ipairs(array) do - ret[#ret + 1] = tonumber(v) - end - return ret -end -opts.minimap_center=str_to_num(split(opts.minimap_center)) -opts.minimap_max_size=str_to_num(split(opts.minimap_max_size)) -opts.ruler_confirm_bindings=split(opts.ruler_confirm_bindings) -opts.ruler_exit_bindings=split(opts.ruler_exit_bindings) - -function clamp(value, low, high) - if value <= low then - return low - elseif value >= high then - return high - else - return value - end -end - -local msg = require 'mp.msg' -local assdraw = require 'mp.assdraw' - -local ass = { -- shared ass state - status_line = "", - minimap = "", - ruler = "", -} - -local cleanup = nil -- function set up by drag-to-pan/pan-follows cursor and must be called to clean lingering state -local mouse_move_callbacks = {} -- functions that are called when mouse_move is triggered -function add_mouse_move_callback(key, func) - if #mouse_move_callbacks == 0 then - mp.add_forced_key_binding("mouse_move", "image-viewer-internal", function() - for _, func in pairs(mouse_move_callbacks) do - func() - end - end) - end - mouse_move_callbacks[key] = func -end -function remove_mouse_move_callback(key) - mouse_move_callbacks[key] = nil - for _,_ in pairs(mouse_move_callbacks) do - return - end - mp.remove_key_binding("image-viewer-internal") -end - -video_dimensions_stale = true -function get_video_dimensions() - -- this function is very much ripped from video/out/aspect.c in mpv's source - if not video_dimensions_stale then return _video_dimensions end - local video_params = mp.get_property_native("video-out-params") - if not video_params then - _video_dimensions = nil - return nil - end - if not _timestamp then _timestamp = 0 end - _timestamp = _timestamp + 1 - _video_dimensions = { - timestamp = _timestamp, - top_left = {x = 0, y = 0}, - bottom_right = {x = 0, y = 0}, - size = {w = 0, h = 0}, - ratios = {w = 0, h = 0}, -- by how much the original video got scaled - } - local keep_aspect = mp.get_property_bool("keepaspect") - local w = video_params["w"] - local h = video_params["h"] - local dw = video_params["dw"] - local dh = video_params["dh"] - if mp.get_property_number("video-rotate") % 180 == 90 then - w, h = h,w - dw, dh = dh, dw - end - local window_w, window_h = mp.get_osd_size() - - if keep_aspect then - local unscaled = mp.get_property_native("video-unscaled") - local panscan = mp.get_property_number("panscan") - - local fwidth = window_w - local fheight = math.floor(window_w / dw * dh) - if fheight > window_h or fheight < h then - local tmpw = math.floor(window_h / dh * dw) - if tmpw <= window_w then - fheight = window_h - fwidth = tmpw - end - end - local vo_panscan_area = window_h - fheight - local f_w = fwidth / fheight - local f_h = 1 - if vo_panscan_area == 0 then - vo_panscan_area = window_h - fwidth - f_w = 1 - f_h = fheight / fwidth - end - if unscaled or unscaled == "downscale-big" then - vo_panscan_area = 0 - if unscaled or (dw <= window_w and dh <= window_h) then - fwidth = dw - fheight = dh - end - end - - local scaled_width = fwidth + math.floor(vo_panscan_area * panscan * f_w) - local scaled_height = fheight + math.floor(vo_panscan_area * panscan * f_h) - - local split_scaling = function (dst_size, scaled_src_size, zoom, align, pan) - scaled_src_size = math.floor(scaled_src_size * 2 ^ zoom) - align = (align + 1) / 2 - local dst_start = math.floor((dst_size - scaled_src_size) * align + pan * scaled_src_size) - if dst_start < 0 then - --account for C int cast truncating as opposed to flooring - dst_start = dst_start + 1 - end - local dst_end = dst_start + scaled_src_size; - if dst_start >= dst_end then - dst_start = 0 - dst_end = 1 - end - return dst_start, dst_end - end - local zoom = mp.get_property_number("video-zoom") - - local align_x = mp.get_property_number("video-align-x") - local pan_x = mp.get_property_number("video-pan-x") - _video_dimensions.top_left.x, _video_dimensions.bottom_right.x = split_scaling(window_w, scaled_width, zoom, align_x, pan_x) - - local align_y = mp.get_property_number("video-align-y") - local pan_y = mp.get_property_number("video-pan-y") - _video_dimensions.top_left.y, _video_dimensions.bottom_right.y = split_scaling(window_h, scaled_height, zoom, align_y, pan_y) - else - _video_dimensions.top_left.x = 0 - _video_dimensions.bottom_right.x = window_w - _video_dimensions.top_left.y = 0 - _video_dimensions.bottom_right.y = window_h - end - _video_dimensions.size.w = _video_dimensions.bottom_right.x - _video_dimensions.top_left.x - _video_dimensions.size.h = _video_dimensions.bottom_right.y - _video_dimensions.top_left.y - _video_dimensions.ratios.w = _video_dimensions.size.w / w - _video_dimensions.ratios.h = _video_dimensions.size.h / h - video_dimensions_stale = false - return _video_dimensions -end - -for _, p in ipairs({ - "keepaspect", - "video-out-params", - "video-unscaled", - "panscan", - "video-zoom", - "video-align-x", - "video-pan-x", - "video-align-y", - "video-pan-y", - "osd-width", - "osd-height", -}) do - mp.observe_property(p, "native", function() video_dimensions_stale = true end) -end - -function drag_to_pan_handler(table) - if cleanup then - cleanup() - cleanup = nil - end - if table["event"] == "down" then - local video_dimensions = get_video_dimensions() - if not video_dimensions then return end - local mouse_pos_origin, video_pan_origin = {}, {} - local moved = false - mouse_pos_origin.x, mouse_pos_origin.y = mp.get_mouse_pos() - video_pan_origin.x = mp.get_property("video-pan-x") - video_pan_origin.y = mp.get_property("video-pan-y") - local idle = function() - if moved then - local mX, mY = mp.get_mouse_pos() - local pX = video_pan_origin.x + (mX - mouse_pos_origin.x) / video_dimensions.size.w - local pY = video_pan_origin.y + (mY - mouse_pos_origin.y) / video_dimensions.size.h - mp.command("no-osd set video-pan-x " .. clamp(pX, -3, 3) .. "; no-osd set video-pan-y " .. clamp(pY, -3, 3)) - moved = false - end - end - mp.register_idle(idle) - add_mouse_move_callback("drag-to-pan", function() moved = true end) - cleanup = function() - remove_mouse_move_callback("drag-to-pan") - mp.unregister_idle(idle) - end - end -end - -function pan_follows_cursor_handler(table) - if cleanup then - cleanup() - cleanup = nil - end - if table["event"] == "down" then - local video_dimensions = get_video_dimensions() - if not video_dimensions then return end - local window_w, window_h = mp.get_osd_size() - local moved = true - local idle = function() - if moved then - local mX, mY = mp.get_mouse_pos() - local x = math.min(1, math.max(- 2 * mX / window_w + 1, -1)) - local y = math.min(1, math.max(- 2 * mY / window_h + 1, -1)) - local command = "" - local margin, move_full = opts.pan_follows_cursor_margin, opts.pan_follows_cursor_move_if_full_view - if (not move_full and window_w < video_dimensions.size.w) then - command = command .. "no-osd set video-pan-x " .. clamp(x * (video_dimensions.size.w - window_w + 2 * margin) / (2 * video_dimensions.size.w), -3, 3) .. ";" - elseif mp.get_property_number("video-pan-x") ~= 0 then - command = command .. "no-osd set video-pan-x " .. "0;" - end - if (not move_full and window_h < video_dimensions.size.h) then - command = command .. "no-osd set video-pan-y " .. clamp(y * (video_dimensions.size.h - window_h + 2 * margin) / (2 * video_dimensions.size.h), -3, 3) .. ";" - elseif mp.get_property_number("video-pan-y") ~= 0 then - command = command .. "no-osd set video-pan-y " .. "0;" - end - if command ~= "" then - mp.command(command) - end - moved = false - end - end - mp.register_idle(idle) - add_mouse_move_callback("pan-follows-cursor", function() moved = true end) - cleanup = function() - remove_mouse_move_callback("pan-follows-cursor") - mp.unregister_idle(idle) - end - end -end - -function cursor_centric_zoom_handler(amt) - local zoom_inc = tonumber(amt) - if not zoom_inc or zoom_inc == 0 then return end - local video_dimensions = get_video_dimensions() - if not video_dimensions then return end - local mouse_pos_origin, video_pan_origin = {}, {} - mouse_pos_origin.x, mouse_pos_origin.y = mp.get_mouse_pos() - video_pan_origin.x = mp.get_property("video-pan-x") - video_pan_origin.y = mp.get_property("video-pan-y") - local zoom_origin = mp.get_property("video-zoom") - -- how far the cursor is form the middle of the video (in percentage) - local rx = (video_dimensions.top_left.x + video_dimensions.size.w / 2 - mouse_pos_origin.x) / (video_dimensions.size.w / 2) - local ry = (video_dimensions.top_left.y + video_dimensions.size.h / 2 - mouse_pos_origin.y) / (video_dimensions.size.h / 2) - - -- the size in pixels of the (in|de)crement - local diffHeight = (2 ^ zoom_inc - 1) * video_dimensions.size.h - local diffWidth = (2 ^ zoom_inc - 1) * video_dimensions.size.w - local newPanX = (video_pan_origin.x * video_dimensions.size.w + rx * diffWidth / 2) / (video_dimensions.size.w + diffWidth) - local newPanY = (video_pan_origin.y * video_dimensions.size.h + ry * diffHeight / 2) / (video_dimensions.size.h + diffHeight) - mp.command("no-osd set video-zoom " .. zoom_origin + zoom_inc .. "; no-osd set video-pan-x " .. clamp(newPanX, -3, 3) .. "; no-osd set video-pan-y " .. clamp(newPanY, -3, 3)) -end - -function align_border(x, y) - local video_dimensions = get_video_dimensions() - if not video_dimensions then return end - local window_w, window_h = mp.get_osd_size() - local x, y = tonumber(x), tonumber(y) - local command = "" - if x then - command = command .. "no-osd set video-pan-x " .. clamp(x * (video_dimensions.size.w - window_w) / (2 * video_dimensions.size.w), -3, 3) .. ";" - end - if y then - command = command .. "no-osd set video-pan-y " .. clamp(y * (video_dimensions.size.h - window_h) / (2 * video_dimensions.size.h), -3, 3) .. ";" - end - if command ~= "" then - mp.command(command) - end -end - -function pan_image(axis, amount, zoom_invariant, image_constrained) - amount = tonumber(amount) - if not amount or amount == 0 or axis ~= "x" and axis ~= "y" then return end - if zoom_invariant == "yes" then - amount = amount / 2 ^ mp.get_property_number("video-zoom") - end - local prop = "video-pan-" .. axis - local old_pan = mp.get_property_number(prop) - if image_constrained == "yes" then - local video_dimensions = get_video_dimensions() - if not video_dimensions then return end - local measure = axis == "x" and "w" or "h" - local window = {} - window.w, window.h = mp.get_osd_size() - local pixels_moved = amount * video_dimensions.size[measure] - -- should somehow refactor this - if pixels_moved > 0 then - if window[measure] > video_dimensions.size[measure] then - if video_dimensions.bottom_right[axis] >= window[measure] then return end - if video_dimensions.bottom_right[axis] + pixels_moved > window[measure] then - amount = (window[measure] - video_dimensions.bottom_right[axis]) / video_dimensions.size[measure] - end - else - if video_dimensions.top_left[axis] >= 0 then return end - if video_dimensions.top_left[axis] + pixels_moved > 0 then - amount = (0 - video_dimensions.top_left[axis]) / video_dimensions.size[measure] - end - end - else - if window[measure] > video_dimensions.size[measure] then - if video_dimensions.top_left[axis] <= 0 then return end - if video_dimensions.top_left[axis] + pixels_moved < 0 then - amount = (0 - video_dimensions.top_left[axis]) / video_dimensions.size[measure] - end - else - if video_dimensions.bottom_right[axis] <= window[measure] then return end - if video_dimensions.bottom_right[axis] + pixels_moved < window[measure] then - amount = (window[measure] - video_dimensions.bottom_right[axis]) / video_dimensions.size[measure] - end - end - end - end - mp.set_property_number(prop, old_pan + amount) -end - -function rotate_video(amt) - local rot = mp.get_property_number("video-rotate") - rot = (rot + amt) % 360 - mp.set_property_number("video-rotate", rot) -end - -function reset_pan_if_visible() - local video_dimensions = get_video_dimensions() - if not video_dimensions then return end - local window_w, window_h = mp.get_osd_size() - local command = "" - if (window_w >= video_dimensions.size.w) then - command = command .. "no-osd set video-pan-x 0" .. ";" - end - if (window_h >= video_dimensions.size.h) then - command = command .. "no-osd set video-pan-y 0" .. ";" - end - if command ~= "" then - mp.command(command) - end -end - -function force_print_filename() - mp.set_property("msg-level", "cplayer=info") - mp.commandv("print-text", mp.get_property("path")) - mp.set_property("msg-level", "all=no") -end - -function draw_ass() - local ww, wh = mp.get_osd_size() - local merge = function(a, b) - return b ~= "" and (a .. "\n" .. b) or a - end - mp.set_osd_ass(ww, wh, merge(merge(ass.status_line, ass.minimap), ass.ruler)) -end - -local status_line_enabled = false -local status_line_stale = true - -function mark_status_line_stale() - status_line_stale = true -end - -function refresh_status_line() - if not status_line_stale then return end - status_line_stale = false - local path = mp.get_property("path") - if path == nil or path == "" then - ass.status_line = "" - draw_ass() - return - end - local expanded = mp.command_native({ "expand-text", opts.status_line }) - if not expanded then - msg.warn("Error expanding status line") - ass.status_line = "" - draw_ass() - return - end - local w,h = mp.get_osd_size() - local an, x, y - local margin = 10 - if opts.status_line_position == "top_left" then - x = margin - y = margin - an = 7 - elseif opts.status_line_position == "top_right" then - x = w-margin - y = margin - an = 9 - elseif opts.status_line_position == "bottom_right" then - x = w-margin - y = h-margin - an = 3 - else - x = margin - y = h-margin - an = 1 - end - local a = assdraw:ass_new() - a:new_event() - a:an(an) - a:pos(x,y) - a:append("{\\fs".. opts.status_line_size.. "}{\\bord1.0}") - a:append(expanded) - ass.status_line = a.text - draw_ass() -end - -function enable_status_line() - if status_line_enabled then return end - status_line_enabled = true - local start = 0 - while true do - local s, e, cap = string.find(opts.status_line, "%${[?!]?([%l%d-/]*)", start) - if not s then break end - mp.observe_property(cap, nil, mark_status_line_stale) - start = e - end - mp.observe_property("path", nil, mark_status_line_stale) - mp.observe_property("osd-width", nil, mark_status_line_stale) - mp.observe_property("osd-height", nil, mark_status_line_stale) - mp.register_idle(refresh_status_line) - mark_status_line_stale() -end - -function disable_status_line() - if not status_line_enabled then return end - status_line_enabled = false - mp.unobserve_property(mark_status_line_stale) - mp.unregister_idle(refresh_status_line) - ass.status_line = "" - draw_ass() -end - -if opts.status_line_enabled then - enable_status_line() -end - -if opts.command_on_image_loaded ~= "" or opts.command_on_non_image_loaded ~= "" then - local was_image = false - local frame_count = nil - local audio_tracks = nil - local out_params_ready = nil - local path = nil - - function state_changed() - function set_image(is_image) - if is_image and not was_image and opts.command_on_first_image_loaded ~= "" then - mp.command(opts.command_on_first_image_loaded) - end - if is_image and opts.command_on_image_loaded ~= "" then - mp.command(opts.command_on_image_loaded) - end - if not is_image and was_image and opts.command_on_non_image_loaded ~= "" then - mp.command(opts.command_on_non_image_loaded) - end - was_image = is_image - end - -- only do things when state is consistent - if path ~= nil and audio_tracks ~= nil then - if frame_count == nil and audio_tracks > 0 then - set_image(false) - elseif out_params_ready and frame_count ~= nil then - -- png have 0 frames, jpg 1 ¯\_(ツ)_/¯ - set_image((frame_count == 0 or frame_count == 1) and audio_tracks == 0) - end - end - end - - mp.observe_property("video-out-params/par", "number", function(_, val) - out_params_ready = (val ~= nil and val > 0) - state_changed() - end) - mp.observe_property("estimated-frame-count", "number", function(_, val) - frame_count = val - state_changed() - end) - mp.observe_property("path", "string", function(_, val) - if not val or val == "" then - path = nil - else - path = val - end - state_changed() - end) - mp.register_event("tracks-changed", function() - audio_tracks = 0 - local tracks = 0 - for _, track in ipairs(mp.get_property_native("track-list")) do - tracks = tracks + 1 - if track.type == "audio" then - audio_tracks = audio_tracks + 1 - end - end - if tracks == 0 then - audio_tracks = nil - end - state_changed() - end) -end - -function refresh_minimap() - local dim = get_video_dimensions() - if not dim then - ass.minimap = "" - draw_ass() - return - end - if _minimap_old_timestamp and dim.timestamp == _minimap_old_timestamp then return end - _minimap_old_timestamp = dim.timestamp - local ww, wh = mp.get_osd_size() - if opts.minimap_hide_when_full_image_in_view then - if dim.top_left.x >= 0 and - dim.top_left.y >= 0 and - dim.bottom_right.x <= ww and - dim.bottom_right.y <= wh - then - ass.minimap = "" - draw_ass() - return - end - end - local center = { - x=opts.minimap_center[1]/100*ww, - y=opts.minimap_center[2]/100*wh - } - local cutoff = { - x=opts.minimap_max_size[1]/100*ww/2, - y=opts.minimap_max_size[2]/100*wh/2 - } - local a = assdraw.ass_new() - local draw = function(x, y, w, h, opacity, color) - a:new_event() - a:pos(center.x, center.y) - a:append("{\\bord0}") - a:append("{\\shad0}") - a:append("{\\c&" .. color .. "&}") - a:append("{\\2a&HFF}") - a:append("{\\3a&HFF}") - a:append("{\\4a&HFF}") - a:append("{\\1a&H" .. opacity .. "}") - w=w/2 - h=h/2 - a:draw_start() - local rounded = {true,true,true,true} -- tl, tr, br, bl - local x0,y0,x1,y1 = x-w, y-h, x+w, y+h - if x0 < -cutoff.x then - x0 = -cutoff.x - rounded[4] = false - rounded[1] = false - end - if y0 < -cutoff.y then - y0 = -cutoff.y - rounded[1] = false - rounded[2] = false - end - if x1 > cutoff.x then - x1 = cutoff.x - rounded[2] = false - rounded[3] = false - end - if y1 > cutoff.y then - y1 = cutoff.y - rounded[3] = false - rounded[4] = false - end - - local r = 3 - local c = 0.551915024494 * r - if rounded[0] then - a:move_to(x0 + r, y0) - else - a:move_to(x0,y0) - end - if rounded[1] then - a:line_to(x1 - r, y0) - a:bezier_curve(x1 - r + c, y0, x1, y0 + r - c, x1, y0 + r) - else - a:line_to(x1, y0) - end - if rounded[2] then - a:line_to(x1, y1 - r) - a:bezier_curve(x1, y1 - r + c, x1 - r + c, y1, x1 - r, y1) - else - a:line_to(x1, y1) - end - if rounded[3] then - a:line_to(x0 + r, y1) - a:bezier_curve(x0 + r - c, y1, x0, y1 - r + c, x0, y1 - r) - else - a:line_to(x0, y1) - end - if rounded[4] then - a:line_to(x0, y0 + r) - a:bezier_curve(x0, y0 + r - c, x0 + r - c, y0, x0 + r, y0) - else - a:line_to(x0, y0) - end - a:draw_stop() - end - local image = function() - draw((dim.top_left.x + dim.size.w/2 - ww/2) / opts.minimap_scale, - (dim.top_left.y + dim.size.h/2 - wh/2) / opts.minimap_scale, - dim.size.w / opts.minimap_scale, - dim.size.h / opts.minimap_scale, - opts.minimap_image_opacity, - opts.minimap_image_color) - end - local view = function() - draw(0, - 0, - ww / opts.minimap_scale, - wh / opts.minimap_scale, - opts.minimap_view_opacity, - opts.minimap_view_color) - end - if opts.minimap_view_above_image then - image() - view() - else - view() - image() - end - ass.minimap = a.text - draw_ass() -end - -local minimap_enabled = false - -function enable_minimap() - if minimap_enabled then return end - minimap_enabled = true - mp.register_idle(refresh_minimap) -end - -function disable_minimap() - if not minimap_enabled then return end - minimap_enabled = false - ass.minimap = a.text - draw_ass() - mp.unregister_idle(refresh_minimap) -end - -if opts.minimap_enabled then - enable_minimap() -end - -local ruler_state = 0 -- {0,1,2,3} = {inactive,setting first point,setting second point,done} -local ruler_first_point = nil -- in video space coordinates -local ruler_second_point = nil -- in video space coordinates - -function cursor_video_space() - local dim = get_video_dimensions() - if not dim then return nil end - local mx, my = mp.get_mouse_pos() - local ret = {} - ret.x = (mx - dim.top_left.x) / dim.ratios.w - ret.y = (my - dim.top_left.y) / dim.ratios.h - return ret -end -function video_space_to_screen(point) - local dim = get_video_dimensions() - if not dim then return nil end - local ret = {} - ret.x = point.x * dim.ratios.w + dim.top_left.x - ret.y = point.y * dim.ratios.h + dim.top_left.y - return ret -end - -function refresh_ruler() - local dim = get_video_dimensions() - if not dim then - ass.ruler = "" - draw_ass() - return - end - - local line_start = {} - local line_end = {} - if ruler_second_point then - line_start.image = ruler_first_point - line_start.screen = video_space_to_screen(ruler_first_point) - line_end.image = ruler_second_point - line_end.screen = video_space_to_screen(ruler_second_point) - elseif ruler_first_point then - line_start.image = ruler_first_point - line_start.screen = video_space_to_screen(ruler_first_point) - line_end.image = cursor_video_space() - line_end.screen = {} - line_end.screen.x, line_end.screen.y = mp.get_mouse_pos() - else - local mx, my = mp.get_mouse_pos() - line_start.image = cursor_video_space() - line_start.screen = {} - line_start.screen.x, line_start.screen.y = mp.get_mouse_pos() - line_end = line_start - end - local distinct = (math.abs(line_start.screen.x - line_end.screen.x) >= 1 - or math.abs(line_start.screen.y - line_end.screen.y) >= 1) - - local a = assdraw:ass_new() - local draw_setup = function(bord) - a:new_event() - a:pos(0,0) - a:append("{\\bord" .. bord .. "}") - a:append("{\\shad0}") - local r = opts.ruler_line_color - a:append("{\\3c&H".. r .. r .. r .. "&}") - a:append("{\\1a&HFF}") - a:append("{\\2a&HFF}") - a:append("{\\3a&H00}") - a:append("{\\4a&HFF}") - a:draw_start() - end - local dot = function(pos, size) - draw_setup(size) - a:move_to(pos.x, pos.y-0.5) - a:line_to(pos.x, pos.y+0.5) - end - local line = function(from, to, size) - draw_setup(size) - a:move_to(from.x, from.y) - a:line_to(to.x, to.y) - end - if distinct then - dot(line_start.screen, opts.ruler_dots_radius) - line(line_start.screen, line_end.screen, opts.ruler_line_width) - dot(line_end.screen, opts.ruler_dots_radius) - else - dot(line_start.screen, opts.ruler_dots_radius) - end - - local line_info = function() - if not opts.ruler_show_distance then return end - a:new_event() - a:append("{\\fs36}{\\bord1}") - a:pos((line_start.screen.x + line_end.screen.x) / 2, (line_start.screen.y + line_end.screen.y) / 2) - local an = 1 - if line_start.image.x < line_end.image.x then an = an + 2 end - if line_start.image.y < line_end.image.y then an = an + 6 end - a:an(an) - local image = math.sqrt(math.pow(line_start.image.x - line_end.image.x, 2) + math.pow(line_start.image.y - line_end.image.y, 2)) - local screen = math.sqrt(math.pow(line_start.screen.x - line_end.screen.x, 2) + math.pow(line_start.screen.y - line_end.screen.y, 2)) - if opts.ruler_coordinates_space == "both" then - a:append(string.format("image: %.1f\\Nscreen: %.1f", image, screen)) - elseif opts.ruler_coordinates_space == "image" then - a:append(string.format("%.1f", image)) - elseif opts.ruler_coordinates_space == "window" then - a:append(string.format("%.1f", screen)) - end - end - local dot_info = function(pos, opposite) - if not opts.ruler_show_coordinates then return end - a:new_event() - a:append("{\\fs" .. opts.ruler_font_size .."}{\\bord1}") - a:pos(pos.screen.x, pos.screen.y) - local an - if distinct then - an = 1 - if line_start.image.x > line_end.image.x then an = an + 2 end - if line_start.image.y < line_end.image.y then an = an + 6 end - else - an = 7 - end - if opposite then - an = 9 + 1 - an - end - a:an(an) - if opts.ruler_coordinates_space == "both" then - a:append(string.format("image: %.1f, %.1f\\Nscreen: %i, %i", - pos.image.x, pos.image.y, pos.screen.x, pos.screen.y)) - elseif opts.ruler_coordinates_space == "image" then - a:append(string.format("%.1f, %.1f", pos.image.x, pos.image.y)) - elseif opts.ruler_coordinates_space == "window" then - a:append(string.format("%i, %i", pos.screen.x, pos.screen.y)) - end - end - dot_info(line_start, true) - if distinct then - line_info() - dot_info(line_end, false) - end - if distinct and opts.ruler_show_angles ~= "no" then - local dist = 50 - local pos_from_angle = function(mult, angle) - return { - x = line_start.screen.x + mult * dist * math.cos(angle), - y = line_start.screen.y + mult * dist * math.sin(angle) - } - end - local extended = {x=line_start.screen.x, y=line_start.screen.y} - if line_end.screen.x > line_start.screen.x then - extended.x = extended.x + dist - else - extended.x = extended.x - dist - end - line(line_start.screen, extended, math.max(0, opts.ruler_line_width-0.5)) - local angle = math.atan(math.abs(line_start.image.y - line_end.image.y) / math.abs(line_start.image.x - line_end.image.x)) - local fix_angle - local an - if line_end.image.y < line_start.image.y and line_end.image.x > line_start.image.x then - -- upper-right - an = 4 - fix_angle = function(angle) return - angle end - elseif line_end.image.y < line_start.image.y then - -- upper-left - an = 6 - fix_angle = function(angle) return math.pi + angle end - elseif line_end.image.x < line_start.image.x then - -- bottom-left - an = 6 - fix_angle = function(angle) return math.pi - angle end - else - -- bottom-right - an = 4 - fix_angle = function(angle) return angle end - end - -- should implement this https://math.stackexchange.com/questions/873224/calculate-control-points-of-cubic-bezier-curve-approximating-a-part-of-a-circle - local cp1 = pos_from_angle(1, fix_angle(angle*1/4)) - local cp2 = pos_from_angle(1, fix_angle(angle*3/4)) - local p2 = pos_from_angle(1, fix_angle(angle)) - a:bezier_curve(cp1.x, cp1.y, cp2.x, cp2.y, p2.x, p2.y) - - a:new_event() - a:append("{\\fs" .. opts.ruler_font_size .."}{\\bord1}") - local text_pos = pos_from_angle(1.1, fix_angle(angle*2/3)) -- you'd think /2 would make more sense, but *2/3 looks better - a:pos(text_pos.x, text_pos.y) - a:an(an) - if opts.ruler_show_angles == "both" then - a:append(string.format("%.2f\\N%.1f°", angle, angle / math.pi * 180)) - elseif opts.ruler_show_angles == "degrees" then - a:append(string.format("%.1f°", angle / math.pi * 180)) - elseif opts.ruler_show_angles == "radians" then - a:append(string.format("%.2f", angle)) - end - end - - ass.ruler = a.text - draw_ass() -end - -function ruler_next() - if ruler_state == 0 then - mp.register_idle(refresh_ruler) - add_mouse_move_callback("ruler", function() end) -- only used to get an idle event on mouse move - for _,key in ipairs(opts.ruler_confirm_bindings) do - mp.add_forced_key_binding(key, "ruler-next-" .. key, ruler_next) - end - for _,key in ipairs(opts.ruler_exit_bindings) do - mp.add_forced_key_binding(key, "ruler-stop-" .. key, ruler_stop) - end - ruler_state = 1 - if opts.ruler_set_first_point_on_begin then - ruler_next() - end - elseif ruler_state == 1 then - ruler_first_point = cursor_video_space() - ruler_state = 2 - elseif ruler_state == 2 then - ruler_state = 3 - ruler_second_point = cursor_video_space() - if opts.ruler_clear_on_second_point_set then - ruler_next() - end - else - ruler_stop() - end -end - -function ruler_stop() - if ruler_state == 0 then return end - mp.unregister_idle(refresh_ruler) - for _,key in ipairs(opts.ruler_confirm_bindings) do - mp.remove_key_binding("ruler-next-" .. key) - end - for _,key in ipairs(opts.ruler_exit_bindings) do - mp.remove_key_binding("ruler-stop-" .. key) - end - remove_mouse_move_callback("ruler") - ruler_state = 0 - ruler_first_point = nil - ruler_second_point = nil - ass.ruler = "" - draw_ass() -end - -mp.add_key_binding(nil, "drag-to-pan", drag_to_pan_handler, {complex = true}) -mp.add_key_binding(nil, "pan-follows-cursor", pan_follows_cursor_handler, {complex = true}) -mp.add_key_binding(nil, "cursor-centric-zoom", cursor_centric_zoom_handler) -mp.add_key_binding(nil, "align-border", align_border) -mp.add_key_binding(nil, "pan-image", pan_image) -mp.add_key_binding(nil, "rotate-video", rotate_video) -mp.add_key_binding(nil, "reset-pan-if-visible", reset_pan_if_visible) -mp.add_key_binding(nil, "force-print-filename", force_print_filename) - -mp.add_key_binding(nil, "ruler", ruler_next) - -mp.add_key_binding(nil, "enable-status-line", enable_status_line) -mp.add_key_binding(nil, "disable-status-line", disable_status_line) -mp.add_key_binding(nil, "toggle-status-line", function() if status_line_enabled then disable_status_line() else enable_status_line() end end) - -mp.add_key_binding(nil, "enable-minimap", enable_minimap) -mp.add_key_binding(nil, "disable-minimap", disable_minimap) -mp.add_key_binding(nil, "toggle-minimap", function() if minimap_enabled then disable_minimap() else enable_minimap() end end) diff --git a/home/.config/nvim/README.adoc b/home/.config/nvim/README.adoc new file mode 100644 index 00000000..caabc08f --- /dev/null +++ b/home/.config/nvim/README.adoc @@ -0,0 +1,16 @@ += FunctionalHacker's NeoVim configuration + +This is my personal NeoVim configuration I use for all text editing in my free +time and at my day job. I mostly code in Java, TypeScript and ReactJS, with +a bit of Rust and Python once in a blue moon. + +The configuration is quite minimal but still fully featured. Some highlights +include + +* LSP support with neovim's built in LSP client +** LSP servers are easily installed and auto-configured with Mason +* Treesitter +** Code folding +** Code highlighting +** Text objects +* Lazy plugin manager for fast startup times diff --git a/home/.config/nvim/coc-settings.json b/home/.config/nvim/coc-settings.json deleted file mode 100644 index eddd81b5..00000000 --- a/home/.config/nvim/coc-settings.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "python.jediEnabled": false, - "suggest.noselect": false, - "suggest.echodocSupport": true, - "suggest.maxCompleteItemCount": 20, - "coc.preferences.formatOnSaveFiletypes": [], - "prettier.singleQuote": false, - "diagnostic.errorSign": "•", - "diagnostic.warningSign": "•", - "diagnostic.infoSign": "•", - "suggest.snippetIndicator": "~", - "rust-analyzer.serverPath": "/usr/bin/rust-analyzer", - "languageserver": { - "bash": { - "command": "bash-language-server", - "args": ["start"], - "filetypes": ["sh"], - "ignoredRootPaths": ["~"] - }, - "xml": { - "command": "xml-language-server", - "args": ["start"], - "filetypes": ["xml"], - "ignoredRootPaths": ["~"] - } - }, - "markdownlint.config": { - "rules": { - "default": true, - "line_length": false - } - } -} diff --git a/home/.config/nvim/conf.d/01-plugins.vim b/home/.config/nvim/conf.d/01-plugins.vim deleted file mode 100644 index 6c18ec60..00000000 --- a/home/.config/nvim/conf.d/01-plugins.vim +++ /dev/null @@ -1,96 +0,0 @@ -" Auto-install vim-plug -if empty(glob('~/.config/nvim/autoload/plug.vim')) - silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall -endif - -" Set coc extensions -let g:coc_global_extensions = [ - \ 'coc-tsserver', - \ 'coc-html', - \ 'coc-tsserver', - \ 'coc-json', - \ 'coc-yaml', - \ 'coc-texlab', - \ 'coc-prettier', - \ 'coc-python', - \ 'coc-emmet', - \ 'coc-rust-analyzer', - \ 'coc-markdownlint', - \ 'coc-snippets', - \ 'coc-java', - \ 'coc-flutter' - \ ] - -call plug#begin() - -" statusline/tabline -Plug 'vim-airline/vim-airline' - -" Make editing passwords safer -Plug 'https://git.zx2c4.com/password-store', { 'rtp': 'contrib/vim/redact_pass.vim' } - -" Colorize color words -Plug 'norcalli/nvim-colorizer.lua' - -" NeoVim in Firefox -Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } - -" Spelling -Plug 'vim-scripts/Vimchant' - -" Pandoc plugins -Plug 'vim-pandoc/vim-pandoc' -Plug 'conornewton/vim-pandoc-markdown-preview' - -" Fuzzy finder -Plug 'junegunn/fzf' -Plug 'junegunn/fzf.vim' - -" Language syntax pack -Plug 'sheerun/vim-polyglot' - -" Read editorconfig settings -Plug 'editorconfig/editorconfig-vim' - -" Make directory if it doesn't exist -Plug 'pbrisbin/vim-mkdir' - -" Tree explorer -Plug 'scrooloose/nerdtree' - -" Moar snippets -Plug 'honza/vim-snippets' - -" Filetype icons -Plug 'ryanoasis/vim-devicons' - -" Surround stuff with brackets and quotes -Plug 'tpope/vim-surround' - -" Do stuff as sudo -Plug 'lambdalisue/suda.vim' - -" Conguer of Completion -Plug 'neoclide/coc.nvim', {'do': './install.sh nightly'} - -" VimL source for CoC -Plug 'Shougo/neco-vim' -Plug 'neoclide/coc-neco' - -" Git plugin -Plug 'jreybert/vimagit' - -" Git diff in gutter -Plug 'airblade/vim-gitgutter' - -" Gpg support -Plug 'jamessan/vim-gnupg' - -" Colorscheme -Plug 'joshdick/onedark.vim' - -" Latex plugin -Plug 'lervag/vimtex' - -call plug#end() diff --git a/home/.config/nvim/conf.d/02-appearance.vim b/home/.config/nvim/conf.d/02-appearance.vim deleted file mode 100644 index 955d2a24..00000000 --- a/home/.config/nvim/conf.d/02-appearance.vim +++ /dev/null @@ -1,46 +0,0 @@ -" Set colorscheme -colorscheme onedark - -" Floating window transparency -set winblend=10 - -" Enable italics -let g:onedark_terminal_italics=1 - -" Disable built-in statusline because airline shows it -set noshowmode - -" Airline -set laststatus=2 -set encoding=utf-8 -let g:airline#extensions#tabline#enabled = 1 -let g:airline_powerline_fonts = 1 -let g:airline_section_warning = '' -let g:airline_section_error = '' -let g:airline_theme='onedark' - -" True color support -set termguicolors - -" Line numbering -set relativenumber -set number - -" Always show signcolumn -set signcolumn=yes - -" Autoindent and syntax highlight -set autoindent -set smartindent -syntax on -filetype on -filetype plugin indent on -set tabstop=4 -set shiftwidth=4 - -" Make gutter and cursorline bg transparent -highlight CursorLineNr guibg=transparent -highlight SignColumn guibg=transparent - -" Don't wrap in the middle of words -set linebreak diff --git a/home/.config/nvim/conf.d/03-keybinds.vim b/home/.config/nvim/conf.d/03-keybinds.vim deleted file mode 100644 index 3f37e03a..00000000 --- a/home/.config/nvim/conf.d/03-keybinds.vim +++ /dev/null @@ -1,39 +0,0 @@ -" Change leader to space -nnoremap -let mapleader = ' ' - -" Toggle nerdtree -map :NERDTreeToggle - -" Markdown preview -nmap MarkdownPreview -nmap MarkdownPreviewStop -nmap MarkdownPreviewToggle - -set splitbelow -set splitright - -" Move between buffers -nnoremap :bn -nnoremap :bp - -" Move between splits -nnoremap -nnoremap -nnoremap -nnoremap - -" Enable mouse -set mouse=a - -" Toggle equalalways -function ToggleEqual () - :set equalalways! - :set equalalways! -endfunction - -nnoremap = :call ToggleEqual() - -" Navigate display lines insted of physical lines -nnoremap j gj -nnoremap k gk diff --git a/home/.config/nvim/conf.d/04-coc.vim b/home/.config/nvim/conf.d/04-coc.vim deleted file mode 100644 index a0424537..00000000 --- a/home/.config/nvim/conf.d/04-coc.vim +++ /dev/null @@ -1,129 +0,0 @@ -" Enable symbol highlight -autocmd CursorHold * silent call CocActionAsync('highlight') - -" If hidden is not set, TextEdit might fail. -set hidden - -" Some servers have issues with backup files, see #649 -set nobackup -set nowritebackup - -" Better display for messages -set cmdheight=2 - -" Smaller updatetime for CursorHold & CursorHoldI -set updatetime=300 - -" Don't give |ins-completion-menu| messages. -set shortmess+=c - -" Use tab for trigger completion with characters ahead and navigate. -" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to confirm snippet -inoremap pumvisible() ? coc#_select_confirm() : - \"\u\\=coc#on_enter()\" - -" Use to trigger completion. -inoremap coc#refresh() - -" Use to confirm completion, `u` means break undo chain at current position. -" Coc only does snippet and additional edit on confirm. -inoremap pumvisible() ? "\" : "\u\" - -" Use `[c` and `]c` to navigate diagnostics -nmap [c (coc-diagnostic-prev) -nmap ]c (coc-diagnostic-next) - -" Remap keys for gotos -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K to show documentation in preview window -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -" Highlight symbol under cursor on CursorHold -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Remap for rename current word -nmap rn (coc-rename) - -" Remap for format selected region -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s). - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Remap for do codeAction of selected region, ex: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap for do codeAction of current line -nmap ac (coc-codeaction) -" Fix autofix problem of current line -nmap qf (coc-fix-current) - -" Use `:Format` to format current buffer -command! -nargs=0 Format :call CocAction('format') - -" Use `:Fold` to fold current buffer -command! -nargs=? Fold :call CocAction('fold', ) - - -" Add diagnostic info for https://github.com/itchyny/lightline.vim -let g:lightline = { - \ 'colorscheme': 'wombat', - \ 'active': { - \ 'left': [ [ 'mode', 'paste' ], - \ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ] - \ }, - \ 'component_function': { - \ 'cocstatus': 'coc#status' - \ }, - \ } - - - -" Using CocList -" Show all diagnostics -nnoremap a :CocList diagnostics -" Manage extensions -nnoremap e :CocList extensions -" Show commands -nnoremap c :CocList commands -" Find symbol of current document -nnoremap o :CocList outline -" Search workspace symbols -nnoremap s :CocList -I symbols -" Do default action for next item. -nnoremap j :CocNext -" Do default action for previous item. -nnoremap k :CocPrev -" Resume latest coc list -nnoremap p :CocListResume diff --git a/home/.config/nvim/conf.d/05-language.vim b/home/.config/nvim/conf.d/05-language.vim deleted file mode 100644 index e5e7cb5e..00000000 --- a/home/.config/nvim/conf.d/05-language.vim +++ /dev/null @@ -1,12 +0,0 @@ -" LaTex settings -let g:vimtex_view_method='zathura' -let g:Tex_DefaultTargetFormat='pdf' -let g:Tex_MultipleCompileFormats='pdf, aux' -let g:vimtex_compiler_progname='nvr' - -" YAML settings -au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent -autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab - -" Run rustfmt on save -let g:rustfmt_autosave = 1 diff --git a/home/.config/nvim/conf.d/06-misc.vim b/home/.config/nvim/conf.d/06-misc.vim deleted file mode 100644 index 1315f116..00000000 --- a/home/.config/nvim/conf.d/06-misc.vim +++ /dev/null @@ -1,41 +0,0 @@ -" Enable python support -let g:python3_host_prog='/usr/bin/python3' -let pyxversion=3 - -" LaTex fallback flavor -let g:tex_flavor = 'latex' - -" Use suda by default -let g:suda_smart_edit = 1 - -" Remap exit terminal mode to esc -au TermOpen * tnoremap - -" Use system clipboard -set clipboard=unnamedplus - -" Remove extra line -set cmdheight=1 - -" Disable auto commenting -set formatoptions-=cro - -" Set pandoc preview program -let g:pandoc_preview_pdf_cmd = "zathura" - -" Case insensitive search -set ignorecase -set smartcase - -" Nerdtree settings -let NERDTreeMinimalUI = 1 "remove press ? for help" -let NERDTreeAutoDeleteBuffer = 1 " delete buffer when file is deleted -let NERDTreeQuitOnOpen = 1 " close nerdtree when opening file -let NERDTreeDirArrows = 1 - -" Firenvim filetypes -au BufEnter github.com_*.txt set filetype=markdown -au BufEnter gitlab.com_*.txt set filetype=markdown -au BufEnter git.reekynet.com_*.txt set filetype=markdown -au BufEnter www.reddit.com_*.txt set filetype=markdown -au BufEnter node.reekynet.com_*.txt set filetype=json diff --git a/home/.config/nvim/conf.d/07-fzf.vim b/home/.config/nvim/conf.d/07-fzf.vim deleted file mode 100644 index 60be3f2e..00000000 --- a/home/.config/nvim/conf.d/07-fzf.vim +++ /dev/null @@ -1,43 +0,0 @@ -" FZF in floating window - -autocmd! FileType fzf -autocmd FileType fzf call SetFZFoptions() -function SetFZFoptions() - set noshowmode noruler nonumber norelativenumber - tunmap -endfunction - -let g:fzf_layout = { 'window': 'call FloatingFZF()' } -function! FloatingFZF() - let buf = nvim_create_buf(v:false, v:true) - call setbufvar(buf, '&signcolumn', 'no') - - let width = float2nr(&columns * 0.8) - let height = float2nr(&lines * 0.6) - let horizontal = 1 - let vertical = 1 - - let opts = { - \ 'relative': 'editor', - \ 'row': (&lines - height) / 2, - \ 'col': (&columns - width) / 2, - \ 'width': width, - \ 'height': height, - \ 'style': 'minimal' - \ } - - call nvim_open_win(buf, v:true, opts) -endfunction - -" Looks -"let $FZF_DEFAULT_OPTS=' --color=dark --color=fg:15,bg:-1,hl:1,fg+:#ffffff,bg+:0,hl+:1 --color=info:0,prompt:0,pointer:12,marker:4,spinner:11,header:-1 --layout=reverse --margin=1,4' - -" ripgrep custom settings -command! -bang -nargs=* Rg - \ call fzf#vim#grep('rg --column --line-number --no-heading --color=always --smart-case ' - \ . (len() > 0 ? : '""'), 0, - \ fzf#vim#with_preview({'options': ['--delimiter=:', '--nth=2..', '--layout=reverse', '--info=inline']}), 0) - -" Keybinds -nmap :Files -nmap :Rg diff --git a/home/.config/nvim/ftplugin/java.lua b/home/.config/nvim/ftplugin/java.lua new file mode 100644 index 00000000..58e0b620 --- /dev/null +++ b/home/.config/nvim/ftplugin/java.lua @@ -0,0 +1,111 @@ +local nvim_local_dir = vim.fn.expand("~/.local/share/nvim") +local mason_packages = nvim_local_dir .. "/mason/packages" +local lombok_jar = mason_packages .. "/jdtls/lombok.jar" +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") +local workspace_dir = nvim_local_dir .. "/jdtls-workspaces/" .. project_name +local lsp_utils = require("lsp_utils") +local jvm = "/usr/lib/jvm" +local java_version = 21 + +require("jdtls").start_or_attach({ + cmd = { + jvm .. "/java-" .. java_version .. "-openjdk-amd64/bin/java", + "-Declipse.application=org.eclipse.jdt.ls.core.id1", + "-Dosgi.bundles.defaultStartLevel=4", + "-Declipse.product=org.eclipse.jdt.ls.core.product", + "-Dlog.protocol=true", + "-Dlog.level=ALL", + "-Xms1g", + "--add-modules=ALL-SYSTEM", + "--add-opens", + "java.base/java.util=ALL-UNNAMED", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + "-javaagent:" .. lombok_jar, + "-jar", + vim.fn.glob(mason_packages .. "/jdtls/plugins/org.eclipse.equinox.launcher_*.jar"), + "-configuration", + nvim_local_dir .. "/mason/packages/jdtls/config_linux", + "-data", + workspace_dir, + }, + settings = { + java = { + signatureHelp = { enabled = true }, + autobuild = { enabled = false }, + configuration = { + runtimes = { + { + name = "JavaSE-1.8", + path = jvm .. "/java-8-openjdk-amd64/", + }, + { + name = "JavaSE-11", + path = jvm .. "/java-11-openjdk-amd64/", + }, + { + name = "JavaSE-17", + path = jvm .. "/java-17-openjdk-amd64/", + }, + { + name = "JavaSE-21", + path = jvm .. "/java-21-openjdk-amd64/", + }, + }, + }, + }, + }, + completion = { favoriteStaticMembers = { "java.text.MessageFormat.format" } }, + handlers = { + ["language/status"] = function() end, + }, + init_options = { + bundles = { + vim.fn.glob(mason_packages .. "/java-debug-adapter/extension/server/com.microsoft.java.debug.plugin-*.jar"), + }, + }, + capabilities = lsp_utils.get_capabilities(), + on_attach = lsp_utils.map_keys, +}) + +function RunJava() + local function show_output(output) + vim.cmd("split") + vim.cmd("enew") + vim.fn.append(0, output) + --vim.cmd("1d") -- Remove the empty first line + vim.bo[0].modifiable = false + end + + local filename = vim.fn.expand("%") -- Get the current file name + local class_name = vim.fn.fnamemodify(filename, ":r") -- Extract the class name + local compile_cmd = "javac " .. filename + local run_cmd = "java " .. class_name + + -- Create a temporary file to capture the compile output + local temp_file = vim.fn.tempname() + + -- Run the compilation command and save the output to the temporary file + local compile_exit_code = vim.fn.system(compile_cmd .. " > " .. temp_file .. " 2>&1") + + -- Check the exit code of the compile command + if compile_exit_code == 0 then + -- Compilation was successful, run the Java program + show_output(vim.fn.systemlist(run_cmd)) + else + -- Compilation failed, display the error output from the temporary file + show_output(vim.fn.readfile(temp_file)) + end + + -- Clean up the temporary file and class file + vim.fn.delete(temp_file) + vim.fn.delete(vim.fn.expand("%:p:h") .. "/" .. class_name .. ".class") +end + +-- Define a VimScript command to execute the Lua function +vim.api.nvim_exec( + [[ + command! RunJava lua RunJava() +]], + false +) diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua new file mode 100644 index 00000000..a23743b8 --- /dev/null +++ b/home/.config/nvim/init.lua @@ -0,0 +1,28 @@ +-- Install lazy if it's not yet installed +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("settings") +require("keybinds") +require("neovide") +require("highlight_yank") +require("lazy").setup({ + spec = { import = "plugins" }, + lockfile = "~/git/dotfiles/home/.config/nvim/lazy-lock.json", + performance = { + disabled_plugins = { "netrwPlugin" }, + }, + defaults = { + -- version = "*", -- Disabled for now + }, +}) diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim deleted file mode 100644 index 6d4602ff..00000000 --- a/home/.config/nvim/init.vim +++ /dev/null @@ -1,3 +0,0 @@ -for f in split(glob('~/.config/nvim/conf.d/*.vim'), '\n') - exe 'source' f -endfor diff --git a/home/.config/nvim/lazy-lock.json b/home/.config/nvim/lazy-lock.json new file mode 100644 index 00000000..1ebcf4b2 --- /dev/null +++ b/home/.config/nvim/lazy-lock.json @@ -0,0 +1,70 @@ +{ + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, + "auto-dark-mode.nvim": { "branch": "master", "commit": "c31de126963ffe9403901b4b0990dde0e6999cc6" }, + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "cder.nvim": { "branch": "main", "commit": "0a071389bb52544ac9cf9557378aa1212dff6982" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-git": { "branch": "main", "commit": "d9efd00e0b9527ee05031ce7e7e55d6b118f543e" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "confirm-quit.nvim": { "branch": "main", "commit": "f15f6d728d385a3d2efa22098e9a45b8a2b20144" }, + "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, + "copilot.lua": { "branch": "master", "commit": "535ebb53880ae67e33d9e50b503d25f9ef3ca06c" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dropbar.nvim": { "branch": "master", "commit": "873ba43f83398fd0e28880cf98fd89e6ce667c51" }, + "firenvim": { "branch": "master", "commit": "c4ab7d2aeb145cd93db8660cb134f771722f2b5e" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "fugitive-gitea": { "branch": "master", "commit": "d93176028d13820f941c165c14039a6019744a5a" }, + "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "kanagawa.nvim": { "branch": "master", "commit": "709018d5af92d2e5780bfb8a6d36e9cad01a6402" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-extra-cmds": { "branch": "main", "commit": "cc7163cb5089236042b5e351cb1a078d0905e40d" }, + "mason-lock.nvim": { "branch": "main", "commit": "86614f76c3442fba1c5c8d79aa1efcb3ad69de1c" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "mini.nvim": { "branch": "main", "commit": "189010888bc37fc1c382f2dcc81b7a6441160686" }, + "neoformat": { "branch": "master", "commit": "874dcd0995db340278c41860e0209bef29d6ef87" }, + "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, + "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, + "nvim-asciidoc-preview": { "branch": "main", "commit": "b12e113b5f7e7522b4e412213d5498cc529f2628" }, + "nvim-autopairs": { "branch": "master", "commit": "6522027785b305269fa17088395dfc0f456cedd2" }, + "nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-dap": { "branch": "master", "commit": "6a5bba0ddea5d419a783e170c20988046376090d" }, + "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, + "nvim-jdtls": { "branch": "master", "commit": "2f7bff9b8d2ee1918b36ca55f19547d9d335a268" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" }, + "nvim-lspconfig": { "branch": "master", "commit": "85e0dd26b710e834a105d679200d01e326a3d2b0" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, + "nvim-tree.lua": { "branch": "master", "commit": "44d9b58f11d5a426c297aafd0be1c9d45617a849" }, + "nvim-treesitter": { "branch": "master", "commit": "da5825bf70cc2ea7eacd1e60c32c07baf19adeba" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-ufo": { "branch": "main", "commit": "a52c92c3bbaa10f0c9b547a50adaa8c7d8b29f94" }, + "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, + "password-store": { "branch": "master", "commit": "b5e965a838bb68c1227caa2cdd874ba496f10149" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, + "schemastore.nvim": { "branch": "main", "commit": "d307d291f38678d064cb987112926df6d9134de3" }, + "statuscol.nvim": { "branch": "main", "commit": "c399884e8f64019ec9bb581251f9710915b7f996" }, + "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-project.nvim": { "branch": "master", "commit": "ce2c9fe209a68c7a924acde42d94ed8a2b2a52c5" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, + "vim-asciidoctor": { "branch": "master", "commit": "f553311b5db03440eb8d7035434d0405e4a2c559" }, + "vim-caddyfile": { "branch": "master", "commit": "24fe0720551883e407cb70ae1d7c03f162d1d5a0" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/home/.config/nvim/lua/highlight_yank.lua b/home/.config/nvim/lua/highlight_yank.lua new file mode 100644 index 00000000..649506bb --- /dev/null +++ b/home/.config/nvim/lua/highlight_yank.lua @@ -0,0 +1,12 @@ +-- Highlight yanked text + +local ag = vim.api.nvim_create_augroup +local au = vim.api.nvim_create_autocmd + +au('TextYankPost', { + group = ag('yank_highlight', {}), + pattern = '*', + callback = function() + vim.highlight.on_yank { higroup='IncSearch', timeout=300 } + end, +}) diff --git a/home/.config/nvim/lua/keybinds.lua b/home/.config/nvim/lua/keybinds.lua new file mode 100644 index 00000000..6676d121 --- /dev/null +++ b/home/.config/nvim/lua/keybinds.lua @@ -0,0 +1,15 @@ +vim.keymap.set("n", "b", function() + local current_theme = vim.fn.eval("&background") + if current_theme == "dark" then + vim.cmd("set background=light") + else + vim.cmd("set background=dark") + end +end, { desc = "Toggle background between dark and light" }) + +vim.keymap.set("n", "h", "nohlsearch", { desc = "Turn off search highlight" }) +vim.keymap.set("n", "co", 'silent! execute "%bd|e#|bd#"', { desc = "Close other buffers" }) +vim.keymap.set("n", "a", "e#", { desc = "Edit alternate file" }) +vim.keymap.set("n", "", "bnext", { desc = "Next buffer" }) +vim.keymap.set("n", "", "bprevious", { desc = "Previous buffer" }) +vim.keymap.set("t", "", "", { desc = "Exit terminal insert mode with esc" }) diff --git a/home/.config/nvim/lua/lsp_utils.lua b/home/.config/nvim/lua/lsp_utils.lua new file mode 100644 index 00000000..8851c307 --- /dev/null +++ b/home/.config/nvim/lua/lsp_utils.lua @@ -0,0 +1,56 @@ +-- This module contains lsp related +-- reusable functions +local m = {} + +local lsp = vim.lsp +local diagnostic = vim.diagnostic +local k = vim.keymap.set + +-- Maps LSP specific keybinds. +-- This makes them only available when LSP is running +function m.map_keys() + local builtin = require("telescope.builtin") + + require("which-key").add({ + { "w", group = "Workspace" }, + }) + + k("n", "F", lsp.buf.format, { desc = "Format with LSP" }) + k("n", "ca", lsp.buf.code_action, { desc = "Code action" }) + k("n", "e", diagnostic.open_float, { desc = "Open diagnostics" }) + k("n", "k", lsp.buf.signature_help, { desc = "Signature help" }) + k("n", "rn", lsp.buf.rename, { desc = "Rename symbol" }) + k("n", "wa", lsp.buf.add_workspace_folder, { desc = "Add folder" }) + k("n", "wl", function() + print(vim.inspect(lsp.buf.list_workspace_folders())) + end, { desc = "List folders" }) + k("n", "wr", lsp.buf.remove_workspace_folder, { desc = "Remove folder" }) + k("n", "K", lsp.buf.hover, { desc = "Hover" }) + k("n", "[d", diagnostic.goto_prev, { desc = "Previous diagnostic" }) + k("n", "]d", diagnostic.goto_next, { desc = "Next diagnostic" }) + k("n", "gD", lsp.buf.declaration, { desc = "Declaration" }) + k("n", "gd", builtin.lsp_definitions, { desc = "Definition" }) + k("n", "gi", builtin.lsp_implementations, { desc = "Implementation" }) + k("n", "gr", builtin.lsp_references, { desc = "References" }) + k("n", "gs", builtin.lsp_document_symbols, { desc = "Symbols" }) + k("n", "gt", lsp.buf.type_definition, { desc = "Type definition" }) +end + +-- Combine built-in LSP and cmp cabaibilities +-- and additional capabilities from other plugins +function m.get_capabilities() + local capabilities = vim.tbl_deep_extend( + "force", + lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities() + ) + + -- Neovim hasn't added foldingRange to default capabilities, users must add it manually for ufo + capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, + } + return capabilities +end + +return m diff --git a/home/.config/nvim/lua/neovide.lua b/home/.config/nvim/lua/neovide.lua new file mode 100644 index 00000000..e0037efb --- /dev/null +++ b/home/.config/nvim/lua/neovide.lua @@ -0,0 +1,29 @@ +local g = vim.g +local o = vim.o + +-- Change scale factor with C+ and C- +g.neovide_scale_factor = {{@@ scale_factor|default(1.0) @@}} +local change_scale_factor = function(delta) + g.neovide_scale_factor = g.neovide_scale_factor * delta +end +vim.keymap.set("n", "", function() + change_scale_factor(1.25) +end) +vim.keymap.set("n", "", function() + change_scale_factor(1 / 1.25) +end) + +-- Hide mouse when typing in neovide (disabled) +g.neovide_hide_mouse_when_typing = false + +-- Enable cursor particles in neovide +g.neovide_cursor_vfx_mode = "railgun" + +-- Enable dark/light theme detection +g.neovide_theme = "auto" + +-- Confirm quit +g.neovide_confirm_quit = true + +-- Set font +--o.guifont = "Hack Nerd Font Mono:h15" diff --git a/home/.config/nvim/lua/pager.lua b/home/.config/nvim/lua/pager.lua new file mode 100644 index 00000000..aea0b8d7 --- /dev/null +++ b/home/.config/nvim/lua/pager.lua @@ -0,0 +1,2 @@ +-- Settings for pager mode +vim.keymap.set("n", "q", vim.cmd.q) diff --git a/home/.config/nvim/lua/plugins/alpha.lua b/home/.config/nvim/lua/plugins/alpha.lua new file mode 100644 index 00000000..792ea76d --- /dev/null +++ b/home/.config/nvim/lua/plugins/alpha.lua @@ -0,0 +1,39 @@ +-- Startup dashboard +--- @type LazyPluginSpec +return { + "goolord/alpha-nvim", + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") + dashboard.section.header.val = { + [[ __ ]], + [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], + [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], + [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], + [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], + [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], + } + dashboard.section.buttons.val = { + dashboard.button( + "p", + "📽 Open a project", + ":lua require('telescope').extensions.project.project()" + ), + dashboard.button("e", " New file", ":ene startinsert "), + dashboard.button("", "🔍 Find file", "Telescope find_files"), + dashboard.button("", "𑪢 Grep files", "Telescope live_grep"), + dashboard.button("l", "🛋 Lazy", ":Lazy"), + dashboard.button("m", "📦 Mason", ":Mason"), + dashboard.button("q", "ꭙ Quit NeoVim", ":qa"), + } + + -- Fortune in footer + dashboard.section.footer.val = require("alpha.fortune")() + + dashboard.config.opts.noautocmd = true + + vim.cmd([[autocmd User AlphaReady echo 'ready']]) + + alpha.setup(dashboard.config) + end, +} diff --git a/home/.config/nvim/lua/plugins/asciidoc.lua b/home/.config/nvim/lua/plugins/asciidoc.lua new file mode 100644 index 00000000..d723b3fc --- /dev/null +++ b/home/.config/nvim/lua/plugins/asciidoc.lua @@ -0,0 +1,15 @@ +-- AsciiDoc plugins are grouped together here +return { + -- Vim ♥️ Asciidoctor + --- @type LazyPluginSpec + { + "habamax/vim-asciidoctor", + ft = { "asciidoctor", "asciidoc" }, + }, + -- AsciiDoc preview + --- @type LazyPluginSpec + { + "tigion/nvim-asciidoc-preview", + ft = { "asciidoctor", "asciidoc" }, + }, +} diff --git a/home/.config/nvim/lua/plugins/autopairs.lua b/home/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 00000000..cde6d85c --- /dev/null +++ b/home/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,6 @@ +-- Automatic brackets +--- @type LazyPluginSpec +return { + "windwp/nvim-autopairs", + config = true +} diff --git a/home/.config/nvim/lua/plugins/bufferline.lua b/home/.config/nvim/lua/plugins/bufferline.lua new file mode 100644 index 00000000..e4c85983 --- /dev/null +++ b/home/.config/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,16 @@ +-- Bufferline +--- @type LazyPluginSpec +return { + "akinsho/bufferline.nvim", + dependencies = { "kyazdani42/nvim-web-devicons" }, + --- @type BufferlineConfig + opts = { + options = { + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level) + local icon = level:match("error") and " " or " " + return " " .. icon .. count + end, + }, + }, +} diff --git a/home/.config/nvim/lua/plugins/caddyfile.lua b/home/.config/nvim/lua/plugins/caddyfile.lua new file mode 100644 index 00000000..ec4c5273 --- /dev/null +++ b/home/.config/nvim/lua/plugins/caddyfile.lua @@ -0,0 +1,6 @@ +-- Caddyfile syntax support +--- @type LazyPluginSpec +return { + "isobit/vim-caddyfile", + ft = "caddyfile", +} diff --git a/home/.config/nvim/lua/plugins/cmp.lua b/home/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 00000000..9f6537d5 --- /dev/null +++ b/home/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,150 @@ +-- Auto completion +--- @type LazyPluginSpec +return { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-buffer", -- Buffer source + -- Git source + { + "petertriho/cmp-git", + dependencies = { "nvim-lua/plenary.nvim" }, + config = true, + }, + "hrsh7th/cmp-nvim-lsp", -- LSP source + "hrsh7th/cmp-nvim-lua", -- Neovim Lua API documentation source + "hrsh7th/cmp-path", -- Path source + "hrsh7th/cmp-cmdline", -- cmdline source + "saadparwaiz1/cmp_luasnip", -- Snippets source + "f3fora/cmp-spell", -- Spell check source + "petertriho/cmp-git", -- Git source + -- Copilot source + { + "zbirenbaum/copilot-cmp", + opts = { fix_pairs = true }, + }, + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + -- Set completeopt to have a better completion experience + vim.o.completeopt = "menuone,noselect" + + local bordered = cmp.config.window.bordered() + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + window = { + completion = bordered, + documentation = bordered, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + -- Snippet placeholder forward + [""] = cmp.mapping(function(fallback) + if luasnip.jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, { "i", "s" }), + -- Snippet placeholder backward + [""] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + -- Completion menu forward + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + -- If only one entry, select it + if #cmp.get_entries() == 1 then + cmp.confirm({ select = true }) + else + cmp.select_next_item() + end + elseif has_words_before() then + cmp.complete() + if #cmp.get_entries() == 1 then + cmp.confirm({ select = true }) + end + else + fallback() + end + end, { "i", "s" }), + -- Completion menu backward + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i", "s" }), + }, + sources = { + { name = "luasnip" }, + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "git" }, + { name = "copilot" }, + { name = "buffer" }, + { name = "spell" }, + { name = "path" }, + { + name = "lazydev", + group_index = 0, -- set group index to 0 to skip loading LuaLS completions + }, + }, + }) + + require("cmp_git").setup() + + -- Enable autopairs when enter is processed + -- on completion + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + + -- search cmdline setup. + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + -- `:` cmdline setup. + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { + name = "cmdline", + option = { + ignore_cmds = { "Man", "!" }, + }, + }, + }), + }) + end, +} diff --git a/home/.config/nvim/lua/plugins/confirm-quit.lua b/home/.config/nvim/lua/plugins/confirm-quit.lua new file mode 100644 index 00000000..f140e7af --- /dev/null +++ b/home/.config/nvim/lua/plugins/confirm-quit.lua @@ -0,0 +1,10 @@ +-- Confirm before quit +--- @type LazyPluginSpec +return { + cond = vim.g.neovide == not nil, + "yutkat/confirm-quit.nvim", + event = "CmdlineEnter", + opts = { + quit_message = "You are in Neovide, are you sure you want to quit?", + }, +} diff --git a/home/.config/nvim/lua/plugins/diffview.lua b/home/.config/nvim/lua/plugins/diffview.lua new file mode 100644 index 00000000..aa17c163 --- /dev/null +++ b/home/.config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,3 @@ +-- Improved diffs +--- @type LazyPluginSpec +return { "sindrets/diffview.nvim" } diff --git a/home/.config/nvim/lua/plugins/dropbar.lua b/home/.config/nvim/lua/plugins/dropbar.lua new file mode 100644 index 00000000..30ef6fff --- /dev/null +++ b/home/.config/nvim/lua/plugins/dropbar.lua @@ -0,0 +1,6 @@ +-- Show the current LSP context in winbar +--- @type LazyPluginSpec +return { + enabled = vim.fn.has("nvim-0.10") == 1, + "Bekaboo/dropbar.nvim", +} diff --git a/home/.config/nvim/lua/plugins/firenvim.lua b/home/.config/nvim/lua/plugins/firenvim.lua new file mode 100644 index 00000000..dba55753 --- /dev/null +++ b/home/.config/nvim/lua/plugins/firenvim.lua @@ -0,0 +1,17 @@ +-- Neovim inside Firefox +--- @type LazyPluginSpec +return { + "glacambre/firenvim", + build = function() + vim.fn["firenvim#install"](0) + end, + config = function() + vim.g.firenvim_config = { + localSettings = { + [".*"] = { + takeOver = "never", + }, + }, + } + end, +} diff --git a/home/.config/nvim/lua/plugins/fugitive.lua b/home/.config/nvim/lua/plugins/fugitive.lua new file mode 100644 index 00000000..a8086c6c --- /dev/null +++ b/home/.config/nvim/lua/plugins/fugitive.lua @@ -0,0 +1,37 @@ +local k = vim.keymap.set + +-- Git commands +--- @type LazyPluginSpec +return { + "tpope/vim-fugitive", + dependencies = { "borissov/fugitive-gitea" }, + config = function() + vim.g.fugitive_gitea_domains = { + "https://git.korhonen.cc", + "https://git.rossum.fi", + } + + -- Keybinds + k("n", "gs", function() + vim.cmd("Git status") + end, { desc = "Status" }) + + k("n", "gaa", function() + vim.cmd("Git add -A") + end, { desc = "All" }) + + k("n", "gc", function() + vim.cmd("Git commit") + end, { desc = "Commit" }) + + k("n", "gu", function() + vim.cmd("Git push") + end, { desc = "Push" }) + + k("n", "gd", function() + vim.cmd("Git pull") + end, { desc = "Pull" }) + + k({ "n", "x" }, "gb", "'<,'>GBrowse", { desc = "Open in browser" }) + end, +} diff --git a/home/.config/nvim/lua/plugins/gitsigns.lua b/home/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 00000000..4cec2e48 --- /dev/null +++ b/home/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,34 @@ +local k = vim.keymap.set + +--- @type LazyPluginSpec +return { + "lewis6991/gitsigns.nvim", + config = function() + local gs = require("gitsigns") + gs.setup() + + -- Keybinds + local opts + + -- Add groups for which-key + require("which-key").add({ + { "g", group = "Git" }, + { "gr", group = "Reset" }, + { "ga", group = "Add" }, + }) + + -- Hunk navigation + k("n", "[h", gs.prev_hunk, { desc = "Previous hunk" }) + k("n", "]h", gs.next_hunk, { desc = "Next hunk" }) + + -- Hunk actions + opts = { desc = "Hunk" } + k("n", "grh", gs.reset_hunk, opts) + k("n", "gah", gs.stage_hunk, opts) + + -- Buffer actions + opts = { desc = "Buffer" } + k("n", "gab", gs.stage_buffer, opts) + k("n", "grb", gs.reset_buffer, opts) + end, +} diff --git a/home/.config/nvim/lua/plugins/gnupg.lua b/home/.config/nvim/lua/plugins/gnupg.lua new file mode 100644 index 00000000..4da3d9d8 --- /dev/null +++ b/home/.config/nvim/lua/plugins/gnupg.lua @@ -0,0 +1,6 @@ +-- Edit GPG encrypted files transparently +--- @type LazyPluginSpec +return { + "jamessan/vim-gnupg", + ft = { "gpg" }, +} diff --git a/home/.config/nvim/lua/plugins/indent-blankline.lua b/home/.config/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 00000000..8ddab8c7 --- /dev/null +++ b/home/.config/nvim/lua/plugins/indent-blankline.lua @@ -0,0 +1,24 @@ +-- Indent characters +--- @type LazyPluginSpec +return { + "lukas-reineke/indent-blankline.nvim", + --- @type ibl.config + opts = { + exclude = { + filetypes = { + "", + "checkhealth", + "alpha", + "git", + "gitcommit", + "TelescopePrompt", + "TelescopeResults", + "help", + "lazy", + "lspinfo", + "man", + }, + }, + }, + main = "ibl", +} diff --git a/home/.config/nvim/lua/plugins/kanagawa.lua b/home/.config/nvim/lua/plugins/kanagawa.lua new file mode 100644 index 00000000..3cd3beac --- /dev/null +++ b/home/.config/nvim/lua/plugins/kanagawa.lua @@ -0,0 +1,56 @@ +-- Colorscheme +--- @type LazyPluginSpec +return { + "rebelot/kanagawa.nvim", + dependencies = { { "f-person/auto-dark-mode.nvim", config = true } }, + --- @type KanagawaConfig + opts = { + compile = true, + dimInactive = true, + colors = { + theme = { + all = { + ui = { + bg_gutter = "none", -- Hide gutter background + }, + }, + }, + }, + background = { + dark = "wave", + light = "lotus", + }, + overrides = function(colors) + local theme = colors.theme + return { + -- Transparent floating windows + NormalFloat = { bg = "none" }, + FloatBorder = { bg = "none" }, + FloatTitle = { bg = "none" }, + NormalDark = { fg = theme.ui.fg_dim, bg = theme.ui.bg_m3 }, + LazyNormal = { bg = theme.ui.bg_m3, fg = theme.ui.fg_dim }, + MasonNormal = { bg = theme.ui.bg_m3, fg = theme.ui.fg_dim }, + + -- Block-like modern Telescope UI + TelescopeTitle = { fg = theme.ui.special, bold = true }, + TelescopePromptNormal = { bg = theme.ui.bg_p1 }, + TelescopePromptBorder = { fg = theme.ui.bg_p1, bg = theme.ui.bg_p1 }, + TelescopeResultsNormal = { fg = theme.ui.fg_dim, bg = theme.ui.bg_m1 }, + TelescopeResultsBorder = { fg = theme.ui.bg_m1, bg = theme.ui.bg_m1 }, + TelescopePreviewNormal = { bg = theme.ui.bg_dim }, + TelescopePreviewBorder = { bg = theme.ui.bg_dim, fg = theme.ui.bg_dim }, + + -- More uniform look for the popup menu + Pmenu = { fg = theme.ui.shade0, bg = theme.ui.bg_p1, blend = vim.o.pumblend }, + PmenuSel = { fg = "NONE", bg = theme.ui.bg_p2 }, + PmenuSbar = { bg = theme.ui.bg_m1 }, + PmenuThumb = { bg = theme.ui.bg_p2 }, + } + end, + }, + --- @param opts KanagawaConfig + config = function(_, opts) + require("kanagawa").setup(opts) + vim.cmd("colorscheme kanagawa") + end, +} diff --git a/home/.config/nvim/lua/plugins/lazydev.lua b/home/.config/nvim/lua/plugins/lazydev.lua new file mode 100644 index 00000000..4e9b1b54 --- /dev/null +++ b/home/.config/nvim/lua/plugins/lazydev.lua @@ -0,0 +1,15 @@ +-- Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API. +--- @type LazyPluginSpec +return { + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "luvit-meta/library", words = { "vim%.uv" } }, + }, + }, + }, +} diff --git a/home/.config/nvim/lua/plugins/lualine.lua b/home/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 00000000..1aaba3e7 --- /dev/null +++ b/home/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,38 @@ +local noice_mode = require("noice").api.statusline.mode +-- Statusline +--- @type LazyPluginSpec +return { + "nvim-lualine/lualine.nvim", + dependencies = { "kyazdani42/nvim-web-devicons" }, + opts = { + sections = { + lualine_x = { + "encoding", + "fileformat", + "filetype", + { + noice_mode.get, + cond = noice_mode.has, + color = { fg = "#ff9e64" }, + }, + }, + lualine_z = { + { + "selectioncount", + cond = function() + local mode = vim.fn.mode() + return mode == "v" or mode == "V" or mode == "\22" + end, + }, + { + "location", + cond = function() + local mode = vim.fn.mode() + return mode ~= "v" and mode ~= "V" and mode ~= "\22" + end, + }, + }, + }, + }, + config = true, +} diff --git a/home/.config/nvim/lua/plugins/luasnip.lua b/home/.config/nvim/lua/plugins/luasnip.lua new file mode 100644 index 00000000..1364a570 --- /dev/null +++ b/home/.config/nvim/lua/plugins/luasnip.lua @@ -0,0 +1,19 @@ +-- Snippets plugin +--- @type LazyPluginSpec +return { + "L3MON4D3/LuaSnip", + -- Snippets collection + dependencies = { "rafamadriz/friendly-snippets" }, + config = function() + local vsCodeLoader = require("luasnip/loaders/from_vscode") + + -- Load friendly-snippets + vsCodeLoader.lazy_load() + + -- Load my custom snippets + vsCodeLoader.lazy_load({ + paths = { "./snippets" }, + }) + end, + run = "make install_jsregexp", +} diff --git a/home/.config/nvim/lua/plugins/markdown-preview.lua b/home/.config/nvim/lua/plugins/markdown-preview.lua new file mode 100644 index 00000000..731496ab --- /dev/null +++ b/home/.config/nvim/lua/plugins/markdown-preview.lua @@ -0,0 +1,10 @@ +-- Markdown preview +--- @type LazyPluginSpec +return { + "iamcco/markdown-preview.nvim", + build = "cd app && yarn install", + config = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, +} diff --git a/home/.config/nvim/lua/plugins/mason.lua b/home/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 00000000..ad4afb42 --- /dev/null +++ b/home/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,75 @@ +-- Package manager for LSP servers, DAP adapters etc. +-- It also handles starting all of my LSP servers +--- @type LazyPluginSpec +return { + "mason-org/mason.nvim", + version = "^1.0.0", + dependencies = { + "neovim/nvim-lspconfig", + { "mason-org/mason-lspconfig.nvim", version = "^1.0.0" }, + -- Add MasonUpdateAll + { "Zeioth/mason-extra-cmds", opts = {} }, + -- Add lockfile support + { + "zapling/mason-lock.nvim", + opts = { + lockfile_path = vim.fn.expand("~/git/dotfiles/home/.config/nvim/mason-lock.json"), + }, + }, + -- Extended functionality for jdtls + "mfussenegger/nvim-jdtls", + -- Add support for LSP file operations + { "antosha417/nvim-lsp-file-operations", opts = {} }, + -- Automatically fetch schemas from JSON schema store + "b0o/schemastore.nvim", + }, + config = function() + require("mason").setup() + + local mlspc = require("mason-lspconfig") + local lsp_utils = require("lsp_utils") + local lspconfig = require("lspconfig") + + local commonLspConfigArgs = { + on_attach = lsp_utils.map_keys, + capabilities = lsp_utils.get_capabilities(), + } + + mlspc.setup() + mlspc.setup_handlers({ + -- Default handler + function(server_name) + lspconfig[server_name].setup(commonLspConfigArgs) + end, + + -- Disable tsserver diagnostics diagnostics + -- that come from ESLint + ["ts_ls"] = function() + lspconfig.ts_ls.setup(vim.tbl_extend("force", commonLspConfigArgs, { + settings = { + diagnostics = { + ignoredCodes = { + 6133, -- Unused variable + 6192, -- Unused import + }, + }, + }, + })) + end, + + -- Don't set up jdtls, it is set up by nvim-jdtls + ["jdtls"] = function() end, + + ["jsonls"] = function() + lspconfig.jsonls.setup(vim.tbl_extend("force", commonLspConfigArgs, { + settings = { + json = { + schemas = require("schemastore").json.schemas(), + validate = { enable = true }, + }, + }, + })) + end, + }) + end, +} diff --git a/home/.config/nvim/lua/plugins/mini.lua b/home/.config/nvim/lua/plugins/mini.lua new file mode 100644 index 00000000..1c2c25a9 --- /dev/null +++ b/home/.config/nvim/lua/plugins/mini.lua @@ -0,0 +1,12 @@ +-- Library of 30+ independent Lua modules improving overall Neovim +--- @type LazyPluginSpec +return { + "echasnovski/mini.nvim", + config = function() + require("mini.surround").setup() + require("mini.comment").setup() + + -- Recommended for which-key + require("mini.icons").setup() + end, +} diff --git a/home/.config/nvim/lua/plugins/neoformat.lua b/home/.config/nvim/lua/plugins/neoformat.lua new file mode 100644 index 00000000..1bdc479a --- /dev/null +++ b/home/.config/nvim/lua/plugins/neoformat.lua @@ -0,0 +1,12 @@ +-- Formatter plugin +--- @type LazyPluginSpec +return { + "sbdchd/neoformat", + keys = { + { + desc = "Format with Neoformat", + "f", + "Neoformat", + }, + }, +} diff --git a/home/.config/nvim/lua/plugins/noice.lua b/home/.config/nvim/lua/plugins/noice.lua new file mode 100644 index 00000000..1de8aae2 --- /dev/null +++ b/home/.config/nvim/lua/plugins/noice.lua @@ -0,0 +1,30 @@ +-- Replace much of neovim's default UI +-- with a modern replacement +--- @type LazyPluginSpec +return { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify" }, + --- @type NoiceConfig + opts = { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + presets = { + -- add a border to hover docs and signature help + lsp_doc_border = true, + }, + }, + keys = { + { + desc = "Dismiss notifications", + "d", + "NoiceDismiss", + }, + }, +} diff --git a/home/.config/nvim/lua/plugins/nvim-colorizer.lua b/home/.config/nvim/lua/plugins/nvim-colorizer.lua new file mode 100644 index 00000000..ce3131d5 --- /dev/null +++ b/home/.config/nvim/lua/plugins/nvim-colorizer.lua @@ -0,0 +1,6 @@ +-- High performance color highlighter +--- @type LazyPluginSpec +return { + "norcalli/nvim-colorizer.lua", + config = true, +} diff --git a/home/.config/nvim/lua/plugins/nvim-dap.lua b/home/.config/nvim/lua/plugins/nvim-dap.lua new file mode 100644 index 00000000..7eb63a51 --- /dev/null +++ b/home/.config/nvim/lua/plugins/nvim-dap.lua @@ -0,0 +1,123 @@ +-- Debug adapter for NeoVim + +local masonPkg = vim.fn.stdpath("data") .. "/mason/packages" +--- @type LazyPluginSpec +return { + "mfussenegger/nvim-dap", + dependencies = { + { + "rcarriga/nvim-dap-ui", + dependencies = { "nvim-neotest/nvim-nio" }, + config = true, + }, + }, + config = function() + local dap = require("dap") + local configurations = dap.configurations + local adapters = dap.adapters + local pick_process = require("dap.utils").pick_process + + -- Applies all given configurations to the given filetypes + --- @param filetypes string[] + --- @param configs Configuration[] + local function dapConfigure(filetypes, configs) + for _, ft in ipairs(filetypes) do + configurations[ft] = configs + end + end + + -- Bash/sh + local bashAdapter = masonPkg .. "/bash-debug-adapter" + local bashExtension = bashAdapter .. "/extension" + adapters.bashdb = { + type = "executable", + command = bashAdapter .. "/bash-debug-adapter", + name = "bashdb", + } + configurations.sh = { + name = "Debug with bashdb", + type = "bashdb", + request = "launch", + showDebugOutput = true, + trace = true, + pathBashdbLib = bashExtension .. "/bashdb_dir", + pathBashdb = bashExtension .. "/bashdb_dir/bashdb", + file = "${file}", + program = "${file}", + cwd = "${workspaceFolder}", + pathCat = "cat", + pathBash = "/bin/bash", + pathMkfifo = "mkfifo", + pathPkill = "pkill", + args = {}, + env = {}, + terminalKind = "integrated", + } + + -- JavaScript/TypeScript in Firefox/Chrome/Node + adapters.libreWolf = { + type = "executable", + command = "node", + args = { masonPkg .. "/firefox-debug-adapter/dist/adapter.bundle.js" }, + } + adapters["pwa-node"] = { + type = "server", + host = "localhost", + port = "${port}", + executable = { + command = "node", + args = { masonPkg .. "/js-debug-adapter/js-debug/src/dapDebugServer.js", "8123" }, + }, + } + + --- @type Configuration[] + local browserConfigs = { + { + name = "LibreWolf attach", + type = "libreWolf", + request = "attach", + url = "http://localhost:4000", + webRoot = "${workspaceFolder}", + }, + { + name = "Chrome attach", + type = "pwa-chrome", + request = "attach", + cwd = "${workspaceFolder}", + }, + } + + --- @type Configuration[] + local nodeConfigs = { + { + name = "Node attach", + type = "pwa-node", + request = "attach", + processId = pick_process, + cwd = "${workspaceFolder}", + }, + { + name = "Node launch", + type = "pwa-node", + request = "launch", + program = "${file}", + cwd = "${workspaceFolder}", + port = "8123", + }, + } + + dapConfigure({ "typescriptreact", "javascriptreact" }, browserConfigs) + dapConfigure({ "typescript", "javascript" }, vim.tbl_extend("force", browserConfigs, nodeConfigs)) + + -- Java + configurations.java = { + { + name = "Debug (Attach) - Remote", + type = "java", + request = "attach", + hostName = "127.0.0.1", + port = 9009, + }, + } + end, +} diff --git a/home/.config/nvim/lua/plugins/nvim-tree.lua b/home/.config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 00000000..fb185398 --- /dev/null +++ b/home/.config/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,25 @@ +-- Tree explorer +--- @type LazyPluginSpec +return { + "kyazdani42/nvim-tree.lua", + dependencies = { "kyazdani42/nvim-web-devicons" }, + opts = { + diagnostics = { + enable = true, + show_on_dirs = true, + }, + renderer = { + highlight_git = true, + }, + update_focused_file = { + enable = true, + }, + }, + keys = { + { + desc = "Open/close nvim-tree", + "o", + "NvimTreeToggle", + }, + }, +} diff --git a/home/.config/nvim/lua/plugins/redact_pass.lua b/home/.config/nvim/lua/plugins/redact_pass.lua new file mode 100644 index 00000000..984de136 --- /dev/null +++ b/home/.config/nvim/lua/plugins/redact_pass.lua @@ -0,0 +1,8 @@ +-- Make editing passwords safer +--- @type LazyPluginSpec +return { + "https://git.zx2c4.com/password-store", + config = function(plugin) + vim.opt.rtp:append(plugin.dir .. "contrib/vim/redact_pass.vim") + end, +} diff --git a/home/.config/nvim/lua/plugins/statuscol.lua b/home/.config/nvim/lua/plugins/statuscol.lua new file mode 100644 index 00000000..c8890013 --- /dev/null +++ b/home/.config/nvim/lua/plugins/statuscol.lua @@ -0,0 +1,16 @@ +-- Customize statuscolumn +--- @type LazyPluginSpec +return { + "luukvbaal/statuscol.nvim", + config = function() + local builtin = require("statuscol.builtin") + require("statuscol").setup({ + relculright = true, + segments = { + { text = { builtin.foldfunc }, click = "v:lua.ScFa" }, + { text = { "%s" }, click = "v:lua.ScSa" }, + { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" }, + }, + }) + end, +} diff --git a/home/.config/nvim/lua/plugins/suda.lua b/home/.config/nvim/lua/plugins/suda.lua new file mode 100644 index 00000000..e02bd3ae --- /dev/null +++ b/home/.config/nvim/lua/plugins/suda.lua @@ -0,0 +1,3 @@ +-- Do stuff as sudo +--- @type LazyPluginSpec +return { "lambdalisue/suda.vim" } diff --git a/home/.config/nvim/lua/plugins/telescope.lua b/home/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 00000000..0a8435a9 --- /dev/null +++ b/home/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,107 @@ +--- @type LazyPluginSpec +return { + "nvim-telescope/telescope.nvim", + dependencies = { + -- Internal dependency for telescope + "nvim-lua/plenary.nvim", + + -- Use fzf for fuzzy finder + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + }, + + -- Replace vim built in select with telescope + "nvim-telescope/telescope-ui-select.nvim", + + -- cd plugin for telescope + "zane-/cder.nvim", + + -- project plugin for telescope + "nvim-telescope/telescope-project.nvim", + }, + opts = { + -- Set layout to vertical + defaults = { + layout_strategy = "flex", + layout_config = { + flex = { + flip_columns = 200, + }, + }, + }, + pickers = { + find_files = { find_command = { "fd", "-Ht", "f" } }, + lsp_references = { show_line = false }, + live_grep = { + additional_args = function() + return { "--hidden" } + end, + }, + }, + extensions = { + cder = { + previewer_command = "eza " + .. "-a " + .. "--color=always " + .. "-T " + .. "--level=3 " + .. "--icons " + .. "--git-ignore " + .. "--long " + .. "--no-permissions " + .. "--no-user " + .. "--no-filesize " + .. "--git " + .. "--ignore-glob=.git", + dir_command = { "fd", "-Ht", "d", ".", os.getenv("HOME") }, + }, + }, + }, + keys = function() + local telescope = require("telescope") + local builtin = require("telescope.builtin") + local extensions = telescope.extensions + + return { + { + desc = "Open Telescope", + "t", + function() + builtin.builtin({ include_extensions = true }) + end, + }, + { + desc = "Change directories", + "cd", + extensions.cder.cder, + }, + { + desc = "Find files", + "", + builtin.find_files, + }, + { + desc = "Grep files", + "", + builtin.live_grep, + }, + { + desc = "Open a project", + "p", + extensions.project.project, + }, + } + end, + config = function(_, opts) + local telescope = require("telescope") + telescope.setup(opts) + + -- Load extensions + telescope.load_extension("fzf") + telescope.load_extension("ui-select") + telescope.load_extension("cder") + telescope.load_extension("project") + telescope.load_extension("notify") + end, +} diff --git a/home/.config/nvim/lua/plugins/treesitter.lua b/home/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 00000000..1c8d78c9 --- /dev/null +++ b/home/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,153 @@ +return { + -- Improved syntax highlighting, text objects and more + --- @type LazyPluginSpec + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + init = function() + require("nvim-treesitter.install").update({ + with_sync = true, + }) + end, + --- @type TSConfig + opts = { + highlight = { enable = true }, + indent = { enable = true }, + ensure_installed = { + "bash", + "css", + "diff", + "dockerfile", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "html", + "http", + "java", + "javascript", + "jsdoc", + "json", + "json5", + "jsonc", + "latex", + "lua", + "luadoc", + "luap", + "make", + "markdown", + "markdown_inline", + "php", + "python", + "query", + "rasi", + "regex", + "rst", + "scss", + "toml", + "tsx", + "typescript", + "vim", + "vimdoc", + "yaml", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + textobjects = { + move = { + enable = true, + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" }, + goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" }, + }, + select = { + enable = true, + lookahead = true, + keymaps = { + ["af"] = { + query = "@function.outer", + desc = "Select outer part of a function", + }, + ["if"] = { + query = "@function.inner", + desc = "Select inner part of a function", + }, + ["ac"] = { + query = "@class.outer", + desc = "Select outer part of a class", + }, + ["ic"] = { + query = "@class.inner", + desc = "Select inner part of a class", + }, + ["as"] = { + query = "@scope", + query_group = "locals", + desc = "Select language scope", + }, + }, + }, + }, + }, + --- @param opts TSConfig + config = function(_, opts) + if type(opts.ensure_installed) == "table" then + --- @type table + local added = {} + opts.ensure_installed = vim.tbl_filter(function(lang) + if added[lang] then + return false + end + added[lang] = true + return true + end, opts.ensure_installed) + end + require("nvim-treesitter.configs").setup(opts) + end, + dependencies = { + { + "nvim-treesitter/nvim-treesitter-textobjects", + config = function() + -- When in diff mode, we want to use the default + -- vim text objects c & C instead of the treesitter ones. + --- @type table + local move = require("nvim-treesitter.textobjects.move") + local configs = require("nvim-treesitter.configs") + for name, fn in pairs(move) do + if name:find("goto") == 1 then + move[name] = function(q, ...) + if vim.wo.diff then + --- @type table + local config = configs.get_module("textobjects.move")[name] + for key, query in pairs(config or {}) do + if q == query and key:find("[%]%[][cC]") then + vim.cmd("normal! " .. key) + return + end + end + end + return fn(q, ...) + end + end + end + end, + }, + }, + }, + + -- Automatically add closing tags for HTML and JSX + --- @type LazyPluginSpec + { + "windwp/nvim-ts-autotag", + config = true, + }, +} diff --git a/home/.config/nvim/lua/plugins/ufo.lua b/home/.config/nvim/lua/plugins/ufo.lua new file mode 100644 index 00000000..9615f83c --- /dev/null +++ b/home/.config/nvim/lua/plugins/ufo.lua @@ -0,0 +1,28 @@ +-- Better folds +--- @type LazyPluginSpec +return { + "kevinhwang91/nvim-ufo", + dependencies = { "kevinhwang91/promise-async" }, + --- @type UfoConfig + opts = { + close_fold_kinds_for_ft = { + default = { "imports" }, + }, + }, + --- @param opts UfoConfig + config = function(_, opts) + local ufo = require("ufo") + ufo.setup(opts) + + -- Using ufo, we need to remap `zR` and `zM` + vim.keymap.set("n", "zR", ufo.openAllFolds) + vim.keymap.set("n", "zM", ufo.closeAllFolds) + + -- Fold settings + local o = vim.o + o.foldcolumn = "1" + o.foldlevel = 99 + o.foldlevelstart = 99 + o.foldenable = true + end, +} diff --git a/home/.config/nvim/lua/plugins/which-key.lua b/home/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 00000000..481adc15 --- /dev/null +++ b/home/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,20 @@ +-- Display possible keybinds +--- @type LazyPluginSpec +return { + "folke/which-key.nvim", + config = function() + require("which-key").add({ + { "", group = "Leader" }, + { "g", group = "Go to" }, + }) + end, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +} diff --git a/home/.config/nvim/lua/settings.lua b/home/.config/nvim/lua/settings.lua new file mode 100644 index 00000000..a02c5de0 --- /dev/null +++ b/home/.config/nvim/lua/settings.lua @@ -0,0 +1,53 @@ +local o = vim.o +local g = vim.g +o.pumblend = 10 + +-- Relative line numbers +o.number = true +o.relativenumber = true + +-- True colors +o.termguicolors = true + +-- Enable cursorline highlighting +o.cursorline = true + +-- Floating window transparency +o.winblend = 10 + +-- Set window title +o.title = true +o.titlestring = "NeoVim: " .. vim.fn.getcwd() + +-- Diff settings +o.diffopt = "filler,internal,algorithm:histogram,indent-heuristic" + +-- Allow switching buffers with unsaved changes +o.hidden = true + +o.guicursor = table.concat({ + "i:ver1", -- Vertical bar cursor in insert mode + "a:blinkon1", -- Blinking cursor in all modes +}, ",") + +-- Enable global statusline +o.laststatus = 3 + +-- Use suda by default +g.suda_smart_edit = 1 + +-- Case insensitive search +o.ignorecase = true +o.smartcase = true + +-- Set leader +g.mapleader = " " + +-- Indentation settings +o.tabstop = 4 +o.softtabstop = -1 +o.expandtab = true +o.shiftwidth = 4 +o.smartindent = true + +o.showmode = false diff --git a/home/.config/nvim/mason-lock.json b/home/.config/nvim/mason-lock.json new file mode 100644 index 00000000..25d803af --- /dev/null +++ b/home/.config/nvim/mason-lock.json @@ -0,0 +1,15 @@ +{ + "bash-language-server": "5.4.3", + "bibtex-tidy": "1.14.0", + "css-lsp": "4.10.0", + "docker-compose-language-service": "0.3.0", + "dockerfile-language-server": "0.13.0", + "eslint-lsp": "4.10.0", + "html-lsp": "4.10.0", + "json-lsp": "4.10.0", + "lemminx": "0.28.0", + "lua-language-server": "3.13.9", + "texlab": "v5.22.1", + "typescript-language-server": "4.3.4", + "yaml-language-server": "1.17.0" +} \ No newline at end of file diff --git a/home/.config/nvim/snippets/javascript.json b/home/.config/nvim/snippets/javascript.json new file mode 100644 index 00000000..7e0f1e8e --- /dev/null +++ b/home/.config/nvim/snippets/javascript.json @@ -0,0 +1,8 @@ +{ + "logVariable": { + "scope": "javascript", + "prefix": "logvar", + "description": "Log the variable under the cursor", + "body": ["console.log('$1', $1);"] + } +} diff --git a/home/.config/nvim/snippets/package.json b/home/.config/nvim/snippets/package.json new file mode 100644 index 00000000..724d4794 --- /dev/null +++ b/home/.config/nvim/snippets/package.json @@ -0,0 +1,14 @@ +{ + "name": "functionalhacker-snippets", + "engines": { + "vscode": "^1.11.0" + }, + "contributes": { + "snippets": [ + { + "language": "javascript", + "path": "./javascript.json" + } + ] + } +} diff --git a/home/.config/nvimpager/init.vim b/home/.config/nvimpager/init.vim deleted file mode 100644 index 76dd80bb..00000000 --- a/home/.config/nvimpager/init.vim +++ /dev/null @@ -1,10 +0,0 @@ -" Source UI plugins -set runtimepath+=~/.config/nvim/plugged/vim-airline -set runtimepath+=~/.config/nvim/plugged/onedark.vim - -" Source syntax plugins -set runtimepath+=~/.config/nvim/plugged/vim-polyglot - -source ~/.config/nvim/conf.d/02-appearance.vim -source ~/.config/nvim/conf.d/03-keybinds.vim -source ~/.config/nvim/conf.d/06-misc.vim diff --git a/home/.config/pacman/makepkg.conf b/home/.config/pacman/makepkg.conf index 0e014014..4cb42c50 100644 --- a/home/.config/pacman/makepkg.conf +++ b/home/.config/pacman/makepkg.conf @@ -15,14 +15,18 @@ VCSCLIENTS=('bzr::bzr' CARCH="x86_64" CHOST="x86_64-pc-linux-gnu" -CPPFLAGS="-D_FORTIFY_SOURCE=2" -CFLAGS="-march=native -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt" -CXXFLAGS="${CFLAGS}" -RUSTFLAGS="-C opt-level=3 -C target-cpu=native" -LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" -MAKEFLAGS="-j$(nproc)" -DEBUG_CFLAGS="-g -fvar-tracking-assignments" -DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" +CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \ + -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \ + -fstack-clash-protection -fcf-protection \ + -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" +CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS" +LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \ + -Wl,-z,pack-relative-relocs" +LTOFLAGS="-flto=auto" +RUSTFLAGS="-Cforce-frame-pointers=yes" +DEBUG_CFLAGS="-g" +DEBUG_CXXFLAGS="$DEBUG_CFLAGS" +DEBUG_RUSTFLAGS="-C debuginfo=2" BUILDENV=(!distcc color !ccache check !sign) diff --git a/home/.config/paru/paru.conf b/home/.config/paru/paru.conf index 1a8d3038..063d7694 100644 --- a/home/.config/paru/paru.conf +++ b/home/.config/paru/paru.conf @@ -1,2 +1,7 @@ [options] NewsOnUpgrade +PgpFetch + +[bin] +Sudo = doas +Bat = /dev/null diff --git a/home/.config/pass-git-helper/git-pass-mapping.ini b/home/.config/pass-git-helper/git-pass-mapping.ini new file mode 100644 index 00000000..aeb49ee9 --- /dev/null +++ b/home/.config/pass-git-helper/git-pass-mapping.ini @@ -0,0 +1,9 @@ +[DEFAULT] +username_extractor=regex_search +regex_username=^username: (.*)$ + +[git.rossum.fi*] +target=work/ldap.rossum.fi + +[git.korhonen.cc*] +target=git/git.korhonen.cc diff --git a/home/.config/plasma-workspace/env/wayland.sh b/home/.config/plasma-workspace/env/wayland.sh new file mode 100644 index 00000000..17afd060 --- /dev/null +++ b/home/.config/plasma-workspace/env/wayland.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Set environment variables for Sway + +# Firefox +export MOZ_ENABLE_WAYLAND=1 +export MOZ_USE_XINPUT2=1 +export MOZ_WEBRENDER=1 +export MOZ_DBUS_REMOTE=1 + +# Fix java on wayland +export _JAVA_AWT_WM_NONREPARENTING=1 +export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' + +# Enable wayland support on clutter +export CLUTTER_BACKEND=wayland diff --git a/home/.config/rofi/config b/home/.config/rofi/config deleted file mode 100644 index d12d19db..00000000 --- a/home/.config/rofi/config +++ /dev/null @@ -1,9 +0,0 @@ -rofi.lines: 5 -rofi.eh: 2 -rofi.padding: 50 -rofi.fullscreen: false -rofi.bw: 0 -rofi.separator-style: none -rofi.hide-scrollbar: true -rofi.font: Overpass 22 -rofi.theme: ~/.config/rofi/gruvbox-dark.rasi diff --git a/home/.config/rofi/config.rasi b/home/.config/rofi/config.rasi new file mode 100644 index 00000000..be258cd5 --- /dev/null +++ b/home/.config/rofi/config.rasi @@ -0,0 +1,150 @@ +// vim: ft=rasi + +configuration { + font: "Overpass 15"; + show-icons: true; + terminal: "foot"; + // modi: "run,ssh"; + // location: 0; + // yoffset: 0; + // xoffset: 0; + // fixed-num-lines: true; + // ssh-client: "ssh"; + // ssh-command: "{terminal} -e {ssh-client} {host} [-p {port}]"; + // run-command: "{cmd}"; + // run-list-command: ""; + // run-shell-command: "{terminal} -e {cmd}"; + // window-command: "wmctrl -i -R {window}"; + // window-match-fields: "all"; + // icon-theme: "Papirus-Dark"; + // drun-match-fields: "name,generic,exec,categories,keywords"; + // drun-categories: ; + // drun-show-actions: false; + // drun-display-format: "{name}"; + // drun-url-launcher: "xdg-open"; + // disable-history: false; + // ignored-prefixes: ""; + // sort: false; + // sorting-method: "normal"; + // case-sensitive: false; + // cycle: true; + // sidebar-mode: false; + // hover-select: false; + // eh: 1; + // auto-select: false; + // parse-hosts: false; + // parse-known-hosts: true; + // combi-modi: "window,run"; + // matching: "normal"; + // tokenize: true; + // m: "-5"; + // filter: ; + // dpi: -1; + // threads: 0; + // scroll-method: 0; + // window-format: "{w} {c} {t}"; + // click-to-exit: true; + // max-history-size: 25; + // combi-hide-mode-prefix: false; + // combi-display-format: "{mode} {text}"; + // matching-negate-char: '-' unsupported ; + // cache-dir: ; + // window-thumbnail: false; + // drun-use-desktop-cache: false; + // drun-reload-desktop-cache: false; + // normalize-match: false; + // steal-focus: false; + // application-fallback-icon: ; + // pid: "/run/user/1000/rofi.pid"; + // display-run: ; + // display-ssh: ; + // display-drun: ""; + // display-combi: ; + // display-keys: ; + // display-filebrowser: ; + // kb-primary-paste: "Control+V,Shift+Insert"; + // kb-secondary-paste: "Control+v,Insert"; + // kb-clear-line: "Control+w"; + // kb-move-front: "Control+a"; + // kb-move-end: "Control+e"; + // kb-move-word-back: "Alt+b,Control+Left"; + // kb-move-word-forward: "Alt+f,Control+Right"; + // kb-move-char-back: "Left,Control+b"; + // kb-move-char-forward: "Right,Control+f"; + // kb-remove-word-back: "Control+Alt+h,Control+BackSpace"; + // kb-remove-word-forward: "Control+Alt+d"; + // kb-remove-char-forward: "Delete,Control+d"; + // kb-remove-char-back: "BackSpace,Shift+BackSpace,Control+h"; + // kb-remove-to-eol: "Control+k"; + // kb-remove-to-sol: "Control+u"; + // kb-accept-entry: "Control+j,Control+m,Return,KP_Enter"; + // kb-accept-custom: "Control+Return"; + // kb-accept-custom-alt: "Control+Shift+Return"; + // kb-accept-alt: "Shift+Return"; + // kb-delete-entry: "Shift+Delete"; + // kb-mode-next: "Shift+Right,Control+Tab"; + // kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab"; + // kb-mode-complete: "Control+l"; + // kb-row-left: "Control+Page_Up"; + // kb-row-right: "Control+Page_Down"; + // kb-row-up: "Up,Control+p,ISO_Left_Tab"; + // kb-row-down: "Down,Control+n"; + // kb-row-tab: "Tab"; + // kb-page-prev: "Page_Up"; + // kb-page-next: "Page_Down"; + // kb-row-first: "Home,KP_Home"; + // kb-row-last: "End,KP_End"; + // kb-row-select: "Control+space"; + // kb-screenshot: "Alt+S"; + // kb-ellipsize: "Alt+period"; + // kb-toggle-case-sensitivity: "grave,dead_grave"; + // kb-toggle-sort: "Alt+grave"; + // kb-cancel: "Escape,Control+g,Control+bracketleft"; + // kb-custom-1: "Alt+1"; + // kb-custom-2: "Alt+2"; + // kb-custom-3: "Alt+3"; + // kb-custom-4: "Alt+4"; + // kb-custom-5: "Alt+5"; + // kb-custom-6: "Alt+6"; + // kb-custom-7: "Alt+7"; + // kb-custom-8: "Alt+8"; + // kb-custom-9: "Alt+9"; + // kb-custom-10: "Alt+0"; + // kb-custom-11: "Alt+exclam"; + // kb-custom-12: "Alt+at"; + // kb-custom-13: "Alt+numbersign"; + // kb-custom-14: "Alt+dollar"; + // kb-custom-15: "Alt+percent"; + // kb-custom-16: "Alt+dead_circumflex"; + // kb-custom-17: "Alt+ampersand"; + // kb-custom-18: "Alt+asterisk"; + // kb-custom-19: "Alt+parenleft"; + // kb-select-1: "Super+1"; + // kb-select-2: "Super+2"; + // kb-select-3: "Super+3"; + // kb-select-4: "Super+4"; + // kb-select-5: "Super+5"; + // kb-select-6: "Super+6"; + // kb-select-7: "Super+7"; + // kb-select-8: "Super+8"; + // kb-select-9: "Super+9"; + // kb-select-10: "Super+0"; + // ml-row-left: "ScrollLeft"; + // ml-row-right: "ScrollRight"; + // ml-row-up: "ScrollUp"; + // ml-row-down: "ScrollDown"; + // me-select-entry: "MousePrimary"; + // me-accept-entry: "MouseDPrimary"; + // me-accept-custom: "Control+MouseDPrimary"; + /* +timeout { +action: "kb-cancel"; +delay: 0; +} +filebrowser { +directories-first: true; +sorting-method: "name"; +} + */ +} +@theme "~/.cache/wal/colors-rofi-dark" diff --git a/home/.config/rofi/gruvbox-common.inc.rasi b/home/.config/rofi/gruvbox-common.inc.rasi deleted file mode 100644 index f7a168d9..00000000 --- a/home/.config/rofi/gruvbox-common.inc.rasi +++ /dev/null @@ -1,127 +0,0 @@ -/* ========================================================================== - File: gruvbox-common.rasi - Desc: Shared rules between all gruvbox themes - Author: bardisty - Source: https://github.com/bardisty/gruvbox-rofi - Modified: Mon Feb 12 2018 06:06:47 PST -0800 - ========================================================================== */ - -window { - background-color: @background; - border: 2; - padding: 2; -} - -mainbox { - border: 0; - padding: 0; -} - -message { - border: 2px 0 0; - border-color: @separatorcolor; - padding: 1px; -} - -textbox { - highlight: @highlight; - text-color: @foreground; -} - -listview { - border: 2px solid 0 0; - padding: 2px 0 0; - border-color: @separatorcolor; - spacing: 2px; - scrollbar: @scrollbar; -} - -element { - border: 0; - padding: 2px; -} - -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} - -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} - -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} - -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} - -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} - -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} - -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} - -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} - -scrollbar { - width: 4px; - border: 0; - handle-color: @scrollbar-handle; - handle-width: 8px; - padding: 0; -} - -sidebar { - border: 2px 0 0; - border-color: @separatorcolor; -} - -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 2px; - children: [ prompt, textbox-prompt-sep, entry, case-indicator ]; -} - -case-indicator, -entry, -prompt, -button { - spacing: 0; - text-color: @normal-foreground; -} - -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -textbox-prompt-sep { - expand: false; - str: ":"; - text-color: @normal-foreground; - margin: 0 0.3em 0 0; -} diff --git a/home/.config/rofi/gruvbox-dark.rasi b/home/.config/rofi/gruvbox-dark.rasi deleted file mode 100644 index 8a4969d9..00000000 --- a/home/.config/rofi/gruvbox-dark.rasi +++ /dev/null @@ -1,61 +0,0 @@ -/* ========================================================================== - Rofi color theme - - Based on the Gruvbox color scheme for Vim by morhetz - https://github.com/morhetz/gruvbox - - File: gruvbox-dark-soft.rasi - Desc: Gruvbox dark (soft contrast) color theme for Rofi - Author: bardisty - Source: https://github.com/bardisty/gruvbox-rofi - Modified: Mon Feb 12 2018 06:04:37 PST -0800 - ========================================================================== */ - -* { - /* Theme settings */ - highlight: bold italic; - scrollbar: true; - - /* Gruvbox dark colors */ - gruvbox-dark-bg0-soft: #32302f; - gruvbox-dark-bg1: #3c3836; - gruvbox-dark-bg3: #665c54; - gruvbox-dark-fg0: #fbf1c7; - gruvbox-dark-fg1: #ebdbb2; - gruvbox-dark-red-dark: #cc241d; - gruvbox-dark-red-light: #fb4934; - gruvbox-dark-yellow-dark: #d79921; - gruvbox-dark-yellow-light: #fabd2f; - gruvbox-dark-gray: #a89984; - - /* Theme colors */ - background: @gruvbox-dark-bg0-soft; - background-color: @background; - foreground: @gruvbox-dark-fg1; - border-color: @gruvbox-dark-gray; - separatorcolor: @border-color; - scrollbar-handle: @border-color; - - normal-background: @background; - normal-foreground: @foreground; - alternate-normal-background: @background; - alternate-normal-foreground: @foreground; - selected-normal-background: @gruvbox-dark-bg3; - selected-normal-foreground: @gruvbox-dark-fg0; - - active-background: @gruvbox-dark-yellow-dark; - active-foreground: @background; - alternate-active-background: @active-background; - alternate-active-foreground: @active-foreground; - selected-active-background: @gruvbox-dark-yellow-light; - selected-active-foreground: @active-foreground; - - urgent-background: @gruvbox-dark-red-dark; - urgent-foreground: @background; - alternate-urgent-background: @urgent-background; - alternate-urgent-foreground: @urgent-foreground; - selected-urgent-background: @gruvbox-dark-red-light; - selected-urgent-foreground: @urgent-foreground; -} - -@import "gruvbox-common.inc" diff --git a/home/.config/rofi/nord.rasi b/home/.config/rofi/nord.rasi deleted file mode 100644 index fdf4de4c..00000000 --- a/home/.config/rofi/nord.rasi +++ /dev/null @@ -1,150 +0,0 @@ -* { - nord0: #2E3440; - nord1: #3B4252; - nord2: #434C5E; - nord3: #4C566A; - nord4: #D8DEE9; - nord5: #E5E9F0; - nord6: #ECEFF4; - nord7: #8FBCBB; - nord8: #88C0D0; - nord9: #81A1C1; - nord10: #5E81AC; - nord11: #BF616A; - nord12: #D08770; - nord13: #EBCB8B; - nord14: #A3BE8C; - nord15: #B48EAD; - background: @nord0; - foreground: @nord4; - selected-normal-foreground: @nord4; - normal-foreground: @foreground; - alternate-normal-background: @nord0; - selected-urgent-foreground: @nord4; - urgent-foreground: @foreground; - alternate-urgent-background: @nord0; - active-foreground: @foreground; - selected-active-foreground: @foreground; - alternate-active-background: @nord0; - bordercolor: @nord10; - alternate-normal-foreground: @foreground; - normal-background: @background; - selected-normal-background: @nord3; - border-color: @nord10; - spacing: 2; - separatorcolor: @blue; - urgent-background: @background; - selected-urgent-background: @nord3; - alternate-urgent-foreground: @urgent-foreground; - background-color: @background; - alternate-active-foreground: @active-foreground; - active-background: @background; - selected-active-background: @nord3; -} - -//---------------------- -// Style -//---------------------- - -#window { - background-color: @background; -} - -#mainbox { - border: 2; - padding: 10; -} - -#message { - border: 2px 2px 2px ; - border-color: @separatorcolor; - padding: 10 ; -} - -#textbox { - text-color: @foreground; -} - -#listview { - fixed-height: 0; - padding: 5 0 0; - spacing: 5px ; -} - -#element { - border: 0; - padding: 5px ; -} - -#element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} - -#element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} - -#element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} - -#element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -#element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} - -#element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} - -#element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} - -#element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} - -#element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} - -#button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -#inputbar { - spacing: 5; - text-color: @normal-foreground; - padding: 5px ; - border: 0 0 1; - border-color: @separatorcolor; -} - -#case-indicator { - spacing: 0; - text-color: @normal-foreground; -} - -#entry { - spacing: 0; - text-color: @normal-foreground; -} - -#prompt { - spacing: 0; - text-color: @normal-foreground; -} diff --git a/home/.config/sway/conf.d/01-vars.conf b/home/.config/sway/conf.d/01-vars.conf index 530dd5ec..76837cf4 100644 --- a/home/.config/sway/conf.d/01-vars.conf +++ b/home/.config/sway/conf.d/01-vars.conf @@ -1,7 +1,7 @@ -# vim:ft=i3config +# vim:ft=swayconfig set $mod Mod4 set $term footclient +set $browser librewolf set $gnome-schema org.gnome.desktop.interface -set $wallpaper ~/pictures/Wallpapers/random/$(ls ~/pictures/Wallpapers/random | sort -R | tail -n 1) set $scripts ~/.config/sway/scripts diff --git a/home/.config/sway/conf.d/02-bar.conf b/home/.config/sway/conf.d/02-bar.conf new file mode 100644 index 00000000..8027d960 --- /dev/null +++ b/home/.config/sway/conf.d/02-bar.conf @@ -0,0 +1,5 @@ +# vim:ft=swayconfig + +bar { + swaybar_command waybar +} diff --git a/home/.config/sway/conf.d/02-input.conf b/home/.config/sway/conf.d/03-input.conf similarity index 90% rename from home/.config/sway/conf.d/02-input.conf rename to home/.config/sway/conf.d/03-input.conf index 1f1a7394..aea31fbe 100644 --- a/home/.config/sway/conf.d/02-input.conf +++ b/home/.config/sway/conf.d/03-input.conf @@ -1,4 +1,4 @@ -# vim:ft=i3config +# vim:ft=swayconfig input type:keyboard { xkb_layout eu diff --git a/home/.config/sway/conf.d/03-output.conf b/home/.config/sway/conf.d/04-output.conf similarity index 91% rename from home/.config/sway/conf.d/03-output.conf rename to home/.config/sway/conf.d/04-output.conf index 8d701a78..9e524bf1 100644 --- a/home/.config/sway/conf.d/03-output.conf +++ b/home/.config/sway/conf.d/04-output.conf @@ -1,4 +1,4 @@ -# vim:ft=i3config +# vim:ft=swayconfig output * bg $wallpaper fill output eDP-1 position 0 0 diff --git a/home/.config/sway/conf.d/04-workspaces.conf b/home/.config/sway/conf.d/05-workspaces.conf similarity index 96% rename from home/.config/sway/conf.d/04-workspaces.conf rename to home/.config/sway/conf.d/05-workspaces.conf index f33cf423..ea67ffe8 100644 --- a/home/.config/sway/conf.d/04-workspaces.conf +++ b/home/.config/sway/conf.d/05-workspaces.conf @@ -1,4 +1,4 @@ -# vim:ft=i3config +# vim:ft=swayconfig # Start applications in specific workspaces assign [app_id="telegramdesktop"] workspace 3 diff --git a/home/.config/sway/conf.d/05-keybinds.conf b/home/.config/sway/conf.d/06-keybinds.conf similarity index 96% rename from home/.config/sway/conf.d/05-keybinds.conf rename to home/.config/sway/conf.d/06-keybinds.conf index 4f68b1c7..252050b4 100644 --- a/home/.config/sway/conf.d/05-keybinds.conf +++ b/home/.config/sway/conf.d/06-keybinds.conf @@ -1,14 +1,17 @@ -# vim:ft=i3config +# vim:ft=swayconfig # start terminal bindsym $mod+Return exec $term +# start neovide +bindsym $mod+n exec neovide + # kill focused window bindsym $mod+w kill # Modes for controlling gaps set $mode_gaps Gaps: (o) outer, (i) inner -set $mode_gaps_outer Outer Gaps: j|k|0|r|i +set $mode_gaps_outer Outer Gaps: j|k|0|r|i set $mode_gaps_inner Inner Gaps: j|k|0|r|o bindsym $mod+g mode "$mode_gaps" @@ -55,8 +58,8 @@ bindsym --locked XF86Search output eDP-1 toggle bindsym $mod+Shift+e exec $term --app-id fzf-launcher --login-shell /bin/sh -c "$scripts/exit.sh" # launch a program -bindsym $mod+d exec wofi -bindsym $mod+Shift+d exec wofi --show run +bindsym $mod+d exec rofi -show drun +bindsym $mod+Shift+d exec rofi -show run # manage clipboard bindsym $mod+c exec clipman pick -t wofi @@ -139,7 +142,7 @@ mode "resize" { bindsym $mod+r mode "resize" # start browser -bindsym $mod+b exec firefox-nightly +bindsym $mod+b exec $browser # media keys bindsym --locked XF86AudioRaiseVolume exec pamixer -ui 1 && pamixer --get-volume > $SWAYSOCK.wob @@ -173,7 +176,7 @@ bindsym XF86Calculator exec alacritty -e calc # Switch to urgent workspace bindsym $mod+u [urgent=latest] focus -# Switch to workspace +# Switch to workspace bindsym $mod+1 workspace 1 bindsym $mod+2 workspace 2 bindsym $mod+3 workspace 3 diff --git a/home/.config/sway/conf.d/06-appearance.conf b/home/.config/sway/conf.d/07-appearance.conf similarity index 78% rename from home/.config/sway/conf.d/06-appearance.conf rename to home/.config/sway/conf.d/07-appearance.conf index 241d3d70..fb429778 100644 --- a/home/.config/sway/conf.d/06-appearance.conf +++ b/home/.config/sway/conf.d/07-appearance.conf @@ -1,8 +1,6 @@ -# vim:ft=i3config +# vim:ft=swayconfig default_border none -gaps inner 15 -gaps outer 15 # Hide cursor after 4 seconds of inactivity seat * hide_cursor 4000 @@ -10,7 +8,7 @@ seat * hide_cursor 4000 ###### Borders ###### # class border backgr. text indicator child_border client.focused #8AC6F2 #8AC6F2 #292D3E #8AC6F2 #8AC6F2 -client.focused_inactive #292D3E #FFFFFF #FFFFFF #292D3E #292D3E +client.focused_inactive #292D3E #FFFFFF #292D3E #292D3E #292D3E client.unfocused #292D3E #292D3E #FFFFFF #282828 #292D3E for_window [app_id="^.*"] border pixel 4 diff --git a/home/.config/sway/conf.d/07-exec.conf b/home/.config/sway/conf.d/07-exec.conf deleted file mode 100644 index d886ee74..00000000 --- a/home/.config/sway/conf.d/07-exec.conf +++ /dev/null @@ -1,12 +0,0 @@ -# vim:ft=i3config - -exec_always { - gsettings set $gnome-schema gtk-theme 'Matcha-dark-azul' - gsettings set $gnome-schema icon-theme 'Papirus-Dark' - gsettings set $gnome-schema cursor-theme 'Breeze' - gsettings set $gnome-schema font-name 'Overpass 12' - gsettings set $gnome-schema document-font-name 'Overpass 12' - gsettings set $gnome-schema monospace-font-name 'Hack Nerd Font Mono 12' - - systemctl --user start sway-session.target -} diff --git a/home/.config/sway/conf.d/08-exec.conf b/home/.config/sway/conf.d/08-exec.conf new file mode 100644 index 00000000..0ac58ac5 --- /dev/null +++ b/home/.config/sway/conf.d/08-exec.conf @@ -0,0 +1,30 @@ +# vim:ft=swayconfig + +exec { + foot -s + $scripts/idle.sh + autotiling + redshift-gtk -m wayland + telegram-desktop + /usr/lib/kdeconnectd + kdeconnect-indicator + mako + wl-paste -t text --watch clipman store --notify 1>> ~/.log/clipman 2>&1 + wl-paste -p -t text --watch clipman store -P --histpath="~/.local/share/clipman-primary.json" + mkfifo $SWAYSOCK.wob && tail -f $SWAYSOCK.wob | wob + /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 + mpDris2 + swaymsg workspace 1 + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + /usr/lib/geoclue-2.0/demos/agent + thunderbird +} + +exec_always { + gsettings set $gnome-schema gtk-theme 'Matcha-dark-azul' + gsettings set $gnome-schema icon-theme 'Papirus-Dark' + gsettings set $gnome-schema cursor-theme 'Numix-Cursor' + gsettings set $gnome-schema font-name 'Overpass 12' + gsettings set $gnome-schema document-font-name 'Overpass 12' + gsettings set $gnome-schema monospace-font-name 'Hack Nerd Font Mono 12' +} diff --git a/home/.config/sway/config b/home/.config/sway/config index afde203c..2d43f1ae 100644 --- a/home/.config/sway/config +++ b/home/.config/sway/config @@ -1,3 +1,4 @@ # vim:ft=i3config +include ~/.cache/wal/colors-sway include ~/.config/sway/conf.d/*.conf diff --git a/home/.config/sway/env b/home/.config/sway/env deleted file mode 100755 index e2c42b18..00000000 --- a/home/.config/sway/env +++ /dev/null @@ -1,20 +0,0 @@ -# Firefox -MOZ_ENABLE_WAYLAND=1 -MOZ_USE_XINPUT2=1 -MOZ_WEBRENDER=1 - -# Enable xdg-desktop-portal-wlr -XDG_CURRENT_DESKTOP=sway -XDG_SESSION_TYPE=wayland - -# Fix java on wayland -_JAVA_AWT_WM_NONREPARENTING=1 -_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' - -# Enable qt5 theming and wayland support -QT_QPA_PLATFORMTHEME=qt5ct -QT_QPA_PLATFORM=wayland -QT_WAYLAND_DISABLE_WINDOWDECORATION=1 - -# Fix redshift on wlroots -WLR_DRM_NO_ATOMIC=1 diff --git a/home/.config/systemd/user/foot-server.service b/home/.config/systemd/user/foot-server.service deleted file mode 100644 index 31f0b070..00000000 --- a/home/.config/systemd/user/foot-server.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Wayland terminal emulator (server) -PartOf=graphical-session.target - -[Service] -Type=simple -ExecStart=/usr/bin/foot -s - -[Install] -WantedBy=sway-session.target diff --git a/home/.config/systemd/user/nvim-headless.service b/home/.config/systemd/user/nvim-headless.service new file mode 100644 index 00000000..9c408839 --- /dev/null +++ b/home/.config/systemd/user/nvim-headless.service @@ -0,0 +1,11 @@ +[Unit] +Description=Neovim headless server + +[Service] +Type=simple +ExecStart=/bin/bash --login -c 'nvim --headless --listen %h/.var/nvim.socket' +Restart=always +RestartSec=1 + +[Install] +WantedBy=default.target diff --git a/home/.config/systemd/user/nvim-remote-ssh@.service b/home/.config/systemd/user/nvim-remote-ssh@.service new file mode 100644 index 00000000..e4658306 --- /dev/null +++ b/home/.config/systemd/user/nvim-remote-ssh@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Neovim remote SSH socket + +# Pass arguments https://superuser.com/a/1282178 +[Service] +Type=simple +Environment="SCRIPT_ARGS=%I" +ExecStart=%h/.local/bin/nvim-remote-ssh $SCRIPT_ARGS +Restart=on-failure +RestartSec=1 + +[Install] +WantedBy=default.target diff --git a/home/.config/udiskie/config.yml b/home/.config/udiskie/config.yml deleted file mode 100644 index 9e6a80cf..00000000 --- a/home/.config/udiskie/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -{%@@ if profile == "ReekyPC" @@%} -device_config: - - id_uuid: 10879044936567925003 - ignore:true -{%@@ endif @@%} diff --git a/home/.config/user-dirs.dirs b/home/.config/user-dirs.dirs deleted file mode 100644 index 99266f46..00000000 --- a/home/.config/user-dirs.dirs +++ /dev/null @@ -1,8 +0,0 @@ -XDG_DESKTOP_DIR="$HOME/desktop" -XDG_DOWNLOAD_DIR="$HOME/downloads" -XDG_TEMPLATES_DIR="$HOME/templates" -XDG_PUBLICSHARE_DIR="$HOME/public" -XDG_DOCUMENTS_DIR="$HOME/documents" -XDG_MUSIC_DIR="$HOME/music" -XDG_PICTURES_DIR="$HOME/pictures" -XDG_VIDEOS_DIR="$HOME/videos" diff --git a/home/.config/wal/colorschemes/dark/kanagawa.json b/home/.config/wal/colorschemes/dark/kanagawa.json new file mode 100644 index 00000000..af39e5a9 --- /dev/null +++ b/home/.config/wal/colorschemes/dark/kanagawa.json @@ -0,0 +1,27 @@ +{ + "colors": { + "color0": "#090618", + "color1": "#C34043", + "color2": "#76946A", + "color3": "#C0A36E", + "color4": "#7E9CD8", + "color5": "#957FB8", + "color6": "#6A9589", + "color7": "#C8C093", + "color8": "#727169", + "color9": "#E82424", + "color10": "#98BB6C", + "color11": "#E6C384", + "color12": "#7FB4CA", + "color13": "#938AA9", + "color14": "#7AA89F", + "color15": "#DCD7BA", + "color16": "#FFA066", + "color17": "#FF5D62" + }, + "special": { + "foreground": "#DCD7BA", + "background": "#1F1F28", + "cursor": "#C8C093" + } +} diff --git a/home/.config/wal/templates/colors-foot.ini b/home/.config/wal/templates/colors-foot.ini new file mode 100644 index 00000000..835bb948 --- /dev/null +++ b/home/.config/wal/templates/colors-foot.ini @@ -0,0 +1,24 @@ +[colors] +foreground = {foreground.strip} +background = {background.strip} +alpha = {background.alpha_dec} + +regular0 = {color0.strip} +regular1 = {color1.strip} +regular2 = {color2.strip} +regular3 = {color3.strip} +regular4 = {color4.strip} +regular5 = {color5.strip} +regular6 = {color6.strip} +regular7 = {color7.strip} +bright0 = {color8.strip} +bright1 = {color9.strip} +bright2 = {color10.strip} +bright3 = {color11.strip} +bright4 = {color12.strip} +bright5 = {color13.strip} +bright6 = {color14.strip} +bright7 = {color15.strip} + +[cursor] +color = {foreground.strip} {cursor.strip} diff --git a/home/.config/waybar/style.css b/home/.config/waybar/style.css index 7610afcd..e5b38cdf 100644 --- a/home/.config/waybar/style.css +++ b/home/.config/waybar/style.css @@ -1,130 +1,141 @@ * { - border: none; - border-radius: 0; - font-family: "Noto Sans Display", "Font Awesome 5 Free"; - font-size: 13px; - min-height: 0; + border: none; + border-radius: 0; + font-family: 'Noto Sans Display', 'Font Awesome 5 Free'; + font-size: 13px; + min-height: 0; } window#waybar { - background: #292D3E; - color: white; + background: #292d3e; + color: white; } /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ #workspaces button { - padding: 0 5px; - background: transparent; - color: white; + padding: 0 5px; + background: transparent; + color: white; } #workspaces button.focused { - background: #64727D; + background: #64727d; } #mode { - background: #64727D; + background: #64727d; } -#clock, #battery, #cpu, #temperature, #memory, #backlight, #network, #pulseaudio, #custom-media, #custom-yay, #tray, #mode, #idle_inhibitor { - padding: 0 10px; - margin: 0 5px; +#clock, +#battery, +#cpu, +#temperature, +#memory, +#backlight, +#network, +#pulseaudio, +#custom-media, +#custom-yay, +#tray, +#mode, +#idle_inhibitor { + padding: 0 10px; + margin: 0 5px; } #clock { - background-color: #64727D; + background-color: #64727d; } #battery { - background-color: #ffffff; - color: black; + background-color: #ffffff; + color: black; } #battery.charging { - color: black; - background-color: #a3be8c; + color: black; + background-color: #a3be8c; } @keyframes blink { - to { - background-color: #ffffff; - color: black; - } + to { + background-color: #ffffff; + color: black; + } } #battery.critical:not(.charging) { - background: #bf616a; - color: white; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; + background: #bf616a; + color: white; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; } #temperature { - background: #97B084; - color: black; + background: #97b084; + color: black; } #temperature.critical { - background: #bf616a; - color: white; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; + background: #bf616a; + color: white; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; } #cpu { - background: #BD9B5D; - color: #000000; + background: #bd9b5d; + color: #000000; } #memory { - color: black; - background: #b48ead; + color: black; + background: #b48ead; } #backlight { - background: #90b1b1; + background: #90b1b1; } #network { - color: black; - background: #81a1c1; + color: black; + background: #81a1c1; } #network.disconnected { - background: #f53c3c; + background: #f53c3c; } #pulseaudio { - background: #88c0d0; - color: black; + background: #88c0d0; + color: black; } #pulseaudio.muted { - background: #90b1b1; - color: #2a5c45; + background: #90b1b1; + color: #2a5c45; } #custom-media { - background: #97B084; - color: black; + background: #97b084; + color: black; } #custom-yay { - background-color: #64727D; + background-color: #64727d; } #tray { - background-color: #282828; + background-color: #282828; } #idle_inhibitor { - background-color: #8fbcbb; - color: #000000; + background-color: #8fbcbb; + color: #000000; } - diff --git a/home/.config/zathura/catppuccin b/home/.config/zathura/catppuccin new file mode 100644 index 00000000..0ee25130 --- /dev/null +++ b/home/.config/zathura/catppuccin @@ -0,0 +1,37 @@ +set default-fg "#d9e0ee" +set default-bg "#1e1d2f" + +set completion-bg "#302d41" +set completion-fg "#d9e0ee" +set completion-highlight-bg "#575268" +set completion-highlight-fg "#d9e0ee" +set completion-group-bg "#302d41" +set completion-group-fg "#96cdfb" + +set statusbar-fg "#d9e0ee" +set statusbar-bg "#302d41" + +set notification-bg "#302d41" +set notification-fg "#d9e0ee" +set notification-error-bg "#302d41" +set notification-error-fg "#f28fad" +set notification-warning-bg "#302d41" +set notification-warning-fg "#fae3b0" + +set inputbar-fg "#d9e0ee" +set inputbar-bg "#302d41" + +set recolor-lightcolor "#1e1d2f" +set recolor-darkcolor "#d9e0ee" + +set index-fg "#d9e0ee" +set index-bg "#1e1d2f" +set index-active-fg "#d9e0ee" +set index-active-bg "#302d41" + +set render-loading-bg "#1e1d2f" +set render-loading-fg "#d9e0ee" + +set highlight-color "#575268" +set highlight-fg "#f5c2e7" +set highlight-active-color "#f5c2e7" diff --git a/home/.config/zathura/zathurarc b/home/.config/zathura/zathurarc index 3f06e2a8..c5ed9997 100644 --- a/home/.config/zathura/zathurarc +++ b/home/.config/zathura/zathurarc @@ -1,33 +1,7 @@ -set completion-bg "#282828" -set recolor-darkcolor "#EBDBB2" -set recolor-lightcolor "#282828" -set completion-fg "#EBDBB2" -set completion-group-bg "#282828" -set completion-group-fg "#1E6D8B" -set completion-highlight-bg "#EBDBB2" -set completion-highlight-fg "#282828" -set default-bg "#282828" -set default-fg "#EBDBB2" -set inputbar-bg "#282828" -set inputbar-fg "#EBDBB2" -set notification-bg "#282828" -set notification-fg "#EBDBB2" -set notification-error-bg "#EBAE79" -set notification-error-fg "#EBDBB2" -set notification-warning-bg "#EBAE79" -set notification-warning-fg "#EBDBB2" -set statusbar-bg "#282828" -set statusbar-fg "#EBDBB2" -set index-bg "#282828" -set index-fg "#EBDBB2" -set index-active-bg "#EBDBB2" -set index-active-fg "#282828" -set render-loading-bg "#282828" -set render-loading-fg "#EBDBB2" - -set smooth-scroll true set window-title-home-tilde true set statusbar-basename true set selection-clipboard clipboard set recolor false set vertical-center true + +include catppuccin diff --git a/home/.config/zellij/config.kdl b/home/.config/zellij/config.kdl new file mode 100644 index 00000000..88d64342 --- /dev/null +++ b/home/.config/zellij/config.kdl @@ -0,0 +1,12 @@ +session_serialization false +theme "kanagawa" + +keybinds { + unbind "Ctrl g" + locked { + bind "Ctrl l" { SwitchToMode "Normal"; } + } + shared_except "locked" { + bind "Ctrl l" { SwitchToMode "Locked"; } + } +} diff --git a/home/.config/zsh/01-env.zsh b/home/.config/zsh/01-env.zsh deleted file mode 100644 index 2658b0d0..00000000 --- a/home/.config/zsh/01-env.zsh +++ /dev/null @@ -1,48 +0,0 @@ -# zsh key timeout -export KEYTIMEOUT=1 - -# prompt customization -export PURE_PROMPT_SYMBOL="λ" -export PURE_PROMPT_VICMD_SYMBOL="y" - -# zsh history settings -export HISTFILE=~/.zsh_history -export HISTSIZE=1000 -export SAVEHIST=1000 - -# Variable to pass to sdotdrop to get current user -export USRNAME=$USER - -# go path -export GOPATH=~/.bin/go - -# fzf settings -export FZF_DEFAULT_COMMAND='fd -Ht f' -export FZF_ALT_C_COMMAND='fd -Ht d' -export FZF_DEFAULT_OPTS='-m --bind ctrl-a:select-all,ctrl-d:deselect-all,ctrl-t:toggle-all' -export FZF_COMPLETION_TRIGGER='**' -export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" -export FZF_CTRL_T_OPTS='--preview "/usr/bin/cat {} | nvimpager -c "' - -# use lesspipe with less -export LESSOPEN="|lesspipe.sh %s" - -# dotfile repository location -export DOTREPO="$HOME/git/dotfiles" - -# nvim ftw! -export EDITOR=nvim -export PAGER="nvimpager -p" -export AUR_PAGER=$PAGER - -# Use GPG for SSH authentication -export GPG_TTY="$(tty)" - -# set SSH_AUTH_SOCK if not logging in over SSH -if [ "$SSH_CONNECTION" -eq "" ]; then - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - gpgconf --launch gpg-agent -fi - -# tehfuk -eval $(thefuck --alias) diff --git a/home/.config/zsh/01-zellij.zsh b/home/.config/zsh/01-zellij.zsh new file mode 100644 index 00000000..d8dfb94b --- /dev/null +++ b/home/.config/zsh/01-zellij.zsh @@ -0,0 +1,4 @@ + # Launch or attach zellij to existing session if logging in over ssh +if [[ -z "$ZELLIJ" && -n "$SSH_CONNECTION" ]]; then + exec zellij attach -c SSH +fi diff --git a/home/.config/zsh/02-env.zsh b/home/.config/zsh/02-env.zsh new file mode 100644 index 00000000..8fef18a9 --- /dev/null +++ b/home/.config/zsh/02-env.zsh @@ -0,0 +1,91 @@ +# key timeout +export KEYTIMEOUT=1 + +# prompt customization +export PURE_PROMPT_SYMBOL="λ" +export PURE_PROMPT_VICMD_SYMBOL="y" + +# history settings +export HISTFILE=~/.zsh_history +export HISTSIZE=10000 +export SAVEHIST=10000 +# Ignore these functions from history since they will +# append the expandend command to the history +export HISTORY_IGNORE="(pi|pr)" +# Additional settings (source https://jdhao.github.io/2021/03/24/zsh_history_setup) +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_SAVE_NO_DUPS +setopt HIST_REDUCE_BLANKS +setopt INC_APPEND_HISTORY_TIME +setopt EXTENDED_HISTORY + +# Enable completions for aliases +setopt no_complete_aliases + +# Variable to pass to sdotdrop to get current user +export USRNAME=$USER + +# Add ~/.local/bin to path +export PATH="$HOME/.local/bin:$PATH" + +# Add locally installed npm binaries to path +export PATH="$HOME/.local/share/npm/bin:$PATH" + +# Add ~/.cargo/bin to path +export PATH="$HOME/.cargo/bin:$PATH" + +# Add ~/.local/share/nvim/mason/bin to path +export PATH="$HOME/.local/share/nvim/mason/bin:$PATH" + +# go path +export GOPATH=~/.go + +# fzf settings +export FD_COMMAND='fd -HLt' +export FZF_DEFAULT_COMMAND="$FD_COMMAND f" +export FZF_ALT_C_COMMAND="$FD_COMMAND d" +export FZF_ALT_C_OPTS="--preview 'eza -l {}'" +export FZF_DEFAULT_OPTS='-m --ansi --bind ctrl-a:toggle-all,ctrl-d:deselect-all,ctrl-t:toggle-all' +export FZF_COMPLETION_TRIGGER='**' +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND --strip-cwd-prefix" +export FZF_CTRL_T_OPTS='--preview "bat --color=always --style=numbers --line-range=:500 {}"' +_fzf_compgen_path() { + resultcmd="$FZF_DEFAULT_COMMAND . $1" + eval ${resultcmd} +} +_fzf_compgen_dir() { + resultcmd="$FZF_ALT_C_COMMAND . $1" + eval ${resultcmd} +} + +# dotfile repository location +export DOTREPO="$HOME/git/dotfiles" + +# nvim ftw! +export EDITOR=nvim +export PAGER="$EDITOR -R +\"lua require 'pager'\"" +export GIT_PAGER="$EDITOR -c 'set ft=git' -R +\"lua require 'pager'\"" +export PARU_PAGER="$PAGER -c 'set ft=PKGBUILD'" +export AUR_PAGER=$EDITOR +export MANPAGER="$EDITOR +\"lua require 'pager'\" +Man!" +export SYSTEMD_EDITOR=$EDITOR +export SYSTEMD_PAGER=less + +# neovide settings +export NEOVIDE_MULTIGRID=1 +export NEOVIDE_FORK=1 + +{%@@ if distro_id == "arch" or distro_id == "ubuntu" @@%} +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +fi +gpgconf --launch gpg-agent +{%@@ elif distro_id == "termux" @@%} +eval $(okc-ssh-agent) >/dev/null +{%@@ endif @@%} + +# Enable grc colorization of supported commands +[[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh + +# Disable dotdrop submodule auto update +export DOTDROP_AUTOUPDATE=no diff --git a/home/.config/zsh/03-aliases.zsh b/home/.config/zsh/03-aliases.zsh deleted file mode 100644 index 4c0d4215..00000000 --- a/home/.config/zsh/03-aliases.zsh +++ /dev/null @@ -1,288 +0,0 @@ -# git shorthands -alias gc='git commit' -alias gac='ga && gc' -alias gpull='git pull' -alias gpush='git push' - -alias mutt='neomutt' - -# Syntax highlighting cat if output is a terminal -cat() { - # Check if output is a terminal, else use regular cat - if [ -t 1 ]; then - nvimpager $@ - else - /usr/bin/cat $@ - fi -} - -rip() { - abcde - printf "Ripping done. Importing to library" - beet import ~/Documents/Rip/flac/* -} - -# make fzf zsh plugin use ripgrep -_fzf_compgen_dir() { - rg --hidden --files --null --sort path "$1" 2>/dev/null | xargs -0 dirname | uniq -} -_fzf_compgen_path() { - rg --files --hidden "$1" 2>/dev/null -} - -# search and install packages with fzf -pi() { - SELECTED_PKGS="$(paru -Slq | fzf --header='Install packages' -m --preview 'paru -Si {1}')" - if [ -n "$SELECTED_PKGS" ]; then - paru -S $(echo $SELECTED_PKGS) - fi -} - -# search and remove packages with fzf -pr() { - SELECTED_PKGS="$(paru -Qsq | fzf --header='Remove packages' -m --preview 'paru -Si {1}')" - if [ -n "$SELECTED_PKGS" ]; then - paru -Rns $(echo $SELECTED_PKGS) - fi -} - -# find and open man pages with fzf -fman() { - man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man -} - -# I'm retarded so I need this -alias :q='exit' -alias :wq='exit' - -alias reboot-kodi='systemctl reboot --boot-loader-entry=kodi.conf' - -# zbar output only data -alias zbarimg='zbarimg -q --raw' -alias zbarcam='zbarcam -q --raw' - -# shorten systemctl and journalctl -alias sc='systemctl' -alias scu='systemctl --user' -alias jc='journalctl' -alias jcu='journalctl --user' - -# switch to desktop mode -alias dock='swaymsg output eDP-1 disable' - -# move to trash instead of remove -alias rm='trash' - -# clean stuff -clean() { - DFCMD="df -h / | tail -n 1 | cut -d' ' -f8- | cut -d' ' -f1 | sed 's/[^0-9]*//g'" - SPACEBEFORE=$(eval "$DFCMD") - trash-empty 10 - sudo journalctl --vacuum-size=500M - paru -Sc - SPACEAFTER=$(eval "$DFCMD") - echo "Saved $(calc $SPACEAFTER - $SPACEBEFORE)G of space" -} - -# connect to wireguard -alias startvpn='sudo systemctl start wg-quick@wg0.service' -alias stopvpn='sudo systemctl stop wg-quick@wg0.service' - -# connect to metropolia vpn -alias metropoliavpn='sudo openconnect -u markoak --passwd-on-stdin vpn.metropolia.fi' - -# read qrcode from selection -qr() { grim -g "$(slurp -d)" - | zbarimg PNG:- } - -# generate qr code in terminal -alias qrencode='qrencode -t ansiutf8' - -# color picker -cpick() { grim -g "$(slurp -p)" -t ppm - | convert - -format "%[pixel:p{0,0}]" txt:- } - -#iwctl aliases -alias i='iwctl station wlan0' - -# change cpu power settings -gpulow() { - echo low | sudo tee /sys/class/drm/card0/device/power_dpm_force_performance_level -} -gpuauto() { - echo auto | sudo tee /sys/class/drm/card0/device/power_dpm_force_performance_level -} - -# monitor cpu freq -cpufreq() { watch -n 1 eval "cat /proc/cpuinfo | grep MHz" } - -# dotdrop -updatesecrets() { bash $DOTREPO/secrets/secrets.sh; chmod 600 $DOTREPO/secrets/secrets } -dotdrop() { source $DOTREPO/secrets/secrets && $DOTREPO/dotdrop.sh $@ } -sdotdrop() { source $DOTREPO/secrets/secrets && sudo -E $DOTREPO/dotdrop.sh --cfg=$DOTREPO/config-root.yaml $@ } -compdef _dotdrop-completion.zsh sdotdrop -alias dotgit='git -C $DOTREPO' -dotsync() { cd $DOTREPO && gpull && ga && gc && gpush && cd $OLDPWD } - - -# sync password manager -passync() { pass git pull && pass git push && updatesecrets } - -update() { - all() { - paru - plugins - {%@@ if profile == "Moria" @@%} - repo - docker-update - docker system prune --volumes - {%@@ endif @@%} - sudo flatpak update - sudo awman-update - } - - repo() { - aur sync -Su --margs --noconfirm - firefox - } - - firefox() { - aur sync -S --rebuild firefox-nightly --margs --noconfirm - } - - plugins() { - vim +PlugUpgrade +PlugUpdate +CocUpdate +qa - zinit self-update - zinit update -p - $HOME/.tmux/plugins/tpm/bin/update_plugins all - } - - docker-update() { - for dir in $HOME/git/dotfiles/docker/*; do - cd $dir - docker-compose pull - docker-compose up -d - cd .. - done - } - - if [ $# -eq 0 ]; then - 1=base - fi - - case "$1" in - all) - all - ;; - plugins) - plugins - ;; - docker) - docker-update - ;; - repo) - repo - ;; - firefox) - firefox - ;; - *) - paru - ;; - esac -} - -# remove unneeded packages -autoremove() { sudo pacman -Rns $(pacman -Qdtq) } - -# turn on usb tethering on my android phone -tether() { adb shell su -c "service call connectivity 33 i32 1 s16 me" > /dev/null } - -# update arch mirrorlist -alias reflect='sudo reflector --latest 200 --threads 8 --verbose --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist' - -# better ls -alias ls='ls_extended -Ih' - -# default icon for notify-send -alias notify-send='notify-send --icon=alarm' - -# download archiso -alias archiso='curl "http://mirror.rackspace.com/archlinux/iso/$(date +%Y.%m).01/archlinux-$(date +%Y.%m).01-x86_64.iso"' - -# Update repository - - -# encrypted tar's with zstd compression -cgpgtar() { tar cf - --zstd $1 | gpg -e -z 0 > $1.tar.zst.gpg } -xgpgtar() { gpg -d $1 | tar x --zstd } - -# colorise output -cvs() { grc cvs $@ } -df() { grc df $@ } -digg() { grc digg $@ } -gcc() { grc gcc $@ } -g++() { grc g++ $@ } -ifconfig() { grc ifconfig $@ } -make() { grc make $@ } -mount() { grc mount $@ } -mtr() { grc mtr $@ } -netstat() { grc mount $@ } -ping() { grc ping $@ } -ps() { grc ps $@ } -tail() { grc tail $@ } -traceroute() { grc traceroute $@ } -wdiff() { grc wdiff $@ } -blkid() { grc blkid $@ } -du() { grc du $@ } -dnf() { grc dnf $@ } -docker() { grc docker $@ } -docker-machine() { grc docker-machine $@ } -env() { grc env $@ } -id() { grc id $@ } -ip() { grc ip $@ } -iostat() { grc iostat $@ } -last() { grc last $@ } -lsattr() { grc lsattr $@ } -lsblk() { grc lsblk $@ } -lspci() { grc lspci $@ } -lsmod() { grc lsmod $@ } -lsof() { grc lsof $@ } -getfacl() { grc getfacl $@ } -getsebool() { grc getsebool $@ } -ulimit() { grc ulimit $@ } -uptime() { grc uptime $@ } -nmap() { grc nmap $@ } -fdisk() { grc fdisk $@ } -findmnt() { grc findmnt $@ } -free() { grc free $@ } -semanage() { grc semanage $@ } -sar() { grc sar $@ } -ss() { grc ss $@ } -sysctl() { grc sysctl $@ } -systemctl() { grc systemctl $@ } -stat() { grc stat $@ } -showmount() { grc showmount $@ } -tune2fs() { grc tune2fs $@ } -tcpdum() { grc tcpdum $@ } - -btw, () { - echo " I use" - echo " ▄ - ▟█▙ - ▟███▙ - ▟█████▙ - ▟███████▙ - ▂▔▀▜██████▙ - ▟██▅▂▝▜█████▙ - ▟█████████████▙ - ▟███████████████▙ - ▟█████████████████▙ - ▟███████████████████▙ - ▟█████████▛▀▀▜████████▙ - ▟████████▛ ▜███████▙ - ▟█████████ ████████▙ - ▟██████████ █████▆▅▄▃▂ - ▟██████████▛ ▜█████████▙ - ▟██████▀▀▀ ▀▀██████▙ - ▟███▀▘ ▝▀███▙ - ▟▛▀ ▀▜▙" -} diff --git a/home/.config/zsh/02-plugins.zsh b/home/.config/zsh/03-plugins.zsh similarity index 55% rename from home/.config/zsh/02-plugins.zsh rename to home/.config/zsh/03-plugins.zsh index 26b690b9..1712bf54 100644 --- a/home/.config/zsh/02-plugins.zsh +++ b/home/.config/zsh/03-plugins.zsh @@ -1,7 +1,7 @@ # install zinit if it's not already installed if [ ! -f ~/.zinit/bin/zinit.zsh ]; then - mkdir ~/.zinit - git clone https://github.com/zdharma/zinit.git ~/.zinit/bin + mkdir ~/.zinit + git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin fi source ~/.zinit/bin/zinit.zsh @@ -19,7 +19,7 @@ zinit ice lucid zinit light zsh-users/zsh-history-substring-search # fzf git awesomeness -zinit ice wait'1' lucid atload'source $HOME/.config/zsh/03-aliases.zsh' +zinit ice wait'1' lucid atload'source $HOME/.config/zsh/04-aliases.zsh' zinit light wfxr/forgit # lots of completions @@ -30,22 +30,13 @@ zinit light zsh-users/zsh-completions zinit ice wait'1' lucid as'completion' zinit snippet https://gist.githubusercontent.com/RPigott/a3efdc08fa4d5fd7df38d091ab5e8532/raw/867ac1884d97d1bd1e5d4037d4eefdf4a004e72b/_swaymsg -# dotdrop completion -zinit ice wait'1' lucid as'completion' -zinit snippet '$DOTREPO/dotdrop/completion/_dotdrop-completion.zsh' - -# docker-compose completion -zinit ice wait'1' lucid as'completion' -zinit snippet https://raw.githubusercontent.com/docker/compose/master/contrib/completion/zsh/_docker-compose - # syntax highlighting zinit ice lucid atinit'zpcompinit' -zinit light zdharma/fast-syntax-highlighting +zinit light zdharma-continuum/fast-syntax-highlighting # use fzf with zsh -{%@@ if profile == "mko-laptop" @@%} -source ~/.fzf.zsh -{%@@ else @@%} -source /usr/share/fzf/key-bindings.zsh -source /usr/share/fzf/completion.zsh -{%@@ endif @@%} +source <(fzf --zsh) + +# Generate completions at runtime +zinit ice wait'2' lucid +zinit light RobSis/zsh-completion-generator diff --git a/home/.config/zsh/04-aliases.zsh b/home/.config/zsh/04-aliases.zsh new file mode 100644 index 00000000..427e8a3d --- /dev/null +++ b/home/.config/zsh/04-aliases.zsh @@ -0,0 +1,408 @@ +# Fix sudo and doas not expanding aliases +# see: https://unix.stackexchange.com/questions/148545/why-does-sudo-ignore-aliases +alias sudo='sudo ' +alias doas='doas ' + +# git shorthands +alias gc='git commit' +alias gac='ga && gc' +alias gs='git status' +alias gpull='git pull' +alias gpush='git push' + +alias o='xdg-open' + +# Open nvim with diffview +# Handy plugin for viewing git diffs +# and handling merges +alias dv='nvim +DiffviewOpen' + +# Rename grc alias from forgit since it +# collides with the grc colorizer +forgit_revert_commit=fgrc + +# Modern replacement for ls +alias ls='eza --icons --git' + +# Enable command not found handler +{%@@ if distro_id == "arch" @@%} +source /usr/share/doc/pkgfile/command-not-found.zsh +{%@@ elif distro_id == "ubuntu" @@%} +source /etc/zsh_command_not_found +{%@@ elif distro_id == "termux" @@%} +function command_not_found_handler { + $PREFIX/libexec/termux/command-not-found $1 +} +{%@@ endif @@%} + +# search and install/remove packages with fzf +pi() { + {%@@ if distro_id == "arch" @@%} + SELECTED_PKGS="$(paru -Slq | fzf --header='Install packages' -m --preview 'paru -Si {1}' | tr '\n' ' ')" + {%@@ else @@%} + SELECTED_PKGS="$(apt list 2>/dev/null | cut -d '/' -f 1 | tail +2 | fzf --header='Install packages' -m --preview 'apt show 2>/dev/null {1}' | tr '\n' ' ')" + {%@@ endif @@%} + if [ -n "$SELECTED_PKGS" ]; then + {%@@ if distro_id == "arch" @@%} + cmd="paru -S $SELECTED_PKGS" + {%@@ elif distro_id == "ubuntu" or distro_id == "debian" @@%} + cmd="doas apt install $SELECTED_PKGS" + {%@@ elif distro_id == "termux" @@%} + cmd="apt install $SELECTED_PKGS" + {%@@ endif @@%} + + # Append the expanded command to history + print -s "$cmd" + + # Finally, excecute the command + eval "$cmd" + fi +} + +mkcd() { + mkdir -p $1 + cd $1 +} + +pr() { + {%@@ if distro_id == "arch" @@%} + SELECTED_PKGS="$(paru -Qsq | fzf --header='Remove packages' -m --preview 'paru -Qi {1}' | tr '\n' ' ')" + {%@@ else @@%} + SELECTED_PKGS="$(apt list --installed 2>/dev/null | cut -d '/' -f 1 | tail +2 | fzf --header='Remove packages' -m --preview 'apt show 2>/dev/null {1}' | tr '\n' ' ')" + {%@@ endif @@%} + if [ -n "$SELECTED_PKGS" ]; then + {%@@ if distro_id == "arch" @@%} + cmd="paru -Rns $SELECTED_PKGS" + {%@@ elif distro_id == "ubuntu" or distro_id == "debian" @@%} + cmd="doas apt remove $SELECTED_PKGS" + {%@@ elif distro_id == "termux" @@%} + cmd="apt remove $SELECTED_PKGS" + {%@@ endif @@%} + + # Append the expanded command to history + print -s "$cmd" + + # Finally, excecute the command + eval "$cmd" + fi +} + +{%@@ if profile == "Moria" @@%} +# Add packages to repo with fzf +ra() { + SELECTED_PKGS="$(paru -Slqa | fzf --header='Add packages to repo' -m --preview 'paru -Si {1}' | tr '\n' ' ')" + if [ -n "$SELECTED_PKGS" ]; then + cmd="aur sync -S $SELECTED_PKGS" + + # Append the expanded command to history + print -s "$cmd" + + # Finally, excecute the command + eval "$cmd" + fi +} +{%@@ endif @@%} + +{%@@ if distro_id == "termux" @@%} +alias gp='okc-gpg' +{%@@ endif @@%} + +# find and open man pages with fzf +fman() { + man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man +} + +alias :q='cowsay "You are not in vim anymore"' + +alias reboot-kodi='systemctl reboot --boot-loader-entry=kodi.conf' + +# zbar output only data +alias zbarimg='zbarimg -q --raw' +alias zbarcam='zbarcam -q --raw' + +# shorten systemctl and journalctl +alias sc='systemctl' +alias scu='systemctl --user' +alias jc='journalctl' +alias jcu='journalctl --user' + +# switch to desktop mode +alias dock='swaymsg output eDP-1 disable' + +{%@@ if distro_id != "termux" @@%} +# move to trash instead of remove +alias rm='trash' +{%@@ endif @@%} + +# clean stuff +clean() { + DFCMD="df -h / | tail -n 1 | cut -d' ' -f8- | cut -d' ' -f1 | sed 's/[^0-9]*//g'" + SPACEBEFORE=$(eval "$DFCMD") + trash-empty 10 + doas journalctl --vacuum-size=500M + paru -Sc + SPACEAFTER=$(eval "$DFCMD") + echo "Saved $(calc $SPACEAFTER - $SPACEBEFORE)G of space" +} + +# connect to wireguard +alias startvpn='doas systemctl start wg-quick@wg0.service' +alias stopvpn='doas systemctl stop wg-quick@wg0.service' + +# read qrcode from selection +qr() { + gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.screenshotUI.open();' 2>&1 > /dev/null && wl-paste | zbarimg -q --raw PNG:- +} + +# generate qr code in terminal +alias qrencode='qrencode -t ansiutf8' + +# color picker +cpick() { grim -g "$(slurp -p)" -t ppm - | convert - -format "%[pixel:p{0,0}]" txt:- } + +#iwctl aliases +alias i='iwctl station wlan0' + +# monitor cpu freq +cpufreq() { watch -n 1 eval "cat /proc/cpuinfo | grep MHz" } + +# dotdrop +alias dotdrop="source $DOTREPO/secrets/secrets && {%@@ if distro_id != "termux" @@%} UID=$(id -u) {%@@ endif @@%} dotdrop --cfg=$DOTREPO/config.toml {%@@ if profile == "Isengard" @@%} -p Isengard{%@@ endif @@%}" + + +alias sdotdrop="source $DOTREPO/secrets/secrets && sudo -E dotdrop --cfg=$DOTREPO/config-root.toml" +compdef _dotdrop-completion.zsh sdotdrop + +updatesecrets() { + bash $DOTREPO/secrets/secrets.sh + chmod 600 $DOTREPO/secrets/secrets +} + +alias dotgit='git -C $DOTREPO' +dotsync() { cd $DOTREPO && gac && gpull && gpush && cd $OLDPWD } + +# sync password manager +passync() { pass git pull && pass git push && updatesecrets } + +update() { + all() { + dotfiles + packages + {%@@ if profile == "Moria" @@%} + repo + docker-update + {%@@ endif @@%} + plugins + } + + packages() { + {%@@ if distro_id == "arch" @@%} + paru -Syu --noconfirm + {%@@ elif distro_id == "ubuntu" or distro_id == "debian" @@%} + doas apt update && doas apt full-upgrade -y && doas apt autoremove -y && doas apt autoclean -y + {%@@ elif distro_id == "termux" @@%} + pkg update && pkg upgrade --yes + {%@@ endif @@%} + {%@@ if distro_id == "termux" @@%} + pip-update-installed + cargo-update-installed + {%@@ endif @@%} + } + + plugins() { + echo "Updating NeoVim plugins to match lockfiles" + nvim --headless -c "Lazy! restore" -c 'TSUpdateSync' -c 'MasonLockRestore' -c 'qa' + echo "Updating zsh plugins" + zinit self-update + zinit update -p + } + + pip-update-installed() { + pip install --upgrade $(pip list --outdated | tail -n +3 | awk '{print $1}') + } + + cargo-update-installed() { + cargo install-update -a + } + + {%@@ if profile == "Moria" @@%} + repo() { + aur sync -Su --margs --noconfirm + } + + local docker-update() { + prevpwddocker=$PWD + for dir in $HOME/git/dotfiles/docker/*/; do + cd $dir + if [[ -f ./DISABLED ]]; then + echo "$(basename $dir) stack is disabled, skipping..." + else + docker compose pull + docker compose up -d + fi + cd .. + done + cd $prevpwddocker + docker system prune -af --volumes + + occ upgrade + occ app:update --all + occ db:add-missing-indices + } + {%@@ endif @@%} + + dotfiles() { + dotgit pull + dotdrop install + } + + if [ $# -eq 0 ]; then + packages # Update only packages if no option was provided + else + case "$1" in + all) + all + ;; + dotfiles) + dotfiles + ;; + plugins) + plugins + ;; + {%@@ if profile == "Moria" @@%} + docker) + docker-update + ;; + repo) + repo + ;; + {%@@ endif @@%} + *) + echo "Unknown option: $1" + return 1 + ;; + esac + fi +} + +_update() { + local commands=( + "all:Update everything" + "dotfiles:Update dotfiles" + "plugins:Update plugins for NeoVim and ZSH" + {%@@ if profile == "Moria" @@%} + "repo:Update packages in Korhonen AUR repository" + "docker:Update all Docker containers" + {%@@ endif @@%} + ) + + _arguments \ + '1: :->command' \ + '*:: :->args' + + case "$state" in + (command) + _describe -t commands 'available commands' commands + ;; + esac +} +compdef _update update + +# turn on usb tethering on my android phone +tether() { adb shell su -c "service call connectivity 33 i32 1 s16 me" > /dev/null } + +# update arch mirrorlist +alias reflect='doas reflector --latest 200 --threads 8 --verbose --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist' + +# default icon for notify-send +alias notify-send='notify-send --icon=alarm' + +# download archiso +alias archiso='curl "http://mirror.rackspace.com/archlinux/iso/$(date +%Y.%m).01/archlinux-$(date +%Y.%m).01-x86_64.iso"' + +# encrypted tar's with zstd compression +cgpgtar() { tar cf - --zstd $1 | gpg -e -z 0 > $1.tar.zst.gpg } +xgpgtar() { gpg -d $1 | tar x --zstd } + +# Switch to different yubikey +alias switch-yubikey='gpg-connect-agent "scd serialno" "learn --force" /bye' + +btw, () { + echo " I use" + echo " ▄ + ▟█▙ + ▟███▙ + ▟█████▙ + ▟███████▙ + ▂▔▀▜██████▙ + ▟██▅▂▝▜█████▙ + ▟█████████████▙ + ▟███████████████▙ + ▟█████████████████▙ + ▟███████████████████▙ + ▟█████████▛▀▀▜████████▙ + ▟████████▛ ▜███████▙ + ▟█████████ ████████▙ + ▟██████████ █████▆▅▄▃▂ + ▟██████████▛ ▜█████████▙ + ▟██████▀▀▀ ▀▀██████▙ + ▟███▀▘ ▝▀███▙ + ▟▛▀ ▀▜▙" +} + +# docker-compose with TOML +# dct() { +# local file_path=('./docker-compose.toml') +# +# zmodload zsh/zutil +# zparseopts -D -K -- \ +# f:=file_path || +# return 1 +# +# file_path=${file_path[-1]} +# +# if [[ ! -a "$file_path" ]]; then +# echo "File $file_path does not exist!" +# return 1 +# fi +# +# yj -ty < $file_path | docker compose -f /dev/stdin --env-file ./.env $@ +# } + +alias dslr-webcam='pkill -f gphoto2; gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0' + +clock() { + while true; do + printf '%s\r' "$(date)" + sleep 0.1 + done +} + +# Change file extension made easy +chext() { + file="$1" + new_ext="$2" + dest="${file%.*}.$new_ext" + + help() { + printf "Change file extension\nUsage: chext file new_extension\nFor example: chext my_script.sh zsh" + } + + if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + help + return + fi + + if [ $# -lt 2 ]; then + help + return 1 + fi + + if [ ! -e "$1" ]; then + echo "$file: no such file or directory" + help + return 1 + fi + + mv "$file" "$dest" +} diff --git a/home/.config/zsh/05-misc.zsh b/home/.config/zsh/05-misc.zsh deleted file mode 100644 index 10ddf01d..00000000 --- a/home/.config/zsh/05-misc.zsh +++ /dev/null @@ -1,10 +0,0 @@ -# Launch tmux if logging in over ssh -if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then - tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux -fi - -# share history between running zsh instances -setopt share_history - -# ignore commands with leading space from history -setopt histignorespace diff --git a/home/.config/zsh/04-keybinds.zsh b/home/.config/zsh/06-keybinds.zsh similarity index 95% rename from home/.config/zsh/04-keybinds.zsh rename to home/.config/zsh/06-keybinds.zsh index 7f0c95d2..bea3d85a 100644 --- a/home/.config/zsh/04-keybinds.zsh +++ b/home/.config/zsh/06-keybinds.zsh @@ -44,3 +44,7 @@ bindkey -M vicmd e edit-command-line # bind delete in normal mode bindkey -M vicmd '^[[3~' delete-char + +# Rebind fzf to ctrl+f +bindkey '^F' fzf-file-widget +bindkey '^T' transpose-chars diff --git a/home/.config/zsh/06-pacman.zsh b/home/.config/zsh/06-pacman.zsh deleted file mode 100644 index 56ebbcea..00000000 --- a/home/.config/zsh/06-pacman.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# from https://wiki.archlinux.org/index.php/Zsh#On-demand_rehash -catch_signal_usr1() { - trap catch_signal_usr1 USR1 - rehash -} -trap catch_signal_usr1 USR1 diff --git a/home/.config/zsh/07-misc.zsh b/home/.config/zsh/07-misc.zsh new file mode 100644 index 00000000..7f84ba4d --- /dev/null +++ b/home/.config/zsh/07-misc.zsh @@ -0,0 +1,5 @@ +# share history between running zsh instances +setopt share_history + +# ignore commands with leading space from history +setopt histignorespace diff --git a/home/.config/zsh/08-pacman.zsh b/home/.config/zsh/08-pacman.zsh new file mode 100644 index 00000000..72077edd --- /dev/null +++ b/home/.config/zsh/08-pacman.zsh @@ -0,0 +1,17 @@ +# from https://wiki.archlinux.org/index.php/Zsh#On-demand_rehash + +zshcache_time="$(date +%s%N)" + +autoload -Uz add-zsh-hook + +rehash_precmd() { + if [[ -e /var/cache/zsh/pacman ]]; then + local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)" + if ((zshcache_time < paccache_time)); then + rehash + zshcache_time="$paccache_time" + fi + fi +} + +add-zsh-hook -Uz precmd rehash_precmd diff --git a/home/.docker/config.json b/home/.docker/config.json new file mode 100644 index 00000000..113ba69f --- /dev/null +++ b/home/.docker/config.json @@ -0,0 +1,3 @@ +{ + "credsStore": "pass" +} diff --git a/home/.gitconfig b/home/.gitconfig deleted file mode 100644 index 9734926e..00000000 --- a/home/.gitconfig +++ /dev/null @@ -1,31 +0,0 @@ -[user] - email = marko@korhonen.cc - name = Marko Korhonen - signingkey = C514037F1EFF4FA6 - -[commit] - signoff = true - gpgsign = true - -[tag] - gpgSign = true - signoff = true - -[format] - signoff = true - -[merge] - prompt = false - tool = nvim-merge -[mergetool "nvim-merge"] - cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J' - -[diff] - prompt = false - tool = nvim-diff - -[difftool "nvim-diff"] - cmd = nvim -d -c 'set nomodifiable' - -[pull] - rebase = false diff --git a/home/.gnupg/gpg-agent.conf b/home/.gnupg/gpg-agent.conf new file mode 100644 index 00000000..9e025a01 --- /dev/null +++ b/home/.gnupg/gpg-agent.conf @@ -0,0 +1,2 @@ +enable-ssh-support +pinentry-program /usr/bin/pinentry-gnome3 diff --git a/home/.gnupg/gpg.conf b/home/.gnupg/gpg.conf index 50a0191b..0a9596e7 100644 --- a/home/.gnupg/gpg.conf +++ b/home/.gnupg/gpg.conf @@ -1,17 +1,2 @@ -# File re-created by pEp -# See backup in '/home/reekymarko/.gnupg/gpg.conf.1.pep.bkp' - -# File re-created by pEp -# See backup in '/home/reekymarko/.gnupg/gpg.conf.0.pep.bkp' - -# GnuPG config file created by KGpg - -default-key A90767494C36DEC2EBBCFB8E83850D9D26A2216C -keyserver hkp://keys.gnupg.net -cert-digest-algo SHA256 -no-emit-version -no-comments -personal-cipher-preferences AES AES256 AES192 CAST5 -personal-digest-preferences SHA256 SHA512 SHA384 SHA224 -ignore-time-conflict -allow-freeform-uid +use-agent +keyserver hkps://keys.openpgp.org diff --git a/home/.gnupg/scdaemon.conf b/home/.gnupg/scdaemon.conf new file mode 100644 index 00000000..eb818ddf --- /dev/null +++ b/home/.gnupg/scdaemon.conf @@ -0,0 +1 @@ +disable-ccid diff --git a/home/.ignore b/home/.ignore index be7a2281..d1402308 100644 --- a/home/.ignore +++ b/home/.ignore @@ -7,7 +7,8 @@ .cache/ .cargo/ .rustup/ -.zplugin/ +.go/ +.zinit/ .config/nvim/plugged/ .local/share/Trash/ .bin/ @@ -15,3 +16,7 @@ .android/ .audacity-data/ .zcompdump* +.var/ +.npm/ +.vscode-oss/ +.git/ diff --git a/home/.librewolf/librewolf.overrides.cfg b/home/.librewolf/librewolf.overrides.cfg new file mode 100644 index 00000000..b05aac1e --- /dev/null +++ b/home/.librewolf/librewolf.overrides.cfg @@ -0,0 +1,48 @@ +// vim:ft=javascript + +// Enable Google safe browsing +pref("browser.safebrowsing.malware.enabled", true); +pref("browser.safebrowsing.phishing.enabled", true); +pref("browser.safebrowsing.blockedURIs.enabled", true); +pref( + "browser.safebrowsing.provider.google4.gethashURL", + "https://safebrowsing.googleapis.com/v4/fullHashes:find?$ct=application/x-protobuf&key=%GOOGLE_SAFEBROWSING_API_KEY%&$httpMethod=POST" +); +pref( + "browser.safebrowsing.provider.google4.updateURL", + "https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$ct=application/x-protobuf&key=%GOOGLE_SAFEBROWSING_API_KEY%&$httpMethod=POST" +); +pref( + "browser.safebrowsing.provider.google.gethashURL", + "https://safebrowsing.google.com/safebrowsing/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2" +); +pref( + "browser.safebrowsing.provider.google.updateURL", + "https://safebrowsing.google.com/safebrowsing/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2&key=%GOOGLE_SAFEBROWSING_API_KEY%" +); + +// Disable letterboxing +pref("privacy.resistFingerprinting.letterboxing", false); + +/* +* Disable RFP because I want automatic dark mode on websites +* that support it +*/ +pref("privacy.resistFingerprinting", false); + +pref("privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts", false); + +// Scan downloads for suspicious files +pref("browser.safebrowsing.downloads.enabled", true); + +// Disable WebGL +pref("webgl.disabled", false); + +// Enable Firefox Sync +pref("identity.fxaccounts.enabled", true); + +// Don't clear browsing history on shutdown +pref("privacy.clearOnShutdown.history", false); + +// Clear download history on shutdown +pref("privacy.clearOnShutdown.downloads", true); diff --git a/home/.npmrc b/home/.npmrc new file mode 100644 index 00000000..256f89fc --- /dev/null +++ b/home/.npmrc @@ -0,0 +1 @@ +prefix=~/.local/share/npm diff --git a/home/.pam_environment b/home/.pam_environment new file mode 100644 index 00000000..b55fba74 --- /dev/null +++ b/home/.pam_environment @@ -0,0 +1,2 @@ +SSH_AGENT_PID DEFAULT= +SSH_AUTH_SOCK DEFAULT="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh" diff --git a/home/.ssh/authorized_keys b/home/.ssh/authorized_keys index 03dfb898..9bd02835 100644 --- a/home/.ssh/authorized_keys +++ b/home/.ssh/authorized_keys @@ -1,2 +1 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDPIoTVXJ2gljf+Tpk7GdwAihhAlnyoblOWYiwFenKeomcYizLt8arEXNT+1Hr+jit7+Fg2Izv31ovo9M1ePyhzuO1jcuCOZkIPvcaN0c6XIH83ZiA04Ysd/HIGv1r7tDTxNnXeKfl55tWpd+F2A0BF3D3dIDBqDfX2Z2odXIjKXHoFBgETATl45bm0txpjTjbpjIiPbaRHg6+lcSnWm3f5p8lCzXs5MIGCdXcBxMhVVxszAI3CD/cEBmnweCam1Ji3J1qYna4BOrIyW5Z3HzS6vAkajxZd2wPU47gpoc3/2sXBwJeE/iOACECC+34rYqadZThprihpYc7D8gIDr7IDN16rvFfEcxE8SFvsPmM1Qbo7uH/F2TFF6mb0FzGQuTcdR4bqcms5jMsgqPGfEs6Rd1pkOXTcxwKOtbH27VYhSs/ow5TEbVHrbLwTU35ohIfZRqlKbrMv3CGgTNzj9MlN339x6G3//lnKR36i/W+Z4FPjT/KayhwbsNR1B5Mfdlr7tbmvFcI2KxvyD7Rr5XuouVTx98s3nlc2MJpII/Q/oX2tWPnYAK/myJC7ucY7G4Y/3uoCv2GYTi2flpEFJITSDPqzwrX19yYK2ooYyvg40Cd2mt4xu9sj4SyEMUu98CIfECT7dsaKVPfcjQqaRZb2Spr4tPfMrcUZYiZgJBPxWQ== cardno:000610127408 -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEvsd9UtWtqfG+vmx9ByEwQwKJlcelWwZlN4b4WG0al3 reekymarko@reekynet.com +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHLUrf0LpumX6XEkPW6Z105sgJMWWOllWy7sxB+lgdUw Marko YubiKey diff --git a/home/.ssh/config b/home/.ssh/config index b39bd8de..5ffe1d8c 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -1,47 +1,94 @@ -host gitea - HostName korhonen.cc - user git +Include ~/.ssh/netforecast_hosts -host gitlab - HostName gitlab.com - User git - -host github - HostName github.com - User git - -host bitbucket - HostName bitbucket.org - User git - -Host aur - HostName aur.archlinux.org - User aur +host * + IdentitiesOnly yes + IdentityFile ~/.ssh/id_ed25519_yubikey.pub + #ControlMaster auto + #ControlPersist 10m + #ControlPath ~/.ssh/%r@%h:%p.socket host moria - HostName korhonen.cc - port 221 - User balrog - ForwardAgent yes - RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra + HostName home.korhonen.cc + port 221 + User functionalhacker + {%@@ if distro_id != "termux" @@%} + # Forward GPG agent + StreamLocalBindUnlink yes + RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/{{@@ env['UID'] @@}}/gnupg/S.gpg-agent.extra + RemoteForward /run/user/1000/gnupg/S.gpg-agent.ssh /run/user/{{@@ env['UID'] @@}}/gnupg/S.gpg-agent.ssh + {%@@ endif @@%} + +host evendim + HostName evendim.korhonen.cc + port 22 + User functionalhacker + {%@@ if distro_id != "termux" @@%} + # Forward GPG agent + StreamLocalBindUnlink yes + RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/{{@@ env['UID'] @@}}/gnupg/S.gpg-agent.extra + RemoteForward /run/user/1000/gnupg/S.gpg-agent.ssh /run/user/{{@@ env['UID'] @@}}/gnupg/S.gpg-agent.ssh + {%@@ endif @@%} + +host beleriand + HostName beleriand.korhonen.lan + User root + +host esgaroth + HostName esgaroth.korhonen.lan + User root + +host rivendell + HostName rivendell.korhonen.lan + User root + +host forgejo + HostName git.korhonen.cc + port 2882 + user git + +host gitlab + HostName gitlab.com + User git + +host github + HostName github.com + User git + +host bitbucket + HostName bitbucket.org + User git + +Host aur + HostName aur.archlinux.org + User aur + +host moria-unlock + HostName home.korhonen.cc + port 221 + User root host gondor - hostname gondor.korhonen.cc - port 22 - User reekymarko - RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra + hostname tolkku.net + port 22 + User reekymarko + {%@@ if distro_id != "termux" @@%} + # Forward GPG agent + StreamLocalBindUnlink yes + RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/{{@@ env['UID'] @@}}/gnupg/S.gpg-agent.extra + RemoteForward /run/user/1000/gnupg/S.gpg-agent.ssh /run/user/{{@@ env['UID'] @@}}/gnupg/S.gpg-agent.ssh + {%@@ endif @@%} host anitta - HostName 10.200.200.4 - port 22 - user reekymarko + HostName 10.200.200.4 + port 22 + user reekymarko host takamaki - HostName 10.200.200.5 - port 22 - user reekymarko + HostName 10.200.200.5 + port 22 + user reekymarko host viirujateippi - HostName viirujateippi.fi - port 22 - user functionalhacker + HostName viirujateippi.fi + port 22 + user functionalhacker diff --git a/home/.ssh/id_ed25519_yubikey.pub b/home/.ssh/id_ed25519_yubikey.pub new file mode 100644 index 00000000..9bd02835 --- /dev/null +++ b/home/.ssh/id_ed25519_yubikey.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHLUrf0LpumX6XEkPW6Z105sgJMWWOllWy7sxB+lgdUw Marko YubiKey diff --git a/home/.tmux.conf b/home/.tmux.conf index 58b4a55a..585da95a 100644 --- a/home/.tmux.conf +++ b/home/.tmux.conf @@ -1,3 +1,6 @@ +# set shell +set -g default-shell /bin/zsh + # Change prefix to ctrl+a unbind C-b set -g prefix C-a @@ -12,3 +15,6 @@ set-option -ga terminal-overrides ",*256col*:Tc" # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run -b '~/.tmux/plugins/tpm/tpm' + +# Enable mouse +set -g mouse on diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..36e7515e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,803 @@ +{ + "name": "dotfiles", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "dotfiles", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "prettier": "^2.7.1", + "pretty-quick": "^3.1.3" + }, + "devDependencies": { + "husky": "^8.0.0" + } + }, + "node_modules/@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==" + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "engines": { + "node": ">=8" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "dependencies": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "engines": { + "node": ">=8.12.0" + } + }, + "node_modules/husky": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", + "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "dependencies": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pretty-quick": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.3.tgz", + "integrity": "sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA==", + "dependencies": { + "chalk": "^3.0.0", + "execa": "^4.0.0", + "find-up": "^4.1.0", + "ignore": "^5.1.4", + "mri": "^1.1.5", + "multimatch": "^4.0.0" + }, + "bin": { + "pretty-quick": "bin/pretty-quick.js" + }, + "engines": { + "node": ">=10.13" + }, + "peerDependencies": { + "prettier": ">=2.0.0" + } + }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + }, + "dependencies": { + "@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==" + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" + }, + "husky": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", + "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", + "dev": true + }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==" + }, + "multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + } + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==" + }, + "pretty-quick": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.3.tgz", + "integrity": "sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA==", + "requires": { + "chalk": "^3.0.0", + "execa": "^4.0.0", + "find-up": "^4.1.0", + "ignore": "^5.1.4", + "mri": "^1.1.5", + "multimatch": "^4.0.0" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..a75bf0a9 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/package.json", + "name": "dotfiles", + "version": "1.0.0", + "private": false, + "description": "FunctionalHacker’s dotfiles", + "scripts": { + "prepare": "husky install" + }, + "repository": { + "type": "git", + "url": "https://git.korhonen.cc/FunctionalHacker/dotfiles" + }, + "author": "", + "license": "MIT", + "devDependencies": { + "husky": "^8.0.0" + }, + "dependencies": { + "prettier": "^2.7.1", + "pretty-quick": "^3.1.3" + } +} diff --git a/pkglist b/pkglist deleted file mode 100644 index 054861e7..00000000 --- a/pkglist +++ /dev/null @@ -1,187 +0,0 @@ -aic94xx-firmware -alacritty -alacritty-terminfo -alsa-utils -amd-ucode -asciiquarium -autoconf -automake -bash -bash-language-server -binutils -bison -blueberry -bluez-utils -bzip2 -ccid -chromium -clipman -clutter -coreutils -cpupower -cryptsetup -device-mapper -dhcpcd -diffutils -discord -dmenu -dolphin -drill-search-cli -e2fsprogs -evolution -evolution-decsync -fakeroot -ffmpeg-amd-full-git -file -file-roller -filesystem -findutils -firefox-nightly -fmui-git -fzf -gawk -gcc -gcc-libs -gettext -git -glibc -gnome-keyring -gotop-bin -grep -grim -gzip -imv -inetutils -iproute2 -iputils -iwd -jfsutils -kdeconnect -kdenlive -kodi-wayland -less -lib32-libva-mesa-driver -lib32-mesa -lib32-vulkan-radeon -libva-mesa-driver -licenses -light -linux -linux-firmware -locale-en_xx -logrotate -ls_extended -lvm2 -lxappearance -make -mako -man-db -man-pages -matcha-gtk-theme -mdadm -mimeo -mkinitcpio-welcomemessage -mpd -mpdris2-py3-git -mpdscribble -mpv-acestream -mpv-amd-full-git -mpv-mpris -mumble -nano -nautilus -ncmpcpp -neofetch -neovim -netctl -nodejs -noto-fonts -numix-icon-theme-git -opensc -openssh -otf-overpass -pacman -pacserve -pass-otp -pass-wl-clipboard -passdmenu -patch -pavucontrol -pciutils -perl -pkgconf -playerctl -polkit-gnome -powertop -procps-ng -psmisc -pulseaudio-ctl -python-docopt -python-jinja -python-ruamel-yaml -qt5-styleplugins -qt5-wayland -qt5ct -ranger -redshift-wlr-gamma-control -reflector -reiserfsprogs -ripgrep -rofi-pass -rtv -ryzenadj-git -s-nail -sed -shadow -sl -slurp -socat -steam -steam-native-runtime -sudo -sway -swaybg -swayidle -swaylock-effects-git -syncthing -syncthing-gtk -sysfsutils -systemd-boot-pacman-hook -systemd-resolvconf -systemd-sysvcompat -tar -telegram-desktop -texinfo -thefuck -tlp -tmux -trash-cli -ttf-dejavu -ttf-font-awesome -ttf-mac-fonts -ttf-nerd-fonts-hack-complete-git -usbutils -util-linux -vi -vulkan-radeon -w3m -waybar-git -wayland -wd719x-firmware -wf-recorder-git -wget -which -wl-clipboard-git -wl-clipboard-x11 -xcursor-breeze -xdg-utils-mimeo -xf86-video-amdgpu -xfsprogs -xorg-server-xwayland -xorg-xeyes -yarn -yay-bin -ydotool-git -youtube-dl -zathura-pdf-mupdf -zsh diff --git a/root/boot/loader/README.md b/root/boot/loader/README.md deleted file mode 100644 index f0138427..00000000 --- a/root/boot/loader/README.md +++ /dev/null @@ -1,2 +0,0 @@ -I don't use systemd-boot on my main system anymore but this is here for reference -when I'm setting up new systems. diff --git a/root/boot/loader/entries/arch-busybox.conf b/root/boot/loader/entries/arch-busybox.conf deleted file mode 100755 index db073af3..00000000 --- a/root/boot/loader/entries/arch-busybox.conf +++ /dev/null @@ -1,5 +0,0 @@ -title Arch Linux -initrd /amd-ucode.img -initrd /initramfs-linux.img -linux /vmlinuz-linux -options cryptdevice=UUID=19fa8fab-c5fe-454a-9a17-b7185ce975ea:cryptroot:allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root resume=/dev/mapper/cryptroot resume_offset=10530935 rw quiet splash vga=current idle=nomwait cpuidle.governor=teo diff --git a/root/boot/loader/entries/arch-systemd.conf b/root/boot/loader/entries/arch-systemd.conf deleted file mode 100755 index 3592520f..00000000 --- a/root/boot/loader/entries/arch-systemd.conf +++ /dev/null @@ -1,5 +0,0 @@ -title Arch Linux -initrd /amd-ucode.img -initrd /initramfs-linux.img -linux /vmlinuz-linux -options rd.luks.uuid=19fa8fab-c5fe-454a-9a17-b7185ce975ea rd.luks.name=19fa8fab-c5fe-454a-9a17-b7185ce975ea=cryptroot rd.luks.options=allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root resume=/dev/mapper/cryptroot resume_offset=10530935 rw quiet splash vga=current idle=nomwait cpuidle.governor=teo diff --git a/root/boot/loader/loader.conf b/root/boot/loader/loader.conf deleted file mode 100755 index 62bce553..00000000 --- a/root/boot/loader/loader.conf +++ /dev/null @@ -1,3 +0,0 @@ -default arch-busybox -timeout 0 -editor 0 diff --git a/root/etc/bluetooth/main.conf b/root/etc/bluetooth/main.conf index ee4a1c5f..750103f8 100755 --- a/root/etc/bluetooth/main.conf +++ b/root/etc/bluetooth/main.conf @@ -1,107 +1,6 @@ [General] -# Default adapter name -# Defaults to 'BlueZ X.YZ' -#Name = BlueZ - -# Default device class. Only the major and minor device class bits are -# considered. Defaults to '0x000000'. -#Class = 0x000100 - -# How long to stay in discoverable mode before going back to non-discoverable -# The value is in seconds. Default is 180, i.e. 3 minutes. -# 0 = disable timer, i.e. stay discoverable forever -#DiscoverableTimeout = 0 - -# How long to stay in pairable mode before going back to non-discoverable -# The value is in seconds. Default is 0. -# 0 = disable timer, i.e. stay pairable forever -#PairableTimeout = 0 - -# Use vendor id source (assigner), vendor, product and version information for -# DID profile support. The values are separated by ":" and assigner, VID, PID -# and version. -# Possible vendor id source values: bluetooth, usb (defaults to usb) -#DeviceID = bluetooth:1234:5678:abcd - -# Do reverse service discovery for previously unknown devices that connect to -# us. This option is really only needed for qualification since the BITE tester -# doesn't like us doing reverse SDP for some test cases (though there could in -# theory be other useful purposes for this too). Defaults to 'true'. -#ReverseServiceDiscovery = true - -# Enable name resolving after inquiry. Set it to 'false' if you don't need -# remote devices name and want shorter discovery cycle. Defaults to 'true'. -#NameResolving = true - -# Enable runtime persistency of debug link keys. Default is false which -# makes debug link keys valid only for the duration of the connection -# that they were created for. -#DebugKeys = false - -# Restricts all controllers to the specified transport. Default value -# is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW). -# Possible values: "dual", "bredr", "le" -#ControllerMode = dual - -# Enables Multi Profile Specification support. This allows to specify if -# system supports only Multiple Profiles Single Device (MPSD) configuration -# or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple -# Devices (MPMD) configurations. -# Possible values: "off", "single", "multiple" -#MultiProfile = off - -# Permanently enables the Fast Connectable setting for adapters that -# support it. When enabled other devices can connect faster to us, -# however the tradeoff is increased power consumptions. This feature -# will fully work only on kernel version 4.1 and newer. Defaults to -# 'false'. -#FastConnectable = false - -# Default privacy setting. -# Enables use of private address. -# Possible values: "off", "device", "network" -# "network" option not supported currently -# Defaults to "off" -# Privacy = off - [GATT] -# GATT attribute cache. -# Possible values: -# always: Always cache attributes even for devices not paired, this is -# recommended as it is best for interoperability, with more consistent -# reconnection times and enables proper tracking of notifications for all -# devices. -# yes: Only cache attributes of paired devices. -# no: Never cache attributes -# Default: always -#Cache = always - -# Minimum required Encryption Key Size for accessing secured characteristics. -# Possible values: 0 and 7-16. 0 means don't care. -# Defaults to 0 -# MinEncKeySize = 0 [Policy] -# -# The ReconnectUUIDs defines the set of remote services that should try -# to be reconnected to in case of a link loss (link supervision -# timeout). The policy plugin should contain a sane set of values by -# default, but this list can be overridden here. By setting the list to -# empty the reconnection feature gets disabled. -#ReconnectUUIDs=00001112-0000-1000-8000-00805f9b34fb,0000111f-0000-1000-8000-00805f9b34fb,0000110a-0000-1000-8000-00805f9b34fb - -# ReconnectAttempts define the number of attempts to reconnect after a link -# lost. Setting the value to 0 disables reconnecting feature. -#ReconnectAttempts=7 - -# ReconnectIntervals define the set of intervals in seconds to use in between -# attempts. -# If the number of attempts defined in ReconnectAttempts is bigger than the -# set of intervals the last interval is repeated until the last attempt. -#ReconnectIntervals=1,2,4,8,16,32,64 - -# AutoEnable defines option to enable all controllers when they are found. -# This includes adapters present on start as well as adapters that are plugged -# in later on. Defaults to 'false'. AutoEnable=true diff --git a/root/etc/clamav/detected.sh b/root/etc/clamav/detected.sh index 6f3f1f9c..4d15efce 100755 --- a/root/etc/clamav/detected.sh +++ b/root/etc/clamav/detected.sh @@ -5,22 +5,22 @@ alert="Signature detected: $CLAM_VIRUSEVENT_VIRUSNAME in $CLAM_VIRUSEVENT_FILENA # Send the alert to systemd logger if exist, othewise to /var/log if [[ -z $(command -v systemd-cat) ]]; then - echo "$(date) - $alert" >> /var/log/clamav/infected.log + echo "$(date) - $alert" >>/var/log/clamav/infected.log else - # as "emerg", this could cause your DE to show a visual alert. Happen in Plasma. but the next visual alert is much nicer - echo "$alert" | /usr/bin/systemd-cat -t clamav -p emerg + # as "emerg", this could cause your DE to show a visual alert. Happen in Plasma. but the next visual alert is much nicer + echo "$alert" | /usr/bin/systemd-cat -t clamav -p emerg fi #send an alrt to all graphical user -XUSERS=($(who|awk '{print $1}'|sort -u)) +XUSERS=($(who | awk '{print $1}' | sort -u)) for XUSER in $XUSERS; do - NAME=(${XUSER/(/ }) - DISPLAY=${NAME[1]/)/} - DBUS_ADDRESS=unix:path=/run/user/$(id -u ${NAME[0]})/bus - echo "run $NAME - $DISPLAY - $DBUS_ADDRESS -" >> /tmp/testlog - /usr/bin/sudo -u ${NAME[0]} DISPLAY=${DISPLAY} \ - DBUS_SESSION_BUS_ADDRESS=${DBUS_ADDRESS} \ - PATH=${PATH} \ - /usr/bin/notify-send -i dialog-warning "clamAV" "$alert" + NAME=(${XUSER/(/ }) + DISPLAY=${NAME[1]/)/} + DBUS_ADDRESS=unix:path=/run/user/$(id -u ${NAME[0]})/bus + echo "run $NAME - $DISPLAY - $DBUS_ADDRESS -" >>/tmp/testlog + /usr/bin/sudo -u ${NAME[0]} DISPLAY=${DISPLAY} \ + DBUS_SESSION_BUS_ADDRESS=${DBUS_ADDRESS} \ + PATH=${PATH} \ + /usr/bin/notify-send -i dialog-warning "clamAV" "$alert" done diff --git a/root/etc/cryptissue b/root/etc/cryptissue index 3c9154a1..ff9f538e 100755 --- a/root/etc/cryptissue +++ b/root/etc/cryptissue @@ -47,3 +47,4 @@ Please return it to me! Below are my contact details Name: {{@@ env['ME_FULLNAME'] @@}} Address: {{@@ env['ME_ADDRESS'] @@}} Phone: {{@@ env['ME_PHONE'] @@}} +Email: {{@@ env['ME_EMAIL'] @@}} diff --git a/root/etc/default/cpupower b/root/etc/default/cpupower index 98c1cb2f..7786ac77 100644 --- a/root/etc/default/cpupower +++ b/root/etc/default/cpupower @@ -1,2 +1,6 @@ # vim:set ts=2 sw=2 ft=sh et: -governor='powersave' +{%@@ if profile == "Mirkwood" @@%} +governor='schedutil' +{%@@ else @@%} +governor='performance' +{%@@ endif @@%} diff --git a/root/etc/doas.conf b/root/etc/doas.conf new file mode 100644 index 00000000..cb547a49 --- /dev/null +++ b/root/etc/doas.conf @@ -0,0 +1,7 @@ +{%@@ if distro_id == "arch" @@%} +permit persist :wheel +permit nopass :wheel as root cmd pacman +{%@@ else @@%} +permit persist :sudo +permit nopass :sudo as root cmd apt +{%@@ endif @@%} diff --git a/root/etc/flexo/flexo.toml b/root/etc/flexo/flexo.toml new file mode 100644 index 00000000..07ec1138 --- /dev/null +++ b/root/etc/flexo/flexo.toml @@ -0,0 +1,26 @@ +cache_directory = "/var/cache/flexo/pkg" +connect_timeout = 3000 +mirrorlist_fallback_file = "/var/cache/flexo/state/mirrorlist" +mirrorlist_latency_test_results_file = "/var/cache/flexo/state/latency_test_results.json" +listen_ip_address = "0.0.0.0" +port = 7878 +mirror_selection_method = "auto" +mirrors_predefined = [] +num_versions_retain = 3 + +[mirrors_auto] + +mirrors_status_json_endpoint = "https://archlinux.org/mirrors/status/json/" +mirrors_status_json_endpoint_fallbacks = [ + "https://raw.githubusercontent.com/nroi/archlinux-mirrors-status-fallback/main/mirrorlist.json", +] +mirrors_blacklist = [] +https_required = true +ipv4 = true +ipv6 = false +max_score = 2.5 +num_mirrors = 8 +mirrors_random_or_sort = "sort" +timeout = 350 +refresh_latency_tests_after = "8 days" +allowed_countries = [] diff --git a/root/etc/kernel/cmdline b/root/etc/kernel/cmdline new file mode 100644 index 00000000..b38c85c5 --- /dev/null +++ b/root/etc/kernel/cmdline @@ -0,0 +1,9 @@ +{%@@ if profile == "Mirkwood" @@%} +cryptdevice=UUID=ddc8cabe-f726-4287-8407-3a0323ec6037:cryptroot:allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root resume=/dev/mapper/cryptroot resume_offset=18529853 rw quiet splash vt.global_cursor_default=0 fbcon=nodefer log_level=3 udev.log_level=3 +{%@@ elif profile == "Moria" @@%} +cryptdevice=UUID=51115cf2-6a44-4f8c-8aa2-ff9d834953d8:cryptroot:allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root ip=:::::eth0:dhcp netconf_timeout=60 rw quiet splash vt.global_cursor_default=0 fbcon=nodefer log_level=3 udev.log_level=3 +{%@@ elif profile == "Shire" @@%} +cryptdevice=UUID=8898d32c-d150-4258-ad0f-96b5afca4718:cryptroot root=/dev/mapper/cryptroot rootflags=subvol=root resume_offset=2106624 intel_idle.max_cstate=1 rw quiet splash vt.global_cursor_default=0 fbcon=nodefer log_level=3 udev.log_level=3 +{%@@ elif profile == "VentoyArch" @@%} +cryptdevice=UUID=d43414f3-37e9-4f35-9d3c-2f85c36c0034:cryptroot:allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root rw quiet splash vt.global_cursor_default=0 fbcon=nodefer log_level=3 udev.log_level=3 +{%@@ endif @@%} diff --git a/root/etc/locale.gen b/root/etc/locale.gen index 91085b8d..062fc4cf 100755 --- a/root/etc/locale.gen +++ b/root/etc/locale.gen @@ -1,2 +1,4 @@ en_US.UTF-8 UTF-8 en_XX.UTF-8@POSIX UTF-8 +fi_FI.UTF-8 UTF-8 +th_TH.UTF-8 UTF-8 diff --git a/root/etc/mkinitcpio.conf b/root/etc/mkinitcpio.conf index 54c22309..9fec8d14 100644 --- a/root/etc/mkinitcpio.conf +++ b/root/etc/mkinitcpio.conf @@ -1,12 +1,22 @@ COMPRESSION="zstd" +{%@@ if profile == "Mirkwood" or profile == "Moria" @@%} MODULES=(amdgpu) +{%@@ elif profile == "Shire" @@%} +MODULES=(i915 hid-multitouch i2c-hid i2c-hid-acpi hid_generic) +{%@@ endif @@%} +{%@@ if profile == "Mirkwood" or profile == "Moria" @@%} +BINARIES=("/usr/bin/btrfs") +{%@@ else @@%} +BINARIES=() +{%@@ endif @@%} FILES=() {%@@ if profile == "Mirkwood" @@%} -BINARIES=("/usr/bin/btrfs") -HOOKS=(colors consolefont welcomemessage base udev autodetect modconf block filesystems btrfs keyboard encrypt fsck) - -{%@@ else @@%} -BINARIES=() -HOOKS=(colors consolefont base udev autodetect modconf block filesystems keyboard fsck) +HOOKS=(base udev kms plymouth keyboard autodetect microcode modconf block filesystems btrfs encrypt resume fsck) +{%@@ elif profile == 'Moria' @@%} +HOOKS=(base udev kms keyboard autodetect microcode modconf block netconf dropbear encryptssh filesystems btrfs fsck) +{%@@ elif profile == 'Shire' @@%} +HOOKS=(base udev kms keyboard keymap autodetect microcode modconf block bluetooth unl0kr encrypt plymouth filesystems resume fsck) +{%@@ elif profile == "VentoyArch" @@%} +HOOKS=(base udev kms plymouth keyboard autodetect microcode modconf block ventoy filesystems btrfs encrypt resume fsck) {%@@ endif @@%} diff --git a/root/etc/mkinitcpio.d/linux-lts.preset b/root/etc/mkinitcpio.d/linux-lts.preset new file mode 100644 index 00000000..3957588c --- /dev/null +++ b/root/etc/mkinitcpio.d/linux-lts.preset @@ -0,0 +1,7 @@ +PRESETS=('default') + +ALL_config="/etc/mkinitcpio.conf" +ALL_kver="/boot/vmlinuz-linux-lts" + +default_image="/boot/initramfs-linux-lts.img" +default_uki="/boot/EFI/Linux/archlinux-linux-lts.efi" diff --git a/root/etc/mkinitcpio.d/linux.preset b/root/etc/mkinitcpio.d/linux.preset new file mode 100644 index 00000000..f7b29ac9 --- /dev/null +++ b/root/etc/mkinitcpio.d/linux.preset @@ -0,0 +1,7 @@ +PRESETS=('default') + +ALL_config="/etc/mkinitcpio.conf" +ALL_kver="/boot/vmlinuz-linux" + +default_image="/boot/initramfs-linux.img" +default_uki="/boot/EFI/Linux/archlinux-linux.efi" diff --git a/root/etc/pacman.conf b/root/etc/pacman.conf index 01d8a2a7..df0355eb 100755 --- a/root/etc/pacman.conf +++ b/root/etc/pacman.conf @@ -2,7 +2,7 @@ ILoveCandy Color CheckSpace -TotalDownload +ParallelDownloads = 5 HoldPkg = pacman glibc SigLevel = Required DatabaseOptional Architecture = auto @@ -10,15 +10,7 @@ LocalFileSigLevel = Optional CacheDir = /var/cache/pacman/pkg {%@@ if profile == "Moria" @@%} CleanMethod=KeepCurrent -CacheDir=/docker/index.korhonen.cc/repo/arch_linux/korhonen_aur/x86_64 -{%@@ endif @@%} - -[korhonen_aur] -{%@@ if profile == "Moria" @@%} -Server = file:///docker/index.korhonen.cc/repo/arch_linux/$repo/$arch -{%@@ else @@%} -Include = /etc/pacman.d/pacserve -Server = https://index.korhonen.cc/repo/arch_linux/$repo/$arch +CacheDir= /var/www/index.korhonen.cc/repo/arch_linux/korhonen_aur/x86_64 {%@@ endif @@%} [core] @@ -29,10 +21,14 @@ Include = /etc/pacman.d/mirrorlist Include = /etc/pacman.d/pacserve Include = /etc/pacman.d/mirrorlist -[community] -Include = /etc/pacman.d/pacserve -Include = /etc/pacman.d/mirrorlist - [multilib] Include = /etc/pacman.d/pacserve Include = /etc/pacman.d/mirrorlist + +[korhonen_aur] +{%@@ if profile == "Moria" @@%} +Server = file:///var/www/index.korhonen.cc/repo/arch_linux/$repo/$arch +{%@@ else @@%} +Include = /etc/pacman.d/pacserve +Server = http://index.korhonen.cc/repo/arch_linux/$repo/$arch +{%@@ endif @@%} diff --git a/root/etc/pacman.d/hooks/zsh.hook b/root/etc/pacman.d/hooks/zsh.hook index 4c3881c0..567e8b83 100644 --- a/root/etc/pacman.d/hooks/zsh.hook +++ b/root/etc/pacman.d/hooks/zsh.hook @@ -2,11 +2,10 @@ Operation = Install Operation = Upgrade Operation = Remove -Type = Package +Type = Path Target = usr/bin/* [Action] Depends = zsh -Depends = procps-ng When = PostTransaction -Exec = /usr/bin/pkill zsh --signal=USR1 +Exec = /usr/bin/install -Dm644 /dev/null /var/cache/zsh/pacman diff --git a/root/etc/pacserve/pacserve.service.conf b/root/etc/pacserve/pacserve.service.conf index 262805ff..a983b4c5 100755 --- a/root/etc/pacserve/pacserve.service.conf +++ b/root/etc/pacserve/pacserve.service.conf @@ -1 +1 @@ -PACSERVE_ARGS="--multicast" +PACSERVE_ARGS="--multicast --avahi" diff --git a/root/etc/plymouth/plymouthd.conf b/root/etc/plymouth/plymouthd.conf new file mode 100644 index 00000000..dffebeca --- /dev/null +++ b/root/etc/plymouth/plymouthd.conf @@ -0,0 +1,7 @@ +[Daemon] +Theme=arch-charge-gdm-spinner +ShowDelay=0 +DeviceTimeout=8 +{%@@ if profile == "Moria" @@%} +DeviceScale=2 +{%@@ endif @@%} diff --git a/root/etc/ssh/sshd_config b/root/etc/ssh/sshd_config index 7d7d5278..9cecff1e 100644 --- a/root/etc/ssh/sshd_config +++ b/root/etc/ssh/sshd_config @@ -1,11 +1,14 @@ # Remove socket for gpg agent forwarding StreamLocalBindUnlink yes +{%@@ if profile == "Moria" @@%} +Port 221 +{%@@ endif @@%} X11Forwarding yes -AuthorizedKeysFile .ssh/authorized_keys +AuthorizedKeysFile .ssh/authorized_keys PasswordAuthentication no PermitRootLogin no ChallengeResponseAuthentication no UsePAM yes PrintMotd no # pam does that -Subsystem sftp /usr/lib/ssh/sftp-server +Subsystem sftp /usr/lib/ssh/sftp-server diff --git a/root/etc/sudoers.d/pacman b/root/etc/sudoers.d/pacman new file mode 100644 index 00000000..12be60e1 --- /dev/null +++ b/root/etc/sudoers.d/pacman @@ -0,0 +1 @@ +%wheel ALL = (root) NOPASSWD: /usr/bin/pacman diff --git a/root/etc/systemd/system/getty@tty1.service.d/override.conf b/root/etc/systemd/system/getty@tty1.service.d/override.conf deleted file mode 100644 index b3c5c28f..00000000 --- a/root/etc/systemd/system/getty@tty1.service.d/override.conf +++ /dev/null @@ -1,3 +0,0 @@ -[Service] -ExecStart= -ExecStart=-/usr/bin/agetty --skip-login --nonewline --noissue --autologin {{@@ env['USRNAME'] @@}} --noclear %I $TERM diff --git a/root/etc/systemd/system/qbittorrent.service b/root/etc/systemd/system/qbittorrent.service deleted file mode 100644 index ed7a42c0..00000000 --- a/root/etc/systemd/system/qbittorrent.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=qBittorrent Daemon Service -After=network.target - -[Service] -User=qbtuser -ExecStart=/usr/bin/qbittorrent-nox --webui-port=8080 - -[Install] -WantedBy=multi-user.target diff --git a/root/etc/systemd/timesyncd.conf b/root/etc/systemd/timesyncd.conf new file mode 100644 index 00000000..243bc7a3 --- /dev/null +++ b/root/etc/systemd/timesyncd.conf @@ -0,0 +1,3 @@ +[Time] +NTP=esgaroth.korhonen.lan +FallbackNTP=0.pool.ntp.org diff --git a/root/etc/udev/rules.d/20-yubikey.rules b/root/etc/udev/rules.d/20-yubikey.rules new file mode 100644 index 00000000..92465054 --- /dev/null +++ b/root/etc/udev/rules.d/20-yubikey.rules @@ -0,0 +1 @@ +ACTION=="remove", ENV{ID_BUS}=="usb", ENV{ID_MODEL_ID}=="0407", ENV{ID_VENDOR_ID}=="1050", RUN+="/usr/bin/loginctl lock-sessions" diff --git a/root/usr/local/bin/sway-run b/root/usr/local/bin/sway-run.sh similarity index 87% rename from root/usr/local/bin/sway-run rename to root/usr/local/bin/sway-run.sh index 762d6e13..ac015c91 100755 --- a/root/usr/local/bin/sway-run +++ b/root/usr/local/bin/sway-run.sh @@ -6,6 +6,7 @@ export MOZ_ENABLE_WAYLAND=1 export MOZ_USE_XINPUT2=1 export MOZ_WEBRENDER=1 +export MOZ_DBUS_REMOTE=1 # Enable xdg-desktop-portal-wlr export XDG_CURRENT_DESKTOP=sway @@ -20,6 +21,9 @@ export QT_QPA_PLATFORMTHEME=qt5ct export QT_QPA_PLATFORM=wayland export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 +# Enable wayland support on clutter +export CLUTTER_BACKEND=wayland + # Fix redshift on wlroots export WLR_DRM_NO_ATOMIC=1 @@ -30,10 +34,12 @@ dbus-run-session sway unset MOZ_ENABLE_WAYLAND unset MOZ_USE_XINPUT2 unset MOZ_WEBRENDER +unset MOZ_DBUS_REMOTE unset _JAVA_AWT_WM_NONREPARENTING unset _JAVA_OPTIONS unset QT_QPA_PLATFORMTHEME unset QT_QPA_PLATFORM unset QT_WAYLAND_DISABLE_WINDOWDECORATION +unset CLUTTER_BACKEND unset WLR_DRM_NO_ATOMIC unset XDG_CURRENT_DESKTOP diff --git a/root/usr/local/bin/telegram-desktop b/root/usr/local/bin/telegram-desktop deleted file mode 100755 index 05f66f23..00000000 --- a/root/usr/local/bin/telegram-desktop +++ /dev/null @@ -1 +0,0 @@ -LANG=en_DK.UTF-8 QT_QPA_PLATFORMTHEME="" QT_STYLE_OVERRIDE="" /usr/bin/telegram-desktop $@ diff --git a/root/usr/local/bin/umpv b/root/usr/local/bin/umpv deleted file mode 100755 index 37a00a6e..00000000 --- a/root/usr/local/bin/umpv +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python3 - -""" -This script emulates "unique application" functionality on Linux. When starting -playback with this script, it will try to reuse an already running instance of -mpv (but only if that was started with umpv). Other mpv instances (not started -by umpv) are ignored, and the script doesn't know about them. -This only takes filenames as arguments. Custom options can't be used; the script -interprets them as filenames. If mpv is already running, the files passed to -umpv are appended to mpv's internal playlist. If a file does not exist or is -otherwise not playable, mpv will skip the playlist entry when attempting to -play it (from the GUI perspective, it's silently ignored). -If mpv isn't running yet, this script will start mpv and let it control the -current terminal. It will not write output to stdout/stderr, because this -will typically just fill ~/.xsession-errors with garbage. -mpv will terminate if there are no more files to play, and running the umpv -script after that will start a new mpv instance. -Note: you can supply custom mpv path and options with the MPV environment - variable. The environment variable will be split on whitespace, and the - first item is used as path to mpv binary and the rest is passed as options - _if_ the script starts mpv. If mpv is not started by the script (i.e. mpv - is already running), this will be ignored. -""" - -import sys -import os -import socket -import errno -import subprocess -import fcntl -import stat -import string - -files = sys.argv[1:] - -# this is the same method mpv uses to decide this -def is_url(filename): - parts = filename.split("://", 1) - if len(parts) < 2: - return False - # protocol prefix has no special characters => it's an URL - allowed_symbols = string.ascii_letters + string.digits + '_' - prefix = parts[0] - return all(map(lambda c: c in allowed_symbols, prefix)) - -# make them absolute; also makes them safe against interpretation as options -def make_abs(filename): - if not is_url(filename): - return os.path.abspath(filename) - return filename -files = [make_abs(f) for f in files] - -SOCK = os.path.join(os.getenv("HOME"), ".umpv_socket") - -sock = None -try: - sock = socket.socket(socket.AF_UNIX) - sock.connect(SOCK) -except socket.error as e: - if e.errno == errno.ECONNREFUSED: - sock = None - pass # abandoned socket - elif e.errno == errno.ENOENT: - sock = None - pass # doesn't exist - else: - raise e - -if sock: - # Unhandled race condition: what if mpv is terminating right now? - for f in files: - # escape: \ \n " - f = f.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n") - f = "\"" + f + "\"" - sock.send(("raw loadfile " + f + " append\n").encode("utf-8")) -else: - # Let mpv recreate socket if it doesn't already exist. - - opts = (os.getenv("MPV") or "mpv").split() - opts.extend(["--no-terminal", "--force-window", "--input-ipc-server=" + SOCK, - "--"]) - opts.extend(files) - - subprocess.check_call(opts) diff --git a/scripts/autorotate.sh b/scripts/autorotate.sh deleted file mode 100755 index 97cb94b8..00000000 --- a/scripts/autorotate.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -function rotate_ms { - case $1 in - "normal") - swaymsg output eDP-1 transform 0 - ;; - "right-up") - swaymsg output eDP-1 transform 90 - ;; - "bottom-up") - swaymsg output eDP-1 transform 180 - ;; - "left-up") - swaymsg output eDP-1 transform 270 - ;; - esac -} - -while IFS='$\n' read -r line; do - rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")" - [[ ! -z $rotation ]] && rotate_ms $rotation -done < <(stdbuf -oL monitor-sensor) diff --git a/scripts/confgen/termite.conf.gen.sh b/scripts/confgen/termite.conf.gen.sh deleted file mode 100755 index 415d887d..00000000 --- a/scripts/confgen/termite.conf.gen.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -source ~/.cache/wal/colors.sh -echo "[colors] -foreground = $foreground -background = $background -color0 = $color0 -color1 = $color1 -color2 = $color2 -color3 = $color3 -color4 = $color4 -color5 = $color5 -color6 = $color6 -color7 = $color7 -color8 = $color8 -color9 = $color9 -color10 = $color10 -color11 = $color11 -color12 = $color12 -color13 = $color13 -color14 = $color14 -color15 = $color15 - -[options] -font = Noto Color Emoji 12 -font = Material Design Icons 12 -font = Hack Nerd Font 12" > ~/.config/termite/config diff --git a/scripts/confgen/zathura.conf.gen.sh b/scripts/confgen/zathura.conf.gen.sh deleted file mode 100755 index 68b15848..00000000 --- a/scripts/confgen/zathura.conf.gen.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -# Generates zathura configuration file with pywal colors - -. $HOME/.cache/wal/colors.sh - -cat < ~/.config/zathura/zathurarc -set completion-bg "$background" -set recolor-darkcolor "$foreground" -set recolor-lightcolor "$background" -set completion-fg "$foreground" -set completion-group-bg "$background" -set completion-group-fg "$color2" -set completion-highlight-bg "$foreground" -set completion-highlight-fg "$background" -set default-bg "$background" -set default-fg "$foreground" -set inputbar-bg "$background" -set inputbar-fg "$foreground" -set notification-bg "$background" -set notification-fg "$foreground" -set notification-error-bg "$color1" -set notification-error-fg "$foreground" -set notification-warning-bg "$color1" -set notification-warning-fg "$foreground" -set statusbar-bg "$background" -set statusbar-fg "$foreground" -set index-bg "$background" -set index-fg "$foreground" -set index-active-bg "$foreground" -set index-active-fg "$background" -set render-loading-bg "$background" -set render-loading-fg "$foreground" - -set smooth-scroll true -set window-title-home-tilde true -set statusbar-basename true -set selection-clipboard clipboard -set recolor false -CONF diff --git a/scripts/fhackeditor b/scripts/fhackeditor new file mode 100755 index 00000000..7a1d4934 --- /dev/null +++ b/scripts/fhackeditor @@ -0,0 +1,9 @@ +#!/bin/sh +# Script to launch a graphical editor if in graphical mode, +# terminal editor otherwise + +if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then + echo "Running in graphical mode" +else + echo "Running in TTY mode" +fi diff --git a/scripts/hibernate-lowbattery.sh b/scripts/hibernate-lowbattery.sh index d98df476..71fb0d16 100755 --- a/scripts/hibernate-lowbattery.sh +++ b/scripts/hibernate-lowbattery.sh @@ -1,9 +1,9 @@ #!/bin/sh acpi -b | awk -F'[,:%]' '{print $2, $3}' | { - read -r status capacity + read -r status capacity - if [ "$status" = Discharging -a "$capacity" -lt 5 ]; then - logger "Critical battery threshold" - systemctl hibernate - fi + if [ "$status" = Discharging -a "$capacity" -lt 5 ]; then + logger "Critical battery threshold" + systemctl hibernate + fi } diff --git a/scripts/ipmi/auto.sh b/scripts/ipmi/auto.sh deleted file mode 100755 index 60b75181..00000000 --- a/scripts/ipmi/auto.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -IPMIHOST=10.0.0.82 -IPMIUSER=ReekyMarko -IPMIPW={{@@ env['PASS_IPMI'] @@}} -IPMIEK=0000000000000000000000000000000000000000 - -printf "Activating dynamic fan control." -ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x01 diff --git a/scripts/ipmi/fans.sh b/scripts/ipmi/fans.sh deleted file mode 100755 index c23b4a6b..00000000 --- a/scripts/ipmi/fans.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -IPMIHOST=10.0.0.82 -IPMIUSER=ReekyMarko -IPMIPW={{@@ env['PASS_IPMI'] @@}} -IPMIEK=0000000000000000000000000000000000000000 - -DATA=`ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr get "FAN 1 RPM" "FAN 2 RPM" "FAN 3 RPM" "FAN 4 RPM" "FAN 5 RPM" "FAN 6 RPM" | grep "Sensor Reading" | awk '{ print $4 }'` - -echo "$DATA" - -mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan1" -m "$(echo "$DATA" | head -1 | tail -1)" -mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan2" -m "$(echo "$DATA" | head -2 | tail -1)" -mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan3" -m "$(echo "$DATA" | head -3 | tail -1)" -mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan4" -m "$(echo "$DATA" | head -4 | tail -1)" -mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan5" -m "$(echo "$DATA" | head -5 | tail -1)" -mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan6" -m "$(echo "$DATA" | head -6 | tail -1)" diff --git a/scripts/ipmi/full.sh b/scripts/ipmi/full.sh deleted file mode 100755 index 8218be99..00000000 --- a/scripts/ipmi/full.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -IPMIHOST=10.0.0.82 -IPMIUSER=ReekyMarko -IPMIPW={{@@ env['PASS_IPMI'] @@}} -IPMIEK=0000000000000000000000000000000000000000 - -printf "speeeed!" -ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x00 -ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x64 diff --git a/scripts/ipmi/static.sh b/scripts/ipmi/static.sh deleted file mode 100755 index cc4bc509..00000000 --- a/scripts/ipmi/static.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -IPMIHOST=10.0.0.82 -IPMIUSER=ReekyMarko -IPMIPW={{@@ env['PASS_IPMI'] @@}} -IPMIEK=0000000000000000000000000000000000000000 - -printf "Activating manual fan speeds! (2160 RPM)" -ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x00 -ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x10 diff --git a/scripts/ipmi/temp.sh b/scripts/ipmi/temp.sh deleted file mode 100755 index b468b766..00000000 --- a/scripts/ipmi/temp.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -IPMIHOST=10.0.0.82 -IPMIUSER=ReekyMarko -IPMIPW={{@@ env['PASS_IPMI'] @@}} -IPMIEK=0000000000000000000000000000000000000000 -MAXTEMP=27 -TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1) - -mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/temp" -m "$TEMP" - - -if [[ $TEMP > $MAXTEMP ]]; - then - printf "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)" - ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x01 - else - printf "Temperature is OK ($TEMP C)" -fi diff --git a/scripts/mail/notify-new-mail.sh b/scripts/mail/notify-new-mail.sh deleted file mode 100755 index 298d6b35..00000000 --- a/scripts/mail/notify-new-mail.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -NEWMAILDIR=~/.mail/$1/INBOX/new -COUNT=$(ls $NEWMAILDIR | wc -l) -ICON=/usr/share/icons/Papirus-Dark/64x64/apps/email.svg -SOUND=/usr/share/sounds/Oxygen-Im-Message-In.ogg - - -if [ $COUNT -ne 0 ]; then - mpv $SOUND & -fi - -if [ $COUNT -gt 1 ]; then - fromaddress=$(cat $NEWMAILDIR/$(ls $NEWMAILDIR | sort -R | tail -1) | formail -x From | tail -1) - notify-send.sh -i $ICON "$COUNT new messages in $1" "From $fromaddress and others" - -elif [ $COUNT -eq 1 ]; then - mailsubject=$(cat $NEWMAILDIR/* | formail -x Subject) - fromaddress=$(cat $NEWMAILDIR/* | formail -x From | tail -1) - - notify-send.sh -i $ICON "New message in $1" "$fromaddress $mailsubject" -else - echo "No new mail" -fi diff --git a/scripts/media/imageviewer b/scripts/media/imageviewer deleted file mode 100755 index bd14f550..00000000 --- a/scripts/media/imageviewer +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -if [ $# -eq 1 ]; then - DIR=/tmp/images - IMGNAME=$(basename $1) - - if [ ! -d $DIR ]; then - mkdir $DIR - fi - - if [ ! -f $DIR/$IMGNAME ]; then - wget $1 -O $DIR/$IMGNAME - fi - - mimeo $DIR/$IMGNAME - -else - DIR=/tmp/images/$(basename $1) - - if [ ! -d $]; then - mkdir -p $DIR - fi - - if [ ! -f $DIR/$IMGNAME ]; then - wget -P $DIR $@ - fi - - mimeo $DIR/* -fi diff --git a/scripts/media/imgurviewer b/scripts/media/imgurviewer deleted file mode 100755 index a5a02053..00000000 --- a/scripts/media/imgurviewer +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -ALBUMNAME=$(basename $1) -ALBUMDIR=/tmp/imgur/$ALBUMNAME - -if [ ! -d $ALBUMDIR ]; then - mkdir -p $ALBUMDIR - imgur-album-downloader $1 $ALBUMDIR -fi - -mimeo $ALBUMDIR diff --git a/scripts/media/mpvqueue b/scripts/media/mpvqueue deleted file mode 100755 index 5a84bc64..00000000 --- a/scripts/media/mpvqueue +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -notify="notify-send -i mpv -a mpv" -url="$1" - -# NOTE: You need to configure mpv to -# enable ipc server on this path (see my mpv config for an example) -MPVSOCKET="/tmp/mpvsocket" - -# See if MPV is already running -if [ -z "$(pidof mpv)" ]; then - # mpv is not running - - # pause other players - playerctl pause - - # start mpv - /usr/bin/mpv --no-terminal "$url" & disown - - # Wait for mpv to be up before adding anything else to playlist - while [ -z "$(pidof mpv)" ]; do - sleep 1 - done - $notify "Playing $url" - -else - # mpv is running, so add stuff to playlist - $notify "Adding $url" - echo "{\"command\": [\"loadfile\", \"$url\", \"append\"]}" | socat - /tmp/mpvsocket -fi diff --git a/scripts/open_with_linux.py b/scripts/open_with_linux.py deleted file mode 100755 index 6a4f9799..00000000 --- a/scripts/open_with_linux.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function - -import os -import sys -import json -import struct -import subprocess - -VERSION = '7.2.2' - -try: - sys.stdin.buffer - - # Python 3.x version - # Read a message from stdin and decode it. - def getMessage(): - rawLength = sys.stdin.buffer.read(4) - if len(rawLength) == 0: - sys.exit(0) - messageLength = struct.unpack('@I', rawLength)[0] - message = sys.stdin.buffer.read(messageLength).decode('utf-8') - return json.loads(message) - - # Send an encoded message to stdout - def sendMessage(messageContent): - encodedContent = json.dumps(messageContent).encode('utf-8') - encodedLength = struct.pack('@I', len(encodedContent)) - - sys.stdout.buffer.write(encodedLength) - sys.stdout.buffer.write(encodedContent) - sys.stdout.buffer.flush() - -except AttributeError: - # Python 2.x version (if sys.stdin.buffer is not defined) - # Read a message from stdin and decode it. - def getMessage(): - rawLength = sys.stdin.read(4) - if len(rawLength) == 0: - sys.exit(0) - messageLength = struct.unpack('@I', rawLength)[0] - message = sys.stdin.read(messageLength) - return json.loads(message) - - # Send an encoded message to stdout - def sendMessage(messageContent): - encodedContent = json.dumps(messageContent) - encodedLength = struct.pack('@I', len(encodedContent)) - - sys.stdout.write(encodedLength) - sys.stdout.write(encodedContent) - sys.stdout.flush() - - -def install(): - home_path = os.getenv('HOME') - - manifest = { - 'name': 'open_with', - 'description': 'Open With native host', - 'path': os.path.realpath(__file__), - 'type': 'stdio', - } - locations = { - 'chrome': os.path.join(home_path, '.config', 'google-chrome', 'NativeMessagingHosts'), - 'chrome-beta': os.path.join(home_path, '.config', 'google-chrome-beta', 'NativeMessagingHosts'), - 'chrome-unstable': os.path.join(home_path, '.config', 'google-chrome-unstable', 'NativeMessagingHosts'), - 'chromium': os.path.join(home_path, '.config', 'chromium', 'NativeMessagingHosts'), - 'firefox': os.path.join(home_path, '.mozilla', 'native-messaging-hosts'), - } - filename = 'open_with.json' - - for browser, location in locations.items(): - if os.path.exists(os.path.dirname(location)): - if not os.path.exists(location): - os.mkdir(location) - - browser_manifest = manifest.copy() - if browser == 'firefox': - browser_manifest['allowed_extensions'] = ['openwith@darktrojan.net'] - else: - browser_manifest['allowed_origins'] = [ - 'chrome-extension://cogjlncmljjnjpbgppagklanlcbchlno/', # Chrome - 'chrome-extension://fbmcaggceafhobjkhnaakhgfmdaadhhg/', # Opera - ] - - with open(os.path.join(location, filename), 'w') as file: - file.write( - json.dumps(browser_manifest, indent=2, separators=(',', ': '), sort_keys=True).replace(' ', '\t') + '\n' - ) - - -def _read_desktop_file(path): - with open(path, 'r') as desktop_file: - current_section = None - name = None - command = None - for line in desktop_file: - if line[0] == '[': - current_section = line[1:-2] - if current_section != 'Desktop Entry': - continue - - if line.startswith('Name='): - name = line[5:].strip() - elif line.startswith('Exec='): - command = line[5:].strip() - - return { - 'name': name, - 'command': command - } - - -def find_browsers(): - apps = [ - 'Chrome', - 'Chromium', - 'chromium-browser', - 'firefox', - 'Firefox', - 'Google Chrome', - 'google-chrome', - 'opera', - 'Opera', - 'SeaMonkey', - 'seamonkey', - ] - paths = [ - os.path.join(os.getenv('HOME'), '.local/share/applications'), - '/usr/local/share/applications', - '/usr/share/applications' - ] - suffix = '.desktop' - - results = [] - for p in paths: - for a in apps: - fp = os.path.join(p, a) + suffix - if os.path.exists(fp): - results.append(_read_desktop_file(fp)) - return results - - -def listen(): - receivedMessage = getMessage() - if receivedMessage == 'ping': - sendMessage({ - 'version': VERSION, - 'file': os.path.realpath(__file__) - }) - elif receivedMessage == 'find': - sendMessage(find_browsers()) - else: - for k, v in os.environ.items(): - if k.startswith('MOZ_'): - try: - os.unsetenv(k) - except: - os.environ[k] = '' - - devnull = open(os.devnull, 'w') - subprocess.Popen(receivedMessage, stdout=devnull, stderr=devnull) - sendMessage(None) - - -if __name__ == '__main__': - if len(sys.argv) == 2: - if sys.argv[1] == 'install': - install() - sys.exit(0) - elif sys.argv[1] == 'find_browsers': - print(find_browsers()) - sys.exit(0) - - allowed_extensions = [ - 'openwith@darktrojan.net', - 'chrome-extension://cogjlncmljjnjpbgppagklanlcbchlno/', - 'chrome-extension://fbmcaggceafhobjkhnaakhgfmdaadhhg/', - ] - for ae in allowed_extensions: - if ae in sys.argv: - listen() - sys.exit(0) - - print('Open With native helper, version %s.' % VERSION) diff --git a/secrets/env b/secrets/env index 7b41c97b..aeb2ded3 100755 --- a/secrets/env +++ b/secrets/env @@ -6,7 +6,6 @@ export PASS_MUSPY="$(pass entertainment/muspy.com | head -1)" export PASS_ARIA2="$(pass linux/aria2 | head -1)" export PASS_MPD="$(pass linux/mpd | head -1)" export PASS_MPD_ADMIN="$(pass linux/mpd-admin | head -1)" -export PASS_IPMI="$(pass selfhosted/idrac | head -1)" export PASS_MQTT="$(pass selfhosted/mqtt.reekynet.com | head -1)" export PASS_EMAIL_HACKER="$(pass email/functionalhacker@korhonen.cc | head -1)" @@ -16,6 +15,7 @@ export PASS_EMAIL_ADMIN="$(pass email/admin@korhonen.cc | head -1)" export ME_FULLNAME="$(pass me | head -1)" export ME_ADDRESS="$(pass me | rg 'address' | cut -d' ' -f2-)" export ME_PHONE="$(pass me | rg 'phone' | cut -d' ' -f2-)" +export ME_EMAIL="$(pass me | rg 'email' | cut -d' ' -f2-)" export WIREGUARD_MIRKWOOD_PRIVKEY="$(pass selfhosted/wireguard/mirkwood | grep PrivateKey | cut -d' ' -f2-)" export WIREGUARD_MIRKWOOD_PUBKEY="$(pass selfhosted/wireguard/mirkwood | grep PublicKey | cut -d' ' -f2-)" diff --git a/secrets/secrets.sh b/secrets/secrets.sh index 349c03a6..2232d5e4 100755 --- a/secrets/secrets.sh +++ b/secrets/secrets.sh @@ -2,7 +2,7 @@ source $DOTREPO/secrets/env -cat < $DOTREPO/secrets/secrets +cat <$DOTREPO/secrets/secrets export PASS_LIBREFM="$PASS_LIBREFM" export PASS_MUSICBRAINZ="$PASS_MUSICBRAINZ" export PASS_LISTENBRAINZ="$PASS_LISTENBRAINZ" @@ -20,6 +20,7 @@ export PASS_EMAIL_ADMIN="$PASS_EMAIL_ADMIN" export ME_FULLNAME="$ME_FULLNAME" export ME_ADDRESS="$ME_ADDRESS" export ME_PHONE="$ME_PHONE" +export ME_EMAIL="$ME_EMAIL" export WIREGUARD_MIRKWOOD_PRIVKEY="$WIREGUARD_MIRKWOOD_PRIVKEY" export WIREGUARD_MIRKWOOD_PUBKEY="$WIREGUARD_MIRKWOOD_PUBKEY"