summaryrefslogtreecommitdiff
path: root/config/X
diff options
context:
space:
mode:
Diffstat (limited to 'config/X')
-rw-r--r--config/X/alacritty/alacritty.yml939
-rw-r--r--config/X/dunst/dunstrc456
-rw-r--r--config/X/mpv/input.conf204
-rwxr-xr-xconfig/X/mpv/mpv.conf28
-rwxr-xr-xconfig/X/mpv/playfile.txt2
-rw-r--r--config/X/mpv/scripts/script-opts/webm.conf78
-rwxr-xr-xconfig/X/mpv/scripts/script-opts/youtube-quality.conf41
-rw-r--r--config/X/mpv/scripts/webm.lua2914
-rwxr-xr-xconfig/X/mpv/scripts/youtube-quality.lua275
-rw-r--r--config/X/mpv/watch_later/9EDC60703A9785FE514694A824A115632
-rw-r--r--config/X/picom/picom.conf493
-rw-r--r--config/X/picom/picom.conf.bak410
-rw-r--r--config/X/redshift/redshift.conf70
-rw-r--r--config/X/x11/.Xauthoritybin0 -> 52 bytes
-rwxr-xr-xconfig/X/x11/.Xresources155
-rwxr-xr-xconfig/X/x11/xinitrc36
-rw-r--r--config/X/xmobar/scripts/.updates.swpbin0 -> 12288 bytes
-rwxr-xr-xconfig/X/xmobar/scripts/battery13
-rwxr-xr-xconfig/X/xmobar/scripts/checkupds2
-rwxr-xr-xconfig/X/xmobar/scripts/minwinfo5
-rwxr-xr-xconfig/X/xmobar/scripts/whscreen23
-rwxr-xr-xconfig/X/xmobar/scripts/winfo124
-rw-r--r--config/X/xmobar/scripts/winfo_icons15
-rw-r--r--config/X/xmobar/xmobarrc0.hs20
-rw-r--r--config/X/xmobar/xmobarrc1.hs149
-rwxr-xr-xconfig/X/xmonad/autostart/.cyclepaper.sh19
-rwxr-xr-xconfig/X/xmonad/autostart/autostart.sh10
-rwxr-xr-xconfig/X/xmonad/autostart/fehbg.sh2
-rwxr-xr-xconfig/X/xmonad/autostart/getvolume.sh20
-rwxr-xr-xconfig/X/xmonad/autostart/yt-not.sh63
-rwxr-xr-xconfig/X/xmonad/xmonad.disabled/autostart/.cyclepaper.sh19
-rwxr-xr-xconfig/X/xmonad/xmonad.disabled/autostart/autostart.sh10
-rwxr-xr-xconfig/X/xmonad/xmonad.disabled/autostart/fehbg.sh2
-rwxr-xr-xconfig/X/xmonad/xmonad.disabled/autostart/getvolume.sh20
-rwxr-xr-xconfig/X/xmonad/xmonad.disabled/autostart/yt-not.sh63
-rw-r--r--config/X/xmonad/xmonad.disabled/xmonad.hs344
-rw-r--r--config/X/xmonad/xmonad.hs344
37 files changed, 7370 insertions, 0 deletions
diff --git a/config/X/alacritty/alacritty.yml b/config/X/alacritty/alacritty.yml
new file mode 100644
index 0000000..b771be8
--- /dev/null
+++ b/config/X/alacritty/alacritty.yml
@@ -0,0 +1,939 @@
+# 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: xterm-256color
+
+window:
+ # Window dimensions (changes require restart)
+ #
+ # Number of lines/columns (not pixels) in the terminal. 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: 2
+ y: 1
+
+ # 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.80
+
+ # 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
+
+ # GTK theme variant (Linux/BSD only)
+ #
+ # Override the variant of the GTK theme. Commonly supported values are `dark`
+ # and `light`. Set this to `None` to use the default theme variant.
+ #gtk_theme_variant: 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: monospace
+
+ # 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: monospace
+
+ # 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: monospace
+
+ # 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: monospace
+
+ # The `style` can be specified to pick a specific face.
+ #style: Bold Italic
+
+ # Point size
+ size: 10.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: 0
+ y: 0
+
+ # 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: 0
+ # y: 0
+
+ # Thin stroke font rendering (macOS only)
+ #
+ # Thin strokes are suitable for retina displays, but for non-retina screens
+ # it is recommended to set `use_thin_strokes` to `false`.
+ #use_thin_strokes: true
+
+ # 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
+
+# If `true`, bold text is drawn using the bright color variants.
+#draw_bold_text_with_bright_colors: false
+
+# Colors (Tomorrow Night)
+#colors:
+ # Default colors
+ #primary:
+ # background: '#1d1f21'
+ # foreground: '#c5c8c6'
+
+ # 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: CellBackground
+ # cursor: CellForeground
+
+ # 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'
+
+ #bar:
+ # background: '#c5c8c6'
+ # foreground: '#1d1f21'
+
+ # Keyboard regex 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
+
+ # 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: CellBackground
+ # background: CellForeground
+
+ # Normal colors
+ #normal:
+ # black: '#1d1f21'
+ # red: '#cc6666'
+ # green: '#b5bd68'
+ # yellow: '#f0c674'
+ # blue: '#81a2be'
+ # magenta: '#b294bb'
+ # cyan: '#8abeb7'
+ # white: '#c5c8c6'
+
+ # Bright colors
+ #bright:
+ # black: '#666666'
+ # red: '#d54e53'
+ # green: '#b9ca4a'
+ # yellow: '#e7c547'
+ # blue: '#7aa6da'
+ # magenta: '#c397d8'
+ # cyan: '#70c0b1'
+ # white: '#eaeaea'
+
+ # Dim colors
+ #
+ # If the dim colors are not set, they will be calculated automatically based
+ # on the `normal` colors.
+ #dim:
+ # black: '#131415'
+ # red: '#864343'
+ # green: '#777c44'
+ # yellow: '#9e824c'
+ # blue: '#556a7d'
+ # magenta: '#75617b'
+ # cyan: '#5b7d78'
+ # white: '#828482'
+
+ # 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
+
+# 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: Block
+
+ # 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: Off
+
+ # 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
+
+ # 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:
+# - (macOS) /bin/bash --login
+# - (Linux/BSD) user login shell
+# - (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
+
+# Send ESC (\x1b) before characters when alt is pressed.
+#alt_send_esc: true
+
+# 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
+
+# Regex hints
+#
+# Terminal hints can be used to find text 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 a `regex` and either an `action` or a `command` field.
+ # The fields `mouse`, `binding` and `post_processing` are optional.
+ #
+ # 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.
+ #
+ # 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{-}\\^⟨⟩`]+"
+ command: xdg-open
+ post_processing: true
+ mouse:
+ enabled: true
+ mods: Control
+ binding:
+ key: U
+ mods: Control|Shift
+ - regex: "([0-9a-f]{12,128})|([[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3})"
+ action: Copy
+ post_processing: false
+ binding:
+ key: I
+ mods: Control|Shift
+
+# 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, mode: ~Vi, action: PasteSelection }
+
+# 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/glutin/*/glutin/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
+# - 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`.
+#
+# - 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: F1, chars: ''}
+ #- { 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: 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: SpawnNewInstance }
+ #- { 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
+
+ # Print all received window events.
+ #print_events: false
+# Copyright (c) 2017-present Arctic Ice Studio <development@arcticicestudio.com>
+# Copyright (c) 2017-present Sven Greb <code@svengreb.de>
+#
+
+#################################################################################
+#
+# Project: Nord Alacritty
+# Version: 0.1.0
+# Repository: https://github.com/arcticicestudio/nord-alacritty
+# License: MIT
+# References:
+# https://github.com/alacritty/alacritty
+#
+colors:
+ primary:
+ background: '#2e3440'
+ foreground: '#d8dee9'
+ dim_foreground: '#a5abb6'
+ cursor:
+ text: '#2e3440'
+ cursor: '#d8dee9'
+ vimode_cursor:
+ text: '#2e3440'
+ cursor: '#d8dee9'
+ selection:
+ text: CellForeground
+ background: '#4c566a'
+ search:
+ matches:
+ foreground: CellBackground
+ background: '#88c0d0'
+ footer_bar:
+ background: '#434c5e'
+ foreground: '#d8dee9'
+ normal:
+ black: '#3b4252'
+ red: '#bf616a'
+ green: '#a3be8c'
+ yellow: '#ebcb8b'
+ blue: '#81a1c1'
+ magenta: '#b48ead'
+ cyan: '#88c0d0'
+ white: '#e5e9f0'
+ bright:
+ black: '#6c566a'
+ green: '#a5abb6'
+ cyan: '#8fbcbb'
+ white: '#eceff4'
+ dim:
+ black: '#373e4d'
+ red: '#94545d'
+ green: '#809575'
+ yellow: '#b29e75'
+ blue: '#68809a'
+ magenta: '#8c738c'
+ cyan: '#6d96a5'
+ white: '#aeb3bb'
diff --git a/config/X/dunst/dunstrc b/config/X/dunst/dunstrc
new file mode 100644
index 0000000..58a2753
--- /dev/null
+++ b/config/X/dunst/dunstrc
@@ -0,0 +1,456 @@
+# See dunst(5) for all configuration options
+
+[global]
+ ### Display ###
+
+ # Which monitor should the notifications be displayed on.
+ # monitor = 0
+
+ # Display notification on focused monitor. Possible modes are:
+ # mouse: follow mouse pointer
+ # keyboard: follow window with keyboard focus
+ # none: don't follow anything
+ #
+ # "keyboard" needs a window manager that exports the
+ # _NET_ACTIVE_WINDOW property.
+ # This should be the case for almost all modern window managers.
+ #
+ # If this option is set to mouse or keyboard, the monitor option
+ # will be ignored.
+ follow = keyboard
+
+ ### Geometry ###
+
+ # dynamic width from 0 to 300
+ # width = (0, 300)
+ # constant width of 300
+ width = (100,450)
+
+ # The maximum height of a single notification, excluding the frame.
+ height = 80
+
+ # Position the notification in the top right corner
+ origin = top-center
+
+ # Offset from the origin
+ offset = 10x26
+
+ # Scale factor. It is auto-detected if value is 0.
+ scale = 0
+
+ # Maximum number of notification (0 means no limit)
+ notification_limit = 3
+
+ ### Progress bar ###
+
+ # Turn on the progess bar. It appears when a progress hint is passed with
+ # for example dunstify -h int:value:12
+ progress_bar = true
+
+ # Set the progress bar height. This includes the frame, so make sure
+ # it's at least twice as big as the frame width.
+ progress_bar_height = 10
+
+ # Set the frame width of the progress bar
+ progress_bar_frame_width = 1
+
+ # Set the minimum width for the progress bar
+ progress_bar_min_width = 150
+
+ # Set the maximum width for the progress bar
+ progress_bar_max_width = 300
+
+
+ # Show how many messages are currently hidden (because of
+ # notification_limit).
+ indicate_hidden = yes
+
+ # The transparency of the window. Range: [0; 100].
+ # This option will only work if a compositing window manager is
+ # present (e.g. xcompmgr, compiz, etc.). (X11 only)
+ transparency = 0
+
+ # Draw a line of "separator_height" pixel height between two
+ # notifications.
+ # Set to 0 to disable.
+ # If gap_size is greater than 0, this setting will be ignored.
+ separator_height = 2
+
+ # Padding between text and separator.
+ padding = 6
+
+ # Horizontal padding.
+ horizontal_padding = 8
+
+ # Padding between text and icon.
+ text_icon_padding = 0
+
+ # Defines width in pixels of frame around the notification window.
+ # Set to 0 to disable.
+ frame_width = 1
+
+ # Defines color of the frame around the notification window.
+ frame_color = "#00000"
+
+ # Size of gap to display between notifications - requires a compositor.
+ # If value is greater than 0, separator_height will be ignored and a border
+ # of size frame_width will be drawn around each notification instead.
+ # Click events on gaps do not currently propagate to applications below.
+ gap_size = 2
+
+ # Define a color for the separator.
+ # possible values are:
+ # * auto: dunst tries to find a color fitting to the background;
+ # * foreground: use the same color as the foreground;
+ # * frame: use the same color as the frame;
+ # * anything else will be interpreted as a X color.
+ separator_color = frame
+
+ # Sort messages by urgency.
+ sort = yes
+
+ # Don't remove messages, if the user is idle (no mouse or keyboard input)
+ # for longer than idle_threshold seconds.
+ # Set to 0 to disable.
+ # A client can set the 'transient' hint to bypass this. See the rules
+ # section for how to disable this if necessary
+ # idle_threshold = 120
+
+ ### Text ###
+
+ font = mononoki nerd font mono 10
+
+ # The spacing between lines. If the height is smaller than the
+ # font height, it will get raised to the font height.
+ line_height = 11
+
+ # Possible values are:
+ # full: Allow a small subset of html markup in notifications:
+ # <b>bold</b>
+ # <i>italic</i>
+ # <s>strikethrough</s>
+ # <u>underline</u>
+ #
+ # For a complete reference see
+ # <https://docs.gtk.org/Pango/pango_markup.html>.
+ #
+ # strip: This setting is provided for compatibility with some broken
+ # clients that send markup even though it's not enabled on the
+ # server. Dunst will try to strip the markup but the parsing is
+ # simplistic so using this option outside of matching rules for
+ # specific applications *IS GREATLY DISCOURAGED*.
+ #
+ # no: Disable markup parsing, incoming notifications will be treated as
+ # plain text. Dunst will not advertise that it has the body-markup
+ # capability if this is set as a global setting.
+ #
+ # It's important to note that markup inside the format option will be parsed
+ # regardless of what this is set to.
+ markup = full
+
+ # The format of the message. Possible variables are:
+ # %a appname
+ # %s summary
+ # %b body
+ # %i iconname (including its path)
+ # %I iconname (without its path)
+ # %p progress value if set ([ 0%] to [100%]) or nothing
+ # %n progress value if set without any extra characters
+ # %% Literal %
+ # Markup is allowed
+ format = "%b"
+
+ # Alignment of message text.
+ # Possible values are "left", "center" and "right".
+ alignment = left
+
+ # Vertical alignment of message text and icon.
+ # Possible values are "top", "center" and "bottom".
+ vertical_alignment = center
+
+ # Show age of message if message is older than show_age_threshold
+ # seconds.
+ # Set to -1 to disable.
+ show_age_threshold = 60
+
+ # Specify where to make an ellipsis in long lines.
+ # Possible values are "start", "middle" and "end".
+ ellipsize = middle
+
+ # Ignore newlines '\n' in notifications.
+ ignore_newline = no
+
+ # Stack together notifications with the same content
+ stack_duplicates = false
+
+ # Hide the count of stacked notifications with the same content
+ hide_duplicate_count = false
+
+ # Display indicators for URLs (U) and actions (A).
+ show_indicators = no
+
+ ### Icons ###
+
+ # Recursive icon lookup. You can set a single theme, instead of having to
+ # define all lookup paths.
+ enable_recursive_icon_lookup = true
+
+ # Set icon theme (only used for recursive icon lookup)
+ icon_theme = Adwaita
+ # You can also set multiple icon themes, with the leftmost one being used first.
+ # icon_theme = "Adwaita, breeze"
+
+ # Align icons left/right/top/off
+ icon_position = left
+
+ # Scale small icons up to this size, set to 0 to disable. Helpful
+ # for e.g. small files or high-dpi screens. In case of conflict,
+ # max_icon_size takes precedence over this.
+ min_icon_size = 16
+
+ # Scale larger icons down to this size, set to 0 to disable
+ max_icon_size = 32
+
+ # Paths to default icons (only neccesary when not using recursive icon lookup)
+ icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/
+
+ ### History ###
+
+ # Should a notification popped up from history be sticky or timeout
+ # as if it would normally do.
+ sticky_history = yes
+
+ # Maximum amount of notifications kept in history
+ history_length = 20
+
+ ### Misc/Advanced ###
+
+ # dmenu path.
+ dmenu = /usr/bin/dmenu -p dunst:
+
+ # Browser for opening urls in context menu.
+ browser = /usr/bin/xdg-open
+
+ # Always run rule-defined scripts, even if the notification is suppressed
+ always_run_script = true
+
+ # Define the title of the windows spawned by dunst
+ title = Dunst
+
+ # Define the class of the windows spawned by dunst
+ class = Dunst
+
+ # Define the corner radius of the notification window
+ # in pixel size. If the radius is 0, you have no rounded
+ # corners.
+ # The radius will be automatically lowered if it exceeds half of the
+ # notification height to avoid clipping text and/or icons.
+ corner_radius = 5
+
+ # Ignore the dbus closeNotification message.
+ # Useful to enforce the timeout set by dunst configuration. Without this
+ # parameter, an application may close the notification sent before the
+ # user defined timeout.
+ ignore_dbusclose = false
+
+ ### Wayland ###
+ # These settings are Wayland-specific. They have no effect when using X11
+
+ # Uncomment this if you want to let notications appear under fullscreen
+ # applications (default: overlay)
+ # layer = top
+
+ # Set this to true to use X11 output on Wayland.
+ force_xwayland = false
+
+ ### Legacy
+
+ # Use the Xinerama extension instead of RandR for multi-monitor support.
+ # This setting is provided for compatibility with older nVidia drivers that
+ # do not support RandR and using it on systems that support RandR is highly
+ # discouraged.
+ #
+ # By enabling this setting dunst will not be able to detect when a monitor
+ # is connected or disconnected which might break follow mode if the screen
+ # layout changes.
+ force_xinerama = false
+
+ ### mouse
+
+ # Defines list of actions for each mouse event
+ # Possible values are:
+ # * none: Don't do anything.
+ # * do_action: Invoke the action determined by the action_name rule. If there is no
+ # such action, open the context menu.
+ # * open_url: If the notification has exactly one url, open it. If there are multiple
+ # ones, open the context menu.
+ # * close_current: Close current notification.
+ # * close_all: Close all notifications.
+ # * context: Open context menu for the notification.
+ # * context_all: Open context menu for all notifications.
+ # These values can be strung together for each mouse event, and
+ # will be executed in sequence.
+ mouse_left_click = open_url
+ mouse_middle_click = do_action, close_current
+ mouse_right_click = close_all
+
+# Experimental features that may or may not work correctly. Do not expect them
+# to have a consistent behaviour across releases.
+[experimental]
+ # Calculate the dpi to use on a per-monitor basis.
+ # If this setting is enabled the Xft.dpi value will be ignored and instead
+ # dunst will attempt to calculate an appropriate dpi value for each monitor
+ # using the resolution and physical size. This might be useful in setups
+ # where there are multiple screens with very different dpi values.
+ per_monitor_dpi = false
+
+
+[urgency_low]
+ # IMPORTANT: colors have to be defined in quotation marks.
+ # Otherwise the "#" and following would be interpreted as a comment.
+ # Icon for notifications with low urgency, uncomment to enable
+ #default_icon = /path/to/icon
+ background = "#d08770"
+ foreground = "#2E3541"
+ frame_color = "#81a1c1"
+ timeout = 6
+
+[urgency_normal]
+ background = "#393d4b"
+ foreground = "#80a0c0"
+ frame_color = "#81a1c1"
+ timeout = 5
+ # Icon for notifications with normal urgency, uncomment to enable
+ #default_icon = /path/to/icon
+
+[urgency_critical]
+ background = "#b48ead"
+ foreground = "#d8dee9"
+ frame_color = "#81a1c1"
+ timeout = 0
+ # Icon for notifications with critical urgency, uncomment to enable
+ #default_icon = /path/to/icon
+
+# Every section that isn't one of the above is interpreted as a rules to
+# override settings for certain messages.
+#
+# Messages can be matched by
+# appname (discouraged, see desktop_entry)
+# body
+# category
+# desktop_entry
+# icon
+# match_transient
+# msg_urgency
+# stack_tag
+# summary
+#
+# and you can override the
+# background
+# foreground
+# format
+# frame_color
+# fullscreen
+# new_icon
+# set_stack_tag
+# set_transient
+# set_category
+# timeout
+# urgency
+# icon_position
+# skip_display
+# history_ignore
+# action_name
+# word_wrap
+# ellipsize
+# alignment
+# hide_text
+#
+# Shell-like globbing will get expanded.
+#
+# Instead of the appname filter, it's recommended to use the desktop_entry filter.
+# GLib based applications export their desktop-entry name. In comparison to the appname,
+# the desktop-entry won't get localized.
+#
+# SCRIPTING
+# You can specify a script that gets run when the rule matches by
+# setting the "script" option.
+# The script will be called as follows:
+# script appname summary body icon urgency
+# where urgency can be "LOW", "NORMAL" or "CRITICAL".
+#
+# NOTE: It might be helpful to run dunst -print in a terminal in order
+# to find fitting options for rules.
+
+# Disable the transient hint so that idle_threshold cannot be bypassed from the
+# client
+#[transient_disable]
+# match_transient = yes
+# set_transient = no
+#
+# Make the handling of transient notifications more strict by making them not
+# be placed in history.
+#[transient_history_ignore]
+# match_transient = yes
+# history_ignore = yes
+
+# fullscreen values
+# show: show the notifications, regardless if there is a fullscreen window opened
+# delay: displays the new notification, if there is no fullscreen window active
+# If the notification is already drawn, it won't get undrawn.
+# pushback: same as delay, but when switching into fullscreen, the notification will get
+# withdrawn from screen again and will get delayed like a new notification
+#[fullscreen_delay_everything]
+# fullscreen = delay
+#[fullscreen_show_critical]
+# msg_urgency = critical
+# fullscreen = show
+
+#[espeak]
+# summary = "*"
+# script = dunst_espeak.sh
+
+#[script-test]
+# summary = "*script*"
+# script = dunst_test.sh
+
+#[ignore]
+# # This notification will not be displayed
+# summary = "foobar"
+# skip_display = true
+
+#[history-ignore]
+# # This notification will not be saved in history
+# summary = "foobar"
+# history_ignore = yes
+
+#[skip-display]
+# # This notification will not be displayed, but will be included in the history
+# summary = "foobar"
+# skip_display = yes
+
+#[signed_on]
+# appname = Pidgin
+# summary = "*signed on*"
+# urgency = low
+#
+#[signed_off]
+# appname = Pidgin
+# summary = *signed off*
+# urgency = low
+#
+#[says]
+# appname = Pidgin
+# summary = *says*
+# urgency = critical
+#
+#[twitter]
+# appname = Pidgin
+# summary = *twitter.com*
+# urgency = normal
+#
+#[stack-volumes]
+# appname = "some_volume_notifiers"
+# set_stack_tag = "volume"
+#
+# vim: ft=cfg
diff --git a/config/X/mpv/input.conf b/config/X/mpv/input.conf
new file mode 100644
index 0000000..9de1b1b
--- /dev/null
+++ b/config/X/mpv/input.conf
@@ -0,0 +1,204 @@
+# mpv keybindings
+#
+# Location of user-defined bindings: ~/.config/mpv/input.conf
+#
+# Lines starting with # are comments. Use SHARP to assign the # key.
+# Copy this file and uncomment and edit the bindings you want to change.
+#
+# List of commands and further details: DOCS/man/input.rst
+# List of special keys: --input-keylist
+# Keybindings testing mode: mpv --input-test --force-window --idle
+#
+# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore').
+#
+# Strings need to be quoted and escaped:
+# KEY show-text "This is a single backslash: \\ and a quote: \" !"
+#
+# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with
+# the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal).
+#
+# The default keybindings are hardcoded into the mpv binary.
+# You can disable them completely with: --no-input-default-bindings
+
+# Developer note:
+# On compilation, this file is baked into the mpv binary, and all lines are
+# uncommented (unless '#' is followed by a space) - thus this file defines the
+# default key bindings.
+
+# If this is enabled, treat all the following bindings as default.
+#default-bindings start
+
+#MBTN_LEFT ignore # don't do anything
+#MBTN_LEFT_DBL cycle fullscreen # toggle fullscreen
+#MBTN_RIGHT cycle pause # toggle pause/playback mode
+#MBTN_BACK playlist-prev # skip to the previous file
+#MBTN_FORWARD playlist-next # skip to the next file
+
+# Mouse wheels, touchpad or other input devices that have axes
+# if the input devices supports precise scrolling it will also scale the
+# numeric value accordingly
+#WHEEL_UP seek 10 # seek 10 seconds forward
+#WHEEL_DOWN seek -10 # seek 10 seconds backward
+#WHEEL_LEFT add volume -2
+#WHEEL_RIGHT add volume 2
+
+## Seek units are in seconds, but note that these are limited by keyframes
+#RIGHT seek 5 # seek 5 seconds forward
+#LEFT seek -5 # seek 5 seconds backward
+#UP seek 60 # seek 1 minute forward
+#DOWN seek -60 # seek 1 minute backward
+# Do smaller, always exact (non-keyframe-limited), seeks with shift.
+# Don't show them on the OSD (no-osd).
+#Shift+RIGHT no-osd seek 1 exact # seek exactly 1 second forward
+#Shift+LEFT no-osd seek -1 exact # seek exactly 1 second backward
+#Shift+UP no-osd seek 5 exact # seek exactly 5 seconds forward
+#Shift+DOWN no-osd seek -5 exact # seek exactly 5 seconds backward
+#Ctrl+LEFT no-osd sub-seek -1 # seek to the previous subtitle
+#Ctrl+RIGHT no-osd sub-seek 1 # seek to the next subtitle
+#Ctrl+Shift+LEFT sub-step -1 # change subtitle timing such that the previous subtitle is displayed
+#Ctrl+Shift+RIGHT sub-step 1 # change subtitle timing such that the next subtitle is displayed
+#Alt+left add video-pan-x 0.1 # move the video right
+#Alt+right add video-pan-x -0.1 # move the video left
+#Alt+up add video-pan-y 0.1 # move the video down
+#Alt+down add video-pan-y -0.1 # move the video up
+#Alt++ add video-zoom 0.1 # zoom in
+#Alt+- add video-zoom -0.1 # zoom out
+#Alt+BS set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0 # reset zoom and pan settings
+#PGUP add chapter 1 # seek to the next chapter
+#PGDWN add chapter -1 # seek to the previous chapter
+#Shift+PGUP seek 600 # seek 10 minutes forward
+#Shift+PGDWN seek -600 # seek 10 minutes backward
+#[ multiply speed 1/1.1 # decrease the playback speed
+#] multiply speed 1.1 # increase the playback speed
+#{ multiply speed 0.5 # halve the playback speed
+#} multiply speed 2.0 # double the playback speed
+#BS set speed 1.0 # reset the speed to normal
+#Shift+BS revert-seek # undo the previous (or marked) seek
+#Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek
+#q quit
+#Q quit-watch-later # exit and remember the playback position
+#q {encode} quit 4
+#ESC set fullscreen no # leave fullscreen
+#ESC {encode} quit 4
+#p cycle pause # toggle pause/playback mode
+#. frame-step # advance one frame and pause
+#, frame-back-step # go back by one frame and pause
+#SPACE cycle pause # toggle pause/playback mode
+#> playlist-next # skip to the next file
+#ENTER playlist-next # skip to the next file
+#< playlist-prev # skip to the previous file
+#O no-osd cycle-values osd-level 3 1 # toggle displaying the OSD on user interaction or always
+#o show-progress # show playback progress
+#P show-progress # show playback progress
+#i script-binding stats/display-stats # display information and statistics
+#I script-binding stats/display-stats-toggle # toggle displaying information and statistics
+#` script-binding console/enable # open the console
+#z add sub-delay -0.1 # shift subtitles 100 ms earlier
+#Z add sub-delay +0.1 # delay subtitles by 100 ms
+#x add sub-delay +0.1 # delay subtitles by 100 ms
+#ctrl++ add audio-delay 0.100 # change audio/video sync by delaying the audio
+#ctrl+- add audio-delay -0.100 # change audio/video sync by shifting the audio earlier
+#Shift+g add sub-scale +0.1 # increase the subtitle font size
+#Shift+f add sub-scale -0.1 # decrease the subtitle font size
+#9 add volume -2
+#/ add volume -2
+#0 add volume 2
+#* add volume 2
+#m cycle mute # toggle mute
+#1 add contrast -1
+#2 add contrast 1
+#3 add brightness -1
+#4 add brightness 1
+#5 add gamma -1
+#6 add gamma 1
+#7 add saturation -1
+#8 add saturation 1
+#Alt+0 set current-window-scale 0.5 # halve the window size
+#Alt+1 set current-window-scale 1.0 # reset the window size
+#Alt+2 set current-window-scale 2.0 # double the window size
+#d cycle deinterlace # toggle the deinterlacing filter
+#r add sub-pos -1 # move subtitles up
+#R add sub-pos +1 # move subtitles down
+#t add sub-pos +1 # move subtitles down
+#v cycle sub-visibility # hide or show the subtitles
+#Alt+v cycle secondary-sub-visibility # hide or show the secondary subtitles
+#V cycle sub-ass-vsfilter-aspect-compat # toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer
+#u cycle-values sub-ass-override "force" "no" # toggle overriding SSA/ASS subtitle styles with the normal styles
+#j cycle sub # switch subtitle track
+#J cycle sub down # switch subtitle track backwards
+#SHARP cycle audio # switch audio track
+#_ cycle video # switch video track
+#T cycle ontop # toggle placing the video on top of other windows
+#f cycle fullscreen # toggle fullscreen
+#s screenshot # take a screenshot of the video in its original resolution with subtitles
+#S screenshot video # take a screenshot of the video in its original resolution without subtitles
+#Ctrl+s screenshot window # take a screenshot of the window with OSD and subtitles
+#Alt+s screenshot each-frame # automatically screenshot every frame; issue this command again to stop taking screenshots
+#w add panscan -0.1 # decrease panscan
+#W add panscan +0.1 # shrink black bars by cropping the video
+#e add panscan +0.1 # shrink black bars by cropping the video
+#A cycle-values video-aspect-override "16:9" "4:3" "2.35:1" "-1" # cycle the video aspect ratio ("-1" is the container aspect)
+#POWER quit
+#PLAY cycle pause # toggle pause/playback mode
+#PAUSE cycle pause # toggle pause/playback mode
+#PLAYPAUSE cycle pause # toggle pause/playback mode
+#PLAYONLY set pause no # unpause
+#PAUSEONLY set pause yes # pause
+#STOP quit
+#FORWARD seek 60 # seek 1 minute forward
+#REWIND seek -60 # seek 1 minute backward
+#NEXT playlist-next # skip to the next file
+#PREV playlist-prev # skip to the previous file
+#VOLUME_UP add volume 2
+#VOLUME_DOWN add volume -2
+#MUTE cycle mute # toggle mute
+#CLOSE_WIN quit
+#CLOSE_WIN {encode} quit 4
+#ctrl+w quit
+#E cycle edition # switch edition
+#l ab-loop # set/clear A-B loop points
+#L cycle-values loop-file "inf" "no" # toggle infinite looping
+#ctrl+c quit 4
+#DEL script-binding osc/visibility # cycle OSC visibility between never, auto (mouse-move) and always
+#ctrl+h cycle-values hwdec "auto" "no" # toggle hardware decoding
+#F8 show-text ${playlist} # show the playlist
+#F9 show-text ${track-list} # show the list of video, audio and sub tracks
+
+#
+# Legacy bindings (may or may not be removed in the future)
+#
+#! add chapter -1 # seek to the previous chapter
+#@ add chapter 1 # seek to the next chapter
+
+#
+# Not assigned by default
+# (not an exhaustive list of unbound commands)
+#
+
+# ? cycle sub-forced-only # toggle DVD forced subs
+# ? stop # stop playback (quit or enter idle mode)
+#
+
+q quit-watch-later
+
+# seeking
+H add chapter -1
+L add chapter 1
+h seek -5
+l seek 5
+- seek -60
+= seek 60
+
+# Add/Decrease volume
+j add volume -5
+k add volume 5
+
+# Subtitles
+c cycle sub # switch subtitle track up-order
+C cycle sub down # switch subtitle track down-order
+Alt+c cycle sub-visibility # Toggle subtitles
+
+# Cycle audio tracks
+v cycle audio # switch audio track
+V cycle audio # switch audio track
+ctrl+l cycle-values loop-file "inf" "no" # toggle infinite looping
diff --git a/config/X/mpv/mpv.conf b/config/X/mpv/mpv.conf
new file mode 100755
index 0000000..034ec6a
--- /dev/null
+++ b/config/X/mpv/mpv.conf
@@ -0,0 +1,28 @@
+profile=gpu-hq
+
+# Set OSD font
+osd-font='Ubuntu Mono'
+# Set OSD font size
+osd-font-size=30
+
+# Set volume to 100% on startup.
+volume=60
+
+# Set player max vol to 100%.
+volume-max=100
+
+# Set max streaming quality as 1080p.
+ytdl-format=bestvideo[height<=?1080]+bestaudio/best
+
+# Default demuxer is 150/75 MB, note that this uses RAM so set a reasonable amount.
+# 150MB, Max pre-load for network streams (1 MiB = 1048576 Bytes).
+demuxer-max-bytes=150000000
+
+# 75MB, Max loaded video kept after playback.
+demuxer-max-back-bytes=75000000
+
+# Force stream to be seekable even if disabled.
+force-seekable=yes
+
+slang=eng, en, english
+alang=jpn
diff --git a/config/X/mpv/playfile.txt b/config/X/mpv/playfile.txt
new file mode 100755
index 0000000..9cd1e1c
--- /dev/null
+++ b/config/X/mpv/playfile.txt
@@ -0,0 +1,2 @@
+https://www.youtube.com/watch?v=0C6p5wQ5SwQ
+https://www.youtube.com/watch?v=aEWptdD32iA
diff --git a/config/X/mpv/scripts/script-opts/webm.conf b/config/X/mpv/scripts/script-opts/webm.conf
new file mode 100644
index 0000000..9ea44dd
--- /dev/null
+++ b/config/X/mpv/scripts/script-opts/webm.conf
@@ -0,0 +1,78 @@
+# Defaults to shift+w
+keybind=W
+# If empty, saves on the same directory of the playing video.
+# A starting "~" will be replaced by the home dir.
+# This field is delimited by double-square-brackets - [[ and ]] - instead of
+# quotes, because Windows users might run into a issue when using
+# backslashes as a path separator. Examples of valid inputs for this field
+# would be: [[]] (the default, empty value), [[C:\Users\John]] (on Windows),
+# and [[/home/john]] (on Unix-like systems eg. Linux).
+# The [[]] delimiter is not needed when using from a configuration file
+# in the script-opts folder.
+output_directory=
+run_detached=no
+# Template string for the output file
+# %f - Filename, with extension
+# %F - Filename, without extension
+# %T - Media title, if it exists, or filename, with extension (useful for some streams, such as YouTube).
+# %s, %e - Start and end time, with milliseconds
+# %S, %E - Start and end time, without milliseconds
+# %M - "-audio", if audio is enabled, empty otherwise
+# %R - "-(height)p", where height is the video's height, or scale_height, if it's enabled.
+# More specifiers are supported, see https://mpv.io/manual/master/#options-screenshot-template
+# Property expansion is supported (with %{} at top level, ${} when nested), see https://mpv.io/manual/master/#property-expansion
+output_template=%F-[%s-%e]%M
+# Scale video to a certain height, keeping the aspect ratio. -1 disables it.
+scale_height=-1
+# Change the FPS of the output video, dropping or duplicating frames as needed.
+# -1 means the FPS will be unchanged from the source.
+fps=-1
+# Target filesize, in kB. This will be used to calculate the bitrate
+# used on the encode. If this is set to <= 0, the video bitrate will be set
+# to 0, which might enable constant quality modes, depending on the
+# video codec that's used (VP8 and VP9, for example).
+target_filesize=2500
+# If true, will use stricter flags to ensure the resulting file doesn't
+# overshoot the target filesize. Not recommended, as constrained quality
+# mode should work well, unless you're really having trouble hitting
+# the target size.
+strict_filesize_constraint=no
+strict_bitrate_multiplier=0.95
+# In kilobits.
+strict_audio_bitrate=64
+# Sets the output format, from a few predefined ones.
+# Currently we have:
+# webm-vp8 (libvpx/libvorbis)
+# webm-vp9 (libvpx-vp9/libopus)
+# mp4 (h264/AAC)
+# mp4-nvenc (h264-NVENC/AAC)
+# raw (rawvideo/pcm_s16le).
+# mp3 (libmp3lame)
+# and gif
+output_format=webm-vp8
+twopass=yes
+# If set, applies the video filters currently used on the playback to the encode.
+apply_current_filters=yes
+# If set, writes the video's filename to the "Title" field on the metadata.
+write_filename_on_metadata=no
+# Set the number of encoding threads, for codecs libvpx and libvpx-vp9
+libvpx_threads=4
+additional_flags=
+# Constant Rate Factor (CRF). The value meaning and limits may change,
+# from codec to codec. Set to -1 to disable.
+crf=10
+# Useful for flags that may impact output filesize, such as qmin, qmax etc
+# Won't be applied when strict_filesize_constraint is on.
+non_strict_additional_flags=
+# Display the encode progress, in %. Requires run_detached to be disabled.
+# On Windows, it shows a cmd popup. "auto" will display progress on non-Windows platforms.
+display_progress=auto
+# The font size used in the menu. Isn't used for the notifications (started encode, finished encode etc)
+font_size=28
+margin=10
+message_duration=5
+# gif dither mode, 0-5 for bayer w/ bayer_scale 0-5, 6 for paletteuse default (sierra2_4a)
+gif_dither=2
+# Force square pixels on output video
+# Some players like recent Firefox versions display videos with non-square pixels with wrong aspect ratio
+force_square_pixels=no
diff --git a/config/X/mpv/scripts/script-opts/youtube-quality.conf b/config/X/mpv/scripts/script-opts/youtube-quality.conf
new file mode 100755
index 0000000..b197714
--- /dev/null
+++ b/config/X/mpv/scripts/script-opts/youtube-quality.conf
@@ -0,0 +1,41 @@
+# KEY BINDINGS
+
+# invoke or dismiss the quality menu
+toggle_menu_binding=ctrl+f
+# move the menu cursor up
+up_binding=UP
+# move the menu cursor down
+down_binding=DOWN
+# select menu entry
+select_binding=ENTER
+
+# formatting / cursors
+selected_and_active=▶ -
+selected_and_inactive=● -
+unselected_and_active=▷ -
+unselected_and_inactive=○ -
+
+# font size scales by window, if false requires larger font and padding sizes
+scale_playlist_by_window=false
+
+# playlist ass style overrides inside curly brackets, \keyvalue is one field, extra \ for escape in lua
+# example {\\fnUbuntu\\fs10\\b0\\bord1} equals: font=Ubuntu, size=10, bold=no, border=1
+# read http://docs.aegisub.org/3.2/ASS_Tags/ for reference of tags
+# undeclared tags will use default osd settings
+# these styles will be used for the whole playlist. More specific styling will need to be hacked in
+#
+# (a monospaced font is recommended but not required)
+style_ass_tags={\\fnUbuntu}
+
+# paddings for top left corner
+text_padding_x=1
+text_padding_y=1
+
+# how many seconds until the quality menu times out
+menu_timeout=10
+
+#use youtube-dl to fetch a list of available formats (overrides quality_strings)
+fetch_formats=yes
+
+# list of ytdl-format strings to choose from
+quality_strings=[ {"4320p" : "bestvideo[height<=?4320p]+bestaudio/best"}, {"2160p" : "bestvideo[height<=?2160]+bestaudio/best"}, {"1440p" : "bestvideo[height<=?1440]+bestaudio/best"}, {"1080p" : "bestvideo[height<=?1080]+bestaudio/best"}, {"720p" : "bestvideo[height<=?720]+bestaudio/best"}, {"480p" : "bestvideo[height<=?480]+bestaudio/best"}, {"360p" : "bestvideo[height<=?360]+bestaudio/best"}, {"240p" : "bestvideo[height<=?240]+bestaudio/best"}, {"144p" : "bestvideo[height<=?144]+bestaudio/best"} ]
diff --git a/config/X/mpv/scripts/webm.lua b/config/X/mpv/scripts/webm.lua
new file mode 100644
index 0000000..4397b9b
--- /dev/null
+++ b/config/X/mpv/scripts/webm.lua
@@ -0,0 +1,2914 @@
+local mp = require("mp")
+local assdraw = require("mp.assdraw")
+local msg = require("mp.msg")
+local utils = require("mp.utils")
+local mpopts = require("mp.options")
+local options = {
+ -- Defaults to shift+w
+ keybind = "W",
+ -- If empty, saves on the same directory of the playing video.
+ -- A starting "~" will be replaced by the home dir.
+ -- This field is delimited by double-square-brackets - [[ and ]] - instead of
+ -- quotes, because Windows users might run into a issue when using
+ -- backslashes as a path separator. Examples of valid inputs for this field
+ -- would be: [[]] (the default, empty value), [[C:\Users\John]] (on Windows),
+ -- and [[/home/john]] (on Unix-like systems eg. Linux).
+ -- The [[]] delimiter is not needed when using from a configuration file
+ -- in the script-opts folder.
+ output_directory = [[]],
+ run_detached = false,
+ -- Template string for the output file
+ -- %f - Filename, with extension
+ -- %F - Filename, without extension
+ -- %T - Media title, if it exists, or filename, with extension (useful for some streams, such as YouTube).
+ -- %s, %e - Start and end time, with milliseconds
+ -- %S, %E - Start and end time, without milliseconds
+ -- %M - "-audio", if audio is enabled, empty otherwise
+ -- %R - "-(height)p", where height is the video's height, or scale_height, if it's enabled.
+ -- More specifiers are supported, see https://mpv.io/manual/master/#options-screenshot-template
+ -- Property expansion is supported (with %{} at top level, ${} when nested), see https://mpv.io/manual/master/#property-expansion
+ output_template = "%F-[%s-%e]%M",
+ -- Scale video to a certain height, keeping the aspect ratio. -1 disables it.
+ scale_height = -1,
+ -- Change the FPS of the output video, dropping or duplicating frames as needed.
+ -- -1 means the FPS will be unchanged from the source.
+ fps = -1,
+ -- Target filesize, in kB. This will be used to calculate the bitrate
+ -- used on the encode. If this is set to <= 0, the video bitrate will be set
+ -- to 0, which might enable constant quality modes, depending on the
+ -- video codec that's used (VP8 and VP9, for example).
+ target_filesize = 2500,
+ -- If true, will use stricter flags to ensure the resulting file doesn't
+ -- overshoot the target filesize. Not recommended, as constrained quality
+ -- mode should work well, unless you're really having trouble hitting
+ -- the target size.
+ strict_filesize_constraint = false,
+ strict_bitrate_multiplier = 0.95,
+ -- In kilobits.
+ strict_audio_bitrate = 64,
+ -- Sets the output format, from a few predefined ones.
+ -- Currently we have:
+ -- webm-vp8 (libvpx/libvorbis)
+ -- webm-vp9 (libvpx-vp9/libopus)
+ -- mp4 (h264/AAC)
+ -- mp4-nvenc (h264-NVENC/AAC)
+ -- raw (rawvideo/pcm_s16le).
+ -- mp3 (libmp3lame)
+ -- and gif
+ output_format = "webm-vp8",
+ twopass = true,
+ -- If set, applies the video filters currently used on the playback to the encode.
+ apply_current_filters = true,
+ -- If set, writes the video's filename to the "Title" field on the metadata.
+ write_filename_on_metadata = false,
+ -- Set the number of encoding threads, for codecs libvpx and libvpx-vp9
+ libvpx_threads = 4,
+ additional_flags = "",
+ -- Constant Rate Factor (CRF). The value meaning and limits may change,
+ -- from codec to codec. Set to -1 to disable.
+ crf = 10,
+ -- Useful for flags that may impact output filesize, such as qmin, qmax etc
+ -- Won't be applied when strict_filesize_constraint is on.
+ non_strict_additional_flags = "",
+ -- Display the encode progress, in %. Requires run_detached to be disabled.
+ -- On Windows, it shows a cmd popup. "auto" will display progress on non-Windows platforms.
+ display_progress = "auto",
+ -- The font size used in the menu. Isn't used for the notifications (started encode, finished encode etc)
+ font_size = 28,
+ margin = 10,
+ message_duration = 5,
+ -- gif dither mode, 0-5 for bayer w/ bayer_scale 0-5, 6 for paletteuse default (sierra2_4a)
+ gif_dither = 2,
+ -- Force square pixels on output video
+ -- Some players like recent Firefox versions display videos with non-square pixels with wrong aspect ratio
+ force_square_pixels = false,
+}
+
+mpopts.read_options(options)
+local base64_chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
+
+-- encoding
+function base64_encode(data)
+ return ((data:gsub('.', function(x)
+ local r,b='',x:byte()
+ for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
+ return r;
+ end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
+ if (#x < 6) then return '' end
+ local c=0
+ for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
+ return base64_chars:sub(c+1,c+1)
+ end)..({ '', '==', '=' })[#data%3+1])
+end
+
+-- decoding
+function base64_decode(data)
+ data = string.gsub(data, '[^'..base64_chars..'=]', '')
+ return (data:gsub('.', function(x)
+ if (x == '=') then return '' end
+ local r,f='',(base64_chars:find(x)-1)
+ for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
+ return r;
+ end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
+ if (#x ~= 8) then return '' end
+ local c=0
+ for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
+ return string.char(c)
+ end))
+end
+local emit_event
+emit_event = function(event_name, ...)
+ return mp.commandv("script-message", "webm-" .. tostring(event_name), ...)
+end
+local test_set_options
+test_set_options = function(new_options_json)
+ local new_options = utils.parse_json(new_options_json)
+ for k, v in pairs(new_options) do
+ options[k] = v
+ end
+end
+mp.register_script_message("mpv-webm-set-options", test_set_options)
+local bold
+bold = function(text)
+ return "{\\b1}" .. tostring(text) .. "{\\b0}"
+end
+local message
+message = function(text, duration)
+ local ass = mp.get_property_osd("osd-ass-cc/0")
+ ass = ass .. text
+ return mp.osd_message(ass, duration or options.message_duration)
+end
+local append
+append = function(a, b)
+ for _, val in ipairs(b) do
+ a[#a + 1] = val
+ end
+ return a
+end
+local seconds_to_time_string
+seconds_to_time_string = function(seconds, no_ms, full)
+ if seconds < 0 then
+ return "unknown"
+ end
+ local ret = ""
+ if not (no_ms) then
+ ret = string.format(".%03d", seconds * 1000 % 1000)
+ end
+ ret = string.format("%02d:%02d%s", math.floor(seconds / 60) % 60, math.floor(seconds) % 60, ret)
+ if full or seconds > 3600 then
+ ret = string.format("%d:%s", math.floor(seconds / 3600), ret)
+ end
+ return ret
+end
+local seconds_to_path_element
+seconds_to_path_element = function(seconds, no_ms, full)
+ local time_string = seconds_to_time_string(seconds, no_ms, full)
+ local _
+ time_string, _ = time_string:gsub(":", ".")
+ return time_string
+end
+local file_exists
+file_exists = function(name)
+ local info, err = utils.file_info(name)
+ if info ~= nil then
+ return true
+ end
+ return false
+end
+local expand_properties
+expand_properties = function(text, magic)
+ if magic == nil then
+ magic = "$"
+ end
+ for prefix, raw, prop, colon, fallback, closing in text:gmatch("%" .. magic .. "{([?!]?)(=?)([^}:]*)(:?)([^}]*)(}*)}") do
+ local err
+ local prop_value
+ local compare_value
+ local original_prop = prop
+ local get_property = mp.get_property_osd
+ if raw == "=" then
+ get_property = mp.get_property
+ end
+ if prefix ~= "" then
+ for actual_prop, compare in prop:gmatch("(.-)==(.*)") do
+ prop = actual_prop
+ compare_value = compare
+ end
+ end
+ if colon == ":" then
+ prop_value, err = get_property(prop, fallback)
+ else
+ prop_value, err = get_property(prop, "(error)")
+ end
+ prop_value = tostring(prop_value)
+ if prefix == "?" then
+ if compare_value == nil then
+ prop_value = err == nil and fallback .. closing or ""
+ else
+ prop_value = prop_value == compare_value and fallback .. closing or ""
+ end
+ prefix = "%" .. prefix
+ elseif prefix == "!" then
+ if compare_value == nil then
+ prop_value = err ~= nil and fallback .. closing or ""
+ else
+ prop_value = prop_value ~= compare_value and fallback .. closing or ""
+ end
+ else
+ prop_value = prop_value .. closing
+ end
+ if colon == ":" then
+ local _
+ text, _ = text:gsub("%" .. magic .. "{" .. prefix .. raw .. original_prop:gsub("%W", "%%%1") .. ":" .. fallback:gsub("%W", "%%%1") .. closing .. "}", expand_properties(prop_value))
+ else
+ local _
+ text, _ = text:gsub("%" .. magic .. "{" .. prefix .. raw .. original_prop:gsub("%W", "%%%1") .. closing .. "}", prop_value)
+ end
+ end
+ return text
+end
+local format_filename
+format_filename = function(startTime, endTime, videoFormat)
+ local hasAudioCodec = videoFormat.audioCodec ~= ""
+ local replaceFirst = {
+ ["%%mp"] = "%%mH.%%mM.%%mS",
+ ["%%mP"] = "%%mH.%%mM.%%mS.%%mT",
+ ["%%p"] = "%%wH.%%wM.%%wS",
+ ["%%P"] = "%%wH.%%wM.%%wS.%%wT"
+ }
+ local replaceTable = {
+ ["%%wH"] = string.format("%02d", math.floor(startTime / (60 * 60))),
+ ["%%wh"] = string.format("%d", math.floor(startTime / (60 * 60))),
+ ["%%wM"] = string.format("%02d", math.floor(startTime / 60 % 60)),
+ ["%%wm"] = string.format("%d", math.floor(startTime / 60)),
+ ["%%wS"] = string.format("%02d", math.floor(startTime % 60)),
+ ["%%ws"] = string.format("%d", math.floor(startTime)),
+ ["%%wf"] = string.format("%s", startTime),
+ ["%%wT"] = string.sub(string.format("%.3f", startTime % 1), 3),
+ ["%%mH"] = string.format("%02d", math.floor(endTime / (60 * 60))),
+ ["%%mh"] = string.format("%d", math.floor(endTime / (60 * 60))),
+ ["%%mM"] = string.format("%02d", math.floor(endTime / 60 % 60)),
+ ["%%mm"] = string.format("%d", math.floor(endTime / 60)),
+ ["%%mS"] = string.format("%02d", math.floor(endTime % 60)),
+ ["%%ms"] = string.format("%d", math.floor(endTime)),
+ ["%%mf"] = string.format("%s", endTime),
+ ["%%mT"] = string.sub(string.format("%.3f", endTime % 1), 3),
+ ["%%f"] = mp.get_property("filename"),
+ ["%%F"] = mp.get_property("filename/no-ext"),
+ ["%%s"] = seconds_to_path_element(startTime),
+ ["%%S"] = seconds_to_path_element(startTime, true),
+ ["%%e"] = seconds_to_path_element(endTime),
+ ["%%E"] = seconds_to_path_element(endTime, true),
+ ["%%T"] = mp.get_property("media-title"),
+ ["%%M"] = (mp.get_property_native('aid') and not mp.get_property_native('mute') and hasAudioCodec) and '-audio' or '',
+ ["%%R"] = (options.scale_height ~= -1) and "-" .. tostring(options.scale_height) .. "p" or "-" .. tostring(mp.get_property_native('height')) .. "p",
+ ["%%t%%"] = "%%"
+ }
+ local filename = options.output_template
+ for format, value in pairs(replaceFirst) do
+ local _
+ filename, _ = filename:gsub(format, value)
+ end
+ for format, value in pairs(replaceTable) do
+ local _
+ filename, _ = filename:gsub(format, value)
+ end
+ if mp.get_property_bool("demuxer-via-network", false) then
+ local _
+ filename, _ = filename:gsub("%%X{([^}]*)}", "%1")
+ filename, _ = filename:gsub("%%x", "")
+ else
+ local x = string.gsub(mp.get_property("stream-open-filename", ""), string.gsub(mp.get_property("filename", ""), "%W", "%%%1") .. "$", "")
+ local _
+ filename, _ = filename:gsub("%%X{[^}]*}", x)
+ filename, _ = filename:gsub("%%x", x)
+ end
+ filename = expand_properties(filename, "%")
+ for format in filename:gmatch("%%t([aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ])") do
+ local _
+ filename, _ = filename:gsub("%%t" .. format, os.date("%" .. format))
+ end
+ local _
+ filename, _ = filename:gsub("[<>:\"/\\|?*]", "")
+ return tostring(filename) .. "." .. tostring(videoFormat.outputExtension)
+end
+local parse_directory
+parse_directory = function(dir)
+ local home_dir = os.getenv("HOME")
+ if not home_dir then
+ home_dir = os.getenv("USERPROFILE")
+ end
+ if not home_dir then
+ local drive = os.getenv("HOMEDRIVE")
+ local path = os.getenv("HOMEPATH")
+ if drive and path then
+ home_dir = utils.join_path(drive, path)
+ else
+ msg.warn("Couldn't find home dir.")
+ home_dir = ""
+ end
+ end
+ local _
+ dir, _ = dir:gsub("^~", home_dir)
+ return dir
+end
+local is_windows = type(package) == "table" and type(package.config) == "string" and package.config:sub(1, 1) == "\\"
+local trim
+trim = function(s)
+ return s:match("^%s*(.-)%s*$")
+end
+local get_null_path
+get_null_path = function()
+ if file_exists("/dev/null") then
+ return "/dev/null"
+ end
+ return "NUL"
+end
+local run_subprocess
+run_subprocess = function(params)
+ local res = utils.subprocess(params)
+ msg.verbose("Command stdout: ")
+ msg.verbose(res.stdout)
+ if res.status ~= 0 then
+ msg.verbose("Command failed! Reason: ", res.error, " Killed by us? ", res.killed_by_us and "yes" or "no")
+ return false
+ end
+ return true
+end
+local shell_escape
+shell_escape = function(args)
+ local ret = { }
+ for i, a in ipairs(args) do
+ local s = tostring(a)
+ if string.match(s, "[^A-Za-z0-9_/:=-]") then
+ if is_windows then
+ s = '"' .. string.gsub(s, '"', '"\\""') .. '"'
+ else
+ s = "'" .. string.gsub(s, "'", "'\\''") .. "'"
+ end
+ end
+ table.insert(ret, s)
+ end
+ local concat = table.concat(ret, " ")
+ if is_windows then
+ concat = '"' .. concat .. '"'
+ end
+ return concat
+end
+local run_subprocess_popen
+run_subprocess_popen = function(command_line)
+ local command_line_string = shell_escape(command_line)
+ command_line_string = command_line_string .. " 2>&1"
+ msg.verbose("run_subprocess_popen: running " .. tostring(command_line_string))
+ return io.popen(command_line_string)
+end
+local calculate_scale_factor
+calculate_scale_factor = function()
+ local baseResY = 720
+ local osd_w, osd_h = mp.get_osd_size()
+ return osd_h / baseResY
+end
+local should_display_progress
+should_display_progress = function()
+ if options.display_progress == "auto" then
+ return not is_windows
+ end
+ return options.display_progress
+end
+local reverse
+reverse = function(list)
+ local _accum_0 = { }
+ local _len_0 = 1
+ local _max_0 = 1
+ for _index_0 = #list, _max_0 < 0 and #list + _max_0 or _max_0, -1 do
+ local element = list[_index_0]
+ _accum_0[_len_0] = element
+ _len_0 = _len_0 + 1
+ end
+ return _accum_0
+end
+local get_pass_logfile_path
+get_pass_logfile_path = function(encode_out_path)
+ return tostring(encode_out_path) .. "-video-pass1.log"
+end
+local dimensions_changed = true
+local _video_dimensions = { }
+local get_video_dimensions
+get_video_dimensions = function()
+ if not (dimensions_changed) then
+ return _video_dimensions
+ end
+ local video_params = mp.get_property_native("video-out-params")
+ if not video_params then
+ return nil
+ end
+ dimensions_changed = false
+ local keep_aspect = mp.get_property_bool("keepaspect")
+ local w = video_params["w"]
+ local h = video_params["h"]
+ local dw = video_params["dw"]
+ local dh = video_params["dh"]
+ if mp.get_property_number("video-rotate") % 180 == 90 then
+ w, h = h, w
+ dw, dh = dh, dw
+ end
+ _video_dimensions = {
+ top_left = { },
+ bottom_right = { },
+ ratios = { }
+ }
+ local window_w, window_h = mp.get_osd_size()
+ if keep_aspect then
+ local unscaled = mp.get_property_native("video-unscaled")
+ local panscan = mp.get_property_number("panscan")
+ local fwidth = window_w
+ local fheight = math.floor(window_w / dw * dh)
+ if fheight > window_h or fheight < h then
+ local tmpw = math.floor(window_h / dh * dw)
+ if tmpw <= window_w then
+ fheight = window_h
+ fwidth = tmpw
+ end
+ end
+ local vo_panscan_area = window_h - fheight
+ local f_w = fwidth / fheight
+ local f_h = 1
+ if vo_panscan_area == 0 then
+ vo_panscan_area = window_h - fwidth
+ f_w = 1
+ f_h = fheight / fwidth
+ end
+ if unscaled or unscaled == "downscale-big" then
+ vo_panscan_area = 0
+ if unscaled or (dw <= window_w and dh <= window_h) then
+ fwidth = dw
+ fheight = dh
+ end
+ end
+ local scaled_width = fwidth + math.floor(vo_panscan_area * panscan * f_w)
+ local scaled_height = fheight + math.floor(vo_panscan_area * panscan * f_h)
+ local split_scaling
+ split_scaling = function(dst_size, scaled_src_size, zoom, align, pan)
+ scaled_src_size = math.floor(scaled_src_size * 2 ^ zoom)
+ align = (align + 1) / 2
+ local dst_start = math.floor((dst_size - scaled_src_size) * align + pan * scaled_src_size)
+ if dst_start < 0 then
+ dst_start = dst_start + 1
+ end
+ local dst_end = dst_start + scaled_src_size
+ if dst_start >= dst_end then
+ dst_start = 0
+ dst_end = 1
+ end
+ return dst_start, dst_end
+ end
+ local zoom = mp.get_property_number("video-zoom")
+ local align_x = mp.get_property_number("video-align-x")
+ local pan_x = mp.get_property_number("video-pan-x")
+ _video_dimensions.top_left.x, _video_dimensions.bottom_right.x = split_scaling(window_w, scaled_width, zoom, align_x, pan_x)
+ local align_y = mp.get_property_number("video-align-y")
+ local pan_y = mp.get_property_number("video-pan-y")
+ _video_dimensions.top_left.y, _video_dimensions.bottom_right.y = split_scaling(window_h, scaled_height, zoom, align_y, pan_y)
+ else
+ _video_dimensions.top_left.x = 0
+ _video_dimensions.bottom_right.x = window_w
+ _video_dimensions.top_left.y = 0
+ _video_dimensions.bottom_right.y = window_h
+ end
+ _video_dimensions.ratios.w = w / (_video_dimensions.bottom_right.x - _video_dimensions.top_left.x)
+ _video_dimensions.ratios.h = h / (_video_dimensions.bottom_right.y - _video_dimensions.top_left.y)
+ return _video_dimensions
+end
+local set_dimensions_changed
+set_dimensions_changed = function()
+ dimensions_changed = true
+end
+local monitor_dimensions
+monitor_dimensions = function()
+ local properties = {
+ "keepaspect",
+ "video-out-params",
+ "video-unscaled",
+ "panscan",
+ "video-zoom",
+ "video-align-x",
+ "video-pan-x",
+ "video-align-y",
+ "video-pan-y",
+ "osd-width",
+ "osd-height"
+ }
+ for _, p in ipairs(properties) do
+ mp.observe_property(p, "native", set_dimensions_changed)
+ end
+end
+local clamp
+clamp = function(min, val, max)
+ if val <= min then
+ return min
+ end
+ if val >= max then
+ return max
+ end
+ return val
+end
+local clamp_point
+clamp_point = function(top_left, point, bottom_right)
+ return {
+ x = clamp(top_left.x, point.x, bottom_right.x),
+ y = clamp(top_left.y, point.y, bottom_right.y)
+ }
+end
+local VideoPoint
+do
+ local _class_0
+ local _base_0 = {
+ set_from_screen = function(self, sx, sy)
+ local d = get_video_dimensions()
+ local point = clamp_point(d.top_left, {
+ x = sx,
+ y = sy
+ }, d.bottom_right)
+ self.x = math.floor(d.ratios.w * (point.x - d.top_left.x) + 0.5)
+ self.y = math.floor(d.ratios.h * (point.y - d.top_left.y) + 0.5)
+ end,
+ to_screen = function(self)
+ local d = get_video_dimensions()
+ return {
+ x = math.floor(self.x / d.ratios.w + d.top_left.x + 0.5),
+ y = math.floor(self.y / d.ratios.h + d.top_left.y + 0.5)
+ }
+ end
+ }
+ _base_0.__index = _base_0
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.x = -1
+ self.y = -1
+ end,
+ __base = _base_0,
+ __name = "VideoPoint"
+ }, {
+ __index = _base_0,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ VideoPoint = _class_0
+end
+local Region
+do
+ local _class_0
+ local _base_0 = {
+ is_valid = function(self)
+ return self.x > -1 and self.y > -1 and self.w > -1 and self.h > -1
+ end,
+ set_from_points = function(self, p1, p2)
+ self.x = math.min(p1.x, p2.x)
+ self.y = math.min(p1.y, p2.y)
+ self.w = math.abs(p1.x - p2.x)
+ self.h = math.abs(p1.y - p2.y)
+ end
+ }
+ _base_0.__index = _base_0
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.x = -1
+ self.y = -1
+ self.w = -1
+ self.h = -1
+ end,
+ __base = _base_0,
+ __name = "Region"
+ }, {
+ __index = _base_0,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ Region = _class_0
+end
+local make_fullscreen_region
+make_fullscreen_region = function()
+ local r = Region()
+ local d = get_video_dimensions()
+ local a = VideoPoint()
+ local b = VideoPoint()
+ local xa, ya
+ do
+ local _obj_0 = d.top_left
+ xa, ya = _obj_0.x, _obj_0.y
+ end
+ a:set_from_screen(xa, ya)
+ local xb, yb
+ do
+ local _obj_0 = d.bottom_right
+ xb, yb = _obj_0.x, _obj_0.y
+ end
+ b:set_from_screen(xb, yb)
+ r:set_from_points(a, b)
+ return r
+end
+local read_double
+read_double = function(bytes)
+ local sign = 1
+ local mantissa = bytes[2] % 2 ^ 4
+ for i = 3, 8 do
+ mantissa = mantissa * 256 + bytes[i]
+ end
+ if bytes[1] > 127 then
+ sign = -1
+ end
+ local exponent = (bytes[1] % 128) * 2 ^ 4 + math.floor(bytes[2] / 2 ^ 4)
+ if exponent == 0 then
+ return 0
+ end
+ mantissa = (math.ldexp(mantissa, -52) + 1) * sign
+ return math.ldexp(mantissa, exponent - 1023)
+end
+local write_double
+write_double = function(num)
+ local bytes = {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ }
+ if num == 0 then
+ return bytes
+ end
+ local anum = math.abs(num)
+ local mantissa, exponent = math.frexp(anum)
+ exponent = exponent - 1
+ mantissa = mantissa * 2 - 1
+ local sign = num ~= anum and 128 or 0
+ exponent = exponent + 1023
+ bytes[1] = sign + math.floor(exponent / 2 ^ 4)
+ mantissa = mantissa * 2 ^ 4
+ local currentmantissa = math.floor(mantissa)
+ mantissa = mantissa - currentmantissa
+ bytes[2] = (exponent % 2 ^ 4) * 2 ^ 4 + currentmantissa
+ for i = 3, 8 do
+ mantissa = mantissa * 2 ^ 8
+ currentmantissa = math.floor(mantissa)
+ mantissa = mantissa - currentmantissa
+ bytes[i] = currentmantissa
+ end
+ return bytes
+end
+local FirstpassStats
+do
+ local _class_0
+ local duration_multiplier, fields_before_duration, fields_after_duration
+ local _base_0 = {
+ get_duration = function(self)
+ local big_endian_binary_duration = reverse(self.binary_duration)
+ return read_double(reversed_binary_duration) / duration_multiplier
+ end,
+ set_duration = function(self, duration)
+ local big_endian_binary_duration = write_double(duration * duration_multiplier)
+ self.binary_duration = reverse(big_endian_binary_duration)
+ end,
+ _bytes_to_string = function(self, bytes)
+ return string.char(unpack(bytes))
+ end,
+ as_binary_string = function(self)
+ local before_duration_string = self:_bytes_to_string(self.binary_data_before_duration)
+ local duration_string = self:_bytes_to_string(self.binary_duration)
+ local after_duration_string = self:_bytes_to_string(self.binary_data_after_duration)
+ return before_duration_string .. duration_string .. after_duration_string
+ end
+ }
+ _base_0.__index = _base_0
+ _class_0 = setmetatable({
+ __init = function(self, before_duration, duration, after_duration)
+ self.binary_data_before_duration = before_duration
+ self.binary_duration = duration
+ self.binary_data_after_duration = after_duration
+ end,
+ __base = _base_0,
+ __name = "FirstpassStats"
+ }, {
+ __index = _base_0,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ local self = _class_0
+ duration_multiplier = 10000000.0
+ fields_before_duration = 16
+ fields_after_duration = 1
+ self.data_before_duration_size = function(self)
+ return fields_before_duration * 8
+ end
+ self.data_after_duration_size = function(self)
+ return fields_after_duration * 8
+ end
+ self.size = function(self)
+ return (fields_before_duration + 1 + fields_after_duration) * 8
+ end
+ self.from_bytes = function(self, bytes)
+ local before_duration
+ do
+ local _accum_0 = { }
+ local _len_0 = 1
+ local _max_0 = self:data_before_duration_size()
+ for _index_0 = 1, _max_0 < 0 and #bytes + _max_0 or _max_0 do
+ local b = bytes[_index_0]
+ _accum_0[_len_0] = b
+ _len_0 = _len_0 + 1
+ end
+ before_duration = _accum_0
+ end
+ local duration
+ do
+ local _accum_0 = { }
+ local _len_0 = 1
+ local _max_0 = self:data_before_duration_size() + 8
+ for _index_0 = self:data_before_duration_size() + 1, _max_0 < 0 and #bytes + _max_0 or _max_0 do
+ local b = bytes[_index_0]
+ _accum_0[_len_0] = b
+ _len_0 = _len_0 + 1
+ end
+ duration = _accum_0
+ end
+ local after_duration
+ do
+ local _accum_0 = { }
+ local _len_0 = 1
+ for _index_0 = self:data_before_duration_size() + 8 + 1, #bytes do
+ local b = bytes[_index_0]
+ _accum_0[_len_0] = b
+ _len_0 = _len_0 + 1
+ end
+ after_duration = _accum_0
+ end
+ return self(before_duration, duration, after_duration)
+ end
+ FirstpassStats = _class_0
+end
+local read_logfile_into_stats_array
+read_logfile_into_stats_array = function(logfile_path)
+ local file = assert(io.open(logfile_path, "rb"))
+ local logfile_string = base64_decode(file:read())
+ file:close()
+ local stats_size = FirstpassStats:size()
+ assert(logfile_string:len() % stats_size == 0)
+ local stats = { }
+ for offset = 1, #logfile_string, stats_size do
+ local bytes = {
+ logfile_string:byte(offset, offset + stats_size - 1)
+ }
+ assert(#bytes == stats_size)
+ stats[#stats + 1] = FirstpassStats:from_bytes(bytes)
+ end
+ return stats
+end
+local write_stats_array_to_logfile
+write_stats_array_to_logfile = function(stats_array, logfile_path)
+ local file = assert(io.open(logfile_path, "wb"))
+ local logfile_string = ""
+ for _index_0 = 1, #stats_array do
+ local stat = stats_array[_index_0]
+ logfile_string = logfile_string .. stat:as_binary_string()
+ end
+ file:write(base64_encode(logfile_string))
+ return file:close()
+end
+local vp8_patch_logfile
+vp8_patch_logfile = function(logfile_path, encode_total_duration)
+ local stats_array = read_logfile_into_stats_array(logfile_path)
+ local average_duration = encode_total_duration / (#stats_array - 1)
+ for i = 1, #stats_array - 1 do
+ stats_array[i]:set_duration(average_duration)
+ end
+ stats_array[#stats_array]:set_duration(encode_total_duration)
+ return write_stats_array_to_logfile(stats_array, logfile_path)
+end
+local formats = { }
+local Format
+do
+ local _class_0
+ local _base_0 = {
+ getPreFilters = function(self)
+ return { }
+ end,
+ getPostFilters = function(self)
+ return { }
+ end,
+ getFlags = function(self)
+ return { }
+ end,
+ getCodecFlags = function(self)
+ local codecs = { }
+ if self.videoCodec ~= "" then
+ codecs[#codecs + 1] = "--ovc=" .. tostring(self.videoCodec)
+ end
+ if self.audioCodec ~= "" then
+ codecs[#codecs + 1] = "--oac=" .. tostring(self.audioCodec)
+ end
+ return codecs
+ end,
+ postCommandModifier = function(self, command, region, startTime, endTime)
+ return command
+ end
+ }
+ _base_0.__index = _base_0
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.displayName = "Basic"
+ self.supportsTwopass = true
+ self.videoCodec = ""
+ self.audioCodec = ""
+ self.outputExtension = ""
+ self.acceptsBitrate = true
+ end,
+ __base = _base_0,
+ __name = "Format"
+ }, {
+ __index = _base_0,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ Format = _class_0
+end
+local RawVideo
+do
+ local _class_0
+ local _parent_0 = Format
+ local _base_0 = {
+ getColorspace = function(self)
+ local csp = mp.get_property("colormatrix")
+ local _exp_0 = csp
+ if "bt.601" == _exp_0 then
+ return "bt601"
+ elseif "bt.709" == _exp_0 then
+ return "bt709"
+ elseif "bt.2020" == _exp_0 then
+ return "bt2020"
+ elseif "smpte-240m" == _exp_0 then
+ return "smpte240m"
+ else
+ msg.info("Warning, unknown colorspace " .. tostring(csp) .. " detected, using bt.601.")
+ return "bt601"
+ end
+ end,
+ getPostFilters = function(self)
+ return {
+ "format=yuv444p16",
+ "lavfi-scale=in_color_matrix=" .. self:getColorspace(),
+ "format=bgr24"
+ }
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.displayName = "Raw"
+ self.supportsTwopass = false
+ self.videoCodec = "rawvideo"
+ self.audioCodec = "pcm_s16le"
+ self.outputExtension = "avi"
+ self.acceptsBitrate = false
+ end,
+ __base = _base_0,
+ __name = "RawVideo",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ RawVideo = _class_0
+end
+formats["raw"] = RawVideo()
+local WebmVP8
+do
+ local _class_0
+ local _parent_0 = Format
+ local _base_0 = {
+ getPreFilters = function(self)
+ local colormatrixFilter = {
+ ["bt.709"] = "bt709",
+ ["bt.2020"] = "bt2020",
+ ["smpte-240m"] = "smpte240m"
+ }
+ local ret = { }
+ local colormatrix = mp.get_property_native("video-params/colormatrix")
+ if colormatrixFilter[colormatrix] then
+ append(ret, {
+ "lavfi-colormatrix=" .. tostring(colormatrixFilter[colormatrix]) .. ":bt601"
+ })
+ end
+ return ret
+ end,
+ getFlags = function(self)
+ return {
+ "--ovcopts-add=threads=" .. tostring(options.libvpx_threads),
+ "--ovcopts-add=auto-alt-ref=1",
+ "--ovcopts-add=lag-in-frames=25",
+ "--ovcopts-add=quality=good",
+ "--ovcopts-add=cpu-used=0"
+ }
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.displayName = "WebM"
+ self.supportsTwopass = true
+ self.videoCodec = "libvpx"
+ self.audioCodec = "libvorbis"
+ self.outputExtension = "webm"
+ self.acceptsBitrate = true
+ end,
+ __base = _base_0,
+ __name = "WebmVP8",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ WebmVP8 = _class_0
+end
+formats["webm-vp8"] = WebmVP8()
+local WebmVP9
+do
+ local _class_0
+ local _parent_0 = Format
+ local _base_0 = {
+ getFlags = function(self)
+ return {
+ "--ovcopts-add=threads=" .. tostring(options.libvpx_threads)
+ }
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.displayName = "WebM (VP9)"
+ self.supportsTwopass = false
+ self.videoCodec = "libvpx-vp9"
+ self.audioCodec = "libopus"
+ self.outputExtension = "webm"
+ self.acceptsBitrate = true
+ end,
+ __base = _base_0,
+ __name = "WebmVP9",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ WebmVP9 = _class_0
+end
+formats["webm-vp9"] = WebmVP9()
+local MP4
+do
+ local _class_0
+ local _parent_0 = Format
+ local _base_0 = { }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.displayName = "MP4 (h264/AAC)"
+ self.supportsTwopass = true
+ self.videoCodec = "libx264"
+ self.audioCodec = "aac"
+ self.outputExtension = "mp4"
+ self.acceptsBitrate = true
+ end,
+ __base = _base_0,
+ __name = "MP4",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ MP4 = _class_0
+end
+formats["mp4"] = MP4()
+local MP4NVENC
+do
+ local _class_0
+ local _parent_0 = Format
+ local _base_0 = { }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.displayName = "MP4 (h264-NVENC/AAC)"
+ self.supportsTwopass = true
+ self.videoCodec = "h264_nvenc"
+ self.audioCodec = "aac"
+ self.outputExtension = "mp4"
+ self.acceptsBitrate = true
+ end,
+ __base = _base_0,
+ __name = "MP4NVENC",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ MP4NVENC = _class_0
+end
+formats["mp4-nvenc"] = MP4NVENC()
+local MP3
+do
+ local _class_0
+ local _parent_0 = Format
+ local _base_0 = { }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.displayName = "MP3 (libmp3lame)"
+ self.supportsTwopass = false
+ self.videoCodec = ""
+ self.audioCodec = "libmp3lame"
+ self.outputExtension = "mp3"
+ self.acceptsBitrate = true
+ end,
+ __base = _base_0,
+ __name = "MP3",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ MP3 = _class_0
+end
+formats["mp3"] = MP3()
+local GIF
+do
+ local _class_0
+ local _parent_0 = Format
+ local _base_0 = {
+ postCommandModifier = function(self, command, region, startTime, endTime)
+ local new_command = { }
+ local start_ts = seconds_to_time_string(startTime, false, true)
+ local end_ts = seconds_to_time_string(endTime, false, true)
+ start_ts = start_ts:gsub(":", "\\\\:")
+ end_ts = end_ts:gsub(":", "\\\\:")
+ local cfilter = "[vid1]trim=start=" .. tostring(start_ts) .. ":end=" .. tostring(end_ts) .. "[vidtmp];"
+ if mp.get_property("deinterlace") == "yes" then
+ cfilter = cfilter .. "[vidtmp]yadif=mode=1[vidtmp];"
+ end
+ for _, v in ipairs(command) do
+ local _continue_0 = false
+ repeat
+ if v:match("^%-%-vf%-add=lavfi%-scale") or v:match("^%-%-vf%-add=lavfi%-crop") or v:match("^%-%-vf%-add=fps") or v:match("^%-%-vf%-add=lavfi%-eq") then
+ local n = v:gsub("^%-%-vf%-add=", ""):gsub("^lavfi%-", "")
+ cfilter = cfilter .. "[vidtmp]" .. tostring(n) .. "[vidtmp];"
+ else
+ if v:match("^%-%-video%-rotate=90") then
+ cfilter = cfilter .. "[vidtmp]transpose=1[vidtmp];"
+ else
+ if v:match("^%-%-video%-rotate=270") then
+ cfilter = cfilter .. "[vidtmp]transpose=2[vidtmp];"
+ else
+ if v:match("^%-%-video%-rotate=180") then
+ cfilter = cfilter .. "[vidtmp]transpose=1[vidtmp];[vidtmp]transpose=1[vidtmp];"
+ else
+ if v:match("^%-%-deinterlace=") then
+ _continue_0 = true
+ break
+ else
+ append(new_command, {
+ v
+ })
+ _continue_0 = true
+ break
+ end
+ end
+ end
+ end
+ end
+ _continue_0 = true
+ until true
+ if not _continue_0 then
+ break
+ end
+ end
+ cfilter = cfilter .. "[vidtmp]split[topal][vidf];"
+ cfilter = cfilter .. "[topal]palettegen[pal];"
+ cfilter = cfilter .. "[vidf]fifo[vidf];"
+ if options.gif_dither == 6 then
+ cfilter = cfilter .. "[vidf][pal]paletteuse[vo]"
+ else
+ cfilter = cfilter .. "[vidf][pal]paletteuse=dither=bayer:bayer_scale=" .. tostring(options.gif_dither) .. ":diff_mode=rectangle[vo]"
+ end
+ append(new_command, {
+ "--lavfi-complex=" .. tostring(cfilter)
+ })
+ return new_command
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.displayName = "GIF"
+ self.supportsTwopass = false
+ self.videoCodec = "gif"
+ self.audioCodec = ""
+ self.outputExtension = "gif"
+ self.acceptsBitrate = false
+ end,
+ __base = _base_0,
+ __name = "GIF",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ GIF = _class_0
+end
+formats["gif"] = GIF()
+local Page
+do
+ local _class_0
+ local _base_0 = {
+ add_keybinds = function(self)
+ if not self.keybinds then
+ return
+ end
+ for key, func in pairs(self.keybinds) do
+ mp.add_forced_key_binding(key, key, func, {
+ repeatable = true
+ })
+ end
+ end,
+ remove_keybinds = function(self)
+ if not self.keybinds then
+ return
+ end
+ for key, _ in pairs(self.keybinds) do
+ mp.remove_key_binding(key)
+ end
+ end,
+ observe_properties = function(self)
+ self.sizeCallback = function()
+ return self:draw()
+ end
+ local properties = {
+ "keepaspect",
+ "video-out-params",
+ "video-unscaled",
+ "panscan",
+ "video-zoom",
+ "video-align-x",
+ "video-pan-x",
+ "video-align-y",
+ "video-pan-y",
+ "osd-width",
+ "osd-height"
+ }
+ for _index_0 = 1, #properties do
+ local p = properties[_index_0]
+ mp.observe_property(p, "native", self.sizeCallback)
+ end
+ end,
+ unobserve_properties = function(self)
+ if self.sizeCallback then
+ mp.unobserve_property(self.sizeCallback)
+ self.sizeCallback = nil
+ end
+ end,
+ clear = function(self)
+ local window_w, window_h = mp.get_osd_size()
+ mp.set_osd_ass(window_w, window_h, "")
+ return mp.osd_message("", 0)
+ end,
+ prepare = function(self)
+ return nil
+ end,
+ dispose = function(self)
+ return nil
+ end,
+ show = function(self)
+ if self.visible then
+ return
+ end
+ self.visible = true
+ self:observe_properties()
+ self:add_keybinds()
+ self:prepare()
+ self:clear()
+ return self:draw()
+ end,
+ hide = function(self)
+ if not self.visible then
+ return
+ end
+ self.visible = false
+ self:unobserve_properties()
+ self:remove_keybinds()
+ self:clear()
+ return self:dispose()
+ end,
+ setup_text = function(self, ass)
+ local scale = calculate_scale_factor()
+ local margin = options.margin * scale
+ ass:append("{\\an7}")
+ ass:pos(margin, margin)
+ return ass:append("{\\fs" .. tostring(options.font_size * scale) .. "}")
+ end
+ }
+ _base_0.__index = _base_0
+ _class_0 = setmetatable({
+ __init = function() end,
+ __base = _base_0,
+ __name = "Page"
+ }, {
+ __index = _base_0,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ Page = _class_0
+end
+local EncodeWithProgress
+do
+ local _class_0
+ local _parent_0 = Page
+ local _base_0 = {
+ draw = function(self)
+ local progress = 100 * ((self.currentTime - self.startTime) / self.duration)
+ local progressText = string.format("%d%%", progress)
+ local window_w, window_h = mp.get_osd_size()
+ local ass = assdraw.ass_new()
+ ass:new_event()
+ self:setup_text(ass)
+ ass:append("Encoding (" .. tostring(bold(progressText)) .. ")\\N")
+ return mp.set_osd_ass(window_w, window_h, ass.text)
+ end,
+ parseLine = function(self, line)
+ local matchTime = string.match(line, "Encode time[-]pos: ([0-9.]+)")
+ local matchExit = string.match(line, "Exiting... [(]([%a ]+)[)]")
+ if matchTime == nil and matchExit == nil then
+ return
+ end
+ if matchTime ~= nil and tonumber(matchTime) > self.currentTime then
+ self.currentTime = tonumber(matchTime)
+ end
+ if matchExit ~= nil then
+ self.finished = true
+ self.finishedReason = matchExit
+ end
+ end,
+ startEncode = function(self, command_line)
+ local copy_command_line
+ do
+ local _accum_0 = { }
+ local _len_0 = 1
+ for _index_0 = 1, #command_line do
+ local arg = command_line[_index_0]
+ _accum_0[_len_0] = arg
+ _len_0 = _len_0 + 1
+ end
+ copy_command_line = _accum_0
+ end
+ append(copy_command_line, {
+ '--term-status-msg=Encode time-pos: ${=time-pos}\\n'
+ })
+ self:show()
+ local processFd = run_subprocess_popen(copy_command_line)
+ for line in processFd:lines() do
+ msg.verbose(string.format('%q', line))
+ self:parseLine(line)
+ self:draw()
+ end
+ processFd:close()
+ self:hide()
+ if self.finishedReason == "End of file" then
+ return true
+ end
+ return false
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self, startTime, endTime)
+ self.startTime = startTime
+ self.endTime = endTime
+ self.duration = endTime - startTime
+ self.currentTime = startTime
+ end,
+ __base = _base_0,
+ __name = "EncodeWithProgress",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ EncodeWithProgress = _class_0
+end
+local get_active_tracks
+get_active_tracks = function()
+ local accepted = {
+ video = true,
+ audio = not mp.get_property_bool("mute"),
+ sub = mp.get_property_bool("sub-visibility")
+ }
+ local active = {
+ video = { },
+ audio = { },
+ sub = { }
+ }
+ for _, track in ipairs(mp.get_property_native("track-list")) do
+ if track["selected"] and accepted[track["type"]] then
+ local count = #active[track["type"]]
+ active[track["type"]][count + 1] = track
+ end
+ end
+ return active
+end
+local filter_tracks_supported_by_format
+filter_tracks_supported_by_format = function(active_tracks, format)
+ local has_video_codec = format.videoCodec ~= ""
+ local has_audio_codec = format.audioCodec ~= ""
+ local supported = {
+ video = has_video_codec and active_tracks["video"] or { },
+ audio = has_audio_codec and active_tracks["audio"] or { },
+ sub = has_video_codec and active_tracks["sub"] or { }
+ }
+ return supported
+end
+local append_track
+append_track = function(out, track)
+ local external_flag = {
+ ["audio"] = "audio-file",
+ ["sub"] = "sub-file"
+ }
+ local internal_flag = {
+ ["video"] = "vid",
+ ["audio"] = "aid",
+ ["sub"] = "sid"
+ }
+ if track['external'] and string.len(track['external-filename']) <= 2048 then
+ return append(out, {
+ "--" .. tostring(external_flag[track['type']]) .. "=" .. tostring(track['external-filename'])
+ })
+ else
+ return append(out, {
+ "--" .. tostring(internal_flag[track['type']]) .. "=" .. tostring(track['id'])
+ })
+ end
+end
+local append_audio_tracks
+append_audio_tracks = function(out, tracks)
+ local internal_tracks = { }
+ for _index_0 = 1, #tracks do
+ local track = tracks[_index_0]
+ if track['external'] then
+ append_track(out, track)
+ else
+ append(internal_tracks, {
+ track
+ })
+ end
+ end
+ if #internal_tracks > 1 then
+ local filter_string = ""
+ for _index_0 = 1, #internal_tracks do
+ local track = internal_tracks[_index_0]
+ filter_string = filter_string .. "[aid" .. tostring(track['id']) .. "]"
+ end
+ filter_string = filter_string .. "amix[ao]"
+ return append(out, {
+ "--lavfi-complex=" .. tostring(filter_string)
+ })
+ else
+ if #internal_tracks == 1 then
+ return append_track(out, internal_tracks[1])
+ end
+ end
+end
+local get_scale_filters
+get_scale_filters = function()
+ local filters = { }
+ if options.force_square_pixels then
+ append(filters, {
+ "lavfi-scale=iw*sar:ih"
+ })
+ end
+ if options.scale_height > 0 then
+ append(filters, {
+ "lavfi-scale=-2:" .. tostring(options.scale_height)
+ })
+ end
+ return filters
+end
+local get_fps_filters
+get_fps_filters = function()
+ if options.fps > 0 then
+ return {
+ "fps=" .. tostring(options.fps)
+ }
+ end
+ return { }
+end
+local get_contrast_brightness_and_saturation_filters
+get_contrast_brightness_and_saturation_filters = function()
+ local mpv_brightness = mp.get_property("brightness")
+ local mpv_contrast = mp.get_property("contrast")
+ local mpv_saturation = mp.get_property("saturation")
+ if mpv_brightness == 0 and mpv_contrast == 0 and mpv_saturation == 0 then
+ return { }
+ end
+ local eq_saturation = (mpv_saturation + 100) / 100.0
+ local eq_contrast = (mpv_contrast + 100) / 100.0
+ local eq_brightness = (mpv_brightness / 50.0 + eq_contrast - 1) / 2.0
+ return {
+ "lavfi-eq=contrast=" .. tostring(eq_contrast) .. ":saturation=" .. tostring(eq_saturation) .. ":brightness=" .. tostring(eq_brightness)
+ }
+end
+local append_property
+append_property = function(out, property_name, option_name)
+ option_name = option_name or property_name
+ local prop = mp.get_property(property_name)
+ if prop and prop ~= "" then
+ return append(out, {
+ "--" .. tostring(option_name) .. "=" .. tostring(prop)
+ })
+ end
+end
+local append_list_options
+append_list_options = function(out, property_name, option_prefix)
+ option_prefix = option_prefix or property_name
+ local prop = mp.get_property_native(property_name)
+ if prop then
+ for _index_0 = 1, #prop do
+ local value = prop[_index_0]
+ append(out, {
+ "--" .. tostring(option_prefix) .. "-append=" .. tostring(value)
+ })
+ end
+ end
+end
+local get_playback_options
+get_playback_options = function()
+ local ret = { }
+ append_property(ret, "sub-ass-override")
+ append_property(ret, "sub-ass-force-style")
+ append_property(ret, "sub-ass-vsfilter-aspect-compat")
+ append_property(ret, "sub-auto")
+ append_property(ret, "sub-pos")
+ append_property(ret, "sub-delay")
+ append_property(ret, "video-rotate")
+ append_property(ret, "ytdl-format")
+ append_property(ret, "deinterlace")
+ return ret
+end
+local get_speed_flags
+get_speed_flags = function()
+ local ret = { }
+ local speed = mp.get_property_native("speed")
+ if speed ~= 1 then
+ append(ret, {
+ "--vf-add=setpts=PTS/" .. tostring(speed),
+ "--af-add=atempo=" .. tostring(speed),
+ "--sub-speed=1/" .. tostring(speed)
+ })
+ end
+ return ret
+end
+local get_metadata_flags
+get_metadata_flags = function()
+ local title = mp.get_property("filename/no-ext")
+ return {
+ "--oset-metadata=title=%" .. tostring(string.len(title)) .. "%" .. tostring(title)
+ }
+end
+local apply_current_filters
+apply_current_filters = function(filters)
+ local vf = mp.get_property_native("vf")
+ msg.verbose("apply_current_filters: got " .. tostring(#vf) .. " currently applied.")
+ for _index_0 = 1, #vf do
+ local _continue_0 = false
+ repeat
+ local filter = vf[_index_0]
+ msg.verbose("apply_current_filters: filter name: " .. tostring(filter['name']))
+ if filter["enabled"] == false then
+ _continue_0 = true
+ break
+ end
+ local str = filter["name"]
+ local params = filter["params"] or { }
+ for k, v in pairs(params) do
+ str = str .. ":" .. tostring(k) .. "=%" .. tostring(string.len(v)) .. "%" .. tostring(v)
+ end
+ append(filters, {
+ str
+ })
+ _continue_0 = true
+ until true
+ if not _continue_0 then
+ break
+ end
+ end
+end
+local get_video_filters
+get_video_filters = function(format, region)
+ local filters = { }
+ append(filters, format:getPreFilters())
+ if options.apply_current_filters then
+ apply_current_filters(filters)
+ end
+ if region and region:is_valid() then
+ append(filters, {
+ "lavfi-crop=" .. tostring(region.w) .. ":" .. tostring(region.h) .. ":" .. tostring(region.x) .. ":" .. tostring(region.y)
+ })
+ end
+ append(filters, get_scale_filters())
+ append(filters, get_fps_filters())
+ append(filters, get_contrast_brightness_and_saturation_filters())
+ append(filters, format:getPostFilters())
+ return filters
+end
+local get_video_encode_flags
+get_video_encode_flags = function(format, region)
+ local flags = { }
+ append(flags, get_playback_options())
+ local filters = get_video_filters(format, region)
+ for _index_0 = 1, #filters do
+ local f = filters[_index_0]
+ append(flags, {
+ "--vf-add=" .. tostring(f)
+ })
+ end
+ append(flags, get_speed_flags())
+ return flags
+end
+local calculate_bitrate
+calculate_bitrate = function(active_tracks, format, length)
+ if format.videoCodec == "" then
+ return nil, options.target_filesize * 8 / length
+ end
+ local video_kilobits = options.target_filesize * 8
+ local audio_kilobits = nil
+ local has_audio_track = #active_tracks["audio"] > 0
+ if options.strict_filesize_constraint and has_audio_track then
+ audio_kilobits = length * options.strict_audio_bitrate
+ video_kilobits = video_kilobits - audio_kilobits
+ end
+ local video_bitrate = math.floor(video_kilobits / length)
+ local audio_bitrate = audio_kilobits and math.floor(audio_kilobits / length) or nil
+ return video_bitrate, audio_bitrate
+end
+local find_path
+find_path = function(startTime, endTime)
+ local path = mp.get_property('path')
+ if not path then
+ return nil, nil, nil, nil, nil
+ end
+ local is_stream = not file_exists(path)
+ local is_temporary = false
+ if is_stream then
+ if mp.get_property('file-format') == 'hls' then
+ path = utils.join_path(parse_directory('~'), 'cache_dump.ts')
+ mp.command_native({
+ 'dump_cache',
+ seconds_to_time_string(startTime, false, true),
+ seconds_to_time_string(endTime + 5, false, true),
+ path
+ })
+ endTime = endTime - startTime
+ startTime = 0
+ is_temporary = true
+ end
+ end
+ return path, is_stream, is_temporary, startTime, endTime
+end
+local encode
+encode = function(region, startTime, endTime)
+ local format = formats[options.output_format]
+ local originalStartTime = startTime
+ local originalEndTime = endTime
+ local path, is_stream, is_temporary
+ path, is_stream, is_temporary, startTime, endTime = find_path(startTime, endTime)
+ if not path then
+ message("No file is being played")
+ return
+ end
+ local command = {
+ "mpv",
+ path,
+ "--start=" .. seconds_to_time_string(startTime, false, true),
+ "--end=" .. seconds_to_time_string(endTime, false, true),
+ "--loop-file=no",
+ "--no-pause"
+ }
+ append(command, format:getCodecFlags())
+ local active_tracks = get_active_tracks()
+ local supported_active_tracks = filter_tracks_supported_by_format(active_tracks, format)
+ for track_type, tracks in pairs(supported_active_tracks) do
+ if track_type == "audio" then
+ append_audio_tracks(command, tracks)
+ else
+ for _index_0 = 1, #tracks do
+ local track = tracks[_index_0]
+ append_track(command, track)
+ end
+ end
+ end
+ for track_type, tracks in pairs(supported_active_tracks) do
+ local _continue_0 = false
+ repeat
+ if #tracks > 0 then
+ _continue_0 = true
+ break
+ end
+ local _exp_0 = track_type
+ if "video" == _exp_0 then
+ append(command, {
+ "--vid=no"
+ })
+ elseif "audio" == _exp_0 then
+ append(command, {
+ "--aid=no"
+ })
+ elseif "sub" == _exp_0 then
+ append(command, {
+ "--sid=no"
+ })
+ end
+ _continue_0 = true
+ until true
+ if not _continue_0 then
+ break
+ end
+ end
+ if format.videoCodec ~= "" then
+ append(command, get_video_encode_flags(format, region))
+ end
+ append(command, format:getFlags())
+ if options.write_filename_on_metadata then
+ append(command, get_metadata_flags())
+ end
+ if format.acceptsBitrate then
+ if options.target_filesize > 0 then
+ local length = endTime - startTime
+ local video_bitrate, audio_bitrate = calculate_bitrate(supported_active_tracks, format, length)
+ if video_bitrate then
+ append(command, {
+ "--ovcopts-add=b=" .. tostring(video_bitrate) .. "k"
+ })
+ end
+ if audio_bitrate then
+ append(command, {
+ "--oacopts-add=b=" .. tostring(audio_bitrate) .. "k"
+ })
+ end
+ if options.strict_filesize_constraint then
+ local type = format.videoCodec ~= "" and "ovc" or "oac"
+ append(command, {
+ "--" .. tostring(type) .. "opts-add=minrate=" .. tostring(bitrate) .. "k",
+ "--" .. tostring(type) .. "opts-add=maxrate=" .. tostring(bitrate) .. "k"
+ })
+ end
+ else
+ local type = format.videoCodec ~= "" and "ovc" or "oac"
+ append(command, {
+ "--" .. tostring(type) .. "opts-add=b=0"
+ })
+ end
+ end
+ for token in string.gmatch(options.additional_flags, "[^%s]+") do
+ command[#command + 1] = token
+ end
+ if not options.strict_filesize_constraint then
+ for token in string.gmatch(options.non_strict_additional_flags, "[^%s]+") do
+ command[#command + 1] = token
+ end
+ if options.crf >= 0 then
+ append(command, {
+ "--ovcopts-add=crf=" .. tostring(options.crf)
+ })
+ end
+ end
+ local dir = ""
+ if is_stream then
+ dir = parse_directory("~")
+ else
+ local _
+ dir, _ = utils.split_path(path)
+ end
+ if options.output_directory ~= "" then
+ dir = parse_directory(options.output_directory)
+ end
+ local formatted_filename = format_filename(originalStartTime, originalEndTime, format)
+ local out_path = utils.join_path(dir, formatted_filename)
+ append(command, {
+ "--o=" .. tostring(out_path)
+ })
+ emit_event("encode-started")
+ if options.twopass and format.supportsTwopass and not is_stream then
+ local first_pass_cmdline
+ do
+ local _accum_0 = { }
+ local _len_0 = 1
+ for _index_0 = 1, #command do
+ local arg = command[_index_0]
+ _accum_0[_len_0] = arg
+ _len_0 = _len_0 + 1
+ end
+ first_pass_cmdline = _accum_0
+ end
+ append(first_pass_cmdline, {
+ "--ovcopts-add=flags=+pass1"
+ })
+ message("Starting first pass...")
+ msg.verbose("First-pass command line: ", table.concat(first_pass_cmdline, " "))
+ local res = run_subprocess({
+ args = first_pass_cmdline,
+ cancellable = false
+ })
+ if not res then
+ message("First pass failed! Check the logs for details.")
+ emit_event("encode-finished", "fail")
+ return
+ end
+ append(command, {
+ "--ovcopts-add=flags=+pass2"
+ })
+ if format.videoCodec == "libvpx" then
+ msg.verbose("Patching libvpx pass log file...")
+ vp8_patch_logfile(get_pass_logfile_path(out_path), endTime - startTime)
+ end
+ end
+ command = format:postCommandModifier(command, region, startTime, endTime)
+ msg.info("Encoding to", out_path)
+ msg.verbose("Command line:", table.concat(command, " "))
+ if options.run_detached then
+ message("Started encode, process was detached.")
+ return utils.subprocess_detached({
+ args = command
+ })
+ else
+ local res = false
+ if not should_display_progress() then
+ message("Started encode...")
+ res = run_subprocess({
+ args = command,
+ cancellable = false
+ })
+ else
+ local ewp = EncodeWithProgress(startTime, endTime)
+ res = ewp:startEncode(command)
+ end
+ if res then
+ message("Encoded successfully! Saved to\\N" .. tostring(bold(out_path)))
+ emit_event("encode-finished", "success")
+ else
+ message("Encode failed! Check the logs for details.")
+ emit_event("encode-finished", "fail")
+ end
+ os.remove(get_pass_logfile_path(out_path))
+ if is_temporary then
+ return os.remove(path)
+ end
+ end
+end
+local CropPage
+do
+ local _class_0
+ local _parent_0 = Page
+ local _base_0 = {
+ reset = function(self)
+ local dimensions = get_video_dimensions()
+ local xa, ya
+ do
+ local _obj_0 = dimensions.top_left
+ xa, ya = _obj_0.x, _obj_0.y
+ end
+ self.pointA:set_from_screen(xa, ya)
+ local xb, yb
+ do
+ local _obj_0 = dimensions.bottom_right
+ xb, yb = _obj_0.x, _obj_0.y
+ end
+ self.pointB:set_from_screen(xb, yb)
+ if self.visible then
+ return self:draw()
+ end
+ end,
+ setPointA = function(self)
+ local posX, posY = mp.get_mouse_pos()
+ self.pointA:set_from_screen(posX, posY)
+ if self.visible then
+ return self:draw()
+ end
+ end,
+ setPointB = function(self)
+ local posX, posY = mp.get_mouse_pos()
+ self.pointB:set_from_screen(posX, posY)
+ if self.visible then
+ return self:draw()
+ end
+ end,
+ cancel = function(self)
+ self:hide()
+ return self.callback(false, nil)
+ end,
+ finish = function(self)
+ local region = Region()
+ region:set_from_points(self.pointA, self.pointB)
+ self:hide()
+ return self.callback(true, region)
+ end,
+ draw_box = function(self, ass)
+ local region = Region()
+ region:set_from_points(self.pointA:to_screen(), self.pointB:to_screen())
+ local d = get_video_dimensions()
+ ass:new_event()
+ ass:append("{\\an7}")
+ ass:pos(0, 0)
+ ass:append('{\\bord0}')
+ ass:append('{\\shad0}')
+ ass:append('{\\c&H000000&}')
+ ass:append('{\\alpha&H77}')
+ ass:draw_start()
+ ass:rect_cw(d.top_left.x, d.top_left.y, region.x, region.y + region.h)
+ ass:rect_cw(region.x, d.top_left.y, d.bottom_right.x, region.y)
+ ass:rect_cw(d.top_left.x, region.y + region.h, region.x + region.w, d.bottom_right.y)
+ ass:rect_cw(region.x + region.w, region.y, d.bottom_right.x, d.bottom_right.y)
+ return ass:draw_stop()
+ end,
+ draw = function(self)
+ local window = { }
+ window.w, window.h = mp.get_osd_size()
+ local ass = assdraw.ass_new()
+ self:draw_box(ass)
+ ass:new_event()
+ self:setup_text(ass)
+ ass:append(tostring(bold('Crop:')) .. "\\N")
+ ass:append(tostring(bold('1:')) .. " change point A (" .. tostring(self.pointA.x) .. ", " .. tostring(self.pointA.y) .. ")\\N")
+ ass:append(tostring(bold('2:')) .. " change point B (" .. tostring(self.pointB.x) .. ", " .. tostring(self.pointB.y) .. ")\\N")
+ ass:append(tostring(bold('r:')) .. " reset to whole screen\\N")
+ ass:append(tostring(bold('ESC:')) .. " cancel crop\\N")
+ local width, height = math.abs(self.pointA.x - self.pointB.x), math.abs(self.pointA.y - self.pointB.y)
+ ass:append(tostring(bold('ENTER:')) .. " confirm crop (" .. tostring(width) .. "x" .. tostring(height) .. ")\\N")
+ return mp.set_osd_ass(window.w, window.h, ass.text)
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self, callback, region)
+ self.pointA = VideoPoint()
+ self.pointB = VideoPoint()
+ self.keybinds = {
+ ["1"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.setPointA
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["2"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.setPointB
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["r"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.reset
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["ESC"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.cancel
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["ENTER"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.finish
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)()
+ }
+ self:reset()
+ self.callback = callback
+ if region and region:is_valid() then
+ self.pointA.x = region.x
+ self.pointA.y = region.y
+ self.pointB.x = region.x + region.w
+ self.pointB.y = region.y + region.h
+ end
+ end,
+ __base = _base_0,
+ __name = "CropPage",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ CropPage = _class_0
+end
+local Option
+do
+ local _class_0
+ local _base_0 = {
+ hasPrevious = function(self)
+ local _exp_0 = self.optType
+ if "bool" == _exp_0 then
+ return true
+ elseif "int" == _exp_0 then
+ if self.opts.min then
+ return self.value > self.opts.min
+ else
+ return true
+ end
+ elseif "list" == _exp_0 then
+ return self.value > 1
+ end
+ end,
+ hasNext = function(self)
+ local _exp_0 = self.optType
+ if "bool" == _exp_0 then
+ return true
+ elseif "int" == _exp_0 then
+ if self.opts.max then
+ return self.value < self.opts.max
+ else
+ return true
+ end
+ elseif "list" == _exp_0 then
+ return self.value < #self.opts.possibleValues
+ end
+ end,
+ leftKey = function(self)
+ local _exp_0 = self.optType
+ if "bool" == _exp_0 then
+ self.value = not self.value
+ elseif "int" == _exp_0 then
+ self.value = self.value - self.opts.step
+ if self.opts.min and self.opts.min > self.value then
+ self.value = self.opts.min
+ end
+ elseif "list" == _exp_0 then
+ if self.value > 1 then
+ self.value = self.value - 1
+ end
+ end
+ end,
+ rightKey = function(self)
+ local _exp_0 = self.optType
+ if "bool" == _exp_0 then
+ self.value = not self.value
+ elseif "int" == _exp_0 then
+ self.value = self.value + self.opts.step
+ if self.opts.max and self.opts.max < self.value then
+ self.value = self.opts.max
+ end
+ elseif "list" == _exp_0 then
+ if self.value < #self.opts.possibleValues then
+ self.value = self.value + 1
+ end
+ end
+ end,
+ getValue = function(self)
+ local _exp_0 = self.optType
+ if "bool" == _exp_0 then
+ return self.value
+ elseif "int" == _exp_0 then
+ return self.value
+ elseif "list" == _exp_0 then
+ local value, _
+ do
+ local _obj_0 = self.opts.possibleValues[self.value]
+ value, _ = _obj_0[1], _obj_0[2]
+ end
+ return value
+ end
+ end,
+ setValue = function(self, value)
+ local _exp_0 = self.optType
+ if "bool" == _exp_0 then
+ self.value = value
+ elseif "int" == _exp_0 then
+ self.value = value
+ elseif "list" == _exp_0 then
+ local set = false
+ for i, possiblePair in ipairs(self.opts.possibleValues) do
+ local possibleValue, _
+ possibleValue, _ = possiblePair[1], possiblePair[2]
+ if possibleValue == value then
+ set = true
+ self.value = i
+ break
+ end
+ end
+ if not set then
+ return msg.warn("Tried to set invalid value " .. tostring(value) .. " to " .. tostring(self.displayText) .. " option.")
+ end
+ end
+ end,
+ getDisplayValue = function(self)
+ local _exp_0 = self.optType
+ if "bool" == _exp_0 then
+ return self.value and "yes" or "no"
+ elseif "int" == _exp_0 then
+ if self.opts.altDisplayNames and self.opts.altDisplayNames[self.value] then
+ return self.opts.altDisplayNames[self.value]
+ else
+ return tostring(self.value)
+ end
+ elseif "list" == _exp_0 then
+ local value, displayValue
+ do
+ local _obj_0 = self.opts.possibleValues[self.value]
+ value, displayValue = _obj_0[1], _obj_0[2]
+ end
+ return displayValue or value
+ end
+ end,
+ draw = function(self, ass, selected)
+ if selected then
+ ass:append(tostring(bold(self.displayText)) .. ": ")
+ else
+ ass:append(tostring(self.displayText) .. ": ")
+ end
+ if self:hasPrevious() then
+ ass:append("◀ ")
+ end
+ ass:append(self:getDisplayValue())
+ if self:hasNext() then
+ ass:append(" ▶")
+ end
+ return ass:append("\\N")
+ end,
+ optVisible = function(self)
+ if self.visibleCheckFn == nil then
+ return true
+ else
+ return self.visibleCheckFn()
+ end
+ end
+ }
+ _base_0.__index = _base_0
+ _class_0 = setmetatable({
+ __init = function(self, optType, displayText, value, opts, visibleCheckFn)
+ self.optType = optType
+ self.displayText = displayText
+ self.opts = opts
+ self.value = 1
+ self.visibleCheckFn = visibleCheckFn
+ return self:setValue(value)
+ end,
+ __base = _base_0,
+ __name = "Option"
+ }, {
+ __index = _base_0,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ Option = _class_0
+end
+local EncodeOptionsPage
+do
+ local _class_0
+ local _parent_0 = Page
+ local _base_0 = {
+ getCurrentOption = function(self)
+ return self.options[self.currentOption][2]
+ end,
+ leftKey = function(self)
+ (self:getCurrentOption()):leftKey()
+ return self:draw()
+ end,
+ rightKey = function(self)
+ (self:getCurrentOption()):rightKey()
+ return self:draw()
+ end,
+ prevOpt = function(self)
+ for i = self.currentOption - 1, 1, -1 do
+ if self.options[i][2]:optVisible() then
+ self.currentOption = i
+ break
+ end
+ end
+ return self:draw()
+ end,
+ nextOpt = function(self)
+ for i = self.currentOption + 1, #self.options do
+ if self.options[i][2]:optVisible() then
+ self.currentOption = i
+ break
+ end
+ end
+ return self:draw()
+ end,
+ confirmOpts = function(self)
+ for _, optPair in ipairs(self.options) do
+ local optName, opt
+ optName, opt = optPair[1], optPair[2]
+ options[optName] = opt:getValue()
+ end
+ self:hide()
+ return self.callback(true)
+ end,
+ cancelOpts = function(self)
+ self:hide()
+ return self.callback(false)
+ end,
+ draw = function(self)
+ local window_w, window_h = mp.get_osd_size()
+ local ass = assdraw.ass_new()
+ ass:new_event()
+ self:setup_text(ass)
+ ass:append(tostring(bold('Options:')) .. "\\N\\N")
+ for i, optPair in ipairs(self.options) do
+ local opt = optPair[2]
+ if opt:optVisible() then
+ opt:draw(ass, self.currentOption == i)
+ end
+ end
+ ass:append("\\N▲ / ▼: navigate\\N")
+ ass:append(tostring(bold('ENTER:')) .. " confirm options\\N")
+ ass:append(tostring(bold('ESC:')) .. " cancel\\N")
+ return mp.set_osd_ass(window_w, window_h, ass.text)
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self, callback)
+ self.callback = callback
+ self.currentOption = 1
+ local scaleHeightOpts = {
+ possibleValues = {
+ {
+ -1,
+ "no"
+ },
+ {
+ 144
+ },
+ {
+ 240
+ },
+ {
+ 360
+ },
+ {
+ 480
+ },
+ {
+ 540
+ },
+ {
+ 720
+ },
+ {
+ 1080
+ },
+ {
+ 1440
+ },
+ {
+ 2160
+ }
+ }
+ }
+ local filesizeOpts = {
+ step = 250,
+ min = 0,
+ altDisplayNames = {
+ [0] = "0 (constant quality)"
+ }
+ }
+ local crfOpts = {
+ step = 1,
+ min = -1,
+ altDisplayNames = {
+ [-1] = "disabled"
+ }
+ }
+ local fpsOpts = {
+ possibleValues = {
+ {
+ -1,
+ "source"
+ },
+ {
+ 15
+ },
+ {
+ 24
+ },
+ {
+ 30
+ },
+ {
+ 48
+ },
+ {
+ 50
+ },
+ {
+ 60
+ },
+ {
+ 120
+ },
+ {
+ 240
+ }
+ }
+ }
+ local formatIds = {
+ "webm-vp8",
+ "webm-vp9",
+ "mp4",
+ "mp4-nvenc",
+ "raw",
+ "mp3",
+ "gif"
+ }
+ local formatOpts = {
+ possibleValues = (function()
+ local _accum_0 = { }
+ local _len_0 = 1
+ for _index_0 = 1, #formatIds do
+ local fId = formatIds[_index_0]
+ _accum_0[_len_0] = {
+ fId,
+ formats[fId].displayName
+ }
+ _len_0 = _len_0 + 1
+ end
+ return _accum_0
+ end)()
+ }
+ local gifDitherOpts = {
+ possibleValues = {
+ {
+ 0,
+ "bayer_scale 0"
+ },
+ {
+ 1,
+ "bayer_scale 1"
+ },
+ {
+ 2,
+ "bayer_scale 2"
+ },
+ {
+ 3,
+ "bayer_scale 3"
+ },
+ {
+ 4,
+ "bayer_scale 4"
+ },
+ {
+ 5,
+ "bayer_scale 5"
+ },
+ {
+ 6,
+ "sierra2_4a"
+ }
+ }
+ }
+ self.options = {
+ {
+ "output_format",
+ Option("list", "Output Format", options.output_format, formatOpts)
+ },
+ {
+ "twopass",
+ Option("bool", "Two Pass", options.twopass)
+ },
+ {
+ "apply_current_filters",
+ Option("bool", "Apply Current Video Filters", options.apply_current_filters)
+ },
+ {
+ "scale_height",
+ Option("list", "Scale Height", options.scale_height, scaleHeightOpts)
+ },
+ {
+ "strict_filesize_constraint",
+ Option("bool", "Strict Filesize Constraint", options.strict_filesize_constraint)
+ },
+ {
+ "write_filename_on_metadata",
+ Option("bool", "Write Filename on Metadata", options.write_filename_on_metadata)
+ },
+ {
+ "target_filesize",
+ Option("int", "Target Filesize", options.target_filesize, filesizeOpts)
+ },
+ {
+ "crf",
+ Option("int", "CRF", options.crf, crfOpts)
+ },
+ {
+ "fps",
+ Option("list", "FPS", options.fps, fpsOpts)
+ },
+ {
+ "gif_dither",
+ Option("list", "GIF Dither Type", options.gif_dither, gifDitherOpts, function()
+ return self.options[1][2]:getValue() == "gif"
+ end)
+ },
+ {
+ "force_square_pixels",
+ Option("bool", "Force Square Pixels", options.force_square_pixels)
+ }
+ }
+ self.keybinds = {
+ ["LEFT"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.leftKey
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["RIGHT"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.rightKey
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["UP"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.prevOpt
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["DOWN"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.nextOpt
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["ENTER"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.confirmOpts
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["ESC"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.cancelOpts
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)()
+ }
+ end,
+ __base = _base_0,
+ __name = "EncodeOptionsPage",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ EncodeOptionsPage = _class_0
+end
+local PreviewPage
+do
+ local _class_0
+ local _parent_0 = Page
+ local _base_0 = {
+ prepare = function(self)
+ local vf = mp.get_property_native("vf")
+ vf[#vf + 1] = {
+ name = "sub"
+ }
+ if self.region:is_valid() then
+ vf[#vf + 1] = {
+ name = "crop",
+ params = {
+ w = tostring(self.region.w),
+ h = tostring(self.region.h),
+ x = tostring(self.region.x),
+ y = tostring(self.region.y)
+ }
+ }
+ end
+ mp.set_property_native("vf", vf)
+ if self.startTime > -1 and self.endTime > -1 then
+ mp.set_property_native("ab-loop-a", self.startTime)
+ mp.set_property_native("ab-loop-b", self.endTime)
+ mp.set_property_native("time-pos", self.startTime)
+ end
+ return mp.set_property_native("pause", false)
+ end,
+ dispose = function(self)
+ mp.set_property("ab-loop-a", "no")
+ mp.set_property("ab-loop-b", "no")
+ for prop, value in pairs(self.originalProperties) do
+ mp.set_property_native(prop, value)
+ end
+ end,
+ draw = function(self)
+ local window_w, window_h = mp.get_osd_size()
+ local ass = assdraw.ass_new()
+ ass:new_event()
+ self:setup_text(ass)
+ ass:append("Press " .. tostring(bold('ESC')) .. " to exit preview.\\N")
+ return mp.set_osd_ass(window_w, window_h, ass.text)
+ end,
+ cancel = function(self)
+ self:hide()
+ return self.callback()
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self, callback, region, startTime, endTime)
+ self.callback = callback
+ self.originalProperties = {
+ ["vf"] = mp.get_property_native("vf"),
+ ["time-pos"] = mp.get_property_native("time-pos"),
+ ["pause"] = mp.get_property_native("pause")
+ }
+ self.keybinds = {
+ ["ESC"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.cancel
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)()
+ }
+ self.region = region
+ self.startTime = startTime
+ self.endTime = endTime
+ self.isLoop = false
+ end,
+ __base = _base_0,
+ __name = "PreviewPage",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ PreviewPage = _class_0
+end
+local MainPage
+do
+ local _class_0
+ local _parent_0 = Page
+ local _base_0 = {
+ setStartTime = function(self)
+ self.startTime = mp.get_property_number("time-pos")
+ if self.visible then
+ self:clear()
+ return self:draw()
+ end
+ end,
+ setEndTime = function(self)
+ self.endTime = mp.get_property_number("time-pos")
+ if self.visible then
+ self:clear()
+ return self:draw()
+ end
+ end,
+ setupStartAndEndTimes = function(self)
+ if mp.get_property_native("duration") then
+ self.startTime = 0
+ self.endTime = mp.get_property_native("duration")
+ else
+ self.startTime = -1
+ self.endTime = -1
+ end
+ if self.visible then
+ self:clear()
+ return self:draw()
+ end
+ end,
+ draw = function(self)
+ local window_w, window_h = mp.get_osd_size()
+ local ass = assdraw.ass_new()
+ ass:new_event()
+ self:setup_text(ass)
+ ass:append(tostring(bold('WebM maker')) .. "\\N\\N")
+ ass:append(tostring(bold('c:')) .. " crop\\N")
+ ass:append(tostring(bold('1:')) .. " set start time (current is " .. tostring(seconds_to_time_string(self.startTime)) .. ")\\N")
+ ass:append(tostring(bold('2:')) .. " set end time (current is " .. tostring(seconds_to_time_string(self.endTime)) .. ")\\N")
+ ass:append(tostring(bold('o:')) .. " change encode options\\N")
+ ass:append(tostring(bold('p:')) .. " preview\\N")
+ ass:append(tostring(bold('e:')) .. " encode\\N\\N")
+ ass:append(tostring(bold('ESC:')) .. " close\\N")
+ return mp.set_osd_ass(window_w, window_h, ass.text)
+ end,
+ show = function(self)
+ _class_0.__parent.show(self)
+ return emit_event("show-main-page")
+ end,
+ onUpdateCropRegion = function(self, updated, newRegion)
+ if updated then
+ self.region = newRegion
+ end
+ return self:show()
+ end,
+ crop = function(self)
+ self:hide()
+ local cropPage = CropPage((function()
+ local _base_1 = self
+ local _fn_0 = _base_1.onUpdateCropRegion
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(), self.region)
+ return cropPage:show()
+ end,
+ onOptionsChanged = function(self, updated)
+ return self:show()
+ end,
+ changeOptions = function(self)
+ self:hide()
+ local encodeOptsPage = EncodeOptionsPage((function()
+ local _base_1 = self
+ local _fn_0 = _base_1.onOptionsChanged
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)())
+ return encodeOptsPage:show()
+ end,
+ onPreviewEnded = function(self)
+ return self:show()
+ end,
+ preview = function(self)
+ self:hide()
+ local previewPage = PreviewPage((function()
+ local _base_1 = self
+ local _fn_0 = _base_1.onPreviewEnded
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(), self.region, self.startTime, self.endTime)
+ return previewPage:show()
+ end,
+ encode = function(self)
+ self:hide()
+ if self.startTime < 0 then
+ message("No start time, aborting")
+ return
+ end
+ if self.endTime < 0 then
+ message("No end time, aborting")
+ return
+ end
+ if self.startTime >= self.endTime then
+ message("Start time is ahead of end time, aborting")
+ return
+ end
+ return encode(self.region, self.startTime, self.endTime)
+ end
+ }
+ _base_0.__index = _base_0
+ setmetatable(_base_0, _parent_0.__base)
+ _class_0 = setmetatable({
+ __init = function(self)
+ self.keybinds = {
+ ["c"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.crop
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["1"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.setStartTime
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["2"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.setEndTime
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["o"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.changeOptions
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["p"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.preview
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["e"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.encode
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)(),
+ ["ESC"] = (function()
+ local _base_1 = self
+ local _fn_0 = _base_1.hide
+ return function(...)
+ return _fn_0(_base_1, ...)
+ end
+ end)()
+ }
+ self.startTime = -1
+ self.endTime = -1
+ self.region = Region()
+ end,
+ __base = _base_0,
+ __name = "MainPage",
+ __parent = _parent_0
+ }, {
+ __index = function(cls, name)
+ local val = rawget(_base_0, name)
+ if val == nil then
+ local parent = rawget(cls, "__parent")
+ if parent then
+ return parent[name]
+ end
+ else
+ return val
+ end
+ end,
+ __call = function(cls, ...)
+ local _self_0 = setmetatable({}, _base_0)
+ cls.__init(_self_0, ...)
+ return _self_0
+ end
+ })
+ _base_0.__class = _class_0
+ if _parent_0.__inherited then
+ _parent_0.__inherited(_parent_0, _class_0)
+ end
+ MainPage = _class_0
+end
+monitor_dimensions()
+local mainPage = MainPage()
+mp.add_key_binding(options.keybind, "display-webm-encoder", (function()
+ local _base_0 = mainPage
+ local _fn_0 = _base_0.show
+ return function(...)
+ return _fn_0(_base_0, ...)
+ end
+end)(), {
+ repeatable = false
+})
+mp.register_event("file-loaded", (function()
+ local _base_0 = mainPage
+ local _fn_0 = _base_0.setupStartAndEndTimes
+ return function(...)
+ return _fn_0(_base_0, ...)
+ end
+end)())
+msg.verbose("Loaded mpv-webm script!")
+return emit_event("script-loaded")
diff --git a/config/X/mpv/scripts/youtube-quality.lua b/config/X/mpv/scripts/youtube-quality.lua
new file mode 100755
index 0000000..1331210
--- /dev/null
+++ b/config/X/mpv/scripts/youtube-quality.lua
@@ -0,0 +1,275 @@
+-- youtube-quality.lua
+--
+-- Change youtube video quality on the fly.
+--
+-- Diplays a menu that lets you switch to different ytdl-format settings while
+-- you're in the middle of a video (just like you were using the web player).
+--
+-- Bound to ctrl-f by default.
+
+local mp = require 'mp'
+local utils = require 'mp.utils'
+local msg = require 'mp.msg'
+local assdraw = require 'mp.assdraw'
+
+local opts = {
+ --key bindings
+ toggle_menu_binding = "ctrl+f",
+ up_binding = "UP",
+ down_binding = "DOWN",
+ select_binding = "ENTER",
+
+ --formatting / cursors
+ selected_and_active = "▶ - ",
+ selected_and_inactive = "● - ",
+ unselected_and_active = "▷ - ",
+ unselected_and_inactive = "○ - ",
+
+ --font size scales by window, if false requires larger font and padding sizes
+ scale_playlist_by_window=false,
+
+ --playlist ass style overrides inside curly brackets, \keyvalue is one field, extra \ for escape in lua
+ --example {\\fnUbuntu\\fs10\\b0\\bord1} equals: font=Ubuntu, size=10, bold=no, border=1
+ --read http://docs.aegisub.org/3.2/ASS_Tags/ for reference of tags
+ --undeclared tags will use default osd settings
+ --these styles will be used for the whole playlist. More specific styling will need to be hacked in
+ --
+ --(a monospaced font is recommended but not required)
+ style_ass_tags = "{\\fnmonospace}",
+
+ --paddings for top left corner
+ text_padding_x = 5,
+ text_padding_y = 5,
+
+ --other
+ menu_timeout = 10,
+
+ --use yt-dlp to fetch a list of available formats (overrides quality_strings)
+ fetch_formats = true,
+
+ --default menu entries
+ quality_strings=[[
+ [
+ {"4320p" : "bestvideo[height<=?4320p]+bestaudio/best"},
+ {"2160p" : "bestvideo[height<=?2160]+bestaudio/best"},
+ {"1440p" : "bestvideo[height<=?1440]+bestaudio/best"},
+ {"1080p" : "bestvideo[height<=?1080]+bestaudio/best"},
+ {"720p" : "bestvideo[height<=?720]+bestaudio/best"},
+ {"480p" : "bestvideo[height<=?480]+bestaudio/best"},
+ {"360p" : "bestvideo[height<=?360]+bestaudio/best"},
+ {"240p" : "bestvideo[height<=?240]+bestaudio/best"},
+ {"144p" : "bestvideo[height<=?144]+bestaudio/best"}
+ ]
+ ]],
+}
+(require 'mp.options').read_options(opts, "youtube-quality")
+opts.quality_strings = utils.parse_json(opts.quality_strings)
+
+local destroyer = nil
+
+
+function show_menu()
+ local selected = 1
+ local active = 0
+ local current_ytdl_format = mp.get_property("ytdl-format")
+ msg.verbose("current ytdl-format: "..current_ytdl_format)
+ local num_options = 0
+ local options = {}
+
+
+ if opts.fetch_formats then
+ options, num_options = download_formats()
+ end
+
+ if next(options) == nil then
+ for i,v in ipairs(opts.quality_strings) do
+ num_options = num_options + 1
+ for k,v2 in pairs(v) do
+ options[i] = {label = k, format=v2}
+ if v2 == current_ytdl_format then
+ active = i
+ selected = active
+ end
+ end
+ end
+ end
+
+ --set the cursor to the currently format
+ for i,v in ipairs(options) do
+ if v.format == current_ytdl_format then
+ active = i
+ selected = active
+ break
+ end
+ end
+
+ function selected_move(amt)
+ selected = selected + amt
+ if selected < 1 then selected = num_options
+ elseif selected > num_options then selected = 1 end
+ timeout:kill()
+ timeout:resume()
+ draw_menu()
+ end
+ function choose_prefix(i)
+ if i == selected and i == active then return opts.selected_and_active
+ elseif i == selected then return opts.selected_and_inactive end
+
+ if i ~= selected and i == active then return opts.unselected_and_active
+ elseif i ~= selected then return opts.unselected_and_inactive end
+ return "> " --shouldn't get here.
+ end
+
+ function draw_menu()
+ local ass = assdraw.ass_new()
+
+ ass:pos(opts.text_padding_x, opts.text_padding_y)
+ ass:append(opts.style_ass_tags)
+
+ for i,v in ipairs(options) do
+ ass:append(choose_prefix(i)..v.label.."\\N")
+ end
+
+ local w, h = mp.get_osd_size()
+ if opts.scale_playlist_by_window then w,h = 0, 0 end
+ mp.set_osd_ass(w, h, ass.text)
+ end
+
+ function destroy()
+ timeout:kill()
+ mp.set_osd_ass(0,0,"")
+ mp.remove_key_binding("move_up")
+ mp.remove_key_binding("move_down")
+ mp.remove_key_binding("select")
+ mp.remove_key_binding("escape")
+ destroyer = nil
+ end
+ timeout = mp.add_periodic_timer(opts.menu_timeout, destroy)
+ destroyer = destroy
+
+ mp.add_forced_key_binding(opts.up_binding, "move_up", function() selected_move(-1) end, {repeatable=true})
+ mp.add_forced_key_binding(opts.down_binding, "move_down", function() selected_move(1) end, {repeatable=true})
+ mp.add_forced_key_binding(opts.select_binding, "select", function()
+ destroy()
+ mp.set_property("ytdl-format", options[selected].format)
+ reload_resume()
+ end)
+ mp.add_forced_key_binding(opts.toggle_menu_binding, "escape", destroy)
+
+ draw_menu()
+ return
+end
+
+local ytdl = {
+ path = "yt-dlp",
+ searched = false,
+ blacklisted = {}
+}
+
+format_cache={}
+function download_formats()
+ local function exec(args)
+ local ret = utils.subprocess({args = args})
+ return ret.status, ret.stdout, ret
+ end
+
+ local function table_size(t)
+ s = 0
+ for i,v in ipairs(t) do
+ s = s+1
+ end
+ return s
+ end
+
+ local url = mp.get_property("path")
+
+ url = string.gsub(url, "ytdl://", "") -- Strip possible ytdl:// prefix.
+
+ -- don't fetch the format list if we already have it
+ if format_cache[url] ~= nil then
+ local res = format_cache[url]
+ return res, table_size(res)
+ end
+ mp.osd_message("fetching available formats with yt-dlp...", 60)
+
+ if not (ytdl.searched) then
+ local ytdl_mcd = mp.find_config_file("yt-dlp")
+ if not (ytdl_mcd == nil) then
+ msg.verbose("found yt-dlp at: " .. ytdl_mcd)
+ ytdl.path = ytdl_mcd
+ end
+ ytdl.searched = true
+ end
+
+ local command = {ytdl.path, "--no-warnings", "--no-playlist", "-J"}
+ table.insert(command, url)
+ local es, json, result = exec(command)
+
+ if (es < 0) or (json == nil) or (json == "") then
+ mp.osd_message("fetching formats failed...", 1)
+ msg.error("failed to get format list: " .. err)
+ return {}, 0
+ end
+
+ local json, err = utils.parse_json(json)
+
+ if (json == nil) then
+ mp.osd_message("fetching formats failed...", 1)
+ msg.error("failed to parse JSON data: " .. err)
+ return {}, 0
+ end
+
+ res = {}
+ msg.verbose("yt-dlp succeeded!")
+ for i,v in ipairs(json.formats) do
+ if v.vcodec ~= "none" then
+ local fps = v.fps and v.fps.."fps" or ""
+ local resolution = string.format("%sx%s", v.width, v.height)
+ local l = string.format("%-9s %-5s (%-4s / %s)", resolution, fps, v.ext, v.vcodec)
+ local f = string.format("%s+bestaudio/best", v.format_id)
+ table.insert(res, {label=l, format=f, width=v.width })
+ end
+ end
+
+ table.sort(res, function(a, b) return a.width > b.width end)
+
+ mp.osd_message("", 0)
+ format_cache[url] = res
+ return res, table_size(res)
+end
+
+
+-- register script message to show menu
+mp.register_script_message("toggle-quality-menu",
+function()
+ if destroyer ~= nil then
+ destroyer()
+ else
+ show_menu()
+ end
+end)
+
+-- keybind to launch menu
+mp.add_key_binding(opts.toggle_menu_binding, "quality-menu", show_menu)
+
+-- special thanks to reload.lua (https://github.com/4e6/mpv-reload/)
+function reload_resume()
+ local playlist_pos = mp.get_property_number("playlist-pos")
+ local reload_duration = mp.get_property_native("duration")
+ local time_pos = mp.get_property("time-pos")
+
+ mp.set_property_number("playlist-pos", playlist_pos)
+
+ -- Tries to determine live stream vs. pre-recordered VOD. VOD has non-zero
+ -- duration property. When reloading VOD, to keep the current time position
+ -- we should provide offset from the start. Stream doesn't have fixed start.
+ -- Decent choice would be to reload stream from it's current 'live' positon.
+ -- That's the reason we don't pass the offset when reloading streams.
+ if reload_duration and reload_duration > 0 then
+ local function seeker()
+ mp.commandv("seek", time_pos, "absolute")
+ mp.unregister_event(seeker)
+ end
+ mp.register_event("file-loaded", seeker)
+ end
+end
diff --git a/config/X/mpv/watch_later/9EDC60703A9785FE514694A824A11563 b/config/X/mpv/watch_later/9EDC60703A9785FE514694A824A11563
new file mode 100644
index 0000000..8356b1e
--- /dev/null
+++ b/config/X/mpv/watch_later/9EDC60703A9785FE514694A824A11563
@@ -0,0 +1,2 @@
+start=9052.872000
+volume=45.000000
diff --git a/config/X/picom/picom.conf b/config/X/picom/picom.conf
new file mode 100644
index 0000000..9e9ecdb
--- /dev/null
+++ b/config/X/picom/picom.conf
@@ -0,0 +1,493 @@
+#################################
+# Animations #
+#################################
+# requires https://github.com/jonaburg/picom
+# (These are also the default values)
+transition-length = 300
+transition-pow-x = 0.1
+transition-pow-y = 0.1
+transition-pow-w = 0.1
+transition-pow-h = 0.1
+size-transition = true
+
+
+#################################
+# Corners #
+#################################
+# requires: https://github.com/sdhand/compton or https://github.com/jonaburg/picom
+corner-radius = 5.0;
+rounded-corners-exclude = [
+ "class_g = 'Dunst'"
+];
+round-borders = 1;
+round-borders-exclude = [
+ #"class_g = 'TelegramDesktop'",
+];
+
+#################################
+# Shadows #
+#################################
+
+
+# Enabled client-side shadows on windows. Note desktop windows
+# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
+# unless explicitly requested using the wintypes option.
+#
+# shadow = false
+shadow = false;
+
+# The blur radius for shadows, in pixels. (defaults to 12)
+# shadow-radius = 12
+shadow-radius = 7;
+
+# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
+# shadow-opacity = .75
+
+# The left offset for shadows, in pixels. (defaults to -15)
+# shadow-offset-x = -15
+shadow-offset-x = -7;
+
+# The top offset for shadows, in pixels. (defaults to -15)
+# shadow-offset-y = -15
+shadow-offset-y = -7;
+
+# Avoid drawing shadows on dock/panel windows. This option is deprecated,
+# you should use the *wintypes* option in your config file instead.
+#
+# no-dock-shadow = false
+
+# Don't draw shadows on drag-and-drop windows. This option is deprecated,
+# you should use the *wintypes* option in your config file instead.
+#
+# no-dnd-shadow = false
+
+# Red color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-red = 0
+
+# Green color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-green = 0
+
+# Blue color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-blue = 0
+
+# Do not paint shadows on shaped windows. Note shaped windows
+# here means windows setting its shape through X Shape extension.
+# Those using ARGB background is beyond our control.
+# Deprecated, use
+# shadow-exclude = 'bounding_shaped'
+# or
+# shadow-exclude = 'bounding_shaped && !rounded_corners'
+# instead.
+#
+# shadow-ignore-shaped = ''
+
+# Specify a list of conditions of windows that should have no shadow.
+#
+# examples:
+# shadow-exclude = "n:e:Notification";
+#
+# shadow-exclude = []
+shadow-exclude = [
+ "name = 'Notification'",
+ "class_g = 'Conky'",
+ "class_g ?= 'Notify-osd'",
+ "class_g = 'Cairo-clock'",
+ "class_g = 'slop'",
+ "class_g = 'Polybar'",
+ "_GTK_FRAME_EXTENTS@:c"
+];
+
+# Specify a X geometry that describes the region in which shadow should not
+# be painted in, such as a dock window region. Use
+# shadow-exclude-reg = "x10+0+0"
+# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
+#
+# shadow-exclude-reg = ""
+
+# Crop shadow of a window fully on a particular Xinerama screen to the screen.
+# xinerama-shadow-crop = false
+
+
+#################################
+# Fading #
+#################################
+
+
+# Fade windows in/out when opening/closing and when opacity changes,
+# unless no-fading-openclose is used.
+# fading = false
+fading = true;
+
+# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
+# fade-in-step = 0.028
+fade-in-step = 0.03;
+
+# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
+# fade-out-step = 0.03
+fade-out-step = 1.00;
+
+# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
+# fade-delta = 10
+
+# Specify a list of conditions of windows that should not be faded.
+# don't need this, we disable fading for all normal windows with wintypes: {}
+fade-exclude = [
+ "class_g = 'slop'", # maim
+ "class_g = 'dmenu'",
+ "class_g = 'Pinentry-gtk-2'",
+]
+
+# Do not fade on window open/close.
+# no-fading-openclose = false
+
+# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
+# no-fading-destroyed-argb = false
+
+
+#################################
+# Transparency / Opacity #
+#################################
+
+
+# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
+# inactive-opacity = 1
+inactive-opacity = 0.8;
+
+# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
+# frame-opacity = 1.0
+frame-opacity = 0.7;
+
+# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0)
+# menu-opacity = 1.0
+# menu-opacity is depreciated use dropdown-menu and popup-menu instead.
+
+#If using these 2 below change their values in line 510 & 511 aswell
+popup_menu = { opacity = 0.8; }
+dropdown_menu = { opacity = 0.8; }
+
+
+# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows.
+# inactive-opacity-override = true
+inactive-opacity-override = false;
+
+# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
+active-opacity = 1.0;
+
+# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
+# inactive-dim = 0.0
+
+# Specify a list of conditions of windows that should always be considered focused.
+# focus-exclude = []
+focus-exclude = [
+ "class_g = 'Cairo-clock'",
+ "class_g = 'Bar'", # lemonbar
+ "class_g = 'slop'" # maim
+];
+
+# Use fixed inactive dim value, instead of adjusting according to window opacity.
+# inactive-dim-fixed = 1.0
+
+# Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
+# like `50:name *= "Firefox"`. picom-trans is recommended over this.
+# Note we don't make any guarantee about possible conflicts with other
+# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
+# example:
+# opacity-rule = [ "80:class_g = 'URxvt'" ];
+#
+# opacity-rule = []
+opacity-rule = [
+];
+
+
+#################################
+# Background-Blurring #
+#################################
+
+
+# Parameters for background blurring, see the *BLUR* section for more information.
+# blur-method = kawase
+# blur-size = 12
+#
+# blur-deviation = false
+
+# Blur background of semi-transparent / ARGB windows.
+# Bad in performance, with driver-dependent behavior.
+# The name of the switch may change without prior notifications.
+#
+# blur-background = true;
+
+# Blur background of windows when the window frame is not opaque.
+# Implies:
+# blur-background
+# Bad in performance, with driver-dependent behavior. The name may change.
+#
+# blur-background-frame = false;
+
+
+# Use fixed blur strength rather than adjusting according to window opacity.
+# blur-background-fixed = false;
+
+
+# Specify the blur convolution kernel, with the following format:
+# example:
+# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
+#
+# blur-kern = ''
+# blur-kern = "3x3box";
+
+blur: {
+ # requires: https://github.com/ibhagwan/picom
+ method = "dual_kawase";
+ #method = "kernel";
+ strength = 7;
+ # deviation = 1.0;
+ # kernel = "11x11gaussian";
+ background = false;
+ background-frame = false;
+ background-fixed = false;
+ kern = "3x3box";
+}
+
+# Exclude conditions for background blur.
+blur-background-exclude = [
+ #"window_type = 'dock'",
+ #"window_type = 'desktop'",
+ #
+ # prevents picom from blurring the background
+ # when taking selection screenshot with `main`
+ # https://github.com/naelstrof/maim/issues/130
+ "class_g = 'slop'",
+ "_GTK_FRAME_EXTENTS@:c"
+];
+
+
+#################################
+# General Settings #
+#################################
+
+# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
+# daemon = false
+
+# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
+# `xrender` is the default one.
+#
+experimental-backends = true;
+backend = "glx";
+#backend = "xrender";
+
+
+# Enable/disable VSync.
+# vsync = false
+vsync = true
+
+# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
+# dbus = false
+
+# Try to detect WM windows (a non-override-redirect window with no
+# child that has 'WM_STATE') and mark them as active.
+#
+# mark-wmwin-focused = false
+mark-wmwin-focused = true;
+
+# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
+# mark-ovredir-focused = false
+mark-ovredir-focused = true;
+
+# Try to detect windows with rounded corners and don't consider them
+# shaped windows. The accuracy is not very high, unfortunately.
+#
+# detect-rounded-corners = false
+detect-rounded-corners = true;
+
+# Detect '_NET_WM_OPACITY' on client windows, useful for window managers
+# not passing '_NET_WM_OPACITY' of client windows to frame windows.
+#
+# detect-client-opacity = false
+detect-client-opacity = true;
+
+# Limit picom to repaint at most once every 1 / 'refresh_rate' second to
+# boost performance. This should not be used with
+# vsync drm/opengl/opengl-oml
+# as they essentially does sw-opti's job already,
+# unless you wish to specify a lower refresh rate than the actual value.
+#
+# sw-opti =
+
+# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
+# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
+# provided that the WM supports it.
+#
+# use-ewmh-active-win = false
+
+# Unredirect all windows if a full-screen opaque window is detected,
+# to maximize performance for full-screen windows. Known to cause flickering
+# when redirecting/unredirecting windows. paint-on-overlay may make the flickering less obvious.
+#
+# unredir-if-possible = false
+
+# Delay before unredirecting the window, in milliseconds. Defaults to 0.
+# unredir-if-possible-delay = 0
+
+# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
+# unredir-if-possible-exclude = []
+
+# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
+# in the same group focused at the same time.
+#
+# detect-transient = false
+detect-transient = true
+
+# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
+# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if
+# detect-transient is enabled, too.
+#
+# detect-client-leader = false
+detect-client-leader = true
+
+# Resize damaged region by a specific number of pixels.
+# A positive value enlarges it while a negative one shrinks it.
+# If the value is positive, those additional pixels will not be actually painted
+# to screen, only used in blur calculation, and such. (Due to technical limitations,
+# with use-damage, those pixels will still be incorrectly painted to screen.)
+# Primarily used to fix the line corruption issues of blur,
+# in which case you should use the blur radius value here
+# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
+# with a 5x5 one you use `--resize-damage 2`, and so on).
+# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
+#
+# resize-damage = 1
+
+# Specify a list of conditions of windows that should be painted with inverted color.
+# Resource-hogging, and is not well tested.
+#
+# invert-color-include = []
+
+# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
+# Might cause incorrect opacity when rendering transparent content (but never
+# practically happened) and may not work with blur-background.
+# My tests show a 15% performance boost. Recommended.
+#
+# glx-no-stencil = false
+
+# GLX backend: Avoid rebinding pixmap on window damage.
+# Probably could improve performance on rapid window content changes,
+# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
+# Recommended if it works.
+#
+# glx-no-rebind-pixmap = false
+
+# Disable the use of damage information.
+# This cause the whole screen to be redrawn everytime, instead of the part of the screen
+# has actually changed. Potentially degrades the performance, but might fix some artifacts.
+# The opposing option is use-damage
+#
+# no-use-damage = false
+#use-damage = true (Causing Weird Black semi opaque rectangles when terminal is opened)
+#Changing use-damage to false fixes the problem
+use-damage = false
+
+# Use X Sync fence to sync clients' draw calls, to make sure all draw
+# calls are finished before picom starts drawing. Needed on nvidia-drivers
+# with GLX backend for some users.
+#
+# xrender-sync-fence = false
+
+# GLX backend: Use specified GLSL fragment shader for rendering window contents.
+# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl`
+# in the source tree for examples.
+#
+# glx-fshader-win = ''
+
+# Force all windows to be painted with blending. Useful if you
+# have a glx-fshader-win that could turn opaque pixels transparent.
+#
+# force-win-blend = false
+
+# Do not use EWMH to detect fullscreen windows.
+# Reverts to checking if a window is fullscreen based only on its size and coordinates.
+#
+# no-ewmh-fullscreen = false
+
+# Dimming bright windows so their brightness doesn't exceed this set value.
+# Brightness of a window is estimated by averaging all pixels in the window,
+# so this could comes with a performance hit.
+# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
+#
+# max-brightness = 1.0
+
+# Make transparent windows clip other windows like non-transparent windows do,
+# instead of blending on top of them.
+#
+# transparent-clipping = false
+
+# Set the log level. Possible values are:
+# "trace", "debug", "info", "warn", "error"
+# in increasing level of importance. Case doesn't matter.
+# If using the "TRACE" log level, it's better to log into a file
+# using *--log-file*, since it can generate a huge stream of logs.
+#
+# log-level = "debug"
+log-level = "info";
+
+# Set the log file.
+# If *--log-file* is never specified, logs will be written to stderr.
+# Otherwise, logs will to written to the given file, though some of the early
+# logs might still be written to the stderr.
+# When setting this option from the config file, it is recommended to use an absolute path.
+#
+# log-file = '/path/to/your/log/file'
+
+# Show all X errors (for debugging)
+# show-all-xerrors = false
+
+# Write process ID to a file.
+# write-pid-path = '/path/to/your/log/file'
+
+# Window type settings
+#
+# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
+# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
+# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
+# "tooltip", "notification", "combo", and "dnd".
+#
+# Following per window-type options are available: ::
+#
+# fade, shadow:::
+# Controls window-type-specific shadow and fade settings.
+#
+# opacity:::
+# Controls default opacity of the window type.
+#
+# focus:::
+# Controls whether the window of this type is to be always considered focused.
+# (By default, all window types except "normal" and "dialog" has this on.)
+#
+# full-shadow:::
+# Controls whether shadow is drawn under the parts of the window that you
+# normally won't be able to see. Useful when the window has parts of it
+# transparent, and you want shadows in those areas.
+#
+# redir-ignore:::
+# Controls whether this type of windows should cause screen to become
+# redirected again after been unredirected. If you have unredir-if-possible
+# set, and doesn't want certain window to cause unnecessary screen redirection,
+# you can set this to `true`.
+#
+wintypes:
+{
+ dialog = { fade = false; }
+ combo = { fade = false; }
+ desktop = { fade = false; }
+ dock = { shadow = false; }
+ dnd = { shadow = false; }
+ dropdown_menu = { fade = false; }
+ menu = { fade = false; }
+ normal = { fade = true; shadow = false; }
+ notification = { fade = false; }
+ popup_menu = { fade = false; }
+ splash = { fade = false; }
+ toolbar = { fade = false; }
+ tooltip = { fade = false; }
+ uknown = { fade = false; }
+ utility = { fade = false; }
+};
diff --git a/config/X/picom/picom.conf.bak b/config/X/picom/picom.conf.bak
new file mode 100644
index 0000000..c8c56b4
--- /dev/null
+++ b/config/X/picom/picom.conf.bak
@@ -0,0 +1,410 @@
+#################################
+# Shadows #
+#################################
+
+
+# Enabled client-side shadows on windows. Note desktop windows
+# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
+# unless explicitly requested using the wintypes option.
+#
+# shadow = false
+# shadow = true;
+
+# The blur radius for shadows, in pixels. (defaults to 12)
+# shadow-radius = 13;
+
+# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
+# shadow-opacity = .75
+
+# The left offset for shadows, in pixels. (defaults to -15)
+# shadow-offset-x = -11
+
+# The top offset for shadows, in pixels. (defaults to -15)
+# shadow-offset-y = -11
+
+# Red color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-red = 0
+
+# Green color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-green = 0
+
+# Blue color value of shadow (0.0 - 1.0, defaults to 0).
+# shadow-blue = 0
+
+# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue)
+# shadow-color = "#000000"
+
+# Specify a list of conditions of windows that should have no shadow.
+#
+# examples:
+# shadow-exclude = "n:e:Notification";
+#
+# shadow-exclude = [
+# "name = 'xmobar2'"
+# ]
+
+
+# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window.
+# clip-shadow-above = []
+
+# Specify a X geometry that describes the region in which shadow should not
+# be painted in, such as a dock window region. Use
+# shadow-exclude-reg = "x10+0+0"
+# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
+#
+# shadow-exclude-reg = ""
+
+# Crop shadow of a window fully on a particular Xinerama screen to the screen.
+# xinerama-shadow-crop = false
+
+
+#################################
+# Fading #
+#################################
+
+
+# Fade windows in/out when opening/closing and when opacity changes,
+# unless no-fading-openclose is used.
+# fading = false
+fading = true;
+
+# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
+fade-in-step = 0.06
+
+# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
+fade-out-step = 0.06
+
+# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
+# fade-delta = 10
+
+# Specify a list of conditions of windows that should not be faded.
+fade-exclude = [
+ "class_g = 'dmenu'",
+ "class_g = 'Pinentry-gtk-2'"
+]
+
+# Do not fade on window open/close.
+# no-fading-openclose = false
+
+# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
+# no-fading-destroyed-argb = false
+
+
+#################################
+# Transparency / Opacity #
+#################################
+
+# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
+# inactive-opacity = 1
+inactive-opacity = 1.0;
+
+# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
+# frame-opacity = 1.0
+frame-opacity = 1.0;
+
+# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows.
+# inactive-opacity-override = true
+inactive-opacity-override = false;
+
+# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
+active-opacity = 1.0
+
+# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
+# inactive-dim = 0.0
+
+# Specify a list of conditions of windows that should never be considered focused.
+# focus-exclude = []
+focus-exclude = [
+];
+
+# If I want dmenu to be excluded I can do so by giving position
+# focus-exclude = "x = 0 && y = 0 && override_redirect = true";
+
+# Use fixed inactive dim value, instead of adjusting according to window opacity.
+# inactive-dim-fixed = 1.0
+
+# Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
+# like `50:name *= "Firefox"`. picom-trans is recommended over this.
+# Note we don't make any guarantee about possible conflicts with other
+# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
+# example:
+opacity-rule = [
+ # "100:name *= '- YouTube'",
+ # "90:class_g = 'firefox'",
+];
+#
+
+#################################
+# Corners #
+#################################
+
+# Sets the radius of rounded window corners. When > 0, the compositor will
+# round the corners of windows. Does not interact well with
+# `transparent-clipping`.
+corner-radius = 9
+
+
+# Exclude conditions for rounded corners.
+rounded-corners-exclude = [
+ #"window_type = 'dock'",
+ #"window_type = 'desktop'",
+ "name != 'xmobar2'"
+];
+
+#################################
+# Background-Blurring #
+#################################
+
+# Parameters for background blurring, see the *BLUR* section for more information.
+# blur-method =
+# blur-size = 12
+#
+# blur-deviation = false
+#
+# blur-strength = 5
+
+# Blur background of semi-transparent / ARGB windows.
+# Bad in performance, with driver-dependent behavior.
+# The name of the switch may change without prior notifications.
+#
+# blur-background = false
+
+# Blur background of windows when the window frame is not opaque.
+# Implies:
+# blur-background
+# Bad in performance, with driver-dependent behavior. The name may change.
+#
+# blur-background-frame = false
+
+
+# Use fixed blur strength rather than adjusting according to window opacity.
+# blur-background-fixed = false
+
+
+# Specify the blur convolution kernel, with the following format:
+# example:
+# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
+#
+# blur-kern = ""
+# blur-kern = "3x3box";
+
+# Exclude conditions for background blur.
+# blur-background-exclude = []
+# blur-background-exclude = [
+# "window_type = 'dock'",
+# "window_type = 'desktop'",
+# "_GTK_FRAME_EXTENTS@:c"
+# ];
+
+#################################
+# General Settings #
+#################################
+
+# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
+# daemon = false
+
+# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
+# `xrender` is the default one.
+#
+# backend = "glx"
+backend = "glx";
+
+# Enable/disable VSync.
+# vsync = false
+vsync = true;
+
+# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
+# dbus = false
+
+# Try to detect WM windows (a non-override-redirect window with no
+# child that has 'WM_STATE') and mark them as active.
+#
+# mark-wmwin-focused = false
+mark-wmwin-focused = false;
+
+# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
+# mark-ovredir-focused = false
+mark-ovredir-focused = false;
+
+# Try to detect windows with rounded corners and don't consider them
+# shaped windows. The accuracy is not very high, unfortunately.
+#
+# detect-rounded-corners = false
+detect-rounded-corners = false;
+
+# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers
+# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows.
+#
+# detect-client-opacity = false
+detect-client-opacity = false;
+
+# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
+# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
+# provided that the WM supports it.
+#
+use-ewmh-active-win = false
+
+# Unredirect all windows if a full-screen opaque window is detected,
+# to maximize performance for full-screen windows. Known to cause flickering
+# when redirecting/unredirecting windows.
+#
+unredir-if-possible = true
+
+# Delay before unredirecting the window, in milliseconds. Defaults to 0.
+# unredir-if-possible-delay = 0
+
+# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
+# unredir-if-possible-exclude = []
+
+# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
+# in the same group focused at the same time.
+#
+# detect-transient = false
+detect-transient = true;
+
+# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
+# group focused at the same time. This usually means windows from the same application
+# will be considered focused or unfocused at the same time.
+# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too.
+#
+detect-client-leader = true
+
+# Resize damaged region by a specific number of pixels.
+# A positive value enlarges it while a negative one shrinks it.
+# If the value is positive, those additional pixels will not be actually painted
+# to screen, only used in blur calculation, and such. (Due to technical limitations,
+# with use-damage, those pixels will still be incorrectly painted to screen.)
+# Primarily used to fix the line corruption issues of blur,
+# in which case you should use the blur radius value here
+# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
+# with a 5x5 one you use `--resize-damage 2`, and so on).
+# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
+#
+# resize-damage = 1
+
+# Specify a list of conditions of windows that should be painted with inverted color.
+# Resource-hogging, and is not well tested.
+#
+# invert-color-include = []
+
+# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
+# Might cause incorrect opacity when rendering transparent content (but never
+# practically happened) and may not work with blur-background.
+# My tests show a 15% performance boost. Recommended.
+#
+glx-no-stencil = true;
+
+# GLX backend: Avoid rebinding pixmap on window damage.
+# Probably could improve performance on rapid window content changes,
+# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
+# Recommended if it works.
+#
+# glx-no-rebind-pixmap = false
+
+# Disable the use of damage information.
+# This cause the whole screen to be redrawn everytime, instead of the part of the screen
+# has actually changed. Potentially degrades the performance, but might fix some artifacts.
+# The opposing option is use-damage
+#
+# no-use-damage = false
+use-damage = false;
+
+# Use X Sync fence to sync clients' draw calls, to make sure all draw
+# calls are finished before picom starts drawing. Needed on nvidia-drivers
+# with GLX backend for some users.
+#
+# xrender-sync-fence = false
+
+# GLX backend: Use specified GLSL fragment shader for rendering window contents.
+# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl`
+# in the source tree for examples.
+#
+# glx-fshader-win = ""
+
+# Force all windows to be painted with blending. Useful if you
+# have a glx-fshader-win that could turn opaque pixels transparent.
+#
+# force-win-blend = false
+
+# Do not use EWMH to detect fullscreen windows.
+# Reverts to checking if a window is fullscreen based only on its size and coordinates.
+#
+# no-ewmh-fullscreen = false
+
+# Dimming bright windows so their brightness doesn't exceed this set value.
+# Brightness of a window is estimated by averaging all pixels in the window,
+# so this could comes with a performance hit.
+# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
+#
+# max-brightness = 1.0
+
+# Make transparent windows clip other windows like non-transparent windows do,
+# instead of blending on top of them.
+#
+# transparent-clipping = false
+
+# Set the log level. Possible values are:
+# "trace", "debug", "info", "warn", "error"
+# in increasing level of importance. Case doesn't matter.
+# If using the "TRACE" log level, it's better to log into a file
+# using *--log-file*, since it can generate a huge stream of logs.
+#
+# log-level = "debug"
+log-level = "warn";
+
+# Set the log file.
+# If *--log-file* is never specified, logs will be written to stderr.
+# Otherwise, logs will to written to the given file, though some of the early
+# logs might still be written to the stderr.
+# When setting this option from the config file, it is recommended to use an absolute path.
+#
+# log-file = "/path/to/your/log/file"
+
+# Show all X errors (for debugging)
+# show-all-xerrors = false
+
+# Write process ID to a file.
+# write-pid-path = "/path/to/your/log/file"
+
+# Window type settings
+#
+# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
+# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
+# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
+# "tooltip", "notification", "combo", and "dnd".
+#
+# Following per window-type options are available: ::
+#
+# fade, shadow:::
+# Controls window-type-specific shadow and fade settings.
+#
+# opacity:::
+# Controls default opacity of the window type.
+#
+# focus:::
+# Controls whether the window of this type is to be always considered focused.
+# (By default, all window types except "normal" and "dialog" has this on.)
+#
+# full-shadow:::
+# Controls whether shadow is drawn under the parts of the window that you
+# normally won't be able to see. Useful when the window has parts of it
+# transparent, and you want shadows in those areas.
+#
+# clip-shadow-above:::
+# Controls wether shadows that would have been drawn above the window should
+# be clipped. Useful for dock windows that should have no shadow painted on top.
+#
+# redir-ignore:::
+# Controls whether this type of windows should cause screen to become
+# redirected again after been unredirected. If you have unredir-if-possible
+# set, and doesn't want certain window to cause unnecessary screen redirection,
+# you can set this to `true`.
+#
+#wintypes:
+#{
+# tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; };
+# dock = { shadow = false; clip-shadow-above = true; }
+# dnd = { shadow = false; }
+# popup_menu = { opacity = 0.8; }
+# dropdown_menu = { opacity = 0.8; }
+#};
diff --git a/config/X/redshift/redshift.conf b/config/X/redshift/redshift.conf
new file mode 100644
index 0000000..9652fab
--- /dev/null
+++ b/config/X/redshift/redshift.conf
@@ -0,0 +1,70 @@
+; Global settings for redshift
+[redshift]
+; Set the day and night screen temperatures
+temp-day=5700
+temp-night=3500
+
+; Disable the smooth fade between temperatures when Redshift starts and stops.
+; 0 will cause an immediate change between screen temperatures.
+; 1 will gradually apply the new screen temperature over a couple of seconds.
+fade=0
+
+; Solar elevation thresholds.
+; By default, Redshift will use the current elevation of the sun to determine
+; whether it is daytime, night or in transition (dawn/dusk). When the sun is
+; above the degrees specified with elevation-high it is considered daytime and
+; below elevation-low it is considered night.
+;elevation-high=3
+;elevation-low=-6
+
+; Custom dawn/dusk intervals.
+; Instead of using the solar elevation, the time intervals of dawn and dusk
+; can be specified manually. The times must be specified as HH:MM in 24-hour
+; format.
+;dawn-time=6:00-7:45
+;dusk-time=18:35-20:15
+
+; Set the screen brightness. Default is 1.0.
+;brightness=0.9
+; It is also possible to use different settings for day and night
+; since version 1.8.
+;brightness-day=0.7
+;brightness-night=0.4
+; Set the screen gamma (for all colors, or each color channel
+; individually)
+gamma=0.8
+;gamma=0.8:0.7:0.8
+; This can also be set individually for day and night since
+; version 1.10.
+;gamma-day=0.8:0.7:0.8
+;gamma-night=0.6
+
+; Set the location-provider: 'geoclue2', 'manual'
+; type 'redshift -l list' to see possible values.
+; The location provider settings are in a different section.
+location-provider=manual
+
+; Set the adjustment-method: 'randr', 'vidmode'
+; type 'redshift -m list' to see all possible values.
+; 'randr' is the preferred method, 'vidmode' is an older API.
+; but works in some cases when 'randr' does not.
+; The adjustment method settings are in a different section.
+adjustment-method=randr
+
+; Configuration of the location-provider:
+; type 'redshift -l PROVIDER:help' to see the settings.
+; ex: 'redshift -l manual:help'
+; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
+; are negative numbers.
+[manual]
+lat=50
+lon=4
+
+; Configuration of the adjustment-method
+; type 'redshift -m METHOD:help' to see the settings.
+; ex: 'redshift -m randr:help'
+; In this example, randr is configured to adjust only screen 0.
+; Note that the numbering starts from 0, so this is actually the first screen.
+; If this option is not specified, Redshift will try to adjust _all_ screens.
+[randr]
+screen=0
diff --git a/config/X/x11/.Xauthority b/config/X/x11/.Xauthority
new file mode 100644
index 0000000..b606434
--- /dev/null
+++ b/config/X/x11/.Xauthority
Binary files differ
diff --git a/config/X/x11/.Xresources b/config/X/x11/.Xresources
new file mode 100755
index 0000000..c809b23
--- /dev/null
+++ b/config/X/x11/.Xresources
@@ -0,0 +1,155 @@
+! Use Xterm with 256 beautiful colors
+xterm*termName: xterm-256color
+
+! Use a nice truetype font and size by default...
+xterm*faceName: Ubuntu Mono
+xterm*faceSize: 16
+
+! VT font menu: unreadable
+xterm*facesize1: 8
+! VT font menu : tiny
+xterm*facesize2: 10
+! VT font menu: small
+xterm*facesize3: 12
+! VT font menu: medium
+xterm*facesize4: 18
+! VT font menu: large
+xterm*facesize5: 22
+! VT font menu: huge
+xterm*facesize6: 24
+
+! Every shell is a login shell by default (for inclusion of all necessary environment variables)
+xterm*loginshell: true
+
+! A lot of scrollback
+xterm*savelines: 16384
+
+! right hand side scrollbar...
+! xterm*rightScrollBar: true
+! xterm*ScrollBar: true
+
+! stop output to terminal from jumping down to bottom of scroll again
+xterm*scrollTtyOutput: false
+
+! ## select text ##
+xterm*highlightSelection: true
+! remove trailing spaces
+xterm*trimSelection: true
+! selection goes to CLIPBOARD selection
+! xterm*selectToClipboard: true
+! double-click to select whole URLs :D
+xterm*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48
+
+! ## keybindings ##
+! ctrl -/+ zooms out/in
+! ctrl shift c/v = copy/paste
+! selection with mouse left click goes right to clipboard
+xterm*translations: #override \n\
+ Ctrl <Key>-: smaller-vt-font() \n\
+ Ctrl <Key>+: larger-vt-font() \n\
+ Ctrl <Key>0: set-vt-font(d) \n\
+ Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
+ Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
+ <Btn1Up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)
+! Alt key becomes the ESC key >:)
+xterm*metaSendsEscape: true
+
+! Base16 Solarized Dark
+! Scheme: Ethan Schoonover (http://ethanschoonover.com/solarized)
+
+!#define S_base03 #002b36
+!#define S_base02 #073642
+!#define S_base01 #586e75
+!#define S_base00 #657b83
+!#define S_base0 #839496
+!#define S_base1 #93a1a1
+!#define S_base2 #eee8d5
+!#define S_base3 #fdf6e3
+!
+!*background: S_base03
+!*foreground: S_base0
+!*fadeColor: S_base03
+!*cursorColor: S_base1
+!*pointerColorBackground:S_base01
+!*pointerColorForeground:S_base1
+!
+!#define S_yellow #b58900
+!#define S_orange #cb4b16
+!#define S_red #dc322f
+!#define S_magenta #d33682
+!#define S_violet #6c71c4
+!#define S_blue #268bd2
+!#define S_cyan #2aa198
+!#define S_green #859900
+!
+!!! black dark/light
+!*color0: S_base02
+!*color8: S_base03
+!
+!!! red dark/light
+!*color1: S_red
+!*color9: S_orange
+!
+!!! green dark/light
+!*color2: S_green
+!*color10: S_base01
+!
+!!! yellow dark/light
+!*color3: S_yellow
+!*color11: S_base00
+!
+!!! blue dark/light
+!*color4: S_blue
+!*color12: S_base0
+!
+!!! magenta dark/light
+!*color5: S_magenta
+!*color13: S_violet
+!
+!!! cyan dark/light
+!*color6: S_cyan
+!*color14: S_base1
+!
+!!! white dark/light
+!*color7: S_base2
+!*color15: S_base3
+
+#define nord0 #2E3440
+#define nord1 #3B4252
+#define nord2 #434C5E
+#define nord3 #4C566A
+#define nord4 #D8DEE9
+#define nord5 #E5E9F0
+#define nord6 #ECEFF4
+#define nord7 #8FBCBB
+#define nord8 #88C0D0
+#define nord9 #81A1C1
+#define nord10 #5E81AC
+#define nord11 #BF616A
+#define nord12 #D08770
+#define nord13 #EBCB8B
+#define nord14 #A3BE8C
+#define nord15 #B48EAD
+
+*.foreground: nord4
+*.background: nord0
+*.cursorColor: nord4
+*fading: 35
+*fadeColor: nord3
+
+*.color0: nord1
+*.color1: nord11
+*.color2: nord14
+*.color3: nord13
+*.color4: nord9
+*.color5: nord15
+*.color6: nord8
+*.color7: nord5
+*.color8: nord3
+*.color9: nord11
+*.color10: nord14
+*.color11: nord13
+*.color12: nord9
+*.color13: nord15
+*.color14: nord7
+*.color15: nord6
diff --git a/config/X/x11/xinitrc b/config/X/x11/xinitrc
new file mode 100755
index 0000000..c438f1b
--- /dev/null
+++ b/config/X/x11/xinitrc
@@ -0,0 +1,36 @@
+#!/bin/sh
+userresources=$HOME/.Xresources
+usermodmap=$HOME/.Xmodmap
+sysresources=/etc/X11/xinit/.Xresources
+sysmodmap=/etc/X11/xinit/.Xmodmap
+
+# merge in defaults and keymaps
+
+if [ -f $sysresources ]; then
+ xrdb -merge $sysresources
+fi
+
+if [ -f $sysmodmap ]; then
+ xmodmap $sysmodmap
+fi
+
+if [ -f "$userresources" ]; then
+ xrdb -merge "$userresources"
+fi
+
+if [ -f "$usermodmap" ]; then
+ xmodmap "$usermodmap"
+fi
+
+xrandr --output HDMI-1 --primary --left-of VGA-1
+if [ -d /etc/X11/xinit/xinitrc.d ] ; then
+ for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
+ [ -x "$f" ] && . "$f"
+ done
+ unset f
+fi
+
+picom -b
+setxkbmap -option ctrl:nocaps
+xautolock -time 5 -locker slock &
+exec xmonad
diff --git a/config/X/xmobar/scripts/.updates.swp b/config/X/xmobar/scripts/.updates.swp
new file mode 100644
index 0000000..99422fc
--- /dev/null
+++ b/config/X/xmobar/scripts/.updates.swp
Binary files differ
diff --git a/config/X/xmobar/scripts/battery b/config/X/xmobar/scripts/battery
new file mode 100755
index 0000000..77b0d29
--- /dev/null
+++ b/config/X/xmobar/scripts/battery
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+battery="$(acpi -i | awk -F ',' 'NR==1 {print $2}')"
+charging="$(acpi -i | awk 'NR==1 {print $3}')"
+battery=${battery:1:-1}
+if [[ "${charging::-1}" == "Charging" ]]
+then
+ icon="<fn=1></fn>"
+else
+ index=$((battery/25))
+ array=("<fn=1></fn>" "<fn=1></fn>" "<fn=1></fn>" "<fn=1></fn>" "<fn=1></fn>")
+ icon="${array[$index]}"
+fi
+echo -n " ${battery}% ${icon}"
diff --git a/config/X/xmobar/scripts/checkupds b/config/X/xmobar/scripts/checkupds
new file mode 100755
index 0000000..6cc6030
--- /dev/null
+++ b/config/X/xmobar/scripts/checkupds
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+checkupdates | wc -l
diff --git a/config/X/xmobar/scripts/minwinfo b/config/X/xmobar/scripts/minwinfo
new file mode 100755
index 0000000..1736a5f
--- /dev/null
+++ b/config/X/xmobar/scripts/minwinfo
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+#
+echo "name: $1"
+echo "icon: $2"
+echo "sentence: $3"
diff --git a/config/X/xmobar/scripts/whscreen b/config/X/xmobar/scripts/whscreen
new file mode 100755
index 0000000..030493b
--- /dev/null
+++ b/config/X/xmobar/scripts/whscreen
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# # -- Based on mouse
+# # Get mouse location, only X matters
+# X=$(\
+# xdotool getmouselocation -s \
+# | head -n1 \
+# | cut -f2 -d'='\
+# )
+
+# Based on active window
+X=$(xdotool getwindowgeometry -s $(xdotool getwindowfocus) | grep "X" | cut -d'=' -f2)
+
+# For dual monitor setup
+monitor_width="$(\
+ xdotool getdisplaygeometry \
+ | cut -d ' ' -f 1 \
+)"
+
+# If '-' number is negative
+[[ "$((${X} - ${monitor_width}))" -lt 0 ]] \
+ && echo -n '<' \
+ || echo -n '>'
diff --git a/config/X/xmobar/scripts/winfo b/config/X/xmobar/scripts/winfo
new file mode 100755
index 0000000..033ab49
--- /dev/null
+++ b/config/X/xmobar/scripts/winfo
@@ -0,0 +1,124 @@
+#!/bin/bash
+XMDIR="$HOME/.config/xmobar"
+
+terminal="$(\
+ grep -m 1 "myTerminal *=" ~/.config/xmonad/xmonad.hs \
+ | cut -f 2 -d '"' \
+)"
+
+# Gets info over active window in X server
+# made to work with xmobar
+# Make option to change the terminal
+
+# ID of focused window
+GetWinID () {
+ xdotool getWindowfocus
+}
+
+# Gets name of program running active window
+GetWinName () {
+ xdotool getwindowclassname $(GetWinID)
+}
+
+GetWinIcons () {
+ NAME="$(GetWinName | cut -f 1 -d " ")"
+ test -z "$NAME" || \
+ grep -i -m 1 "${NAME}" "$XMDIR/scripts/winfo_icons" | cut -f1 -d' '
+}
+
+# Get current directory of active window
+# for st
+GetCWD (){
+ # Parent PID of process running in window
+ PARENT_PID="$(\
+ xdotool getwindowpid $(GetWinID)\
+ )"
+
+ # PID of process runnning in window
+ PROCESS="$(\
+ pstree -p ${PARENT_PID} \
+ | head -n1 \
+ | sed \
+ -e 's/^.*-\(.*\)$/\1/g' \
+ -e 's/^ *\([^{:( ]*\).*$/\1/g' \
+ )"
+
+ echo -n "${PROCESS}" \
+ | sed \
+ -e "s;^zsh$;<fn=1></fn>&;g" \
+ -e "s;^htop$;<fn=1></fn> &;g" \
+ -e "s;^ranger$;<fn=1></fn> &;g"
+}
+
+# Get title of window / name of process
+# takes one argument, window name
+GetWinTitle() {
+ # Max length of string
+ MAX_LEN=64
+ xdotool GetWindowName $(GetWinID) \
+ | sed \
+ -e 's/ — Mozilla Firefox//g' \
+ -e "s;${HOME};~;g" \
+ -e "s/^\(.\{$MAX_LEN\}\).*$/\1../g" \
+ -e 's/ *\.\.$/\.\./g' \
+ -e "s;^${terminal^}$;$(GetCWD);g"
+}
+
+# Help function
+Help () {
+ echo "-- This is winfo --"
+ echo "Gets information over focused window"
+ echo
+ echo "Usage: getFWinfo [OPTION]"
+ echo " -h display this help and exit"
+ echo " -n for name"
+ echo " -i for icons"
+ echo " -t for titles"
+}
+
+##############################################
+#################### MAIN ####################
+##############################################
+
+# Handles options
+if [ $# -eq 0 ]
+then
+ Help
+ exit 0
+fi
+
+while getopts ":hinTt" option
+do
+ case "$option" in
+
+ h) # Prints help message
+ Help
+ exit 0
+ ;;
+
+ T) # Get terminal specified by xmonad
+ echo ${terminal}
+ exit 0
+ ;;
+
+ i) # Get window icons, uses GetWinName
+ GetWinIcons
+ exit 0
+ ;;
+
+ n) # Get window name "WM_CLASS"
+ GetWinName
+ # Capitalize
+ exit 0
+ ;;
+
+ t) # Get window title, like name of webpage/working dir
+ GetWinTitle
+ exit 0
+ ;;
+
+ esac
+done
+ echo "Invalid option."
+ Help
+ exit 1
diff --git a/config/X/xmobar/scripts/winfo_icons b/config/X/xmobar/scripts/winfo_icons
new file mode 100644
index 0000000..dbdc3ae
--- /dev/null
+++ b/config/X/xmobar/scripts/winfo_icons
@@ -0,0 +1,15 @@
+<fn=1></fn> alacritty kitty
+<fn=1></fn> firefox
+<fn=1></fn> minecraft multimc
+<fn=1></fn> virt-manager virtualbox rustdesk
+<fn=1></fn> mpv
+<fn=1>ﭮ</fn> discord
+<fn=1></fn> jetbrains-clion
+<fn=1></fn> pinentry-gtk-2
+<fn=1></fn> code-oss
+<fn=1>響</fn> mumble
+<fn=1></fn> soffice libreoffice-writer
+<fn=1></fn> steam
+<fn=1></fn> packettracer
+<fn=1></fn> ktouch
+<fn=1></fn> signal
diff --git a/config/X/xmobar/xmobarrc0.hs b/config/X/xmobar/xmobarrc0.hs
new file mode 100644
index 0000000..e3824f2
--- /dev/null
+++ b/config/X/xmobar/xmobarrc0.hs
@@ -0,0 +1,20 @@
+Config { font = "xft:Ubuntu Mono:pixelsize=14:style=bold:antialias=true:hinting:=true"
+ -- Only 1 font, so height automatic
+ , position = BottomW C 16
+ , bgColor = "#2e3440"
+ , fgColor = "#2aa198"
+ , lowerOnStart = True
+ , pickBroadest = False
+ , persistent = False
+ , hideOnStart = False
+ , overrideRedirect = True
+ , wmName = "xmobar2"
+
+ , commands = [
+ Run StdinReader
+ ]
+ , sepChar = "%"
+ , alignSep = "}{"
+
+ , template = "}<fc=#eceff4> %StdinReader% </fc>{"}
+
diff --git a/config/X/xmobar/xmobarrc1.hs b/config/X/xmobar/xmobarrc1.hs
new file mode 100644
index 0000000..a187055
--- /dev/null
+++ b/config/X/xmobar/xmobarrc1.hs
@@ -0,0 +1,149 @@
+Config { font = "xft:Ubuntu Mono:pixelsize=14:style=bold:antialias=true:hinting:=true"
+ , additionalFonts = [
+ "xft:Mononoki Nerd Font Mono:style=bold:pixelsize=24:antialias=true:hinting=true",
+ "xft:Mononoki Nerd Font Mono:style=bold:pixelsize=24:antialias=false:hinting=true"
+ ]
+ , position = TopH 24
+ , borderColor = "#2e3440"
+ , borderWidth = 2
+ , border = BottomB
+ , bgColor = "#2e3440"
+ , fgColor = "#2aa198"
+ , lowerOnStart = True
+ , pickBroadest = False
+ , persistent = False
+ , hideOnStart = False
+ , iconRoot = "/home/aluc/.config/xmobar/icons"
+ , overrideRedirect = True
+ , commands = [ Run Cpu [ "-t", "<total>%"
+ ,"-l", "#2e3440,#58e1ac"
+ ,"-L", "20"
+ ,"-n", "#4c566a,#58e1ac"
+ ,"-h", "#cb4b16,#58e1ac"
+ ,"-H", "50"
+ ,"-w", "3"
+ ] 10
+
+ , Run Memory ["-t", "<usedratio>%"
+ ,"-l", "#2e3440,#58e1ac"
+ ,"-L", "20"
+ ,"-n", "#4c566a,#58e1ac"
+ ,"-h", "#cb4b16,#58e1ac"
+ ,"-H", "50"
+ ,"-w", "2"
+ ] 10
+
+ -- Focused window info
+ , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-n"] "FWname" 3
+ , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-t"] "FWtitle" 3
+ , Run Com "/home/aluc/.config/xmobar/scripts/winfo" ["-i"] "FWicon" 3
+ , Run Com "/home/aluc/.config/xmobar/scripts/checkupds" ["-i"] "updates" 3600
+ -- , Run ComX "$HOME/bin/cmusP" [] "" "cmus" 1
+ , Run Com "uname" ["-r"] "" 36000
+ , Run Date "<fn=1>\xf073</fn> %b %_d %Y - %H:%M:%S" "date" 10
+ , Run PipeReader "/home/aluc/.config/xmobar/scripts/volume-pipe" "vol"
+ ]
+ , sepChar = "%"
+ , alignSep = "}{"
+
+
+ -- COLORS
+ -- #2aa198 : Blue/green -- fg
+ --
+ -- #d08770 : pinkish brown -- memory
+ -- #ff00ff : pink/purple -- swap
+ -- #828be6 : perrywinkle -- FWname
+ -- #825be6 : purpley -- FWtitle
+ -- bgColor = "#2e3440"
+ -- fgColor = "#2aa198"
+ -- #58e1ac
+
+ , template = " \
+ -- Left
+
+ \<fc=#b48ead,#2e3440><fn=2></fn></fc>\
+ \<fc=#2e3440,#b48ead>\
+ \<box type=VBoth width=4 color=#b48ead>\
+ \ <fn=1></fn> %uname% \
+ \</box>\
+ \</fc>\
+ \<fc=#2e3440,#b48ead><fn=2></fn></fc>\
+
+ \<fc=#58e1ac,#2e3440><fn=2></fn></fc>\
+ \<fc=#2e3440,#58e1ac>\
+ \<box type=VBoth width=4 color=#58e1ac>\
+ \ %vol% \
+ \</box>\
+ \</fc>\
+ \<fc=#2e3440,#58e1ac><fn=2></fn></fc>\
+
+ \<fc=#88c0d0,#2e3440><fn=2></fn></fc>\
+ \<fc=#2e3440,#88c0d0>\
+ \<box type=VBoth width=4 color=#88c0d0>\
+ \<action=`dmenu_run` button=1>\
+ \ dmenu \
+ \</action>\
+ \</box>\
+ \</fc>\
+ \<fc=#88c0d0><fn=2></fn></fc>\
+
+
+ -- Centered
+ \}\
+ \<fc=#ebcb8b,#2e3440><fn=2></fn></fc>\
+ \<fc=#4c566a,#ebcb8b>\
+ \<box type=VBoth width=4 color=#ebcb8b>\
+ \ %FWicon% \
+ \</box>\
+ \</fc>\
+ \<fc=#4c566a,#ebcb8b>\
+ \<box type=VBoth width=4 color=#ebcb8b>\
+ \%FWname% \
+ \</box>\
+ \</fc>\
+ \<fc=#b48ead,#ebcb8b>\
+ \<box type=VBoth width=4 color=#ebcb8b>\
+ \<box type=Bottom width=2 mb=3 color=#b48ead>\
+ \%FWtitle%\
+ \</box>\
+ \</box>\
+ \</fc>\
+ \<fc=#2e3440,#ebcb8b><fn=2> </fn></fc>\
+ \<fc=#ebcb8b,#2e3440><fn=2></fn></fc>\
+
+
+ -- Right
+ \{ \
+
+ \<fc=#88c0d0,#2e3440><fn=2></fn></fc>\
+ \<fc=#2e3440,#88c0d0>\
+ \<box type=VBoth width=4 color=#88c0d0>\
+ \ %updates% <fn=1></fn>\
+ \</box>\
+ \</fc>\
+ \<fc=#88c0d0><fn=2></fn></fc>\
+
+ \<fc=#2e3440,#58e1ac><fn=2></fn></fc>\
+ \<fc=#2e3440,#58e1ac>\
+ \<box type=VBoth width=4 color=#58e1ac>\
+ \ <fn=1></fn>%cpu% \
+ \</box>\
+ \<fc=#2e3440,#58e1ac>\
+ \<box type=VBoth width=4 color=#58e1ac>\
+ \%memory% \
+ \</box>\
+ \</fc>\
+ \</fc>\
+ \<fc=#58e1ac><fn=2></fn></fc>\
+
+ \<fc=#2e3440,#b48ead><fn=2></fn></fc>\
+ \<fc=#2e3440,#b48ead>\
+ \<box type=VBoth width=4 color=#b48ead>\
+ \ %date% \
+ \</box>\
+ \</fc>\
+ \<fc=#b48ead><fn=2></fn></fc> "
+
+ }
+
+
diff --git a/config/X/xmonad/autostart/.cyclepaper.sh b/config/X/xmonad/autostart/.cyclepaper.sh
new file mode 100755
index 0000000..fb07bc9
--- /dev/null
+++ b/config/X/xmonad/autostart/.cyclepaper.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+wallpaper_dir="$HOME/Pictures/Wallpapers/nord"
+
+interval="15m"
+
+wallpapers=($(ls $wallpaper_dir))
+wp_count=${#wallpapers[@]}
+i=0
+
+while true; do
+ feh --bg-scale $wallpaper_dir/${wallpapers[$i]}
+ ((i++))
+ if [ $i -eq $wp_count ]
+ then
+ i=0
+ fi
+ sleep $interval
+done
diff --git a/config/X/xmonad/autostart/autostart.sh b/config/X/xmonad/autostart/autostart.sh
new file mode 100755
index 0000000..c9d75ae
--- /dev/null
+++ b/config/X/xmonad/autostart/autostart.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+cd $HOME/.config/xmonad/autostart/
+for script in *.sh
+do
+ if [ "./$script" != "$0" ] && [ -z "$(ps aux | grep "$script" | head -n -1)" ]
+ then
+ echo "started $script"
+ setsid ./$script &
+ fi
+done
diff --git a/config/X/xmonad/autostart/fehbg.sh b/config/X/xmonad/autostart/fehbg.sh
new file mode 100755
index 0000000..4b65f3a
--- /dev/null
+++ b/config/X/xmonad/autostart/fehbg.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+feh --no-fehbg --bg-scale "$HOME/pictures/Wallpapers/nord/nord_background3.jpg"
diff --git a/config/X/xmonad/autostart/getvolume.sh b/config/X/xmonad/autostart/getvolume.sh
new file mode 100755
index 0000000..ee2509e
--- /dev/null
+++ b/config/X/xmonad/autostart/getvolume.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+while true
+do
+ string=$(pamixer --get-volume)
+ muted=$(pamixer --get-mute)
+ if [[ "$muted" == "true" ]]
+ then
+ icon="<fn=1></fn>"
+ elif [ $string -gt 49 ]
+ then
+ icon="<fn=1></fn>"
+ elif [ $string -eq 0 ]
+ then
+ icon="<fn=1></fn>"
+ elif [ $string -lt 50 ]
+ then
+ icon="<fn=1></fn>"
+ fi
+ echo "${string}% $icon" > $HOME/.config/xmobar/scripts/volume-pipe
+done
diff --git a/config/X/xmonad/autostart/yt-not.sh b/config/X/xmonad/autostart/yt-not.sh
new file mode 100755
index 0000000..a68f0c3
--- /dev/null
+++ b/config/X/xmonad/autostart/yt-not.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+ytnotdir="$HOME/.local/share/yt-not"
+
+get_notification()
+{
+
+ cat "${ytnotdir}/channels.yt-not" | \
+ while read line
+ do
+ channelId="$(echo "$line" | awk '{print $1}')"
+ ch_name="$(echo "$line" | awk '{print $2}')"
+ pre_vId="$(echo "$line" | awk '{print $3}')"
+ # Get last vid from xml feed
+ new_vId="$(curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}" | sed '/videoId/!d;s/^.*>\(.*\)<.*$/\1/g' | head -n1)"
+ if [ "$new_vId" != "$pre_vId" ]
+ then
+ dunstify "yt-notify" "NEW VID!! from\n${ch_name}"
+ newline=$(echo "$line" | sed "s/$pre_vId/$new_vId/")
+ sed -i "s/$line/$newline/" "${ytnotdir}/channels.yt-not"
+ fi
+ done
+}
+
+# Two valid formats:
+# 1: @channel
+# 2: channelId @channel videoId
+parse_channels()
+{
+ cat "${ytnotdir}/channels.yt-not" | \
+ while read line
+ do
+ # First word of line is channelId or channelTag
+ chidot="$(echo "$line" | awk '{print $1}')"
+ # Tags start with @
+ if [ "${chidot::1}" == "@" ]
+ then
+ # channel tag -> channelId
+ channelId="$(curl -s "https://www.youtube.com/${chidot}" | pup 'meta[itemprop="channelId"] attr{content}')"
+ sed -i "s/${chidot}/${channelId} ${chidot} novideo/" "${ytnotdir}/channels.yt-not"
+ fi
+ done
+}
+
+main()
+{
+ mkdir -p "${ytnotdir}"
+ if [ ! -f "${ytnotdir}/channels.yt-not" ]
+ then
+ echo "@bugswriter_" > "${ytnotdir}/channels.yt-not"
+ echo "@DistroTube" >> "${ytnotdir}/channels.yt-not"
+ echo "@MentalOutlaw" >> "${ytnotdir}/channels.yt-not"
+ echo "@Fireship" >> "${ytnotdir}/channels.yt-not"
+ fi
+
+ while true
+ do
+ sleep 15m
+ parse_channels
+ get_notification
+ done
+}
+
+main
diff --git a/config/X/xmonad/xmonad.disabled/autostart/.cyclepaper.sh b/config/X/xmonad/xmonad.disabled/autostart/.cyclepaper.sh
new file mode 100755
index 0000000..fb07bc9
--- /dev/null
+++ b/config/X/xmonad/xmonad.disabled/autostart/.cyclepaper.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+wallpaper_dir="$HOME/Pictures/Wallpapers/nord"
+
+interval="15m"
+
+wallpapers=($(ls $wallpaper_dir))
+wp_count=${#wallpapers[@]}
+i=0
+
+while true; do
+ feh --bg-scale $wallpaper_dir/${wallpapers[$i]}
+ ((i++))
+ if [ $i -eq $wp_count ]
+ then
+ i=0
+ fi
+ sleep $interval
+done
diff --git a/config/X/xmonad/xmonad.disabled/autostart/autostart.sh b/config/X/xmonad/xmonad.disabled/autostart/autostart.sh
new file mode 100755
index 0000000..c9d75ae
--- /dev/null
+++ b/config/X/xmonad/xmonad.disabled/autostart/autostart.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+cd $HOME/.config/xmonad/autostart/
+for script in *.sh
+do
+ if [ "./$script" != "$0" ] && [ -z "$(ps aux | grep "$script" | head -n -1)" ]
+ then
+ echo "started $script"
+ setsid ./$script &
+ fi
+done
diff --git a/config/X/xmonad/xmonad.disabled/autostart/fehbg.sh b/config/X/xmonad/xmonad.disabled/autostart/fehbg.sh
new file mode 100755
index 0000000..4b65f3a
--- /dev/null
+++ b/config/X/xmonad/xmonad.disabled/autostart/fehbg.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+feh --no-fehbg --bg-scale "$HOME/pictures/Wallpapers/nord/nord_background3.jpg"
diff --git a/config/X/xmonad/xmonad.disabled/autostart/getvolume.sh b/config/X/xmonad/xmonad.disabled/autostart/getvolume.sh
new file mode 100755
index 0000000..ee2509e
--- /dev/null
+++ b/config/X/xmonad/xmonad.disabled/autostart/getvolume.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+while true
+do
+ string=$(pamixer --get-volume)
+ muted=$(pamixer --get-mute)
+ if [[ "$muted" == "true" ]]
+ then
+ icon="<fn=1></fn>"
+ elif [ $string -gt 49 ]
+ then
+ icon="<fn=1></fn>"
+ elif [ $string -eq 0 ]
+ then
+ icon="<fn=1></fn>"
+ elif [ $string -lt 50 ]
+ then
+ icon="<fn=1></fn>"
+ fi
+ echo "${string}% $icon" > $HOME/.config/xmobar/scripts/volume-pipe
+done
diff --git a/config/X/xmonad/xmonad.disabled/autostart/yt-not.sh b/config/X/xmonad/xmonad.disabled/autostart/yt-not.sh
new file mode 100755
index 0000000..a68f0c3
--- /dev/null
+++ b/config/X/xmonad/xmonad.disabled/autostart/yt-not.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+ytnotdir="$HOME/.local/share/yt-not"
+
+get_notification()
+{
+
+ cat "${ytnotdir}/channels.yt-not" | \
+ while read line
+ do
+ channelId="$(echo "$line" | awk '{print $1}')"
+ ch_name="$(echo "$line" | awk '{print $2}')"
+ pre_vId="$(echo "$line" | awk '{print $3}')"
+ # Get last vid from xml feed
+ new_vId="$(curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}" | sed '/videoId/!d;s/^.*>\(.*\)<.*$/\1/g' | head -n1)"
+ if [ "$new_vId" != "$pre_vId" ]
+ then
+ dunstify "yt-notify" "NEW VID!! from\n${ch_name}"
+ newline=$(echo "$line" | sed "s/$pre_vId/$new_vId/")
+ sed -i "s/$line/$newline/" "${ytnotdir}/channels.yt-not"
+ fi
+ done
+}
+
+# Two valid formats:
+# 1: @channel
+# 2: channelId @channel videoId
+parse_channels()
+{
+ cat "${ytnotdir}/channels.yt-not" | \
+ while read line
+ do
+ # First word of line is channelId or channelTag
+ chidot="$(echo "$line" | awk '{print $1}')"
+ # Tags start with @
+ if [ "${chidot::1}" == "@" ]
+ then
+ # channel tag -> channelId
+ channelId="$(curl -s "https://www.youtube.com/${chidot}" | pup 'meta[itemprop="channelId"] attr{content}')"
+ sed -i "s/${chidot}/${channelId} ${chidot} novideo/" "${ytnotdir}/channels.yt-not"
+ fi
+ done
+}
+
+main()
+{
+ mkdir -p "${ytnotdir}"
+ if [ ! -f "${ytnotdir}/channels.yt-not" ]
+ then
+ echo "@bugswriter_" > "${ytnotdir}/channels.yt-not"
+ echo "@DistroTube" >> "${ytnotdir}/channels.yt-not"
+ echo "@MentalOutlaw" >> "${ytnotdir}/channels.yt-not"
+ echo "@Fireship" >> "${ytnotdir}/channels.yt-not"
+ fi
+
+ while true
+ do
+ sleep 15m
+ parse_channels
+ get_notification
+ done
+}
+
+main
diff --git a/config/X/xmonad/xmonad.disabled/xmonad.hs b/config/X/xmonad/xmonad.disabled/xmonad.hs
new file mode 100644
index 0000000..e72957b
--- /dev/null
+++ b/config/X/xmonad/xmonad.disabled/xmonad.hs
@@ -0,0 +1,344 @@
+import XMonad
+
+-- Actions
+import qualified XMonad.Actions.CycleWS as CWS
+import XMonad.Actions.NoBorders
+import XMonad.Actions.SpawnOn
+
+-- Hooks
+import XMonad.Hooks.DynamicLog (dynamicLogWithPP, filterOutWsPP, wrap, xmobarPP, xmobarColor, shorten, shorten', shortenLeft', PP(..))
+import XMonad.Hooks.EwmhDesktops
+import XMonad.Hooks.ManageHelpers
+import XMonad.Hooks.ManageDocks
+import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
+import XMonad.Hooks.SetWMName
+import XMonad.Hooks.StatusBar
+import XMonad.Hooks.StatusBar.PP (xmobarFont)
+import XMonad.Hooks.WorkspaceHistory
+
+import XMonad.Layout.Gaps
+import XMonad.Layout.PerWorkspace
+import XMonad.Layout.NoBorders
+import XMonad.Layout.Spacing
+import XMonad.Layout.Spiral
+
+import qualified XMonad.StackSet as W
+-- import XMonad.EZConfig (AddAdditionalKeysP)
+
+-- Utils
+import XMonad.Util.Cursor
+import XMonad.Util.Dmenu
+import XMonad.Util.EZConfig (additionalKeysP)
+import XMonad.Util.NamedScratchpad
+import XMonad.Util.Run
+import XMonad.Util.SpawnOnce
+
+-- Data
+import Data.Maybe (fromJust)
+import Data.Monoid
+import qualified Data.Map as M
+
+import System.Exit
+import System.IO
+
+-- Variables
+--
+-- Default Terminal
+myTerminal :: String
+myTerminal = "alacritty"
+
+-- Whether focus follows the mouse pointer.
+myFocusFollowsMouse :: Bool
+myFocusFollowsMouse = True
+
+-- Whether clicking on a window to focus also passes the click to the window
+myClickJustFocuses :: Bool
+myClickJustFocuses = True
+
+-- Width of the window border in pixels.
+--
+myBorderWidth = 2
+
+myModMask = mod4Mask
+
+-- myScratchPads :: [NamedScratchpad]
+-- myScratchPads = [ NS "terminal" "kitty" (title =? "getScratched") defaultFloating ]
+--
+-- Workspaces
+myWorkspaces = ["cab","web","lab","ser","gfx","idi","gam","muz","cha","hid"]
+colorbg = "#2e3440"
+colorfg = "#eceff4"
+
+color01 = "#5e8bac"
+color02 = "#b48ead"
+color04 = "#ebcb8b"
+color05 = "#81a1c1"
+color09 = "#4c566a"
+color17 = "#d03a3f"
+
+leftwp = "<box type=Bottom width=2 mb=2 color=" ++ colorfg ++ ">"
+rightwp = "</box>"
+
+-- Count of window in active workspace
+windowCount :: X (Maybe String)
+windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
+
+------ COLORS
+
+-- Border colors for unfocused and focused windows, respectively.
+myNormalBorderColor = color09
+myFocusedBorderColor = color05
+
+------------------------------------------------------------------------
+-- Key bindings. Add, modify or remove key bindings here.
+myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
+
+ --
+ -- mod-[1..9], Switch to workspace N
+ -- mod-shift-[1..9], Move client to workspace N
+ --
+ [((m .|. modm, k), windows $ f i)
+ | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
+ , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
+ ++
+ --
+ -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
+ -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
+ --
+ [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
+ | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
+ -- | (key, sc) <- zip [xK_e, xK_w, xK_r] [0..]
+ , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
+
+------------------------------------------------------------------------
+-- Mouse bindings: default actions bound to mouse events
+--
+myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
+
+ -- mod-button1, Set the window to floating mode and move by dragging
+ [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
+ >> windows W.shiftMaster))
+ -- mod-button2, Raise the window to the top of the stack
+ , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
+ -- mod-button3, Set the window to floating mode and resize by dragging
+ , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
+ >> windows W.shiftMaster))
+ -- you may also bind events to the mouse scroll wheel (button4 and button5)
+ ]
+
+------------------------------------------------------------------------
+-- Layouts:
+myLayoutPrinter :: String -> String
+myLayoutPrinter "Spacing Tall" = xmobarColor colorfg colorbg "til"
+myLayoutPrinter "Spacing Mirror Tall" = xmobarColor colorfg colorbg "mti"
+myLayoutPrinter "Spacing Spiral" = xmobarColor colorfg colorbg "fib"
+myLayoutPrinter "Spacing Full" = xmobarColor colorfg colorbg "ful"
+myLayoutPrinter x = xmobarColor colorfg colorbg x
+
+myLayout =
+ onWorkspace "gam" Full $
+ avoidStruts(gaps [(L,3), (D,3), (U,3), (R,3)] $ smartSpacing 2 $ tiled ||| Mirror tiled ||| fib ||| Full)
+ where
+ -- default tiling algorithm partitions the screen into two panes
+ tiled = Tall nmaster delta ratio
+ -- The default number of windows in the master pane
+ nmaster = 1
+ -- Default proportion of screen occupied by master pane
+ ratio = 2/5
+ -- Percent of screen to increment by when resizing panes
+ delta = 3/100
+
+ fib = spiral (6/7)
+
+
+------------------------------------------------------------------------
+-- Window rules:
+
+myManageHook = composeAll
+ [
+ -- className =? "Gimp" --> doFloat
+ -- , className =? "Tilp" --> doFloat
+ -- , resource =? "desktop_window" --> doIgnore
+ -- , resource =? "kdesktop" --> doIgnore
+ --
+ className =? "discord" --> doShift "cha",
+ className =? "Steam" --> doShift "gam"
+ ]
+-- <+> namedScratchpadManageHook myScratchPads
+
+
+------------------------------------------------------------------------
+-- Startup hook
+myStartupHook = do
+
+ setWMName "XMonad"
+
+ setDefaultCursor xC_arrow
+
+ spawnOnce "checkupdates | wc -l > /tmp/updates.tmp"
+ spawnOnce "systemctl --user restart redshift.service"
+ spawnOnce "unclutter --timeout 3 --jitter 50 -b"
+ spawnOnce "numlockx"
+ spawnOnce "$HOME/.config/xmonad/autostart/autostart.sh"
+
+------------------------------------------------------------------------
+-- Now run xmonad with all the defaults we set up.
+
+-- Run xmonad with the settings you specify. No need to modify this.
+--
+main = do
+ -- Setup xmobar as docks
+ --
+ xmproc0 <- spawnPipe "xmobar $HOME/.config/xmobar/xmobarrc0.hs"
+ xmproc1 <- spawnPipe "xmobar $HOME/.config/xmobar/xmobarrc1.hs"
+
+ -- ewmh: Add fullscreen handling support
+ xmonad $ docks . ewmh $ defaults {
+ layoutHook = avoidStruts $ layoutHook defaults
+ , logHook = dynamicLogWithPP $ filterOutWsPP ["hid"] $ xmobarPP {
+ ppOutput = \x -> hPutStrLn xmproc0 x
+
+ , ppCurrent = xmobarColor colorfg colorbg . wrap leftwp rightwp -- Visible but not current workspace
+ , ppVisible = xmobarColor colorfg colorbg -- Hidden workspace
+ , ppHidden = xmobarColor color01 colorbg -- Hidden workspaces (no windows)
+ , ppHiddenNoWindows = xmobarColor color04 colorbg -- Title of active window
+ , ppTitle = xmobarColor "" "" . shorten' "" 0 -- Separator character
+ , ppSep = " "
+ , ppLayout = myLayoutPrinter
+ -- Urgent workspace , ppUrgent = xmobarColor color17 colorbg . wrap "!" "!"
+ , ppExtras = [windowCount] -- Adding # of windows on current workspace to the bar
+ }
+
+}
+
+
+defaults = ewmh def {
+ -- simple stuff
+ terminal = myTerminal,
+ focusFollowsMouse = myFocusFollowsMouse,
+ clickJustFocuses = myClickJustFocuses,
+ borderWidth = myBorderWidth,
+ modMask = myModMask,
+ workspaces = myWorkspaces,
+ normalBorderColor = myNormalBorderColor,
+ focusedBorderColor = myFocusedBorderColor,
+
+ -- key bindings
+ keys = myKeys,
+ mouseBindings = myMouseBindings,
+
+ -- hooks, layouts
+ layoutHook = myLayout,
+ manageHook = myManageHook <+> manageSpawn,
+ startupHook = myStartupHook
+ }
+ `additionalKeysP`
+ [ ("M-<Return>", spawn myTerminal)
+ , ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do
+ , ("M-0", windows $ W.greedyView $ "hid") -- N.B. this is an absurd thing to do
+ , ("M-u", incScreenWindowSpacing (2))
+ , ("M-i", incScreenWindowSpacing (-2))
+ , ("M-o", setScreenWindowSpacing (2))
+ -- Then these key bindings
+ -- cycling worspaces
+ , ("M-<R>", CWS.nextWS)
+ , ("M-<L>", CWS.prevWS)
+ , ("M-S-<R>", CWS.shiftToNext >> CWS.nextWS)
+ , ("M-S-<L>", CWS.shiftToPrev >> CWS.prevWS)
+ , ("M-m", spawn "emacs")
+ -- launch firefox
+ , ("M-b", spawn "firefox")
+ -- take screenshots
+ , ("M-s", spawn "maim ~/pictures/screenshot-$(date +%y%m%d_%H_%M_%S).png")
+ , ("M-C-s", spawn "maim -i $(xdotool getactivewindow) ~/pictures/screenshot-$(date +%y%m%d_%H_%M_%S).png")
+ , ("M-S-s", spawn "maim --select | xclip -selection clipboard -t image/png")
+ -- close focused window
+ , ("M-c", spawn "kill $(xprop | grep PID | cut -d = -f 2)")
+ , ("M-S-c", kill)
+ -- Rotate through the available layout algorithms
+ , ("M-C-1", sendMessage $ JumpToLayout "Tall")
+ , ("M-C-2", sendMessage $ JumpToLayout "Mirror Tall")
+ , ("M-C-3", sendMessage $ JumpToLayout "Spiral")
+ , ("M-C-4", sendMessage $ JumpToLayout "Full")
+ , ("M-<Tab>", sendMessage NextLayout)
+
+ , ("M-<Space>", spawn "cycleKB")
+ -- Resize viewed windows to the correct size
+ , ("M-n", refresh)
+ -- Move focus to the next window
+ , ("M-j", windows W.focusDown)
+ -- Move focus to the previous window
+ , ("M-k", windows W.focusUp)
+ -- Swap the focused window with the next window
+ , ("M-S-j", windows W.swapDown)
+ -- Swap the focused window with the previous window
+ , ("M-S-k", windows W.swapUp)
+ -- Shrink the master area
+ , ("M-h", sendMessage Shrink)
+ -- Expand the master area
+ , ("M-l", sendMessage Expand)
+ -- Push window back into tiling
+ , ("M-S-t", withFocused $ windows . W.sink)
+ -- Increment the number of windows in the master area
+ , ("M-,", sendMessage (IncMasterN 1))
+ -- Deincrement the number of windows in the master area
+ , ("M-.", sendMessage (IncMasterN (-1)))
+ -- Quit xmonad
+ , ("M-S-q", io (exitWith ExitSuccess))
+ -- Restart xmonad
+ , ("M-q", spawn "killall xmobar; xmonad --recompile && xmonad --restart")
+ , ("M-x m", spawn "kill -USR1 $(pgrep xmobar)")
+ -- open alsamixer and change volume with keyboard wheel
+ , ("<XF86AudioLowerVolume>" , spawn "pamixer -d 5")
+ , ("<XF86AudioRaiseVolume>" , spawn "pamixer -i 5")
+ , ("<XF86AudioMute>" , spawn "pamixer -t")
+ , ("<XF86MonBrightnessDown>", spawn "light -U 5")
+ , ("<XF86MonBrightnessUp>" , spawn "light -A 5")
+ , ("M-y" , spawn "arr_hjkl")
+ -- Toggle borders
+ , ("M-S-b", do
+ withFocused toggleBorder
+ refresh)
+ -- Fullscreen by toggling borders,
+ -- struts so docks can be obfuscated
+ -- (forcing it into tiling, because problems if you change layouts)
+ , ("M-S-f", do
+ sendMessage ToggleStruts
+ sendMessage ToggleGaps
+ toggleWindowSpacingEnabled
+ withFocused toggleBorder
+ refresh)
+
+ , ("M-a c" , spawn "code")
+ , ("M-a d" , spawnOn "cha" "discord")
+ , ("M-a s" , spawnOn "cha" "signal-desktop")
+ , ("M-a k" , spawn "virt-manager")
+ , ("M-a m" , spawn "mumble")
+ , ("M-a v" , spawn "virtualbox")
+ -- file managers
+ , ("M-f k", spawn ("kitty" ++ " -e ranger"))
+ , ("M-f d", spawn "dolphin")
+
+
+ -- cycle keyboards
+ -- dmenu
+ , ("M-S-<Return>", spawn "dmenu_run")
+ , ("M-p a", spawn "dmapimg")
+ , ("M-<Insert>", spawn "dmpsbm")
+ , ("M-S-<Insert>", spawn "dmpsclip")
+ , ("M-p c", spawn "dmclip")
+ , ("M-p d", spawn "dmdsktp")
+ , ("M-p f", spawn "dmfm")
+ , ("M-p g", spawn "passgen")
+ , ("M-p h", spawn "dmhelp")
+ , ("M-p l", spawn "dmlang")
+ , ("M-p m", spawn "passmenu")
+ -- , ("M-p S-m", spawn "passmenu --type")
+ , ("M-p p", spawn "dmpdf")
+ , ("M-p o", spawn "dmpower")
+ , ("M-p v", spawn "dmvid")
+
+ -- Gaming
+ , ("M-g s", spawnOn "gam" "steam")
+ , ("M-g m", spawnOn "gam" "multimc -l 1.8.9")
+ ]
diff --git a/config/X/xmonad/xmonad.hs b/config/X/xmonad/xmonad.hs
new file mode 100644
index 0000000..c6cf44b
--- /dev/null
+++ b/config/X/xmonad/xmonad.hs
@@ -0,0 +1,344 @@
+import XMonad
+
+-- Actions
+import qualified XMonad.Actions.CycleWS as CWS
+import XMonad.Actions.NoBorders
+import XMonad.Actions.SpawnOn
+
+-- Hooks
+import XMonad.Hooks.DynamicLog (dynamicLogWithPP, filterOutWsPP, wrap, xmobarPP, xmobarColor, shorten, shorten', shortenLeft', PP(..))
+import XMonad.Hooks.EwmhDesktops
+import XMonad.Hooks.ManageHelpers
+import XMonad.Hooks.ManageDocks
+import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
+import XMonad.Hooks.SetWMName
+import XMonad.Hooks.StatusBar
+import XMonad.Hooks.StatusBar.PP (xmobarFont)
+import XMonad.Hooks.WorkspaceHistory
+
+import XMonad.Layout.Gaps
+import XMonad.Layout.PerWorkspace
+import XMonad.Layout.NoBorders
+import XMonad.Layout.Spacing
+import XMonad.Layout.Spiral
+
+import qualified XMonad.StackSet as W
+-- import XMonad.EZConfig (AddAdditionalKeysP)
+
+-- Utils
+import XMonad.Util.Cursor
+import XMonad.Util.Dmenu
+import XMonad.Util.EZConfig (additionalKeysP)
+import XMonad.Util.NamedScratchpad
+import XMonad.Util.Run
+import XMonad.Util.SpawnOnce
+
+-- Data
+import Data.Maybe (fromJust)
+import Data.Monoid
+import qualified Data.Map as M
+
+import System.Exit
+import System.IO
+
+-- Variables
+--
+-- Default Terminal
+myTerminal :: String
+myTerminal = "alacritty"
+
+-- Whether focus follows the mouse pointer.
+myFocusFollowsMouse :: Bool
+myFocusFollowsMouse = True
+
+-- Whether clicking on a window to focus also passes the click to the window
+myClickJustFocuses :: Bool
+myClickJustFocuses = True
+
+-- Width of the window border in pixels.
+--
+myBorderWidth = 2
+
+myModMask = mod4Mask
+
+-- myScratchPads :: [NamedScratchpad]
+-- myScratchPads = [ NS "terminal" "kitty" (title =? "getScratched") defaultFloating ]
+--
+-- Workspaces
+myWorkspaces = ["cab","web","lab","ser","gfx","idi","gam","muz","cha","hid"]
+colorbg = "#2e3440"
+colorfg = "#eceff4"
+
+color01 = "#5e8bac"
+color02 = "#b48ead"
+color04 = "#ebcb8b"
+color05 = "#81a1c1"
+color09 = "#4c566a"
+color17 = "#d03a3f"
+
+leftwp = "<box type=Bottom width=2 mb=2 color=" ++ colorfg ++ ">"
+rightwp = "</box>"
+
+-- Count of window in active workspace
+windowCount :: X (Maybe String)
+windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
+
+------ COLORS
+
+-- Border colors for unfocused and focused windows, respectively.
+myNormalBorderColor = color09
+myFocusedBorderColor = color05
+
+------------------------------------------------------------------------
+-- Key bindings. Add, modify or remove key bindings here.
+myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
+
+ --
+ -- mod-[1..9], Switch to workspace N
+ -- mod-shift-[1..9], Move client to workspace N
+ --
+ [((m .|. modm, k), windows $ f i)
+ | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
+ , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
+ ++
+ --
+ -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
+ -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
+ --
+ [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
+ | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
+ -- | (key, sc) <- zip [xK_e, xK_w, xK_r] [0..]
+ , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
+
+------------------------------------------------------------------------
+-- Mouse bindings: default actions bound to mouse events
+--
+myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
+
+ -- mod-button1, Set the window to floating mode and move by dragging
+ [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
+ >> windows W.shiftMaster))
+ -- mod-button2, Raise the window to the top of the stack
+ , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
+ -- mod-button3, Set the window to floating mode and resize by dragging
+ , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
+ >> windows W.shiftMaster))
+ -- you may also bind events to the mouse scroll wheel (button4 and button5)
+ ]
+
+------------------------------------------------------------------------
+-- Layouts:
+myLayoutPrinter :: String -> String
+myLayoutPrinter "Spacing Tall" = xmobarColor colorfg colorbg "til"
+myLayoutPrinter "Spacing Mirror Tall" = xmobarColor colorfg colorbg "mti"
+myLayoutPrinter "Spacing Spiral" = xmobarColor colorfg colorbg "fib"
+myLayoutPrinter "Spacing Full" = xmobarColor colorfg colorbg "ful"
+myLayoutPrinter x = xmobarColor colorfg colorbg x
+
+myLayout =
+ onWorkspace "gam" Full $
+ avoidStruts(gaps [(L,3), (D,3), (U,3), (R,3)] $ smartSpacing 2 $ tiled ||| Mirror tiled ||| fib ||| Full)
+ where
+ -- default tiling algorithm partitions the screen into two panes
+ tiled = Tall nmaster delta ratio
+ -- The default number of windows in the master pane
+ nmaster = 1
+ -- Default proportion of screen occupied by master pane
+ ratio = 2/5
+ -- Percent of screen to increment by when resizing panes
+ delta = 3/100
+
+ fib = spiral (6/7)
+
+
+------------------------------------------------------------------------
+-- Window rules:
+
+myManageHook = composeAll
+ [
+ -- className =? "Gimp" --> doFloat
+ -- , className =? "Tilp" --> doFloat
+ -- , resource =? "desktop_window" --> doIgnore
+ -- , resource =? "kdesktop" --> doIgnore
+ --
+ className =? "discord" --> doShift "cha",
+ className =? "Steam" --> doShift "gam"
+ ]
+-- <+> namedScratchpadManageHook myScratchPads
+
+
+------------------------------------------------------------------------
+-- Startup hook
+myStartupHook = do
+
+ setWMName "XMonad"
+
+ setDefaultCursor xC_arrow
+
+ spawnOnce "checkupdates | wc -l > /tmp/updates.tmp"
+ spawnOnce "systemctl --user restart redshift.service"
+ spawnOnce "unclutter --timeout 3 --jitter 50 -b"
+ spawnOnce "numlockx"
+ spawnOnce "$HOME/.config/xmonad/autostart/autostart.sh"
+
+------------------------------------------------------------------------
+-- Now run xmonad with all the defaults we set up.
+
+-- Run xmonad with the settings you specify. No need to modify this.
+--
+main = do
+ -- Setup xmobar as docks
+ --
+ xmproc0 <- spawnPipe "xmobar $HOME/.config/xmobar/xmobarrc0.hs"
+ xmproc1 <- spawnPipe "xmobar $HOME/.config/xmobar/xmobarrc1.hs"
+
+ -- ewmh: Add fullscreen handling support
+ xmonad $ docks . ewmh $ defaults {
+ layoutHook = avoidStruts $ layoutHook defaults
+ , logHook = dynamicLogWithPP $ filterOutWsPP ["hid"] $ xmobarPP {
+ ppOutput = \x -> hPutStrLn xmproc0 x
+
+ , ppCurrent = xmobarColor colorfg colorbg . wrap leftwp rightwp -- Visible but not current workspace
+ , ppVisible = xmobarColor colorfg colorbg -- Hidden workspace
+ , ppHidden = xmobarColor color01 colorbg -- Hidden workspaces (no windows)
+ , ppHiddenNoWindows = xmobarColor color04 colorbg -- Title of active window
+ , ppTitle = xmobarColor "" "" . shorten' "" 0 -- Separator character
+ , ppSep = " "
+ , ppLayout = myLayoutPrinter
+ -- Urgent workspace , ppUrgent = xmobarColor color17 colorbg . wrap "!" "!"
+ , ppExtras = [windowCount] -- Adding # of windows on current workspace to the bar
+ }
+
+}
+
+
+defaults = ewmh def {
+ -- simple stuff
+ terminal = myTerminal,
+ focusFollowsMouse = myFocusFollowsMouse,
+ clickJustFocuses = myClickJustFocuses,
+ borderWidth = myBorderWidth,
+ modMask = myModMask,
+ workspaces = myWorkspaces,
+ normalBorderColor = myNormalBorderColor,
+ focusedBorderColor = myFocusedBorderColor,
+
+ -- key bindings
+ keys = myKeys,
+ mouseBindings = myMouseBindings,
+
+ -- hooks, layouts
+ layoutHook = myLayout,
+ manageHook = myManageHook <+> manageSpawn,
+ startupHook = myStartupHook
+ }
+ `additionalKeysP`
+ [ ("M-<Return>", spawn myTerminal)
+ , ("M-<Backspace>", withFocused hide) -- N.B. this is an absurd thing to do
+ , ("M-0", windows $ W.greedyView $ "hid") -- N.B. this is an absurd thing to do
+ , ("M-u", incScreenWindowSpacing (2))
+ , ("M-i", incScreenWindowSpacing (-2))
+ , ("M-o", setScreenWindowSpacing (2))
+ -- Then these key bindings
+ -- cycling worspaces
+ , ("M-<R>", CWS.nextWS)
+ , ("M-<L>", CWS.prevWS)
+ , ("M-S-<R>", CWS.shiftToNext >> CWS.nextWS)
+ , ("M-S-<L>", CWS.shiftToPrev >> CWS.prevWS)
+ , ("M-m", spawn "emacs")
+ -- launch firefox
+ , ("M-b", spawn "firefox")
+ -- take screenshots
+ , ("M-s", spawn "maim ~/pictures/screenshot-$(date +%y%m%d_%H_%M_%S).png")
+ , ("M-C-s", spawn "maim -i $(xdotool getactivewindow) ~/pictures/screenshot-$(date +%y%m%d_%H_%M_%S).png")
+ , ("M-S-s", spawn "maim --select | xclip -selection clipboard -t image/png")
+ -- close focused window
+ , ("M-c", spawn "kill $(xprop | grep PID | cut -d = -f 2)")
+ , ("M-S-c", kill)
+ -- Rotate through the available layout algorithms
+ , ("M-C-1", sendMessage $ JumpToLayout "Tall")
+ , ("M-C-2", sendMessage $ JumpToLayout "Mirror Tall")
+ , ("M-C-3", sendMessage $ JumpToLayout "Spiral")
+ , ("M-C-4", sendMessage $ JumpToLayout "Full")
+ , ("M-<Tab>", sendMessage NextLayout)
+
+ , ("M-<Space>", spawn "cycleKB")
+ -- Resize viewed windows to the correct size
+ , ("M-n", refresh)
+ -- Move focus to the next window
+ , ("M-j", windows W.focusDown)
+ -- Move focus to the previous window
+ , ("M-k", windows W.focusUp)
+ -- Swap the focused window with the next window
+ , ("M-S-j", windows W.swapDown)
+ -- Swap the focused window with the previous window
+ , ("M-S-k", windows W.swapUp)
+ -- Shrink the master area
+ , ("M-h", sendMessage Shrink)
+ -- Expand the master area
+ , ("M-l", sendMessage Expand)
+ -- Push window back into tiling
+ , ("M-S-t", withFocused $ windows . W.sink)
+ -- Increment the number of windows in the master area
+ , ("M-,", sendMessage (IncMasterN 1))
+ -- Deincrement the number of windows in the master area
+ , ("M-.", sendMessage (IncMasterN (-1)))
+ -- Quit xmonad
+ , ("M-S-q", io (exitWith ExitSuccess))
+ -- Restart xmonad
+ , ("M-q", spawn "killall xmobar; xmonad --recompile && xmonad --restart")
+ , ("M-x m", spawn "kill -USR1 $(pgrep xmobar)")
+ -- open alsamixer and change volume with keyboard wheel
+ , ("<XF86AudioLowerVolume>" , spawn "pamixer -d 5")
+ , ("<XF86AudioRaiseVolume>" , spawn "pamixer -i 5")
+ , ("<XF86AudioMute>" , spawn "pamixer -t")
+ , ("<XF86MonBrightnessDown>", spawn "light -U 5")
+ , ("<XF86MonBrightnessUp>" , spawn "light -A 5")
+ , ("M-y" , spawn "arr_hjkl")
+ -- Toggle borders
+ , ("M-S-b", do
+ withFocused toggleBorder
+ refresh)
+ -- Fullscreen by toggling borders,
+ -- struts so docks can be obfuscated
+ -- (forcing it into tiling, because problems if you change layouts)
+ , ("M-S-f", do
+ sendMessage ToggleStruts
+ sendMessage ToggleGaps
+ toggleWindowSpacingEnabled
+ withFocused toggleBorder
+ refresh)
+
+ , ("M-a c" , spawn "code")
+ , ("M-a d" , spawnOn "cha" "discord")
+ , ("M-a s" , spawnOn "cha" "signal-desktop")
+ , ("M-a k" , spawn "virt-manager")
+ , ("M-a m" , spawn "mumble")
+ , ("M-a v" , spawn "virtualbox")
+ -- file managers
+ , ("M-f k", spawn ("kitty" ++ " -e ranger"))
+ , ("M-f d", spawn "dolphin")
+
+
+ -- cycle keyboards
+ -- dmenu
+ , ("M-S-<Return>", spawn "dmenu_run")
+ , ("M-p a", spawn "dmapimg")
+ , ("M-<Insert>", spawn "dmpsbm")
+ , ("M-S-<Insert>", spawn "dmpsclip")
+ , ("M-p c", spawn "dmclip")
+ , ("M-p d", spawn "dmdsktp")
+ , ("M-p f", spawn "dmfm")
+ , ("M-p g", spawn "dmpassgen")
+ , ("M-p h", spawn "dmhelp")
+ , ("M-p l", spawn "dmlang")
+ , ("M-p m", spawn "dmpass")
+ -- , ("M-p S-m", spawn "passmenu --type")
+ , ("M-p p", spawn "dmpdf")
+ , ("M-p o", spawn "dmpower")
+ , ("M-p v", spawn "dmvid")
+
+ -- Gaming
+ , ("M-g s", spawnOn "gam" "steam")
+ , ("M-g m", spawnOn "gam" "multimc -l 1.8.9")
+ ]