diff options
author | Soispha <soispha@vhack.eu> | 2023-08-26 23:42:21 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-08-26 23:42:21 +0200 |
commit | 3f600ab07dbad3b6dd7655587ddea158b19aea71 (patch) | |
tree | 7164ccd965e1d14ade970aeb8eb188b1442a6c91 /hm | |
parent | Style(treewide): Format all lua-files makes lua ➛ nix easier (diff) | |
download | nixos-config-3f600ab07dbad3b6dd7655587ddea158b19aea71.tar.gz nixos-config-3f600ab07dbad3b6dd7655587ddea158b19aea71.zip |
Refactor(treewide): Abbreviate path names
Diffstat (limited to 'hm')
198 files changed, 10180 insertions, 0 deletions
diff --git a/hm/default.nix b/hm/default.nix new file mode 100644 index 00000000..015cdeb2 --- /dev/null +++ b/hm/default.nix @@ -0,0 +1,60 @@ +{ + pkgs, + sysLib, + # extra information + system, + # bins + video_pause, + yambar_cpu, + yambar_memory, + lf_rename, + strip_js_comments, + river_init_lesser, + grades, + shell_library, + flake_update, + # external deps + user_js, + neovim_config, + snap-sync, + # modules + impermanence, + nixNeovim, + nixVim, +}: { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.soispha = import ./soispha; + extraSpecialArgs = { + inherit + pkgs + sysLib + # extra information + + system + # bins + + video_pause + yambar_cpu + yambar_memory + lf_rename + strip_js_comments + river_init_lesser + grades + shell_library + flake_update + # external deps + + user_js + neovim_config + snap-sync + # modules + + impermanence + nixNeovim + nixVim + ; + }; + }; +} diff --git a/hm/soispha/conf/alacritty/alacritty.yml b/hm/soispha/conf/alacritty/alacritty.yml new file mode 100644 index 00000000..fdccac3f --- /dev/null +++ b/hm/soispha/conf/alacritty/alacritty.yml @@ -0,0 +1,1003 @@ +--- +# Configuration for Alacritty, the GPU enhanced terminal emulator. + +# Import additional configuration files +# +# Imports are loaded in order, skipping all missing files, with the importing +# file being loaded last. If a field is already present in a previous import, it +# will be replaced. +# +# All imports must either be absolute paths starting with `/`, or paths relative +# to the user's home directory starting with `~/`. +#import: +# - /path/to/alacritty.yml + +# Any items in the `env` entry below will be added as +# environment variables. Some entries may override variables +# set by alacritty itself. +env: + # TERM variable + # + # This value is used to set the `$TERM` environment variable for + # each instance of Alacritty. If it is not present, alacritty will + # check the local terminfo database and use `alacritty` if it is + # available, otherwise `xterm-256color` is used. + TERM: alacritty + +window: + # Window dimensions (changes require restart) + # + # Number of lines/columns (not pixels) in the terminal. Both lines and columns + # must be non-zero for this to take effect. The number of columns must be at + # least `2`, while using a value of `0` for columns and lines will fall back + # to the window manager's recommended size + dimensions: + columns: 0 + lines: 0 + + # Window position (changes require restart) + # + # Specified in number of pixels. + # If the position is not set, the window manager will handle the placement. + #position: + # x: 0 + # y: 0 + + # Window padding (changes require restart) + # + # Blank space added around the window in pixels. This padding is scaled + # by DPI and the specified value is always added at both opposing sides. + padding: + x: 5 + y: 5 + + # Spread additional padding evenly around the terminal content. + #dynamic_padding: false + + # Window decorations + # + # Values for `decorations`: + # - full: Borders and title bar + # - none: Neither borders nor title bar + # + # Values for `decorations` (macOS only): + # - transparent: Title bar, transparent background and title bar buttons + # - buttonless: Title bar, transparent background and no title bar buttons + decorations: none + + # Background opacity + # + # Window opacity as a floating point number from `0.0` to `1.0`. + # The value `0.0` is completely transparent and `1.0` is opaque. + opacity: 0.9 + + # Startup Mode (changes require restart) + # + # Values for `startup_mode`: + # - Windowed + # - Maximized + # - Fullscreen + # + # Values for `startup_mode` (macOS only): + # - SimpleFullscreen + startup_mode: Windowed + + # Window title + title: Alacritty + + # Allow terminal applications to change Alacritty's window title. + dynamic_title: true + + # Window class (Linux/BSD only): + class: + # Application instance name + instance: Alacritty + # General application class + general: Alacritty + + # Decorations theme variant + # + # Override the variant of the System theme/GTK theme/Wayland client side + # decorations. Commonly supported values are `Dark`, `Light`, and `None` for + # auto pick-up. Set this to `None` to use the default theme variant. + decorations_theme_variant: None + + # Resize increments + # + # Prefer resizing window by discrete steps equal to cell dimensions. + #resize_increments: false + + # Make `Option` key behave as `Alt` (macOS only): + # - OnlyLeft + # - OnlyRight + # - Both + # - None (default) + #option_as_alt: None + +scrolling: + # Maximum number of lines in the scrollback buffer. + # Specifying '0' will disable scrolling. + history: 10000 + + # Scrolling distance multiplier. + multiplier: 3 + +# Font configuration +font: + # Normal (roman) font face + normal: + # Font family + # + # Default: + # - (macOS) Menlo + # - (Linux/BSD) monospace + # - (Windows) Consolas + # family: Source Code Pro + #family: SauceCodePro Nerd Font # This is needed because of reserved font names + family: SauceCodePro Nerd Font Mono + + # The `style` can be specified to pick a specific face. + style: Regular + + # Bold font face + #bold: + # Font family + # + # If the bold family is not specified, it will fall back to the + # value specified for the normal font. + #family: Source Code Pro + + # The `style` can be specified to pick a specific face. + #style: Bold + + # Italic font face + #italic: + # Font family + # + # If the italic family is not specified, it will fall back to the + # value specified for the normal font. + #family: Source Code Pro + + # The `style` can be specified to pick a specific face. + #style: Italic + + # Bold italic font face + #bold_italic: + # Font family + # + # If the bold italic family is not specified, it will fall back to the + # value specified for the normal font. + #family: Source Code Pro + + # The `style` can be specified to pick a specific face. + #style: Bold Italic + + # Point size + size: 12.0 + + # Offset is the extra space around each character. `offset.y` can be thought + # of as modifying the line spacing, and `offset.x` as modifying the letter + # spacing. + offset: + x: -1 + y: -1 + + # Glyph offset determines the locations of the glyphs within their cells with + # the default being at the bottom. Increasing `x` moves the glyph to the + # right, increasing `y` moves the glyph upward. + glyph_offset: + x: -1 + y: -1 + + # Use built-in font for box drawing characters. + # + # If `true`, Alacritty will use a custom built-in font for box drawing + # characters (Unicode points 2500 - 259f). + # + builtin_box_drawing: true # TODO: + +# If `true`, bold text is drawn using the bright color variants. +#draw_bold_text_with_bright_colors: true # TODO: + +# Colors (Tomorrow Night) +colors: + # Default colors + primary: + background: '#191919' + foreground: '#d8dee9' + + # Bright and dim foreground colors + # + # The dimmed foreground color is calculated automatically if it is not + # present. If the bright foreground color is not set, or + # `draw_bold_text_with_bright_colors` is `false`, the normal foreground + # color will be used. + #dim_foreground: '#828482' + #bright_foreground: '#eaeaea' + + # Cursor colors + # + # Colors which should be used to draw the terminal cursor. + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + cursor: + text: '#191919' + cursor: '#d8dee9' + + # Vi mode cursor colors + # + # Colors for the cursor when the vi mode is active. + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + vi_mode_cursor: + text: CellBackground + cursor: CellForeground + + # Search colors + # + # Colors used for the search bar and match highlighting. + search: + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + matches: + foreground: '#000000' + background: '#ffffff' + focused_match: + foreground: '#ffffff' + background: '#000000' + + # Keyboard hints + hints: + # First character in the hint label + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + start: + foreground: '#1d1f21' + background: '#e9ff5e' + + # All characters after the first one in the hint label + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + end: + foreground: '#e9ff5e' + background: '#1d1f21' + + # Line indicator + # + # Color used for the indicator displaying the position in history during + # search and vi mode. + # + # By default, these will use the opposing primary color. + #line_indicator: + # foreground: None + # background: None + + # Footer bar + # + # Color used for the footer bar on the bottom, used by search regex input, + # hyperlink URI preview, etc. + # + footer_bar: + background: '#c5c8c6' + foreground: '#1d1f21' + + # Selection colors + # + # Colors which should be used to draw the selection area. + # + # Allowed values are CellForeground/CellBackground, which reference the + # affected cell, or hexadecimal colors like #ff00ff. + selection: + text: '#191919' + background: '#d8dee9' + + # Normal colors + normal: + black: '#191919' + red: '#b02626' + green: '#40a62f' + yellow: '#f2e635' + blue: '#314ad0' + magenta: '#b30ad0' + cyan: '#32d0fc' + white: '#acadb1' + + # Bright colors + bright: + black: '#36393d' + red: '#ce2727' + green: '#47c930' + yellow: '#fff138' + blue: '#2e4bea' + magenta: '#cc15ed' + cyan: '#54d9ff' + white: '#dbdbdb' + + # Dim colors + # + # If the dim colors are not set, they will be calculated automatically based + # on the `normal` colors. + dim: + black: '#676f78' + red: '#b55454' + green: '#78a670' + yellow: '#faf380' + blue: '#707fd0' + magenta: '#c583d0' + cyan: '#8adaf1' + white: '#e0e3e7' + # Indexed Colors + # + # The indexed colors include all colors from 16 to 256. + # When these are not set, they're filled with sensible defaults. + # + # Example: + # `- { index: 16, color: '#ff00ff' }` + # + #indexed_colors: [] + + # Transparent cell backgrounds + # + # Whether or not `window.opacity` applies to all cell backgrounds or only to + # the default background. When set to `true` all cells will be transparent + # regardless of their background color. + #transparent_background_colors: false # TODO: + +# Bell +# +# The bell is rung every time the BEL control character is received. +#bell: + # Visual Bell Animation + # + # Animation effect for flashing the screen when the visual bell is rung. + # + # Values for `animation`: + # - Ease + # - EaseOut + # - EaseOutSine + # - EaseOutQuad + # - EaseOutCubic + # - EaseOutQuart + # - EaseOutQuint + # - EaseOutExpo + # - EaseOutCirc + # - Linear + #animation: EaseOutExpo + + # Duration of the visual bell flash in milliseconds. A `duration` of `0` will + # disable the visual bell animation. + duration: 0 + + # Visual bell animation color. + #color: '#ffffff' + + # Bell Command + # + # This program is executed whenever the bell is rung. + # + # When set to `command: None`, no command will be executed. + # + # Example: + # command: + # program: notify-send + # args: ["Hello, World!"] + # + #command: None + +selection: + # This string contains all characters that are used as separators for + # "semantic words" in Alacritty. + semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" + + # When set to `true`, selected text will be copied to the primary clipboard. + save_to_clipboard: false + +cursor: + # Cursor style + style: + # Cursor shape + # + # Values for `shape`: + # - ▇ Block + # - _ Underline + # - | Beam + shape: Beam + + # Cursor blinking state + # + # Values for `blinking`: + # - Never: Prevent the cursor from ever blinking + # - Off: Disable blinking by default + # - On: Enable blinking by default + # - Always: Force the cursor to always blink + blinking: On + + # Vi mode cursor style + # + # If the vi mode cursor style is `None` or not specified, it will fall back to + # the style of the active value of the normal cursor. + # + # See `cursor.style` for available options. + vi_mode_style: None + + # Cursor blinking interval in milliseconds. + blink_interval: 750 + + # Time after which cursor stops blinking, in seconds. + # + # Specifying '0' will disable timeout for blinking. + blink_timeout: 5 + + # If this is `true`, the cursor will be rendered as a hollow box when the + # window is not focused. + unfocused_hollow: true + + # Thickness of the cursor relative to the cell width as floating point number + # from `0.0` to `1.0`. + thickness: 0.15 + +# Live config reload (changes require restart) +live_config_reload: true + +# Shell +# +# You can set `shell.program` to the path of your favorite shell, e.g. +# `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the +# shell. +# +# Default: +# - (Linux/BSD/macOS) `$SHELL` or the user's login shell, if `$SHELL` is unset +# - (Windows) powershell +#shell: +# program: /bin/bash +# args: +# - --login + +# Startup directory +# +# Directory the shell is started in. If this is unset, or `None`, the working +# directory of the parent process will be used. +#working_directory: None + +# Offer IPC using `alacritty msg` (unix only) +ipc_socket: true + +mouse: + # Click settings + # + # The `double_click` and `triple_click` settings control the time + # alacritty should wait for accepting multiple clicks as one double + # or triple click. + double_click: { threshold: 300 } + triple_click: { threshold: 300 } + + # If this is `true`, the cursor is temporarily hidden when typing. + hide_when_typing: false + +# Hints +# +# Terminal hints can be used to find text or hyperlink in the visible part of +# the terminal and pipe it to other applications. +hints: + # Keys used for the hint labels. + alphabet: "jfkdls;ahgurieowpq" + + # List with all available hints + # + # Each hint must have any of `regex` or `hyperlinks` field and either an + # `action` or a `command` field. The fields `mouse`, `binding` and + # `post_processing` are optional. + # + # The `hyperlinks` option will cause OSC 8 escape sequence hyperlinks to be + # highlighted. + # + # The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and + # `mouse.mods` accept the same values as they do in the `key_bindings` section. + # + # The `mouse.enabled` field controls if the hint should be underlined while + # the mouse with all `mouse.mods` keys held or the vi mode cursor is above it. + # + # If the `post_processing` field is set to `true`, heuristics will be used to + # shorten the match if there are characters likely not to be part of the hint + # (e.g. a trailing `.`). This is most useful for URIs and applies only to + # `regex` matches. + # + # Values for `action`: + # - Copy + # Copy the hint's text to the clipboard. + # - Paste + # Paste the hint's text to the terminal or search. + # - Select + # Select the hint's text. + # - MoveViModeCursor + # Move the vi mode cursor to the beginning of the hint. + enabled: + - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\ + [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+" + hyperlinks: true + command: xdg-open + post_processing: true + mouse: + enabled: true + mods: None + binding: + key: U + mods: Control|Shift + + - regex: "([^ '\"`=:\\[\\(]*/)([^/: '\"`\\)\\]]*)" + action: Paste + post_procesing: false + binding: + key: T + mods: Control|Shift + + - regex: "([a-z0-9]{7})\\s" + action: Paste + post_procesing: false + binding: + key: H + mods: Control|Shift + + # multi regex for different purposes: + # 2. UUIDs + # 3. hex (for example signatures) + # 4. IP addresses +# - regex: "([[:alnum:]_$%&+=/@-]+)\ +#|([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\ +#|([0-9a-f]{12,128})\ +#|([[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3})" +# action: Copy +# post_processing: false +# binding: +# key: U +# mods: Control|Shift + +# Mouse bindings +# +# Mouse bindings are specified as a list of objects, much like the key +# bindings further below. +# +# To trigger mouse bindings when an application running within Alacritty +# captures the mouse, the `Shift` modifier is automatically added as a +# requirement. +# +# Each mouse binding will specify a: +# +# - `mouse`: +# +# - Middle +# - Left +# - Right +# - Numeric identifier such as `5` +# +# - `action` (see key bindings for actions not exclusive to mouse mode) +# +# - Mouse exclusive actions: +# +# - ExpandSelection +# Expand the selection to the current mouse cursor location. +# +# And optionally: +# +# - `mods` (see key bindings) +mouse_bindings: +# - { mouse: Right, action: ExpandSelection } +# - { mouse: Right, mods: Control, action: ExpandSelection } + - { mouse: Middle, action: Copy } + +# Key bindings +# +# Key bindings are specified as a list of objects. For example, this is the +# default paste binding: +# +# `- { key: V, mods: Control|Shift, action: Paste }` +# +# Each key binding will specify a: +# +# - `key`: Identifier of the key pressed +# +# - A-Z +# - F1-F24 +# - Key0-Key9 +# +# A full list with available key codes can be found here: +# https://docs.rs/winit/*/winit/event/enum.VirtualKeyCode.html#variants +# +# Instead of using the name of the keys, the `key` field also supports using +# the scancode of the desired key. Scancodes have to be specified as a +# decimal number. This command will allow you to display the hex scancodes +# for certain keys: +# +# `showkey --scancodes`. +# +# Then exactly one of: +# +# - `chars`: Send a byte sequence to the running application +# +# The `chars` field writes the specified string to the terminal. This makes +# it possible to pass escape sequences. To find escape codes for bindings +# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside +# of tmux. Note that applications use terminfo to map escape sequences back +# to keys. It is therefore required to update the terminfo when changing an +# escape sequence. +# +# - `action`: Execute a predefined action +# +# - ToggleViMode +# - SearchForward +# Start searching toward the right of the search origin. +# - SearchBackward +# Start searching toward the left of the search origin. +# - Copy +# - Paste +# - IncreaseFontSize +# - DecreaseFontSize +# - ResetFontSize +# - ScrollPageUp +# - ScrollPageDown +# - ScrollHalfPageUp +# - ScrollHalfPageDown +# - ScrollLineUp +# - ScrollLineDown +# - ScrollToTop +# - ScrollToBottom +# - ClearHistory +# Remove the terminal's scrollback history. +# - Hide +# Hide the Alacritty window. +# - Minimize +# Minimize the Alacritty window. +# - Quit +# Quit Alacritty. +# - ToggleFullscreen +# - ToggleMaximized +# - SpawnNewInstance +# Spawn a new instance of Alacritty. +# - CreateNewWindow +# Create a new Alacritty window from the current process. +# - ClearLogNotice +# Clear Alacritty's UI warning and error notice. +# - ClearSelection +# Remove the active selection. +# - ReceiveChar +# - None +# +# - Vi mode exclusive actions: +# +# - Open +# Perform the action of the first matching hint under the vi mode cursor +# with `mouse.enabled` set to `true`. +# - ToggleNormalSelection +# - ToggleLineSelection +# - ToggleBlockSelection +# - ToggleSemanticSelection +# Toggle semantic selection based on `selection.semantic_escape_chars`. +# - CenterAroundViCursor +# Center view around vi mode cursor +# +# - Vi mode exclusive cursor motion actions: +# +# - Up +# One line up. +# - Down +# One line down. +# - Left +# One character left. +# - Right +# One character right. +# - First +# First column, or beginning of the line when already at the first column. +# - Last +# Last column, or beginning of the line when already at the last column. +# - FirstOccupied +# First non-empty cell in this terminal row, or first non-empty cell of +# the line when already at the first cell of the row. +# - High +# Top of the screen. +# - Middle +# Center of the screen. +# - Low +# Bottom of the screen. +# - SemanticLeft +# Start of the previous semantically separated word. +# - SemanticRight +# Start of the next semantically separated word. +# - SemanticLeftEnd +# End of the previous semantically separated word. +# - SemanticRightEnd +# End of the next semantically separated word. +# - WordLeft +# Start of the previous whitespace separated word. +# - WordRight +# Start of the next whitespace separated word. +# - WordLeftEnd +# End of the previous whitespace separated word. +# - WordRightEnd +# End of the next whitespace separated word. +# - Bracket +# Character matching the bracket at the cursor's location. +# - SearchNext +# Beginning of the next match. +# - SearchPrevious +# Beginning of the previous match. +# - SearchStart +# Start of the match to the left of the vi mode cursor. +# - SearchEnd +# End of the match to the right of the vi mode cursor. +# +# - Search mode exclusive actions: +# - SearchFocusNext +# Move the focus to the next search match. +# - SearchFocusPrevious +# Move the focus to the previous search match. +# - SearchConfirm +# - SearchCancel +# - SearchClear +# Reset the search regex. +# - SearchDeleteWord +# Delete the last word in the search regex. +# - SearchHistoryPrevious +# Go to the previous regex in the search history. +# - SearchHistoryNext +# Go to the next regex in the search history. +# +# - macOS exclusive actions: +# - ToggleSimpleFullscreen +# Enter fullscreen without occupying another space. +# +# - Linux/BSD exclusive actions: +# +# - CopySelection +# Copy from the selection buffer. +# - PasteSelection +# Paste from the selection buffer. +# +# - `command`: Fork and execute a specified command plus arguments +# +# The `command` field must be a map containing a `program` string and an +# `args` array of command line parameter strings. For example: +# `{ program: "alacritty", args: ["-e", "vttest"] }` +# +# And optionally: +# +# - `mods`: Key modifiers to filter binding actions +# +# - Command +# - Control +# - Option +# - Super +# - Shift +# - Alt +# +# Multiple `mods` can be combined using `|` like this: +# `mods: Control|Shift`. +# Whitespace and capitalization are relevant and must match the example. +# +# - `mode`: Indicate a binding for only specific terminal reported modes +# +# This is mainly used to send applications the correct escape sequences +# when in different modes. +# +# - AppCursor +# - AppKeypad +# - Search +# - Alt +# - Vi +# +# A `~` operator can be used before a mode to apply the binding whenever +# the mode is *not* active, e.g. `~Alt`. +# +# Bindings are always filled by default, but will be replaced when a new +# binding with the same triggers is defined. To unset a default binding, it can +# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for +# a no-op if you do not wish to receive input characters for that binding. +# +# If the same trigger is assigned to multiple actions, all of them are executed +# in the order they were defined in. +key_bindings: +# +# + - { key: P, mods: Control, action: Paste } + - { key: Insert, mods: Shift, action: Paste } + - { key: Slash, mods: Control, chars: "gc" } + - { key: Y, mods: Control, action: Copy } + - { key: Key0, mods: Control, action: ResetFontSize } + - { key: Equals, mods: Control, action: IncreaseFontSize } + - { key: Plus, mods: Control, action: IncreaseFontSize } + - { key: Minus, mods: Control, action: DecreaseFontSize } + + # Vi Mode + - { key: Space, mods: Control, action: ToggleViMode } + - { key: Space, mods: Control, mode: Vi, action: ScrollToBottom } + - { key: I, mode: Vi, action: ScrollToBottom } + - { key: I, mode: Vi, action: ToggleViMode } + - { key: C, mods: Control, mode: Vi, action: ScrollToBottom } + - { key: C, mods: Control, mode: Vi, action: ToggleViMode } + - { key: Escape, mode: Vi, action: ClearSelection } + - { key: Y, mods: Control, mode: Vi, action: ScrollLineUp } + - { key: E, mods: Control, mode: Vi, action: ScrollLineDown } + - { key: G, mode: Vi, action: ScrollToTop } + - { key: G, mods: Shift, mode: Vi, action: ScrollToBottom } + - { key: B, mods: Control, mode: Vi, action: ScrollPageUp } + - { key: F, mods: Control, mode: Vi, action: ScrollPageDown } + - { key: U, mods: Control, mode: Vi, action: ScrollHalfPageUp } + - { key: D, mods: Control, mode: Vi, action: ScrollHalfPageDown } + - { key: Y, mode: Vi, action: Copy } + - { key: Y, mode: Vi, action: ClearSelection } + - { key: V, mode: Vi, action: ToggleNormalSelection } + - { key: V, mods: Shift, mode: Vi, action: ToggleLineSelection } + - { key: V, mods: Control, mode: Vi, action: ToggleBlockSelection } + - { key: V, mods: Alt, mode: Vi, action: ToggleSemanticSelection } + - { key: Return, mode: Vi, action: Open } + - { key: K, mode: Vi, action: Up } + - { key: J, mode: Vi, action: Down } + - { key: H, mode: Vi, action: Left } + - { key: L, mode: Vi, action: Right } + - { key: Up, mode: Vi, action: Up } + - { key: Down, mode: Vi, action: Down } + - { key: Left, mode: Vi, action: Left } + - { key: Right, mode: Vi, action: Right } + - { key: Key0, mode: Vi, action: First } + - { key: Key4, mode: Vi, action: Last } + - { key: Key6, mods: Shift, mode: Vi, action: FirstOccupied } + - { key: H, mods: Shift, mode: Vi, action: High } + - { key: M, mods: Shift, mode: Vi, action: Middle } + - { key: L, mods: Shift, mode: Vi, action: Low } + - { key: B, mode: Vi, action: SemanticLeft } + - { key: W, mode: Vi, action: SemanticRight } + - { key: E, mode: Vi, action: SemanticRightEnd } + - { key: B, mods: Shift, mode: Vi, action: WordLeft } + - { key: W, mods: Shift, mode: Vi, action: WordRight } + - { key: E, mods: Shift, mode: Vi, action: WordRightEnd } + - { key: Key5, mods: Shift, mode: Vi, action: Bracket } + - { key: Slash, mode: Vi, action: SearchForward } + - { key: Slash, mods: Shift, mode: Vi, action: SearchBackward } + - { key: N, mode: Vi, action: SearchNext } + - { key: N, mods: Shift, mode: Vi, action: SearchPrevious } +# +# +# + #- { key: Paste, action: Paste } + #- { key: Copy, action: Copy } + #- { key: L, mods: Control, action: ClearLogNotice } + #- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } + #- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp } + #- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown } + #- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop } + #- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } + + # Vi Mode + #- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode } + #- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom } + #- { key: Escape, mode: Vi|~Search, action: ClearSelection } + #- { key: I, mode: Vi|~Search, action: ToggleViMode } + #- { key: I, mode: Vi|~Search, action: ScrollToBottom } + #- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode } + #- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp } + #- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown } + #- { key: G, mode: Vi|~Search, action: ScrollToTop } + #- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom } + #- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp } + #- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown } + #- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp } + #- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown } + #- { key: Y, mode: Vi|~Search, action: Copy } + #- { key: Y, mode: Vi|~Search, action: ClearSelection } + #- { key: Copy, mode: Vi|~Search, action: ClearSelection } + #- { key: V, mode: Vi|~Search, action: ToggleNormalSelection } + #- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection } + #- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection } + #- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection } + #- { key: Return, mode: Vi|~Search, action: Open } + #- { key: Z, mode: Vi|~Search, action: CenterAroundViCursor } + #- { key: K, mode: Vi|~Search, action: Up } + #- { key: J, mode: Vi|~Search, action: Down } + #- { key: H, mode: Vi|~Search, action: Left } + #- { key: L, mode: Vi|~Search, action: Right } + #- { key: Up, mode: Vi|~Search, action: Up } + #- { key: Down, mode: Vi|~Search, action: Down } + #- { key: Left, mode: Vi|~Search, action: Left } + #- { key: Right, mode: Vi|~Search, action: Right } + #- { key: Key0, mode: Vi|~Search, action: First } + #- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last } + #- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied } + #- { key: H, mods: Shift, mode: Vi|~Search, action: High } + #- { key: M, mods: Shift, mode: Vi|~Search, action: Middle } + #- { key: L, mods: Shift, mode: Vi|~Search, action: Low } + #- { key: B, mode: Vi|~Search, action: SemanticLeft } + #- { key: W, mode: Vi|~Search, action: SemanticRight } + #- { key: E, mode: Vi|~Search, action: SemanticRightEnd } + #- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft } + #- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight } + #- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd } + #- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket } + #- { key: Slash, mode: Vi|~Search, action: SearchForward } + #- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward } + #- { key: N, mode: Vi|~Search, action: SearchNext } + #- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious } + + # Search Mode + #- { key: Return, mode: Search|Vi, action: SearchConfirm } + #- { key: Escape, mode: Search, action: SearchCancel } + #- { key: C, mods: Control, mode: Search, action: SearchCancel } + #- { key: U, mods: Control, mode: Search, action: SearchClear } + #- { key: W, mods: Control, mode: Search, action: SearchDeleteWord } + #- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious } + #- { key: N, mods: Control, mode: Search, action: SearchHistoryNext } + #- { key: Up, mode: Search, action: SearchHistoryPrevious } + #- { key: Down, mode: Search, action: SearchHistoryNext } + #- { key: Return, mode: Search|~Vi, action: SearchFocusNext } + #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } + + # (Windows, Linux, and BSD only) + #- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } + #- { key: C, mods: Control|Shift, action: Copy } + #- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward } + #- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward } + #- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection } + #- { key: Insert, mods: Shift, action: PasteSelection } + #- { key: Key0, mods: Control, action: ResetFontSize } + #- { key: Equals, mods: Control, action: IncreaseFontSize } + #- { key: Plus, mods: Control, action: IncreaseFontSize } + #- { key: NumpadAdd, mods: Control, action: IncreaseFontSize } + #- { key: Minus, mods: Control, action: DecreaseFontSize } + #- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } + + # (Windows only) + #- { key: Return, mods: Alt, action: ToggleFullscreen } + + # (macOS only) + #- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" } + #- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory } + #- { key: Key0, mods: Command, action: ResetFontSize } + #- { key: Equals, mods: Command, action: IncreaseFontSize } + #- { key: Plus, mods: Command, action: IncreaseFontSize } + #- { key: NumpadAdd, mods: Command, action: IncreaseFontSize } + #- { key: Minus, mods: Command, action: DecreaseFontSize } + #- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize } + #- { key: V, mods: Command, action: Paste } + #- { key: C, mods: Command, action: Copy } + #- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection } + #- { key: H, mods: Command, action: Hide } + #- { key: H, mods: Command|Alt, action: HideOtherApplications } + #- { key: M, mods: Command, action: Minimize } + #- { key: Q, mods: Command, action: Quit } + #- { key: W, mods: Command, action: Quit } + #- { key: N, mods: Command, action: CreateNewWindow } + #- { key: F, mods: Command|Control, action: ToggleFullscreen } + #- { key: F, mods: Command, mode: ~Search, action: SearchForward } + #- { key: B, mods: Command, mode: ~Search, action: SearchBackward } + +#debug: + # Display the time it takes to redraw each frame. + #render_timer: false + + # Keep the log file after quitting Alacritty. + #persistent_logging: false + + # Log level + # + # Values for `log_level`: + # - Off + # - Error + # - Warn + # - Info + # - Debug + # - Trace + #log_level: Warn + + # Renderer override. + # - glsl3 + # - gles2 + # - gles2_pure + #renderer: None + + # Print all received window events. + #print_events: false + + # Highlight window damage information. + #highlight_damage: false diff --git a/hm/soispha/conf/alacritty/default.nix b/hm/soispha/conf/alacritty/default.nix new file mode 100644 index 00000000..4e98f502 --- /dev/null +++ b/hm/soispha/conf/alacritty/default.nix @@ -0,0 +1,6 @@ +{config, ...}: { + programs.alacritty = { + enable = true; + }; + xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml; +} diff --git a/hm/soispha/conf/btop/default.nix b/hm/soispha/conf/btop/default.nix new file mode 100644 index 00000000..06b56ea7 --- /dev/null +++ b/hm/soispha/conf/btop/default.nix @@ -0,0 +1,5 @@ +{config, ...}: { + programs.btop = { + enable = true; + }; +} diff --git a/hm/soispha/conf/dconf/default.nix b/hm/soispha/conf/dconf/default.nix new file mode 100644 index 00000000..dc439e1e --- /dev/null +++ b/hm/soispha/conf/dconf/default.nix @@ -0,0 +1,9 @@ +{...}: { + # Also see: https://github.com/gvolpe/dconf2nix + dconf.settings = { + "org/gnome/desktop/wm/preferences" = { + # hide gtk buttons in titelbar + button-layout = ""; + }; + }; +} diff --git a/hm/soispha/conf/default.nix b/hm/soispha/conf/default.nix new file mode 100644 index 00000000..01d18d4a --- /dev/null +++ b/hm/soispha/conf/default.nix @@ -0,0 +1,38 @@ +{...}: { + imports = [ + ./alacritty + ./btop + ./dconf + ./direnv + ./firefox + ./gammastep + ./git + ./gpg + ./grades + ./gtk + ./himalaya + ./iamb + ./keepassxc + ./latexindent + ./less + ./lf + ./mail + ./mako + ./mbsync + ./mpd + ./mpv + ./mumble + ./neomutt + ./nvim + ./nheko + ./npm + ./python + ./rclone + ./ssh + ./swayidle + ./swaylock + ./tridactyl + ./yambar + ./zsh + ]; +} diff --git a/hm/soispha/conf/direnv/default.nix b/hm/soispha/conf/direnv/default.nix new file mode 100644 index 00000000..3a7b8add --- /dev/null +++ b/hm/soispha/conf/direnv/default.nix @@ -0,0 +1,6 @@ +{...}: { + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; +} diff --git a/hm/soispha/conf/firefox/config/bookmarks/default.nix b/hm/soispha/conf/firefox/config/bookmarks/default.nix new file mode 100644 index 00000000..4de83ac9 --- /dev/null +++ b/hm/soispha/conf/firefox/config/bookmarks/default.nix @@ -0,0 +1,26 @@ +[ + { + name = "Feed - Piped"; + url = "https://piped.video/feed"; + } + + { + name = "DeepL Translate"; + url = "https://www.deepl.com/translator"; + } + + { + name = "HM Options"; + url = "https://mipmip.github.io/home-manager-option-search/"; + } + + { + name = "Nix lib"; + url = "https://teu5us.github.io/nix-lib.html"; + } + + { + name = "Nixpkgs manual"; + url = "https://ryantm.github.io/nixpkgs/"; + } +] diff --git a/hm/soispha/conf/firefox/config/chrome/userChrome.css b/hm/soispha/conf/firefox/config/chrome/userChrome.css new file mode 100644 index 00000000..0b3aff77 --- /dev/null +++ b/hm/soispha/conf/firefox/config/chrome/userChrome.css @@ -0,0 +1,41 @@ +/* thickness of tab when you have too many open tabs */ +.tabbrowser-tab:not([pinned="true"]) { + min-width: 10px !important; + min-height: 10px !important; +} + +/* tab height +#TabsToolbar .tabbrowser-tabs { +min-height: 10px !important; +} +*/ + +/* +.tabbrowser-tab {min-width: 016px !important;} +.tabbrowser-tab {clip-width: 016px !important;} +*/ + +/* the + button that opens new tabs */ +#TabsToolbar .tabs-newtab-button { + margin-left: 10px !important; + height: Auto !important; +} + +#main-window[privatebrowsingmode="temporary"] #navigator-toolbox { + background-color: #c40944 !important; +} + +/* close button inside a tab */ +.tab-close-button * { + width: 10px !important; + height: 10px !important; +} + +/* bookmark toolbar */ +#personal-bookmarks .bookmark-item > .toolbarbutton-text { + font-size: 10pt !important; +} +#personal-bookmarks .bookmark-item > .toolbarbutton-icon { + height: 12px !important; + width: 12px !important; +} diff --git a/hm/soispha/conf/firefox/config/extensions/extensions.json b/hm/soispha/conf/firefox/config/extensions/extensions.json new file mode 100644 index 00000000..7f32dfb1 --- /dev/null +++ b/hm/soispha/conf/firefox/config/extensions/extensions.json @@ -0,0 +1,51 @@ +{ + "darkreader": { + "addonId": "addon@darkreader.org", + "pname": "darkreader", + "sha256": "sha256:964d7fdeec1dc90b5238a82db699de7a2bbf54e3e2bf18569befff451f35f89a", + "url": "https://addons.mozilla.org/firefox/downloads/file/4151368/darkreader-4.9.65.xpi", + "version": "4.9.65" + }, + "keepassxc-browser": { + "addonId": "keepassxc-browser@keepassxc.org", + "pname": "keepassxc-browser", + "sha256": "sha256:deb1c3c29fabe90dd811536d434d64c200caab9a9f7febc3428aa170eefec5f2", + "url": "https://addons.mozilla.org/firefox/downloads/file/4134768/keepassxc_browser-1.8.7.xpi", + "version": "1.8.7" + }, + "libredirect": { + "addonId": "7esoorv3@alefvanoon.anonaddy.me", + "pname": "libredirect", + "sha256": "sha256:564e56e1ccccf2f445b6cb9485c602609589a23052d2a53ab491cbce51c6b42f", + "url": "https://addons.mozilla.org/firefox/downloads/file/4144580/libredirect-2.7.1.xpi", + "version": "2.7.1" + }, + "simple-tab-groups": { + "addonId": "simple-tab-groups@drive4ik", + "pname": "simple-tab-groups", + "sha256": "sha256:b56f30cea753a9c4d1c0e078c0e5e635f1885ea7e40305cee59b9e145fad0a6c", + "url": "https://addons.mozilla.org/firefox/downloads/file/4103800/simple_tab_groups-5.2.xpi", + "version": "5.2" + }, + "tridactyl-vim": { + "addonId": "tridactyl.vim@cmcaine.co.uk", + "pname": "tridactyl-vim", + "sha256": "sha256:08b7af97bef05300ab3ac3ad721322ff00505631233482568fc4489c16d51b71", + "url": "https://addons.mozilla.org/firefox/downloads/file/4036604/tridactyl_vim-1.23.0.xpi", + "version": "1.23.0" + }, + "ublock-origin": { + "addonId": "uBlock0@raymondhill.net", + "pname": "ublock-origin", + "sha256": "sha256:8b73468bc233a11dd2895219466381783d19123857dd0b6fd16a01820fca4834", + "url": "https://addons.mozilla.org/firefox/downloads/file/4141256/ublock_origin-1.51.0.xpi", + "version": "1.51.0" + }, + "video-pauser": { + "addonId": "video-pauser@addons.vhack.eu", + "pname": "video-pauser", + "sha256": "sha256:da02e29f1d50d3a6db8a28bb7972afaeaa788bb8d38a2e9ebbfcd73d65d84841", + "url": "https://addons.mozilla.org/firefox/downloads/file/4098103/video_pauser-0.1.0.xpi", + "version": "0.1.0" + } +} diff --git a/hm/soispha/conf/firefox/config/prefs/default.nix b/hm/soispha/conf/firefox/config/prefs/default.nix new file mode 100644 index 00000000..91bb65f0 --- /dev/null +++ b/hm/soispha/conf/firefox/config/prefs/default.nix @@ -0,0 +1,23 @@ +{ + pkgs, + config, + user_js, + lib, + ... +}: let + bookmarks = import ../bookmarks; + firefoxBookmarksFile = (import ../../functions/bookmarks) {inherit lib pkgs;}; + user_js_override = pkgs.writeText "user.override.js" (builtins.readFile ./override.js); +in + pkgs.runCommand "user.js" {} '' + mkdir $out; + cat "${user_js}/user.js" > $out/user.js; + cat "${user_js_override}" >> $out/user.js; + + cat << EOF >> $out/user.js; + // My bookmarks + user_pref("browser.bookmarks.file", "${toString (firefoxBookmarksFile bookmarks)}"); + user_pref("browser.startup.homepage", "file:///home/dt/home.html"); // 0103 // TODO: add this from a flake + user_pref("browser.download.dir", "${config.home.homeDirectory}/media/downloads"); + EOF + '' diff --git a/hm/soispha/conf/firefox/config/prefs/override.js b/hm/soispha/conf/firefox/config/prefs/override.js new file mode 100644 index 00000000..9c9b70e5 --- /dev/null +++ b/hm/soispha/conf/firefox/config/prefs/override.js @@ -0,0 +1,191 @@ +/* + 0100: STARTUP + 0200: GEOLOCATION / LANGUAGE / LOCALE + 0300: QUIETER FOX + 0400: SAFE BROWSING + 0600: BLOCK IMPLICIT OUTBOUND + 0700: DNS / DoH / PROXY / SOCKS / IPv6 + 0800: LOCATION BAR / SEARCH BAR / SUGGESTIONS / HISTORY / FORMS + 0900: PASSWORDS + 1000: DISK AVOIDANCE + 1200: HTTPS (SSL/TLS / OCSP / CERTS / HPKP) + 1400: FONTS + 1600: HEADERS / REFERERS + 1700: CONTAINERS + 2000: PLUGINS / MEDIA / WEBRTC + 2400: DOM (DOCUMENT OBJECT MODEL) + 2600: MISCELLANEOUS + 2700: ETP (ENHANCED TRACKING PROTECTION) + 2800: SHUTDOWN & SANITIZING + 4500: RFP (RESIST FINGERPRINTING) + 5000: OPTIONAL OPSEC + 5500: OPTIONAL HARDENING + 6000: DON'T TOUCH + 7000: DON'T BOTHER + 8000: DON'T BOTHER: FINGERPRINTING + 9000: NON-PROJECT RELATED + 9999: DEPRECATED / REMOVED / LEGACY / RENAMED +*/ + + +// restore session +user_pref("browser.startup.page", 3); // 0102 + +user_pref("browser.newtabpage.enabled", true); // 0104 + +// disable the geoservice, TODO: don't know if I want this +//user_pref("geo.provider.use_geoclue", false); // 0202 + +// TODO: is this something useful? +user_pref("datareporting.policy.dataSubmissionEnabled", true); // 0330 + +// enable health reports +user_pref("datareporting.healthreport.uploadEnabled", true); // 0331 + +// Do I want to opt-out? +user_pref("toolkit.telemetry.coverage.opt-out", false); // 0333 + +// enables studies +user_pref("app.shield.optoutstudies.enabled", true); // 0340 + +// I guess that browsing protection is useful +user_pref("browser.safebrowsing.downloads.remote.enabled", true); // 0403 + +// TODO: does this (-> set to false) make things slower? +user_pref("network.prefetch-next", true); // 0601 + +// enable ipv6 because the rest of the system uses it +user_pref("network.dns.disableIPv6", false); // 0701 + +// TRR only +user_pref("network.trr.mode", 3); // 0710 + +// I trust my search engine +user_pref("keyword.enabled", true); // 801 +user_pref("browser.search.suggest.enabled", true); // 0804 +user_pref("browser.urlbar.suggest.searches", true); // 0804 +// TODO: no idea what this does, enabling it +user_pref("browser.urlbar.showSearchTerms.enabled", true); // 9004 + +// prefetch urls, if the get auto completed +user_pref("browser.urlbar.speculativeConnect.enabled", true); // 0805 + +// Disable autoScrolling (clicking with the mouse wheel) +user_pref("general.autoScroll", false); + +// add new tabs after the current one +user_pref("browser.tabs.insertAfterCurrent", true); + +// TODO: I might want to enable this +//user_pref("browser.urlbar.suggest.quicksuggest.nonsponsored", false); // 0807 + +// TODO: enable form and search history? +//user_pref("browser.formfill.enable", false); // 0810 + +// disk cache should help performance +user_pref("browser.cache.disk.enable", true); // 1001 + +// store extra session data (form content, cookies and POST data) 0: everywhere +user_pref("browser.sessionstore.privacy_level", 0); // 1003 + +// Disable unsafe passive content (images) on https sites +user_pref("security.mixed_content.block_display_content", true); // 1241 + +// Disable the eme banner +user_pref("browser.eme.ui.enabled", false); // 2022 + +// Don't delete my precious temp files +user_pref("browser.helperApps.deleteTempFileOnExit", false); // 2603 + +// Download to the download dir +user_pref("browser.download.useDownloadDir", true); // 2651 + +// Open the download panel +user_pref("browser.download.alwaysOpenPanel", true); // 2652 + +// Block after custom ruleset +user_pref("browser.contentblocking.category", "custom"); // 2701 + +// set the custom settings // 7016 +user_pref("network.cookie.cookieBehavior", 1); +user_pref("network.http.referer.disallowCrossSiteRelaxingDefault", true); +user_pref("network.http.referer.disallowCrossSiteRelaxingDefault.top_navigation", true); +user_pref("privacy.partition.network_state.ocsp_cache", true); +user_pref("privacy.query_stripping.enabled", true); +user_pref("privacy.trackingprotection.enabled", true); +user_pref("privacy.trackingprotection.socialtracking.enabled", true); +user_pref("privacy.trackingprotection.cryptomining.enabled", true); +user_pref("privacy.trackingprotection.fingerprinting.enabled", true); + + +// I might want to change that, when it hinders session restore +//user_pref("privacy.partition.always_partition_third_party_non_cookie_storage.exempt_sessionstorage", false); // 2720 + +// I like my history very much! +user_pref("privacy.sanitize.sanitizeOnShutdown", false); // 2810 + +// The downsides (light theme + potential breakages): +//user_pref("privacy.resistFingerprinting", true); // 4501 +user_pref("privacy.resistFingerprinting.letterboxing", false); // 4504 + +// I would like to keep my gl, even in the web +user_pref("webgl.disabled", false); // 4520 + +// I like my service workers and am using a service using them. +user_pref("dom.serviceWorkers.enabled", true); // 7017 + +// I've got a password manager already +user_pref("signon.rememberSignons", false); // 5003 + +// Do not track header +user_pref("privacy.donottrackheader.enabled", true); // 7015 + +// Allow my custom css +user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); + +// might improve performance TODO: +user_pref("gfx.webrender.all", true); + +// disable updates (pretty pointless with nix) +user_pref("extensions.update.autoUpdateDefault", false); +user_pref("extensions.update.enabled", false); +user_pref("app.update.channel", "default"); + +user_pref("browser.ctrlTab.recentlyUsedOrder", false); + +user_pref("browser.download.useDownloadDir", true); +user_pref("browser.download.folderList", 2); # TODO: +user_pref("browser.download.viewableInternally.typeWasRegistered.svg", true); +user_pref("browser.download.viewableInternally.typeWasRegistered.webp", true); +user_pref("browser.download.viewableInternally.typeWasRegistered.xml", true); + +// TODO: what does this do? +user_pref("browser.search.widget.inNavBar", true); + +user_pref("browser.shell.checkDefaultBrowser", false); +user_pref("browser.tabs.loadInBackground", true); +user_pref("browser.urlbar.placeholderName", "Brave"); + +// Set the tabs and bookmarks +user_pref("browser.tabs.inTitlebar", 1); +user_pref("browser.toolbars.bookmarks.visibility", "always"); +user_pref("browser.places.importBookmarksHTML", true); + +// Theme +user_pref("extensions.activeThemeID", "firefox-alpenglow@mozilla.org"); +user_pref("extensions.extensions.activeThemeID", "firefox-alpenglow@mozilla.org"); + +// highlight all entries when searching +user_pref("findbar.highlightAll", true); + +// TODO: +//user_pref("extensions.webcompat.enable_picture_in_picture_overrides", true); +//user_pref("extensions.webcompat.enable_shims", true); +//user_pref("extensions.webcompat.perform_injections", true); +//user_pref("extensions.webcompat.perform_ua_overrides", true); + +// onlykey / copied from a yubikey config +//user_pref("security.webauth.u2f", true); +//user_pref("security.webauth.webauthn", true); +//user_pref("security.webauth.webauthn_enable_softtoken", true); +//user_pref("security.webauth.webauthn_enable_usbtoken", true); diff --git a/hm/soispha/conf/firefox/config/search/engines/default.nix b/hm/soispha/conf/firefox/config/search/engines/default.nix new file mode 100644 index 00000000..286d7247 --- /dev/null +++ b/hm/soispha/conf/firefox/config/search/engines/default.nix @@ -0,0 +1,59 @@ +{pkgs, ...}: { + "Brave Search" = { + urls = [{template = "https://search.brave.com/search?q={searchTerms}";}]; + IconUpdateURL = "https://raw.githubusercontent.com/brave/brave-core/master/components/brave_welcome_ui/components/images/lion_logo.svg"; + updateInterval = 24; # every day + definedAliases = ["@bs"]; + }; + + # NIX + "Nix Packages" = { + urls = [{template = "https://search.nixos.org/packages?type=packages&query={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; + }; + "Nix Options" = { + urls = [{template = "https://search.nixos.org/options?type=options&query={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@no"]; + }; + "NixOS Wiki" = { + urls = [{template = "https://nixos.wiki/index.php?search={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@nw"]; + }; + + "Arch Wiki" = { + urls = [{template = "https://wiki.archlinux.org/index.php?search={searchTerms}";}]; + iconUpdateURL = "https://upload.wikimedia.org/wikipedia/commons/a/a5/Archlinux-icon-crystal-64.svg"; + updateInterval = 24; + definedAliases = ["@aw"]; + }; + + # RUST + "Rust std" = { + urls = [{template = "https://doc.rust-lang.org/std/?search={searchTerms}";}]; + iconUpdateURL = "https://rustacean.net/assets/rustacean-orig-noshadow.svg"; + updateInterval = 24; + definedAliases = ["@rs"]; + }; + + "Google Scholar" = { + urls = [{template = "https://scholar.google.com/scholar?hl=en&q={searchTerms}";}]; + iconUpdateURL = "https://scholar.google.com/favicon.ico"; + updateInterval = 24; + definedAliases = ["@gs"]; + }; + "Wikipedia" = { + urls = [{template = "https://en.wikipedia.org/wiki/{searchTerms}";}]; + iconUpdateURL = "https://upload.wikimedia.org/wikipedia/en/8/80/Wikipedia-logo-v2.svg"; + updateInterval = 24; + definedAliases = ["@wp"]; + }; + + "Wikipedia (en)".metaData.hidden = true; + "DuckDuckGo".metaData.hidden = true; + "Bing".metaData.hidden = true; + "Google".metaData.hidden = true; + "Amazon.de".metaData.hidden = true; +} diff --git a/hm/soispha/conf/firefox/default.nix b/hm/soispha/conf/firefox/default.nix new file mode 100644 index 00000000..1040ed0b --- /dev/null +++ b/hm/soispha/conf/firefox/default.nix @@ -0,0 +1,71 @@ +{ + config, + pkgs, + lib, + user_js, + video_pause, + ... +}: let + userChrome = builtins.readFile ./config/chrome/userChrome.css; + + user_js_nix = (import ./config/prefs) {inherit pkgs lib config user_js;}; + + extensions = builtins.map buildFirefoxXpiAddon ( + lib.attrValues ( + lib.importJSON ./config/extensions/extensions.json + ) + ); + engines = (import ./config/search/engines) {inherit pkgs;}; + + # source: https://gitlab.com/rycee/nur-expressions/-/blob/master/pkgs/firefox-addons/default.nix + buildFirefoxXpiAddon = (import ./functions/extensions) {inherit pkgs;}; + + video-pauser = (import ./functions/extensions/video-pauser.nix) {inherit pkgs video_pause;}; +in { + home.packages = [ + pkgs.tridactyl-native + ]; + home.sessionVariables = { + # improve touch input & make scrolling smother + MOZ_USE_XINPUT2 = "1"; + # improve wayland support + MOZ_ENABLE_WAYLAND = 1; + }; + xdg.mimeApps = { + enable = true; + defaultApplications = { + "text/html" = ["firefox.desktop"]; + "x-scheme-handler/http" = ["firefox.desktop"]; + "x-scheme-handler/https" = ["firefox.desktop"]; + "x-scheme-handler/about" = ["firefox.desktop"]; + "x-scheme-handler/unknown" = ["firefox.desktop"]; + }; + }; + programs.firefox = { + enable = true; + package = pkgs.firefox-wayland.override { + extraNativeMessagingHosts = [video-pauser]; + cfg = { + enableTridactylNative = true; + }; + }; + profiles."default" = { + inherit extensions; + isDefault = true; + id = 0; + name = "default"; + + inherit userChrome; + + search = { + default = "Brave Search"; + force = true; + + inherit engines; + }; + + bookmarks = []; + extraConfig = builtins.readFile "${user_js_nix}/user.js"; + }; + }; +} diff --git a/hm/soispha/conf/firefox/functions/bookmarks/default.nix b/hm/soispha/conf/firefox/functions/bookmarks/default.nix new file mode 100644 index 00000000..d1d89dd2 --- /dev/null +++ b/hm/soispha/conf/firefox/functions/bookmarks/default.nix @@ -0,0 +1,49 @@ +{ + lib, + pkgs, +}: bookmarks: let + indent = level: + lib.concatStringsSep "" (map (lib.const " ") (lib.range 1 level)); + + bookmarkToHTML = indentLevel: bookmark: '' + ${indent indentLevel}<DT><A HREF="${ + lib.escapeXML bookmark.url + }" ADD_DATE="0" LAST_MODIFIED="0">${lib.escapeXML bookmark.name}</A>''; + + directoryToHTML = indentLevel: directory: '' + ${indent indentLevel}<DT>${ + if directory.toolbar + then ''<H3 PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar'' + else "<H3>${lib.escapeXML directory.name}" + }</H3> + ${indent indentLevel}<DL><p> + ${allItemsToHTML (indentLevel + 1) directory.bookmarks} + ${indent indentLevel}</p></DL>''; + + itemToHTMLOrRecurse = indentLevel: item: + if item ? "url" + then bookmarkToHTML indentLevel item + else directoryToHTML indentLevel item; + + allItemsToHTML = indentLevel: bookmarks: + lib.concatStringsSep "\n" + (map (itemToHTMLOrRecurse indentLevel) bookmarks); + + bookmarkEntries = allItemsToHTML 1 bookmarks; +in + pkgs.writeText "firefox-bookmarks.html" '' + <!DOCTYPE NETSCAPE-Bookmark-file-1> + <!-- This is an automatically generated file. + It will be read and overwritten. + DO NOT EDIT! --> + <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> + <TITLE>Bookmarks</TITLE> + <H1>Bookmarks Menu</H1> + + <DL><p> + <DT><H3 ADD_DATE="0" LAST_MODIFIED="0" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3> + <DL><p> + ${bookmarkEntries} + </DL><p> + </p></DL> + '' diff --git a/hm/soispha/conf/firefox/functions/extensions/default.nix b/hm/soispha/conf/firefox/functions/extensions/default.nix new file mode 100644 index 00000000..b84461c7 --- /dev/null +++ b/hm/soispha/conf/firefox/functions/extensions/default.nix @@ -0,0 +1,25 @@ +{pkgs, ...}: { + pname, + version, + addonId, + url, + sha256, + #meta, + ... +}: +pkgs.stdenv.mkDerivation { + name = "${pname}-${version}"; + + #inherit meta; + + src = builtins.fetchurl {inherit url sha256;}; + + preferLocalBuild = true; + allowSubstitutes = true; + + buildCommand = '' + dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" + mkdir -p "$dst" + install -v -m644 "$src" "$dst/${addonId}.xpi" + ''; +} diff --git a/hm/soispha/conf/firefox/functions/extensions/video-pauser.nix b/hm/soispha/conf/firefox/functions/extensions/video-pauser.nix new file mode 100644 index 00000000..c4c5238f --- /dev/null +++ b/hm/soispha/conf/firefox/functions/extensions/video-pauser.nix @@ -0,0 +1,30 @@ +{ + pkgs, + video_pause, + ... +}: +pkgs.runCommand "video_pause_native_messaging" {} '' + install -d $out/share/ + cat << EOF > $out/share/video_pauser.json + { + "name": "video_pauser", + "description": "Pause your Videos with a single key stroke!", + "path": "${video_pause}/bin/video_pause", + "type": "stdio", + "allowed_extensions": ["video-pauser@addons.vhack.eu"] + } + EOF + + nativeMessagingPaths=( + /lib/mozilla/native-messaging-hosts + /etc/opt/chrome/native-messaging-hosts + /etc/chromium/native-messaging-hosts + /etc/vivaldi/native-messaging-hosts + /lib/librewolf/native-messaging-hosts + ) + + for manifestDir in "''${nativeMessagingPaths[@]}"; do + install -d $out$manifestDir + ln -s $out/share/video_pauser.json $out$manifestDir/ + done +'' diff --git a/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py b/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py new file mode 100755 index 00000000..311fd214 --- /dev/null +++ b/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# source: https://unix.stackexchange.com/a/497861 +# Command-line tool to decompress mozLz4 files used for example by Firefox to store various kinds of session backup information. +# Works in both Python 2.7.15 and 3.6.7, as of version 2.1.6 of the LZ4 Python bindings at pypi.org/project/lz4. +# To use in another script, simply cut and paste the import statement and the mozlz4_to_text() function (lines 8 to 17). + +import lz4.block # pip install lz4 --user + + +def mozlz4_to_text(filepath): + # Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file, + # return the uncompressed text. + bytestream = open(filepath, "rb") + bytestream.read(8) # skip past the b"mozLz40\0" header + valid_bytes = bytestream.read() + text = lz4.block.decompress(valid_bytes) + return text + + +def main(args): + # Given command-line arguments of an input filepath for a ".mozlz4" file + # and optionally an output filepath, write the decompressed text to the + # output filepath. + # Default output filepath is the input filepath minus the last three characters + # (e.g. "foo.jsonlz4" becomes "foo.json") + filepath_in = args[0] + if len(args) < 2: + filepath_out = filepath_in[:-3] + else: + filepath_out = args[1] + text = mozlz4_to_text(filepath_in) + with open(filepath_out, "wb") as outfile: + outfile.write(text) + print("Wrote decompressed text to {}".format(filepath_out)) + + +if __name__ == "__main__": + import sys + args = sys.argv[1:] + if args and not args[0] in ("--help", "-h"): + main(args) + else: + print("Usage: mozlz4.py <mozlz4 file to read> <location to write>") diff --git a/hm/soispha/conf/firefox/scripts/update_extensions b/hm/soispha/conf/firefox/scripts/update_extensions new file mode 100755 index 00000000..05f47aad --- /dev/null +++ b/hm/soispha/conf/firefox/scripts/update_extensions @@ -0,0 +1,22 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +#. ~/.local/lib/shell/lib + +tmp=$(mktemp) +cat << EOF > $tmp + darkreader + keepassxc-browser + simple-tab-groups + ublock-origin + tridactyl-vim + video-pauser + libredirect +EOF + +# The bin is provided in the devshell. The cat execution should be unquoted +generate_extensions $(cat "$tmp") > "$(dirname $0)"/../config/extensions/extensions.json + + + +rm "$tmp"; diff --git a/hm/soispha/conf/gammastep/default.nix b/hm/soispha/conf/gammastep/default.nix new file mode 100644 index 00000000..1ae0550b --- /dev/null +++ b/hm/soispha/conf/gammastep/default.nix @@ -0,0 +1,29 @@ +{ + lib, + nixosConfig, + ... +}: let + temp = + if nixosConfig.soispha.laptop.enable + then 3000 + else 1300; +in { + services.gammastep = { + enable = true; + settings = { + general = { + temp-day = lib.mkForce temp; + temp-night = lib.mkForce temp; + gamma = "0.8:0.8:0.8"; + fade = 0; + adjustment-method = "wayland"; + location-provider = "manual"; + }; + + manual = { + lat = 48.1; + lon = 11.6; + }; + }; + }; +} diff --git a/hm/soispha/conf/git/default.nix b/hm/soispha/conf/git/default.nix new file mode 100644 index 00000000..f99f705c --- /dev/null +++ b/hm/soispha/conf/git/default.nix @@ -0,0 +1,90 @@ +{ + lib, + nixosConfig, + ... +}: let + gitIgnoreFile = ./git_ignore.git; + gitTemplateFile = ./git_template.git; +in { + programs.git = { + enable = true; + #package = pkgs.gitAndTools.gitFull; # TODO: for git send-email support + aliases = { + st = "status"; + ds = "diff --staged"; + di = "diff"; + rs = "restore --staged"; + + ## Logging: + ls = "log --max-count=10 --color --format=format:'%C(bold red)%h%C(reset) %C(dim bold blue)%s%C(reset) %C(dim white)[%aN] %C(bold red)<%G?>%C(reset)%C(auto)%d%C(reset)'"; + + # https://stackoverflow.com/a/61487052 + lg = "lg1"; + lg1 = "lg1-specific --all"; + lg2 = "lg2-specific --all"; + lg3 = "lg3-specific --all"; + + lg1-specific = "log --graph --abbrev-commit --decorate \ + --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold cyan) [%G?]%C(reset)%C(auto)%d%C(reset)'"; + + lg2-specific = "log --graph --abbrev-commit --decorate \ + --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'"; + + lg3-specific = "log --graph --abbrev-commit --decorate \ + --format=format:'%C(bold blue)%h%C(reset)\ + - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)\ + %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)\ + %C(bold red)(signature: %G? by %GS, trust: %GT)%C(reset)%n\ + '' %C(white)%s%C(reset)%n''\ + %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)\ + %C(bold white)- trailers: %(trailers) %C(reset)'"; + }; + extraConfig = { + core = { + excludesFile = "${gitIgnoreFile}"; + }; + init = { + defaultBranch = "prime"; + }; + user = { + email = "soispha@vhack.eu"; + name = "Soispha"; + }; + help = { + autocorrect = 5; + }; + push = { + gpgSign = "if-asked"; + }; + commit = { + template = "${gitTemplateFile}"; + }; + diff = { + colorMoved = "default"; + }; + merge = { + conflictstyle = "diff3"; + }; + }; + delta = { + enable = true; + options = { + decorations = { + commit-decoration-style = "bold yellow box ul"; + file-decoration-style = "none"; + file-style = "bold yellow ul"; + }; + keep-plus-minus-markers = + if nixosConfig.soispha.laptop.enable + then true + else false; + features = "decorations"; + whitespace-error-style = "22 reverse"; + }; + }; + signing = { + key = "9606FC749FCE16360723D4ADA5E94010C3A642AD!"; + signByDefault = true; + }; + }; +} diff --git a/hm/soispha/conf/git/git_ignore.git b/hm/soispha/conf/git/git_ignore.git new file mode 100644 index 00000000..8f29815e --- /dev/null +++ b/hm/soispha/conf/git/git_ignore.git @@ -0,0 +1,4 @@ +# default nvim Session file name +Session.vim + +# vim: ft=gitignore diff --git a/hm/soispha/conf/git/git_template.git b/hm/soispha/conf/git/git_template.git new file mode 100644 index 00000000..9621698d --- /dev/null +++ b/hm/soispha/conf/git/git_template.git @@ -0,0 +1,66 @@ + +# Title: Summary, imperative, start upper case, don't end with a period +# If applied, this commit will <your Title> + +# Body: Explain *what* and *why* (not *how*). + + +# BREAKING CHANGE: <description> +# Fixes: # +# Refs: # +# Co-authored-by: <name> <email> + + + +# Convention Commits (https://www.conventionalcommits.org/en/v1.0.0/ or https://github.com/angular/angular/blob/85b4941be137a2fcdc664dc870e408dd72ad7de7/CONTRIBUTING.md#commit): +# Feat: [Features] -> MINOR version bump +# A new feature +# +# Fix: [Bug Fixes] -> PATCH version bump +# A bug fix +# +# append '!' after the type/scope: [Breaking Change] -> MAJOR version bump +# A breaking API change +# +# Docs: [Documentation] +# Documentation only changes +# +# Style: [Styles] +# Changes that do not affect the meaning of the code +# (white-space, formatting, missing semi-colons, etc) +# +# Refactor: [Code Refactoring] +# A code change that neither fixes a bug nor adds a feature +# +# Perf: [Performance Improvements] -> PATCH version bump +# A code change that improves performance +# +# Test: [Tests] +# Adding missing tests or correcting existing tests +# +# Build: [Builds] -> PATCH version bump +# Changes that affect the build system or external dependencies +# (example scopes: gulp, broccoli, npm) +# +# Ci: [Continuous Integrations] +# Changes to our CI configuration files and scripts +# (example scopes: Travis, Circle, BrowserStack, SauceLabs) +# +# Chore: [Chores] +# Other changes that don't modify src or test files +# +# Reverts: [Reverts] +# Reverts a previous commit + +# How to Write a Git Commit Message: +# [https://chris.beams.io/posts/git-commit/] -> https://cbea.ms/git-commit/ +# +# 1. Separate subject from body with a blank line +# 2. Limit the subject line to 50 characters +# 3. Capitalize the subject line +# 4. Do not end the subject line with a period +# 5. Use the imperative mood in the subject line +# 6. Wrap the body at 72 characters +# 7. Use the body to explain *what* and *why* vs. *how* +# +# vim: ft=gitcommit diff --git a/hm/soispha/conf/gpg/agent-program b/hm/soispha/conf/gpg/agent-program new file mode 100755 index 00000000..e6917db0 --- /dev/null +++ b/hm/soispha/conf/gpg/agent-program @@ -0,0 +1,2 @@ +#!/bin/sh +onlykey-gpg-agent -v --skey-slot=ECC32 --dkey-slot=ECC32 "$@" diff --git a/hm/soispha/conf/gpg/default.nix b/hm/soispha/conf/gpg/default.nix new file mode 100644 index 00000000..97334c8f --- /dev/null +++ b/hm/soispha/conf/gpg/default.nix @@ -0,0 +1,65 @@ +{ + config, + nixosConfig, + sysLib, + pkgs, + ... +}: let + agent-program = sysLib.writeShellScriptWithLibrary { + name = "onlykey-gpg-agent"; + src = ./agent-program; + dependencies = with pkgs; [ + python3 + onlykey-agent + ]; + }; + settings = + if nixosConfig.networking.hostName == "isimud" + then {} + else { + # Hardware-based GPG configuration + agent-program = "${agent-program}/bin/onlykey-gpg-agent"; + + default-key = "Soispha <soispha@vhack.eu>"; + # TODO: add more + }; + gpg-agent = + if nixosConfig.networking.hostName == "isimud" + then { + enable = true; + enableZshIntegration = true; + enableScDaemon = true; # smartcards and such things + pinentryFlavor = "tty"; + } + else { + enable = false; + enableZshIntegration = true; + enableScDaemon = true; # smartcards and such things + pinentryFlavor = "tty"; + }; +in { + programs.gpg = { + enable = true; + homedir = "${config.xdg.dataHome}/gnupg/onlykey"; + mutableKeys = false; + mutableTrust = false; + inherit settings; + publicKeys = [ + { + source = ./keys/key_1; + trust = "ultimate"; + } + { + source = ./keys/key_2; + trust = "ultimate"; + } + { + source = ./keys/key_3; + trust = "full"; + } + ]; + }; + services = { + inherit gpg-agent; + }; +} diff --git a/hm/soispha/conf/gpg/keys/key_1 b/hm/soispha/conf/gpg/keys/key_1 new file mode 100644 index 00000000..b10b8b6c --- /dev/null +++ b/hm/soispha/conf/gpg/keys/key_1 Binary files differdiff --git a/hm/soispha/conf/gpg/keys/key_2 b/hm/soispha/conf/gpg/keys/key_2 new file mode 100644 index 00000000..0b06cf3b --- /dev/null +++ b/hm/soispha/conf/gpg/keys/key_2 Binary files differdiff --git a/hm/soispha/conf/gpg/keys/key_3 b/hm/soispha/conf/gpg/keys/key_3 new file mode 100644 index 00000000..22ffb931 --- /dev/null +++ b/hm/soispha/conf/gpg/keys/key_3 Binary files differdiff --git a/hm/soispha/conf/grades/config.yaml b/hm/soispha/conf/grades/config.yaml new file mode 100644 index 00000000..36712971 --- /dev/null +++ b/hm/soispha/conf/grades/config.yaml @@ -0,0 +1,68 @@ +# für oberstufe +--- +unit: Punkte +grade_groups: + - name: Zeugnis + weight: '100' + double_weight_on_class_type: false + - name: Sonstige + weight: '1' + double_weight_on_class_type: true + - name: Klausur + weight: '1' + double_weight_on_class_type: false + +grade_types: + - name: Zeugnis + group: Zeugnis + - name: Klausur + group: Klausur + - name: Epo + group: Sonstige + - name: Test + group: Sonstige + +class_types: + - name: NebenFach + double_weight_on_marked_grade_groups: true + - name: LeistungsKurs + double_weight_on_marked_grade_groups: false + +classes: + - name: M + long_name: Mathe + class_type: LeistungsKurs + - name: E + long_name: Englisch + class_type: LeistungsKurs + - name: CH + long_name: Chemie + class_type: LeistungsKurs + + - name: d + long_name: Deutsch + class_type: NebenFach + - name: g + long_name: Geschichte + class_type: NebenFach + - name: se + long_name: Sozialkunde/Erdkunde + class_type: NebenFach + - name: et + long_name: Ethik + class_type: NebenFach + - name: spj + long_name: Sport + class_type: NebenFach + - name: inf + long_name: Informatik + class_type: NebenFach + - name: ph + long_name: Phyisk + class_type: NebenFach + - name: phi + long_name: Philosophie + class_type: NebenFach + - name: bi + long_name: Biologie + class_type: NebenFach diff --git a/hm/soispha/conf/grades/default.nix b/hm/soispha/conf/grades/default.nix new file mode 100644 index 00000000..d2678174 --- /dev/null +++ b/hm/soispha/conf/grades/default.nix @@ -0,0 +1,3 @@ +{...}: { + xdg.configFile."grades/config.yaml".source = ./config.yaml; +} diff --git a/hm/soispha/conf/gtk/default.nix b/hm/soispha/conf/gtk/default.nix new file mode 100644 index 00000000..f5411369 --- /dev/null +++ b/hm/soispha/conf/gtk/default.nix @@ -0,0 +1,58 @@ +{ + config, + lib, + pkgs, + stdenv, + ... +}: { + gtk = { + enable = true; + theme = { + package = pkgs.nordic; + name = "Nordic"; + }; + cursorTheme = { + package = pkgs.nordzy-cursor-theme; + name = "Nordzy-cursors"; + }; + iconTheme = { + package = pkgs.nordzy-icon-theme; + name = "Nordzy-icon"; + }; + font = { + name = "Noto Sans"; + size = 10; + }; + gtk2 = { + configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + # extraConfig = '' + # gtk-enable-animations=1 + # gtk-primary-button-warps-slider=0 + # gtk-toolbar-style=3 + # gtk-menu-images=1 + # gtk-button-images=1 + # + # ''; + }; + gtk3 = { + # extraConfig = '' + # gtk-button-images=true + # gtk-decoration-layout=icon:minimize,maximize,close + # gtk-enable-animations=true + # gtk-menu-images=true + # gtk-primary-button-warps-slider=false + # gtk-toolbar-style=3 + # #gtk-modules=window-decorations-gtk-module:colorreload-gtk-module + # ''; + extraCss = ""; + }; + gtk4 = { + # extraConfig = '' + # gtk-application-prefer-dark-theme=true + # gtk-decoration-layout=icon:minimize,maximize,close + # gtk-enable-animations=true + # gtk-primary-button-warps-slider=false + # ''; + }; + }; +} diff --git a/hm/soispha/conf/himalaya/default.nix b/hm/soispha/conf/himalaya/default.nix new file mode 100644 index 00000000..c072693e --- /dev/null +++ b/hm/soispha/conf/himalaya/default.nix @@ -0,0 +1,8 @@ +{...}: { + programs.himalaya = { + enable = true; + settings = { + # TODO: + }; + }; +} diff --git a/hm/soispha/conf/iamb/config.json b/hm/soispha/conf/iamb/config.json new file mode 100644 index 00000000..ca06d543 --- /dev/null +++ b/hm/soispha/conf/iamb/config.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "soispha": { + "user_id": "@soispha:vhack.eu", + "url": "https://matrix.vhack.eu" + } + }, + "default_profile": "soispha" +} diff --git a/hm/soispha/conf/iamb/default.nix b/hm/soispha/conf/iamb/default.nix new file mode 100644 index 00000000..2a93472c --- /dev/null +++ b/hm/soispha/conf/iamb/default.nix @@ -0,0 +1,3 @@ +{...}: { + xdg.configFile."iamb/config.json".source = ./config.json; +} diff --git a/hm/soispha/conf/keepassxc/default.nix b/hm/soispha/conf/keepassxc/default.nix new file mode 100644 index 00000000..3ac82812 --- /dev/null +++ b/hm/soispha/conf/keepassxc/default.nix @@ -0,0 +1,7 @@ +{ + config, + pkgs, + ... +}: { + xdg.configFile."keepassxc/keepassxc.ini".source = ./keepassxc.ini; +} diff --git a/hm/soispha/conf/keepassxc/keepassxc.ini b/hm/soispha/conf/keepassxc/keepassxc.ini new file mode 100644 index 00000000..288a194b --- /dev/null +++ b/hm/soispha/conf/keepassxc/keepassxc.ini @@ -0,0 +1,58 @@ +[General] +AutoSaveAfterEveryChange=true +BackupBeforeSave=true +BackupFilePathPattern=/home/soispha/.local/share/keepassxc/{DB_FILENAME}.old.kdbx +ConfigVersion=2 +HideWindowOnCopy=false + +[Browser] +CustomProxyLocation= +Enabled=true + +[FdoSecrets] +Enabled=true + +[GUI] +AdvancedSettings=true +ApplicationTheme=dark +CompactMode=false +HidePasswords=true +ShowExpiredEntriesOnDatabaseUnlockOffsetDays=1 +TrayIconAppearance=monochrome-light + +[KeeShare] +Active="" +Own="" +QuietSuccess=true + +[PasswordGenerator] +AdditionalChars= +AdvancedMode=true +Braces=true +Dashes=true +EASCII=true +ExcludedChars= +Length=128 +Logograms=true +LowerCase=true +Math=true +Numbers=true +Punctuation=true +Quotes=true +SpecialChars=true +Type=0 +UpperCase=true +WordCount=4 +WordSeparator="," + +[SSHAgent] +Enabled=true + +[Security] +HidePasswordPreviewPanel=true +IconDownloadFallback=true +LockDatabaseIdle=false +LockDatabaseIdleSeconds=960 +PasswordEmptyPlaceholder=true +PasswordsHidden=true +PasswordsRepeatVisible=true diff --git a/hm/soispha/conf/latexindent/default.nix b/hm/soispha/conf/latexindent/default.nix new file mode 100644 index 00000000..0d776e14 --- /dev/null +++ b/hm/soispha/conf/latexindent/default.nix @@ -0,0 +1,8 @@ +{ + config, + pkgs, + ... +}: { + xdg.configFile."latexindent/indentconfig.yaml".source = ./indentconfig.yaml; + xdg.configFile."latexindent/mysettings.yaml".source = ./mysettings.yaml; +} diff --git a/hm/soispha/conf/latexindent/indentconfig.yaml b/hm/soispha/conf/latexindent/indentconfig.yaml new file mode 100644 index 00000000..d67351f3 --- /dev/null +++ b/hm/soispha/conf/latexindent/indentconfig.yaml @@ -0,0 +1,2 @@ +paths: +- /home/dt/.config/latexindent/mysettings.yaml diff --git a/hm/soispha/conf/latexindent/mysettings.yaml b/hm/soispha/conf/latexindent/mysettings.yaml new file mode 100644 index 00000000..9a0f8b2f --- /dev/null +++ b/hm/soispha/conf/latexindent/mysettings.yaml @@ -0,0 +1,672 @@ +# defaultSettings.yaml for latexindent.pl, version 3.19.1, 2022-12-04 +# a script that aims to +# beautify .tex, .sty, .cls files +# +# (or latexindent.exe if you're on Windows) +# +#--------------------------------------------------------------------------------------- +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See http://www.gnu.org/licenses/. +# +# Chris Hughes, 2017 +# +# For all communication, please visit: https://github.com/cmhughes/latexindent.pl +# +#--------------------------------------------------------------------------------------- +# You should feel encouraged to change anything you like in these settings, but +# it would probably be better to have your own user settings +# files somewhere else - remember that this file may be overwritten +# when you update your tex distribution. Please see the manual linked from: +# +# https://github.com/cmhughes/latexindent.pl +# +# for details of how to create and configure your own settings files. +# +# Please read the manual (linked from above) first to understand what each switch does. +# +#--------------------------------------------------------------------------------------- + +# latexindent can be called to act on a file without using the file's extension, +# e.g, simply +# latexindent myfile +# in which case the choice of file extension is chosen +# according to the choices made in fileExtensionPreference +# Other file extensions can be added. +fileExtensionPreference: + .tex: 1 + .sty: 2 + .cls: 3 + .bib: 4 + +# default file extension of backup file (if -w switch is active) +# for example, if your .tex file is called +# myfile.tex +# and you specify the backupExtension as BACKUP.bak then your +# backup file will be +# myfileBACKUP.bak +backupExtension: .bak + +# only one backup per file: +# - if onlyOneBackUp is 0 then, as a safety measure, +# the number on the extension increments by 1 each time: +# +# myfile.bak0, myfile.bak1, myfile.bak2 +# - if you set onlyOnebackUp to 1, then the backup file will +# be overwritten each time (not recommended until you trust the script) +onlyOneBackUp: 0 + +# some users may want a finite number of backup files, +# say at most 3; in which case, they can change this maxNumberOfBackUps. +# +# If maxNumberOfBackUps is set to 0 (or less) then infinitely +# many backups are possible, unless onlyOneBackUp is switched on +maxNumberOfBackUps: 0 + +# some users may wish to cycle through back up files. +# +# for example, with maxNumberOfBackUps: 4, they may +# wish to delete the oldest back up file, and keep only the most recent. +# +# copy myfile.bak1 to myfile.bak0 +# copy myfile.bak2 to myfile.bak1 +# copy myfile.bak3 to myfile.bak2 +# copy myfile.bak4 to myfile.bak3 +# +# the back up will be written to myfile.bak4 +cycleThroughBackUps: 0 + +# preferences for information displayed in the log file +logFilePreferences: + showEveryYamlRead: 1 + showAmalgamatedSettings: 0 + showDecorationStartCodeBlockTrace: 0 + showDecorationFinishCodeBlockTrace: 0 + endLogFileWith: '--------------' + showGitHubInfoFooter: 1 + Dumper: + Terse: 1 + Indent: 1 + Useqq: 1 + Deparse: 1 + Quotekeys: 0 + Sortkeys: 1 + Pair: " => " + +# verbatim environments specified +# in this field will not be changed at all! +verbatimEnvironments: + verbatim: 1 + lstlisting: 1 + minted: 1 + +# verbatim commands such as \verb! body !, \lstinline$something else$ +verbatimCommands: + verb: 1 + lstinline: 1 + +# no indent blocks (not necessarily verbatim +# environments) which are marked as %\begin{noindent} +# or anything else that you detail in the following +noIndentBlock: + noindent: 1 + cmhtest: 1 + +# \begin{document} and \end{document} are treated differently +# by latexindent within filecontents environments +fileContentsEnvironments: + filecontents: 1 + filecontents*: 1 + +# indent preamble +indentPreamble: 1 + +# assume no preamble in cls, sty, by default +lookForPreamble: + .tex: 1 + .sty: 0 + .cls: 0 + .bib: 0 + +# some preambles can contain \begin and \end statements +# that are not in their 'standard environment block', for example, +# consider the following key = values: +# preheadhook={\begin{mdframed}[style=myframedstyle]}, +# postfoothook=\end{mdframed}, +preambleCommandsBeforeEnvironments: 0 + +# default value of indentation +defaultIndent: " " + +# remove trailing whitespace from all lines +removeTrailingWhitespace: + beforeProcessing: 0 + afterProcessing: 1 + +# name of code blocks that should have their body aligned at ampersand delimiters +lookForAlignDelims: + tabular: + delims: 1 + alignDoubleBackSlash: 1 + spacesBeforeDoubleBackSlash: 1 + multiColumnGrouping: 0 + alignRowsWithoutMaxDelims: 1 + spacesBeforeAmpersand: 1 + spacesAfterAmpersand: 1 + justification: left + alignFinalDoubleBackSlash: 0 + dontMeasure: 0 + delimiterRegEx: '(?<!\\)(&)' + delimiterJustification: left + lookForChildCodeBlocks: 1 + tabularx: + delims: 1 + longtable: 1 + tabu: 1 + array: 1 + matrix: 1 + listabla: 1 + # amsmath + align: 1 + align*: 1 + alignat: 1 + alignat*: 1 + aligned: 1 + bmatrix: 1 + Bmatrix: 1 + cases: 1 + flalign: 1 + flalign*: 1 + pmatrix: 1 + vmatrix: 1 + Vmatrix: 1 + # mathtools + cases*: 1 + dcases: 1 + dcases*: 1 + rcases: 1 + rcases*: 1 + drcases: 1 + drcases*: 1 + # nicematrix + NiceTabular: 1 + NiceMatrix: 1 + pNiceMatrix: 1 + bNiceMatrix: 1 + BNiceMatrix: 1 + vNiceMatrix: 1 + VNiceMatrix: 1 + NiceArray: 1 + pNiceArrayC: 1 + bNiceArrayC: 1 + BNiceArrayC: 1 + vNiceArrayC: 1 + VNiceArrayC: 1 + NiceArrayCwithDelims: 1 + pNiceArrayRC: 1 + bNiceArrayRC: 1 + BNiceArrayRC: 1 + vNiceArrayRC: 1 + VNiceArrayRC: 1 + NiceArrayRCwithDelims: 1 + # tabularray + tblr: 1 + longtblr: 1 + talltblr: 1 + +# if you want the script to look for \item commands +# and format it, as follows (for example), +# \begin{itemize} +# \item content here +# next line is indented +# next line is indented +# \item another item +# \end{itemize} +# then populate indentAfterItems. See also itemNames +indentAfterItems: + itemize: 1 + itemize*: 1 + enumerate: 1 + enumerate*: 1 + description: 1 + description*: 1 + list: 1 + +# if you want to use other names for your items (for example, \part) +# then populate them here; note that you can trick latexindent.pl +# into indenting all kinds of commands (within environments specified in +# indentAfterItems) using this technique. +itemNames: + item: 1 + myitem: 1 + +# specialBeginEnd is, by default, mathmode focus, although +# there's no restrictions +specialBeginEnd: + displayMath: + begin: '\\\[' + end: '\\\]' + lookForThis: 1 + inlineMath: + begin: '(?<!\$)(?<!\\)\$(?!\$)' + end: '(?<!\\)\$(?!\$)' + lookForThis: 1 + displayMathTeX: + begin: '\$\$' + end: '\$\$' + lookForThis: 1 + specialBeforeCommand: 0 + +# if you want to add indentation after +# a heading, such as \part, \chapter, etc +# then populate it in here - you can add +# an indent rule to indentRules if you would +# like something other than defaultIndent +# +# you can also change the level if you like, +# or add your own title command +indentAfterHeadings: + part: + indentAfterThisHeading: 0 + level: 1 + chapter: + indentAfterThisHeading: 0 + level: 2 + section: + indentAfterThisHeading: 0 + level: 3 + subsection: + indentAfterThisHeading: 0 + level: 4 + subsection*: + indentAfterThisHeading: 0 + level: 4 + subsubsection: + indentAfterThisHeading: 0 + level: 5 + paragraph: + indentAfterThisHeading: 0 + level: 6 + subparagraph: + indentAfterThisHeading: 0 + level: 7 + +# maximum indentation, off by default +maximumIndentation: -1 + +# if you don't want to have additional indentation +# in a code block, then add it to noAdditionalIndent; note that +# code blocks in this field will inherit +# the *current* level of indentation they just won't +# get any *additional* indentation +noAdditionalIndent: + myexample: 0 + mydefinition: 0 + problem: 0 + exercises: 0 + mysolution: 0 + foreach: 0 + widepage: 0 + comment: 0 + document: 0 + frame: 0 + +# if you have indent rules for particular code blocks +# then you can populate them in indentRules; for example, you might just want +# to use a space " " or maybe a double tab " " +indentRules: + myenvironment: " " + anotherenvironment: " " + chapter: " " + section: " " + item: " " + myitem: " " + +# set noAdditionalIndent globally for codeblocks +noAdditionalIndentGlobal: + environments: 0 + commands: 0 + optionalArguments: 0 + mandatoryArguments: 0 + ifElseFi: 0 + items: 0 + keyEqualsValuesBracesBrackets: 0 + namedGroupingBracesBrackets: 0 + UnNamedGroupingBracesBrackets: 0 + specialBeginEnd: 0 + afterHeading: 0 + filecontents: 0 + +# set indentRules globally for codeblocks; these need +# to be horizontal spaces, if they are to be used +indentRulesGlobal: + environments: 0 + commands: 0 + optionalArguments: 0 + mandatoryArguments: 0 + ifElseFi: 0 + items: 0 + keyEqualsValuesBracesBrackets: 0 + namedGroupingBracesBrackets: 0 + UnNamedGroupingBracesBrackets: 0 + specialBeginEnd: 0 + afterHeading: 0 + filecontents: 0 + +# command code block details +commandCodeBlocks: + roundParenthesesAllowed: 1 + stringsAllowedBetweenArguments: + - + amalgamate: 1 + - 'node' + - 'at' + - 'to' + - 'decoration' + - '\+\+' + - '\-\-' + - '\#\#\d' + commandNameSpecial: + - + amalgamate: 1 + - '@ifnextchar\[' + +# change dos line breaks into unix +dos2unixlinebreaks: 1 + +# modifyLineBreaks will only be searched if the -m +# switch is active +# +# poly-switch examples: +# +# BeginStartsOnOwnLine: +# modify line breaks before a begin statement +# +# when set to -1, e.g +# some text some text +# \begin{myenvironment} +# will be changed to +# some text some text \begin{myenvironment} +# when set to 0, the switch is ignored +# when set to 1, e.g +# some text some text \begin{myenvironment} +# will be changed to +# some text some text +# \begin{myenvironment} +# when set to 2, e.g +# some text some text \begin{myenvironment} +# will be changed to +# some text some text% +# \begin{myenvironment} +# when set to 3, e.g +# some text some text \begin{myenvironment} +# will be changed to +# some text some text +# +# \begin{myenvironment} +# +# BodyStartsOnOwnLine: +# modify line breaks before the beginning of the body +# +# when set to -1, e.g +# \begin{myenv} +# body text body text +# will be changed to +# \begin{myenv}body text body text +# when set to 0, the switch is ignored +# when set to 1, e.g +# \begin{myenv}body text body text +# will be changed to +# \begin{myenv} +# body text body text +# when set to 2, e.g +# \begin{myenv}body text body text +# will be changed to +# \begin{myenv}% +# body text body text +# when set to 3, e.g +# \begin{myenv}body text body text +# will be changed to +# \begin{myenv} +# +# body text body text +# +# EndStartsOnOwnLine: +# modify line breaks before the end statement +# +# when set to -1, e.g +# some text some text +# \end{myenvironment} +# will be changed to +# some text some text \end{myenvironment} +# when set to 0, the switch is ignored +# when set to 1, e.g +# some text some text \end{myenvironment} +# will be changed to +# some text some text +# \end{myenvironment} +# when set to 2, e.g +# some text some text \end{myenvironment} +# will be changed to +# some text some text% +# \end{myenvironment} +# when set to 3, e.g +# some text some text \end{myenvironment} +# will be changed to +# some text some text +# +# \end{myenvironment} +# +# EndFinishesWithLineBreak: +# modify line breaks after the end statement +# +# when set to -1, e.g +# \end{myenvironment} +# some text some text +# will be changed to +# \end{myenvironment}some text some text +# when set to 0, the switch is ignored +# when set to 1, e.g +# \end{myenvironment}some text some text +# will be changed to +# \end{myenvironment} +# some text some text +# when set to 2, e.g +# \end{myenvironment}some text some text +# will be changed to +# \end{myenvironment}% +# some text some text +# when set to 3, e.g +# \end{myenvironment}some text some text +# will be changed to +# \end{myenvironment} +# +# some text some text +# +# you can specify settings on a per-name basis +modifyLineBreaks: + preserveBlankLines: 1 + condenseMultipleBlankLinesInto: 1 + oneSentencePerLine: + manipulateSentences: 0 + removeSentenceLineBreaks: 1 + multipleSpacesToSingle: 1 + textWrapSentences: 0 # setting to 1 disables main textWrap routine + sentenceIndent: "" + sentencesFollow: + par: 1 + blankLine: 1 + fullStop: 1 + exclamationMark: 1 + questionMark: 1 + rightBrace: 1 + commentOnPreviousLine: 1 + other: 0 + sentencesBeginWith: + A-Z: 1 + a-z: 0 + other: 0 + sentencesEndWith: + basicFullStop: 0 + betterFullStop: 1 + exclamationMark: 1 + questionMark: 1 + other: 0 + textWrapOptions: + columns: 0 + multipleSpacesToSingle: 1 + removeBlockLineBreaks: 1 + blocksFollow: + headings: 1 + commentOnPreviousLine: 1 + par: 1 + blankLine: 1 + verbatim: 1 + filecontents: 1 + other: '\\\]|\\item(?:\h|\[)' # regex + blocksBeginWith: + A-Z: 1 + a-z: 1 + 0-9: 0 + other: 0 # regex + blocksEndBefore: + commentOnOwnLine: 1 + verbatim: 1 + filecontents: 1 + other: '\\begin\{|\\\[|\\end\{' # regex + huge: overflow # forbid mid-word line breaks + separator: "" + # poly-switches below here + environments: + BeginStartsOnOwnLine: 0 + BodyStartsOnOwnLine: 0 + EndStartsOnOwnLine: 0 + EndFinishesWithLineBreak: 0 + equation*: + BeginStartsOnOwnLine: 0 + BodyStartsOnOwnLine: 0 + EndStartsOnOwnLine: 0 + EndFinishesWithLineBreak: 0 + ifElseFi: + IfStartsOnOwnLine: 0 + BodyStartsOnOwnLine: 0 + OrStartsOnOwnLine: 0 + OrFinishesWithLineBreak: 0 + ElseStartsOnOwnLine: 0 + ElseFinishesWithLineBreak: 0 + FiStartsOnOwnLine: 0 + FiFinishesWithLineBreak: 0 + ifnum: + IfStartsOnOwnLine: 0 + BodyStartsOnOwnLine: 0 + OrStartsOnOwnLine: 0 + OrFinishesWithLineBreak: 0 + ElseStartsOnOwnLine: 0 + ElseFinishesWithLineBreak: 0 + FiStartsOnOwnLine: 0 + FiFinishesWithLineBreak: 0 + commands: + CommandStartsOnOwnLine: 0 + CommandNameFinishesWithLineBreak: 0 + optionalArguments: + LSqBStartsOnOwnLine: 0 + OptArgBodyStartsOnOwnLine: 0 + RSqBStartsOnOwnLine: 0 + RSqBFinishesWithLineBreak: 0 + mandatoryArguments: + LCuBStartsOnOwnLine: 0 + MandArgBodyStartsOnOwnLine: 0 + RCuBStartsOnOwnLine: 0 + RCuBFinishesWithLineBreak: 0 + keyEqualsValuesBracesBrackets: + KeyStartsOnOwnLine: 0 + EqualsStartsOnOwnLine: 0 + EqualsFinishesWithLineBreak: 0 + items: + ItemStartsOnOwnLine: 0 + ItemFinishesWithLineBreak: 0 + namedGroupingBracesBrackets: + NameStartsOnOwnLine: 0 + NameFinishesWithLineBreak: 0 + specialBeginEnd: + SpecialBeginStartsOnOwnLine: 0 + SpecialBodyStartsOnOwnLine: 0 + SpecialEndStartsOnOwnLine: 0 + SpecialEndFinishesWithLineBreak: 0 + verbatim: + VerbatimBeginStartsOnOwnLine: 0 + VerbatimEndFinishesWithLineBreak: 0 + +# replacements, only active when either -r or -rr switches are active +replacements: + - + amalgamate: 1 + - + this: 'latexindent.pl' + that: 'pl.latexindent' + lookForThis: 0 + when: before + +# fineTuning allows you to tweak the internal pattern matching that +# is central to latexindent.pl +fineTuning: + environments: + name: '[a-zA-Z@\*0-9_\\]+' + ifElseFi: + name: '(?!@?if[a-zA-Z@]*?\{)@?if[a-zA-Z@]*?' + commands: + name: '[+a-zA-Z@\*0-9_\:]+?' + items: + canBeFollowedBy: '(?:\[[^]]*?\])|(?:<[^>]*?>)' + keyEqualsValuesBracesBrackets: + name: '[a-zA-Z@\*0-9_\/.:\#-]+[a-zA-Z@\*0-9_\/.\h\{\}:\#-]*?' + follow: '(?:(?<!\\)\{)|,|(?:(?<!\\)\[)' + namedGroupingBracesBrackets: + name: '[0-9\.a-zA-Z@\*><]+?' + follow: '\h|\R|\{|\[|\$|\)|\(' + UnNamedGroupingBracesBrackets: + follow: '\{|\[|,|&|\)|\(|\$' + arguments: + before: '(?:#\d\h*;?,?\/?)+|\<.*?\>' + between: '_|\^|\*' + trailingComments: + notPreceededBy: '(?<!\\)' + modifyLineBreaks: + doubleBackSlash: '\\\\(?:\h*\[\h*\d+\h*[a-zA-Z]+\h*\])?' + comma: ',' + betterFullStop: |- + (?x) # ignore spaces in the below + (?: # + \.\) # .) + (?!\h*[a-z]) # not *followed by* a-z + ) # + | # OR + (?: # + (?<! # not *preceeded by* + (?: # + (?:[eE]\.[gG]) # e.g OR E.g OR e.G OR E.G + | # + (?:[iI]\.[eE]) # i.e OR I.e OR i.E OR I.E + | # + (?:etc) # etc + ) # + ) # + ) # + \. # . + (?! # not *followed by* + (?: # + [a-zA-Z0-9-~,] # + | # + \), # ), + | # + \)\. # ). + ) # + ) # diff --git a/hm/soispha/conf/less/default.nix b/hm/soispha/conf/less/default.nix new file mode 100644 index 00000000..fe7142f1 --- /dev/null +++ b/hm/soispha/conf/less/default.nix @@ -0,0 +1,15 @@ +{ + config, + pkgs, + ... +}: { + programs.less = { + enable = true; + keys = '' + t forw-line + n back-line + l repeat-search + L reverse-search + ''; + }; +} diff --git a/hm/soispha/conf/lf/colors b/hm/soispha/conf/lf/colors new file mode 100644 index 00000000..b2289b4e --- /dev/null +++ b/hm/soispha/conf/lf/colors @@ -0,0 +1,190 @@ +# vim:ft=dircolors +# (This is not a dircolors file but it helps to highlight colors and comments) + +# default values from dircolors +# (entries with a leading # are not implemented in lf) +# #no 00 # NORMAL +# fi 00 # FILE +# #rs 0 # RESET +# di 01;34 # DIR +# ln 01;36 # LINK +# #mh 00 # MULTIHARDLINK +# pi 40;33 # FIFO +# so 01;35 # SOCK +# #do 01;35 # DOOR +# bd 40;33;01 # BLK +# cd 40;33;01 # CHR +# or 40;31;01 # ORPHAN +# #mi 00 # MISSING +# su 37;41 # SETUID +# sg 30;43 # SETGID +# #ca 30;41 # CAPABILITY +# tw 30;42 # STICKY_OTHER_WRITABLE +# ow 34;42 # OTHER_WRITABLE +# st 37;44 # STICKY +# ex 01;32 # EXEC + +# default values from lf (with matching order) +# ln 01;36 # LINK +# or 31;01 # ORPHAN +# tw 01;34 # STICKY_OTHER_WRITABLE +# ow 01;34 # OTHER_WRITABLE +# st 01;34 # STICKY +# di 01;34 # DIR +# pi 33 # FIFO +# so 01;35 # SOCK +# bd 33;01 # BLK +# cd 33;01 # CHR +# su 01;32 # SETUID +# sg 01;32 # SETGID +# ex 01;32 # EXEC +# fi 00 # FILE + + +# file types (with matching order) +ln 01;33 # LINK +#ln 01;34 # LINK +or 01;35;46 # ORPHAN +tw 35 # STICKY_OTHER_WRITABLE +ow 35 # OTHER_WRITABLE +st 01;36 # STICKY +di 01;36 # DIR +pi 33 # FIFO +so 01;35 # SOCK +bd 33;01 # BLK +cd 33;01 # CHR +su 01;32 # SETUID +sg 01;32 # SETGID +ex 01;31;44 # EXEC +fi 00 # FILE + +# links +~/.mbsyncrc 01;34 +~/.cups 01;34 +~/.mozilla 01;34 +~/.ssh 01;34 + +~/.steampid 01;34 +~/.steam 01;34 +~/.steampath 01;34 + +# nix +~/.nix-profile 01;34 +~/.nix-defexpr 01;34 + +# archives or compressed (dircolors defaults) +*.tar 01;31 +*.tgz 01;31 +*.arc 01;31 +*.arj 01;31 +*.taz 01;31 +*.lha 01;31 +*.lz4 01;31 +*.lzh 01;31 +*.lzma 01;31 +*.tlz 01;31 +*.txz 01;31 +*.tzo 01;31 +*.t7z 01;31 +*.zip 01;31 +*.z 01;31 +*.dz 01;31 +*.gz 01;31 +*.lrz 01;31 +*.lz 01;31 +*.lzo 01;31 +*.xz 01;31 +*.zst 01;31 +*.tzst 01;31 +*.bz2 01;31 +*.bz 01;31 +*.tbz 01;31 +*.tbz2 01;31 +*.tz 01;31 +*.deb 01;31 +*.rpm 01;31 +*.jar 01;31 +*.war 01;31 +*.ear 01;31 +*.sar 01;31 +*.rar 01;31 +*.alz 01;31 +*.ace 01;31 +*.zoo 01;31 +*.cpio 01;31 +*.7z 01;31 +*.rz 01;31 +*.cab 01;31 +*.wim 01;31 +*.swm 01;31 +*.dwm 01;31 +*.esd 01;31 + +# image formats (dircolors defaults) +*.jpg 01;35 +*.jpeg 01;35 +*.mjpg 01;35 +*.mjpeg 01;35 +*.gif 01;35 +*.bmp 01;35 +*.pbm 01;35 +*.pgm 01;35 +*.ppm 01;35 +*.tga 01;35 +*.xbm 01;35 +*.xpm 01;35 +*.tif 01;35 +*.tiff 01;35 +*.png 01;35 +*.svg 01;35 +*.svgz 01;35 +*.mng 01;35 +*.pcx 01;35 +*.mov 01;35 +*.mpg 01;35 +*.mpeg 01;35 +*.m2v 01;35 +*.mkv 01;35 +*.webm 01;35 +*.ogm 01;35 +*.mp4 01;35 +*.m4v 01;35 +*.mp4v 01;35 +*.vob 01;35 +*.qt 01;35 +*.nuv 01;35 +*.wmv 01;35 +*.asf 01;35 +*.rm 01;35 +*.rmvb 01;35 +*.flc 01;35 +*.avi 01;35 +*.fli 01;35 +*.flv 01;35 +*.gl 01;35 +*.dl 01;35 +*.xcf 01;35 +*.xwd 01;35 +*.yuv 01;35 +*.cgm 01;35 +*.emf 01;35 +*.ogv 01;35 +*.ogx 01;35 + +# audio formats (dircolors defaults) +*.aac 00;36 +*.au 00;36 +*.flac 00;36 +*.m4a 00;36 +*.mid 00;36 +*.midi 00;36 +*.mka 00;36 +*.mp3 00;36 +*.mpc 00;36 +*.ogg 00;36 +*.ra 00;36 +*.wav 00;36 +*.oga 00;36 +*.opus 00;36 +*.spx 00;36 +*.xspf 00;36 diff --git a/hm/soispha/conf/lf/commands/default.nix b/hm/soispha/conf/lf/commands/default.nix new file mode 100644 index 00000000..a52cb2f0 --- /dev/null +++ b/hm/soispha/conf/lf/commands/default.nix @@ -0,0 +1,241 @@ +{ + pkgs, + sysLib, + shell_library, + system, + lf_rename, + ... +}: let + functionCall = { + file, + dependencies, + replacementStrings, + ... + }: + sysLib.writeShellScriptWithLibraryAndKeepPath { + name = "${builtins.baseNameOf file}"; + src = file; + dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;}); + inherit replacementStrings; + } + + "/bin/${builtins.baseNameOf file}"; + + shell = { + file, + dependencies, + replacementStrings ? null, + ... + }: '' + ''${{ + ${functionCall {inherit file dependencies replacementStrings;}} + }} + ''; # closes the lf tui + pipe = { + file, + dependencies, + replacementStrings ? null, + ... + }: '' + %{{ + ${functionCall {inherit file dependencies replacementStrings;}} + }} + ''; # runs the command in the ui/term bar + async = { + file, + dependencies, + replacementStrings ? null, + ... + }: '' + &{{ + ${functionCall {inherit file dependencies replacementStrings;}} + }} + ''; # runs the command in the background + wait = { + file, + dependencies, + replacementStrings ? null, + ... + }: '' + !{{ + ${functionCall {inherit file dependencies replacementStrings;}} + }} + ''; # adds a prompt after the command has run +in { + archive = shell { + file = ./scripts/archive; + dependencies = builtins.attrValues { + inherit + (pkgs) + fzf + gnutar + xz + p7zip + zip + ; + }; + }; + broot_jump = shell { + file = ./scripts/broot_jump; + dependencies = builtins.attrValues { + inherit (pkgs) broot; + }; + }; + chmod = pipe { + file = ./scripts/chmod; + dependencies = []; + }; + clear_trash = shell { + file = ./scripts/clear_trash; + dependencies = builtins.attrValues { + inherit + (pkgs) + fzf + trashy + ; + }; + }; + dl_file = pipe { + file = ./scripts/dl_file; + dependencies = builtins.attrValues { + inherit + (pkgs) + xdragon + curl + ; + }; + }; + dragon = pipe { + file = ./scripts/dragon; + dependencies = builtins.attrValues { + inherit + (pkgs) + xdragon + ; + }; + }; + dragon_individual = pipe { + file = ./scripts/dragon_individual; + dependencies = builtins.attrValues { + inherit + (pkgs) + xdragon + ; + }; + }; + dragon_stay = pipe { + file = ./scripts/dragon_stay; + dependencies = builtins.attrValues { + inherit + (pkgs) + xdragon + ; + }; + }; + fzf_jump = shell { + file = ./scripts/fzf_jump; + dependencies = builtins.attrValues { + inherit (pkgs) fzf lf gnused; + }; + }; + mk_dir = pipe { + file = ./scripts/mk_dir; + dependencies = []; + }; + mk_file = shell { + file = ./scripts/mk_file; + dependencies = []; + }; + mk_file_and_edit = shell { + file = ./scripts/mk_file_and_edit; + dependencies = []; + }; + mk_ln = pipe { + file = ./scripts/mk_ln; + dependencies = []; + }; + mk_scr_default = shell { + file = ./scripts/mk_scr_default; + dependencies = builtins.attrValues {}; + replacementStrings = { + SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; + }; + }; + mk_scr_temp = shell { + file = ./scripts/mk_scr_temp; + dependencies = builtins.attrValues {}; + replacementStrings = { + SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; + TO_BE_SHELL_LIBRARY_PATH = "%SHELL_LIBRARY_PATH"; # replacement is not recursive + }; + }; + open = shell { + file = ./scripts/open; + dependencies = builtins.attrValues {inherit (pkgs) file xdg-utils;}; + }; + go_project_base_directory = async { + file = ./scripts/go_project_root; + dependencies = []; + }; + open_config = shell { + file = ./scripts/open_config; + dependencies = builtins.attrValues { + #inherit + #(pkgs) + ## TODO: rewrite this: bookmenu, https://github.com/jarun/buku + # + #buku + #; + }; + }; + restore_trash = shell { + file = ./scripts/restore_trash; + dependencies = builtins.attrValues { + inherit + (pkgs) + fzf + trashy + ; + }; + }; + set_wall_paper = pipe { + file = ./scripts/set_wall_paper; + dependencies = []; + }; + /* + FIXME: + The c code fails, when stdout/-in is piped. + rename = '' + %{{ + ${lf_rename.packages."${system}".default}/bin/rename + }} + ''; + */ + stripspace = pipe { + file = ./scripts/stripspace; + dependencies = []; + }; + trash = pipe { + file = ./scripts/trash; + dependencies = builtins.attrValues { + inherit + (pkgs) + trashy + trash-cli + findutils + ; + }; + }; + unarchive = pipe { + file = ./scripts/unarchive; + dependencies = builtins.attrValues { + inherit + (pkgs) + gnutar + unzip + # TODO: this is unfree! unrar + + p7zip + ; + }; + }; +} diff --git a/hm/soispha/conf/lf/commands/scripts/archive b/hm/soispha/conf/lf/commands/scripts/archive new file mode 100755 index 00000000..48fe25fc --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/archive @@ -0,0 +1,54 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +# Option '-f' disables pathname expansion which can be useful when $f, $fs, and +# $fx variables contain names with '*' or '?' characters. However, this option +# is used selectively within individual commands as it can be limiting at +# times. +set -f + +archivers="$(tmp 'echo "gzip xz 7z zip"')"; + +prompt "Archive name: " +name="" +while [ -z "$name" ] || [ -e "$name" ] +do + read -r name + if [ -e "$name" ]; then + prompt "Archive already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Archive name: " + fi + fi +done + +root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/";fi)"; + +# fx contains all selected file name separated by a newline +while read -r raw_file; do + file="$(echo "$raw_file" | sed "s|$root||")"; + set -- "$@" "$file"; +done < "$(tmp "echo '$fx'")"; + +case "$(awk '{for (i=1; i<=NF; i++) print $i}' "$archivers" | fzf)" in + "gzip") + tar -czf "$name".tar.gz "$@" + ;; + "xz") + tar -cf "$name".tar "$@" + xz -z -9 -e -T0 "$name".tar + ;; + "7z") + 7z a "$name".7z "$@" + ;; + "zip") + zip --symlinks -r "$name".zip "$@" + ;; +esac +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/broot_jump b/hm/soispha/conf/lf/commands/scripts/broot_jump new file mode 100755 index 00000000..abefc616 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/broot_jump @@ -0,0 +1,16 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +tmp=$(mktmp) +res="$(broot --outcmd "$tmp" && sed 's/cd //' "$tmp")" + +if [ -f "$res" ]; then + cmd="select" +elif [ -d "$res" ]; then + cmd="cd" +fi + +lf -remote "send '$id' '$cmd' '$res'" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/chmod b/hm/soispha/conf/lf/commands/scripts/chmod new file mode 100755 index 00000000..07bc37cc --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/chmod @@ -0,0 +1,13 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +readp "Mode bits: " bits + +while read -r file; do + chmod "$bits" "$file" +done < "$(tmp "echo $fx")" + +lf -remote 'send reload' +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/clear_trash b/hm/soispha/conf/lf/commands/scripts/clear_trash new file mode 100755 index 00000000..f2571fcc --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/clear_trash @@ -0,0 +1,8 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +# could also use --force, for instand removal +trash list | fzf --multi | awk '{print $NF}' | xargs trash empty --match=exact +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/dl_file b/hm/soispha/conf/lf/commands/scripts/dl_file new file mode 100755 index 00000000..54518049 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/dl_file @@ -0,0 +1,33 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +# Provides the ability to download a file by dropping it into a window + +url="$(dragon -t -x)" + +if [ -n "$url" ]; then + prompt "File Name: " + name="" + while [ -z "$name" ] || [ -e "$name" ] + do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "File Name: " + fi + fi + done + + # Download the file with curl + [ -n "$name" ] && curl -o "$name" "$url" || die "curl failed" +else + die "URL is null!" +fi +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/dragon b/hm/soispha/conf/lf/commands/scripts/dragon new file mode 100755 index 00000000..7e2d9ba6 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/dragon @@ -0,0 +1,11 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +while read -r file; do + set -- "$@" "$file" +done < "$(tmp "echo '$fx'")" + +dragon -a -x "$@" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/dragon_individual b/hm/soispha/conf/lf/commands/scripts/dragon_individual new file mode 100755 index 00000000..5d55aaa8 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/dragon_individual @@ -0,0 +1,11 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +while read -r file; do + set -- "$@" "$file" +done < "$(tmp "echo '$fx'")" + +dragon "$@" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/dragon_stay b/hm/soispha/conf/lf/commands/scripts/dragon_stay new file mode 100755 index 00000000..f3483483 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/dragon_stay @@ -0,0 +1,11 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +while read -r file; do + set -- "$@" "$file"; +done < "$(tmp "echo '$fx'")" + +dragon -a "$@" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/fzf_jump b/hm/soispha/conf/lf/commands/scripts/fzf_jump new file mode 100755 index 00000000..0e53d7ca --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/fzf_jump @@ -0,0 +1,16 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +res="$(fd . --maxdepth 3 | fzf --header='Jump to location')" + +if [ -f "$res" ]; then + cmd="select" +elif [ -d "$res" ]; then + cmd="cd" +fi + + +lf -remote "send $id $cmd \"$res\"" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/go_project_root b/hm/soispha/conf/lf/commands/scripts/go_project_root new file mode 100755 index 00000000..555caaf9 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/go_project_root @@ -0,0 +1,13 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +flake_base_dir="$(search_flake_base_dir)"; +if [ "$flake_base_dir" ]; then + lf -remote "send $id cd $flake_base_dir" || die "Bug: No base dir ($flake_base_dir)" +else + die "Unable to locate base dir"; +fi + +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/mk_dir b/hm/soispha/conf/lf/commands/scripts/mk_dir new file mode 100755 index 00000000..4dca06dc --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/mk_dir @@ -0,0 +1,24 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +prompt "Directory Name: " +name="" +while [ -z "$name" ] || [ -e "$name" ] +do + read -r name + if [ -e "$name" ]; then + prompt "Directory already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Directory Name: " + fi + fi +done + +mkdir "$name" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/mk_file b/hm/soispha/conf/lf/commands/scripts/mk_file new file mode 100755 index 00000000..5f245396 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/mk_file @@ -0,0 +1,24 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +prompt "File name: " +name="" +while [ -z "$name" ] || [ -e "$name" ] +do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "File name: " + fi + fi +done + +touch "$name" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/mk_file_and_edit b/hm/soispha/conf/lf/commands/scripts/mk_file_and_edit new file mode 100755 index 00000000..2e5a2deb --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/mk_file_and_edit @@ -0,0 +1,25 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +prompt "File name: " +name="" +while [ -z "$name" ] || [ -e "$name" ] +do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "File name: " + fi + fi +done + +touch "$name" +"$EDITOR" "$name" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/mk_ln b/hm/soispha/conf/lf/commands/scripts/mk_ln new file mode 100755 index 00000000..1e97517f --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/mk_ln @@ -0,0 +1,36 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +while IFS= read -r i;do + set -- "$@" "$i" +done < "$HOME"/.local/share/lf/files + +mode="$1" +shift + +if [ "$#" -eq 0 ]; then + msg "no files to link" + exit 0 +fi + +case "$mode" in + copy) + while [ "$#" -gt 0 ]; do + file="$1" + ans="$(basename "$file")" + + while [ -e "$ans" ];do + prompt "$ans already exists, new name for link: " + read -r ans + done + + ln -s "$file" "$(pwd)/$ans" + shift + done + ;; +esac +rm ~/.local/share/lf/files +# lf -remote "send clear" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/mk_scr_default b/hm/soispha/conf/lf/commands/scripts/mk_scr_default new file mode 100755 index 00000000..b13ca9f5 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/mk_scr_default @@ -0,0 +1,31 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + + +prompt "Script name: " +name="" +while [ -z "$name" ] || [ -e "$name" ] +do + read -r name + if [ -e "$name" ]; then + prompt "Script already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Script Name: " + fi + fi +done + +script="$(pwd)"/"$name" + +cat "%SHELL_LIBRARY_TEMPLATE" > "$script" +chmod +x "$script" +"$VISUAL" "$script" + + +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/mk_scr_temp b/hm/soispha/conf/lf/commands/scripts/mk_scr_temp new file mode 100755 index 00000000..a520469c --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/mk_scr_temp @@ -0,0 +1,31 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + + +prompt "Script name: " +name="" +while [ -z "$name" ] || [ -e "$name" ] +do + read -r name + if [ -e "$name" ]; then + prompt "Script already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Script Name: " + fi + fi +done + +script="$(pwd)"/"$name" + +sed 's|%TO_BE_SHELL_LIBRARY_PATH|%SHELL_LIBRARY_PATH|' "%SHELL_LIBRARY_TEMPLATE" > "$script" +chmod +x "$script" +"$VISUAL" "$script" + + +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/open b/hm/soispha/conf/lf/commands/scripts/open new file mode 100755 index 00000000..c507482b --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/open @@ -0,0 +1,11 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +case $(file --mime-type "$f" -bL) in + text/*|application/json|application/vnd.hp-HPGL) "$EDITOR" "$f";; + image/*) "$IVIEWER" "$f";; + *) xdg-open "$f";; +esac +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/open_config b/hm/soispha/conf/lf/commands/scripts/open_config new file mode 100755 index 00000000..35e5165d --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/open_config @@ -0,0 +1,7 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +"$EDITOR" "$(bookmenu -b ~/.config/bookmenu/configs -f fzf -o)" # TODO: implement this +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/restore_trash b/hm/soispha/conf/lf/commands/scripts/restore_trash new file mode 100755 index 00000000..a7bf0094 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/restore_trash @@ -0,0 +1,7 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/set_wall_paper b/hm/soispha/conf/lf/commands/scripts/set_wall_paper new file mode 100755 index 00000000..c493e773 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/set_wall_paper @@ -0,0 +1,10 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +die "No yet implemented" # TODO: do what the 'die' says +#sed -i "s,export AWMWALLPAPER='.*',export AWMWALLPAPER='${f}'," ${ZDOTDIR}/.zshenv +#nohub swaybg -i "$f" +#feh --bg-max --no-fehbg "$f" +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/stripspace b/hm/soispha/conf/lf/commands/scripts/stripspace new file mode 100755 index 00000000..91714712 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/stripspace @@ -0,0 +1,31 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +files=$(mktmp); +echo "$fx" > "$files"; + +awk_source=$(mktmp); +cat << OFT > "$awk_source" +BEGIN {FS=" "} +{for (i=1; i != NF + 1; i++) + if (i == NF) { + parts[i]=tolower(\$i); + } else { + parts[i]=tolower(\$i"_"); + } +} +END {for (i in parts) printf parts[i]} +OFT + +while read -r file; do + dirty_name=$(mktmp) + basename "$file" > "$dirty_name"; + clean_name=$(awk -f "$awk_source" "$dirty_name"); + + [ -e "$clean_name" ] && die "file \"$clean_name\" already exists!"; + mv "$(cat "$dirty_name")" "$clean_name" || die "Move failed"; + lf -remote 'send reload' +done < "$files"; +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/trash b/hm/soispha/conf/lf/commands/scripts/trash new file mode 100755 index 00000000..8dd6033d --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/trash @@ -0,0 +1,26 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +trash_output=$(mktmp); +expected_error_output=$(mktmp); + +while read -r file; do + set -- "$@" "$file" +done < "$(tmp "echo '$fx'")" + +# TODO: why are we using trashy at all, when trash-cli can do everything? +# try trashy first, trough nix because both trashy and trash-cli provide a trash command, which conflicts +nix run nixpkgs#trashy -- put "$@" 2> "$trash_output"; + +cat << EOF > "$expected_error_output"; +[1;31merror:[0m Error during a \`trash\` operation: Unknown { description: "Path: '\"/.Trash-1000\"'. Message: Permission denied (os error 13)" } +EOF + +if [ "$(cat "$expected_error_output")" = "$(cat "$trash_output")" ];then + warning "Deleting with trash-cli to the /.Trash folder"; + # this file could not be trashed because it is on the tempfs volume, trash-cli can do this this + trash-put "$@"; +fi +# vim: ft=sh diff --git a/hm/soispha/conf/lf/commands/scripts/unarchive b/hm/soispha/conf/lf/commands/scripts/unarchive new file mode 100755 index 00000000..ee97f3b1 --- /dev/null +++ b/hm/soispha/conf/lf/commands/scripts/unarchive @@ -0,0 +1,22 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +# extract the current file with the right command +# (xkcd link: https://xkcd.com/1168/) +set -f +# TODO: add support for multiple files at once +case "$f" in + *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf "$f";; + *.tar.gz|*.tgz) tar xzvf "$f";; + *.tar.xz|*.txz) tar xJvf "$f";; + *.zip) unzip "$f";; + *.rar) + die "rar is a unfree format!" + #unrar x $f + ;; + *.7z) 7z x "$f";; + *) die "Unsupported format" ;; +esac +# vim: ft=sh diff --git a/hm/soispha/conf/lf/default.nix b/hm/soispha/conf/lf/default.nix new file mode 100644 index 00000000..ed037b05 --- /dev/null +++ b/hm/soispha/conf/lf/default.nix @@ -0,0 +1,53 @@ +{ + pkgs, + sysLib, + nixosConfig, + shell_library, + lf_rename, + system, + ... +}: let + commands = import ./commands {inherit pkgs sysLib shell_library system lf_rename;}; + keybindings = import ./keybindings {inherit nixosConfig;}; +in { + xdg.configFile."lf/icons".source = ./icons; + xdg.configFile."lf/colors".source = ./colors; + + # TODO: add the systemd tempfile option here + + programs.lf = { + enable = true; + + inherit commands keybindings; + + previewer = { + keybinding = "i"; + source = "${pkgs.ctpv}/bin/ctpv"; + }; + settings = { + # TODO: this needs to be added to nixos: + #autoquit = true; # quit the server, if no clients are left + #dirpreviews = true; # preview for directories + + dircounts = true; # count things in directories TODO: this has performance impact + drawbox = true; + # errorfmt = "\\033[1;91m==> ERROR:\\033[0m\\033[1;93m%s\\033[0m"; + errorfmt = "\\033[1;91m%s\\033[0m"; + hidden = true; # show hidden files + icons = true; + ifs = "\\n"; # internal field separator for shell commands + #info = "size"; # show the size of a directory + shell = "sh"; + shellopts = "-eu"; # e: exit on error; u: error for unset variables + }; + # TODO: remove auto quit, if it has been added + extraConfig = '' + &${pkgs.ctpv}/bin/ctpv -s $id + cmd on-quit %${pkgs.ctpv}/bin/ctpv -e $id + set cleaner ${pkgs.ctpv}/bin/ctpvclear + + # close the server, after the last client exits + set autoquit true + ''; + }; +} diff --git a/hm/soispha/conf/lf/icons b/hm/soispha/conf/lf/icons new file mode 100644 index 00000000..7ef62a0b --- /dev/null +++ b/hm/soispha/conf/lf/icons @@ -0,0 +1,357 @@ +# vim:ft=conf + +# These examples require Nerd Fonts or a compatible font to be used. +# See https://www.nerdfonts.com for more information. + +# default values from lf (with matching order) +# ln l # LINK +# or l # ORPHAN +# tw t # STICKY_OTHER_WRITABLE +# ow d # OTHER_WRITABLE +# st t # STICKY +# di d # DIR +# pi p # FIFO +# so s # SOCK +# bd b # BLK +# cd c # CHR +# su u # SETUID +# sg g # SETGID +# ex x # EXEC +# fi - # FILE + +# file types (with matching order) +ln # LINK +or # ORPHAN +tw t # STICKY_OTHER_WRITABLE +ow # OTHER_WRITABLE # nf-oct-file_directory +st t # STICKY +di # DIR # nf-oct-file_directory +pi p # FIFO +so s # SOCK +bd b # BLK +cd c # CHR +su u # SETUID +sg g # SETGID +ex # EXEC +fi # FILE # nf-fa-file_text_o + +# file extensions (vim-devicons) +*.styl +*.sass +*.scss +*.htm +*.html +*.slim +*.haml +*.ejs +*.css +*.less +*.md +*.mdx +*.markdown +*.rmd +*.json +*.webmanifest +*.js +*.mjs +*.jsx +*.rb +*.gemspec +*.rake +*.php +*.py +*.pyc +*.pyo +*.pyd +*.coffee +*.mustache +*.hbs +*.conf +*.ini +*.yml +*.yaml +*.toml +*.bat +*.mk +*.jpg +*.jpeg +*.bmp +*.png +*.webp +*.gif +*.ico +*.twig +*.cpp +*.c++ +*.cxx +*.cc +*.cp +*.c +*.cs +*.h +*.hh +*.hpp +*.hxx +*.hs +*.lhs +*.nix +*.lua +*.java +*.sh +*.fish +*.bash +*.zsh +*.ksh +*.csh +*.awk +*.ps1 +*.ml λ +*.mli λ +*.diff +*.db +*.sql +*.dump +*.clj +*.cljc +*.cljs +*.edn +*.scala +*.go +*.dart +*.xul +*.sln +*.suo +*.pl +*.pm +*.t +*.rss +'*.f#' +*.fsscript +*.fsx +*.fs +*.fsi +*.rs +*.rlib +*.d +*.erl +*.hrl +*.ex +*.exs +*.eex +*.leex +*.heex +*.vim +*.ai +*.psd +*.psb +*.ts +*.tsx +*.jl +*.pp +*.vue +*.elm +*.swift +*.xcplayground +*.tex +*.r +*.rproj +*.sol +*.pem + +# file names (vim-devicons) (case-insensitive not supported in lf) +*gruntfile.coffee +*gruntfile.js +*gruntfile.ls +*gulpfile.coffee +*gulpfile.js +*gulpfile.ls +*mix.lock +*dropbox +*.ds_store +*.gitconfig +*.gitignore +*.gitattributes +*.gitlab-ci.yml +*.bashrc +*.zshrc +*.zshenv +*.zprofile +*.vimrc +*.gvimrc +*_vimrc +*_gvimrc +*.bashprofile +*favicon.ico +*license +*node_modules +*react.jsx +*procfile +*dockerfile +*docker-compose.yml +*rakefile +*config.ru +*gemfile +*makefile +*cmakelists.txt +*robots.txt + +# file names (case-sensitive adaptations) +*Gruntfile.coffee +*Gruntfile.js +*Gruntfile.ls +*Gulpfile.coffee +*Gulpfile.js +*Gulpfile.ls +*Dropbox +*.DS_Store +*LICENSE +*React.jsx +*Procfile +*Dockerfile +*Docker-compose.yml +*Rakefile +*Gemfile +*Makefile +*CMakeLists.txt + +# file patterns (vim-devicons) (patterns not supported in lf) +# .*jquery.*\.js$ +# .*angular.*\.js$ +# .*backbone.*\.js$ +# .*require.*\.js$ +# .*materialize.*\.js$ +# .*materialize.*\.css$ +# .*mootools.*\.js$ +# .*vimrc.* +# Vagrantfile$ + +# file patterns (file name adaptations) +*jquery.min.js +*angular.min.js +*backbone.min.js +*require.min.js +*materialize.min.js +*materialize.min.css +*mootools.min.js +*vimrc +Vagrantfile + +# archives or compressed (extensions from dircolors defaults) +*.tar +*.tgz +*.arc +*.arj +*.taz +*.lha +*.lz4 +*.lzh +*.lzma +*.tlz +*.txz +*.tzo +*.t7z +*.zip +*.z +*.dz +*.gz +*.lrz +*.lz +*.lzo +*.xz +*.zst +*.tzst +*.bz2 +*.bz +*.tbz +*.tbz2 +*.tz +*.deb +*.rpm +*.jar +*.war +*.ear +*.sar +*.rar +*.alz +*.ace +*.zoo +*.cpio +*.7z +*.rz +*.cab +*.wim +*.swm +*.dwm +*.esd + +# image formats (extensions from dircolors defaults) +*.jpg +*.jpeg +*.mjpg +*.mjpeg +*.gif +*.bmp +*.pbm +*.pgm +*.ppm +*.tga +*.xbm +*.xpm +*.tif +*.tiff +*.png +*.svg +*.svgz +*.mng +*.pcx +*.mov +*.mpg +*.mpeg +*.m2v +*.mkv +*.webm +*.ogm +*.mp4 +*.m4v +*.mp4v +*.vob +*.qt +*.nuv +*.wmv +*.asf +*.rm +*.rmvb +*.flc +*.avi +*.fli +*.flv +*.gl +*.dl +*.xcf +*.xwd +*.yuv +*.cgm +*.emf +*.ogv +*.ogx + +# audio formats (extensions from dircolors defaults) +*.aac +*.au +*.flac +*.m4a +*.mid +*.midi +*.mka +*.mp3 +*.mpc +*.ogg +*.ra +*.wav +*.oga +*.opus +*.spx +*.xspf + +# other formats +*.pdf diff --git a/hm/soispha/conf/lf/keybindings/default.nix b/hm/soispha/conf/lf/keybindings/default.nix new file mode 100644 index 00000000..ab34d7d4 --- /dev/null +++ b/hm/soispha/conf/lf/keybindings/default.nix @@ -0,0 +1,127 @@ +{nixosConfig, ...}: { + # Remove some defaults + m = null; + "\"'\"" = null; + "'\"'" = null; + d = null; + c = null; + e = null; + j = null; + k = null; + l = null; + ";" = null; + + # File Openers + ee = "\$\$EDITOR \"$f\""; + es = "\$ nvim -S \"$f\""; + u = "%\$IVIEWER \"$f\""; + cc = "\$sudo -e \"$f\""; + + # Archive Mappings + au = "unarchive"; + aa = "archive"; + + # Trash Mappings + dd = "trash"; + jc = "clear_trash"; + jr = "restore_trash"; + + # Broot Mapping + f = "fzf_jump"; + + # Dragon Mapping + dr = "dragon"; + ds = "dragon-stay"; + di = "dragon-individual"; + #dm = "mvdragon"; + #dc = "cpdragon"; + dl = "dlfile"; + + cs = "stripspace"; + + # Vim keys + h = "updir"; + t = "down"; + n = "up"; + s = "open"; + + # Basic Functions + "." = "set hidden!"; + DD = "delete"; + p = "paste"; + x = "cut"; + y = "copy"; + "<enter>" = "open"; + + mk = "mk_ln"; + mf = "mk_file"; + me = "mk_file_and_edit"; + md = "mk_dir"; + ms = "mk_scr_default"; + mt = "mk_scr_temp"; + + ch = "chmod"; + bg = "set_wall_paper"; + o = "open_config"; + r = "rename"; + H = "go_project_base_directory"; + L = "bottom"; + R = "reload"; + C = "clear"; + U = "unselect"; + + # Movement + gjr = "cd ~/.local/share/Trash/files"; + gus = "cd /run/user/${builtins.toString nixosConfig.users.users.soispha.uid}"; + + "gr." = "cd ~/repos"; + grn = "cd ~/repos/nix"; + grcc = "cd ~/repos/c"; + grcp = "cd ~/repos/cpp"; + grl = "cd ~/repos/lua"; + grr = "cd ~/repos/rust"; + grs = "cd ~/repos/shell"; + grjs = "cd ~/repos/java_script"; + grmd = "cd ~/repos/mark_down"; + grty = "cd ~/repos/typst"; + grte = "cd ~/repos/tex"; + grj = "cd ~/repos/java"; + gra = "cd ~/repos/awk"; + grpy = "cd ~/repos/python"; + grpe = "cd ~/repos/perl"; + grahk = "cd ~/repos/auto_hot_key"; + grh = "cd ~/repos/html"; + # ------------- + "gm." = "cd ~/media"; + gmp = "cd ~/media/pictures"; + gmd = "cd ~/media/downloads"; + gmm = "cd ~/media/music"; + gmi = "cd ~/media/isos"; + # ------------- + "gs." = "cd ~/school"; + gsi = "cd ~/school/infomatik"; + gsc = "cd ~/school/chemie"; + gse = "cd ~/school/english"; + gsgo = "cd ~/school/geographie"; + gsgs = "cd ~/school/geschichte"; + gskr = "cd ~/school/katholische_religion"; + gsmu = "cd ~/school/musik"; + gsma = "cd ~/school/mathematik"; + gsl = "cd ~/school/latein"; + gsd = "cd ~/school/deutsch"; + gsb = "cd ~/school/biologie"; + gsso = "cd ~/school/sozialkunde"; + gssp = "cd ~/school/sport"; + gspy = "cd ~/school/physik"; + gspi = "cd ~/school/philosophie"; + # ------------- + + gc = "cd ~/.config"; + gl = "cd ~/.local"; + gE = "cd /etc"; + + "gU." = "cd /usr"; + gUs = " cd /usr/share"; + + gt = "cd /tmp"; +} diff --git a/hm/soispha/conf/mail/default.nix b/hm/soispha/conf/mail/default.nix new file mode 100644 index 00000000..475bcacf --- /dev/null +++ b/hm/soispha/conf/mail/default.nix @@ -0,0 +1,64 @@ +{ + config, + pkgs, + lib, + ... +}: let + non_public_accounts = import ./non_public_accounts.nix {inherit pkgs;}; + accounts = lib.recursiveUpdate {inherit soispha;} non_public_accounts; + + soispha = { + address = "soispha@vhack.eu"; + userName = "soispha@vhack.eu"; + realName = "Soispha"; + primary = true; + passwordCommand = "${pkgs.libsecret}/bin/secret-tool lookup account soispha@vhack.eu"; + aliases = [ + "admin@vhack.eu" + ]; + folders = { + }; + gpg = { + encryptByDefault = true; + key = "9606FC749FCE16360723D4ADA5E94010C3A642AD"; + signByDefault = true; + }; + signature = { + # TODO: + }; + neomutt = { + enable = true; + }; + mbsync = { + enable = true; + create = "both"; + }; + himalaya = { + enable = true; + backend = "imap"; + sender = "smtp"; + settings = { + # TODO: + }; + }; + smtp = { + host = "server1.vhack.eu"; + port = 465; + }; + imap = { + host = "server1.vhack.eu"; + port = 993; + }; + jmap = { + # TODO: + }; + maildir = { + path = "soispha"; + }; + }; +in { + accounts.email = { + maildirBasePath = "${config.xdg.dataHome}/maildir"; + inherit accounts; + }; +} diff --git a/hm/soispha/conf/mail/non_public_accounts.nix b/hm/soispha/conf/mail/non_public_accounts.nix new file mode 100644 index 00000000..0076aebd --- /dev/null +++ b/hm/soispha/conf/mail/non_public_accounts.nix Binary files differdiff --git a/hm/soispha/conf/mako/default.nix b/hm/soispha/conf/mako/default.nix new file mode 100644 index 00000000..711457f2 --- /dev/null +++ b/hm/soispha/conf/mako/default.nix @@ -0,0 +1,44 @@ +{ + config, + pkgs, + ... +}: { + services.mako = { + enable = true; + backgroundColor = "#2e3440"; + borderColor = "#88c0d0"; + borderRadius = 25; + borderSize = 2; + defaultTimeout = 5000; + font = "Source Code Pro 10"; + width = 500; + height = 500; + icons = true; + ignoreTimeout = true; + layer = "overlay"; + markup = true; # TODO: + maxIconSize = 64; + sort = "-time"; + extraConfig = '' + [urgency=low] + border-color=#cccccc + + [urgency=normal] + border-color=#d08770 + + [urgency=high] + border-size=3 + border-color=#bf616a + default-timeout=0 + + [urgency=critical] + border-size=4 + border-color=#bf616a + default-timeout=0 + + [category=mpd] + default-timeout=2000 + group-by=category + ''; + }; +} diff --git a/hm/soispha/conf/mbsync/default.nix b/hm/soispha/conf/mbsync/default.nix new file mode 100644 index 00000000..ac9808c9 --- /dev/null +++ b/hm/soispha/conf/mbsync/default.nix @@ -0,0 +1,17 @@ +{ + config, + lib, + ... +}: { + # TODO: I have no clue if both are needed, but it looks neat, right? + programs.mbsync = { + enable = true; + }; + services.mbsync = { + enable = true; + # TODO: enable after isync 1.5 drops + #configFile = "${config.xdg.configHome}/mbsync/mbsync.conf"; + }; + # Disable the timer, and only activate it on neomutt start + systemd.user.timers.mbsync = lib.mkForce {}; +} diff --git a/hm/soispha/conf/mpd/default.nix b/hm/soispha/conf/mpd/default.nix new file mode 100644 index 00000000..bbd345a7 --- /dev/null +++ b/hm/soispha/conf/mpd/default.nix @@ -0,0 +1,39 @@ +{ + config, + pkgs, + lib, + osConfig, + ... +}: let + dataDir = "${config.xdg.dataHome}/mpd"; + playlistDirectory = "${dataDir}/playlists"; + runtimeDir = "/run/user/${builtins.toString osConfig.users.users.soispha.uid}/mpd"; +in { + systemd.user.services.mpd.Service.ExecStartPre = lib.mkForce '' + ${pkgs.coreutils}/bin/mkdir -p "${dataDir}" "${playlistDirectory}" "${runtimeDir}" + ''; + services.mpd = { + enable = true; + inherit dataDir; + musicDirectory = "~/media/music"; + network = { + listenAddress = "${runtimeDir}/socket"; + }; + extraConfig = '' + metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc,comment" + auto_update "yes" + + audio_output { + type "pipewire" + name "pipewire" + } + #database { + # plugin "simple" + # path "~/.local/share/mpd/db + # cache_directory "~/.local/share/mpd/cache" + #} + + filesystem_charset "UTF-8" + ''; + }; +} diff --git a/hm/soispha/conf/mpd/mpdconf.example b/hm/soispha/conf/mpd/mpdconf.example new file mode 100644 index 00000000..eaa5e641 --- /dev/null +++ b/hm/soispha/conf/mpd/mpdconf.example @@ -0,0 +1,418 @@ +# An example configuration file for MPD. +# Read the user manual for documentation: http://www.musicpd.org/doc/user/ + + +# Files and directories ####################################################### +# +# This setting controls the top directory which MPD will search to discover the +# available audio files and add them to the daemon's online database. This +# setting defaults to the XDG directory, otherwise the music directory will be +# be disabled and audio files will only be accepted over ipc socket (using +# file:// protocol) or streaming files over an accepted protocol. +# +#music_directory "~/music" +# +# This setting sets the MPD internal playlist directory. The purpose of this +# directory is storage for playlists created by MPD. The server will use +# playlist files not created by the server but only if they are in the MPD +# format. This setting defaults to playlist saving being disabled. +# +#playlist_directory "~/.mpd/playlists" +# +# This setting sets the location of the MPD database. This file is used to +# load the database at server start up and store the database while the +# server is not up. This setting defaults to disabled which will allow +# MPD to accept files over ipc socket (using file:// protocol) or streaming +# files over an accepted protocol. +# +#db_file "~/.mpd/database" + +# These settings are the locations for the daemon log files for the daemon. +# +# The special value "syslog" makes MPD use the local syslog daemon. This +# setting defaults to logging to syslog. +# +# If you use systemd, do not configure a log_file. With systemd, MPD +# defaults to the systemd journal, which is fine. +# +#log_file "~/.mpd/log" + +# This setting sets the location of the file which stores the process ID +# for use of mpd --kill and some init scripts. This setting is disabled by +# default and the pid file will not be stored. +# +# If you use systemd, do not configure a pid_file. +# +#pid_file "~/.mpd/pid" + +# This setting sets the location of the file which contains information about +# most variables to get MPD back into the same general shape it was in before +# it was brought down. This setting is disabled by default and the server +# state will be reset on server start up. +# +#state_file "~/.mpd/state" +# +# The location of the sticker database. This is a database which +# manages dynamic information attached to songs. +# +#sticker_file "~/.mpd/sticker.sql" +# +############################################################################### + + +# General music daemon options ################################################ +# +# This setting specifies the user that MPD will run as. MPD should never run as +# root and you may use this setting to make MPD change its user ID after +# initialization. This setting is disabled by default and MPD is run as the +# current user. +# +#user "nobody" +# +# This setting specifies the group that MPD will run as. If not specified +# primary group of user specified with "user" setting will be used (if set). +# This is useful if MPD needs to be a member of group such as "audio" to +# have permission to use sound card. +# +#group "nogroup" +# +# This setting sets the address for the daemon to listen on. Careful attention +# should be paid if this is assigned to anything other than the default, any. +# This setting can deny access to control of the daemon. Not effective if +# systemd socket activation is in use. +# +# For network +#bind_to_address "any" +# +# And for Unix Socket +#bind_to_address "~/.mpd/socket" +# +# This setting is the TCP port that is desired for the daemon to get assigned +# to. +# +#port "6600" +# +# Suppress all messages below the given threshold. Use "verbose" for +# troubleshooting. Available setting arguments are "notice", "info", "verbose", +# "warning" and "error". +# +#log_level "notice" +# +# Setting "restore_paused" to "yes" puts MPD into pause mode instead +# of starting playback after startup. +# +#restore_paused "no" +# +# This setting enables MPD to create playlists in a format usable by other +# music players. +# +#save_absolute_paths_in_playlists "no" +# +# This setting defines a list of tag types that will be extracted during the +# audio file discovery process. The complete list of possible values can be +# found in the user manual. +#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc" +# +# This example just enables the "comment" tag without disabling all +# the other supported tags: +#metadata_to_use "+comment" +# +# This setting enables automatic update of MPD's database when files in +# music_directory are changed. +# +#auto_update "yes" +# +# Limit the depth of the directories being watched, 0 means only watch +# the music directory itself. There is no limit by default. +# +#auto_update_depth "3" +# +############################################################################### + + +# Symbolic link behavior ###################################################### +# +# If this setting is set to "yes", MPD will discover audio files by following +# symbolic links outside of the configured music_directory. +# +#follow_outside_symlinks "yes" +# +# If this setting is set to "yes", MPD will discover audio files by following +# symbolic links inside of the configured music_directory. +# +#follow_inside_symlinks "yes" +# +############################################################################### + + +# Zeroconf / Avahi Service Discovery ########################################## +# +# If this setting is set to "yes", service information will be published with +# Zeroconf / Avahi. +# +#zeroconf_enabled "yes" +# +# The argument to this setting will be the Zeroconf / Avahi unique name for +# this MPD server on the network. %h will be replaced with the hostname. +# +#zeroconf_name "Music Player @ %h" +# +############################################################################### + + +# Permissions ################################################################# +# +# If this setting is set, MPD will require password authorization. The password +# setting can be specified multiple times for different password profiles. +# +#password "password@read,add,control,admin" +# +# This setting specifies the permissions a user has who has not yet logged in. +# +#default_permissions "read,add,control,admin" +# +############################################################################### + + +# Database ####################################################################### +# +# An example of a database section instead of the old 'db_file' setting. +# It enables mounting other storages into the music directory. +# +#database { +# plugin "simple" +# path "~/.local/share/mpd/db +# cache_directory "~/.local/share/mpd/cache" +#} +# +# An example of database config for a satellite setup +# +#music_directory "nfs://fileserver.local/srv/mp3" +#database { +# plugin "proxy" +# host "other.mpd.host" +# port "6600" +#} + +# Input ####################################################################### +# +input { + plugin "curl" +# proxy "proxy.isp.com:8080" +# proxy_user "user" +# proxy_password "password" +} + +# +############################################################################### + +# Audio Output ################################################################ +# +# MPD supports various audio output types, as well as playing through multiple +# audio outputs at the same time, through multiple audio_output settings +# blocks. Setting this block is optional, though the server will only attempt +# autodetection for one sound card. +# +# An example of an ALSA output: +# +#audio_output { +# type "alsa" +# name "My ALSA Device" +## device "hw:0,0" # optional +## mixer_type "hardware" # optional +## mixer_device "default" # optional +## mixer_control "PCM" # optional +## mixer_index "0" # optional +#} +# +# An example of an OSS output: +# +#audio_output { +# type "oss" +# name "My OSS Device" +## device "/dev/dsp" # optional +## mixer_type "hardware" # optional +## mixer_device "/dev/mixer" # optional +## mixer_control "PCM" # optional +#} +# +# An example of a shout output (for streaming to Icecast): +# +#audio_output { +# type "shout" +# encoder "vorbis" # optional +# name "My Shout Stream" +# host "localhost" +# port "8000" +# mount "/mpd.ogg" +# password "hackme" +# quality "5.0" +# bitrate "128" +# format "44100:16:1" +## protocol "icecast2" # optional +## user "source" # optional +## description "My Stream Description" # optional +## url "http://example.com" # optional +## genre "jazz" # optional +## public "no" # optional +## timeout "2" # optional +## mixer_type "software" # optional +#} +# +# An example of a recorder output: +# +#audio_output { +# type "recorder" +# name "My recorder" +# encoder "vorbis" # optional, vorbis or lame +# path "/var/lib/mpd/recorder/mpd.ogg" +## quality "5.0" # do not define if bitrate is defined +# bitrate "128" # do not define if quality is defined +# format "44100:16:1" +#} +# +# An example of a httpd output (built-in HTTP streaming server): +# +#audio_output { +# type "httpd" +# name "My HTTP Stream" +# encoder "vorbis" # optional, vorbis or lame +# port "8000" +# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6 +## quality "5.0" # do not define if bitrate is defined +# bitrate "128" # do not define if quality is defined +# format "44100:16:1" +# max_clients "0" # optional 0=no limit +#} +# +# An example of a pulseaudio output (streaming to a remote pulseaudio server) +# +#audio_output { +# type "pulse" +# name "My Pulse Output" +## server "remote_server" # optional +## sink "remote_server_sink" # optional +## media_role "media_role" #optional +#} +# +# An example of a winmm output (Windows multimedia API). +# +#audio_output { +# type "winmm" +# name "My WinMM output" +## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional +# or +## device "0" # optional +## mixer_type "hardware" # optional +#} +# +# An example of a wasapi output (Windows multimedia API). +# +#audio_output { +# type "wasapi" +# name "My WASAPI output" +## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional +# or +## device "0" # optional +## Exclusive mode blocks all other audio source, and get best audio quality without resampling. +## exclusive "no" # optional +## Enumerate all devices in log. +## enumerate "no" # optional +#} +# +# An example of an openal output. +# +#audio_output { +# type "openal" +# name "My OpenAL output" +## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional +#} +# +# An example of an sndio output. +# +#audio_output { +# type "sndio" +# name "sndio output" +# mixer_type "hardware" +#} +# +# An example of an OS X output: +# +#audio_output { +# type "osx" +# name "My OS X Device" +## device "Built-in Output" # optional +## channel_map "-1,-1,0,1" # optional +#} +# +## Example "pipe" output: +# +#audio_output { +# type "pipe" +# name "my pipe" +# command "aplay -f cd 2>/dev/null" +## Or if you're want to use AudioCompress +# command "AudioCompress -m | aplay -f cd 2>/dev/null" +## Or to send raw PCM stream through PCM: +# command "nc example.org 8765" +# format "44100:16:2" +#} +# +## An example of a null output (for no audio output): +# +#audio_output { +# type "null" +# name "My Null Output" +# mixer_type "none" # optional +#} +# +############################################################################### + + +# Normalization automatic volume adjustments ################################## +# +# This setting specifies the type of ReplayGain to use. This setting can have +# the argument "off", "album", "track" or "auto". "auto" is a special mode that +# chooses between "track" and "album" depending on the current state of +# random playback. If random playback is enabled then "track" mode is used. +# See <https://wiki.hydrogenaud.io/index.php?title=Replaygain> for +# more details about ReplayGain. +# This setting is off by default. +# +#replaygain "album" +# +# This setting sets the pre-amp used for files that have ReplayGain tags. By +# default this setting is disabled. +# +#replaygain_preamp "0" +# +# This setting sets the pre-amp used for files that do NOT have ReplayGain tags. +# By default this setting is disabled. +# +#replaygain_missing_preamp "0" +# +# This setting enables or disables ReplayGain limiting. +# MPD calculates actual amplification based on the ReplayGain tags +# and replaygain_preamp / replaygain_missing_preamp setting. +# If replaygain_limit is enabled MPD will never amplify audio signal +# above its original level. If replaygain_limit is disabled such amplification +# might occur. By default this setting is enabled. +# +#replaygain_limit "yes" +# +# This setting enables on-the-fly normalization volume adjustment. This will +# result in the volume of all playing audio to be adjusted so the output has +# equal "loudness". This setting is disabled by default. +# +#volume_normalization "no" +# +############################################################################### + +# Character Encoding ########################################################## +# +# If file or directory names do not display correctly for your locale then you +# may need to modify this setting. +# +#filesystem_charset "UTF-8" +# +############################################################################### diff --git a/hm/soispha/conf/mpv/default.nix b/hm/soispha/conf/mpv/default.nix new file mode 100644 index 00000000..1e10f2ef --- /dev/null +++ b/hm/soispha/conf/mpv/default.nix @@ -0,0 +1,10 @@ +{ + config, + pkgs, + ... +}: { + programs.mpv = { + enable = true; + # TODO: add config + }; +} diff --git a/hm/soispha/conf/mumble/Mumble.conf b/hm/soispha/conf/mumble/Mumble.conf new file mode 100644 index 00000000..2d895f41 --- /dev/null +++ b/hm/soispha/conf/mumble/Mumble.conf @@ -0,0 +1,67 @@ +[General] +databaselocation=/home/soispha/.local/share/Mumble/Mumble/mumble.sqlite +lastupdate=3 + +[audio] +headphone=true +input=PipeWire +loudness=1549 +output=PipeWire +quality=72000 +vadmax=@Variant(\0\0\0\x87?Kw\x97) +vadmin=@Variant(\0\0\0\x87?7\x1e\xd4) + +[messages] +10\log=13 +12\log=13 +14\log=13 +15\log=13 +17\log=13 +18\log=13 +19\log=13 +2\log=13 +20\log=13 +21\log=13 +22\log=13 +23\log=13 +25\log=13 +26\log=13 +27\log=13 +28\log=13 +29\log=13 +30\log=13 +31\log=13 +5\log=13 +6\log=13 +9\log=13 +size=32 + +[messagesounds] +size=31 + +[net] +certificate="@ByteArray(0\x82\tX\x2\x1\x3\x30\x82\t\xe\x6\t*\x86H\x86\xf7\r\x1\a\x1\xa0\x82\b\xff\x4\x82\b\xfb\x30\x82\b\xf7\x30\x82\x3\xad\x6\t*\x86H\x86\xf7\r\x1\a\x1\xa0\x82\x3\x9e\x4\x82\x3\x9a\x30\x82\x3\x96\x30\x82\x3\x92\x6\v*\x86H\x86\xf7\r\x1\f\n\x1\x3\xa0\x82\x3+0\x82\x3'\x6\n*\x86H\x86\xf7\r\x1\t\x16\x1\xa0\x82\x3\x17\x4\x82\x3\x13\x30\x82\x3\xf\x30\x82\x1\xf7\xa0\x3\x2\x1\x2\x2\x1\x1\x30\r\x6\t*\x86H\x86\xf7\r\x1\x1\x5\x5\0\x30\x16\x31\x14\x30\x12\x6\x3U\x4\x3\f\vMumble User0\x1e\x17\r230710132716Z\x17\r430705132716Z0\x16\x31\x14\x30\x12\x6\x3U\x4\x3\f\vMumble User0\x82\x1\"0\r\x6\t*\x86H\x86\xf7\r\x1\x1\x1\x5\0\x3\x82\x1\xf\0\x30\x82\x1\n\x2\x82\x1\x1\0\xb3\x8c\xd2\xdbM\x90\xa6\xc7}\xf4\x6X\xf9O\x16Q\x12\xc7\x1\xca\x88\x9c\x96o\xd1\x11\xc1\xc3\xd1/\xb6\x9d\xcfn\xcd\x84\xd2\x1d\xcc\xfcO\xf9\xa4\"\xaa'2\x6\xee[\x3\xd3vx\x84`i@P|\xb8\xc5I\xa8\xa2\b\xc8\0\xbd\xf1\xcc\x63\xbe\x99Zj&\xa5t\xc5\bOr\xc1\xaen\xc7\n\xd2\xcc\xa1\x30\xb8\xe0\0\xe8\xc5\xb6\x86g\x14\x30S\x9d\x8b\xfb\xacP\x7f+\x93}3\xe3\xcbPJ\x86\xf7^Z\xda\x87Z\xfez\xec\xc0\xf7\xe9\x80\xbc\xe2\re@\xe7\x92\x84\xe5\x97\f\x8c\n\x3\x1c\xd1\xbb\x32\xce\xfe\xb6\x1d\xefUYz\xf\xd7,5\x4G\x1f\t\xf7\x43\f?wx\x1a\x12\xd4.I\xbd\xe4G\xea\x33\x9d\xb1\xb0\x62\x45\xcd\xe0\x8b\xe4\x31\x1a\x8c\xedLEyC\xf0\x9f\x32}c\xc9X\x19[\xf7\xfb\xfc\x39\xe0\xd5\x30\x87\xd0\x82:\xb5\x87j]\x9d\xf8\x1b\x4\xb2P \x5/\xb2H\xfa\x42I\x1dN\xa9\xb7\x9a\x91*\x83\xe\x45\xcf\xbe\t\xb5\x36)\xf7\x7f\x1\x43\x2\x3\x1\0\x1\xa3h0f0\f\x6\x3U\x1d\x13\x1\x1\xff\x4\x2\x30\0\x30\x13\x6\x3U\x1d%\x4\f0\n\x6\b+\x6\x1\x5\x5\a\x3\x2\x30\x1d\x6\x3U\x1d\xe\x4\x16\x4\x14\xb9\x41\x19t\x16\x18~\xe8\v\xa9\x9b\x86i\x86\xeP%\xd7\n\xc9\x30\"\x6\t`\x86H\x1\x86\xf8\x42\x1\r\x4\x15\x16\x13Generated by Mumble0\r\x6\t*\x86H\x86\xf7\r\x1\x1\x5\x5\0\x3\x82\x1\x1\0\x91+\r'hS\xc2\x12k\x13O\xb2\"\x85\xd6w\x96\x8a\x97\x46\xee\x95Q\x8b\x8b\t\x8a\xfcH\xab\x30\x1dxV\xc9\xf5\x80\x42;'o\xf1\xd1\xf2\xfb\x18\xe2+\x8d\x39 \xc3\xe\x44\xa9\t\xe2i\x8a\xa7?#\xcd]0\xf4\x1d\x4\a\xd6\x87\x62\xe2\xd8\x34\xb6\xcf\x89\xf2\v\xf1\x8b\xc6\xf8\x8f\x94H/\xfa`\x9d\xb5\xac\x66H\xef\xf4\tJ\xfeHg]!\xed\n\xaf\xa8nd@y\xe8>A\x10\xc4>\xc3\xf7\xe3\xffW\x90T\x87\x94[\x7fg0+p\xdd\x3\x8d\xdb\x80\f?\xe9\xf9l5\xac)z+4R\xbc\xf3\xe1\x82\xde\xc3u\xb2\xa1s\xe2\xbb\xdcp<I\xff\x9d\xc6\xa7\xfe\xda{\xe7\xee\xe4\xeb\xc2\xfc\x9d\x1d\x41T\xee\x91\xbe\x9f\x87\x1\x62\xf8\xc3\xa5+\xc8h\xe2\xedz\xd7\x37\xb8\xbb\xf2\x1b%\xef\xfd\xa5\x36\x35Y\xfb\xf9\xa8\x6|\x8ep\xb5\x64\x14L+\f\xad\a5\x5\xf6\xe9\xcb\xf1\xac\x96\xe0lZ^PP0\xc6\xb2\n\xd6ny\xcc\x9aZ\xb1\xc9\x35\x10\x10\x31T0#\x6\t*\x86H\x86\xf7\r\x1\t\x15\x31\x16\x4\x14\x9f\xdc\xf9\x38\xc2\x8a\x1c\xfe\x6}\xf6\x64\x62>L#|\f\x7f\x93\x30-\x6\t*\x86H\x86\xf7\r\x1\t\x14\x31 \x1e\x1e\0M\0u\0m\0\x62\0l\0\x65\0 \0I\0\x64\0\x65\0n\0t\0i\0t\0y0\x82\x5\x42\x6\t*\x86H\x86\xf7\r\x1\a\x1\xa0\x82\x5\x33\x4\x82\x5/0\x82\x5+0\x82\x5'\x6\v*\x86H\x86\xf7\r\x1\f\n\x1\x1\xa0\x82\x4\xc0\x30\x82\x4\xbc\x2\x1\0\x30\r\x6\t*\x86H\x86\xf7\r\x1\x1\x1\x5\0\x4\x82\x4\xa6\x30\x82\x4\xa2\x2\x1\0\x2\x82\x1\x1\0\xb3\x8c\xd2\xdbM\x90\xa6\xc7}\xf4\x6X\xf9O\x16Q\x12\xc7\x1\xca\x88\x9c\x96o\xd1\x11\xc1\xc3\xd1/\xb6\x9d\xcfn\xcd\x84\xd2\x1d\xcc\xfcO\xf9\xa4\"\xaa'2\x6\xee[\x3\xd3vx\x84`i@P|\xb8\xc5I\xa8\xa2\b\xc8\0\xbd\xf1\xcc\x63\xbe\x99Zj&\xa5t\xc5\bOr\xc1\xaen\xc7\n\xd2\xcc\xa1\x30\xb8\xe0\0\xe8\xc5\xb6\x86g\x14\x30S\x9d\x8b\xfb\xacP\x7f+\x93}3\xe3\xcbPJ\x86\xf7^Z\xda\x87Z\xfez\xec\xc0\xf7\xe9\x80\xbc\xe2\re@\xe7\x92\x84\xe5\x97\f\x8c\n\x3\x1c\xd1\xbb\x32\xce\xfe\xb6\x1d\xefUYz\xf\xd7,5\x4G\x1f\t\xf7\x43\f?wx\x1a\x12\xd4.I\xbd\xe4G\xea\x33\x9d\xb1\xb0\x62\x45\xcd\xe0\x8b\xe4\x31\x1a\x8c\xedLEyC\xf0\x9f\x32}c\xc9X\x19[\xf7\xfb\xfc\x39\xe0\xd5\x30\x87\xd0\x82:\xb5\x87j]\x9d\xf8\x1b\x4\xb2P \x5/\xb2H\xfa\x42I\x1dN\xa9\xb7\x9a\x91*\x83\xe\x45\xcf\xbe\t\xb5\x36)\xf7\x7f\x1\x43\x2\x3\x1\0\x1\x2\x82\x1\0\x4\xd6\xf2\x66\v\xe0\xae\xc6(\xccw\x91Ub\xfe\xd8\x7f\x97\x92\xa2Imc\x16\xaf}y\x8a\x14,\xe3\x90\xbc\x63!\xb2\aQ\xdbQ\x1f\xbc\xbc\x62\\\xd0\xc2\xa5\xf2-\xcc\xdc\x19\xd0\xe4\xcc\x8ey\xb7\xd1\xac\xcfP\x8du\x94\xa4\x3u\x1b;\xe5\xa2\x61\x12\xd1R\xaaZ\v\xe7\x8d\xf0\xabl\xce\xba\x99\xbd\x95\xdbpkCJr\xfb\xc5P9\x1e\xf\xb1iI9&\xeb\x62\x8a#\xa7\x17\xcbw\x92\xf9\xf7JZ\xa6;F\xb3\xba\xb1H\x89]uU7\x1e\xd7\xf6U`\x8d\xa1\x1aG7\x11\x31\xbf\xf4\xdb\x32\x63\xbf\x3\xad&h\x82\x9b\xe7\x19/\xf6\r\x8c\x89\xc6\xd0\x1d\0\x87\t|\xc0\xf2\x8f\xbb\x87_8{\xf2\xc7\x8a\x34)\xe3\xf1\xcc(\xf4\xee\xeb($\x5\x84\xaf\x1\xaa\xf7\xff\x9b\x15h\x2y\xb3\x91\xba,Oq\xc9$\x81\x11Zg\xc4I3\v\xeay\f\xf0\x33\xc6p\xea\xc6\x9d\xac\xaa\xedp\xa7!\xcbHf5\xa0i\xbdo@\xb8![\x7f\xea\xad\x6\x31p\x81\x61\x2\x81\x81\0\xdc\x8d}{\xc3\x31\xb6(F\xc5\x36\x9b\xba\x66\xb1\xce\r_\x90\xc6\x1f\x87\x37\x84m\xd1\a8\xc0\v9\xe0\x8bm\xaf\x64\xbe\x81\xa8\xe7\xaf\x19\x43,vj\xaf!9rz\x87\"\xca\xbf\xcf\x16\x88\x46t\xbd\x12\xaa;\xf4x_\x1b\xb3\x90\b\xb6\xf6\xec\x1f\x95\x62\xac\xfa\x1b\xae\xa2\xa7oA\x9bhOW\xa8\x44\\\xadz T\xe3\x43\x46\x99\x98\xb4{*\"\xdb\xd9\xc8\xd2\x15\n4\"\x8d\x96$\x17\xfd^\xf7\x84\x93\x7fw{o\0\xe1\x2\x81\x81\0\xd0hNA\xc3\x9e\x93&iq\x1dQ\xb6\xc6\x1c\x32\xf3\xfc c&Y\xe7|\xbeq2P\xe1\xdb\x97\xf8\x9fI(\x98\x9d\xf1\xfe\xb6\xf\x90\xa5\xebi>\x14\x6\xd8.\xf4\xce\x86\x9d*\x87 \xf9X\x4\xdcZ\xf9g\x3\x98H{\xdf\x66\xde\xd6zr\xecG_\x14t\x1dm%P\xe5\xea\x8e\x6\xa2. \xa1\xd7\xd7W]\xdd\x15\x6\xcf+/\x11\vel\xd3\xe8\xc3/\xbc\x1f\xc3n\xd4\xb8\x62j\xf5\xc0\xc0\x89\xe3z\xb8\x36\xd5\xb2\xa3\x2\x81\x80z`W\xdc\x30\x36\x89(W\xfc]\x8c\x93% K\x80\xc8\"\0\x8c\xc5\xee\\ \xc2\xf7\n\xda$`|\xe3`}\r\x9dW<m1\x8f\x6\xe2\xc8\xe1\xf1\x42\xb2)\x7f+4v\xe3n\xf8\xc5\xac\xb2\x61\xa6\xd5\xa6\x66\xc3\xd3\xa1\xff\x44PQ\x95\x38\xf7]`_2w\xe1\xb2\x86\xcd\b\xce>V\xa8\0\xc9\xcd\xd2\xc4\f\xe4\x8d%k+\x16\xbc.\n\xf7\x44\x9d\xd6\xfc\x1a\x88\x8a\xdd\x11J\xd9\xc4%\xe6g\xd8\xbc.\xe2\x11/J\x81\x2\x81\x80\x63;W\xf\xbf:1,\x98\x6\x31\x4\xa8wz\x13\xd4\xd2\x97\x5>\xcc\x8e\tz\x90\x61y\xdb\xa0\xf8\xa2|\r\x94\x93\xde\x98\xcc\x44\x19\xf3\x30\xdd\x7fu\xfc\x89)\xc4i\xf2\x30l\x83\x44\x66\x31\xf3t\x15\f\b6\xc1\xa2o\xd8\xf3\x8d\x82\xcb\x32\xf0\xa7\x8ap>G\xef~\xf9\xc6\xa4\x42\xe3\xafJ\xe7\x95\xc8\x1a\x2\xc1\xe9\xc2\x8b\xf1{\x11?\xce\xe8\xd3\x39WI<.\xedo^Y\xd6U\x99\x1e\xfe\xb6\xf1\xb6v'\a\xb1\xac\\\xeb\x2\x81\x80@\x19\xc4\x32&\xcb\xc1\xca\x10K\xdf\x45\xf9\xf\x1d\x85\x39\x65\xdc\x33\x45\xbe\xac\x97~;\xe2m-\xd6\x9b\x82\x1\xbd\x90'W\xf5\xf5\xce\x35\xd7\xb4\xcdidTiP\\-vG+`\xb5u\xb7\x14\x44\xe1\xd9\xd3\r\x81\xb0GL\xe1U\xe3\xf0\xaa\xd1\x8f\xc6\"\xa5S\xb6\xbf\x4\x1a\xc4\xe0|\x8d\xa2+y(-\xad\ty\xd5\xe2g\xd3\x8c\xcdl\x96g3\xfe\x80\xb7|b[\xca\xb2\xbf\x61\xf7\x9c\x65\x30\x61\xa0\x35\xf6W\xb4\xcc\xdd\x34\x31T0#\x6\t*\x86H\x86\xf7\r\x1\t\x15\x31\x16\x4\x14\x9f\xdc\xf9\x38\xc2\x8a\x1c\xfe\x6}\xf6\x64\x62>L#|\f\x7f\x93\x30-\x6\t*\x86H\x86\xf7\r\x1\t\x14\x31 \x1e\x1e\0M\0u\0m\0\x62\0l\0\x65\0 \0I\0\x64\0\x65\0n\0t\0i\0t\0y0A010\r\x6\t`\x86H\x1\x65\x3\x4\x2\x1\x5\0\x4 Fm\xb6/lL\x18\x1b!\xfa+x\xb5\xd9?GrR\xb7\xd3\x90\xc1N)L\x9c\xc7')\xe^\xbe\x4\b\x8b\x2\xb2\xb2\x97\b\x8a\xf6\x2\x2\b\0)" +framesperpacket=1 + +[overlay] +blacklist=@Invalid() +blacklistexclude=@Invalid() +launchers=@Invalid() +launchersexclude=@Invalid() +paths=@Invalid() +pathsexclude=@Invalid() +version=1.4.0 +whitelist=@Invalid() +whitelistexclude=@Invalid() + +[shortcuts] +size=0 + +[ui] +HighContrast=true +connect\geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\n\0\0\0\0\0\0\0\f=\0\0\x1m\0\0\n\0\0\0\0\0\0\0\f=\0\0\x1m\0\0\0\x1\x2\0\0\0\a\x80\0\0\n\0\0\0\0\0\0\0\f=\0\0\x1m)" +connect\header=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x2&\0\0\0\x3\x1\x1\0\0\0\0\0\0\x1\0\0\0\x2\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x3\0\0\x1w\0\0\0\x1\0\0\0\x1\0\0\0S\0\0\0\x1\0\0\0\x3\0\0\0\\\0\0\0\x1\0\0\0\x3\0\0\x3\xe8\0\0\0\0\x64) +geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\n\0\0\0\0\0\0\0\r\xb9\0\0\x3\xfa\0\0\n\0\0\0\0\0\0\0\f\xde\0\0\x1\xb2\0\0\0\x1\x2\0\0\0\a\x80\0\0\n\0\0\0\0\0\0\0\r\xb9\0\0\x3\xfa) +header=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x2\xb0\0\0\0\x1\x1\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x1\0\0\x2\xb0\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\0\0\0\x64) +server=mumble.vhack.eu +state=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x1\0\0\0\0\0\0\x1\0\0\0\x3\xbd\xfc\x2\0\0\0\x2\xfb\0\0\0\f\0q\0\x64\0w\0L\0o\0g\x1\0\0\0>\0\0\x3\xa0\0\0\0z\0\xff\xff\xff\xfb\0\0\0\xe\0q\0\x64\0w\0\x43\0h\0\x61\0t\x1\0\0\x3\xe2\0\0\0\x19\0\0\0\x19\0\0\0\x19\0\0\x2\xb6\0\0\x3\xbd\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x1\0\0\0\x1a\0q\0t\0I\0\x63\0o\0n\0T\0o\0o\0l\0\x62\0\x61\0r\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0) diff --git a/hm/soispha/conf/mumble/default.nix b/hm/soispha/conf/mumble/default.nix new file mode 100644 index 00000000..6fa524dc --- /dev/null +++ b/hm/soispha/conf/mumble/default.nix @@ -0,0 +1,3 @@ +{...}: { + xdg.configFile."Mumble/Mumble.conf".source = ./Mumble.conf; +} diff --git a/hm/soispha/conf/neomutt/default.nix b/hm/soispha/conf/neomutt/default.nix new file mode 100644 index 00000000..e4fbcb39 --- /dev/null +++ b/hm/soispha/conf/neomutt/default.nix @@ -0,0 +1,168 @@ +{pkgs, ...}: { + programs.neomutt = { + enable = true; + package = pkgs.writeShellScriptBin "neomutt" '' + systemctl --user start mbsync.service; + ${pkgs.neomutt}/bin/neomutt; + ''; + vimKeys = false; # see the modified ones below + checkStatsInterval = 60; + binds = [ + #------------------------------------------------------------ + # Vi Key Bindings (taken from their configuration, modified for dvorak) + #------------------------------------------------------------ + + # Moving around + { + action = "noop"; + key = "g"; + map = ["attach" "browser" "index"]; + } + { + action = "first-entry"; + key = "gg"; + map = ["attach" "browser" "index"]; + } + { + action = "last-entry"; + key = "G"; + map = ["attach" "browser" "index"]; + } + { + action = "noop"; + key = "g"; + map = ["pager"]; + } + { + action = "top"; + key = "gg"; + map = ["pager"]; + } + { + action = "bottom"; + key = "G"; + map = ["pager"]; + } + { + action = "previous-line"; + key = "n"; + map = ["pager"]; + } + { + action = "next-line"; + key = "t"; + map = ["pager"]; + } + + # Scrolling + { + action = "next-page"; + key = "\\CF"; + map = ["attach" "browser" "pager" "index"]; + } + { + action = "previous-page"; + key = "\\CB"; + map = ["attach" "browser" "pager" "index"]; + } + { + action = "half-up"; + key = "\\Cu"; + map = ["attach" "browser" "pager" "index"]; + } + { + action = "half-down"; + key = "\\Cd"; + map = ["attach" "browser" "pager" "index"]; + } + { + action = "next-line"; + key = "\\Ce"; + map = ["browser" "pager"]; + } + { + action = "previous-line"; + key = "\\Cy"; + map = ["browser" "pager"]; + } + { + action = "next-line"; + key = "\\Ce"; + map = ["index"]; + } + { + action = "previous-line"; + key = "\\Cy"; + map = ["index"]; + } + + { + action = "noop"; + key = "d"; + map = ["pager" "index"]; + } + { + action = "delete-message"; + key = "dd"; + map = ["pager" "index"]; + } + + # Mail & Reply + { + # Doesn't work currently + action = "list-reply"; + key = "\\Cm"; + map = ["index"]; + } + + # Threads + { + action = "search-opposite"; + key = "N"; + map = ["browser" "pager" "index"]; + } + { + action = "delete-thread"; + key = "dT"; + map = ["pager" "index"]; + } + { + action = "delete-subthread"; + key = "dt"; + map = ["pager" "index"]; + } + { + action = "next-thread"; + key = "gt"; + map = ["pager" "index"]; + } + { + action = "previous-thread"; + key = "gT"; + map = ["pager" "index"]; + } + { + action = "collapse-thread"; + key = "za"; + map = ["index"]; + } + { + # Missing: folddisable/foldenable + action = "collapse-all"; + key = "zA"; + map = ["index"]; + } + + { + action = "search-next"; + key = "l"; + map = ["index"]; + } + { + action = "limit"; + key = "f"; + map = ["index"]; + } + ]; + }; +} diff --git a/hm/soispha/conf/nheko/default.nix b/hm/soispha/conf/nheko/default.nix new file mode 100644 index 00000000..fd147c0b --- /dev/null +++ b/hm/soispha/conf/nheko/default.nix @@ -0,0 +1,13 @@ +{ + config, + nixosConfig, + lib, + ... +}: { + config = lib.mkIf nixosConfig.soispha.secrets.enable { + xdg.configFile."nheko/nheko.conf".source = config.lib.file.mkOutOfStoreSymlink nixosConfig.age.secrets.nheko.path; + programs.nheko = { + enable = true; + }; + }; +} diff --git a/hm/soispha/conf/npm/.npmrc b/hm/soispha/conf/npm/.npmrc new file mode 100644 index 00000000..d0d846bd --- /dev/null +++ b/hm/soispha/conf/npm/.npmrc @@ -0,0 +1,6 @@ +scripts-prepend-node-path=true +node_gyp= +prefix=${XDG_DATA_HOME}/npm +cache=${XDG_CACHE_HOME}/npm +tmp=${XDG_RUNTIME_DIR}/npm +init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js diff --git a/hm/soispha/conf/npm/default.nix b/hm/soispha/conf/npm/default.nix new file mode 100644 index 00000000..7b4bb6a1 --- /dev/null +++ b/hm/soispha/conf/npm/default.nix @@ -0,0 +1,7 @@ +{ + config, + pkgs, + ... +}: { + xdg.configFile."npm/.npmrc".source = ./.npmrc; +} diff --git a/hm/soispha/conf/nvim/autocmds/default.nix b/hm/soispha/conf/nvim/autocmds/default.nix new file mode 100644 index 00000000..cb0311fb --- /dev/null +++ b/hm/soispha/conf/nvim/autocmds/default.nix @@ -0,0 +1,99 @@ +{config, ...}: { + programs.nixvim = { + autoGroups = { + cursor_off = {clear = true;}; + colorcolumn_toggle = {clear = true;}; + numbertoggle = {clear = true;}; + coloroverride = {clear = true;}; + highlight_on_yank = {clear = true;}; + }; + autoCmd = [ + { + event = ["TextYankPost"]; + pattern = ["*"]; + callback = { + __raw = '' + function() + vim.highlight.on_yank() + end + ''; + }; + group = "highlight_on_yank"; + description = "Highlight the yanked text"; + } + { + event = ["BufWritePre"]; + pattern = ["*"]; + command = '' + ks | if search("\\s\\+$", 'n') != 0 | :%s/\s\+$// | endif | 's + ''; + description = '' + Remove trailing whitespace on safe + :%s/\s\+$\| \+\ze\t//g >> For trailing spaces and spaces before tabstops + ''; + } + + { + event = ["WinLeave"]; + pattern = ["*"]; + command = "set nocursorline"; # TODO: possible also nocursorcolumn + group = "cursor_off"; + description = "Display cursorline and cursorcolumn ONLY in active window."; + } + { + event = ["WinEnter"]; + pattern = ["*"]; + command = "set cursorline"; # TODO: possible also cursorcolumn + group = "cursor_off"; + description = "Display cursorline and cursorcolumn ONLY in active window."; + } + + { + event = ["InsertEnter"]; + pattern = ["*"]; + command = "set colorcolumn=${config.programs.nixvim.options.colorcolumn}"; + group = "colorcolumn_toggle"; + description = "Only activate the colorcolumn when focused"; + } + { + event = ["BufLeave" "FocusLost" "InsertLeave" "WinLeave"]; + pattern = ["*"]; + command = "set colorcolumn=0"; + group = "colorcolumn_toggle"; + description = "Only activate the colorcolumn when focused"; + } + + { + event = ["BufEnter" "FocusGained" "InsertLeave" "WinEnter"]; + pattern = ["*"]; + command = "if &nu && mode() != \"i\" | set rnu | endif"; + group = "numbertoggle"; + description = "Change line numbers, when not focused"; + } + { + event = ["BufLeave" "FocusLost" "InsertEnter" "WinLeave"]; + pattern = ["*"]; + command = "if &nu | set nornu | endif"; + group = "numbertoggle"; + description = "Change line numbers, when not focused"; + } + + { + # Override LineNr + event = ["ColorScheme"]; + pattern = ["*"]; + command = "highlight LineNr ctermfg=DarkGrey guifg=DarkGrey "; + group = "coloroverride"; + description = "Changes Line number colors"; + } + { + # Override CursorLineNr + event = ["ColorScheme"]; + pattern = ["*"]; + command = "highlight CursorLineNr ctermfg=White guifg=White "; + group = "coloroverride"; + description = "Changes Line number colors"; + } + ]; + }; +} diff --git a/hm/soispha/conf/nvim/clipboard/default.nix b/hm/soispha/conf/nvim/clipboard/default.nix new file mode 100644 index 00000000..0a686190 --- /dev/null +++ b/hm/soispha/conf/nvim/clipboard/default.nix @@ -0,0 +1,7 @@ +{...}: { + programs.nixvim = { + clipboard.providers = { + wl-copy.enable = true; + }; + }; +} diff --git a/hm/soispha/conf/nvim/default.nix b/hm/soispha/conf/nvim/default.nix new file mode 100644 index 00000000..61467618 --- /dev/null +++ b/hm/soispha/conf/nvim/default.nix @@ -0,0 +1,48 @@ +{ + pkgs, + lib, + ... +}: { + imports = [ + ./autocmds + ./clipboard + ./files + ./mappings + ./options + ./plugins + ]; + programs.nixvim = { + enable = true; + + # source: https://www.patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Neovim + extraConfigLuaPre = lib.mkBefore '' + --------------------------------------------------------------------------- + -- + -- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ + -- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ + -- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ + -- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ + -- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ + -- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + -- + --------------------------------------------------------------------------- + ''; + + extraPackages = with pkgs; [ + /* + These are mostly linters and formatters used for different file types. + Including them here is fine, as they are not necessarily sync able to different people. + */ + # nix + alejandra + statix + + # yaml + yamllint + + # shell + shellcheck + shfmt + ]; + }; +} diff --git a/hm/soispha/conf/nvim/files/default.nix b/hm/soispha/conf/nvim/files/default.nix new file mode 100644 index 00000000..5045eb9f --- /dev/null +++ b/hm/soispha/conf/nvim/files/default.nix @@ -0,0 +1,17 @@ +{ + lib, + pkgs, + ... +}: { + programs.nixvim = { + extraPlugins = [ + pkgs.vimExtraPlugins.gruvbox + ]; + extraFiles = { + path = "ftplugin/tex.lua"; + content = '' + ${lib.strings.fileContents ./ftplugin/tex.lua} + ''; + }; + }; +} diff --git a/hm/soispha/conf/nvim/files/ftplugin/tex.lua b/hm/soispha/conf/nvim/files/ftplugin/tex.lua new file mode 100644 index 00000000..8f39d7bb --- /dev/null +++ b/hm/soispha/conf/nvim/files/ftplugin/tex.lua @@ -0,0 +1,78 @@ +-- local used = false; +-- vim.keymap.set('n', '<leader>t', function() +-- used = not used; +-- if used then +-- require('nvim-treesitter.configs').setup { +-- highlight = { +-- additional_vim_regex_highlighting = { "latex", "markdown" }, +-- }, +-- } +-- else +-- require('nvim-treesitter.configs').setup { +-- highlight = { +-- additional_vim_regex_highlighting = { "" }, +-- }, +-- } +-- end +-- end +-- ); +-- +-- +-- Set non-treesitter colorscheme +require("gruvbox").setup({ + undercurl = true; + underline = true; + bold = true; + italic = { strings = true; comments = true; operators = false; folds = true; }; + strikethrough = true; + invert_selection = false; + invert_signs = false; + invert_tabline = false; + invert_intend_guides = false; + inverse = true; -- invert background for search, diffs, statuslines and errors + contrast = ""; -- can be "hard", "soft" or empty string + palette_overrides = {}; + overrides = {}; + dim_inactive = false; + transparent_mode = false; +}) +vim.cmd("colorscheme gruvbox") + +require("lualine").setup({ options = { theme = "gruvbox"; }; }) + +-- Set tex specific telescope extension +require("telescope").setup({ + extensions = { + bibtex = { + -- Depth for the *.bib file + depth = 1; + -- Path to global bibliographies (placed outside of the project) + global_files = {}; + -- Define the search keys to use in the picker + search_keys = { "author"; "year"; "title"; }; + -- Template for the formatted citation + citation_format = "{{author}} ({{year}}), {{title}}."; + -- Only use initials for the authors first name + citation_trim_firstname = true; + -- Max number of authors to write in the formatted citation + -- following authors will be replaced by "et al." + citation_max_auth = 2; + -- Wrapping in the preview window is disabled by default + wrap = false; + -- Custom format for citation label + custom_formats = { + { id = "tex_autocite"; cite_marker = "\\autocite{%s}"; }; + }; + format = "tex_autocite"; + -- Use context awareness + context = true; + -- Fallback to global/directory .bib files if context not found + -- This setting has no effect if context = false + context_fallback = true; + }; + }; +}) +require("telescope").load_extension("bibtex") +vim.api.nvim_set_keymap("n", "<leader>ib", function() + require("telescope").extensions.bibtex.bibtex() + end, { noremap = true; silent = true; desc = "list bibtex entries in telescope"; }) diff --git a/hm/soispha/conf/nvim/mappings/default.nix b/hm/soispha/conf/nvim/mappings/default.nix new file mode 100644 index 00000000..1d00b0a4 --- /dev/null +++ b/hm/soispha/conf/nvim/mappings/default.nix @@ -0,0 +1,222 @@ +{lib, ...}: { + programs.nixvim = { + globals = { + mapleader = " "; + maplocalleader = " "; + }; + maps = let + normal_and_insert = { + "<Esc>" = { + action = "<cmd>noh<CR><Esc>"; + desc = "Disable the search highlighting and send Escape"; + }; + }; + in { + insert = + lib.recursiveUpdate { + "hh" = { + action = '' + function() + local cmp = require('cmp'); + local luasnip = require('luasnip'); + + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end + ''; + lua = true; + desc = "completion trigger/ forward in completen menu"; + }; + "cc" = { + action = '' + function() + local cmp = require('cmp'); + cmp.confirm() + end + ''; + lua = true; + desc = "confirm the selected item"; + }; + } + normal_and_insert; + normalVisualOp = { + # yank/ cut to the system clipboard + "<leader>y" = { + action = "\"+y"; + desc = "yank to the system clipboard"; + }; + "<leader>Y" = { + action = "\"+Y"; + desc = "yank until the end of the line to the system clipboard"; + }; + + # Unmap some old keys + #"s" = "'<Nop>'"; + #"t" = "'<Nop>'"; + "<Up>" = "<Nop>"; + "<Down>" = "<Nop>"; + "<Left>" = "<Nop>"; + "<Right>" = "<Nop>"; + + # Center the cursor vertically when moving to the next word during a search. + "l" = { + action = "nzzzv"; + desc = "Center the cursor vertically when moving to the next word during a + search."; + }; + "L" = { + action = "Nzzzv"; + desc = "Center the cursor vertically when moving to the next word during a + search."; + }; + # remap the other keys to dvorak + "k" = { + action = "t"; + desc = "go the the right on char"; + }; + "K" = { + action = "T"; + desc = "go to the left on char"; + }; + "j" = { + action = "k"; + desc = "go to the right before the char"; + }; + "J" = { + action = "K"; + desc = "go to the left before the char"; + }; + + # Change Vim-keys + "h" = { + action = "<left>"; + desc = "go left"; + }; + "t" = { + action = "g<down>"; + desc = "go down, with displaylines"; + }; + "n" = { + action = "g<up>"; + desc = "go up, with displaylines"; + }; + "s" = { + action = "<right>"; + desc = "go right"; + }; + + # Move display lines + "0" = { + action = "g0"; + desc = "go to the leftmost character in the screen line"; + }; + "$" = { + action = "g$"; + desc = "go to the rightmost character in the screen line"; + }; + }; + normal = + lib.recursiveUpdate { + "<Tab>" = { + action = ":"; + desc = "jump to command line"; + }; + + "\\f" = { + action = "function() require('lf').start() end"; + lua = true; + desc = "open lf in a floating window"; + }; + + # Splits + "<C-t>" = { + action = "<C-w>p"; + desc = "go to previous split"; + }; + "<C-n>" = { + action = "<C-w>w"; + desc = "go to next split"; + }; + "<leader>-" = { + action = "<C-W>s"; + desc = "New horizontal split"; + }; + "<leader>|" = { + action = "<C-W>v"; + desc = "New vertical split"; + }; + + # Exit insert mode after creating a new line above or below the current line."; + "o" = { + action = "o<Esc>"; + desc = "add new line below"; + }; + "O" = { + action = "O<Esc>"; + desc = "add new line above"; + }; + + "<leader>p" = { + action = "\"_dP"; + desc = "keep the cut thing in the base register"; + }; + + "<leader>d" = { + action = "\"_d"; + desc = "delete without saving to register"; + }; + "dd" = { + action = '' + function() + if vim.api.nvim_get_current_line():match("^%s*$") then + return '"_dd' + else + return "dd" + end + end + ''; + lua = true; + desc = "Pipe all blank line deletions to the blackhole register"; + expr = true; + silent = true; + }; + + "<leader>s" = { + action = ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>"; + desc = "replace for the word under the cursor"; + }; + + "<C-s>" = { + action = "<cmd>mksession! <CR>"; + desc = "overwrite/create a session"; + }; + + "<leader>X" = { + action = "!!$SHELL <CR>"; + desc = "Read the current line and execute that line in your $SHELL. The resulting output will replace the curent line that was being executed."; + }; + } + normal_and_insert; + terminal = { + "<Esc><Esc>" = { + action = "<C-\\><C-n>"; + desc = "Exit terminal mode with <Esc><Esc>"; + }; + }; + visual = { + # move selected lines in visual mode + "T" = { + action = ":m '>+1<CR>gv=gv"; + desc = "move selected lines in visual mode down"; + }; + "N" = { + action = ":m '<-2<CR>gv=gv"; + desc = "move selected lines in visual mode up"; + }; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/options/default.nix b/hm/soispha/conf/nvim/options/default.nix new file mode 100644 index 00000000..879a5cd1 --- /dev/null +++ b/hm/soispha/conf/nvim/options/default.nix @@ -0,0 +1,105 @@ +{nixosConfig, ...}: { + programs.nixvim.options = { + autoindent = true; # copy indent from previous line + cindent = true; # use c like indenting rules + breakindent = true; # continue indent visually + showbreak = "↳ "; # downwards arrow with tip rightwards(U+21B3, UTF-8: E2 86 B3) + breakindentopt = { + shift = 2; # wrapped line's beginning will be shifted by the given number of + }; + + incsearch = true; # show search results while typing + inccommand = "split"; # line preview of :s results + ignorecase = true; # ignore case when searching + smartcase = true; # if a capital letter is used in search, overwrite ignorecase + showmatch = true; # show matching words during a search. + hlsearch = true; # highlight when searching + + confirm = true; # confirm to save changes before closing modified buffer + colorcolumn = "+1"; # show a +1 before the 'textwidth' + completeopt = ["menuone" "noselect"]; # have a better completion experience + + # https://www.compart.com/en/unicode/U+XXXX (unicode character code) + # stylua: ignore + fillchars = { + fold = "·"; # MIDDLE DOT (U+00B7, UTF-8: C2 B7) + horiz = "━"; # BOX DRAWINGS HEAVY HORIZONTAL (U+2501, UTF-8: E2 94 81) + horizdown = "┳"; # BOX DRAWINGS HEAVY DOWN AND HORIZONTAL (U+2533, UTF-8: E2 94 B3) + horizup = "┻"; # BOX DRAWINGS HEAVY UP AND HORIZONTAL (U+253B, UTF-8: E2 94 BB) + vert = "┃"; # BOX DRAWINGS HEAVY VERTICAL (U+2503, UTF-8: E2 94 83) + vertleft = "┫"; # BOX DRAWINGS HEAVY VERTICAL AND LEFT (U+252B, UTF-8: E2 94 AB) + vertright = "┣"; # BOX DRAWINGS HEAVY VERTICAL AND RIGHT (U+2523, UTF-8: E2 94 A3) + verthoriz = "╋"; # BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL (U+254B, UTF-8: E2 95 8B) + }; + listchars = builtins.concatStringsSep "," [ + "nbsp:⦸" # CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8) + "tab:▷┅" # WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + "extends:»" # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB) + "precedes:«" # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB) + "trail:•" # BULLET (U+2022, UTF-8: E2 80 A2) + ]; + + # shell-like autocomplete to unambiguous portions + wildmode = builtins.concatStringsSep "," [ + "longest" + "list" + "full" + ]; + + grepformat = "%f:%l:%c:%m"; # the default format for rg in vimgrep mode + grepprg = "rg --vimgrep"; # use rg as grep implementation in `:grep` + + hidden = true; # allows you to hide buffers with unsaved changes without being prompted + + laststatus = 3; # use global statusline # TODO: + + list = true; # show whitespace + + mouse = ""; # disables the mouse + + number = true; # line numbers + relativenumber = true; # relative line numbers + + # vim.opt.shada:append {'%'}; -- store buffers in the shada file and reopen them if nvim has been started without file name argument + + shell = nixosConfig.users.users.soispha.shell.pname; # try to use default shell for the default user as a shell for ":!" + + spell = true; # activate spell checking + spelllang = "en_us,de_de"; # set spell languages + spelloptions = "camel"; # CamelCase check if both camel and case are correct words + + syntax = "ON"; # use syntax highlighting and let nvim figure out which + + shiftwidth = 0; # use tabstop setting as shiftwidth + tabstop = 4; # use 4 spaces in place of a tab + expandtab = true; # expand tabs to spaces + + showtabline = 2; # always show the tabline + + timeoutlen = 500; # wait 500 msec for the next char in an input sequence + ttyfast = true; # let vim know that I am using a fast term + + undofile = true; # use a undofile, to save the undos + undolevels = 10000; # keep nearly all undo things stored + + virtualedit = "block"; # allow the cursor to move beyond actual character in visual block mode + + textwidth = 120; # automatically hard wrap at 120 columns by default + + foldmethod = "marker"; # use markers to specify folds + + termguicolors = true; + cursorline = true; + # vim.opt.cursorcolumn = true; + + scrolloff = 999; # try to keep at least 999 lines above and below the cursor (this effectively keeps the screen centered) + + linebreak = true; # break to long lines, but do only break them at [[::space::]] + + showcmd = true; # show partial command, being typed + showmode = true; # show the mode (Visual, Insert, Command) + + wildmenu = true; # shell completion + wildignore = "*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx"; # ignore binary files + }; +} diff --git a/hm/soispha/conf/nvim/plugins/colorscheme/default.nix b/hm/soispha/conf/nvim/plugins/colorscheme/default.nix new file mode 100644 index 00000000..21069752 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/colorscheme/default.nix @@ -0,0 +1,17 @@ +{ + pkgs, + lib, + ... +}: { + programs.nixvim = { + # TODO: package nightfox though a module + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/nightfox.lua} + ${lib.strings.fileContents ./lua/mk_todos_readable.lua} + ''; + colorscheme = "duskfox"; + extraPlugins = [ + pkgs.vimExtraPlugins.nightfox-nvim + ]; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/colorscheme/lua/mk_todos_readable.lua b/hm/soispha/conf/nvim/plugins/colorscheme/lua/mk_todos_readable.lua new file mode 100644 index 00000000..0145ec19 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/colorscheme/lua/mk_todos_readable.lua @@ -0,0 +1,5 @@ +local opts = { bg = "NONE"; fg = "fg"; } +vim.api.nvim_set_hl(0, "@text.danger", opts) +vim.api.nvim_set_hl(0, "@text.note", opts) +vim.api.nvim_set_hl(0, "@text.todo", opts) +vim.api.nvim_set_hl(0, "@text.warning", opts) diff --git a/hm/soispha/conf/nvim/plugins/colorscheme/lua/nightfox.lua b/hm/soispha/conf/nvim/plugins/colorscheme/lua/nightfox.lua new file mode 100644 index 00000000..025eb133 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/colorscheme/lua/nightfox.lua @@ -0,0 +1,44 @@ +require("nightfox").setup({ + options = { + -- Compiled file's destination location + compile_path = vim.fn.stdpath("cache") .. "/nightfox"; + compile_file_suffix = "_compiled"; -- Compiled file suffix + transparent = true; -- Disable setting background + terminal_colors = true; -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + dim_inactive = true; -- Non focused panes set to alternative background + module_default = true; -- Default enable value for modules + colorblind = { + enable = true; -- Enable colorblind support + simulate_only = false; -- Only show simulated colorblind colors and not diff shifted + severity = { + protan = 0.3; -- Severity [0,1] for protan (red) + deutan = 0.9; -- Severity [0,1] for deutan (green) + tritan = 0; -- Severity [0,1] for tritan (blue) + }; + }; + styles = { -- Style to be applied to different syntax groups + comments = "italic"; -- Value is any valid attr-list value `:help attr-list` + conditionals = "NONE"; + constants = "NONE"; + functions = "bold"; + keywords = "bold"; + numbers = "NONE"; + operators = "NONE"; + strings = "NONE"; + types = "NONE"; + variables = "NONE"; + }; + inverse = { -- Inverse highlight for different types + match_paren = false; + visual = false; + search = false; + }; + modules = { -- List of various plugins and additional options + diagnostic = { enable = true; background = false; }; + native_lsp = { enable = true; background = false; }; + }; + }; + palettes = {}; + specs = {}; + groups = {}; +}) diff --git a/hm/soispha/conf/nvim/plugins/default.nix b/hm/soispha/conf/nvim/plugins/default.nix new file mode 100644 index 00000000..796ae3f2 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/default.nix @@ -0,0 +1,23 @@ +{...}: { + imports = [ + #./lsp-progress-nvim + ./colorscheme + ./femaco + ./goto-preview + ./harpoon + ./leap + ./lf-nvim + ./lsp + ./lspkind + ./lualine + ./luasnip + ./nvim-cmp + ./nvim-lint + ./raw_plugins + ./telescope + ./todo-comments + ./treesitter + ./vim-tex + ./which-key + ]; +} diff --git a/hm/soispha/conf/nvim/plugins/femaco/default.nix b/hm/soispha/conf/nvim/plugins/femaco/default.nix new file mode 100644 index 00000000..6d7ec16a --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/femaco/default.nix @@ -0,0 +1,24 @@ +{ + pkgs, + lib, + ... +}: { + programs.nixvim = { + # TODO: package femaco though a module + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/femaco.lua} + ''; + extraPlugins = [ + pkgs.vimPlugins.nvim-FeMaco-lua + ]; + maps = { + normal = { + "<leader>cc" = { + action = "require('femaco.edit').edit_code_block()"; + lua = true; + desc = "edit a [c]ode blo[c]k with femaco"; + }; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/femaco/lua/femaco.lua b/hm/soispha/conf/nvim/plugins/femaco/lua/femaco.lua new file mode 100644 index 00000000..12171793 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/femaco/lua/femaco.lua @@ -0,0 +1,49 @@ +require("femaco").setup({ + -- should prepare a new buffer and return the winid + -- by default opens a floating window + -- provide a different callback to change this behaviour + -- @param opts: the return value from float_opts + prepare_buffer = function(opts) + local buf = vim.api.nvim_create_buf(false, false) + return vim.api.nvim_open_win(buf, true, opts) + end; + -- should return options passed to nvim_open_win + -- @param code_block: data about the code-block with the keys + -- * range + -- * lines + -- * lang + float_opts = function(code_block) + return { + relative = "cursor"; + width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10); -- TODO: how to offset sign column etc? + height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6); + anchor = "NW"; + row = 0; + col = 0; + style = "minimal"; + border = "rounded"; + zindex = 1; + } + end; + -- return filetype to use for a given lang + -- lang can be nil + ft_from_lang = function(lang) + return lang + end; + -- what to do after opening the float + post_open_float = function(winnr) + vim.wo.signcolumn = "no" + end; + -- create the path to a temporary file + create_tmp_filepath = function(filetype) + return os.tmpname() + end; + -- if a newline should always be used, useful for multiline injections + -- which separators needs to be on separate lines such as markdown, neorg etc + -- @param base_filetype: The filetype which FeMaco is called from, not the + -- filetype of the injected language (this is the current buffer so you can + -- get it from vim.bo.filetyp). + ensure_newline = function(base_filetype) + return false + end; +}) diff --git a/hm/soispha/conf/nvim/plugins/goto-preview/default.nix b/hm/soispha/conf/nvim/plugins/goto-preview/default.nix new file mode 100644 index 00000000..740bb04c --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/goto-preview/default.nix @@ -0,0 +1,42 @@ +{ + pkgs, + lib, + ... +}: { + programs.nixvim = { + # TODO: package goto-preview though a module + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/goto-preview.lua} + ''; + extraPlugins = [ + pkgs.vimExtraPlugins.goto-preview + ]; + maps.normal = { + "<space>gd" = { + action = "require('goto-preview').goto_preview_definition"; + lua = true; + desc = "[G]oto [D]efinition"; + }; + "<space>gtd" = { + action = "require('goto-preview').goto_preview_type_definition"; + lua = true; + desc = "[G]oto the [t]ype [D]efinition"; + }; + "<space>gi" = { + action = "require('goto-preview').goto_preview_implementation"; + lua = true; + desc = "[G]oto [I]mplementations"; + }; + "<space>gr" = { + action = "require('goto-preview').goto_preview_references"; + lua = true; + desc = "[G]o to all [R]eferences of the symbol"; + }; + "\\<space>" = { + action = "require('goto-preview').close_all_win"; + lua = true; + desc = "close all preview windows"; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/goto-preview/lua/goto-preview.lua b/hm/soispha/conf/nvim/plugins/goto-preview/lua/goto-preview.lua new file mode 100644 index 00000000..cde50d3e --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/goto-preview/lua/goto-preview.lua @@ -0,0 +1,21 @@ +require("goto-preview").setup({ + width = 120; -- Width of the floating window + height = 15; -- Height of the floating window + border = { "↖"; "─"; "┐"; "│"; "┘"; "─"; "└"; "│"; }; -- Border characters of the floating window + default_mappings = false; -- Bind default mappings + debug = false; -- Print debug information + opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent. + resizing_mappings = false; -- Binds arrow keys to resizing the floating window. + post_open_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook. + post_close_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook. + references = { -- Configure the telescope UI for slowing the references cycling window. + telescope = {}; -- require("telescope.themes").get_dropdown({ hide_preview = false }) + }; + -- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality. + focus_on_open = true; -- Focus the floating window when opening it. + dismiss_on_move = false; -- Dismiss the floating window when moving the cursor. + force_close = true; -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close + bufhidden = "wipe"; -- the bufhidden option to set on the floating window. See :h bufhidden + stack_floating_preview_windows = true; -- Whether to nest floating windows + preview_window_title = { enable = true; position = "left"; }; -- Whether to set the preview window title as the filename +}) diff --git a/hm/soispha/conf/nvim/plugins/harpoon/default.nix b/hm/soispha/conf/nvim/plugins/harpoon/default.nix new file mode 100644 index 00000000..ecd1d6cb --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/harpoon/default.nix @@ -0,0 +1,95 @@ +{...}: let + numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"]; + mkNumberedCommand = { + command_template, + prefix, + number, + desc_template, + }: { + name = "${prefix}${number}"; + value = { + action = '' + function() + ${command_template number} + end + ''; + lua = true; + desc = "${desc_template number}"; + }; + }; + mkGotoTerminalCommand = number: let + desc_template = number: "Goto terminal number ${number}"; + command_template = number: ''require("harpoon.term").gotoTerminal(${number})''; + prefix = "gt"; + in + mkNumberedCommand {inherit desc_template command_template prefix number;}; + mkGotoFileCommand = number: let + desc_template = number: "Goto Buffer number ${number}"; + command_template = number: ''require("harpoon.ui").nav_file(${number})''; + prefix = "gf"; + in + mkNumberedCommand {inherit desc_template command_template prefix number;}; + + gotoTerminalMappings = builtins.listToAttrs (builtins.map mkGotoTerminalCommand numbers); + gotoFileMappings = builtins.listToAttrs (builtins.map mkGotoFileCommand numbers); +in { + programs.nixvim = { + plugins.harpoon = { + enable = true; + # menu.width = "vim.api.nvim_win_get_width(0) - 4"; # TODO: integrate that + keymaps = { + tmuxGotoTerminal = null; # TODO: + }; + }; + maps.normalVisualOp = + { + "-" = { + action = '' + function() + require("harpoon.ui").nav_next() + end + ''; + lua = true; + desc = "go to the next marked file"; + }; + "_" = { + action = '' + function() + require("harpoon.ui").nav_prev() + end + ''; + lua = true; + desc = "go to the previous marked file"; + }; + "<leader><leader>" = { + action = '' + function() + require("harpoon.mark").add_file() + end + ''; + lua = true; + desc = "add a mark to the open file in harpoon."; + }; + "gqc" = { + action = '' + function() + require("harpoon.cmd-ui").toggle_quick_menu() + end + ''; + lua = true; + desc = "toggle the harpoon command quick menu to see all commands."; + }; + "<leader>q" = { + action = '' + function() + require("harpoon.ui").toggle_quick_menu() + end + ''; + lua = true; + desc = "toggle the harpoon normal quick menu to see all marks."; + }; + } + // gotoFileMappings + // gotoTerminalMappings; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/leap/default.nix b/hm/soispha/conf/nvim/plugins/leap/default.nix new file mode 100644 index 00000000..bffdf33c --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/leap/default.nix @@ -0,0 +1,58 @@ +{...}: { + programs.nixvim = { + plugins.leap = { + enable = true; + addDefaultMappings = false; # They don't work with dvorak. + safeLabels = [ + "f" + "j" + "k" + "l" + "/" + "z" + "S" + "F" + "J" + "K" + "L" + "H" + "W" + "E" + "M" + "B" + "U" + "X" + "?" + "Z" + ]; + }; + maps = { + normalVisualOp = { + "m" = { + action = "<Plug>(leap-forward-to)"; + desc = "leap forward to"; + }; + "M" = { + action = "<Plug>(leap-backward-to)"; + desc = "leap backward to"; + }; + "gs" = { + action = "<Plug>(leap-from-window)"; + desc = "leap to enterable windows"; + }; + }; + visual = { + /* + "x" = { + action = "<Plug>(leap-forward-till)"; + desc = "leap forward till"; + }; + "X" = { + action = "<Plug>(leap-backward-till)"; + desc = "leap backward till"; + }; + */ + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lf-nvim/default.nix b/hm/soispha/conf/nvim/plugins/lf-nvim/default.nix new file mode 100644 index 00000000..c562f400 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lf-nvim/default.nix @@ -0,0 +1,18 @@ +{ + pkgs, + lib, + ... +}: { + programs.nixvim = { + # TODO: package lf-nvim though a module + # FIXME: change the nvim path, when I change the path with lf + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/lf-nvim.lua} + ''; + extraPlugins = [ + pkgs.vimExtraPlugins.lf-nvim + + pkgs.vimExtraPlugins.nvim-toggleterm-lua # required by lf-nvim + ]; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lf-nvim/lua/lf-nvim.lua b/hm/soispha/conf/nvim/plugins/lf-nvim/lua/lf-nvim.lua new file mode 100644 index 00000000..8a0cf817 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lf-nvim/lua/lf-nvim.lua @@ -0,0 +1,43 @@ +local fn = vim.fn + +-- Defaults +require("lf").setup({ + default_action = "drop"; -- default action when `Lf` opens a file + -- TODO: what do these mappings do? + default_actions = { -- default action keybindings + ["<C-t>"] = "tabedit"; + ["<C-x>"] = "split"; + ["<C-v>"] = "vsplit"; + ["<C-o>"] = "tab drop"; + }; + + winblend = 10; -- psuedotransparency level + dir = ""; -- directory where `lf` starts ('gwd' is git-working-directory, ""/nil is CWD) + direction = "float"; -- window type: float horizontal vertical + border = "rounded"; -- border kind: single double shadow curved + height = fn.float2nr(fn.round(0.75 * vim.o.lines)); -- height of the *floating* window + width = fn.float2nr(fn.round(0.75 * vim.o.columns)); -- width of the *floating* window + escape_quit = true; -- map escape to the quit command (so it doesn't go into a meta normal mode) + focus_on_open = true; -- focus the current file when opening Lf (experimental) + mappings = true; -- whether terminal buffer mapping is enabled + tmux = false; -- tmux statusline can be disabled on opening of Lf + default_file_manager = true; -- make lf default file manager + disable_netrw_warning = true; -- don't display a message when opening a directory with `default_file_manager` as true + highlights = { -- highlights passed to toggleterm + Normal = { link = "Normal"; }; + NormalFloat = { link = "Normal"; }; + FloatBorder = { guifg = "#cdcbe0"; guibg = "#191726"; }; + }; + + -- Layout configurations + layout_mapping = "<M-u>"; -- resize window with this key + views = { -- window dimensions to rotate through + { width = 0.800; height = 0.800; }; + { width = 0.600; height = 0.600; }; + { width = 0.950; height = 0.950; }; + { width = 0.500; height = 0.500; col = 0; row = 0; }; + { width = 0.500; height = 0.500; col = 0; row = 0.5; }; + { width = 0.500; height = 0.500; col = 0.5; row = 0; }; + { width = 0.500; height = 0.500; col = 0.5; row = 0.5; }; + }; +}) diff --git a/hm/soispha/conf/nvim/plugins/lsp-progress-nvim/default.nix b/hm/soispha/conf/nvim/plugins/lsp-progress-nvim/default.nix new file mode 100644 index 00000000..6602ceb6 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp-progress-nvim/default.nix @@ -0,0 +1,50 @@ +{ + lib, + pkgs, + ... +}: { + programs.nixvim = { + # TODO: package lsp-progress-nvim though a module + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/lsp-progress-nvim.lua} + ''; + extraPlugins = [ + pkgs.vimExtraPlugins.lsp-progress-nvim + ]; + + # Status line setup + autoGroups.lsp_refresh.clear = true; + autoCmd = [ + { + event = ["User LspProgressStatusUpdated"]; + pattern = ["*"]; + callback = + /* + lua + */ + { + __raw = '' + require("lualine").refresh + ''; + }; + group = "lsp_refresh"; + description = "Refresh the statusbar when the lsp status was updated."; + } + ]; + plugins.lualine = let + get_lsp_progress = { + __raw = + /* + lua + */ + '' + require('lsp-progress').progress + ''; + }; + in { + sections = { + lualine_c = [{name = get_lsp_progress;}]; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp-progress-nvim/lua/lsp-progress-nvim.lua b/hm/soispha/conf/nvim/plugins/lsp-progress-nvim/lua/lsp-progress-nvim.lua new file mode 100644 index 00000000..4273085c --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp-progress-nvim/lua/lsp-progress-nvim.lua @@ -0,0 +1,150 @@ +--- @type table<string, any> +require("lsp-progress").setup({ + -- Spinning icons. + -- + --- @type string[] + spinner = { "⣾"; "⣽"; "⣻"; "⢿"; "⡿"; "⣟"; "⣯"; "⣷"; }; + + -- Spinning update time in milliseconds. + -- + --- @type integer + spin_update_time = 200; + + -- Last message cached decay time in milliseconds. + -- + -- Message could be really fast(appear and disappear in an + -- instant) that user cannot even see it, thus we cache the last message + -- for a while for user view. + -- + --- @type integer + decay = 700; + + -- User event name. + -- + --- @type string + event = "LspProgressStatusUpdated"; + + -- Event update time limit in milliseconds. + -- + -- Sometimes progress handler could emit many events in an instant, while + -- refreshing statusline cause too heavy synchronized IO, so we limit the + -- event rate to reduce this cost. + -- + --- @type integer + event_update_time_limit = 100; + + -- Max progress string length, by default -1 is unlimited. + -- + --- @type integer + max_size = -1; + + -- Regular internal update time. + -- + -- Emit user event to update the lsp progress status, even there's no new + -- message. + -- + --- @type integer + regular_internal_update_time = 500; + + -- Disable emitting events on specific mode/filetype. + -- User events would interrupt insert mode, thus break which-key like plugins behaviour. + -- See: + -- * https://github.com/linrongbin16/lsp-progress.nvim/issues/50 + -- * https://neovim.io/doc/user/builtin.html#mode() + -- + --- @type table[] + disable_events_opts = { { mode = "i"; filetype = "TelescopePrompt"; }; }; + + -- Format series message. + -- + -- By default it looks like: `formatting isort (100%) - done`. + -- + --- @param title string|nil + --- Message title. + --- @param message string|nil + --- Message body. + --- @param percentage number|nil + --- Progress in percentage numbers: 0-100. + --- @param done boolean + --- Indicate whether this series is the last one in progress. + --- @return string|nil messages + --- The returned value will be passed to function `client_format` as + --- one of the `series_messages` array, or ignored if return nil. + series_format = function(title, message, percentage, done) + local builder = {} + local has_title = false + local has_message = false + if title and title ~= "" then + table.insert(builder, title) + has_title = true + end + if message and message ~= "" then + table.insert(builder, message) + has_message = true + end + if percentage and (has_title or has_message) then + table.insert(builder, string.format("(%.0f%%%%)", percentage)) + end + if done and (has_title or has_message) then + table.insert(builder, "- done") + end + return table.concat(builder, " ") + end; + + -- Format client message. + -- + -- By default it looks like: + -- `[null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)`. + -- + --- @param client_name string + --- Client name. + --- @param spinner string + --- Spinner icon. + --- @param series_messages string[]|table[] + --- Messages array. + --- @return string|nil messages + --- The returned value will be passed to function `format` as one of the + --- `client_messages` array, or ignored if return nil. + client_format = function(client_name, spinner, series_messages) + return #series_messages > 0 + and ("[" .. client_name .. "] " .. spinner .. " " .. table.concat(series_messages, ", ")) + or nil + end; + + -- Format (final) message. + -- + -- By default it looks like: + -- ` LSP [null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)` + -- + --- @param client_messages string[]|table[] + --- Client messages array. + --- @return nil|string message + --- The returned value will be returned from `progress` API. + format = function(client_messages) + local sign = " LSP" -- nf-fa-gear \uf013 + return #client_messages > 0 and (sign .. " " .. table.concat(client_messages, " ")) or sign + end; + + -- Enable debug. + -- + --- @type boolean + debug = false; + + -- Print log to console(command line). + -- + --- @type boolean + console_log = false; + + -- Print log to file. + -- + --- @type boolean + file_log = true; + + -- Log file to write, work with `file_log=true`. + -- + -- For Windows: `$env:USERPROFILE\AppData\Local\nvim-data\lsp-progress.log`. + -- For *NIX: `~/.local/share/nvim/lsp-progress.log`. + -- + --- @type string + file_log_name = "lsp-progress.log"; +}) diff --git a/hm/soispha/conf/nvim/plugins/lsp/default.nix b/hm/soispha/conf/nvim/plugins/lsp/default.nix new file mode 100644 index 00000000..b7c1e174 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/default.nix @@ -0,0 +1,29 @@ +{...}: { + imports = [ + ./keymaps + ./servers + ]; + programs.nixvim.plugins.lsp = { + enable = true; + onAttach = + "" + # + '' + # function(client, bufnr) + # -- Enable completion triggered by <c-x><c-o> + # -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + # end + # '' + ; + preConfig = '' + vim.diagnostic.config({ + underline = true, + -- virtual_text = true, + virtual_text = { + source = "always", -- Or "if_many" + }, + update_in_insert = true, + severity_sort = true, + }, nil); + ''; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/keymaps/default.nix b/hm/soispha/conf/nvim/plugins/lsp/keymaps/default.nix new file mode 100644 index 00000000..4017521d --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/keymaps/default.nix @@ -0,0 +1,72 @@ +{...}: { + programs.nixvim = { + plugins.lsp.keymaps = { + diagnostic = { + "N" = { + action = "goto_prev"; + desc = "go to previous diagnostic message"; + }; + "T" = { + action = "goto_next"; + desc = "go to next diagnostic message"; + }; + "<space>e" = { + action = "open_float"; + desc = "open float for the symbol"; + }; + "<space>gq" = { + action = "setloclist"; + desc = "add buffer diagnostic to the location list (quick-fix)"; + }; + }; + lspBuf = { + "<space>gD" = { + action = "declaration"; + desc = "[G]o to [d]eclaration"; + }; + "<space>hi" = { + action = "hover"; + desc = "Display [h]over [i]nformation"; + }; + "<space>sh" = { + action = "signature_help"; + desc = "Display [s]ignature [h]elp"; + }; + "<space>wa" = { + action = "add_workspace_folder"; + desc = "[W]orkspace folder [a]dd"; + }; + "<space>wr" = { + action = "remove_workspace_folder"; + desc = "[W]orkspace folder [r]emove"; + }; + "<space>rn" = { + action = "rename"; + desc = "[R]e[n]ame the item under the cursor"; + }; + "<space>ca" = { + action = "code_action"; + desc = "Open the [c]ode [a]ction menu"; + }; + }; + }; + maps = { + normal = { + "<space>f" = { + action = "function() vim.lsp.buf.format { async = true } end"; + lua = true; + desc = "[F]ormat the current buffer (asynchronously)"; + }; + "<space>wl" = { + action = '' + function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end + ''; + lua = true; + desc = "[W]orkspace folders [l]ist"; + }; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/servers/default.nix b/hm/soispha/conf/nvim/plugins/lsp/servers/default.nix new file mode 100644 index 00000000..8ffac2e1 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/servers/default.nix @@ -0,0 +1,11 @@ +{...}: { + imports = [ + ./servers/bashls.nix + ./servers/ltex.nix + ./servers/lua-ls.nix + ./servers/nil_ls.nix + ./servers/rust-analyzer.nix + ./servers/texlab.nix + ./servers/ccls.nix + ]; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/servers/servers/bashls.nix b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/bashls.nix new file mode 100644 index 00000000..0577a335 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/bashls.nix @@ -0,0 +1,5 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + bashls.enable = true; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/servers/servers/ccls.nix b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/ccls.nix new file mode 100644 index 00000000..0698bcce --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/ccls.nix @@ -0,0 +1,5 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + ccls.enable = true; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/servers/servers/ltex.nix b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/ltex.nix new file mode 100644 index 00000000..0d039f82 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/ltex.nix @@ -0,0 +1,39 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + ltex = let + filetypes = [ + "rust" + "java" + "cpp" + "shell" + "bash" + + "bibtex" + "context" + "context.tex" + "latex" + "tex" + + "html" + "markdown" + "org" + "restructuredtext" + "rsweave" + + "git-commit" + "gitcommit" + ]; + in { + enable = true; + inherit filetypes; + settings = { + enabled = filetypes; + completionEnabled = false; + language = "en-CA"; + additionalRules = { + enablePickyRules = true; + }; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/servers/servers/lua-ls.nix b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/lua-ls.nix new file mode 100644 index 00000000..5a44b500 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/lua-ls.nix @@ -0,0 +1,8 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + lua-ls = { + enable = true; + settings.telemetry.enable = false; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/servers/servers/nil_ls.nix b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/nil_ls.nix new file mode 100644 index 00000000..f0cccbdc --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/nil_ls.nix @@ -0,0 +1,10 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + nil_ls = { + enable = true; + settings = { + formatting.command = ["alejandra"]; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/servers/servers/rust-analyzer.nix b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/rust-analyzer.nix new file mode 100644 index 00000000..943a8c80 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/rust-analyzer.nix @@ -0,0 +1,10 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + rust-analyzer = { + enable = true; + settings = { + typing.autoClosingAngleBrackets.enable = true; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lsp/servers/servers/texlab.nix b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/texlab.nix new file mode 100644 index 00000000..59af8d39 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lsp/servers/servers/texlab.nix @@ -0,0 +1,7 @@ +{...}: { + programs.nixvim.plugins.lsp.servers = { + texlab = { + enable = true; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lspkind/default.nix b/hm/soispha/conf/nvim/plugins/lspkind/default.nix new file mode 100644 index 00000000..ed7d411b --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lspkind/default.nix @@ -0,0 +1,6 @@ +{...}: { + programs.nixvim.plugins.lspkind = { + enable = true; + preset = "default"; # "codicons" is only for a font patched with vscode-codeicons. + }; +} diff --git a/hm/soispha/conf/nvim/plugins/lualine/default.nix b/hm/soispha/conf/nvim/plugins/lualine/default.nix new file mode 100644 index 00000000..0b789558 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/lualine/default.nix @@ -0,0 +1,114 @@ +{...}: { + programs.nixvim.plugins.lualine = let + get_location_of_file = { + __raw = '' + function() + local file_lines = vim.fn.line('$'); + local file_current_cursor_positon = vim.fn.getcurpos(); + return file_current_cursor_positon[3] .. ":" .. file_current_cursor_positon[2] .. "/" .. file_lines + end + ''; + }; + + get_trailing_whitespace = { + __raw = '' + function() + local space = vim.fn.search([[\s\+$]], 'nwc') + return space ~= 0 and "TW:" .. space or "" + end + ''; + }; + get_mixed_indent = { + __raw = + /* + lua + */ + '' + function() + local space_pat = [[\v^ +]] + local tab_pat = [[\v^\t+]] + local space_indent = vim.fn.search(space_pat, 'nwc') + local tab_indent = vim.fn.search(tab_pat, 'nwc') + local mixed = (space_indent > 0 and tab_indent > 0) + local mixed_same_line + if not mixed then + mixed_same_line = vim.fn.search([[\v^(\t+ | +\t)]], 'nwc') + mixed = mixed_same_line > 0 + end + if not mixed then return "" end + if mixed_same_line ~= nil and mixed_same_line > 0 then + return 'MI:' .. mixed_same_line + end + local space_indent_cnt = vim.fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total + local tab_indent_cnt = vim.fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total + if space_indent_cnt > tab_indent_cnt then + return 'MI:' .. tab_indent + else + return 'MI:' .. space_indent + end + end + ''; + }; + in { + enable = true; + iconsEnabled = true; + theme = "nightfox"; + componentSeparators = { + left = ""; + right = ""; + }; + sectionSeparators = { + left = ""; + right = ""; + }; + disabledFiletypes = { + statusline = []; + winbar = []; + }; + ignoreFocus = []; + alwaysDivideMiddle = true; + globalstatus = false; + refresh = { + statusline = 1000; + tabline = 1000; + winbar = 1000; + }; + sections = { + lualine_a = ["mode"]; + lualine_b = [ + { + name = "FugitiveHead"; + icon = ""; + } + "diff" + "diagnostics" + ]; + lualine_c = ["filename"]; + lualine_x = ["searchcount" "filetype"]; + lualine_y = [ + "encoding" + "fileformat" + {name = get_mixed_indent;} + {name = get_trailing_whitespace;} + ]; + lualine_z = [{name = get_location_of_file;}]; + }; + inactiveSections = { + lualine_a = []; + lualine_b = []; + lualine_c = ["filename"]; + lualine_x = [{name = get_location_of_file;}]; + lualine_y = []; + lualine_z = []; + }; + tabline = {}; + winbar = {}; + inactiveWinbar = {}; + + # TODO: add all installed and supported extensions here + extensions = [ + "toggleterm" + #"fugitive" # TODO: maybe add this? + ]; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/luasnip/default.nix b/hm/soispha/conf/nvim/plugins/luasnip/default.nix new file mode 100644 index 00000000..50a0b94c --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/luasnip/default.nix @@ -0,0 +1,12 @@ +{lib, ...}: { + programs.nixvim = { + plugins.luasnip = { + enable = true; + }; + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/luasnip.lua} + require("luasnip.loaders.from_lua").load({paths = "${./lua/snippets}"}) + require("luasnip.loaders.from_lua").lazy_load({paths = "${./lua/snippets}"}) + ''; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/luasnip/lua/luasnip.lua b/hm/soispha/conf/nvim/plugins/luasnip/lua/luasnip.lua new file mode 100644 index 00000000..0a603692 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/luasnip/lua/luasnip.lua @@ -0,0 +1,7 @@ +require("luasnip").config.set_config({ + -- Enable auto triggered snippets + enable_autosnippets = true; + + -- Use Tab (or some other key if you prefer) to trigger visual selection + store_selection_keys = "<Tab>"; +}) diff --git a/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/all.lua b/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/all.lua new file mode 100644 index 00000000..5ce91a87 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/all.lua @@ -0,0 +1,60 @@ +local get_visual = function(args, parent) + if #parent.snippet.env.SELECT_RAW > 0 then + return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) + else + return sn(nil, i(1, "")) + end +end +local function char_count_same(c1, c2) + local line = vim.api.nvim_get_current_line() + -- '%'-escape chars to force explicit match (gsub accepts patterns). + -- second return value is number of substitutions. + local _, ct1 = string.gsub(line, "%" .. c1, "") + local _, ct2 = string.gsub(line, "%" .. c2, "") + return ct1 == ct2 +end + +local function even_count(c) + local line = vim.api.nvim_get_current_line() + local _, ct = string.gsub(line, c, "") + return ct % 2 == 0 +end + +local function neg(fn, ...) + return not fn(...) +end + +local function part(fn, ...) + local args = { ...; } + return function() + return fn(unpack(args)) + end +end + +-- This makes creation of pair-type snippets easier. +local function pair(pair_begin, pair_end, expand_func, ...) + -- triggerd by opening part of pair, wordTrig=false to trigger anywhere. + -- ... is used to pass any args following the expand_func to it. + return s( + { trig = pair_begin; wordTrig = false; snippetType = "autosnippet"; }, + { t({ pair_begin; }); d(1, get_visual); t({ pair_end; }); }, + { condition = part(expand_func, part(..., pair_begin, pair_end)); } + ) +end + +local maybe = { pair = nil; } +if vim.bo.filetype == "tex" then + maybe.pair = pair("<", ">", neg, char_count_same) +end + +local output_table = { + pair("(", ")", neg, char_count_same); + pair("{", "}", neg, char_count_same); + pair("[", "]", neg, char_count_same); + pair("'", "'", neg, even_count); + pair('"', '"', neg, even_count); + pair("`", "`", neg, even_count); +} +output_table[#output_table + 1] = maybe.pair + +return output_table diff --git a/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/html/html.lua b/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/html/html.lua new file mode 100644 index 00000000..c467dd68 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/html/html.lua @@ -0,0 +1,108 @@ +local get_visual = function(args, parent) + if #parent.snippet.env.SELECT_RAW > 0 then + return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) + else + return sn(nil, i(1)) + end +end + +local line_begin = require("luasnip.extras.expand_conditions").line_begin + +return { + -- HEADER + s( + { + trig = "h([123456])"; + regTrig = true; + wordTrig = false; + snippetType = "autosnippet"; + }, + fmt( + [[ + <h{}>{}</h{}> + ]], + { + f(function(_, snip) + return snip.captures[1] + end); + d(1, get_visual); + f(function(_, snip) + return snip.captures[1] + end); + } + ), + { condition = line_begin; } + ); -- PARAGRAPH + s( + { trig = "pp"; snippetType = "autosnippet"; }, + fmt( + [[ + <p>{}</p> + ]], + { d(1, get_visual); } + ), + { condition = line_begin; } + ); -- UNORDERED LIST + s( + { trig = "itt"; snippetType = "autosnippet"; }, + fmt( + [[ + <ul> + <li>{}</li>{} + </ul> + ]], + { i(1); i(0); } + ), + { condition = line_begin; } + ); -- LIST ITEM + s( + { trig = "ii"; snippetType = "autosnippet"; }, + fmt( + [[ + <li>{}</li> + ]], + { d(1, get_visual); } + ), + { condition = line_begin; } + ); + -- DOCUMENT TEMPLATE + s( + { trig = "base"; }, + fmt( + [[ + <!doctype HTML> + <html lang="en"> + <head> + <meta charset="UTF-8"> + <title>{}</title> + </head> + <body> + {} + </body> + </html> + ]], + { i(1, "FooBar"); i(0); } + ), + { condition = line_begin; } + ); -- ANCHOR TAG + s( + { + trig = "([^%l])aa"; + regTrig = true; + wordTrig = false; + snippetType = "autosnippet"; + }, + fmt( + [[ + {}<a href="{}">{}</a> + ]], + { + f(function(_, snip) + return snip.captures[1] + end); + i(1); + d(2, get_visual); + } + ) + ); +} diff --git a/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/tex/delimiter.lua b/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/tex/delimiter.lua new file mode 100644 index 00000000..e50898fc --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/tex/delimiter.lua @@ -0,0 +1,34 @@ +local get_visual = function(args, parent) + if #parent.snippet.env.SELECT_RAW > 0 then + return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) + else + return sn(nil, i(1, "")) + end +end + +local translation_table = { ["("] = ")"; ["{"] = "}"; ["["] = "]"; } + +-- Return snippet tables +return { + -- LEFT/RIGHT ALL BRACES + s( + { + trig = "([^%a])l([%(%[%{])"; + regTrig = true; + wordTrig = false; + snippetType = "autosnippet"; + }, + fmta("<>\\left<><>\\right<>", { + f(function(_, snip) + return snip.captures[1] + end); + f(function(_, snip) + return snip.captures[2] + end); + d(1, get_visual); + f(function(_, snip) + return translation_table[snip.captures[2]] + end); + }) + ); +} diff --git a/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/tex/greek.lua b/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/tex/greek.lua new file mode 100644 index 00000000..19989093 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/luasnip/lua/snippets/tex/greek.lua @@ -0,0 +1,37 @@ +-- Return snippet tables +return { + s({ trig = ";a"; snippetType = "autosnippet"; }, { t("\\alpha"); }); + s({ trig = ";b"; snippetType = "autosnippet"; }, { t("\\beta"); }); + s({ trig = ";g"; snippetType = "autosnippet"; }, { t("\\gamma"); }); + s({ trig = ";G"; snippetType = "autosnippet"; }, { t("\\Gamma"); }); + s({ trig = ";d"; snippetType = "autosnippet"; }, { t("\\delta"); }); + s({ trig = ";D"; snippetType = "autosnippet"; }, { t("\\Delta"); }); + s({ trig = ";e"; snippetType = "autosnippet"; }, { t("\\epsilon"); }); + s({ trig = ";ve"; snippetType = "autosnippet"; }, { t("\\varepsilon"); }); + s({ trig = ";z"; snippetType = "autosnippet"; }, { t("\\zeta"); }); + s({ trig = ";h"; snippetType = "autosnippet"; }, { t("\\eta"); }); + s({ trig = ";o"; snippetType = "autosnippet"; }, { t("\\theta"); }); + s({ trig = ";vo"; snippetType = "autosnippet"; }, { t("\\vartheta"); }); + s({ trig = ";O"; snippetType = "autosnippet"; }, { t("\\Theta"); }); + s({ trig = ";k"; snippetType = "autosnippet"; }, { t("\\kappa"); }); + s({ trig = ";l"; snippetType = "autosnippet"; }, { t("\\lambda"); }); + s({ trig = ";L"; snippetType = "autosnippet"; }, { t("\\Lambda"); }); + s({ trig = ";m"; snippetType = "autosnippet"; }, { t("\\mu"); }); + s({ trig = ";n"; snippetType = "autosnippet"; }, { t("\\nu"); }); + s({ trig = ";x"; snippetType = "autosnippet"; }, { t("\\xi"); }); + s({ trig = ";X"; snippetType = "autosnippet"; }, { t("\\Xi"); }); + s({ trig = ";i"; snippetType = "autosnippet"; }, { t("\\pi"); }); + s({ trig = ";I"; snippetType = "autosnippet"; }, { t("\\Pi"); }); + s({ trig = ";r"; snippetType = "autosnippet"; }, { t("\\rho"); }); + s({ trig = ";s"; snippetType = "autosnippet"; }, { t("\\sigma"); }); + s({ trig = ";S"; snippetType = "autosnippet"; }, { t("\\Sigma"); }); + s({ trig = ";t"; snippetType = "autosnippet"; }, { t("\\tau"); }); + s({ trig = ";f"; snippetType = "autosnippet"; }, { t("\\phi"); }); + s({ trig = ";vf"; snippetType = "autosnippet"; }, { t("\\varphi"); }); + s({ trig = ";F"; snippetType = "autosnippet"; }, { t("\\Phi"); }); + s({ trig = ";c"; snippetType = "autosnippet"; }, { t("\\chi"); }); + s({ trig = ";p"; snippetType = "autosnippet"; }, { t("\\psi"); }); + s({ trig = ";P"; snippetType = "autosnippet"; }, { t("\\Psi"); }); + s({ trig = ";w"; snippetType = "autosnippet"; }, { t("\\omega"); }); + s({ trig = ";W"; snippetType = "autosnippet"; }, { t("\\Omega"); }); +} diff --git a/hm/soispha/conf/nvim/plugins/nvim-cmp/default.nix b/hm/soispha/conf/nvim/plugins/nvim-cmp/default.nix new file mode 100644 index 00000000..2fd35272 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/nvim-cmp/default.nix @@ -0,0 +1,47 @@ +{...}: { + programs.nixvim.plugins.nvim-cmp = { + /* + TODO:; integrate this: + ```lua + enabled = { + function() + -- disable completion in comments + local context = require 'cmp.config.context' + -- keep command mode completion enabled when cursor is in a comment + -- te + if vim.api.nvim_get_mode().mode == 'c' then + return true + else + return not context.in_treesitter_capture("comment") + and not context.in_syntax_group("Comment") + end + end + }, + ``` + */ + enable = true; + + mapping = { + # TODO: add support for desc and which key here + "<C-d>" = { + action = "cmp.mapping.scroll_docs(-4)"; + #desc = "Scroll up by four lines"; + }; + "<C-f>" = { + action = "cmp.mapping.scroll_docs(4)"; + #desc = "Scroll down by four lines"; + }; + "HH" = { + action = "cmp.mapping.complete()"; + #desc = "Confirm snipped"; + }; + }; + + snippet.expand = "luasnip"; + + sources = [ + {name = "nvim_lsp";} + {name = "luasnip";} + ]; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/nvim-lint/default.nix b/hm/soispha/conf/nvim/plugins/nvim-lint/default.nix new file mode 100644 index 00000000..c583ebf6 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/nvim-lint/default.nix @@ -0,0 +1,15 @@ +{ + pkgs, + lib, + ... +}: { + programs.nixvim = { + # TODO: package nvim-lint though a module + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/nvim-lint.lua} + ''; + extraPlugins = [ + pkgs.vimExtraPlugins.nvim-lint + ]; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/nvim-lint/lua/nvim-lint.lua b/hm/soispha/conf/nvim/plugins/nvim-lint/lua/nvim-lint.lua new file mode 100644 index 00000000..582da638 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/nvim-lint/lua/nvim-lint.lua @@ -0,0 +1,20 @@ +require("lint").linters_by_ft = { + -- text + markdown = {}; + -- tex = {'chktex'}, -- maybe add some text linters ? + + -- shell + sh = { "shellcheck"; }; + bash = { "shellcheck"; }; + zsh = { "shellcheck"; }; + dash = { "shellcheck"; }; + + yaml = { "yamllint"; }; + nix = { "nix"; "statix"; }; +} + +vim.api.nvim_create_autocmd({ "BufEnter"; "BufWritePost"; }, { + callback = function() + require("lint").try_lint() + end; +}) diff --git a/hm/soispha/conf/nvim/plugins/raw_plugins/default.nix b/hm/soispha/conf/nvim/plugins/raw_plugins/default.nix new file mode 100644 index 00000000..941cb7cb --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/raw_plugins/default.nix @@ -0,0 +1,11 @@ +{...}: { + programs.nixvim = { + # Not all plugins have own modules + # You can add missing plugins here + # `pkgs.vimExtraPlugins` is added by the overlay you added at the beginning + # For a list of available plugins, look here: + # https://github.com/jooooscha/nixpkgs-vim-extra-plugins/blob/main/plugins.md + extraPlugins = [ + ]; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/default.nix b/hm/soispha/conf/nvim/plugins/telescope/default.nix new file mode 100644 index 00000000..b5054ed0 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/default.nix @@ -0,0 +1,10 @@ +{...}: { + imports = [ + ./defaults + ./keymaps + ./extensions + ]; + programs.nixvim.plugins.telescope = { + enable = true; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/defaults/default.nix b/hm/soispha/conf/nvim/plugins/telescope/defaults/default.nix new file mode 100644 index 00000000..1d88aad8 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/defaults/default.nix @@ -0,0 +1,30 @@ +{...}: { + programs.nixvim.plugins.telescope.defaults = { + mappings = let + insert_and_normal_mappings = { + # map actions.which_key to <c-h> (default: <c-/>) + # actions.which_key shows the mappings for your picker, + # e.g. git_{create, delete, ...}_branch for the git_branches picker + "<C-h>" = "which_key"; + }; + in { + i = + insert_and_normal_mappings; + n = + { + "t" = "move_selection_next"; + "n" = "move_selection_previous"; + "<Space>" = "toggle_all"; + + "<C-d>" = "preview_scrolling_up"; + "<C-u>" = "preview_scrolling_down"; + "<Left>" = "preview_scrolling_left"; + "<Right>" = "preview_scrolling_right"; + + "<Esc>" = "close"; + "q" = "close"; + } + // insert_and_normal_mappings; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/extensions/bibtex/default.nix b/hm/soispha/conf/nvim/plugins/telescope/extensions/bibtex/default.nix new file mode 100644 index 00000000..12c9736c --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/extensions/bibtex/default.nix @@ -0,0 +1,13 @@ +{pkgs, ...}: { + # WARNING: This is only activated in tex files via the ftplugin. + programs.nixvim = { + extraPlugins = [ + pkgs.vimExtraPlugins.telescope-bibtex-nvim + ]; + maps.normal = { + "<space>ib" = { + desc = "[i]nsert a [b]atex citation"; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/extensions/default.nix b/hm/soispha/conf/nvim/plugins/telescope/extensions/default.nix new file mode 100644 index 00000000..0b1e033a --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/extensions/default.nix @@ -0,0 +1,9 @@ +{...}: { + imports = [ + ./bibtex + ./frecency + ./fzy-native + ./rooter + ./symbols + ]; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/extensions/frecency/default.nix b/hm/soispha/conf/nvim/plugins/telescope/extensions/frecency/default.nix new file mode 100644 index 00000000..4a4c22be --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/extensions/frecency/default.nix @@ -0,0 +1,22 @@ +{...}: { + programs.nixvim = { + maps = { + normal = { + "gff" = { + action = "function() require('telescope').extensions.frecency.frecency() end"; + lua = true; + desc = "activate the frecency file selection"; + }; + }; + }; + plugins.telescope = { + extensions.frecency = { + enable = true; + showUnindexed = true; + showScores = true; + # TODO: add this: + #db_safe_mode = true; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/extensions/fzy-native/default.nix b/hm/soispha/conf/nvim/plugins/telescope/extensions/fzy-native/default.nix new file mode 100644 index 00000000..ce0bdccc --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/extensions/fzy-native/default.nix @@ -0,0 +1,5 @@ +{...}: { + programs.nixvim.plugins.telescope.extensions.fzy-native = { + enable = true; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/extensions/rooter/default.nix b/hm/soispha/conf/nvim/plugins/telescope/extensions/rooter/default.nix new file mode 100644 index 00000000..779448cc --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/extensions/rooter/default.nix @@ -0,0 +1,7 @@ +{lib, ...}: { + programs.nixvim = { + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/rooter.lua} + ''; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/extensions/rooter/lua/rooter.lua b/hm/soispha/conf/nvim/plugins/telescope/extensions/rooter/lua/rooter.lua new file mode 100644 index 00000000..eaf68ecf --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/extensions/rooter/lua/rooter.lua @@ -0,0 +1,84 @@ +-- Taken from: https://github.com/desdic/telescope-rooter.nvim/blob/69423216c75a5f1f1477bbf8faf6b0dc8af04099/lua/telescope/_extensions/rooter.lua +local has_telescope, telescope = pcall(require, "telescope") +if not has_telescope then + error("This extension requires telescope.nvim") + return +end + +local has_plenary, plenary = pcall(require, "plenary") +if not has_plenary then + error("This extension requires plenary") + return +end + +local log = plenary.log.new({ plugin = "telescope_rooter"; level = "info"; }) + +-- TODO: expose this function +local toggle = function(_) + vim.g["Telescope#rooter#enabled"] = not vim.g["Telescope#rooter#enabled"] + print("Telescope#rooter#enabled=" .. vim.inspect(vim.g["Telescope#rooter#enabled"])) +end + +local config = { patterns = { ".git"; }; enable = true; debug = false; } + +-- default enabled +vim.g["Telescope#rooter#enabled"] = vim.F.if_nil(config.enable, true) + +-- redefine log if debug enabled +if vim.F.if_nil(config.debug, false) then + log = plenary.log.new({ plugin = "telescope_rooter"; level = "debug"; }) +end + +local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true; }) + +vim.api.nvim_create_autocmd({ "DirChangedPre"; }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then + return + end + + if vim.g["Telescope#rooter#oldpwd"] == nil then + vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() + log.debug("before " .. vim.inspect(vim.loop.cwd())) + end + end; + group = group; +}) + +vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then + return + end + + vim.schedule(function() + if vim.bo.filetype == "TelescopePrompt" then + local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true; })[1]) + if rootdir ~= nil then + vim.api.nvim_set_current_dir(rootdir) + log.debug("changing dir to " .. rootdir) + end + end + end) + end; + group = group; +}) + +vim.api.nvim_create_autocmd({ "BufWinLeave"; }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then + return + end + + vim.schedule(function() + if vim.bo.filetype ~= "TelescopePrompt" then + if vim.g["Telescope#rooter#oldpwd"] ~= nil then + log.debug("restoring " .. vim.g["Telescope#rooter#oldpwd"]) + vim.api.nvim_set_current_dir(vim.g["Telescope#rooter#oldpwd"]) + vim.g["Telescope#rooter#oldpwd"] = nil + end + end + end) + end; + group = group; +}) diff --git a/hm/soispha/conf/nvim/plugins/telescope/extensions/symbols/default.nix b/hm/soispha/conf/nvim/plugins/telescope/extensions/symbols/default.nix new file mode 100644 index 00000000..1a679776 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/extensions/symbols/default.nix @@ -0,0 +1,51 @@ +{pkgs, ...}: { + programs.nixvim = { + extraPlugins = [ + # Source of symbols for telescope symbols + pkgs.vimExtraPlugins.telescope-symbols-nvim + ]; + maps = { + normal = { + "<space>il" = { + action = '' + function() + require('telescope.builtin').symbols{ sources = { + 'latex' + }} + end + ''; + lua = true; + desc = "[i]nsert a [l]atex symbol"; + }; + "<space>ie" = { + action = '' + function() + require('telescope.builtin').symbols{ sources = { + 'emoji', + }} + end + ''; + lua = true; + desc = "[i]nsert a [e]moji"; + }; + "<space>is" = { + action = '' + function() + require('telescope.builtin').symbols{ sources = { + 'emoji', + 'gitmoji', + 'julia', + 'kaomoji', + 'latex', + 'math', + 'nerd', + }} + end + ''; + lua = true; + desc = "[i]nsert a [s]ymbol (like emojis)"; + }; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/telescope/keymaps/default.nix b/hm/soispha/conf/nvim/plugins/telescope/keymaps/default.nix new file mode 100644 index 00000000..f0745f73 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/telescope/keymaps/default.nix @@ -0,0 +1,8 @@ +{...}: { + programs.nixvim.plugins.telescope.keymaps = { + "<space>rg" = { + action = "live_grep"; + desc = "[rg] in a live session"; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/todo-comments/default.nix b/hm/soispha/conf/nvim/plugins/todo-comments/default.nix new file mode 100644 index 00000000..9ed6cc87 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/todo-comments/default.nix @@ -0,0 +1,49 @@ +{...}: { + programs.nixvim.plugins.todo-comments = { + enable = true; + guiStyle = { + fg = "BOLD"; + bg = "NONE"; + }; + highlight = { + keyword = "wide_fg"; + }; + keywords = { + /* + # Defaults: + FIX = { + icon = " "; # Icon used for the sign, and in search results. + color = "error"; # Can be a hex color, or a named color. + alt = ["FIXME" "BUG" "FIXIT" "ISSUE"]; # A set of other keywords that all map to this FIX keywords. + }; + TODO = { + icon = " "; + color = "info"; + }; + HACK = { + icon = " "; + color = "warning"; + }; + WARN = { + icon = " "; + color = "warning"; + alt = ["WARNING" "XXX"]; + }; + PERF = { + icon = " "; + alt = ["OPTIM" "PERFORMANCE" "OPTIMIZE"]; + }; + NOTE = { + icon = " "; + color = "hint"; + alt = ["INFO"]; + }; + TEST = { + icon = "⏲ "; + color = "test"; + alt = ["TESTING" "PASSED" "FAILED"]; + }; + */ + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/treesitter/default.nix b/hm/soispha/conf/nvim/plugins/treesitter/default.nix new file mode 100644 index 00000000..9d30d6b9 --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/treesitter/default.nix @@ -0,0 +1,40 @@ +{...}: { + programs.nixvim.plugins.treesitter = { + enable = true; + + ensureInstalled = "all"; + indent = true; + + # inject nixvim specific highlighting (eg in extraConfigLua). + nixvimInjections = true; + + # TODO: It would we wonderfull, if we could use treesitter in latex + disabledLanguages = ["latex"]; + + /* + # TODO: this is not supported by the nixVim modlue, nixNeovim supports this though .. + highlight = { + # `false` will disable the whole extension + enable = true; + disable = ["latex"]; + + # Setting this to true will run `:h syntax` and tree-sitter at the same time. + # Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + # Using this option may slow down your editor; and you may see some duplicate highlights. + # Instead of true it can also be a list of languages + additionalVimRegexHighlighting = [""]; + }; + */ + + incrementalSelection = { + enable = true; + keymaps = { + # TODO: include these + initSelection = "gnn"; # set to `false` to disable one of the mappings + nodeIncremental = "grn"; + scopeIncremental = "grc"; + nodeDecremental = "grm"; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/vim-tex/default.nix b/hm/soispha/conf/nvim/plugins/vim-tex/default.nix new file mode 100644 index 00000000..9b5cea5e --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/vim-tex/default.nix @@ -0,0 +1,59 @@ +{...}: { + programs.nixvim = { + options.conceallevel = 0; + + # globals.tex_conceal = "abdmg"; + # globals.tex_flavor = "latex"; + + plugins.vimtex = { + enable = true; + extraConfig = { + view_method = "zathura"; + quickfix_mode = -1; + view_enabled = -1; + tex_conceal = "abdmg"; + tex_flavor = "latex"; + + # Useful if treesitter is the highlighter + #syntax_enabled = 0; + #syntax_conceal_disable = 1; + + mappings_disable = { + n = ["tsf" "tsc" "tse" "ts$" "tsd" "tsD"]; + x = ["tsd" "tsD" "tsf"]; + }; + + toc_config = { + name = "TOC"; + layers = ["content" "todo" "include"]; + resize = false; + split_width = 49; + todo_sorted = -1; + show_help = false; + show_numbers = false; + mode = true; + layer_keys = { + content = "C"; + label = "L"; + todo = "j"; + include = "I"; + }; + }; + + compiler_latexmk = { + build_dir = "build"; + callback = false; + continuous = true; + executable = "latexmk"; + hooks = []; + options = [ + "-verbose" + "-file-line-error" + "-synctex=0" + "-interaction=nonstopmode" + ]; + }; + }; + }; + }; +} diff --git a/hm/soispha/conf/nvim/plugins/which-key/default.nix b/hm/soispha/conf/nvim/plugins/which-key/default.nix new file mode 100644 index 00000000..be63f7ac --- /dev/null +++ b/hm/soispha/conf/nvim/plugins/which-key/default.nix @@ -0,0 +1,5 @@ +{...}: { + programs.nixvim.plugins.which-key = { + enable = true; + }; +} diff --git a/hm/soispha/conf/python/default.nix b/hm/soispha/conf/python/default.nix new file mode 100644 index 00000000..eeaccdcf --- /dev/null +++ b/hm/soispha/conf/python/default.nix @@ -0,0 +1,7 @@ +{ + config, + pkgs, + ... +}: { + xdg.configFile."python/pythonrc".source = ./pythonrc; +} diff --git a/hm/soispha/conf/python/pythonrc b/hm/soispha/conf/python/pythonrc new file mode 100644 index 00000000..38c48e0f --- /dev/null +++ b/hm/soispha/conf/python/pythonrc @@ -0,0 +1,11 @@ +import os +import atexit +import readline + +history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history') +readline.read_history_file(history) + +def write_history(): + readline.write_history_file(history) + +atexit.register(write_history) diff --git a/hm/soispha/conf/rclone/default.nix b/hm/soispha/conf/rclone/default.nix new file mode 100644 index 00000000..bd0c1ac2 --- /dev/null +++ b/hm/soispha/conf/rclone/default.nix @@ -0,0 +1,7 @@ +{ + config, + pkgs, + ... +}: { + xdg.configFile."rclone/rclone.conf".source = ./rclone.conf; +} diff --git a/hm/soispha/conf/rclone/rclone.conf b/hm/soispha/conf/rclone/rclone.conf new file mode 100644 index 00000000..9e1c4f08 --- /dev/null +++ b/hm/soispha/conf/rclone/rclone.conf @@ -0,0 +1,10 @@ +[vhack1] +type = sftp +host = server1.vhack.eu +user = soispha +key_use_agent = true +known_hosts_file = ~/.local/share/ssh/known_hosts +shell_type = unix +md5sum_command = md5sum +sha1sum_command = sha1sum + diff --git a/hm/soispha/conf/ssh/default.nix b/hm/soispha/conf/ssh/default.nix new file mode 100644 index 00000000..1359e4ab --- /dev/null +++ b/hm/soispha/conf/ssh/default.nix @@ -0,0 +1,15 @@ +{config, ...}: { + programs.ssh = { + enable = true; + compression = true; + hashKnownHosts = false; + serverAliveInterval = 240; + userKnownHostsFile = "${config.xdg.dataHome}/ssh/known_hosts"; + matchBlocks = { + "codeberg.org" = { + # TODO:: Remove this once they fix their ipv6 config + addressFamily = "inet"; + }; + }; + }; +} diff --git a/hm/soispha/conf/swayidle/config b/hm/soispha/conf/swayidle/config new file mode 100644 index 00000000..8ba07850 --- /dev/null +++ b/hm/soispha/conf/swayidle/config @@ -0,0 +1,5 @@ +timeout 180 'swaylock -fFu' + +timeout 360 'systemctl suspend-then-hibernate' + +before-sleep 'swaylock -f' diff --git a/hm/soispha/conf/swayidle/default.nix b/hm/soispha/conf/swayidle/default.nix new file mode 100644 index 00000000..6b8a7d80 --- /dev/null +++ b/hm/soispha/conf/swayidle/default.nix @@ -0,0 +1,29 @@ +{ + config, + pkgs, + ... +}: { + xdg.configFile."swayidle/config".source = ./config; + + # services.swayidle = { + # enable = true; + # events = [ + # { + # event = "before-sleep"; + # command = "${pkgs.swaylock}/bin/swaylock -f "; + # } + # ]; + # timeouts = [ + # { + # timeout = 180; + # command = "${pkgs.swaylock}/bin/swaylock -fFu "; + # } + # { + # timeout = 360; + # # TODO: systemctl is installed? + # command = "systemctl suspend-then-hibernate"; + # } + # ]; + # # systemdTarget = ""; # TODO: this might be usefull + # }; +} diff --git a/hm/soispha/conf/swaylock/commands.jpg b/hm/soispha/conf/swaylock/commands.jpg new file mode 100644 index 00000000..54016503 --- /dev/null +++ b/hm/soispha/conf/swaylock/commands.jpg Binary files differdiff --git a/hm/soispha/conf/swaylock/default.nix b/hm/soispha/conf/swaylock/default.nix new file mode 100644 index 00000000..7c3762cc --- /dev/null +++ b/hm/soispha/conf/swaylock/default.nix @@ -0,0 +1,10 @@ +{...}: { + programs.swaylock = { + enable = true; + settings = { + #image = "$WALLPAPER"; + image = "${./commands.jpg}"; + color = "000000"; + }; + }; +} diff --git a/hm/soispha/conf/swaylock/gnu.png b/hm/soispha/conf/swaylock/gnu.png new file mode 100644 index 00000000..d07dee3e --- /dev/null +++ b/hm/soispha/conf/swaylock/gnu.png Binary files differdiff --git a/hm/soispha/conf/tridactyl/config.vim b/hm/soispha/conf/tridactyl/config.vim new file mode 100644 index 00000000..84e290cb --- /dev/null +++ b/hm/soispha/conf/tridactyl/config.vim @@ -0,0 +1,47 @@ +" vim: filetype=vim + +" This wipes all existing settings. This means that if a setting in this file +" is removed, then it will return to default. In other words, this file serves +" as an enforced single point of truth for Tridactyl's configuration. +sanitize tridactyllocal tridactylsync + +" Just use a blank page for new tab. It would be nicer to use the standard +" Firefox homepage, but Tridactyl doesn't support this yet. +"TODO: use custome file +"set newtab file:///home/soispha/new.html + +" Set a nice colorscheme +colorscheme midnight + +" Delete temp files after use +alias editor_rm composite editor | jsb -p tri.native.run(`rm -f '${JS_ARG[0]}'`) +bind --mode=insert <C-i> editor_rm +bind --mode=input <C-i> editor_rm + +" Use vim in tmux for editor. +set editorcmd alacritty -e nvim + +" Ctrl-F should use the browser's native 'find' functionality. +unbind <C-f> + +" But also support Tridactyl search too. +bind / fillcmdline find +bind ? fillcmdline find -? +bind l findnext 1 +bind L findnext -1 +" Remove search highlighting. +bind ,<Space> nohlsearch +" Use sensitive case. Smart case would be nice here, but it doesn't work. +set findcase smartcase + +" Smooth scrolling, yes please. This is still a bit janky in Tridactyl. +set smoothscroll true + +" The default jump of 10 is a bit much. +bind t scrollline 5 +bind n scrollline -5 + +" K and J should move between tabs. x should close them. +bind T tabprev +bind N tabnext +bind x tabclose diff --git a/hm/soispha/conf/tridactyl/default.nix b/hm/soispha/conf/tridactyl/default.nix new file mode 100644 index 00000000..23307cfe --- /dev/null +++ b/hm/soispha/conf/tridactyl/default.nix @@ -0,0 +1,3 @@ +{...}: { + xdg.configFile."tridactyl/tridactylrc".source = ./config.vim; +} diff --git a/hm/soispha/conf/yambar/config/config.yml b/hm/soispha/conf/yambar/config/config.yml new file mode 100644 index 00000000..bb742fd3 --- /dev/null +++ b/hm/soispha/conf/yambar/config/config.yml @@ -0,0 +1,234 @@ +--- +# Config file for yambar +# Note that this may be version-dependent, this file is written for v1.8.0 + + +# Font anchors +font-main: &fontmain Source Code Pro:pixelsize=26 +font-aws: &awesome Font Awesome 5 Free:style=solid:pixelsize=23 + +# Color anchors +fg-none: &fgnone 00000000 +fg-1: &fg1 c6ceefff +fg-blue: &fgblue 99d1dbff +fg-sapphire: &fgsapp 74c7ecdd +fg-green: &fggreen a6e3a1dd +fg-peach: &fgpeach fab387dd +fg-mauve: &fgmauve cba6f7dd +fg-teal: &fgteal 94e2d5dd +fg-lavendar: &fglav b4befedd +fg-focus: &fgfocus e78284ff +bg-1: &bg1 303446ff +bg-tag: &bgtag 585b70ff +bg-tag2: &bgtag2 45475aff +bg-urgent: &bgurgent e78284ff + +# Background blocks +background-block: &bgcblock {background: {color: *bg1 }} +background-block-urgent: &bgcurg {background: {color: *bgurgent }} + +# Underlines +underline-focused: &line {underline: { size: 3, color: *fgfocus}} +underline-urgent: &lineurgent {underline: { size: 3, color: *fgblue}} +underline-utils: &lineutil {underline: { size: 3, color: *fgpeach}} +underline-resources: &linemem {underline: { size: 3, color: *fggreen}} +underline-battery: &linebat {underline: { size: 3, color: *fgsapp}} +underline-clock: &lineclock {underline: { size: 3, color: *fgteal}} +underline-weather: &linewea {underline: { size: 3, color: *fglav}} +underline-title: &linetitle {underline: { size: 3, color: *bgtag}} + +# Combined decorations +combination-utils: &combutil {stack: [ <<: *bgcblock, <<: *lineutil]} +combination-resources: &combmem {stack: [ <<: *bgcblock, <<: *linemem]} +combination-battery: &combbat {stack: [ <<: *bgcblock, <<: *linebat]} +combination-clock: &combclock {stack: [ <<: *bgcblock, <<: *lineclock]} +combination-weather: &combwea {stack: [ <<: *bgcblock, <<: *linewea]} + + +### Main + +bar: + location: top + height: 45 + layer: bottom + spacing: 0 + margin: 10 + border: {margin: 0, top-margin: 10} + foreground: *fg1 + background: *fgnone + font: *fontmain + + ### Left, river tags + left: + - river: + anchors: + - id: &name { text: "{id}" } + - string: &focus { stack: [ {background: {color: *bg1}} ] } + - string: &normal { string: { <<: *name, margin: 10 } } + - string: + &occupied { string: { <<: *name, deco: {background: {color: *bgtag2}}, margin: 10 } } + - string: &urgent { string: { <<: *name, deco: {stack: [background: {color: *bgurgent}, <<: *lineurgent]}, margin: 10 } } + - string: &focused { string: { <<: *name, deco: {stack: [background: {color: *bgtag}, <<: *line]}, margin: 10 } } + - string: &unfocused { string: { <<: *name, deco: {background: {color: *bgtag2}}, margin: 10 } } + - base: &river_base + default: *normal + conditions: + state == focused: *focused + state == unfocused: *unfocused + state == urgent: *urgent + state == invisible: + map: + conditions: + occupied: *occupied + ~occupied: *normal + content: + map: + on-click: + left: sh -c "riverctl set-focused-tags $((1 << ({id} - 1)))" + right: sh -c "riverctl toggle-focused-tags $((1 << ({id} -1)))" + middle: sh -c "riverctl toggle-view-tags $((1 << ({id} -1)))" + conditions: + id == 1: { map: { <<: *river_base } } + id == 2: { map: { <<: *river_base } } + id == 3: { map: { <<: *river_base } } + id == 4: { map: { <<: *river_base } } + id == 5: { map: { <<: *river_base } } + id == 6: { map: { <<: *river_base } } + id == 7: { map: { <<: *river_base } } + id == 8: { map: { <<: *river_base } } + id == 9: { map: { <<: *river_base } } + title: + map: + default: + { + string: + { + text: "{title}", + left-margin: 12, + right-margin: 12, + # max: 35, + deco: *linetitle + }, + } + conditions: + title == "": { string: { text: "" } } + + ### Center, clock & weather gadget + center: + - clock: + time-format: "%H:%M:%S %Z" + date-format: "%d/%m/%y (%a)" + foreground: *fgblue + content: + string: + text: " {date} {time} " + deco: *combclock + + ### Right, system tray + right: + #- network: + # name: wlp5s0 + # poll-interval: 10 + # content: + # map: + # on-click: /bin/sh -c "nmtui" + # conditions: + # ~carrier: {empty: {}} + # carrier: + # string: {text: " {ssid} ", deco: *combutil} + #- network: + # name: enp4s0 + # content: + # map: + # on-click: /bin/sh -c "nmtui" + # conditions: + # ~carrier: + # string: {text: " Eth failed ", deco: *combutil} + # carrier: {empty: {}} + + - script: # Sound volume + path: @volume_script@ + content: + map: + on-click: /bin/sh -c "pavucontrol" + conditions: + muted: + string: + text: " ﱝ " + deco: *bgcurg + ~muted: + string: {text: " {volume}% ", deco: *combutil} + + - script: # Grade average + path: @grade_average_script@ + content: + string: + text: " {grade} " + deco: *combmem + + #- backlight: + # name: intel_backlight + # content: + # - string: {text: " {percent}% ", deco: *combutil} + + - script: # CPU + path: @cpu_script@ + content: + string: + text: " {cpu}% " + deco: *combmem + + - script: # Memory info + path: @memory_script@ + content: + map: + conditions: + swapstate: + string: + text: " {memperc}%({swapperc}%) " + deco: *combmem + ~swapstate: + string: + text: " {memperc}% " + deco: *combmem + - script: # Disk space + path: @disk_script@ + content: + string: + text: " {diskspace}({diskperc})" + deco: *combmem + #- battery: + # name: BAT0 + # poll-interval: 30 + # content: + # list: + # items: + # - ramp: + # tag: capacity + # items: + # - string: + # text: " {capacity}%({estimate}) " + # deco: *bgcurg + # - string: + # text: " {capacity}%({estimate}) " + # deco: {stack: [ <<: *bgcblock, <<: *linebat]} + # - string: + # text: " {capacity}%({estimate}) " + # deco: {stack: [ <<: *bgcblock, <<: *linebat]} + # - string: + # text: " {capacity}%({estimate}) " + # deco: {stack: [ <<: *bgcblock, <<: *linebat]} + # - string: + # text: " {capacity}%({estimate}) " + # deco: {stack: [ <<: *bgcblock, <<: *linebat]} + #- script: # tray + # path: /home/dt/.config/yambar/scripts/yambar-tray + # content: + # empty: {} + #- script: + # path: /home/dt/.config/yambar/scripts/yambar-tray-width + # poll-interval: 10 + # content: + # string: + # text: "{padding}" + # deco: *combmem diff --git a/hm/soispha/conf/yambar/config/laptop.yml b/hm/soispha/conf/yambar/config/laptop.yml new file mode 100644 index 00000000..805ffe5b --- /dev/null +++ b/hm/soispha/conf/yambar/config/laptop.yml @@ -0,0 +1,234 @@ +--- +# Config file for yambar +# Note that this may be version-dependent, this file is written for v1.8.0 + + +# Font anchors +font-main: &fontmain Source Code Pro:pixelsize=22 +font-aws: &awesome Font Awesome 5 Free:style=solid:pixelsize=20 + +# Color anchors +fg-none: &fgnone 00000000 +fg-1: &fg1 c6ceefff +fg-blue: &fgblue 99d1dbff +fg-sapphire: &fgsapp 74c7ecdd +fg-green: &fggreen a6e3a1dd +fg-peach: &fgpeach fab387dd +fg-mauve: &fgmauve cba6f7dd +fg-teal: &fgteal 94e2d5dd +fg-lavendar: &fglav b4befedd +fg-focus: &fgfocus e78284ff +bg-1: &bg1 303446ff +bg-tag: &bgtag 585b70ff +bg-tag2: &bgtag2 45475aff +bg-urgent: &bgurgent e78284ff + +# Background blocks +background-block: &bgcblock {background: {color: *bg1 }} +background-block-urgent: &bgcurg {background: {color: *bgurgent }} + +# Underlines +underline-focused: &line {underline: { size: 3, color: *fgfocus}} +underline-urgent: &lineurgent {underline: { size: 3, color: *fgblue}} +underline-utils: &lineutil {underline: { size: 3, color: *fgpeach}} +underline-resources: &linemem {underline: { size: 3, color: *fggreen}} +underline-battery: &linebat {underline: { size: 3, color: *fgsapp}} +underline-clock: &lineclock {underline: { size: 3, color: *fgteal}} +underline-weather: &linewea {underline: { size: 3, color: *fglav}} +underline-title: &linetitle {underline: { size: 3, color: *bgtag}} + +# Combined decorations +combination-utils: &combutil {stack: [ <<: *bgcblock, <<: *lineutil]} +combination-resources: &combmem {stack: [ <<: *bgcblock, <<: *linemem]} +combination-battery: &combbat {stack: [ <<: *bgcblock, <<: *linebat]} +combination-clock: &combclock {stack: [ <<: *bgcblock, <<: *lineclock]} +combination-weather: &combwea {stack: [ <<: *bgcblock, <<: *linewea]} + + +### Main + +bar: + location: top + height: 25 + layer: bottom + spacing: 0 + margin: 10 + border: {margin: 0, top-margin: 5} + foreground: *fg1 + background: *fgnone + font: *fontmain + + ### Left, river tags + left: + - river: + anchors: + - id: &name { text: "{id}" } + - string: &focus { stack: [ {background: {color: *bg1}} ] } + - string: &normal { string: { <<: *name, margin: 10 } } + - string: + &occupied { string: { <<: *name, deco: {background: {color: *bgtag2}}, margin: 10 } } + - string: &urgent { string: { <<: *name, deco: {stack: [background: {color: *bgurgent}, <<: *lineurgent]}, margin: 10 } } + - string: &focused { string: { <<: *name, deco: {stack: [background: {color: *bgtag}, <<: *line]}, margin: 10 } } + - string: &unfocused { string: { <<: *name, deco: {background: {color: *bgtag2}}, margin: 10 } } + - base: &river_base + default: *normal + conditions: + state == focused: *focused + state == unfocused: *unfocused + state == urgent: *urgent + state == invisible: + map: + conditions: + occupied: *occupied + ~occupied: *normal + content: + map: + on-click: + left: sh -c "riverctl set-focused-tags $((1 << ({id} - 1)))" + right: sh -c "riverctl toggle-focused-tags $((1 << ({id} -1)))" + middle: sh -c "riverctl toggle-view-tags $((1 << ({id} -1)))" + conditions: + id == 1: { map: { <<: *river_base } } + id == 2: { map: { <<: *river_base } } + id == 3: { map: { <<: *river_base } } + id == 4: { map: { <<: *river_base } } + id == 5: { map: { <<: *river_base } } + id == 6: { map: { <<: *river_base } } + id == 7: { map: { <<: *river_base } } + id == 8: { map: { <<: *river_base } } + id == 9: { map: { <<: *river_base } } + title: + map: + default: + { + string: + { + text: "{title}", + left-margin: 12, + right-margin: 12, + # max: 35, + deco: *linetitle + }, + } + conditions: + title == "": { string: { text: "" } } + + ### Center, clock & weather gadget + center: + - clock: + time-format: "%H:%M:%S %Z" + date-format: "%d/%m/%y (%a)" + foreground: *fgblue + content: + string: + text: " {date} {time} " + deco: *combclock + + ### Right, system tray + right: + #- network: + # name: wlp5s0 + # poll-interval: 10 + # content: + # map: + # on-click: /bin/sh -c "nmtui" + # conditions: + # ~carrier: {empty: {}} + # carrier: + # string: {text: " {ssid} ", deco: *combutil} + #- network: + # name: enp4s0 + # content: + # map: + # on-click: /bin/sh -c "nmtui" + # conditions: + # ~carrier: + # string: {text: " Eth failed ", deco: *combutil} + # carrier: {empty: {}} + + - script: # Sound volume + path: @volume_script@ + content: + map: + on-click: /bin/sh -c "pavucontrol" + conditions: + muted: + string: + text: " ﱝ " + deco: *bgcurg + ~muted: + string: {text: " {volume}% ", deco: *combutil} + + - script: # Grade average + path: @grade_average_script@ + content: + string: + text: " {grade} " + deco: *combmem + + - backlight: + name: @backlight@ + content: + - string: {text: " {percent}% ", deco: *combutil} + + - script: # CPU + path: @cpu_script@ + content: + string: + text: " {cpu}% " + deco: *combmem + + - script: # Memory info + path: @memory_script@ + content: + map: + conditions: + swapstate: + string: + text: " {memperc}%({swapperc}%) " + deco: *combmem + ~swapstate: + string: + text: " {memperc}% " + deco: *combmem + - script: # Disk space + path: @disk_script@ + content: + string: + text: " {diskspace}({diskperc})" + deco: *combmem + - battery: + name: BAT0 + poll-interval: 300 + content: + list: + items: + - ramp: + tag: capacity + items: + - string: + text: " {capacity}%({estimate}) " + deco: *bgcurg + - string: + text: " {capacity}%({estimate}) " + deco: {stack: [ <<: *bgcblock, <<: *linebat]} + - string: + text: " {capacity}%({estimate}) " + deco: {stack: [ <<: *bgcblock, <<: *linebat]} + - string: + text: " {capacity}%({estimate}) " + deco: {stack: [ <<: *bgcblock, <<: *linebat]} + - string: + text: " {capacity}%({estimate}) " + deco: {stack: [ <<: *bgcblock, <<: *linebat]} + #- script: # tray + # path: /home/dt/.config/yambar/scripts/yambar-tray + # content: + # empty: {} + #- script: + # path: /home/dt/.config/yambar/scripts/yambar-tray-width + # poll-interval: 10 + # content: + # string: + # text: "{padding}" + # deco: *combmem diff --git a/hm/soispha/conf/yambar/default.nix b/hm/soispha/conf/yambar/default.nix new file mode 100644 index 00000000..0bcf8419 --- /dev/null +++ b/hm/soispha/conf/yambar/default.nix @@ -0,0 +1,53 @@ +{ + nixosConfig, + sysLib, + system, + pkgs, + grades, + yambar_cpu, + yambar_memory, + ... +}: let + makeScript = { + file, + dependencies, + ... + }: + sysLib.writeShellScriptWithLibrary { + name = "${builtins.baseNameOf file}"; + src = file; + dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;}); + } + + "/bin/${builtins.baseNameOf file}"; +in { + xdg.configFile."yambar/config.yml".source = pkgs.substituteAll { + src = + if nixosConfig.soispha.laptop.enable + then ./config/laptop.yml + else ./config/config.yml; + + backlight = + if nixosConfig.soispha.laptop.enable + then nixosConfig.soispha.laptop.backlight + else ""; + volume_script = makeScript { + dependencies = builtins.attrValues {inherit (pkgs) pulseaudio gawk coreutils;}; + file = ./scripts/sound-volume; + }; + grade_average_script = makeScript { + dependencies = + [ + grades.outputs.packages.${system}.default + ] + ++ (builtins.attrValues {inherit (pkgs) coreutils gawk;}); + file = ./scripts/grades-average; + }; + cpu_script = yambar_cpu.app.${system}.default.program; + memory_script = yambar_memory.app.${system}.default.program; + + disk_script = makeScript { + dependencies = builtins.attrValues {inherit (pkgs) gawk btrfs-progs coreutils;}; + file = ./scripts/disk; + }; + }; +} diff --git a/hm/soispha/conf/yambar/scripts/disk b/hm/soispha/conf/yambar/scripts/disk new file mode 100755 index 00000000..83b23ad9 --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/disk @@ -0,0 +1,22 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +# Main loop +while true; do + # vars + used_space=$(btrfs filesystem usage /srv 2> /dev/null | awk '{if ( /Used:/ ) { print $2 } } ' | head -n1) + all_space=$(btrfs filesystem usage /srv 2> /dev/null | awk '{if ( /Device size:/ ) { print $3 } } ' | head -n1 | tr -d "GiB") + + + # Check space available (4) and percentage used (5) + spaceperc=$(echo "$(echo "$used_space" | tr -d "GiB" )" "$all_space" | awk '{div=$1/$2;div *= 100; printf"%2d%%\n",div }') + + echo "diskspace|string|$used_space" + echo "diskperc|string|$spaceperc" + echo "" + sleep 1 +done + +# vim: ft=sh diff --git a/hm/soispha/conf/yambar/scripts/grades-average b/hm/soispha/conf/yambar/scripts/grades-average new file mode 100755 index 00000000..20de5684 --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/grades-average @@ -0,0 +1,15 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +while true; do + grade="$(grades list average | awk '{print $2}')"; + + echo "grade|string|$grade"; + echo ""; + + sleep 1; +done + +# vim: ft=sh diff --git a/hm/soispha/conf/yambar/scripts/network b/hm/soispha/conf/yambar/scripts/network new file mode 100755 index 00000000..8e02d6dc --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/network @@ -0,0 +1,47 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +retest=120 +retest_if_con_fails=10 +backend=nmcli + +case "$backend" in + "nmcli") # Test for connectivity with nmcli + while true; do + connection_status=$(nmcli networking connectivity) + if [ "$connection_status" = "full" ]; then + echo "internet|string|Connected" + echo "" + sleep $retest + else + echo "internet|string|Disconnected" + echo "" + sleep $retest_if_con_fails + fi + done + ;; + "ping") # Test for connectivity with ping + ip_address='8.8.8.8' + ping_number=3 + + while true; do + + ping_result=$(mktmp) + ping $ip_address -c $ping_number -q | awk 'BEGIN {FS="/"} END {print $5}' > "$ping_result" + + if [ "$(cat "$ping_result" | wc -l)" -eq 0 ]; then + echo "med|string|No connection" + echo "" + sleep $retest_if_con_fails + else + echo "med|string|$(cat "$ping_result") ms" + echo "" + sleep $retest + fi + done + ;; +esac + +# vim: ft=sh diff --git a/hm/soispha/conf/yambar/scripts/old/amixer-monitor b/hm/soispha/conf/yambar/scripts/old/amixer-monitor new file mode 100755 index 00000000..9e75acfa --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/amixer-monitor @@ -0,0 +1,24 @@ +#!/bin/sh +# An improved amixer script that actually detects volume beyond 100% + + +SLEEPTIME=1 + + +while true; do + + volume=$(pactl get-sink-volume 0 | awk 'BEGIN { FS="/"} {print $2 }' | tr -d "%" | tr -d ' ') + + if [ "$volume" -eq 0 ]; then + echo "muted|bool|true" + + else + # Read sink volume in percentages + echo "volume|string|$volume" + echo "muted|bool|false" + fi + + echo "" + sleep "$SLEEPTIME" + +done diff --git a/hm/soispha/conf/yambar/scripts/old/cpu b/hm/soispha/conf/yambar/scripts/old/cpu new file mode 100755 index 00000000..bae820d0 --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/cpu @@ -0,0 +1,126 @@ +#!/bin/bash +# I didn't write this script; this is almost directly copied from the dnkl/yambar github. + + +# cpu.sh - measures CPU usage at a configurable sample interval +# +# Usage: cpu.sh INTERVAL_IN_SECONDS +# +# This script will emit the following tags on stdout (N is the number +# of logical CPUs): +# +# Name Type +# -------------------- +# cpu range 0-100 +# cpu0 range 0-100 +# cpu1 range 0-100 +# ... +# cpuN-1 range 0-100 +# +# I.e. ‘cpu’ is the average (or aggregated) CPU usage, while cpuX is a +# specific CPU’s usage. +# +# Example configuration (update every second): +# +# - script: +# path: /path/to/cpu.sh +# args: [1] +# content: {string: {text: "{cpu}%"}} +# + +interval=2 + +case ${interval} in + ''|*[!0-9]*) + echo "interval must be an integer" + exit 1 + ;; + *) + ;; +esac + +# Get number of CPUs, by reading /proc/stat +# The output looks like: +# +# cpu A B C D ... +# cpu0 A B C D ... +# cpu1 A B C D ... +# cpuN A B C D ... +# +# The first line is a summary line, accounting *all* CPUs +IFS=$'\n' readarray -t all_cpu_stats < <(grep -e "^cpu" /proc/stat) +cpu_count=$((${#all_cpu_stats[@]} - 1)) + +# Arrays of ‘previous’ idle and total stats, needed to calculate the +# difference between each sample. +prev_idle=() +prev_total=() +for i in $(seq ${cpu_count}); do + prev_idle+=(0) + prev_total+=(0) +done + +prev_average_idle=0 +prev_average_total=0 + +while true; do + IFS=$'\n' readarray -t all_cpu_stats < <(grep -e "^cpu" /proc/stat) + + usage=() # CPU usage in percent, 0 <= x <= 100 + + average_idle=0 # All CPUs idle time since boot + average_total=0 # All CPUs total time since boot + + for i in $(seq 0 $((cpu_count - 1))); do + # Split this CPUs stats into an array + stats=($(echo "${all_cpu_stats[$((i + 1))]}")) + + # man procfs(5) + user=${stats[1]} + nice=${stats[2]} + system=${stats[3]} + idle=${stats[4]} + iowait=${stats[5]} + irq=${stats[6]} + softirq=${stats[7]} + steal=${stats[8]} + guest=${stats[9]} + guestnice=${stats[10]} + + # Guest time already accounted for in user + user=$((user - guest)) + nice=$((nice - guestnice)) + + idle=$((idle + iowait)) + + total=$((user + nice + system + irq + softirq + idle + steal + guest + guestnice)) + + average_idle=$((average_idle + idle)) + average_total=$((average_total + total)) + + # Diff since last sample + diff_idle=$((idle - prev_idle[i])) + diff_total=$((total - prev_total[i])) + + usage[i]=$((100 * (diff_total - diff_idle) / diff_total)) + + prev_idle[i]=${idle} + prev_total[i]=${total} + done + + diff_average_idle=$((average_idle - prev_average_idle)) + diff_average_total=$((average_total - prev_average_total)) + + average_usage=$((100 * (diff_average_total - diff_average_idle) / diff_average_total)) + + prev_average_idle=${average_idle} + prev_average_total=${average_total} + + echo "cpu|range:0-100|${average_usage}" + for i in $(seq 0 $((cpu_count - 1))); do + echo "cpu${i}|range:0-100|${usage[i]}" + done + + echo "" + sleep "${interval}" +done diff --git a/hm/soispha/conf/yambar/scripts/old/dfspace b/hm/soispha/conf/yambar/scripts/old/dfspace new file mode 100755 index 00000000..0b262481 --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/dfspace @@ -0,0 +1,23 @@ +#!/bin/sh + +# Sleep seconds +timer="60" + +# Main loop +while true; do + + # vars + used_space=$(btrfs filesystem usage / 2> /dev/null | awk '{if ( /Used:/ ) { print $2 } } ' | head -n1) + all_space=$(btrfs filesystem usage / 2> /dev/null | awk '{if ( /Device size:/ ) { print $3 } } ' | head -n1 | tr -d "GiB") + + + # Check space available (4) and percentage used (5) + spaceperc=$(echo "$(echo "$used_space" | tr -d "GiB" )" "$all_space" | awk '{div=$1/$2;div *= 100; printf"%2d%%\n",div }') + + echo "diskspace|string|$used_space" + echo "diskperc|string|$spaceperc" + echo "" + sleep $timer + +done + diff --git a/hm/soispha/conf/yambar/scripts/old/grades-average b/hm/soispha/conf/yambar/scripts/old/grades-average new file mode 100755 index 00000000..a04b958c --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/grades-average @@ -0,0 +1,12 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +grade=$(grades list average | awk '{print $2}'); + +echo "grade|string|$grade"; +echo ""; + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/hm/soispha/conf/yambar/scripts/old/meminfo b/hm/soispha/conf/yambar/scripts/old/meminfo new file mode 100755 index 00000000..0156e94c --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/meminfo @@ -0,0 +1,37 @@ +#!/bin/sh +# Checks memory usage + +# Number of seconds to retest +timer=5 + +# Main loop +while true; do + + mem_total=$(LANG=C free -b|awk '/^Mem:/{print $2}') + mem_used=$(LANG=C free -b|awk '/^Mem:/{print $3}') + swap_total=$(LANG=C free -b|awk '/^Swap:/{print $2}') + swap_used=$(LANG=C free -b|awk '/^Swap:/{print $3}') + + + memperc=$(echo "$mem_used" "$mem_total" | awk '{ div = 100 * ($1 / $2)} { printf "%.0f ", div }' | tr -d ' ' ) + swapperc=$(echo "$swap_used" "$swap_total" | awk '{ + if ( $1 == 0 || $2 == 0 ) { + print "%" + } else { + div = 100 * ($1 / $2); + printf "%.0f ", div +} +}' | tr -d ' ' ) + + +echo "memperc|string|$memperc" +if [ "$swapperc" = "%" ];then + echo "swapstate|bool|false" +else + echo "swapperc|string|$swapperc" + echo "swapstate|bool|true" +fi +echo "" +sleep "$timer" + +done diff --git a/hm/soispha/conf/yambar/scripts/old/nmclitest b/hm/soispha/conf/yambar/scripts/old/nmclitest new file mode 100755 index 00000000..3e8bc73a --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/nmclitest @@ -0,0 +1,23 @@ +#!/bin/sh +# Test for connectivity with nmcli + +Timer=${1:-120} # Number of seconds to retest +Timer2=${2:-10} # Number of seconds to retest if connection fails + +# Main loop +while true; do + + CONN=$(nmcli networking connectivity) + + if [[ "$CONN" == "full" ]]; then + echo "internet|string|Connected" + echo "" + sleep $Timer + else + echo "internet|string|Disconnected" + echo "" + sleep $Timer2 + fi + +done + diff --git a/hm/soispha/conf/yambar/scripts/old/pingtest b/hm/soispha/conf/yambar/scripts/old/pingtest new file mode 100755 index 00000000..2b5f9998 --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/pingtest @@ -0,0 +1,28 @@ +#!/bin/sh +# Test for connectivity with ping + +Timer=${1:-120} # Number of seconds to retest +Timer2=${2:-10} # Number of seconds to retest if connection fails +IP=${3:-'8.8.8.8'} # IP address to test, defaults to Google +PCount=${4:-3} # Number of pings to send + +# Main loop +while true; do + + # Pings the IP address for five times + PINGSTR=$(ping $IP -c $PCount -q) + # Use text formatting to get min/max ms delays + MED=$(echo $PINGSTR | sed 's/min\/avg\/max\/mdev = /\n/g' | tail -n 1 | sed 's/\//\t/g' | cut -f2) + + if [[ "$MED" == "" ]]; then + echo "med|string|No connection" + echo "" + sleep $Timer2 + else + echo "med|string|$MED ms" + echo "" + sleep $Timer + fi + +done + diff --git a/hm/soispha/conf/yambar/scripts/old/yambar-tray b/hm/soispha/conf/yambar/scripts/old/yambar-tray new file mode 100755 index 00000000..1704c6dd --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/yambar-tray @@ -0,0 +1,27 @@ +#!/bin/sh + + +pkill stalonetray +pkill trayer + +# launch a tray. +echo + +sleep 0.1 # make sure yambar starts first so we can draw on tpo of it + +# trayer-srg fork! +trayer \ + --edge top \ + --tint 0x24242400 \ + --align right \ + --height 20 \ + --expand false \ + --transparent true \ + --alpha 0 \ + --width 20 \ + --monitor primary \ + --widthtype request + # &>/dev/null + + + diff --git a/hm/soispha/conf/yambar/scripts/old/yambar-tray-width b/hm/soispha/conf/yambar/scripts/old/yambar-tray-width new file mode 100755 index 00000000..00544e70 --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/old/yambar-tray-width @@ -0,0 +1,28 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + +CHARWIDTH=8 # i guess? + +tray_width_px() { + xwininfo -name panel | # trayer names its window "panel" + grep -i width: | + awk '{print $2}' +} + +px_to_spaces() { + spaces="$((1 + ${1:-0} / $CHARWIDTH))" + printf "% *s\n" $spaces +} + +sleep 0.2 # be sure trayer is already up + +output="$(px_to_spaces `tray_width_px`)" +echo "padding|string|$output" +echo "" + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/hm/soispha/conf/yambar/scripts/sound-volume b/hm/soispha/conf/yambar/scripts/sound-volume new file mode 100755 index 00000000..8494cbd5 --- /dev/null +++ b/hm/soispha/conf/yambar/scripts/sound-volume @@ -0,0 +1,20 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +while true; do + volume="$(pactl get-sink-volume 0 | awk 'BEGIN { FS="/" } {gsub("%","",$2); gsub(" ","",$2)} {printf $2}')" + + if [ "$volume" -eq 0 ]; then + echo "muted|bool|true" + else + echo "volume|string|$volume" + echo "muted|bool|false" + fi + echo "" + + sleep 1; +done + +# vim: ft=sh diff --git a/hm/soispha/conf/zsh/config/custom_cursor.sh b/hm/soispha/conf/zsh/config/custom_cursor.sh new file mode 100644 index 00000000..9a6da012 --- /dev/null +++ b/hm/soispha/conf/zsh/config/custom_cursor.sh @@ -0,0 +1,40 @@ +# Change cursor shape for different vi modes. +function zle-keymap-select { + if [[ ${KEYMAP} == vicmd ]] || + [[ $1 = 'block' ]]; then + echo -ne '\e[1 q' + elif [[ ${KEYMAP} == main ]] || + [[ ${KEYMAP} == viins ]] || + [[ ${KEYMAP} = '' ]] || + [[ $1 = 'beam' ]]; then + echo -ne '\e[5 q' + fi +} +zle -N zle-keymap-select + +# ci", ci', ci`, di", etc +autoload -U select-quoted +zle -N select-quoted +for m in visual viopp; do + for c in {a,i}{\',\",\`}; do + bindkey -M $m $c select-quoted + done +done + +# ci{, ci(, ci<, di{, etc +autoload -U select-bracketed +zle -N select-bracketed +for m in visual viopp; do + for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do + bindkey -M $m $c select-bracketed + done +done + +zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" +} +zle -N zle-line-init + +echo -ne '\e[5 q' # Use beam shape cursor on startup. +precmd() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. diff --git a/hm/soispha/conf/zsh/config/zsh-init.sh b/hm/soispha/conf/zsh/config/zsh-init.sh new file mode 100644 index 00000000..4d54d058 --- /dev/null +++ b/hm/soispha/conf/zsh/config/zsh-init.sh @@ -0,0 +1,39 @@ +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# Flex on the ubuntu users +[ "$NVIM" ] || hyfetch +#loginctl show-session $XDG_SESSION_ID + +## Enable colors and change prompt: +#autoload -Uz colors && colors +#autoload -Uz compinit && compinit -u +## Edit line in vim buffer ctrl-v +autoload -Uz edit-command-line; zle -N edit-command-line +## Enter vim buffer from normal mode +#autoload -Uz edit-command-line && zle -N edit-command-line +bindkey "^V" edit-command-line + +## zstyles +#zstyle ':completion:*' menu select +## Auto complete with case insensitivity +#zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + +#zmodload zsh/complist +#fpath+=/home/dt/.config/zsh/comp +#compinit +#_comp_options+=(globdots) # Include hidden files. +# +## Source configs +#source "${ZDOTDIR}/ali.sh" +#source "${ZDOTDIR}/prompt.sh" +#source "${ZDOTDIR}/hotkeys.sh" +#source "./${path_custom_cursor}" +#source ~/.local/lib/shell/lib +# +## Load zsh-syntax-highlighting +#source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +## Suggest aliases for commands +#source /usr/share/zsh/plugins/zsh-you-should-use/you-should-use.plugin.zsh +# +##eval "$(lua ~/scripts/z.lua --init zsh enhanced)" diff --git a/hm/soispha/conf/zsh/config/zsh-prompt.sh b/hm/soispha/conf/zsh/config/zsh-prompt.sh new file mode 100644 index 00000000..26d478ef --- /dev/null +++ b/hm/soispha/conf/zsh/config/zsh-prompt.sh @@ -0,0 +1,63 @@ +#vim:ft=zsh +_command_time_preexec() { + timer=${timer:-$SECONDS} +} + +_command_time_precmd() { + PROMPT_TMP_DIR=$(mktemp) + if [ $timer ]; then + ts=$(($SECONDS - $timer)) + tts=$ts + mi=0 + ho=0 + if [ $ts -ge 3 ];then + while [ $ts -ge 60 ];do + ts=$((ts-60)) + mi=$((mi+1)) + done + + while [ $mi -ge 60 ];do + mi=$((mi-60)) + ho=$((ho+1)) + done + + if [ $tts -ge 3600 ];then + out=$(printf '%dh %dm %ds\n' $ho $mi $ts) + elif [ $tts -ge 60 ];then + out=$(printf '%dm %ds\n' $mi $ts) + elif [ $tts -lt 60 ];then + out=$(printf '%ds\n' $ts) + fi + + export psvar[1]="took $(printf '%s ' "$out")" + echo $psvar[1] > $PROMPT_TMP_DIR + fi + + unset timer + unset ts + unset tts + unset mi + unset ho +fi +} + +_command_ro_precmd() { +if ! [ -w $(pwd) ];then + echo " " +fi +} + +preexec_functions+=(_command_time_preexec) +precmd_functions+=(_command_time_precmd) + +blue="14" +red="9" +white="15" +setopt PROMPT_SUBST +export PROMPT='%(?.%F{$blue}.%F{$red})%B%3~%(!. %F{$red}as root %f. )%F{$white}$(if [ -n $PROMPT_TMP_DIR ];then cat $PROMPT_TMP_DIR 2>/dev/null; rm $PROMPT_TMP_DIR 2>/dev/null;fi)%f%(?.%F{$blue}.%F{$red})%F{$red}$(_command_ro_precmd)%F{$blue}❯ %b%f' +export RPROMPT='' + +#%(2V.%F{$red}%2v%f$(export psvar[2]="") .) + +# TODO:: +# Add git support diff --git a/hm/soispha/conf/zsh/default.nix b/hm/soispha/conf/zsh/default.nix new file mode 100644 index 00000000..11011977 --- /dev/null +++ b/hm/soispha/conf/zsh/default.nix @@ -0,0 +1,139 @@ +{ + config, + pkgs, + lib, + shell_library, + system, + osConfig, + ... +}: { + # TODO: ADD THIS ADDON + # next one only works if your alias is only a command, e.g. if you `alias='cat some_file.txt &2> /dev/null'`, running `cat some_file.txt` won't trigger it. + # TODO: find something better for this use case + # zsh-you-should-use # ZSH plugin that reminds you to use existing aliases for commands you just typed + home.sessionPath = []; + programs.zsh = { + enable = true; + enableAutosuggestions = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + + autocd = true; + + dotDir = ".config/zsh"; + + history = { + extended = true; + ignoreDups = false; + expireDuplicatesFirst = false; + ignoreSpace = false; # TODO: I might change that + + path = "${config.xdg.dataHome}/zsh/history"; + save = 9000000; # number of lines to save + size = 9000000; # number of lines to keep + share = false; # share between sessions + }; + historySubstringSearch = { + enable = true; + searchDownKey = "^[[B"; # DOWN Arrow key + searchUpKey = "^[[A"; # UP Arrow key + }; + + loginExtra = + '' + eval $(ssh-agent -s) > /dev/null # start ssh agent + '' + + lib.concatStringsSep "\nsetopt " [ + "setopt AUTO_CD" # This is needed as first item + "AUTO_PUSHD" + "CHASE_DOTS" + + "ALWAYS_TO_END" + + "EXTENDED_HISTORY" + "HIST_ALLOW_CLOBBER" + "HIST_VERIFY" + "HIST_FCNTL_LOCK" + "APPEND_HISTORY" + + "DVORAK" + "CORRECT" + + "PROMPT_SUBST" + "TRANSIENT_RPROMPT" # maybe? + + "COMBINING_CHARS" + "VI" + ]; + + initExtraFirst = + builtins.readFile ./config/zsh-init.sh + + builtins.readFile ./config/zsh-prompt.sh + + builtins.readFile ./config/custom_cursor.sh + + builtins.readFile "${pkgs.fzf}/share/fzf/key-bindings.zsh" + + "SHELL_LIBRARY_VERSION=\"1.1.4\" source ${shell_library.rawLib.${system}}"; + shellAliases = { + ll = ". ll"; + hisea = "history 0 | grep"; + }; + sessionVariables = { + EDITOR = "nvim"; + IVIEWER = "imv"; + READER = "zathura"; + VISUAL = "nvim"; + CODEEDITOR = "nvim"; + TERMINAL = "alacritty"; + BROWSER = "firefox"; + COLORTERM = "truecolor"; + PAGER = "less -R"; + WM = "river"; + WALLPAPER = "${config.home.homeDirectory}/media/pictures/wallpaper"; + + # FUNCNEST for more functions in functions + #FUNCNEST = "2000"; + + WALLPAPERDIR = "$HOME/media/pictures/wallpapers/"; + LESS = "R"; + MANPAGER = "less -R --use-color -Dd+r -Du+b"; + LIBVIRT_DEFAULT_URI = "qemu:///system"; + + BEMENU_SCALE = "1.5"; + BEMENU_BACKEND = "wayland"; + BEMENU_OPTS = "--fn 'Source Code Pro 10' -c -l 30 -B 1 -W 0.9 --hf #ffffff"; + + MPD_HOST = "/run/user/${builtins.toString osConfig.users.users.soispha.uid}/mpd/socket"; + + # Clean the home dir {{{ + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + + #_JAVA_OPTIONS = lib.concatStringsSep " " [ + # ''-Djava.util.prefs.userRoot="${config.xdg.configHome}/java"'' + # ''-Djavafx.cachedir="${config.xdg.cacheHome}/openjfx"'' + # ]; + #GRADLE_USER_HOME = "${config.xdg.dataHome}/gradle"; + #GOPATH = "${config.xdg.dataHome}/go"; + #GTK2_RC_FILES = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + #LESSHISFILE = "${config.xdg.cacheHome}/less/history"; + #LESSKEYIN = "${config.xdg.configHome}/less/lesskey"; + #RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; + #NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc"; + #NUGET_PACKAGES = "${config.xdg.cacheHome}/NuGetPackages"; + #PYTHONSTARTUP = "${config.xdg.configHome}/python/pythonrc"; + #XAUTHORITY = "${config.xdg.stateHome}/Xauthority"; + #COMPDUMPFILE = "${config.xdg.dataHome}/zsh/.zcompdump}"; + #IPYTHONDIR = "${config.xdg.configHome}/ipython"; + #PARALLEL_HOME = "${config.xdg.configHome}/parallel"; + #STACK_XDG = "1"; + #WINEPREFIX = "${config.xdg.dataHome}/wine"; + # }}} + + # Export Wayland env Vars {{{ + QT_QPA_PLATFORM = "wayland"; + QT_QPA_PLATFORMTHEME = "qt5ct"; # needs qt5ct + CLUTTER_BACKEND = "wayland"; + SDL_VIDEODRIVER = "wayland"; # might brake some things + MOZ_ENABLE_WAYLAND = "1"; + # }}} + }; + }; +} diff --git a/hm/soispha/default.nix b/hm/soispha/default.nix new file mode 100644 index 00000000..b6a00038 --- /dev/null +++ b/hm/soispha/default.nix @@ -0,0 +1,61 @@ +{ + impermanence, + nixNeovim, + nixVim, + ... +}: let + # TODO: actually use this in the user config + username = "soispha"; + homeDirectory = "/home/${username}"; + + # xdg + configHome = "${homeDirectory}/.config"; + dataHome = "${homeDirectory}/.local/share"; + stateHome = "${homeDirectory}/.local/state"; + cacheHome = "${homeDirectory}/.cache"; + binHome = "${homeDirectory}/.local/bin"; + # TODO: add XDG_RUNTIME_DIR +in { + imports = [ + ./conf + ./files + ./impermanence + ./pkgs + ./wms + + impermanence.nixosModules.home-manager.impermanence + nixNeovim.nixosModules.default + nixVim.homeManagerModules.nixvim + ]; + + # I don't know what this does, but I've seen it a lot online, so it should be good, right? + programs.home-manager.enable = true; + + home = { + inherit username homeDirectory; + stateVersion = "23.05"; + enableNixpkgsReleaseCheck = true; + }; + xdg = { + inherit configHome dataHome stateHome cacheHome; #binHome; # TODO: add binHome, when the standart is extended + enable = true; + + /* + TODO: add this + desktopEntries = {}; + */ + + userDirs = { + enable = true; + createDirectories = true; + desktop = null; + documents = "${homeDirectory}/school/general"; + download = "${homeDirectory}/media/downloads"; + music = "${homeDirectory}/media/music"; + pictures = "${homeDirectory}/media/pictures"; + videos = "${homeDirectory}/media/videos"; + templates = "${homeDirectory}/media/templates"; + publicShare = "${homeDirectory}/media/public"; + }; + }; +} diff --git a/hm/soispha/files/default.nix b/hm/soispha/files/default.nix new file mode 100644 index 00000000..4e16077c --- /dev/null +++ b/hm/soispha/files/default.nix @@ -0,0 +1,5 @@ +{config, ...}: { + imports = [ + ./wallpaper + ]; +} diff --git a/hm/soispha/files/wallpaper/abstract-nord.png b/hm/soispha/files/wallpaper/abstract-nord.png new file mode 100644 index 00000000..5ef498bf --- /dev/null +++ b/hm/soispha/files/wallpaper/abstract-nord.png Binary files differdiff --git a/hm/soispha/files/wallpaper/default.nix b/hm/soispha/files/wallpaper/default.nix new file mode 100644 index 00000000..2c9b3368 --- /dev/null +++ b/hm/soispha/files/wallpaper/default.nix @@ -0,0 +1,8 @@ +{config, ...}: { + home.file = { + wallpaper = { + source = ./abstract-nord.png; + target = "media/pictures/wallpaper"; + }; + }; +} diff --git a/hm/soispha/impermanence/default.nix b/hm/soispha/impermanence/default.nix new file mode 100644 index 00000000..d0cd1ff1 --- /dev/null +++ b/hm/soispha/impermanence/default.nix @@ -0,0 +1,31 @@ +{ + lib, + nixosConfig, + ... +}: { + config = lib.mkIf nixosConfig.soispha.impermanence.enable { + home.persistence."/srv/home/soispha" = { + allowOther = true; + directories = [ + ".local/share" + + ".local/state/nvim" + ".local/state/wireplumber" + + ".config/Signal" + ".config/Element" + ".config/iamb/profiles" + + ".cache" + ".mozilla" + + "media" + "repos" + "school" + ]; + files = [ + ".local/state/lesshst" + ]; + }; + }; +} diff --git a/hm/soispha/pkgs/default.nix b/hm/soispha/pkgs/default.nix new file mode 100644 index 00000000..c8135d21 --- /dev/null +++ b/hm/soispha/pkgs/default.nix @@ -0,0 +1,164 @@ +{ + pkgs, + sysLib, + grades, + snap-sync, + system, + flake_update, + ... +}: +with pkgs; let + snap-sync-pkgs = pkgs.writeShellScriptBin "snap-sync" (builtins.readFile "${snap-sync}/bin/snap-sync"); + shell-scripts = (import ./scripts.nix) {inherit pkgs sysLib;}; + + Gui = { + Terminals = [ + # foot # wayland native terminal + alacritty # default terminal + ]; + Browsers = [ + #ungoogled-chromium # web browser (only for web programming) + #brave + ]; + + ImageManipulation = [ + #krita # new, and better (KDE) + #gimp # conservative, and old (GNOME) + ]; + + Social = [ + mumble # voice chat software (client) + lutris # multiple game store clients + + # nheko # best matrix client (as of today) + # element-desktop # nheko didn't work + signal-desktop # to avoid encryption problems with signal-bridge + ]; + + Misc = [ + #kalzium # Periodic Table of Elements (`element` is [sort of] better) + keepassxc # password manager + #onlykey # OnlyKey Chrome Desktop App + anki-bin # spaced repetition + ]; + }; + + TuiCli = { + EyeCandy = [ + #banner # Print large banners to ASCII terminals + cmatrix # A curses-based scrolling 'Matrix'-like screen + hyfetch # Neofetch with LGBTQ pride flags. + ]; + + Social = [ + iamb # best tui matrix client (as of today) + ]; + + Misc = [ + android-file-transfer # Android MTP client with minimalistic UI + #xdg-ninja # A shell script which checks your $HOME for unwanted files and directories. + xdg-utils # open urls and such things + yokadi # Command line oriented, sqlite powered, todo list + killall # kill a application by name + ]; + + WM = { + river = [river]; # A dynamic tiling wayland compositor + + CLITools = [ + lswt # List Wayland toplevels + wl-clipboard # Command-line copy/paste utilities + swaylock # lockscreen + ]; + + Media = [ + wf-recorder # Screen recorder + ]; + }; + + Media = { + View = [ + imv # Image viewer + ]; + + Listen = [ + pulseaudio # set the volume with pactl + ncmpc # mpd player client + mpc-cli # a cli mpd client + ]; + }; + + Hardware = { + Storage = [ + #compsize # Calculate compression ratio of a set of files on Btrfs + # TODO: smartmontools # Control and monitor S.M.A.R.T. enabled ATA and SCSI Hard Drives + ]; + + Input = [ + #piper # GTK application to configure gaming mice + ]; + + Printer = [ + # TODO: sane-airscan # SANE - SANE backend for AirScan (eSCL) and WSD document scanners + ]; + }; + + FileListers = [ + tree # A directory listing program displaying a depth indented list of files + fd # Simple, fast and user-friendly alternative to find + ripgrep # A search tool that combines the usability of ag with the raw speed of grep + fzf # used to quickly move around with its keybindings + ]; + + Editors = [ + ed # A POSIX-compliant line-oriented text editor + #sed # GNU stream editor + vim # The original ex/vi text editor (this is `vim` and not `vi`, as `vi` is unfree) + #neovim # Fork of Vim aiming to improve user experience, plugins, and GUIs + ]; + + Programming = { + GeneralTools = [ + git # the fast distributed version control system + git-crypt # mostly here to avoid problems in repositories, where the flake can't be loaded + glow # Command-line markdown renderer + ]; + }; + }; + # TODO: unmaintained, find sth else: + # handlr # Powerful alternative to xdg-utils written in Rust + mapFun = x: + if builtins.isAttrs x + then + if lib.isDerivation x + then [x] + else builtins.attrValues x + else [x]; +in { + home.packages = + [ + snap-sync-pkgs + flake_update.outputs.packages.${system}.default + grades.outputs.packages.${system}.default + ] + ++ shell-scripts + ++ (with builtins; + concatLists + (concatLists [ + (concatMap mapFun + (concatMap mapFun + (concatMap mapFun + (concatMap mapFun + (concatMap mapFun + (concatMap mapFun + (attrValues Gui))))))) + + (concatMap mapFun + (concatMap mapFun + (concatMap mapFun + (concatMap mapFun + (concatMap mapFun + (concatMap mapFun + (attrValues TuiCli))))))) + ])); +} diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix new file mode 100644 index 00000000..544975c5 --- /dev/null +++ b/hm/soispha/pkgs/scripts.nix @@ -0,0 +1,97 @@ +{ + pkgs, + sysLib, + ... +}: let + write_script = { + name, + path, + dependencies, + }: + sysLib.writeShellScriptWithLibrary { + inherit name; + src = ./scripts/${path}/${name}; + dependencies = dependencies ++ [pkgs.dash]; + }; + aumo-scr = write_script { + name = "aumo"; + path = "apps"; + dependencies = builtins.attrValues {inherit (pkgs) udisks gawk gnused gnugrep sudo;}; + }; + con2pdf-scr = write_script { + name = "con2pdf"; + path = "apps"; + dependencies = builtins.attrValues {inherit (pkgs) sane-backends imagemagick coreutils fd;}; + }; + + dldragon-scr = write_script { + name = "dldragon"; + path = "small_functions"; + dependencies = builtins.attrValues {inherit (pkgs) curl xdragon;}; + }; + gtk-themes-scr = write_script { + name = "gtk-themes"; + path = "small_functions"; + dependencies = builtins.attrValues {inherit (pkgs) glib;}; + }; + screen_shot-scr = write_script { + name = "screen_shot"; + path = "small_functions"; + dependencies = builtins.attrValues {inherit (pkgs) grim slurp alacritty;}; # TODO: add llp + }; + mocs-scr = write_script { + name = "mocs"; + path = "small_functions"; + dependencies = builtins.attrValues {inherit (pkgs) ncmpc procps;}; # TODO: add mymocp + }; + update-sys-scr = write_script { + name = "update-sys"; + path = "small_functions"; + dependencies = builtins.attrValues {inherit (pkgs) git git-crypt nixos-rebuild sudo openssh coreutils mktemp gnugrep gnused;}; + }; + + backsnap-scr = write_script { + name = "backsnap"; + path = "wrappers"; + dependencies = builtins.attrValues {}; # TODO: add snap-sync + }; + ll-scr = sysLib.writeShellScriptWithLibraryUnwrapped { + name = "ll"; + src = ./scripts/wrappers/ll; + }; + # TODO: this need to be replaced with a wayland alternative + # llp-scr = write_script { + # name = "llp"; + # path = "wrappers"; + # dependencies = builtins.attrValues {inherit (pkgs) lf ueberzug;}; + # }; + spodi-scr = write_script { + name = "spodi"; + path = "wrappers"; + dependencies = builtins.attrValues {inherit (pkgs) gawk expect spotdl fd coreutils;}; + }; + virsh-del-scr = write_script { + name = "virsh-del"; + path = "wrappers"; + dependencies = builtins.attrValues {inherit (pkgs) libvirt;}; + }; + yti-scr = write_script { + name = "yti"; + path = "wrappers"; + dependencies = builtins.attrValues {inherit (pkgs) gawk expect yt-dlp;}; + }; +in [ + aumo-scr + con2pdf-scr + dldragon-scr + gtk-themes-scr + screen_shot-scr + mocs-scr + update-sys-scr + backsnap-scr + ll-scr + # llp-scr # TODO: see above + spodi-scr + virsh-del-scr + yti-scr +] diff --git a/hm/soispha/pkgs/scripts/apps/aumo b/hm/soispha/pkgs/scripts/apps/aumo new file mode 100755 index 00000000..e49ac82d --- /dev/null +++ b/hm/soispha/pkgs/scripts/apps/aumo @@ -0,0 +1,54 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +# TODO: rewrite this + +if [ "$1" = "-u" ];then udisksctl unmount -b "$(cat "$HOME/.cache/aumo/mnt_disk")"; exit 0; fi +all_available_disks=$(mktemp) +awk '{print $4}' /proc/partitions | sed '1 s|.*||' > "$all_available_disks" + +mounted_disk=$(mktemp) +awk '{print $1}' /proc/mounts > "$mounted_disk" + +unmounted_disks=$(mktemp) + +for i in $(cat $all_available_disks);do + if ! grep -qw "/dev/$i" $mounted_disk && ! ls /sys/block/$i/*/partition > /dev/null 2> /dev/null;then echo $i >> $unmounted_disks;fi +done + + +u=1 +disk=-1 +while [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}') ];do + + [ "$1" = "-v" ] && for i in $(cat $unmounted_disks);do + sudo fdisk -l "/dev/$i" + done + + for i in $(cat $unmounted_disks);do + printf "%4s) %s\n" "$u" "$i" + u=$(( u + 1 )) + done + + printf "%4s) Exit\n" "0" + printf "Input number: " + read -r disk + + [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}') ] && printf "Wrong number. Please retry\n" + [ $disk -eq 0 ] && exit 0 +done + +mnt_disk="/dev/$(awk -v n=$disk 'NR==n' $unmounted_disks)" + +if ! [ "$1" = "-v" ] && [ -n "$1" ];then sudo mount "$mnt_disk" "$1" && exit 0;fi +[ -n "$2" ] && sudo mount "$mnt_disk" "$1" && exit 0 +if mount | grep -q ~/mnt ;then dien "Something is mounted at ~/mnt";else udisksctl mount -b "$mnt_disk";fi + +[ -e $HOME/.cache/aumo/mnt_disk ] || mkdir -p $HOME/.cache/aumo +echo $mnt_disk >> $HOME/.cache/aumo/mnt_disk +rm $all_available_disks +rm $mounted_disk +rm $unmounted_disks +[ -d /tmp/LIB_FILE_TEMP_DIR/ ] && rm -r /tmp/LIB_FILE_TEMP_DIR/ diff --git a/hm/soispha/pkgs/scripts/apps/con2pdf b/hm/soispha/pkgs/scripts/apps/con2pdf new file mode 100755 index 00000000..9cadc376 --- /dev/null +++ b/hm/soispha/pkgs/scripts/apps/con2pdf @@ -0,0 +1,152 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + + +# needed for help() and version +# shellcheck disable=2034 +AUTHORS="Soispha"; +# shellcheck disable=2034 +YEARS="2023"; +# shellcheck disable=2034 +VERSION="1.0.0"; + +help() { +cat << EOF +Scan images and turn them into a pdf. + +Usage: + $NAME [--help|--version|--out-dir|--num-pages|--method] --name --device + +Options: + --out-dir | -o + Path to place the generated pdf files (default: ./pdf). + --name | -n + Name for the pdf files (e.g. "\$name"_1.pdf). + --num-pages | -p + Number of pages to merge into one pdf (default: 1). + --device | -d + Device used for scanning. + --method | -m + Method to use for scanning (default: ADF). + --help | -h + Display this help and exit. + --version | -v + Display version and copyright information and exit. +EOF +} + +scan() { + number_of_pages="$1"; + device="$2"; + output_directory="$3"; + name="$4"; + method="$5"; + + [ -z "$number_of_pages" ] && die "Parameter 'number_of_pages' is not set!" + [ -z "$device" ] && die "Parameter 'device' is not set!" + [ -z "$output_directory" ] && die "Parameter 'output_directory' is not set!" + [ -z "$name" ] && die "Parameter 'name' is not set!" + [ -z "$method" ] && die "Parameter 'method' is not set!" + + tiff_temp_path="$(mktmp -d)"; + cd "$tiff_temp_path" || die "Bug" + + msg "Started scanning..."; + if [ "$method" = "Flatbed" ]; then + do_until_success \ + "scanimage --format=tiff --progress --source='$method' --device='$device' --output-file=1.tiff" \ + "warn 'Retrying scan, as we assume a network error!'" + else + for i in $(seq "$number_of_pages");do + do_until_success \ + "scanimage --format=tiff --progress --source='$method' --device='$device' --batch=%d.tif --batch-increment='$number_of_pages' --batch-start='$i'" \ + "warn 'Retrying scan, as we assume a network error!'" + + + if [ "$number_of_pages" -ne 1 ];then + msg "Finished turn, please change side!"; + readp "Press enter to continue" noop + fi + done + fi + + msg "Creating output directory..."; + mkdir "$output_directory"; + cd "$output_directory" || die "Bug" + + counter=0; + msg "Converting images to pdfs..."; + while read -r scanned_image_a;do + if [ "$number_of_pages" -ne 1 ];then + scanned_image_b_set=false; + if [ -z "$scanned_image_b" ];then + scanned_image_b="$i" + scanned_image_b_set=true; + : $((counter += 1)) + fi + + if [ -n "$scanned_image_a" ] && [ "$scanned_image_b_set" = false ];then + convert "$scanned_image_b" "$scanned_image_a" -compress jpeg -quality 100 "$name"_"$counter".pdf + fi + else + : $((counter += 1)) + convert "$scanned_image_a" -compress jpeg -quality 100 "$name"_"$counter".pdf + fi + + done < "$(tmp "fd . '$tiff_temp_path' | sort -n")" +} + +for input in "$@"; do + case "$input" in + "--help" | "-h") + help; + exit 0; + ;; + "--version" | "-v") + version; + exit 0; + ;; + esac +done + +number_of_pages="1"; +unset device; +output_directory="$(pwd)/pdf"; +unset name; +method="ADF"; + +while [ "$#" -ne 0 ]; do + case "$1" in + "--help" | "-h") + ;; + "--version" | "-v") + ;; + "--out-dir" | "-o") + shift 1; + output_directory="$1"; + ;; + "--name" | "-n") + shift 1; + name="$1"; + ;; + "--num-pages" | "-p") + shift 1; + number_of_pages="$1"; + ;; + "--device" | "-d") + shift 1; + device="$1"; + ;; + "--method" | "-m") + shift 1; + method="$1"; + ;; + *) + die "Command line arg $1 does not exist. See --help for a list."; + ;; + esac + shift 1; +done +scan "$number_of_pages" "$device" "$output_directory" "$name" "$method"; diff --git a/hm/soispha/pkgs/scripts/small_functions/dldragon b/hm/soispha/pkgs/scripts/small_functions/dldragon new file mode 100755 index 00000000..ea75c362 --- /dev/null +++ b/hm/soispha/pkgs/scripts/small_functions/dldragon @@ -0,0 +1,28 @@ +#! /usr/bin/env dash +# Provides the ability to download a file by dropping it into a window + +url=$(dragon -t -x) + +if [ -n "$url" ]; then + printf "File Name: " + name="" + while [ -z $name ] || [ -e $name ] + do + read -r name + if [ -e "$name" ]; then + printf "File already exists, overwrite (y|n): " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + printf "File Name: " + fi + fi + done + + # Download the file with curl + [ -n "$name" ] && curl -o "$name" "$url" || exit 1 +else + exit 1 +fi diff --git a/hm/soispha/pkgs/scripts/small_functions/gtk-themes b/hm/soispha/pkgs/scripts/small_functions/gtk-themes new file mode 100755 index 00000000..457bc35a --- /dev/null +++ b/hm/soispha/pkgs/scripts/small_functions/gtk-themes @@ -0,0 +1,21 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + + +# TODO: document, what this does + +# usage: import-gsettings +config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" +if [ ! -f "$config" ]; then exit 1; fi + +gnome_schema="org.gnome.desktop.interface" +gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')" +icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')" +cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')" +font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')" +gsettings set "$gnome_schema" gtk-theme "$gtk_theme" +gsettings set "$gnome_schema" icon-theme "$icon_theme" +gsettings set "$gnome_schema" cursor-theme "$cursor_theme" +gsettings set "$gnome_schema" font-name "$font_name" diff --git a/hm/soispha/pkgs/scripts/small_functions/mocs b/hm/soispha/pkgs/scripts/small_functions/mocs new file mode 100755 index 00000000..e14a84c8 --- /dev/null +++ b/hm/soispha/pkgs/scripts/small_functions/mocs @@ -0,0 +1,15 @@ +#! /bin/bash +if [[ "$(pgrep mocp)" -eq 0 ]]; +then + mocp -M "${XDG_CONFIG_HOME}"/moc -S + if [[ $1 -eq 0 ]]; + then + mocp -M "${XDG_CONFIG_HOME}"/moc -v 12 + else + mocp -M "${XDG_CONFIG_HOME}"/moc -v "$1" + fi + mocp -M "${XDG_CONFIG_HOME}"/moc -p + mymocp& +else + mocp -M "${XDG_CONFIG_HOME}"/moc -G +fi diff --git a/hm/soispha/pkgs/scripts/small_functions/screen_shot b/hm/soispha/pkgs/scripts/small_functions/screen_shot new file mode 100755 index 00000000..73eb2ee4 --- /dev/null +++ b/hm/soispha/pkgs/scripts/small_functions/screen_shot @@ -0,0 +1,10 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +date="$(date +%s)" +grim -g "$(slurp)" "$HOME/media/pictures/screenshots/$date.png" && + alacritty -e ll -command ":{{ set sortby atime; set reverse!; }}" "$HOME/media/pictures/screenshots/$date.png" + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/small_functions/update-sys b/hm/soispha/pkgs/scripts/small_functions/update-sys new file mode 100755 index 00000000..355682d1 --- /dev/null +++ b/hm/soispha/pkgs/scripts/small_functions/update-sys @@ -0,0 +1,78 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +help() { + cat << EOF +This is a NixOS System flake update manager. + +Usage: + $NAME [--branch <branchname>] [--help] + +Options: + --branch | -b BRANCHNAME + select a branch to update from. + --mode | -m MODE + select a mode to update with + --help | -h + output this help. +EOF + exit "$1"; +} +default_branch=$(mktmp); +BRANCH=""; + +while [ "$#" -gt 0 ];do + case "$1" in + "--help" | "-h") + help 0; + ;; + "--branch" | "-b") + if [ -n "$2" ];then + BRANCH="$2"; + else + error "$1 requires an argument"; + help 1; + fi + shift 2; + ;; + "--mode" | "-m") + if [ -n "$2" ];then + MODE="$2"; + else + error "$1 requires an argument"; + help 1; + fi + shift 2; + ;; + *) + error "the option $1 does not exist!"; + help 1; + ;; + esac +done + + +cd /etc/nixos || die "No /etc/nixos"; +msg "Starting system update..."; +git remote update origin --prune > /dev/null 2>&1; +if ! [ "$BRANCH" = "" ];then + git switch "$BRANCH" > /dev/null 2>&1 && msg2 "Switched to branch '$BRANCH'"; +fi +msg2 "Updating git repository..."; +git pull --rebase; + +git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > "$default_branch" & + +msg2 "Updating system..."; +if [ -n "$MODE" ]; then + nixos-rebuild "$MODE"; +else + nixos-rebuild switch; +fi + +git switch "$(cat "$default_branch")" > /dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'"; +msg "Finished Update!"; + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/backsnap b/hm/soispha/pkgs/scripts/wrappers/backsnap new file mode 100755 index 00000000..cd08045d --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/backsnap @@ -0,0 +1,3 @@ +#! /usr/bin/env dash +snap-sync --noconfirm -u d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0 +umount /run/dt/d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0 diff --git a/hm/soispha/pkgs/scripts/wrappers/ll b/hm/soispha/pkgs/scripts/wrappers/ll new file mode 100755 index 00000000..cb1fc0ea --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/ll @@ -0,0 +1,14 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +last_directory="$(mktemp)" + +command lf -last-dir-path="$last_directory" "$@" + +dir="$(cat "$last_directory")" +cd "$dir" || die "$dir does not exist!" +rm "$last_directory" + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/llp b/hm/soispha/pkgs/scripts/wrappers/llp new file mode 100755 index 00000000..2a21450c --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/llp @@ -0,0 +1,19 @@ +#! /bin/bash + +export LLP=1 +cleanup() { + exec 3>&- + rm "$FIFO_UEBERZUG" +} + +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup EXIT + lf "$@" 3>&- +fi diff --git a/hm/soispha/pkgs/scripts/wrappers/spodi b/hm/soispha/pkgs/scripts/wrappers/spodi new file mode 100755 index 00000000..4ff53bff --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/spodi @@ -0,0 +1,45 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +DOWN_DIR="/home/soispha/media/music/down"; + +download_url="$1"; + + + +already_downloaded_files="$(mktmp)" +fd . "$DOWN_DIR" --exclude spotdl.log > "$already_downloaded_files"; + +config="$(mktmp)" +cat << EO > "$config" +--log-level INFO +--cache-path /home/soispha/.local/share/spotdl/.spotipy +--audio youtube-music youtube +--lyrics genius musixmatch azlyrics +--ffmpeg ffmpeg +--format mp3 +--output {artists}_-_{title} +--overwrite skip +--client-id 5f573c9620494bae87890c0f08a60293 +--client-secret 212476d9b0f3472eaa762d90b19b0ba8 +--threads 16 +--print-errors +--preload +EO + +if [ -z "$NO_CHECK" ] && [ "$(wc -l < "$already_downloaded_files" )" -ne 0 ];then + die "something is already downloaded" +fi + +rm "$DOWN_DIR/spotdl.log" +cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" + + +# The sub shell needs to be unquoted, as the arguments may not be treated as one. +# shellcheck disable=2046 +unbuffer spotdl $(cat "$config") download "$download_url" | tee "$DOWN_DIR/spotdl.log" + +[ -d ~/.spotdl ] && rm -r ~/.spotdl +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/virsh-del b/hm/soispha/pkgs/scripts/wrappers/virsh-del new file mode 100755 index 00000000..afcd87c1 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/virsh-del @@ -0,0 +1,10 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +virsh destroy "$1" +virsh undefine "$1" --nvram +virsh vol-delete --pool default "$1".qcow2 + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/yti b/hm/soispha/pkgs/scripts/wrappers/yti new file mode 100755 index 00000000..0b737b30 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/yti @@ -0,0 +1,36 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +die "Use spodi instead!" # TODO: fix this script +DOWN_DIR=/home/soispha/media/playlist/down/ + + +tmp=$(mktmp) +config=$(mktmp) + +for e in "$DOWN_DIR"/*.mp3;do echo "$e" >> "$tmp";done +[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" + +cat << EO > "$config" +--paths home:"$DOWN_DIR" +#--output %(fulltitle) +--restrict-filenames +--no-overwrites +--no-write-info-json +--clean-info-json +--prefer-free-formats +#--format mp3 +--extract-audio +--audio-quality 0 +--audio-format best +EO + + +rm ${DOWN_DIR}yt-dlp.log +cd $DOWN_DIR || die "BUG: no $DOWN_DIR" + +unbuffer yt-dlp --config-location "$config" "$1" | tee $DOWN_DIR/yt-dlp.log + +# vim: ft=sh diff --git a/hm/soispha/wms/default.nix b/hm/soispha/wms/default.nix new file mode 100644 index 00000000..610ea2f4 --- /dev/null +++ b/hm/soispha/wms/default.nix @@ -0,0 +1,7 @@ +{config, ...}: { + imports = [ + # ./sway + ./river + # ./plasma + ]; +} diff --git a/hm/soispha/wms/plasma/default.nix b/hm/soispha/wms/plasma/default.nix new file mode 100644 index 00000000..f68ee272 --- /dev/null +++ b/hm/soispha/wms/plasma/default.nix @@ -0,0 +1,5 @@ +{config, ...}: { + services.xserver.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; +} diff --git a/hm/soispha/wms/river/default.nix b/hm/soispha/wms/river/default.nix new file mode 100644 index 00000000..d8bc4009 --- /dev/null +++ b/hm/soispha/wms/river/default.nix @@ -0,0 +1,68 @@ +{ + pkgs, + sysLib, + river_init_lesser, + nixosConfig, + system, + ... +}: let + inherit (nixosConfig.networking) hostName; + mappings = + if hostName == "tiamat" + then '' + err_fail riverctl keyboard-layout 'us' + err_fail river_init_lesser ~/.config/river/res/moonlander.ron + '' + else if hostName == "lahmu" || hostName == "apzu" || hostName == "mammun" || hostName == "isimud" + then '' + err_fail riverctl keyboard-layout 'us(dvorak)' + err_fail river_init_lesser ~/.config/river/res/keys.ron + '' + else builtins.throw "Host not covered in river mappings"; + screen_setup = + if hostName == "lahmu" + then '' + err_fail wlr-randr --output Virtual-1 --mode 1920x1080 + '' + else if hostName == "tiamat" + then '' + err_fail wlr-randr --output DP-2 --pos 2560,0 + err_fail wlr-randr --output DP-1 --scale 1.5 --pos 0,0 + err_fail gammastep & + '' + else if hostName == "apzu" || hostName == "mammun" || hostName == "isimud" + then '' + err_fail gammastep & + '' + else builtins.throw "Host not covered in river screen setup"; + init_scr = pkgs.substituteAll { + src = ./init; + inherit mappings screen_setup; + }; +in { + xdg.configFile."river/init".source = + sysLib.writeShellScriptWithLibraryAndKeepPath { + name = "river_init"; + src = init_scr; + dependencies = builtins.attrValues { + river_init_lesser = river_init_lesser.packages.${system}.default; + inherit + (pkgs) + dash + river + glib # gnome lib + gammastep + wlr-randr + yambar + mako + swaybg + swayidle + swaylock + alacritty + ; + }; + } + + /bin/river_init; + + xdg.configFile."river/res".source = ./res; +} diff --git a/hm/soispha/wms/river/init b/hm/soispha/wms/river/init new file mode 100755 index 00000000..599992e6 --- /dev/null +++ b/hm/soispha/wms/river/init @@ -0,0 +1,80 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH + +err_fail() { + if ! "$@";then + warning "\"$*\" failed!\n" >> ~/river_log + # msg "Executing the safe init!" + # exec ~/.config/river/res/safe_init + fi +} +err_fail rm ~/river_log +exec 1>> "$HOME"/river_log +exec 2>> "$HOME"/river_log + +#trap err_fail ERR + +#Setup of environment variables {{{ +err_fail riverctl spawn "exec dbus-update-activation-environment SEATD_SOCK DISPLAY WAYLAND_DISPLAY DESKTOP_SESSION=river XDG_CURRENT_DESKTOP=river" +err_fail export XDG_CURRENT_DESKTOP=river +#}}} + +# Setup of mappings {{{ +@mappings@ +# }}} + +# Setup of Rules {{{ +err_fail riverctl float-filter-add app-id float +err_fail riverctl float-filter-add app-id mpv +err_fail riverctl float-filter-add app-id ModernGL +err_fail riverctl float-filter-add title "Manim Slides" + +err_fail riverctl csd-filter-add app-id firefox +# }}} + +# Set riverctl settings {{{ +# background +err_fail riverctl background-color 0x002b36 +err_fail riverctl border-color-focused 0x93a1a1 +err_fail riverctl border-color-unfocused 0x586e75 + +# keyboard repeat rate +err_fail riverctl set-repeat 50 300 + +# Cursor +err_fail riverctl focus-follows-cursor normal +#riverctl hide-cursor timeout 2000 +err_fail riverctl hide-cursor when-typing enabled +err_fail riverctl set-cursor-warp on-output-change +err_fail riverctl xcursor-theme Nordzy-cursors 24 + +err_fail riverctl input pointer-1133-49970-Logitech_Gaming_Mouse_G502 pointer-accel 0 +err_fail riverctl input pointer-1133-49970-Logitech_Gaming_Mouse_G502 accel-profile none + +err_fail riverctl input pointer-12951-6505-ZSA_Technology_Labs_Moonlander_Mark_I pointer-accel 0 +err_fail riverctl input pointer-12951-6505-ZSA_Technology_Labs_Moonlander_Mark_I accel-profile none +# }}} + +# Setup of general apps {{{ +@screen_setup@ + +err_fail yambar & + +err_fail mako & +err_fail swaybg -i "$WALLPAPER" & +err_fail swayidle & +err_fail alacritty & +# }}} + + + +# Setup of layout [acts as exec!] {{{ +err_fail riverctl default-layout rivertile +err_fail rivertile -main-ratio 0.5 -view-padding 1 -outer-padding 0 + +#riverctl default-layout luatile +#river-luatile +# }}} +# vim: ft=sh diff --git a/hm/soispha/wms/river/res/keys.ron b/hm/soispha/wms/river/res/keys.ron new file mode 100644 index 00000000..a4ad6988 --- /dev/null +++ b/hm/soispha/wms/river/res/keys.ron @@ -0,0 +1,57 @@ +#![enable(implicit_some)] +RiverctlCommandArray( + commands: [ + // Focus change + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "T", mods: "Super", command: "focus-view", command_args: "next",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "N", mods: "Super", command: "focus-view", command_args: "previous",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "T", mods: "Super+Control", command: "focus-output", command_args: "next",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "N", mods: "Super+Control", command: "focus-output", command_args: "previous",), + + // Standard program + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "Return", mods: "Super", command: "spawn", command_args: "alacritty",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "q", mods: "Super+Shift", command: "exit", command_args: None,), + + // Screenshot + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "Print", mods: "None", command: "spawn", command_args: "~/repos/shell/scripts/screen_shot",), + + // Audio + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "XF86AudioRaiseVolume", mods: "None", command: "spawn", command_args: "pactl set-sink-volume 1 +5%",), + RiverctlCommand( map_mode: Map, mode: ["normal", "locked"], key: "XF86AudioLowerVolume", mods: "None", command: "spawn", command_args: "~/.local/bin/ytcs",), + RiverctlCommand( map_mode: Map, mode: ["normal", "locked"], key: "XF86AudioMute", mods: "None", command: "spawn", command_args: "~/repos/shell/scripts/mocs",), + + // Launcher + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "R", mods: "Super", command: "spawn", command_args: "bemenu-run",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "F1", mods: "Super", command: "spawn", command_args: "firefox",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "F2", mods: "Super", command: "spawn", command_args: "keepassxc",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "F3", mods: "Super", command: "spawn", command_args: "nheko",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "F4", mods: "Super", command: "spawn", command_args: "steam",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "L", mods: "Super", command: "spawn", command_args: "swaylock -f",), + + // Client + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "f", mods: "Super", command: "toggle-fullscreen", command_args: None,), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "c", mods: "Super+Shift", command: "close", command_args: None,), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "space", mods: "Super+Control", command: "toggle-float", command_args: None,), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "Return", mods: "Super+Control", command: "zoom", command_args: None,), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "o", mods: "Super", command: "send-to-output", command_args: "next",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "T", mods: "Super+Shift", command: "swap", command_args: "next",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "N", mods: "Super+Shift", command: "swap", command_args: "previous",), + + // Toggle all tags + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "0", mods: "Super", command: "set-focused-tags", command_args: "4294967295"), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "0", mods: "Super+Shift", command: "set-view-tags", command_args: "4294967295"), + + // Mouse + RiverctlCommand( map_mode: MapMouse, mode: ["normal"], key: "BTN_LEFT", mods: "Super", command: "move-view", command_args: None,), + RiverctlCommand( map_mode: MapMouse, mode: ["normal"], key: "BTN_RIGHT", mods: "Super", command: "resize-view", command_args: None,), + + ], + // Set these mappings for the tags 0-8 with key [1-9] + tags_number: 9, + tag_commands: [ + RiverctlTagCommand( map_mode: Map, mode: ["normal"], mods: "Super", command: "set-focused-tags",), + RiverctlTagCommand( map_mode: Map, mode: ["normal"], mods: "Super+Shift", command: "set-view-tags",), + RiverctlTagCommand( map_mode: Map, mode: ["normal"], mods: "Super+Control", command: "toggle-focused-tags",), + RiverctlTagCommand( map_mode: Map, mode: ["normal"], mods: "Super+Shift+Control", command: "toggle-view-tags",), + ], +) + diff --git a/hm/soispha/wms/river/res/moonlander.ron b/hm/soispha/wms/river/res/moonlander.ron new file mode 100644 index 00000000..7a0c7298 --- /dev/null +++ b/hm/soispha/wms/river/res/moonlander.ron @@ -0,0 +1,64 @@ +#![enable(implicit_some)] +RiverctlCommandArray( + // TODO: add toggle-focus mapping + commands: [ + // Movement + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "A", mods: "Alt+Control+Super+Shift", command: "exit", command_args: None,), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "B", mods: "Alt+Control+Super+Shift", command: "close", command_args: None,), + + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "C", mods: "Alt+Control+Super+Shift", command: "focus-view", command_args: "previous",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "D", mods: "Alt+Control+Super+Shift", command: "focus-view", command_args: "next",), + + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "E", mods: "Alt+Control+Super+Shift", command: "swap", command_args: "previous",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "F", mods: "Alt+Control+Super+Shift", command: "swap", command_args: "next",), + + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "G", mods: "Alt+Control+Super+Shift", command: "zoom", command_args: None,), + + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "H", mods: "Alt+Control+Super+Shift", command: "toggle-fullscreen", command_args: None,), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "I", mods: "Alt+Control+Super+Shift", command: "toggle-float", command_args: None,), + + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "J", mods: "Alt+Control+Super+Shift", command: "send-to-output", command_args: "next",), + + + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "K", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "alacritty",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "L", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "screen_shot",), + + // Audio + RiverctlCommand( map_mode: Map, mode: ["normal", "locked"], key: "M", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "stop_playing_sound",), + RiverctlCommand( map_mode: Map, mode: ["normal", "locked"], key: "N", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "mpc toggle",), + + // Launcher + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "O", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "bemenu-run",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "P", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "firefox",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "Q", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "keepassxc",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "R", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "nheko",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "S", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "signal-desktop",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "T", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "swaylock -f",), + + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "U", mods: "Alt+Control+Super+Shift", command: "focus-output", command_args: "next",), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "V", mods: "Alt+Control+Super+Shift", command: "focus-previous-tags", command_args: None,), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "W", mods: "Alt+Control+Super+Shift", command: "send-to-previous-tags",command_args: None,), + //RiverctlCommand( map_mode: Map, mode: ["normal"], key: "X", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "bemenu-run",), + //RiverctlCommand( map_mode: Map, mode: ["normal"], key: "Y", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "bemenu-run",), + //RiverctlCommand( map_mode: Map, mode: ["normal"], key: "Z", mods: "Alt+Control+Super+Shift", command: "spawn", command_args: "bemenu-run",), + + + // Toggle all tags + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "0", mods: "Alt+Control+Super+Shift", command: "set-focused-tags", command_args: "4294967295"), + RiverctlCommand( map_mode: Map, mode: ["normal"], key: "0", mods: "Alt+Control+Shift", command: "set-view-tags", command_args: "4294967295"), + + // Mouse + RiverctlCommand( map_mode: MapMouse, mode: ["normal"], key: "BTN_LEFT", mods: "Super", command: "move-view", command_args: None,), + RiverctlCommand( map_mode: MapMouse, mode: ["normal"], key: "BTN_RIGHT", mods: "Super", command: "resize-view", command_args: None,), + ], + + // Set these mappings for the tags 0-8 with key [1-9] + tags_number: 9, + tag_commands: [ + RiverctlTagCommand( map_mode: Map, mode: ["normal"], mods: "Alt+Control+Super+Shift", command: "set-focused-tags",), + RiverctlTagCommand( map_mode: Map, mode: ["normal"], mods: "Alt+Control+Shift", command: "set-view-tags",), + // TODO: RiverctlTagCommand( map_mode: Map, mode: ["normal"], mods: "Super+Control", command: "toggle-focused-tags",), + // TODO: RiverctlTagCommand( map_mode: Map, mode: ["normal"], mods: "Super+Shift+Control", command: "toggle-view-tags",), + ], +) + diff --git a/hm/soispha/wms/river/res/safe_init b/hm/soispha/wms/river/res/safe_init new file mode 100755 index 00000000..8e80026a --- /dev/null +++ b/hm/soispha/wms/river/res/safe_init @@ -0,0 +1,160 @@ +#!/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 Return spawn alacritty + +# Super+Q to close the focused view +riverctl map normal Super Q close + +# Super+Shift+E to exit river +riverctl map normal Super+Shift Q exit + +# Super+J and Super+K to focus the next/previous view in the layout stack +riverctl map normal Super J focus-view next +riverctl map normal Super K focus-view previous + +# Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous +# view in the layout stack +riverctl map normal Super+Shift J swap next +riverctl map normal Super+Shift K 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+L 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 L send-layout-cmd rivertile "main-ratio +0.05" + +# Super+Shift+H and Super+Shift+L 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 L send-layout-cmd rivertile "main-count -1" + +# Super+Alt+{H,J,K,L} to move views +riverctl map normal Super+Alt H move left 100 +riverctl map normal Super+Alt J move down 100 +riverctl map normal Super+Alt K move up 100 +riverctl map normal Super+Alt L move right 100 + +# Super+Alt+Control+{H,J,K,L} to snap views to screen edges +riverctl map normal Super+Alt+Control H snap left +riverctl map normal Super+Alt+Control J snap down +riverctl map normal Super+Alt+Control K snap up +riverctl map normal Super+Alt+Control L snap right + +# Super+Alt+Shift+{H,J,K,L} to resize views +riverctl map normal Super+Alt+Shift H resize horizontal -100 +riverctl map normal Super+Alt+Shift J resize vertical 100 +riverctl map normal Super+Alt+Shift K resize vertical -100 +riverctl map normal Super+Alt+Shift L 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 + +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+Ctrl+[1-9] to toggle focus of tag [0-8] + riverctl map normal Super+Control $i toggle-focused-tags $tags + + # Super+Shift+Ctrl+[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 light (https://github.com/haikarainen/light) + riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5' + riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5' +done + +# Set background and border color +riverctl background-color 0x002b36 +riverctl border-color-focused 0x93a1a1 +riverctl border-color-unfocused 0x586e75 + +# Set keyboard repeat rate +riverctl set-repeat 50 300 + +# Make certain views start floating +riverctl float-filter-add app-id float +riverctl float-filter-add title "popup title with spaces" + +# Set app-ids and titles of views which should use client side decorations +riverctl csd-filter-add app-id "gedit" + +# 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/hm/soispha/wms/sway/default.nix b/hm/soispha/wms/sway/default.nix new file mode 100644 index 00000000..bb3ddb49 --- /dev/null +++ b/hm/soispha/wms/sway/default.nix @@ -0,0 +1,16 @@ +# also requires: +# security.polkit.enable = true; +{lib, ...}: { + wayland.windowManager.sway = { + enable = true; + config = { + modifier = "Mod4"; + # Use kitty as default terminal + terminal = "kitty"; + startup = [ + # Launch Firefox on start + {command = "firefox";} + ]; + }; + }; +} |