├── .ci └── archlinux-docker │ ├── Dockerfile │ ├── Makefile │ └── README.org ├── .dir-locals.el ├── .github ├── dependabot.yml └── workflows │ ├── emacs.yml │ └── main.yml ├── .gitignore ├── CONTRIBUTING.org ├── Dockerfile ├── LICENSE.md ├── Linkfile ├── README.org ├── alacritty └── alacritty.toml ├── arch ├── Aurfile ├── Aurfile_borysb ├── Linkfile ├── Pacmanfile ├── Pacmanignore_borysb ├── README.org ├── lock@.service └── packages │ ├── haskell-ide-engine │ └── PKGBUILD │ └── ttf-symbola │ ├── LICENSE │ ├── PKGBUILD │ ├── pkg │ └── ttf-symbola │ │ ├── .BUILDINFO │ │ ├── .MTREE │ │ ├── .PKGINFO │ │ └── usr │ │ └── share │ │ ├── fonts │ │ └── TTF │ │ │ └── Symbola.ttf │ │ └── licenses │ │ └── ttf-symbola │ │ └── LICENSE │ ├── src │ ├── LICENSE │ ├── Symbola.ttf │ ├── Symbola_Hinted.ttf │ └── ttf-symbola-12.00.zip │ ├── ttf-symbola-12.00-2-any.pkg.tar.xz │ └── ttf-symbola-12.00.zip ├── bat └── config ├── bin ├── README.org ├── brightness ├── certbot-auth-hook ├── certbot-commit ├── certbot-gen ├── colours ├── contributing ├── fehbg ├── fix-data-case ├── ghc-bootstrap ├── gifify ├── haskell-language-server-wrapper ├── hls-wrapper ├── inactive-repo-notifier.sh ├── launch_emacs ├── notify ├── on_desktop_switch ├── on_window_switch ├── open_kitty ├── patch_skhd_path ├── respawn ├── safe_link ├── switch_kbd_layout ├── sync_spacemacs ├── tex2png ├── vulpea-sync ├── xlock-wrapper ├── yabai-layout-toggle ├── yabai-relaunch └── yabai-window-focus ├── dunst └── dunstrc ├── emacs ├── .dir-locals.el ├── .gitignore ├── Eldev ├── Makefile ├── README.org ├── early-init.el ├── images │ ├── litnotes-1.png │ ├── litnotes-2.png │ ├── vino-inventory.png │ └── vino-stats.png ├── init.el ├── lisp │ ├── barberry-theme.el │ ├── config-path.el │ ├── config-vulpea.el │ ├── dash-functional.el │ ├── init-buffer.el │ ├── init-data-formats.el │ ├── init-dired.el │ ├── init-editor.el │ ├── init-elisp.el │ ├── init-elpa.el │ ├── init-env.el │ ├── init-file-templates.el │ ├── init-haskell.el │ ├── init-ide.el │ ├── init-js.el │ ├── init-kbd.el │ ├── init-markdown.el │ ├── init-nix.el │ ├── init-pdf.el │ ├── init-project.el │ ├── init-selection.el │ ├── init-sh.el │ ├── init-spell.el │ ├── init-telega.el │ ├── init-tools.el │ ├── init-ui.el │ ├── init-vcs.el │ ├── init-vino.el │ ├── init-vulpea.el │ ├── init-window.el │ ├── lib-brb-charge.el │ ├── lib-brb-event-plan.el │ ├── lib-brb-event-stats.el │ ├── lib-brb-event.el │ ├── lib-brb-events.el │ ├── lib-brb-order.el │ ├── lib-brb-post.el │ ├── lib-brb-slides.el │ ├── lib-brb.el │ ├── lib-buffer.el │ ├── lib-calc.el │ ├── lib-directory.el │ ├── lib-eval.el │ ├── lib-fun.el │ ├── lib-hash-table.el │ ├── lib-hook.el │ ├── lib-list.el │ ├── lib-nix.el │ ├── lib-plist.el │ ├── lib-string.el │ ├── lib-svg.el │ ├── lib-table.el │ ├── lib-vcl.el │ ├── lib-vcs.el │ ├── lib-vino-stats.el │ ├── lib-vino.el │ ├── lib-vulpea-agenda.el │ ├── lib-vulpea-capture.el │ ├── lib-vulpea-id.el │ ├── lib-vulpea-refile.el │ └── lib-vulpea.el ├── templates │ ├── emacs-lisp-mode │ │ └── __package │ ├── haskell-mode │ │ └── __module │ └── org-mode │ │ ├── bg_slides │ │ └── bg_slides_wine └── test │ ├── lib-buffer-test.el │ └── lib-string-test.el ├── eru-new.sh ├── eru.sh ├── firefox └── userChrome.css ├── fish ├── .gitignore ├── README.org ├── functions │ └── macos_set_env.fish └── images │ ├── notification.png │ └── prompt.png ├── flake.lock ├── flake.nix ├── fontconfig └── fonts.conf ├── gtk-3.0 └── settings.ini ├── haskell ├── .ghci ├── Linkfile ├── README.org ├── stack-global.yaml └── stack.yaml ├── images ├── d12frosted.png ├── desktop_arch.png ├── desktop_mac.png ├── eru-example-1.png └── eru-example-2.png ├── melkor ├── Dockerfile ├── app │ └── Main.hs ├── package.yaml ├── src │ ├── Melkor.hs │ └── Melkor │ │ ├── BuildMap.hs │ │ ├── BuildPlan.hs │ │ ├── Extra │ │ ├── Display.hs │ │ ├── List.hs │ │ └── Tuple.hs │ │ └── Types │ │ ├── Eff.hs │ │ ├── Internal │ │ ├── SingleRelMap.hs │ │ └── ToString.hs │ │ ├── Provider.hs │ │ └── Resource.hs ├── stack.yaml ├── stack.yaml.lock └── test │ ├── .dir-locals.el │ ├── Melkor │ ├── BuildMapSpec.hs │ ├── BuildPlanSpec.hs │ ├── Test │ │ └── Gen.hs │ └── Types │ │ └── Internal │ │ └── SingleRelMapSpec.hs │ └── Spec.hs ├── mimeapps.list ├── networkmanager-dmenu └── config.ini ├── nix ├── darwin.nix ├── darwin │ └── yabai.nix ├── home.nix ├── linux │ ├── services.nix │ └── xsession.nix ├── overlays │ └── default.nix ├── packages.nix └── pkgs │ └── base16-shell.nix ├── scala ├── Linkfile └── plugins.sbt ├── skhd └── skhdrc ├── systemd └── user │ └── timers.target.wants │ └── vulpea.sync.timer ├── xmonad ├── .gitignore ├── Linkfile ├── README.org ├── cabal.project ├── d12x.cabal ├── flake.lock ├── flake.nix ├── icons │ ├── battery-charge.xcf │ ├── battery-charge.xpm │ ├── battery-charged.xcf │ ├── battery-charged.xpm │ ├── battery-use.xcf │ ├── battery-use.xpm │ ├── volume-mute.xcf │ ├── volume-mute.xpm │ ├── volume-up.xcf │ └── volume-up.xpm ├── lib │ └── Utils │ │ ├── Color.hs │ │ └── Icon.hs ├── package.yaml ├── xmobar │ └── Main.hs └── xmonad │ ├── Main.hs │ └── XMonad │ ├── Commands.hs │ ├── Keybindings.hs │ ├── Window.hs │ └── Workspaces.hs ├── xorg ├── 30-touchpad.conf ├── xkb │ └── symbols │ │ └── ua-custom └── xresources └── yabai └── yabairc /.ci/archlinux-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM archlinux/base 2 | RUN pacman -Syu --noconfirm --needed base-devel git pacman-contrib 3 | RUN useradd -m -g users -G wheel -s /bin/bash d12frosted 4 | RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers 5 | USER d12frosted 6 | WORKDIR /home/d12frosted 7 | CMD ["/usr/bin/bash"] 8 | -------------------------------------------------------------------------------- /.ci/archlinux-docker/Makefile: -------------------------------------------------------------------------------- 1 | DOCKER_USER:=d12frosted 2 | DOCKER_ORGANIZATION=d12frosted 3 | DOCKER_IMAGE:=environment 4 | DOCKER_IMAGE_TAG:=archlinux 5 | 6 | image: 7 | docker build --no-cache -t "$(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG)" . 8 | 9 | push: 10 | docker login -u $(DOCKER_USER) 11 | docker push "$(DOCKER_ORGANIZATION)/$(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG)" 12 | 13 | .PHONY: image push 14 | -------------------------------------------------------------------------------- /.ci/archlinux-docker/README.org: -------------------------------------------------------------------------------- 1 | * Docker Image for Arch Linux 2 | This repository contains all scripts and files needed to create a Docker image 3 | for the Arch Linux distribution with everything required to test =eru= script. 4 | 5 | Based on [[https://github.com/archlinux/archlinux-docker][archlinux-docker]]. 6 | 7 | ** Dependencies 8 | Install the following Arch Linux packages: 9 | 10 | - =make= 11 | - =devtools= 12 | - =docker= 13 | 14 | ** Usage 15 | Run =make docker-image= as root to build the base image. 16 | 17 | ** Purpose 18 | - Provide the Arch experience in a Docker Image. 19 | - Feature-wise, provide the complete minimum to test =eru=. 20 | -------------------------------------------------------------------------------- /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((org-mode . ((fill-column . 80) 2 | (vulpea-id-auto-targets . nil)))) 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | -------------------------------------------------------------------------------- /.github/workflows/emacs.yml: -------------------------------------------------------------------------------- 1 | name: Emacs 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - master 8 | schedule: 9 | - cron: "0 6 * * *" 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | strategy: 16 | matrix: 17 | emacs_version: 18 | - snapshot 19 | steps: 20 | - uses: cachix/install-nix-action@V28 21 | with: 22 | nix_path: nixpkgs=channel:nixpkgs-unstable 23 | 24 | - uses: purcell/setup-emacs@master 25 | with: 26 | version: ${{ matrix.emacs_version }} 27 | 28 | - uses: actions/checkout@v4 29 | 30 | - name: Install extra dependencies 31 | run: | 32 | sudo apt-get update 33 | sudo apt-get install aspell fish 34 | 35 | - name: Install configurations 36 | run: ./eru.sh install emacs 37 | 38 | - name: Test configurations 39 | run: ./eru.sh test emacs 40 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v4 11 | 12 | - name: .stack-work cache 13 | uses: actions/cache@v4 14 | with: 15 | path: melkor/.stack-work 16 | key: ${{ runner.os }}-stack-work-${{ hashFiles('melkor/stack.yaml.lock') }} 17 | restore-keys: | 18 | ${{ runner.os }}-stack-work 19 | 20 | - name: $HOME/.stack cache 21 | uses: actions/cache@v4 22 | with: 23 | path: ~/.stack 24 | key: ${{ runner.os }}-stack-${{ hashFiles('melkor/stack.yaml.lock') }} 25 | restore-keys: | 26 | ${{ runner.os }}-stack 27 | 28 | - name: Melkor tests 29 | run: ./eru-new.sh test 30 | 31 | - name: Shape the world! 32 | run: ./eru-new.sh 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # nix managed 2 | fish/conf.d/ 3 | fish/config.fish 4 | git 5 | gnupg 6 | ssh 7 | 8 | # nix-darwin result 9 | result 10 | 11 | # haskell 12 | # https://github.com/commercialhaskell/stack/blob/master/.gitignore 13 | .stack-work/ 14 | 15 | # melkor 16 | melkor.cabal 17 | .shake/ 18 | 19 | # csharp 20 | NuGet/ 21 | xbuild/ 22 | 23 | 24 | # output files 25 | *.out 26 | 27 | # some .mono files 28 | .mono/ 29 | 30 | # Ignored applications 31 | Blue Jeans 32 | BraveSoftware 33 | GIMP 34 | GottCode 35 | Pinta 36 | QtProject.conf 37 | Slack 38 | StardewValley 39 | Trolltech.conf 40 | audacious 41 | bloop 42 | brittany 43 | calibre 44 | cef_user_data 45 | chromium 46 | configstore 47 | dconf 48 | enchant 49 | fisher 50 | gconf 51 | google-chrome 52 | gopass 53 | gtk-2.0 54 | gtk-3.0 55 | libfm 56 | mc 57 | menus 58 | mono.addins 59 | neofetch 60 | nvm 61 | pcmanfm 62 | procps 63 | pulse 64 | spotify 65 | wix 66 | yay 67 | -------------------------------------------------------------------------------- /CONTRIBUTING.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: showall 2 | 3 | * Contributing 4 | 5 | Everyone is welcome to contribute to =environment= project. Feature requests, 6 | proposals, issue reports, documentation improvements, code patches - just to 7 | name few things that the project can gain from. 8 | 9 | Please note that the main upstream of =environment= is located on [[https://gitlab.com/d12frosted/.config][GitLab]], and 10 | it's advisable to send your contributions there. But they can be accepted also 11 | via [[mailto:boris@d12frosted.io][email]] and [[https://github.com/d12frosted/environment][GitHub]]. 12 | 13 | Happy hacking! 14 | 15 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM d12frosted/environment:archlinux 2 | MAINTAINER Boris Buliga 3 | WORKDIR /opt/eru 4 | COPY ./eru-new.sh /opt/eru/eru-new.sh 5 | RUN ./eru-new.sh 6 | -------------------------------------------------------------------------------- /Linkfile: -------------------------------------------------------------------------------- 1 | eru.sh ~/.local/bin/eru 2 | eru-new.sh ~/.local/bin/eru-new 3 | -------------------------------------------------------------------------------- /alacritty/alacritty.toml: -------------------------------------------------------------------------------- 1 | [env] 2 | WINIT_X11_SCALE_FACTOR = "1.0" 3 | 4 | [font.normal] 5 | family = "Source Code Pro" 6 | 7 | [terminal] 8 | shell = "/run/current-system/sw/bin/fish" 9 | 10 | [window] 11 | decorations = "transparent" 12 | option_as_alt = "both" 13 | -------------------------------------------------------------------------------- /arch/Aurfile: -------------------------------------------------------------------------------- 1 | bazel-buildtools 2 | cask 3 | dmenu2 4 | dropbox 5 | dropbox-cli 6 | emacs-git 7 | intellij-idea-ultimate-edition 8 | mons 9 | networkmanager-dmenu-git 10 | patat-bin 11 | pinta-git 12 | spotify 13 | ttf-font-awesome-4 14 | ttf-symbola 15 | -------------------------------------------------------------------------------- /arch/Aurfile_borysb: -------------------------------------------------------------------------------- 1 | bluejeans 2 | -------------------------------------------------------------------------------- /arch/Linkfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/arch/Linkfile -------------------------------------------------------------------------------- /arch/Pacmanfile: -------------------------------------------------------------------------------- 1 | ack 2 | adobe-source-code-pro-fonts 3 | adobe-source-han-sans-otc-fonts 4 | adobe-source-han-serif-otc-fonts 5 | adobe-source-sans-pro-fonts 6 | alacritty 7 | aspell 8 | aspell-en 9 | aspell-uk 10 | bat 11 | bind-tools 12 | bower 13 | certbot 14 | clipmenu 15 | clipnotify 16 | ctags 17 | docker 18 | docker-compose 19 | dotnet-runtime 20 | dotnet-sdk 21 | dunst 22 | dwarffortress 23 | expect 24 | fd 25 | feh 26 | firefox 27 | fish 28 | flameshot 29 | gimp 30 | git 31 | gnumeric 32 | gnupg 33 | gocryptfs 34 | graphviz 35 | hledger 36 | hledger-web 37 | hlint 38 | hoogle 39 | java-runtime-common 40 | jq 41 | kubectl 42 | net-tools 43 | network-manager-applet 44 | networkmanager 45 | networkmanager-openconnect 46 | networkmanager-openvpn 47 | nm-connection-editor 48 | npm 49 | ntp 50 | openssh 51 | pcmanfm 52 | physlock 53 | protobuf 54 | pulseaudio 55 | pulseaudio-alsa 56 | pulseaudio-bluetooth 57 | pulsemixer 58 | pygmentize 59 | python 60 | python-pip 61 | ripgrep 62 | rng-tools 63 | scrot 64 | shellcheck 65 | stack 66 | stylish-haskell 67 | systemd 68 | telegram-desktop 69 | texlive-most 70 | thunderbird 71 | tree 72 | unzip 73 | vim 74 | w3m 75 | weechat 76 | wget 77 | wireless_tools 78 | xautolock 79 | xclip 80 | xorg 81 | xorg-fonts-misc 82 | xorg-xinit 83 | xorg-xlsfonts 84 | xterm 85 | -------------------------------------------------------------------------------- /arch/Pacmanignore_borysb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/arch/Pacmanignore_borysb -------------------------------------------------------------------------------- /arch/README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Arch Linux 2 | #+AUTHOR: Boris Buliga 3 | #+EMAIL: boris@d12frosted.io 4 | #+STARTUP: showeverything 5 | #+OPTIONS: toc:nil 6 | 7 | This domain contains list of packages that should be installed on Arch Linux. 8 | 9 | - =Pacmanfile= - list of package to be installed from Arch Linux repository. 10 | - =Aurfile= - list of packages to be installed from Aur repository. 11 | 12 | It's also possible to install certain packages only for specific users. They 13 | need to be listed in either =Pacmanfile_USER= or =Aurfile_USER=. Some of the 14 | packages can be ignored for specific users, they need to be listed in either 15 | =Pacmanignore_USER= or =Aurignore_USER=. 16 | 17 | These files are processed by =eru=. 18 | 19 | - =eru packages= - install missing packages; 20 | - =eru upgrade= - upgrades the system and all specified packages. 21 | -------------------------------------------------------------------------------- /arch/lock@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Lock X session for user %i 3 | Before=sleep.target 4 | 5 | [Service] 6 | User=%i 7 | Environment=DISPLAY=:0 8 | ExecStartPre=/usr/bin/xset dpms force suspend 9 | ExecStart=/usr/local/bin/lock 10 | 11 | [Install] 12 | WantedBy=sleep.target 13 | -------------------------------------------------------------------------------- /arch/packages/haskell-ide-engine/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Boris Buliga 2 | 3 | _pkgname=haskell-ide-engine 4 | pkgname=${_pkgname} 5 | pkgver=r2946.cbc49f87 6 | pkgrel=1 7 | pkgdesc="The engine for Haskell ide-integration." 8 | arch=('i686' 'x86_64') 9 | url="https://github.com/haskell/haskell-ide-engine" 10 | license=('custom:BSD3') 11 | depends=() 12 | makedepends=('git' 'stack' 'cabal-install' 'happy') 13 | provides=() 14 | conflicts=() 15 | replaces=() 16 | backup=() 17 | options=() 18 | install= 19 | changelog= 20 | source=("git://github.com/haskell/${_pkgname}.git") 21 | noextract=() 22 | md5sums=('SKIP') 23 | validpgpkeys=() 24 | 25 | pkgver() { 26 | cd "${srcdir}/${_pkgname}" 27 | 28 | printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" 29 | } 30 | 31 | build() { 32 | cd "${srcdir}/${_pkgname}" 33 | 34 | git submodule update --init 35 | 36 | stack build 37 | } 38 | 39 | package() { 40 | cd "${srcdir}/${_pkgname}" 41 | 42 | install -D -m 644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE" 43 | 44 | stack --local-bin-path "${pkgdir}/usr/bin/" install \ 45 | && cp "${pkgdir}/usr/bin/hie" "${pkgdir}/usr/bin/hie-8.4.3" 46 | } 47 | -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/LICENSE: -------------------------------------------------------------------------------- 1 | Unicode Fonts for Ancient Scripts (UFAS) License Agreement 2 | 3 | UFAS: refers to the set of all fonts and documents available on this site; 4 | are licensed under the conditons stated in this License Agreement. 5 | 6 | Developer: refers to George Douros, Kolokotroni 3, Larissa, 41223, Greece; 7 | is the sole developer and exclusive owner of all UFAS material; 8 | retains all rights to previous, current and future versions of UFAS; 9 | does not warrant the performance or results User may obtain by using UFAS sofware; 10 | is in no event liable to User or anyone else for any consequental, incidental or special damages, or 11 | for any claim against User by any third party seeking such damages. 12 | 13 | User: refers to anyone who downloads UFAS from this, or any other, site; 14 | may use UFAS for strictly personal and non-commercial purposes, without charge; 15 | is allowed a single instantaton and no network installaton; 16 | agrees not to adapt, modify, alter, translate, convert, or otherwise change UFAS; 17 | may not license, sell, rent, lease, sublicense, lend, or in any way distribute UFAS for proft. 18 | 19 | Commercial or educatonal use of UFAS is not permited. 20 | 21 | This and all UFAS licenses are exclusively issued by Developer. 22 | -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: George Rawlinson 2 | # Contributor: Morten Linderud 3 | # Contributor: Daniel Micay 4 | # Contributor: Elena ``of Valhalla'' Grandi 5 | # Contributor: Jesse Jaara 6 | 7 | pkgname=ttf-symbola 8 | pkgver=12.00 9 | pkgrel=2 10 | pkgdesc="Font for unicode symbols (part of Unicode Fonts for Ancient Scripts)." 11 | arch=('any') 12 | conflicts=('ttf-symbola-ib') 13 | provides=('ttf-symbola') 14 | url="http://users.teilar.gr/~g1951d/" 15 | license=('custom') 16 | depends=('fontconfig' 'xorg-font-utils') 17 | source=("${pkgname}-${pkgver}.zip::https://web.archive.org/web/20190608100449/http://users.teilar.gr/~g1951d/Symbola.zip" 18 | "LICENSE") 19 | sha512sums=('96057c9dbf8a1ab48323d49f727dc00eb8ab66a60e4037b622280d6b84a2c692129e174994a36683ba78bee43e2a2096c4d87ac5c350be78f4d8d6cd7218a528' 20 | '9afe91785611955511248fd31a86c7e370b23b1b2c37f9345c8f274b3e0e1dbf9c0da8f9edac62d27d318e56485b80966aa7622f167f4da5d5925a7935bfa3da') 21 | 22 | package() { 23 | install -Dm644 Symbola.ttf "$pkgdir/usr/share/fonts/TTF/Symbola.ttf" 24 | install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" 25 | } 26 | -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/pkg/ttf-symbola/.MTREE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/arch/packages/ttf-symbola/pkg/ttf-symbola/.MTREE -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/pkg/ttf-symbola/.PKGINFO: -------------------------------------------------------------------------------- 1 | # Generated by makepkg 5.2.1 2 | # using fakeroot version 1.24 3 | pkgname = ttf-symbola 4 | pkgbase = ttf-symbola 5 | pkgver = 12.00-2 6 | pkgdesc = Font for unicode symbols (part of Unicode Fonts for Ancient Scripts). 7 | url = http://users.teilar.gr/~g1951d/ 8 | builddate = 1581107046 9 | packager = Unknown Packager 10 | size = 2868090 11 | arch = any 12 | license = custom 13 | conflict = ttf-symbola-ib 14 | provides = ttf-symbola 15 | depend = fontconfig 16 | depend = xorg-font-utils 17 | -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/pkg/ttf-symbola/usr/share/fonts/TTF/Symbola.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/arch/packages/ttf-symbola/pkg/ttf-symbola/usr/share/fonts/TTF/Symbola.ttf -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/pkg/ttf-symbola/usr/share/licenses/ttf-symbola/LICENSE: -------------------------------------------------------------------------------- 1 | Unicode Fonts for Ancient Scripts (UFAS) License Agreement 2 | 3 | UFAS: refers to the set of all fonts and documents available on this site; 4 | are licensed under the conditons stated in this License Agreement. 5 | 6 | Developer: refers to George Douros, Kolokotroni 3, Larissa, 41223, Greece; 7 | is the sole developer and exclusive owner of all UFAS material; 8 | retains all rights to previous, current and future versions of UFAS; 9 | does not warrant the performance or results User may obtain by using UFAS sofware; 10 | is in no event liable to User or anyone else for any consequental, incidental or special damages, or 11 | for any claim against User by any third party seeking such damages. 12 | 13 | User: refers to anyone who downloads UFAS from this, or any other, site; 14 | may use UFAS for strictly personal and non-commercial purposes, without charge; 15 | is allowed a single instantaton and no network installaton; 16 | agrees not to adapt, modify, alter, translate, convert, or otherwise change UFAS; 17 | may not license, sell, rent, lease, sublicense, lend, or in any way distribute UFAS for proft. 18 | 19 | Commercial or educatonal use of UFAS is not permited. 20 | 21 | This and all UFAS licenses are exclusively issued by Developer. 22 | -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/src/LICENSE: -------------------------------------------------------------------------------- 1 | /home/d12frosted/.config/arch/packages/ttf-symbola/LICENSE -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/src/Symbola.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/arch/packages/ttf-symbola/src/Symbola.ttf -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/src/Symbola_Hinted.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/arch/packages/ttf-symbola/src/Symbola_Hinted.ttf -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/src/ttf-symbola-12.00.zip: -------------------------------------------------------------------------------- 1 | /home/d12frosted/.config/arch/packages/ttf-symbola/ttf-symbola-12.00.zip -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/ttf-symbola-12.00-2-any.pkg.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/arch/packages/ttf-symbola/ttf-symbola-12.00-2-any.pkg.tar.xz -------------------------------------------------------------------------------- /arch/packages/ttf-symbola/ttf-symbola-12.00.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/arch/packages/ttf-symbola/ttf-symbola-12.00.zip -------------------------------------------------------------------------------- /bat/config: -------------------------------------------------------------------------------- 1 | --theme="base16" 2 | -------------------------------------------------------------------------------- /bin/README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: bin 2 | #+AUTHOR: Boris Buliga 3 | #+EMAIL: boris@d12frosted.io 4 | #+STARTUP: showeverything 5 | #+OPTIONS: toc:nil 6 | 7 | Some scripts and utils that I use with varying frequency. They are either used 8 | directly by other domains of my environment or are not that important to be part 9 | of a separate repository. 10 | 11 | - =brightness= - script for controlling screen brightness on Arch Linux. 12 | - =gifify= - script for converting video file to GIF. More information can be 13 | found in related [[https://d12frosted.io/posts/2018-10-13-gifify.html][blog post]]. 14 | - =notify= - script for sending desktop notifications on Linux (via 15 | [[https://developer.gnome.org/notification-spec/][notify-send]]) and macOS (via [[https://github.com/julienXX/terminal-notifier][terminal-notifier]]). Can be easily extended to 16 | support other notifications systems. 17 | - =open_kitty= - monstrosity that I use on macOS to start [[https://sw.kovidgoyal.net/kitty/][Kitty]] that enables 18 | better integration with [[https://github.com/koekeishiya/yabai][yabai]]. 19 | - =patch_skhd_path= - used by =eru= to patch [[https://github.com/koekeishiya/skhd][skhd]] PATH, so most of my binaries 20 | are available in =skhd= configurations. 21 | -------------------------------------------------------------------------------- /bin/brightness: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | 5 | ACTION=$1 6 | AMMOUNT=$2 7 | 8 | function print_usage() { 9 | echo "Usage: 10 | brigtness ACTION [OPTIONS] 11 | 12 | Actions: 13 | help Show help 14 | level Show current level of brightness 15 | add AMMOUNT Increase brigtness by AMMOUNT 16 | rem AMMOUNT Decrease brigtness by AMMOUNT 17 | inc Increase brigtness by 5% 18 | dec Decrease brigtness by 5% 19 | " 20 | } 21 | 22 | ################################################################################ 23 | 24 | file=/sys/class/backlight/intel_backlight/brightness 25 | max_file=/sys/class/backlight/intel_backlight/max_brightness 26 | level=$(cat $file) 27 | max_level=$(cat $max_file) 28 | 29 | case $ACTION in 30 | help) 31 | print_usage 32 | ;; 33 | level) 34 | echo "$level / $max_level" 35 | ;; 36 | add) 37 | new_level=$((level + AMMOUNT)) 38 | new_level=$((new_level > max_level ? max_level : new_level)) 39 | echo "$new_level" > $file 40 | ;; 41 | rem) 42 | new_level=$((level - AMMOUNT)) 43 | new_level=$((new_level > 0 ? new_level : 0)) 44 | echo "$new_level" > $file 45 | ;; 46 | inc) 47 | new_level=$((level + 5 * max_level / 100)) 48 | new_level=$((new_level > max_level ? max_level : new_level)) 49 | echo "$new_level" > $file 50 | ;; 51 | dec) 52 | new_level=$((level - 5 * max_level / 100)) 53 | new_level=$((new_level > 0 ? new_level : 0)) 54 | echo "$new_level" > $file 55 | ;; 56 | *) 57 | print_usage 58 | exit 1 59 | ;; 60 | esac 61 | 62 | ################################################################################ 63 | -------------------------------------------------------------------------------- /bin/certbot-auth-hook: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source "/var/cache/certbot-gen/env" 4 | 5 | echo "$root" 6 | echo "$CERTBOT_DOMAIN" 7 | echo "$CERTBOT_VALIDATION" 8 | echo "$CERTBOT_TOKEN" 9 | 10 | sudo -u "$user" "/home/$user/.config/bin/certbot-commit" "$root" "$CERTBOT_TOKEN" "$CERTBOT_VALIDATION" 11 | 12 | echo "Waiting for changes to propagate..." 13 | 14 | passed=false 15 | while [ "$passed" = false ]; do 16 | res=$(curl -s -L -f "http://$domain/.well-known/acme-challenge/$CERTBOT_TOKEN") 17 | if [[ "$res" = "$CERTBOT_VALIDATION" ]]; then 18 | passed=true 19 | else 20 | sleep 10 21 | fi 22 | done 23 | -------------------------------------------------------------------------------- /bin/certbot-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | root=$1 4 | token=$2 5 | validation=$3 6 | 7 | echo "user = $USER" 8 | echo "root = $root" 9 | echo "token = $token" 10 | echo "validation = $validation" 11 | 12 | echo "Writing challenge file" 13 | mkdir -p "$root/assets/.well-known/acme-challenge/$token" 14 | file="$root/assets/.well-known/acme-challenge/$token/index.html" 15 | echo "$validation" > "$file" 16 | 17 | cd "$root" && { 18 | git add "$file" 19 | git commit -m "acme challenge" 20 | git push 21 | } 22 | -------------------------------------------------------------------------------- /bin/certbot-gen: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | email= 6 | domain= 7 | root= 8 | 9 | ################################################################################ 10 | 11 | while [[ $# -gt 0 ]] 12 | do 13 | key="$1" 14 | 15 | case $key in 16 | --email) 17 | email="$2" 18 | shift # past argument 19 | shift # past value 20 | ;; 21 | --domain) 22 | domain="$2" 23 | shift # past argument 24 | shift # past value 25 | ;; 26 | --root) 27 | root="$2" 28 | shift # past argument 29 | shift # past value 30 | ;; 31 | *) # unknown option 32 | POSITIONAL+=("$1") # save it in an array for later 33 | shift # past argument 34 | ;; 35 | esac 36 | done 37 | set -- "${POSITIONAL[@]}" 38 | 39 | function print_usage() { 40 | echo "Usage: 41 | certbot-gen [OPTIONS] 42 | 43 | Options: 44 | --email TEXT Specify user email (required) 45 | --domain TEXT Specify domain for which certificate is generated (required) 46 | --root TEXT Specify the root of the site files (required) 47 | " 48 | } 49 | 50 | ################################################################################ 51 | 52 | function ensure() { 53 | if [[ -z $2 ]]; then 54 | echo "Missing $1!" 55 | echo 56 | print_usage 57 | exit 1 58 | fi 59 | } 60 | 61 | ensure "email" "$email" 62 | ensure "domain" "$domain" 63 | ensure "root" "$root" 64 | 65 | ################################################################################ 66 | 67 | echo "Will generate certificate for: 68 | 69 | domain: $domain 70 | email: $email 71 | root: $root 72 | " 73 | 74 | ################################################################################ 75 | 76 | sudo mkdir -p "/var/cache/certbot-gen" 77 | echo "domain=$domain 78 | email=$email 79 | root=$root 80 | user=$USER" | sudo tee -a "/var/cache/certbot-gen/env" > /dev/null 81 | 82 | ################################################################################ 83 | 84 | sudo certbot certonly \ 85 | --manual \ 86 | --manual-auth-hook certbot-auth-hook \ 87 | --domain "$domain" \ 88 | --email "$email" 89 | -------------------------------------------------------------------------------- /bin/colours: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Print all the colours. 4 | # 5 | # Usage: 6 | # 7 | # colours [-t|--terse] 8 | # 9 | # -t, --terse: compact mode 10 | # 11 | 12 | import sys 13 | terse = "-t" in sys.argv[1:] or "--terse" in sys.argv[1:] 14 | write = sys.stdout.write 15 | for i in range(2 if terse else 10): 16 | for j in range(30, 38): 17 | for k in range(40, 48): 18 | if terse: 19 | write("\33[%d;%d;%dm%d;%d;%d\33[m " % (i, j, k, i, j, k)) 20 | else: 21 | write("%d;%d;%d: \33[%d;%d;%dm Hello, World! \33[m \n" % 22 | (i, j, k, i, j, k,)) 23 | write("\n") 24 | -------------------------------------------------------------------------------- /bin/contributing: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | project=$(basename "$PWD") 4 | file=CONTRIBUTING.org 5 | readme_file=README.org 6 | 7 | message=$(echo "Everyone is welcome to contribute to =$project= project. Feature 8 | requests, proposals, issue reports, documentation improvements, code patches - 9 | just to name few things that the project can gain from. 10 | 11 | Please note that the main upstream of =$project= is located on 12 | [[https://gitlab.com/d12frosted/$project][GitLab]], and it's advisable to send 13 | your contributions there. But they can be accepted also via 14 | [[mailto:boris@d12frosted.io][email]] and 15 | [[https://github.com/d12frosted/$project][GitHub]].") 16 | 17 | if [ -f .gitlab-ci.yml ]; then 18 | message=$(echo "$message 19 | 20 | This project has automated tests that are run on 21 | [[https://gitlab.com/d12frosted/$project][GitLab]]. If you are contributing 22 | outside of GitLab, please run the tests manually. For more information please 23 | refer to relevant section in readme file or contact me via email.") 24 | 25 | fi 26 | 27 | message=$(echo "$message 28 | 29 | Happy hacking!") 30 | 31 | echo "#+STARTUP: showall 32 | 33 | * Contributing 34 | 35 | $message" > $file 36 | 37 | emacs \ 38 | -nw \ 39 | --eval "(progn 40 | (find-file \"$file\") 41 | (sit-for 0.1) 42 | (ignore-errors (call-interactively #'org-show-subtree)) 43 | (sit-for 0.1) 44 | (while (not (eobp)) 45 | (sit-for 0.1) 46 | (org-forward-paragraph) 47 | (org-fill-paragraph)) 48 | (save-buffer) 49 | (kill-emacs))" 50 | 51 | emacs \ 52 | -nw \ 53 | --eval "(progn 54 | (find-file \"$readme_file\") 55 | (sit-for 0.1) 56 | (ignore-errors (call-interactively #'org-show-subtree)) 57 | (sit-for 0.1) 58 | (if-let* 59 | ((items (imenu--make-index-alist t)) 60 | (items (delete (assoc \"*Rescan*\" items) items)) 61 | (target (seq-find 62 | (lambda (x) 63 | (string-match-p (regexp-quote \"contributing\") 64 | (cond ((consp x) (car x)) 65 | ((stringp x) x)))) 66 | (car items)))) 67 | (progn 68 | (imenu target) 69 | (sit-for 0.1) 70 | (call-interactively #'org-cut-subtree)) 71 | (end-of-buffer)) 72 | (sit-for 0.1) 73 | (insert \"** Contributing\\n\\n\") 74 | (insert \"$message\") 75 | (sit-for 0.1) 76 | (org-previous-visible-heading 1) 77 | (while (not (eobp)) 78 | (sit-for 0.1) 79 | (org-forward-paragraph) 80 | (org-fill-paragraph)) 81 | (save-buffer) 82 | (kill-emacs))" 83 | -------------------------------------------------------------------------------- /bin/fehbg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | feh --no-fehbg --bg-scale "$HOME/Dropbox/resources/wallpapers/denise-nouvion-wallpapers-4-2560x1440.jpg" 4 | -------------------------------------------------------------------------------- /bin/fix-data-case: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Fix org-mode .data directory by making sure all UUIDs are lowercase 5 | # 6 | 7 | set -e 8 | 9 | org_dir= 10 | if [ -z ${1+x} ]; then 11 | org_dir="." 12 | else 13 | org_dir="$1" 14 | fi 15 | 16 | data_dir="$org_dir/.data/" 17 | 18 | function process() { 19 | while IFS= read -r -d '' dir 20 | do 21 | ldir=$(echo "$dir" | tr '[:upper:]' '[:lower:]') 22 | if [ "$dir" != "$ldir" ]; then 23 | echo "$dir" "->" "$ldir" 24 | mv "$dir" "$ldir" 25 | fi 26 | done < <(find "$data_dir" -mindepth "$1" -maxdepth "$1" -type d -print0) 27 | } 28 | 29 | process 1 30 | process 2 31 | -------------------------------------------------------------------------------- /bin/ghc-bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | file="cabal.project" 6 | token="with-compiler" 7 | 8 | function check() { 9 | command -v "$1" >/dev/null 2>&1 10 | } 11 | 12 | check ghcup || { 13 | echo "Could not find ghcup in your PATH." 14 | echo "Make sure it's installed and try again." 15 | exit 1 16 | } 17 | 18 | if [ ! -f "$file" ]; then 19 | echo "Could not find $file file!" 20 | echo "Please cd into cabal project root." 21 | exit 1 22 | fi 23 | 24 | with_compiler=$(grep -m 1 "$token" "$file" || echo "") 25 | 26 | if [ -z "$with_compiler" ]; then 27 | echo "Your $file doesn't have $token." 28 | exit 1 29 | fi 30 | 31 | ghc_version=${with_compiler#$token: ghc-} 32 | 33 | echo "Your project requires GHC $ghc_version" 34 | 35 | ghcup install hls 36 | ghcup install ghc "$ghc_version" 37 | ghcup set ghc "$ghc_version" 38 | 39 | echo "Success!" 40 | -------------------------------------------------------------------------------- /bin/haskell-language-server-wrapper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -f flake.nix ]; then 4 | nix develop --command haskell-language-server $@ 5 | else 6 | $HOME/.local/bin/haskell-language-server-wrapper $@ 7 | fi 8 | -------------------------------------------------------------------------------- /bin/hls-wrapper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | ghc-bootstrap 6 | exec haskell-language-server-wrapper 7 | -------------------------------------------------------------------------------- /bin/inactive-repo-notifier.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Supports only master branch. And remote named origin. 4 | # 5 | # Notification is not posted if notification file already contains specified 6 | # message. 7 | 8 | set -e 9 | 10 | REMOTE_URL="$1" 11 | REPO_PATH="$2" 12 | NOTIFICATION_FILE="$3" 13 | MESSAGE="$4" 14 | THRESHOLD_SECONDS="$5" 15 | 16 | function log { 17 | echo "[$(date '+%d/%m/%y %H:%M:%S')]" "$@" 18 | } 19 | 20 | repo_name=${REMOTE_URL#*:} 21 | repo_name=${repo_name%.git} 22 | 23 | log "Checking $repo_name for being inactive" 24 | 25 | if [[ ! -d "$REPO_PATH/.git" ]]; then 26 | log "Missing local copy of repository" 27 | git clone --depth 1 "$REMOTE_URL" "$REPO_PATH" 28 | fi 29 | 30 | cd "$REPO_PATH" && { 31 | git fetch --all 32 | git reset --hard origin/master 33 | 34 | now=$(date +%s) 35 | last=$(git show -s --format=%ct HEAD) 36 | diff=$(($now - $last)) 37 | if [[ $diff -ge $THRESHOLD_SECONDS ]]; then 38 | log "No updates for $diff seconds." 39 | if [[ $(cat "$NOTIFICATION_FILE" | grep "$MESSAGE") ]]; then 40 | echo "Notification already exists, so not creating new one." 41 | else 42 | echo "Creating notification." 43 | echo "$MESSAGE" >> "$NOTIFICATION_FILE" 44 | fi 45 | else 46 | log "Last update was $diff seconds ago. Repo is active." 47 | fi 48 | } 49 | -------------------------------------------------------------------------------- /bin/launch_emacs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | /usr/local/bin/emacsclient --no-wait "$1" 4 | -------------------------------------------------------------------------------- /bin/notify: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################################################ 4 | 5 | APPLICATION=notify 6 | MESSAGE= 7 | URGENCY=normal 8 | 9 | ACTION=$1 10 | shift 11 | 12 | POSITIONAL=() 13 | while [[ $# -gt 0 ]] 14 | do 15 | key="$1" 16 | case $key in 17 | -m|--message) 18 | MESSAGE="$2" 19 | shift # past argument 20 | shift # past value 21 | ;; 22 | -t|--title) 23 | TITLE="$2" 24 | shift # past argument 25 | shift # past value 26 | ;; 27 | -a|--application) 28 | APPLICATION="$2" 29 | shift # past argument 30 | shift # past value 31 | ;; 32 | -u|--urgency) 33 | URGENCY="$2" 34 | shift # past argument 35 | shift # past value 36 | ;; 37 | *) # unknown option 38 | POSITIONAL+=("$1") # save it in an array for later 39 | shift # past argument 40 | ;; 41 | esac 42 | done 43 | set -- "${POSITIONAL[@]}" # restore positional parameters 44 | 45 | function print_usage() { 46 | echo "Usage: 47 | notify ACTION 48 | 49 | Actions: 50 | help Show help options 51 | send Send a notification 52 | status Get status of the notification system (enabled, disabled) 53 | enable Enable notification system 54 | disable Disable notification system 55 | toggle Toggle the status of notification system 56 | 57 | Send Options: 58 | -a|--application TEXT Specify the application sending notification 59 | -t|--title TEXT Specify the title of the notification (required) 60 | -m|--message TEXT Specify the message of the notification 61 | -u|--urgency LEVEL Specify the urgency level (low, normal or critical) 62 | " 63 | } 64 | 65 | ################################################################################ 66 | 67 | function check() { 68 | command -v "$1" >/dev/null 2>&1 69 | } 70 | 71 | ################################################################################ 72 | 73 | status_file="$XDG_DATA_HOME/notify/status" 74 | mkdir -p "$XDG_DATA_HOME/notify" 75 | 76 | function exec() { 77 | case $1 in 78 | help) 79 | print_usage 80 | ;; 81 | send) 82 | if [[ -z $TITLE ]]; then 83 | echo "Missing title!" 84 | echo 85 | print_usage 86 | exit 1 87 | fi 88 | 89 | check notify-send && { 90 | notify-send -a "$APPLICATION" "$TITLE" "$MESSAGE" -u "$URGENCY" 91 | } 92 | check terminal-notifier && { 93 | terminal-notifier -title "$APPLICATION" -subtitle "$TITLE" -message "$MESSAGE" 94 | } 95 | ;; 96 | status) 97 | if check defaults; then 98 | status=$(defaults read ~/Library/Preferences/ByHost/com.apple.notificationcenterui.plist doNotDisturb) 99 | status=$(( ( status + 1 ) % 2)) 100 | else 101 | status=$(cat "$status_file" 2>/dev/null) 102 | fi 103 | if [[ "$status" = "1" ]]; then 104 | echo "enabled" 105 | else 106 | echo "disabled" 107 | fi 108 | ;; 109 | enable) 110 | echo "1" > "$XDG_DATA_HOME/notify/status" 111 | check dunstctl && { 112 | dunstctl set-paused false 113 | } 114 | ;; 115 | disable) 116 | echo "0" > "$XDG_DATA_HOME/notify/status" 117 | check dunstctl && { 118 | dunstctl set-paused true 119 | } 120 | ;; 121 | toggle) 122 | status=$(cat "$status_file" 2>/dev/null) 123 | if [[ "$status" = "1" ]]; then 124 | exec disable 125 | else 126 | exec enable 127 | fi 128 | ;; 129 | *) 130 | print_usage 131 | exit 1 132 | ;; 133 | esac 134 | } 135 | 136 | exec "$ACTION" 137 | 138 | ################################################################################ 139 | -------------------------------------------------------------------------------- /bin/on_desktop_switch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | osascript -e 'tell application "Übersicht"' \ 4 | -e 'refresh widget id "desktop-coffee"' \ 5 | -e 'refresh widget id "window-coffee"' \ 6 | -e 'end tell' 7 | -------------------------------------------------------------------------------- /bin/on_window_switch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | osascript -e 'tell application "Übersicht" to refresh widget id "window-coffee"' -------------------------------------------------------------------------------- /bin/open_kitty: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # https://github.com/noperator/dotfiles/blob/master/.config/kitty/launch-instance.sh 4 | 5 | # Launch a kitty window from another kitty window, while: 6 | # 1. Copying the first window's working directory, and 7 | # 2. Keeping the second window on the first window's focused display. 8 | 9 | FOCUSED_WINDOW=$(yabai -m query --windows --window) 10 | 11 | # If launching _from_ a focused kitty window, open the new kitty window with 12 | # the same working directory. The socket is required to use control messages to 13 | # grab the working directory of the focused kitty window; more details in 14 | # kitty's documentation: 15 | # - https://sw.kovidgoyal.net/kitty/invocation.html?highlight=socket#cmdoption-kitty-listen-on 16 | FOCUSED_WINDOW_APP=$(echo "$FOCUSED_WINDOW" | jq '.app' -r) 17 | if [[ "$FOCUSED_WINDOW_APP" == 'kitty' ]]; then 18 | DIR=$( 19 | /Applications/Kitty.app/Contents/MacOS/kitty @ --to unix:/tmp/mykitty ls | 20 | jq '.[] | select(.is_focused==true) | .tabs[] | select(.is_focused==true) | .windows[] | .cwd' -r 21 | ) 22 | else 23 | DIR="$HOME" 24 | fi 25 | 26 | # Adapted a few changes from @yanzhang0219's script to leverage yabai signals to 27 | # move the new kitty window to the focused display, rather than the display the 28 | # first kitty window was launched from. 29 | # - https://github.com/koekeishiya/yabai/issues/413#issuecomment-604072616 30 | # - https://github.com/koekeishiya/yabai/wiki/Commands#automation-with-rules-and-signals 31 | FOCUSED_WINDOW_DISPLAY=$(echo "$FOCUSED_WINDOW" | jq .display) 32 | FOCUSED_WINDOW_ID=$(echo "$FOCUSED_WINDOW" | jq .id) 33 | 34 | yabai -m signal --add \ 35 | action="yabai -m signal --remove temp_move_kitty; 36 | YABAI_WINDOW_DISPLAY=\$(yabai -m query --windows --window $YABAI_WINDOW_ID | jq .display); 37 | if ! [[ \$YABAI_WINDOW_DISPLAY == $FOCUSED_WINDOW_DISPLAY ]]; then 38 | yabai -m window \$YABAI_WINDOW_ID --warp $FOCUSED_WINDOW_ID; 39 | yabai -m window --focus \$YABAI_WINDOW_ID; 40 | fi" \ 41 | app=kitty \ 42 | event=window_created \ 43 | label=temp_move_kitty 44 | 45 | # Launch new kitty window; the temporary signal above will move it to the 46 | # focused display. 47 | /Applications/Kitty.app/Contents/MacOS/kitty --listen-on unix:/tmp/mykitty --single-instance --directory "$DIR" 48 | -------------------------------------------------------------------------------- /bin/patch_skhd_path: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | plist_path=$(brew --prefix skhd)/homebrew.mxcl.skhd.plist 4 | temp_plist_path=$TMPDIR/homebrew.mxcl.skhd.plist 5 | path_value="~/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" 6 | 7 | echo "Patching skhd PATH" 8 | 9 | rm -rf "$temp_plist_path" 10 | 11 | found_path_var=0 12 | while IFS='' read -r line || [[ -n "$line" ]]; do 13 | if [[ "$found_path_var" == "1" ]]; then 14 | echo " $path_value" >> "$temp_plist_path" 15 | found_path_var=0 16 | else 17 | echo "$line" >> "$temp_plist_path" 18 | fi 19 | 20 | if [[ $line == *"PATH"* ]]; then 21 | found_path_var="1" 22 | fi 23 | done < "$plist_path" 24 | 25 | mv "$temp_plist_path" "$plist_path" 26 | 27 | echo "Done patching skhd PATH" 28 | 29 | echo "Restart skhd" 30 | brew services restart skhd 31 | -------------------------------------------------------------------------------- /bin/respawn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for PID in `pgrep $1`; do 4 | kill ${PID} > /dev/null & 5 | done 6 | 7 | $1 & 8 | -------------------------------------------------------------------------------- /bin/safe_link: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Extracted from Eru.sh 4 | # 5 | # Use at your own risk. 6 | # 7 | 8 | set -e 9 | 10 | s="$1" 11 | t="$2" 12 | d=$(dirname "$t") 13 | 14 | if [[ -d "$d" ]]; then 15 | owner=$(stat -c '%U' "$d") 16 | if [[ "$owner" != "root" && "$owner" != "$USER" ]]; then 17 | echo "can not link '$s' to '$t'" 18 | echo "owner of '$d' is $owner" 19 | echo "allowed owners: root or $USER" 20 | exit 1 21 | fi 22 | fi 23 | 24 | if [[ ! -f "$s" && ! -d "$s" ]]; then 25 | echo "can not link '$s' as it does not exist" 26 | exit 1 27 | fi 28 | 29 | if [[ ! -d $d ]]; then 30 | echo "create $d" 31 | mkdir -p "$d" 32 | fi 33 | 34 | if [[ -L "$t" ]]; then 35 | echo "relink $s -> $t" 36 | if [[ "$owner" = "root" ]]; then 37 | sudo rm "$t" 38 | else 39 | rm "$t" 40 | fi 41 | else 42 | echo "link $s -> $t" 43 | fi 44 | 45 | if [[ "$s" != /* ]]; then 46 | s=$(realpath --relative-to="$d" "$s") 47 | echo "source is relative, so changing it to $s" 48 | fi 49 | 50 | if [[ "$owner" = "root" ]]; then 51 | sudo ln -s "$s" "$t" 52 | else 53 | ln -s "$s" "$t" 54 | fi 55 | -------------------------------------------------------------------------------- /bin/switch_kbd_layout: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Select the next keyboard layout from the list [us, ua] or [us, us intl]. 4 | 5 | use_cyrillic= 6 | target_layout= 7 | target_variant= 8 | 9 | POSITIONAL=() 10 | while [[ $# -gt 0 ]] 11 | do 12 | key="$1" 13 | 14 | case $key in 15 | --use-cyrillic) 16 | use_cyrillic=t 17 | shift 18 | ;; 19 | --layout) 20 | target_layout=$2 21 | shift 22 | shift 23 | ;; 24 | --variant) 25 | target_variant=$2 26 | shift 27 | shift 28 | ;; 29 | *) # unknown option 30 | POSITIONAL+=("$1") # save it in an array for later 31 | shift # past argument 32 | ;; 33 | esac 34 | done 35 | set -- "${POSITIONAL[@]}" # restore positional parameters 36 | 37 | if [[ -z "$target_layout" ]]; then 38 | layout=$(setxkbmap -query | awk '/layout/{print $2}') 39 | variant=$(setxkbmap -query | awk '/variant/{print $2}') 40 | case $layout in 41 | us) 42 | if [ -z "$use_cyrillic" ]; then 43 | target_layout=us 44 | case $variant in 45 | intl) 46 | target_variant= 47 | ;; 48 | *) 49 | target_variant=intl 50 | ;; 51 | esac 52 | else 53 | target_layout=ua 54 | fi 55 | ;; 56 | *) 57 | target_layout=us 58 | ;; 59 | esac 60 | fi 61 | 62 | setxkbmap -layout $target_layout -variant $target_variant 63 | -------------------------------------------------------------------------------- /bin/sync_spacemacs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Sync spacemacs fork with original repository 4 | # 5 | 6 | # Configs 7 | # 8 | 9 | REPO=~/.spacemacs 10 | BRANCH=develop 11 | REMOTE_ORIGIN=origin 12 | REMOTE_NAME=checkversion 13 | REMOTE_URL="git@github.com:syl20bnr/spacemacs.git" 14 | 15 | # Better defaults 16 | 17 | pushd () { 18 | command pushd "$@" > /dev/null 19 | } 20 | 21 | popd () { 22 | command popd > /dev/null 23 | } 24 | 25 | # Implementation 26 | # 27 | 28 | set -e 29 | pushd "$(pwd)" 30 | if [[ ! -d "$REPO" ]]; then 31 | git clone "$REMOTE_URL" "$REPO" 32 | fi 33 | cd "$REPO" 34 | git diff-index --quiet HEAD -- || { 35 | echo "Your working directory is not clean." 36 | echo "Please commit or stash all changes before proceeding." 37 | exit 1 38 | } 39 | branch=$(git symbolic-ref --short HEAD) 40 | if [[ $branch != "$BRANCH" ]]; then 41 | echo "Switching from $branch to $BRANCH" 42 | git checkout $BRANCH 43 | fi 44 | if [[ -d $REPO/.git/refs/remotes/$REMOTE_NAME ]]; then 45 | url=$(git remote get-url $REMOTE_NAME) 46 | if [[ $url != "$REMOTE_URL" ]]; then 47 | echo "Remote '$BRANCH' has wrong url, so updating it" 48 | echo " $url -> $REMOTE_URL" 49 | git remote set-url $REMOTE_NAME $REMOTE_URL 50 | fi 51 | else 52 | echo "Could not find remote '$REMOTE_NAME', so adding it" 53 | git remote add $REMOTE_NAME $REMOTE_URL 54 | fi 55 | git fetch $REMOTE_NAME 56 | if [[ $(git rev-parse HEAD) == $(git rev-parse $REMOTE_NAME/$BRANCH) ]]; then 57 | echo "Everything up-to-date" 58 | exit 0 59 | fi 60 | echo "Fetched changes:" 61 | git --no-pager lg HEAD..$REMOTE_NAME/$BRANCH 62 | git reset --hard $REMOTE_NAME/$BRANCH 63 | git push $REMOTE_ORIGIN $BRANCH 64 | popd 65 | -------------------------------------------------------------------------------- /bin/tex2png: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Convert Tex to PNG 5 | # 6 | 7 | set -e 8 | 9 | INPUT= 10 | OUTPUT= 11 | DENSITY=300 12 | QUALITY=90 13 | 14 | POSITIONAL=() 15 | while [[ $# -gt 0 ]] 16 | do 17 | key="$1" 18 | case $key in 19 | -i|--input) 20 | INPUT="$2" 21 | shift # past argument 22 | shift # past value 23 | ;; 24 | -o|--output) 25 | OUTPUT="$2" 26 | shift # past argument 27 | shift # past value 28 | ;; 29 | --density) 30 | DENSITY="$2" 31 | shift # past argument 32 | shift # past value 33 | ;; 34 | --quality) 35 | QUALITY="$2" 36 | shift # past argument 37 | shift # past value 38 | ;; 39 | *) # unknown option 40 | POSITIONAL+=("$1") # save it in an array for later 41 | shift # past argument 42 | ;; 43 | esac 44 | done 45 | set -- "${POSITIONAL[@]}" # restore positional parameters 46 | 47 | function print_usage() { 48 | echo "Usage: 49 | 50 | gifify -i FILE [OPTIONS] 51 | 52 | -i, --input FILE (required) specify input text file 53 | 54 | -o, --output FILE (optional) specify output image file 55 | 56 | defaults to input file with extension changed to png 57 | 58 | --density INT (optional) specify density of the output image 59 | 60 | defaults to 300 61 | 62 | --quality INT (optional) specify quality of the output image 63 | 64 | defaults to 90 65 | " 66 | } 67 | 68 | if [[ -z $INPUT ]]; then 69 | echo "Missing input" 70 | print_usage 71 | exit 1 72 | fi 73 | 74 | if [[ ! -f $INPUT ]]; then 75 | echo "'$INPUT' is not a file" 76 | print_usage 77 | exit 1 78 | fi 79 | 80 | if [[ -z $OUTPUT ]]; then 81 | OUTPUT="${INPUT%.*}.png" 82 | fi 83 | 84 | FILE=$(basename "$INPUT") 85 | WORK_DIR=$(mktemp -d) 86 | 87 | echo "input: $INPUT" 88 | echo "output: $OUTPUT" 89 | echo "density: $DENSITY" 90 | echo "quality: $QUALITY" 91 | 92 | PDF_FILE="${FILE%.*}.pdf" 93 | IMG_FILE=$(basename "$OUTPUT") 94 | 95 | cp "$INPUT" "$WORK_DIR/$FILE" 96 | ( 97 | cd "$WORK_DIR" 98 | pdflatex "$FILE" -shell-escape 99 | convert -density "$DENSITY" "$PDF_FILE" -quality "$QUALITY" "$IMG_FILE" 100 | ) 101 | 102 | cp "$WORK_DIR/$IMG_FILE" "$OUTPUT" 103 | -------------------------------------------------------------------------------- /bin/vulpea-sync: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | function a_section() { 6 | local text=">>> ${*:2}" 7 | local length="${#text}" 8 | echo 9 | echo '┌────────────────────────────────────────────────────────────────────────────┐' 10 | echo -ne "│ \033[$1m$text\033[0m" 11 | printf "%$((75 - length))s│\n" 12 | echo '└────────────────────────────────────────────────────────────────────────────┘' 13 | } 14 | 15 | function section() { 16 | a_section "1;32" "$1" "${*:2}" 17 | } 18 | 19 | section "$(date '+%d/%m/%y %H:%M:%S')" 20 | 21 | echo "Sync Vulpea files in $VULPEA_DIR as $USER" 22 | cd "$VULPEA_DIR" && { 23 | git config user.name "Golem" 24 | git config user.email "golem@d12frosted.io" 25 | git add . 26 | if git diff-index --quiet --cached HEAD --; then 27 | echo "nothing to commit" 28 | else 29 | git commit -m "[$(date '+%d/%m/%y %H:%M:%S')] sync" 30 | fi 31 | } 32 | 33 | echo "fetching commits..." 34 | git fetch origin 35 | echo "rebasing..." 36 | git rebase origin/master 37 | 38 | if [ "$USER" = "d12frosted" ]; then 39 | echo "pushing..." 40 | git push origin master 41 | fi 42 | -------------------------------------------------------------------------------- /bin/xlock-wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # make sure that US layout is selected 4 | switch_kbd_layout --layout us 5 | 6 | # actually lock the screen 7 | # xset s activate 8 | 9 | export XSECURELOCK_AUTH_CURSOR_BLINK=0 10 | export XSECURELOCK_PASSWORD_PROMPT=disco 11 | export XSECURELOCK_SHOW_HOSTNAME=0 12 | xsecurelock 13 | -------------------------------------------------------------------------------- /bin/yabai-layout-toggle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ "$(yabai -m query --spaces | jq -re '.[] | select(."is-visible").type')" == 'bsp' ]; then 4 | yabai -m space --layout stack 5 | else 6 | yabai -m space --layout bsp 7 | fi 8 | -------------------------------------------------------------------------------- /bin/yabai-relaunch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai" 4 | -------------------------------------------------------------------------------- /bin/yabai-window-focus: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | direction="$1" 4 | 5 | case $direction in 6 | prev) 7 | yabai -m query --spaces \ 8 | | jq -re '.[] | select(."is-visible").index' \ 9 | | xargs -I{} yabai -m query --windows --space {} \ 10 | | jq -sre 'add | map(select(."is-hidden" == false) | select(."is-minimized" == false)) | sort_by(.display, .frame.x, .frame.y, ."stack-index", .id) | reverse | nth(index(map(select(."has-focus"))) - 1).id' \ 11 | | xargs -I{} yabai -m window --focus {} 12 | ;; 13 | next) 14 | yabai -m query --spaces \ 15 | | jq -re '.[] | select(."is-visible").index' \ 16 | | xargs -I{} yabai -m query --windows --space {} \ 17 | | jq -sre 'add | map(select(."is-hidden" == false) | select(."is-minimized" == false)) | sort_by(.display, .frame.x, .frame.y, ."stack-index", .id) | nth(index(map(select(."has-focus"))) - 1).id' \ 18 | | xargs -I{} yabai -m window --focus {} 19 | ;; 20 | *) 21 | echo "unknown direction '$direction'" 22 | exit 1 23 | ;; 24 | esac 25 | -------------------------------------------------------------------------------- /dunst/dunstrc: -------------------------------------------------------------------------------- 1 | [global] 2 | monitor = 0 3 | follow = mouse 4 | geometry = "480x120-0+32" 5 | indicate_hidden = yes 6 | shrink = no 7 | separator_height = 0 8 | padding = 14 9 | horizontal_padding = 14 10 | frame_width = 2 11 | sort = no 12 | idle_threshold = 120 13 | font = Source Code Pro 10 14 | line_height = 3 15 | markup = full 16 | format = %a\n%s\n%b 17 | alignment = left 18 | show_age_threshold = 60 19 | word_wrap = yes 20 | ignore_newline = no 21 | stack_duplicates = false 22 | hide_duplicate_count = yes 23 | show_indicators = false 24 | icon_position = off 25 | sticky_history = yes 26 | history_length = 20 27 | browser = /usr/bin/firefox-nightly -new-tab 28 | always_run_script = true 29 | title = Dunst 30 | class = Dunst 31 | 32 | [urgency_low] 33 | timeout = 4 34 | background = "#fefefe" 35 | foreground = "#050505" 36 | frame_color = "#93ccea" 37 | 38 | [urgency_normal] 39 | timeout = 8 40 | background = "#fefef0" 41 | foreground = "#050505" 42 | frame_color = "#93ccea" 43 | 44 | [urgency_critical] 45 | timeout = 0 46 | background = "#fef0f0" 47 | foreground = "#050505" 48 | frame_color = "#93ccea" 49 | -------------------------------------------------------------------------------- /emacs/.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((emacs-lisp-mode . ((byte-compile-error-on-warn . t) 2 | (fill-column . 70) 3 | (indent-tabs-mode . nil) 4 | (elisp-lint-indent-specs . ((vulpea-utils-with-file . 1) 5 | (vulpea-utils-with-note . 1) 6 | (org-roam-with-file . 2) 7 | (org-with-point-at . 1) 8 | (org-element-map . 2) 9 | (file-templates-set . defun) 10 | (leader-def . 0) 11 | (dlet . 1) 12 | (general-create-definer . 1) 13 | (eval-with-default-dir . 1) 14 | (bui-define-interface . 2) 15 | (use-package . 1) 16 | (buffer-lines-map . 1) 17 | (buffer-lines-each . 1) 18 | (buffer-lines-each-t . 1) 19 | (request . defun))))) 20 | (org-mode . ((fill-column . 80) 21 | (vulpea-id-auto-targets . nil)))) 22 | -------------------------------------------------------------------------------- /emacs/.gitignore: -------------------------------------------------------------------------------- 1 | *.elc 2 | .eldev 3 | *-autoloads.el 4 | lib-private-*.el 5 | init-private-*.el 6 | config-private-*.el 7 | -------------------------------------------------------------------------------- /emacs/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean 2 | clean: 3 | eldev clean all 4 | 5 | .PHONY: bootstrap 6 | bootstrap: 7 | eldev clean 8 | eldev -C --unstable -a -dtT build 9 | 10 | .PHONY: upgrade 11 | upgrade: 12 | eldev -C --unstable -a -dtT upgrade 13 | 14 | .PHONY: compile 15 | compile: 16 | eldev clean elc 17 | eldev -C --unstable -a -dtT compile 18 | 19 | .PHONY: lint 20 | lint: 21 | eldev -C --unstable -a -dtT lint 22 | 23 | .PHONY: test 24 | test: 25 | eldev exec t 26 | eldev -C --unstable -a -dtT test 27 | 28 | .PHONY: vulpea 29 | vulpea: 30 | eldev -C --unstable exec "(-vulpea-db-bootstrap)" 31 | 32 | .PHONY: brb 33 | brb: 34 | eldev -C --unstable exec "(-brb-sync)" 35 | -------------------------------------------------------------------------------- /emacs/early-init.el: -------------------------------------------------------------------------------- 1 | ;;; early-init.el --- Early customization -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 24 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; See Emacs Help for more information on The Early Init File. 33 | ;; Basically, this file contains frame customizations. 34 | ;; 35 | ;;; Code: 36 | 37 | ;; the sooner the better 38 | (setq package-enable-at-startup nil) 39 | 40 | ;; Less clutter 41 | (add-to-list 'default-frame-alist '(tool-bar-lines . 0)) 42 | (add-to-list 'default-frame-alist '(menu-bar-lines . 0)) 43 | (add-to-list 'default-frame-alist '(undecorated . nil)) 44 | (add-to-list 'default-frame-alist '(undecorated-round . t)) 45 | (add-to-list 'default-frame-alist '(vertical-scroll-bars . nil)) 46 | (add-to-list 'default-frame-alist '(horizontal-scroll-bars . nil)) 47 | (add-to-list 'default-frame-alist '(internal-border-width . 18)) 48 | (add-to-list 'default-frame-alist '(child-frame-border-width . 2)) 49 | ;; (add-to-list 'default-frame-alist '(left-fringe . 0)) 50 | ;; (add-to-list 'default-frame-alist '(right-fringe . 0)) 51 | 52 | ;; LSP needs that 53 | (setenv "LSP_USE_PLISTS" "true") 54 | 55 | (provide 'early-init) 56 | ;;; early-init.el ends here 57 | -------------------------------------------------------------------------------- /emacs/images/litnotes-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/emacs/images/litnotes-1.png -------------------------------------------------------------------------------- /emacs/images/litnotes-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/emacs/images/litnotes-2.png -------------------------------------------------------------------------------- /emacs/images/vino-inventory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/emacs/images/vino-inventory.png -------------------------------------------------------------------------------- /emacs/images/vino-stats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/emacs/images/vino-stats.png -------------------------------------------------------------------------------- /emacs/lisp/config-path.el: -------------------------------------------------------------------------------- 1 | ;;; config-path.el --- Path constants -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; This module defines path constants used across other modules. 33 | ;; 34 | ;;; Code: 35 | 36 | (defconst path-home-dir (file-name-as-directory (getenv "HOME")) 37 | "Path to user home directory. 38 | 39 | In a nutshell, it's just a value of $HOME.") 40 | 41 | (defconst path-cloud-dir (expand-file-name "Library/Mobile Documents/com~apple~CloudDocs/" path-home-dir) 42 | "Path to a cloud storage directory.") 43 | 44 | ;; (defconst path-cloud-dir (expand-file-name "Library/CloudStorage/Dropbox/" path-home-dir) 45 | ;; "Path to a cloud storage directory.") 46 | 47 | (defconst path-config-dir 48 | (file-name-as-directory 49 | (or (getenv "XDG_CONFIG_HOME") 50 | (concat path-home-dir ".config"))) 51 | "The root directory for personal configurations.") 52 | 53 | (defconst path-emacs-dir 54 | (file-name-as-directory 55 | (expand-file-name "emacs/" path-config-dir)) 56 | "The path to this Emacs directory.") 57 | 58 | (defconst path-autoloads-file 59 | (expand-file-name "lisp/init-autoloads.el" path-emacs-dir) 60 | "The path to personal autoloads file.") 61 | 62 | (defconst path-emacs-private-dir 63 | (concat path-cloud-dir "emacs/") 64 | "The root directory for private configurations.") 65 | 66 | (defconst path-local-dir 67 | (concat 68 | (file-name-as-directory 69 | (or (getenv "XDG_CACHE_HOME") 70 | (concat path-home-dir ".cache"))) 71 | "emacs/") 72 | "The root directory for local Emacs files. 73 | 74 | Use this as permanent storage for files that are safe to share 75 | across systems.") 76 | 77 | (defconst path-etc-dir (concat path-local-dir "etc/") 78 | "Directory for non-volatile storage. 79 | 80 | Use this for files that don't change much, like servers binaries, 81 | external dependencies or long-term shared data.") 82 | 83 | (defconst path-cache-dir (concat path-local-dir "cache/") 84 | "Directory for volatile storage. 85 | 86 | Use this for files that change often, like cache files.") 87 | 88 | (defconst path-packages-dir 89 | (expand-file-name (format "packages/%s.%s/" 90 | emacs-major-version 91 | emacs-minor-version) 92 | path-local-dir) 93 | "Where packages are stored.") 94 | 95 | (defconst path-projects-dir 96 | (file-name-as-directory 97 | (or (getenv "PROJECTS_HOME") 98 | (concat path-home-dir "Developer"))) 99 | "The root directory for projects.") 100 | 101 | (provide 'config-path) 102 | ;;; config-path.el ends here 103 | -------------------------------------------------------------------------------- /emacs/lisp/config-vulpea.el: -------------------------------------------------------------------------------- 1 | ;;; config-vulpea.el --- Vulpea configurations -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 14 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Configurations for `vulpea' and `org-mode'. 33 | ;; 34 | ;;; Code: 35 | 36 | (require 'config-path) 37 | 38 | (defvar vulpea-test-mode 39 | (file-exists-p 40 | (expand-file-name "vulpea_test" path-cache-dir)) 41 | "Non-nil if notes should start in a test mode. 42 | 43 | Probably that means using directory with test notes instead of 44 | real notes. Maybe it also means experimental features.") 45 | 46 | (defvar vulpea-directory 47 | (if vulpea-test-mode 48 | (expand-file-name 49 | "vulpea-test/" 50 | path-home-dir) 51 | (expand-file-name 52 | "vulpea/" 53 | path-home-dir)) 54 | "Directory containing notes.") 55 | 56 | (provide 'config-vulpea) 57 | ;;; config-vulpea.el ends here 58 | -------------------------------------------------------------------------------- /emacs/lisp/dash-functional.el: -------------------------------------------------------------------------------- 1 | ;;; dash-functional.el --- Mocking dash-functional -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 16 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Unfortunately, dash-functional is obsolete. And instead of talking 33 | ;; to popular libraries, they simply put a warning inside this 34 | ;; package, meaning that people treating warnings as errors have no 35 | ;; way to load this module (even transitively). 36 | ;; 37 | ;; Thanks, folks! I really appreciate it. 38 | ;; 39 | ;; So this module is a fake to avoid byte compilation error. 40 | ;; 41 | ;;; Code: 42 | 43 | (require 'dash) 44 | 45 | (provide 'dash-functional) 46 | ;;; dash-functional.el ends here 47 | -------------------------------------------------------------------------------- /emacs/lisp/init-data-formats.el: -------------------------------------------------------------------------------- 1 | ;;; init-data-formats.el --- Data Formats -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2025, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 06 Mar 2025 9 | ;; 10 | ;; URL: https://github.com/d12frosted/ 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;;; Code: 33 | 34 | (use-package json-snatcher 35 | :ensure t 36 | :defer t) 37 | 38 | (use-package json-mode 39 | :ensure t 40 | :defer t) 41 | 42 | (use-package yaml-mode 43 | :ensure t 44 | :defer t 45 | :hook 46 | (yaml-mode . lsp) 47 | :init 48 | (setq-default yaml-indent-offset tab-width) 49 | :config) 50 | 51 | (use-package protobuf-mode 52 | :ensure t 53 | :defer t) 54 | 55 | (provide 'init-data-formats) 56 | ;;; init-data-formats.el ends here 57 | -------------------------------------------------------------------------------- /emacs/lisp/init-dired.el: -------------------------------------------------------------------------------- 1 | ;;; init-dired.el --- Dired configurations -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 16 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Configurations for wonderful `dired'. 33 | ;; 34 | ;;; Code: 35 | 36 | 37 | 38 | (use-package dired 39 | :ensure nil 40 | :init 41 | (setq 42 | dired-listing-switches "-alh" 43 | dired-recursive-copies 'always 44 | dired-recursive-deletes 'top 45 | dired-auto-revert-buffer t 46 | dired-hide-details-hide-symlink-targets nil)) 47 | 48 | 49 | 50 | ;; sort dired buffer so directories are first 51 | (add-hook 'dired-after-readin-hook #'dired-sort-directories-first) 52 | 53 | (defun dired-sort-directories-first () 54 | "List directories first in Dired buffers." 55 | (save-excursion 56 | (let (buffer-read-only) 57 | (forward-line 2) ;; beyond dir. header 58 | (sort-regexp-fields t "^.*$" "[ ]*." (point) (point-max)))) 59 | (set-buffer-modified-p nil)) 60 | 61 | 62 | 63 | (provide 'init-dired) 64 | ;;; init-dired.el ends here 65 | -------------------------------------------------------------------------------- /emacs/lisp/init-env.el: -------------------------------------------------------------------------------- 1 | ;;; init-env.el --- Environment configurations -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Environment-related configurations. 33 | ;; 34 | ;;; Code: 35 | 36 | (defconst env-graphic-p (display-graphic-p)) 37 | (defconst env-rootp (string-equal "root" (getenv "USER"))) 38 | (defconst env-sys-mac-p (eq system-type 'darwin)) 39 | (defconst env-sys-linux-p (eq system-type 'gnu/linux)) 40 | (defconst env-sys-name (system-name)) 41 | 42 | (provide 'init-env) 43 | ;;; init-env.el ends here 44 | -------------------------------------------------------------------------------- /emacs/lisp/init-haskell.el: -------------------------------------------------------------------------------- 1 | ;;; init-haskell.el --- Haskell support -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 16 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Haskell support. 33 | ;; 34 | ;;; Code: 35 | 36 | (use-package haskell-mode 37 | :ensure t 38 | :hook ((haskell-mode . subword-mode)) 39 | :config 40 | (file-templates-set 41 | 'haskell-mode 42 | :trigger "__module" 43 | :project t) 44 | (setq haskell-process-suggest-remove-import-lines t 45 | haskell-process-auto-import-loaded-modules t) 46 | ;; flycheck makes this unnecessary 47 | (setq haskell-process-show-overlays nil) 48 | (add-to-list 'completion-ignored-extensions ".hi")) 49 | 50 | (use-package ormolu 51 | :ensure t 52 | :hook (haskell-mode . ormolu-format-on-save-mode)) 53 | 54 | (use-package lsp-haskell 55 | :ensure t 56 | :after haskell-mode 57 | :hook ((haskell-mode . lsp)) 58 | :commands (lsp-haskell--hie-command) 59 | :init 60 | (setq-default 61 | lsp-haskell-importlens-on nil)) 62 | 63 | (provide 'init-haskell) 64 | ;;; init-haskell.el ends here 65 | -------------------------------------------------------------------------------- /emacs/lisp/init-js.el: -------------------------------------------------------------------------------- 1 | ;;; init-js.el --- JS/TS support -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 19 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; JS/TS support. 33 | ;; 34 | ;; npm i -g typescript-language-server; npm i -g typescript 35 | ;; 36 | ;;; Code: 37 | 38 | (require 'init-elpa) 39 | (require 'init-ide) 40 | 41 | (use-package lsp-eslint 42 | :after lsp-mode) 43 | 44 | (use-package lsp-tailwindcss 45 | :ensure (:host github :repo "merrickluo/lsp-tailwindcss") 46 | :after lsp-mode 47 | :init 48 | (setq lsp-tailwindcss-add-on-mode t 49 | lsp-tailwindcss-server-version "0.14.7") 50 | :config 51 | (dolist (tw-major-mode 52 | '(css-mode 53 | css-ts-mode 54 | typescript-mode 55 | typescript-ts-mode 56 | tsx-ts-mode 57 | js2-mode 58 | js-ts-mode 59 | clojure-mode)) 60 | (add-to-list 'lsp-tailwindcss-major-modes tw-major-mode))) 61 | 62 | (provide 'init-js) 63 | ;;; init-js.el ends here 64 | -------------------------------------------------------------------------------- /emacs/lisp/init-kbd.el: -------------------------------------------------------------------------------- 1 | ;;; init-kbd.el --- Keybinding configurations -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Install all required packages and setup key bindings. 33 | ;; 34 | ;;; Code: 35 | 36 | (require 'init-env) 37 | 38 | (defmacro leader-def (&rest args) 39 | "A wrapper for `general-def'. 40 | 41 | ARGS are arguments, right?" 42 | (declare (indent defun)) 43 | `(,'general-def ,@args ,@'(:states nil 44 | :keymaps 'override 45 | :prefix "M-m" 46 | :prefix-command 'prefix-command 47 | :prefix-map 'prefix-map))) 48 | 49 | (use-package general 50 | :ensure (:wait t) 51 | :demand t 52 | :init 53 | (leader-def 54 | "/" '(nil :which-key "search...") 55 | "[" '(nil :which-key "previous...") 56 | "a" '(nil :which-key "align...") 57 | "g" '(nil :which-key "git...") 58 | "i" '(nil :which-key "insert...") 59 | "j" '(nil :which-key "jump...") 60 | "o" '(nil :which-key "open...") 61 | "v" '(nil :which-key "vino..."))) 62 | 63 | (use-package which-key 64 | :ensure (:wait t) 65 | :demand t 66 | :diminish which-key-mode 67 | :init 68 | (which-key-mode)) 69 | 70 | (defvar kbd-escape-hook nil 71 | "A hook run after \\[keyboard-quit] is pressed. 72 | 73 | Triggers `kbd-escape'. 74 | 75 | If any hook returns non-nil, all hooks after it are ignored.") 76 | 77 | (defun kbd-escape () 78 | "Run the `kbd-escape-hook'." 79 | (interactive) 80 | (cond ((minibuffer-window-active-p (minibuffer-window)) 81 | ;; quit the minibuffer if open. 82 | (abort-recursive-edit)) 83 | ;; Run all escape hooks. If any returns non-nil, then stop 84 | ;; there. 85 | ((cl-find-if #'funcall kbd-escape-hook)) 86 | ;; don't abort macros 87 | ((or defining-kbd-macro executing-kbd-macro) nil) 88 | ;; Back to the default 89 | ((keyboard-quit)))) 90 | 91 | (global-set-key [remap keyboard-quit] #'kbd-escape) 92 | 93 | (when (and env-sys-mac-p env-graphic-p) 94 | (defvar mac-option-modifier) 95 | (defvar mac-command-modifier) 96 | (setq mac-option-modifier nil 97 | mac-command-modifier 'meta)) 98 | 99 | (provide 'init-kbd) 100 | ;;; init-kbd.el ends here 101 | -------------------------------------------------------------------------------- /emacs/lisp/init-markdown.el: -------------------------------------------------------------------------------- 1 | ;;; init-markdown.el --- Markdown markup language support -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 04 Oct 2022 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;;; Code: 33 | 34 | (use-package markdown-mode 35 | :defer t 36 | :hook ((markdown-mode . markdown-toggle-fontify-code-blocks-natively))) 37 | 38 | (provide 'init-markdown) 39 | ;;; init-markdown.el ends here 40 | -------------------------------------------------------------------------------- /emacs/lisp/init-nix.el: -------------------------------------------------------------------------------- 1 | ;;; init-nix.el --- Nix support -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 15 May 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Nix support. 33 | ;; 34 | ;;; Code: 35 | 36 | ;; it might sound strange, but we need to properly install `magit' 37 | ;; before we can install `nix-mode' because the former properly 38 | ;; handles `magit-section' package, which is dependency of the latter 39 | (require 'init-vcs) 40 | 41 | (use-package nix-mode 42 | :ensure t 43 | :mode "\\.nix\\'") 44 | 45 | (provide 'init-nix) 46 | ;;; init-nix.el ends here 47 | -------------------------------------------------------------------------------- /emacs/lisp/init-pdf.el: -------------------------------------------------------------------------------- 1 | ;;; init-pdf.el --- PDF viewing support -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 17 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; PDF viewing support. 33 | ;; 34 | ;; Building pdf-tools on macOS can be daunting. One of the solutions 35 | ;; is to use nix package manager (from nix user perspective ,nix is a 36 | ;; solution for every problem): 37 | ;; 38 | ;; $ cd $PACKAGES/straight/build/pdf-tools/build/server 39 | ;; $ nix-shell -p pkg-config poppler autoconf automake libtool libpng 40 | ;; $ autoreconf -i -f 41 | ;; $ ./autobuild -i $PACKAGES/straight/build/pdf-tools --os nixos 42 | ;; 43 | ;; See https://github.com/politza/pdf-tools/issues/645 for more 44 | ;; information. 45 | ;; 46 | ;;; Code: 47 | 48 | (use-package pdf-tools 49 | :ensure t 50 | :mode ("\\.pdf\\'" . pdf-view-mode) 51 | :hook (pdf-view-mode . auto-revert-mode) 52 | :commands (pdf-info-close 53 | pdf-tools-install) 54 | :init 55 | (setq-default pdf-view-display-size 'fit-page) 56 | :config 57 | (add-hook 'pdf-view-mode-hook #'pdf-setup-view-mode)) 58 | 59 | (defun pdf-setup-view-mode () 60 | "Setup `pdf-view-mode'." 61 | (add-hook 'kill-buffer-hook #'pdf-cleanup-windows nil t) 62 | (cua-mode 0)) 63 | 64 | (defun pdf-cleanup-windows () 65 | "Kill left-over annotation buffers on document death." 66 | (when (and (boundp 'pdf-annot-list-document-buffer) 67 | (buffer-live-p pdf-annot-list-document-buffer)) 68 | (pdf-info-close pdf-annot-list-document-buffer)) 69 | (when (and (boundp 'pdf-annot-list-buffer) 70 | (buffer-live-p pdf-annot-list-buffer)) 71 | (kill-buffer pdf-annot-list-buffer)) 72 | (let ((contents-buffer (get-buffer "*Contents*"))) 73 | (when (and contents-buffer (buffer-live-p contents-buffer)) 74 | (kill-buffer contents-buffer)))) 75 | 76 | (provide 'init-pdf) 77 | ;;; init-pdf.el ends here 78 | -------------------------------------------------------------------------------- /emacs/lisp/init-project.el: -------------------------------------------------------------------------------- 1 | ;;; init-project.el --- Project support -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Project support via `project'. 33 | ;; 34 | ;;; Code: 35 | 36 | (require 'init-elpa) 37 | (require 'config-path) 38 | (require 'lib-eval) 39 | 40 | 41 | 42 | (defun project-shell-command () 43 | "Invoke `shell-command' in the project's root." 44 | (interactive) 45 | (if-let* ((project (project-current)) 46 | (root (project-root project))) 47 | (eval-with-default-dir root 48 | (call-interactively #'shell-command)) 49 | (user-error "You are not in project"))) 50 | 51 | (use-package project 52 | :ensure nil 53 | :general 54 | (leader-def 55 | "p" '(nil :which-key "project...") 56 | "p!" '(project-shell-command :which-key "Run cmd in project root") 57 | "p/" '(project-find-regexp :which-key "Grep the project") 58 | "pf" '(project-find-file :which-key "Find file in project") 59 | "pp" '(project-switch :which-key "Switch project") 60 | "pc" '(project-compile :which-key "Compile project"))) 61 | 62 | (setq project-list-file (expand-file-name "projects" path-etc-dir)) 63 | 64 | (defalias 'project-switch #'project-switch-project) 65 | 66 | (defun project-p () 67 | "Return non-nil when located in a project." 68 | (project-current)) 69 | 70 | ;; Emacs 27 71 | (unless (fboundp 'project-root) 72 | (cl-defmethod project-root ((project (head transient))) 73 | (cdr project))) 74 | 75 | (defun project-magit () 76 | "Start `magit-status' in the current project's root directory." 77 | (interactive) 78 | (magit-status-setup-buffer (project-root (project-current t)))) 79 | 80 | (setq project-switch-commands 81 | '((?f "Find file" project-find-file) 82 | (?g "Find regexp" project-find-regexp) 83 | (?d "Dired" project-dired) 84 | (?v "Magit" project-magit) 85 | (?e "Eshell" project-eshell))) 86 | 87 | (use-package rg 88 | :ensure t 89 | :defer t 90 | :commands (rg-project) 91 | :init 92 | (defalias 'project-find-regexp #'rg-project)) 93 | 94 | (provide 'init-project) 95 | ;;; init-project.el ends here 96 | -------------------------------------------------------------------------------- /emacs/lisp/init-spell.el: -------------------------------------------------------------------------------- 1 | ;;; init-spell.el --- Spell check -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 16 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Spell check support. 33 | ;; 34 | ;;; Code: 35 | 36 | (use-package jinx 37 | :ensure t 38 | :commands (global-jinx-mode) 39 | :bind (("M-$" . jinx-correct) 40 | ("C-M-$" . jinx-languages)) 41 | :init 42 | (global-jinx-mode)) 43 | 44 | (provide 'init-spell) 45 | ;;; init-spell.el ends here 46 | -------------------------------------------------------------------------------- /emacs/lisp/init-telega.el: -------------------------------------------------------------------------------- 1 | ;;; init-telega.el --- Telegram inside Em*cs -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 17 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Because Emacs, baby. Chatting in Telegram never was so pleasant and 33 | ;; hassle free. 34 | ;; 35 | ;;; Code: 36 | 37 | (use-package telega 38 | :ensure (telega 39 | :host github 40 | :repo "zevlg/telega.el" 41 | :branch "releases" 42 | :files (:defaults "contrib" "etc" "server" "Makefile")) 43 | :disabled 44 | :defer t 45 | :hook ((telega-chat-mode . ui-reset-line-spacing) 46 | (telega-webpage-mode . ui-reset-line-spacing) 47 | (telega-chat-mode . editor-disable-electric-pair)) 48 | :general 49 | (leader-def 50 | "t" '(:keymap telega-prefix-map)) 51 | :init 52 | (when (and elpa-bootstrap-p 53 | env-sys-linux-p) 54 | (require 'telega-server) 55 | (require 'lib-nix) 56 | (let ((exec-path (cons telega-directory exec-path)) 57 | (default-directory telega--lib-directory)) 58 | (unless (executable-find "telega-server") 59 | (nix-shell-command 60 | :message-intro "building telega-server..." 61 | :message-error "Failed to build telega-server" 62 | :deps '("pkg-config" "tdlib") 63 | :command (concat 64 | (or (executable-find "gmake") 65 | "make") 66 | " " 67 | "LIBS_PREFIX=" 68 | (expand-file-name telega-server-libs-prefix) " " 69 | "INSTALL_PREFIX=" 70 | (expand-file-name telega-directory) " " 71 | "server-reinstall")))))) 72 | 73 | (provide 'init-telega) 74 | ;;; init-telega.el ends here 75 | -------------------------------------------------------------------------------- /emacs/lisp/init-tools.el: -------------------------------------------------------------------------------- 1 | ;;; init-tools.el --- various tools configurations -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 30 Mar 2022 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;;; Code: 33 | 34 | (require 'config-vulpea) 35 | 36 | (use-package restclient 37 | :ensure (:host github :repo "pashky/restclient.el" :files ("restclient.el" "restclient-jq.el")) 38 | :defer t 39 | :config 40 | (require 'restclient-jq)) 41 | 42 | (use-package jq-mode 43 | :ensure t 44 | :defer t) 45 | 46 | (use-package gptel 47 | :ensure t 48 | :defer t 49 | :config 50 | (gptel-make-anthropic "Claude" 51 | :stream t 52 | :key (auth-source-pick-first-password :host "api.anthropic.com")) 53 | (setq-default 54 | gptel-model 'o1 55 | gptel-directives 56 | (let ((file (expand-file-name "gptel-directives.el" vulpea-directory))) 57 | (when (file-exists-p file) 58 | (with-temp-buffer 59 | (condition-case nil 60 | (progn 61 | (insert-file-contents file) 62 | (read (current-buffer))) 63 | (error 64 | (message "Could not read data from %s" file)))))))) 65 | 66 | (provide 'init-tools) 67 | ;;; init-tools.el ends here 68 | -------------------------------------------------------------------------------- /emacs/lisp/init-window.el: -------------------------------------------------------------------------------- 1 | ;;; init-window.el --- Window configurations -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Configurations for window system. 33 | ;; 34 | ;;; Code: 35 | 36 | ;; prefer vertical splits by default 37 | (setq split-height-threshold nil) 38 | (setq split-width-threshold 160) 39 | 40 | ;; minimum window height 41 | (setq window-min-height 1) 42 | 43 | (use-package ace-window 44 | :ensure t 45 | :defer t 46 | :init 47 | (setq-default aw-keys '(?q ?w ?e ?r ?t ?y ?u ?i ?o))) 48 | 49 | (defun window-split-vertically () 50 | "Split window vertically." 51 | (interactive) 52 | (split-window-right)) 53 | 54 | (defun window-split-vertically-and-focus () 55 | "Split window vertically and focus it." 56 | (interactive) 57 | (split-window-right) 58 | (windmove-right)) 59 | 60 | (defun window-split-horizontally () 61 | "Split window horizontally." 62 | (interactive) 63 | (split-window-below)) 64 | 65 | (defun window-split-horizontally-and-focus () 66 | "Split window horizontally and focus it." 67 | (interactive) 68 | (split-window-below) 69 | (windmove-down)) 70 | 71 | (defun window-zoom () 72 | "Close other windows to focus on this one. 73 | 74 | Activate again to undo this. If the window changes before then, 75 | the undo expires." 76 | (interactive) 77 | (if (and (one-window-p) 78 | (assq ?_ register-alist)) 79 | (jump-to-register ?_) 80 | (window-configuration-to-register ?_) 81 | (delete-other-windows))) 82 | 83 | (with-eval-after-load 'general 84 | (leader-def 85 | "C-w" '(ace-window :which-key "Ace window") 86 | "M-w" '(ace-window :which-key "Ace window") 87 | 88 | "w" '(nil :which-key "window...") 89 | "wS" '(window-split-horizontally 90 | :which-key "split frame horizontally") 91 | "wV" '(window-split-vertically 92 | :which-key "split frame vertically") 93 | "wk" '(delete-window 94 | :which-key "kill window") 95 | "wm" '(window-zoom 96 | :which-key "kill other windows") 97 | "ws" '(window-split-horizontally-and-focus 98 | :which-key "split frame horizontally and focus") 99 | "wv" '(window-split-vertically-and-focus 100 | :which-key "split frame vertically and focus"))) 101 | 102 | (provide 'init-window) 103 | ;;; init-window.el ends here 104 | -------------------------------------------------------------------------------- /emacs/lisp/lib-calc.el: -------------------------------------------------------------------------------- 1 | ;;; lib-calc.el --- Calc utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 23 Apr 2022 9 | ;; 10 | ;; URL: https://github.com/d12frosted/ 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; This module contains various utilities for working with `calc' 33 | ;; programatically. 34 | ;; 35 | ;; Feedback on this code is highly appreciated! 36 | ;; 37 | ;;; Code: 38 | 39 | (require 'calc) 40 | (require 'calc-stat) 41 | 42 | (defun calc-from-number (number) 43 | "Convert NUMBER to Calc format." 44 | (math-read-number (number-to-string number))) 45 | 46 | (defun calc-to-number (number) 47 | "Convert NUMBER from Calc format." 48 | (read (math-format-number number))) 49 | 50 | (provide 'lib-calc) 51 | ;;; lib-calc.el ends here 52 | -------------------------------------------------------------------------------- /emacs/lisp/lib-directory.el: -------------------------------------------------------------------------------- 1 | ;;; lib-directory.el --- Directory utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 14 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Various utilities for files and directories. 33 | ;; 34 | ;;; Code: 35 | 36 | (defun directory-subdirs (directory &optional rec) 37 | "Return subdirs or files of DIRECTORY. 38 | 39 | If REC is non-nil then do recursive search." 40 | (let ((res 41 | (seq-map 42 | #'file-name-as-directory 43 | (seq-remove 44 | (lambda (file) 45 | (or (string-match "\\`\\." 46 | (file-name-nondirectory file)) 47 | (string-match "\\`#.*#\\'" 48 | (file-name-nondirectory file)) 49 | (string-match "~\\'" 50 | (file-name-nondirectory file)) 51 | (not (file-directory-p file)))) 52 | (directory-files directory t))))) 53 | (if rec 54 | (apply 55 | #'append 56 | (seq-map (lambda (p) (cons p (directory-subdirs p))) 57 | res)) 58 | res))) 59 | 60 | (provide 'lib-directory) 61 | ;;; lib-directory.el ends here 62 | -------------------------------------------------------------------------------- /emacs/lisp/lib-eval.el: -------------------------------------------------------------------------------- 1 | ;;; lib-eval.el --- Eval utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Eval utilities. 33 | ;; 34 | ;;; Code: 35 | 36 | (defmacro eval-with-default-dir (dir &rest body) 37 | "Invoke in DIR the BODY." 38 | (declare (debug t) (indent 1)) 39 | `(let ((default-directory ,dir)) 40 | ,@body)) 41 | 42 | (cl-flet ((always-yes (&rest _) t)) 43 | (defun eval-no-confirm (fun &rest args) 44 | "Apply FUN to ARGS, skipping user confirmations." 45 | (cl-letf (((symbol-function 'y-or-n-p) #'always-yes) 46 | ((symbol-function 'yes-or-no-p) #'always-yes)) 47 | (apply fun args)))) 48 | 49 | (provide 'lib-eval) 50 | ;;; lib-eval.el ends here 51 | -------------------------------------------------------------------------------- /emacs/lisp/lib-fun.el: -------------------------------------------------------------------------------- 1 | ;;; lib-fun.el --- Extra functions and utlities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Utilities to build functions. 33 | ;; 34 | ;;; Code: 35 | 36 | (defun fun-unquote (exp) 37 | "Return EXP unquoted." 38 | (declare (pure t) (side-effect-free t)) 39 | (while (memq (car-safe exp) '(quote function)) 40 | (setq exp (cadr exp))) 41 | exp) 42 | 43 | (defun fun-collect-while (fn filter &rest args) 44 | "Repeat FN and collect it's results until `C-g` is used. 45 | 46 | Repeat cycle stops when `C-g` is used or FILTER returns nil. 47 | 48 | If FILTER is nil, it does not affect repeat cycle. 49 | 50 | If FILTER returns nil, the computed value is not added to result. 51 | 52 | ARGS are passed to FN." 53 | (let (result 54 | value 55 | (continue t) 56 | (inhibit-quit t)) 57 | (with-local-quit 58 | (while continue 59 | (setq value (apply fn args)) 60 | (if (and filter 61 | (null (funcall filter value))) 62 | (setq continue nil) 63 | (setq result (cons value result))))) 64 | (setq quit-flag nil) 65 | (seq-reverse result))) 66 | 67 | (defun fun-repeat-while (fn filter &rest args) 68 | "Repeat FN and return the first unfiltered result. 69 | 70 | Repeat cycle stops when `C-g` is used or FILTER returns nil. 71 | 72 | ARGS are passed to FN." 73 | (let (value 74 | (continue t) 75 | (inhibit-quit t)) 76 | (with-local-quit 77 | (while continue 78 | (setq value (apply fn args)) 79 | (when (null (funcall filter value)) 80 | (setq continue nil)))) 81 | (setq quit-flag nil) 82 | (when (null continue) 83 | value))) 84 | 85 | (defun fun-noop (&rest _) 86 | "Do nothing. 87 | 88 | Useful for temporarily disabling a function.") 89 | 90 | (defun fun-remove-keyword-params (seq) 91 | "Remove keyword parameters from arguments SEQ. 92 | 93 | Useful for cases, when you want to combine &rest and &key 94 | arguments in `cl-defun'. For example: 95 | 96 | (cl-defun foo (&rest rest 97 | &key key1 key2 98 | &allow-other-keys) 99 | (fun-remove-keyword-params rest))" 100 | (if (null seq) nil 101 | (let ((head (car seq)) 102 | (tail (cdr seq))) 103 | (if (keywordp head) (fun-remove-keyword-params (cdr tail)) 104 | (cons head (fun-remove-keyword-params tail)))))) 105 | 106 | (defun fun-silent (fn &rest args) 107 | "Wrapper for FN suppressing any messages. 108 | 109 | ARGS are passed as is to FN." 110 | (cl-letf (((symbol-function 'message) #'format)) 111 | (apply fn args))) 112 | 113 | (defmacro silenzio (&rest body) 114 | "Evaluate BODY like in Vatican. Silently." 115 | `(cl-letf (((symbol-function 'message) #'format)) 116 | ,@body)) 117 | 118 | (provide 'lib-fun) 119 | ;;; lib-fun.el ends here 120 | -------------------------------------------------------------------------------- /emacs/lisp/lib-hash-table.el: -------------------------------------------------------------------------------- 1 | ;;; lib-hash-table.el --- Hash table utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2023, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 06 Apr 2023 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;;; Code: 33 | 34 | (require 'dash) 35 | 36 | (cl-defun hash-table-from (list &key key-fn value-fn test) 37 | "Convert LIST to hash table. 38 | 39 | KEY-FN (required) is a function to convert a given value from LIST to key. 40 | 41 | VALUE-FN (optional) is a function to convert a given value from 42 | list to value. It accepts two arguments - element of list and 43 | current value assigned to key in hast table. The latter allows to 44 | deal with overlapping keys. VALUE-FN by default returns a given 45 | element of list as is. 46 | 47 | TEST must be a symbol that specifies how to compare keys. Default 48 | is ‘equal’. Predefined are the tests ‘eq’, ‘eql’, and ‘equal’. 49 | User-supplied test and hash functions can be specified via 50 | ‘define-hash-table-test’." 51 | (declare (indent 1)) 52 | (let ((tbl (make-hash-table :test (or test 'equal))) 53 | key val) 54 | (--each list 55 | (setq key (funcall key-fn it)) 56 | (setq val (if value-fn 57 | (funcall value-fn it (gethash key tbl)) 58 | it)) 59 | (puthash key val tbl)) 60 | tbl)) 61 | 62 | (provide 'lib-hash-table) 63 | ;;; lib-hash-table.el ends here 64 | -------------------------------------------------------------------------------- /emacs/lisp/lib-hook.el: -------------------------------------------------------------------------------- 1 | ;;; lib-hook.el --- Hook utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Taming hooks using some utilities. 33 | ;; 34 | ;;; Code: 35 | 36 | (require 'lib-fun) 37 | 38 | (defmacro hook-with-delay (hook secs function &optional depth local) 39 | "Add the FUNCTION to the value of HOOK. 40 | 41 | The FUNCTION is delayed to be evaluated in SECS once HOOK is 42 | triggered. 43 | 44 | DEPTH and LOCAL are passed as is to `add-hook'." 45 | (let* ((f-name-str (concat (symbol-name (fun-unquote function)) 46 | "-" 47 | (symbol-name (fun-unquote hook)) 48 | "-with-delay")) 49 | (f-name (make-symbol f-name-str)) 50 | (doc (format "Call `%s' in %s seconds" 51 | (symbol-name (fun-unquote function)) 52 | secs))) 53 | `(progn 54 | (eval-when-compile 55 | (defun ,f-name () ,doc 56 | (run-with-idle-timer ,secs nil ,function)) 57 | (add-hook ,hook #',f-name ,depth ,local))))) 58 | 59 | (provide 'lib-hook) 60 | ;;; lib-hook.el ends here 61 | -------------------------------------------------------------------------------- /emacs/lisp/lib-list.el: -------------------------------------------------------------------------------- 1 | ;;; lib-list.el --- list helpers -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2023, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 30 Nov 2023 9 | ;; 10 | ;; URL: https://github.com/d12frosted/ 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;;; Code: 33 | 34 | (require 'dash) 35 | 36 | ;; * Position (1-based index) 37 | 38 | (defun -find-position (list pred) 39 | "Find first position in LIST satisfying PRED. 40 | 41 | Position is 1-based, while index is 0-based." 42 | (when-let ((idx (-find-index pred list))) 43 | (1+ idx))) 44 | 45 | (defun -position-of (list str) 46 | "Find first position of STR in LIST . 47 | 48 | Position is 1-based, while index is 0-based." 49 | (-find-position list (-partial #'string-equal str))) 50 | 51 | (defun -find-positions (list pred) 52 | "Find all positions in LIST satisfying PRED. 53 | 54 | Position is 1-based, while index is 0-based." 55 | (when-let ((idxs (-find-indices pred list))) 56 | (-map #'1+ idxs))) 57 | 58 | (defun -positions-of (list str) 59 | "Find all positions of STR in LIST. 60 | 61 | STR can be a list of strings. 62 | 63 | Position is 1-based, while index is 0-based." 64 | (if (stringp str) 65 | (-find-positions list (-partial #'string-equal str)) 66 | (-find-positions list (-partial #'-contains-p str)))) 67 | 68 | ;; * misc 69 | 70 | (defun -update-first-by (pred fn def list) 71 | "Update elements of LIST using FN. 72 | 73 | Return a copy of LIST, where the first element matching PRED is 74 | updated using FN. In case no element is found, DEF is added to the end." 75 | (if-let* ((n (-find-index pred list))) 76 | (-update-at n fn list) 77 | (-snoc list def))) 78 | 79 | (defmacro --update-first-by (pred fn def list) 80 | "Anaphoric version of `-update-by'. 81 | 82 | PRED is a form with `it' bound to element of the LIST. 83 | FN is a form with `it' bound to element of the LIST. 84 | DEF is used when no element is found." 85 | (declare (debug (form def-form form))) 86 | `(-update-first-by (lambda (it) (ignore it) ,pred) (lambda (it) (ignore it) ,fn) ,def ,list)) 87 | 88 | (defun -count-unique (list) 89 | "Return count unique elements of LIST." 90 | (cl-loop 91 | with hash = (make-hash-table :test #'equal) 92 | for key in list 93 | do (cl-incf (gethash key hash 0)) 94 | finally (return 95 | (cl-loop for key being each hash-key of hash 96 | using (hash-value value) 97 | collect (cons key value))))) 98 | 99 | (provide 'lib-list) 100 | ;;; lib-list.el ends here 101 | -------------------------------------------------------------------------------- /emacs/lisp/lib-nix.el: -------------------------------------------------------------------------------- 1 | ;;; lib-nix.el --- Utilities for using Nix -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 09 June 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Various utilities for working with Nix. 33 | ;; 34 | ;;; Code: 35 | 36 | (cl-defun nix-shell-command (&key 37 | deps 38 | command 39 | message-intro 40 | message-error) 41 | "Execute COMMAND in nix-shell with DEPS. 42 | 43 | If result is non-zero, error is printed in messages buffer. 44 | 45 | Basically, executes nix-shell -p DEPS --command COMMAND." 46 | (message message-intro) 47 | (let* ((error-buffer (generate-new-buffer "*nix-shell-error*")) 48 | (cmd (format 49 | "nix-shell -p %s --command '%s'" 50 | (string-join deps " ") 51 | command)) 52 | (res (shell-command cmd nil error-buffer))) 53 | (unless (zerop res) 54 | (message (with-current-buffer error-buffer 55 | (buffer-string))) 56 | (error message-error)))) 57 | 58 | (provide 'lib-nix) 59 | ;;; lib-nix.el ends here 60 | -------------------------------------------------------------------------------- /emacs/lisp/lib-plist.el: -------------------------------------------------------------------------------- 1 | ;;; lib-plist.el --- Property list utilitites -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 07 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Utilities for property lists. 33 | ;; 34 | ;;; Code: 35 | 36 | (require 'lib-string) 37 | 38 | (defun plist-delete (plist prop) 39 | "Delete PROP from PLIST." 40 | (let (p) 41 | (while plist 42 | (if (not (eq prop (car plist))) 43 | (setq p (plist-put p (car plist) (nth 1 plist)))) 44 | (setq plist (cddr plist))) 45 | p)) 46 | 47 | (defmacro plist-buttonize-prop (plist prop default callback 48 | &optional to-string read-fn) 49 | "Make a button out of PROP from PLIST. 50 | 51 | The result is a button string. The extracted value (or DEFAULT) 52 | is displayed using TO-STRING or `string-from'. The action prompts 53 | a new value unless READ-FN is specified. 54 | 55 | CALLBACK is called with updated plist." 56 | (let* ((plist-var (gensym)) 57 | (prompt (concat 58 | (s-capitalize 59 | (s-replace "-" " " (s-chop-prefix ":" (symbol-name prop)))) 60 | ": ")) 61 | (to-string (or to-string `(quote string-from)))) 62 | `(let* ((,plist-var ,plist) 63 | (value (or (plist-get ,plist-var ,prop) ,default)) 64 | (read-fn (or 65 | ,read-fn 66 | (pcase (type-of value) 67 | (`integer #'read-number) 68 | (_ #'read-string))))) 69 | (buttonize (funcall ,to-string value) 70 | (lambda (&rest _) 71 | (let* ((value (funcall read-fn ,prompt)) 72 | (,plist-var (plist-put ,plist-var ,prop value))) 73 | (funcall ,callback ,plist-var))))))) 74 | 75 | (provide 'lib-plist) 76 | ;;; lib-plist.el ends here 77 | -------------------------------------------------------------------------------- /emacs/lisp/lib-table.el: -------------------------------------------------------------------------------- 1 | ;;; lib-table.el --- Table utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 15 Sep 2022 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Table is a list of lists. These utilities might be slow. 33 | ;; 34 | ;;; Code: 35 | 36 | 37 | ;; * Selection 38 | 39 | (cl-defun table-select-rows (value table &key column compare-fn) 40 | "Select rows with a VALUE at COLUMN from TABLE. 41 | 42 | COLUMN is zero-based. 43 | 44 | COMPARE-FN is a function used to compare values. By default 45 | `string-equal' is used. 46 | 47 | Everything before and including COLUMN is dropped from the rows." 48 | (setf column (or column 0)) 49 | (-map 50 | (-partial #'-drop (+ 1 column)) 51 | (-filter 52 | (-compose 53 | (-partial (or compare-fn #'string-equal) value) 54 | (-partial #'nth column)) 55 | table))) 56 | 57 | 58 | ;; * Manipulations 59 | 60 | (cl-defun table-transpose (table) 61 | "Transpose TABLE." 62 | (let ((n (length (car table)))) 63 | (-map 64 | (lambda (i) 65 | (-map (-partial #'nth i) table)) 66 | (-iota n)))) 67 | 68 | 69 | ;; * Application 70 | 71 | (cl-defun table-vreduce-columns (fn table) 72 | "Reduce columns of the TABLE using FN. 73 | 74 | FN is a function that takes a list of `calc' numbers and returns 75 | a `calc' number. Result is converted into Emacs Lisp number. 76 | 77 | Empty cells of the column are ignored (e.g. filtered out). 78 | 79 | In short, this function allows to apply `calc' vector function on 80 | columns, but also supports missing data." 81 | (--map 82 | (--> it 83 | (-filter #'numberp it) 84 | (-map #'calc-from-number it) 85 | (when it (apply fn it)) 86 | (when it (calc-to-number it))) 87 | (table-transpose table))) 88 | 89 | 90 | 91 | (provide 'lib-table) 92 | ;;; lib-table.el ends here 93 | -------------------------------------------------------------------------------- /emacs/lisp/lib-vcs.el: -------------------------------------------------------------------------------- 1 | ;;; lib-vcs.el --- VCS utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 08 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Utilities for working with VCS 33 | ;; 34 | ;;; Code: 35 | 36 | 37 | 38 | (defvar vcs-url-github-issue-regexp 39 | (format "\\(%s/\\(%s\\)/\\(%s\\)/\\(%s\\)/\\(%s\\)\\).*" 40 | "https://github\\.com" 41 | "[-\\.[:alnum:]]+" 42 | "[-\\.[:alnum:]]+" 43 | "[[:alpha:]]+" 44 | "[[:alnum:]]+") 45 | "GitHub issue/pull URL regexp. 46 | 47 | - 1st group is whole URL. 48 | - 2nd group is owner. 49 | - 3rd group is repository name. 50 | - 4th group is type of the object - issue/pull/miliestone/commit. 51 | - 5th group is the number of the object.") 52 | 53 | (defvar vcs-url-github-project-regexp 54 | (format "\\(%s/\\(%s\\)/\\(%s\\)/?\\)" 55 | "https://github\\.com" 56 | "[-\\.[:alnum:]]+" 57 | "[-\\.[:alnum:]]+") 58 | "GitHub project URL regexp. 59 | 60 | - 1st group is whole URL. 61 | - 2nd group is owner. 62 | - 3rd group is repository name.") 63 | 64 | (defvar vcs-url-known-github-users '("d12frosted" 65 | "org-roam") 66 | "List of known GitHub users.") 67 | 68 | 69 | 70 | (defun vcs-url-format-github-issue (owner repo type number) 71 | "Format GitHub issue. 72 | 73 | Depending on the TYPE format can be one of the following: 74 | 75 | - OWNER/REPO#NUMBER if TYPE is not milestone; 76 | - OWNER/REPOmNUMBER otherwise. 77 | 78 | In case OWNER is a member of `vcs-url-known-github-users', then OWNER 79 | part of format is omitted." 80 | (concat 81 | (if (seq-contains-p vcs-url-known-github-users owner) 82 | repo 83 | (concat owner "/" repo)) 84 | (if (string-equal type "milestone") 85 | "m" 86 | "#") 87 | (if (string-equal type "commit") 88 | (substring number 0 (min 7 (length number))) 89 | number))) 90 | 91 | (defun vcs-url-format-github-project (owner repo) 92 | "Format GitHub REPO. 93 | 94 | In case OWNER is a member of `vcs-url-known-github-users', then OWNER 95 | part of format is omitted." 96 | (concat 97 | (if (seq-contains-p vcs-url-known-github-users owner) 98 | repo 99 | (concat owner "/" repo)))) 100 | 101 | 102 | 103 | (provide 'lib-vcs) 104 | ;;; lib-vcs.el ends here 105 | -------------------------------------------------------------------------------- /emacs/lisp/lib-vulpea-id.el: -------------------------------------------------------------------------------- 1 | ;;; lib-vulpea-id.el --- ID utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 08 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; Various ID utilities. 33 | ;; 34 | ;; Automatic ID generation is controlled by `vulpea-id-auto-targets'. 35 | ;; It can be configured from init.el file, or from .dir-locals.el file 36 | ;; (for example ,to disable automatic generation): 37 | ;; 38 | ;; ((org-mode . ((vulpea-id-auto-targets . nil)))) 39 | ;; 40 | ;;; Code: 41 | 42 | (require 'org-id) 43 | 44 | (defvar vulpea-id-auto-targets nil 45 | "Targets for automatic ID assignment. 46 | 47 | Each element of this list can be one of the following: 48 | 49 | - file - to automatically set ID on the file level; 50 | - headings - to automatically set ID for each heading in the file. 51 | 52 | Empty list means no id assignment is needed.") 53 | 54 | ;;;###autoload 55 | (defun vulpea-id-auto-assign () 56 | "Add ID property to the current file. 57 | 58 | Targets are defined by `vulpea-id-auto-targets'." 59 | (when (and vulpea-id-auto-targets 60 | (derived-mode-p 'org-mode) 61 | (eq buffer-read-only nil)) 62 | (save-excursion 63 | (widen) 64 | (goto-char (point-min)) 65 | (when (seq-contains-p vulpea-id-auto-targets 'file) 66 | (org-id-get-create)) 67 | (when (seq-contains-p vulpea-id-auto-targets 'headings) 68 | (org-map-entries #'org-id-get-create))))) 69 | 70 | (provide 'lib-vulpea-id) 71 | ;;; lib-vulpea-id.el ends here 72 | -------------------------------------------------------------------------------- /emacs/lisp/lib-vulpea-refile.el: -------------------------------------------------------------------------------- 1 | ;;; lib-vulpea-refile.el --- Note refiling utilities -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Copyright (c) 2015-2022, Boris Buliga 4 | ;; 5 | ;; Author: Boris Buliga 6 | ;; Maintainer: Boris Buliga 7 | ;; 8 | ;; Created: 08 Feb 2021 9 | ;; 10 | ;; URL: https://github.com/d12frosted/environment/tree/master/emacs 11 | ;; 12 | ;; License: GPLv3 13 | ;; 14 | ;; This program is free software; you can redistribute it and/or 15 | ;; modify it under the terms of the GNU General Public License as 16 | ;; published by the Free Software Foundation, either version 3 of the 17 | ;; License, or (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, but 20 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | ;; General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with this program. If not, see 26 | ;; . 27 | ;; 28 | ;; This file is not part of GNU Emacs. 29 | ;; 30 | ;;; Commentary: 31 | ;; 32 | ;; This module provides utilities for refiling vulpea notes. 33 | ;; 34 | ;;; Code: 35 | 36 | (require 'org) 37 | 38 | (defvar vulpea-refile-ignored-tags '("JOURNAL" "REFILE") 39 | "List of tags to ignore during refile.") 40 | 41 | ;;;###autoload 42 | (defun vulpea-refile-verify-target () 43 | "Exclude todo keywords with a done state from refile targets." 44 | (let ((tags-at (org-get-tags))) 45 | (and 46 | ;; doesn't have done keyword 47 | (not (member (nth 2 (org-heading-components)) org-done-keywords)) 48 | 49 | ;; doesn't have blacklisted tag 50 | (or (null tags-at) 51 | (cl-member-if-not 52 | (lambda (x) 53 | (member (if (listp x) (car x) x) 54 | vulpea-refile-ignored-tags)) 55 | tags-at))))) 56 | 57 | (provide 'lib-vulpea-refile) 58 | ;;; lib-vulpea-refile.el ends here 59 | -------------------------------------------------------------------------------- /emacs/templates/emacs-lisp-mode/__package: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # -- 3 | ;;; `(file-name-nondirectory buffer-file-name)`${1: --- ${2:description}} -*- lexical-binding: t; -*- 4 | ;; 5 | ;; Copyright (c) `(format-time-string "%Y")`, `user-full-name` <`user-mail-address`> 6 | ;; 7 | ;; Author: `user-full-name` <`user-mail-address`> 8 | ;; Maintainer: `user-full-name` <`user-mail-address`> 9 | ;; Version: 0.1 10 | ;; Package-Requires: ((emacs "27.1")) 11 | ;; 12 | ;; Created: `(format-time-string "%d %b %Y")` 13 | ;; 14 | ;; URL: https://github.com/d12frosted/ 15 | ;; 16 | ;; License: GPLv3 17 | ;; 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License as 20 | ;; published by the Free Software Foundation, either version 3 of the 21 | ;; License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, but 24 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26 | ;; General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with this program. If not, see 30 | ;; . 31 | ;; 32 | ;; This file is not part of GNU Emacs. 33 | ;; 34 | ;;; Commentary: 35 | ;; 36 | ;;; Code: 37 | 38 | $0 39 | 40 | (provide '`(file-name-base buffer-file-name)`) 41 | ;;; `(file-name-nondirectory buffer-file-name)` ends here -------------------------------------------------------------------------------- /emacs/templates/haskell-mode/__module: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # expand-env: ((yas-indent-line 'fixed)) 3 | # -- 4 | {-| 5 | Module : `(haskell-guess-module-name-from-file-name (buffer-file-name))` 6 | Description : ${1:Module short description} 7 | Copyright : (c) `user-full-name`, `(format-time-string "%Y")` 8 | License : MIT 9 | Maintainer : `user-mail-address` 10 | Stability : experimental 11 | Portability : POSIX 12 | 13 | ${2:Module long description} 14 | -} 15 | 16 | -------------------------------------------------------------------------------- 17 | 18 | module `(haskell-guess-module-name-from-file-name (buffer-file-name))` where 19 | 20 | -------------------------------------------------------------------------------- 21 | 22 | $0 23 | 24 | -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /emacs/templates/org-mode/bg_slides: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : Barberry Garden Slides - structure 3 | # -- 4 | `(brb-slides-template-title-full)` 5 | #+date: `(brb-slides-template-date)` 6 | #+author: `user-full-name` 7 | #+startup: beamer 8 | #+latex_class: beamer 9 | #+latex_class_options: [presentation,aspectratio=169,8pt] 10 | #+latex_header: \usepackage{soul} 11 | #+latex_header: \usepackage{mathtools} 12 | #+latex_header: \usepackage{emoji} 13 | #+latex_header: \usepackage[utf8]{inputenc} 14 | #+latex_header: \usemintedstyle{tango} 15 | #+latex_header: \setminted{mathescape=true} 16 | #+latex_header: \setbeamertemplate{itemize items}[circle] 17 | #+latex_header: \setbeamertemplate{enumerate items}[default] 18 | #+latex_header: \setbeamertemplate{caption}{\raggedright\insertcaption\par} 19 | #+latex_header: \setlength{\parskip}{\baselineskip}% 20 | #+latex_header: \setlength{\parindent}{0pt}% 21 | #+latex_header: \setbeamertemplate{navigation symbols}{}%remove navigation symbols 22 | #+latex_header: \newcommand{\hlyellow}[1]{\colorbox{yellow!50}{$\displaystyle#1$}} 23 | #+latex_header: \newcommand{\hlfancy}[2]{\sethlcolor{#1}\hl{#2}} 24 | #+options: H:1 toc:nil num:t 25 | #+exclude_tags: noexport 26 | 27 | #+begin_export latex 28 | \newcommand{\mathcolorbox}[2]{% 29 | \begingroup 30 | \setlength{\fboxsep}{2pt}% 31 | \colorbox{#1}{$\displaystyle #2$}% 32 | \endgroup 33 | } 34 | 35 | \AtBeginSection[]{ 36 | \begin{frame} 37 | \vfill 38 | \centering 39 | \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title} 40 | \usebeamerfont{title}\insertsectionhead\par% 41 | \end{beamercolorbox} 42 | \vfill 43 | \end{frame} 44 | } 45 | 46 | #+end_export 47 | 48 | * Your role 49 | 50 | - drink wine 51 | - enjoy the evening 52 | - rate each tasted wine on a scale from 1 to 5 53 | - optionally guess it to gain points 54 | - person with the highest points wins a present 55 | 56 | * That's all folks 57 | 58 | Thank you very much for participation! It's time to take taxi :) 59 | -------------------------------------------------------------------------------- /emacs/templates/org-mode/bg_slides_wine: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : Barberry Garden Slides - wine 3 | # -- 4 | * Wine #`(+ 1 (brb-slides-wine-cur-idx))` 5 | 6 | This slide exists only to make sure that I do not spoil the wine name. After 7 | all, it's a blind tasting, right? 8 | 9 | * Wine #`(+ 1 (brb-slides-wine-cur-idx))` - `(brb-slides-template-wine-name)` 10 | 11 | ** Wine :B_column: 12 | :PROPERTIES: 13 | :BEAMER_env: column 14 | :BEAMER_col: 0.50 15 | :END: 16 | 17 | `(brb-slides-template-wine-info)` 18 | 19 | ** Image :B_column: 20 | :PROPERTIES: 21 | :BEAMER_env: column 22 | :BEAMER_col: 0.50 23 | :END: 24 | 25 | #+ATTR_LATEX: :height 6.0cm 26 | `(brb-slides-template-wine-image)` 27 | -------------------------------------------------------------------------------- /eru-new.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | ################################################################################ 4 | # 5 | # Of the theme that I have declared to you, I will now that ye make in harmony 6 | # together a Great Music. And since I have kindled you with the Flame 7 | # Imperishable, ye shall show forth your powers in adorning this theme, each 8 | # with his own thoughts and devices, if he will. But I win sit and hearken, and 9 | # be glad that through you great beauty has been wakened into song. 10 | # 11 | # John Ronald Reuel Tolkien (c) 12 | # 13 | ################################################################################ 14 | 15 | set -e 16 | 17 | function silence { 18 | local output= 19 | if ! output=$(eval "$@" 2>&1); then 20 | echo "$output" 21 | exit 1 22 | fi 23 | } 24 | 25 | # 26 | # Fetching the notes 27 | # 28 | 29 | export XDG_CONFIG_HOME=$HOME/.config 30 | 31 | env_https=https://github.com/d12frosted/environment 32 | env_ssh=git@github.com:d12frosted/environment.git 33 | 34 | if [ -d "$XDG_CONFIG_HOME" ] && [ ! -d "$XDG_CONFIG_HOME/.git" ]; then 35 | cd "$XDG_CONFIG_HOME" && { 36 | git init 37 | # clone via HTTPS, as most likely SSH is not yet available or configured 38 | git remote add origin $env_https 39 | git fetch 40 | git reset --hard origin/master 41 | } 42 | fi 43 | 44 | if [ ! -d "$XDG_CONFIG_HOME/.git" ]; then 45 | # clone via HTTPS, as most likely SSH is not yet available or configured 46 | git clone $env_https "$XDG_CONFIG_HOME" 47 | fi 48 | 49 | cd "$XDG_CONFIG_HOME" && { 50 | git remote set-url origin $env_ssh 51 | } 52 | 53 | # 54 | # Haskell is the language of Eru. 55 | # 56 | 57 | if command -v stack >/dev/null 2>&1; then 58 | silence stack upgrade 59 | else 60 | curl -sSL https://get.haskellstack.org/ | sh 61 | fi 62 | 63 | # 64 | # Now start the Great Music 65 | # 66 | 67 | cd "$XDG_CONFIG_HOME/melkor" && { 68 | silence stack setup --allow-different-user 69 | silence stack build --allow-different-user 70 | 71 | if [ "$1" = test ]; then 72 | stack test 73 | else 74 | stack exec --allow-different-user -- melkor "$@" 75 | fi 76 | } 77 | -------------------------------------------------------------------------------- /firefox/userChrome.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Make the toolbar extra-compact 3 | */ 4 | 5 | :root[uidensity=compact] #urlbar, 6 | :root[uidensity=compact] .searchbar-textbox { 7 | font-size: unset !important; 8 | min-height: 24px !important; 9 | } 10 | 11 | :root[uidensity=compact] #identity-box { 12 | max-height: 22px; 13 | } 14 | 15 | :root[uidensity=compact] #nav-bar .toolbarbutton-1 { 16 | padding: 0px !important; 17 | } 18 | 19 | /* Compatibility with auto-hide.css */ 20 | :root[uidensity=compact] #navigator-toolbox { 21 | --nav-bar-height: 31px !important; 22 | } 23 | 24 | :root[uidensity=compact] .toolbarbutton-icon { 25 | width: 14px !important; 26 | height: 14px !important; 27 | } 28 | 29 | :root[uidensity=compact] .toolbarbutton-1 > .toolbarbutton-icon { 30 | width: 28px !important; 31 | height: 28px !important; 32 | } 33 | 34 | 35 | /* 36 | * Makes tabs extra-compact 37 | */ 38 | 39 | [uidensity=compact]:root { 40 | --tab-min-height: 22px !important; 41 | --newtab-margin: -3px 0 -3px -3px !important; 42 | } 43 | 44 | :root[uidensity=compact] #tabbrowser-tabs { 45 | --tab-min-height: var(--tab-min-height) !important; 46 | } 47 | 48 | :root[uidensity=compact] .tabbrowser-tab { 49 | max-height: var(--tab-min-height) !important; 50 | } 51 | 52 | :root[uidensity=compact] .tabs-newtab-button{ 53 | margin: var(--newtab-margin) !important; 54 | } 55 | 56 | :root[uidensity=compact] .tab-icon-image { 57 | width: 14px !important; 58 | height: 14px !important; 59 | } 60 | 61 | :root[uidensity=compact] .tab-close-button { 62 | display: none; 63 | } 64 | 65 | :root[uidensity=compact] .tab-line { 66 | height: 1px !important; 67 | } 68 | 69 | /* 70 | * Prevent tabs overflow 71 | */ 72 | 73 | .tabbrowser-tab { 74 | min-width: 1em !important; 75 | clip-width: 1em !important; 76 | } 77 | 78 | /* 79 | * Compact fonts 80 | */ 81 | 82 | :root[uidensity=compact] #navigator-toolbox { 83 | font-size: 10px; 84 | } 85 | 86 | :root[uidensity=compact] .bookmark-item { 87 | font-size: 10px 88 | } 89 | 90 | /* 91 | * Compact search 92 | */ 93 | 94 | :root[uidensity=compact] .search-panel-one-offs-header { 95 | display: none; 96 | } 97 | 98 | :root[uidensity=compact] .search-panel-one-offs { 99 | display: none; 100 | } 101 | 102 | .urlbarView-row { 103 | font-size: 12px !important; 104 | height: 16px !important; 105 | } 106 | -------------------------------------------------------------------------------- /fish/.gitignore: -------------------------------------------------------------------------------- 1 | fish_history 2 | fishd.* 3 | fish_variables 4 | -------------------------------------------------------------------------------- /fish/README.org: -------------------------------------------------------------------------------- 1 | :PROPERTIES: 2 | :ID: 92d3d8e1-7043-4d69-827d-e84a3c4a1797 3 | :END: 4 | #+TITLE: fish 5 | #+AUTHOR: Boris Buliga 6 | #+EMAIL: boris@d12frosted.io 7 | #+STARTUP: showeverything 8 | #+OPTIONS: toc:t 9 | 10 | [[https://d12frosted.io/posts/2015-02-07-make-the-fish-fly.html][Make the Fish fly]]. If it doesn't fly, it's not a [[https://fishshell.com][fish]]. 11 | 12 | * Dependencies 13 | :PROPERTIES: 14 | :ID: 3e05618c-04f1-4da5-8f5e-89192c0706d4 15 | :END: 16 | 17 | It's impossible to maintain the list of dependencies in documentation. =eru= is 18 | your friend. 19 | 20 | * Custom lambda-prompt 21 | :PROPERTIES: 22 | :ID: af6c9ab5-86c9-453c-b0e0-068cefc77696 23 | :END: 24 | 25 | [[file:images/prompt.png]] 26 | 27 | Strong points of my custom [[file:functions/fish_prompt.fish][fish_prompt]] are: 28 | 29 | 1. it print non-zero status code of previous command 30 | 2. uses =__terlar_git_prompt= for being informative about git repositories and 31 | =__fish_hg_prompt= for mercurial repositories 32 | 3. prints duration of last executed command if it exceeds =8000= ms and notifies 33 | about completion using =terminal-notifier= (checkout =__d12_prompt_duration= 34 | function for more information) 35 | 4. minimalistic 36 | 37 | [[file:images/notification.png]] 38 | -------------------------------------------------------------------------------- /fish/functions/macos_set_env.fish: -------------------------------------------------------------------------------- 1 | # Adapt construct_path from the macOS /usr/libexec/path_helper executable for 2 | # fish usage; 3 | # 4 | # The main difference is that it allows to control how extra entries are 5 | # preserved: either at the beginning of the VAR list or at the end via first 6 | # argument MODE. 7 | # 8 | # Usage: 9 | # 10 | # __fish_macos_set_env MODE VAR VAR-FILE VAR-DIR 11 | # 12 | # MODE: either append or prepend 13 | # 14 | # Example: 15 | # 16 | # __fish_macos_set_env prepend PATH /etc/paths '/etc/paths.d' 17 | # 18 | # __fish_macos_set_env append MANPATH /etc/manpaths '/etc/manpaths.d' 19 | # 20 | # [1]: https://opensource.apple.com/source/shell_cmds/shell_cmds-203/path_helper/path_helper.c.auto.html . 21 | # 22 | function macos_set_env -d "set an environment variable like path_helper does (macOS only)" 23 | # noops on other operating systems 24 | if test $KERNEL_NAME darwin 25 | set -l result 26 | set -l entries 27 | 28 | # echo "1. $argv[2] = $$argv[2]" 29 | 30 | # Populate path according to config files 31 | for path_file in $argv[3] $argv[4]/* 32 | if [ -f $path_file ] 33 | while read -l entry 34 | if not contains -- $entry $result 35 | test -n "$entry" 36 | and set -a result $entry 37 | end 38 | end <$path_file 39 | end 40 | end 41 | 42 | # echo "2. $argv[2] = $result" 43 | 44 | # Merge in any existing path elements 45 | set entries $$argv[2] 46 | if test $argv[1] = "prepend" 47 | set entries[-1..1] $entries 48 | end 49 | for existing_entry in $entries 50 | if not contains -- $existing_entry $result 51 | if test $argv[1] = "prepend" 52 | set -p result $existing_entry 53 | else 54 | set -a result $existing_entry 55 | end 56 | end 57 | end 58 | 59 | # echo "3. $argv[2] = $result" 60 | 61 | set -xg $argv[2] $result 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /fish/images/notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/fish/images/notification.png -------------------------------------------------------------------------------- /fish/images/prompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/fish/images/prompt.png -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "darwin": { 4 | "inputs": { 5 | "nixpkgs": [ 6 | "nixpkgs" 7 | ] 8 | }, 9 | "locked": { 10 | "lastModified": 1749873626, 11 | "narHash": "sha256-1Mc/D/1RwwmDKY59f4IpDBgcQttxffm+4o0m67lQ8hc=", 12 | "owner": "lnl7", 13 | "repo": "nix-darwin", 14 | "rev": "2f140d6ac8840c6089163fb43ba95220c230f22b", 15 | "type": "github" 16 | }, 17 | "original": { 18 | "owner": "lnl7", 19 | "repo": "nix-darwin", 20 | "type": "github" 21 | } 22 | }, 23 | "emacs-overlay": { 24 | "inputs": { 25 | "nixpkgs": "nixpkgs", 26 | "nixpkgs-stable": "nixpkgs-stable" 27 | }, 28 | "locked": { 29 | "lastModified": 1750152107, 30 | "narHash": "sha256-EtSUmvOKU7mfocPNsBSmgjOcqPBKWshSN/jsxmHZqfI=", 31 | "owner": "nix-community", 32 | "repo": "emacs-overlay", 33 | "rev": "cff16fc129c76889ddfb0ebb17b53b6633c77ba5", 34 | "type": "github" 35 | }, 36 | "original": { 37 | "owner": "nix-community", 38 | "repo": "emacs-overlay", 39 | "type": "github" 40 | } 41 | }, 42 | "home-manager": { 43 | "inputs": { 44 | "nixpkgs": [ 45 | "nixpkgs" 46 | ] 47 | }, 48 | "locked": { 49 | "lastModified": 1750127463, 50 | "narHash": "sha256-K2xFtlD3PcKAZriOE3LaBLYmVfGQu+rIF4Jr1RFYR0Q=", 51 | "owner": "nix-community", 52 | "repo": "home-manager", 53 | "rev": "28eef8722d1af18ca13e687dbf485e1c653a0402", 54 | "type": "github" 55 | }, 56 | "original": { 57 | "owner": "nix-community", 58 | "repo": "home-manager", 59 | "type": "github" 60 | } 61 | }, 62 | "nixpkgs": { 63 | "locked": { 64 | "lastModified": 1749794982, 65 | "narHash": "sha256-Kh9K4taXbVuaLC0IL+9HcfvxsSUx8dPB5s5weJcc9pc=", 66 | "owner": "NixOS", 67 | "repo": "nixpkgs", 68 | "rev": "ee930f9755f58096ac6e8ca94a1887e0534e2d81", 69 | "type": "github" 70 | }, 71 | "original": { 72 | "owner": "NixOS", 73 | "ref": "nixos-unstable", 74 | "repo": "nixpkgs", 75 | "type": "github" 76 | } 77 | }, 78 | "nixpkgs-stable": { 79 | "locked": { 80 | "lastModified": 1749995256, 81 | "narHash": "sha256-LEGfcombb0otUf23oAmYCXR4+lMQKa49XmU0G5HItGI=", 82 | "owner": "NixOS", 83 | "repo": "nixpkgs", 84 | "rev": "daa45f10955cc2207ac9c5f0206774d2f757c162", 85 | "type": "github" 86 | }, 87 | "original": { 88 | "owner": "NixOS", 89 | "ref": "nixos-24.11", 90 | "repo": "nixpkgs", 91 | "type": "github" 92 | } 93 | }, 94 | "nixpkgs_2": { 95 | "locked": { 96 | "lastModified": 1749903597, 97 | "narHash": "sha256-jp0D4vzBcRKwNZwfY4BcWHemLGUs4JrS3X9w5k/JYDA=", 98 | "owner": "nixos", 99 | "repo": "nixpkgs", 100 | "rev": "41da1e3ea8e23e094e5e3eeb1e6b830468a7399e", 101 | "type": "github" 102 | }, 103 | "original": { 104 | "owner": "nixos", 105 | "ref": "nixpkgs-unstable", 106 | "repo": "nixpkgs", 107 | "type": "github" 108 | } 109 | }, 110 | "root": { 111 | "inputs": { 112 | "darwin": "darwin", 113 | "emacs-overlay": "emacs-overlay", 114 | "home-manager": "home-manager", 115 | "nixpkgs": "nixpkgs_2" 116 | } 117 | } 118 | }, 119 | "root": "root", 120 | "version": 7 121 | } 122 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | # References: 2 | # 3 | # https://github.com/cmacrae/config 4 | # https://www.tweag.io/blog/2020-05-25-flakes/ 5 | # https://www.tweag.io/blog/2020-06-25-eval-cache/ 6 | # https://www.tweag.io/blog/2020-07-31-nixos-flakes/ 7 | 8 | { 9 | description = "d12frosted systems configuration"; 10 | 11 | inputs = { 12 | nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 13 | darwin.url = "github:lnl7/nix-darwin"; 14 | home-manager.url = "github:nix-community/home-manager"; 15 | emacs-overlay.url = "github:nix-community/emacs-overlay"; 16 | 17 | # Follows 18 | darwin.inputs.nixpkgs.follows = "nixpkgs"; 19 | home-manager.inputs.nixpkgs.follows = "nixpkgs"; 20 | }; 21 | 22 | outputs = { self, nixpkgs, darwin, home-manager, emacs-overlay }: 23 | let 24 | overlays = [ 25 | emacs-overlay.overlay 26 | (import ./nix/overlays) 27 | ]; 28 | in { 29 | darwinConfigurations.d12frosted = darwin.lib.darwinSystem { 30 | system = "aarch64-darwin"; # "x86_64-darwin"; 31 | modules = [ 32 | ./nix/darwin.nix 33 | home-manager.darwinModules.home-manager 34 | { 35 | nixpkgs.overlays = overlays; 36 | } 37 | ]; 38 | }; 39 | 40 | darwinConfigurations.borysb = darwin.lib.darwinSystem { 41 | system = "aarch64-darwin"; # "x86_64-darwin"; 42 | modules = [ 43 | ./nix/darwin.nix 44 | home-manager.darwinModules.home-manager 45 | { 46 | nixpkgs.overlays = overlays; 47 | } 48 | ]; 49 | }; 50 | 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /fontconfig/fonts.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | monospace 6 | 7 | Source Code Pro 8 | 9 | 10 | 11 | sans-serif 12 | 13 | Source Sans Pro 14 | 15 | 16 | 17 | serif 18 | 19 | Source Serif Pro 20 | 21 | 22 | 23 | Helvetica 24 | Source Sans Pro 25 | 26 | 27 | -------------------------------------------------------------------------------- /gtk-3.0/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-key-theme-name = Emacs 3 | gtk-font-name=Source Code Pro 10 4 | -------------------------------------------------------------------------------- /haskell/.ghci: -------------------------------------------------------------------------------- 1 | :set prompt "λ " 2 | :set -XOverloadedStrings 3 | :set -XDataKinds 4 | :set -XTypeApplications 5 | -------------------------------------------------------------------------------- /haskell/Linkfile: -------------------------------------------------------------------------------- 1 | .ghci ~/.ghci 2 | stack-global.yaml ~/.stack/global-project/stack.yaml 3 | stack.yaml ~/.stack/config.yaml 4 | -------------------------------------------------------------------------------- /haskell/README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: haskell domain 2 | #+AUTHOR: Boris Buliga 3 | #+EMAIL: boris@d12frosted.io 4 | #+STARTUP: showeverything 5 | #+OPTIONS: toc:t 6 | 7 | #+BEGIN_QUOTE 8 | – Do you have a minute to talk about Alonzo's Curry? 9 | 10 | – Sorry, but I am already a member of Haskell Church! 11 | #+END_QUOTE 12 | 13 | Configurations for =stack=, =ghc= and =cabal=. One might think that this domain 14 | has the hardest dependency list, but it's not true. This domain has no 15 | dependencies at all. You even don't need to install =GHC=. But don't be pleased, 16 | emacs domain has a lot of haskell dependencies. 17 | -------------------------------------------------------------------------------- /haskell/stack-global.yaml: -------------------------------------------------------------------------------- 1 | flags: {} 2 | packages: [] 3 | extra-deps: [] 4 | resolver: lts-14.9 5 | -------------------------------------------------------------------------------- /haskell/stack.yaml: -------------------------------------------------------------------------------- 1 | templates: 2 | params: 3 | author-email: boris@d12frosted.io 4 | author-name: Boris Buliga 5 | github-username: d12frosted 6 | copyright: 2019 Boris Buliga 7 | category: Development 8 | -------------------------------------------------------------------------------- /images/d12frosted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/images/d12frosted.png -------------------------------------------------------------------------------- /images/desktop_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/images/desktop_arch.png -------------------------------------------------------------------------------- /images/desktop_mac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/images/desktop_mac.png -------------------------------------------------------------------------------- /images/eru-example-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/images/eru-example-1.png -------------------------------------------------------------------------------- /images/eru-example-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/images/eru-example-2.png -------------------------------------------------------------------------------- /melkor/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM haskell:8 2 | MAINTAINER Boris Buliga 3 | 4 | COPY ./stack.yaml /opt/server/stack.yaml 5 | COPY ./package.yaml /opt/server/package.yaml 6 | 7 | WORKDIR /opt/server 8 | 9 | RUN stack setup 10 | RUN stack build --only-dependencies 11 | 12 | COPY ./src /opt/server/src 13 | COPY ./app /opt/server/app 14 | 15 | RUN stack build 16 | CMD stack exec -- melkor 17 | -------------------------------------------------------------------------------- /melkor/app/Main.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | {-# LANGUAGE OverloadedStrings #-} 3 | 4 | -------------------------------------------------------------------------------- 5 | 6 | module Main where 7 | 8 | -------------------------------------------------------------------------------- 9 | 10 | import Melkor 11 | import Melkor.Types.Provider 12 | import Melkor.Types.Resource 13 | import RIO 14 | import qualified RIO.HashSet as HS 15 | 16 | -------------------------------------------------------------------------------- 17 | 18 | main :: IO () 19 | main = runMelkor melkor 20 | 21 | melkor :: RIO Melkor () 22 | melkor = do 23 | depend $ gitHubRepo "d12frosted" "hledger-imp" 24 | depend $ gitHubRepo "d12frosted" "environment" 25 | using dummyProvider 26 | using smartProvider 27 | 28 | -------------------------------------------------------------------------------- 29 | 30 | dummyProvider :: Provider 31 | dummyProvider = 32 | mkProvider 33 | "GitHub" 34 | HS.empty 35 | (const (pure True)) 36 | (const (pure Missing)) 37 | (const (pure ())) 38 | (const (pure ())) 39 | 40 | smartProvider :: Provider 41 | smartProvider = 42 | mkProvider 43 | "GitLab" 44 | HS.empty 45 | (const (pure False)) 46 | (const (pure Missing)) 47 | (const (pure ())) 48 | (const (pure ())) 49 | -------------------------------------------------------------------------------- /melkor/package.yaml: -------------------------------------------------------------------------------- 1 | name: melkor 2 | version: 0.1.0.0 3 | git: "https://gitlab.com/d12frosted/environment" 4 | license: MIT 5 | author: "Boris Buliga" 6 | maintainer: "boris@d12frosted.io" 7 | copyright: "2019-2020 Boris Buliga" 8 | 9 | description: Please see the README on GitLab at 10 | 11 | dependencies: 12 | - base >= 4.7 && < 5 13 | - bytestring 14 | - comonad 15 | - containers 16 | - directory 17 | - env-extra 18 | - mtl 19 | - ordered-containers 20 | - path 21 | - path-extra 22 | - rio 23 | - text 24 | - unordered-containers 25 | - hashable 26 | 27 | ghc-options: 28 | - -O2 29 | 30 | library: 31 | source-dirs: src 32 | 33 | executables: 34 | melkor: 35 | main: Main.hs 36 | source-dirs: app 37 | ghc-options: 38 | - -threaded 39 | - -rtsopts 40 | - -with-rtsopts=-IO 41 | dependencies: 42 | - melkor 43 | 44 | tests: 45 | melkor-test: 46 | main: Spec.hs 47 | source-dirs: test 48 | ghc-options: 49 | - -threaded 50 | - -rtsopts 51 | - -with-rtsopts=-N 52 | dependencies: 53 | - QuickCheck 54 | - melkor 55 | - tasty 56 | - tasty-hunit 57 | - tasty-quickcheck 58 | - tasty-quickcheck-laws 59 | -------------------------------------------------------------------------------- /melkor/src/Melkor/BuildPlan.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | 3 | -- | 4 | -- Module : Melkor.BuildPlan 5 | -- Description : 'BuildPlan' type definition 6 | -- Copyright : (c) Boris Buliga, 2020 7 | -- License : MIT 8 | -- Maintainer : boris@d12frosted.io 9 | -- Stability : experimental 10 | -- Portability : POSIX 11 | module Melkor.BuildPlan 12 | ( BuildPlan (..), 13 | buildPlan, 14 | ) 15 | where 16 | 17 | -------------------------------------------------------------------------------- 18 | 19 | import Melkor.BuildMap (BuildMap, buildMap) 20 | import qualified Melkor.BuildMap as BM 21 | import Melkor.Types.Eff 22 | import Melkor.Types.Provider 23 | import Melkor.Types.Resource 24 | import RIO 25 | import qualified RIO.HashMap as HM 26 | import qualified RIO.HashSet as HS 27 | 28 | -------------------------------------------------------------------------------- 29 | 30 | data BuildPlan = BuildPlan 31 | { buildPlanMap :: HashMap Resource Provider, 32 | buildPlanOrphans :: HashSet Resource, 33 | buildPlanAmbiguous :: HashMap Resource [Provider] 34 | } 35 | 36 | fromBuildMap :: BuildMap -> BuildPlan 37 | fromBuildMap bm = 38 | BuildPlan 39 | { buildPlanMap = BM.rules bm, 40 | buildPlanOrphans = BM.orphans bm, 41 | buildPlanAmbiguous = HM.map toList $ BM.ambiguous bm 42 | } 43 | 44 | buildPlan :: 45 | (HasContext env) => 46 | HashSet Resource -> 47 | HashSet Provider -> 48 | RIO env BuildPlan 49 | buildPlan rset pset = do 50 | bm <- buildMap rset pset 51 | bm' <- buildMap (HS.unions $ providerDependencies <$> toList (BM.providers bm)) pset 52 | pure $ fromBuildMap (bm <> bm') 53 | 54 | -------------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /melkor/src/Melkor/Extra/Display.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE OverloadedStrings #-} 4 | {-# LANGUAGE TypeSynonymInstances #-} 5 | 6 | -------------------------------------------------------------------------------- 7 | 8 | -- | 9 | -- Module : Melkor.Extra.Display 10 | -- Description : Utilities for 'Display' type class 11 | -- Copyright : (c) Boris Buliga, 2020 12 | -- License : MIT 13 | -- Maintainer : boris@d12frosted.io 14 | -- Stability : experimental 15 | -- Portability : POSIX 16 | module Melkor.Extra.Display where 17 | 18 | -------------------------------------------------------------------------------- 19 | 20 | import RIO 21 | import qualified RIO.ByteString.Lazy as BL 22 | import RIO.List (intersperse) 23 | import RIO.Text (unpack) 24 | 25 | -------------------------------------------------------------------------------- 26 | 27 | instance Display Bool where 28 | display = displayShow 29 | {-# INLINE display #-} 30 | 31 | -------------------------------------------------------------------------------- 32 | 33 | instance Display a => Display (Maybe a) where 34 | display = displayMaybe 35 | {-# INLINE display #-} 36 | 37 | displayMaybe :: Display a => Maybe a -> Utf8Builder 38 | displayMaybe Nothing = "Nothing" 39 | displayMaybe (Just a) = display a 40 | {-# INLINE displayMaybe #-} 41 | 42 | -------------------------------------------------------------------------------- 43 | 44 | instance Display a => Display [a] where 45 | display = displayList 46 | {-# INLINE display #-} 47 | 48 | instance {-# OVERLAPPING #-} Display String where 49 | display = fromString 50 | {-# INLINE display #-} 51 | 52 | displayList :: Display a => [a] -> Utf8Builder 53 | displayList xs = "[" <> dc xs <> "]" 54 | where 55 | dc = mconcat . intersperse ", " . fmap display 56 | {-# INLINE displayList #-} 57 | 58 | -------------------------------------------------------------------------------- 59 | 60 | instance (Display a, Display b) => Display (a, b) where 61 | display = displayTuple 62 | {-# INLINE display #-} 63 | 64 | displayPair :: (Display a, Display b) => (a, b) -> Utf8Builder 65 | displayPair (a, b) = mconcat [display a, " -> ", display b] 66 | 67 | displayTuple :: (Display a, Display b) => (a, b) -> Utf8Builder 68 | displayTuple (a, b) = mconcat ["(", display a, ", ", display b, ")"] 69 | {-# INLINE displayTuple #-} 70 | 71 | instance (Display a, Display b, Display c) => Display (a, b, c) where 72 | display = displayTuple3 73 | {-# INLINE display #-} 74 | 75 | displayTuple3 :: (Display a, Display b, Display c) => (a, b, c) -> Utf8Builder 76 | displayTuple3 (a, b, c) = mconcat ["(", display a, ", ", display b, ", ", display c, ")"] 77 | {-# INLINE displayTuple3 #-} 78 | 79 | -------------------------------------------------------------------------------- 80 | 81 | instance Display BL.ByteString where 82 | display = display . decodeUtf8With lenientDecode . BL.toStrict 83 | {-# INLINE display #-} 84 | 85 | -------------------------------------------------------------------------------- 86 | 87 | stringDisplay :: Display a => a -> String 88 | stringDisplay = unpack . textDisplay 89 | 90 | -------------------------------------------------------------------------------- 91 | -------------------------------------------------------------------------------- /melkor/src/Melkor/Extra/List.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | 3 | -- | 4 | -- Module : Melkor.Extra.List 5 | -- Description : Utility functions for lists 6 | -- Copyright : (c) Boris Buliga, 2020 7 | -- License : MIT 8 | -- Maintainer : boris@d12frosted.io 9 | -- Stability : experimental 10 | -- Portability : POSIX 11 | module Melkor.Extra.List where 12 | 13 | -------------------------------------------------------------------------------- 14 | 15 | -------------------------------------------------------------------------------- 16 | 17 | toSingleton :: [a] -> Maybe a 18 | toSingleton [a] = Just a 19 | toSingleton _ = Nothing 20 | 21 | -------------------------------------------------------------------------------- 22 | -------------------------------------------------------------------------------- /melkor/src/Melkor/Extra/Tuple.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | {-# LANGUAGE TupleSections #-} 3 | 4 | -------------------------------------------------------------------------------- 5 | 6 | -- | 7 | -- Module : Melkor.Extra.Tuple 8 | -- Description : Utility functions for tuples 9 | -- Copyright : (c) Boris Buliga, 2020 10 | -- License : MIT 11 | -- Maintainer : boris@d12frosted.io 12 | -- Stability : experimental 13 | -- Portability : POSIX 14 | module Melkor.Extra.Tuple where 15 | 16 | -------------------------------------------------------------------------------- 17 | 18 | mapToFst :: (a -> b) -> a -> (b, a) 19 | mapToFst f a = (f a, a) 20 | {-# INLINE mapToFst #-} 21 | 22 | mapToSnd :: (a -> b) -> a -> (a, b) 23 | mapToSnd f a = (a, f a) 24 | {-# INLINE mapToSnd #-} 25 | 26 | -------------------------------------------------------------------------------- 27 | 28 | traverseToFst :: Functor t => (a -> t b) -> a -> t (b, a) 29 | traverseToFst f a = (,a) <$> f a 30 | {-# INLINE traverseToFst #-} 31 | 32 | traverseToSnd :: Functor t => (a -> t b) -> a -> t (a, b) 33 | traverseToSnd f a = (a,) <$> f a 34 | {-# INLINE traverseToSnd #-} 35 | 36 | -------------------------------------------------------------------------------- 37 | -------------------------------------------------------------------------------- /melkor/src/Melkor/Types/Eff.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | {-# LANGUAGE ConstraintKinds #-} 3 | {-# LANGUAGE DeriveFunctor #-} 4 | 5 | -------------------------------------------------------------------------------- 6 | 7 | -- | 8 | -- Module : Melkor.Types.Eff 9 | -- Description : Eff type class declaration 10 | -- Copyright : (c) Boris Buliga, 2020 11 | -- License : MIT 12 | -- Maintainer : boris@d12frosted.io 13 | -- Stability : experimental 14 | -- Portability : POSIX 15 | module Melkor.Types.Eff where 16 | 17 | -------------------------------------------------------------------------------- 18 | 19 | import RIO 20 | 21 | -------------------------------------------------------------------------------- 22 | 23 | type HasContext m = HasLogFunc m 24 | 25 | newtype Context = Context 26 | { ctxLogFunc :: LogFunc 27 | } 28 | 29 | instance HasLogFunc Context where 30 | logFuncL = lens ctxLogFunc (\x y -> x {ctxLogFunc = y}) 31 | 32 | -------------------------------------------------------------------------------- 33 | 34 | newtype Eff a = Eff 35 | { unEff :: Context -> RIO Context a 36 | } 37 | deriving (Functor) 38 | 39 | instance Applicative Eff where 40 | pure = Eff . const . pure 41 | (Eff f) <*> (Eff v) = Eff $ \ctx -> f ctx <*> v ctx 42 | 43 | instance Monad Eff where 44 | m >>= k = Eff $ \ctx -> do 45 | a <- unEff m ctx 46 | unEff (k a) ctx 47 | 48 | instance MonadIO Eff where 49 | liftIO = Eff . const . liftIO 50 | 51 | runEff :: (HasContext env) => Eff a -> RIO env a 52 | runEff = runEff' (\env -> Context $ env ^. logFuncL) 53 | 54 | runEff' :: (env -> Context) -> Eff a -> RIO env a 55 | runEff' f (Eff m) = do 56 | env <- asks f 57 | runRIO env (m env) 58 | 59 | -------------------------------------------------------------------------------- 60 | -------------------------------------------------------------------------------- /melkor/src/Melkor/Types/Internal/ToString.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | {-# LANGUAGE FlexibleInstances #-} 3 | {-# LANGUAGE TypeSynonymInstances #-} 4 | 5 | -------------------------------------------------------------------------------- 6 | 7 | -- | 8 | -- Module : Melkor.Types.Internal.ToString 9 | -- Description : Type class for things that can be converted to string. 10 | -- Copyright : (c) Boris Buliga, 2020 11 | -- License : MIT 12 | -- Maintainer : boris@d12frosted.io 13 | -- Stability : experimental 14 | -- Portability : POSIX 15 | module Melkor.Types.Internal.ToString where 16 | 17 | -------------------------------------------------------------------------------- 18 | 19 | import RIO 20 | import qualified RIO.Text as T 21 | 22 | -------------------------------------------------------------------------------- 23 | 24 | class ToString a where 25 | toString :: a -> String 26 | 27 | instance ToString String where 28 | toString = id 29 | {-# INLINE toString #-} 30 | 31 | instance ToString Text where 32 | toString = T.unpack 33 | {-# INLINE toString #-} 34 | 35 | -------------------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /melkor/src/Melkor/Types/Resource.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | {-# LANGUAGE DeriveGeneric #-} 3 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} 4 | {-# LANGUAGE OverloadedStrings #-} 5 | 6 | -------------------------------------------------------------------------------- 7 | 8 | -- | 9 | -- Module : Melkor.Types.Resource 10 | -- Description : Resource data type declaration 11 | -- Copyright : (c) Boris Buliga, 2020 12 | -- License : MIT 13 | -- Maintainer : boris@d12frosted.io 14 | -- Stability : experimental 15 | -- Portability : POSIX 16 | module Melkor.Types.Resource 17 | ( Resource, 18 | GitHost (..), 19 | GitOwner, 20 | GitRepoName, 21 | GitBranch, 22 | gitHubRepo, 23 | gitHubRepo', 24 | ) 25 | where 26 | 27 | -------------------------------------------------------------------------------- 28 | 29 | import Melkor.Types.Internal.ToString 30 | import RIO 31 | 32 | -------------------------------------------------------------------------------- 33 | 34 | -- | 'Resource' data type declares something that can be present in the 35 | -- environment. One can install or update it, or even depend on it. 36 | data Resource 37 | = GitRepo GitHost GitOwner GitRepoName GitBranch 38 | deriving (Generic, Eq, Ord) 39 | 40 | data GitHost = GitHub | GitLab deriving (Generic, Eq, Ord, Enum, Show) 41 | 42 | newtype GitOwner = GitOwner Text deriving (Hashable, Eq, Ord, Show, IsString) 43 | 44 | newtype GitRepoName = GitRepoName Text deriving (Hashable, Eq, Ord, Show, IsString) 45 | 46 | newtype GitBranch = GitBranch Text deriving (Hashable, Eq, Ord, Show, IsString) 47 | 48 | instance Hashable GitHost 49 | 50 | instance Hashable Resource 51 | 52 | -------------------------------------------------------------------------------- 53 | 54 | gitHubRepo :: GitOwner -> GitRepoName -> Resource 55 | gitHubRepo owner name = gitHubRepo' owner name "master" 56 | 57 | gitHubRepo' :: GitOwner -> GitRepoName -> GitBranch -> Resource 58 | gitHubRepo' = GitRepo GitHub 59 | 60 | -------------------------------------------------------------------------------- 61 | 62 | instance Show Resource where 63 | show = toString . textDisplay 64 | 65 | instance Display Resource where 66 | display (GitRepo host owner repo branch) = 67 | mconcat 68 | [ display host, 69 | ":", 70 | display owner, 71 | "/", 72 | display repo, 73 | ":", 74 | display branch 75 | ] 76 | {-# INLINE display #-} 77 | 78 | instance Display GitHost where 79 | display = displayShow 80 | {-# INLINE display #-} 81 | 82 | instance Display GitOwner where 83 | textDisplay (GitOwner owner) = owner 84 | {-# INLINE textDisplay #-} 85 | 86 | instance Display GitRepoName where 87 | textDisplay (GitRepoName repo) = repo 88 | {-# INLINE textDisplay #-} 89 | 90 | instance Display GitBranch where 91 | textDisplay (GitBranch branch) = branch 92 | {-# INLINE textDisplay #-} 93 | 94 | -------------------------------------------------------------------------------- 95 | -------------------------------------------------------------------------------- /melkor/stack.yaml: -------------------------------------------------------------------------------- 1 | resolver: lts-15.0 2 | 3 | packages: 4 | - . 5 | 6 | extra-deps: 7 | - git: https://github.com/d12frosted/path-extra 8 | commit: 8457c546d02c97d06710320de4e834fb0fd46637 9 | - env-extra-1.0.0.0@sha256:2b5f58f5756dedf9956c2f5738920b082ab8e08a0b62b902b67f5134cecad00d,1558 10 | - tasty-quickcheck-laws-0.0.3@sha256:a33a458e2a98feee96be41969382a63c9570fdbca262f07e56d6b4d0228b36cd,2105 11 | -------------------------------------------------------------------------------- /melkor/stack.yaml.lock: -------------------------------------------------------------------------------- 1 | # This file was autogenerated by Stack. 2 | # You should not edit this file by hand. 3 | # For more information, please see the documentation at: 4 | # https://docs.haskellstack.org/en/stable/lock_files 5 | 6 | packages: 7 | - completed: 8 | cabal-file: 9 | size: 1484 10 | sha256: 41255c031aa84e63da37adbfe7fe2a9407227ae378f7d86b6eba57d61a1ba6fb 11 | name: path-extra 12 | version: 0.1.0.0 13 | git: https://github.com/d12frosted/path-extra 14 | pantry-tree: 15 | size: 589 16 | sha256: b96881df98c9a2690edb2be3345dc5dde81c18bb22dd1351be8e7ca12f1758dd 17 | commit: 8457c546d02c97d06710320de4e834fb0fd46637 18 | original: 19 | git: https://github.com/d12frosted/path-extra 20 | commit: 8457c546d02c97d06710320de4e834fb0fd46637 21 | - completed: 22 | hackage: env-extra-1.0.0.0@sha256:2b5f58f5756dedf9956c2f5738920b082ab8e08a0b62b902b67f5134cecad00d,1558 23 | pantry-tree: 24 | size: 330 25 | sha256: b87d102a147f4c675b9b22ce62ab3bf0d79a030b416d4281319e8b91dabeb314 26 | original: 27 | hackage: env-extra-1.0.0.0@sha256:2b5f58f5756dedf9956c2f5738920b082ab8e08a0b62b902b67f5134cecad00d,1558 28 | - completed: 29 | hackage: tasty-quickcheck-laws-0.0.3@sha256:a33a458e2a98feee96be41969382a63c9570fdbca262f07e56d6b4d0228b36cd,2105 30 | pantry-tree: 31 | size: 1528 32 | sha256: fb68e01210ba5d9d979b1803a074ff8a2ab4972cfe2d2f6b6863a382914415e5 33 | original: 34 | hackage: tasty-quickcheck-laws-0.0.3@sha256:a33a458e2a98feee96be41969382a63c9570fdbca262f07e56d6b4d0228b36cd,2105 35 | snapshots: 36 | - completed: 37 | size: 488576 38 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/0.yaml 39 | sha256: e4b6a87b47ec1cf63a7f1a0884a3b276fce2b0d174a10e8753c4f618e7983568 40 | original: lts-15.0 41 | -------------------------------------------------------------------------------- /melkor/test/.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((haskell-mode . ((dante-target . ":melkor-test")))) 2 | -------------------------------------------------------------------------------- /melkor/test/Melkor/Types/Internal/SingleRelMapSpec.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | 3 | -- | 4 | -- Module : Melkor.Types.Internal.SingleRelMapSpec 5 | -- Description : 'SingleRelMap' tests 6 | -- Copyright : (c) Boris Buliga, 2020 7 | -- License : MIT 8 | -- Maintainer : boris@d12frosted.io 9 | -- Stability : experimental 10 | -- Portability : POSIX 11 | module Melkor.Types.Internal.SingleRelMapSpec where 12 | 13 | -------------------------------------------------------------------------------- 14 | 15 | import Melkor.Test.Gen 16 | import Melkor.Types.Internal.SingleRelMap 17 | -------------------------------------------------------------------------------- 18 | 19 | import RIO 20 | import Test.Tasty 21 | import Test.Tasty.QuickCheck 22 | import Test.Tasty.QuickCheck.Laws.Monoid 23 | 24 | -------------------------------------------------------------------------------- 25 | 26 | tests :: TestTree 27 | tests = 28 | testGroup 29 | "SingleRelMap" 30 | [ testMonoidLaws (Proxy :: Proxy (SingleRelMap Bool Word)), 31 | testProperty "mappend combines keys" $ 32 | prop_mappendKeys (Proxy :: Proxy Bool) (Proxy :: Proxy Word), 33 | testProperty "mappend combines elems" $ 34 | prop_mappendKeys (Proxy :: Proxy Bool) (Proxy :: Proxy Word) 35 | ] 36 | 37 | prop_mappendKeys :: 38 | ( Show a, 39 | Hashable a, 40 | Eq a, 41 | Show b, 42 | Hashable b, 43 | Eq b 44 | ) => 45 | Proxy a -> 46 | Proxy b -> 47 | SingleRelMap a b -> 48 | SingleRelMap a b -> 49 | Property 50 | prop_mappendKeys _ _ srm1 srm2 = 51 | keys (srm1 <> srm2) === keys srm1 <> keys srm2 52 | 53 | prop_mappendElems :: 54 | ( Show a, 55 | Hashable a, 56 | Eq a, 57 | Show b, 58 | Hashable b, 59 | Eq b 60 | ) => 61 | Proxy a -> 62 | Proxy b -> 63 | SingleRelMap a b -> 64 | SingleRelMap a b -> 65 | Property 66 | prop_mappendElems _ _ srm1 srm2 = 67 | elems (srm1 <> srm2) === elems srm1 <> elems srm2 68 | 69 | -------------------------------------------------------------------------------- 70 | -------------------------------------------------------------------------------- /melkor/test/Spec.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | 3 | -- | 4 | -- Module : Spec 5 | -- Description : Melkor test spec 6 | -- Copyright : (c) Boris Buliga, 2020 7 | -- License : MIT 8 | -- Maintainer : boris@d12frosted.io 9 | -- Stability : experimental 10 | -- Portability : POSIX 11 | module Main where 12 | 13 | -------------------------------------------------------------------------------- 14 | 15 | import Melkor.BuildMapSpec as BuildMap 16 | import Melkor.BuildPlanSpec as BuildPlan 17 | import Melkor.Types.Internal.SingleRelMapSpec as SingleRelMap 18 | -------------------------------------------------------------------------------- 19 | 20 | import RIO 21 | import Test.Tasty 22 | 23 | -------------------------------------------------------------------------------- 24 | 25 | main :: IO () 26 | main = 27 | defaultMain $ 28 | testGroup 29 | "Tests" 30 | [ SingleRelMap.tests, 31 | BuildMap.tests 32 | -- , BuildPlan.tests 33 | ] 34 | 35 | -------------------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /mimeapps.list: -------------------------------------------------------------------------------- 1 | [Default Applications] 2 | x-scheme-handler/http=userapp-Firefox-UBGX90.desktop 3 | x-scheme-handler/https=userapp-Firefox-UBGX90.desktop 4 | x-scheme-handler/chrome=userapp-Firefox-UBGX90.desktop 5 | text/html=userapp-Firefox-UBGX90.desktop 6 | application/x-extension-htm=userapp-Firefox-UBGX90.desktop 7 | application/x-extension-html=userapp-Firefox-UBGX90.desktop 8 | application/x-extension-shtml=userapp-Firefox-UBGX90.desktop 9 | application/xhtml+xml=userapp-Firefox-UBGX90.desktop 10 | application/x-extension-xhtml=userapp-Firefox-UBGX90.desktop 11 | application/x-extension-xht=userapp-Firefox-UBGX90.desktop 12 | 13 | [Added Associations] 14 | x-scheme-handler/http=userapp-Firefox-UBGX90.desktop; 15 | x-scheme-handler/https=userapp-Firefox-UBGX90.desktop; 16 | x-scheme-handler/chrome=userapp-Firefox-UBGX90.desktop; 17 | text/html=userapp-Firefox-UBGX90.desktop; 18 | application/x-extension-htm=userapp-Firefox-UBGX90.desktop; 19 | application/x-extension-html=userapp-Firefox-UBGX90.desktop; 20 | application/x-extension-shtml=userapp-Firefox-UBGX90.desktop; 21 | application/xhtml+xml=userapp-Firefox-UBGX90.desktop; 22 | application/x-extension-xhtml=userapp-Firefox-UBGX90.desktop; 23 | application/x-extension-xht=userapp-Firefox-UBGX90.desktop; 24 | -------------------------------------------------------------------------------- /networkmanager-dmenu/config.ini: -------------------------------------------------------------------------------- 1 | [dmenu] 2 | fn = -*-source-code-pro-*-*-*-12-*-*-*-*-*-*-* 3 | # dmenu_command = /usr/bin/dmenu 4 | # # Note that dmenu_command can contain arguments as well like `rofi -width 30` 5 | # # Rofi and dmenu are set to case insensitive by default `-i` 6 | # l = number of lines to display, defaults to number of total network options 7 | # fn = font string 8 | # nb = normal background (name, #RGB, or #RRGGBB) 9 | # nf = normal foreground 10 | # sb = selected background 11 | # sf = selected foreground 12 | # b = (just set to empty value and menu will appear at the bottom 13 | # m = number of monitor to display on 14 | # p = Custom Prompt for the networks menu 15 | # pinentry = Pinentry command 16 | # rofi_highlight = # (Default: False) use rofi highlighting instead of '**' 17 | 18 | # # override normal foreground and background colors (dmenu) or use the 19 | # # -password option (rofi) to obscure passphrase entry 20 | # [dmenu_passphrase] 21 | # nf = #222222 22 | # nb = #222222 23 | # rofi_obscure = True 24 | 25 | [editor] 26 | terminal = xterm 27 | gui_if_available = True 28 | # terminal = 29 | # gui_if_available = 30 | -------------------------------------------------------------------------------- /nix/darwin/yabai.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | let 3 | jq = "${pkgs.jq}/bin/jq"; 4 | open_alacritty = "open -na ${pkgs.alacritty}/Applications/Alacritty.app"; 5 | set_shell = "export SHELL=/run/current-system/sw/bin/fish"; 6 | open_emacs = ''open -na "$(brew --cellar emacs-plus@30)/30.1/Emacs.app"''; 7 | in { 8 | 9 | home.file.skhd = { 10 | target = ".config/skhd/skhdrc"; 11 | text = '' 12 | ################################################################################ 13 | # 14 | # window manipulation 15 | # 16 | 17 | lalt - return : yabai -m window --swap first 18 | lalt + shift - space : yabai -m space --balance 19 | lalt - space : yabai-layout-toggle 20 | 21 | alt - r : yabai -m space --rotate 90 22 | 23 | lalt - j : yabai-window-focus prev 24 | lalt - k : yabai-window-focus next 25 | 26 | lalt - h : yabai -m window --resize left:-100:0 || yabai -m window --resize right:-100:0 27 | lalt - l : yabai -m window --resize right:100:0 || yabai -m window --resize left:100:0 28 | lalt + shift - h : yabai -m window --resize bottom:0:100 || yabai -m window --resize top:0:100 29 | lalt + shift - l : yabai -m window --resize top:0:-100 || yabai -m window --resize bottom:0:-100 30 | 31 | ################################################################################ 32 | # 33 | # space manipulation 34 | # 35 | 36 | lalt - 1 : yabai -m space --focus 1 37 | lalt - 2 : yabai -m space --focus 2 38 | lalt - 3 : yabai -m space --focus 3 39 | lalt - 4 : yabai -m space --focus 4 40 | lalt - 5 : yabai -m space --focus 5 41 | lalt - 6 : yabai -m space --focus 6 42 | 43 | lalt + shift - 1 : yabai -m window --space 1; yabai -m space --focus 1 44 | lalt + shift - 2 : yabai -m window --space 2; yabai -m space --focus 2 45 | lalt + shift - 3 : yabai -m window --space 3; yabai -m space --focus 3 46 | lalt + shift - 4 : yabai -m window --space 4; yabai -m space --focus 4 47 | lalt + shift - 5 : yabai -m window --space 5; yabai -m space --focus 5 48 | lalt + shift - 6 : yabai -m window --space 6; yabai -m space --focus 6 49 | 50 | ################################################################################ 51 | # 52 | # Applications 53 | # 54 | 55 | lalt + shift - c [ 56 | "emacs" : skhd -k "ctrl - x" ; skhd -k "ctrl - c" 57 | * : skhd -k "cmd - q" 58 | ] 59 | 60 | ################################################################################ 61 | # 62 | # Mode for opening applications 63 | # 64 | 65 | :: open @ 66 | lalt - o ; open 67 | open < lalt - o ; default 68 | 69 | # emacs 70 | open < e : ${set_shell} ; ${open_emacs} ; skhd -k "alt - o" 71 | open < shift - e : nohup emacs --debug-init &>/dev/null & ; skhd -k "alt - o" 72 | 73 | # alacritty 74 | open < return : ${open_alacritty} ; skhd -k "alt - o" 75 | alt + shift - return : ${open_alacritty} 76 | 77 | ################################################################################ 78 | # 79 | # Blacklist some applications 80 | # 81 | 82 | .blacklist [ 83 | "Final Fantasy XIV" 84 | "ffxiv_dx11.exe" 85 | ] 86 | 87 | lalt - f : terminal-notifier -message $SHELL -group system-wide-whisper -timeout 1 88 | ''; 89 | }; 90 | } 91 | -------------------------------------------------------------------------------- /nix/linux/services.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: { 2 | services = { 3 | gpg-agent = { 4 | enable = true; 5 | enableSshSupport = true; 6 | sshKeys = [ 7 | "${config.home.homeDirectory}/.ssh/id_rsa" 8 | ]; 9 | }; 10 | }; 11 | systemd.user.services.dropbox = { 12 | Unit.description = "Dropbox"; 13 | Install.WantedBy = [ 14 | # "graphical-session.target" 15 | "default.target" 16 | ]; 17 | Service = { 18 | ExecStart = "${pkgs.dropbox.out}/bin/dropbox"; 19 | ExecReload = "${pkgs.coreutils.out}/bin/kill -HUP $MAINPID"; 20 | KillMode = "control-group"; # upstream recommends process 21 | Restart = "on-failure"; 22 | PrivateTmp = true; 23 | ProtectSystem = "full"; 24 | Nice = 10; 25 | }; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /nix/linux/xsession.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: { 2 | home.file.".xsession" = { 3 | executable = true; 4 | text = '' 5 | export PATH=/nix/var/nix/profiles/default/bin:$PATH 6 | export PATH=/run/current-system/sw/bin:$PATH 7 | export PATH=$HOME/.nix-profile/bin:$PATH 8 | export PATH=/run/wrappers/bin:$PATH 9 | export PATH=$HOME/.local/bin:$PATH 10 | export PATH=$HOME/.config/bin:$PATH 11 | 12 | export XDG_CONFIG_HOME=${config.xdg.configHome} 13 | 14 | userresources=$XDG_CONFIG_HOME/xorg/xresources 15 | usermodmap=$XDG_CONFIG_HOME/xorg/xmodmap 16 | 17 | if [ -f "$userresources" ]; then 18 | xrdb -merge "$userresources" 19 | fi 20 | 21 | if [ -f "$usermodmap" ]; then 22 | xmodmap "$usermodmap" 23 | fi 24 | 25 | # I need this so much outside of Emacs. 26 | ${pkgs.xorg.xset}/bin/xset r rate 180 26 27 | 28 | # Make sure that Caps doesn't miss its purpose 29 | setxkbmap -option caps:ctrl_modifier 30 | 31 | # I rarely see my wallpapers. But when I do, I am happy. 32 | fehbg & 33 | 34 | # Because every X needs some algebra to tame it. 35 | dbus-launch d12-xmonad --replace 36 | ''; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /nix/overlays/default.nix: -------------------------------------------------------------------------------- 1 | self: super: { 2 | # TODO: Switch back to src build when SkyLight issue is fixed 3 | yabai = super.yabai.overrideAttrs ( 4 | _: rec { 5 | version = "3.3.8"; 6 | src = builtins.fetchTarball { 7 | url = "https://github.com/koekeishiya/yabai/releases/download/v${version}/yabai-v${version}.tar.gz"; 8 | sha256 = "1qh1vf52j0b3lyrm005c8c98s39rk1lq61rrq0ml2yr4h77rq3xv"; 9 | }; 10 | 11 | installPhase = '' 12 | mkdir -p $out/bin 13 | mkdir -p $out/share/man/man1/ 14 | cp ./bin/yabai $out/bin/yabai 15 | cp ./doc/yabai.1 $out/share/man/man1/yabai.1 16 | ''; 17 | } 18 | ); 19 | 20 | base16-shell = self.callPackage ../pkgs/base16-shell.nix {}; 21 | 22 | jetbrains = super.jetbrains // { 23 | idea-ultimate = super.jetbrains.idea-ultimate.overrideAttrs ( 24 | _: rec { 25 | version = "2021.3"; 26 | src = super.fetchurl { 27 | url = "https://download.jetbrains.com/idea/ideaIU-${version}-no-jbr.tar.gz"; 28 | sha256 = "0riwww75aizprb01c1sccprbr00ky5wgy5cxxjxqgm8v72rfnihb"; /* updated by script */ 29 | }; 30 | }); 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /nix/packages.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, stdenv, ... }: 2 | 3 | with pkgs; 4 | let exe = haskell.lib.justStaticExecutables; 5 | in [ 6 | # pandoc 7 | coreutils 8 | eask 9 | ffmpeg 10 | fish 11 | fontconfig 12 | git 13 | git-filter-repo 14 | git-lfs 15 | gnugrep 16 | gnumake 17 | gnumeric 18 | gnupg 19 | gnuplot 20 | gnused 21 | gnutar 22 | hledger 23 | hledger-ui 24 | hledger-web 25 | home-manager 26 | hpack 27 | imagemagick 28 | jq 29 | killall 30 | kubectl 31 | libicns 32 | libwebp 33 | ncdu 34 | openssh 35 | openssl 36 | python310Packages.pygments 37 | ranger 38 | ripgrep 39 | rsync 40 | sqlite 41 | texlive.combined.scheme-full 42 | unrar 43 | unzip 44 | uv 45 | wget 46 | ] ++ lib.optionals stdenv.isDarwin [ pinentry_mac terminal-notifier yt-dlp ] 47 | ++ [ 48 | # all things editor 49 | (aspellWithDicts (dicts: with dicts; [ en en-computers en-science ])) 50 | languagetool 51 | nixfmt-classic 52 | nixpkgs-fmt 53 | ormolu 54 | shellcheck 55 | ] ++ [ 56 | # all things haskell 57 | # cabal2nix 58 | # hpack 59 | ] ++ [ 60 | # all things node :fear: 61 | nodePackages.npm 62 | nodePackages.pnpm 63 | nodePackages.typescript 64 | nodePackages.typescript-language-server 65 | nodePackages.webpack 66 | nodejs 67 | yarn 68 | (writeShellScriptBin "claude-code" '' 69 | ${nodejs}/bin/npx @anthropic-ai/claude-code "$@" 70 | '') 71 | ] ++ [ 72 | # fonts 73 | font-awesome_4 74 | fontconfig 75 | (iosevka-bin.override { variant = ""; }) 76 | (iosevka-bin.override { variant = "Aile"; }) 77 | (iosevka-bin.override { variant = "Curly"; }) 78 | mplus-outline-fonts.githubRelease 79 | roboto-mono 80 | source-code-pro 81 | source-sans-pro 82 | source-serif-pro 83 | symbola 84 | ] 85 | -------------------------------------------------------------------------------- /nix/pkgs/base16-shell.nix: -------------------------------------------------------------------------------- 1 | { stdenv, pkgs, ... }: 2 | 3 | stdenv.mkDerivation rec { 4 | version = "31f5d1d9dae6d408cfd6d23519f41fe8fd0824b9"; 5 | pname = "base16-shell"; 6 | src = pkgs.fetchFromGitHub { 7 | owner = "chriskempson"; 8 | repo = pname; 9 | rev = version; 10 | sha256 = "0dbrx571d13x1zhi3zraarh563237j83v72n3l081fz0rz2rzfp0"; 11 | }; 12 | outputs = [ "out" ]; 13 | installPhase = '' 14 | mkdir -p $out 15 | cp -r . $out 16 | ''; 17 | } 18 | -------------------------------------------------------------------------------- /scala/Linkfile: -------------------------------------------------------------------------------- 1 | plugins.sbt ~/.sbt/1.0/plugins/plugins.sbt 2 | -------------------------------------------------------------------------------- /scala/plugins.sbt: -------------------------------------------------------------------------------- 1 | // resolvers += Resolver.sonatypeRepo("snapshots") 2 | // addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.3-23-550c6c0a") 3 | -------------------------------------------------------------------------------- /systemd/user/timers.target.wants/vulpea.sync.timer: -------------------------------------------------------------------------------- 1 | /home/d12frosted/.config/systemd/user/vulpea.sync.timer -------------------------------------------------------------------------------- /xmonad/.gitignore: -------------------------------------------------------------------------------- 1 | stack.yaml.lock 2 | .stack-work 3 | dist-newstyle 4 | -------------------------------------------------------------------------------- /xmonad/Linkfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/xmonad/Linkfile -------------------------------------------------------------------------------- /xmonad/README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: xmonad 2 | #+AUTHOR: Boris Buliga 3 | #+EMAIL: boris@d12frosted.io 4 | #+STARTUP: showeverything 5 | #+OPTIONS: toc:nil 6 | 7 | It's complicated. But life in X is impossible without it. 8 | 9 | * How to install 10 | 11 | The best way to install my configurations is to use =eru=. It also automatically 12 | restarts =xmonad= and =xmobar= if they are already running. 13 | 14 | #+begin_src bash 15 | $ eru xmonad 16 | #+end_src 17 | 18 | If you really want to do it by hand: 19 | 20 | #+begin_src bash 21 | $ stack install 22 | #+end_src 23 | 24 | * How to start 25 | 26 | Now you can use =d12-xmonad= and =d12-xmobar= executables. The former knows how 27 | to start status bar. 28 | 29 | #+begin_src bash 30 | $ d12-xmonad 31 | #+end_src 32 | 33 | See also my =xinitrc= in =xorg= domain. 34 | 35 | * Features 36 | 37 | 1. =xmonad= and =xmobar= configurations with shareable code and support of 38 | additional dependencies. Default setup of these applications do not support 39 | external dependencies or even shared code. 40 | 2. =d12-xmonad= automatically starts =d12-xmobar=. 41 | 3. Even though it's a custom application, =d12-xmonad= supports hotloading (e.g. 42 | restaring) via =--restart= argument. In short it works like this (this flow 43 | is possible thanks to great =xmonad= code): 44 | 1. =mod-q= is bind to =eru xmonad=, which rebuilds my configurations of 45 | =xmonad= and =xmobar= 46 | 2. if compilation fails, notification is sent via =notify= (checkout by =bin= 47 | domain) 48 | 3. otherwise =eru= launches =d12-xmonad= with =--restart= argument 49 | 4. this sends a notification to the running instance of =d12-xmonad= and it 50 | restarts itself 51 | 5. since =d12-xmonad= has direct dependency on =d12-xmobar=, it also gets 52 | restarted 53 | 4. Dropbox section in status bar 54 | 5. Notification section in status bar 55 | -------------------------------------------------------------------------------- /xmonad/cabal.project: -------------------------------------------------------------------------------- 1 | packages: *.cabal 2 | 3 | source-repository-package 4 | type: git 5 | location: https://github.com/d12frosted/path-extra 6 | tag: 2a9170f0e393c1bd1a732dd5ae740a8d70a27a71 7 | --sha256: 1b6g9airyx7ci5crafj7c0ajajgb23fha4lm0q7h73mngldxd6qp 8 | 9 | package xmobar 10 | flags: +all_extensions 11 | all_extensions: True 12 | -------------------------------------------------------------------------------- /xmonad/d12x.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 1.12 2 | 3 | -- This file has been generated from package.yaml by hpack version 0.34.4. 4 | -- 5 | -- see: https://github.com/sol/hpack 6 | -- 7 | -- hash: 877dee89ff234551b0976a648357cfc9c4745da8f85cf2c4cc8e512971fb8e97 8 | 9 | name: d12x 10 | version: 0.1.0.0 11 | homepage: https://github.com/d12frosted/environment#readme 12 | bug-reports: https://github.com/d12frosted/environment/issues 13 | author: Boris Buliga 14 | maintainer: Boris Buliga 15 | build-type: Simple 16 | 17 | source-repository head 18 | type: git 19 | location: https://github.com/d12frosted/environment 20 | 21 | library 22 | exposed-modules: 23 | Utils.Color 24 | Utils.Icon 25 | other-modules: 26 | Paths_d12x 27 | hs-source-dirs: 28 | lib 29 | default-extensions: 30 | OverloadedStrings 31 | ghc-options: -Wall -Werror 32 | build-depends: 33 | base 34 | , xmonad-contrib 35 | default-language: Haskell2010 36 | 37 | executable d12-xmobar 38 | main-is: Main.hs 39 | other-modules: 40 | Paths_d12x 41 | hs-source-dirs: 42 | xmobar 43 | default-extensions: 44 | OverloadedStrings 45 | ghc-options: -Wall -Werror 46 | build-depends: 47 | base 48 | , d12x 49 | , data-default 50 | , mtl 51 | , path 52 | , path-extra 53 | , process 54 | , xmobar 55 | default-language: Haskell2010 56 | 57 | executable d12-xmonad 58 | main-is: Main.hs 59 | other-modules: 60 | XMonad.Commands 61 | XMonad.Keybindings 62 | XMonad.Window 63 | XMonad.Workspaces 64 | Paths_d12x 65 | hs-source-dirs: 66 | xmonad 67 | default-extensions: 68 | OverloadedStrings 69 | ghc-options: -Wall -Werror 70 | build-depends: 71 | X11 72 | , base 73 | , d12x 74 | , data-default 75 | , xmonad 76 | , xmonad-contrib 77 | , xmonad-extras 78 | default-language: Haskell2010 79 | -------------------------------------------------------------------------------- /xmonad/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "A very basic flake"; 3 | inputs.haskellNix.url = "github:input-output-hk/haskell.nix"; 4 | inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable"; 5 | inputs.flake-utils.url = "github:numtide/flake-utils"; 6 | outputs = { self, nixpkgs, flake-utils, haskellNix }: 7 | flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" ] (system: 8 | let 9 | overlays = [ 10 | haskellNix.overlay 11 | (final: prev: { 12 | # This overlay adds our project to pkgs 13 | helloProject = 14 | final.haskell-nix.project' { 15 | src = ./.; 16 | compiler-nix-name = "ghc8104"; 17 | # This is used by `nix develop .` to open a shell for use with 18 | # `cabal`, `hlint` and `haskell-language-server` 19 | shell.tools = { 20 | cabal = {}; 21 | hlint = {}; 22 | haskell-language-server = {}; 23 | }; 24 | }; 25 | }) 26 | (self: super: { 27 | Xpm = self.xorg.libXpm; 28 | }) 29 | ]; 30 | pkgs = import nixpkgs { inherit system overlays; }; 31 | flake = pkgs.helloProject.flake {}; 32 | in flake // { 33 | # Built by `nix build .` 34 | defaultPackage = flake.packages."d12x:lib:d12x"; 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /xmonad/icons/battery-charge.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/xmonad/icons/battery-charge.xcf -------------------------------------------------------------------------------- /xmonad/icons/battery-charge.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * battery_charge_xpm[] = { 3 | "32 32 2 1", 4 | " c #FFFFFF", 5 | ". c #000000", 6 | " ", 7 | " ", 8 | " ", 9 | " ", 10 | " ........ ", 11 | " ......... ", 12 | " ........ ", 13 | "......... ........ ...... ", 14 | "......... ....... ...... ", 15 | "......... ....... ...... ", 16 | "... ...... ......", 17 | "... ...... ......", 18 | "... ..... ......", 19 | "... ........... ...", 20 | "... ............ ...", 21 | "... ............. ...", 22 | "... .............. ...", 23 | "... ............. ...", 24 | "... ....... ...", 25 | "... ....... ......", 26 | "... ...... ......", 27 | "... ...... ......", 28 | "..... ..... ........... ", 29 | "..... ..... ........... ", 30 | "..... .... ........... ", 31 | " .... ", 32 | " ... ", 33 | " ... ", 34 | " .. ", 35 | " ", 36 | " ", 37 | " "}; 38 | -------------------------------------------------------------------------------- /xmonad/icons/battery-charged.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/xmonad/icons/battery-charged.xcf -------------------------------------------------------------------------------- /xmonad/icons/battery-charged.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * battery_charged_xpm[] = { 3 | "32 32 2 1", 4 | " c #FFFFFF", 5 | ". c #000000", 6 | " ", 7 | " ", 8 | " ", 9 | " ", 10 | " ", 11 | " ", 12 | " ", 13 | "............................. ", 14 | "............................. ", 15 | "............................. ", 16 | "... ......", 17 | "... ......", 18 | "... ................... ......", 19 | "... ................... ...", 20 | "... ................... ...", 21 | "... ................... ...", 22 | "... ................... ...", 23 | "... ................... ...", 24 | "... ................... ...", 25 | "... ................... ......", 26 | "... ......", 27 | "... ......", 28 | "............................. ", 29 | "............................. ", 30 | "............................. ", 31 | " ", 32 | " ", 33 | " ", 34 | " ", 35 | " ", 36 | " ", 37 | " "}; 38 | -------------------------------------------------------------------------------- /xmonad/icons/battery-use.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/xmonad/icons/battery-use.xcf -------------------------------------------------------------------------------- /xmonad/icons/battery-use.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * battery_use_xpm[] = { 3 | "32 32 2 1", 4 | " c #FFFFFF", 5 | ". c #000000", 6 | " ", 7 | " ", 8 | " ", 9 | " ", 10 | " ", 11 | " ", 12 | " ", 13 | "............................. ", 14 | "............................. ", 15 | "............................. ", 16 | "... ......", 17 | "... ......", 18 | "... ... ... ... ......", 19 | "... ... ... ... ...", 20 | "... ... ... ... ...", 21 | "... ... ... ... ...", 22 | "... ... ... ... ...", 23 | "... ... ... ... ...", 24 | "... ... ... ... ...", 25 | "... ... ... ... ......", 26 | "... ......", 27 | "... ......", 28 | "............................. ", 29 | "............................. ", 30 | "............................. ", 31 | " ", 32 | " ", 33 | " ", 34 | " ", 35 | " ", 36 | " ", 37 | " "}; 38 | -------------------------------------------------------------------------------- /xmonad/icons/volume-mute.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/xmonad/icons/volume-mute.xcf -------------------------------------------------------------------------------- /xmonad/icons/volume-mute.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * volume_mute_xpm[] = { 3 | "32 32 2 1", 4 | " c #FFFFFF", 5 | ". c #000000", 6 | " ", 7 | " ", 8 | " ", 9 | " ", 10 | " ", 11 | " .. ", 12 | " .... ", 13 | " ...... ", 14 | " ........ ... ... ", 15 | " .......... ... ... ", 16 | " .............. ... ... ", 17 | "................ ... ... ", 18 | "................ ... ... ", 19 | "................ ... ... ", 20 | "................ ...... ", 21 | "................ ...... ", 22 | "................ ...... ", 23 | "................ ... ... ", 24 | "................ ... ... ", 25 | "................ ... ... ", 26 | "................ ... ... ", 27 | " .............. ... ... ", 28 | " .......... ... ... ", 29 | " ........ ", 30 | " ...... ", 31 | " .... ", 32 | " .. ", 33 | " ", 34 | " ", 35 | " ", 36 | " ", 37 | " "}; 38 | -------------------------------------------------------------------------------- /xmonad/icons/volume-up.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d12frosted/environment/472f5df9bb533f21c40950179f438f4f7196a6c2/xmonad/icons/volume-up.xcf -------------------------------------------------------------------------------- /xmonad/icons/volume-up.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * volume_up_xpm[] = { 3 | "32 32 3 1", 4 | " c None", 5 | ". c #FFFFFF", 6 | "+ c #000000", 7 | "................................", 8 | "................................", 9 | "...........................+....", 10 | "...........................++...", 11 | ".............+.............++...", 12 | "............++.............+++..", 13 | "..........++++......+......+++..", 14 | "........++++++......++......+++.", 15 | "......++++++++......++......+++.", 16 | "....++++++++++......+++.....+++.", 17 | "..++++++++++++++....+++......+++", 18 | "++++++++++++++++.....+++.....+++", 19 | "++++++++++++++++.....+++.....+++", 20 | "++++++++++++++++......+++....+++", 21 | "++++++++++++++++......+++....+++", 22 | "++++++++++++++++......+++....+++", 23 | "++++++++++++++++......+++....+++", 24 | "++++++++++++++++......+++....+++", 25 | "++++++++++++++++......+++....+++", 26 | "++++++++++++++++......++.....+++", 27 | "++++++++++++++++.....+++.....+++", 28 | "..++++++++++++++.....++......++.", 29 | "....++++++++++......+++.....+++.", 30 | "......++++++++......++......+++.", 31 | "........++++++......++......++..", 32 | "..........++++......+......+++..", 33 | "............++.............++...", 34 | "...........................++...", 35 | "...........................+....", 36 | "................................", 37 | "................................", 38 | "................................"}; 39 | -------------------------------------------------------------------------------- /xmonad/lib/Utils/Color.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | {-# LANGUAGE OverloadedStrings #-} 3 | {-# LANGUAGE RankNTypes #-} 4 | 5 | -------------------------------------------------------------------------------- 6 | 7 | -- | Defines colours used in the XMonad and XMobar configurations. 8 | module Utils.Color where 9 | 10 | -------------------------------------------------------------------------------- 11 | 12 | import Data.String 13 | 14 | -------------------------------------------------------------------------------- 15 | 16 | type Color = forall a. IsString a => a 17 | 18 | -------------------------------------------------------------------------------- 19 | 20 | background :: Color 21 | background = "#fefefe" 22 | 23 | backgroundInactive :: Color 24 | backgroundInactive = background 25 | 26 | backgroundActive :: Color 27 | backgroundActive = "#ca3435" 28 | 29 | -------------------------------------------------------------------------------- 30 | 31 | textRegular :: Color 32 | textRegular = "#050505" 33 | 34 | textWarning :: Color 35 | textWarning = "#e77200" 36 | 37 | textAlert :: Color 38 | textAlert = "#962727" 39 | 40 | textFocusedBg :: Color 41 | textFocusedBg = textRegular 42 | 43 | textFocusedFg :: Color 44 | textFocusedFg = background 45 | 46 | textTitleBg :: Color 47 | textTitleBg = "" 48 | 49 | textTitleFg :: Color 50 | textTitleFg = "#4848ff" 51 | 52 | -------------------------------------------------------------------------------- 53 | 54 | iconStaticBg :: Color 55 | iconStaticBg = "#f3fcf3" 56 | 57 | iconStaticFg :: Color 58 | iconStaticFg = textRegular 59 | 60 | iconInactiveBg :: Color 61 | iconInactiveBg = background 62 | 63 | iconInactiveFg :: Color 64 | iconInactiveFg = textRegular 65 | 66 | iconActiveBg :: Color 67 | iconActiveBg = "#bfdec8" 68 | 69 | iconActiveFg :: Color 70 | iconActiveFg = textRegular 71 | 72 | iconAlertBg :: Color 73 | iconAlertBg = "#fef0f0" 74 | 75 | iconAlertFg :: Color 76 | iconAlertFg = textRegular 77 | 78 | -------------------------------------------------------------------------------- 79 | 80 | popupBg :: Color 81 | popupBg = "#f3fcf3" 82 | 83 | popupFg :: Color 84 | popupFg = "#050505" 85 | 86 | -------------------------------------------------------------------------------- 87 | -------------------------------------------------------------------------------- /xmonad/lib/Utils/Icon.hs: -------------------------------------------------------------------------------- 1 | -- | Utility functions for working with icons (Unicode or Font Awesome 2 | -- characters). 3 | 4 | -------------------------------------------------------------------------------- 5 | 6 | module Utils.Icon 7 | ( static 8 | , inactive 9 | , inactiveThin 10 | , active 11 | , alert 12 | ) where 13 | 14 | -------------------------------------------------------------------------------- 15 | 16 | import Utils.Color 17 | 18 | -------------------------------------------------------------------------------- 19 | 20 | import XMonad.Hooks.DynamicLog (wrap, xmobarColor) 21 | 22 | -------------------------------------------------------------------------------- 23 | 24 | static :: String -> String 25 | static = xmobarColor iconStaticFg iconStaticBg . thin 26 | 27 | inactiveThin :: String -> String 28 | inactiveThin = xmobarColor iconInactiveFg iconInactiveBg . thin 29 | 30 | inactive :: String -> String 31 | inactive = xmobarColor iconInactiveFg iconInactiveBg . wide 32 | 33 | active :: String -> String 34 | active = xmobarColor iconActiveFg iconActiveBg . wide 35 | 36 | alert :: String -> String 37 | alert = xmobarColor iconAlertFg iconAlertBg . thin 38 | 39 | -------------------------------------------------------------------------------- 40 | 41 | wide :: String -> String 42 | wide = wrap " " " " 43 | 44 | thin :: String -> String 45 | thin = wrap "\x2008" "\x2008" 46 | 47 | -------------------------------------------------------------------------------- 48 | -------------------------------------------------------------------------------- /xmonad/package.yaml: -------------------------------------------------------------------------------- 1 | name: d12x 2 | version: '0.1.0.0' 3 | author: Boris Buliga 4 | maintainer: Boris Buliga 5 | github: d12frosted/environment 6 | 7 | default-extensions: 8 | - OverloadedStrings 9 | 10 | ghc-options: -Wall -Werror 11 | 12 | library: 13 | source-dirs: lib 14 | dependencies: 15 | - base 16 | - xmonad-contrib 17 | 18 | executables: 19 | d12-xmonad: 20 | source-dirs: xmonad 21 | main: Main.hs 22 | dependencies: 23 | - X11 24 | - base 25 | - d12x 26 | - data-default 27 | - xmonad 28 | - xmonad-contrib 29 | - xmonad-extras 30 | d12-xmobar: 31 | source-dirs: xmobar 32 | main: Main.hs 33 | dependencies: 34 | - base 35 | - path-extra 36 | - d12x 37 | - data-default 38 | - mtl 39 | - path 40 | - process 41 | - xmobar 42 | -------------------------------------------------------------------------------- /xmonad/xmonad/XMonad/Commands.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE LambdaCase #-} 2 | 3 | -- | Custom interactive commands that usually run by pressing some magic key 4 | -- bindings. 5 | module XMonad.Commands where 6 | 7 | import XMonad 8 | import XMonad.StackSet 9 | import XMonad.Window 10 | import XMonad.Workspaces 11 | 12 | firefox :: X () 13 | firefox = 14 | findApp "firefox" >>= \case 15 | Nothing -> spawn "firefox" >> windows (greedyView wsWeb) 16 | Just win -> windows . focusWindow $ win 17 | -------------------------------------------------------------------------------- /xmonad/xmonad/XMonad/Keybindings.hs: -------------------------------------------------------------------------------- 1 | -- | Keybindings for XMonad. Because why not? 2 | module XMonad.Keybindings where 3 | 4 | import XMonad 5 | import XMonad.Commands 6 | 7 | keybindings :: [(String, X ())] 8 | keybindings = 9 | [ ("M-q", spawn "eru xmonad"), 10 | ("M-p", spawn "rofi -show run"), 11 | ("", spawn "pactl set-sink-mute @DEFAULT_SINK@ false ; pactl set-sink-volume @DEFAULT_SINK@ +5%"), 12 | ("", spawn "pactl set-sink-mute @DEFAULT_SINK@ false ; pactl set-sink-volume @DEFAULT_SINK@ -5%"), 13 | ("", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"), 14 | ("", spawn "pactl set-source-mute @DEFAULT_SOURCE@ toggle"), 15 | ("", spawn "brightness inc"), 16 | ("", spawn "brightness dec"), 17 | ("M-S-z", spawn "xlock-wrapper"), 18 | ("M-", spawn "switch_kbd_layout --use-cyrillic"), 19 | ("M-S-", spawn "switch_kbd_layout"), 20 | ("M-", spawn "scrot"), 21 | ("M-C-", spawn "flameshot gui"), 22 | ("M-o e", spawn "emacs"), 23 | ("M-o i", firefox) 24 | ] 25 | -------------------------------------------------------------------------------- /xmonad/xmonad/XMonad/Window.hs: -------------------------------------------------------------------------------- 1 | -- | Helpers and utilities for Window search and manipulation. 2 | 3 | -------------------------------------------------------------------------------- 4 | 5 | {-# LANGUAGE NoImplicitPrelude #-} 6 | {-# LANGUAGE TupleSections #-} 7 | 8 | -------------------------------------------------------------------------------- 9 | 10 | module XMonad.Window where 11 | 12 | -------------------------------------------------------------------------------- 13 | 14 | import Data.List (find) 15 | import Graphics.X11.Xlib.Extras 16 | import Prelude 17 | import XMonad 18 | import XMonad.StackSet 19 | 20 | -------------------------------------------------------------------------------- 21 | 22 | findApp :: String -> X (Maybe Window) 23 | findApp name = withDisplay $ \dis -> do 24 | wins <- withWindowSet (pure . allWindows) 25 | wmap <- traverse (classify dis) wins 26 | return (snd <$> find ((== name) . fst) wmap) 27 | where classify :: Display -> Window -> X (String, Window) 28 | classify dis win = fmap ((, win) . resClass) $ io $ getClassHint dis win 29 | 30 | switchToApp :: String -> X () 31 | switchToApp name = 32 | findApp name >>= flip whenJust (windows . focusWindow) 33 | 34 | -------------------------------------------------------------------------------- 35 | -------------------------------------------------------------------------------- /xmonad/xmonad/XMonad/Workspaces.hs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | 3 | -------------------------------------------------------------------------------- 4 | 5 | -- | Configurations for workspaces. 6 | module XMonad.Workspaces where 7 | 8 | -------------------------------------------------------------------------------- 9 | 10 | import Data.Semigroup 11 | import XMonad 12 | 13 | -------------------------------------------------------------------------------- 14 | 15 | wsCode1 :: WorkspaceId 16 | wsCode1 = "\xf121" 17 | 18 | wsCode2 :: WorkspaceId 19 | wsCode2 = "\xf120" 20 | 21 | wsWeb :: WorkspaceId 22 | wsWeb = "\xf269" 23 | 24 | wsChat :: WorkspaceId 25 | wsChat = "\xf086" 26 | 27 | wsMail :: WorkspaceId 28 | wsMail = "\xf0e0" 29 | 30 | wsMedia :: WorkspaceId 31 | wsMedia = "\xf001" 32 | 33 | wsOther :: WorkspaceId 34 | wsOther = "\xf18c" 35 | 36 | -------------------------------------------------------------------------------- 37 | 38 | manageAppsWorkspace :: Query (Endo WindowSet) 39 | manageAppsWorkspace = 40 | composeAll . concat $ 41 | [ [stringProperty "WM_WINDOW_ROLE" =? "browser" --> doShift wsWeb], 42 | [className =? "jetbrains-idea" --> doShift wsCode2], 43 | [className =? "Spotify" --> doShift wsMedia], 44 | [className =? "TelegramDesktop" --> doShift wsChat], 45 | [className =? "Slack" --> doShift wsChat], 46 | [className =? "DBeaver" --> doShift wsCode2], 47 | [className =? "Java" --> doShift wsOther], 48 | [className =? "zoom" --> doShift wsMedia] 49 | ] 50 | 51 | -------------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /xorg/30-touchpad.conf: -------------------------------------------------------------------------------- 1 | Section "InputClass" 2 | Identifier "libinput touchpad catchall" 3 | MatchIsTouchpad "on" 4 | MatchDevicePath "/dev/input/event*" 5 | Driver "libinput" 6 | Option "NaturalScrolling" "true" 7 | EndSection 8 | -------------------------------------------------------------------------------- /xorg/xresources: -------------------------------------------------------------------------------- 1 | ! 2 | ! Resolution 3 | ! 4 | 5 | ! Xft.dpi: 133 6 | Xft.autohint: 0 7 | Xft.lcdfilter: lcddefault 8 | Xft.hintstyle: hintfull 9 | Xft.hinting: 1 10 | Xft.antialias: 1 11 | Xft.rgba: rgb 12 | 13 | ! 14 | ! Xterm configurations 15 | ! 16 | 17 | XTerm*utf8: 1 18 | XTerm*faceName: xft:Source Code Pro:size=10 19 | XTerm*metaSendsEscape: true 20 | XTerm.*backarrowKey: false 21 | XTerm*deleteIsDEL: true 22 | XTerm*modifier: meta 23 | XTerm*modifyOtherKeys: 1 24 | 25 | ! Tomorrow 26 | #define t_background #ffffff 27 | #define t_current_line #efefef 28 | #define t_selection #d6d6d6 29 | #define t_foreground #4d4d4c 30 | #define t_comment #8e908c 31 | #define t_red #c82829 32 | #define t_orange #f5871f 33 | #define t_yellow #eab700 34 | #define t_green #718c00 35 | #define t_aqua #3e999f 36 | #define t_blue #4271ae 37 | #define t_purple #8959a8 38 | 39 | *.foreground: t_foreground 40 | *.background: t_background 41 | *.cursorColor: #aeafad 42 | 43 | ! Black / Grey 44 | *.color0: #000000 45 | *.color8: #666666 46 | 47 | ! Red / Bright Red 48 | *.color1: t_red 49 | *.color9: #FF3334 50 | 51 | ! Green + Bright Green 52 | *.color2: t_green 53 | *.color10: #9ec400 54 | 55 | ! Yellow (Orange) + Bright Yellow (Yellow) 56 | *.color3: t_orange 57 | *.color11: t_yellow 58 | 59 | ! Blue + Bright Blue 60 | *.color4: t_blue 61 | *.color12: t_blue 62 | 63 | ! Magenta (Purple) + Bright Magenta 64 | *.color5: t_purple 65 | *.color13: #b777e0 66 | 67 | ! Cyan (Aqua) + Bright Cyan 68 | *.color6: t_aqua 69 | *.color14: #54ced6 70 | 71 | ! Light Grey (Selection) + White (Current Line) 72 | *.color7: t_selection 73 | *.color15: t_current_line 74 | 75 | ! 76 | ! RXVT configurations 77 | ! 78 | 79 | URxvt.font: xft:Source Code Pro:pixelsize=18,xft:Symbola:pixelsize=18 80 | URxvt.scrollBar: false 81 | URxvt.perl-ext-common: font-size,selection-to-clipboard 82 | -------------------------------------------------------------------------------- /yabai/yabairc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # load scripting additions 4 | yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" 5 | sudo yabai --load-sa 6 | 7 | # config 8 | yabai -m config layout bsp 9 | yabai -m config top_padding 8 10 | yabai -m config bottom_padding 8 11 | yabai -m config left_padding 8 12 | yabai -m config right_padding 8 13 | yabai -m config window_gap 8 14 | 15 | yabai -m config auto_balance off 16 | yabai -m config split_ratio 0.5 17 | yabai -m config window_shadow off 18 | 19 | # borders 20 | borders active_color=0xffe1e3e4 inactive_color=0xff494d64 width=5.0 & 21 | 22 | # 23 | # setup spaces 24 | # 25 | for _ in $(yabai -m query --spaces | jq '.[].index | select(. > 6)'); do 26 | yabai -m space --destroy 7 27 | done 28 | 29 | function setup_space { 30 | local idx="$1" 31 | local name="$2" 32 | local space= 33 | echo "setup space $idx : $name" 34 | 35 | space=$(yabai -m query --spaces --space "$idx") 36 | if [ -z "$space" ]; then 37 | yabai -m space --create 38 | fi 39 | 40 | yabai -m space "$idx" --label "$name" 41 | } 42 | 43 | setup_space 1 emacs 44 | setup_space 2 code 45 | setup_space 3 web 46 | setup_space 4 social 47 | setup_space 5 media 48 | setup_space 6 other 49 | 50 | # custom application runes 51 | yabai -m rule --add app="^Arc$" title"^$" space=3 52 | yabai -m rule --add app="Arc.LittleBrowserWindow" manage=off 53 | yabai -m rule --add app="^Firefox$" space=3 54 | yabai -m rule --add app="^Safari$" space=3 55 | 56 | yabai -m rule --add app="^Discord$" space=4 57 | yabai -m rule --add app="^Hey$" space=4 58 | yabai -m rule --add app="^Messages$" space=4 59 | yabai -m rule --add app="^Slack$" space=4 60 | yabai -m rule --add app="^Telegram$" space=4 61 | 62 | yabai -m rule --add app="^Music$" space=5 63 | yabai -m rule --add app="^Spotify$" space=5 64 | 65 | yabai -m rule --add app="^Transmission$" space=6 66 | yabai -m rule --add app="^XIV on Mac$" space=6 manage=off 67 | 68 | yabai -m rule --add app="^Archive Utility$" manage=off 69 | yabai -m rule --add app="^Calculator$" manage=off 70 | yabai -m rule --add app="^Cryptomator$" manage=off 71 | yabai -m rule --add app="^Emacs$" title!='^$' manage=on 72 | yabai -m rule --add app="^Finder$" title="Copy" manage=off 73 | yabai -m rule --add app="^NIIMBOT$" manage=off 74 | yabai -m rule --add app="^System Preferences$" manage=off 75 | yabai -m rule --add app="^System Settings$" manage=off 76 | yabai -m rule --add app='^IntelliJ IDEA$' subrole='AXDialog' manage=off 77 | yabai -m rule --add title="^Preferences" manage=off 78 | yabai -m rule --add title="^Settings" manage=off 79 | --------------------------------------------------------------------------------