From 1cace80e4832a5d250ef4b7ccd687996563fb01b Mon Sep 17 00:00:00 2001 From: venomade Date: Thu, 27 Feb 2025 17:06:42 +0000 Subject: Add old dotfiles --- alpine-river/README.md | 45 + alpine-river/build/emacs/.gitignore | 3 + alpine-river/build/emacs/install-emacs.sh | 92 + alpine-river/config/btop/.gitignore | 1 + alpine-river/config/btop/btop.conf | 248 ++ alpine-river/config/btop/themes/rose-pine.theme | 119 + alpine-river/config/dunst/dunstrc | 42 + alpine-river/config/fastfetch/config.jsonc | 49 + alpine-river/config/fish/.gitignore | 1 + alpine-river/config/fish/completions/fisher.fish | 7 + .../fish/completions/fzf_configure_bindings.fish | 8 + alpine-river/config/fish/completions/ya.fish | 52 + alpine-river/config/fish/completions/yazi.fish | 9 + alpine-river/config/fish/conf.d/fzf.fish | 28 + alpine-river/config/fish/conf.d/rustup.fish | 1 + alpine-river/config/fish/config.fish | 23 + alpine-river/config/fish/fish_plugins | 3 + .../functions/_fzf_configure_bindings_help.fish | 43 + .../fish/functions/_fzf_extract_var_info.fish | 15 + .../fish/functions/_fzf_preview_changed_file.fish | 49 + .../config/fish/functions/_fzf_preview_file.fish | 43 + .../fish/functions/_fzf_report_diff_type.fish | 18 + .../fish/functions/_fzf_report_file_type.fish | 6 + .../fish/functions/_fzf_search_directory.fish | 33 + .../config/fish/functions/_fzf_search_git_log.fish | 36 + .../fish/functions/_fzf_search_git_status.fish | 41 + .../config/fish/functions/_fzf_search_history.fish | 39 + .../fish/functions/_fzf_search_processes.fish | 32 + .../fish/functions/_fzf_search_variables.fish | 47 + .../config/fish/functions/_fzf_wrapper.fish | 21 + alpine-river/config/fish/functions/fisher.fish | 240 ++ .../fish/functions/fzf_configure_bindings.fish | 46 + .../config/fish/themes/Ros\303\251 Pine.theme" | 41 + alpine-river/config/foot/foot.ini | 34 + alpine-river/config/fuzzel/fuzzel.ini | 22 + alpine-river/config/gtk-3.0/gtk.css | 12 + alpine-river/config/gtk-3.0/settings.ini | 5 + alpine-river/config/gtk-4.0/gtk.css | 12 + alpine-river/config/gtk-4.0/settings.ini | 6 + alpine-river/config/kanata/config.kbd | 52 + alpine-river/config/mpv/mpv.conf | 3 + alpine-river/config/mpv/script-opts/uosc.conf | 237 ++ alpine-river/config/mpv/scripts/thumbfast.lua | 951 ++++++++ alpine-river/config/nvim/.gitignore | 1 + alpine-river/config/nvim/init.lua | 134 ++ alpine-river/config/nvim/lua/config/cmp.lua | 30 + alpine-river/config/nvim/lua/config/colemak.lua | 29 + alpine-river/config/nvim/lua/config/lazy.lua | 35 + alpine-river/config/nvim/lua/plugins.lua | 32 + alpine-river/config/river/init | 200 ++ alpine-river/config/river/theme | 19 + alpine-river/config/swaylock/config | 48 + alpine-river/config/waybar/config | 71 + alpine-river/config/waybar/rose-pine.css | 23 + alpine-river/config/waybar/style.css | 98 + alpine-river/config/yazi/keymap.toml | 96 + alpine-river/config/yazi/rose-pine.tmTheme | 959 ++++++++ alpine-river/config/yazi/theme.toml | 153 ++ alpine-river/config/yazi/yazi.toml | 6 + alpine-river/local/bin/dry | Bin 0 -> 19959796 bytes alpine-river/local/bin/kanata | Bin 0 -> 2349208 bytes alpine-river/local/bin/kew | Bin 0 -> 713488 bytes alpine-river/local/bin/take-slurpshot | 18 + alpine-river/local/bin/ya | Bin 0 -> 3099296 bytes alpine-river/local/bin/yazi | Bin 0 -> 14089936 bytes alpine-river/profile | 17 + alpine-river/screenshot.png | Bin 0 -> 2176077 bytes alpine-river/tmux.conf | 76 + alpine-river/world | 93 + emacs-elisp/config.el | 47 + emacs-elisp/config/fonts.el | 74 + emacs-elisp/config/functions.el | 50 + emacs-elisp/config/misc.el | 43 + emacs-elisp/config/orgmode.el | 6 + emacs-elisp/config/project.el | 10 + emacs-elisp/config/shortcuts.el | 33 + emacs-elisp/config/straight.el | 15 + emacs-elisp/config/theme.el | 5 + emacs-elisp/init.el | 4 + emacs-elisp/languages/c-cpp.el | 4 + emacs-elisp/languages/clojure.el | 5 + emacs-elisp/languages/rust.el | 11 + emacs-elisp/languages/scheme.el | 10 + emacs-elisp/packages/avy.el | 6 + emacs-elisp/packages/cape.el | 11 + emacs-elisp/packages/corfu.el | 7 + emacs-elisp/packages/counsel.el | 11 + emacs-elisp/packages/devdocs.el | 5 + emacs-elisp/packages/flycheck.el | 6 + emacs-elisp/packages/lsp.el | 13 + emacs-elisp/packages/magit.el | 3 + emacs-elisp/packages/movetext.el | 4 + emacs-elisp/packages/multicursor.el | 6 + emacs-elisp/packages/rainbow.el | 4 + emacs-elisp/packages/simplemdln.el | 15 + emacs-elisp/packages/smartparens.el | 5 + emacs-elisp/packages/undotree.el | 6 + emacs-elisp/packages/whichkey.el | 5 + emacs-evil/EmacsLogo.png | Bin 0 -> 24600 bytes emacs-evil/README.md | 7 + emacs-evil/config.org | 832 +++++++ emacs-evil/early-init.el | 1 + emacs-evil/eshell/aliases | 1 + emacs-evil/eshell/profile | 0 emacs-evil/init.el | 4 + emacs-evil/res/EmacsDashScreenshot.png | Bin 0 -> 143889 bytes neovim/init.lua | 2 + neovim/lua/plugins/autopairs.lua | 3 + neovim/lua/plugins/catppuccin.lua | 29 + neovim/lua/plugins/codeium.lua | 1 + neovim/lua/plugins/colorizer.lua | 1 + neovim/lua/plugins/dashboard.lua | 58 + neovim/lua/plugins/harpoon.lua | 10 + neovim/lua/plugins/init.lua | 11 + neovim/lua/plugins/lastplace.lua | 1 + neovim/lua/plugins/lsp.lua | 40 + neovim/lua/plugins/lualine.lua | 13 + neovim/lua/plugins/telescope.lua | 7 + neovim/lua/plugins/treesitter.lua | 17 + neovim/lua/venomade/clipboard.lua | 14 + neovim/lua/venomade/config.lua | 41 + neovim/lua/venomade/init.lua | 5 + neovim/lua/venomade/lazy.lua | 44 + neovim/lua/venomade/neovide.lua | 20 + neovim/lua/venomade/remap.lua | 7 + nixos/LICENSE | 13 + nixos/README | 3 + nixos/config/coc-settings.json | 18 + nixos/config/dmenu.patch | 19 + nixos/config/dmscripts-conf | 261 ++ nixos/config/ghci | 1 + nixos/config/kitty.conf | 2535 ++++++++++++++++++++ nixos/config/neovim/init.lua | 2 + nixos/config/neovim/lua/plugins/autopairs.lua | 3 + nixos/config/neovim/lua/plugins/catppuccin.lua | 29 + nixos/config/neovim/lua/plugins/codeium.lua | 1 + nixos/config/neovim/lua/plugins/colorizer.lua | 1 + nixos/config/neovim/lua/plugins/dashboard.lua | 58 + nixos/config/neovim/lua/plugins/harpoon.lua | 10 + nixos/config/neovim/lua/plugins/init.lua | 11 + nixos/config/neovim/lua/plugins/lastplace.lua | 1 + nixos/config/neovim/lua/plugins/lsp.lua | 40 + nixos/config/neovim/lua/plugins/lualine.lua | 13 + nixos/config/neovim/lua/plugins/telescope.lua | 7 + nixos/config/neovim/lua/plugins/treesitter.lua | 17 + nixos/config/neovim/lua/venomade/clipboard.lua | 14 + nixos/config/neovim/lua/venomade/config.lua | 41 + nixos/config/neovim/lua/venomade/init.lua | 5 + nixos/config/neovim/lua/venomade/lazy.lua | 42 + nixos/config/neovim/lua/venomade/neovide.lua | 20 + nixos/config/neovim/lua/venomade/remap.lua | 7 + nixos/config/picom.conf | 423 ++++ nixos/config/rc.conf | 2 + nixos/config/vimrc | 302 +++ nixos/config/xmobarrc | 122 + nixos/config/xmonad.hs | 304 +++ nixos/config/zshrc | 34 + nixos/configuration.nix | 281 +++ nixos/flake.lock | 48 + nixos/flake.nix | 28 + nixos/hardware-configuration.nix | 39 + nixos/home.nix | 117 + nixos/scripts/_dm-helper.sh | 196 ++ nixos/scripts/dm-dictionary | 96 + nixos/scripts/dm-documents | 54 + nixos/scripts/dm-hub | 119 + nixos/scripts/dm-man | 57 + nixos/scripts/dm-note | 61 + nixos/scripts/dm-pipewire-out-switcher | 51 + nixos/scripts/dm-spellcheck | 38 + nixos/scripts/dm-weather | 43 + nixos/scripts/dm-websearch | 54 + nixos/scripts/dm-wifi | 42 + nixos/scripts/dm-youtube | 87 + nixos/scripts/get-battery | 39 + nixos/scripts/get-brightness | 22 + nixos/scripts/get-volume | 22 + nixos/wallpapers/PastelPinkLightning.jpg | Bin 0 -> 2842087 bytes swaywm/README.md | 5 + swaywm/bashrc | 27 + swaywm/config/dunst/dunstrc | 471 ++++ swaywm/config/foot/foot.ini | 8 + swaywm/config/i3status/config | 108 + swaywm/config/sway/config | 266 ++ swaywm/local/bin/brightness | 52 + swaywm/local/bin/i3status++ | 8 + swaywm/local/bin/j4dmenu | 2 + swaywm/local/bin/ppctl | 66 + swaywm/local/bin/volume | 78 + swaywm/papes/PurplePhoneLines.jpg | Bin 0 -> 3087356 bytes swaywm/softlink.sh | 42 + swaywm/update.sh | 6 + 192 files changed, 13538 insertions(+) create mode 100644 alpine-river/README.md create mode 100644 alpine-river/build/emacs/.gitignore create mode 100755 alpine-river/build/emacs/install-emacs.sh create mode 100644 alpine-river/config/btop/.gitignore create mode 100644 alpine-river/config/btop/btop.conf create mode 100644 alpine-river/config/btop/themes/rose-pine.theme create mode 100644 alpine-river/config/dunst/dunstrc create mode 100644 alpine-river/config/fastfetch/config.jsonc create mode 100644 alpine-river/config/fish/.gitignore create mode 100644 alpine-river/config/fish/completions/fisher.fish create mode 100644 alpine-river/config/fish/completions/fzf_configure_bindings.fish create mode 100644 alpine-river/config/fish/completions/ya.fish create mode 100644 alpine-river/config/fish/completions/yazi.fish create mode 100644 alpine-river/config/fish/conf.d/fzf.fish create mode 100644 alpine-river/config/fish/conf.d/rustup.fish create mode 100644 alpine-river/config/fish/config.fish create mode 100644 alpine-river/config/fish/fish_plugins create mode 100644 alpine-river/config/fish/functions/_fzf_configure_bindings_help.fish create mode 100644 alpine-river/config/fish/functions/_fzf_extract_var_info.fish create mode 100644 alpine-river/config/fish/functions/_fzf_preview_changed_file.fish create mode 100644 alpine-river/config/fish/functions/_fzf_preview_file.fish create mode 100644 alpine-river/config/fish/functions/_fzf_report_diff_type.fish create mode 100644 alpine-river/config/fish/functions/_fzf_report_file_type.fish create mode 100644 alpine-river/config/fish/functions/_fzf_search_directory.fish create mode 100644 alpine-river/config/fish/functions/_fzf_search_git_log.fish create mode 100644 alpine-river/config/fish/functions/_fzf_search_git_status.fish create mode 100644 alpine-river/config/fish/functions/_fzf_search_history.fish create mode 100644 alpine-river/config/fish/functions/_fzf_search_processes.fish create mode 100644 alpine-river/config/fish/functions/_fzf_search_variables.fish create mode 100644 alpine-river/config/fish/functions/_fzf_wrapper.fish create mode 100644 alpine-river/config/fish/functions/fisher.fish create mode 100644 alpine-river/config/fish/functions/fzf_configure_bindings.fish create mode 100644 "alpine-river/config/fish/themes/Ros\303\251 Pine.theme" create mode 100644 alpine-river/config/foot/foot.ini create mode 100644 alpine-river/config/fuzzel/fuzzel.ini create mode 100644 alpine-river/config/gtk-3.0/gtk.css create mode 100644 alpine-river/config/gtk-3.0/settings.ini create mode 100644 alpine-river/config/gtk-4.0/gtk.css create mode 100644 alpine-river/config/gtk-4.0/settings.ini create mode 100644 alpine-river/config/kanata/config.kbd create mode 100644 alpine-river/config/mpv/mpv.conf create mode 100644 alpine-river/config/mpv/script-opts/uosc.conf create mode 100644 alpine-river/config/mpv/scripts/thumbfast.lua create mode 100644 alpine-river/config/nvim/.gitignore create mode 100644 alpine-river/config/nvim/init.lua create mode 100644 alpine-river/config/nvim/lua/config/cmp.lua create mode 100644 alpine-river/config/nvim/lua/config/colemak.lua create mode 100644 alpine-river/config/nvim/lua/config/lazy.lua create mode 100644 alpine-river/config/nvim/lua/plugins.lua create mode 100755 alpine-river/config/river/init create mode 100755 alpine-river/config/river/theme create mode 100644 alpine-river/config/swaylock/config create mode 100644 alpine-river/config/waybar/config create mode 100644 alpine-river/config/waybar/rose-pine.css create mode 100644 alpine-river/config/waybar/style.css create mode 100644 alpine-river/config/yazi/keymap.toml create mode 100644 alpine-river/config/yazi/rose-pine.tmTheme create mode 100644 alpine-river/config/yazi/theme.toml create mode 100644 alpine-river/config/yazi/yazi.toml create mode 100755 alpine-river/local/bin/dry create mode 100755 alpine-river/local/bin/kanata create mode 100755 alpine-river/local/bin/kew create mode 100755 alpine-river/local/bin/take-slurpshot create mode 100755 alpine-river/local/bin/ya create mode 100755 alpine-river/local/bin/yazi create mode 100644 alpine-river/profile create mode 100644 alpine-river/screenshot.png create mode 100644 alpine-river/tmux.conf create mode 100644 alpine-river/world create mode 100644 emacs-elisp/config.el create mode 100644 emacs-elisp/config/fonts.el create mode 100644 emacs-elisp/config/functions.el create mode 100644 emacs-elisp/config/misc.el create mode 100644 emacs-elisp/config/orgmode.el create mode 100644 emacs-elisp/config/project.el create mode 100644 emacs-elisp/config/shortcuts.el create mode 100644 emacs-elisp/config/straight.el create mode 100644 emacs-elisp/config/theme.el create mode 100644 emacs-elisp/init.el create mode 100644 emacs-elisp/languages/c-cpp.el create mode 100644 emacs-elisp/languages/clojure.el create mode 100644 emacs-elisp/languages/rust.el create mode 100644 emacs-elisp/languages/scheme.el create mode 100644 emacs-elisp/packages/avy.el create mode 100644 emacs-elisp/packages/cape.el create mode 100644 emacs-elisp/packages/corfu.el create mode 100644 emacs-elisp/packages/counsel.el create mode 100644 emacs-elisp/packages/devdocs.el create mode 100644 emacs-elisp/packages/flycheck.el create mode 100644 emacs-elisp/packages/lsp.el create mode 100644 emacs-elisp/packages/magit.el create mode 100644 emacs-elisp/packages/movetext.el create mode 100644 emacs-elisp/packages/multicursor.el create mode 100644 emacs-elisp/packages/rainbow.el create mode 100644 emacs-elisp/packages/simplemdln.el create mode 100644 emacs-elisp/packages/smartparens.el create mode 100644 emacs-elisp/packages/undotree.el create mode 100644 emacs-elisp/packages/whichkey.el create mode 100644 emacs-evil/EmacsLogo.png create mode 100644 emacs-evil/README.md create mode 100644 emacs-evil/config.org create mode 100644 emacs-evil/early-init.el create mode 100644 emacs-evil/eshell/aliases create mode 100644 emacs-evil/eshell/profile create mode 100644 emacs-evil/init.el create mode 100644 emacs-evil/res/EmacsDashScreenshot.png create mode 100644 neovim/init.lua create mode 100644 neovim/lua/plugins/autopairs.lua create mode 100644 neovim/lua/plugins/catppuccin.lua create mode 100644 neovim/lua/plugins/codeium.lua create mode 100644 neovim/lua/plugins/colorizer.lua create mode 100644 neovim/lua/plugins/dashboard.lua create mode 100644 neovim/lua/plugins/harpoon.lua create mode 100644 neovim/lua/plugins/init.lua create mode 100644 neovim/lua/plugins/lastplace.lua create mode 100644 neovim/lua/plugins/lsp.lua create mode 100644 neovim/lua/plugins/lualine.lua create mode 100644 neovim/lua/plugins/telescope.lua create mode 100644 neovim/lua/plugins/treesitter.lua create mode 100644 neovim/lua/venomade/clipboard.lua create mode 100644 neovim/lua/venomade/config.lua create mode 100644 neovim/lua/venomade/init.lua create mode 100644 neovim/lua/venomade/lazy.lua create mode 100644 neovim/lua/venomade/neovide.lua create mode 100644 neovim/lua/venomade/remap.lua create mode 100644 nixos/LICENSE create mode 100644 nixos/README create mode 100644 nixos/config/coc-settings.json create mode 100644 nixos/config/dmenu.patch create mode 100644 nixos/config/dmscripts-conf create mode 100644 nixos/config/ghci create mode 100644 nixos/config/kitty.conf create mode 100644 nixos/config/neovim/init.lua create mode 100644 nixos/config/neovim/lua/plugins/autopairs.lua create mode 100644 nixos/config/neovim/lua/plugins/catppuccin.lua create mode 100644 nixos/config/neovim/lua/plugins/codeium.lua create mode 100644 nixos/config/neovim/lua/plugins/colorizer.lua create mode 100644 nixos/config/neovim/lua/plugins/dashboard.lua create mode 100644 nixos/config/neovim/lua/plugins/harpoon.lua create mode 100644 nixos/config/neovim/lua/plugins/init.lua create mode 100644 nixos/config/neovim/lua/plugins/lastplace.lua create mode 100644 nixos/config/neovim/lua/plugins/lsp.lua create mode 100644 nixos/config/neovim/lua/plugins/lualine.lua create mode 100644 nixos/config/neovim/lua/plugins/telescope.lua create mode 100644 nixos/config/neovim/lua/plugins/treesitter.lua create mode 100644 nixos/config/neovim/lua/venomade/clipboard.lua create mode 100644 nixos/config/neovim/lua/venomade/config.lua create mode 100644 nixos/config/neovim/lua/venomade/init.lua create mode 100644 nixos/config/neovim/lua/venomade/lazy.lua create mode 100644 nixos/config/neovim/lua/venomade/neovide.lua create mode 100644 nixos/config/neovim/lua/venomade/remap.lua create mode 100644 nixos/config/picom.conf create mode 100644 nixos/config/rc.conf create mode 100644 nixos/config/vimrc create mode 100644 nixos/config/xmobarrc create mode 100644 nixos/config/xmonad.hs create mode 100644 nixos/config/zshrc create mode 100644 nixos/configuration.nix create mode 100644 nixos/flake.lock create mode 100644 nixos/flake.nix create mode 100644 nixos/hardware-configuration.nix create mode 100644 nixos/home.nix create mode 100755 nixos/scripts/_dm-helper.sh create mode 100755 nixos/scripts/dm-dictionary create mode 100755 nixos/scripts/dm-documents create mode 100755 nixos/scripts/dm-hub create mode 100755 nixos/scripts/dm-man create mode 100755 nixos/scripts/dm-note create mode 100755 nixos/scripts/dm-pipewire-out-switcher create mode 100755 nixos/scripts/dm-spellcheck create mode 100755 nixos/scripts/dm-weather create mode 100755 nixos/scripts/dm-websearch create mode 100755 nixos/scripts/dm-wifi create mode 100755 nixos/scripts/dm-youtube create mode 100755 nixos/scripts/get-battery create mode 100755 nixos/scripts/get-brightness create mode 100755 nixos/scripts/get-volume create mode 100644 nixos/wallpapers/PastelPinkLightning.jpg create mode 100644 swaywm/README.md create mode 100644 swaywm/bashrc create mode 100644 swaywm/config/dunst/dunstrc create mode 100644 swaywm/config/foot/foot.ini create mode 100644 swaywm/config/i3status/config create mode 100644 swaywm/config/sway/config create mode 100755 swaywm/local/bin/brightness create mode 100755 swaywm/local/bin/i3status++ create mode 100755 swaywm/local/bin/j4dmenu create mode 100755 swaywm/local/bin/ppctl create mode 100755 swaywm/local/bin/volume create mode 100644 swaywm/papes/PurplePhoneLines.jpg create mode 100755 swaywm/softlink.sh create mode 100755 swaywm/update.sh diff --git a/alpine-river/README.md b/alpine-river/README.md new file mode 100644 index 0000000..9942daa --- /dev/null +++ b/alpine-river/README.md @@ -0,0 +1,45 @@ +# Venomade's dotfiles +These are my personal dotfiles for [Alpine Linux](https://alpinelinux.org/) + +This repository contains submodules so clone with: `git clone git@github.com:venomade/dotfiles ~/.dotfiles --recurse-submodules` + +## Screenshot +![dotfiles screenshot](https://raw.githubusercontent.com/venomade/dotfiles/refs/heads/master/screenshot.png "Dotfiles Screenshot") + +## Software +A basic overview of the software I use: + +| **Component** | **Program/Tool** | +|------------------|--------------------------------------------------------------------| +| OS | [Alpine Linux](https://alpinelinux.org/) | +| Window Manager | [River](https://isaacfreund.com/software/river/) | +| App Launcher | [Fuzzel](https://codeberg.org/dnkl/fuzzel/) | +| Audio | [Pipewire](https://pipewire.org/) | +| Audio Mixer | [ncpamixer](https://github.com/fulhax/ncpamixer) | +| Browser | [Firefox ESR](https://www.mozilla.org/en-GB/firefox/enterprise/) | +| Clipboard | [wl-clipboard](https://github.com/bugaevc/wl-clipboard/) | +| Containers | [Docker](https://www.docker.com/) & [Dry](https://moncho.github.io/dry/) | +| File Manager | [Yazi](https://github.com/sxyazi/yazi/) | +| Font | [Fantasque Sans](https://github.com/belluzj/fantasque-sans/) | +| Idle Daemon | [swayidle](https://github.com/swaywm/swayidle/) | +| Image Viewer | [mpv --pause](https://mpv.io/) | +| Life Manager | [Emacs](https://www.gnu.org/software/emacs/) | +| Login Manager | [TTY](https://rickroll.it/) | +| Multiplexer | [TMUX](https://github.com/tmux/tmux/) | +| Music Player | [kew](https://github.com/ravachol/kew) | +| Notifications | [Dunst](https://dunst-project.org/) | +| Screen Locker | [swaylock](https://github.com/swaywm/swaylock/) | +| Screen Record | [wf-recorder](https://github.com/ammen99/wf-recorder/) | +| Screenshot | [wayshot](https://git.sr.ht/~shinyzenith/wayshot/) & [slurp](https://github.com/emersion/slurp/) | +| Shell | [Fish](https://fishshell.com/) | +| Sync Client | [rclone](https://rclone.org/) | +| SysInfo Viewer | [fastfetch](https://github.com/fastfetch-cli/fastfetch/) | +| System Monitor | [Btop](https://github.com/aristocratos/btop/) | +| Terminal | [Foot](https://codeberg.org/dnkl/foot/) | +| Text Editor | [Neovim](https://neovim.io/) | +| Video Player | [mpv](https://mpv.io/) | +| Wallpaper Util | [swaybg](https://github.com/swaywm/swaybg/) | + + +## Packages +A copy of my `/etc/apk/world` is in the [world](./world) file. diff --git a/alpine-river/build/emacs/.gitignore b/alpine-river/build/emacs/.gitignore new file mode 100644 index 0000000..7ec083a --- /dev/null +++ b/alpine-river/build/emacs/.gitignore @@ -0,0 +1,3 @@ +emacs-*/ +*.tar.xz +*.zip diff --git a/alpine-river/build/emacs/install-emacs.sh b/alpine-river/build/emacs/install-emacs.sh new file mode 100755 index 0000000..bbb6fe3 --- /dev/null +++ b/alpine-river/build/emacs/install-emacs.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +### WARNING STILL DEBIAN, NOT ALPINE, WAIT FOR UPDATE +echo "------------------------------------------------------------------------" +echo "WARNING! THIS SCRIPT IS FOR DEBIAN, PRESS ENTER TO CONTINUE, C-c TO EXIT" +echo "------------------------------------------------------------------------" +read -p "" + +# Basic Dependencies +sudo apt install -y \ + git \ + build-essential \ + libgtk-3-dev \ + libgnutls28-dev \ + libtiff5-dev \ + libgif-dev \ + libjpeg-dev \ + libpng-dev \ + libxpm-dev \ + libncurses-dev \ + texinfo +# Native JSON +sudo apt install -y libjansson4 libjansson-dev +# Native Compilation +sudo apt install -y \ + libgccjit0 \ + libgccjit-11-dev \ + gcc-11 \ + g++-11 +# Images +sudo apt install -y libmagickcore-dev libmagick++-dev +# TreeSitter +sudo apt install -y libtree-sitter-dev +# GTK3 +sudo apt install -y libgtk-3-dev libwebkit2gtk-4.1-dev +# VTerm +sudo apt install -y cmake libtool-bin + +# Download Font +# Install Font +FONT="FantasqueSansMono" +FONT_ARCHIVE="${FONT}.zip" +FONT_DIRECTORY="$HOME/.local/share/fonts/${FONT}" + +if [ ! -f "$FONT_ARCHIVE" ]; then + # Download the archive + wget "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/$FONT_ARCHIVE" +fi + +if [ -d "$FONT_DIRECTORY" ]; then + echo "Directory $FONT_DIRECTORY already exists. Deleting it." + rm -rf "$FONT_DIRECTORY" +fi + +mkdir -p "$FONT_DIRECTORY" +unzip -o "$FONT_ARCHIVE" -d "$FONT_DIRECTORY" +fc-cache -fv + +# Download Emacs +# Define the version variable +VERSION="29.4" +ARCHIVE="emacs-${VERSION}.tar.xz" +DIRECTORY="emacs-${VERSION}" + +if [ -f "$ARCHIVE" ]; then + echo "Archive $ARCHIVE already exists. Skipping download." +else + wget "https://mirror.lyrahosting.com/gnu/emacs/$ARCHIVE" +fi + +if [ -d "$DIRECTORY" ]; then + echo "Directory $DIRECTORY already exists. Deleting it." + #TODO FIX THIS DANGEROUS LINE + sudo rm -rf "$DIRECTORY" +fi + +tar -xf "$ARCHIVE" + +#Build Emacs +tar xvf emacs-*.tar.xz +cd $(find . -maxdepth 1 -type d -name 'emacs-*' | head -n 1) +export CC=/usr/bin/gcc-11 CXX=/usr/bin/gcc-11 +./autogen.sh +mkdir build +cd build + +CONFIGURE_ARGS="--with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-gpm=no --with-imagemagick --with-json --with-xwidgets --with-x-toolkit=gtk3 --with-cairo --with-modules --with-native-compilation --with-tree-sitter --without-pop --with-pgtk" + +../configure $CONFIGURE_ARGS CFLAGS="-O2 -pipe -march=native" +make -j $(($(nproc) - 1)) CFLAGS="-O2 -pipe -march=native" +read -p "Press Enter to install Emacs, C-c if compilation failed" +sudo make clean install -j $(($(nproc) - 1)) diff --git a/alpine-river/config/btop/.gitignore b/alpine-river/config/btop/.gitignore new file mode 100644 index 0000000..76fc0ad --- /dev/null +++ b/alpine-river/config/btop/.gitignore @@ -0,0 +1 @@ +btop.log diff --git a/alpine-river/config/btop/btop.conf b/alpine-river/config/btop/btop.conf new file mode 100644 index 0000000..45225ef --- /dev/null +++ b/alpine-river/config/btop/btop.conf @@ -0,0 +1,248 @@ +#? Config file for btop v. 1.4.0 + +#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes. +#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes" +color_theme = "/home/venomade/.config/btop/themes/rose-pine.theme" + +#* If the theme set background should be shown, set to False if you want terminal background transparency. +theme_background = False + +#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false. +truecolor = True + +#* Set to true to force tty mode regardless if a real tty has been detected or not. +#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols. +force_tty = False + +#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets. +#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box. +#* Use whitespace " " as separator between different presets. +#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty" +presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty" + +#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists. +#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift. +vim_keys = True + +#* Rounded corners on boxes, is ignored if TTY mode is ON. +rounded_corners = False + +#* Default symbols to use for graph creation, "braille", "block" or "tty". +#* "braille" offers the highest resolution but might not be included in all fonts. +#* "block" has half the resolution of braille but uses more common characters. +#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY. +#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view. +graph_symbol = "braille" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_cpu = "default" + +# Graph symbol to use for graphs in gpu box, "default", "braille", "block" or "tty". +graph_symbol_gpu = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_mem = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_net = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_proc = "braille" + +#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace. +shown_boxes = "cpu mem net proc" + +#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs. +update_ms = 500 + +#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", +#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. +proc_sorting = "cpu lazy" + +#* Reverse sorting order, True or False. +proc_reversed = False + +#* Show processes as a tree. +proc_tree = False + +#* Use the cpu graph colors in the process list. +proc_colors = True + +#* Use a darkening gradient in the process list. +proc_gradient = False + +#* If process cpu usage should be of the core it's running on or usage of the total available cpu power. +proc_per_core = False + +#* Show process memory as bytes instead of percent. +proc_mem_bytes = True + +#* Show cpu graph for each process. +proc_cpu_graphs = True + +#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate) +proc_info_smaps = False + +#* Show proc box on left side of screen instead of right. +proc_left = False + +#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop). +proc_filter_kernel = True + +#* In tree-view, always accumulate child process resources in the parent process. +proc_aggregate = False + +#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available. +#* Select from a list of detected attributes from the options menu. +cpu_graph_upper = "Auto" + +#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available. +#* Select from a list of detected attributes from the options menu. +cpu_graph_lower = "Auto" + +#* If gpu info should be shown in the cpu box. Available values = "Auto", "On" and "Off". +show_gpu_info = "Auto" + +#* Toggles if the lower CPU graph should be inverted. +cpu_invert_lower = True + +#* Set to True to completely disable the lower CPU graph. +cpu_single_graph = False + +#* Show cpu box at bottom of screen instead of top. +cpu_bottom = False + +#* Shows the system uptime in the CPU box. +show_uptime = True + +#* Show cpu temperature. +check_temp = True + +#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors. +cpu_sensor = "Auto" + +#* Show temperatures for cpu cores also if check_temp is True and sensors has been found. +show_coretemp = True + +#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core. +#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine. +#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries. +#* Example: "4:0 5:1 6:3" +cpu_core_map = "" + +#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine". +temp_scale = "celsius" + +#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024. +base_10_sizes = False + +#* Show CPU frequency. +show_cpu_freq = True + +#* Draw a clock at top of screen, formatting according to strftime, empty string to disable. +#* Special formatting: /host = hostname | /user = username | /uptime = system uptime +clock_format = "%X" + +#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort. +background_update = True + +#* Custom cpu model name, empty string to disable. +custom_cpu_name = "" + +#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ". +#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user". +disks_filter = "" + +#* Show graphs instead of meters for memory values. +mem_graphs = True + +#* Show mem box below net box instead of above. +mem_below_net = False + +#* Count ZFS ARC in cached and available memory. +zfs_arc_cached = True + +#* If swap memory should be shown in memory box. +show_swap = False + +#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk. +swap_disk = False + +#* If mem box should be split to also show disks info. +show_disks = False + +#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar. +only_physical = True + +#* Read disks list from /etc/fstab. This also disables only_physical. +use_fstab = True + +#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool) +zfs_hide_datasets = False + +#* Set to true to show available disk space for privileged users. +disk_free_priv = False + +#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view. +show_io_stat = True + +#* Toggles io mode for disks, showing big graphs for disk read/write speeds. +io_mode = True + +#* Set to True to show combined read/write io graphs in io mode. +io_graph_combined = True + +#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ". +#* Example: "/mnt/media:100 /:20 /boot:1". +io_graph_speeds = "" + +#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False. +net_download = 100 + +net_upload = 100 + +#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest. +net_auto = True + +#* Sync the auto scaling for download and upload to whichever currently has the highest scale. +net_sync = True + +#* Starts with the Network Interface specified here. +net_iface = "" + +#* Show battery stats in top right if battery is present. +show_battery = True + +#* Which battery to use if multiple are present. "Auto" for auto detection. +selected_battery = "Auto" + +#* Show power stats of battery next to charge indicator. +show_battery_watts = True + +#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG". +#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info. +log_level = "WARNING" + +#* Measure PCIe throughput on NVIDIA cards, may impact performance on certain cards. +nvml_measure_pcie_speeds = True + +#* Horizontally mirror the GPU graph. +gpu_mirror_graph = True + +#* Custom gpu0 model name, empty string to disable. +custom_gpu_name0 = "" + +#* Custom gpu1 model name, empty string to disable. +custom_gpu_name1 = "" + +#* Custom gpu2 model name, empty string to disable. +custom_gpu_name2 = "" + +#* Custom gpu3 model name, empty string to disable. +custom_gpu_name3 = "" + +#* Custom gpu4 model name, empty string to disable. +custom_gpu_name4 = "" + +#* Custom gpu5 model name, empty string to disable. +custom_gpu_name5 = "" diff --git a/alpine-river/config/btop/themes/rose-pine.theme b/alpine-river/config/btop/themes/rose-pine.theme new file mode 100644 index 0000000..b045441 --- /dev/null +++ b/alpine-river/config/btop/themes/rose-pine.theme @@ -0,0 +1,119 @@ +# Main background, empty for terminal default, need to be empty if you want transparent background +theme[main_bg]="#191724" +# Base + +# Main text color +theme[main_fg]="#e0def4" +# Text + +# Title color for boxes +theme[title]="#908caa" +# Subtle + +# Highlight color for keyboard shortcuts +theme[hi_fg]="#e0def4" +# Text + +# Background color of selected item in processes box +theme[selected_bg]="#524f67" +# HL High + +# Foreground color of selected item in processes box +theme[selected_fg]="#f6c177" +# Gold + +# Color of inactive/disabled text +theme[inactive_fg]="#403d52" +# HL Med + +# Color of text appearing on top of graphs, i.e uptime and current network graph scaling +theme[graph_text]="#9ccfd8" +# Foam + +# Background color of the percentage meters +theme[meter_bg]="#9ccfd8" +# Foam + +# Misc colors for processes box including mini cpu graphs, details memory graph and details status text +theme[proc_misc]="#c4a7e7" +# Iris + +# Cpu box outline color +theme[cpu_box]="#ebbcba" +# Rose + +# Memory/disks box outline color +theme[mem_box]="#31748f" +# Pine + +# Net up/down box outline color +theme[net_box]="#c4a7e7" +# Iris + +# Processes box outline color +theme[proc_box]="#eb6f92" +# Love + +# Box divider line and small boxes line color +theme[div_line]="#6e6a86" +# Muted + +# Temperature graph colors +theme[temp_start]="#ebbcba" +# Rose +theme[temp_mid]="#f6c177" +# Gold +theme[temp_end]="#eb6f92" +# Love + +# CPU graph colors +theme[cpu_start]="#f6c177" +# Gold +theme[cpu_mid]="#ebbcba" +# Rose +theme[cpu_end]="#eb6f92" +# Love + +# Mem/Disk free meter +# all love +theme[free_start]="#eb6f92" +theme[free_mid]="#eb6f92" +theme[free_end]="#eb6f92" + +# Mem/Disk cached meter +# all iris +theme[cached_start]="#c4a7e7" +theme[cached_mid]="#c4a7e7" +theme[cached_end]="#c4a7e7" + +# Mem/Disk available meter +# all pine +theme[available_start]="#31748f" +theme[available_mid]="#31748f" +theme[available_end]="#31748f" + +# Mem/Disk used meter +# all rose +theme[used_start]="#ebbcba" +theme[used_mid]="#ebbcba" +theme[used_end]="#ebbcba" + +# Download graph colors +# Pine for start, foam for the rest +theme[download_start]="#31748f" +theme[download_mid]="#9ccfd8" +theme[download_end]="#9ccfd8" + +# Upload graph colors +theme[upload_start]="#ebbcba" +# Rose for start +theme[upload_mid]="#eb6f92" +# Love for mid and end +theme[upload_end]="#eb6f92" + +# Process box color gradient for threads, mem and cpu usage +theme[process_start]="#31748f" +# Pine +theme[process_mid]="#9ccfd8" +# Foam for mid and end +theme[process_end]="#9ccfd8" diff --git a/alpine-river/config/dunst/dunstrc b/alpine-river/config/dunst/dunstrc new file mode 100644 index 0000000..225d5f8 --- /dev/null +++ b/alpine-river/config/dunst/dunstrc @@ -0,0 +1,42 @@ +[global] + width = (200,600) + offset = 0x24 + + progress_bar_min_width = 380 + progress_bar_max_width = 380 + progress_bar_corner_radius = 0 + + padding = 10 + horizontal_padding = 10 + frame_width = 2 + gap_size = 3 + origin = "top-center" + font = "FantasqueSansMono 12" + + icon_theme = "rose-pine-icons" + enable_recursive_icon_lookup = true + corner_radius = 0 + + background = "#191724" + foreground = "#e0def4" + +[urgency_low] + background = "#26273d" + highlight = "#31748f" + frame_color = "#31748f" + default_icon = "dialog-information" + format = "%s\n%b" + +[urgency_normal] + background = "#191724" + highlight = "#f6c177" + frame_color = "#ebbcba" + default_icon = "dialog-warning" + format = "%s\n%b" + +[urgency_critical] + background = "#eb6f92" + highlight = "#35263d" + frame_color = "#35263d" + default_icon = "dialog-error" + format = "%s\n%b" diff --git a/alpine-river/config/fastfetch/config.jsonc b/alpine-river/config/fastfetch/config.jsonc new file mode 100644 index 0000000..746244c --- /dev/null +++ b/alpine-river/config/fastfetch/config.jsonc @@ -0,0 +1,49 @@ +{ + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", + "logo": { + "type": "small" + }, + "display": { + "constants": [ + //"██ " + "> " + ] + }, + "modules": [ + { + "key": "{$1}Distro", + "keyColor": "38;5;210", + "type": "os" + }, + { + "key": "{$1}Kernel", + "keyColor": "38;5;84", + "type": "kernel" + }, + //{ + // "key": "{$1}Shell", + // "keyColor": "38;5;147", + // "type": "shell" + //}, + { + "key": "{$1}Packages", + "keyColor": "38;5;200", + "type": "packages" + }, + { + "key": "{$1}WM", + "keyColor": "38;5;44", + "type": "wm" + }, + { + "key": "{$1}CPU", + "keyColor": "38;5;75", + "type": "cpu" + }, + { + "key": "{$1}Memory", + "keyColor": "38;5;123", + "type": "memory" + } + ] +} diff --git a/alpine-river/config/fish/.gitignore b/alpine-river/config/fish/.gitignore new file mode 100644 index 0000000..23efee9 --- /dev/null +++ b/alpine-river/config/fish/.gitignore @@ -0,0 +1 @@ +fish_variables diff --git a/alpine-river/config/fish/completions/fisher.fish b/alpine-river/config/fish/completions/fisher.fish new file mode 100644 index 0000000..6d23ce4 --- /dev/null +++ b/alpine-river/config/fish/completions/fisher.fish @@ -0,0 +1,7 @@ +complete --command fisher --exclusive --long help --description "Print help" +complete --command fisher --exclusive --long version --description "Print version" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex" +complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)" diff --git a/alpine-river/config/fish/completions/fzf_configure_bindings.fish b/alpine-river/config/fish/completions/fzf_configure_bindings.fish new file mode 100644 index 0000000..b38ef92 --- /dev/null +++ b/alpine-river/config/fish/completions/fzf_configure_bindings.fish @@ -0,0 +1,8 @@ +complete fzf_configure_bindings --no-files +complete fzf_configure_bindings --long help --short h --description "Print help" --condition "not __fish_seen_argument --help -h" +complete fzf_configure_bindings --long directory --description "Change the key binding for Search Directory" --condition "not __fish_seen_argument --directory" +complete fzf_configure_bindings --long git_log --description "Change the key binding for Search Git Log" --condition "not __fish_seen_argument --git_log" +complete fzf_configure_bindings --long git_status --description "Change the key binding for Search Git Status" --condition "not __fish_seen_argument --git_status" +complete fzf_configure_bindings --long history --description "Change the key binding for Search History" --condition "not __fish_seen_argument --history" +complete fzf_configure_bindings --long processes --description "Change the key binding for Search Processes" --condition "not __fish_seen_argument --processes" +complete fzf_configure_bindings --long variables --description "Change the key binding for Search Variables" --condition "not __fish_seen_argument --variables" diff --git a/alpine-river/config/fish/completions/ya.fish b/alpine-river/config/fish/completions/ya.fish new file mode 100644 index 0000000..2c869c5 --- /dev/null +++ b/alpine-river/config/fish/completions/ya.fish @@ -0,0 +1,52 @@ +# Print an optspec for argparse to handle cmd's options that are independent of any subcommand. +function __fish_ya_global_optspecs + string join \n V/version h/help +end + +function __fish_ya_needs_command + # Figure out if the current invocation already has a command. + set -l cmd (commandline -opc) + set -e cmd[1] + argparse -s (__fish_ya_global_optspecs) -- $cmd 2>/dev/null + or return + if set -q argv[1] + # Also print the command, so this can be used to figure out what it is. + echo $argv[1] + return 1 + end + return 0 +end + +function __fish_ya_using_subcommand + set -l cmd (__fish_ya_needs_command) + test -z "$cmd" + and return 1 + contains -- $cmd[1] $argv +end + +complete -c ya -n "__fish_ya_needs_command" -s V -l version -d 'Print version' +complete -c ya -n "__fish_ya_needs_command" -s h -l help -d 'Print help' +complete -c ya -n "__fish_ya_needs_command" -f -a "pub" -d 'Publish a message to the current instance' +complete -c ya -n "__fish_ya_needs_command" -f -a "pub-to" -d 'Publish a message to the specified instance' +complete -c ya -n "__fish_ya_needs_command" -f -a "sub" -d 'Subscribe to messages from all remote instances' +complete -c ya -n "__fish_ya_needs_command" -f -a "pack" -d 'Manage packages' +complete -c ya -n "__fish_ya_needs_command" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c ya -n "__fish_ya_using_subcommand pub" -l str -d 'Send the message with a string body' -r +complete -c ya -n "__fish_ya_using_subcommand pub" -l json -d 'Send the message with a JSON body' -r +complete -c ya -n "__fish_ya_using_subcommand pub" -l list -d 'Send the message as string of list' -r +complete -c ya -n "__fish_ya_using_subcommand pub" -s h -l help -d 'Print help' +complete -c ya -n "__fish_ya_using_subcommand pub-to" -l str -d 'Send the message with a string body' -r +complete -c ya -n "__fish_ya_using_subcommand pub-to" -l json -d 'Send the message with a JSON body' -r +complete -c ya -n "__fish_ya_using_subcommand pub-to" -l list -d 'Send the message as string of list' -r +complete -c ya -n "__fish_ya_using_subcommand pub-to" -s h -l help -d 'Print help' +complete -c ya -n "__fish_ya_using_subcommand sub" -s h -l help -d 'Print help' +complete -c ya -n "__fish_ya_using_subcommand pack" -s a -l add -d 'Add a package' -r +complete -c ya -n "__fish_ya_using_subcommand pack" -s i -l install -d 'Install all packages' +complete -c ya -n "__fish_ya_using_subcommand pack" -s l -l list -d 'List all packages' +complete -c ya -n "__fish_ya_using_subcommand pack" -s u -l upgrade -d 'Upgrade all packages' +complete -c ya -n "__fish_ya_using_subcommand pack" -s h -l help -d 'Print help' +complete -c ya -n "__fish_ya_using_subcommand help; and not __fish_seen_subcommand_from pub pub-to sub pack help" -f -a "pub" -d 'Publish a message to the current instance' +complete -c ya -n "__fish_ya_using_subcommand help; and not __fish_seen_subcommand_from pub pub-to sub pack help" -f -a "pub-to" -d 'Publish a message to the specified instance' +complete -c ya -n "__fish_ya_using_subcommand help; and not __fish_seen_subcommand_from pub pub-to sub pack help" -f -a "sub" -d 'Subscribe to messages from all remote instances' +complete -c ya -n "__fish_ya_using_subcommand help; and not __fish_seen_subcommand_from pub pub-to sub pack help" -f -a "pack" -d 'Manage packages' +complete -c ya -n "__fish_ya_using_subcommand help; and not __fish_seen_subcommand_from pub pub-to sub pack help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' diff --git a/alpine-river/config/fish/completions/yazi.fish b/alpine-river/config/fish/completions/yazi.fish new file mode 100644 index 0000000..cd243b0 --- /dev/null +++ b/alpine-river/config/fish/completions/yazi.fish @@ -0,0 +1,9 @@ +complete -c yazi -l cwd-file -d 'Write the cwd on exit to this file' -r -F +complete -c yazi -l chooser-file -d 'Write the selected files to this file on open fired' -r -F +complete -c yazi -l client-id -d 'Use the specified client ID, must be a globally unique number' -r +complete -c yazi -l local-events -d 'Report the specified local events to stdout' -r +complete -c yazi -l remote-events -d 'Report the specified remote events to stdout' -r +complete -c yazi -l clear-cache -d 'Clear the cache directory' +complete -c yazi -l debug -d 'Print debug information' +complete -c yazi -s V -l version -d 'Print version' +complete -c yazi -s h -l help -d 'Print help' diff --git a/alpine-river/config/fish/conf.d/fzf.fish b/alpine-river/config/fish/conf.d/fzf.fish new file mode 100644 index 0000000..8156c11 --- /dev/null +++ b/alpine-river/config/fish/conf.d/fzf.fish @@ -0,0 +1,28 @@ +# fzf.fish is only meant to be used in interactive mode. If not in interactive mode and not in CI, skip the config to speed up shell startup +if not status is-interactive && test "$CI" != true + exit +end + +# Because of scoping rules, to capture the shell variables exactly as they are, we must read +# them before even executing _fzf_search_variables. We use psub to store the +# variables' info in temporary files and pass in the filenames as arguments. +# This variable is global so that it can be referenced by fzf_configure_bindings and in tests +set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)' + + +# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings +fzf_configure_bindings + +# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased +function _fzf_uninstall --on-event fzf_uninstall + _fzf_uninstall_bindings + + set --erase _fzf_search_vars_command + functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings + complete --erase fzf_configure_bindings + + set_color cyan + echo "fzf.fish uninstalled." + echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings." + set_color normal +end diff --git a/alpine-river/config/fish/conf.d/rustup.fish b/alpine-river/config/fish/conf.d/rustup.fish new file mode 100644 index 0000000..e4cb363 --- /dev/null +++ b/alpine-river/config/fish/conf.d/rustup.fish @@ -0,0 +1 @@ +source "$HOME/.cargo/env.fish" diff --git a/alpine-river/config/fish/config.fish b/alpine-river/config/fish/config.fish new file mode 100644 index 0000000..523724e --- /dev/null +++ b/alpine-river/config/fish/config.fish @@ -0,0 +1,23 @@ +if status is-interactive + # Commands to run in interactive sessions can go here + fish_config theme choose "Rosé Pine" + fzf_configure_bindings --directory=\cf + + # set fish_greeting $(fastfetch) + function fish_greeting + fastfetch + end + set BROWSER firefox-esr + set PATH "$PATH:$HOME/.local/bin" + set EDITOR nvim + + function ls + command eza $argv + end + + abbr y yazi + abbr v nvim + abbr ec emacsclient -t + abbr sudo doas + +end diff --git a/alpine-river/config/fish/fish_plugins b/alpine-river/config/fish/fish_plugins new file mode 100644 index 0000000..aa9becc --- /dev/null +++ b/alpine-river/config/fish/fish_plugins @@ -0,0 +1,3 @@ +jorgebucaran/fisher +rose-pine/fish +patrickf1/fzf.fish diff --git a/alpine-river/config/fish/functions/_fzf_configure_bindings_help.fish b/alpine-river/config/fish/functions/_fzf_configure_bindings_help.fish new file mode 100644 index 0000000..ecfe68e --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_configure_bindings_help.fish @@ -0,0 +1,43 @@ +function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings." + echo "\ +USAGE: + fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...] + +DESCRIPTION + fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it + previously installed. It installs bindings for both default and insert modes. fzf.fish executes + it without options on fish startup to install the out-of-the-box key bindings. + + By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding + can be configured using a namesake corresponding option: + COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION + Search Directory | Ctrl+Alt+F (F for file) | --directory + Search Git Log | Ctrl+Alt+L (L for log) | --git_log + Search Git Status | Ctrl+Alt+S (S for status) | --git_status + Search History | Ctrl+R (R for reverse) | --history + Search Processes | Ctrl+Alt+P (P for process) | --processes + Search Variables | Ctrl+V (V for variable) | --variables + Override a command's binding by specifying its corresponding option with the desired key + sequence. Disable a command's binding by specifying its corresponding option with no value. + + Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly + executed multiple times. Once the desired fzf_configure_bindings command has been found, add it + to your config.fish in order to persist the customized bindings. + + In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an + equals sign between an option's name and value. However, it does not validate key sequences. + + Pass -h or --help to print this help message and exit. + +EXAMPLES + Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V + \$ fzf_configure_bindings --directory=\cf --variables=\e\cv + Default bindings but disable Search History + \$ fzf_configure_bindings --history= + An agglomeration of different options + \$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes= + +SEE Also + To learn more about fish key bindings, see bind(1) and fish_key_reader(1). +" +end diff --git a/alpine-river/config/fish/functions/_fzf_extract_var_info.fish b/alpine-river/config/fish/functions/_fzf_extract_var_info.fish new file mode 100644 index 0000000..dd4e952 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_extract_var_info.fish @@ -0,0 +1,15 @@ +# helper function for _fzf_search_variables +function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output." + # Extract only the lines about the variable, all of which begin with either + # $variable_name: ...or... $variable_name[ + string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output | + + # Strip the variable name prefix, including ": " for scope info lines + string replace --regex "^\\\$$variable_name(?:: )?" '' | + + # Distill the lines of values, replacing... + # [1]: |value| + # ...with... + # [1] value + string replace --regex ": \|(.*)\|" ' $1' +end diff --git a/alpine-river/config/fish/functions/_fzf_preview_changed_file.fish b/alpine-river/config/fish/functions/_fzf_preview_changed_file.fish new file mode 100644 index 0000000..78dd561 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_preview_changed_file.fish @@ -0,0 +1,49 @@ +# helper for _fzf_search_git_status +# arg should be a line from git status --short, e.g. +# MM functions/_fzf_preview_changed_file.fish +# D README.md +# R LICENSE -> "New License" +function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file." + # remove quotes because they'll be interpreted literally by git diff + # no need to requote when referencing $path because fish does not perform word splitting + # https://fishshell.com/docs/current/fish_for_bash_users.html + set -f path (string unescape (string sub --start 4 $path_status)) + # first letter of short format shows index, second letter shows working tree + # https://git-scm.com/docs/git-status/2.35.0#_short_format + set -f index_status (string sub --length 1 $path_status) + set -f working_tree_status (string sub --start 2 --length 1 $path_status) + + set -f diff_opts --color=always + + if test $index_status = '?' + _fzf_report_diff_type Untracked + _fzf_preview_file $path + else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU + # Unmerged statuses taken directly from git status help's short format table + # Unmerged statuses are mutually exclusive with other statuses, so if we see + # these, then safe to assume the path is unmerged + _fzf_report_diff_type Unmerged + git diff $diff_opts -- $path + else + if test $index_status != ' ' + _fzf_report_diff_type Staged + + # renames are only detected in the index, never working tree, so only need to test for it here + # https://stackoverflow.com/questions/73954214 + if test $index_status = R + # diff the post-rename path with the original path, otherwise the diff will show the entire file as being added + set -f orig_and_new_path (string split --max 1 -- ' -> ' $path) + git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2] + # path currently has the form of "original -> current", so we need to correct it before it's used below + set path $orig_and_new_path[2] + else + git diff --staged $diff_opts -- $path + end + end + + if test $working_tree_status != ' ' + _fzf_report_diff_type Unstaged + git diff $diff_opts -- $path + end + end +end diff --git a/alpine-river/config/fish/functions/_fzf_preview_file.fish b/alpine-river/config/fish/functions/_fzf_preview_file.fish new file mode 100644 index 0000000..c926475 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_preview_file.fish @@ -0,0 +1,43 @@ +# helper function for _fzf_search_directory and _fzf_search_git_status +function _fzf_preview_file --description "Print a preview for the given file based on its file type." + # because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file + # as one argument, we collect all the arguments into one single variable and treat that as the path + set -f file_path $argv + + if test -L "$file_path" # symlink + # notify user and recurse on the target of the symlink, which can be any of these file types + set -l target_path (realpath "$file_path") + + set_color yellow + echo "'$file_path' is a symlink to '$target_path'." + set_color normal + + _fzf_preview_file "$target_path" + else if test -f "$file_path" # regular file + if set --query fzf_preview_file_cmd + # need to escape quotes to make sure eval receives file_path as a single arg + eval "$fzf_preview_file_cmd '$file_path'" + else + bat --style=numbers --color=always "$file_path" + end + else if test -d "$file_path" # directory + if set --query fzf_preview_dir_cmd + # see above + eval "$fzf_preview_dir_cmd '$file_path'" + else + # -A list hidden files as well, except for . and .. + # -F helps classify files by appending symbols after the file name + command ls -A -F "$file_path" + end + else if test -c "$file_path" + _fzf_report_file_type "$file_path" "character device file" + else if test -b "$file_path" + _fzf_report_file_type "$file_path" "block device file" + else if test -S "$file_path" + _fzf_report_file_type "$file_path" socket + else if test -p "$file_path" + _fzf_report_file_type "$file_path" "named pipe" + else + echo "$file_path doesn't exist." >&2 + end +end diff --git a/alpine-river/config/fish/functions/_fzf_report_diff_type.fish b/alpine-river/config/fish/functions/_fzf_report_diff_type.fish new file mode 100644 index 0000000..cc26fb3 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_report_diff_type.fish @@ -0,0 +1,18 @@ +# helper for _fzf_preview_changed_file +# prints out something like +# ╭────────╮ +# │ Staged │ +# ╰────────╯ +function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch." + # number of "-" to draw is the length of the string to box + 2 for padding + set -f repeat_count (math 2 + (string length $diff_type)) + set -f line (string repeat --count $repeat_count ─) + set -f top_border ╭$line╮ + set -f btm_border ╰$line╯ + + set_color yellow + echo $top_border + echo "│ $diff_type │" + echo $btm_border + set_color normal +end diff --git a/alpine-river/config/fish/functions/_fzf_report_file_type.fish b/alpine-river/config/fish/functions/_fzf_report_file_type.fish new file mode 100644 index 0000000..49e02e1 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_report_file_type.fish @@ -0,0 +1,6 @@ +# helper function for _fzf_preview_file +function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file." + set_color red + echo "Cannot preview '$file_path': it is a $file_type." + set_color normal +end diff --git a/alpine-river/config/fish/functions/_fzf_search_directory.fish b/alpine-river/config/fish/functions/_fzf_search_directory.fish new file mode 100644 index 0000000..4541eec --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_search_directory.fish @@ -0,0 +1,33 @@ +function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths." + # Directly use fd binary to avoid output buffering delay caused by a fd alias, if any. + # Debian-based distros install fd as fdfind and the fd package is something else, so + # check for fdfind first. Fall back to "fd" for a clear error message. + set -f fd_cmd (command -v fdfind || command -v fd || echo "fd") + set -f --append fd_cmd --color=always $fzf_fd_opts + + set -f fzf_arguments --multi --ansi $fzf_directory_opts + set -f token (commandline --current-token) + # expand any variables or leading tilde (~) in the token + set -f expanded_token (eval echo -- $token) + # unescape token because it's already quoted so backslashes will mess up the path + set -f unescaped_exp_token (string unescape -- $expanded_token) + + # If the current token is a directory and has a trailing slash, + # then use it as fd's base directory. + if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token" + set --append fd_cmd --base-directory=$unescaped_exp_token + # use the directory name as fzf's prompt to indicate the search is limited to that directory + set --prepend fzf_arguments --prompt="Directory $unescaped_exp_token> " --preview="_fzf_preview_file $expanded_token{}" + set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) + else + set --prepend fzf_arguments --prompt="Directory> " --query="$unescaped_exp_token" --preview='_fzf_preview_file {}' + set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments) + end + + + if test $status -eq 0 + commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ') + end + + commandline --function repaint +end diff --git a/alpine-river/config/fish/functions/_fzf_search_git_log.fish b/alpine-river/config/fish/functions/_fzf_search_git_log.fish new file mode 100644 index 0000000..aa54724 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_search_git_log.fish @@ -0,0 +1,36 @@ +function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash." + if not git rev-parse --git-dir >/dev/null 2>&1 + echo '_fzf_search_git_log: Not in a git repository.' >&2 + else + if not set --query fzf_git_log_format + # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below + set -f fzf_git_log_format '%C(bold blue)%h%C(reset) - %C(cyan)%ad%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)' + end + + set -f preview_cmd 'git show --color=always --stat --patch {1}' + if set --query fzf_diff_highlighter + set preview_cmd "$preview_cmd | $fzf_diff_highlighter" + end + + set -f selected_log_lines ( + git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \ + _fzf_wrapper --ansi \ + --multi \ + --scheme=history \ + --prompt="Git Log> " \ + --preview=$preview_cmd \ + --query=(commandline --current-token) \ + $fzf_git_log_opts + ) + if test $status -eq 0 + for line in $selected_log_lines + set -f abbreviated_commit_hash (string split --field 1 " " $line) + set -f full_commit_hash (git rev-parse $abbreviated_commit_hash) + set -f --append commit_hashes $full_commit_hash + end + commandline --current-token --replace (string join ' ' $commit_hashes) + end + end + + commandline --function repaint +end diff --git a/alpine-river/config/fish/functions/_fzf_search_git_status.fish b/alpine-river/config/fish/functions/_fzf_search_git_status.fish new file mode 100644 index 0000000..358f88c --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_search_git_status.fish @@ -0,0 +1,41 @@ +function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths." + if not git rev-parse --git-dir >/dev/null 2>&1 + echo '_fzf_search_git_status: Not in a git repository.' >&2 + else + set -f preview_cmd '_fzf_preview_changed_file {}' + if set --query fzf_diff_highlighter + set preview_cmd "$preview_cmd | $fzf_diff_highlighter" + end + + set -f selected_paths ( + # Pass configuration color.status=always to force status to use colors even though output is sent to a pipe + git -c color.status=always status --short | + _fzf_wrapper --ansi \ + --multi \ + --prompt="Git Status> " \ + --query=(commandline --current-token) \ + --preview=$preview_cmd \ + --nth="2.." \ + $fzf_git_status_opts + ) + if test $status -eq 0 + # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle + # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping") + set -f cleaned_paths + + for path in $selected_paths + if test (string sub --length 1 $path) = R + # path has been renamed and looks like "R LICENSE -> LICENSE.md" + # extract the path to use from after the arrow + set --append cleaned_paths (string split -- "-> " $path)[-1] + else + set --append cleaned_paths (string sub --start=4 $path) + end + end + + commandline --current-token --replace -- (string join ' ' $cleaned_paths) + end + end + + commandline --function repaint +end diff --git a/alpine-river/config/fish/functions/_fzf_search_history.fish b/alpine-river/config/fish/functions/_fzf_search_history.fish new file mode 100644 index 0000000..cafbce9 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_search_history.fish @@ -0,0 +1,39 @@ +function _fzf_search_history --description "Search command history. Replace the command line with the selected command." + # history merge incorporates history changes from other fish sessions + # it errors out if called in private mode + if test -z "$fish_private_mode" + builtin history merge + end + + if not set --query fzf_history_time_format + # Reference https://devhints.io/strftime to understand strftime format symbols + set -f fzf_history_time_format "%m-%d %H:%M:%S" + end + + # Delinate time from command in history entries using the vertical box drawing char (U+2502). + # Then, to get raw command from history entries, delete everything up to it. The ? on regex is + # necessary to make regex non-greedy so it won't match into commands containing the char. + set -f time_prefix_regex '^.*? │ ' + # Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line + set -f commands_selected ( + builtin history --null --show-time="$fzf_history_time_format │ " | + _fzf_wrapper --read0 \ + --print0 \ + --multi \ + --scheme=history \ + --prompt="History> " \ + --query=(commandline) \ + --preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \ + --preview-window="bottom:3:wrap" \ + $fzf_history_opts | + string split0 | + # remove timestamps from commands selected + string replace --regex $time_prefix_regex '' + ) + + if test $status -eq 0 + commandline --replace -- $commands_selected + end + + commandline --function repaint +end diff --git a/alpine-river/config/fish/functions/_fzf_search_processes.fish b/alpine-river/config/fish/functions/_fzf_search_processes.fish new file mode 100644 index 0000000..133a880 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_search_processes.fish @@ -0,0 +1,32 @@ +function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process." + # Directly use ps command because it is often aliased to a different command entirely + # or with options that dirty the search results and preview output + set -f ps_cmd (command -v ps || echo "ps") + # use all caps to be consistent with ps default format + # snake_case because ps doesn't seem to allow spaces in the field names + set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command') + set -f processes_selected ( + $ps_cmd -A -opid,command | \ + _fzf_wrapper --multi \ + --prompt="Processes> " \ + --query (commandline --current-token) \ + --ansi \ + # first line outputted by ps is a header, so we need to mark it as so + --header-lines=1 \ + # ps uses exit code 1 if the process was not found, in which case show an message explaining so + --preview="$ps_cmd -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \ + --preview-window="bottom:4:wrap" \ + $fzf_processes_opts + ) + + if test $status -eq 0 + for process in $processes_selected + set -f --append pids_selected (string split --no-empty --field=1 -- " " $process) + end + + # string join to replace the newlines outputted by string split with spaces + commandline --current-token --replace -- (string join ' ' $pids_selected) + end + + commandline --function repaint +end diff --git a/alpine-river/config/fish/functions/_fzf_search_variables.fish b/alpine-river/config/fish/functions/_fzf_search_variables.fish new file mode 100644 index 0000000..52a7c70 --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_search_variables.fish @@ -0,0 +1,47 @@ +# This function expects the following two arguments: +# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables +# argument 2 = output of (set --names | psub), i.e. a file with all variable names +function _fzf_search_variables --argument-names set_show_output set_names_output --description "Search and preview shell variables. Replace the current token with the selected variable." + if test -z "$set_names_output" + printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2 + + commandline --function repaint + return 22 # 22 means invalid argument in POSIX + end + + # Exclude the history variable from being piped into fzf because + # 1. it's not included in $set_names_output + # 2. it tends to be a very large value => increases computation time + # 3._fzf_search_history is a much better way to examine history anyway + set -f all_variable_names (string match --invert history <$set_names_output) + + set -f current_token (commandline --current-token) + # Use the current token to pre-populate fzf's query. If the current token begins + # with a $, remove it from the query so that it will better match the variable names + set -f cleaned_curr_token (string replace -- '$' '' $current_token) + + set -f variable_names_selected ( + printf '%s\n' $all_variable_names | + _fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \ + --prompt="Variables> " \ + --preview-window="wrap" \ + --multi \ + --query=$cleaned_curr_token \ + $fzf_variables_opts + ) + + if test $status -eq 0 + # If the current token begins with a $, do not overwrite the $ when + # replacing the current token with the selected variable. + # Uses brace expansion to prepend $ to each variable name. + commandline --current-token --replace ( + if string match --quiet -- '$*' $current_token + string join " " \${$variable_names_selected} + else + string join " " $variable_names_selected + end + ) + end + + commandline --function repaint +end diff --git a/alpine-river/config/fish/functions/_fzf_wrapper.fish b/alpine-river/config/fish/functions/_fzf_wrapper.fish new file mode 100644 index 0000000..486e36c --- /dev/null +++ b/alpine-river/config/fish/functions/_fzf_wrapper.fish @@ -0,0 +1,21 @@ +function _fzf_wrapper --description "Prepares some environment variables before executing fzf." + # Make sure fzf uses fish to execute preview commands, some of which + # are autoloaded fish functions so don't exist in other shells. + # Use --function so that it doesn't clobber SHELL outside this function. + set -f --export SHELL (command --search fish) + + # If neither FZF_DEFAULT_OPTS nor FZF_DEFAULT_OPTS_FILE are set, then set some sane defaults. + # See https://github.com/junegunn/fzf#environment-variables + set --query FZF_DEFAULT_OPTS FZF_DEFAULT_OPTS_FILE + if test $status -eq 2 + # cycle allows jumping between the first and last results, making scrolling faster + # layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env + # border shows where the fzf window begins and ends + # height=90% leaves space to see the current command and some scrollback, maintaining context of work + # preview-window=wrap wraps long lines in the preview window, making reading easier + # marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >) + set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"' + end + + fzf $argv +end diff --git a/alpine-river/config/fish/functions/fisher.fish b/alpine-river/config/fish/functions/fisher.fish new file mode 100644 index 0000000..e915cb8 --- /dev/null +++ b/alpine-river/config/fish/functions/fisher.fish @@ -0,0 +1,240 @@ +function fisher --argument-names cmd --description "A plugin manager for Fish" + set --query fisher_path || set --local fisher_path $__fish_config_dir + set --local fisher_version 4.4.5 + set --local fish_plugins $__fish_config_dir/fish_plugins + + switch "$cmd" + case -v --version + echo "fisher, version $fisher_version" + case "" -h --help + echo "Usage: fisher install Install plugins" + echo " fisher remove Remove installed plugins" + echo " fisher update Update installed plugins" + echo " fisher update Update all installed plugins" + echo " fisher list [] List installed plugins matching regex" + echo "Options:" + echo " -v, --version Print version" + echo " -h, --help Print this help message" + echo "Variables:" + echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~ + case ls list + string match --entire --regex -- "$argv[2]" $_fisher_plugins + case install update remove + isatty || read --local --null --array stdin && set --append argv $stdin + + set --local install_plugins + set --local update_plugins + set --local remove_plugins + set --local arg_plugins $argv[2..-1] + set --local old_plugins $_fisher_plugins + set --local new_plugins + + test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins | string replace -- \~ ~) + + if ! set --query argv[2] + if test "$cmd" != update + echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1 + else if ! set --query file_plugins + echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1 + end + set arg_plugins $file_plugins + end + + for plugin in $arg_plugins + set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin) + contains -- "$plugin" $new_plugins || set --append new_plugins $plugin + end + + if set --query argv[2] + for plugin in $new_plugins + if contains -- "$plugin" $old_plugins + test "$cmd" = remove && + set --append remove_plugins $plugin || + set --append update_plugins $plugin + else if test "$cmd" = install + set --append install_plugins $plugin + else + echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1 + end + end + else + for plugin in $new_plugins + contains -- "$plugin" $old_plugins && + set --append update_plugins $plugin || + set --append install_plugins $plugin + end + + for plugin in $old_plugins + contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin + end + end + + set --local pid_list + set --local source_plugins + set --local fetch_plugins $update_plugins $install_plugins + set --local fish_path (status fish-path) + + echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal) + + for plugin in $fetch_plugins + set --local source (command mktemp -d) + set --append source_plugins $source + + command mkdir -p $source/{completions,conf.d,themes,functions} + + $fish_path --command " + if test -e $plugin + command cp -Rf $plugin/* $source + else + set temp (command mktemp -d) + set repo (string split -- \@ $plugin) || set repo[2] HEAD + + if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1]) + set name (string split -- / \$path)[-1] + set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz + else + set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2] + end + + echo Fetching (set_color --underline)\$url(set_color normal) + + if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null + command cp -Rf \$temp/*/* $source + else + echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2 + command rm -rf $source + end + + command rm -rf \$temp + end + + set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files + " & + + set --append pid_list (jobs --last --pid) + end + + wait $pid_list 2>/dev/null + + for plugin in $fetch_plugins + if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source + if set --local index (contains --index -- "$plugin" $install_plugins) + set --erase install_plugins[$index] + else + set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)] + end + end + end + + for plugin in $update_plugins $remove_plugins + if set --local index (contains --index -- "$plugin" $_fisher_plugins) + set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files + + if contains -- "$plugin" $remove_plugins + for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var) + emit {$name}_uninstall + end + printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ + set --erase _fisher_plugins[$index] + end + + command rm -rf (string replace -- \~ ~ $$plugin_files_var) + + functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var) + + for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var) + complete --erase --command $name + end + + set --erase $plugin_files_var + end + end + + if set --query update_plugins[1] || set --query install_plugins[1] + command mkdir -p $fisher_path/{functions,themes,conf.d,completions} + end + + for plugin in $update_plugins $install_plugins + set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] + set --local files $source/{functions,themes,conf.d,completions}/* + + if set --local index (contains --index -- $plugin $install_plugins) + set --local user_files $fisher_path/{functions,themes,conf.d,completions}/* + set --local conflict_files + + for file in (string replace -- $source/ $fisher_path/ $files) + contains -- $file $user_files && set --append conflict_files $file + end + + if set --query conflict_files[1] && set --erase install_plugins[$index] + echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2 + continue + end + end + + for file in (string replace -- $source/ "" $files) + command cp -RLf $source/$file $fisher_path/$file + end + + set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files + + set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~) + + contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin + contains -- $plugin $install_plugins && set --local event install || set --local event update + + printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ + + for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~) + source $file + if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file) + emit {$name}_$event + end + end + end + + command rm -rf $source_plugins + + if set --query _fisher_plugins[1] + set --local commit_plugins + + for plugin in $file_plugins + contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin + end + + for plugin in $_fisher_plugins + contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin + end + + string replace --regex -- $HOME \~ $commit_plugins >$fish_plugins + else + set --erase _fisher_plugins + command rm -f $fish_plugins + end + + set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins) + + test "$total" != "0 0 0" && echo (string join ", " ( + test $total[1] = 0 || echo "Installed $total[1]") ( + test $total[2] = 0 || echo "Updated $total[2]") ( + test $total[3] = 0 || echo "Removed $total[3]") + ) plugin/s + case \* + echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1 + end +end + +if ! set --query _fisher_upgraded_to_4_4 + set --universal _fisher_upgraded_to_4_4 + if functions --query _fisher_list + set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share + command rm -rf $XDG_DATA_HOME/fisher + functions --erase _fisher_{list,plugin_parse} + fisher update >/dev/null 2>/dev/null + else + for var in (set --names | string match --entire --regex '^_fisher_.+_files$') + set $var (string replace -- ~ \~ $$var) + end + functions --erase _fisher_fish_postexec + end +end diff --git a/alpine-river/config/fish/functions/fzf_configure_bindings.fish b/alpine-river/config/fish/functions/fzf_configure_bindings.fish new file mode 100644 index 0000000..4b4e7a2 --- /dev/null +++ b/alpine-river/config/fish/functions/fzf_configure_bindings.fish @@ -0,0 +1,46 @@ +# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect +# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1 +function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options." + # no need to install bindings if not in interactive mode or running tests + status is-interactive || test "$CI" = true; or return + + set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?' + argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null + if test $status -ne 0 + echo "Invalid option or a positional argument was provided." >&2 + _fzf_configure_bindings_help + return 22 + else if set --query _flag_help + _fzf_configure_bindings_help + return + else + # Initialize with default key sequences and then override or disable them based on flags + # index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables + set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv # \c = control, \e = escape + set --query _flag_directory && set key_sequences[1] "$_flag_directory" + set --query _flag_git_log && set key_sequences[2] "$_flag_git_log" + set --query _flag_git_status && set key_sequences[3] "$_flag_git_status" + set --query _flag_history && set key_sequences[4] "$_flag_history" + set --query _flag_processes && set key_sequences[5] "$_flag_processes" + set --query _flag_variables && set key_sequences[6] "$_flag_variables" + + # If fzf bindings already exists, uninstall it first for a clean slate + if functions --query _fzf_uninstall_bindings + _fzf_uninstall_bindings + end + + for mode in default insert + test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory + test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log + test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status + test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history + test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes + test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command" + end + + function _fzf_uninstall_bindings --inherit-variable key_sequences + bind --erase -- $key_sequences + bind --erase --mode insert -- $key_sequences + end + end +end diff --git "a/alpine-river/config/fish/themes/Ros\303\251 Pine.theme" "b/alpine-river/config/fish/themes/Ros\303\251 Pine.theme" new file mode 100644 index 0000000..446f6b5 --- /dev/null +++ "b/alpine-river/config/fish/themes/Ros\303\251 Pine.theme" @@ -0,0 +1,41 @@ +# syntax highlighting variables +# https://fishshell.com/docs/current/interactive.html#syntax-highlighting-variables +fish_color_normal e0def4 +fish_color_command c4a7e7 +fish_color_keyword 9ccfd8 +fish_color_quote f6c177 +fish_color_redirection 31748f +fish_color_end 908caa +fish_color_error eb6f92 +fish_color_param ebbcba +fish_color_comment 908caa +# fish_color_match --background=brblue +fish_color_selection --reverse +# fish_color_history_current --bold +fish_color_operator e0def4 +fish_color_escape 31748f +fish_color_autosuggestion 908caa +fish_color_cwd ebbcba +# fish_color_cwd_root red +fish_color_user f6c177 +fish_color_host 9ccfd8 +fish_color_host_remote c4a7e7 +fish_color_cancel e0def4 +fish_color_search_match --background=191724 +fish_color_valid_path + +# pager color variables +# https://fishshell.com/docs/current/interactive.html#pager-color-variables +fish_pager_color_progress ebbcba +fish_pager_color_background --background=1f1d2e +fish_pager_color_prefix 9ccfd8 +fish_pager_color_completion 908caa +fish_pager_color_description 908caa +fish_pager_color_secondary_background +fish_pager_color_secondary_prefix +fish_pager_color_secondary_completion +fish_pager_color_secondary_description +fish_pager_color_selected_background --background=26233a +fish_pager_color_selected_prefix 9ccfd8 +fish_pager_color_selected_completion e0def4 +fish_pager_color_selected_description e0def4 diff --git a/alpine-river/config/foot/foot.ini b/alpine-river/config/foot/foot.ini new file mode 100644 index 0000000..af175a8 --- /dev/null +++ b/alpine-river/config/foot/foot.ini @@ -0,0 +1,34 @@ +shell=tmux +font=FantasqueSansMono:size=14 +term=xterm-256color + +pad=0x0 center + +# -*- conf -*- +# Rose-Piné + +[cursor] +color=191724 e0def4 +style=beam + +[colors] +background=191724 +foreground=e0def4 +regular0=26233a # black (Overlay) +regular1=eb6f92 # red (Love) +regular2=31748f # green (Pine) +regular3=f6c177 # yellow (Gold) +regular4=9ccfd8 # blue (Foam) +regular5=c4a7e7 # magenta (Iris) +regular6=ebbcba # cyan (Rose) +regular7=e0def4 # white (Text) + +bright0=6e6a86 # bright black (Muted) +bright1=eb6f92 # bright red (Love) +bright2=31748f # bright green (Pine) +bright3=f6c177 # bright yellow (Gold) +bright4=9ccfd8 # bright blue (Foam) +bright5=c4a7e7 # bright magenta (Iris) +bright6=ebbcba # bright cyan (Rose) +bright7=e0def4 # bright white (Text) + diff --git a/alpine-river/config/fuzzel/fuzzel.ini b/alpine-river/config/fuzzel/fuzzel.ini new file mode 100644 index 0000000..1f84146 --- /dev/null +++ b/alpine-river/config/fuzzel/fuzzel.ini @@ -0,0 +1,22 @@ +[main] +font=FantasqueSansMono:size=14 +icons-enabled=false +dpi-aware=no +use-bold=true +prompt="λ " +width=35 +horizontal-pad=10 +vertical-pad=10 + +[border] +width=2 +radius=0 + +[colors] +border=ebbcbaff +background=191724ff +text=e0def4ff +match=9ccfd8ff +selection=1a1b26ff +selection-match=9ccfd8ff +selection-text=c4a7e7ff diff --git a/alpine-river/config/gtk-3.0/gtk.css b/alpine-river/config/gtk-3.0/gtk.css new file mode 100644 index 0000000..64c61fd --- /dev/null +++ b/alpine-river/config/gtk-3.0/gtk.css @@ -0,0 +1,12 @@ +/* No (default) title bar on wayland */ +headerbar.default-decoration { + /* You may need to tweak these values depending on your GTK theme */ + margin-bottom: 50px; + margin-top: -100px; +} + +/* rm -rf window shadows */ +window.csd, /* gtk4? */ +window.csd decoration { /* gtk3 */ + box-shadow: none; +} diff --git a/alpine-river/config/gtk-3.0/settings.ini b/alpine-river/config/gtk-3.0/settings.ini new file mode 100644 index 0000000..9f5e79d --- /dev/null +++ b/alpine-river/config/gtk-3.0/settings.ini @@ -0,0 +1,5 @@ +[Settings] +gtk-dialogs-use-header=false +gtk-cursor-theme-name=BreezeX-RosePine-Linux +gtk-cursor-theme-size=32 +gtk-font-name=Fantasque Sans Mono, 12 diff --git a/alpine-river/config/gtk-4.0/gtk.css b/alpine-river/config/gtk-4.0/gtk.css new file mode 100644 index 0000000..64c61fd --- /dev/null +++ b/alpine-river/config/gtk-4.0/gtk.css @@ -0,0 +1,12 @@ +/* No (default) title bar on wayland */ +headerbar.default-decoration { + /* You may need to tweak these values depending on your GTK theme */ + margin-bottom: 50px; + margin-top: -100px; +} + +/* rm -rf window shadows */ +window.csd, /* gtk4? */ +window.csd decoration { /* gtk3 */ + box-shadow: none; +} diff --git a/alpine-river/config/gtk-4.0/settings.ini b/alpine-river/config/gtk-4.0/settings.ini new file mode 100644 index 0000000..8fea2b9 --- /dev/null +++ b/alpine-river/config/gtk-4.0/settings.ini @@ -0,0 +1,6 @@ +[Settings] +gtk-dialogs-use-header=false +gtk-cursor-theme-name=BreezeX-RosePine-Linux +gtk-cursor-theme-size=32 +gtk-font-name=Fantasque Sans Mono, 12 + diff --git a/alpine-river/config/kanata/config.kbd b/alpine-river/config/kanata/config.kbd new file mode 100644 index 0000000..aeb84b0 --- /dev/null +++ b/alpine-river/config/kanata/config.kbd @@ -0,0 +1,52 @@ +#| +This minimal config changes Caps Lock to act as Caps Lock on quick tap, but +if held, it will act as Left Ctrl. It also changes the backtick/grave key to +act as backtick/grave on quick tap, but change ijkl keys to arrow keys on hold. + +This text between the two pipe+octothorpe sequences is a multi-line comment. +|# + +;; Text after double-semicolons are single-line comments. + +#| +One defcfg entry may be added, which is used for configuration key-pairs. These +configurations change kanata's behaviour at a more global level than the other +configuration entries. +|# + +(defcfg + #| + This configuration will process all keys pressed inside of kanata, even if + they are not mapped in defsrc. This is so that certain actions can activate + at the right time for certain input sequences. By default, unmapped keys are + not processed through kanata due to a Windows issue related to AltGr. If you + use AltGr in your keyboard, you will likely want to follow the simple.kbd + file while unmapping lctl and ralt from defsrc. + |# + process-unmapped-keys yes +) + +(defsrc + esc del + caps pgup + h j k l pgdn + lsft rsft +) + +(deflayer default + grv _ + @cap _ + _ _ _ _ _ + _ _ +) + +(deflayer arrows + _ home + _ end + h y n u ins + _ _ +) + +(defalias + cap (tap-hold 200 200 esc lctl) +) diff --git a/alpine-river/config/mpv/mpv.conf b/alpine-river/config/mpv/mpv.conf new file mode 100644 index 0000000..49b93d9 --- /dev/null +++ b/alpine-river/config/mpv/mpv.conf @@ -0,0 +1,3 @@ +background-color="#191724" +sub-color="#e0def4" +osd-color="#e0def4" diff --git a/alpine-river/config/mpv/script-opts/uosc.conf b/alpine-river/config/mpv/script-opts/uosc.conf new file mode 100644 index 0000000..de8e293 --- /dev/null +++ b/alpine-river/config/mpv/script-opts/uosc.conf @@ -0,0 +1,237 @@ +# Display style of current position. available: line, bar +timeline_style=line +# Line display style config +timeline_line_width=2 +# Timeline size when fully expanded, in pixels, 0 to disable +timeline_size=40 +# Comma separated states when element should always be fully visible. +# Available: paused, audio, image, video, idle, windowed, fullscreen +timeline_persistency= +# Top border of background color to help visually separate timeline from video +timeline_border=1 +# When scrolling above timeline, wheel will seek by this amount of seconds. +# Default uses fast seeking. Add `!` suffix to enable exact seeks. Example: `5!` +timeline_step=5 +# Render cache indicators for streaming content +timeline_cache=yes + +# When to display an always visible progress bar (minimized timeline). Can be: windowed, fullscreen, always, never +# Can also be toggled on demand with `toggle-progress` command. +progress=windowed +progress_size=2 +progress_line_width=20 + +# A comma delimited list of controls above the timeline. Set to `never` to disable. +# Parameter spec: enclosed in `{}` means value, enclosed in `[]` means optional +# Full item syntax: `[<[!]{disposition1}[,[!]{dispositionN}]>]{element}[:{paramN}][#{badge}[>{limit}]][?{tooltip}]` +# Common properties: +# `{icon}` - parameter used to specify an icon name (example: `face`) +# - pick here: https://fonts.google.com/icons?icon.platform=web&icon.set=Material+Icons&icon.style=Rounded +# `{element}`s and their parameters: +# `{shorthand}` - preconfigured shorthands: +# `play-pause`, `menu`, `subtitles`, `audio`, `video`, `playlist`, +# `chapters`, `editions`, `stream-quality`, `open-file`, `items`, +# `next`, `prev`, `first`, `last`, `audio-device`, `fullscreen`, +# `loop-playlist`, `loop-file`, `shuffle` +# `speed[:{scale}]` - display speed slider, [{scale}] - factor of controls_size, default: 1.3 +# `command:{icon}:{command}` - button that executes a {command} when pressed +# `toggle:{icon}:{prop}[@{owner}]` - button that toggles mpv property +# `cycle:{default_icon}:{prop}[@{owner}]:{value1}[={icon1}][!]/{valueN}[={iconN}][!]` +# - button that cycles mpv property between values, each optionally having different icon and active flag +# - presence of `!` at the end will style the button as active +# - `{owner}` is the name of a script that manages this property if any +# `gap[:{scale}]` - display an empty gap +# {scale} - factor of controls_size, default: 0.3 +# `space` - fills all available space between previous and next item, useful to align items to the right +# - multiple spaces divide the available space among themselves, which can be used for centering +# `button:{name}` - button whose state, look, and click action are managed by external script +# Item visibility control: +# `<[!]{disposition1}[,[!]{dispositionN}]>` - optional prefix to control element's visibility +# - `{disposition}` can be one of: +# - `idle` - true if mpv is in idle mode (no file loaded) +# - `image` - true if current file is a single image +# - `audio` - true for audio only files +# - `video` - true for files with a video track +# - `has_many_video` - true for files with more than one video track +# - `has_image` - true for files with a cover or other image track +# - `has_audio` - true for files with an audio track +# - `has_many_audio` - true for files with more than one audio track +# - `has_sub` - true for files with an subtitle track +# - `has_many_sub` - true for files with more than one subtitle track +# - `has_many_edition` - true for files with more than one edition +# - `has_chapter` - true for files with chapter list +# - `stream` - true if current file is read from a stream +# - `has_playlist` - true if current playlist has 2 or more items in it +# - prefix with `!` to negate the required disposition +# Examples: +# - `stream-quality` - show stream quality button only for streams +# - `audio` - show audio tracks button for all files that have +# an audio track, but are not exclusively audio only files +# Place `#{badge}[>{limit}]` after the element params to give it a badge. Available badges: +# `sub`, `audio`, `video` - track type counters +# `{mpv_prop}` - any mpv prop that makes sense to you: https://mpv.io/manual/master/#property-list +# - if prop value is an array it'll display its size +# `>{limit}` will display the badge only if it's numerical value is above this threshold. +# Example: `#audio>1` +# Place `?{tooltip}` after the element config to give it a tooltip. +# Example implementations: +# menu = command:menu:script-binding uosc/menu-blurred?Menu +# subtitles = command:subtitles:script-binding uosc/subtitles#sub?Subtitles +# fullscreen = cycle:crop_free:fullscreen:no/yes=fullscreen_exit!?Fullscreen +# loop-playlist = cycle:repeat:loop-playlist:no/inf!?Loop playlist +# toggle:{icon}:{prop} = cycle:{icon}:{prop}:no/yes! +controls=menu,gap,subtitles,audio,video,editions,stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen +controls_size=32 +controls_margin=8 +controls_spacing=2 +controls_persistency= + +# Where to display volume controls: none, left, right +volume=right +volume_size=40 +volume_border=1 +volume_step=1 +volume_persistency= + +# Playback speed widget: mouse drag or wheel to change, click to reset +speed_step=0.1 +speed_step_is_factor=no +speed_persistency= + +# Controls all menus, such as context menu, subtitle loader/selector, etc +menu_item_height=36 +menu_min_width=260 +menu_padding=4 +# Determines if `/` or `ctrl+f` is required to activate the search, or if typing +# any text is sufficient. +# When enabled, you can no longer toggle a menu off with the same key that opened it, if the key is a unicode character. +menu_type_to_search=yes + +# Top bar with window controls and media title +# Can be: never, no-border, always +top_bar=no-border +top_bar_size=40 +# Can be: `no` (hide), left or right +top_bar_controls=right +# Can be: `no` (hide), `yes` (inherit title from mpv.conf), or a custom template string +top_bar_title=yes +# Template string to enable alternative top bar title. If alt title matches main title, +# it'll be hidden. Tip: use `${media-title}` for main, and `${filename}` for alt title. +top_bar_alt_title= +# Can be: +# `below` => display alt title below the main one +# `toggle` => toggle the top bar title text between main and alt by clicking +# the top bar, or calling `toggle-title` binding +top_bar_alt_title_place=below +# Flash top bar when any of these file types is loaded. Available: audio,video,image,chapter +top_bar_flash_on=video,audio +top_bar_persistency= + +# Window border drawn in no-border mode +window_border_size=1 + +# If there's no playlist and file ends, load next file in the directory +# Requires `keep-open=yes` in `mpv.conf`. +autoload=no +# What types to accept as next item when autoloading or requesting to play next file +# Can be: video, audio, image, subtitle +autoload_types=video,audio,image +# Enable uosc's playlist/directory shuffle mode +# This simply makes the next selected playlist or directory item be random, just +# like any other player in the world. It also has an easily togglable control button. +shuffle=no + +# Scale the interface by this factor +scale=1 +# Scale in fullscreen +scale_fullscreen=1.3 +# Adjust the text scaling to fit your font +font_scale=1 +# Border of text and icons when drawn directly on top of video +text_border=1.2 +# Border radius of buttons, menus, and all other rectangles +border_radius=4 +# A comma delimited list of color overrides in RGB HEX format. Defaults: +# foreground=ffffff,foreground_text=000000,background=000000,background_text=ffffff,curtain=111111,success=a5e075,error=ff616e +color= +# A comma delimited list of opacity overrides for various UI element backgrounds and shapes. +# This does not affect any text, which is always rendered fully opaque. Defaults: +# timeline=0.9,position=1,chapters=0.8,slider=0.9,slider_gauge=1,controls=0,speed=0.6,menu=1,submenu=0.4,border=1,title=1,tooltip=1,thumbnail=1,curtain=0.8,idle_indicator=0.8,audio_indicator=0.5,buffering_indicator=0.3,playlist_position=0.8 +opacity= +# A comma delimited list of features to refine at a cost of some performance impact. +# text_width - Use a more accurate text width measurement that measures each text string individually +# instead of just measuring the width of known letters once and adding them up. +# sorting - Use filename sorting that handles non-english languages better, especially asian ones. +# At the moment, this is only available on windows, and has no effect on other platforms. +refine= +# Duration of animations in milliseconds +animation_duration=100 +# Execute command for background clicks shorter than this number of milliseconds, 0 to disable +# Execution always waits for `input-doubleclick-time` to filter out double-clicks +click_threshold=0 +click_command=cycle pause; script-binding uosc/flash-pause-indicator +# Flash duration in milliseconds used by `flash-{element}` commands +flash_duration=1000 +# Distances in pixels below which elements are fully faded in/out +proximity_in=40 +proximity_out=120 +# Use only bold font weight throughout the whole UI +font_bold=no +# One of `total`, `playtime-remaining` (scaled by the current speed), `time-remaining` (remaining length of file) +destination_time=playtime-remaining +# Display sub second fraction in timestamps up to this precision +time_precision=0 +# Display stream's buffered time in timeline if it's lower than this amount of seconds, 0 to disable +buffered_time_threshold=60 +# Hide UI when mpv autohides the cursor. Timing is controlled by `cursor-autohide` in `mpv.conf` (in milliseconds). +autohide=no +# Can be: flash, static, manual (controlled by flash-pause-indicator and decide-pause-indicator commands) +pause_indicator=flash +# Sizes to list in stream quality menu +stream_quality_options=4320,2160,1440,1080,720,480,360,240,144 +# Types to identify media files +video_types=3g2,3gp,asf,avi,f4v,flv,h264,h265,m2ts,m4v,mkv,mov,mp4,mp4v,mpeg,mpg,ogm,ogv,rm,rmvb,ts,vob,webm,wmv,y4m +audio_types=aac,ac3,aiff,ape,au,cue,dsf,dts,flac,m4a,mid,midi,mka,mp3,mp4a,oga,ogg,opus,spx,tak,tta,wav,weba,wma,wv +image_types=apng,avif,bmp,gif,j2k,jp2,jfif,jpeg,jpg,jxl,mj2,png,svg,tga,tif,tiff,webp +subtitle_types=aqt,ass,gsub,idx,jss,lrc,mks,pgs,pjs,psb,rt,sbv,slt,smi,sub,sup,srt,ssa,ssf,ttxt,txt,usf,vt,vtt +playlist_types=m3u,m3u8,pls,url,cue +# Default open-file menu directory. Use `{drives}` to open drives menu on windows (defaults to `/` on unix). +default_directory=~/ +# List hidden files when reading directories. Due to environment limitations, this currently only hides +# files starting with a dot. Doesn't hide hidden files on windows (we have no way to tell they're hidden). +show_hidden_files=no +# Move files to trash (recycle bin) when deleting files. Dependencies: +# - Linux: `sudo apt install trash-cli` +# - MacOS: `brew install trash` +use_trash=no +# Adjusted osd margins based on the visibility of UI elements +adjust_osd_margins=yes + +# Adds chapter range indicators to some common chapter types. +# Additionally to displaying the start of the chapter as a diamond icon on top of the timeline, +# the portion of the timeline of that chapter range is also colored based on the config below. +# +# The syntax is a comma-delimited list of `{type}:{color}` pairs, where: +# `{type}` => range type. Currently supported ones are: +# - `openings`, `endings` => anime openings/endings +# - `intros`, `outros` => video intros/outros +# - `ads` => segments created by sponsor-block software like https://github.com/po5/mpv_sponsorblock +# `{color}` => an RGB(A) HEX color code (`rrggbb`, or `rrggbbaa`) +# +# To exclude marking any of the range types, simply remove them from the list. +chapter_ranges=openings:30abf964,endings:30abf964,ads:c54e4e80 +# Add alternative lua patterns to identify beginnings of simple chapter ranges (except for `ads`) +# Syntax: `{type}:{pattern}[,{patternN}][;{type}:{pattern}[,{patternN}]]` +chapter_range_patterns=openings:オープニング;endings:エンディング + +# Localization language priority from highest to lowest. +# Also controls what languages are fetched by `download-subtitles` menu. +# Built in languages can be found in `uosc/intl`. +# `slang` is a keyword to inherit values from `--slang` mpv config. +# Supports paths to custom json files: `languages=~~/custom.json,slang,en` +languages=slang,en + +# A comma separated list of element IDs to disable. Available IDs: +# window_border, top_bar, timeline, controls, volume, +# idle_indicator, audio_indicator, buffering_indicator, pause_indicator +disable_elements= diff --git a/alpine-river/config/mpv/scripts/thumbfast.lua b/alpine-river/config/mpv/scripts/thumbfast.lua new file mode 100644 index 0000000..58d1870 --- /dev/null +++ b/alpine-river/config/mpv/scripts/thumbfast.lua @@ -0,0 +1,951 @@ +-- thumbfast.lua +-- +-- High-performance on-the-fly thumbnailer +-- +-- Built for easy integration in third-party UIs. + +--[[ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at https://mozilla.org/MPL/2.0/. +]] + +local options = { + -- Socket path (leave empty for auto) + socket = "", + + -- Thumbnail path (leave empty for auto) + thumbnail = "", + + -- Maximum thumbnail generation size in pixels (scaled down to fit) + -- Values are scaled when hidpi is enabled + max_height = 200, + max_width = 200, + + -- Scale factor for thumbnail display size (requires mpv 0.38+) + -- Note that this is lower quality than increasing max_height and max_width + scale_factor = 1, + + -- Apply tone-mapping, no to disable + tone_mapping = "auto", + + -- Overlay id + overlay_id = 42, + + -- Spawn thumbnailer on file load for faster initial thumbnails + spawn_first = false, + + -- Close thumbnailer process after an inactivity period in seconds, 0 to disable + quit_after_inactivity = 0, + + -- Enable on network playback + network = false, + + -- Enable on audio playback + audio = false, + + -- Enable hardware decoding + hwdec = false, + + -- Windows only: use native Windows API to write to pipe (requires LuaJIT) + direct_io = false, + + -- Custom path to the mpv executable + mpv_path = "mpv" +} + +mp.utils = require "mp.utils" +mp.options = require "mp.options" +mp.options.read_options(options, "thumbfast") + +local properties = {} +local pre_0_30_0 = mp.command_native_async == nil +local pre_0_33_0 = true +local support_media_control = mp.get_property_native("media-controls") ~= nil + +function subprocess(args, async, callback) + callback = callback or function() end + + if not pre_0_30_0 then + if async then + return mp.command_native_async({name = "subprocess", playback_only = true, args = args}, callback) + else + return mp.command_native({name = "subprocess", playback_only = false, capture_stdout = true, args = args}) + end + else + if async then + return mp.utils.subprocess_detached({args = args}, callback) + else + return mp.utils.subprocess({args = args}) + end + end +end + +local winapi = {} +if options.direct_io then + local ffi_loaded, ffi = pcall(require, "ffi") + if ffi_loaded then + winapi = { + ffi = ffi, + C = ffi.C, + bit = require("bit"), + socket_wc = "", + + -- WinAPI constants + CP_UTF8 = 65001, + GENERIC_WRITE = 0x40000000, + OPEN_EXISTING = 3, + FILE_FLAG_WRITE_THROUGH = 0x80000000, + FILE_FLAG_NO_BUFFERING = 0x20000000, + PIPE_NOWAIT = ffi.new("unsigned long[1]", 0x00000001), + + INVALID_HANDLE_VALUE = ffi.cast("void*", -1), + + -- don't care about how many bytes WriteFile wrote, so allocate something to store the result once + _lpNumberOfBytesWritten = ffi.new("unsigned long[1]"), + } + -- cache flags used in run() to avoid bor() call + winapi._createfile_pipe_flags = winapi.bit.bor(winapi.FILE_FLAG_WRITE_THROUGH, winapi.FILE_FLAG_NO_BUFFERING) + + ffi.cdef[[ + void* __stdcall CreateFileW(const wchar_t *lpFileName, unsigned long dwDesiredAccess, unsigned long dwShareMode, void *lpSecurityAttributes, unsigned long dwCreationDisposition, unsigned long dwFlagsAndAttributes, void *hTemplateFile); + bool __stdcall WriteFile(void *hFile, const void *lpBuffer, unsigned long nNumberOfBytesToWrite, unsigned long *lpNumberOfBytesWritten, void *lpOverlapped); + bool __stdcall CloseHandle(void *hObject); + bool __stdcall SetNamedPipeHandleState(void *hNamedPipe, unsigned long *lpMode, unsigned long *lpMaxCollectionCount, unsigned long *lpCollectDataTimeout); + int __stdcall MultiByteToWideChar(unsigned int CodePage, unsigned long dwFlags, const char *lpMultiByteStr, int cbMultiByte, wchar_t *lpWideCharStr, int cchWideChar); + ]] + + winapi.MultiByteToWideChar = function(MultiByteStr) + if MultiByteStr then + local utf16_len = winapi.C.MultiByteToWideChar(winapi.CP_UTF8, 0, MultiByteStr, -1, nil, 0) + if utf16_len > 0 then + local utf16_str = winapi.ffi.new("wchar_t[?]", utf16_len) + if winapi.C.MultiByteToWideChar(winapi.CP_UTF8, 0, MultiByteStr, -1, utf16_str, utf16_len) > 0 then + return utf16_str + end + end + end + return "" + end + + else + options.direct_io = false + end +end + +local file +local file_bytes = 0 +local spawned = false +local disabled = false +local force_disabled = false +local spawn_waiting = false +local spawn_working = false +local script_written = false + +local dirty = false + +local x, y +local last_x, last_y + +local last_seek_time + +local effective_w, effective_h = options.max_width, options.max_height +local real_w, real_h +local last_real_w, last_real_h + +local script_name + +local show_thumbnail = false + +local filters_reset = {["lavfi-crop"]=true, ["crop"]=true} +local filters_runtime = {["hflip"]=true, ["vflip"]=true} +local filters_all = {["hflip"]=true, ["vflip"]=true, ["lavfi-crop"]=true, ["crop"]=true} + +local tone_mappings = {["none"]=true, ["clip"]=true, ["linear"]=true, ["gamma"]=true, ["reinhard"]=true, ["hable"]=true, ["mobius"]=true} +local last_tone_mapping + +local last_vf_reset = "" +local last_vf_runtime = "" + +local last_rotate = 0 + +local par = "" +local last_par = "" + +local last_crop = nil + +local last_has_vid = 0 +local has_vid = 0 + +local file_timer +local file_check_period = 1/60 + +local allow_fast_seek = true + +local client_script = [=[ +#!/usr/bin/env bash +MPV_IPC_FD=0; MPV_IPC_PATH="%s" +trap "kill 0" EXIT +while [[ $# -ne 0 ]]; do case $1 in --mpv-ipc-fd=*) MPV_IPC_FD=${1/--mpv-ipc-fd=/} ;; esac; shift; done +if echo "print-text thumbfast" >&"$MPV_IPC_FD"; then echo -n > "$MPV_IPC_PATH"; tail -f "$MPV_IPC_PATH" >&"$MPV_IPC_FD" & while read -r -u "$MPV_IPC_FD" 2>/dev/null; do :; done; fi +]=] + +local function get_os() + local raw_os_name = "" + + if jit and jit.os and jit.arch then + raw_os_name = jit.os + else + if package.config:sub(1,1) == "\\" then + -- Windows + local env_OS = os.getenv("OS") + if env_OS then + raw_os_name = env_OS + end + else + raw_os_name = subprocess({"uname", "-s"}).stdout + end + end + + raw_os_name = (raw_os_name):lower() + + local os_patterns = { + ["windows"] = "windows", + ["linux"] = "linux", + + ["osx"] = "darwin", + ["mac"] = "darwin", + ["darwin"] = "darwin", + + ["^mingw"] = "windows", + ["^cygwin"] = "windows", + + ["bsd$"] = "darwin", + ["sunos"] = "darwin" + } + + -- Default to linux + local str_os_name = "linux" + + for pattern, name in pairs(os_patterns) do + if raw_os_name:match(pattern) then + str_os_name = name + break + end + end + + return str_os_name +end + +local os_name = mp.get_property("platform") or get_os() + +local path_separator = os_name == "windows" and "\\" or "/" + +if options.socket == "" then + if os_name == "windows" then + options.socket = "thumbfast" + else + options.socket = "/tmp/thumbfast" + end +end + +if options.thumbnail == "" then + if os_name == "windows" then + options.thumbnail = os.getenv("TEMP").."\\thumbfast.out" + else + options.thumbnail = "/tmp/thumbfast.out" + end +end + +local unique = mp.utils.getpid() + +options.socket = options.socket .. unique +options.thumbnail = options.thumbnail .. unique + +if options.direct_io then + if os_name == "windows" then + winapi.socket_wc = winapi.MultiByteToWideChar("\\\\.\\pipe\\" .. options.socket) + end + + if winapi.socket_wc == "" then + options.direct_io = false + end +end + +options.scale_factor = math.floor(options.scale_factor) + +local mpv_path = options.mpv_path +local frontend_path + +if mpv_path == "mpv" and os_name == "windows" then + frontend_path = mp.get_property_native("user-data/frontend/process-path") + mpv_path = frontend_path or mpv_path +end + +if mpv_path == "mpv" and os_name == "darwin" and unique then + -- TODO: look into ~~osxbundle/ + mpv_path = string.gsub(subprocess({"ps", "-o", "comm=", "-p", tostring(unique)}).stdout, "[\n\r]", "") + if mpv_path ~= "mpv" then + mpv_path = string.gsub(mpv_path, "/mpv%-bundle$", "/mpv") + local mpv_bin = mp.utils.file_info("/usr/local/mpv") + if mpv_bin and mpv_bin.is_file then + mpv_path = "/usr/local/mpv" + else + local mpv_app = mp.utils.file_info("/Applications/mpv.app/Contents/MacOS/mpv") + if mpv_app and mpv_app.is_file then + mp.msg.warn("symlink mpv to fix Dock icons: `sudo ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/mpv`") + else + mp.msg.warn("drag to your Applications folder and symlink mpv to fix Dock icons: `sudo ln -s /Applications/mpv.app/Contents/MacOS/mpv /usr/local/mpv`") + end + end + end +end + +local function vo_tone_mapping() + local passes = mp.get_property_native("vo-passes") + if passes and passes["fresh"] then + for k, v in pairs(passes["fresh"]) do + for k2, v2 in pairs(v) do + if k2 == "desc" and v2 then + local tone_mapping = string.match(v2, "([0-9a-z.-]+) tone map") + if tone_mapping then + return tone_mapping + end + end + end + end + end +end + +local function vf_string(filters, full) + local vf = "" + local vf_table = properties["vf"] + + if (properties["video-crop"] or "") ~= "" then + vf = "lavfi-crop="..string.gsub(properties["video-crop"], "(%d*)x?(%d*)%+(%d+)%+(%d+)", "w=%1:h=%2:x=%3:y=%4").."," + local width = properties["video-out-params"] and properties["video-out-params"]["dw"] + local height = properties["video-out-params"] and properties["video-out-params"]["dh"] + if width and height then + vf = string.gsub(vf, "w=:h=:", "w="..width..":h="..height..":") + end + end + + if vf_table and #vf_table > 0 then + for i = #vf_table, 1, -1 do + if filters[vf_table[i].name] then + local args = "" + for key, value in pairs(vf_table[i].params) do + if args ~= "" then + args = args .. ":" + end + args = args .. key .. "=" .. value + end + vf = vf .. vf_table[i].name .. "=" .. args .. "," + end + end + end + + if (full and options.tone_mapping ~= "no") or options.tone_mapping == "auto" then + if properties["video-params"] and properties["video-params"]["primaries"] == "bt.2020" then + local tone_mapping = options.tone_mapping + if tone_mapping == "auto" then + tone_mapping = last_tone_mapping or properties["tone-mapping"] + if tone_mapping == "auto" and properties["current-vo"] == "gpu-next" then + tone_mapping = vo_tone_mapping() + end + end + if not tone_mappings[tone_mapping] then + tone_mapping = "hable" + end + last_tone_mapping = tone_mapping + vf = vf .. "zscale=transfer=linear,format=gbrpf32le,tonemap="..tone_mapping..",zscale=transfer=bt709," + end + end + + if full then + vf = vf.."scale=w="..effective_w..":h="..effective_h..par..",pad=w="..effective_w..":h="..effective_h..":x=-1:y=-1,format=bgra" + end + + return vf +end + +local function calc_dimensions() + local width = properties["video-out-params"] and properties["video-out-params"]["dw"] + local height = properties["video-out-params"] and properties["video-out-params"]["dh"] + if not width or not height then return end + + local scale = properties["display-hidpi-scale"] or 1 + + if width / height > options.max_width / options.max_height then + effective_w = math.floor(options.max_width * scale + 0.5) + effective_h = math.floor(height / width * effective_w + 0.5) + else + effective_h = math.floor(options.max_height * scale + 0.5) + effective_w = math.floor(width / height * effective_h + 0.5) + end + + local v_par = properties["video-out-params"] and properties["video-out-params"]["par"] or 1 + if v_par == 1 then + par = ":force_original_aspect_ratio=decrease" + else + par = "" + end +end + +local info_timer = nil + +local function info(w, h) + local rotate = properties["video-params"] and properties["video-params"]["rotate"] + local image = properties["current-tracks/video"] and properties["current-tracks/video"]["image"] + local albumart = image and properties["current-tracks/video"]["albumart"] + + disabled = (w or 0) == 0 or (h or 0) == 0 or + has_vid == 0 or + (properties["demuxer-via-network"] and not options.network) or + (albumart and not options.audio) or + (image and not albumart) or + force_disabled + + if info_timer then + info_timer:kill() + info_timer = nil + elseif has_vid == 0 or (rotate == nil and not disabled) then + info_timer = mp.add_timeout(0.05, function() info(w, h) end) + end + + local json, err = mp.utils.format_json({width=w * options.scale_factor, height=h * options.scale_factor, scale_factor=options.scale_factor, disabled=disabled, available=true, socket=options.socket, thumbnail=options.thumbnail, overlay_id=options.overlay_id}) + if pre_0_30_0 then + mp.command_native({"script-message", "thumbfast-info", json}) + else + mp.command_native_async({"script-message", "thumbfast-info", json}, function() end) + end +end + +local function remove_thumbnail_files() + if file then + file:close() + file = nil + file_bytes = 0 + end + os.remove(options.thumbnail) + os.remove(options.thumbnail..".bgra") +end + +local activity_timer + +local function spawn(time) + if disabled then return end + + local path = properties["path"] + if path == nil then return end + + if options.quit_after_inactivity > 0 then + if show_thumbnail or activity_timer:is_enabled() then + activity_timer:kill() + end + activity_timer:resume() + end + + local open_filename = properties["stream-open-filename"] + local ytdl = open_filename and properties["demuxer-via-network"] and path ~= open_filename + if ytdl then + path = open_filename + end + + remove_thumbnail_files() + + local vid = properties["vid"] + has_vid = vid or 0 + + local args = { + mpv_path, "--no-config", "--msg-level=all=no", "--idle", "--pause", "--keep-open=always", "--really-quiet", "--no-terminal", + "--load-scripts=no", "--osc=no", "--ytdl=no", "--load-stats-overlay=no", "--load-osd-console=no", "--load-auto-profiles=no", + "--edition="..(properties["edition"] or "auto"), "--vid="..(vid or "auto"), "--no-sub", "--no-audio", + "--start="..time, allow_fast_seek and "--hr-seek=no" or "--hr-seek=yes", + "--ytdl-format=worst", "--demuxer-readahead-secs=0", "--demuxer-max-bytes=128KiB", + "--vd-lavc-skiploopfilter=all", "--vd-lavc-software-fallback=1", "--vd-lavc-fast", "--vd-lavc-threads=2", "--hwdec="..(options.hwdec and "auto" or "no"), + "--vf="..vf_string(filters_all, true), + "--sws-scaler=fast-bilinear", + "--video-rotate="..last_rotate, + "--ovc=rawvideo", "--of=image2", "--ofopts=update=1", "--o="..options.thumbnail + } + + if not pre_0_30_0 then + table.insert(args, "--sws-allow-zimg=no") + end + + if support_media_control then + table.insert(args, "--media-controls=no") + end + + if os_name == "darwin" and properties["macos-app-activation-policy"] then + table.insert(args, "--macos-app-activation-policy=accessory") + end + + if os_name == "windows" or pre_0_33_0 then + table.insert(args, "--input-ipc-server="..options.socket) + elseif not script_written then + local client_script_path = options.socket..".run" + local script = io.open(client_script_path, "w+") + if script == nil then + mp.msg.error("client script write failed") + return + else + script_written = true + script:write(string.format(client_script, options.socket)) + script:close() + subprocess({"chmod", "+x", client_script_path}, true) + table.insert(args, "--scripts="..client_script_path) + end + else + local client_script_path = options.socket..".run" + table.insert(args, "--scripts="..client_script_path) + end + + table.insert(args, "--") + table.insert(args, path) + + spawned = true + spawn_waiting = true + + subprocess(args, true, + function(success, result) + if spawn_waiting and (success == false or (result.status ~= 0 and result.status ~= -2)) then + spawned = false + spawn_waiting = false + options.tone_mapping = "no" + mp.msg.error("mpv subprocess create failed") + if not spawn_working then -- notify users of required configuration + if options.mpv_path == "mpv" then + if properties["current-vo"] == "libmpv" then + if options.mpv_path == mpv_path then -- attempt to locate ImPlay + mpv_path = "ImPlay" + spawn(time) + else -- ImPlay not in path + if os_name ~= "darwin" then + force_disabled = true + info(real_w or effective_w, real_h or effective_h) + end + mp.commandv("show-text", "thumbfast: ERROR! cannot create mpv subprocess", 5000) + mp.commandv("script-message-to", "implay", "show-message", "thumbfast initial setup", "Set mpv_path=PATH_TO_ImPlay in thumbfast config:\n" .. string.gsub(mp.command_native({"expand-path", "~~/script-opts/thumbfast.conf"}), "[/\\]", path_separator).."\nand restart ImPlay") + end + else + mp.commandv("show-text", "thumbfast: ERROR! cannot create mpv subprocess", 5000) + if os_name == "windows" and frontend_path == nil then + mp.commandv("script-message-to", "mpvnet", "show-text", "thumbfast: ERROR! install standalone mpv, see README", 5000, 20) + mp.commandv("script-message", "mpv.net", "show-text", "thumbfast: ERROR! install standalone mpv, see README", 5000, 20) + end + end + else + mp.commandv("show-text", "thumbfast: ERROR! cannot create mpv subprocess", 5000) + -- found ImPlay but not defined in config + mp.commandv("script-message-to", "implay", "show-message", "thumbfast", "Set mpv_path=PATH_TO_ImPlay in thumbfast config:\n" .. string.gsub(mp.command_native({"expand-path", "~~/script-opts/thumbfast.conf"}), "[/\\]", path_separator).."\nand restart ImPlay") + end + end + elseif success == true and (result.status == 0 or result.status == -2) then + if not spawn_working and properties["current-vo"] == "libmpv" and options.mpv_path ~= mpv_path then + mp.commandv("script-message-to", "implay", "show-message", "thumbfast initial setup", "Set mpv_path=ImPlay in thumbfast config:\n" .. string.gsub(mp.command_native({"expand-path", "~~/script-opts/thumbfast.conf"}), "[/\\]", path_separator).."\nand restart ImPlay") + end + spawn_working = true + spawn_waiting = false + end + end + ) +end + +local function run(command) + if not spawned then return end + + if options.direct_io then + local hPipe = winapi.C.CreateFileW(winapi.socket_wc, winapi.GENERIC_WRITE, 0, nil, winapi.OPEN_EXISTING, winapi._createfile_pipe_flags, nil) + if hPipe ~= winapi.INVALID_HANDLE_VALUE then + local buf = command .. "\n" + winapi.C.SetNamedPipeHandleState(hPipe, winapi.PIPE_NOWAIT, nil, nil) + winapi.C.WriteFile(hPipe, buf, #buf + 1, winapi._lpNumberOfBytesWritten, nil) + winapi.C.CloseHandle(hPipe) + end + + return + end + + local command_n = command.."\n" + + if os_name == "windows" then + if file and file_bytes + #command_n >= 4096 then + file:close() + file = nil + file_bytes = 0 + end + if not file then + file = io.open("\\\\.\\pipe\\"..options.socket, "r+b") + end + elseif pre_0_33_0 then + subprocess({"/usr/bin/env", "sh", "-c", "echo '" .. command .. "' | socat - " .. options.socket}) + return + elseif not file then + file = io.open(options.socket, "r+") + end + if file then + file_bytes = file:seek("end") + file:write(command_n) + file:flush() + end +end + +local function draw(w, h, script) + if not w or not show_thumbnail then return end + if x ~= nil then + local scale_w, scale_h = options.scale_factor ~= 1 and (w * options.scale_factor) or nil, options.scale_factor ~= 1 and (h * options.scale_factor) or nil + if pre_0_30_0 then + mp.command_native({"overlay-add", options.overlay_id, x, y, options.thumbnail..".bgra", 0, "bgra", w, h, (4*w), scale_w, scale_h}) + else + mp.command_native_async({"overlay-add", options.overlay_id, x, y, options.thumbnail..".bgra", 0, "bgra", w, h, (4*w), scale_w, scale_h}, function() end) + end + elseif script then + local json, err = mp.utils.format_json({width=w, height=h, scale_factor=options.scale_factor, x=x, y=y, socket=options.socket, thumbnail=options.thumbnail, overlay_id=options.overlay_id}) + mp.commandv("script-message-to", script, "thumbfast-render", json) + end +end + +local function real_res(req_w, req_h, filesize) + local count = filesize / 4 + local diff = (req_w * req_h) - count + + if (properties["video-params"] and properties["video-params"]["rotate"] or 0) % 180 == 90 then + req_w, req_h = req_h, req_w + end + + if diff == 0 then + return req_w, req_h + else + local threshold = 5 -- throw out results that change too much + local long_side, short_side = req_w, req_h + if req_h > req_w then + long_side, short_side = req_h, req_w + end + for a = short_side, short_side - threshold, -1 do + if count % a == 0 then + local b = count / a + if long_side - b < threshold then + if req_h < req_w then return b, a else return a, b end + end + end + end + return nil + end +end + +local function move_file(from, to) + if os_name == "windows" then + os.remove(to) + end + -- move the file because it can get overwritten while overlay-add is reading it, and crash the player + os.rename(from, to) +end + +local function seek(fast) + if last_seek_time then + run("async seek " .. last_seek_time .. (fast and " absolute+keyframes" or " absolute+exact")) + end +end + +local seek_period = 3/60 +local seek_period_counter = 0 +local seek_timer +seek_timer = mp.add_periodic_timer(seek_period, function() + if seek_period_counter == 0 then + seek(allow_fast_seek) + seek_period_counter = 1 + else + if seek_period_counter == 2 then + if allow_fast_seek then + seek_timer:kill() + seek() + end + else seek_period_counter = seek_period_counter + 1 end + end +end) +seek_timer:kill() + +local function request_seek() + if seek_timer:is_enabled() then + seek_period_counter = 0 + else + seek_timer:resume() + seek(allow_fast_seek) + seek_period_counter = 1 + end +end + +local function check_new_thumb() + -- the slave might start writing to the file after checking existance and + -- validity but before actually moving the file, so move to a temporary + -- location before validity check to make sure everything stays consistant + -- and valid thumbnails don't get overwritten by invalid ones + local tmp = options.thumbnail..".tmp" + move_file(options.thumbnail, tmp) + local finfo = mp.utils.file_info(tmp) + if not finfo then return false end + spawn_waiting = false + local w, h = real_res(effective_w, effective_h, finfo.size) + if w then -- only accept valid thumbnails + move_file(tmp, options.thumbnail..".bgra") + + real_w, real_h = w, h + if real_w and (real_w ~= last_real_w or real_h ~= last_real_h) then + last_real_w, last_real_h = real_w, real_h + info(real_w, real_h) + end + if not show_thumbnail then + file_timer:kill() + end + return true + end + + return false +end + +file_timer = mp.add_periodic_timer(file_check_period, function() + if check_new_thumb() then + draw(real_w, real_h, script_name) + end +end) +file_timer:kill() + +local function clear() + file_timer:kill() + seek_timer:kill() + if options.quit_after_inactivity > 0 then + if show_thumbnail or activity_timer:is_enabled() then + activity_timer:kill() + end + activity_timer:resume() + end + last_seek_time = nil + show_thumbnail = false + last_x = nil + last_y = nil + if script_name then return end + if pre_0_30_0 then + mp.command_native({"overlay-remove", options.overlay_id}) + else + mp.command_native_async({"overlay-remove", options.overlay_id}, function() end) + end +end + +local function quit() + activity_timer:kill() + if show_thumbnail then + activity_timer:resume() + return + end + run("quit") + spawned = false + real_w, real_h = nil, nil + clear() +end + +activity_timer = mp.add_timeout(options.quit_after_inactivity, quit) +activity_timer:kill() + +local function thumb(time, r_x, r_y, script) + if disabled then return end + + time = tonumber(time) + if time == nil then return end + + if r_x == "" or r_y == "" then + x, y = nil, nil + else + x, y = math.floor(r_x + 0.5), math.floor(r_y + 0.5) + end + + script_name = script + if last_x ~= x or last_y ~= y or not show_thumbnail then + show_thumbnail = true + last_x, last_y = x, y + draw(real_w, real_h, script) + end + + if options.quit_after_inactivity > 0 then + if show_thumbnail or activity_timer:is_enabled() then + activity_timer:kill() + end + activity_timer:resume() + end + + if time == last_seek_time then return end + last_seek_time = time + if not spawned then spawn(time) end + request_seek() + if not file_timer:is_enabled() then file_timer:resume() end +end + +local function watch_changes() + if not dirty or not properties["video-out-params"] then return end + dirty = false + + local old_w = effective_w + local old_h = effective_h + + calc_dimensions() + + local vf_reset = vf_string(filters_reset) + local rotate = properties["video-rotate"] or 0 + + local resized = old_w ~= effective_w or + old_h ~= effective_h or + last_vf_reset ~= vf_reset or + (last_rotate % 180) ~= (rotate % 180) or + par ~= last_par or last_crop ~= properties["video-crop"] + + if resized then + last_rotate = rotate + info(effective_w, effective_h) + elseif last_has_vid ~= has_vid and has_vid ~= 0 then + info(effective_w, effective_h) + end + + if spawned then + if resized then + -- mpv doesn't allow us to change output size + local seek_time = last_seek_time + run("quit") + clear() + spawned = false + spawn(seek_time or mp.get_property_number("time-pos", 0)) + file_timer:resume() + else + if rotate ~= last_rotate then + run("set video-rotate "..rotate) + end + local vf_runtime = vf_string(filters_runtime) + if vf_runtime ~= last_vf_runtime then + run("vf set "..vf_string(filters_all, true)) + last_vf_runtime = vf_runtime + end + end + else + last_vf_runtime = vf_string(filters_runtime) + end + + last_vf_reset = vf_reset + last_rotate = rotate + last_par = par + last_crop = properties["video-crop"] + last_has_vid = has_vid + + if not spawned and not disabled and options.spawn_first and resized then + spawn(mp.get_property_number("time-pos", 0)) + file_timer:resume() + end +end + +local function update_property(name, value) + properties[name] = value +end + +local function update_property_dirty(name, value) + properties[name] = value + dirty = true + if name == "tone-mapping" then + last_tone_mapping = nil + end +end + +local function update_tracklist(name, value) + -- current-tracks shim + for _, track in ipairs(value) do + if track.type == "video" and track.selected then + properties["current-tracks/video"] = track + return + end + end +end + +local function sync_changes(prop, val) + update_property(prop, val) + if val == nil then return end + + if type(val) == "boolean" then + if prop == "vid" then + has_vid = 0 + last_has_vid = 0 + info(effective_w, effective_h) + clear() + return + end + val = val and "yes" or "no" + end + + if prop == "vid" then + has_vid = 1 + end + + if not spawned then return end + + run("set "..prop.." "..val) + dirty = true +end + +local function file_load() + clear() + spawned = false + real_w, real_h = nil, nil + last_real_w, last_real_h = nil, nil + last_tone_mapping = nil + last_seek_time = nil + if info_timer then + info_timer:kill() + info_timer = nil + end + + calc_dimensions() + info(effective_w, effective_h) +end + +local function shutdown() + run("quit") + remove_thumbnail_files() + if os_name ~= "windows" then + os.remove(options.socket) + os.remove(options.socket..".run") + end +end + +local function on_duration(prop, val) + allow_fast_seek = (val or 30) >= 30 +end + +mp.observe_property("current-tracks/video", "native", function(name, value) + if pre_0_33_0 then + mp.unobserve_property(update_tracklist) + pre_0_33_0 = false + end + update_property(name, value) +end) + +mp.observe_property("track-list", "native", update_tracklist) +mp.observe_property("display-hidpi-scale", "native", update_property_dirty) +mp.observe_property("video-out-params", "native", update_property_dirty) +mp.observe_property("video-params", "native", update_property_dirty) +mp.observe_property("vf", "native", update_property_dirty) +mp.observe_property("tone-mapping", "native", update_property_dirty) +mp.observe_property("demuxer-via-network", "native", update_property) +mp.observe_property("stream-open-filename", "native", update_property) +mp.observe_property("macos-app-activation-policy", "native", update_property) +mp.observe_property("current-vo", "native", update_property) +mp.observe_property("video-rotate", "native", update_property) +mp.observe_property("video-crop", "native", update_property) +mp.observe_property("path", "native", update_property) +mp.observe_property("vid", "native", sync_changes) +mp.observe_property("edition", "native", sync_changes) +mp.observe_property("duration", "native", on_duration) + +mp.register_script_message("thumb", thumb) +mp.register_script_message("clear", clear) + +mp.register_event("file-loaded", file_load) +mp.register_event("shutdown", shutdown) + +mp.register_idle(watch_changes) diff --git a/alpine-river/config/nvim/.gitignore b/alpine-river/config/nvim/.gitignore new file mode 100644 index 0000000..e033bc6 --- /dev/null +++ b/alpine-river/config/nvim/.gitignore @@ -0,0 +1 @@ +lazy-lock.json diff --git a/alpine-river/config/nvim/init.lua b/alpine-river/config/nvim/init.lua new file mode 100644 index 0000000..e1870d1 --- /dev/null +++ b/alpine-river/config/nvim/init.lua @@ -0,0 +1,134 @@ +-- Setup Lazy Plugin Manager +require("config.lazy") + +-- Setup Config +vim.cmd.colorscheme("rose-pine") +vim.opt.termguicolors = true + +vim.opt.nu = true +vim.opt.rnu = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.autoindent = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 12 + +vim.opt.updatetime = 50 + +vim.opt.splitbelow = true +vim.opt.splitright = true + +vim.opt.encoding = "utf-8" + +vim.opt.shell = "fish" + +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.incsearch = true + +vim.opt.cursorline = true + +vim.opt.title = true + +vim.opt.clipboard = "unnamedplus" + +vim.opt.colorcolumn = "80" + +vim.cmd "set showtabline=0 | set laststatus=0" + +vim.wo.fillchars='eob: ' + +vim.g.codeium_enabled = false + +vim.g.mapleader = " " +vim.keymap.set("n", "bk", vim.cmd.bdelete, + { desc = "Kill Buffer" }) +vim.keymap.set("n", "bn", vim.cmd.bnext, + { desc = "Next Buffer" }) +vim.keymap.set("n", "bp", vim.cmd.bprev, + { desc = "Previous Buffer" }) + +vim.keymap.set("n", "K", vim.lsp.buf.hover) +vim.keymap.set("n", "gd", vim.lsp.buf.definition) +vim.keymap.set("n", "gt", vim.lsp.buf.type_definition) +vim.keymap.set("n", "gi", vim.lsp.buf.implementation) +vim.keymap.set("n", "ge", vim.diagnostic.goto_next) + +vim.keymap.set("n", "wh", vim.cmd.split, + { desc = "Split Window Horizontally" }) +vim.keymap.set("n", "wv", vim.cmd.vsplit, + { desc = "Split Window Vertically" }) +vim.keymap.set("n", "wc", "q", + { desc = "Close Window" }) +vim.keymap.set("n", "ww", "w", + { desc = "Next Window" }) + + +local tscope = require('telescope.builtin') +vim.keymap.set('n', 'ff', tscope.find_files, + { desc = "Find File" }) +vim.keymap.set('n', 'fb', tscope.buffers, + { desc = "Find Buffer" }) +vim.keymap.set('n', 'fh', tscope.help_tags, + { desc = "Find Help" }) +vim.keymap.set('n', 'fg', function() + tscope.grep_string( + { search = vim.fn.input("Grep > "), + desc = "Find by Grep" }); +end) + +-- Setup Plugins +require("telescope").setup({}) +require("nvim-autopairs").setup({ + disable_filetype = { "TelescopePrompt" , "vim" } +}) +require("nvim-highlight-colors").setup({}) +require("statuscol").setup({relculright = true}) +require("lualine").setup({ + options = { + icons_enabled = false, + component_separators = { left = '|', right = '|'}, + section_separators = { left = '', right = ''}, + }, + sections = { + lualine_a = {"mode","filename"}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {"diagnostics"}, + lualine_y = {}, + lualine_z = {} + } +}) +require('leap').create_default_mappings() +require('leap').opts.equivalence_classes = { + ' \t\r\n', '([{', ')]}', '\'"`' } +require("nvim-treesitter.configs").setup({ + ensure_installed = {"c", "vimdoc", "markdown", "jsonc"}, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, +}) +-- require("config.cmp") +local capabilities = require('cmp_nvim_lsp').default_capabilities() +require("lspconfig").clangd.setup({capabilities = capabilities}) +require("lspconfig").rust_analyzer.setup({}) + +-- Use Colemak Bindings +require("config.colemak") diff --git a/alpine-river/config/nvim/lua/config/cmp.lua b/alpine-river/config/nvim/lua/config/cmp.lua new file mode 100644 index 0000000..13ca020 --- /dev/null +++ b/alpine-river/config/nvim/lua/config/cmp.lua @@ -0,0 +1,30 @@ +vim.opt.completeopt={"menu", "menuone", "noselect"} + +local cmp = require'cmp' + +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'path' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) +}) diff --git a/alpine-river/config/nvim/lua/config/colemak.lua b/alpine-river/config/nvim/lua/config/colemak.lua new file mode 100644 index 0000000..a3a8d9a --- /dev/null +++ b/alpine-river/config/nvim/lua/config/colemak.lua @@ -0,0 +1,29 @@ +local function map(mode, lhs, rhs, opts) + local options = { noremap = true, silent = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.keymap.set(mode, lhs, rhs, options) +end + +map("", "n", "j") +map("", "e", "k") +map("", "i", "l") +map("", "j", "n") +map("", "k", "e") +map("", "l", "i") +map("", "K", "E") +map("", "N", "J") +map("", "E", "K") -- As in 'Explore' documentation +map("", "L", "I") +map("", "I", "L") +map("", "J", "N") + +map("n", "h", "h") +map("n", "n", "j") +map("n", "e", "k") +map("n", "i", "l") + +-- Kakoune Holdover +map ("n", "gh", "0") +map ("n", "gi", "$") diff --git a/alpine-river/config/nvim/lua/config/lazy.lua b/alpine-river/config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..f5ee74c --- /dev/null +++ b/alpine-river/config/nvim/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/alpine-river/config/nvim/lua/plugins.lua b/alpine-river/config/nvim/lua/plugins.lua new file mode 100644 index 0000000..7982b53 --- /dev/null +++ b/alpine-river/config/nvim/lua/plugins.lua @@ -0,0 +1,32 @@ +return { + {"rose-pine/neovim", as = "rose-pine"}, + {"brenoprata10/nvim-highlight-colors"}, + {"windwp/nvim-autopairs"}, + {"nvim-treesitter/nvim-treesitter"}, + {"nvim-telescope/telescope.nvim", + dependencies = {"nvim-lua/plenary.nvim"}}, + {"hrsh7th/nvim-cmp"}, + {"hrsh7th/cmp-buffer"}, + {"hrsh7th/cmp-path"}, + {"hrsh7th/cmp-nvim-lsp"}, + {"L3MON4D3/LuaSnip"}, + {"saadparwaiz1/cmp_luasnip"}, + {"ggandor/leap.nvim", + dependencies = {"tpope/vim-repeat"}}, + {"nvim-lualine/lualine.nvim"}, + {"luukvbaal/statuscol.nvim"}, + {"Exafunction/codeium.vim", event = 'BufEnter'}, + {"neovim/nvim-lspconfig", lazy = false, + dependencies = { + { "ms-jpq/coq_nvim", branch = "coq" }, + { "ms-jpq/coq.artifacts", branch = "artifacts" }, + { 'ms-jpq/coq.thirdparty', branch = "3p" } + }, + init = function() + vim.g.coq_settings = { + auto_start = true, -- if you want to start COQ at startup + -- Your COQ settings here + } + end, + } +} diff --git a/alpine-river/config/river/init b/alpine-river/config/river/init new file mode 100755 index 0000000..4bd10d9 --- /dev/null +++ b/alpine-river/config/river/init @@ -0,0 +1,200 @@ +#!/bin/sh + +# This is the example configuration file for river. +# +# If you wish to edit this, you will probably want to copy it to +# $XDG_CONFIG_HOME/river/init or $HOME/.config/river/init first. +# +# See the river(1), riverctl(1), and rivertile(1) man pages for complete +# documentation. + +# Note: the "Super" modifier is also known as Logo, GUI, Windows, Mod4, etc. + +# Super+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot) +riverctl map normal Super+Shift Return spawn footclient + +# Super+Shift F to start a floating terminal seperate from the foot server +riverctl map normal Super+Shift F spawn "foot --app-id=float-term -W 100x40 -e fish" + +# Super+D to open dmenu +riverctl map normal Super D spawn fuzzel + +# Super+W to open firefox +riverctl map normal Super W spawn firefox-esr + +# Super+L to lock +riverctl map normal Super L spawn swaylock + +# Super+Shift+Q to close the focused view +riverctl map normal Super+Shift Q close + +# Super+Shift+Control+C to exit river +riverctl map normal Super+Shift+Control C exit + +# Super+N and Super+E to focus the next/previous view in the layout stack +riverctl map normal Super N focus-view next +riverctl map normal Super E focus-view previous + +# Super+Shift+N and Super+Shift+E to swap the focused view with the next/previous +# view in the layout stack +riverctl map normal Super+Shift N swap next +riverctl map normal Super+Shift E swap previous + +# Super+Period and Super+Comma to focus the next/previous output +riverctl map normal Super Period focus-output next +riverctl map normal Super Comma focus-output previous + +# Super+Shift+{Period,Comma} to send the focused view to the next/previous output +riverctl map normal Super+Shift Period send-to-output next +riverctl map normal Super+Shift Comma send-to-output previous + +# Super+Return to bump the focused view to the top of the layout stack +riverctl map normal Super Return zoom + +# Super+H and Super+I to decrease/increase the main ratio of rivertile(1) +riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05" +riverctl map normal Super I send-layout-cmd rivertile "main-ratio +0.05" + +# Super+Shift+H and Super+Shift+I to increment/decrement the main count of rivertile(1) +riverctl map normal Super+Shift H send-layout-cmd rivertile "main-count +1" +riverctl map normal Super+Shift I send-layout-cmd rivertile "main-count -1" + +# Super+Alt+{H,N,E,I} to move views +riverctl map normal Super+Alt H move left 100 +riverctl map normal Super+Alt N move down 100 +riverctl map normal Super+Alt E move up 100 +riverctl map normal Super+Alt I move right 100 + +# Super+Alt+Control+{H,N,E,I} to snap views to screen edges +riverctl map normal Super+Alt+Control H snap left +riverctl map normal Super+Alt+Control N snap down +riverctl map normal Super+Alt+Control E snap up +riverctl map normal Super+Alt+Control I snap right + +# Super+Alt+Shift+{H,N,E,I} to resize views +riverctl map normal Super+Alt+Shift H resize horizontal -100 +riverctl map normal Super+Alt+Shift N resize vertical 100 +riverctl map normal Super+Alt+Shift E resize vertical -100 +riverctl map normal Super+Alt+Shift I resize horizontal 100 + +# Super + Left Mouse Button to move views +riverctl map-pointer normal Super BTN_LEFT move-view + +# Super + Right Mouse Button to resize views +riverctl map-pointer normal Super BTN_RIGHT resize-view + +# Super + Middle Mouse Button to toggle float +riverctl map-pointer normal Super BTN_MIDDLE toggle-float + +for i in $(seq 1 9) +do + tags=$((1 << ($i - 1))) + + # Super+[1-9] to focus tag [0-8] + riverctl map normal Super $i set-focused-tags $tags + + # Super+Shift+[1-9] to tag focused view with tag [0-8] + riverctl map normal Super+Shift $i set-view-tags $tags + + # Super+Control+[1-9] to toggle focus of tag [0-8] + riverctl map normal Super+Control $i toggle-focused-tags $tags + + # Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view + riverctl map normal Super+Shift+Control $i toggle-view-tags $tags +done + +# Super+0 to focus all tags +# Super+Shift+0 to tag focused view with all tags +all_tags=$(((1 << 32) - 1)) +riverctl map normal Super 0 set-focused-tags $all_tags +riverctl map normal Super+Shift 0 set-view-tags $all_tags + +# Super+Space to toggle float +riverctl map normal Super Space toggle-float + +# Super+F to toggle fullscreen +riverctl map normal Super F toggle-fullscreen + +# Super+{Up,Right,Down,Left} to change layout orientation +riverctl map normal Super Up send-layout-cmd rivertile "main-location top" +riverctl map normal Super Right send-layout-cmd rivertile "main-location right" +riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom" +riverctl map normal Super Left send-layout-cmd rivertile "main-location left" + +# Declare a passthrough mode. This mode has only a single mapping to return to +# normal mode. This makes it useful for testing a nested wayland compositor +riverctl declare-mode passthrough + +# Super+F11 to enter passthrough mode +riverctl map normal Super F11 enter-mode passthrough + +# Super+F11 to return to normal mode +riverctl map passthrough Super F11 enter-mode normal + +# Various media key mapping examples for both normal and locked mode which do +# not have a modifier +for mode in normal locked +do + # Eject the optical drive (well if you still have one that is) + riverctl map $mode None XF86Eject spawn 'eject -T' + + # Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer) + riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer -i 5' + riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer -d 5' + riverctl map $mode None XF86AudioMute spawn 'pamixer --toggle-mute' + + # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) + riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause' + riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause' + riverctl map $mode None XF86AudioPrev spawn 'playerctl previous' + riverctl map $mode None XF86AudioNext spawn 'playerctl next' + + # Control screen backlight brightness with brightnessctl (https://github.com/Hummer12007/brightnessctl) + riverctl map $mode None XF86MonBrightnessUp spawn 'brightnessctl set +5%' + riverctl map $mode None XF86MonBrightnessDown spawn 'brightnessctl set 5%-' +done + +# Set keyboard layout +riverctl keyboard-layout -variant "colemak" -options "ctrl:nocaps" "us" + +# Set keyboard repeat rate +riverctl set-repeat 50 300 + +# Make all windows use ssd by default +riverctl rule-add ssd + +# Make all views with an app-id that starts with "float" and title "foo" start floating. +riverctl rule-add -app-id 'float*' float + +# Make all views with app-id "bar" and any title use client-side decorations +riverctl rule-add -app-id "bar" csd + +# Focus follows Cursor +riverctl focus-follows-cursor normal + +# Hide Cursor when typing +riverctl hide-cursor when-typing enabled + +# Set Cursor Theme +riverctl xcursor-theme BreezeX-RosePine-Linux 32 + +# Set River Theme +source ~/.config/river/theme + +### TOUCHPAD +riverctl input "pointer-1739-0-Synaptics_tm2964-001" tap enabled +riverctl input "pointer-1739-0-Synaptics_tm2964-001" natural-scroll enabled +riverctl input "pointer-1739-0-Synaptics_tm2964-001" disable-while-typing enabled + +### SPAWNS +riverctl spawn "/usr/libexec/pipewire-launcher" +riverctl spawn "foot --server" +riverctl spawn "swaybg -i ~/Pictures/.wallpaper.jpg --mode fill" +riverctl spawn "wlsunset -S 07:00 -s 22:00" +riverctl spawn "waybar" +riverctl spawn "dunst" + +# Set the default layout generator to be rivertile and start it. +# River will send the process group of the init executable SIGTERM on exit. +riverctl default-layout rivertile +rivertile -view-padding 6 -outer-padding 6 & diff --git a/alpine-river/config/river/theme b/alpine-river/config/river/theme new file mode 100755 index 0000000..253e3f7 --- /dev/null +++ b/alpine-river/config/river/theme @@ -0,0 +1,19 @@ +#!/bin/sh + +# Rose Pine +rp_base=191724 +rp_text=e0def4 +rp_overlay=26233a +rp_love=eb6f92 +rp_pine=31748f +rp_gold=f6c177 +rp_foam=9ccfd8 +rp_iris=c4a7e7 +rp_rose=ebbcba +rp_text=e0def4 +rp_muted=6e6a86 + +riverctl background-color 0x$rp_base +riverctl border-color-focused 0x$rp_rose +riverctl border-color-unfocused 0x$rp_muted +riverctl border-color-urgent 0x$rp_love diff --git a/alpine-river/config/swaylock/config b/alpine-river/config/swaylock/config new file mode 100644 index 0000000..a1841a9 --- /dev/null +++ b/alpine-river/config/swaylock/config @@ -0,0 +1,48 @@ +# Font +font=FantasqueSansMono +font-size=18 + +# Background color +color=#191724 + +# Layout text colors +layout-bg-color=#00000000 +layout-border-color=#00000000 +layout-text-color=#e0def4 + +# Text color +text-color=#ebbcba +text-clear-color=#9ccfd8 +text-caps-lock-color=#f6c177 +text-ver-color=#c4a7e7 +text-wrong-color=#eb6f92 + +# Highlight segments +bs-hl-color=#19172466 +key-hl-color=#ebbcba +caps-lock-bs-hl-color=#19172466 +caps-lock-key-hl-color=#f6c177 + +# Highlight segments separator +separator-color=#00000000 + +# Inside of the indicator +inside-color=#ebbcba55 +inside-clear-color=#9ccfd855 +inside-caps-lock-color=#f6c17755 +inside-ver-color=#c4a7e755 +inside-wrong-color=#eb6f9255 + +# Line between the inside and ring +line-color=#ebbcba11 +line-clear-color=#9ccfd811 +line-caps-lock-color=#f6c17711 +line-ver-color=#c4a7e711 +line-wrong-color=#eb6f9211 + +# Indicator ring +ring-color=#ebbcbaaa +ring-clear-color=#9ccfd8aa +ring-caps-lock-color=#f6c177aa +ring-ver-color=#c4a7e7aa +ring-wrong-color=#eb6f92aa diff --git a/alpine-river/config/waybar/config b/alpine-river/config/waybar/config new file mode 100644 index 0000000..dd524e7 --- /dev/null +++ b/alpine-river/config/waybar/config @@ -0,0 +1,71 @@ +{ + "modules-left": [ + "river/tags" + ], + "modules-center": [ + "mpris" + ], + "modules-right": [ + "cpu", + "battery", + "memory", + "temperature", + "clock" + ], + "battery":{ + "format": "bat {capacity:2}%", + "states": { + "warning": 20, + "critical": 10 + }, + "tooltip": false + }, + "clock": { + "format": "{:%T}", + "format-alt": "{:%a %d-%m}", + "interval": 1, + "tooltip": false + }, + "network": { + "format-wifi": "{essid} {signalStrength}%", + "format-ethernet": "{ifname}: {ipaddr}/{cidr}", + "format-linked": "{ifname} (No IP)", + "format-disconnected": "Disconnected", + "format-alt": "{ifname}: {ipaddr}/{cidr}", + "tooltip": false + }, + "idle_inhibitor": { + "tooltip": false + }, + "cpu": { + "format": "cpu{usage:3}%", + "interval": 1, + "states": { + "warning": 50, + "critical": 90 + }, + "tooltip": false + }, + "memory": { + "format": "mem {}%", + "interval": 1, + "states": { + "warning": 50, + "critical": 90 + }, + "tooltip": false + }, + "mpris":{ + "player": "kew", + "format": "{artist} - {title}", + "tooltip": false, + "max-length": 75 + }, + "temperature": { + "format": "tmp {temperatureC}°", + "interval": 1, + "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 80, + "tooltip": false + } +} diff --git a/alpine-river/config/waybar/rose-pine.css b/alpine-river/config/waybar/rose-pine.css new file mode 100644 index 0000000..a3ae0e4 --- /dev/null +++ b/alpine-river/config/waybar/rose-pine.css @@ -0,0 +1,23 @@ +/* +* Variant: Rosé Pine +* Maintainer: DankChoir +*/ + +@define-color base #191724; +@define-color surface #1f1d2e; +@define-color overlay #26233a; + +@define-color muted #6e6a86; +@define-color subtle #908caa; +@define-color text #e0def4; + +@define-color love #eb6f92; +@define-color gold #f6c177; +@define-color rose #ebbcba; +@define-color pine #31748f; +@define-color foam #9ccfd8; +@define-color iris #c4a7e7; + +@define-color highlightLow #21202e; +@define-color highlightMed #403d52; +@define-color highlightHigh #524f67; diff --git a/alpine-river/config/waybar/style.css b/alpine-river/config/waybar/style.css new file mode 100644 index 0000000..484f6c4 --- /dev/null +++ b/alpine-river/config/waybar/style.css @@ -0,0 +1,98 @@ +@import "./rose-pine.css"; + +* { + border-radius: 0; + font-family: FantasqueSansMono; + font-size: 14pt; + min-height: 0; +} + +window#waybar { + background-color: rgba(0,0,0,0); /* transparent */ +} + +#tags { + margin-top: 12px; + margin-left: 12px; + padding: 1px; + background-color: @base; /*base02*/ + border: 2px solid @rose; /*base1*/ +} + +#tags button { + margin: 1px; + padding: 1px; + color: @text; /*base1*/ + border: 2px solid @base; /*base02*/ + + /* Disable animation on click, GTK has the stupidest defaults */ + transition-property: none; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +#tags button:hover { + box-shadow: inherit; + text-shadow: inherit; + background: @base; /*base02*/ +} + +#tags button.focused { + color: @base; /*base02*/ + background-color: @rose; /*base1*/ + border: 2px solid @base; /*base02*/ +} + +#tags button.occupied { + border: 2px solid @rose; /*base1*/ +} + +#tags button.urgent { + border: 2px solid @love; /*red*/ +} + +#tags button.occupied.urgent { + border: 2px solid @love; /*red*/ +} + +#tags button.focused.occupied { + color: @base; /*base02*/ + background-color: @rose; /*base1*/ + border: 2px solid @rose; /*base1*/ +} + +#battery, +#clock, +#mode, +#cpu, +#memory, +#mpris, +#network, +#idle_inhibitor, +#temperature { + padding: 1px 5px; + margin-top: 12px; + margin-left: 12px; + background-color: @base; /*base02*/ + color: @text; /*base1*/ + border: 2px solid @rose; /*base1*/ +} + +#clock { + margin-right: 12px; +} + +#mprimpris { + margin-left: 0px; + margin-right: 0px; +} + +#cpu.warning, +#memory.warning { + border: 2px solid @gold; /*yellow*/ +} + +#cpu.critical, +#memory.critical, +#temperature.critical { + border: 2px solid @love; /*red*/ +} diff --git a/alpine-river/config/yazi/keymap.toml b/alpine-river/config/yazi/keymap.toml new file mode 100644 index 0000000..94ca258 --- /dev/null +++ b/alpine-river/config/yazi/keymap.toml @@ -0,0 +1,96 @@ +"$schema" = "https://yazi-rs.github.io/schemas/keymap.json" + +[manager] + +prepend_keymap = [ + # { on = [ "w" ], exec = 'shell "$SHELL" --block --confirm', desc = "Open shell here" }, + # { on = [ "W" ], exec = "tasks_show" }, + + # Navigation + { on = [ "e" ], run = "arrow -1" }, + { on = [ "n" ], run = "arrow 1" }, + + { on = [ "E" ], run = "arrow -5" }, + { on = [ "N" ], run = "arrow 5" }, + + { on = [ "h" ], run = "leave" }, + { on = [ "i" ], run = "enter" }, + + { on = [ "H" ], run = "back" }, + { on = [ "I" ], run = "forward" }, + + { on = [ "" ], run = "seek -5" }, + { on = [ "" ], run = "seek 5" }, + + # Operation + { on = [ "k" ], run = "link" }, + { on = [ "K" ], run = "link --relative" }, + + # Find + { on = [ "j" ], run = "find_arrow" }, + { on = [ "J" ], run = "find_arrow --previous" }, +] + +[tasks] + +prepend_keymap = [ + { on = [ "W" ], run = "close" }, + + { on = [ "e" ], run = "arrow -1" }, + { on = [ "n" ], run = "arrow 1" }, +] + +[select] + +prepend_keymap = [ + { on = [ "e" ], run = "arrow -1" }, + { on = [ "n" ], run = "arrow 1" }, + + { on = [ "E" ], run = "arrow -5" }, + { on = [ "N" ], run = "arrow 5" }, +] + +[input] + +prepend_keymap = [ + # Mode + { on = [ "l" ], run = "insert" }, + { on = [ "" ], run = [ "move -999", "insert" ] }, + { on = [ "" ], run = [ "move 999", "insert --append" ] }, + + # Character-wise movement + { on = [ "h" ], run = "move -1" }, + { on = [ "i" ], run = "move 1" }, + + # Word-wise movement + { on = [ "=" ], run = "forward --end-of-word" }, + + # Line-wise movement + { on = [ "H" ], run = "move -999" }, + { on = [ "I" ], run = "move 999" }, + + # Cut/Yank/Paste + { on = [ "x" ], run = [ "delete", "move 1 --in-operating" ] }, + + # Undo/Redo + { on = [ "u" ], run = "undo" }, + { on = [ "U" ], run = "redo" }, +] + +[completion] + +prepend_keymap = [ + { on = [ "" ], run = "arrow -1" }, + { on = [ "" ], run = "arrow 1" }, +] + +[help] + +prepend_keymap = [ + # Navigation + { on = [ "e" ], run = "arrow -1" }, + { on = [ "n" ], run = "arrow 1" }, + + { on = [ "E" ], run = "arrow -5" }, + { on = [ "N" ], run = "arrow 5" }, +] diff --git a/alpine-river/config/yazi/rose-pine.tmTheme b/alpine-river/config/yazi/rose-pine.tmTheme new file mode 100644 index 0000000..e90da85 --- /dev/null +++ b/alpine-river/config/yazi/rose-pine.tmTheme @@ -0,0 +1,959 @@ + + + + + name + Catppuccin + settings + + + settings + + foreground + #908caa + background + #191724 + caret + #E0DEF4 + invisibles + #e0def4 + gutterForeground + #575279 + gutterForegroundHighlight + #9ccfd8 + lineHighlight + #26233A + selection + #393552 + selectionBorder + #191724 + activeGuide + #eb6f92 + findHighlightForeground + #181825 + findHighlight + #f6c177 + bracketsForeground + #575279 + bracketContentsForeground + #575279 + + + + name + Comment + scope + comment + settings + + foreground + #393552 + fontStyle + italic + + + + name + String + scope + string + settings + + foreground + #9ccfd8 + fontStyle + + + + + name + String regex + scope + string.regexp + settings + + foreground + #eb6f92 + fontStyle + + + + + name + Number + scope + constant.numeric + settings + + foreground + #eb6f92 + fontStyle + + + + + name + Boolean + scope + constant.language.boolean + settings + + foreground + #eb6f92 + fontStyle + bold italic + + + + name + Built-in constant + scope + constant.language + settings + + foreground + #E0DEF4 + fontStyle + italic + + + + name + Built-in function + scope + support.function.builtin + settings + + foreground + #eb6f92 + fontStyle + italic + + + + name + User-defined constant + scope + variable.other.constant + settings + + foreground + #eb6f92 + fontStyle + + + + + name + Variable + scope + variable + settings + + + + name + Keyword + scope + keyword + settings + + foreground + #eb6f92 + fontStyle + italic + + + + name + Conditional/loop + scope + keyword.control.loop, keyword.control.conditional, keyword.control.c++ + settings + + foreground + #cba6f7 + fontStyle + bold + + + + name + Return + scope + keyword.control.return, keyword.control.flow.return + settings + + foreground + #B4637A + fontStyle + bold + + + + name + Exception + scope + support.type.exception + settings + + foreground + #eb6f92 + fontStyle + italic + + + + name + Operator + scope + keyword.operator, punctuation.accessor + settings + + foreground + #89dceb + fontStyle + bold + + + + name + Punctuation separator + scope + punctuation.separator + settings + + foreground + #9ccfd8 + fontStyle + + + + + name + Punctuation terminator + scope + punctuation.terminator + settings + + foreground + #9ccfd8 + fontStyle + + + + + name + Punctuation bracket + scope + punctuation.section + settings + + foreground + #575279 + fontStyle + + + + + name + Include + scope + keyword.control.import.include + settings + + foreground + #9ccfd8 + fontStyle + italic + + + + name + Storage + scope + storage + settings + + foreground + #f38ba8 + fontStyle + + + + + name + Storage type + scope + storage.type + settings + + foreground + #f6c177 + fontStyle + italic + + + + name + Storage modifier + scope + storage.modifier + settings + + foreground + #f38ba8 + fontStyle + + + + + name + Storage type namespace + scope + entity.name.namespace, meta.path + settings + + foreground + #74658B + fontStyle + italic + + + + name + Storage type class + scope + storage.type.class + settings + + foreground + #74658B + fontStyle + italic + + + + name + Label + scope + entity.name.label + settings + + foreground + #31748F + fontStyle + + + + + name + Keyword class + scope + keyword.declaration.class + settings + + foreground + #f38ba8 + fontStyle + italic + + + + name + Class name + scope + entity.name.class, meta.toc-list.full-identifier + settings + + foreground + #89dceb + fontStyle + + + + + name + Inherited class + scope + entity.other.inherited-class + settings + + foreground + #89dceb + fontStyle + italic + + + + name + Function name + scope + entity.name.function, variable.function + settings + + foreground + #31748F + fontStyle + italic + + + + name + Function macro + scope + entity.name.function.preprocessor + settings + + foreground + #f38ba8 + fontStyle + + + + + name + Macro directive - ifdef + scope + keyword.control.import + settings + + foreground + #f38ba8 + fontStyle + + + + + name + Constructor + scope + entity.name.function.constructor, entity.name.function.destructor + settings + + foreground + #E0DEF4 + fontStyle + + + + + name + Function argument + scope + variable.parameter.function + settings + + foreground + #74658B + fontStyle + italic + + + + name + Function declaration + scope + keyword.declaration.function + settings + + foreground + #eba0ac + fontStyle + italic + + + + name + Library function + scope + support.function + settings + + foreground + #89dceb + fontStyle + + + + + name + Library constant + scope + support.constant + settings + + foreground + #31748F + fontStyle + + + + + name + Library class/type + scope + support.type, support.class + settings + + foreground + #31748F + fontStyle + italic + + + + name + Library variable + scope + support.other.variable + settings + + fontStyle + + + + + name + Variable function + scope + variable.function + settings + + foreground + #31748F + fontStyle + italic + + + + name + Variable parameter + scope + variable.parameter + settings + + foreground + #74658B + fontStyle + italic + + + + name + Variable other + scope + variable.other + settings + + foreground + #908caa + fontStyle + italic + + + + name + Variable field + scope + variable.other.member + settings + + foreground + #74658B + fontStyle + + + + + name + Variable language + scope + variable.language + settings + + foreground + #9ccfd8 + fontStyle + + + + + name + Tag name + scope + entity.name.tag + settings + + foreground + #eb6f92 + fontStyle + + + + + name + Tag attribute + scope + entity.other.attribute-name + settings + + foreground + #cba6f7 + fontStyle + italic + + + + name + Tag delimiter + scope + punctuation.definition.tag + settings + + foreground + #eba0ac + fontStyle + + + + + name + Markdown URL + scope + markup.underline.link.markdown + settings + + foreground + #74658B + fontStyle + italic underline + + + + name + Markdown reference + scope + meta.link.inline.description + settings + + foreground + #74658B + fontStyle + bold + + + + name + Markdown literal + scope + comment.block.markdown, meta.code-fence, markup.raw.code-fence, markup.raw.inline + settings + + foreground + #9ccfd8 + fontStyle + italic + + + + name + Markdown title + scope + punctuation.definition.heading, entity.name.section + settings + + foreground + #31748F + fontStyle + bold + + + + name + Markdown emphasis + scope + markup.italic + settings + + foreground + #eba0ac + fontStyle + italic + + + + name + Markdown strong + scope + markup.bold + settings + + foreground + #eba0ac + fontStyle + bold + + + + name + Escape + scope + constant.character.escape + settings + + foreground + #B4637A + fontStyle + + + + + name + Bash built-in function + scope + source.shell.bash meta.function.shell meta.compound.shell meta.function-call.identifier.shell + settings + + foreground + #B4637A + fontStyle + + + + + name + Bash parameter + scope + variable.language.shell + settings + + foreground + #f38ba8 + fontStyle + italic + + + + name + Lua field + scope + source.lua meta.function.lua meta.block.lua meta.mapping.value.lua meta.mapping.key.lua string.unquoted.key.lua + settings + + foreground + #E0DEF4 + fontStyle + italic + + + + name + Lua constructor + scope + source.lua meta.function.lua meta.block.lua meta.mapping.key.lua string.unquoted.key.lua + settings + + foreground + #E0DEF4 + fontStyle + + + + + name + Java constant + scope + entity.name.constant.java + settings + + foreground + #9ccfd8 + fontStyle + + + + + name + CSS property + scope + support.type.property-name.css + settings + + foreground + #E0DEF4 + fontStyle + italic + + + + name + CSS constant + scope + support.constant.property-value.css + settings + + foreground + #908caa + fontStyle + + + + + name + CSS suffix + scope + constant.numeric.suffix.css, keyword.other.unit.css + settings + + foreground + #9ccfd8 + fontStyle + italic + + + + name + CSS variable property + scope + variable.other.custom-property.name.css, support.type.custom-property.name.css, punctuation.definition.custom-property.css + settings + + foreground + #9ccfd8 + fontStyle + + + + + name + SCSS tag + scope + entity.name.tag.css + settings + + foreground + #E0DEF4 + fontStyle + + + + + name + SASS variable + scope + variable.other.sass + settings + + foreground + #9ccfd8 + fontStyle + + + + + name + Invalid + scope + invalid + settings + + foreground + #908caa + background + #f38ba8 + fontStyle + + + + + name + Invalid deprecated + scope + invalid.deprecated + settings + + foreground + #908caa + background + #cba6f7 + fontStyle + + + + + name + Diff header + scope + meta.diff, meta.diff.header + settings + + foreground + #393552 + fontStyle + + + + + name + Diff deleted + scope + markup.deleted + settings + + foreground + #f38ba8 + fontStyle + + + + + name + Diff inserted + scope + markup.inserted + settings + + foreground + #9ccfd8 + fontStyle + + + + + name + Diff changed + scope + markup.changed + settings + + foreground + #f6c177 + fontStyle + + + + + name + Message error + scope + message.error + settings + + foreground + #f38ba8 + fontStyle + + + + + uuid + 4d0379b5-ef82-467b-b8b8-365889420646 + colorSpaceName + sRGB + semanticClass + theme.dark.Catppuccin + author + BrunDerSchwarzmagier + + diff --git a/alpine-river/config/yazi/theme.toml b/alpine-river/config/yazi/theme.toml new file mode 100644 index 0000000..2c92781 --- /dev/null +++ b/alpine-river/config/yazi/theme.toml @@ -0,0 +1,153 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +# : Manager {{{ + +[manager] +cwd = { fg = "#9ccfd8" } + +# Hovered +hovered = { fg = "#e0def4", bg = "#26233a" } +preview_hovered = { underline = true } + +# Find +find_keyword = { fg = "#f6c177", italic = true } +find_position = { fg = "#eb6f92", bg = "reset", italic = true } + +# Marker +marker_selected = { fg = "#9ccfd8", bg = "#9ccfd8" } +marker_copied = { fg = "#f6c177", bg = "#f6c177" } +marker_cut = { fg = "#B4637A", bg = "#B4637A" } + +# Tab +tab_active = { fg = "#e0def4", bg = "#191724" } +tab_inactive = { fg = "#e0def4", bg = "#2A273F" } +tab_width = 1 + +# Border +border_symbol = "│" +border_style = { fg = "#524f67" } + +# Highlighting +syntect_theme = "~/.config/yazi/rose-pine.tmTheme" + +# : }}} + + +# : Status {{{ + +[status] +separator_open = "" +separator_close = "" +separator_style = { fg = "#2A273F", bg = "#2A273F" } + +# Mode +mode_normal = { fg = "#191724", bg = "#ebbcba", bold = true } +mode_select = { fg = "#e0def4", bg = "#9ccfd8", bold = true } +mode_unset = { fg = "#e0def4", bg = "#b4637a", bold = true } + +# Progress +progress_label = { fg = "#e0def4", bold = true } +progress_normal = { fg = "#191724", bg = "#2A273F" } +progress_error = { fg = "#B4637A", bg = "#2A273F" } + +# Permissions +permissions_t = { fg = "#31748f" } +permissions_r = { fg = "#f6c177" } +permissions_w = { fg = "#B4637A" } +permissions_x = { fg = "#9ccfd8" } +permissions_s = { fg = "#524f67" } + +# : }}} + + +# : Input {{{ + +[input] +border = { fg = "#524f67" } +title = {} +value = {} +selected = { reversed = true } + +# : }}} + + +# : Select {{{ + +[select] +border = { fg = "#524f67" } +active = { fg = "#eb6f92" } +inactive = {} + +# : }}} + + +# : Tasks {{{ + +[tasks] +border = { fg = "#524f67" } +title = {} +hovered = { underline = true } + +# : }}} + + +# : Which {{{ + +[which] +mask = { bg = "#313244" } +cand = { fg = "#9ccfd8" } +rest = { fg = "#9399b2" } +desc = { fg = "#eb6f92" } +separator = "  " +separator_style = { fg = "#585b70" } + +# : }}} + + +# : Help {{{ + +[help] +on = { fg = "#eb6f92" } +exec = { fg = "#9ccfd8" } +desc = { fg = "#9399b2" } +hovered = { bg = "#585b70", bold = true } +footer = { fg = "#2A273F", bg = "#e0def4" } + +# : }}} + + +# : File-specific styles {{{ + +[filetype] + +rules = [ + # Images + { mime = "image/*", fg = "#9ccfd8" }, + + # Videos + { mime = "video/*", fg = "#f6c177" }, + { mime = "audio/*", fg = "#f6c177" }, + + # Archives + { mime = "application/zip", fg = "#eb6f92" }, + { mime = "application/gzip", fg = "#eb6f92" }, + { mime = "application/x-tar", fg = "#eb6f92" }, + { mime = "application/x-bzip", fg = "#eb6f92" }, + { mime = "application/x-bzip2", fg = "#eb6f92" }, + { mime = "application/x-7z-compressed", fg = "#eb6f92" }, + { mime = "application/x-rar", fg = "#eb6f92" }, + + # Fallback + { name = "*", fg = "#e0def4" }, + { name = "*/", fg = "#524f67" }, +] + +# : }}} + +# Disable Nerds +[icon] +globs = [] +dirs = [] +files = [] +exts = [] +conds = [] diff --git a/alpine-river/config/yazi/yazi.toml b/alpine-river/config/yazi/yazi.toml new file mode 100644 index 0000000..4e4a4e2 --- /dev/null +++ b/alpine-river/config/yazi/yazi.toml @@ -0,0 +1,6 @@ +[manager] +# show_hidden = true +sort_by = "modified" +sort_reverse = true +linemode = "size" +scrolloff = 12 diff --git a/alpine-river/local/bin/dry b/alpine-river/local/bin/dry new file mode 100755 index 0000000..0bca4a0 Binary files /dev/null and b/alpine-river/local/bin/dry differ diff --git a/alpine-river/local/bin/kanata b/alpine-river/local/bin/kanata new file mode 100755 index 0000000..a88cf14 Binary files /dev/null and b/alpine-river/local/bin/kanata differ diff --git a/alpine-river/local/bin/kew b/alpine-river/local/bin/kew new file mode 100755 index 0000000..7949cec Binary files /dev/null and b/alpine-river/local/bin/kew differ diff --git a/alpine-river/local/bin/take-slurpshot b/alpine-river/local/bin/take-slurpshot new file mode 100755 index 0000000..0edc9ec --- /dev/null +++ b/alpine-river/local/bin/take-slurpshot @@ -0,0 +1,18 @@ +#!/bin/bash + +# Generate base filename with timestamp +base_filename=$(date +"%m-%d-%Y_%H-%M-%S") +extension=".png" + +# Initialize full filename +filename="${base_filename}${extension}" +counter=1 + +# Check if file exists and append incremental suffix if needed +while [[ -e "$filename" ]]; do + filename="${base_filename}-${counter}${extension}" + ((counter++)) +done + +# Output the available filename +wayshot -f "$HOME/Pictures/Screenshots/$filename" -s "$(slurp)" diff --git a/alpine-river/local/bin/ya b/alpine-river/local/bin/ya new file mode 100755 index 0000000..7a8ee1d Binary files /dev/null and b/alpine-river/local/bin/ya differ diff --git a/alpine-river/local/bin/yazi b/alpine-river/local/bin/yazi new file mode 100755 index 0000000..5ce96d0 Binary files /dev/null and b/alpine-river/local/bin/yazi differ diff --git a/alpine-river/profile b/alpine-river/profile new file mode 100644 index 0000000..49fd884 --- /dev/null +++ b/alpine-river/profile @@ -0,0 +1,17 @@ +export XDG_SESSION_TYPE=wayland +export XDG_CURRENT_DESKTOP=river +export LIBSEAT_BACKEND=seatd + +# Setup XDG_RUNTIME_DIR +if [ -z "$XDG_RUNTIME_DIR" ]; then + XDG_RUNTIME_DIR="/tmp/$(id -u)-runtime-dir" + + mkdir -pm 0700 "$XDG_RUNTIME_DIR" + export XDG_RUNTIME_DIR +fi + +# Start River +if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then + exec dbus-run-session river > ~/.river.log 2>&1 +fi +. "$HOME/.cargo/env" diff --git a/alpine-river/screenshot.png b/alpine-river/screenshot.png new file mode 100644 index 0000000..310ae10 Binary files /dev/null and b/alpine-river/screenshot.png differ diff --git a/alpine-river/tmux.conf b/alpine-river/tmux.conf new file mode 100644 index 0000000..8edbe2c --- /dev/null +++ b/alpine-river/tmux.conf @@ -0,0 +1,76 @@ +# Set Shell to ZSH +set-option -g default-shell /usr/bin/fish + +# Use C-t and C-n for the prefix +set-option -g prefix C-space + +# Easy Config Reload +bind-key r source-file ~/.tmux.conf \; display-message "Config reloaded" + +# Mouse Mode +set -g mouse on + +# Fix Colors +set -g default-terminal "screen-256color" +set -ga terminal-overrides ",*col*:Tc" + +# Switch Pane Keys +bind-key h select-pane -L +bind-key i select-pane -R +bind-key e select-pane -U +bind-key n select-pane -D + +# Easier Splitting +bind-key v split-window -h -c "#{pane_current_path}" +bind-key s split-window -v -c "#{pane_current_path}" + +# Quick Create and tab through windows +# bind-key -n C-Tab next-window +# bind-key -n C-S-Tab previous-window +bind-key Tab next-window +bind-key k kill-window +bind-key c new-window + +# Fix delay on vim escape +set -s escape-time 0 + +# Change background color of a tab when activity occurs +setw -g monitor-activity on + +# Do NOT reset the color of the tab after activity stops occuring +setw -g monitor-silence 0 + +# Disable bell +setw -g monitor-bell off + +# Disable visual text box when activity occurs +set -g visual-activity off + +# Images in TMUX +set -g allow-passthrough all +set -ga update-environment TERM +set -ga update-environment TERM_PROGRAM + +# mpris + +# tmux2k +set -g @tmux2k-start-icon "λ" +set -g @tmux2k-theme 'duo' +set -g @tmux2k-duo-bg '#ebbcba' +set -g @tmux2k-duo-fg '#191724' +set -g @tmux2k-icons-only true +set -g @tmux2k-left-plugins " " +set -g @tmux2k-right-plugins " " +set -g @tmux2k-refresh-rate 1 +set -g @tmux2k-window-list-alignment "left" +set -g @tmux2k-compact-windows false #remove +set -g @tmux2k-military-time true +set -g @tmux2k-day-month true + +# TMUX Packages + +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'venomade/tmux2k' + +run '~/.tmux/plugins/tpm/tpm' diff --git a/alpine-river/world b/alpine-river/world new file mode 100644 index 0000000..84c3419 --- /dev/null +++ b/alpine-river/world @@ -0,0 +1,93 @@ +alpine-base +bash +bat +brightnessctl +btop +busybox-doc +busybox-mdev-openrc +chafa-libs +clang19-extra-tools +curl +dbus +doas +docker +docker-doc +dosfstools +dunst +e2fsprogs +emacs-doc +emacs-pgtk-nativecomp +eudev +eza +faad2-libs +fastfetch +fd +fftw-single-libs +file +firefox-esr +fish +font-iosevka +font-noto +font-noto-cjk +font-roboto +foot +fuse3 +fuzzel +fzf +gcompat +git +grep +grub-efi +iw +lazygit +libtag +libva-intel-driver +linux-firmware-i915 +linux-firmware-intel +linux-firmware-mediatek +linux-firmware-other +linux-firmware-rtl_bt +linux-lts +maim +make +man-pages +mandoc +mesa-dri-gallium +mesa-va-gallium +mpv +ncpamixer +neovim +neovim-doc +openntpd +openssh +openssl +opusfile +pamixer +pipewire +pipewire-pulse +playerctl +rclone +ripgrep +river +river-doc +seatd +slurp +swaybg +swayidle +swayidle-doc +swaylock +tmux +udev +udev-init-scripts +udev-init-scripts-openrc +unzip +waybar +waybar-doc +wayshot +wf-recorder +wireplumber +wl-clipboard +wlr-randr +wlsunset +wpa_supplicant +xdg-utils diff --git a/emacs-elisp/config.el b/emacs-elisp/config.el new file mode 100644 index 0000000..53412e1 --- /dev/null +++ b/emacs-elisp/config.el @@ -0,0 +1,47 @@ +(defun dir-load (dir config) + (load-file + (expand-file-name + (concat dir "/" config ".el") + user-emacs-directory))) + +(defun cfg-load (config) + (dir-load "config" config)) + +(defun pkg-load (config) + (dir-load "packages" config)) + +(defun lang-load (config) + (dir-load "languages" config)) + +;; Configs +(cfg-load "straight") +(cfg-load "theme") +(cfg-load "fonts") +(cfg-load "functions") +(cfg-load "shortcuts") +(cfg-load "misc") +(cfg-load "orgmode") +(cfg-load "project") + +;; Packages +(pkg-load "avy") +(pkg-load "corfu") +(pkg-load "cape") +(pkg-load "flycheck") +(pkg-load "smartparens") +(pkg-load "devdocs") +(pkg-load "counsel") +(pkg-load "movetext") +(pkg-load "whichkey") +(pkg-load "lsp") +(pkg-load "magit") +(pkg-load "undotree") +(pkg-load "simplemdln") +(pkg-load "multicursor") +(pkg-load "rainbow") + +;; Languages +(lang-load "rust") +(lang-load "c-cpp") +(lang-load "scheme") +(lang-load "clojure") diff --git a/emacs-elisp/config/fonts.el b/emacs-elisp/config/fonts.el new file mode 100644 index 0000000..7e951af --- /dev/null +++ b/emacs-elisp/config/fonts.el @@ -0,0 +1,74 @@ +;; Set Fonts and their size +(defvar customfontsettings + '((mono . "Iosevka") + (variabl . "RobotoCondensed") + (size . 14))) + +(set-face-attribute 'variable-pitch nil + :font (cdr (assoc 'variabl customfontsettings)) + :height (* (cdr (assoc 'size customfontsettings)) 10) + :weight 'regular) + +(set-face-attribute 'fixed-pitch nil + :font (cdr (assoc 'mono customfontsettings)) + :height (* (cdr (assoc 'size customfontsettings)) 10) + :weight 'regular) + +(set-face-attribute 'default nil + :font (cdr (assoc 'mono customfontsettings)) + :height (* (cdr (assoc 'size customfontsettings)) 10) + :weight 'regular) + + +(add-to-list 'default-frame-alist + `(font . ,(concat (cdr (assoc 'mono customfontsettings)) "-" (number-to-string (cdr (assoc 'size customfontsettings)))))) + +(set-face-attribute 'font-lock-comment-face nil + :slant 'italic) + +(set-face-attribute 'font-lock-keyword-face nil + :slant 'italic) + +;; Set mode-line font +(set-face-attribute 'mode-line nil :inherit 'variable-pitch) +(set-face-attribute 'mode-line-inactive nil :inherit 'variable-pitch) + +;; Set Usable Ligatures +(dolist (char/ligature-re + `((?- . ,(rx (or (or "-->" "-<<" "->>" "-|" "-~" "-<" "->") (+ "-")))) + (?/ . ,(rx (or (or "/==" "/=" "/>" "/**" "/*") (+ "/")))) + (?* . ,(rx (or (or "*>" "*/") (+ "*")))) + (?< . ,(rx (or (or "<<=" "<<-" "<|||" "<==>" "" "-<<" "->>" "-|" "-~" "-<" "->") (+ "-")))) + (?/ . ,(rx (or (or "/==" "/=" "/>" "/**" "/*") (+ "/")))) + (?* . ,(rx (or (or "*>" "*/") (+ "*")))) + (?< . ,(rx (or (or "<<=" "<<-" "<|||" "<==>" " doFloat, + resource =? "desktop_window" --> doIgnore + ] + +------------------------------------------------------------------------ +-- Event handling + +-- * EwmhDesktops users should change this to ewmhDesktopsEventHook + +-- +-- Defines a custom handler function for X Events. The function should +-- return (All True) if the default handler is to be run afterwards. To +-- combine event hooks use mappend or mconcat from Data.Monoid. +-- +-- myEventHook = mempty +myEventHook = docksEventHook <+> handleEventHook def <+> fullscreenEventHook + +------------------------------------------------------------------------ +-- Status bars and logging + +-- Perform an arbitrary action on each internal state change or X event. +-- See the 'XMonad.Hooks.DynamicLog' extension for examples. +-- +myLogHook = return () + +------------------------------------------------------------------------ +-- Startup hook + +-- Perform an arbitrary action each time xmonad starts or is restarted +-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize +-- per-workspace layout choices. +-- +-- By default, do nothing. +myStartupHook = do + spawnOnce "setxkbmap -layout us -variant colemak -option caps:escape" + spawnOnce "xsetroot -cursor_name left_ptr" + spawnOnce "feh --bg-scale ~/.wallpapers/PastelPinkLightning.jpg &" + spawnOnce "picom &" + spawnOnce "clipmenud &" + +------------------------------------------------------------------------ +-- XMobar + +myPP = + xmobarPP + { ppCurrent = xmobarColor "#907F9B" "" . wrap "" "", + ppTitle = xmobarColor "#C7B2D3" "" . shorten 100, + ppSep = " | ", + ppOrder = \(ws : _ : t : _) -> [ws, t] + } + +toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b) + +------------------------------------------------------------------------ +-- Now run xmonad with all the defaults we set up. + +-- Run xmonad with the settings you specify. No need to modify this. +-- +-- main = do +-- xmproc <- spawnPipe "xmobar -x 0 /home/venomade/.xmobarrc" +-- xmonad $ docks defaults +main = xmonad =<< statusBar "xmobar" myPP toggleStrutsKey defaults + +-- A structure containing your configuration settings, overriding +-- fields in the default config. Any you don't override, will +-- use the defaults defined in xmonad/XMonad/Config.hs +-- +-- No need to modify this. +-- +defaults = + def + { -- simple stuff + terminal = myTerminal, + focusFollowsMouse = myFocusFollowsMouse, + clickJustFocuses = myClickJustFocuses, + borderWidth = myBorderWidth, + modMask = myModMask, + workspaces = myWorkspaces, + normalBorderColor = myNormalBorderColor, + focusedBorderColor = myFocusedBorderColor, + -- key bindings + keys = myKeys, + mouseBindings = myMouseBindings, + -- hooks, layouts + layoutHook = myLayout, + manageHook = myManageHook, + handleEventHook = myEventHook, + logHook = myLogHook, + startupHook = myStartupHook + } + +-- | Finally, a copy of the default bindings in simple textual tabular format. +help :: String +help = unlines ["Read xmonad.hs"] diff --git a/nixos/config/zshrc b/nixos/config/zshrc new file mode 100644 index 0000000..7c2e8cb --- /dev/null +++ b/nixos/config/zshrc @@ -0,0 +1,34 @@ +autoload -U compinit +compinit + +setopt COMPLETE_IN_WORD + +eval "$(starship init zsh)" + +#source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +#source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh + +DISABLE_AUTO_TITLE="true" + +function set_terminal_title() { + echo -en "\e]2;$@\a" +} + +HISTFILE=~/.zsh_history +HISTSIZE=10000 +SAVEHIST=10000 +setopt appendhistory +setopt SHARE_HISTORY + +bindkey "^[[H" beginning-of-line +bindkey "^[[F" end-of-line +bindkey "^[[3~" delete-char + +alias l=eza +alias ls="eza -T" + +alias vim=nvim + +export path=($HOME/.local/bin $path) + +[ -f "/home/venomade/.ghcup/env" ] && source "/home/venomade/.ghcup/env" # ghcup-env diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 0000000..4848515 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,281 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "thinkpad"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/London"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_GB.UTF-8"; + LC_IDENTIFICATION = "en_GB.UTF-8"; + LC_MEASUREMENT = "en_GB.UTF-8"; + LC_MONETARY = "en_GB.UTF-8"; + LC_NAME = "en_GB.UTF-8"; + LC_NUMERIC = "en_GB.UTF-8"; + LC_PAPER = "en_GB.UTF-8"; + LC_TELEPHONE = "en_GB.UTF-8"; + LC_TIME = "en_GB.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.excludePackages = [ + pkgs.xterm + ]; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + environment.gnome.excludePackages = with pkgs; [ + epiphany + gnome-connections + gnome-tour + gnome.geary + gnome.gnome-characters + gnome.gnome-contacts + gnome.gnome-maps + gnome.gnome-music + gnome.simple-scan + gnome.totem + gnome.yelp + snapshot + ]; + + services.xserver.libinput = { + enable = true; + touchpad = { + naturalScrolling = true; + }; + }; + + services.xserver.displayManager = { + defaultSession = "none+xmonad"; + #lightdm = { + # enable = true; + # greeter.enable = false; + #}; + #autoLogin = { + # enable = true; + # user = "venomade"; + #}; + }; + + services.xserver.windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + config = builtins.readFile config/xmonad.hs; + }; + + services.picom = { + enable = true; + settings = { + shadow = true; + shadow-radius = 7; + shadow-offset-x = -7; + shadow-offset-y = -7; + fading = true; + fade-in-step = 0.2; + fade-out-step = 0.2; + inactive-opacity-override = false; + corner-radius = 4; + rounded-corners-exclude = [ + "window_type = 'dock'" + "window_type = 'desktop'" + ]; + blur-method = "dual_kawase"; + blur-size = 12; + blur-strength = 5; + blur-kern = "3x3box"; + backend = "glx"; + vsync = true; + mark-wmwin-focused = true; + mark-ovredir-focused = true; + detect-rounded-corners = true; + detect-client-opacity = true; + detect-transient = true; + use-damage = true; + }; + }; + + # Location (It's approximate) + location = { + provider = "manual"; + longitude = 52.2; + latitude = 0.1; + }; + + # Redshift + services.redshift = { + enable = true; + brightness = { + day = "1"; + night = "1"; + }; + temperature = { + day = 5500; + night = 3700; + }; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = "colemak"; + xkbOptions = "caps:escape"; + }; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.venomade = { + isNormalUser = true; + description = "Venomade"; + extraGroups = [ "networkmanager" "wheel" ]; + shell = pkgs.zsh; + packages = with pkgs; [ + clang-tools + eza + firefox + gcc + ghc + haskellPackages.haskell-language-server + hut + musikcube + neovim + nil + nodejs_21 + protonvpn-cli_2 + starship + zsh + ]; + }; + + programs.zsh = { + enable = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + }; + + home-manager = { + # also pass inputs to home-manager modules + extraSpecialArgs = {inherit inputs;}; + users = { + "venomade" = import ./home.nix; + }; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + git + vim + wget + # XMonad + (dmenu.override { + patches = [ + config/dmenu.patch + ]; + }) + feh + haskellPackages.xmobar + j4-dmenu-desktop + kitty + ncpamixer + nerdfonts + playerctl + pulseaudio + tomato-c + zathura + ranger + redshift + # DMScripts + clipmenu + didyoumean + jq + xclip + translate-shell + # Laptop + brightnessctl + # NixOS is not linux + steam-run + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # NixOS is not linux + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + +} diff --git a/nixos/flake.lock b/nixos/flake.lock new file mode 100644 index 0000000..7442090 --- /dev/null +++ b/nixos/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704980804, + "narHash": "sha256-lPNNKdPqIYcjhhYIVwlajNt/HqVWbMOoSdNnwCvOP04=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "93e804e7f8a1eb88bde6117cd5046501e66aa4bd", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1704722960, + "narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nixos/flake.nix b/nixos/flake.nix new file mode 100644 index 0000000..921f28b --- /dev/null +++ b/nixos/flake.nix @@ -0,0 +1,28 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, ... }@inputs: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + + nixosConfigurations.default = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./configuration.nix + inputs.home-manager.nixosModules.default + ]; + }; + }; +} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix new file mode 100644 index 0000000..c2e9413 --- /dev/null +++ b/nixos/hardware-configuration.nix @@ -0,0 +1,39 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/01b1bbcb-ffab-488b-932a-f30551cb8d73"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/EA66-E4EE"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp2s0f0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/home.nix b/nixos/home.nix new file mode 100644 index 0000000..cfc4090 --- /dev/null +++ b/nixos/home.nix @@ -0,0 +1,117 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "venomade"; + home.homeDirectory = "/home/venomade"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + ".config/dmscripts/config".source = config/dmscripts-conf; + ".config/kitty/kitty.conf".source = config/kitty.conf; + ".config/picom/picom.conf".source = config/picom.conf; + ".config/ranger/rc.conf".source = config/rc.conf; + ".ghci".source = config/ghci; + ".vim/coc-settings.json".source = config/coc-settings.json; + ".vimrc".source = config/vimrc; + ".xmobarrc".source = config/xmobarrc; + ".zshrc".source = config/zshrc; + }; + + home.file."neovim" = { + source = ./config/neovim; + target = ".config/nvim"; + recursive = true; + }; + + home.file."scripts" = { + source = ./scripts; + target = ".local/bin"; + recursive = true; + }; + + home.file."wallpapers" = { + source = ./wallpapers; + target = ".wallpapers"; + recursive = true; + }; + + home.file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ"; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. If you don't want to manage your shell through Home + # Manager then you have to manually source 'hm-session-vars.sh' located at + # either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/venomade/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + programs.git = { + enable = true; + userEmail = "venomade@venomade.com"; + userName = "venomade"; + }; + + # Configure X11 Cursor + xsession.pointerCursor = { + package = pkgs.gnome.adwaita-icon-theme; + name = "Adwaita"; + size = 38; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/nixos/scripts/_dm-helper.sh b/nixos/scripts/_dm-helper.sh new file mode 100755 index 0000000..78a33d0 --- /dev/null +++ b/nixos/scripts/_dm-helper.sh @@ -0,0 +1,196 @@ +#!/usr/bin/env bash + +# Script name: _dm-helper +# Description: A helper script for the other scripts in the collection. +# Dependencies: +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: Simon Ingelsson +# HostGrady +# aryak1 + +set -euo pipefail + +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + echo "This is a helper-script it does not do anything on its own." + exit 1 +fi + +###################### +# Error handling # +###################### + +# Simple warn function +warn() { + printf 'Warn: %s\n' "$1" +} + +# Simple error function +err() { + printf 'Error: %s\n' "$1" + exit 1 +} + +############################ +# Dislay server checks # +############################ + +# Boiler code for if you want to do something with display servers + +#function() { +# case "$XDG_SESSION_TYPE" in +# 'x11') something with x;; +# 'wayland') something with wayland;; +# *) err "Unknown display server";; +# esac +#} + +# Function to copy to clipboard with different tools depending on the display server +cp2cb() { + case "$XDG_SESSION_TYPE" in + 'x11') xclip -r -selection clipboard ;; + 'wayland') wl-copy -n ;; + *) err "Unknown display server" ;; + esac +} + +grep-desktop() { + case "$XDG_SESSION_TYPE" in + 'x11') grep "Name=" /usr/share/xsessions/*.desktop | cut -d'=' -f2 ;; + 'wayland') grep "Name=" /usr/share/wayland-sessions/*.desktop | cut -d'=' -f2 || grep "Name=" /usr/share/xsessions/*.desktop | grep -i "wayland" | cut -d'=' -f2 | cut -d' ' -f1 ;; + *) err "Unknown display server" ;; + esac +} + +############### +# Parsing # +############### + +# simple function which provides a key-value pair in the form of the DM_XML_TAG and DM_XML_VALUE varaibles +xmlgetnext() { + local IFS='>' + # we need to mangle backslashes for this to work (SC2162) + # The DM_XML_* variables are global variables and are expected to be read and dealt with by someone else (SC2034) + # shellcheck disable=SC2162,SC2034 + read -d '<' DM_XML_TAG DM_XML_VALUE +} + +################# +# Help Function # +################# + +# Every script has a '-h' option that displays the following information. +help() { + printf '%s%s%s\n' "Usage: $(basename "$0") [options] +$(grep '^# Description: ' "$0" | sed 's/# Description: /Description: /g') +$(grep '^# Dependencies: ' "$0" | sed 's/# Dependencies: /Dependencies: /g') + +The folowing OPTIONS are accepted: + -h displays this help page + -d runs the script using 'dmenu' + -f runs the script using 'fzf' + -r runs the script using 'rofi' + +Running" " $(basename "$0") " "without any argument defaults to using 'dmenu' +Run 'man dmscripts' for more information" >/dev/stderr +} + +#################### +# Handle Arguments # +#################### + +# this function is a simple parser designed to get the menu program and then exit prematurally +get_menu_program() { + # If script is run with '-d', it will use 'dmenu' + # If script is run with '-f', it will use 'fzf' + # If script is run with '-r', it will use 'rofi' + while getopts "dfrh" arg 2>/dev/null; do + case "${arg}" in + d) # shellcheck disable=SC2153 + echo "${DMENU}" + return 0 + ;; + f) # shellcheck disable=SC2153 + echo "${FMENU}" + return 0 + ;; + r) # shellcheck disable=SC2153 + echo "${RMENU}" + return 0 + ;; + h) + help + return 1 + ;; + *) + echo "invalid option: +Type $(basename "$0") -h for help" >/dev/stderr + return 1 + ;; + esac + done + echo "Did not find menu argument, using \${DMENU}" >/dev/stderr + # shellcheck disable=SC2153 + echo "${DMENU}" +} + +#################### +# Boilerplate Code # +#################### + +# this function will source the dmscripts config files in the order specified below: +# +# Config priority (in order of which code takes precendent over the other): +# 1. Git repository config - For developers +# 2. $XDG_CONFIG_HOME/dmscripts/config || $HOME/.config/dmscripts/config - For local edits +# 3. /etc/dmscripts/config - For the gloabl/default configuration +# +# Only 1 file is ever sourced + +# this warning is simply not necessary anywhere in the scope +# shellcheck disable=SC1091 +source_dmscripts_configs() { + # this is to ensure this variable is defined + XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-}" + + [ -f "../config/config" ] && source "../config/config" && return 0 + [ -z "$XDG_CONFIG_HOME" ] && [ -f "$HOME/.config/dmscripts/config" ] && source "$HOME/.config/dmscripts/config" && return 0 + [ -n "$XDG_CONFIG_HOME" ] && [ -f "$XDG_CONFIG_HOME/dmscripts/config" ] && source "$XDG_CONFIG_HOME/dmscripts/config" && return 0 + [ -f "/etc/dmscripts/config" ] && source "/etc/dmscripts/config" +} + +# checks the base configuration file and compares it with the local configuration file +# if the numbers are different then the code will return 0, else 1 +# +# this does not check the git config as it doesn't make sense +configs_are_different() { + local _base_file="" + local _config_file="" + + # DM_SHUTUP is a variable in the dmscript config that is intended to silence the notifications. + DM_SHUTUP="${DM_SHUTUP:-}" + + # it cannot determine if the files are different if it does not exist + [ -f "/etc/dmscripts/config" ] && _base_file="/etc/dmscripts/config" || return 1 + + # this is essentially the same idea as seen previous just with different variable names + local _xdg_config_home="${XDG_CONFIG_HOME:-}" + + [ -z "$_xdg_config_home" ] && [ -f "$HOME/.config/dmscripts/config" ] && _config_file="$HOME/.config/dmscripts/config" + [ -n "$_xdg_config_home" ] && [ -f "$XDG_CONFIG_HOME/dmscripts/config" ] && _config_file="$XDG_CONFIG_HOME/dmscripts/config" + + # if there is no other config files then just exit. + [ -z "$_config_file" ] && return 1 + + _config_file_revision=$(grep "^_revision=" "${_config_file}") + _base_file_revision=$(grep "^_revision=" "${_base_file}") + + if [[ ! "${_config_file_revision}" == "${_base_file_revision}" ]]; then + if [ -z "$DM_SHUTUP" ]; then + notify-send "dmscripts configuration outdated" "Review the differences of /etc/dmscripts/config and your local config and apply changes accordingly (dont forget to bump the revision number)" + fi + return 0 + fi + + return 1 +} diff --git a/nixos/scripts/dm-dictionary b/nixos/scripts/dm-dictionary new file mode 100755 index 0000000..e9b60e2 --- /dev/null +++ b/nixos/scripts/dm-dictionary @@ -0,0 +1,96 @@ +#!/usr/bin/env bash +# +# Script name: dm-dictionary +# Description: Uses the translate package as a dictionary. +# Dependencies: dmenu, fzf, rofi, translate-shell, didyoumean +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: Francesco Prem Solidoro +# Derek Taylor + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. + +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +main() { + # dmenu expects some sort of input piped into it. + # The echo to /dev/null is just a hacky way of giving + # dmenu some input without really giving any input. + # shellcheck disable=SC2260 + word="$(echo "" >/dev/null | ${MENU} "Enter word to lookup:")" + testword="$(dym -c -n=1 "$word")" + + if [ "$word" != "$testword" ]; then + keyword=$(dym -c "$word" | ${MENU} "was $word a misspelling?(select/no)") + if [ "$keyword" = "no" ] || [ "$keyword" = "n" ]; then + keyword="$word" + fi + else + keyword="$word" + fi + + if ! [ "${keyword}" ]; then + printf 'No word inserted\n' >&2 + exit 0 + fi + $DMTERM trans -v -d "$keyword" +} + +mainfzf() { + # shellcheck disable=SC2260 + word="$(echo " " | fzf --bind 'return:print-query' --prompt "Enter word to lookup:")" + testword="$(dym -c -n=1 "$word")" + + if [ "$word" != "$testword" ]; then + # shellcheck disable=SC2153 + keyword=$(dym -c "$word" | ${FMENU} "was $word a misspelling?(select/no)") + if [ "$keyword" = "no" ] || [ "$keyword" = "n" ]; then + keyword="$word" + fi + else + keyword="$word" + fi + + if ! [ "${keyword}" ]; then + printf 'No word inserted\n' >&2 + exit 0 + fi + $DMTERM trans -v -d "$keyword" +} + +no_opt=1 +# If script is run with '-d', it will use 'dmenu' +# If script is run with '-f', it will use 'fzf' +# If script is run with '-d', it will use 'rofi' +while getopts "dfrh" arg 2>/dev/null; do + case "${arg}" in + d) # shellcheck disable=SC2153 + MENU=${DMENU} + [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main + ;; + f) # shellcheck disable=SC2153 + [[ "${BASH_SOURCE[0]}" == "${0}" ]] && mainfzf ;; + r) # shellcheck disable=SC2153 + MENU=${RMENU} + [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "@" + ;; + h) help ;; + *) printf '%s\n' "Error: invalid option" "Type $(basename "$0") -h for help" ;; + esac + no_opt=0 +done + +# If script is run with NO argument, it will use 'dmenu' +[ $no_opt = 1 ] && MENU=${DMENU} && [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "$@" diff --git a/nixos/scripts/dm-documents b/nixos/scripts/dm-documents new file mode 100755 index 0000000..6cece6c --- /dev/null +++ b/nixos/scripts/dm-documents @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Script name: dm-documents +# Description: Search for PDFs to open. +# Dependencies: dmenu, fzf, rofi, zathura +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: Derek Taylor +# HostGrady + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. + +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +main() { + # PDF_VIEWER=zathura + files="$(find "$HOME" -maxdepth 4 -iname "*.pdf")" + choice=$(printf '%s\n' "${files[@]}" \ + | cut -d '/' -f4- \ + | sed -e 's/Documents/Dcs/g' \ + -e 's/Downloads/Dwn/g' \ + -e 's/Pictures/Pic/g' \ + -e 's/Images/Img/g' \ + -e 's/.pdf//g' \ + | sort -g \ + | ${MENU} "File: ") || exit 1 + if [ "$choice" ]; then + file=$( + printf '%s' "$choice" \ + | sed -e 's/Dcs/Documents/g' \ + -e 's/Dwn/Downloads/g' \ + -e 's/Pic/Pictures/g' \ + -e 's/Img/Images/g' + ) + "${PDF_VIEWER}" "$HOME/${file}.pdf" + else + echo "Program Terminated." && exit 0 + fi +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/dm-hub b/nixos/scripts/dm-hub new file mode 100755 index 0000000..39f37c9 --- /dev/null +++ b/nixos/scripts/dm-hub @@ -0,0 +1,119 @@ +#!/usr/bin/env bash +# +# Script name: dm-hub +# Description: A hub allowing you to execute all the other dmscripts. +# Dependencies: dmenu, fzf, rofi +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: n-e0 +# Simon Ingelsson +# Derek Taylor + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +_path=$(dirname "$(realpath "$0")") + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +function maindmenu() { + local _self + declare -A _scripts + + _self=$(basename "$0") + + while IFS= read -r -d '' script; do + # Every 'dmscript' should contain a line that begins with "# Description: ". + # Let's take that description and add it next to the script name in the dmenu. + script_name=$(echo "$(basename "${script}") $(grep '^# Description: ' "${script}")" | sed 's/# Description: /- /g') + [[ "${script_name}" == "${_self}" ]] && continue + _scripts[${script_name}]="${script}" + done < <(find "${_path}" -type f -regex ".*/dm-.*" -print0) + + choice=$(printf '%s\n' "${!_scripts[@]}" | sort | grep ".*dm.*" | ${DMENU} 'Run Script:' "$@") + + if [ "${choice}" ]; then + thecommand="$(printf '%s' "${_scripts["${choice}"]}" | awk '{print $1}')" + bash "$thecommand" -d "$@" + else + echo "Program terminated." && exit 0 + fi +} + +function mainfzf() { + local _self + declare -A _scripts + + _self=$(basename "$0") + + while IFS= read -r -d '' script; do + # Every 'dmscript' should contain a line that begins with "# Description: ". + # Let's take that description and add it next to the script name in the dmenu. + script_name=$(echo "$(basename "${script}") $(grep '^# Description: ' "${script}")" | sed 's/# Description: /- /g') + [[ "${script_name}" == "${_self}" ]] && continue + _scripts[${script_name}]="${script}" + done < <(find "${_path}" -type f -regex ".*/dm-.*" -print0) + + choice=$(printf '%s\n' "${!_scripts[@]}" | sort | grep ".*dm.*" | ${FMENU} 'Run Script:') + + if [ "${choice}" ]; then + thecommand="$(printf '%s' "${_scripts["${choice}"]}" | awk '{print $1}')" + bash "$thecommand" -f + else + echo "Program terminated." && exit 0 + fi +} + +function mainrofi() { + local _self + declare -A _scripts + + _self=$(basename "$0") + + while IFS= read -r -d '' script; do + # Every 'dmscript' should contain a line that begins with "# Description: ". + # Let's take that description and add it next to the script name in the dmenu. + script_name=$(echo "$(basename "${script}") $(grep '^# Description: ' "${script}")" | sed 's/# Description: /- /g') + [[ "${script_name}" == "${_self}" ]] && continue + _scripts[${script_name}]="${script}" + done < <(find "${_path}" -type f -regex ".*/dm-.*" -print0) + + choice=$(printf '%s\n' "${!_scripts[@]}" | sort | grep ".*dm.*" | ${RMENU} 'Run Script:' "$@") + + if [ "${choice}" ]; then + thecommand="$(printf '%s' "${_scripts["${choice}"]}" | awk '{print $1}')" + bash "$thecommand" -r "$@" + else + echo "Program terminated." && exit 0 + fi +} + +no_opt=1 +# If script is run with '-d', it will use 'dmenu' +# If script is run with '-f', it will use 'fzf' +# If script is run with '-d', it will use 'rofi' +while getopts "dfrh" arg 2>/dev/null; do + case "${arg}" in + d) [[ "${BASH_SOURCE[0]}" == "${0}" ]] && maindmenu ;; + f) [[ "${BASH_SOURCE[0]}" == "${0}" ]] && mainfzf ;; + r) [[ "${BASH_SOURCE[0]}" == "${0}" ]] && mainrofi "$@" ;; + h) help ;; + *) printf '%s\n' "Error: invalid option" "Type $(basename "$0") -h for help" ;; + esac + no_opt=0 +done + +# If script is run with NO argument, it will use 'dmenu' +[ $no_opt = 1 ] && [[ "${BASH_SOURCE[0]}" == "${0}" ]] && maindmenu "$@" + +# TODO: for some reason dm-template is broken with this script, needs investigating diff --git a/nixos/scripts/dm-man b/nixos/scripts/dm-man new file mode 100755 index 0000000..2b4688b --- /dev/null +++ b/nixos/scripts/dm-man @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# +# Script name: dm-man +# Description: Search for a manpage or get a random one. +# Dependencies: dmenu, fzf, rofi, alacritty (edit DMTERM in dmscripts config if using another terminal) +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: Derek Taylor +# Simon Ingelsson + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +main() { + # An array of options to choose. + local _options=("Search manpages" "Random manpage" "Quit") + # Piping the above array into dmenu. + # We use "printf '%s\n'" to format the array one item to a line. + choice=$(printf '%s\n' "${_options[@]}" | ${MENU} 'Manpages:') + + # What to do when/if we choose one of the options. + case "$choice" in + 'Search manpages') + # shellcheck disable=SC2086 + man -k . | awk '{$3="-"; print $0}' \ + | ${MENU} 'Search for:' \ + | awk '{print $2, $1}' | tr -d '()' | xargs $DMTERM man + ;; + 'Random manpage') + # shellcheck disable=SC2086 + man -k . | cut -d' ' -f1 | shuf -n 1 \ + | ${MENU} 'Random manpage:' | xargs $DMTERM man + ;; + 'Quit') + echo "Program terminated." && exit 0 + ;; + *) + exit 0 + ;; + esac + +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/dm-note b/nixos/scripts/dm-note new file mode 100755 index 0000000..318c613 --- /dev/null +++ b/nixos/scripts/dm-note @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +# +# Script name: dm-note +# Description: Store multiple one-line texts or codes and copy one of them when needed. +# Dependencies: dmenu, fzf, rofi, xclip +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: Fawzakin +# Derek Taylor + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +# TODO: Program is broken with FZF, fix later. +main() { + # Picking our options. + choice=$(printf 'Copy note\nNew note\nDelete note\nQuit' | ${MENU} 'Notes:') + + # Choose what we should do with our choice. + case "$choice" in + 'Copy note') + # shellcheck disable=SC2154 + note_pick=$(${MENU} 'Copy:' <"${note_dir}") + [ -n "${note_pick}" ] && echo "${note_pick}" | cp2cb && notify-send -u normal "Note copied" "${note_pick}" + ;; + 'New note') + note_new=$(echo "" | ${MENU} 'Enter new note:') + # Making sure the input is not empty and not already exist in note_dir. + # The sed command should prevent grep from taking certain characters as a regex input. + [ -n "$note_new" ] && ! grep -q "^$(echo "${note_new}" | sed -e 's/\[/\\[/g;s/\]/\\]/g')\$" "${note_dir}" \ + && echo "${note_new}" >>"${note_dir}" && notify-send -u normal "Note created" "${note_new}" + ;; + 'Delete note') + note_del=$(${MENU} 'Delete:' <"${note_dir}") + # grep should always returns 0 regardless what happens. + grep -v "^$(echo "${note_del}" | sed -e 's/\[/\\[/g;s/\]/\\]/g')\$" "${note_dir}" >"/tmp/dmnote" || true + [ -n "${note_del}" ] && cp -f "/tmp/dmnote" "${note_dir}" && notify-send -u normal "Note deleted" "${note_del}" + ;; + 'Quit') + echo "Program terminated." && exit 0 + ;; + *) + exit 0 + ;; + esac +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/dm-pipewire-out-switcher b/nixos/scripts/dm-pipewire-out-switcher new file mode 100755 index 0000000..8023671 --- /dev/null +++ b/nixos/scripts/dm-pipewire-out-switcher @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# +# Script name: dm-pipewire-out-switcher +# Description: Switch default output for pipewire. +# Dependencies: dmenu, fzf, rofi, pipewire, jq, pactl +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: Simon Ingelsson +# Derek Taylor + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +get_default_sink() { + pactl --format=json info | jq -r .default_sink_name +} +get_all_sinks() { + pactl --format=json list short sinks \ + | current=$(get_default_sink) jq -r '.[] | if .name == env.current then .state="* " else .state="" end | .state + .name' +} + +main() { + choice=$(printf '%s\n' "$(get_all_sinks)" \ + | sort \ + | ${MENU} 'Sink: ') || exit 1 + + if [ "$choice" ]; then + if [[ "${choice}" == "* $(get_default_sink)" ]]; then + exit 0 + fi + pactl set-default-sink "${choice}" + notify-send "Sink is now: ${choice}" + else + echo "Program terminated." && exit 0 + fi +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/dm-spellcheck b/nixos/scripts/dm-spellcheck new file mode 100755 index 0000000..9626438 --- /dev/null +++ b/nixos/scripts/dm-spellcheck @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# +# Script name: dm-dictionary +# Description: Uses didyoumean as a spellchecker. +# Dependencies: dmenu, fzf, rofi, didyoumean +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: Francesco Prem Solidoro +# Derek Taylor + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +main() { + WORD="$(printf '%s' "" | ${MENU} "Enter Word:")" + + if ! [ "${WORD}" ] || [ "${WORD}" = "quit" ]; then + printf 'No word inserted\n' >&2 + exit 0 + fi + + dym -c "$WORD" | ${MENU} "Select Correct Spelling:" | xclip -selection clipboard +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/dm-weather b/nixos/scripts/dm-weather new file mode 100755 index 0000000..b2dd34f --- /dev/null +++ b/nixos/scripts/dm-weather @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# +# Script name: dm-weather +# Description: Simple graphical weather app +# Dependencies: dmenu, curl, yad +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: HostGrady +# Derek Taylor + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +main() { + # Here we obtain the location from the list in the config + # As this is loaded from other file it is technically not defined + # shellcheck disable=SC2154 + _location="$(printf '%s\n' "${weather_locations}" | ${MENU} "Where do you want to see the weather?")" + echo "$_location" + + # If $weather_opts is unset, give it an empty value + weather_opts+='' + + # Curl wttr.in, a CLI weather app. + # curl -s "https://wttr.in/${_location// /%20}?T&${weather_opts}" | yad --text-info --maximized + kitty -e sh -c "curl -s 'https://wttr.in/${_location// /%20}?T&${weather_opts}'; read -n 1 -s" + +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/dm-websearch b/nixos/scripts/dm-websearch new file mode 100755 index 0000000..3dcfd34 --- /dev/null +++ b/nixos/scripts/dm-websearch @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# +# Script name: dm-websearch +# Description: Search various search engines (inspired by surfraw). +# Dependencies: dmenu, fzf, rofi, brave (change DMMBROWSER in dmscripts config if using another browser) +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: Derek Taylor +# Ali Furkan Yıldız +# HostGrady +# Simon Ingelsson + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +main() { + if [ -z "${!websearch[*]}" ]; then + notify-send "dm-websearch: BREAKING CHANGES" "Due to breaking changes you must edit all declare statements in your config to include the g option. declare -A -> declare -Ag, declare -a -> declare -ag" + echo "$(date): dm-websearch: BREAKING CHANGES: Due to breaking changes you must edit all declare statements in your config to include the g option. +are -A -> declare -Ag +are -a -> declare -ag" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 2 + exit 1 + fi + # As this is loaded from other file it is technically not defined + # shellcheck disable=SC2154 # Choosing a search engine by name from array above. + engine=$(printf '%s\n' "${!websearch[@]}" | sort | ${MENU} 'Choose search engine:') || exit 1 + + # Getting the URL of the search engine we chose. + url="${websearch["${engine}"]}" + + # Searching the chosen engine. + query=$(printf '%s' "$engine" | ${MENU} 'Enter search query:') + + query="$(echo -n "${query}" | jq -s -R -r @uri)" + # Display search results in web browser + # shellcheck disable=SC2154 + ${DMBROWSER} "${url}${query}" +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/dm-wifi b/nixos/scripts/dm-wifi new file mode 100755 index 0000000..3f94ee5 --- /dev/null +++ b/nixos/scripts/dm-wifi @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# script name: dm-wifi +# Description: Connect to wifi using dmenu +# Dependencies: dmenu, fzf, rofi, nmcli, Any Nerd Font +# GitLab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributor: WitherCubes +# Derek Taylor + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +main() { + # TODO: Fix cut line at some point + bssid=$(nmcli device wifi list | sed -n '1!p' | cut -b 9- | ${MENU} "Select Wifi  :" | cut -d' ' -f1) + pass=$(echo "" | ${MENU} "Enter Password  :") + # We are disabling a shellcheck warning about using && and || as it doesn't apply here. + # shellcheck disable=SC2015 + [ -n "$pass" ] && nmcli device wifi connect "$bssid" password "$pass" || nmcli device wifi connect "$bssid" + sleep 10 + if ping -q -c 2 -W 2 google.com >/dev/null; then + notify-send "Your internet is working :)" + else + notify-send "Your internet is not working :(" + fi +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/dm-youtube b/nixos/scripts/dm-youtube new file mode 100755 index 0000000..32888d6 --- /dev/null +++ b/nixos/scripts/dm-youtube @@ -0,0 +1,87 @@ +#!/usr/bin/env bash +# +# Script name: dm-youtube +# Description: Youtube subscription manager without API access +# Dependencies: dmenu, curl, a browser (brave by default) +# Gitlab: https://www.gitlab.com/dwt1/dmscripts +# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE +# Contributors: HostGrady +# Derek Taylor + +# Set with the flags "-e", "-u","-o pipefail" cause the script to fail +# if certain things happen, which is a good thing. Otherwise, we can +# get hidden bugs that are hard to discover. +set -euo pipefail + +# shellcheck disable=SC1091 +source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null + +source_dmscripts_configs + +if configs_are_different; then + echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 1 +fi + +# this is a function for parsing youtube rss, see _dm-helper.sh for information on xmlgetnext +parse_youtube_feed() { + echo "$1" | while xmlgetnext; do + case $DM_XML_TAG in + 'entry') + title='' + link='' + published='' + ;; + 'media:title') + title="$DM_XML_VALUE" + ;; + 'yt:videoId') + link="$DM_XML_VALUE" + ;; + 'published') + published="$(date --date="${DM_XML_VALUE}" "+%Y-%m-%d %H:%M")" + ;; + '/entry') + echo " ${published} | ${link} | ${title}" + ;; + esac + done +} + +main() { + local _feed_url _channel _video + local _channel_id _video_id _video_list + + if [ -z "${!youtube_channels[*]}" ]; then + notify-send "dm-youtube: BREAKING CHANGES" "Due to breaking changes you must edit all declare statements in your config to include the g option. declare -A -> declare -Ag, declare -a -> declare -ag" + echo "$(date): dm-youtube: BREAKING CHANGES: Due to breaking changes you must edit all declare statements in your config to include the g option. +are -A -> declare -Ag +are -a -> declare -ag" >>"$DM_CONFIG_DIFF_LOGFILE" + sleep 2 + exit 1 + fi + # Sorts the array and lets you select a channel with dmenu + # As this is loaded from other file it is technically not defined + # shellcheck disable=SC2154 + _channel=$(printf '%s\n' "${!youtube_channels[@]}" | sort | ${MENU} 'Select Channel:') + + # The way it's done here is most effective, it searchs for "=" then it takes + # everything before the = sign and leaves us with our variable used in the + # _feed_url variable + _channel_id=$(curl -s -f -L "${youtube_channels[${_channel}]}" | grep -o "channel_id=.*" | sed 's/".*//g') + _feed_url="https://www.youtube.com/feeds/videos.xml?channel_id=${_channel_id##*=}" + # parse rss + _video_list=$(parse_youtube_feed "$(curl -s "${_feed_url}")") + + _video=$(printf '%s\n' "${_video_list}" | sort -r | ${MENU} 'Select Video') + _video_id=$(echo "${_video}" | cut -d'|' -f2 | sed -e 's/^[ \t]*//') + + if [[ -n ${_video_id} ]]; then + # After the video is chosen, run it in your web browser + # shellcheck disable=SC2154 + ${DMBROWSER} "https://www.youtube.com/watch?v=${_video_id}" + fi +} + +MENU="$(get_menu_program "$@")" +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main diff --git a/nixos/scripts/get-battery b/nixos/scripts/get-battery new file mode 100755 index 0000000..fff6d19 --- /dev/null +++ b/nixos/scripts/get-battery @@ -0,0 +1,39 @@ +#!/bin/sh + +BATTERY_PATH="/sys/class/power_supply/BAT0" + +# Check if the battery is present +if [ -d "$BATTERY_PATH" ]; then + # Get battery status (Charging, Discharging, Full, etc.) + status=$(cat "$BATTERY_PATH/status") + + # Get battery percentage + capacity=$(cat "$BATTERY_PATH/capacity") + + # Set default icon and color + icon="" + color="" + + # Determine icon based on battery status + if [ "$status" == "Charging" ]; then + icon="󱟦" # Charging icon + else + icon="󱟤" # Discharging icon + fi + + # Determine color based on battery percentage + if [ "$capacity" -le 20 ]; then + color="" # Red + elif [ "$capacity" -le 50 ]; then + color="" # Orange + elif [ "$capacity" -le 79 ]; then + color="" # Yellow + else + color="" # Green + fi + + # Display battery information with icon and color + echo "$color$icon $capacity%" +else + echo "Battery not found." +fi diff --git a/nixos/scripts/get-brightness b/nixos/scripts/get-brightness new file mode 100755 index 0000000..4531c16 --- /dev/null +++ b/nixos/scripts/get-brightness @@ -0,0 +1,22 @@ +#!/bin/sh + +# Get the current brightness level as a percentage +brightness=$(brightnessctl g) +max_brightness=$(brightnessctl m) + +# Perform float division and store the result with 2 decimal points +result=$(awk "BEGIN { printf \"%.2f\", $brightness / $max_brightness }") + +# Convert the result to a percentage (multiply by 100) and round to the nearest whole number +percentage=$(awk "BEGIN { printf \"%.0f\", $result * 100 }") + +# Set the icon based on the brightness level +if [ $percentage -le 33 ]; then + icon="󰃞" +elif [ $percentage -le 66 ]; then + icon="󰃟" +else + icon="󰃠" +fi + +echo "$icon $percentage%" diff --git a/nixos/scripts/get-volume b/nixos/scripts/get-volume new file mode 100755 index 0000000..4a9d510 --- /dev/null +++ b/nixos/scripts/get-volume @@ -0,0 +1,22 @@ +#!/bin/sh +# Dependencies: pactl, awk + +volume=$(pactl list sinks | awk '/^\s+Volume:/ {print $5}' | head -n 1 | tr -d '%') +muted=$(pactl list sinks | awk '/^\s+Mute:/ {print $2}' | head -n 1) + +if [ "$muted" = "yes" ]; then + icon="󰝟" +else + if [ "$volume" -le 20 ]; then + icon="󰕿" + elif [ "$volume" -le 50 ]; then + icon="󰖀" + elif [ "$volume" -le 100 ]; then + icon="󰕾" + else + icon="󰝝" + fi +fi + +echo "$icon $volume%" + diff --git a/nixos/wallpapers/PastelPinkLightning.jpg b/nixos/wallpapers/PastelPinkLightning.jpg new file mode 100644 index 0000000..9440d79 Binary files /dev/null and b/nixos/wallpapers/PastelPinkLightning.jpg differ diff --git a/swaywm/README.md b/swaywm/README.md new file mode 100644 index 0000000..1320957 --- /dev/null +++ b/swaywm/README.md @@ -0,0 +1,5 @@ +# My Dotfiles + +**Purple & Black i3-style SwayWM config** + +font: [ZedMono Nerd Font](https://www.nerdfonts.com/font-downloads) diff --git a/swaywm/bashrc b/swaywm/bashrc new file mode 100644 index 0000000..47781d7 --- /dev/null +++ b/swaywm/bashrc @@ -0,0 +1,27 @@ +# .bashrc + +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# User specific environment +if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then + PATH="$HOME/.local/bin:$HOME/bin:$PATH" +fi +export PATH + +# Uncomment the following line if you don't like systemctl's auto-paging feature: +# export SYSTEMD_PAGER= + +# User specific aliases and functions +if [ -d ~/.bashrc.d ]; then + for rc in ~/.bashrc.d/*; do + if [ -f "$rc" ]; then + . "$rc" + fi + done +fi +unset rc + +alias ec=emacsclient diff --git a/swaywm/config/dunst/dunstrc b/swaywm/config/dunst/dunstrc new file mode 100644 index 0000000..a6a7a85 --- /dev/null +++ b/swaywm/config/dunst/dunstrc @@ -0,0 +1,471 @@ +# See dunst(5) for all configuration options + +[global] + ### Display ### + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a window manager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern window managers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = none + + ### Geometry ### + + # dynamic width from 0 to 300 + # width = (0, 300) + # constant width of 300 + width = (220,300) + + # The maximum height of a single notification, excluding the frame. + height = 300 + + # Position the notification in the top right corner + origin = bottom-right + + # Offset from the origin + offset = 4x4 + + # Scale factor. It is auto-detected if value is 0. + scale = 0 + + # Maximum number of notification (0 means no limit) + notification_limit = 20 + + ### Progress bar ### + + # Turn on the progess bar. It appears when a progress hint is passed with + # for example dunstify -h int:value:12 + progress_bar = true + + # Set the progress bar height. This includes the frame, so make sure + # it's at least twice as big as the frame width. + progress_bar_height = 10 + + # Set the frame width of the progress bar + progress_bar_frame_width = 1 + + # Set the minimum width for the progress bar + progress_bar_min_width = 150 + + # Set the maximum width for the progress bar + progress_bar_max_width = 300 + + # Corner radius for the progress bar. 0 disables rounded corners. + progress_bar_corner_radius = 0 + + # Corner radius for the icon image. + icon_corner_radius = 0 + + # Show how many messages are currently hidden (because of + # notification_limit). + indicate_hidden = yes + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing window manager is + # present (e.g. xcompmgr, compiz, etc.). (X11 only) + transparency = 0 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + # If gap_size is greater than 0, this setting will be ignored. + separator_height = 2 + + # Padding between text and separator. + padding = 8 + + # Horizontal padding. + horizontal_padding = 8 + + # Padding between text and icon. + text_icon_padding = 0 + + # Defines width in pixels of frame around the notification window. + # Set to 0 to disable. + frame_width = 3 + + # Defines color of the frame around the notification window. + frame_color = "#000000" + + # Size of gap to display between notifications - requires a compositor. + # If value is greater than 0, separator_height will be ignored and a border + # of size frame_width will be drawn around each notification instead. + # Click events on gaps do not currently propagate to applications below. + gap_size = 0 + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Sort type. + # possible values are: + # * id: sort by id + # * urgency_ascending: sort by urgency (low then normal then critical) + # * urgency_descending: sort by urgency (critical then normal then low) + # * update: sort by update (most recent always at the top) + sort = yes + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + # A client can set the 'transient' hint to bypass this. See the rules + # section for how to disable this if necessary + # idle_threshold = 120 + + ### Text ### + + font = ZedMono Nerd Font 10 + + # The spacing between lines. If the height is smaller than the + # font height, it will get raised to the font height. + line_height = 0 + + # Possible values are: + # full: Allow a small subset of html markup in notifications: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # + # strip: This setting is provided for compatibility with some broken + # clients that send markup even though it's not enabled on the + # server. Dunst will try to strip the markup but the parsing is + # simplistic so using this option outside of matching rules for + # specific applications *IS GREATLY DISCOURAGED*. + # + # no: Disable markup parsing, incoming notifications will be treated as + # plain text. Dunst will not advertise that it has the body-markup + # capability if this is set as a global setting. + # + # It's important to note that markup inside the format option will be parsed + # regardless of what this is set to. + markup = full + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # %n progress value if set without any extra characters + # %% Literal % + # Markup is allowed + format = "%s\n%b" + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # Vertical alignment of message text and icon. + # Possible values are "top", "center" and "bottom". + vertical_alignment = center + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Specify where to make an ellipsis in long lines. + # Possible values are "start", "middle" and "end". + ellipsize = middle + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Stack together notifications with the same content + stack_duplicates = true + + # Hide the count of stacked notifications with the same content + hide_duplicate_count = false + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + ### Icons ### + + # Recursive icon lookup. You can set a single theme, instead of having to + # define all lookup paths. + enable_recursive_icon_lookup = true + + # Set icon theme (only used for recursive icon lookup) + icon_theme = Adwaita + # You can also set multiple icon themes, with the leftmost one being used first. + # icon_theme = "Adwaita, breeze" + + # Align icons left/right/top/off + icon_position = left + + # Scale small icons up to this size, set to 0 to disable. Helpful + # for e.g. small files or high-dpi screens. In case of conflict, + # max_icon_size takes precedence over this. + min_icon_size = 16 + + # Scale larger icons down to this size, set to 0 to disable + max_icon_size = 16 + + # Paths to default icons (only neccesary when not using recursive icon lookup) + icon_path = /usr/share/icons/Adwaita/symbolic/status/:/usr/share/icons/Adwaita/symbolic/devices/ + + ### History ### + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + ### Misc/Advanced ### + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = /usr/bin/xdg-open + + # Always run rule-defined scripts, even if the notification is suppressed + always_run_script = true + + # Define the title of the windows spawned by dunst + title = Dunst + + # Define the class of the windows spawned by dunst + class = Dunst + + # Define the corner radius of the notification window + # in pixel size. If the radius is 0, you have no rounded + # corners. + # The radius will be automatically lowered if it exceeds half of the + # notification height to avoid clipping text and/or icons. + corner_radius = 0 + + # Ignore the dbus closeNotification message. + # Useful to enforce the timeout set by dunst configuration. Without this + # parameter, an application may close the notification sent before the + # user defined timeout. + ignore_dbusclose = false + + ### Wayland ### + # These settings are Wayland-specific. They have no effect when using X11 + + # Uncomment this if you want to let notications appear under fullscreen + # applications (default: overlay) + # layer = top + + # Set this to true to use X11 output on Wayland. + force_xwayland = false + + ### Legacy + + # Use the Xinerama extension instead of RandR for multi-monitor support. + # This setting is provided for compatibility with older nVidia drivers that + # do not support RandR and using it on systems that support RandR is highly + # discouraged. + # + # By enabling this setting dunst will not be able to detect when a monitor + # is connected or disconnected which might break follow mode if the screen + # layout changes. + force_xinerama = false + + ### mouse + + # Defines list of actions for each mouse event + # Possible values are: + # * none: Don't do anything. + # * do_action: Invoke the action determined by the action_name rule. If there is no + # such action, open the context menu. + # * open_url: If the notification has exactly one url, open it. If there are multiple + # ones, open the context menu. + # * close_current: Close current notification. + # * close_all: Close all notifications. + # * context: Open context menu for the notification. + # * context_all: Open context menu for all notifications. + # These values can be strung together for each mouse event, and + # will be executed in sequence. + mouse_left_click = close_current + mouse_middle_click = do_action, close_current + mouse_right_click = close_all + +# Experimental features that may or may not work correctly. Do not expect them +# to have a consistent behaviour across releases. +[experimental] + # Calculate the dpi to use on a per-monitor basis. + # If this setting is enabled the Xft.dpi value will be ignored and instead + # dunst will attempt to calculate an appropriate dpi value for each monitor + # using the resolution and physical size. This might be useful in setups + # where there are multiple screens with very different dpi values. + per_monitor_dpi = false + + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + background = "#b09ade" + foreground = "#000000" + timeout = 10 + # Icon for notifications with low urgency, uncomment to enable + #default_icon = /path/to/icon + +[urgency_normal] + background = "#b09ade" + foreground = "#000000" + timeout = 10 + override_pause_level = 30 + # Icon for notifications with normal urgency, uncomment to enable + #default_icon = /path/to/icon + +[urgency_critical] + background = "#900000" + foreground = "#ffffff" + frame_color = "#ff0000" + timeout = 0 + override_pause_level = 60 + # Icon for notifications with critical urgency, uncomment to enable + #default_icon = /path/to/icon + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# +# Messages can be matched by +# appname (discouraged, see desktop_entry) +# body +# category +# desktop_entry +# icon +# match_transient +# msg_urgency +# stack_tag +# summary +# +# and you can override the +# background +# foreground +# format +# frame_color +# fullscreen +# new_icon +# set_stack_tag +# set_transient +# set_category +# timeout +# urgency +# icon_position +# skip_display +# history_ignore +# action_name +# word_wrap +# ellipsize +# alignment +# hide_text +# override_pause_level +# +# Shell-like globbing will get expanded. +# +# Instead of the appname filter, it's recommended to use the desktop_entry filter. +# GLib based applications export their desktop-entry name. In comparison to the appname, +# the desktop-entry won't get localized. +# +# You can also allow a notification to appear even when paused. Notification will appear whenever notification's override_pause_level >= dunst's paused level. +# This can be used to set partial pause modes, where more urgent notifications get through, but less urgent stay paused. To do that, you can override the following in the rules: +# override_pause_level = X + +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +# Disable the transient hint so that idle_threshold cannot be bypassed from the +# client +#[transient_disable] +# match_transient = yes +# set_transient = no +# +# Make the handling of transient notifications more strict by making them not +# be placed in history. +#[transient_history_ignore] +# match_transient = yes +# history_ignore = yes + +# fullscreen values +# show: show the notifications, regardless if there is a fullscreen window opened +# delay: displays the new notification, if there is no fullscreen window active +# If the notification is already drawn, it won't get undrawn. +# pushback: same as delay, but when switching into fullscreen, the notification will get +# withdrawn from screen again and will get delayed like a new notification +#[fullscreen_delay_everything] +# fullscreen = delay +#[fullscreen_show_critical] +# msg_urgency = critical +# fullscreen = show + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# skip_display = true + +#[history-ignore] +# # This notification will not be saved in history +# summary = "foobar" +# history_ignore = yes + +#[skip-display] +# # This notification will not be displayed, but will be included in the history +# summary = "foobar" +# skip_display = yes + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +#[stack-volumes] +# appname = "some_volume_notifiers" +# set_stack_tag = "volume" +# +# vim: ft=cfg diff --git a/swaywm/config/foot/foot.ini b/swaywm/config/foot/foot.ini new file mode 100644 index 0000000..4b719df --- /dev/null +++ b/swaywm/config/foot/foot.ini @@ -0,0 +1,8 @@ +font=ZedMono Nerd Font:size=14 + +[cursor] +style=beam + +[colors] +background=181818 +foreground=e4e4ef \ No newline at end of file diff --git a/swaywm/config/i3status/config b/swaywm/config/i3status/config new file mode 100644 index 0000000..77d19e7 --- /dev/null +++ b/swaywm/config/i3status/config @@ -0,0 +1,108 @@ +# i3status configuration file. +# b +# see "man i3status" for documentation. + +# It is important that this file is edited as UTF-8. +# The following line should contain a sharp s: +# ß +# If the above line is not correctly displayed, fix your editor first! + +general { + output_format = "i3bar" + colors = true + # color_good = "#ffff66" #"#00e6ac" #"#33cc3" #"#F08D0C" + interval = 5 + markup="pango" +} + +#pink #ff80bf #fa4c7e +#yellow #ffff66 #fdd243 +#green #aaff80 #78da59 +#Dark blue #1a8cff #166cd6 +#light blue #99ccff #33bdf5 +#Grey Shadow #b3b3b3 #8d8e90 +#Orange #ffa64d #fba137 + +order += "read_file powerprofile" +order += "cpu_usage" +order += "memory" +order += "disk /" +order += "wireless _first_" +#order += "ethernet enp4s0" +order += "battery 0" +order += "read_file brightness" +order += "volume master" +order += "time" + +wireless _first_ { + # format_up = " [%essid ]" + # format_down = " [down]" + format_up = "  %essid " + format_down = "  Wifi down " +} + +battery 0 { + format = " %status %percentage " + format_down = "No battery" + #'#fa4c7e' + status_chr = " " + status_bat = " " + status_full = " " + status_unk = "[? ukwn ] " + path = "/sys/class/power_supply/BAT%d/uevent" + low_threshold = 10 + #last_full_capacity = true + hide_seconds = true + integer_battery_capacity = true +} + +volume master { + #format = "[ ]: %volume " + format = "  %volume " + format_muted = "  %volume " + device = "default" + mixer = "Master" + mixer_idx = 0 +} + +time { + #format = "%time" + format = " %Y-%m-%d %H:%M:%S " + #format = "%time" + #format_time = "  %I:%M %p |  %a [%d]-%b [%m]" + #format_time = "%H:%M %Z" + separator_block_width = 0 + min_width = 100 + #format_time = "  %I:%M %p // %a [%d]-%b [%m]" +} + +ethernet enp4s0 { + # if you use %speed, i3status requires root privileges + format_up =" enp4s0:  %ip" + format_down = "" +} + + +disk "/" { + format = " 󰋊 %used " +} + +cpu_usage { + format = "  %usage " +} + +memory { + format = "  %used " +} + +read_file powerprofile { + path = "/tmp/powerprofile" + format = " %content " + format_bad = "..." +} + +read_file brightness { + path = "/tmp/brightness_status" + format = " %content " + format_bad = "..." +} \ No newline at end of file diff --git a/swaywm/config/sway/config b/swaywm/config/sway/config new file mode 100644 index 0000000..3884175 --- /dev/null +++ b/swaywm/config/sway/config @@ -0,0 +1,266 @@ +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 +# Home row direction keys, like vim +set $left n +set $down e +set $up i +set $right o +# Your preferred terminal emulator +set $term foot +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +#set $menu dmenu_path | wmenu | xargs swaymsg exec -- +set $menu "dmenu_run -fn 'ZedMono Nerd Font-12' -i -b -nb '#000000' -nf '#ffffff' -sb '#b299db' -sf '#000000' -p 'run>'" + +set $dmenu "~/.local/bin/j4dmenu" + +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +output * bg /home/venomade/Pictures/Papes/PurplePhoneLines.jpg fill + +output eDP-1 resolution 1920x1080 +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs + +### Idle configuration +# +# Example configuration: +# +# exec swayidle -w \ +# timeout 300 'swaylock -f -c 000000' \ +# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ +# before-sleep 'swaylock -f -c 000000' +# +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. + +### Input configuration +# +# Example configuration: +# +# input "2:14:SynPS/2_Synaptics_TouchPad" { +# dwt enabled +# tap enabled +# natural_scroll enabled +# middle_emulation enabled +# } +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + +input * { + xkb_layout us + xkb_variant colemak +} + +input "2:7:SynPS/2_Synaptics_TouchPad" { + tap enabled + natural_scroll enabled +} + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $term + + # Open an emacs frame + bindsym $mod+Shift+Return exec emacsclient -c -a emacs + + # Kill focused window + bindsym $mod+Shift+q kill + + # Start your launcher + bindsym $mod+d exec $dmenu + bindsym $mod+Shift+d exec $menu + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+r reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+c exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+h layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +### Utility Buttons +# Volume Mute +bindsym XF86AudioMute exec ~/.local/bin/volume mute +# Microphone Mute +bindsym XF86AudioMicMute exec ~/.local/bin/volume mute-mic +# Volume Up/Down +bindsym XF86AudioRaiseVolume exec ~/.local/bin/volume up +bindsym XF86AudioLowerVolume exec ~/.local/bin/volume down +# Brightness Up/Down +bindsym XF86MonBrightnessUp exec ~/.local/bin/brightness up +bindsym XF86MonBrightnessDown exec ~/.local/bin/brightness down +# Power Profiles +bindsym XF86Go exec ~/.local/bin/ppctl power-saver +bindsym Cancel exec ~/.local/bin/ppctl balanced +bindsym XF86Favorites exec ~/.local/bin/ppctl performance + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + position bottom + + # When the status_command prints a new line to stdout, swaybar updates. + # The default just shows the current date and time. + status_command i3status + + font "ZedMono Nerd Font 10" + + colors { + statusline #ffffff + # background #323232 + background #000000 + inactive_workspace #00000000 #00000000 #25312b + focused_workspace #00000000 #000000ff #ffffffaa + } +} + +gaps inner 4 +# for_window [title="^.*"] title_format "" +default_border pixel 3 +default_floating_border pixel 3 + +# Dracula theme [https://draculatheme.com/] +# class border bground text indicator child_border +#client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4 +client.focused #000000 #000000 #F8F8F2 #000000 #000000 +client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A +client.unfocused #282A36 #282A36 #BFBFBF #282A36 #282A36 +client.urgent #44475A #FF5555 #F8F8F2 #FF5555 #FF5555 +client.placeholder #282A36 #282A36 #F8F8F2 #282A36 #282A36 +client.background #F8F8F2 + + +include /etc/sway/config.d/* \ No newline at end of file diff --git a/swaywm/local/bin/brightness b/swaywm/local/bin/brightness new file mode 100755 index 0000000..2c8ebb4 --- /dev/null +++ b/swaywm/local/bin/brightness @@ -0,0 +1,52 @@ +#!/bin/bash + +function get_brightness { + cntb=$(brightnessctl g) + maxb=$(brightnessctl m) + + echo $(( ($cntb * 100) / $maxb )) +} + +# Function to get the icon based on the brightness level +function get_brightness_icon { + brightness_level=$1 + if [ $brightness_level -le 33 ]; then + echo "󰃞" + elif [ $brightness_level -le 66 ]; then + echo "󰃟" + else + echo "󰃠" + fi +} + +# Function to set the contents of "/tmp/brightness_status" to the current brightness level +function set_tmp_brightness_status { + brightness_level=$(get_brightness) + icon=$(get_brightness_icon $brightness_level) + echo "$icon $brightness_level%" > /tmp/brightness_status +} + +function send_notification { + brightness_level=$(get_brightness) + icon=$(get_brightness_icon $brightness_level) + # Make the bar with the special character ─ (it's not dash -) + # https://en.wikipedia.org/wiki/Box-drawing_character + bar=$(seq -s "─" $(($brightness_level / 5)) | sed 's/[0-9]//g') + # Send the notification + dunstify -i display-brightness-symbolic -t 2500 -r 2593 -u normal " $bar" +} + +case $1 in + up) + # Set the brightness level up (+ 5%) + brightnessctl s 5%+ + send_notification + set_tmp_brightness_status + ;; + down) + # Set the brightness level down (- 5%) + brightnessctl s 5%- + send_notification + set_tmp_brightness_status + ;; +esac diff --git a/swaywm/local/bin/i3status++ b/swaywm/local/bin/i3status++ new file mode 100755 index 0000000..ea4ede6 --- /dev/null +++ b/swaywm/local/bin/i3status++ @@ -0,0 +1,8 @@ +#!/bin/bash + +i3status | (read line; echo "$line"; read line ; echo "$line" ; read line ; echo "$line" ; while true +do + read line + json_array="$(echo $line | sed -e 's/^,//')" + echo ",$json_array" +done) \ No newline at end of file diff --git a/swaywm/local/bin/j4dmenu b/swaywm/local/bin/j4dmenu new file mode 100755 index 0000000..6d63196 --- /dev/null +++ b/swaywm/local/bin/j4dmenu @@ -0,0 +1,2 @@ +#!/bin/bash +j4-dmenu-desktop --dmenu="dmenu -fn 'ZedMono Nerd Font-12' -i -b -nb '#000000' -nf '#ffffff' -sb '#b299db' -sf '#000000' -p 'drun>'" \ No newline at end of file diff --git a/swaywm/local/bin/ppctl b/swaywm/local/bin/ppctl new file mode 100755 index 0000000..6babda5 --- /dev/null +++ b/swaywm/local/bin/ppctl @@ -0,0 +1,66 @@ +#!/bin/bash + +function set_profile { + case $1 in + performance) + powerprofilesctl set performance + ;; + balanced) + powerprofilesctl set balanced + ;; + power-saver) + powerprofilesctl set power-saver + ;; + *) + echo "Invalid profile. Please use 'performance', 'balanced', or 'power-saver'." + ;; + esac +} + +function get_profile { + powerprofilesctl get +} + +function get_nficon { + profile=$1 + case $profile in + performance) + echo "󰓅" + ;; + balanced) + echo "󰾅" + ;; + power-saver) + echo "󰾆" + ;; + *) + echo "Invalid profile" + ;; + esac +} + +function send_notification { + profile=$(get_profile) + icon="power-profile-$profile-symbolic" + # Send the notification + dunstify -i $icon -t 2500 -r 2593 -u normal "Power Profile: $profile" +} + +# Function to set the contents of "/tmp/powerprofile" to the current profile +function set_tmp_powerprofile { + profile=$(get_profile) + nficon=$(get_nficon $profile) + echo "$nficon $profile" > /tmp/powerprofile +} + +case $1 in + performance|balanced|power-saver) + set_profile $1 + send_notification + set_tmp_powerprofile + ;; + *) + echo "Usage: $0 {performance|balanced|power-saver}" + exit 1 + ;; +esac diff --git a/swaywm/local/bin/volume b/swaywm/local/bin/volume new file mode 100755 index 0000000..eb662b4 --- /dev/null +++ b/swaywm/local/bin/volume @@ -0,0 +1,78 @@ +#!/bin/bash + +function get_volume { + pactl get-sink-volume @DEFAULT_SINK@ | awk '/Volume:/ {print $5}' | cut -d '/' -f 1 | sed 's/%//g' +} + +function is_mute { + #amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off > /dev/null + pactl list sinks | grep -A 10 'State: ' | grep -q 'Mute: yes' +} + +function is_mic_mute { + pactl list sources | grep -A 10 'State: ' | grep -q 'Mute: yes' +} + +function get_icon { + volume=$(get_volume) + if is_mute; then + echo "audio-volume-muted-symbolic" + elif (( volume <= 39 )); then + echo "audio-volume-low-symbolic" + elif (( volume <= 74 )); then + echo "audio-volume-medium-symbolic" + elif (( volume <= 100 )); then + echo "audio-volume-high-symbolic" + else + echo "audio-volume-overamplified-symbolic" + fi +} + +function send_notification { + volume=$(get_volume) + icon=$(get_icon) + # Make the bar with the special character ─ (it's not dash -) + # https://en.wikipedia.org/wiki/Box-drawing_character + bar=$(seq -s "─" $(($volume / 5)) | sed 's/[0-9]//g') + # Send the notification + dunstify -i "$icon" -t 2500 -r 2593 -u normal " $bar" +} + +case $1 in + up) + # Set the volume on (if it was muted) + #amixer -D pulse set Master on > /dev/null + # Up the volume (+ 5%) + # amixer -D pu lse sset Master 5%+ > /dev/null + volume=$(get_volume) + if [[ $volume -le 99 ]]; then + pactl set-sink-volume @DEFAULT_SINK@ +5% + else + pactl set-sink-volume @DEFAULT_SINK@ 100% + fi + send_notification + ;; + down) + # amixer -D pulse set Master on > /dev/null + # amixer -D pulse sset Master 5%- > /dev/null + pactl set-sink-volume @DEFAULT_SINK@ -5% + send_notification + ;; + mute) + # Toggle mute + pactl set-sink-mute @DEFAULT_SINK@ toggle + if is_mute ; then + dunstify -i audio-volume-muted -t 2500 -r 2593 -u normal "Mute" + else + send_notification + fi + ;; + mute-mic) + pactl set-source-mute @DEFAULT_SOURCE@ toggle + if is_mic_mute ; then + dunstify -i microphone-sensitivity-muted-symbolic -t 2500 -r 2593 -u normal "Microphone Muted" + else + dunstify -i microphone-sensitivity-high-symbolic -t 2500 -r 2593 -u normal "Microphone Unmuted" + fi + ;; +esac diff --git a/swaywm/papes/PurplePhoneLines.jpg b/swaywm/papes/PurplePhoneLines.jpg new file mode 100644 index 0000000..2274a73 Binary files /dev/null and b/swaywm/papes/PurplePhoneLines.jpg differ diff --git a/swaywm/softlink.sh b/swaywm/softlink.sh new file mode 100755 index 0000000..ebb5c3f --- /dev/null +++ b/swaywm/softlink.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Define an associative array mapping dotfile names to their corresponding paths +declare -A dotfiles=( + ["bashrc"]="$HOME/.bashrc" + ["papes/PurplePhoneLines.jpg"]="$HOME/Pictures/Papes/PurplePhoneLines.jpg" + ["local/bin"]="$HOME/.local/bin" + ["config/foot"]="$HOME/.config/foot" + ["config/sway"]="$HOME/.config/sway" + ["config/dunst"]="$HOME/.config/dunst" + ["config/i3status/"]="$HOME/.config/i3status" + # Add more dotfiles here as needed +) + +# Function to create symbolic links +create_symlink() { + local source=$1 + local target=$2 + + # Check if the target file already exists + if [ -e "$target" ]; then + echo "Target file '$target' already exists. Skipping..." + return + fi + + # Check if the target directory exists, if not, create it + local target_dir=$(dirname "$target") + if [ ! -d "$target_dir" ]; then + mkdir -p "$target_dir" + fi + + # Create symbolic link + ln -s "$source" "$target" + echo "Created symbolic link: $source -> $target" +} + +# Loop through each dotfile and create symbolic links +for file in "${!dotfiles[@]}"; do + create_symlink "$(pwd)/$file" "${dotfiles[$file]}" +done + +echo "Dotfile setup complete." diff --git a/swaywm/update.sh b/swaywm/update.sh new file mode 100755 index 0000000..d2a0f47 --- /dev/null +++ b/swaywm/update.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +#GIT PUSH +git add * +git commit -m "Dotfiles Update: $(date)" +git push -u origin master -- cgit 1.4.1-2-gfad0