diff --git a/config/alacritty/alacritty.yml b/config/alacritty/alacritty.yml new file mode 100755 index 000000000..7b09af212 --- /dev/null +++ b/config/alacritty/alacritty.yml @@ -0,0 +1,872 @@ +## ____ ____ _ __ +## | _ \| _ \| |/ / +## | | | | |_) | ' / Clay Gomera (Drake) +## | |_| | _ <| . \ This is my custom alacritty config for my laptop +## |____/|_| \_\_|\_\ +## + +# Configuration for Alacritty, the GPU enhanced terminal emulator. + +# 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) + # + # Specified in number of columns/lines, not pixels. + # If both are `0`, this setting is ignored. + #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: 6 + y: 6 + + # 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, but no title bar buttons + #decorations: full + + # 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 + + # 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: 5000 + + # Number of lines the viewport will move for every line scrolled when + # scrollback is enabled (history > 0). + #multiplier: 3 + + # Scroll to the bottom when new text is written to the terminal. + #auto_scroll: false + +# Spaces per Tab (changes require restart) +# +# This setting defines the width of a tab in cells. +# +# Some applications, like Emacs, rely on knowing about the width of a tab. +# To prevent unexpected behavior in these applications, it's also required to +# change the `it` value in terminfo when altering this setting. +#tabspaces: 8 + +# Font configuration +font: + # Normal (roman) font face + normal: + # Font family + # + # Default: + # - (macOS) Menlo + # - (Linux/BSD) monospace + # - (Windows) Consolas + # family: Source Code Pro + # family: CodeNewRoman Nerd Font + # family: RobotoMono Nerd Font + # family: Hack + # family: JetBrains Mono + # family: UbuntuMono Nerd Font + # family: Monofur Nerd Font + # family: TerminessTTF Nerd Font + family: mononoki Nerd Font + + # The `style` can be specified to pick a specific face. + style: Regular + + # Bold font face + bold: + # Font family + # + # If the bold family is not specified, it will fall back to the + # value specified for the normal font. + # family: Source Code Pro + # family: CodeNewRoman Nerd Font + # family: RobotoMono Nerd Font + # family: Hack + # family: JetBrains Mono + # family: UbuntuMono Nerd Font + # family: Monofur Nerd Font + # family: TerminessTTF Nerd Font + family: mononoki Nerd Font + + # The `style` can be specified to pick a specific face. + style: Bold + + # Italic font face + italic: + # Font family + # + # If the italic family is not specified, it will fall back to the + # value specified for the normal font. + # family: Source Code Pro + # family: CodeNewRoman Nerd Font + # family: RobotoMono Nerd Font + # family: Hack + # family: JetBrains Mono + # family: UbuntuMono Nerd Font + # family: Monofuritalic Nerd Font Mono + # family: TerminessTTF Nerd Font + family: mononoki Nerd Font + + # The `style` can be specified to pick a specific face. + style: Italic + + # Bold italic font face + bold_italic: + # Font family + # + # If the bold italic family is not specified, it will fall back to the + # value specified for the normal font. + # family: Source Code Pro + # family: CodeNewRoman Nerd Font + # family: RobotoMono Nerd Font + # family: Hack + # family: JetBrains Mono + # family: UbuntuMono Nerd Font + # family: Monofuritalic Nerd Font Mono + # family: TerminessTTF Nerd Font + family: mononoki Nerd Font + + # The `style` can be specified to pick a specific face. + style: Bold Italic + + # Point size + size: 9.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: 1 + + # Glyph offset determines the locations of the glyphs within their cells with + # the default being at the bottom. Increasing `x` moves the glyph to the right, + # increasing `y` moves the glyph upwards. + #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` + # + # macOS >= 10.14.x: + # + # If the font quality on non-retina display looks bad then set + # `use_thin_strokes` to `true` and enable font smoothing by running the + # following command: + # `defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO` + # + # This is a global setting and will require a log out or restart to take + # effect. + #use_thin_strokes: true + +# If `true`, bold text is drawn using the bright color variants. +draw_bold_text_with_bright_colors: true + +####################################### +## START OF COLOR SCHEMES ## +####################################### +schemes: + ### Doom One ### + doom-one: &doom-one + primary: + background: '#282c34' + foreground: '#bbc2cf' + cursor: + text: CellBackground + cursor: '#528bff' + selection: + text: CellForeground + background: '#3e4451' + normal: + black: '#1c1f24' + red: '#ff6c6b' + green: '#98be65' + yellow: '#da8548' + blue: '#51afef' + magenta: '#c678dd' + cyan: '#5699af' + white: '#202328' + bright: + black: '#5b6268' + red: '#da8548' + green: '#4db5bd' + yellow: '#ecbe7b' + blue: '#3071db' # This is 2257a0 in Doom Emacs but I lightened it. + magenta: '#a9a1e1' + cyan: '#46d9ff' + white: '#dfdfdf' + + ### Dracula ### + dracula: &dracula + primary: + background: '#282a36' + foreground: '#f8f8f2' + cursor: + text: CellBackground + cursor: CellForeground + vi_mode_cursor: + text: CellBackground + cursor: CellForeground + search: + matches: + foreground: '#44475a' + background: '#50fa7b' + focused_match: + foreground: '#44475a' + background: '#ffb86c' + bar: + background: '#282a36' + foreground: '#f8f8f2' + line_indicator: + foreground: None + background: None + selection: + text: CellForeground + background: '#44475a' + normal: + black: '#000000' + red: '#ff5555' + green: '#50fa7b' + yellow: '#f1fa8c' + blue: '#bd93f9' + magenta: '#ff79c6' + cyan: '#8be9fd' + white: '#bfbfbf' + bright: + black: '#4d4d4d' + red: '#ff6e67' + green: '#5af78e' + yellow: '#f4f99d' + blue: '#caa9fa' + magenta: '#ff92d0' + cyan: '#9aedfe' + white: '#e6e6e6' + dim: + black: '#14151b' + red: '#ff2222' + green: '#1ef956' + yellow: '#ebf85b' + blue: '#4d5b86' + magenta: '#ff46b0' + cyan: '#59dffc' + white: '#e6e6d1' + + ### Gruvbox dark ### + gruvbox-dark: &gruvbox-dark + # Default colors + primary: + # hard contrast: background = '0x1d2021' + background: '#282828' + # soft contrast: background = '0x32302f' + foreground: '#ebdbb2' + + # Normal colors + normal: + black: '#282828' + red: '#cc241d' + green: '#98971a' + yellow: '#d79921' + blue: '#458588' + magenta: '#b16286' + cyan: '#689d6a' + white: '#a89984' + + # Bright colors + bright: + black: '#928374' + red: '#fb4934' + green: '#b8bb26' + yellow: '#fabd2f' + blue: '#83a598' + magenta: '#d3869b' + cyan: '#8ec07c' + white: '#ebdbb2' + +### Monokai ### + monokai-pro: &monokai-pro + # Default colors + primary: + background: '#2D2A2E' + foreground: '#FCFCFA' + + # Normal colors + normal: + black: '#403E41' + red: '#FF6188' + green: '#A9DC76' + yellow: '#FFD866' + blue: '#FC9867' + magenta: '#AB9DF2' + cyan: '#78DCE8' + white: '#FCFCFA' + + # Bright colors + bright: + black: '#727072' + red: '#FF6188' + green: '#A9DC76' + yellow: '#FFD866' + blue: '#FC9867' + magenta: '#AB9DF2' + cyan: '#78DCE8' + white: '#FCFCFA' + + ### Nord ### + nord: &nord + # Default colors + primary: + background: '#2E3440' + foreground: '#D8DEE9' + + # Normal colors + normal: + black: '#3B4252' + red: '#BF616A' + green: '#A3BE8C' + yellow: '#EBCB8B' + blue: '#81A1C1' + magenta: '#B48EAD' + cyan: '#88C0D0' + white: '#E5E9F0' + + # Bright colors + bright: + black: '#4C566A' + red: '#BF616A' + green: '#A3BE8C' + yellow: '#EBCB8B' + blue: '#81A1C1' + magenta: '#B48EAD' + cyan: '#8FBCBB' + white: '#ECEFF4' + + ### Oceanic Next ### + oceanic-next: &oceanic-next + # Default colors + primary: + background: '#1b2b34' + foreground: '#d8dee9' + + # Colors the cursor will use if `custom_cursor_colors` is true + cursor: + text: '#1b2b34' + cursor: '#ffffff' + + # Normal colors + normal: + black: '#343d46' + red: '#EC5f67' + green: '#99C794' + yellow: '#FAC863' + blue: '#6699cc' + magenta: '#c594c5' + cyan: '#5fb3b3' + white: '#d8dee9' + + # Bright colors + bright: + black: '#343d46' + red: '#EC5f67' + green: '#99C794' + yellow: '#FAC863' + blue: '#6699cc' + magenta: '#c594c5' + cyan: '#5fb3b3' + white: '#d8dee9' + + ### Palenight ### + palenight: &palenight + # Default colors + primary: + background: '#292d3e' + foreground: '#d0d0d0' + + # Normal colors + normal: + black: '#292d3e' + red: '#f07178' + green: '#c3e88d' + yellow: '#ffcb6b' + blue: '#82aaff' + magenta: '#c792ea' + cyan: '#89ddff' + white: '#d0d0d0' + + # Bright colors + bright: + black: '#434758' + red: '#ff8b92' + green: '#ddffa7' + yellow: '#ffe585' + blue: '#9cc4ff' + magenta: '#e1acff' + cyan: '#a3f7ff' + white: '#ffffff' + + ### Solarized Dark ### + solarized-dark: &solarized-dark + # Default colors + primary: + background: '#002b36' # base03 + foreground: '#839496' # base0 + + # Cursor colors + cursor: + text: '#002b36' # base03 + cursor: '#839496' # base0 + + # Normal colors + normal: + black: '#073642' # base02 + red: '#dc322f' # red + green: '#859900' # green + yellow: '#b58900' # yellow + blue: '#268bd2' # blue + magenta: '#d33682' # magenta + cyan: '#2aa198' # cyan + white: '#eee8d5' # base2 + + # Bright colors + bright: + black: '#002b36' # base03 + red: '#cb4b16' # orange + green: '#586e75' # base01 + yellow: '#657b83' # base00 + blue: '#839496' # base0 + magenta: '#6c71c4' # violet + cyan: '#93a1a1' # base1 + white: '#fdf6e3' # base3 + + ### Solarized Light ### + solarized-light: &solarized-light + # Default colors + primary: + background: '#fdf6e3' # base3 + foreground: '#657b83' # base00 + + # Cursor colors + cursor: + text: '#fdf6e3' # base3 + cursor: '#657b83' # base00 + + # Normal colors + normal: + black: '#073642' # base02 + red: '#dc322f' # red + green: '#859900' # green + yellow: '#b58900' # yellow + blue: '#268bd2' # blue + magenta: '#d33682' # magenta + cyan: '#2aa198' # cyan + white: '#eee8d5' # base2 + + # Bright colors + bright: + black: '#002b36' # base03 + red: '#cb4b16' # orange + green: '#586e75' # base01 + yellow: '#657b83' # base00 + blue: '#839496' # base0 + magenta: '#6c71c4' # violet + cyan: '#93a1a1' # base1 + white: '#fdf6e3' # base3 + + ### Tomorrow Night ### + tomorrow-night: &tomorrow-night + # Default colors + primary: + background: '#1d1f21' + foreground: '#c5c8c6' + + # Colors the cursor will use if `custom_cursor_colors` is true + cursor: + text: '#1d1f21' + cursor: '#ffffff' + + # Normal colors + normal: + black: '#1d1f21' + red: '#cc6666' + green: '#b5bd68' + yellow: '#e6c547' + blue: '#81a2be' + magenta: '#b294bb' + cyan: '#70c0ba' + white: '#373b41' + + # Bright colors + bright: + black: '#666666' + red: '#ff3334' + green: '#9ec400' + yellow: '#f0c674' + blue: '#81a2be' + magenta: '#b77ee0' + cyan: '#54ced6' + white: '#282a2e' + +###################################################################### +## SET THEME: Choose ONE color scheme from those in the above list. ## +## ################################################################### +# Available themes are: +# *doom-one +# *dracula +# *gruvbox-dark +# *monokai-pro +# *nord +# *oceanic-next +# *palenight +# *solarized-light +# *solarized-dark +# *tomorrow-night + +colors: *gruvbox-dark + +####################################### +## END OF COLOR SCHEMES ## +####################################### + +# Visual Bell +# +# Any time the BEL code is received, Alacritty "rings" the visual bell. Once +# rung, the terminal background will be set to white and transition back to the +# default background color. You can control the rate of this transition by +# setting the `duration` property (represented in milliseconds). You can also +# configure the transition function by setting the `animation` property. +# +# Values for `animation`: +# - Ease +# - EaseOut +# - EaseOutSine +# - EaseOutQuad +# - EaseOutCubic +# - EaseOutQuart +# - EaseOutQuint +# - EaseOutExpo +# - EaseOutCirc +# - Linear +# +# Specifying a `duration` of `0` will disable the visual bell. +#visual_bell: +# animation: EaseOutExpo +# duration: 0 +# color: '#ffffff' + +# 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. +background_opacity: 0.97 +# background_opacity: 0.70 + +#selection: + #semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" + + # When set to `true`, selected text will be copied to the primary clipboard. + #save_to_clipboard: false + +# Allow terminal applications to change Alacritty's window title. +#dynamic_title: true + +#cursor: + # Cursor style + # + # Values for `style`: + # - ▇ Block + # - _ Underline + # - | Beam + #style: Block + + # If this is `true`, the cursor will be rendered as a hollow box when the + # window is not focused. + #unfocused_hollow: true + +# 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 + +# WinPTY backend (Windows only) +# +# Alacritty defaults to using the newer ConPTY backend if it is available, +# since it resolves a lot of bugs and is quite a bit faster. If it is not +# available, the the WinPTY backend will be used instead. +# +# Setting this option to `true` makes Alacritty use the legacy WinPTY backend, +# even if the ConPTY backend is available. +#winpty_backend: false + +# Send ESC (\x1b) before characters when alt is pressed. +#alt_send_esc: true + +#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`: + # - None + # - Error + # - Warn + # - Info + # - Debug + # - Trace + #log_level: Warn + + # Print all received window events. + #print_events: false + + # Record all characters and escape sequences as test data. + #ref_test: false + +#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 + + #url: + # URL launcher + # + # This program is executed when clicking on a text which is recognized as a URL. + # The URL is always added to the command as the last parameter. + # + # When set to `None`, URL launching will be disabled completely. + # + # Default: + # - (macOS) open + # - (Linux/BSD) xdg-open + # - (Windows) explorer + #launcher: + # program: xdg-open + # args: [] + + # URL modifiers + # + # These are the modifiers that need to be held down for opening URLs when clicking + # on them. The available modifiers are documented in the key binding section. + #modifiers: None + +# Mouse bindings +# +# Mouse bindings are specified as a list of objects, much like the key +# bindings further below. +# +# Each mouse binding will specify a: +# +# - `mouse`: +# +# - Middle +# - Left +# - Right +# - Numeric identifier such as `5` +# +# - `action` (see key bindings) +# +# And optionally: +# +# - `mods` (see key bindings) +#mouse_bindings: +# - { mouse: Middle, 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 +# +# - Copy +# - Paste +# - PasteSelection +# - IncreaseFontSize +# - DecreaseFontSize +# - ResetFontSize +# - ScrollPageUp +# - ScrollPageDown +# - ScrollLineUp +# - ScrollLineDown +# - ScrollToTop +# - ScrollToBottom +# - ClearHistory +# - Hide +# - Minimize +# - Quit +# - ToggleFullscreen +# - SpawnNewInstance +# - ClearLogNotice +# - ReceiveChar +# - None +# +# (macOS only): +# - ToggleSimpleFullscreen: Enters fullscreen without occupying another space +# +# - `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 +# - Alt +# +# 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. +key_bindings: + # (Windows, Linux, and BSD only) + - { key: V, mods: Control|Shift, action: Paste } + - { key: C, mods: Control|Shift, action: Copy } + - { 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: Minus, mods: Control, action: DecreaseFontSize } + - { key: F11, mods: None, action: ToggleFullscreen } + - { key: L, mods: Control, action: ClearLogNotice } + - { key: L, mods: Control, chars: "\x0c" } + - { key: Home, mods: Shift, action: ScrollToTop, mode: ~Alt } + - { key: End, mods: Shift, action: ScrollToBottom, mode: ~Alt } diff --git a/config/awesome/awesome-wm-widgets/.luacheckrc b/config/awesome/awesome-wm-widgets/.luacheckrc new file mode 100644 index 000000000..e4f47fa64 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/.luacheckrc @@ -0,0 +1,24 @@ +self = false + +globals = { + "screen", + "mouse", + "root", + "client" +} + +read_globals = { + "awesome", + "button", + "dbus", + "drawable", + "drawin", + "key", + "keygrabber", + "mousegrabber", + "selection", + "tag", + "window", + "table.unpack", + "math.atan2", +} \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/battery-widget/README.md b/config/awesome/awesome-wm-widgets/battery-widget/README.md new file mode 100644 index 000000000..9af7a4c48 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/battery-widget/README.md @@ -0,0 +1,74 @@ +# Battery widget + +Simple and easy-to-install widget for Awesome Window Manager. + +This widget consists of: + + - an icon which shows the battery level: + ![Battery Widget](./bat-wid-1.png) + - a pop-up window, which shows up when you hover over an icon: + ![Battery Widget](./bat-wid-2.png) + Alternatively you can use a tooltip (check the code): + ![Battery Widget](./bat-wid-22.png) + - a pop-up warning message which appears on bottom right corner when battery level is less that 15% (you can get the image [here](https://vk.com/images/stickers/1933/512.png)): + ![Battery Widget](./bat-wid-3.png) + +Note that widget uses the Arc icon theme, so it should be [installed](https://github.com/horst3180/arc-icon-theme#installation) first under **/usr/share/icons/Arc/** folder. + +## Customization + +It is possible to customize widget by providing a table with all or some of the following config parameters: + +| Name | Default | Description | +|---|---|---| +| `font` | Play 8 | Fond | +| `path_to_icons` | `/usr/share/icons/Arc/status/symbolic/` | Path to the folder with icons* | +| `show_current_level`| false | Show current charge level | +| `margin_right`|0| The right margin of the widget| +| `margin_left`|0| The left margin of the widget| +| `display_notification` | `false` | Display a notification on mouseover | +| `notification_position` | `top_right` | The notification position | +| `timeout` | 10 | How often in seconds the widget refreshes | +| `warning_msg_title` | _Huston, we have a problem_ | Title of the warning popup | +| `warning_msg_text` | _Battery is dying_ | Text of the warning popup | +| `warning_msg_position` | `bottom_right` | Position of the warning popup | +| `warning_msg_icon` | ~/.config/awesome/awesome-wm-widgets/battery-widget/spaceman.jpg | Icon of the warning popup | +| `enable_battery_warning` | `true` | Display low battery warning | + +*Note: the widget expects following icons be present in the folder: + + - battery-caution-charging-symbolic.svg + - battery-empty-charging-symbolic.svg + - battery-full-charged-symbolic.svg + - battery-full-symbolic.svg + - battery-good-symbolic.svg + - battery-low-symbolic.svg + - battery-caution-symbolic.svg + - battery-empty-symbolic.svg + - battery-full-charging-symbolic.svg + - battery-good-charging-symbolic.svg + - battery-low-charging-symbolic.svg + - battery-missing-symbolic.svg + +## Installation + +This widget reads the output of acpi tool. +- install `acpi` and check the output: + +```bash +$ sudo apt-get install acpi +$ acpi +Battery 0: Discharging, 66%, 02:34:06 remaining +``` + +```lua +local battery_widget = require("awesome-wm-widgets.battery-widget.battery") + +... +s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + ... + battery_widget(), + ... +``` diff --git a/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-1.png b/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-1.png new file mode 100644 index 000000000..00e161804 Binary files /dev/null and b/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-1.png differ diff --git a/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-2.png b/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-2.png new file mode 100644 index 000000000..ae20af2d5 Binary files /dev/null and b/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-2.png differ diff --git a/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-22.png b/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-22.png new file mode 100644 index 000000000..38761f70a Binary files /dev/null and b/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-22.png differ diff --git a/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-3.png b/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-3.png new file mode 100644 index 000000000..352b49634 Binary files /dev/null and b/config/awesome/awesome-wm-widgets/battery-widget/bat-wid-3.png differ diff --git a/config/awesome/awesome-wm-widgets/battery-widget/battery.lua b/config/awesome/awesome-wm-widgets/battery-widget/battery.lua new file mode 100644 index 000000000..fc8c56f42 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/battery-widget/battery.lua @@ -0,0 +1,200 @@ +------------------------------------------------- +-- Battery Widget for Awesome Window Manager +-- Shows the battery status using the ACPI tool +-- More details could be found here: +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/battery-widget + +-- @author Pavel Makhov +-- @copyright 2017 Pavel Makhov +------------------------------------------------- + +local awful = require("awful") +local naughty = require("naughty") +local watch = require("awful.widget.watch") +local wibox = require("wibox") +local gfs = require("gears.filesystem") +local dpi = require('beautiful').xresources.apply_dpi + +-- acpi sample outputs +-- Battery 0: Discharging, 75%, 01:51:38 remaining +-- Battery 0: Charging, 53%, 00:57:43 until charged + +local HOME = os.getenv("HOME") +local WIDGET_DIR = HOME .. '/.config/awesome/awesome-wm-widgets/battery-widget' + +local battery_widget = {} +local function worker(user_args) + local args = user_args or {} + + local font = args.font or 'Play 8' + local path_to_icons = args.path_to_icons or "/usr/share/icons/Arc/status/symbolic/" + local show_current_level = args.show_current_level or false + local margin_left = args.margin_left or 0 + local margin_right = args.margin_right or 0 + + local display_notification = args.display_notification or false + local display_notification_onClick = args.display_notification_onClick or true + local position = args.notification_position or "top_right" + local timeout = args.timeout or 10 + + local warning_msg_title = args.warning_msg_title or 'Huston, we have a problem' + local warning_msg_text = args.warning_msg_text or 'Battery is dying' + local warning_msg_position = args.warning_msg_position or 'bottom_right' + local warning_msg_icon = args.warning_msg_icon or WIDGET_DIR .. '/spaceman.jpg' + local enable_battery_warning = args.enable_battery_warning + if enable_battery_warning == nil then + enable_battery_warning = true + end + + if not gfs.dir_readable(path_to_icons) then + naughty.notify{ + title = "Battery Widget", + text = "Folder with icons doesn't exist: " .. path_to_icons, + preset = naughty.config.presets.critical + } + end + + local icon_widget = wibox.widget { + { + id = "icon", + widget = wibox.widget.imagebox, + resize = false + }, + valign = 'center', + layout = wibox.container.place, + } + local level_widget = wibox.widget { + font = font, + widget = wibox.widget.textbox + } + + battery_widget = wibox.widget { + icon_widget, + level_widget, + layout = wibox.layout.fixed.horizontal, + } + -- Popup with battery info + -- One way of creating a pop-up notification - naughty.notify + local notification + local function show_battery_status(batteryType) + awful.spawn.easy_async([[bash -c 'acpi']], + function(stdout, _, _, _) + naughty.destroy(notification) + notification = naughty.notify{ + text = stdout, + title = "Battery status", + icon = path_to_icons .. batteryType .. ".svg", + icon_size = dpi(16), + position = position, + timeout = 5, hover_timeout = 0.5, + width = 200, + screen = mouse.screen + } + end + ) + end + + -- Alternative to naughty.notify - tooltip. You can compare both and choose the preferred one + --battery_popup = awful.tooltip({objects = {battery_widget}}) + + -- To use colors from beautiful theme put + -- following lines in rc.lua before require("battery"): + -- beautiful.tooltip_fg = beautiful.fg_normal + -- beautiful.tooltip_bg = beautiful.bg_normal + + local function show_battery_warning() + naughty.notify { + icon = warning_msg_icon, + icon_size = 100, + text = warning_msg_text, + title = warning_msg_title, + timeout = 25, -- show the warning for a longer time + hover_timeout = 0.5, + position = warning_msg_position, + bg = "#F06060", + fg = "#EEE9EF", + width = 300, + screen = mouse.screen + } + end + local last_battery_check = os.time() + local batteryType = "battery-good-symbolic" + + watch("acpi -i", timeout, + function(widget, stdout) + local battery_info = {} + local capacities = {} + for s in stdout:gmatch("[^\r\n]+") do + local status, charge_str, _ = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?(.*)') + if status ~= nil then + table.insert(battery_info, {status = status, charge = tonumber(charge_str)}) + else + local cap_str = string.match(s, '.+:.+last full capacity (%d+)') + table.insert(capacities, tonumber(cap_str)) + end + end + + local capacity = 0 + for _, cap in ipairs(capacities) do + capacity = capacity + cap + end + + local charge = 0 + local status + for i, batt in ipairs(battery_info) do + if capacities[i] ~= nil then + if batt.charge >= charge then + status = batt.status -- use most charged battery status + -- this is arbitrary, and maybe another metric should be used + end + + charge = charge + batt.charge * capacities[i] + end + end + charge = charge / capacity + + if show_current_level then + level_widget.text = string.format('%d%%', charge) + end + + if (charge >= 0 and charge < 15) then + batteryType = "battery-empty%s-symbolic" + if enable_battery_warning and status ~= 'Charging' and os.difftime(os.time(), last_battery_check) > 300 then + -- if 5 minutes have elapsed since the last warning + last_battery_check = os.time() + + show_battery_warning() + end + elseif (charge >= 15 and charge < 40) then batteryType = "battery-caution%s-symbolic" + elseif (charge >= 40 and charge < 60) then batteryType = "battery-low%s-symbolic" + elseif (charge >= 60 and charge < 80) then batteryType = "battery-good%s-symbolic" + elseif (charge >= 80 and charge <= 100) then batteryType = "battery-full%s-symbolic" + end + + if status == 'Charging' then + batteryType = string.format(batteryType, '-charging') + else + batteryType = string.format(batteryType, '') + end + + widget.icon:set_image(path_to_icons .. batteryType .. ".svg") + + -- Update popup text + -- battery_popup.text = string.gsub(stdout, "\n$", "") + end, + icon_widget) + + if display_notification then + battery_widget:connect_signal("mouse::enter", function() show_battery_status(batteryType) end) + battery_widget:connect_signal("mouse::leave", function() naughty.destroy(notification) end) + elseif display_notification_onClick then + battery_widget:connect_signal("button::press", function(_,_,_,button) + if (button == 3) then show_battery_status(batteryType) end + end) + battery_widget:connect_signal("mouse::leave", function() naughty.destroy(notification) end) + end + + return wibox.container.margin(battery_widget, margin_left, margin_right) +end + +return setmetatable(battery_widget, { __call = function(_, ...) return worker(...) end }) diff --git a/config/awesome/awesome-wm-widgets/battery-widget/spaceman.jpg b/config/awesome/awesome-wm-widgets/battery-widget/spaceman.jpg new file mode 100644 index 000000000..73ddaf375 Binary files /dev/null and b/config/awesome/awesome-wm-widgets/battery-widget/spaceman.jpg differ diff --git a/config/awesome/awesome-wm-widgets/brightness-widget/README.md b/config/awesome/awesome-wm-widgets/brightness-widget/README.md new file mode 100644 index 000000000..cbf5b7e15 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/brightness-widget/README.md @@ -0,0 +1,93 @@ +# Brightness widget + +This widget represents current brightness level, depending on config parameters could be an arcchart or icon with text: ![Brightness widget](./br-wid-1.png) + +## Customization + +It is possible to customize widget by providing a table with all or some of the following config parameters: + +| Name | Default | Description | +|---|---|---| +| `type`| `arc` | The widget type. Could be `arc` or `icon_and_text` | +| `program` | `light` | The program used to control the brightness, either `light`, `xbacklight`, or `brightnessctl`. | +| `step` | 5 | Step | +| `base` | 20 | Base level to set brightness to on left click. | +| `path_to_icon` | `/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg` | Path to the icon | +| `font` | `Play 9` | Font | +| `timeout` | 1 | How often in seconds the widget refreshes. Check the note below | +| `tooltip` | false | Display brightness level in a tooltip when the mouse cursor hovers the widget | + +_Note:_ If brightness is controlled only by the widget (either by a mouse, or by a shortcut, then the `timeout` could be quite big, as there is no reason to synchronize the brightness level). + +## Installation + +To choose the right `program` argument, first you need to check which of them works better for you. + + - using `xbacklight`: + + Install (on Ubuntu it's available in the apt repository) it and check if it works by running: + + ```bash + xbacklight -get + ``` + + If there is no output it means that it doesn't work, you can either try to fix it, or try to use `light`. + + - using `light` command: + + Install (on Ubuntu it's available in the apt repository) from the repo: [github.com/haikarainen/light](https://github.com/haikarainen/light) and check if it works by running + + ```bash + light -G + 49.18 + light -A 5 + ``` + If you're on Ubuntu/debian and if the brightness level doesn't change, try to do this: https://github.com/haikarainen/light/issues/113#issuecomment-632638436. + + - using `brightnessctl`: + + On Ubuntu it is available in the apt repository. Install and check the ouptut of the following command. + ```bash + brightnessctl --list + ``` + +Then clone this repo under **~/.config/awesome/**: + +```bash +git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/awesome-wm-widgets +``` + +Require widget at the beginning of **rc.lua**: + +```lua +local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness") +``` + +Add the widget to the tasklist: + +```lua +s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + ... + -- default + brightness_widget(), + -- or customized + brightness_widget{ + type = 'icon_and_text', + program = 'xbacklight', + step = 2, + } + } + ... +``` + +## Controls + +In order to change brightness by shortcuts you can add them to the `globalkeys` table in the **rc.lua**: + +```lua +awful.key({ modkey }, ";", function () brightness_widget:inc() end, {description = "increase brightness", group = "custom"}), +awful.key({ modkey, "Shift"}, ";", function () brightness_widget:dec() end, {description = "decrease brightness", group = "custom"}), +``` +On a laptop you can use `XF86MonBrightnessUp` and `XF86MonBrightnessDown` keys. diff --git a/config/awesome/awesome-wm-widgets/brightness-widget/br-wid-1.png b/config/awesome/awesome-wm-widgets/brightness-widget/br-wid-1.png new file mode 100644 index 000000000..b00b0e609 Binary files /dev/null and b/config/awesome/awesome-wm-widgets/brightness-widget/br-wid-1.png differ diff --git a/config/awesome/awesome-wm-widgets/brightness-widget/brightness.lua b/config/awesome/awesome-wm-widgets/brightness-widget/brightness.lua new file mode 100644 index 000000000..8a7c13d69 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/brightness-widget/brightness.lua @@ -0,0 +1,186 @@ +------------------------------------------------- +-- Brightness Widget for Awesome Window Manager +-- Shows the brightness level of the laptop display +-- More details could be found here: +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/brightness-widget + +-- @author Pavel Makhov +-- @copyright 2021 Pavel Makhov +------------------------------------------------- + +local awful = require("awful") +local wibox = require("wibox") +local watch = require("awful.widget.watch") +local spawn = require("awful.spawn") +local naughty = require("naughty") + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/brightness-widget/' +local get_brightness_cmd +local set_brightness_cmd +local inc_brightness_cmd +local dec_brightness_cmd + +local brightness_widget = {} + +local function show_warning(message) + naughty.notify{ + preset = naughty.config.presets.critical, + title = 'Brightness Widget', + text = message} +end + +local function worker(user_args) + + local args = user_args or {} + + local type = args.type or 'icon_and_text' -- arc or icon_and_text + local path_to_icon = args.path_to_icon or ICON_DIR .. 'brightness.svg' + local font = args.font or 'mononoki Nerd Font 9' + local timeout = args.timeout or 100 + + local program = args.program or 'light' + local step = args.step or 5 + local base = args.base or 20 + local current_level = 0 -- current brightness value + local tooltip = args.tooltip or false + if program == 'light' then + get_brightness_cmd = 'light -G' + set_brightness_cmd = 'light -S %d' -- + inc_brightness_cmd = 'light -A ' .. step + dec_brightness_cmd = 'light -U ' .. step + elseif program == 'xbacklight' then + get_brightness_cmd = 'xbacklight -get' + set_brightness_cmd = 'xbacklight -set %d' -- + inc_brightness_cmd = 'xbacklight -inc ' .. step + dec_brightness_cmd = 'xbacklight -dec ' .. step + elseif program == 'brightnessctl' then + get_brightness_cmd = 'bash -c "brightnessctl -m | cut -d, -f4 | tr -d %"' + set_brightness_cmd = 'brightnessctl set %d%%' -- + inc_brightness_cmd = 'brightnessctl set +' .. step .. '%' + dec_brightness_cmd = 'brightnessctl set ' .. step .. '-%' + else + show_warning(program .. " command is not supported by the widget") + return + end + + if type == 'icon_and_text' then + brightness_widget.widget = wibox.widget { + { + { + image = path_to_icon, + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + layout = wibox.container.place + }, + { + id = 'txt', + font = font, + widget = wibox.widget.textbox + }, + spacing = 2, + layout = wibox.layout.fixed.horizontal, + set_value = function(self, level) + self:get_children_by_id('txt')[1]:set_text(level .. '') + end + } + elseif type == 'arc' then + brightness_widget.widget = wibox.widget { + { + { + image = path_to_icon, + resize = true, + widget = wibox.widget.imagebox, + }, + valign = 'center', + layout = wibox.container.place + }, + max_value = 100, + thickness = 2, + start_angle = 4.71238898, -- 2pi*3/4 + forced_height = 18, + forced_width = 18, + paddings = 2, + widget = wibox.container.arcchart, + set_value = function(self, level) + self:set_value(level) + end + } + else + show_warning(type .. " type is not supported by the widget") + return + + end + + local update_widget = function(widget, stdout, _, _, _) + local brightness_level = tonumber(string.format("%.0f", stdout)) + current_level = brightness_level + widget:set_value(brightness_level) + end + + function brightness_widget:set(value) + current_level = value + spawn.easy_async(string.format(set_brightness_cmd, value), function() + spawn.easy_async(get_brightness_cmd, function(out) + update_widget(brightness_widget.widget, out) + end) + end) + end + local old_level = 0 + function brightness_widget:toggle() + if old_level < 0.1 then + -- avoid toggling between '0' and 'almost 0' + old_level = 1 + end + if current_level < 0.1 then + -- restore previous level + current_level = old_level + else + -- save current brightness for later + old_level = current_level + current_level = 0 + end + brightness_widget:set(current_level) + end + function brightness_widget:inc() + spawn.easy_async(inc_brightness_cmd, function() + spawn.easy_async(get_brightness_cmd, function(out) + update_widget(brightness_widget.widget, out) + end) + end) + end + function brightness_widget:dec() + spawn.easy_async(dec_brightness_cmd, function() + spawn.easy_async(get_brightness_cmd, function(out) + update_widget(brightness_widget.widget, out) + end) + end) + end + + brightness_widget.widget:buttons( + awful.util.table.join( + awful.button({}, 1, function() brightness_widget:set(base) end), + awful.button({}, 3, function() brightness_widget:toggle() end), + awful.button({}, 4, function() brightness_widget:inc() end), + awful.button({}, 5, function() brightness_widget:dec() end) + ) + ) + + watch(get_brightness_cmd, timeout, update_widget, brightness_widget.widget) + + if tooltip then + awful.tooltip { + objects = { brightness_widget.widget }, + timer_function = function() + return current_level .. " %" + end, + } + end + + return brightness_widget.widget +end + +return setmetatable(brightness_widget, { __call = function(_, ...) + return worker(...) +end }) diff --git a/config/awesome/awesome-wm-widgets/brightness-widget/brightness.svg b/config/awesome/awesome-wm-widgets/brightness-widget/brightness.svg new file mode 100644 index 000000000..d33437203 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/brightness-widget/brightness.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/README.md b/config/awesome/awesome-wm-widgets/logout-menu-widget/README.md new file mode 100644 index 000000000..d47dcb284 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/logout-menu-widget/README.md @@ -0,0 +1,45 @@ +# Logout Menu Widget + +This widget shows a menu with options to log out from the current session, lock, reboot, suspend and power off the computer, similar to [logout-popup-widget](https://github.com/streetturtle/awesome-wm-widgets/tree/master/logout-popup-widget): + +![demo](./logout-menu.gif) + +## Installation + +Clone this repo (if not cloned yet) **./.config/awesome/** + +```bash +cd ./.config/awesome/ +git clone https://github.com/streetturtle/awesome-wm-widgets +``` +Then add the widget to the wibar: + +```lua +local logout_menu_widget = require("awesome-wm-widgets.logout-menu-widget.logout-menu") + +s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + ... + -- default + logout_menu_widget(), + -- custom + logout_menu_widget{ + font = 'Play 14', + onlock = function() awful.spawn.with_shell('i3lock-fancy') end + } + ... +``` + +## Customization + +It is possible to customize the widget by providing a table with all or some of the following config parameters: + +| Name | Default | Description | +|---|---|---| +| `font` | `beautiful.font` | Font of the menu items | +| `onlogout` | `function() awesome.quit() end` | Function which is called when the logout item is clicked | +| `onlock` | `function() awful.spawn.with_shell("i3lock") end` | Function which is called when the lock item is clicked | +| `onreboot` | `function() awful.spawn.with_shell("reboot") end` | Function which is called when the reboot item is clicked | +| `onsuspend` | `function() awful.spawn.with_shell("systemctl suspend") end` | Function which is called when the suspend item is clicked | +| `onpoweroff` | `function() awful.spawn.with_shell("shutdown now") end` | Function which is called when the poweroff item is clicked | diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/lock.svg b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/lock.svg new file mode 100644 index 000000000..3cfa528a2 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/log-out.svg b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/log-out.svg new file mode 100644 index 000000000..77afebb47 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/log-out.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/moon.svg b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/moon.svg new file mode 100644 index 000000000..60e6ce8da --- /dev/null +++ b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/moon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/power.svg b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/power.svg new file mode 100644 index 000000000..68b1be8d6 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/power.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/power_w.svg b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/power_w.svg new file mode 100644 index 000000000..1f9c4e3b4 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/power_w.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/refresh-cw.svg b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/refresh-cw.svg new file mode 100644 index 000000000..39f52a559 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/logout-menu-widget/icons/refresh-cw.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/logout-menu.gif b/config/awesome/awesome-wm-widgets/logout-menu-widget/logout-menu.gif new file mode 100644 index 000000000..9f17b5133 Binary files /dev/null and b/config/awesome/awesome-wm-widgets/logout-menu-widget/logout-menu.gif differ diff --git a/config/awesome/awesome-wm-widgets/logout-menu-widget/logout-menu.lua b/config/awesome/awesome-wm-widgets/logout-menu-widget/logout-menu.lua new file mode 100644 index 000000000..1e2418753 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/logout-menu-widget/logout-menu.lua @@ -0,0 +1,136 @@ +------------------------------------------------- +-- Logout Menu Widget for Awesome Window Manager +-- More details could be found here: +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/logout-menu-widget + +-- @author Pavel Makhov +-- @copyright 2020 Pavel Makhov +------------------------------------------------- + +local awful = require("awful") +local wibox = require("wibox") +local gears = require("gears") +local beautiful = require("beautiful") + +local HOME = os.getenv('HOME') +local ICON_DIR = HOME .. '/.config/awesome/awesome-wm-widgets/logout-menu-widget/icons/' + +local logout_menu_widget = wibox.widget { + { + { + image = ICON_DIR .. 'power_w.svg', + resize = true, + widget = wibox.widget.imagebox, + }, + margins = 4, + layout = wibox.container.margin + }, + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 4) + end, + widget = wibox.container.background, +} + +local popup = awful.popup { + ontop = true, + visible = false, + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 4) + end, + border_width = 1, + border_color = beautiful.bg_focus, + maximum_width = 400, + offset = { y = 5 }, + widget = {} +} + +local function worker(user_args) + local rows = { layout = wibox.layout.fixed.vertical } + + local args = user_args or {} + + local font = args.font or beautiful.font + + local onlogout = args.onlogout or function () awesome.quit() end +-- local onlock = args.onlock or function() awful.spawn.with_shell("i3lock") end + local onreboot = args.onreboot or function() awful.spawn.with_shell("loginctl reboot") end + local onsuspend = args.onsuspend or function() awful.spawn.with_shell("loginctl suspend") end + local onpoweroff = args.onpoweroff or function() awful.spawn.with_shell("loginctl poweroff") end + + local menu_items = { + { name = 'Log out', icon_name = 'log-out.svg', command = onlogout }, +-- { name = 'Lock', icon_name = 'lock.svg', command = onlock }, + { name = 'Reboot', icon_name = 'refresh-cw.svg', command = onreboot }, + { name = 'Suspend', icon_name = 'moon.svg', command = onsuspend }, + { name = 'Power off', icon_name = 'power.svg', command = onpoweroff }, + } + + for _, item in ipairs(menu_items) do + + local row = wibox.widget { + { + { + { + image = ICON_DIR .. item.icon_name, + resize = false, + widget = wibox.widget.imagebox + }, + { + text = item.name, + font = font, + widget = wibox.widget.textbox + }, + spacing = 12, + layout = wibox.layout.fixed.horizontal + }, + margins = 8, + layout = wibox.container.margin + }, + bg = beautiful.bg_normal, + widget = wibox.container.background + } + + row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end) + row:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) end) + + local old_cursor, old_wibox + row:connect_signal("mouse::enter", function() + local wb = mouse.current_wibox + old_cursor, old_wibox = wb.cursor, wb + wb.cursor = "hand1" + end) + row:connect_signal("mouse::leave", function() + if old_wibox then + old_wibox.cursor = old_cursor + old_wibox = nil + end + end) + + row:buttons(awful.util.table.join(awful.button({}, 1, function() + popup.visible = not popup.visible + item.command() + end))) + + table.insert(rows, row) + end + popup:setup(rows) + + logout_menu_widget:buttons( + awful.util.table.join( + awful.button({}, 1, function() + if popup.visible then + popup.visible = not popup.visible + logout_menu_widget:set_bg('#00000000') + else + popup:move_next_to(mouse.current_widget_geometry) + logout_menu_widget:set_bg(beautiful.bg_focus) + end + end) + ) + ) + + return logout_menu_widget + +end + +return setmetatable(logout_menu_widget, { __call = function(_, ...) return worker(...) end }) diff --git a/config/awesome/awesome-wm-widgets/volume-widget/README.md b/config/awesome/awesome-wm-widgets/volume-widget/README.md new file mode 100644 index 000000000..4fc7f5573 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/README.md @@ -0,0 +1,119 @@ +# Volume widget + +Volume widget based on [amixer](https://linux.die.net/man/1/amixer) (is used for controlling the audio volume) and [pacmd](https://linux.die.net/man/1/pacmd) (is used for selecting a sink/source). Also, the widget provides an easy way to customize how it looks, following types are supported out-of-the-box: + +![types](screenshots/variations.png) + +From left to right: `horizontal_bar`, `vertical_bar`, `icon`, `icon_and_text`, `arc` + +A right-click on the widget opens a popup where you can choose a sink/source: +![sink-sources](screenshots/volume-sink-sources.png) + +Left click toggles mute and middle click opens a mixer ([pavucontrol](https://freedesktop.org/software/pulseaudio/pavucontrol/) by default). + +### Features + + - switch between sinks/sources by right click on the widget; + - more responsive than previous versions of volume widget, which were refreshed once a second; + - 5 predefined customizable looks; + +## Installation + +Clone the repo under **~/.config/awesome/** and add widget in **rc.lua**: + +```lua +local volume_widget = require('awesome-wm-widgets.volume-widget.volume') +... +s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + ... + -- default + volume_widget(), + -- customized + volume_widget{ + widget_type = 'arc' + }, +``` + +Note that widget uses following command the get the current volume: `amixer -D pulse sget Master`, so please make sure that it works for you, otherwise you need to set parameter `device = 'default'`. + +### Shortcuts + +To improve responsiveness of the widget when volume level is changed by a shortcut use corresponding methods of the widget: + +```lua +awful.key({ modkey }, "]", function() volume_widget:inc(5) end), +awful.key({ modkey }, "[", function() volume_widget:dec(5) end), +awful.key({ modkey }, "\\", function() volume_widget:toggle() end), +``` + +## Customization + +It is possible to customize the widget by providing a table with all or some of the following config parameters: + +### Generic parameter + +| Name | Default | Description | +|---|---|---| +| `mixer_cmd` | `pavucontrol` | command to run on middle click (e.g. a mixer program) | +| `step` | `5` | How much the volume is raised or lowered at once (in %) | +| `widget_type`| `icon_and_text`| Widget type, one of `horizontal_bar`, `vertical_bar`, `icon`, `icon_and_text`, `arc` | +| `device` | `pulse` | Select the device name to control | + +Depends on the chosen widget type add parameters from the corresponding section below: + +#### `icon` parameters + +| Name | Default | Description | +|---|---|---| +| `icon_dir`| `./icons`| Path to the folder with icons | + +_Note:_ if you are changing icons, the folder should contain following .svg images: + - audio-volume-high-symbolic + - audio-volume-medium-symbolic + - audio-volume-low-symbolic + - audio-volume-muted-symbolic + +#### `icon_and_text` parameters + +| Name | Default | Description | +|---|---|---| +| `icon_dir`| `./icons`| Path to the folder with icons | +| `font` | `beautiful.font` | Font name and size, like `Play 12` | + +#### `arc` parameters + +| Name | Default | Description | +|---|---|---| +| `thickness` | 2 | Thickness of the arc | +| `main_color` | `beautiful.fg_color` | Color of the arc | +| `bg_color` | `#ffffff11` | Color of the arc's background | +| `mute_color` | `beautiful.fg_urgent` | Color of the arc when mute | +| `size` | 18 | Size of the widget | + +#### `horizontal_bar` parameters + +| Name | Default | Description | +|---|---|---| +| `main_color` | `beautiful.fg_normal` | Color of the bar | +| `mute_color` | `beautiful.fg_urgent` | Color of the bar when mute | +| `bg_color` | `'#ffffff11'` | Color of the bar's background | +| `width` | `50` | The bar width | +| `margins` | `10` | Top and bottom margins (if your wibar is 22 px high, bar will be 2 px = 22 - 2*10) | +| `shape` | `'bar'` | [gears.shape](https://awesomewm.org/doc/api/libraries/gears.shape.html), could be `octogon`, `hexagon`, `powerline`, etc | +| `with_icon` | `true` | Show volume icon| + +_Note:_ I didn't figure out how does the `forced_height` property of progressbar widget work (maybe it doesn't work at all), thus there is a workaround with margins. + +#### `vertical_bar` parameters + +| Name | Default | Description | +|---|---|---| +| `main_color` | `beautiful.fg_normal` | Color of the bar | +| `mute_color` | `beautiful.fg_urgent` | Color of the bar when mute | +| `bg_color` | `'#ffffff11'` | Color of the bar's background | +| `width` | `10` | The bar width | +| `margins` | `20` | Top and bottom margins (if your wibar is 22 px high, bar will be 2 px = 22 - 2*10) | +| `shape` | `'bar'` | [gears.shape](https://awesomewm.org/doc/api/libraries/gears.shape.html), could be `octogon`, `hexagon`, `powerline`, etc | +| `with_icon` | `true` | Show volume icon| diff --git a/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-high-symbolic.svg b/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-high-symbolic.svg new file mode 100644 index 000000000..985c107bf --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-high-symbolic.svg @@ -0,0 +1,88 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-low-symbolic.svg b/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-low-symbolic.svg new file mode 100644 index 000000000..7eb453137 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-low-symbolic.svg @@ -0,0 +1,88 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-medium-symbolic.svg b/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-medium-symbolic.svg new file mode 100644 index 000000000..11e44fe9d --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-medium-symbolic.svg @@ -0,0 +1,88 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-muted-symbolic.svg b/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-muted-symbolic.svg new file mode 100644 index 000000000..e577d0505 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/icons/audio-volume-muted-symbolic.svg @@ -0,0 +1,88 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/config/awesome/awesome-wm-widgets/volume-widget/screenshots/variations.png b/config/awesome/awesome-wm-widgets/volume-widget/screenshots/variations.png new file mode 100644 index 000000000..21d7eadf5 Binary files /dev/null and b/config/awesome/awesome-wm-widgets/volume-widget/screenshots/variations.png differ diff --git a/config/awesome/awesome-wm-widgets/volume-widget/screenshots/volume-sink-sources.png b/config/awesome/awesome-wm-widgets/volume-widget/screenshots/volume-sink-sources.png new file mode 100644 index 000000000..7d010bcc7 Binary files /dev/null and b/config/awesome/awesome-wm-widgets/volume-widget/screenshots/volume-sink-sources.png differ diff --git a/config/awesome/awesome-wm-widgets/volume-widget/utils.lua b/config/awesome/awesome-wm-widgets/volume-widget/utils.lua new file mode 100644 index 000000000..417a666ed --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/utils.lua @@ -0,0 +1,105 @@ + + +local utils = {} + +local function split(string_to_split, separator) + if separator == nil then separator = "%s" end + local t = {} + + for str in string.gmatch(string_to_split, "([^".. separator .."]+)") do + table.insert(t, str) + end + + return t +end + +function utils.extract_sinks_and_sources(pacmd_output) + local sinks = {} + local sources = {} + local device + local properties + local ports + local in_sink = false + local in_source = false + local in_device = false + local in_properties = false + local in_ports = false + for line in pacmd_output:gmatch("[^\r\n]+") do + if string.match(line, 'source%(s%) available.') then + in_sink = false + in_source = true + end + if string.match(line, 'sink%(s%) available.') then + in_sink = true + in_source = false + end + + if string.match(line, 'index:') then + in_device = true + in_properties = false + device = { + id = line:match(': (%d+)'), + is_default = string.match(line, '*') ~= nil + } + if in_sink then + table.insert(sinks, device) + elseif in_source then + table.insert(sources, device) + end + end + + if string.match(line, '^\tproperties:') then + in_device = false + in_properties = true + properties = {} + device['properties'] = properties + end + + if string.match(line, 'ports:') then + in_device = false + in_properties = false + in_ports = true + ports = {} + device['ports'] = ports + end + + if string.match(line, 'active port:') then + in_device = false + in_properties = false + in_ports = false + device['active_port'] = line:match(': (.+)'):gsub('<',''):gsub('>','') + end + + if in_device then + local t = split(line, ': ') + local key = t[1]:gsub('\t+', ''):lower() + local value = t[2]:gsub('^<', ''):gsub('>$', '') + device[key] = value + end + + if in_properties then + local t = split(line, '=') + local key = t[1]:gsub('\t+', ''):gsub('%.', '_'):gsub('-', '_'):gsub(':', ''):gsub("%s+$", "") + local value + if t[2] == nil then + value = t[2] + else + value = t[2]:gsub('"', ''):gsub("^%s+", ""):gsub(' Analog Stereo', '') + end + properties[key] = value + end + + if in_ports then + local t = split(line, ': ') + local key = t[1] + if key ~= nil then + key = key:gsub('\t+', '') + end + ports[key] = t[2] + end + end + + return sinks, sources +end + +return utils \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/volume-widget/volume-2.svg b/config/awesome/awesome-wm-widgets/volume-widget/volume-2.svg new file mode 100644 index 000000000..10f1c67ad --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/volume-2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/volume-widget/volume.lua b/config/awesome/awesome-wm-widgets/volume-widget/volume.lua new file mode 100644 index 000000000..5c95f6657 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/volume.lua @@ -0,0 +1,228 @@ +------------------------------------------------- +-- The Ultimate Volume Widget for Awesome Window Manager +-- More details could be found here: +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/volume-widget + +-- @author Pavel Makhov +-- @copyright 2020 Pavel Makhov +------------------------------------------------- + +local awful = require("awful") +local wibox = require("wibox") +local spawn = require("awful.spawn") +local gears = require("gears") +local beautiful = require("beautiful") +local watch = require("awful.widget.watch") +local utils = require("awesome-wm-widgets.volume-widget.utils") + + +local LIST_DEVICES_CMD = [[sh -c "pacmd list-sinks; pacmd list-sources"]] +local function GET_VOLUME_CMD(device) return 'amixer -D ' .. device .. ' sget Master' end +local function INC_VOLUME_CMD(device, step) return 'amixer set Master ' .. step .. '%+' end +local function DEC_VOLUME_CMD(device, step) return 'amixer set Master ' .. step .. '%-' end +local function TOG_VOLUME_CMD(device) return 'amixer set Master toggle' end + + +local widget_types = { + icon_and_text = require("awesome-wm-widgets.volume-widget.widgets.icon-and-text-widget"), + icon = require("awesome-wm-widgets.volume-widget.widgets.icon-widget"), + arc = require("awesome-wm-widgets.volume-widget.widgets.arc-widget"), + horizontal_bar = require("awesome-wm-widgets.volume-widget.widgets.horizontal-bar-widget"), + vertical_bar = require("awesome-wm-widgets.volume-widget.widgets.vertical-bar-widget") +} +local volume = {} + +local rows = { layout = wibox.layout.fixed.vertical } + +local popup = awful.popup{ + bg = beautiful.bg_normal, + ontop = true, + visible = false, + shape = gears.shape.rounded_rect, + border_width = 1, + border_color = beautiful.bg_focus, + maximum_width = 400, + offset = { y = 5 }, + widget = {} +} + +local function build_main_line(device) + if device.active_port ~= nil and device.ports[device.active_port] ~= nil then + return device.properties.device_description .. ' · ' .. device.ports[device.active_port] + else + return device.properties.device_description + end +end + +local function build_rows(devices, on_checkbox_click, device_type) + local device_rows = { layout = wibox.layout.fixed.vertical } + for _, device in pairs(devices) do + + local checkbox = wibox.widget { + checked = device.is_default, + color = beautiful.bg_normal, + paddings = 2, + shape = gears.shape.circle, + forced_width = 20, + forced_height = 20, + check_color = beautiful.fg_urgent, + widget = wibox.widget.checkbox + } + + checkbox:connect_signal("button::press", function() + spawn.easy_async(string.format([[sh -c 'pacmd set-default-%s "%s"']], device_type, device.name), function() + on_checkbox_click() + end) + end) + + local row = wibox.widget { + { + { + { + checkbox, + valign = 'center', + layout = wibox.container.place, + }, + { + { + text = build_main_line(device), + align = 'left', + widget = wibox.widget.textbox + }, + left = 10, + layout = wibox.container.margin + }, + spacing = 8, + layout = wibox.layout.align.horizontal + }, + margins = 4, + layout = wibox.container.margin + }, + bg = beautiful.bg_normal, + widget = wibox.container.background + } + + row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end) + row:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) end) + + local old_cursor, old_wibox + row:connect_signal("mouse::enter", function() + local wb = mouse.current_wibox + old_cursor, old_wibox = wb.cursor, wb + wb.cursor = "hand1" + end) + row:connect_signal("mouse::leave", function() + if old_wibox then + old_wibox.cursor = old_cursor + old_wibox = nil + end + end) + + row:connect_signal("button::press", function() + spawn.easy_async(string.format([[sh -c 'pacmd set-default-%s "%s"']], device_type, device.name), function() + on_checkbox_click() + end) + end) + + table.insert(device_rows, row) + end + + return device_rows +end + +local function build_header_row(text) + return wibox.widget{ + { + markup = "" .. text .. "", + align = 'center', + widget = wibox.widget.textbox + }, + bg = beautiful.bg_normal, + widget = wibox.container.background + } +end + +local function rebuild_popup() + spawn.easy_async(LIST_DEVICES_CMD, function(stdout) + + local sinks, sources = utils.extract_sinks_and_sources(stdout) + + for i = 0, #rows do rows[i]=nil end + + table.insert(rows, build_header_row("SINKS")) + table.insert(rows, build_rows(sinks, function() rebuild_popup() end, "sink")) + table.insert(rows, build_header_row("SOURCES")) + table.insert(rows, build_rows(sources, function() rebuild_popup() end, "source")) + + popup:setup(rows) + end) +end + + +local function worker(user_args) + + local args = user_args or {} + + local mixer_cmd = args.mixer_cmd or 'pavucontrol' + local widget_type = args.widget_type + local refresh_rate = args.refresh_rate or 1 + local step = args.step or 5 + local device = args.device or 'pulse' + + if widget_types[widget_type] == nil then + volume.widget = widget_types['icon_and_text'].get_widget(args.icon_and_text_args) + else + volume.widget = widget_types[widget_type].get_widget(args) + end + + local function update_graphic(widget, stdout) + local mute = string.match(stdout, "%[(o%D%D?)%]") -- \[(o\D\D?)\] - [on] or [off] + if mute == 'off' then widget:mute() + elseif mute == 'on' then widget:unmute() + end + local volume_level = string.match(stdout, "(%d?%d?%d)%%") -- (\d?\d?\d)\%) + volume_level = string.format("% 3d", volume_level) + widget:set_volume_level(volume_level) + end + + function volume:inc(s) + spawn.easy_async(INC_VOLUME_CMD(device, s or step), function(stdout) update_graphic(volume.widget, stdout) end) + end + + function volume:dec(s) + spawn.easy_async(DEC_VOLUME_CMD(device, s or step), function(stdout) update_graphic(volume.widget, stdout) end) + end + + function volume:toggle() + spawn.easy_async(TOG_VOLUME_CMD(device), function(stdout) update_graphic(volume.widget, stdout) end) + end + + function volume:mixer() + if mixer_cmd then + spawn.easy_async(mixer_cmd) + end + end + + volume.widget:buttons( + awful.util.table.join( + awful.button({}, 3, function() + if popup.visible then + popup.visible = not popup.visible + else + rebuild_popup() + popup:move_next_to(mouse.current_widget_geometry) + end + end), + awful.button({}, 4, function() volume:inc() end), + awful.button({}, 5, function() volume:dec() end), + awful.button({}, 2, function() volume:mixer() end), + awful.button({}, 1, function() volume:toggle() end) + ) + ) + + watch(GET_VOLUME_CMD(device), refresh_rate, update_graphic, volume.widget) + + return volume.widget +end + +return setmetatable(volume, { __call = function(_, ...) return worker(...) end }) diff --git a/config/awesome/awesome-wm-widgets/volume-widget/widgets/arc-widget.lua b/config/awesome/awesome-wm-widgets/volume-widget/widgets/arc-widget.lua new file mode 100644 index 000000000..b512f127f --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/widgets/arc-widget.lua @@ -0,0 +1,46 @@ +local wibox = require("wibox") +local beautiful = require('beautiful') + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +local widget = {} + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local thickness = args.thickness or 2 + local main_color = args.main_color or beautiful.fg_color + local bg_color = args.bg_color or '#ffffff11' + local mute_color = args.mute_color or beautiful.fg_urgent + local size = args.size or 18 + + return wibox.widget { + { + id = "icon", + image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + resize = true, + widget = wibox.widget.imagebox, + }, + max_value = 100, + thickness = thickness, + start_angle = 4.71238898, -- 2pi*3/4 + forced_height = size, + forced_width = size, + bg = bg_color, + paddings = 2, + widget = wibox.container.arcchart, + set_volume_level = function(self, new_value) + self.value = new_value + end, + mute = function(self) + self.colors = { mute_color } + end, + unmute = function(self) + self.colors = { main_color } + end + } + +end + + +return widget \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/volume-widget/widgets/horizontal-bar-widget.lua b/config/awesome/awesome-wm-widgets/volume-widget/widgets/horizontal-bar-widget.lua new file mode 100644 index 000000000..be1f38d2e --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/widgets/horizontal-bar-widget.lua @@ -0,0 +1,58 @@ +local wibox = require("wibox") +local beautiful = require('beautiful') +local gears = require("gears") + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +local widget = {} + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local main_color = args.main_color or beautiful.fg_normal + local mute_color = args.mute_color or beautiful.fg_urgent + local bg_color = args.bg_color or '#ffffff11' + local width = args.width or 50 + local margins = args.margins or 10 + local shape = args.shape or 'bar' + local with_icon = args.with_icon == true and true or false + + local bar = wibox.widget { + { + { + id = "icon", + image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + visible = with_icon, + layout = wibox.container.place, + }, + { + id = 'bar', + max_value = 100, + forced_width = width, + color = main_color, + margins = { top = margins, bottom = margins }, + background_color = bg_color, + shape = gears.shape[shape], + widget = wibox.widget.progressbar, + }, + spacing = 4, + layout = wibox.layout.fixed.horizontal, + set_volume_level = function(self, new_value) + self:get_children_by_id('bar')[1]:set_value(tonumber(new_value)) + end, + mute = function(self) + self:get_children_by_id('bar')[1]:set_color(mute_color) + end, + unmute = function(self) + self:get_children_by_id('bar')[1]:set_color(main_color) + end + } + + return bar +end + +return widget diff --git a/config/awesome/awesome-wm-widgets/volume-widget/widgets/icon-and-text-widget.lua b/config/awesome/awesome-wm-widgets/volume-widget/widgets/icon-and-text-widget.lua new file mode 100644 index 000000000..b1a2793dd --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/widgets/icon-and-text-widget.lua @@ -0,0 +1,59 @@ +local wibox = require("wibox") +local beautiful = require('beautiful') + +local widget = {} + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local font = args.font or beautiful.font + local icon_dir = args.icon_dir or ICON_DIR + + return wibox.widget { + { + { + id = "icon", + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + layout = wibox.container.place + }, + { + id = 'txt', + font = font, + widget = wibox.widget.textbox + }, + layout = wibox.layout.fixed.horizontal, + set_volume_level = function(self, new_value) + self:get_children_by_id('txt')[1]:set_text(new_value) + local volume_icon_name + if self.is_muted then + volume_icon_name = 'audio-volume-muted-symbolic' + else + local new_value_num = tonumber(new_value) + if (new_value_num >= 0 and new_value_num < 33) then + volume_icon_name="audio-volume-low-symbolic" + elseif (new_value_num < 66) then + volume_icon_name="audio-volume-medium-symbolic" + else + volume_icon_name="audio-volume-high-symbolic" + end + end + self:get_children_by_id('icon')[1]:set_image(icon_dir .. volume_icon_name .. '.svg') + end, + mute = function(self) + self.is_muted = true + self:get_children_by_id('icon')[1]:set_image(icon_dir .. 'audio-volume-muted-symbolic.svg') + end, + unmute = function(self) + self.is_muted = false + end + } + +end + + +return widget \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/volume-widget/widgets/icon-widget.lua b/config/awesome/awesome-wm-widgets/volume-widget/widgets/icon-widget.lua new file mode 100644 index 000000000..cc39a3d3a --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/widgets/icon-widget.lua @@ -0,0 +1,46 @@ +local wibox = require("wibox") + +local widget = {} + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local icon_dir = args.icon_dir or ICON_DIR + + return wibox.widget { + { + id = "icon", + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + layout = wibox.container.place, + set_volume_level = function(self, new_value) + local volume_icon_name + if self.is_muted then + volume_icon_name = 'audio-volume-muted-symbolic' + else + local new_value_num = tonumber(new_value) + if (new_value_num >= 0 and new_value_num < 33) then + volume_icon_name="audio-volume-low-symbolic" + elseif (new_value_num < 66) then + volume_icon_name="audio-volume-medium-symbolic" + else + volume_icon_name="audio-volume-high-symbolic" + end + end + self:get_children_by_id('icon')[1]:set_image(icon_dir .. volume_icon_name .. '.svg') + end, + mute = function(self) + self.is_muted = true + self:get_children_by_id('icon')[1]:set_image(icon_dir .. 'audio-volume-muted-symbolic.svg') + end, + unmute = function(self) + self.is_muted = false + end + } +end + +return widget \ No newline at end of file diff --git a/config/awesome/awesome-wm-widgets/volume-widget/widgets/vertical-bar-widget.lua b/config/awesome/awesome-wm-widgets/volume-widget/widgets/vertical-bar-widget.lua new file mode 100644 index 000000000..6f32b50d9 --- /dev/null +++ b/config/awesome/awesome-wm-widgets/volume-widget/widgets/vertical-bar-widget.lua @@ -0,0 +1,64 @@ +local wibox = require("wibox") +local beautiful = require('beautiful') +local gears = require("gears") + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +local widget = {} + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local main_color = args.main_color or beautiful.fg_normal + local mute_color = args.mute_color or beautiful.fg_urgent + local bg_color = args.bg_color or '#ffffff11' + local width = args.width or 10 + local margins = args.height or 2 + local shape = args.shape or 'bar' + local with_icon = args.with_icon == true and true or false + + local bar = wibox.widget { + { + { + id = "icon", + image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + visible = with_icon, + layout = wibox.container.place, + }, + { + { + id = 'bar', + max_value = 100, + forced_width = width, + forced_height = 5, + margins = { top = margins, bottom = margins }, + color = main_color, + background_color = bg_color, + shape = gears.shape[shape], + widget = wibox.widget.progressbar, + }, + forced_width = width, + direction = 'east', + layout = wibox.container.rotate, + }, + spacing = 4, + layout = wibox.layout.fixed.horizontal, + set_volume_level = function(self, new_value) + self:get_children_by_id('bar')[1]:set_value(tonumber(new_value)) + end, + mute = function(self) + self:get_children_by_id('bar')[1]:set_color(mute_color) + end, + unmute = function(self) + self:get_children_by_id('bar')[1]:set_color(main_color) + end + } + + return bar +end + +return widget diff --git a/config/awesome/config.org b/config/awesome/config.org new file mode 100644 index 000000000..3cd712685 --- /dev/null +++ b/config/awesome/config.org @@ -0,0 +1,645 @@ +#+TITLE: DRK's Awesome Config +#+AUTHOR: Clay Gomera (Drake) +#+DESCRIPTION: This my full awesome config for my laptop. +#+PROPERTY: header-args :tangle rc.lua + +* TABLE OF CONTENTS :toc: +- [[#about-this-config][ABOUT THIS CONFIG]] +- [[#libraries][Libraries]] +- [[#handle-runtime-errors-after-startup][Handle runtime errors after startup]] +- [[#themes][Themes]] +- [[#layouts][Layouts]] +- [[#lain-layouts][Lain layouts]] +- [[#default-awesome-variables][Default Awesome variables]] +- [[#personal-variables][Personal Variables]] +- [[#tags][Tags]] +- [[#wibox-and-wallpaper-stuff][Wibox and wallpaper stuff]] +- [[#bindings][Bindings]] +- [[#rules][Rules]] +- [[#signals][Signals]] +- [[#mouse-client-focus][Mouse client focus]] +- [[#autorun][Autorun]] + +* ABOUT THIS CONFIG +Awesome is a highly configurable, next generation framework window manager for X. It is very fast, extensible and licensed under the GNU GPLv2 license. It is primarily targeted at power users, developers and any people dealing with every day computing tasks and who want to have fine-grained control on their graphical environment. This is the Awesome configuration of Clay Gomera (Drake) fully written in ORG mode inside EMACS. This is just a personal hobby that gives me all the freedom and posibilites to learn how to code and use text editors like Emacs. + +#+CAPTION: An example screenshot +#+NAME: screenshot +#+attr_org: :width 750 +[[./screenshot.png]] + +* Libraries +This is where you put custom libraries like lain or awesome-wm-widgets. +#+begin_src lua + -- Standard awesome library +local gears = require("gears") --Utilities such as color parsing and objects +local awful = require("awful") --Everything related to window managment +require("awful.autofocus") + -- Custom libraries +local battery_widget = require("awesome-wm-widgets.battery-widget.battery") +local volume_widget = require('awesome-wm-widgets.volume-widget.volume') +local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness") +local logout_menu_widget = require("awesome-wm-widgets.logout-menu-widget.logout-menu") + -- Widget and layout library +local wibox = require("wibox") + -- Theme handling library +local beautiful = require("beautiful") + -- Notification library +local naughty = require("naughty") +naughty.config.defaults['icon_size'] = 100 + -- Lain library +local lain = require("lain") +-- Enable hotkeys help widget for VIM and other apps +-- when client with a matching name is opened: +local hotkeys_popup = require("awful.hotkeys_popup").widget + require("awful.hotkeys_popup.keys") +local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility +#+end_src + +* Handle runtime errors after startup +This section manages all the errors and error notifications. +#+begin_src lua +if awesome.startup_errors then + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) end +do + local in_error = false + awesome.connect_signal("debug::error", function (err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) +end +local function run_once(cmd_arr) + for _, cmd in ipairs(cmd_arr) do + awful.spawn.with_shell(string.format("pgrep -u $USER -fx '%s' > /dev/null || (%s)", cmd, cmd)) + end +end +run_once({ "unclutter -root" }) -- entries must be comma-separated +#+end_src + +* Themes +Here you chose your theme, tipically you will use a lain theme like powerarrow or multicolor, my custom theme is a fork of the powerarrow_dark theme focused on the gruvbox color palette and functional integration with the awesome-wm-widgets library. To setup more themes you need to put them into the themes folder located here in the awesome .config folder, then you need to add them into that variable called "local theme = { "theme1", "theme2" }". All the themes are indentified with a number as you can see down there, so to chose a theme you need to edit the variable "local chosen_theme = themes[1,2,3,etc]" to specify the theme that you want. +#+begin_src lua +local themes = { + "gruvbox-dark" -- 1 +} +local chosen_theme = themes[1] +local theme_path = string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme) +beautiful.init(theme_path) +beautiful.init(string.format(gears.filesystem.get_configuration_dir() .. "/themes/%s/theme.lua", chosen_theme)) +#+end_src + +* Layouts +Here you can comment out the layouts that you don't want to use or put them in another order. +#+begin_src lua +awful.layout.suit.tile.left.mirror = true +awful.layout.layouts = { + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + --awful.layout.suit.fair, + --awful.layout.suit.fair.horizontal, + --awful.layout.suit.spiral, + --awful.layout.suit.spiral.dwindle, + awful.layout.suit.max, + --awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating, + --awful.layout.suit.corner.nw, + --awful.layout.suit.corner.ne, + --awful.layout.suit.corner.sw, + --awful.layout.suit.corner.se, + --lain.layout.cascade, + --lain.layout.cascade.tile, + --lain.layout.centerwork, + --lain.layout.centerwork.horizontal, + --lain.layout.termfair, + --lain.layout.termfair.center, +} +#+end_src + +* Lain layouts +These are the lain layouts, i don't know what is this yet. +#+begin_src lua +lain.layout.termfair.nmaster = 3 +lain.layout.termfair.ncol = 1 +lain.layout.termfair.center.nmaster = 3 +lain.layout.termfair.center.ncol = 1 +lain.layout.cascade.tile.offset_x = 2 +lain.layout.cascade.tile.offset_y = 32 +lain.layout.cascade.tile.extra_padding = 5 +lain.layout.cascade.tile.nmaster = 5 +lain.layout.cascade.tile.ncol = 2 +#+end_src + +* Default Awesome variables +Here are the defaults awesome variables, just the terminal. +#+begin_src lua +awful.util.terminal = terminal +#+end_src + +* Personal Variables +Here are my personal variables. +#+begin_src lua +local editor = os.getenv("EDITOR") or "/home/drk/.local/bin/./neovide" +local editorgui = "emacsclient -c -a 'emacs'" +local terminal = "alacritty" +local filemanager = "alacritty -e ./.config/vifm/scripts/vifmrun" +local filemanagergui = "pcmanfm" +local audiomixer = "alacritty -e pulsemixer" +local audiomixer2 = "alacritty -e alsamixer" +local browser = "firefox" +local browser2 = "qutebrowser" +local musicplayer = "alacritty -e musikcube" +local musicplayergui = "lollypop" +local emailclient = "thunderbird" +local element = "element-desktop" +local whatsapp = 'firefox --new-window web.whatsapp.com' +-- Key bindings variables +local modkey = "Mod4" +local altkey = "Mod1" +local modkey1 = "Control" +#+end_src + +* Tags +Here are the tagnames, you can edit them as you wish. +#+begin_src lua +awful.util.tagnames = { " CODE ", " WEB ", " MUSIC ", " CHAT ", " TERM1 ", " TERM2 ", " WORK1 ", " WORK2 ", " GAME " } +#+end_src + +* Wibox and wallpaper stuff +Just wibox and wallpaper stuff, i use nitrogen and tipically you will edit your wibox settings in the theme.lua file located in your theme's folder. So this isn't really useful to modify. +#+begin_src lua +awful.util.taglist_buttons = my_table.join( + awful.button({ }, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), + awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) +) +awful.util.tasklist_buttons = my_table.join( + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + c:emit_signal("request::activate", "tasklist", {raise = true}) + end + end), + awful.button({ }, 3, function () + local instance = nil + + return function () + if instance and instance.wibox.visible then + instance:hide() + instance = nil + else + instance = awful.menu.clients({theme = {width = 250}}) + end + end + end), + awful.button({ }, 4, function () awful.client.focus.byidx(1) end), + awful.button({ }, 5, function () awful.client.focus.byidx(-1) end) +) +screen.connect_signal("property::geometry", function(s) + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end +end) +awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end) +#+end_src + +* Bindings +This sections is all about keyboard shortcuts or being more correct "bindings". This is the most important part of this config, all the tags are app centric, this means that they are there to host a specific application or type of applications. +|-----------+---------+-----+--------------------+--------------------------------------------------------------| +| Tagnumber | Tagname | Key | Type | App | +|-----------+---------+-----+--------------------+--------------------------------------------------------------| +| 1 | CODE | F1 | Text editors | Super + F1 = Emacs / Super + Shift + F1 = spacevim | +| 2 | WEB | F2 | Web browsers | Super + F2 = firefox / Super + Shift + F2 = qutebrowser | +| 3 | MUSIC | F3 | Music players | Super + F3 = musikcube / Super + Shift + F3 = lollypop | +| 4 | CHAT | F4 | Messaging apps | Super + F4 = element / Super + Shift + F4 = whatsapp | +| 5 | TERM1 | | Terminal apps 1 | Super + Shift + f = vifm / Super + Alt + f = pcmanfm | +| 6 | TERM2 | | Terminal apps 2 | Super + Shift + m = pulsemixer / Super + Alt + m = alsamixer | +| 7 | WORK1 | | Work in progress 1 | Super + d = opens rofi to select a program | +| 8 | WORK2 | | Work in progress 2 | Super + d = opens rofi to select a program | +| 9 | GAME | F9 | Games | Super + F9 = retroarch | +|-----------+---------+-----+--------------------+--------------------------------------------------------------| + +#+begin_src lua +-- Mouse bindings +root.buttons(gears.table.join( + awful.button({ }, 4, awful.tag.viewnext), + awful.button({ }, 5, awful.tag.viewprev) +)) + +-- Awesome things +globalkeys = my_table.join( + awful.key({ modkey, }, "s", hotkeys_popup.show_help, + {description="show help", group="awesome"}), + awful.key({ modkey, "Control" }, "r", awesome.restart, + {description = "reload awesome", group = "awesome"}), + awful.key({ modkey, "Shift" }, "q", awesome.quit, + {description = "quit awesome", group = "awesome"}), + +-- Tag browsing arrow keys and escape + awful.key({ modkey, }, "Left", awful.tag.viewprev, + {description = "view previous", group = "tag"}), + awful.key({ modkey, }, "Right", awful.tag.viewnext, + {description = "view next", group = "tag"}), + awful.key({ modkey, }, "Escape", awful.tag.history.restore, + {description = "go back", group = "tag"}), + +-- Tag browsing alt + tab + awful.key({ altkey, }, "Tab", awful.tag.viewnext, + {description = "view next", group = "tag"}), + awful.key({ altkey, "Shift" }, "Tab", awful.tag.viewprev, + {description = "view previous", group = "tag"}), + +-- Copy primary to clipboard (terminals to gtk) + awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end, + {description = "copy terminal to gtk", group = "hotkeys"}), + +-- Copy clipboard to primary (gtk to terminals) + awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end, + {description = "copy gtk to terminal", group = "hotkeys"}), + +-- Client focus + awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) end, + {description = "focus next by index", group = "client"}), + awful.key({ modkey, }, "k", function () awful.client.focus.byidx(-1) end, + {description = "focus previous by index", group = "client"}), + +-- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, + {description = "swap with next client by index", group = "client"}), + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, + {description = "swap with previous client by index", group = "client"}), + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, + {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, + {description = "focus the previous screen", group = "screen"}), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto, + {description = "jump to urgent client", group = "client"}), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + {description = "go back", group = "client"}), + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, + {description = "increase master width factor", group = "layout"}), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, + {description = "decrease master width factor", group = "layout"}), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, + {description = "increase the number of master clients", group = "layout"}), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, + {description = "decrease the number of master clients", group = "layout"}), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, + {description = "increase the number of columns", group = "layout"}), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, + {description = "decrease the number of columns", group = "layout"}), + awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, + {description = "select next", group = "layout"}), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, + {description = "select previous", group = "layout"}), + +-- Rofi + awful.key({ modkey }, "d", function () awful.spawn(string.format("rofi -show drun", beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) end, + {description = "show rofi drun menu", group = "hotkeys"}), + awful.key({ modkey }, "r", function () awful.spawn(string.format("rofi -show run", beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) end, + {description = "show rofi run menu", group = "hotkeys"}), + awful.key({ modkey }, "Tab", function () awful.spawn(string.format("rofi -show window", beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) end, + {description = "show rofi window menu", group = "hotkeys"}), + awful.key({ modkey }, "w", function () awful.util.spawn("./.shell-scripts/rofi-wifi-menu.sh") end, + {description = "show rofi wifi menu", group = "hotkeys"}), + +-- Keyboard Layouts + awful.key({ modkey, "Shift" }, "e", function () awful.util.spawn("setxkbmap -layout es") end, + {description = "switch to es keyboard layout", group = "keyboard"}), + awful.key({ modkey, "Shift" }, "u", function () awful.util.spawn("setxkbmap -layout us") end, + {description = "switch to us keyboard layout", group = "keyboard"}), + +-- Apps + -- terminal + awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + {description = "open a terminal", group = "launcher"}), + -- code + awful.key({ modkey }, "F1", function () awful.spawn(editorgui) end, + {description = "launch emacs", group = "apps"}), + awful.key({ modkey, "Shift" }, "F1", function () awful.spawn(editor) end, + {description = "launch spacevim", group = "apps"}), + -- web + awful.key({ modkey }, "F2", function () awful.spawn(browser) end, + {description = "launch firefox", group = "apps"}), + awful.key({ modkey, "Shift" }, "F2", function () awful.spawn(browser2) end, + {description = "launch qutebrowser", group = "apps"}), + -- music + awful.key({ modkey }, "F3", function () awful.spawn(musicplayer) end, + {description = "launch musikcube", group = "apps"}), + awful.key({ modkey, "Shift" }, "F3", function () awful.spawn(musicplayergui) end, + {description = "launch lollypop", group = "apps"}), + -- chat + awful.key({ modkey }, "F4", function () awful.spawn(element) end, + {description = "launch element", group = "apps"}), + awful.key({ modkey, "Shift" }, "F4", function () awful.spawn(whatsapp) end, + {description = "launch whatsapp", group = "apps"}), + -- term1, term2, work1, work2 + awful.key({ modkey, "Shift" }, "f", function () awful.spawn(filemanager) end, + {description = "launch vifm", group = "apps"}), + awful.key({ modkey, altkey }, "f", function () awful.spawn(filemanagergui) end, + {description = "launch pcmanfm", group = "apps"}), + awful.key({ modkey, "Shift" }, "m", function () awful.spawn(audiomixer) end, + {description = "launch pulsemixer", group = "apps"}), + awful.key({ modkey, altkey }, "m", function () awful.spawn(audiomixer2) end, + {description = "launch alsamixer", group = "apps"}), + -- game + awful.key({ modkey }, "F9", function () awful.util.spawn("retroarch") end, + {description = "launch retroarch", group = "apps"}), + +-- Volume Control + awful.key({}, "XF86AudioRaiseVolume", function() volume_widget:inc(5) end, + {description = "increase volume", group = "volume"}), + awful.key({}, "XF86AudioLowerVolume", function() volume_widget:dec(5) end, + {description = "decrease volume", group = "volume"}), + awful.key({}, "XF86AudioMute", function() volume_widget:toggle() end, + {description = "mute volume", group = "volume"}), + +-- Screenshot + awful.key({}, "Print", function() awful.util.spawn("scrot") end, + {description = "take a complete screenshot", group = "screenshot"}), + awful.key({"Control"}, "Print", function() awful.util.spawn("scrot -s") end, + {description = "take an area screenshot", group = "screenshot"}), + +-- Brightness + awful.key({}, "XF86MonBrightnessUp", function () brightness_widget:inc(5) end, + {description = "increase brightness", group = "brightness"}), + awful.key({}, "XF86MonBrightnessDown", function () brightness_widget:dec(5) end, + {description = "decrease brightness", group = "brightness"}), + +-- Screen configuration + awful.key({ modkey }, "p", function() awful.util.spawn("arandr") end, + {description = "launch screen configuration tool", group = ("screen")}), + +-- Show/Hide Wibox + awful.key({ modkey }, "b", function () + for s in screen do + s.mywibox.visible = not s.mywibox.visible + if s.mybottomwibox then + s.mybottomwibox.visible = not s.mybottomwibox.visible + end + end + end, + {description = "toggle wibox", group = "awesome"}), + +-- On the fly useless gaps change + awful.key({ altkey, "Control" }, "j", function () lain.util.useless_gaps_resize(1) end, + {description = "increment gaps", group = "tag"}), + awful.key({ altkey, "Control" }, "l", function () lain.util.useless_gaps_resize(-1) end, + {description = "decrement gaps", group = "tag"}), + +-- Dynamic tagging + awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end, + {description = "add new tag", group = "tag"}), + awful.key({ modkey, "Control" }, "r", function () lain.util.rename_tag() end, + {description = "rename tag", group = "tag"}), + awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end, + {description = "move tag to the left", group = "tag"}), + awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end, + {description = "move tag to the right", group = "tag"}), + awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end, + {description = "delete tag", group = "tag"}), + +-- Minimize, maximize, moving clients, fullscreen, etc + awful.key({ modkey, "Control" }, "n", + function () + local c = awful.client.restore() + -- Focus restored client + if c then + client.focus = c + c:raise() + end + end, + {description = "restore minimized", group = "client"}) +) +clientkeys = gears.table.join( + awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen c:raise() end, + {description = "toggle fullscreen", group = "client"}), + awful.key({ modkey }, "q", function (c) c:kill() end, + {description = "close", group = "client"}), + awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, + {description = "toggle floating", group = "client"}), + awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, + {description = "move to master", group = "client"}), + awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, + {description = "move to screen", group = "client"}), + awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, + {description = "toggle keep on top", group = "client"}), + awful.key({ modkey, }, "n", + function (c) + c.minimized = true + end , + {description = "minimize", group = "client"}), + awful.key({ modkey, }, "m", + function (c) + c.maximized = not c.maximized + c:raise() + end , + {description = "(un)maximize", group = "client"}), + awful.key({ modkey, "Control" }, "m", + function (c) + c.maximized_vertical = not c.maximized_vertical + c:raise() + end , + {description = "(un)maximize vertically", group = "client"}), + awful.key({ modkey, "Shift" }, "m", + function (c) + c.maximized_horizontal = not c.maximized_horizontal + c:raise() + end , + {description = "(un)maximize horizontally", group = "client"}) +) + +-- Bind all key numbers to tags. +-- Be careful: we use keycodes to make it works on any keyboard layout. +-- This should map on the top row of your keyboard, usually 1 to 9. +for i = 1, 9 do + -- Hack to only show tags 1 and 9 in the shortcut window (mod+s) + local descr_view, descr_toggle, descr_move, descr_toggle_focus + if i == 1 or i == 9 then + descr_view = {description = "view tag #", group = "tag"} + descr_toggle = {description = "toggle tag #", group = "tag"} + descr_move = {description = "move focused client to tag #", group = "tag"} + descr_toggle_focus = {description = "toggle focused client on tag #", group = "tag"} + end + globalkeys = my_table.join(globalkeys, + -- View tag only. + awful.key({ modkey }, "#" .. i + 9, + function () + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end, + descr_view), + -- Toggle tag display. + awful.key({ modkey, "Control" }, "#" .. i + 9, + function () + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, + descr_toggle), + -- Move client to tag. + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function () + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + descr_move), + -- Toggle tag on focused client. + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function () + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end, + descr_toggle_focus) + ) +end + +-- Other mouse bindings +clientbuttons = gears.table.join( + awful.button({ }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + end), + awful.button({ modkey }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.resize(c) + end) +) + +-- Set keys +root.keys(globalkeys) +#+end_src + +* Rules +Here are the rules, so basically here you can specify how you want Awesomewm to manage clients. I edited this to make sure that my master client always stays in its default position, for example in the master and stack layout or "tile layout", it wont matter how much apps i open, my main client will stay there in the main position. Also you can edit this to specify wich apps needs to open always in floating mode and a bunch of other things. +#+begin_src lua +-- Rules to apply to new clients (through the "manage" signal). +awful.rules.rules = { + -- All clients will match this rule. + { rule = { }, + properties = { border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = clientkeys, + buttons = clientbuttons, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap+awful.placement.no_offscreen, + callback = awful.client.setslave + } + }, + -- Floating clients. + { rule_any = { + instance = { + "DTA", -- Firefox addon DownThemAll. + "copyq", -- Includes session name in class. + "pinentry", + }, + class = { + "Arandr", + "Blueman-manager", + "Gpick", + "Kruler", + "MessageWin", -- kalarm. + -- "Sxiv", + "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. + "Wpa_gui", + "veromix", + "xtightvncviewer"}, + -- Note that the name property shown in xprop might be set slightly after creation of the client + -- and the name shown there might not match defined rules here. + name = { + "Event Tester", -- xev. + }, + role = { + "AlarmWindow", -- Thunderbird's calendar. + "ConfigManager", -- Thunderbird's about:config. + "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. + } + }, properties = { floating = true }}, +} +#+end_src + +* Signals +These are the signals, they are related to the rules, i don't tipically edit them. +#+begin_src lua +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c) + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- if not awesome.startup then awful.client.setslave(c) end + if awesome.startup and + not c.size_hints.user_position + and not c.size_hints.program_position then + -- Prevent clients from being unreachable after screen count changes. + awful.placement.no_offscreen(c) + end +end) +#+end_src + +* Mouse client focus +These are the mouse functions to whenever you hover a window with your mouse, it automatically focuses it. +#+begin_src lua +-- Enable sloppy focus, so that focus follows mouse. +client.connect_signal("mouse::enter", function(c) + c:emit_signal("request::activate", "mouse_enter", {raise = false}) +end) +client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) +client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +#+end_src + +* Autorun +You know what is this, the things that will open with you sign in. Like setting up the wallpaper automatically, or the polkit to make sure that you will get the password prompt when a program needs it, the picom compositor and finally the emacs daemon. +#+begin_src lua +awful.util.spawn_with_shell("nitrogen --restore") +awful.util.spawn_with_shell("lxpolkit") +awful.util.spawn_with_shell("picom") +awful.util.spawn_with_shell("/usr/bin/emacs --daemon &") +#+end_src diff --git a/config/awesome/lain/helpers.lua b/config/awesome/lain/helpers.lua new file mode 100755 index 000000000..4d75f7b60 --- /dev/null +++ b/config/awesome/lain/helpers.lua @@ -0,0 +1,203 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + +--]] + +local spawn = require("awful.spawn") +local timer = require("gears.timer") +local debug = require("debug") +local io = { lines = io.lines, + open = io.open } +local pairs = pairs +local rawget = rawget +local table = { sort = table.sort } + +-- Lain helper functions for internal use +-- lain.helpers +local helpers = {} + +helpers.lain_dir = debug.getinfo(1, 'S').source:match[[^@(.*/).*$]] +helpers.icons_dir = helpers.lain_dir .. 'icons/' +helpers.scripts_dir = helpers.lain_dir .. 'scripts/' + +-- {{{ Modules loader + +function helpers.wrequire(table, key) + local module = rawget(table, key) + return module or require(table._NAME .. '.' .. key) +end + +-- }}} + +-- {{{ File operations + +-- check if the file exists and is readable +function helpers.file_exists(path) + local file = io.open(path, "rb") + if file then file:close() end + return file ~= nil +end + +-- get a table with all lines from a file +function helpers.lines_from(path) + local lines = {} + for line in io.lines(path) do + lines[#lines + 1] = line + end + return lines +end + +-- get a table with all lines from a file matching regexp +function helpers.lines_match(regexp, path) + local lines = {} + for line in io.lines(path) do + if string.match(line, regexp) then + lines[#lines + 1] = line + end + end + return lines +end + +-- get first line of a file +function helpers.first_line(path) + local file, first = io.open(path, "rb"), nil + if file then + first = file:read("*l") + file:close() + end + return first +end + +-- get first non empty line from a file +function helpers.first_nonempty_line(path) + for line in io.lines(path) do + if #line then return line end + end + return nil +end + +-- }}} + +-- {{{ Timer maker + +helpers.timer_table = {} + +function helpers.newtimer(name, timeout, fun, nostart, stoppable) + if not name or #name == 0 then return end + name = (stoppable and name) or timeout + if not helpers.timer_table[name] then + helpers.timer_table[name] = timer({ timeout = timeout }) + helpers.timer_table[name]:start() + end + helpers.timer_table[name]:connect_signal("timeout", fun) + if not nostart then + helpers.timer_table[name]:emit_signal("timeout") + end + return stoppable and helpers.timer_table[name] +end + +-- }}} + +-- {{{ Pipe operations + +-- run a command and execute a function on its output (asynchronous pipe) +-- @param cmd the input command +-- @param callback function to execute on cmd output +-- @return cmd PID +function helpers.async(cmd, callback) + return spawn.easy_async(cmd, + function (stdout, stderr, reason, exit_code) + callback(stdout, exit_code) + end) +end + +-- like above, but call spawn.easy_async with a shell +function helpers.async_with_shell(cmd, callback) + return spawn.easy_async_with_shell(cmd, + function (stdout, stderr, reason, exit_code) + callback(stdout, exit_code) + end) +end + +-- run a command and execute a function on its output line by line +function helpers.line_callback(cmd, callback) + return spawn.with_line_callback(cmd, { + stdout = function (line) + callback(line) + end, + }) +end + +-- }}} + +-- {{{ A map utility + +helpers.map_table = {} + +function helpers.set_map(element, value) + helpers.map_table[element] = value +end + +function helpers.get_map(element) + return helpers.map_table[element] +end + +-- }}} + +-- {{{ Misc + +-- check if an element exist on a table +function helpers.element_in_table(element, tbl) + for _, i in pairs(tbl) do + if i == element then + return true + end + end + return false +end + +-- iterate over table of records sorted by keys +function helpers.spairs(t) + -- collect the keys + local keys = {} + for k in pairs(t) do keys[#keys+1] = k end + + table.sort(keys) + + -- return the iterator function + local i = 0 + return function() + i = i + 1 + if keys[i] then + return keys[i], t[keys[i]] + end + end +end + +-- create the partition of singletons of a given set +-- example: the trivial partition set of {a, b, c}, is {{a}, {b}, {c}} +function helpers.trivial_partition_set(set) + local ss = {} + for _,e in pairs(set) do + ss[#ss+1] = {e} + end + return ss +end + +-- creates the powerset of a given set +function helpers.powerset(s) + if not s then return {} end + local t = {{}} + for i = 1, #s do + for j = 1, #t do + t[#t+1] = {s[i],unpack(t[j])} + end + end + return t +end + +-- }}} + +return helpers diff --git a/config/awesome/lain/icons/cal/black/1.png b/config/awesome/lain/icons/cal/black/1.png new file mode 100755 index 000000000..d2fb62efe Binary files /dev/null and b/config/awesome/lain/icons/cal/black/1.png differ diff --git a/config/awesome/lain/icons/cal/black/10.png b/config/awesome/lain/icons/cal/black/10.png new file mode 100755 index 000000000..507b0795a Binary files /dev/null and b/config/awesome/lain/icons/cal/black/10.png differ diff --git a/config/awesome/lain/icons/cal/black/11.png b/config/awesome/lain/icons/cal/black/11.png new file mode 100755 index 000000000..336141b1d Binary files /dev/null and b/config/awesome/lain/icons/cal/black/11.png differ diff --git a/config/awesome/lain/icons/cal/black/12.png b/config/awesome/lain/icons/cal/black/12.png new file mode 100755 index 000000000..c58972948 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/12.png differ diff --git a/config/awesome/lain/icons/cal/black/13.png b/config/awesome/lain/icons/cal/black/13.png new file mode 100755 index 000000000..377518bb4 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/13.png differ diff --git a/config/awesome/lain/icons/cal/black/14.png b/config/awesome/lain/icons/cal/black/14.png new file mode 100755 index 000000000..6f4a9fe89 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/14.png differ diff --git a/config/awesome/lain/icons/cal/black/15.png b/config/awesome/lain/icons/cal/black/15.png new file mode 100755 index 000000000..1a271c179 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/15.png differ diff --git a/config/awesome/lain/icons/cal/black/16.png b/config/awesome/lain/icons/cal/black/16.png new file mode 100755 index 000000000..5e65835dc Binary files /dev/null and b/config/awesome/lain/icons/cal/black/16.png differ diff --git a/config/awesome/lain/icons/cal/black/17.png b/config/awesome/lain/icons/cal/black/17.png new file mode 100755 index 000000000..f3fa0a997 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/17.png differ diff --git a/config/awesome/lain/icons/cal/black/18.png b/config/awesome/lain/icons/cal/black/18.png new file mode 100755 index 000000000..7acb37a87 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/18.png differ diff --git a/config/awesome/lain/icons/cal/black/19.png b/config/awesome/lain/icons/cal/black/19.png new file mode 100755 index 000000000..a55795731 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/19.png differ diff --git a/config/awesome/lain/icons/cal/black/2.png b/config/awesome/lain/icons/cal/black/2.png new file mode 100755 index 000000000..17b33e016 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/2.png differ diff --git a/config/awesome/lain/icons/cal/black/20.png b/config/awesome/lain/icons/cal/black/20.png new file mode 100755 index 000000000..558d11101 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/20.png differ diff --git a/config/awesome/lain/icons/cal/black/21.png b/config/awesome/lain/icons/cal/black/21.png new file mode 100755 index 000000000..0bbedc85e Binary files /dev/null and b/config/awesome/lain/icons/cal/black/21.png differ diff --git a/config/awesome/lain/icons/cal/black/22.png b/config/awesome/lain/icons/cal/black/22.png new file mode 100755 index 000000000..762d2628c Binary files /dev/null and b/config/awesome/lain/icons/cal/black/22.png differ diff --git a/config/awesome/lain/icons/cal/black/23.png b/config/awesome/lain/icons/cal/black/23.png new file mode 100755 index 000000000..a39dceef2 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/23.png differ diff --git a/config/awesome/lain/icons/cal/black/24.png b/config/awesome/lain/icons/cal/black/24.png new file mode 100755 index 000000000..c00dbca8a Binary files /dev/null and b/config/awesome/lain/icons/cal/black/24.png differ diff --git a/config/awesome/lain/icons/cal/black/25.png b/config/awesome/lain/icons/cal/black/25.png new file mode 100755 index 000000000..dc9243cf4 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/25.png differ diff --git a/config/awesome/lain/icons/cal/black/26.png b/config/awesome/lain/icons/cal/black/26.png new file mode 100755 index 000000000..50bb182a5 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/26.png differ diff --git a/config/awesome/lain/icons/cal/black/27.png b/config/awesome/lain/icons/cal/black/27.png new file mode 100755 index 000000000..0fbf9fcf4 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/27.png differ diff --git a/config/awesome/lain/icons/cal/black/28.png b/config/awesome/lain/icons/cal/black/28.png new file mode 100755 index 000000000..def6ab29f Binary files /dev/null and b/config/awesome/lain/icons/cal/black/28.png differ diff --git a/config/awesome/lain/icons/cal/black/29.png b/config/awesome/lain/icons/cal/black/29.png new file mode 100755 index 000000000..531923cb1 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/29.png differ diff --git a/config/awesome/lain/icons/cal/black/3.png b/config/awesome/lain/icons/cal/black/3.png new file mode 100755 index 000000000..98b552d39 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/3.png differ diff --git a/config/awesome/lain/icons/cal/black/30.png b/config/awesome/lain/icons/cal/black/30.png new file mode 100755 index 000000000..ca58151de Binary files /dev/null and b/config/awesome/lain/icons/cal/black/30.png differ diff --git a/config/awesome/lain/icons/cal/black/31.png b/config/awesome/lain/icons/cal/black/31.png new file mode 100755 index 000000000..6e8da212b Binary files /dev/null and b/config/awesome/lain/icons/cal/black/31.png differ diff --git a/config/awesome/lain/icons/cal/black/4.png b/config/awesome/lain/icons/cal/black/4.png new file mode 100755 index 000000000..43359797a Binary files /dev/null and b/config/awesome/lain/icons/cal/black/4.png differ diff --git a/config/awesome/lain/icons/cal/black/5.png b/config/awesome/lain/icons/cal/black/5.png new file mode 100755 index 000000000..576ec119f Binary files /dev/null and b/config/awesome/lain/icons/cal/black/5.png differ diff --git a/config/awesome/lain/icons/cal/black/6.png b/config/awesome/lain/icons/cal/black/6.png new file mode 100755 index 000000000..56fa8abea Binary files /dev/null and b/config/awesome/lain/icons/cal/black/6.png differ diff --git a/config/awesome/lain/icons/cal/black/7.png b/config/awesome/lain/icons/cal/black/7.png new file mode 100755 index 000000000..7c90b3a8b Binary files /dev/null and b/config/awesome/lain/icons/cal/black/7.png differ diff --git a/config/awesome/lain/icons/cal/black/8.png b/config/awesome/lain/icons/cal/black/8.png new file mode 100755 index 000000000..9d1f28e6f Binary files /dev/null and b/config/awesome/lain/icons/cal/black/8.png differ diff --git a/config/awesome/lain/icons/cal/black/9.png b/config/awesome/lain/icons/cal/black/9.png new file mode 100755 index 000000000..00d0933c3 Binary files /dev/null and b/config/awesome/lain/icons/cal/black/9.png differ diff --git a/config/awesome/lain/icons/cal/white/1.png b/config/awesome/lain/icons/cal/white/1.png new file mode 100755 index 000000000..a0faa20c7 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/1.png differ diff --git a/config/awesome/lain/icons/cal/white/10.png b/config/awesome/lain/icons/cal/white/10.png new file mode 100755 index 000000000..7d9343bd4 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/10.png differ diff --git a/config/awesome/lain/icons/cal/white/11.png b/config/awesome/lain/icons/cal/white/11.png new file mode 100755 index 000000000..7af5e993e Binary files /dev/null and b/config/awesome/lain/icons/cal/white/11.png differ diff --git a/config/awesome/lain/icons/cal/white/12.png b/config/awesome/lain/icons/cal/white/12.png new file mode 100755 index 000000000..b164f858f Binary files /dev/null and b/config/awesome/lain/icons/cal/white/12.png differ diff --git a/config/awesome/lain/icons/cal/white/13.png b/config/awesome/lain/icons/cal/white/13.png new file mode 100755 index 000000000..fef74f36e Binary files /dev/null and b/config/awesome/lain/icons/cal/white/13.png differ diff --git a/config/awesome/lain/icons/cal/white/14.png b/config/awesome/lain/icons/cal/white/14.png new file mode 100755 index 000000000..d747a6bd1 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/14.png differ diff --git a/config/awesome/lain/icons/cal/white/15.png b/config/awesome/lain/icons/cal/white/15.png new file mode 100755 index 000000000..64418a6f6 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/15.png differ diff --git a/config/awesome/lain/icons/cal/white/16.png b/config/awesome/lain/icons/cal/white/16.png new file mode 100755 index 000000000..8b8670043 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/16.png differ diff --git a/config/awesome/lain/icons/cal/white/17.png b/config/awesome/lain/icons/cal/white/17.png new file mode 100755 index 000000000..033b5ff1b Binary files /dev/null and b/config/awesome/lain/icons/cal/white/17.png differ diff --git a/config/awesome/lain/icons/cal/white/18.png b/config/awesome/lain/icons/cal/white/18.png new file mode 100755 index 000000000..0cf1c2430 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/18.png differ diff --git a/config/awesome/lain/icons/cal/white/19.png b/config/awesome/lain/icons/cal/white/19.png new file mode 100755 index 000000000..bfd3530c2 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/19.png differ diff --git a/config/awesome/lain/icons/cal/white/2.png b/config/awesome/lain/icons/cal/white/2.png new file mode 100755 index 000000000..e7f3fa495 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/2.png differ diff --git a/config/awesome/lain/icons/cal/white/20.png b/config/awesome/lain/icons/cal/white/20.png new file mode 100755 index 000000000..9a5a1fb3c Binary files /dev/null and b/config/awesome/lain/icons/cal/white/20.png differ diff --git a/config/awesome/lain/icons/cal/white/21.png b/config/awesome/lain/icons/cal/white/21.png new file mode 100755 index 000000000..266ab9f38 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/21.png differ diff --git a/config/awesome/lain/icons/cal/white/22.png b/config/awesome/lain/icons/cal/white/22.png new file mode 100755 index 000000000..f4862892d Binary files /dev/null and b/config/awesome/lain/icons/cal/white/22.png differ diff --git a/config/awesome/lain/icons/cal/white/23.png b/config/awesome/lain/icons/cal/white/23.png new file mode 100755 index 000000000..244dceb8a Binary files /dev/null and b/config/awesome/lain/icons/cal/white/23.png differ diff --git a/config/awesome/lain/icons/cal/white/24.png b/config/awesome/lain/icons/cal/white/24.png new file mode 100755 index 000000000..0ce1c7553 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/24.png differ diff --git a/config/awesome/lain/icons/cal/white/25.png b/config/awesome/lain/icons/cal/white/25.png new file mode 100755 index 000000000..48d279c4a Binary files /dev/null and b/config/awesome/lain/icons/cal/white/25.png differ diff --git a/config/awesome/lain/icons/cal/white/26.png b/config/awesome/lain/icons/cal/white/26.png new file mode 100755 index 000000000..7535855da Binary files /dev/null and b/config/awesome/lain/icons/cal/white/26.png differ diff --git a/config/awesome/lain/icons/cal/white/27.png b/config/awesome/lain/icons/cal/white/27.png new file mode 100755 index 000000000..2aa907428 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/27.png differ diff --git a/config/awesome/lain/icons/cal/white/28.png b/config/awesome/lain/icons/cal/white/28.png new file mode 100755 index 000000000..020197690 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/28.png differ diff --git a/config/awesome/lain/icons/cal/white/29.png b/config/awesome/lain/icons/cal/white/29.png new file mode 100755 index 000000000..9305b9bd0 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/29.png differ diff --git a/config/awesome/lain/icons/cal/white/3.png b/config/awesome/lain/icons/cal/white/3.png new file mode 100755 index 000000000..f1eb5de62 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/3.png differ diff --git a/config/awesome/lain/icons/cal/white/30.png b/config/awesome/lain/icons/cal/white/30.png new file mode 100755 index 000000000..1ba61aacf Binary files /dev/null and b/config/awesome/lain/icons/cal/white/30.png differ diff --git a/config/awesome/lain/icons/cal/white/31.png b/config/awesome/lain/icons/cal/white/31.png new file mode 100755 index 000000000..e9a873bc2 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/31.png differ diff --git a/config/awesome/lain/icons/cal/white/4.png b/config/awesome/lain/icons/cal/white/4.png new file mode 100755 index 000000000..ee1ed6a88 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/4.png differ diff --git a/config/awesome/lain/icons/cal/white/5.png b/config/awesome/lain/icons/cal/white/5.png new file mode 100755 index 000000000..466aa7122 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/5.png differ diff --git a/config/awesome/lain/icons/cal/white/6.png b/config/awesome/lain/icons/cal/white/6.png new file mode 100755 index 000000000..0a7bf4d70 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/6.png differ diff --git a/config/awesome/lain/icons/cal/white/7.png b/config/awesome/lain/icons/cal/white/7.png new file mode 100755 index 000000000..e97195177 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/7.png differ diff --git a/config/awesome/lain/icons/cal/white/8.png b/config/awesome/lain/icons/cal/white/8.png new file mode 100755 index 000000000..cb03d0b40 Binary files /dev/null and b/config/awesome/lain/icons/cal/white/8.png differ diff --git a/config/awesome/lain/icons/cal/white/9.png b/config/awesome/lain/icons/cal/white/9.png new file mode 100755 index 000000000..fca554a5b Binary files /dev/null and b/config/awesome/lain/icons/cal/white/9.png differ diff --git a/config/awesome/lain/icons/layout/default/cascade.png b/config/awesome/lain/icons/layout/default/cascade.png new file mode 100755 index 000000000..292a057f0 Binary files /dev/null and b/config/awesome/lain/icons/layout/default/cascade.png differ diff --git a/config/awesome/lain/icons/layout/default/cascadetile.png b/config/awesome/lain/icons/layout/default/cascadetile.png new file mode 100755 index 000000000..ba30f43e0 Binary files /dev/null and b/config/awesome/lain/icons/layout/default/cascadetile.png differ diff --git a/config/awesome/lain/icons/layout/default/cascadetilew.png b/config/awesome/lain/icons/layout/default/cascadetilew.png new file mode 100755 index 000000000..d15eb70be Binary files /dev/null and b/config/awesome/lain/icons/layout/default/cascadetilew.png differ diff --git a/config/awesome/lain/icons/layout/default/cascadew.png b/config/awesome/lain/icons/layout/default/cascadew.png new file mode 100755 index 000000000..da64bd6ce Binary files /dev/null and b/config/awesome/lain/icons/layout/default/cascadew.png differ diff --git a/config/awesome/lain/icons/layout/default/centerfair.png b/config/awesome/lain/icons/layout/default/centerfair.png new file mode 100755 index 000000000..188c24348 Binary files /dev/null and b/config/awesome/lain/icons/layout/default/centerfair.png differ diff --git a/config/awesome/lain/icons/layout/default/centerfairw.png b/config/awesome/lain/icons/layout/default/centerfairw.png new file mode 100755 index 000000000..ed4bcf5cd Binary files /dev/null and b/config/awesome/lain/icons/layout/default/centerfairw.png differ diff --git a/config/awesome/lain/icons/layout/default/centerwork.png b/config/awesome/lain/icons/layout/default/centerwork.png new file mode 100755 index 000000000..51e06bc7e Binary files /dev/null and b/config/awesome/lain/icons/layout/default/centerwork.png differ diff --git a/config/awesome/lain/icons/layout/default/centerworkh.png b/config/awesome/lain/icons/layout/default/centerworkh.png new file mode 100755 index 000000000..c59092f01 Binary files /dev/null and b/config/awesome/lain/icons/layout/default/centerworkh.png differ diff --git a/config/awesome/lain/icons/layout/default/centerworkhw.png b/config/awesome/lain/icons/layout/default/centerworkhw.png new file mode 100755 index 000000000..7820f8cb4 Binary files /dev/null and b/config/awesome/lain/icons/layout/default/centerworkhw.png differ diff --git a/config/awesome/lain/icons/layout/default/centerworkw.png b/config/awesome/lain/icons/layout/default/centerworkw.png new file mode 100755 index 000000000..85e699646 Binary files /dev/null and b/config/awesome/lain/icons/layout/default/centerworkw.png differ diff --git a/config/awesome/lain/icons/layout/default/termfair.png b/config/awesome/lain/icons/layout/default/termfair.png new file mode 100755 index 000000000..06226c168 Binary files /dev/null and b/config/awesome/lain/icons/layout/default/termfair.png differ diff --git a/config/awesome/lain/icons/layout/default/termfairw.png b/config/awesome/lain/icons/layout/default/termfairw.png new file mode 100755 index 000000000..0a8b57631 Binary files /dev/null and b/config/awesome/lain/icons/layout/default/termfairw.png differ diff --git a/config/awesome/lain/icons/layout/zenburn/cascade.png b/config/awesome/lain/icons/layout/zenburn/cascade.png new file mode 100755 index 000000000..fbe4fac50 Binary files /dev/null and b/config/awesome/lain/icons/layout/zenburn/cascade.png differ diff --git a/config/awesome/lain/icons/layout/zenburn/cascadetile.png b/config/awesome/lain/icons/layout/zenburn/cascadetile.png new file mode 100755 index 000000000..2e03a8072 Binary files /dev/null and b/config/awesome/lain/icons/layout/zenburn/cascadetile.png differ diff --git a/config/awesome/lain/icons/layout/zenburn/centerfair.png b/config/awesome/lain/icons/layout/zenburn/centerfair.png new file mode 100755 index 000000000..75dc993be Binary files /dev/null and b/config/awesome/lain/icons/layout/zenburn/centerfair.png differ diff --git a/config/awesome/lain/icons/layout/zenburn/centerwork.png b/config/awesome/lain/icons/layout/zenburn/centerwork.png new file mode 100755 index 000000000..af7a863d1 Binary files /dev/null and b/config/awesome/lain/icons/layout/zenburn/centerwork.png differ diff --git a/config/awesome/lain/icons/layout/zenburn/centerworkh.png b/config/awesome/lain/icons/layout/zenburn/centerworkh.png new file mode 100755 index 000000000..88019b309 Binary files /dev/null and b/config/awesome/lain/icons/layout/zenburn/centerworkh.png differ diff --git a/config/awesome/lain/icons/layout/zenburn/termfair.png b/config/awesome/lain/icons/layout/zenburn/termfair.png new file mode 100755 index 000000000..f7640b555 Binary files /dev/null and b/config/awesome/lain/icons/layout/zenburn/termfair.png differ diff --git a/config/awesome/lain/icons/mail.png b/config/awesome/lain/icons/mail.png new file mode 100755 index 000000000..9c0c7a390 Binary files /dev/null and b/config/awesome/lain/icons/mail.png differ diff --git a/config/awesome/lain/icons/no_net.png b/config/awesome/lain/icons/no_net.png new file mode 100755 index 000000000..3613372f8 Binary files /dev/null and b/config/awesome/lain/icons/no_net.png differ diff --git a/config/awesome/lain/icons/openweathermap/01d.png b/config/awesome/lain/icons/openweathermap/01d.png new file mode 100755 index 000000000..569965e62 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/01d.png differ diff --git a/config/awesome/lain/icons/openweathermap/01n.png b/config/awesome/lain/icons/openweathermap/01n.png new file mode 100755 index 000000000..ce5b13546 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/01n.png differ diff --git a/config/awesome/lain/icons/openweathermap/02d.png b/config/awesome/lain/icons/openweathermap/02d.png new file mode 100755 index 000000000..2ba979984 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/02d.png differ diff --git a/config/awesome/lain/icons/openweathermap/02n.png b/config/awesome/lain/icons/openweathermap/02n.png new file mode 100755 index 000000000..12e4283df Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/02n.png differ diff --git a/config/awesome/lain/icons/openweathermap/03d.png b/config/awesome/lain/icons/openweathermap/03d.png new file mode 100755 index 000000000..1cf0e9d2c Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/03d.png differ diff --git a/config/awesome/lain/icons/openweathermap/03n.png b/config/awesome/lain/icons/openweathermap/03n.png new file mode 100755 index 000000000..89a42b8b9 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/03n.png differ diff --git a/config/awesome/lain/icons/openweathermap/04d.png b/config/awesome/lain/icons/openweathermap/04d.png new file mode 100755 index 000000000..e7fb67ff6 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/04d.png differ diff --git a/config/awesome/lain/icons/openweathermap/04n.png b/config/awesome/lain/icons/openweathermap/04n.png new file mode 120000 index 000000000..b9a83df00 --- /dev/null +++ b/config/awesome/lain/icons/openweathermap/04n.png @@ -0,0 +1 @@ +04d.png \ No newline at end of file diff --git a/config/awesome/lain/icons/openweathermap/09d.png b/config/awesome/lain/icons/openweathermap/09d.png new file mode 100755 index 000000000..cfa066a27 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/09d.png differ diff --git a/config/awesome/lain/icons/openweathermap/09n.png b/config/awesome/lain/icons/openweathermap/09n.png new file mode 120000 index 000000000..cca1f5de2 --- /dev/null +++ b/config/awesome/lain/icons/openweathermap/09n.png @@ -0,0 +1 @@ +09d.png \ No newline at end of file diff --git a/config/awesome/lain/icons/openweathermap/10d.png b/config/awesome/lain/icons/openweathermap/10d.png new file mode 100755 index 000000000..712d0c88d Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/10d.png differ diff --git a/config/awesome/lain/icons/openweathermap/10n.png b/config/awesome/lain/icons/openweathermap/10n.png new file mode 120000 index 000000000..6e012271d --- /dev/null +++ b/config/awesome/lain/icons/openweathermap/10n.png @@ -0,0 +1 @@ +10d.png \ No newline at end of file diff --git a/config/awesome/lain/icons/openweathermap/11d.png b/config/awesome/lain/icons/openweathermap/11d.png new file mode 100755 index 000000000..3b62f7c77 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/11d.png differ diff --git a/config/awesome/lain/icons/openweathermap/11n.png b/config/awesome/lain/icons/openweathermap/11n.png new file mode 120000 index 000000000..b227917d7 --- /dev/null +++ b/config/awesome/lain/icons/openweathermap/11n.png @@ -0,0 +1 @@ +11d.png \ No newline at end of file diff --git a/config/awesome/lain/icons/openweathermap/13d.png b/config/awesome/lain/icons/openweathermap/13d.png new file mode 100755 index 000000000..e265b012c Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/13d.png differ diff --git a/config/awesome/lain/icons/openweathermap/13n.png b/config/awesome/lain/icons/openweathermap/13n.png new file mode 120000 index 000000000..94e5a5257 --- /dev/null +++ b/config/awesome/lain/icons/openweathermap/13n.png @@ -0,0 +1 @@ +13d.png \ No newline at end of file diff --git a/config/awesome/lain/icons/openweathermap/50d.png b/config/awesome/lain/icons/openweathermap/50d.png new file mode 100755 index 000000000..905ace335 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/50d.png differ diff --git a/config/awesome/lain/icons/openweathermap/50n.png b/config/awesome/lain/icons/openweathermap/50n.png new file mode 120000 index 000000000..e3ba96129 --- /dev/null +++ b/config/awesome/lain/icons/openweathermap/50n.png @@ -0,0 +1 @@ +50d.png \ No newline at end of file diff --git a/config/awesome/lain/icons/openweathermap/README.md b/config/awesome/lain/icons/openweathermap/README.md new file mode 100755 index 000000000..f908fbd90 --- /dev/null +++ b/config/awesome/lain/icons/openweathermap/README.md @@ -0,0 +1,3 @@ +[Plain Weather Icons](http://merlinthered.deviantart.com/art/plain-weather-icons-157162192), created by [MerlinTheRed](http://merlinthered.deviantart.com/). + + diff --git a/config/awesome/lain/icons/openweathermap/na.png b/config/awesome/lain/icons/openweathermap/na.png new file mode 100755 index 000000000..1cc513211 Binary files /dev/null and b/config/awesome/lain/icons/openweathermap/na.png differ diff --git a/config/awesome/lain/icons/taskwarrior.png b/config/awesome/lain/icons/taskwarrior.png new file mode 100755 index 000000000..c64fe8623 Binary files /dev/null and b/config/awesome/lain/icons/taskwarrior.png differ diff --git a/config/awesome/lain/init.lua b/config/awesome/lain/init.lua new file mode 100755 index 000000000..b59d5dd93 --- /dev/null +++ b/config/awesome/lain/init.lua @@ -0,0 +1,15 @@ +--[[ + + Lain + Layouts, widgets and utilities for Awesome WM + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + +--]] + +return { + layout = require("lain.layout"), + util = require("lain.util"), + widget = require("lain.widget") +} diff --git a/config/awesome/lain/lain-scm-1.rockspec b/config/awesome/lain/lain-scm-1.rockspec new file mode 100755 index 000000000..fb1eaaf12 --- /dev/null +++ b/config/awesome/lain/lain-scm-1.rockspec @@ -0,0 +1,27 @@ +package = "lain" +version = "scm-1" +source = { + url = "https://github.com/lcpz/lain", + tag = "scm-1`" +} +description = { + summary = "Layout, widgets and utilities for Awesome WM", + detailed = [[ + Successor of awesome-vain, this module provides alternative layouts, asynchronous widgets and utility functions for Awesome WM. + + Dependencies: curl (for IMAP, MPD and weather widgets); Glib >= 2.54 (for filesystems widget). + ]], + homepage = "https://github.com/lcpz/lain", + license = "GPL-2.0" +} +dependencies = { + "lua >= 5.1", + "awesome >= 4.0", + "Glib >= 2.54", + "curl" +} +supported_platforms = { "linux" } +build = { + type = "builtin", + modules = { lain = "init.lua" } +} diff --git a/config/awesome/lain/layout/cascade.lua b/config/awesome/lain/layout/cascade.lua new file mode 100755 index 000000000..cbc3877b0 --- /dev/null +++ b/config/awesome/lain/layout/cascade.lua @@ -0,0 +1,172 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2014, projektile + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local floor = math.floor +local screen = screen + +local cascade = { + name = "cascade", + nmaster = 0, + offset_x = 32, + offset_y = 8, + tile = { + name = "cascadetile", + nmaster = 0, + ncol = 0, + mwfact = 0, + offset_x = 5, + offset_y = 32, + extra_padding = 0 + } +} + +local function do_cascade(p, tiling) + local t = p.tag or screen[p.screen].selected_tag + local wa = p.workarea + local cls = p.clients + + if #cls == 0 then return end + + if not tiling then + -- Cascade windows. + + local num_c + if cascade.nmaster > 0 then + num_c = cascade.nmaster + else + num_c = t.master_count + end + + -- Opening a new window will usually force all existing windows to + -- get resized. This wastes a lot of CPU time. So let's set a lower + -- bound to "how_many": This wastes a little screen space but you'll + -- get a much better user experience. + local how_many = (#cls >= num_c and #cls) or num_c + + local current_offset_x = cascade.offset_x * (how_many - 1) + local current_offset_y = cascade.offset_y * (how_many - 1) + + -- Iterate. + for i = 1,#cls,1 do + local c = cls[i] + local g = {} + + g.x = wa.x + (how_many - i) * cascade.offset_x + g.y = wa.y + (i - 1) * cascade.offset_y + g.width = wa.width - current_offset_x + g.height = wa.height - current_offset_y + + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end + + p.geometries[c] = g + end + else + -- Layout with one fixed column meant for a master window. Its + -- width is calculated according to mwfact. Other clients are + -- cascaded or "tabbed" in a slave column on the right. + + -- (1) (2) (3) (4) + -- +----------+---+ +----------+---+ +----------+---+ +----------+---+ + -- | | | | | 3 | | | 4 | | +---+| + -- | | | -> | | | -> | +---++ -> | +---+|+ + -- | 1 | 2 | | 1 +---++ | 1 | 3 || | 1 +---+|+| + -- | | | | | 2 || | +---++| | +---+|+ | + -- | | | | | || | | 2 | | | | 2 |+ | + -- +----------+---+ +---------+---++ +--------+---+-+ +------+---+---+ + + local mwfact + if cascade.tile.mwfact > 0 then + mwfact = cascade.tile.mwfact + else + mwfact = t.master_width_factor + end + + -- Make slave windows overlap main window? Do this if ncol is 1. + local overlap_main + if cascade.tile.ncol > 0 then + overlap_main = cascade.tile.ncol + else + overlap_main = t.column_count + end + + -- Minimum space for slave windows? See cascade.tile.lua. + local num_c + if cascade.tile.nmaster > 0 then + num_c = cascade.tile.nmaster + else + num_c = t.master_count + end + + local how_many = (#cls - 1 >= num_c and (#cls - 1)) or num_c + + local current_offset_x = cascade.tile.offset_x * (how_many - 1) + local current_offset_y = cascade.tile.offset_y * (how_many - 1) + + if #cls <= 0 then return end + + -- Main column, fixed width and height. + local c = cls[1] + local g = {} + -- Rounding is necessary to prevent the rendered size of slavewid + -- from being 1 pixel off when the result is not an integer. + local mainwid = floor(wa.width * mwfact) + local slavewid = wa.width - mainwid + + if overlap_main == 1 then + g.width = wa.width + + -- The size of the main window may be reduced a little bit. + -- This allows you to see if there are any windows below the + -- main window. + -- This only makes sense, though, if the main window is + -- overlapping everything else. + g.width = g.width - cascade.tile.extra_padding + else + g.width = mainwid + end + + g.height = wa.height + g.x = wa.x + g.y = wa.y + + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end + + p.geometries[c] = g + + -- Remaining clients stacked in slave column, new ones on top. + if #cls <= 1 then return end + for i = 2,#cls do + c = cls[i] + g = {} + + g.width = slavewid - current_offset_x + g.height = wa.height - current_offset_y + + g.x = wa.x + mainwid + (how_many - (i - 1)) * cascade.tile.offset_x + g.y = wa.y + (i - 2) * cascade.tile.offset_y + + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end + + p.geometries[c] = g + end + end +end + +function cascade.tile.arrange(p) + return do_cascade(p, true) +end + +function cascade.arrange(p) + return do_cascade(p, false) +end + +return cascade diff --git a/config/awesome/lain/layout/centerwork.lua b/config/awesome/lain/layout/centerwork.lua new file mode 100755 index 000000000..2b38a69f0 --- /dev/null +++ b/config/awesome/lain/layout/centerwork.lua @@ -0,0 +1,194 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2018, Eugene Pakhomov + * (c) 2016, Henrik Antonsson + * (c) 2015, Joerg Jaspert + * (c) 2014, projektile + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local floor, max, mouse, mousegrabber, screen = math.floor, math.max, mouse, mousegrabber, screen + +local centerwork = { + name = "centerwork", + horizontal = { name = "centerworkh" } +} + +local function arrange(p, layout) + local t = p.tag or screen[p.screen].selected_tag + local wa = p.workarea + local cls = p.clients + + if #cls == 0 then return end + + local c, g = cls[1], {} + + -- Main column, fixed width and height + local mwfact = t.master_width_factor + local mainhei = floor(wa.height * mwfact) + local mainwid = floor(wa.width * mwfact) + local slavewid = wa.width - mainwid + local slaveLwid = floor(slavewid / 2) + local slaveRwid = slavewid - slaveLwid + local slavehei = wa.height - mainhei + local slaveThei = floor(slavehei / 2) + local slaveBhei = slavehei - slaveThei + local nbrFirstSlaves = floor(#cls / 2) + local nbrSecondSlaves = floor((#cls - 1) / 2) + + local slaveFirstDim, slaveSecondDim = 0, 0 + + if layout.name == "centerwork" then -- vertical + if nbrFirstSlaves > 0 then slaveFirstDim = floor(wa.height / nbrFirstSlaves) end + if nbrSecondSlaves > 0 then slaveSecondDim = floor(wa.height / nbrSecondSlaves) end + + g.height = wa.height + g.width = mainwid + + g.x = wa.x + slaveLwid + g.y = wa.y + else -- horizontal + if nbrFirstSlaves > 0 then slaveFirstDim = floor(wa.width / nbrFirstSlaves) end + if nbrSecondSlaves > 0 then slaveSecondDim = floor(wa.width / nbrSecondSlaves) end + + g.height = mainhei + g.width = wa.width + + g.x = wa.x + g.y = wa.y + slaveThei + end + + g.width = max(g.width, 1) + g.height = max(g.height, 1) + + p.geometries[c] = g + + -- Auxiliary clients + if #cls <= 1 then return end + for i = 2, #cls do + local c, g = cls[i], {} + local idxChecker, dimToAssign + + local rowIndex = floor(i/2) + + if layout.name == "centerwork" then + if i % 2 == 0 then -- left slave + g.x = wa.x + g.y = wa.y + (rowIndex - 1) * slaveFirstDim + g.width = slaveLwid + + idxChecker, dimToAssign = nbrFirstSlaves, slaveFirstDim + else -- right slave + g.x = wa.x + slaveLwid + mainwid + g.y = wa.y + (rowIndex - 1) * slaveSecondDim + g.width = slaveRwid + + idxChecker, dimToAssign = nbrSecondSlaves, slaveSecondDim + end + + -- if last slave in row, use remaining space for it + if rowIndex == idxChecker then + g.height = wa.y + wa.height - g.y + else + g.height = dimToAssign + end + else + if i % 2 == 0 then -- top slave + g.x = wa.x + (rowIndex - 1) * slaveFirstDim + g.y = wa.y + g.height = slaveThei + + idxChecker, dimToAssign = nbrFirstSlaves, slaveFirstDim + else -- bottom slave + g.x = wa.x + (rowIndex - 1) * slaveSecondDim + g.y = wa.y + slaveThei + mainhei + g.height = slaveBhei + + idxChecker, dimToAssign = nbrSecondSlaves, slaveSecondDim + end + + -- if last slave in row, use remaining space for it + if rowIndex == idxChecker then + g.width = wa.x + wa.width - g.x + else + g.width = dimToAssign + end + end + + g.width = max(g.width, 1) + g.height = max(g.height, 1) + + p.geometries[c] = g + end +end + +local function mouse_resize_handler(c, corner, x, y, orientation) + local wa = c.screen.workarea + local mwfact = c.screen.selected_tag.master_width_factor + local g = c:geometry() + local offset = 0 + local cursor = "cross" + + local corner_coords + + if orientation == 'vertical' then + if g.height + 15 >= wa.height then + offset = g.height * .5 + cursor = "sb_h_double_arrow" + elseif not (g.y + g.height + 15 > wa.y + wa.height) then + offset = g.height + end + corner_coords = { x = wa.x + wa.width * (1 - mwfact) / 2, y = g.y + offset } + else + if g.width + 15 >= wa.width then + offset = g.width * .5 + cursor = "sb_v_double_arrow" + elseif not (g.x + g.width + 15 > wa.x + wa.width) then + offset = g.width + end + corner_coords = { y = wa.y + wa.height * (1 - mwfact) / 2, x = g.x + offset } + end + + mouse.coords(corner_coords) + + local prev_coords = {} + + mousegrabber.run(function(_mouse) + if not c.valid then return false end + for _, v in ipairs(_mouse.buttons) do + if v then + prev_coords = { x = _mouse.x, y = _mouse.y } + local new_mwfact + if orientation == 'vertical' then + new_mwfact = 1 - (_mouse.x - wa.x) / wa.width * 2 + else + new_mwfact = 1 - (_mouse.y - wa.y) / wa.height * 2 + end + c.screen.selected_tag.master_width_factor = math.min(math.max(new_mwfact, 0.01), 0.99) + return true + end + end + return prev_coords.x == _mouse.x and prev_coords.y == _mouse.y + end, cursor) +end + +function centerwork.arrange(p) + return arrange(p, centerwork) +end + +function centerwork.horizontal.arrange(p) + return arrange(p, centerwork.horizontal) +end + +function centerwork.mouse_resize_handler(c, corner, x, y) + return mouse_resize_handler(c, corner, x, y, 'vertical') +end + +function centerwork.horizontal.mouse_resize_handler(c, corner, x, y) + return mouse_resize_handler(c, corner, x, y, 'horizontal') +end + +return centerwork diff --git a/config/awesome/lain/layout/init.lua b/config/awesome/lain/layout/init.lua new file mode 100755 index 000000000..6478b0605 --- /dev/null +++ b/config/awesome/lain/layout/init.lua @@ -0,0 +1,19 @@ +--[[ + + Lain + Layouts, widgets and utilities for Awesome WM + + Layouts section + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local wrequire = require("lain.helpers").wrequire +local setmetatable = setmetatable + +local layout = { _NAME = "lain.layout" } + +return setmetatable(layout, { __index = wrequire }) diff --git a/config/awesome/lain/layout/termfair.lua b/config/awesome/lain/layout/termfair.lua new file mode 100755 index 000000000..e33894e11 --- /dev/null +++ b/config/awesome/lain/layout/termfair.lua @@ -0,0 +1,237 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2014, projektile + * (c) 2013, Luca CPZ + * (c) 2010, Nicolas Estibals + * (c) 2010-2012, Peter Hofmann + +--]] + +local math = math +local screen = screen +local tonumber = tonumber + +local termfair = { name = "termfair" } +termfair.center = { name = "centerfair" } + +local function do_fair(p, orientation) + local t = p.tag or screen[p.screen].selected_tag + local wa = p.workarea + local cls = p.clients + + if #cls == 0 then return end + + if orientation == "west" then + -- Layout with fixed number of vertical columns (read from nmaster). + -- New windows align from left to right. When a row is full, a now + -- one above it is created. Like this: + + -- (1) (2) (3) + -- +---+---+---+ +---+---+---+ +---+---+---+ + -- | | | | | | | | | | | | + -- | 1 | | | -> | 2 | 1 | | -> | 3 | 2 | 1 | -> + -- | | | | | | | | | | | | + -- +---+---+---+ +---+---+---+ +---+---+---+ + + -- (4) (5) (6) + -- +---+---+---+ +---+---+---+ +---+---+---+ + -- | 4 | | | | 5 | 4 | | | 6 | 5 | 4 | + -- +---+---+---+ -> +---+---+---+ -> +---+---+---+ + -- | 3 | 2 | 1 | | 3 | 2 | 1 | | 3 | 2 | 1 | + -- +---+---+---+ +---+---+---+ +---+---+---+ + + -- How many vertical columns? Read from nmaster on the tag. + local num_x = tonumber(termfair.nmaster) or t.master_count + local ncol = tonumber(termfair.ncol) or t.column_count + + if num_x <= 2 then num_x = 2 end + if ncol <= 1 then ncol = 1 end + local width = math.floor(wa.width/num_x) + + local num_y = math.max(math.ceil(#cls / num_x), ncol) + local height = math.floor(wa.height/num_y) + local cur_num_x = num_x + local at_x = 0 + local at_y = 0 + + local remaining_clients = #cls + + -- We start the first row. Left-align by limiting the number of + -- available slots. + if remaining_clients < num_x then + cur_num_x = remaining_clients + end + + -- Iterate in reversed order. + for i = #cls,1,-1 do + -- Get x and y position. + local c = cls[i] + local this_x = cur_num_x - at_x - 1 + local this_y = num_y - at_y - 1 + + -- Calculate geometry. + local g = {} + if this_x == (num_x - 1) then + g.width = wa.width - (num_x - 1)*width + else + g.width = width + end + + if this_y == (num_y - 1) then + g.height = wa.height - (num_y - 1)*height + else + g.height = height + end + + g.x = wa.x + this_x*width + g.y = wa.y + this_y*height + + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end + + p.geometries[c] = g + + remaining_clients = remaining_clients - 1 + + -- Next grid position. + at_x = at_x + 1 + if at_x == num_x then + -- Row full, create a new one above it. + at_x = 0 + at_y = at_y + 1 + + -- We start a new row. Left-align. + if remaining_clients < num_x then + cur_num_x = remaining_clients + end + end + end + elseif orientation == "center" then + -- Layout with fixed number of vertical columns (read from nmaster). + -- Cols are centerded until there is nmaster columns, then windows + -- are stacked in the slave columns, with at most ncol clients per + -- column if possible. + + -- with nmaster=3 and ncol=1 you'll have + -- (1) (2) (3) + -- +---+---+---+ +-+---+---+-+ +---+---+---+ + -- | | | | | | | | | | | | | + -- | | 1 | | -> | | 1 | 2 | | -> | 1 | 2 | 3 | -> + -- | | | | | | | | | | | | | + -- +---+---+---+ +-+---+---+-+ +---+---+---+ + + -- (4) (5) + -- +---+---+---+ +---+---+---+ + -- | | | 3 | | | 2 | 4 | + -- + 1 + 2 +---+ -> + 1 +---+---+ + -- | | | 4 | | | 3 | 5 | + -- +---+---+---+ +---+---+---+ + + -- How many vertical columns? Read from nmaster on the tag. + local num_x = tonumber(termfair.center.nmaster) or t.master_count + local ncol = tonumber(termfair.center.ncol) or t.column_count + + if num_x <= 2 then num_x = 2 end + if ncol <= 1 then ncol = 1 end + + local width = math.floor(wa.width / num_x) + + if #cls < num_x then + -- Less clients than the number of columns, let's center it! + local offset_x = wa.x + (wa.width - #cls*width) / 2 + for i = 1, #cls do + local g = { y = wa.y } + g.width = width + g.height = wa.height + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end + g.x = offset_x + (i - 1) * width + p.geometries[cls[i]] = g + end + else + -- More clients than the number of columns, let's arrange it! + -- Master client deserves a special treatement + local g = {} + g.width = wa.width - (num_x - 1)*width + g.height = wa.height + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end + g.x = wa.x + g.y = wa.y + p.geometries[cls[1]] = g + + -- Treat the other clients + + -- Compute distribution of clients among columns + local num_y = {} + local remaining_clients = #cls-1 + local ncol_min = math.ceil(remaining_clients/(num_x-1)) + + if ncol >= ncol_min then + for i = (num_x-1), 1, -1 do + if (remaining_clients-i+1) < ncol then + num_y[i] = remaining_clients-i + 1 + else + num_y[i] = ncol + end + remaining_clients = remaining_clients - num_y[i] + end + else + local rem = remaining_clients % (num_x-1) + if rem == 0 then + for i = 1, num_x-1 do + num_y[i] = ncol_min + end + else + for i = 1, num_x-1 do + num_y[i] = ncol_min - 1 + end + for i = 0, rem-1 do + num_y[num_x-1-i] = num_y[num_x-1-i] + 1 + end + end + end + + -- Compute geometry of the other clients + local nclient = 2 -- we start with the 2nd client + local wx = g.x + g.width + for i = 1, (num_x-1) do + local height = math.floor(wa.height / num_y[i]) + local wy = wa.y + for j = 0, (num_y[i]-2) do + local g = {} + g.x = wx + g.y = wy + g.height = height + g.width = width + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end + p.geometries[cls[nclient]] = g + nclient = nclient + 1 + wy = wy + height + end + local g = {} + g.x = wx + g.y = wy + g.height = wa.height - (num_y[i] - 1)*height + g.width = width + if g.width < 1 then g.width = 1 end + if g.height < 1 then g.height = 1 end + p.geometries[cls[nclient]] = g + nclient = nclient + 1 + wx = wx + width + end + end + end +end + +function termfair.center.arrange(p) + return do_fair(p, "center") +end + +function termfair.arrange(p) + return do_fair(p, "west") +end + +return termfair diff --git a/config/awesome/lain/util/dkjson.lua b/config/awesome/lain/util/dkjson.lua new file mode 100755 index 000000000..89aa2e148 --- /dev/null +++ b/config/awesome/lain/util/dkjson.lua @@ -0,0 +1,713 @@ +-- Module options: +local always_try_using_lpeg = true +local register_global_module_table = false +local global_module_name = 'json' + +--[==[ + +David Kolf's JSON module for Lua 5.1/5.2 + +Version 2.5 + + +For the documentation see the corresponding readme.txt or visit +. + +You can contact the author by sending an e-mail to 'david' at the +domain 'dkolf.de'. + + +Copyright (C) 2010-2013 David Heiko Kolf + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--]==] + +-- global dependencies: +local pairs, type, tostring, tonumber, getmetatable, setmetatable, rawset = + pairs, type, tostring, tonumber, getmetatable, setmetatable, rawset +local error, require, pcall, select = error, require, pcall, select +local floor, huge = math.floor, math.huge +local strrep, gsub, strsub, strbyte, strchar, strfind, strlen, strformat = + string.rep, string.gsub, string.sub, string.byte, string.char, + string.find, string.len, string.format +local strmatch = string.match +local concat = table.concat + +local json = { version = "dkjson 2.5" } + +if register_global_module_table then + _G[global_module_name] = json +end + +local _ENV = nil -- blocking globals in Lua 5.2 + +pcall (function() + -- Enable access to blocked metatables. + -- Don't worry, this module doesn't change anything in them. + local debmeta = require "debug".getmetatable + if debmeta then getmetatable = debmeta end +end) + +json.null = setmetatable ({}, { + __tojson = function () return "null" end +}) + +local function isarray (tbl) + local max, n, arraylen = 0, 0, 0 + for k,v in pairs (tbl) do + if k == 'n' and type(v) == 'number' then + arraylen = v + if v > max then + max = v + end + else + if type(k) ~= 'number' or k < 1 or floor(k) ~= k then + return false + end + if k > max then + max = k + end + n = n + 1 + end + end + if max > 10 and max > arraylen and max > n * 2 then + return false -- don't create an array with too many holes + end + return true, max +end + +local escapecodes = { + ["\""] = "\\\"", ["\\"] = "\\\\", ["\b"] = "\\b", ["\f"] = "\\f", + ["\n"] = "\\n", ["\r"] = "\\r", ["\t"] = "\\t" +} + +local function escapeutf8 (uchar) + local value = escapecodes[uchar] + if value then + return value + end + local a, b, c, d = strbyte (uchar, 1, 4) + a, b, c, d = a or 0, b or 0, c or 0, d or 0 + if a <= 0x7f then + value = a + elseif 0xc0 <= a and a <= 0xdf and b >= 0x80 then + value = (a - 0xc0) * 0x40 + b - 0x80 + elseif 0xe0 <= a and a <= 0xef and b >= 0x80 and c >= 0x80 then + value = ((a - 0xe0) * 0x40 + b - 0x80) * 0x40 + c - 0x80 + elseif 0xf0 <= a and a <= 0xf7 and b >= 0x80 and c >= 0x80 and d >= 0x80 then + value = (((a - 0xf0) * 0x40 + b - 0x80) * 0x40 + c - 0x80) * 0x40 + d - 0x80 + else + return "" + end + if value <= 0xffff then + return strformat ("\\u%.4x", value) + elseif value <= 0x10ffff then + -- encode as UTF-16 surrogate pair + value = value - 0x10000 + local highsur, lowsur = 0xD800 + floor (value/0x400), 0xDC00 + (value % 0x400) + return strformat ("\\u%.4x\\u%.4x", highsur, lowsur) + else + return "" + end +end + +local function fsub (str, pattern, repl) + -- gsub always builds a new string in a buffer, even when no match + -- exists. First using find should be more efficient when most strings + -- don't contain the pattern. + if strfind (str, pattern) then + return gsub (str, pattern, repl) + else + return str + end +end + +local function quotestring (value) + -- based on the regexp "escapable" in https://github.com/douglascrockford/JSON-js + value = fsub (value, "[%z\1-\31\"\\\127]", escapeutf8) + if strfind (value, "[\194\216\220\225\226\239]") then + value = fsub (value, "\194[\128-\159\173]", escapeutf8) + value = fsub (value, "\216[\128-\132]", escapeutf8) + value = fsub (value, "\220\143", escapeutf8) + value = fsub (value, "\225\158[\180\181]", escapeutf8) + value = fsub (value, "\226\128[\140-\143\168-\175]", escapeutf8) + value = fsub (value, "\226\129[\160-\175]", escapeutf8) + value = fsub (value, "\239\187\191", escapeutf8) + value = fsub (value, "\239\191[\176-\191]", escapeutf8) + end + return "\"" .. value .. "\"" +end +json.quotestring = quotestring + +local function replace(str, o, n) + local i, j = strfind (str, o, 1, true) + if i then + return strsub(str, 1, i-1) .. n .. strsub(str, j+1, -1) + else + return str + end +end + +-- locale independent num2str and str2num functions +local decpoint, numfilter + +local function updatedecpoint () + decpoint = strmatch(tostring(0.5), "([^05+])") + -- build a filter that can be used to remove group separators + numfilter = "[^0-9%-%+eE" .. gsub(decpoint, "[%^%$%(%)%%%.%[%]%*%+%-%?]", "%%%0") .. "]+" +end + +updatedecpoint() + +local function num2str (num) + return replace(fsub(tostring(num), numfilter, ""), decpoint, ".") +end + +local function str2num (str) + local num = tonumber(replace(str, ".", decpoint)) + if not num then + updatedecpoint() + num = tonumber(replace(str, ".", decpoint)) + end + return num +end + +local function addnewline2 (level, buffer, buflen) + buffer[buflen+1] = "\n" + buffer[buflen+2] = strrep (" ", level) + buflen = buflen + 2 + return buflen +end + +function json.addnewline (state) + if state.indent then + state.bufferlen = addnewline2 (state.level or 0, + state.buffer, state.bufferlen or #(state.buffer)) + end +end + +local encode2 -- forward declaration + +local function addpair (key, value, prev, indent, level, buffer, buflen, tables, globalorder, state) + local kt = type (key) + if kt ~= 'string' and kt ~= 'number' then + return nil, "type '" .. kt .. "' is not supported as a key by JSON." + end + if prev then + buflen = buflen + 1 + buffer[buflen] = "," + end + if indent then + buflen = addnewline2 (level, buffer, buflen) + end + buffer[buflen+1] = quotestring (key) + buffer[buflen+2] = ":" + return encode2 (value, indent, level, buffer, buflen + 2, tables, globalorder, state) +end + +local function appendcustom(res, buffer, state) + local buflen = state.bufferlen + if type (res) == 'string' then + buflen = buflen + 1 + buffer[buflen] = res + end + return buflen +end + +local function exception(reason, value, state, buffer, buflen, defaultmessage) + defaultmessage = defaultmessage or reason + local handler = state.exception + if not handler then + return nil, defaultmessage + else + state.bufferlen = buflen + local ret, msg = handler (reason, value, state, defaultmessage) + if not ret then return nil, msg or defaultmessage end + return appendcustom(ret, buffer, state) + end +end + +function json.encodeexception(reason, value, state, defaultmessage) + return quotestring("<" .. defaultmessage .. ">") +end + +encode2 = function (value, indent, level, buffer, buflen, tables, globalorder, state) + local valtype = type (value) + local valmeta = getmetatable (value) + valmeta = type (valmeta) == 'table' and valmeta -- only tables + local valtojson = valmeta and valmeta.__tojson + if valtojson then + if tables[value] then + return exception('reference cycle', value, state, buffer, buflen) + end + tables[value] = true + state.bufferlen = buflen + local ret, msg = valtojson (value, state) + if not ret then return exception('custom encoder failed', value, state, buffer, buflen, msg) end + tables[value] = nil + buflen = appendcustom(ret, buffer, state) + elseif value == nil then + buflen = buflen + 1 + buffer[buflen] = "null" + elseif valtype == 'number' then + local s + if value ~= value or value >= huge or -value >= huge then + -- This is the behaviour of the original JSON implementation. + s = "null" + else + s = num2str (value) + end + buflen = buflen + 1 + buffer[buflen] = s + elseif valtype == 'boolean' then + buflen = buflen + 1 + buffer[buflen] = value and "true" or "false" + elseif valtype == 'string' then + buflen = buflen + 1 + buffer[buflen] = quotestring (value) + elseif valtype == 'table' then + if tables[value] then + return exception('reference cycle', value, state, buffer, buflen) + end + tables[value] = true + level = level + 1 + local isa, n = isarray (value) + if n == 0 and valmeta and valmeta.__jsontype == 'object' then + isa = false + end + local msg + if isa then -- JSON array + buflen = buflen + 1 + buffer[buflen] = "[" + for i = 1, n do + buflen, msg = encode2 (value[i], indent, level, buffer, buflen, tables, globalorder, state) + if not buflen then return nil, msg end + if i < n then + buflen = buflen + 1 + buffer[buflen] = "," + end + end + buflen = buflen + 1 + buffer[buflen] = "]" + else -- JSON object + local prev = false + buflen = buflen + 1 + buffer[buflen] = "{" + local order = valmeta and valmeta.__jsonorder or globalorder + if order then + local used = {} + n = #order + for i = 1, n do + local k = order[i] + local v = value[k] + if v then + used[k] = true + buflen, msg = addpair (k, v, prev, indent, level, buffer, buflen, tables, globalorder, state) + prev = true -- add a seperator before the next element + end + end + for k,v in pairs (value) do + if not used[k] then + buflen, msg = addpair (k, v, prev, indent, level, buffer, buflen, tables, globalorder, state) + if not buflen then return nil, msg end + prev = true -- add a seperator before the next element + end + end + else -- unordered + for k,v in pairs (value) do + buflen, msg = addpair (k, v, prev, indent, level, buffer, buflen, tables, globalorder, state) + if not buflen then return nil, msg end + prev = true -- add a seperator before the next element + end + end + if indent then + buflen = addnewline2 (level - 1, buffer, buflen) + end + buflen = buflen + 1 + buffer[buflen] = "}" + end + tables[value] = nil + else + return exception ('unsupported type', value, state, buffer, buflen, + "type '" .. valtype .. "' is not supported by JSON.") + end + return buflen +end + +function json.encode (value, state) + state = state or {} + local oldbuffer = state.buffer + local buffer = oldbuffer or {} + state.buffer = buffer + updatedecpoint() + local ret, msg = encode2 (value, state.indent, state.level or 0, + buffer, state.bufferlen or 0, state.tables or {}, state.keyorder, state) + if not ret then + error (msg, 2) + elseif oldbuffer == buffer then + state.bufferlen = ret + return true + else + state.bufferlen = nil + state.buffer = nil + return concat (buffer) + end +end + +local function loc (str, where) + local line, pos, linepos = 1, 1, 0 + while true do + pos = strfind (str, "\n", pos, true) + if pos and pos < where then + line = line + 1 + linepos = pos + pos = pos + 1 + else + break + end + end + return "line " .. line .. ", column " .. (where - linepos) +end + +local function unterminated (str, what, where) + return nil, strlen (str) + 1, "unterminated " .. what .. " at " .. loc (str, where) +end + +local function scanwhite (str, pos) + while true do + pos = strfind (str, "%S", pos) + if not pos then return nil end + local sub2 = strsub (str, pos, pos + 1) + if sub2 == "\239\187" and strsub (str, pos + 2, pos + 2) == "\191" then + -- UTF-8 Byte Order Mark + pos = pos + 3 + elseif sub2 == "//" then + pos = strfind (str, "[\n\r]", pos + 2) + if not pos then return nil end + elseif sub2 == "/*" then + pos = strfind (str, "*/", pos + 2) + if not pos then return nil end + pos = pos + 2 + else + return pos + end + end +end + +local escapechars = { + ["\""] = "\"", ["\\"] = "\\", ["/"] = "/", ["b"] = "\b", ["f"] = "\f", + ["n"] = "\n", ["r"] = "\r", ["t"] = "\t" +} + +local function unichar (value) + if value < 0 then + return nil + elseif value <= 0x007f then + return strchar (value) + elseif value <= 0x07ff then + return strchar (0xc0 + floor(value/0x40), + 0x80 + (floor(value) % 0x40)) + elseif value <= 0xffff then + return strchar (0xe0 + floor(value/0x1000), + 0x80 + (floor(value/0x40) % 0x40), + 0x80 + (floor(value) % 0x40)) + elseif value <= 0x10ffff then + return strchar (0xf0 + floor(value/0x40000), + 0x80 + (floor(value/0x1000) % 0x40), + 0x80 + (floor(value/0x40) % 0x40), + 0x80 + (floor(value) % 0x40)) + else + return nil + end +end + +local function scanstring (str, pos) + local lastpos = pos + 1 + local buffer, n = {}, 0 + while true do + local nextpos = strfind (str, "[\"\\]", lastpos) + if not nextpos then + return unterminated (str, "string", pos) + end + if nextpos > lastpos then + n = n + 1 + buffer[n] = strsub (str, lastpos, nextpos - 1) + end + if strsub (str, nextpos, nextpos) == "\"" then + lastpos = nextpos + 1 + break + else + local escchar = strsub (str, nextpos + 1, nextpos + 1) + local value + if escchar == "u" then + value = tonumber (strsub (str, nextpos + 2, nextpos + 5), 16) + if value then + local value2 + if 0xD800 <= value and value <= 0xDBff then + -- we have the high surrogate of UTF-16. Check if there is a + -- low surrogate escaped nearby to combine them. + if strsub (str, nextpos + 6, nextpos + 7) == "\\u" then + value2 = tonumber (strsub (str, nextpos + 8, nextpos + 11), 16) + if value2 and 0xDC00 <= value2 and value2 <= 0xDFFF then + value = (value - 0xD800) * 0x400 + (value2 - 0xDC00) + 0x10000 + else + value2 = nil -- in case it was out of range for a low surrogate + end + end + end + value = value and unichar (value) + if value then + if value2 then + lastpos = nextpos + 12 + else + lastpos = nextpos + 6 + end + end + end + end + if not value then + value = escapechars[escchar] or escchar + lastpos = nextpos + 2 + end + n = n + 1 + buffer[n] = value + end + end + if n == 1 then + return buffer[1], lastpos + elseif n > 1 then + return concat (buffer), lastpos + else + return "", lastpos + end +end + +local scanvalue -- forward declaration + +local function scantable (what, closechar, str, startpos, nullval, objectmeta, arraymeta) + local len = strlen (str) + local tbl, n = {}, 0 + local pos = startpos + 1 + if what == 'object' then + setmetatable (tbl, objectmeta) + else + setmetatable (tbl, arraymeta) + end + while true do + pos = scanwhite (str, pos) + if not pos then return unterminated (str, what, startpos) end + local char = strsub (str, pos, pos) + if char == closechar then + return tbl, pos + 1 + end + local val1, err + val1, pos, err = scanvalue (str, pos, nullval, objectmeta, arraymeta) + if err then return nil, pos, err end + pos = scanwhite (str, pos) + if not pos then return unterminated (str, what, startpos) end + char = strsub (str, pos, pos) + if char == ":" then + if val1 == nil then + return nil, pos, "cannot use nil as table index (at " .. loc (str, pos) .. ")" + end + pos = scanwhite (str, pos + 1) + if not pos then return unterminated (str, what, startpos) end + local val2 + val2, pos, err = scanvalue (str, pos, nullval, objectmeta, arraymeta) + if err then return nil, pos, err end + tbl[val1] = val2 + pos = scanwhite (str, pos) + if not pos then return unterminated (str, what, startpos) end + char = strsub (str, pos, pos) + else + n = n + 1 + tbl[n] = val1 + end + if char == "," then + pos = pos + 1 + end + end +end + +scanvalue = function (str, pos, nullval, objectmeta, arraymeta) + pos = pos or 1 + pos = scanwhite (str, pos) + if not pos then + return nil, strlen (str) + 1, "no valid JSON value (reached the end)" + end + local char = strsub (str, pos, pos) + if char == "{" then + return scantable ('object', "}", str, pos, nullval, objectmeta, arraymeta) + elseif char == "[" then + return scantable ('array', "]", str, pos, nullval, objectmeta, arraymeta) + elseif char == "\"" then + return scanstring (str, pos) + else + local pstart, pend = strfind (str, "^%-?[%d%.]+[eE]?[%+%-]?%d*", pos) + if pstart then + local number = str2num (strsub (str, pstart, pend)) + if number then + return number, pend + 1 + end + end + pstart, pend = strfind (str, "^%a%w*", pos) + if pstart then + local name = strsub (str, pstart, pend) + if name == "true" then + return true, pend + 1 + elseif name == "false" then + return false, pend + 1 + elseif name == "null" then + return nullval, pend + 1 + end + end + return nil, pos, "no valid JSON value at " .. loc (str, pos) + end +end + +local function optionalmetatables(...) + if select("#", ...) > 0 then + return ... + else + return {__jsontype = 'object'}, {__jsontype = 'array'} + end +end + +function json.decode (str, pos, nullval, ...) + local objectmeta, arraymeta = optionalmetatables(...) + return scanvalue (str, pos, nullval, objectmeta, arraymeta) +end + +function json.use_lpeg () + local g = require ("lpeg") + + if g.version() == "0.11" then + error "due to a bug in LPeg 0.11, it cannot be used for JSON matching" + end + + local pegmatch = g.match + local P, S, R = g.P, g.S, g.R + + local function ErrorCall (str, pos, msg, state) + if not state.msg then + state.msg = msg .. " at " .. loc (str, pos) + state.pos = pos + end + return false + end + + local function Err (msg) + return g.Cmt (g.Cc (msg) * g.Carg (2), ErrorCall) + end + + local SingleLineComment = P"//" * (1 - S"\n\r")^0 + local MultiLineComment = P"/*" * (1 - P"*/")^0 * P"*/" + local Space = (S" \n\r\t" + P"\239\187\191" + SingleLineComment + MultiLineComment)^0 + + local PlainChar = 1 - S"\"\\\n\r" + local EscapeSequence = (P"\\" * g.C (S"\"\\/bfnrt" + Err "unsupported escape sequence")) / escapechars + local HexDigit = R("09", "af", "AF") + local function UTF16Surrogate (match, pos, high, low) + high, low = tonumber (high, 16), tonumber (low, 16) + if 0xD800 <= high and high <= 0xDBff and 0xDC00 <= low and low <= 0xDFFF then + return true, unichar ((high - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000) + else + return false + end + end + local function UTF16BMP (hex) + return unichar (tonumber (hex, 16)) + end + local U16Sequence = (P"\\u" * g.C (HexDigit * HexDigit * HexDigit * HexDigit)) + local UnicodeEscape = g.Cmt (U16Sequence * U16Sequence, UTF16Surrogate) + U16Sequence/UTF16BMP + local Char = UnicodeEscape + EscapeSequence + PlainChar + local String = P"\"" * g.Cs (Char ^ 0) * (P"\"" + Err "unterminated string") + local Integer = P"-"^(-1) * (P"0" + (R"19" * R"09"^0)) + local Fractal = P"." * R"09"^0 + local Exponent = (S"eE") * (S"+-")^(-1) * R"09"^1 + local Number = (Integer * Fractal^(-1) * Exponent^(-1))/str2num + local Constant = P"true" * g.Cc (true) + P"false" * g.Cc (false) + P"null" * g.Carg (1) + local SimpleValue = Number + String + Constant + local ArrayContent, ObjectContent + + -- The functions parsearray and parseobject parse only a single value/pair + -- at a time and store them directly to avoid hitting the LPeg limits. + local function parsearray (str, pos, nullval, state) + local obj, cont + local npos + local t, nt = {}, 0 + repeat + obj, cont, npos = pegmatch (ArrayContent, str, pos, nullval, state) + if not npos then break end + pos = npos + nt = nt + 1 + t[nt] = obj + until cont == 'last' + return pos, setmetatable (t, state.arraymeta) + end + + local function parseobject (str, pos, nullval, state) + local obj, key, cont + local npos + local t = {} + repeat + key, obj, cont, npos = pegmatch (ObjectContent, str, pos, nullval, state) + if not npos then break end + pos = npos + t[key] = obj + until cont == 'last' + return pos, setmetatable (t, state.objectmeta) + end + + local Array = P"[" * g.Cmt (g.Carg(1) * g.Carg(2), parsearray) * Space * (P"]" + Err "']' expected") + local Object = P"{" * g.Cmt (g.Carg(1) * g.Carg(2), parseobject) * Space * (P"}" + Err "'}' expected") + local Value = Space * (Array + Object + SimpleValue) + local ExpectedValue = Value + Space * Err "value expected" + ArrayContent = Value * Space * (P"," * g.Cc'cont' + g.Cc'last') * g.Cp() + local Pair = g.Cg (Space * String * Space * (P":" + Err "colon expected") * ExpectedValue) + ObjectContent = Pair * Space * (P"," * g.Cc'cont' + g.Cc'last') * g.Cp() + local DecodeValue = ExpectedValue * g.Cp () + + function json.decode (str, pos, nullval, ...) + local state = {} + state.objectmeta, state.arraymeta = optionalmetatables(...) + local obj, retpos = pegmatch (DecodeValue, str, pos, nullval, state) + if state.msg then + return nil, state.pos, state.msg + else + return obj, retpos + end + end + + -- use this function only once: + json.use_lpeg = function () return json end + + json.using_lpeg = true + + return json -- so you can get the module using json = require "dkjson".use_lpeg() +end + +if always_try_using_lpeg then + pcall (json.use_lpeg) +end + +return json diff --git a/config/awesome/lain/util/init.lua b/config/awesome/lain/util/init.lua new file mode 100755 index 000000000..55bfa26a5 --- /dev/null +++ b/config/awesome/lain/util/init.lua @@ -0,0 +1,168 @@ +--[[ + + Lain + Layouts, widgets and utilities for Awesome WM + + Utilities section + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local awful = require("awful") +local sqrt = math.sqrt +local pairs = pairs +local client = client +local tonumber = tonumber +local wrequire = require("lain.helpers").wrequire +local setmetatable = setmetatable + +-- Lain utilities submodule +-- lain.util +local util = { _NAME = "lain.util" } + +-- Like awful.menu.clients, but only show clients of currently selected tags +function util.menu_clients_current_tags(menu, args) + -- List of currently selected tags. + local cls_tags = awful.screen.focused().selected_tags + + if cls_tags == nil then return nil end + + -- Final list of menu items. + local cls_t = {} + + -- For each selected tag get all clients of that tag and add them to + -- the menu. A click on a menu item will raise that client. + for i = 1,#cls_tags do + local t = cls_tags[i] + local cls = t:clients() + + for k, c in pairs(cls) do + cls_t[#cls_t + 1] = { awful.util.escape(c.name) or "", + function () + c.minimized = false + client.focus = c + c:raise() + end, + c.icon } + end + end + + -- No clients? Then quit. + if #cls_t <= 0 then return nil end + + -- menu may contain some predefined values, otherwise start with a + -- fresh menu. + if not menu then menu = {} end + + -- Set the list of items and show the menu. + menu.items = cls_t + local m = awful.menu(menu) + m:show(args) + + return m +end + +-- Magnify a client: set it to "float" and resize it. +function util.magnify_client(c, width_f, height_f) + if c and not c.floating then + util.magnified_client = c + util.mc(c, width_f, height_f) + else + util.magnified_client = nil + c.floating = false + end +end + +-- https://github.com/lcpz/lain/issues/195 +function util.mc(c, width_f, height_f) + c = c or util.magnified_client + if not c then return end + + c.floating = true + local s = awful.screen.focused() + local mg = s.workarea + local g = {} + local mwfact = width_f or s.selected_tag.master_width_factor or 0.5 + g.width = sqrt(mwfact) * mg.width + g.height = sqrt(height_f or mwfact) * mg.height + g.x = mg.x + (mg.width - g.width) / 2 + g.y = mg.y + (mg.height - g.height) / 2 + + if c then c:geometry(g) end -- if c is still a valid object +end + +-- Non-empty tag browsing +-- direction in {-1, 1} <-> {previous, next} non-empty tag +function util.tag_view_nonempty(direction, sc) + local s = sc or awful.screen.focused() + + for i = 1, #s.tags do + awful.tag.viewidx(direction, s) + if #s.clients > 0 then + return + end + end +end + +-- {{{ Dynamic tagging + +-- Add a new tag +function util.add_tag(layout) + awful.prompt.run { + prompt = "New tag name: ", + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = function(name) + if not name or #name == 0 then return end + awful.tag.add(name, { screen = awful.screen.focused(), layout = layout or awful.layout.suit.tile }):view_only() + end + } +end + +-- Rename current tag +function util.rename_tag() + awful.prompt.run { + prompt = "Rename tag: ", + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = function(new_name) + if not new_name or #new_name == 0 then return end + local t = awful.screen.focused().selected_tag + if t then + t.name = new_name + end + end + } +end + +-- Move current tag +-- pos in {-1, 1} <-> {previous, next} tag position +function util.move_tag(pos) + local tag = awful.screen.focused().selected_tag + if tonumber(pos) <= -1 then + awful.tag.move(tag.index - 1, tag) + else + awful.tag.move(tag.index + 1, tag) + end +end + +-- Delete current tag +-- Any rule set on the tag shall be broken +function util.delete_tag() + local t = awful.screen.focused().selected_tag + if not t then return end + t:delete() +end + +-- }}} + +-- On the fly useless gaps change +function util.useless_gaps_resize(thatmuch, s, t) + local scr = s or awful.screen.focused() + local tag = t or scr.selected_tag + tag.gap = tag.gap + tonumber(thatmuch) + awful.layout.arrange(scr) +end + +return setmetatable(util, { __index = wrequire }) diff --git a/config/awesome/lain/util/markup.lua b/config/awesome/lain/util/markup.lua new file mode 100755 index 000000000..63f94864d --- /dev/null +++ b/config/awesome/lain/util/markup.lua @@ -0,0 +1,66 @@ +--[[ + + Licensed under MIT License + * (c) 2013, Luca CPZ + * (c) 2009, Uli Schlachter + * (c) 2009, Majic + +--]] + +local format = string.format +local setmetatable = setmetatable + +-- Lain markup util submodule +-- lain.util.markup +local markup = { fg = {}, bg = {} } + +-- Convenience tags +function markup.bold(text) return format("%s", text) end +function markup.italic(text) return format("%s", text) end +function markup.strike(text) return format("%s", text) end +function markup.underline(text) return format("%s", text) end +function markup.monospace(text) return format("%s", text) end +function markup.big(text) return format("%s", text) end +function markup.small(text) return format("%s", text) end + +-- Set the font +function markup.font(font, text) + return format("%s", font, text) +end + +-- Set the foreground +function markup.fg.color(color, text) + return format("%s", color, text) +end + +-- Set the background +function markup.bg.color(color, text) + return format("%s", color, text) +end + +-- Set foreground and background +function markup.color(fg, bg, text) + return format("%s", fg, bg, text) +end + +-- Set font and foreground +function markup.fontfg(font, fg, text) + return format("%s", font, fg, text) +end + +-- Set font and background +function markup.fontbg(font, bg, text) + return format("%s", font, bg, text) +end + +-- Set font, foreground and background +function markup.fontcolor(font, fg, bg, text) + return format("%s", font, fg, bg, text) +end + +-- link markup.{fg,bg}(...) calls to markup.{fg,bg}.color(...) +setmetatable(markup.fg, { __call = function(_, ...) return markup.fg.color(...) end }) +setmetatable(markup.bg, { __call = function(_, ...) return markup.bg.color(...) end }) + +-- link markup(...) calls to markup.fg.color(...) +return setmetatable(markup, { __call = function(_, ...) return markup.fg.color(...) end }) diff --git a/config/awesome/lain/util/menu_iterator.lua b/config/awesome/lain/util/menu_iterator.lua new file mode 100755 index 000000000..0ea4e0e2d --- /dev/null +++ b/config/awesome/lain/util/menu_iterator.lua @@ -0,0 +1,144 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2017, Simon Désaulniers + * (c) 2017, Uli Schlachter + * (c) 2017, Jeferson Siqueira + +--]] + +-- Menu iterator with Naughty notifications +-- lain.util.menu_iterator + +local naughty = require("naughty") +local util = require("lain.util") +local atable = require("awful.util").table +local assert = assert +local pairs = pairs +local tconcat = table.concat +local unpack = unpack + +local state = { cid = nil } + +local function naughty_destroy_callback(reason) + local closed = naughty.notificationClosedReason + if reason == closed.expired or reason == closed.dismissedByUser then + local actions = state.index and state.menu[state.index - 1][2] + if actions then + for _,action in pairs(actions) do + -- don't try to call nil callbacks + if action then action() end + end + state.index = nil + end + end +end + +-- Iterates over a menu. +-- After the timeout, callbacks associated to the last visited choice are +-- executed. Inputs: +-- * menu: a list of {label, {callbacks}} pairs +-- * timeout: time to wait before confirming the menu selection +-- * icon: icon to display in the notification of the chosen label +local function iterate(menu, timeout, icon) + local timeout = timeout or 4 -- default timeout for each menu entry + local icon = icon or nil -- icon to display on the menu + + -- Build the list of choices + if not state.index then + state.menu = menu + state.index = 1 + end + + -- Select one and display the appropriate notification + local label + local next = state.menu[state.index] + state.index = state.index + 1 + + if not next then + label = "Cancel" + state.index = nil + else + label, _ = unpack(next) + end + + state.cid = naughty.notify({ + text = label, + icon = icon, + timeout = timeout, + screen = mouse.screen, + replaces_id = state.cid, + destroy = naughty_destroy_callback + }).id +end + +-- Generates a menu compatible with the first argument of `iterate` function and +-- suitable for the following cases: +-- * all possible choices individually (partition of singletons); +-- * all possible subsets of the set of choices (powerset). +-- +-- Inputs: +-- * args: an array containing the following members: +-- * choices: Array of choices (string) on which the menu will be +-- generated. +-- * name: Displayed name of the menu (in the form "name: choices"). +-- * selected_cb: Callback to execute for each selected choice. Takes +-- the choice as a string argument. Can be `nil` (no action +-- to execute). +-- * rejected_cb: Callback to execute for each rejected choice (possible +-- choices which are not selected). Takes the choice as a +-- string argument. Can be `nil` (no action to execute). +-- * extra_choices: An array of extra { choice_str, callback_fun } pairs to be +-- added to the menu. Each callback_fun can be `nil`. +-- * combination: The combination of choices to generate. Possible values: +-- "powerset" and "single" (default). +-- Output: +-- * m: menu to be iterated over. +local function menu(args) + local choices = assert(args.choices or args[1]) + local name = assert(args.name or args[2]) + local selected_cb = args.selected_cb + local rejected_cb = args.rejected_cb + local extra_choices = args.extra_choices or {} + + local ch_combinations = args.combination == "powerset" and helpers.powerset(choices) or helpers.trivial_partition_set(choices) + + for _,c in pairs(extra_choices) do + ch_combinations = atable.join(ch_combinations, {{c[1]}}) + end + + local m = {} -- the menu + + for _,c in pairs(ch_combinations) do + if #c > 0 then + local cbs = {} + + -- selected choices + for _,ch in pairs(c) do + if atable.hasitem(choices, ch) then + cbs[#cbs + 1] = selected_cb and function() selected_cb(ch) end or nil + end + end + + -- rejected choices + for _,ch in pairs(choices) do + if not atable.hasitem(c, ch) and atable.hasitem(choices, ch) then + cbs[#cbs + 1] = rejected_cb and function() rejected_cb(ch) end or nil + end + end + + -- add user extra choices (like the choice "None" for example) + for _,x in pairs(extra_choices) do + if x[1] == c[1] then + cbs[#cbs + 1] = x[2] + end + end + + m[#m + 1] = { name .. ": " .. tconcat(c, " + "), cbs } + end + end + + return m +end + +return { iterate = iterate, menu = menu } diff --git a/config/awesome/lain/util/quake.lua b/config/awesome/lain/util/quake.lua new file mode 100755 index 000000000..01891b037 --- /dev/null +++ b/config/awesome/lain/util/quake.lua @@ -0,0 +1,168 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2016, Luca CPZ + * (c) 2015, unknown + +--]] + +local awful = require("awful") +local capi = { client = client } +local math = math +local string = string +local pairs = pairs +local screen = screen +local setmetatable = setmetatable + +-- Quake-like Dropdown application spawn +local quake = {} + +-- If you have a rule like "awful.client.setslave" for your terminals, +-- ensure you use an exception for QuakeDD. Otherwise, you may +-- run into problems with focus. + +function quake:display() + if self.followtag then self.screen = awful.screen.focused() end + + -- First, we locate the client + local client = nil + local i = 0 + for c in awful.client.iterate(function (c) + -- c.name may be changed! + return c.instance == self.name + end) + do + i = i + 1 + if i == 1 then + client = c + else + -- Additional matching clients, let's remove the sticky bit + -- which may persist between awesome restarts. We don't close + -- them as they may be valuable. They will just turn into + -- normal clients. + c.sticky = false + c.ontop = false + c.above = false + end + end + + if not client and not self.visible then return end + + if not client then + -- The client does not exist, we spawn it + cmd = string.format("%s %s %s", self.app, + string.format(self.argname, self.name), self.extra) + awful.spawn(cmd, { tag = self.screen.selected_tag }) + return + end + + -- Set geometry + client.floating = true + client.border_width = self.border + client.size_hints_honor = false + client:geometry(self.geometry[self.screen.index] or self:compute_size()) + + -- Set not sticky and on top + client.sticky = false + client.ontop = true + client.above = true + client.skip_taskbar = true + + -- Additional user settings + if self.settings then self.settings(client) end + + -- Toggle display + if self.visible then + client.hidden = false + client:raise() + self.last_tag = self.screen.selected_tag + client:tags({self.screen.selected_tag}) + capi.client.focus = client + else + client.hidden = true + local ctags = client:tags() + for i, t in pairs(ctags) do + ctags[i] = nil + end + client:tags(ctags) + end + + return client +end + +function quake:compute_size() + -- skip if we already have a geometry for this screen + if not self.geometry[self.screen.index] then + local geom + if not self.overlap then + geom = screen[self.screen.index].workarea + else + geom = screen[self.screen.index].geometry + end + local width, height = self.width, self.height + if width <= 1 then width = math.floor(geom.width * width) - 2 * self.border end + if height <= 1 then height = math.floor(geom.height * height) end + local x, y + if self.horiz == "left" then x = geom.x + elseif self.horiz == "right" then x = geom.width + geom.x - width + else x = geom.x + (geom.width - width)/2 end + if self.vert == "top" then y = geom.y + elseif self.vert == "bottom" then y = geom.height + geom.y - height + else y = geom.y + (geom.height - height)/2 end + self.geometry[self.screen.index] = { x = x, y = y, width = width, height = height } + end + return self.geometry[self.screen.index] +end + +function quake:new(config) + local conf = config or {} + + conf.app = conf.app or "xterm" -- application to spawn + conf.name = conf.name or "QuakeDD" -- window name + conf.argname = conf.argname or "-name %s" -- how to specify window name + conf.extra = conf.extra or "" -- extra arguments + conf.border = conf.border or 1 -- client border width + conf.visible = conf.visible or false -- initially not visible + conf.followtag = conf.followtag or false -- spawn on currently focused screen + conf.overlap = conf.overlap or false -- overlap wibox + conf.screen = conf.screen or awful.screen.focused() + conf.settings = conf.settings + + -- If width or height <= 1 this is a proportion of the workspace + conf.height = conf.height or 0.25 -- height + conf.width = conf.width or 1 -- width + conf.vert = conf.vert or "top" -- top, bottom or center + conf.horiz = conf.horiz or "left" -- left, right or center + conf.geometry = {} -- internal use + + local dropdown = setmetatable(conf, { __index = quake }) + + capi.client.connect_signal("manage", function(c) + if c.instance == dropdown.name and c.screen == dropdown.screen then + dropdown:display() + end + end) + capi.client.connect_signal("unmanage", function(c) + if c.instance == dropdown.name and c.screen == dropdown.screen then + dropdown.visible = false + end + end) + + return dropdown +end + +function quake:toggle() + if self.followtag then self.screen = awful.screen.focused() end + local current_tag = self.screen.selected_tag + if current_tag and self.last_tag ~= current_tag and self.visible then + local c=self:display() + if c then + c:move_to_tag(current_tag) + end + else + self.visible = not self.visible + self:display() + end +end + +return setmetatable(quake, { __call = function(_, ...) return quake:new(...) end }) diff --git a/config/awesome/lain/util/separators.lua b/config/awesome/lain/util/separators.lua new file mode 100755 index 000000000..465132d56 --- /dev/null +++ b/config/awesome/lain/util/separators.lua @@ -0,0 +1,117 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2015, Luca CPZ + * (c) 2015, plotnikovanton + +--]] + +local wibox = require("wibox") +local gears = require("gears") + +-- Lain Cairo separators util submodule +-- lain.util.separators +local separators = { height = 0, width = 9 } + +-- [[ Arrow + +-- Right +function separators.arrow_right(col1, col2) + local widget = wibox.widget.base.make_widget() + widget.col1 = col1 + widget.col2 = col2 + + widget.fit = function(m, w, h) + return separators.width, separators.height + end + + widget.update = function(col1, col2) + widget.col1 = col1 + widget.col2 = col2 + widget:emit_signal("widget::redraw_needed") + end + + widget.draw = function(mycross, wibox, cr, width, height) + if widget.col2 ~= "alpha" then + cr:set_source_rgb(gears.color.parse_color(widget.col2)) + cr:new_path() + cr:move_to(0, 0) + cr:line_to(width, height/2) + cr:line_to(width, 0) + cr:close_path() + cr:fill() + + cr:new_path() + cr:move_to(0, height) + cr:line_to(width, height/2) + cr:line_to(width, height) + cr:close_path() + cr:fill() + end + + if widget.col1 ~= "alpha" then + cr:set_source_rgb(gears.color.parse_color(widget.col1)) + cr:new_path() + cr:move_to(0, 0) + cr:line_to(width, height/2) + cr:line_to(0, height) + cr:close_path() + cr:fill() + end + end + + return widget +end + +-- Left +function separators.arrow_left(col1, col2) + local widget = wibox.widget.base.make_widget() + widget.col1 = col1 + widget.col2 = col2 + + widget.fit = function(m, w, h) + return separators.width, separators.height + end + + widget.update = function(col1, col2) + widget.col1 = col1 + widget.col2 = col2 + widget:emit_signal("widget::redraw_needed") + end + + widget.draw = function(mycross, wibox, cr, width, height) + if widget.col1 ~= "alpha" then + cr:set_source_rgb(gears.color.parse_color(widget.col1)) + cr:new_path() + cr:move_to(width, 0) + cr:line_to(0, height/2) + cr:line_to(0, 0) + cr:close_path() + cr:fill() + + cr:new_path() + cr:move_to(width, height) + cr:line_to(0, height/2) + cr:line_to(0, height) + cr:close_path() + cr:fill() + end + + if widget.col2 ~= "alpha" then + cr:new_path() + cr:move_to(width, 0) + cr:line_to(0, height/2) + cr:line_to(width, height) + cr:close_path() + + cr:set_source_rgb(gears.color.parse_color(widget.col2)) + cr:fill() + end + end + + return widget +end + +-- ]] + +return separators diff --git a/config/awesome/lain/widget/alsa.lua b/config/awesome/lain/widget/alsa.lua new file mode 100755 index 000000000..3b6c6d6d2 --- /dev/null +++ b/config/awesome/lain/widget/alsa.lua @@ -0,0 +1,53 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010, Adrian C. + +--]] + +local helpers = require("lain.helpers") +local shell = require("awful.util").shell +local wibox = require("wibox") +local string = string + +-- ALSA volume +-- lain.widget.alsa + +local function factory(args) + local alsa = { widget = wibox.widget.textbox() } + local args = args or {} + local timeout = args.timeout or 5 + local settings = args.settings or function() end + + alsa.cmd = args.cmd or "amixer" + alsa.channel = args.channel or "Master" + alsa.togglechannel = args.togglechannel + + local format_cmd = string.format("%s get %s", alsa.cmd, alsa.channel) + + if alsa.togglechannel then + format_cmd = { shell, "-c", string.format("%s get %s; %s get %s", + alsa.cmd, alsa.channel, alsa.cmd, alsa.togglechannel) } + end + + alsa.last = {} + + function alsa.update() + helpers.async(format_cmd, function(mixer) + local l,s = string.match(mixer, "([%d]+)%%.*%[([%l]*)") + if alsa.last.level ~= l or alsa.last.status ~= s then + volume_now = { level = l, status = s } + widget = alsa.widget + settings() + alsa.last = volume_now + end + end) + end + + helpers.newtimer(string.format("alsa-%s-%s", alsa.cmd, alsa.channel), timeout, alsa.update) + + return alsa +end + +return factory diff --git a/config/awesome/lain/widget/alsabar.lua b/config/awesome/lain/widget/alsabar.lua new file mode 100755 index 000000000..9b9f4b97a --- /dev/null +++ b/config/awesome/lain/widget/alsabar.lua @@ -0,0 +1,153 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2013, Rman + +--]] + +local helpers = require("lain.helpers") +local awful = require("awful") +local naughty = require("naughty") +local wibox = require("wibox") +local math = math +local string = string +local type = type +local tonumber = tonumber + +-- ALSA volume bar +-- lain.widget.alsabar + +local function factory(args) + local alsabar = { + colors = { + background = "#000000", + mute = "#EB8F8F", + unmute = "#A4CE8A" + }, + + _current_level = 0, + _playback = "off" + } + + local args = args or {} + local timeout = args.timeout or 5 + local settings = args.settings or function() end + local width = args.width or 63 + local height = args.height or 1 + local margins = args.margins or 1 + local paddings = args.paddings or 1 + local ticks = args.ticks or false + local ticks_size = args.ticks_size or 7 + + alsabar.cmd = args.cmd or "amixer" + alsabar.channel = args.channel or "Master" + alsabar.togglechannel = args.togglechannel + alsabar.colors = args.colors or alsabar.colors + alsabar.followtag = args.followtag or false + alsabar.notification_preset = args.notification_preset + + if not alsabar.notification_preset then + alsabar.notification_preset = {} + alsabar.notification_preset.font = "Monospace 10" + end + + local format_cmd = string.format("%s get %s", alsabar.cmd, alsabar.channel) + + if alsabar.togglechannel then + format_cmd = { awful.util.shell, "-c", string.format("%s get %s; %s get %s", + alsabar.cmd, alsabar.channel, alsabar.cmd, alsabar.togglechannel) } + end + + alsabar.bar = wibox.widget { + color = alsabar.colors.unmute, + background_color = alsabar.colors.background, + forced_height = height, + forced_width = width, + margins = margins, + paddings = margins, + ticks = ticks, + ticks_size = ticks_size, + widget = wibox.widget.progressbar + } + + alsabar.tooltip = awful.tooltip({ objects = { alsabar.bar } }) + + function alsabar.update(callback) + helpers.async(format_cmd, function(mixer) + local vol, playback = string.match(mixer, "([%d]+)%%.*%[([%l]*)") + + if not vol or not playback then return end + + if vol ~= alsabar._current_level or playback ~= alsabar._playback then + alsabar._current_level = tonumber(vol) + alsabar.bar:set_value(alsabar._current_level / 100) + if alsabar._current_level == 0 or playback == "off" then + alsabar._playback = playback + alsabar.tooltip:set_text("[Muted]") + alsabar.bar.color = alsabar.colors.mute + else + alsabar._playback = "on" + alsabar.tooltip:set_text(string.format("%s: %s", alsabar.channel, vol)) + alsabar.bar.color = alsabar.colors.unmute + end + + volume_now = { + level = alsabar._current_level, + status = alsabar._playback + } + + settings() + + if type(callback) == "function" then callback() end + end + end) + end + + function alsabar.notify() + alsabar.update(function() + local preset = alsabar.notification_preset + + preset.title = string.format("%s - %s%%", alsabar.channel, alsabar._current_level) + + if alsabar._playback == "off" then + preset.title = preset.title .. " Muted" + end + + -- tot is the maximum number of ticks to display in the notification + -- fallback: default horizontal wibox height + local wib, tot = awful.screen.focused().mywibox, 20 + + -- if we can grab mywibox, tot is defined as its height if + -- horizontal, or width otherwise + if wib then + if wib.position == "left" or wib.position == "right" then + tot = wib.width + else + tot = wib.height + end + end + + int = math.modf((alsabar._current_level / 100) * tot) + preset.text = string.format("[%s%s]", string.rep("|", int), + string.rep(" ", tot - int)) + + if alsabar.followtag then preset.screen = awful.screen.focused() end + + if not alsabar.notification then + alsabar.notification = naughty.notify { + preset = preset, + destroy = function() alsabar.notification = nil end + } + else + naughty.replace_text(alsabar.notification, preset.title, preset.text) + end + end) + end + + helpers.newtimer(string.format("alsabar-%s-%s", alsabar.cmd, alsabar.channel), timeout, alsabar.update) + + return alsabar +end + +return factory diff --git a/config/awesome/lain/widget/bat.lua b/config/awesome/lain/widget/bat.lua new file mode 100755 index 000000000..5a301b50a --- /dev/null +++ b/config/awesome/lain/widget/bat.lua @@ -0,0 +1,216 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local helpers = require("lain.helpers") +local fs = require("gears.filesystem") +local naughty = require("naughty") +local wibox = require("wibox") +local math = math +local string = string +local ipairs = ipairs +local tonumber = tonumber + +-- Battery infos +-- lain.widget.bat + +local function factory(args) + local pspath = args.pspath or "/sys/class/power_supply/" + + if not fs.is_dir(pspath) then + naughty.notify { text = "lain.widget.bat: invalid power supply path", timeout = 0 } + return + end + + local bat = { widget = wibox.widget.textbox() } + local args = args or {} + local timeout = args.timeout or 30 + local notify = args.notify or "on" + local n_perc = args.n_perc or { 5, 15 } + local batteries = args.batteries or (args.battery and {args.battery}) or {} + local ac = args.ac or "AC0" + local settings = args.settings or function() end + + function bat.get_batteries() + helpers.line_callback("ls -1 " .. pspath, function(line) + local bstr = string.match(line, "BAT%w+") + if bstr then + batteries[#batteries + 1] = bstr + else + ac = string.match(line, "A%w+") or "AC0" + end + end) + end + + if #batteries == 0 then bat.get_batteries() end + + bat_notification_critical_preset = { + title = "Battery exhausted", + text = "Shutdown imminent", + timeout = 15, + fg = "#000000", + bg = "#FFFFFF" + } + + bat_notification_low_preset = { + title = "Battery low", + text = "Plug the cable!", + timeout = 15, + fg = "#202020", + bg = "#CDCDCD" + } + + bat_notification_charged_preset = { + title = "Battery full", + text = "You can unplug the cable", + timeout = 15, + fg = "#202020", + bg = "#CDCDCD" + } + + bat_now = { + status = "N/A", + ac_status = "N/A", + perc = "N/A", + time = "N/A", + watt = "N/A" + } + + bat_now.n_status = {} + bat_now.n_perc = {} + for i = 1, #batteries do + bat_now.n_status[i] = "N/A" + bat_now.n_perc[i] = 0 + end + + -- used to notify full charge only once before discharging + local fullnotification = false + + function bat.update() + local sum_rate_current = 0 + local sum_rate_voltage = 0 + local sum_rate_power = 0 + local sum_rate_energy = 0 + local sum_energy_now = 0 + local sum_energy_full = 0 + + for i, battery in ipairs(batteries) do + local bstr = pspath .. battery + local present = helpers.first_line(bstr .. "/present") + + if tonumber(present) == 1 then + -- current_now(I)[uA], voltage_now(U)[uV], power_now(P)[uW] + local rate_current = tonumber(helpers.first_line(bstr .. "/current_now")) + local rate_voltage = tonumber(helpers.first_line(bstr .. "/voltage_now")) + local rate_power = tonumber(helpers.first_line(bstr .. "/power_now")) + + -- energy_now(P)[uWh], charge_now(I)[uAh] + local energy_now = tonumber(helpers.first_line(bstr .. "/energy_now") or + helpers.first_line(bstr .. "/charge_now")) + + -- energy_full(P)[uWh], charge_full(I)[uAh] + local energy_full = tonumber(helpers.first_line(bstr .. "/energy_full") or + helpers.first_line(bstr .. "/charge_full")) + + local energy_percentage = tonumber(helpers.first_line(bstr .. "/capacity")) or + math.floor((energy_now / energy_full) * 100) + + bat_now.n_status[i] = helpers.first_line(bstr .. "/status") or "N/A" + bat_now.n_perc[i] = energy_percentage or bat_now.n_perc[i] + + sum_rate_current = sum_rate_current + (rate_current or 0) + sum_rate_voltage = sum_rate_voltage + (rate_voltage or 0) + sum_rate_power = sum_rate_power + (rate_power or 0) + sum_rate_energy = sum_rate_energy + (rate_power or (((rate_voltage or 0) * (rate_current or 0)) / 1e6)) + sum_energy_now = sum_energy_now + (energy_now or 0) + sum_energy_full = sum_energy_full + (energy_full or 0) + end + end + + -- When one of the battery is charging, others' status are either + -- "Full", "Unknown" or "Charging". When the laptop is not plugged in, + -- one or more of the batteries may be full, but only one battery + -- discharging suffices to set global status to "Discharging". + bat_now.status = bat_now.n_status[1] + for _,status in ipairs(bat_now.n_status) do + if status == "Discharging" or status == "Charging" then + bat_now.status = status + end + end + bat_now.ac_status = tonumber(helpers.first_line(string.format("%s%s/online", pspath, ac))) or "N/A" + + if bat_now.status ~= "N/A" then + if bat_now.status ~= "Full" and sum_rate_power == 0 and bat_now.ac_status == 1 then + bat_now.perc = math.floor(math.min(100, (sum_energy_now / sum_energy_full) * 100)) + bat_now.time = "00:00" + bat_now.watt = 0 + + -- update {perc,time,watt} iff battery not full and rate > 0 + elseif bat_now.status ~= "Full" then + local rate_time = 0 + -- Calculate time and watt if rates are greater then 0 + if (sum_rate_power > 0 or sum_rate_current > 0) then + local div = (sum_rate_power > 0 and sum_rate_power) or sum_rate_current + + if bat_now.status == "Charging" then + rate_time = (sum_energy_full - sum_energy_now) / div + else -- Discharging + rate_time = sum_energy_now / div + end + + if 0 < rate_time and rate_time < 0.01 then -- check for magnitude discrepancies (#199) + rate_time_magnitude = math.abs(math.floor(math.log10(rate_time))) + rate_time = rate_time * 10^(rate_time_magnitude - 2) + end + end + + local hours = math.floor(rate_time) + local minutes = math.floor((rate_time - hours) * 60) + bat_now.perc = math.floor(math.min(100, (sum_energy_now / sum_energy_full) * 100)) + bat_now.time = string.format("%02d:%02d", hours, minutes) + bat_now.watt = tonumber(string.format("%.2f", sum_rate_energy / 1e6)) + elseif bat_now.status == "Full" then + bat_now.perc = 100 + bat_now.time = "00:00" + bat_now.watt = 0 + end + end + + widget = bat.widget + settings() + + -- notifications for critical, low, and full levels + if notify == "on" then + if bat_now.status == "Discharging" then + if tonumber(bat_now.perc) <= n_perc[1] then + bat.id = naughty.notify({ + preset = bat_notification_critical_preset, + replaces_id = bat.id + }).id + elseif tonumber(bat_now.perc) <= n_perc[2] then + bat.id = naughty.notify({ + preset = bat_notification_low_preset, + replaces_id = bat.id + }).id + end + fullnotification = false + elseif bat_now.status == "Full" and not fullnotification then + bat.id = naughty.notify({ + preset = bat_notification_charged_preset, + replaces_id = bat.id + }).id + fullnotification = true + end + end + end + + helpers.newtimer("batteries", timeout, bat.update) + + return bat +end + +return factory diff --git a/config/awesome/lain/widget/cal.lua b/config/awesome/lain/widget/cal.lua new file mode 100755 index 000000000..9b613bf6c --- /dev/null +++ b/config/awesome/lain/widget/cal.lua @@ -0,0 +1,130 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2018, Luca CPZ + +--]] + +local helpers = require("lain.helpers") +local markup = require("lain.util.markup") +local awful = require("awful") +local naughty = require("naughty") +local floor = math.floor +local os = os +local pairs = pairs +local string = string +local tconcat = table.concat +local tonumber = tonumber +local tostring = tostring + +-- Calendar notification +-- lain.widget.cal + +local function factory(args) + args = args or {} + local cal = { + attach_to = args.attach_to or {}, + week_start = args.week_start or 2, + three = args.three or false, + followtag = args.followtag or false, + icons = args.icons or helpers.icons_dir .. "cal/white/", + notification_preset = args.notification_preset or { + font = "Monospace 10", fg = "#FFFFFF", bg = "#000000" + } + } + + function cal.build(month, year) + local current_month, current_year = tonumber(os.date("%m")), tonumber(os.date("%Y")) + local is_current_month = (not month or not year) or (month == current_month and year == current_year) + local today = is_current_month and tonumber(os.date("%d")) -- otherwise nil and not highlighted + local t = os.time { year = year or current_year, month = month and month+1 or current_month+1, day = 0 } + local d = os.date("*t", t) + local mth_days, st_day, this_month = d.day, (d.wday-d.day-cal.week_start+1)%7, os.date("%B %Y", t) + local notifytable = { [1] = string.format("%s%s\n", string.rep(" ", floor((28 - this_month:len())/2)), markup.bold(this_month)) } + for x = 0,6 do notifytable[#notifytable+1] = os.date("%a ", os.time { year=2006, month=1, day=x+cal.week_start }) end + notifytable[#notifytable] = string.format("%s\n%s", notifytable[#notifytable]:sub(1, -2), string.rep(" ", st_day*4)) + for x = 1,mth_days do + local strx = x ~= today and x or markup.bold(markup.color(cal.notification_preset.bg, cal.notification_preset.fg, x) .. " ") + strx = string.format("%s%s", string.rep(" ", 3 - tostring(x):len()), strx) + notifytable[#notifytable+1] = string.format("%-4s%s", strx, (x+st_day)%7==0 and x ~= mth_days and "\n" or "") + end + if string.len(cal.icons or "") > 0 and today then cal.icon = cal.icons .. today .. ".png" end + cal.month, cal.year = d.month, d.year + return notifytable + end + + function cal.getdate(month, year, offset) + if not month or not year then + month = tonumber(os.date("%m")) + year = tonumber(os.date("%Y")) + end + + month = month + offset + + while month > 12 do + month = month - 12 + year = year + 1 + end + + while month < 1 do + month = month + 12 + year = year - 1 + end + + return month, year + end + + function cal.hide() + if not cal.notification then return end + naughty.destroy(cal.notification) + cal.notification = nil + end + + function cal.show(timeout, month, year, scr) + cal.notification_preset.text = tconcat(cal.build(month, year)) + + if cal.three then + local current_month, current_year = cal.month, cal.year + local prev_month, prev_year = cal.getdate(cal.month, cal.year, -1) + local next_month, next_year = cal.getdate(cal.month, cal.year, 1) + cal.notification_preset.text = string.format("%s\n\n%s\n\n%s", + tconcat(cal.build(prev_month, prev_year)), cal.notification_preset.text, + tconcat(cal.build(next_month, next_year))) + cal.month, cal.year = current_month, current_year + end + + cal.hide() + cal.notification = naughty.notify { + preset = cal.notification_preset, + screen = cal.followtag and awful.screen.focused() or scr or 1, + icon = cal.icon, + timeout = timeout or cal.notification_preset.timeout or 5 + } + end + + function cal.hover_on() cal.show(0) end + function cal.move(offset) + local offset = offset or 0 + cal.month, cal.year = cal.getdate(cal.month, cal.year, offset) + cal.show(0, cal.month, cal.year) + end + function cal.prev() cal.move(-1) end + function cal.next() cal.move( 1) end + + function cal.attach(widget) + widget:connect_signal("mouse::enter", cal.hover_on) + widget:connect_signal("mouse::leave", cal.hide) + widget:buttons(awful.util.table.join( + awful.button({}, 1, cal.prev), + awful.button({}, 3, cal.next), + awful.button({}, 2, cal.hover_on), + awful.button({}, 5, cal.prev), + awful.button({}, 4, cal.next))) + end + + for _, widget in pairs(cal.attach_to) do cal.attach(widget) end + + return cal +end + +return factory diff --git a/config/awesome/lain/widget/contrib/init.lua b/config/awesome/lain/widget/contrib/init.lua new file mode 100755 index 000000000..9e863a528 --- /dev/null +++ b/config/awesome/lain/widget/contrib/init.lua @@ -0,0 +1,18 @@ +--[[ + + Lain + Layouts, widgets and utilities for Awesome WM + + Users contributed widgets section + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + +--]] + +local wrequire = require("lain.helpers").wrequire +local setmetatable = setmetatable + +local widget = { _NAME = "lain.widget.contrib" } + +return setmetatable(widget, { __index = wrequire }) diff --git a/config/awesome/lain/widget/contrib/moc.lua b/config/awesome/lain/widget/contrib/moc.lua new file mode 100755 index 000000000..f429c7782 --- /dev/null +++ b/config/awesome/lain/widget/contrib/moc.lua @@ -0,0 +1,96 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2014, anticlockwise + +--]] + +local helpers = require("lain.helpers") +local shell = require("awful.util").shell +local focused = require("awful.screen").focused +local escape_f = require("awful.util").escape +local naughty = require("naughty") +local wibox = require("wibox") +local os = os +local string = string + +-- MOC audio player +-- lain.widget.contrib.moc + +local function factory(args) + local moc = { widget = wibox.widget.textbox() } + local args = args or {} + local timeout = args.timeout or 2 + local music_dir = args.music_dir or os.getenv("HOME") .. "/Music" + local cover_pattern = args.cover_pattern or "*\\.(jpg|jpeg|png|gif)$" + local cover_size = args.cover_size or 100 + local default_art = args.default_art or "" + local followtag = args.followtag or false + local settings = args.settings or function() end + + moc_notification_preset = { title = "Now playing", timeout = 6 } + + helpers.set_map("current moc track", nil) + + function moc.update() + helpers.async("mocp -i", function(f) + moc_now = { + state = "N/A", + file = "N/A", + artist = "N/A", + title = "N/A", + album = "N/A", + elapsed = "N/A", + total = "N/A" + } + + for line in string.gmatch(f, "[^\n]+") do + for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do + if k == "State" then moc_now.state = v + elseif k == "File" then moc_now.file = v + elseif k == "Artist" then moc_now.artist = escape_f(v) + elseif k == "SongTitle" then moc_now.title = escape_f(v) + elseif k == "Album" then moc_now.album = escape_f(v) + elseif k == "CurrentTime" then moc_now.elapsed = escape_f(v) + elseif k == "TotalTime" then moc_now.total = escape_f(v) + end + end + end + + moc_notification_preset.text = string.format("%s (%s) - %s\n%s", moc_now.artist, + moc_now.album, moc_now.total, moc_now.title) + widget = moc.widget + settings() + + if moc_now.state == "PLAY" then + if moc_now.title ~= helpers.get_map("current moc track") then + helpers.set_map("current moc track", moc_now.title) + + if followtag then moc_notification_preset.screen = focused() end + + local common = { + preset = moc_notification_preset, + icon = default_art, + icon_size = cover_size, + replaces_id = moc.id, + } + + local path = string.format("%s/%s", music_dir, string.match(moc_now.file, ".*/")) + local cover = string.format("find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'", path, cover_pattern) + helpers.async({ shell, "-c", cover }, function(current_icon) + common.icon = current_icon:gsub("\n", "") + moc.id = naughty.notify(common).id + end) + end + elseif moc_now.state ~= "PAUSE" then + helpers.set_map("current moc track", nil) + end + end) + end + + moc.timer = helpers.newtimer("moc", timeout, moc.update, true, true) + + return moc +end + +return factory diff --git a/config/awesome/lain/widget/contrib/redshift.lua b/config/awesome/lain/widget/contrib/redshift.lua new file mode 100755 index 000000000..d0e5eed77 --- /dev/null +++ b/config/awesome/lain/widget/contrib/redshift.lua @@ -0,0 +1,54 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2017, Luca CPZ + * (c) 2014, blueluke + +--]] + +local async = require("lain.helpers").async +local awful = require("awful") +local execute = os.execute +local type = type + +-- Redshift +-- lain.widget.contrib.redshift +local redshift = { active = false, pid = nil } + +function redshift:start() + execute("pkill redshift") + awful.spawn.with_shell("redshift -x") -- clear adjustments + redshift.pid = awful.spawn.with_shell("redshift") + redshift.active = true + if type(redshift.update_fun) == "function" then + redshift.update_fun(redshift.active) + end +end + +function redshift:toggle() + async({ awful.util.shell, "-c", string.format("ps -p %d -o pid=", redshift.pid) }, function(f) + if f and #f > 0 then -- redshift is running + -- Sending -USR1 toggles redshift (See project website) + execute("pkill -USR1 redshift") + redshift.active = not redshift.active + else -- not started or killed, (re)start it + redshift:start() + end + redshift.update_fun(redshift.active) + end) +end + +-- Attach to a widget +-- Provides a button which toggles redshift on/off on click +-- @param widget: Widget to attach to. +-- @param fun: Function to be run each time redshift is toggled (optional). +-- Use it to update widget text or icons on status change. +function redshift:attach(widget, fun) + redshift.update_fun = fun or function() end + if not redshift.pid then redshift:start() end + if widget then + widget:buttons(awful.util.table.join(awful.button({}, 1, function () redshift:toggle() end))) + end +end + +return redshift diff --git a/config/awesome/lain/widget/contrib/task.lua b/config/awesome/lain/widget/contrib/task.lua new file mode 100755 index 000000000..536e00630 --- /dev/null +++ b/config/awesome/lain/widget/contrib/task.lua @@ -0,0 +1,92 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Jan Xie + +--]] + +local helpers = require("lain.helpers") +local markup = require("lain.util").markup +local awful = require("awful") +local naughty = require("naughty") +local mouse = mouse +local string = string + +-- Taskwarrior notification +-- lain.widget.contrib.task +local task = {} + +function task.hide() + if not task.notification then return end + naughty.destroy(task.notification) + task.notification = nil +end + +function task.show(scr) + task.notification_preset.screen = task.followtag and awful.screen.focused() or scr or 1 + + helpers.async({ awful.util.shell, "-c", task.show_cmd }, function(f) + local widget_focused = true + + if mouse.current_widgets then + widget_focused = false + for _,v in ipairs(mouse.current_widgets) do + if task.widget == v then + widget_focused = true + break + end + end + end + + if widget_focused then + task.hide() + task.notification = naughty.notify { + preset = task.notification_preset, + title = "task next", + text = markup.font(task.notification_preset.font, + awful.util.escape(f:gsub("\n*$", ""))) + } + end + end) +end + +function task.prompt() + awful.prompt.run { + prompt = task.prompt_text, + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = function(t) + helpers.async(t, function(f) + naughty.notify { + preset = task.notification_preset, + title = t, + text = markup.font(task.notification_preset.font, + awful.util.escape(f:gsub("\n*$", ""))) + } + end) + end, + history_path = awful.util.getdir("cache") .. "/history_task" + } +end + +function task.attach(widget, args) + local args = args or {} + task.show_cmd = args.show_cmd or "task next" + task.prompt_text = args.prompt_text or "Enter task command: " + task.followtag = args.followtag or false + task.notification_preset = args.notification_preset + task.widget = widget + + if not task.notification_preset then + task.notification_preset = { + font = "Monospace 10", + icon = helpers.icons_dir .. "/taskwarrior.png" + } + end + + if widget then + widget:connect_signal("mouse::enter", function () task.show() end) + widget:connect_signal("mouse::leave", function () task.hide() end) + end +end + +return task diff --git a/config/awesome/lain/widget/contrib/tp_smapi.lua b/config/awesome/lain/widget/contrib/tp_smapi.lua new file mode 100755 index 000000000..4f43e44a8 --- /dev/null +++ b/config/awesome/lain/widget/contrib/tp_smapi.lua @@ -0,0 +1,146 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2018, Luca CPZ + * (c) 2013, Conor Heine + +--]] + +local helpers = require("lain.helpers") +local focused = require("awful.screen").focused +local gears = require("gears") +local naughty = require("naughty") +local wibox = require("wibox") +local string = string + +-- ThinkPad battery infos and widget creator +-- http://www.thinkwiki.org/wiki/Tp_smapi +-- lain.widget.contrib.tp_smapi + +local function factory(apipath) + local tp_smapi = { + path = apipath or "/sys/devices/platform/smapi" + } + + function tp_smapi.get(batid, feature) + return helpers.first_line(string.format("%s/%s/%s", tp_smapi.path, batid or "BAT0", feature or "")) + end + + function tp_smapi.installed(batid) + return tp_smapi.get(batid, "installed") == "1" + end + + function tp_smapi.status(batid) + return tp_smapi.get(batid, "state") + end + + function tp_smapi.percentage(batid) + return tp_smapi.get(batid, "remaining_percent") + end + + -- either running or charging time + function tp_smapi.time(batid) + local status = tp_smapi.status(batid) + local mins_left = tp_smapi.get(batid, string.match(string.lower(status), "discharging") and "remaining_running_time" or "remaining_charging_time") + if not string.find(mins_left, "^%d+") then return "N/A" end + return string.format("%02d:%02d", math.floor(mins_left / 60), mins_left % 60) -- HH:mm + end + + function tp_smapi.hide() + if not tp_smapi.notification then return end + naughty.destroy(tp_smapi.notification) + tp_smapi.notification = nil + end + + function tp_smapi.show(batid, seconds, scr) + if not tp_smapi.installed(batid) then return end + + local mfgr = tp_smapi.get(batid, "manufacturer") or "no_mfgr" + local model = tp_smapi.get(batid, "model") or "no_model" + local chem = tp_smapi.get(batid, "chemistry") or "no_chem" + local status = tp_smapi.get(batid, "state") + local time = tp_smapi.time(batid) + local msg = "" + + if status and status ~= "idle" then + msg = string.format("[%s] %s %s", status, time ~= "N/A" and time or "unknown remaining time", + string.lower(status):gsub(" ", ""):gsub("\n", "") == "charging" and " until charged" or " remaining") + else + msg = "On AC power" + end + + tp_smapi.hide() + tp_smapi.notification = naughty.notify { + title = string.format("%s: %s %s (%s)", batid, mfgr, model, chem), + text = msg, + timeout = seconds or 0, + screen = scr or focused() + } + end + + function tp_smapi.create_widget(args) + local args = args or {} + local pspath = args.pspath or "/sys/class/power_supply/" + local batteries = args.batteries or (args.battery and {args.battery}) or {} + local timeout = args.timeout or 30 + local settings = args.settings or function() end + + if #batteries == 0 then + helpers.line_callback("ls -1 " .. pspath, function(line) + local bstr = string.match(line, "BAT%w+") + if bstr then batteries[#batteries + 1] = bstr end + end) + end + + local all_batteries_installed = true + + for i, battery in ipairs(batteries) do + if not tp_smapi.installed(battery) then + naughty.notify { + preset = naughty.config.critical, + title = "tp_smapi: error while creating widget", + text = string.format("battery %s is not installed", battery) + } + all_batteries_installed = false + break + end + end + + if not all_batteries_installed then return end + + tpbat = { + batteries = batteries, + widget = args.widget or wibox.widget.textbox() + } + + function tpbat.update() + tpbat_now = { + n_status = {}, + n_perc = {}, + n_time = {}, + status = "N/A" + } + + for i = 1, #batteries do + tpbat_now.n_status[i] = tp_smapi.status(batteries[i]) or "N/A" + tpbat_now.n_perc[i] = tp_smapi.percentage(batteries[i]) + tpbat_now.n_time[i] = tp_smapi.time(batteries[i]) or "N/A" + + if not tpbat_now.n_status[i]:lower():match("full") then + tpbat_now.status = tpbat_now.n_status[i] + end + end + + widget = tpbat.widget -- backwards compatibility + settings() + end + + helpers.newtimer("thinkpad-batteries", timeout, tpbat.update) + + return tpbat + end + + return tp_smapi +end + +return factory diff --git a/config/awesome/lain/widget/cpu.lua b/config/awesome/lain/widget/cpu.lua new file mode 100755 index 000000000..81638c280 --- /dev/null +++ b/config/awesome/lain/widget/cpu.lua @@ -0,0 +1,77 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local helpers = require("lain.helpers") +local wibox = require("wibox") +local math = math +local string = string +local tostring = tostring + +-- CPU usage +-- lain.widget.cpu + +local function factory(args) + local cpu = { core = {}, widget = wibox.widget.textbox() } + local args = args or {} + local timeout = args.timeout or 2 + local settings = args.settings or function() end + + function cpu.update() + -- Read the amount of time the CPUs have spent performing + -- different kinds of work. Read the first line of /proc/stat + -- which is the sum of all CPUs. + local times = helpers.lines_match("cpu","/proc/stat") + + for index,time in pairs(times) do + local coreid = index - 1 + local core = cpu.core[coreid] or + { last_active = 0 , last_total = 0, usage = 0 } + local at = 1 + local idle = 0 + local total = 0 + + for field in string.gmatch(time, "[%s]+([^%s]+)") do + -- 4 = idle, 5 = ioWait. Essentially, the CPUs have done + -- nothing during these times. + if at == 4 or at == 5 then + idle = idle + field + end + total = total + field + at = at + 1 + end + + local active = total - idle + + if core.last_active ~= active or core.last_total ~= total then + -- Read current data and calculate relative values. + local dactive = active - core.last_active + local dtotal = total - core.last_total + local usage = math.ceil((dactive / dtotal) * 100) + + core.last_active = active + core.last_total = total + core.usage = usage + + -- Save current data for the next run. + cpu.core[coreid] = core + end + end + + cpu_now = cpu.core + cpu_now.usage = cpu_now[0].usage + widget = cpu.widget + + settings() + end + + helpers.newtimer("cpu", timeout, cpu.update) + + return cpu +end + +return factory diff --git a/config/awesome/lain/widget/fs.lua b/config/awesome/lain/widget/fs.lua new file mode 100755 index 000000000..d1b7a971a --- /dev/null +++ b/config/awesome/lain/widget/fs.lua @@ -0,0 +1,143 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2018, Uli Schlacter + * (c) 2018, Otto Modinos + * (c) 2013, Luca CPZ + +--]] + +local helpers = require("lain.helpers") +local Gio = require("lgi").Gio +local focused = require("awful.screen").focused +local wibox = require("wibox") +local naughty = require("naughty") +local math = math +local string = string +local tconcat = table.concat +local tonumber = tonumber +local query_size = Gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE +local query_free = Gio.FILE_ATTRIBUTE_FILESYSTEM_FREE +local query_used = Gio.FILE_ATTRIBUTE_FILESYSTEM_USED +local query = query_size .. "," .. query_free .. "," .. query_used + +-- File systems info +-- lain.widget.fs + +local function factory(args) + local fs = { + widget = wibox.widget.textbox(), + units = { + [1] = "Kb", [2] = "Mb", [3] = "Gb", + [4] = "Tb", [5] = "Pb", [6] = "Eb", + [7] = "Zb", [8] = "Yb" + } + } + + function fs.hide() + if not fs.notification then return end + naughty.destroy(fs.notification) + fs.notification = nil + end + + function fs.show(seconds, scr) + fs.hide(); fs.update() + fs.notification_preset.screen = fs.followtag and focused() or scr or 1 + fs.notification = naughty.notify { + preset = fs.notification_preset, + timeout = seconds or 5 + } + end + + local args = args or {} + local timeout = args.timeout or 600 + local partition = args.partition + local threshold = args.threshold or 99 + local showpopup = args.showpopup or "on" + local settings = args.settings or function() end + + fs.followtag = args.followtag or false + fs.notification_preset = args.notification_preset + + if not fs.notification_preset then + fs.notification_preset = { + font = "Monospace 10", + fg = "#FFFFFF", + bg = "#000000" + } + end + + function fs.update() + local notifytable = { [1] = string.format("%-10s %-5s %s\t%s\t\n", "path", "used", "free", "size") } + local pathlen = 10 + fs_now = {} + + for _, mount in ipairs(Gio.unix_mounts_get()) do + local path = Gio.unix_mount_get_mount_path(mount) + local root = Gio.File.new_for_path(path) + local info = root:query_filesystem_info(query) + + if info then + local size = info:get_attribute_uint64(query_size) + local used = info:get_attribute_uint64(query_used) + local free = info:get_attribute_uint64(query_free) + + if size > 0 then + local units = math.floor(math.log(size)/math.log(1024)) + + fs_now[path] = { + units = fs.units[units], + percentage = math.floor(100 * used / size), -- used percentage + size = size / math.pow(1024, math.floor(units)), + used = used / math.pow(1024, math.floor(units)), + free = free / math.pow(1024, math.floor(units)) + } + + if fs_now[path].percentage > 0 then -- don't notify unused file systems + notifytable[#notifytable+1] = string.format("\n%-10s %-5s %.2f\t%.2f\t%s", path, + fs_now[path].percentage .. "%", fs_now[path].free, fs_now[path].size, + fs_now[path].units) + + pathlen = math.max(pathlen, #path) + end + end + end + end + + widget = fs.widget + settings() + + if partition and fs_now[partition] and fs_now[partition].percentage >= threshold then + if not helpers.get_map(partition) then + naughty.notify { + preset = naughty.config.presets.critical, + title = "Warning", + text = string.format("%s is above %d%% (%d%%)", partition, threshold, fs_now[partition].percentage) + } + helpers.set_map(partition, true) + else + helpers.set_map(partition, false) + end + end + + if pathlen > 10 then -- formatting aesthetics + for i = 1, #notifytable do + local pathspaces = notifytable[i]:match("/%w*[/%w*]*%s*") or notifytable[i]:match("path%s*") + notifytable[i] = notifytable[i]:gsub(pathspaces, pathspaces .. string.rep(" ", pathlen - 10) .. "\t") + end + end + + fs.notification_preset.text = tconcat(notifytable) + end + + if showpopup == "on" then + fs.widget:connect_signal('mouse::enter', function () fs.show(0) end) + fs.widget:connect_signal('mouse::leave', function () fs.hide() end) + end + + helpers.newtimer(partition or "fs", timeout, fs.update) + + return fs +end + +return factory diff --git a/config/awesome/lain/widget/imap.lua b/config/awesome/lain/widget/imap.lua new file mode 100755 index 000000000..b3d9dc7d0 --- /dev/null +++ b/config/awesome/lain/widget/imap.lua @@ -0,0 +1,93 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + +--]] + +local helpers = require("lain.helpers") +local naughty = require("naughty") +local wibox = require("wibox") +local awful = require("awful") +local string = string +local type = type +local tonumber = tonumber + +-- Mail IMAP check +-- lain.widget.imap + +local function factory(args) + local imap = { widget = wibox.widget.textbox() } + local args = args or {} + local server = args.server + local mail = args.mail + local password = args.password + local port = args.port or 993 + local timeout = args.timeout or 60 + local pwdtimeout = args.pwdtimeout or 10 + local is_plain = args.is_plain or false + local followtag = args.followtag or false + local notify = args.notify or "on" + local settings = args.settings or function() end + + local head_command = "curl --connect-timeout 3 -fsm 3" + local request = "-X 'STATUS INBOX (MESSAGES RECENT UNSEEN)'" + + if not server or not mail or not password then return end + + mail_notification_preset = { + icon = helpers.icons_dir .. "mail.png", + position = "top_left" + } + + helpers.set_map(mail, 0) + + if not is_plain then + if type(password) == "string" or type(password) == "table" then + helpers.async(password, function(f) password = f:gsub("\n", "") end) + elseif type(password) == "function" then + imap.pwdtimer = helpers.newtimer(mail .. "-password", pwdtimeout, function() + local retrieved_password, try_again = password() + if not try_again then + imap.pwdtimer:stop() -- stop trying to retrieve + password = retrieved_password or "" -- failsafe + end + end, true, true) + end + end + + function imap.update() + -- do not update if the password has not been retrieved yet + if type(password) ~= "string" then return end + + local curl = string.format("%s --url imaps://%s:%s/INBOX -u %s:'%s' %s -k", + head_command, server, port, mail, password, request) + + helpers.async(curl, function(f) + imap_now = { ["MESSAGES"] = 0, ["RECENT"] = 0, ["UNSEEN"] = 0 } + + for s,d in f:gmatch("(%w+)%s+(%d+)") do imap_now[s] = tonumber(d) end + mailcount = imap_now["UNSEEN"] -- backwards compatibility + widget = imap.widget + + settings() + + if notify == "on" and mailcount and mailcount >= 1 and mailcount > helpers.get_map(mail) then + if followtag then mail_notification_preset.screen = awful.screen.focused() end + naughty.notify { + preset = mail_notification_preset, + text = string.format("%s has %d new message%s", mail, mailcount, mailcount == 1 and "" or "s") + } + end + + helpers.set_map(mail, imap_now["UNSEEN"]) + end) + + end + + imap.timer = helpers.newtimer(mail, timeout, imap.update, true, true) + + return imap +end + +return factory diff --git a/config/awesome/lain/widget/init.lua b/config/awesome/lain/widget/init.lua new file mode 100755 index 000000000..57b86bb98 --- /dev/null +++ b/config/awesome/lain/widget/init.lua @@ -0,0 +1,19 @@ +--[[ + + Lain + Layouts, widgets and utilities for Awesome WM + + Widgets section + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local wrequire = require("lain.helpers").wrequire +local setmetatable = setmetatable + +local widget = { _NAME = "lain.widget" } + +return setmetatable(widget, { __index = wrequire }) diff --git a/config/awesome/lain/widget/mem.lua b/config/awesome/lain/widget/mem.lua new file mode 100755 index 000000000..3dcae2b7d --- /dev/null +++ b/config/awesome/lain/widget/mem.lua @@ -0,0 +1,50 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local helpers = require("lain.helpers") +local wibox = require("wibox") +local gmatch, lines, floor = string.gmatch, io.lines, math.floor + +-- Memory usage (ignoring caches) +-- lain.widget.mem + +local function factory(args) + local mem = { widget = wibox.widget.textbox() } + local args = args or {} + local timeout = args.timeout or 2 + local settings = args.settings or function() end + + function mem.update() + mem_now = {} + for line in lines("/proc/meminfo") do + for k, v in gmatch(line, "([%a]+):[%s]+([%d]+).+") do + if k == "MemTotal" then mem_now.total = floor(v / 1024 + 0.5) + elseif k == "MemFree" then mem_now.free = floor(v / 1024 + 0.5) + elseif k == "Buffers" then mem_now.buf = floor(v / 1024 + 0.5) + elseif k == "Cached" then mem_now.cache = floor(v / 1024 + 0.5) + elseif k == "SwapTotal" then mem_now.swap = floor(v / 1024 + 0.5) + elseif k == "SwapFree" then mem_now.swapf = floor(v / 1024 + 0.5) + elseif k == "SReclaimable" then mem_now.srec = floor(v / 1024 + 0.5) + end + end + end + + mem_now.used = mem_now.total - mem_now.free - mem_now.buf - mem_now.cache - mem_now.srec + mem_now.swapused = mem_now.swap - mem_now.swapf + mem_now.perc = math.floor(mem_now.used / mem_now.total * 100) + + widget = mem.widget + settings() + end + + helpers.newtimer("mem", timeout, mem.update) + + return mem +end + +return factory diff --git a/config/awesome/lain/widget/mpd.lua b/config/awesome/lain/widget/mpd.lua new file mode 100755 index 000000000..01f28e633 --- /dev/null +++ b/config/awesome/lain/widget/mpd.lua @@ -0,0 +1,132 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010, Adrian C. + +--]] + +local helpers = require("lain.helpers") +local shell = require("awful.util").shell +local escape_f = require("awful.util").escape +local focused = require("awful.screen").focused +local naughty = require("naughty") +local wibox = require("wibox") +local os = os +local string = string + +-- MPD infos +-- lain.widget.mpd + +local function factory(args) + local mpd = { widget = wibox.widget.textbox() } + local args = args or {} + local timeout = args.timeout or 2 + local password = (args.password and #args.password > 0 and string.format("password %s\\n", args.password)) or "" + local host = args.host or os.getenv("MPD_HOST") or "127.0.0.1" + local port = args.port or os.getenv("MPD_PORT") or "6600" + local music_dir = args.music_dir or os.getenv("HOME") .. "/Music" + local cover_pattern = args.cover_pattern or "*\\.(jpg|jpeg|png|gif)$" + local cover_size = args.cover_size or 100 + local default_art = args.default_art + local notify = args.notify or "on" + local followtag = args.followtag or false + local settings = args.settings or function() end + + local mpdh = string.format("telnet://%s:%s", host, port) + local echo = string.format("printf \"%sstatus\\ncurrentsong\\nclose\\n\"", password) + local cmd = string.format("%s | curl --connect-timeout 1 -fsm 3 %s", echo, mpdh) + + mpd_notification_preset = { title = "Now playing", timeout = 6 } + + helpers.set_map("current mpd track", nil) + + function mpd.update() + helpers.async({ shell, "-c", cmd }, function(f) + mpd_now = { + random_mode = false, + single_mode = false, + repeat_mode = false, + consume_mode = false, + pls_pos = "N/A", + pls_len = "N/A", + state = "N/A", + file = "N/A", + name = "N/A", + artist = "N/A", + title = "N/A", + album = "N/A", + genre = "N/A", + track = "N/A", + date = "N/A", + time = "N/A", + elapsed = "N/A" + } + + for line in string.gmatch(f, "[^\n]+") do + for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do + if k == "state" then mpd_now.state = v + elseif k == "file" then mpd_now.file = v + elseif k == "Name" then mpd_now.name = escape_f(v) + elseif k == "Artist" then mpd_now.artist = escape_f(v) + elseif k == "Title" then mpd_now.title = escape_f(v) + elseif k == "Album" then mpd_now.album = escape_f(v) + elseif k == "Genre" then mpd_now.genre = escape_f(v) + elseif k == "Track" then mpd_now.track = escape_f(v) + elseif k == "Date" then mpd_now.date = escape_f(v) + elseif k == "Time" then mpd_now.time = v + elseif k == "elapsed" then mpd_now.elapsed = string.match(v, "%d+") + elseif k == "song" then mpd_now.pls_pos = v + elseif k == "playlistlength" then mpd_now.pls_len = v + elseif k == "repeat" then mpd_now.repeat_mode = v ~= "0" + elseif k == "single" then mpd_now.single_mode = v ~= "0" + elseif k == "random" then mpd_now.random_mode = v ~= "0" + elseif k == "consume" then mpd_now.consume_mode = v ~= "0" + end + end + end + + mpd_notification_preset.text = string.format("%s (%s) - %s\n%s", mpd_now.artist, + mpd_now.album, mpd_now.date, mpd_now.title) + widget = mpd.widget + settings() + + if mpd_now.state == "play" then + if notify == "on" and mpd_now.title ~= helpers.get_map("current mpd track") then + helpers.set_map("current mpd track", mpd_now.title) + + if followtag then mpd_notification_preset.screen = focused() end + + local common = { + preset = mpd_notification_preset, + icon = default_art, + icon_size = cover_size, + replaces_id = mpd.id + } + + if not string.match(mpd_now.file, "http.*://") then -- local file instead of http stream + local path = string.format("%s/%s", music_dir, string.match(mpd_now.file, ".*/")) + local cover = string.format("find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'", + path:gsub("'", "'\\''"), cover_pattern) + helpers.async({ shell, "-c", cover }, function(current_icon) + common.icon = current_icon:gsub("\n", "") + if #common.icon == 0 then common.icon = nil end + mpd.id = naughty.notify(common).id + end) + else + mpd.id = naughty.notify(common).id + end + + end + elseif mpd_now.state ~= "pause" then + helpers.set_map("current mpd track", nil) + end + end) + end + + mpd.timer = helpers.newtimer("mpd", timeout, mpd.update, true, true) + + return mpd +end + +return factory diff --git a/config/awesome/lain/widget/net.lua b/config/awesome/lain/widget/net.lua new file mode 100755 index 000000000..805b5778f --- /dev/null +++ b/config/awesome/lain/widget/net.lua @@ -0,0 +1,113 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local helpers = require("lain.helpers") +local naughty = require("naughty") +local wibox = require("wibox") +local string = string + +-- Network infos +-- lain.widget.net + +local function factory(args) + local net = { widget = wibox.widget.textbox(), devices = {} } + local args = args or {} + local timeout = args.timeout or 2 + local units = args.units or 1024 -- KB + local notify = args.notify or "on" + local wifi_state = args.wifi_state or "off" + local eth_state = args.eth_state or "off" + local screen = args.screen or 1 + local settings = args.settings or function() end + + -- Compatibility with old API where iface was a string corresponding to 1 interface + net.iface = (args.iface and (type(args.iface) == "string" and {args.iface}) or + (type(args.iface) == "table" and args.iface)) or {} + + function net.get_device() + helpers.line_callback("ip link", function(line) + net.iface[#net.iface + 1] = not string.match(line, "LOOPBACK") and string.match(line, "(%w+): <") or nil + end) + end + + if #net.iface == 0 then net.get_device() end + + function net.update() + -- These are the totals over all specified interfaces + net_now = { + devices = {}, + -- Bytes since last iteration + sent = 0, + received = 0 + } + + for _, dev in ipairs(net.iface) do + local dev_now = {} + local dev_before = net.devices[dev] or { last_t = 0, last_r = 0 } + local now_t = tonumber(helpers.first_line(string.format("/sys/class/net/%s/statistics/tx_bytes", dev)) or 0) + local now_r = tonumber(helpers.first_line(string.format("/sys/class/net/%s/statistics/rx_bytes", dev)) or 0) + + dev_now.carrier = helpers.first_line(string.format("/sys/class/net/%s/carrier", dev)) or "0" + dev_now.state = helpers.first_line(string.format("/sys/class/net/%s/operstate", dev)) or "down" + + dev_now.sent = (now_t - dev_before.last_t) / timeout / units + dev_now.received = (now_r - dev_before.last_r) / timeout / units + + net_now.sent = net_now.sent + dev_now.sent + net_now.received = net_now.received + dev_now.received + + dev_now.sent = string.format("%.1f", dev_now.sent) + dev_now.received = string.format("%.1f", dev_now.received) + + dev_now.last_t = now_t + dev_now.last_r = now_r + + if wifi_state == "on" and helpers.first_line(string.format("/sys/class/net/%s/uevent", dev)) == "DEVTYPE=wlan" and string.match(dev_now.carrier, "1") then + dev_now.wifi = true + dev_now.signal = tonumber(string.match(helpers.lines_from("/proc/net/wireless")[3], "(%-%d+%.)")) or nil + end + + if eth_state == "on" and helpers.first_line(string.format("/sys/class/net/%s/uevent", dev)) ~= "DEVTYPE=wlan" and string.match(dev_now.carrier, "1") then + dev_now.ethernet = true + end + + net.devices[dev] = dev_now + + -- Notify only once when connection is lost + if string.match(dev_now.carrier, "0") and notify == "on" and helpers.get_map(dev) then + naughty.notify { + title = dev, + text = "No carrier", + icon = helpers.icons_dir .. "no_net.png", + screen = screen + } + helpers.set_map(dev, false) + elseif string.match(dev_now.carrier, "1") then + helpers.set_map(dev, true) + end + + net_now.carrier = dev_now.carrier + net_now.state = dev_now.state + net_now.devices[dev] = dev_now + -- net_now.sent and net_now.received will be + -- the totals across all specified devices + end + + net_now.sent = string.format("%.1f", net_now.sent) + net_now.received = string.format("%.1f", net_now.received) + + widget = net.widget + settings() + end + + helpers.newtimer("network", timeout, net.update) + + return net +end + +return factory diff --git a/config/awesome/lain/widget/pulse.lua b/config/awesome/lain/widget/pulse.lua new file mode 100755 index 000000000..f63fe55c3 --- /dev/null +++ b/config/awesome/lain/widget/pulse.lua @@ -0,0 +1,57 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2016, Luca CPZ + +--]] + +local helpers = require("lain.helpers") +local shell = require("awful.util").shell +local wibox = require("wibox") +local string = string +local type = type + +-- PulseAudio volume +-- lain.widget.pulse + +local function factory(args) + local pulse = { widget = wibox.widget.textbox(), device = "N/A" } + local args = args or {} + local timeout = args.timeout or 5 + local settings = args.settings or function() end + + pulse.devicetype = args.devicetype or "sink" + pulse.cmd = args.cmd or "pacmd list-" .. pulse.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'" + + function pulse.update() + helpers.async({ shell, "-c", type(pulse.cmd) == "string" and pulse.cmd or pulse.cmd() }, + function(s) + volume_now = { + index = string.match(s, "index: (%S+)") or "N/A", + device = string.match(s, "device.string = \"(%S+)\"") or "N/A", + muted = string.match(s, "muted: (%S+)") or "N/A" + } + + pulse.device = volume_now.index + + local ch = 1 + volume_now.channel = {} + for v in string.gmatch(s, ":.-(%d+)%%") do + volume_now.channel[ch] = v + ch = ch + 1 + end + + volume_now.left = volume_now.channel[1] or "N/A" + volume_now.right = volume_now.channel[2] or "N/A" + + widget = pulse.widget + settings() + end) + end + + helpers.newtimer("pulse", timeout, pulse.update) + + return pulse +end + +return factory diff --git a/config/awesome/lain/widget/pulsebar.lua b/config/awesome/lain/widget/pulsebar.lua new file mode 100755 index 000000000..317468f46 --- /dev/null +++ b/config/awesome/lain/widget/pulsebar.lua @@ -0,0 +1,162 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2013, Rman + +--]] + +local helpers = require("lain.helpers") +local awful = require("awful") +local naughty = require("naughty") +local wibox = require("wibox") +local math = math +local string = string +local type = type +local tonumber = tonumber + +-- PulseAudio volume bar +-- lain.widget.pulsebar + +local function factory(args) + local pulsebar = { + colors = { + background = "#000000", + mute = "#EB8F8F", + unmute = "#A4CE8A" + }, + + _current_level = 0, + _mute = "no", + device = "N/A" + } + + local args = args or {} + local timeout = args.timeout or 5 + local settings = args.settings or function() end + local width = args.width or 63 + local height = args.height or 1 + local margins = args.margins or 1 + local paddings = args.paddings or 1 + local ticks = args.ticks or false + local ticks_size = args.ticks_size or 7 + + pulsebar.colors = args.colors or pulsebar.colors + pulsebar.followtag = args.followtag or false + pulsebar.notification_preset = args.notification_preset + pulsebar.devicetype = args.devicetype or "sink" + pulsebar.cmd = args.cmd or "pacmd list-" .. pulsebar.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'" + + if not pulsebar.notification_preset then + pulsebar.notification_preset = { + font = "Monospace 10" + } + end + + pulsebar.bar = wibox.widget { + color = pulsebar.colors.unmute, + background_color = pulsebar.colors.background, + forced_height = height, + forced_width = width, + margins = margins, + paddings = paddings, + ticks = ticks, + ticks_size = ticks_size, + widget = wibox.widget.progressbar, + } + + pulsebar.tooltip = awful.tooltip({ objects = { pulsebar.bar } }) + + function pulsebar.update(callback) + helpers.async({ awful.util.shell, "-c", type(pulsebar.cmd) == "string" and pulsebar.cmd or pulsebar.cmd() }, + function(s) + volume_now = { + index = string.match(s, "index: (%S+)") or "N/A", + device = string.match(s, "device.string = \"(%S+)\"") or "N/A", + muted = string.match(s, "muted: (%S+)") or "N/A" + } + + pulsebar.device = volume_now.index + + local ch = 1 + volume_now.channel = {} + for v in string.gmatch(s, ":.-(%d+)%%") do + volume_now.channel[ch] = v + ch = ch + 1 + end + + volume_now.left = volume_now.channel[1] or "N/A" + volume_now.right = volume_now.channel[2] or "N/A" + + local volu = volume_now.left + local mute = volume_now.muted + + if volu:match("N/A") or mute:match("N/A") then return end + + if volu ~= pulsebar._current_level or mute ~= pulsebar._mute then + pulsebar._current_level = tonumber(volu) + pulsebar.bar:set_value(pulsebar._current_level / 100) + if pulsebar._current_level == 0 or mute == "yes" then + pulsebar._mute = mute + pulsebar.tooltip:set_text ("[muted]") + pulsebar.bar.color = pulsebar.colors.mute + else + pulsebar._mute = "no" + pulsebar.tooltip:set_text(string.format("%s %s: %s", pulsebar.devicetype, pulsebar.device, volu)) + pulsebar.bar.color = pulsebar.colors.unmute + end + + settings() + + if type(callback) == "function" then callback() end + end + end) + end + + function pulsebar.notify() + pulsebar.update(function() + local preset = pulsebar.notification_preset + + preset.title = string.format("%s %s - %s%%", pulsebar.devicetype, pulsebar.device, pulsebar._current_level) + + if pulsebar._mute == "yes" then + preset.title = preset.title .. " muted" + end + + -- tot is the maximum number of ticks to display in the notification + -- fallback: default horizontal wibox height + local wib, tot = awful.screen.focused().mywibox, 20 + + -- if we can grab mywibox, tot is defined as its height if + -- horizontal, or width otherwise + if wib then + if wib.position == "left" or wib.position == "right" then + tot = wib.width + else + tot = wib.height + end + end + + int = math.modf((pulsebar._current_level / 100) * tot) + preset.text = string.format("[%s%s]", string.rep("|", int), + string.rep(" ", tot - int)) + + if pulsebar.followtag then preset.screen = awful.screen.focused() end + + if not pulsebar.notification then + pulsebar.notification = naughty.notify { + preset = preset, + destroy = function() pulsebar.notification = nil end + } + else + naughty.replace_text(pulsebar.notification, preset.title, preset.text) + end + end) + end + + helpers.newtimer(string.format("pulsebar-%s", pulsebar.sink), timeout, pulsebar.update) + + return pulsebar +end + +return factory diff --git a/config/awesome/lain/widget/sysload.lua b/config/awesome/lain/widget/sysload.lua new file mode 100755 index 000000000..adf3e035b --- /dev/null +++ b/config/awesome/lain/widget/sysload.lua @@ -0,0 +1,38 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + * (c) 2010-2012, Peter Hofmann + +--]] + +local helpers = require("lain.helpers") +local wibox = require("wibox") +local open, match = io.open, string.match + +-- System load +-- lain.widget.sysload + +local function factory(args) + local sysload = { widget = wibox.widget.textbox() } + local args = args or {} + local timeout = args.timeout or 2 + local settings = args.settings or function() end + + function sysload.update() + local f = open("/proc/loadavg") + local ret = f:read("*all") + f:close() + + load_1, load_5, load_15 = match(ret, "([^%s]+) ([^%s]+) ([^%s]+)") + + widget = sysload.widget + settings() + end + + helpers.newtimer("sysload", timeout, sysload.update) + + return sysload +end + +return factory diff --git a/config/awesome/lain/widget/temp.lua b/config/awesome/lain/widget/temp.lua new file mode 100755 index 000000000..3c93252b1 --- /dev/null +++ b/config/awesome/lain/widget/temp.lua @@ -0,0 +1,41 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2013, Luca CPZ + +--]] + +local helpers = require("lain.helpers") +local wibox = require("wibox") +local open = io.open +local tonumber = tonumber + +-- coretemp +-- lain.widget.temp + +local function factory(args) + local temp = { widget = wibox.widget.textbox() } + local args = args or {} + local timeout = args.timeout or 2 + local tempfile = args.tempfile or "/sys/class/thermal/thermal_zone0/temp" + local settings = args.settings or function() end + + function temp.update() + local f = open(tempfile) + if f then + coretemp_now = tonumber(f:read("*all")) / 1000 + f:close() + else + coretemp_now = "N/A" + end + + widget = temp.widget + settings() + end + + helpers.newtimer("coretemp", timeout, temp.update) + + return temp +end + +return factory diff --git a/config/awesome/lain/widget/weather.lua b/config/awesome/lain/widget/weather.lua new file mode 100755 index 000000000..f35ca68b2 --- /dev/null +++ b/config/awesome/lain/widget/weather.lua @@ -0,0 +1,160 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2015, Luca CPZ + +--]] + +local helpers = require("lain.helpers") +local json = require("lain.util").dkjson +local focused = require("awful.screen").focused +local naughty = require("naughty") +local wibox = require("wibox") +local math = math +local os = os +local string = string +local tonumber = tonumber + +-- OpenWeatherMap +-- current weather and X-days forecast +-- lain.widget.weather + +local function factory(args) + local weather = { widget = wibox.widget.textbox() } + local args = args or {} + local APPID = args.APPID or "3e321f9414eaedbfab34983bda77a66e" -- lain's default + local timeout = args.timeout or 60 * 15 -- 15 min + local timeout_forecast = args.timeout or 60 * 60 * 24 -- 24 hrs + local current_call = args.current_call or "curl -s 'http://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s&APPID=%s'" + local forecast_call = args.forecast_call or "curl -s 'http://api.openweathermap.org/data/2.5/forecast/daily?id=%s&units=%s&lang=%s&cnt=%s&APPID=%s'" + local city_id = args.city_id or 0 -- placeholder + local units = args.units or "metric" + local lang = args.lang or "en" + local cnt = args.cnt or 5 + local date_cmd = args.date_cmd or "date -u -d @%d +'%%a %%d'" + local icons_path = args.icons_path or helpers.icons_dir .. "openweathermap/" + local notification_preset = args.notification_preset or {} + local notification_text_fun = args.notification_text_fun or + function (wn) + local day = os.date("%a %d", wn["dt"]) + local tmin = math.floor(wn["temp"]["min"]) + local tmax = math.floor(wn["temp"]["max"]) + local desc = wn["weather"][1]["description"] + return string.format("%s: %s, %d - %d ", day, desc, tmin, tmax) + end + local weather_na_markup = args.weather_na_markup or " N/A " + local followtag = args.followtag or false + local showpopup = args.showpopup or "on" + local settings = args.settings or function() end + + weather.widget:set_markup(weather_na_markup) + weather.icon_path = icons_path .. "na.png" + weather.icon = wibox.widget.imagebox(weather.icon_path) + + function weather.show(t_out) + weather.hide() + + if followtag then + notification_preset.screen = focused() + end + + if not weather.notification_text then + weather.update() + weather.forecast_update() + end + + weather.notification = naughty.notify({ + text = weather.notification_text, + icon = weather.icon_path, + timeout = t_out, + preset = notification_preset + }) + end + + function weather.hide() + if weather.notification then + naughty.destroy(weather.notification) + weather.notification = nil + end + end + + function weather.attach(obj) + obj:connect_signal("mouse::enter", function() + weather.show(0) + end) + obj:connect_signal("mouse::leave", function() + weather.hide() + end) + end + + function weather.forecast_update() + local cmd = string.format(forecast_call, city_id, units, lang, cnt, APPID) + helpers.async(cmd, function(f) + local pos, err + weather_now, pos, err = json.decode(f, 1, nil) + + if not err and type(weather_now) == "table" and tonumber(weather_now["cod"]) == 200 then + weather.notification_text = "" + for i = 1, weather_now["cnt"] do + weather.notification_text = weather.notification_text .. + notification_text_fun(weather_now["list"][i]) + if i < weather_now["cnt"] then + weather.notification_text = weather.notification_text .. "\n" + end + end + end + end) + end + + function weather.update() + local cmd = string.format(current_call, city_id, units, lang, APPID) + helpers.async(cmd, function(f) + local pos, err, icon + weather_now, pos, err = json.decode(f, 1, nil) + + if not err and type(weather_now) == "table" and tonumber(weather_now["cod"]) == 200 then + local sunrise = tonumber(weather_now["sys"]["sunrise"]) + local sunset = tonumber(weather_now["sys"]["sunset"]) + local icon = weather_now["weather"][1]["icon"] + local loc_now = os.time() -- local time + local loc_m = os.time { year = os.date("%Y"), month = os.date("%m"), day = os.date("%d"), hour = 0 } -- local time from midnight + local loc_d = os.date("*t", loc_now) -- table YMDHMS for current local time (for TZ calculation) + local utc_d = os.date("!*t", loc_now) -- table YMDHMS for current UTC time + local utc_now = os.time(utc_d) -- UTC time now + local offdt = (loc_d.isdst and 1 or 0) * 3600 + 100 * (loc_d.min - utc_d.min) / 60 -- DST offset + local offset = os.difftime(loc_now, utc_now) + (loc_d.isdst and 1 or 0) * 3600 + 100 * (loc_d.min - utc_d.min) / 60 -- TZ offset (including DST) + local offday = (offset < 0 and -86400) or 86400 -- 24 hour correction value (+86400 or -86400) + + -- if current UTC time is earlier then local midnight -> positive offset (negative otherwise) + if offset * (loc_m - utc_now + offdt) > 0 then + sunrise = sunrise + offday -- Shift sunset and sunrise times by 24 hours + sunset = sunset + offday + end + + if sunrise <= loc_now and loc_now <= sunset then + icon = string.gsub(icon, "n", "d") + else + icon = string.gsub(icon, "d", "n") + end + + weather.icon_path = icons_path .. icon .. ".png" + widget = weather.widget + settings() + else + weather.icon_path = icons_path .. "na.png" + weather.widget:set_markup(weather_na_markup) + end + + weather.icon:set_image(weather.icon_path) + end) + end + + if showpopup == "on" then weather.attach(weather.widget) end + + weather.timer = helpers.newtimer("weather-" .. city_id, timeout, weather.update, false, true) + weather.timer_forecast = helpers.newtimer("weather_forecast-" .. city_id, timeout, weather.forecast_update, false, true) + + return weather +end + +return factory diff --git a/config/awesome/lain/wiki/Home.md b/config/awesome/lain/wiki/Home.md new file mode 100755 index 000000000..d098efe32 --- /dev/null +++ b/config/awesome/lain/wiki/Home.md @@ -0,0 +1,43 @@ +Welcome to the Lain wiki! + +If you spot a typo or have a suggestion to improve these pages, please notify me opening an [issue](https://github.com/lcpz/lain/issues) format. Thank you. + +Dependencies +------------ + +Package | Requested by | Reasons of choice +--- | --- | --- +[curl](https://curl.haxx.se) | `imap`, `mpd`, and `weather` widgets | 1. faster and simpler to use than [LuaSocket](https://github.com/diegonehab/luasocket); 2. it's in the core of almost every distro; 3. can be called [asynchronously](https://awesomewm.org/doc/api/libraries/awful.spawn.html#easy_async) +GLib >= 2.54 | `fs` widget | Pure Awesome/Lua implementation. + +The second dependency will be removed once all major distros update their Gio/Glib versions. + +Installation +------------ + +### Arch Linux + +[AUR package](https://aur.archlinux.org/packages/lain-git/) + +### Other distributions + +```shell +git clone https://github.com/lcpz/lain.git ~/.config/awesome/lain +``` + +Also available via [LuaRocks](https://luarocks.org/modules/aajjbb/lain). + +Usage +-------- + +First, include it into your `rc.lua`: + +```lua +local lain = require("lain") +``` + +Then check out the submodules you want: + +- [Layouts](https://github.com/lcpz/lain/wiki/Layouts) +- [Widgets](https://github.com/lcpz/lain/wiki/Widgets) +- [Utilities](https://github.com/lcpz/lain/wiki/Utilities) diff --git a/config/awesome/lain/wiki/Layouts.md b/config/awesome/lain/wiki/Layouts.md new file mode 100755 index 000000000..0286d4b51 --- /dev/null +++ b/config/awesome/lain/wiki/Layouts.md @@ -0,0 +1,255 @@ + + lain/layout + . + |-- termfair + |-- termfair.center + |-- cascade + |-- cascade.tile + |-- centerwork + |-- centerwork.horizontal + +Usage +===== + +As usual, specify your favourites in `awful.layout.layouts`, or set them on specific tags with [`awful.layout.set`](https://awesomewm.org/doc/api/libraries/awful.layout.html#set). + +```lua +awful.layout.set(lain.layout.termfair, tag) +``` + +How do layouts work? +==================== + +`termfair` +-------- + +This layout restricts the size of each window. Each window will have the +same width but is variable in height. Furthermore, windows are +left-aligned. The basic workflow is as follows (the number above the +screen is the number of open windows, the number in a cell is the fixed +number of a client): + + (1) (2) (3) + +---+---+---+ +---+---+---+ +---+---+---+ + | | | | | | | | | | | | + | 1 | | | -> | 2 | 1 | | -> | 3 | 2 | 1 | -> + | | | | | | | | | | | | + +---+---+---+ +---+---+---+ +---+---+---+ + + (4) (5) (6) + +---+---+---+ +---+---+---+ +---+---+---+ + | 4 | | | | 5 | 4 | | | 6 | 5 | 4 | + +---+---+---+ -> +---+---+---+ -> +---+---+---+ + | 3 | 2 | 1 | | 3 | 2 | 1 | | 3 | 2 | 1 | + +---+---+---+ +---+---+---+ +---+---+---+ + +The first client will be located in the left column. When opening +another window, this new window will be placed in the left column while +moving the first window into the middle column. Once a row is full, +another row above it will be created. + +Default number of columns and rows are respectively taken from `nmaster` +and `ncol` values in `awful.tag`, but you can set your own. + +For example, this sets `termfair` to 3 columns and at least 1 row: + +```lua +lain.layout.termfair.nmaster = 3 +lain.layout.termfair.ncol = 1 +``` + +`termfair.center` +---------- + +Similar to `termfair`, but with fixed number of vertical columns. Cols are centerded until there are `nmaster` columns, then windows are stacked as slaves, with possibly `ncol` clients per column at most. + + (1) (2) (3) + +---+---+---+ +-+---+---+-+ +---+---+---+ + | | | | | | | | | | | | | + | | 1 | | -> | | 1 | 2 | | -> | 1 | 2 | 3 | -> + | | | | | | | | | | | | | + +---+---+---+ +-+---+---+-+ +---+---+---+ + + (4) (5) + +---+---+---+ +---+---+---+ + | | | 3 | | | 2 | 4 | + + 1 + 2 +---+ -> + 1 +---+---+ + | | | 4 | | | 3 | 5 | + +---+---+---+ +---+---+---+ + +Like `termfair`, default number of columns and rows are respectively taken from `nmaster` +and `ncol` values in `awful.tag`, but you can set your own. + +For example, this sets `termfair.center` to 3 columns and at least 1 row: + +```lua +lain.layout.termfair.center.nmaster = 3 +lain.layout.termfair.center.ncol = 1 +``` + +`cascade` +------- + +Cascade all windows of a tag. + +You can control the offsets by setting these two variables: + +```lua +lain.layout.cascade.offset_x = 64 +lain.layout.cascade.offset_y = 16 +``` + +The following reserves space for 5 windows: + +```lua +lain.layout.cascade.nmaster = 5 +``` + +That is, no window will get resized upon the creation of a new window, +unless there's more than 5 windows. + +`cascade.tile` +----------- + +Similar to `awful.layout.suit.tile` layout, however, clients in the slave +column are cascaded instead of tiled. + +Left column size can be set, otherwise is controlled by `mwfact` of the +tag. Additional windows will be opened in another column on the right. +New windows are placed above old windows. + +Whether the slave column is placed on top of the master window or not is +controlled by the value of `ncol`. A value of 1 means "overlapping slave column" +and anything else means "don't overlap windows". + +Usage example: + +```lua +lain.layout.cascade.tile.offset_x = 2 +lain.layout.cascade.tile.offset_y = 32 +lain.layout.cascade.tile.extra_padding = 5 +lain.layout.cascade.tile.nmaster = 5 +lain.layout.cascade.tile.ncol = 2 +``` + +`extra_padding` reduces the size of the master window if "overlapping +slave column" is activated. This allows you to see if there are any +windows in your slave column. + +Setting `offset_x` to a very small value or even 0 is recommended to avoid wasting space. + +`centerwork` +---------- + +You start with one window, centered horizontally: + + +--------------------------+ + | +----------+ | + | | | | + | | | | + | | | | + | | MAIN | | + | | | | + | | | | + | | | | + | | | | + | +----------+ | + +--------------------------+ + +This is your main working window. You do most of the work right here. +Sometimes, you may want to open up additional windows. They're put on left and right, alternately. + + +--------------------------+ + | +---+ +----------+ +---+ | + | | | | | | | | + | | | | | | | | + | | | | | | | | + | +---+ | MAIN | +---+ | + | +---+ | | +---+ | + | | | | | | | | + | | | | | | | | + | | | | | | | | + | +---+ +----------+ +---+ | + +--------------------------+ + +*Please note:* If you use Awesome's default configuration, navigation in +this layout may be very confusing. How do you get from the main window +to satellite ones depends on the order in which the windows are opened. +Thus, use of `awful.client.focus.bydirection()` is suggested. +Here's an example: + +```lua +globalkeys = awful.util.table.join( + -- [...] + awful.key({ modkey }, "j", + function() + awful.client.focus.bydirection("down") + if client.focus then client.focus:raise() end + end), + awful.key({ modkey }, "k", + function() + awful.client.focus.bydirection("up") + if client.focus then client.focus:raise() end + end), + awful.key({ modkey }, "h", + function() + awful.client.focus.bydirection("left") + if client.focus then client.focus:raise() end + end), + awful.key({ modkey }, "l", + function() + awful.client.focus.bydirection("right") + if client.focus then client.focus:raise() end + end), + -- [...] +) +``` + +`centerwork.horizontal` +----------- + +Same as `centerwork`, except that the main +window expands horizontally, and the additional windows +are put ontop/below it. Useful if you have a screen turned 90°. + +Pre 4.0 `uselesstile` patches +============================= + +In branch 3.5, this module provided useless gaps layouts. Since useless gaps have been implemented in Awesome 4.0, those layouts have been removed. + +Following are a couple of `uselesstile` variants that were not part of lain. They are kept only for reference and are not supported. + +Xmonad-like +----------- + +If you want to have `awful.layout.suit.tile` behave like xmonad, with internal gaps two times wider than external ones, download [this](https://gist.github.com/lcpz/9e56dcfbe66bfe14967c) as `lain/layout/uselesstile`. + +Inverted master +--------------- + +Want to invert master window position? Use [this](https://gist.github.com/lcpz/c59dc59c9f99d98218eb) version. You can set `single_gap` with `width` and `height` in your `theme.lua`, in order to define the window geometry when there's only one client, otherwise it goes maximized. An example: + + theme.single_gap = { width = 600, height = 100 } + +What about layout icons? +======================== + +They are located in ``lain/icons/layout``. + +To use them, define new `layout_*` variables in your ``theme.lua``. For instance: + +```lua +theme.lain_icons = os.getenv("HOME") .. + "/.config/awesome/lain/icons/layout/default/" +theme.layout_termfair = theme.lain_icons .. "termfair.png" +theme.layout_centerfair = theme.lain_icons .. "centerfair.png" -- termfair.center +theme.layout_cascade = theme.lain_icons .. "cascade.png" +theme.layout_cascadetile = theme.lain_icons .. "cascadetile.png" -- cascade.tile +theme.layout_centerwork = theme.lain_icons .. "centerwork.png" +theme.layout_centerworkh = theme.lain_icons .. "centerworkh.png" -- centerwork.horizontal +``` + +Credit goes to [Nicolas Estibals](https://github.com/nestibal) for creating +layout icons for default theme. + +You can use them as a template for your custom versions. \ No newline at end of file diff --git a/config/awesome/lain/wiki/Utilities.md b/config/awesome/lain/wiki/Utilities.md new file mode 100755 index 000000000..dd54056f0 --- /dev/null +++ b/config/awesome/lain/wiki/Utilities.md @@ -0,0 +1,338 @@ +Quake +----- + +A Quake-like dropdown container for your favourite application. + +**Usage** + +Define it globally to have a single instance for all screens: + +```lua +local quake = lain.util.quake() +``` + +or define it in `connect_for_each_screen` to have one instance for each screen: + +```lua +awful.screen.connect_for_each_screen(function(s) + -- Quake application + s.quake = lain.util.quake() + -- [...] +``` + +**Keybinding example** + +If using a global instance: +```lua +awful.key({ modkey, }, "z", function () quake:toggle() end), +``` + +If using a per-screen instance: +```lua +awful.key({ modkey, }, "z", function () awful.screen.focused().quake:toggle() end), +``` + +**Input table** + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`app` | client to spawn | string | "xterm" +`name` | client name | string | "QuakeDD" +`argname` | how to specify client name | string | "-name %s" +`extra` | extra `app` arguments | string | empty string +`border` | border width | integer | 1 +`visible` | initially visible | boolean | false +`followtag` | always spawn on currently focused screen | boolean | false +`overlap` | Overlap the wibox or not | boolean | false +`settings` | Additional settings to make on the client | function | `nil` +`screen` | screen where to spawn the client | integer | `awful.screen.focused()` +`height` | dropdown client height | float in [0,1] or exact pixels number | 0.25 +`width` | dropdown client width | float in [0,1] or exact pixels number | 1 +`vert` | vertical position | string, possible values: "top", "bottom", "center" | "top" +`horiz` | horizontal position | string, possible values: "left", "right", "center" | "left" + +`height` and `width` express a fraction of the workspace. + +`settings` is a function which takes the client as input, and can be used to customize its properties. For instance: + +```lua +-- set the client sticky +s.quake = lain.util.quake { settings = function(c) c.sticky = true end } +``` + +Read [here](https://awesomewm.org/doc/api/classes/client.html#Object_properties) for the complete list of properties. + +**Notes** + +* [Does not work](https://github.com/lcpz/lain/issues/358) with `gnome-terminal`, `konsole`, or any other terminal which is strictly designed for a Desktop Environment. Just pick a better terminal, [there's plenty](https://wiki.archlinux.org/index.php/List_of_applications#Terminal_emulators). +* Set `followtag = true` if [experiencing issues with multiple screens](https://github.com/lcpz/lain/issues/346). +* If you have a `awful.client.setslave` rule for your application, ensure you use an exception for `QuakeDD` (or your defined `name`). Otherwise, you may run into problems with focus. +* If you are using a VTE-based terminal like `termite`, be sure to set [`argname = "--name %s"`](https://github.com/lcpz/lain/issues/211). + +Separators +---------- + +Adds Cairo separators. + +```lua +local separators = lain.util.separators +``` + +A separator function `separators.separator` takes two color arguments, defined as strings. `"alpha"` argument is allowed. Example: + +```lua +arrl_dl = separators.arrow_left(beautiful.bg_focus, "alpha") +arrl_ld = separators.arrow_left("alpha", beautiful.bg_focus) +``` + +You can customize height and width by setting `separators_height` and `separators_width` in your `theme.lua`. Default values are 0 and 9, respectively. + +List of functions: + + +-- separators + | + |`-- arrow_right() Draw a right arrow. + `-- arrow_left() Draw a left arrow. + +markup +------ + +Mades markup easier. + +```lua +local markup = lain.util.markup +``` + +List of functions: + + +-- markup + | + |`-- bold() Set bold. + |`-- italic() Set italicized text. + |`-- strike() Set strikethrough text. + |`-- underline() Set underlined text. + |`-- monospace() Set monospaced text. + |`-- big() Set bigger text. + |`-- small() Set smaller text. + |`-- font() Set the font of the text. + |`-- font() Set the font of the text. + |`-- color() Set background and foreground color. + |`-- fontfg() Set font and foreground color. + |`-- fontbg() Set font and background color. + `-- fontcolor() Set font, plus background and foreground colors. + | + |`--+ bg + | | + | `-- color() Set background color. + | + `--+ fg + | + `-- color() Set foreground color. + +they all take one argument, which is the text to markup, except the following: + +```lua +markup.font(font, text) +markup.color(fg, bg, text) +markup.fontfg(font, fg, text) +markup.fontbg(font, bg, text) +markup.fontcolor(font, fg, bg, text) +markup.fg.color(color, text) +markup.bg.color(color, text) +``` + +Dynamic tagging +--------------- + +That is: + +- add a new tag; +- rename current tag; +- move current tag; +- delete current tag. + +If you delete a tag, any rule set on it shall be broken, so be careful. + +Use it with key bindings like these: + +```lua +awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag(mylayout) end), +awful.key({ modkey, "Shift" }, "r", function () lain.util.rename_tag() end), +awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(1) end), -- move to next tag +awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(-1) end), -- move to previous tag +awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end), +``` + +The argument in `lain.util.add_tag` represents the tag layout, and is optional: if not present, it will be defaulted to `awful.layout.suit.tile`. + +Useless gaps resize +--------------------- + +Changes `beautiful.useless_gaps` on the fly. + +```lua +lain.util.useless_gap_resize(thatmuch, s, t) +``` + +The argument `thatmuch` is the number of pixel to add to/substract from gaps (integer). + +The arguments `s` and `t` are the `awful.screen` and `awful.tag` in which you want to change the gap. They are optional. + +Following are example keybindings for changing client gaps on current screen and tag. + +Example 1: + +```lua +-- On the fly useless gaps change +awful.key({ altkey, "Control" }, "+", function () lain.util.useless_gaps_resize(1) end), +awful.key({ altkey, "Control" }, "-", function () lain.util.useless_gaps_resize(-1) end), +``` + +where `altkey = Mod1`. Example 2: + +```lua +mywidget:buttons(awful.util.table.join ( + awful.button({}, 4, function() lain.util.useless_gaps_resize(-1) end), + awful.button({}, 5, function() lain.util.useless_gaps_resize(1) end) + end) +)) +``` + +so when hovering the mouse over `mywidget`, you can adjust useless gaps size by scrolling with the mouse wheel. + +tag\_view\_nonempty +------------------- + +This function lets you jump to the next/previous non-empty tag. +It takes two arguments: + +* `direction`: `1` for next non-empty tag, `-1` for previous. +* `sc`: Screen which the taglist is in. Default is `mouse.screen` or `1`. This + argument is optional. + +You can use it with key bindings like these: + +```lua +-- Non-empty tag browsing +awful.key({ altkey }, "Left", function () lain.util.tag_view_nonempty(-1) end), +awful.key({ altkey }, "Right", function () lain.util.tag_view_nonempty(1) end), +``` + +where `altkey = "Mod1"`. + +magnify\_client +--------------- + +Set a client to floating and resize it in the same way the "magnifier" +layout does it. Place it on the "current" screen (derived from the mouse +position). This allows you to magnify any client you wish, regardless of +the currently used layout. Use it with a client keybinding like this: + +```lua +clientkeys = awful.util.table.join( + -- [...] + awful.key({ modkey, "Control" }, "m", lain.util.magnify_client), + -- [...] +) +``` + +If you want to "de-magnify" it, just retype the keybinding. + +If you want magnified client to respond to `incmwfact`, read [here](https://github.com/lcpz/lain/issues/195). + +menu\_clients\_current\_tags +---------------------------- + +Similar to `awful.menu.clients`, but this menu only shows the clients +of currently visible tags. Use it with a key binding like this: + +```lua +awful.key({ "Mod1" }, "Tab", function() + lain.util.menu_clients_current_tags({ width = 350 }, { keygrabber = true }) +end), +``` + +menu\_iterator +-------------- + +A generic menu utility which enables iteration over lists of possible +actions to execute. The perfect example is a menu for choosing what +configuration to apply to X with `xrandr`, as suggested on the [Awesome wiki page](https://awesomewm.org/recipes/xrandr). + +

+ +
An example Synergy menu, courtesy of sim590 +

+ +You can either manually create a menu by defining a table in this format: + +```lua +{ { "choice description 1", callbackFuction1 }, { "choice description 2", callbackFunction2 }, ... } +``` + +or use `util.menu_iterator.menu`. Once you have your menu, use it with `lain.menu_iterator.iterate`. + +### Input tables + +**lain.menu_iterator.iterate** + +| Argument | Description | Type +|---|---| --- +| `menu` | the menu to iterate on | table +| `timeout` | time (in seconds) to wait on a choice before the choice is accepted | integer (default: 4) +| `icon` | path to the icon to display in `naughty.notify` window | string + +**lain.menu_iterator.menu** + +| Argument | Description | Type +|---|---| --- +`choices` | list of choices (e.g., `{ "choice1", "choice2", ... }`) | array of strings +`name` | name of the program related to this menu | string +`selected_cb` | callback to execute for each selected choice, it takes one choice (string) as argument; can be `nil` (no action to execute) | function +`rejected_cb` | callback to execute for all rejected choices (the remaining choices, once one is selected), it takes one choice (string) as argument; can be `nil` (no action to execute) | function +`extra_choices` | more choices to be added to the menu; unlike `choices`, these ones won't trigger `rejected_cb` | array of `{ choice, callback }` pairs, where `choice` is a string and `callback` is a function +`combination` | how choices have to be combined in the menu; possible values are: "single" (default), the set of possible choices will simply be the input set ; "powerset", the set of possible choices will be the [power set](https://en.wikipedia.org/wiki/Power_set) of the input set | string + +### Examples + +A simple example is: + +```lua +local mymenu_iterable = lain.util.menu_iterator.menu { + choices = {"My first choice", "My second choice"}, + name = "My awesome program", + selected_cb = function(choice) + -- do something with selected choice + end, + rejected_cb = function(choice) + -- do something with every rejected choice + end +} +``` + +The variable `mymenu_iterable` is a menu compatible with the function `lain.util.menu_iterator.iterate`, which will iterate over it and displays notification with `naughty.notify` every time it is called. You can use it like this: + +```lua +local confirm_timeout = 5 -- time to wait before confirming the menu selection +local my_notify_icon = "/path/to/icon" -- the icon to display in the notification +lain.util.menu_iterator.iterate(mymenu_iterable, confirm_timeout, my_notify_icon) +``` + +Once `confirm_timeout` has passed without anymore calls to `iterate`, the choice is made and the associated callbacks (both for selected and rejected choices) are spawned. + +A useful practice is to add a `Cancel` option as an extra choice for canceling a menu selection. Extending the above example: + +```lua +local mymenu_iterable = lain.util.menu_iterator.menu { + choices = {"My first choice", "My second choice"}, + name = "My awesome program", + selected_cb = function(choice) + -- do something with selected choice + end, + rejected_cb = function(choice) + -- do something with every rejected choice + end + -- nil means no action to do + extra_choices = { {"Cancel"}, nil } +} +``` diff --git a/config/awesome/lain/wiki/Widgets.md b/config/awesome/lain/wiki/Widgets.md new file mode 100755 index 000000000..34f518df6 --- /dev/null +++ b/config/awesome/lain/wiki/Widgets.md @@ -0,0 +1,55 @@ +# Usage + +Every lain widget is a table. + +A lain widget is generated by a `function`. + +The `function` signature, input and output arguments can be found in the [related wiki entry](https://github.com/lcpz/lain/wiki/Widgets#index). + +Every lain widget contains a `wibox.widget`, which is updated by a timed function. To access the widget, use the field `widget`, while to access the timed function, use the field `update`. Some lain widgets may also have an `icon` field, which is a `wibox.widget.imagebox`, and/or a `timer` field, which is the `gears.timer` on `update`. + +Every `function` may take either a table or a list of variables as input. + +If the input is a table, you must define a function variable called `settings` in it. There you will be able to define `widget` appearance. + +For instance, if `widget` is a textbox, to markup it call `widget:set_markup(...)` within `settings`. + +In the scope of `settings` you can use predefined arguments, which are specified in the wiki entries. + +Example of a lain widget: + +```lua +local cpu = lain.widget.cpu { + settings = function() + widget:set_markup("Cpu " .. cpu_now.usage) + end +} +-- to access the widget: cpu.widget +``` + +If you want to see some applications, check [awesome-copycats](https://github.com/lcpz/awesome-copycats). + +# Index + +- [alsa](https://github.com/lcpz/lain/wiki/alsa) +- [alsabar](https://github.com/lcpz/lain/wiki/alsabar) +- [bat](https://github.com/lcpz/lain/wiki/bat) +- [cal](https://github.com/lcpz/lain/wiki/cal) +- [cpu](https://github.com/lcpz/lain/wiki/cpu) +- [fs](https://github.com/lcpz/lain/wiki/fs) +- [imap](https://github.com/lcpz/lain/wiki/imap) +- [mem](https://github.com/lcpz/lain/wiki/mem) +- [mpd](https://github.com/lcpz/lain/wiki/mpd) +- [net](https://github.com/lcpz/lain/wiki/net) +- [pulse](https://github.com/lcpz/lain/wiki/pulse) +- [pulsebar](https://github.com/lcpz/lain/wiki/pulsebar) +- [sysload](https://github.com/lcpz/lain/wiki/sysload) +- [temp](https://github.com/lcpz/lain/wiki/temp) +- [weather](https://github.com/lcpz/lain/wiki/weather) + +## Users contributed + +- [moc](https://github.com/lcpz/lain/wiki/moc) +- [redshift](https://github.com/lcpz/lain/wiki/redshift) +- [task](https://github.com/lcpz/lain/wiki/task) +- [tp_smapi](https://github.com/lcpz/lain/wiki/tp_smapi) diff --git a/config/awesome/lain/wiki/_Footer.md b/config/awesome/lain/wiki/_Footer.md new file mode 100755 index 000000000..b64f13bfd --- /dev/null +++ b/config/awesome/lain/wiki/_Footer.md @@ -0,0 +1 @@ +[Home](https://github.com/lcpz/lain/wiki) • [Layouts](https://github.com/lcpz/lain/wiki/Layouts) • [Widgets](https://github.com/lcpz/lain/wiki/Widgets) • [Utilities](https://github.com/lcpz/lain/wiki/Utilities) diff --git a/config/awesome/lain/wiki/_Sidebar.md b/config/awesome/lain/wiki/_Sidebar.md new file mode 100755 index 000000000..0289783a8 --- /dev/null +++ b/config/awesome/lain/wiki/_Sidebar.md @@ -0,0 +1,26 @@ +* [Home](https://github.com/lcpz/lain/wiki/Home) +* [Layouts](https://github.com/lcpz/lain/wiki/Layouts) + * [Usage](https://github.com/lcpz/lain/wiki/Layouts#Usage) + * [How do layouts work?](https://github.com/lcpz/lain/wiki/Layouts#how-do-layouts-work) + * [termfair](https://github.com/lcpz/lain/wiki/Layouts#termfair) + * [centerfair](https://github.com/lcpz/lain/wiki/Layouts#termfaircenter) + * [cascade](https://github.com/lcpz/lain/wiki/Layouts#cascade) + * [cascadetile](https://github.com/lcpz/lain/wiki/Layouts#cascadetile) + * [centerwork](https://github.com/lcpz/lain/wiki/Layouts#centerwork) + * [centerworkh](https://github.com/lcpz/lain/wiki/Layouts#centerworkhorizontal) + * [Pre 4.0 uselesstile patches](https://github.com/lcpz/lain/wiki/Layouts#pre-40-uselesstile-patches) + * [What about layout icons?](https://github.com/lcpz/lain/wiki/Layouts#what-about-layout-icons) +* [Widgets](https://github.com/lcpz/lain/wiki/Widgets) + * [Usage](https://github.com/lcpz/lain/wiki/Widgets#usage) + * [Index](https://github.com/lcpz/lain/wiki/Widgets#index) + * [Users contributed](https://github.com/lcpz/lain/wiki/Widgets#users-contributed) +* [Utilities](https://github.com/lcpz/lain/wiki/Utilities) + * [quake](https://github.com/lcpz/lain/wiki/Utilities#quake) + * [separators](https://github.com/lcpz/lain/wiki/Utilities#separators) + * [markup](https://github.com/lcpz/lain/wiki/Utilities#markup) + * [dynamic tagging](https://github.com/lcpz/lain/wiki/Utilities#dynamic-tagging) + * [useless_gaps_resize](https://github.com/lcpz/lain/wiki/Utilities#useless-gaps-resize) + * [tag_view_non_empty](https://github.com/lcpz/lain/wiki/Utilities#tag_view_nonempty) + * [magnify_client](https://github.com/lcpz/lain/wiki/Utilities#magnify_client) + * [menu_clients_current_tags](https://github.com/lcpz/lain/wiki/Utilities#menu_clients_current_tags) + * [menu_iterator](https://github.com/lcpz/lain/wiki/Utilities#menu_iterator) diff --git a/config/awesome/lain/wiki/alsa.md b/config/awesome/lain/wiki/alsa.md new file mode 100755 index 000000000..6882fcb17 --- /dev/null +++ b/config/awesome/lain/wiki/alsa.md @@ -0,0 +1,136 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows ALSA volume. + +```lua +local volume = lain.widget.alsa() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 5 +`cmd` | Alsa mixer command | string | "amixer" +`channel` | Mixer channel | string | "Master" +`togglechannel` | Toggle channel | string | `nil` +`settings` | User settings | function | empty function + +`cmd` is useful if you need to pass additional arguments to amixer. For instance, you may want to define `cmd = "amixer -c X"` in order to set amixer with card `X`. + +`settings` can use the following variables: + +Variable | Meaning | Type | Values +--- | --- | --- | --- +`volume_now.level` | Volume level | integer | 0-100 +`volume_now.status` | Device status | string | "on", "off" + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`channel` | ALSA channel | string +`update` | Update `widget` | function + +## Toggle channel + +In case mute toggling can't be mapped to master channel (this happens, for instance, when you are using an HDMI output), define togglechannel as your S/PDIF device. You can get the device ID with `scontents` command. + +For instance, if card number is 1 and S/PDIF number is 3: + +```shell +$ amixer -c 1 scontents +Simple mixer control 'Master',0 + Capabilities: volume + Playback channels: Front Left - Front Right + Capture channels: Front Left - Front Right + Limits: 0 - 255 + Front Left: 255 [100%] + Front Right: 255 [100%] +Simple mixer control 'IEC958',0 + Capabilities: pswitch pswitch-joined + Playback channels: Mono + Mono: Playback [on] +Simple mixer control 'IEC958',1 + Capabilities: pswitch pswitch-joined + Playback channels: Mono + Mono: Playback [on] +Simple mixer control 'IEC958',2 + Capabilities: pswitch pswitch-joined + Playback channels: Mono + Mono: Playback [on] +Simple mixer control 'IEC958',3 + Capabilities: pswitch pswitch-joined + Playback channels: Mono + Mono: Playback [on] +``` + +you have to set `togglechannel = "IEC958,3"`. + +## Buttons + +If you want buttons, just add the following after your widget in `rc.lua`. + +```lua +volume.widget:buttons(awful.util.table.join( + awful.button({}, 1, function() -- left click + awful.spawn(string.format("%s -e alsamixer", terminal)) + end), + awful.button({}, 2, function() -- middle click + os.execute(string.format("%s set %s 100%%", volume.cmd, volume.channel)) + volume.update() + end), + awful.button({}, 3, function() -- right click + os.execute(string.format("%s set %s toggle", volume.cmd, volume.togglechannel or volume.channel)) + volume.update() + end), + awful.button({}, 4, function() -- scroll up + os.execute(string.format("%s set %s 1%%+", volume.cmd, volume.channel)) + volume.update() + end), + awful.button({}, 5, function() -- scroll down + os.execute(string.format("%s set %s 1%%-", volume.cmd, volume.channel)) + volume.update() + end) +)) +``` + +## Keybindings + +You can control the widget with keybindings like these: + +```lua +-- ALSA volume control +awful.key({ altkey }, "Up", + function () + os.execute(string.format("amixer set %s 1%%+", volume.channel)) + volume.update() + end), +awful.key({ altkey }, "Down", + function () + os.execute(string.format("amixer set %s 1%%-", volume.channel)) + volume.update() + end), +awful.key({ altkey }, "m", + function () + os.execute(string.format("amixer set %s toggle", volume.togglechannel or volume.channel)) + volume.update() + end), +awful.key({ altkey, "Control" }, "m", + function () + os.execute(string.format("amixer set %s 100%%", volume.channel)) + volume.update() + end), +awful.key({ altkey, "Control" }, "0", + function () + os.execute(string.format("amixer set %s 0%%", volume.channel)) + volume.update() + end), +``` + +where `altkey = "Mod1"`. diff --git a/config/awesome/lain/wiki/alsabar.md b/config/awesome/lain/wiki/alsabar.md new file mode 100755 index 000000000..f16b14ffc --- /dev/null +++ b/config/awesome/lain/wiki/alsabar.md @@ -0,0 +1,102 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows ALSA volume with a progressbar; provides tooltips and notifications. + +```lua +local volume = lain.widget.alsabar() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 5 +`settings` | User settings | function | empty function +`width` | Bar width | number | 63 +`height` | Bar height | number | 1 +`margins` | Bar margins | number | 1 +`paddings` | Bar paddings | number | 1 +`ticks` | Set bar ticks on | boolean | false +`ticks_size` | Ticks size | integer | 7 +`cmd` | ALSA mixer command | string | "amixer" +`channel` | Mixer channel | string | "Master" +`togglechannel` | Toggle channel | string | `nil` +`colors` | Bar colors | table | see [Default colors](https://github.com/lcpz/lain/wiki/alsabar#default-colors) +`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/alsabar#default-notification_preset) +`followtag` | Display the notification on currently focused screen | boolean | false + +`cmd` is useful if you need to pass additional arguments to `amixer`. For instance, you may want to define `cmd = "amixer -c X"` in order to set amixer with card `X`. + +In case mute toggling can't be mapped to master channel (this happens, for instance, when you are using an HDMI output), define `togglechannel` as your S/PDIF device. Read [`alsa`](https://github.com/lcpz/lain/wiki/alsa#toggle-channel) page to know how. + +`settings` can use the following variables: + +Variable | Meaning | Type | Values +--- | --- | --- | --- +`volume_now.level` | Volume level | integer | 0-100 +`volume_now.status` | Device status | string | "on", "off" + +With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +### Default colors + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`background` | Bar backgrund color | string | "#000000" +`mute` | Bar mute color | string | "#EB8F8F" +`unmute` | Bar unmute color | string | "#A4CE8A" + +### Default `notification_preset` + +```lua +notification_preset = { + font = "Monospace 10" +} +``` + + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`bar` | The widget | `wibox.widget.progressbar` +`channel` | ALSA channel | string +`notify` | The notification | function +`update` | Update `bar` | function +`tooltip` | The tooltip | `awful.tooltip` + +## Buttons + +If you want buttons, just add the following after your widget in `rc.lua`. + +```lua +volume.bar:buttons(awful.util.table.join( + awful.button({}, 1, function() -- left click + awful.spawn(string.format("%s -e alsamixer", terminal)) + end), + awful.button({}, 2, function() -- middle click + os.execute(string.format("%s set %s 100%%", volume.cmd, volume.channel)) + volume.update() + end), + awful.button({}, 3, function() -- right click + os.execute(string.format("%s set %s toggle", volume.cmd, volume.togglechannel or volume.channel)) + volume.update() + end), + awful.button({}, 4, function() -- scroll up + os.execute(string.format("%s set %s 1%%+", volume.cmd, volume.channel)) + volume.update() + end), + awful.button({}, 5, function() -- scroll down + os.execute(string.format("%s set %s 1%%-", volume.cmd, volume.channel)) + volume.update() + end) +)) +``` + +## Keybindings + +Read [here](https://github.com/lcpz/lain/wiki/alsa#keybindings). If you want notifications, use `volume.notify()` instead of `volume.update()`. diff --git a/config/awesome/lain/wiki/bat.md b/config/awesome/lain/wiki/bat.md new file mode 100755 index 000000000..b7d6cd1f0 --- /dev/null +++ b/config/awesome/lain/wiki/bat.md @@ -0,0 +1,99 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows the remaining time and percentage capacity of your laptop battery, as well +as the current wattage. Multiple batteries are supported. + +Displays a notification when battery is fully charged, low, or critical. + +```lua +local mybattery = lain.widget.bat() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 30 +`pspath` | Power supply directory path | string | "/sys/class/power_supply/" +`battery` | Single battery id | string | autodetected +`batteries` | Multiple batteries id table | table of strings | autodetected +`ac` | AC | string | autodetected +`notify` | Show notification popups | string | "on" +`n_perc` | Percentages assumed for critical and low battery levels | table of integers | `{5, 15}` +`settings` | User settings | function | empty function + +The widget will try to autodetect `battery`, `batteries` and `ac`. If something +goes wrong, you will have to define them manually. In that case, you only have +to define one between `battery` and `batteries`. If you have one battery, you +can either use `args.battery = "BAT*"` or `args.batteries = {"BAT*"}`, where `BAT*` +is the identifier of your battery in `pspath` (do not use it as a wildcard). +Of course, if you have multiple batteries, you need to use the latter option. + +To disable notifications, set `notify` to `"off"`. + +If you define `pspath`, **be sure** to not forget the final slash (/). + +`settings` can use the `bat_now` table, which contains the following strings: + +- `status`, general status ("N/A", "Discharging", "Charging", "Full"); +- `n_status[i]`, i-th battery status (like above); +- `ac_status`, AC-plug flag (0 if cable is unplugged, 1 if plugged, "N/A" otherwise); +- `perc`, total charge percentage (integer between 0 and 100 or "N/A"); +- `n_perc[i]`, i-th battery charge percentage (like above); +- `time`, time remaining until charge if charging, until discharge if discharging (HH:MM string or "N/A"); +- `watt`, battery watts (float with 2 decimals). + +and can modify the following three tables, which will be the preset for the naughty notifications: +* `bat_notification_charged_preset` (used if battery is fully charged and connected to AC) +* `bat_notification_low_preset` (used if battery charge level <= 15) +* `bat_notification_critical_preset` (used if battery charge level <= 5) + +Check [here](https://awesomewm.org/doc/api/libraries/naughty.html#notify) for +the list of variables they can contain. Default definitions: + +```lua +bat_notification_charged_preset = { + title = "Battery full", + text = "You can unplug the cable", + timeout = 15, + fg = "#202020", + bg = "#CDCDCD" + } + +``` + +```lua +bat_notification_low_preset = { + title = "Battery low", + text = "Plug the cable!", + timeout = 15, + fg = "#202020", + bg = "#CDCDCD" +} +``` +```lua +bat_notification_critical_preset = { + title = "Battery exhausted", + text = "Shutdown imminent", + timeout = 15, + fg = "#000000", + bg = "#FFFFFF" +} +``` + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function + +The `update` function can be used to refresh the widget before `timeout` expires. + +## Note + +Alternatively, you can try the [`upower` recipe](https://awesomewm.org/recipes/watch). diff --git a/config/awesome/lain/wiki/cal.md b/config/awesome/lain/wiki/cal.md new file mode 100755 index 000000000..336b9297b --- /dev/null +++ b/config/awesome/lain/wiki/cal.md @@ -0,0 +1,81 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Creates a calendar notification that can be attached to widgets. + +This is a simpler but [faster](https://github.com/awesomeWM/awesome/issues/1861) +alternative to [`awful.widget.calendar_popup`](https://awesomewm.org/doc/api/classes/awful.widget.calendar_popup.html), which emulates UNIX's `cal`. + +```lua +local mycal = lain.widget.cal() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`attach_to` | List of widgets | table | empty table +`week_start` | First day of the week | integer | 2 (Monday) +`three` | Display three months spanning the date | boolean | false +`followtag` | Display the notification on currently focused screen | boolean | false +`icons` | Path to calendar icons | string | [icons/cal/white/](https://github.com/lcpz/lain/tree/master/icons/cal/white) +`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/calendar#default-notification_preset) + +Set `attach_to` as the list of widgets to which you want to attach the calendar, like this: + +```lua +local mycal = lain.widget.cal { + attach_to = { mywidget1, mywidget2, ... }, + -- [...] +} +``` + +For every widget in `attach_to`: + +- Left click / scroll down: switch to previous month. +- Middle click show current month. +- Right click / scroll up: switch to next month. + +With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +### Default `notification_preset` + +```lua +notification_preset = { + font = "Monospace 10", + fg = "#FFFFFF", + bg = "#000000" +} +``` + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`attach` | Attach the calendar to an input widget | function +`show` | Show calendar | function +`hide` | Hide calendar | function + +`attach` takes as argument any widget you want to attach the calendar to, while +`show` takes as optional argument an integer to indicate the seconds to timeout. + +## Keybinding + +```lua +awful.key({ altkey }, "c", function () mycal.show(7) end) +``` + +Where `altkey = "Mod1"`. + +## Notes + +* Naughty notifications require `notification_preset.font` to be **monospaced**, in order to correctly display the output. +* If you want to [disable notification icon](https://github.com/lcpz/lain/pull/351), set `icons = ""` in the input table. +* If you want to localise the calendar, put `os.setlocale(os.getenv("LANG"))` in your `rc.lua`. +* If you want to get notifications [only with mouse clicks](https://github.com/lcpz/lain/issues/320) on a given widget, use this code: + ```lua + yourwidget:disconnect_signal("mouse::enter", mycal.hover_on) + ``` diff --git a/config/awesome/lain/wiki/cpu.md b/config/awesome/lain/wiki/cpu.md new file mode 100755 index 000000000..c13d05aa6 --- /dev/null +++ b/config/awesome/lain/wiki/cpu.md @@ -0,0 +1,30 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows the current CPU usage, both in general and per core. + +```lua +local mycpu = lain.widget.cpu() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 2 +`settings` | User settings | function | empty function + +`settings` can use these strings: + +* `cpu_now.usage`, the general use percentage; +* `cpu_now[i].usage`, the i-th core use percentage, with `i` starting from 1. + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function \ No newline at end of file diff --git a/config/awesome/lain/wiki/fs.md b/config/awesome/lain/wiki/fs.md new file mode 100755 index 000000000..47d6bb28d --- /dev/null +++ b/config/awesome/lain/wiki/fs.md @@ -0,0 +1,82 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows file systems informations. + +If a partition is given in input, a notification will be displayed when it is almost full. + +```lua +local mypartition = lain.widget.fs() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 600 +`partition` | (Optional) Partition to watch: a notification will be displayed when full | string | `nil` +`threshold` | Percentage threshold at which the notification is triggered | integer | 99 +`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/fs#default-notification_preset) +`followtag` | Display the notification on currently focused screen | boolean | false +`showpopup` | Display popups with mouse hovering | string, possible values: "on", "off" | "on" +`settings` | User settings | function | empty function + +`settings` can use the table `fs_now`, which contains a string entry for each file system path available. For instance, root infos are located in the variable `fs_now["/"]`. Every entry in this table have the following variables: + +Variable | Meaning | Type +--- | --- | --- +`units` | (multiple of) units used | string ("Kb", "Mb", "Gb", and so on) +`percentage` | the used percentage | integer +`size` | size in `units` of the given fs | float +`used` | amount of space used in the given fs, expressed in `units` | float +`free` | amount of free space in the given fs, expressed in `units` | float + +Usage example: + +```lua +-- shows used (percentage) and remaining space in home partition +local fsroothome = lain.widget.fs({ + settings = function() + widget:set_text("/home: " .. fs_now["/home"].percentage .. "% (" .. + fs_now["/home"].free .. " " .. fs_now["/home"].units .. " left)") + end +}) +-- output example: "/home: 37% (239.4 Gb left)" +``` + +With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +### Default `notification_preset` + +```lua +notification_preset = { + font = "Monospace 10", + fg = "#FFFFFF", + bg = "#000000" +} +``` + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`show` | The notification | function + +You can display the notification with a key binding like this: + +```lua +awful.key({ altkey }, "h", function () mypartition.show(seconds, scr) end), +``` + +where ``altkey = "Mod1"`` and ``show`` arguments, both optionals, are: + +* `seconds`, notification time in seconds +* `scr`, screen which to display the notification in + +## Note + +Naughty notifications require `notification_preset.font` to be **monospaced**, in order to correctly display the output. diff --git a/config/awesome/lain/wiki/imap.md b/config/awesome/lain/wiki/imap.md new file mode 100755 index 000000000..683777ec3 --- /dev/null +++ b/config/awesome/lain/wiki/imap.md @@ -0,0 +1,115 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows mails count fetching over IMAP. + +```lua +local myimap = lain.widget.imap(args) +``` + +New mails are notified like this: + + +--------------------------------------------+ + | +---+ | + | |\ /| donald@disney.org has 3 new messages | + | +---+ | + +--------------------------------------------+ + +## Input table + +Required parameters are: + +Variable | Meaning | Type +--- | --- | --- +`server` | Mail server | string +`mail` | User mail | string +`password` | User password | string + +while the optional are: + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`port` | IMAP port | integer | 993 +`timeout` | Refresh timeout (in seconds) | integer | 60 +`pwdtimeout` | Timeout for password retrieval function (see [here](https://github.com/lcpz/lain/wiki/imap#password-security)) | integer | 10 +`is_plain` | Define whether `password` is a plain password (true) or a command that retrieves it (false) | boolean | false +`followtag` | Notification behaviour | boolean | false +`notify` | Show notification popups | string | "on" +`settings` | User settings | function | empty function + +`settings` can use `imap_now` table, which contains the following non negative integers: + +- `["MESSAGES"]` +- `["RECENT"]` +- `["UNSEEN"]` + +example of fetch: `total = imap_now["MESSAGES"]`. For backwards compatibility, `settings` can also use `mailcount`, a pointer to `imap_now["UNSEEN"]`. + +Also, `settings` can modify `mail_notification_preset` table, which will be the preset for the naughty notifications. Check [here](https://awesomewm.org/apidoc/libraries/naughty.html#notify) for the list of variables it can contain. Default definition: + +```lua +mail_notification _preset = { + icon = "lain/icons/mail.png", + position = "top_left" +} +``` + +Note that `mailcount` and `imap_now` elements are equals to 0 either if there are no new mails or credentials are invalid, so make sure that your settings are correct. + +With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +You can have multiple instances of this widget at the same time. + +## Password security + +The reason why `is_plain` is false by default is to discourage the habit of storing passwords in plain. + +In general, when `is_plain == false`, `password` can be either a string, a table or a function: the widget will execute it asynchronously in the first two cases. + +### Using plain passwords + +You can set your password in plain like this: + +```lua +myimapcheck = lain.widget.imap { + is_plain = true, + password = "mymailpassword", + -- [...] +} +``` + +and you will have the same security provided by `~/.netrc`. + +### Using a password manager + +I recommend to use [spm](https://notabug.org/kl3/spm) or [pass](https://www.passwordstore.org). In this case, `password` has to be a function. Example stub: + +```lua +myimapcheck = lain.widget.imap { + password = function() + -- do your retrieval + return retrieved_password, try_again + end, + -- [...] +} +``` + +Where `retrieved_password` is the password retrieved from the manager, and `try_again` supports [DBus Secret Service](https://specifications.freedesktop.org/secret-service). + +The process flow is that the first `password()` call spawns the unlock prompt, then the second call retrieves the password. [Here](https://gist.github.com/lcpz/1854fc4320f4701957cd5309c8eed4a6) is an example of `password` function. + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function +`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) +`pwdtimer` | Password retrieval timer (available only if `password` is a function)| [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) + +The `update` function can be used to refresh the widget before `timeout` expires. + +You can use `timer` to start/stop the widget as you like. diff --git a/config/awesome/lain/wiki/mem.md b/config/awesome/lain/wiki/mem.md new file mode 100755 index 000000000..205d535f8 --- /dev/null +++ b/config/awesome/lain/wiki/mem.md @@ -0,0 +1,33 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows memory status in MiB, [like `top` and `free -h`](https://github.com/lcpz/lain/issues/271). + +```lua +local mymem = lain.widget.mem() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 2 +`settings` | User settings | function | empty function + +in `settings` you can use the following variables: + +Variable | Meaning | Type +--- | --- | --- +`mem_now.used` | Memory used (MiB) | string +`mem_now.swapused` | Swap memory used (MiB) | string +`mem_now.perc` | Memory percentage | int + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function \ No newline at end of file diff --git a/config/awesome/lain/wiki/moc.md b/config/awesome/lain/wiki/moc.md new file mode 100755 index 000000000..130bccbbd --- /dev/null +++ b/config/awesome/lain/wiki/moc.md @@ -0,0 +1,122 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +A widget for showing the current song track's information from MOC (Music On Console). + +```lua +local mymoc = lain.widget.contrib.moc() +``` + +Now playing songs are notified like this: + + +--------------------------------------------------------+ + | +-------+ | + | |/^\_/^\| Now playing | + | |\ O O /| Cannibal Corpse (Hammer Smashed Face) - 1993 | + | | '.o.' | Hammer Smashed Face (Radio Disney Version) | + | +-------+ | + +--------------------------------------------------------+ + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 1 +`music_dir` | Music directory | string | "~/Music" +`cover_size` | Album art notification size (both height and width) | integer | 100 +`cover_pattern` | Pattern for the album art file | string | `*\\.(jpg|jpeg|png|gif)`* +`default_art` | Default art | string | "" +`followtag` | Display the notification on currently focused screen | boolean | false +`settings` | User settings | function | empty function + +\* In Lua, "\\\\" means "\" escaped. + +Default `cover_pattern` definition will made the widget set the first jpg, jpeg, png or gif file found in the directory as the album art. + +Pay attention to case sensitivity when defining `music_dir`. + +`settings` can use `moc_now` table, which contains the following string values: + +- state (possible values: "PLAY", "PAUSE", "STOP") +- file +- artist +- title +- album +- elapsed (Time elapsed for the current track) +- total (The current track's total time) + +and can modify `moc_notification_preset` table, which will be the preset for the naughty notifications. Check [here](https://awesomewm.org/apidoc/libraries/naughty.html#notify) for the list of variables it can contain. Default definition: + +```lua +moc_notification_preset = { + title = "Now playing", + timeout = 6, + text = string.format("%s (%s) - %s\n%s", moc_now.artist, + moc_now.album, moc_now.elapsed, moc_now.title) +} +``` + +With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function +`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) + +The `update` function can be used to refresh the widget before `timeout` expires. + +You can use `timer` to start/stop the widget as you like. + +## Keybindings + +You can control the widget with key bindings like these: + +```lua +-- MOC control +awful.key({ altkey, "Control" }, "Up", + function () + os.execute("mocp -G") -- toggle + moc.update() + end), +awful.key({ altkey, "Control" }, "Down", + function () + os.execute("mocp -s") -- stop + moc.update() + end), +awful.key({ altkey, "Control" }, "Left", + function () + os.execute("mocp -r") -- previous + moc.update() + end), +awful.key({ altkey, "Control" }, "Right", + function () + os.execute("mocp -f") -- next + moc.update() + end), +``` + +where `altkey = "Mod1"`. + +If you don't use the widget for long periods and wish to spare CPU, you can toggle it with a keybinding like this: + +```lua +-- toggle MOC widget +awful.key({ altkey }, "0", + function () + local common = { text = "MOC widget ", position = "top_middle", timeout = 2 } + if moc.timer.started then + moc.timer:stop() + common.text = common.text .. markup.bold("OFF") + else + moc.timer:start() + common.text = common.text .. markup.bold("ON") + end + naughty.notify(common) + end), +``` diff --git a/config/awesome/lain/wiki/mpd.md b/config/awesome/lain/wiki/mpd.md new file mode 100755 index 000000000..cd114a583 --- /dev/null +++ b/config/awesome/lain/wiki/mpd.md @@ -0,0 +1,180 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows MPD status. + +```lua +local mympd = lain.widget.mpd() +``` + +Now playing songs are notified like this: + + +--------------------------------------------------------+ + | +-------+ | + | |/^\_/^\| Now playing | + | |\ O O /| Cannibal Corpse (Hammer Smashed Face) - 1993 | + | | '.o.' | Hammer Smashed Face (Radio Disney Version) | + | +-------+ | + +--------------------------------------------------------+ + +**Note:** if MPD is turned off or not set correctly, the widget will constantly display "N/A" values. + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 2 +`password` | MPD password | string | "" +`host` | MPD server | string | "127.0.0.1" +`port` | MPD port | string | "6600" +`music_dir` | Music directory | string | "~/Music" +`cover_size` | Album art notification size (both height and width) | integer | 100 +`cover_pattern` | Pattern for the album art file | string | `*.(jpg\|jpeg\|png\|gif)$` +`default_art` | Default art | string | `nil` +`notify` | Show notification popups | string | "on" +`followtag` | Notification behaviour | boolean | false +`settings` | User settings | function | empty function + +\* In Lua, "\\\\" means "\" escaped. + +Default `cover_pattern` definition will made the widget set the first jpg, jpeg, png or gif file found in the directory as the album art. + +Pay attention to case sensitivity when defining `music_dir`. + +`settings` can use `mpd_now` table, which contains the following values: + +(**note:** the first four are boolean [flags](https://github.com/lcpz/lain/pull/205), the remaining are all strings) + +- random_mode +- single_mode +- repeat_mode +- consume_mode +- pls_pos (playlist position) +- pls_len (playlist length) +- state (possible values: "play", "pause", "stop") +- file +- artist +- title +- name +- album +- track +- genre +- date +- [time](https://github.com/lcpz/lain/pull/90) (length of current song, in seconds) +- [elapsed](https://github.com/lcpz/lain/pull/90) (elapsed time of current song, in seconds) + +and can modify `mpd_notification_preset` table, which will be the preset for the naughty notifications. Check [here](https://awesomewm.org/doc/api/libraries/naughty.html#notify) for the list of variables it can contain. Default definition: + +```lua +mpd_notification_preset = { + title = "Now playing", + timeout = 6, + text = string.format("%s (%s) - %s\n%s", mpd_now.artist, + mpd_now.album, mpd_now.date, mpd_now.title) +} +``` + +With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The textbox | `wibox.widget.textbox` +`update` | Update `widget` | function +`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) + +The `update` function can be used to refresh the widget before `timeout` expires. + +You can use `timer` to start/stop the widget as you like. + +## Keybindings + +You can control the widget with keybindings like these: + +```lua +-- MPD control +awful.key({ altkey, "Control" }, "Up", + function () + awful.spawn.with_shell("mpc toggle || ncmpc toggle || pms toggle") + mympd.update() + end), +awful.key({ altkey, "Control" }, "Down", + function () + awful.spawn.with_shell("mpc stop || ncmpc stop || pms stop") + mympd.update() + end), +awful.key({ altkey, "Control" }, "Left", + function () + awful.spawn.with_shell("mpc prev || ncmpc prev || pms prev") + mympd.update() + end), +awful.key({ altkey, "Control" }, "Right", + function () + awful.spawn.with_shell("mpc next || ncmpc next || pms next") + mympd.update() + end), +``` + +where `altkey = "Mod1"`. + +If you don't use the widget for long periods and wish to spare CPU, you can toggle it with a keybinding like this: + +```lua +-- disable MPD widget +awful.key({ altkey }, "0", + function () + local common = { + text = "MPD widget ", + position = "top_middle", + timeout = 2 + } + if mympd.timer.started then + mympd.timer:stop() + common.text = common.text .. markup.bold("OFF") + else + mympd.timer:start() + common.text = common.text .. markup.bold("ON") + end + naughty.notify(common) + end), +``` + +## Notes + +### Cover not showing in notifications + +If the cover file is existent but not showed in notifications, [try](https://github.com/lcpz/lain/issues/393) setting `music_dir` to a symlink of your music folder, rather than to a physical path. This can be easily done through +```shell +ln -s /the/real_path_to_your_music/ /home/username/Music +``` +However, this only applies if the music is stored outside your user-specific folder, for instance in an external partition. + +### Always use `set_markup` + +In `settings`, if you use `widget:set_text`, [it will ignore Pango markup](https://github.com/lcpz/lain/issues/258), so be sure to always use `widget:set_markup`. + +### Volume fade in toggling MPD + +If you want a fade in/out in toggling MPD, you can put [this script](https://gist.github.com/lcpz/76e315bc27c6cdf7edd5021964b88df1) in your local `bin` directory: + +```shell +$ curl https://gist.githubusercontent.com/lcpz/76e315bc27c6cdf7edd5021964b88df1/raw/97f7ba586418a4e07637cfbc91d2974278dfa623/mpd-fade -o ~/bin/mpc-fade +$ chmod +x ~/bin/mpc-fade +``` + +Set your 1% decrease/increase commands [here](https://gist.github.com/lcpz/76e315bc27c6cdf7edd5021964b88df1#file-mpd-fade-L8-L9), then use a keybinding like this: + +```lua +-- MPD toggle with volume fading +awful.key({ "Shift" }, "Pause", + function() + awful.spawn.easy_async("mpc-fade 20 4", -- mpc-fade + function(stdout, stderr, reason, exit_code) + mympd.update() + end) + end), +``` diff --git a/config/awesome/lain/wiki/net.md b/config/awesome/lain/wiki/net.md new file mode 100755 index 000000000..252399ea7 --- /dev/null +++ b/config/awesome/lain/wiki/net.md @@ -0,0 +1,115 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Monitors network interfaces and shows current traffic. + +```lua +local mynet = lain.widget.net() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 2 +`iface` | Network device(s) | string (single interface) or table of strings (multiple interfaces) | autodetected +`units` | Units | integer | 1024 (kilobytes) +`notify` | Display "no carrier" notifications | string | "on" +`wifi_state` | Get wifi connection status | string | "off" +`eth_state` | Get ethernet connection status | string | "off" +`screen` | Notifications screen | integer | 1 +`settings` | User settings | function | empty function + +`iface` can be a string or an table of the form `{ "eth0", "eth1", ... }` containing a list of the devices to collect data on. + +If more than one device is included, `net_now.sent` and `net_now.received` will contain cumulative values over all given devices. +Use `net_now.devices["eth0"]` to access `sent`, `received`, `state` or `carrier` per device. + +Possible alternative values for `units` are 1 (byte) or multiple of 1024: 1024^2 (mb), 1024^3 (gb), and so on. + +If `notify = "off"` is set, the widget won't display a notification when there's no carrier. + +`settings` can use the following `iface` related strings: + +- `net_now.carrier` ("0", "1"); +- `net_now.state` ("up", "down"); +- `net_now.sent` and `net_now.received` (numbers) will be the sum across all specified interfaces; +- `net_now.devices["interface"]` contains the same attributes as the old api for each interface. More on this in the "Multiple devices" section below. + +If `wifi_state = "on"` is set, `settings` can use the following extra strings attached to `net_now.devices["wireless interface"]`: +- `wifi` (true, false) indicates if the interface is connected to a network; +- `signal` (number) is the connection signal strength in dBm; + +If `eth_state = "on"` is set, `settings` can use the following extra string: `net_now.devices["ethernet interface"].ethernet`, which is a boolean indicating if an ethernet connection's active. + +For compatibility reasons, if multiple devices are given, `net_now.carrier` and `net_now.state` correspond to the last interface in the iface table and should not be relied upon (deprecated). + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function + +## Notes + +### Setting `iface` manually + +If the widget [spawns a "no carrier" notification and you are sure to have an active network device](https://github.com/lcpz/lain/issues/102), then autodetection is probably not working. This may due to [your user privileges](https://github.com/lcpz/lain/issues/102#issuecomment-246470526). In this case you can set `iface` manually. You can see which device is **UP,LOWER_UP** with the following command: + +```shell +ip link show +``` +## Usage examples +### Two widgets for upload/download rates from the same `iface` + +```lua +local mynetdown = wibox.widget.textbox() +local mynetup = lain.widget.net { + settings = function() + widget:set_markup(net_now.sent) + netdowninfo:set_markup(net_now.received) + end +} +``` +### Wifi connection + signal strength indicator and ethernet connection indicator +```lua +local wifi_icon = wibox.widget.imagebox() +local eth_icon = wibox.widget.imagebox() +local net = lain.widget.net { + notify = "off", + wifi_state = "on", + eth_state = "on", + settings = function() + local eth0 = net_now.devices.eth0 + if eth0 then + if eth0.ethernet then + eth_icon:set_image(ethernet_icon_filename) + else + eth_icon:set_image() + end + end + + local wlan0 = net_now.devices.wlan0 + if wlan0 then + if wlan0.wifi then + local signal = wlan0.signal + if signal < -83 then + wifi_icon:set_image(wifi_weak_filename) + elseif signal < -70 then + wifi_icon:set_image(wifi_mid_filename) + elseif signal < -53 then + wifi_icon:set_image(wifi_good_filename) + elseif signal >= -53 then + wifi_icon:set_image(wifi_great_filename) + end + else + wifi_icon:set_image() + end + end + end +} +``` diff --git a/config/awesome/lain/wiki/pulse.md b/config/awesome/lain/wiki/pulse.md new file mode 100755 index 000000000..311b4743b --- /dev/null +++ b/config/awesome/lain/wiki/pulse.md @@ -0,0 +1,135 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows and controls PulseAudio volume. + +```lua +local volume = lain.widget.pulse() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 5 +`devicetype` | PulseAudio device type | string ("sink", "source") | "sink" +`cmd` | PulseAudio command | string or function | see [here](https://github.com/lcpz/lain/blob/master/widget/pulse.lua#L26) +`settings` | User settings | function | empty function + +`cmd` is a terminal command to catch infos from current default device. You can redefine it, being sure that the ouput is something like this: + +```shell +* index: 0 + volume: front-left: 18340 / 28% / -33.18 dB, front-right: 18340 / 28% / -33.18 dB + muted: no + device.string = "front:1" +``` + +If your devices change dynamically, you can define it as a function which returns a command string. + +If sed doesn't work, you can try with a grep variant: + +```lua +cmd = "pacmd list-" .. pulse.devicetype .. "s | grep -e $(pactl info | grep -e 'ink' | cut -d' ' -f3) -e 'volume: front' -e 'muted'" +``` + +### `settings` variables + +`settings` can use the following variables: + +Variable | Meaning | Type | Values +--- | --- | --- | --- +`volume_now.device` | Device name | string | device name or "N/A" +`volume_now.index` | Device index | string | >= "0" +`volume_now.muted` | Device mute status | string | "yes", "no", "N/A" +`volume_now.channel` | Device channels | table of string integers | `volume_now.channel[i]`, where `i >= 1` +`volume_now.left` | Front left sink level or first source | string | "0"-"100" +`volume_now.right` | Front right sink level or second source | string | "0"-"100" + +`volume_now.channel` is a table of your PulseAudio devices. Fetch a channel level like this: `volume_now.channel[i]`, where `i >= 1`. + +`volume_now.{left,right}` are pointers for `volume_now.{channel[1], channel[2]}` (stereo). + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function + +## Buttons + +```lua +volume.widget:buttons(awful.util.table.join( + awful.button({}, 1, function() -- left click + awful.spawn("pavucontrol") + end), + awful.button({}, 2, function() -- middle click + os.execute(string.format("pactl set-sink-volume %d 100%%", volume.device)) + volume.update() + end), + awful.button({}, 3, function() -- right click + os.execute(string.format("pactl set-sink-mute %d toggle", volume.device)) + volume.update() + end), + awful.button({}, 4, function() -- scroll up + os.execute(string.format("pactl set-sink-volume %d +1%%", volume.device)) + volume.update() + end), + awful.button({}, 5, function() -- scroll down + os.execute(string.format("pactl set-sink-volume %d -1%%", volume.device)) + volume.update() + end) +)) +``` + +## Keybindings + +```lua +-- PulseAudio volume control +awful.key({ altkey }, "Up", + function () + os.execute(string.format("pactl set-sink-volume %d +1%%", volume.device)) + volume.update() + end), +awful.key({ altkey }, "Down", + function () + os.execute(string.format("pactl set-sink-volume %d -1%%", volume.device)) + volume.update() + end), +awful.key({ altkey }, "m", + function () + os.execute(string.format("pactl set-sink-mute %d toggle", volume.device)) + volume.update() + end), +awful.key({ altkey, "Control" }, "m", + function () + os.execute(string.format("pactl set-sink-volume %d 100%%", volume.device)) + volume.update() + end), +awful.key({ altkey, "Control" }, "0", + function () + os.execute(string.format("pactl set-sink-volume %d 0%%", volume.device)) + volume.update() + end), +``` + +where `altkey = "Mod1"`. + +## Example + +```lua +-- PulseAudio volume (based on multicolor theme) +local volume = lain.widget.pulse { + settings = function() + vlevel = volume_now.left .. "-" .. volume_now.right .. "% | " .. volume_now.device + if volume_now.muted == "yes" then + vlevel = vlevel .. " M" + end + widget:set_markup(lain.util.markup("#7493d2", vlevel)) + end +} +``` diff --git a/config/awesome/lain/wiki/pulseaudio.md b/config/awesome/lain/wiki/pulseaudio.md new file mode 100755 index 000000000..6c11cb4ee --- /dev/null +++ b/config/awesome/lain/wiki/pulseaudio.md @@ -0,0 +1,150 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows and controls PulseAudio volume. + +```lua +local volume = lain.widget.pulseaudio() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout seconds | number | 5 +`devicetype | PulseAudio device type | string ("sink", "source") | "sink" +`cmd` | PulseAudio command | string | [link](https://github.com/lcpz/lain/blob/master/widget/pulseaudio.lua#L28) +`scallback` | PulseAudio sink callback | function | `nil` +`settings` | User settings | function | empty function + +`cmd` catch infos from current default sink. You can redefine it, being sure that the ouput is something like this: + +```shell +* index: 0 + volume: front-left: 18340 / 28% / -33.18 dB, front-right: 18340 / 28% / -33.18 dB + muted: no + device.string = "front:1" +``` + +**Note:** you can set PulseAudio default sink like this: `pacmd set-default-sink #sink`. + +If [`sed`](https://github.com/lcpz/lain/blob/master/widget/pulseaudio.lua#L28) doesn't work, you can try with `grep`: + +```shell +pacmd list-sinks | grep -e $(pactl info | grep -e 'ink' | cut -d' ' -f3) -e 'volume: front' -e 'muted' +``` + +`scallback` is a callback function to update `cmd`, in case you switch between audio channels and therefore PulseAudio sink changes. If default `cmd` works for you, you can tell `scallback` to work in the same way: + +```lua +scallback = function() + devicetype = "sink" + return "pacmd list-" .. devicetype .. "s | sed -n -e '0,/*/d' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'" +end +``` + +### `settings` variables + +`settings` can use the following variables: + +Variable | Meaning | Type | Values +--- | --- | --- | --- +`volume_now.index` | Sink index | string | >= "0" +`volume_now.sink` | Sink name | string | sink name or "N/A" +`volume_now.muted` | Sink mute status | string | "yes", "no", "N/A" +`volume_now.channel` | Sink channels | table of string integers | `volume_now.channel[i]`, where `i >= 1` +`volume_now.left` | Front left level | string | "0"-"100" +`volume_now.right` | Front right level | string | "0"-"100" + +`volume_now.channel` is a table of your pulseaudio sink channels. Fetch a channel level like this: `volume_now.channel[i]`, where `i >= 1`. + +`volume_now.{left,right}` are pointers for `volume_now.{channel[1], channel[2]}` (stereo). + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function + +## Buttons + +If you want buttons, just add the following after your widget in `rc.lua`. + +```lua +volume.widget:buttons(awful.util.table.join( + awful.button({}, 1, function() -- left click + awful.spawn("pavucontrol") + end), + awful.button({}, 2, function() -- middle click + awful.spawn(string.format("pactl set-sink-volume %d 100%%", volume.sink)) + volume.update() + end), + awful.button({}, 3, function() -- right click + awful.spawn(string.format("pactl set-sink-mute %d toggle", volume.sink)) + volume.update() + end), + awful.button({}, 4, function() -- scroll up + awful.spawn(string.format("pactl set-sink-volume %d +1%%", volume.sink)) + volume.update() + end), + awful.button({}, 5, function() -- scroll down + awful.spawn(string.format("pactl set-sink-volume %d -1%%", volume.sink)) + volume.update() + end) +)) +``` + +## Keybindings + +You can control the widget with key bindings like these: + +```lua +-- PulseAudio volume control +awful.key({ altkey }, "Up", + function () + os.execute(string.format("pactl set-sink-volume %d +1%%", volumewidget.sink)) + volume.update() + end), +awful.key({ altkey }, "Down", + function () + os.execute(string.format("pactl set-sink-volume %d -1%%", volumewidget.sink)) + volume.update() + end), +awful.key({ altkey }, "m", + function () + os.execute(string.format("pactl set-sink-mute %d toggle", volumewidget.sink)) + volume.update() + end), +awful.key({ altkey, "Control" }, "m", + function () + os.execute(string.format("pactl set-sink-volume %d 100%%", volume.sink)) + volume.update() + end), +awful.key({ altkey, "Control" }, "0", + function () + os.execute(string.format("pactl set-sink-volume %d 0%%", volume.sink)) + volume.update() + end), +``` + +where `altkey = "Mod1"`. + +## Example + +```lua +-- PulseAudio volume (based on multicolor theme) +local volume = lain.widget.pulseaudio({ + settings = function() + vlevel = volume_now.left .. "-" .. volume_now.right .. "% | " .. volume_now.sink + if volume_now.muted == "yes" then + vlevel = vlevel .. " M" + end + + widget:set_markup(lain.util.markup("#7493d2", vlevel)) + end +}) +``` \ No newline at end of file diff --git a/config/awesome/lain/wiki/pulsebar.md b/config/awesome/lain/wiki/pulsebar.md new file mode 100755 index 000000000..61a86cdd4 --- /dev/null +++ b/config/awesome/lain/wiki/pulsebar.md @@ -0,0 +1,94 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows PulseAudio volume with a progressbar; provides tooltips and notifications. + +```lua +local volume = lain.widget.pulsebar() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 5 +`settings` | User settings | function | empty function +`width` | Bar width | number | 63 +`height` | Bar height | number | 1 +`margins` | Bar margins | number | 1 +`paddings` | Bar paddings | number | 1 +`ticks` | Set bar ticks on | boolean | false +`ticks_size` | Ticks size | number | 7 +`scallback` | [PulseAudio sink callback](https://github.com/lcpz/lain/wiki/pulseaudio/) | function | `nil` +`sink` | Mixer sink | number | 0 +`colors` | Bar colors | table | see [Default colors](https://github.com/lcpz/lain/wiki/pulsebar#default-colors) +`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/pulsebar#default-notification_preset) +`followtag` | Display the notification on currently focused screen | boolean | false +`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/pulsebar#default-notification_preset) +`devicetype` | PulseAudio device type | string ("sink", "source") | "sink" +`cmd` | PulseAudio command | string or function | see [here](https://github.com/lcpz/lain/blob/master/widget/pulsebar.lua#L48) + +Read [pulse](https://github.com/lcpz/lain/wiki/pulse) page for `cmd` settings. + +`settings` can use [these variables](https://github.com/lcpz/lain/wiki/pulse#settings-variables). + +With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +### Default colors + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`background` | Bar backgrund color | string | "#000000" +`mute` | Bar mute color | string | "#EB8F8F" +`unmute` | Bar unmute color | string | "#A4CE8A" + +### Default `notification_preset` + +```lua +notification_preset = { + font = "Monospace 10" +} +``` + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`bar` | The widget | `wibox.widget.progressbar` +`device` | PulseAudio device | string +`notify` | The notification | function +`update` | Update state | function +`tooltip` | The tooltip | `awful.tooltip` + +## Buttons + +```lua +volume.bar:buttons(awful.util.table.join( + awful.button({}, 1, function() -- left click + awful.spawn("pavucontrol") + end), + awful.button({}, 2, function() -- middle click + os.execute(string.format("pactl set-sink-volume %d 100%%", volume.device)) + volume.update() + end), + awful.button({}, 3, function() -- right click + os.execute(string.format("pactl set-sink-mute %d toggle", volume.device)) + volume.update() + end), + awful.button({}, 4, function() -- scroll up + os.execute(string.format("pactl set-sink-volume %d +1%%", volume.device)) + volume.update() + end), + awful.button({}, 5, function() -- scroll down + os.execute(string.format("pactl set-sink-volume %d -1%%", volume.device)) + volume.update() + end) +)) +``` + +## Keybindings + +Same as [here](https://github.com/lcpz/lain/wiki/pulse#keybindings). If you want notifications, use `volume.notify()` instead of `volume.update()`. diff --git a/config/awesome/lain/wiki/redshift.md b/config/awesome/lain/wiki/redshift.md new file mode 100755 index 000000000..b83ad3a75 --- /dev/null +++ b/config/awesome/lain/wiki/redshift.md @@ -0,0 +1,100 @@ +### What is Redshift? # + +[**Project homepage**](http://jonls.dk/redshift/) + +>**Redshift** is an application that adjusts the computer display's color temperature based upon the Sun's apparent position in relation to the user's location on Earth. +> +>The program is free software, inspired by the proprietary f.lux, and can be used to reduce eye strain as well as insomnia and delayed sleep phase syndrome. +> +>The computer display's color temperature transitions evenly from night to daytime temperature to allow the user's eyes to slowly adapt. At night, the color temperature is low and is typically 3000–4000 K (default is 3500 K), preferably matching the room's lighting temperature. Typical color temperature during the daytime is 5500–6500 K (default is 5500 K). + +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Redshift_%28software%29) + +### Preparations + +**Redshift must be installed** on your system if you want to use this widget. + +Packages should be available for most distributions. Source code and build instructions can be found on Github [here](https://github.com/jonls/redshift). + +You also need a valid config file. Please see the [project homepage](http://jonls.dk/redshift/) for details. An example: [`~/.config/redshift.conf`](https://github.com/jonls/redshift/blob/master/redshift.conf.sample). + +You have to match the location settings to your personal situation: you can adjust the `lat` and `lon` variables using a [web service](https://encrypted.google.com/search?q=get+latitude+and+longitude). + +You might also want to modify the color temperatures to fit your preferences. + +### Using the widget + +This widget provides the following functions: + +| function | meaning | +| --- | --- | +| `redshift:toggle()` | Toggles Redshift adjustments on or off, and also restarts it if terminates. | +| `redshift:attach(widget, update_function)` | Attach to a widget. Click on the widget to toggle redshift on or off. `update_function` is a callback function which will be triggered each time Redshift changes its status. (See the examples below.) | + +### Usage examples + +#### Textbox status widget + +```lua +myredshift = wibox.widget.textbox() +lain.widget.contrib.redshift:attach( + myredshift, + function (active) + if active then + myredshift:set_text("RS on") + else + myredshift:set_text("RS off") + end + end +) +``` + +Then add `myredshift.widget` to your wibox. + +#### Checkbox status widget + +```lua +local markup = lain.util.markup + +local myredshift = wibox.widget{ + checked = false, + check_color = "#EB8F8F", + border_color = "#EB8F8F", + border_width = 1, + shape = gears.shape.square, + widget = wibox.widget.checkbox +} + +local myredshift_text = wibox.widget{ + align = "center", + widget = wibox.widget.textbox, +} + +local myredshift_stack = wibox.widget{ + myredshift, + myredshift_text, + layout = wibox.layout.stack +} + +lain.widget.contrib.redshift:attach( + myredshift, + function (active) + if active then + myredshift_text:set_markup(markup(beautiful.bg_normal, "R")) + else + myredshift_text:set_markup(markup(beautiful.fg_normal, "R")) + end + myredshift.checked = active + end +) +``` + +Then add the `myredshift_stack` widget to your wibox. + +#### Keybinding + +Add this to the keybindings in your `rc.lua`: +```lua +-- Toggle redshift with Mod+Shift+t +awful.key({ modkey, "Shift" }, "t", function () lain.widget.contrib.redshift:toggle() end), +``` \ No newline at end of file diff --git a/config/awesome/lain/wiki/sysload.md b/config/awesome/lain/wiki/sysload.md new file mode 100755 index 000000000..6fb1c04fd --- /dev/null +++ b/config/awesome/lain/wiki/sysload.md @@ -0,0 +1,27 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows the current system load. + +```lua +mysysload = lain.widget.sysload() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 2 +`settings` | User settings | function | empty function + +`settings` can use strings `load_1`, `load_5` and `load_15`, which are the load averages over 1, 5, and 15 minutes. + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function \ No newline at end of file diff --git a/config/awesome/lain/wiki/task.md b/config/awesome/lain/wiki/task.md new file mode 100755 index 000000000..af53a6a3a --- /dev/null +++ b/config/awesome/lain/wiki/task.md @@ -0,0 +1,51 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Attaches a [taskwarrior](http://taskwarrior.org) notifications to a widget, and lets you execute `task` commands from the promptbox. + +```lua +lain.widget.contrib.task.attach(widget, args) +``` + +`args` is an optional table which can contain: + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`show_cmd` | Taskwarrior command to show in the popup | string | "task next" +`prompt_text` | Prompt text | string | "Enter task command: " +`followtag` | Display the notification on currently focused screen | boolean | false +`notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/task#default-notification_preset) + +The tasks are shown in a notification popup when the mouse is moved over the attached `widget`, and the popup is hidden when the mouse is moved away. By default, the notification will show the output of `task next`. With `show_cmd`, the `task` popup command can be customized, for example if you want to [filter the tasks](https://taskwarrior.org/docs/filter.html) or show a [custom report](https://github.com/lcpz/lain/pull/213). + +With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +You can call the notification with a keybinding like this: + +```lua +awful.key({ modkey, altkey }, "t", function () lain.widget.contrib.task.show(scr) end), +``` + +where ``altkey = "Mod1"`` and `scr` (optional) indicates the screen which you want the notification in. + +And you can prompt to input a `task` command with a keybinding like this: + +```lua +awful.key({ altkey }, "t", lain.widget.contrib.task.prompt), +``` + +### Default `notification_preset` + +```lua +notification_preset = { + font = "Monospace 10", + icon = helpers.icons_dir .. "/taskwarrior.png" +} +``` + +## Note + +* If your widget does not display `task next` output, try changing Taskwarrior verbose, for instance: `show_cmd = 'task rc.verbose:label'` or `show_cmd = 'task rc.verbose:nothing'`. \ No newline at end of file diff --git a/config/awesome/lain/wiki/temp.md b/config/awesome/lain/wiki/temp.md new file mode 100755 index 000000000..3857d927b --- /dev/null +++ b/config/awesome/lain/wiki/temp.md @@ -0,0 +1,32 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Shows the current CPU temperature. + +```lua +local mytemp = lain.widget.temp() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout (in seconds) | integer | 2 +`tempfile` | Path of file which stores core temperature value | string | "/sys/class/thermal/thermal_zone0/temp" +`settings` | User settings | function | empty function + +`settings` can use the string `coretemp_now`, which means current core temperature, expressed in Celsius (linux standard). + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`update` | Update `widget` | function + +## Note + +Depending on the architecture, note that your temp files location [might vary](https://github.com/lcpz/lain/issues/84#issuecomment-72751763). \ No newline at end of file diff --git a/config/awesome/lain/wiki/tp_smapi.md b/config/awesome/lain/wiki/tp_smapi.md new file mode 100755 index 000000000..edb108faf --- /dev/null +++ b/config/awesome/lain/wiki/tp_smapi.md @@ -0,0 +1,103 @@ +# Description + +[`tp_smapi`](http://www.thinkwiki.org/wiki/Tp_smapi) interface and widget creator. + +```lua +local tp_smapi = lain.widget.contrib.tp_smapi(apipath) +``` + +The argument `apipath` is an optional string which defines the API path. Its default value is `"/sys/devices/platform/smapi"`. + +# Functions + +## tp_smapi.get(batid, feature) + +Gets the `feature` of battery `batid`. Returns a string. The list of available features is available at [this page](https://www.thinkwiki.org/wiki/Tp_smapi#Battery_status_features). + +## tp_smapi.installed(batid) + +Checks if battery `batid` is installed. Returns a boolean. + +## tp_smapi.status(batid) + +Gets the status of battery `batid`. Returns a string ("charging", "discharging", or "full"). + +## tp_smapi.percentage(batid) + +Gets the percentage of battery `batid`. Returns a numeric string. + +## tp_smapi.time(batid) + +Gets the time of battery `batid`. Depending on the current status, it can be either running or charging time. Returns a string of the format `HH:MM`. + +## tp_smapi.hide() + +Removes any notification spawned by `tp_smapi.show`. + +## tp_smapi.show(batid, seconds, scr) + +Notifies the current information of battery `batid` for `seconds` seconds on screen `scr`. +The argument `scr` is optional, and if missing, the notification will be displayed on the currently focused screen. + +## tp_smapi.create_widget(args) + +Creates a [lain widget](https://github.com/lcpz/lain/wiki/Widgets#usage) of the available ThinkPad batteries. + +```lua +local tpbat = tp_smapi.create_widget() +``` + +### Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`widget` | The widget type to use | [`wibox.widget`](https://awesomewm.org/doc/api/classes/wibox.widget.html) | [`wibox.widget.textbox`](https://awesomewm.org/doc/api/classes/wibox.widget.textbox.html) +`timeout` | Refresh timeout (in seconds) | integer | 30 +`pspath` | Power supply directory path | string | "/sys/class/power_supply/" +`battery` | Single battery id | string | autodetected +`batteries` | Multiple batteries id table | table of strings | autodetected +`settings` | User settings | function | empty function + +The widget will try to autodetect `battery` and `batteries`. If something +goes wrong, you will have to define them manually. In that case, you only have +to define one between `battery` and `batteries`. If you have one battery, you +can either use `args.battery = "BAT*"` or `args.batteries = {"BAT*"}`, where `BAT*` +is the identifier of your battery in `pspath` (do not use it as a wildcard). +Of course, if you have multiple batteries, you need to use the latter option. + +If you define `pspath`, **be sure** to not forget the final slash (/). + +`settings` can use the `tpbat_now` table, which contains the following strings: + +- `status`, general status ("N/A", "discharging", "charging", "full"); +- `n_status[i]`, i-th battery status (like above); +- `n_perc[i]`, i-th battery charge percentage (like above); +- `n_time[i]`, i-th battery running or charging time (HH:MM string or "N/A"); + +`n_time[i]` is the running time of battery `i` when it is discharging, and the charging time otherwise. + +### Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | [`wibox.widget`](https://awesomewm.org/doc/api/classes/wibox.widget.html) | [textbox](https://awesomewm.org/doc/api/classes/wibox.widget.textbox.html) +`batteries` | Battery identifiers | Table of strings +`update` | Update `widget` | function +`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) + +The `update` function can be used to refresh the widget before `timeout` expires. + +### Usage example + +```lua +local tp_smapi = lain.widget.contrib.tp_smapi() +local bat = tp_smapi.create_widget { + battery = "BAT0", + settings = function() + widget:set_markup(tpbat_now.n_perc[1] .. "%") + end +} + +bat.widget:connect_signal("mouse::enter", function () tp_smapi.show("BAT0") end) +bat.widget:connect_signal("mouse::leave", function () tp_smapi.hide() end) +``` diff --git a/config/awesome/lain/wiki/watch.md b/config/awesome/lain/wiki/watch.md new file mode 100755 index 000000000..ff18a5ca9 --- /dev/null +++ b/config/awesome/lain/wiki/watch.md @@ -0,0 +1,222 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Template for asynchronous watcher widgets. + +Executes an input command and makes the user feed a `wibox.widget` with the output. + +```lua +local mywatch = lain.widget.watch() +``` + +This has been implemented in Awesome 4.0 as [`awful.widget.watch`](https://awesomewm.org/doc/api/classes/awful.widget.watch.html). But while Awesome `watch` returns only the widget, Lain one returns a table including its timer and internal update function too. + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`widget` | Widget to feed | `wibox.widget` | `wibox.widget.textbox` +`timeout` | Refresh timeout seconds | number | 5 +`cmd` | The command to execute | string **or** table | `nil` +`nostart` | Widget timer doesn't start immediately | boolean | false +`stoppable` | Widget timer is stoppable | boolean | false +`settings` | User settings | function | see [Default `settings` function](https://github.com/lcpz/lain/wiki/watch#default-settings-function) + +If your command needs a shell, you need to set `cmd` as an array of 3 strings, where the first contains the shell, the second contains `-c`, and the third contains the actual command. Example: + +```lua +cmd = { awful.util.shell, "-c", "myactualcommand" } +``` + +`settings` can use the string `output`, which is the output of `cmd`. + +### Default `settings` function + +```lua +settings = function() widget:set_text(output) end +``` +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | input widget type or `wibox.widget.textbox` +`update` | Update `widget` | function +`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) or `nil` + +The `update` function can be used to refresh the widget before `timeout` expires. + +If `stoppable == true`, the widget will have an ad-hoc timer, which you can control though `timer` variable. + +## Use case examples + +### bitcoin + +```lua +-- Bitcoin to USD current price, using Coinbase V1 API +local bitcoin = lain.widget.watch({ + timeout = 43200, -- half day + stoppable = true, + cmd = "curl -m5 -s 'https://coinbase.com/api/v1/prices/buy'", + settings = function() + local btc, pos, err = require("lain.util").dkjson.decode(output, 1, nil) + local btc_price = (not err and btc and btc["subtotal"]["amount"]) or "N/A" + + -- customize here + widget:set_text(btc_price) + end +}) +``` + +### btrfs + +```lua +-- btrfs root df +local myrootfs = lain.widget.watch({ + timeout = 600, + cmd = "btrfs filesystem df -g /", + settings = function() + local total, used = string.match(output, "Data.-total=(%d+%.%d+)GiB.-used=(%d+%.%d+)GiB") + local percent_used = math.ceil((tonumber(used) / tonumber(total)) * 100) + + -- customize here + widget:set_text(" [/: " .. percent_used .. "%] ") + end +}) +``` + +### cmus + +```lua +-- cmus audio player +local cmus = lain.widget.watch({ + timeout = 2, + stoppable = true, + cmd = "cmus-remote -Q", + settings = function() + local cmus_now = { + state = "N/A", + artist = "N/A", + title = "N/A", + album = "N/A" + } + + for w in string.gmatch(output, "(.-)tag") do + a, b = w:match("(%w+) (.-)\n") + cmus_now[a] = b + end + + -- customize here + widget:set_text(cmus_now.artist .. " - " .. cmus_now.title) + end +}) +``` + +### maildir + +```lua +-- checks whether there are files in the "new" directories of a mail dirtree +local mailpath = "~/Mail" +local mymaildir = lain.widget.watch({ + timeout = 60, + stoppable = true, + cmd = { awful.util.shell, "-c", string.format("ls -1dr %s/*/new/*", mailpath) }, + settings = function() + local inbox_now = { digest = "" } + + for dir in output:gmatch(".-/(%w+)/new") do + inbox_now[dir] = 1 + for _ in output:gmatch(dir) do + inbox_now[dir] = inbox_now[dir] + 1 + end + if #inbox_now.digest > 0 then inbox_now.digest = inbox_now.digest .. ", " end + inbox_now.digest = inbox_now.digest .. string.format("%s (%d)", dir, inbox_now[dir]) + end + + -- customize here + widget:set_text("mail: " .. inbox_now.digest) + end +}) +``` + +### mpris + +```lua +-- infos from mpris clients such as spotify and VLC +-- based on https://github.com/acrisci/playerctl +local mpris = lain.widget.watch({ + cmd = "playerctl status && playerctl metadata", + timeout = 2, + stoppable = true, + settings = function() + local escape_f = require("awful.util").escape + local mpris_now = { + state = "N/A", + artist = "N/A", + title = "N/A", + art_url = "N/A", + album = "N/A", + album_artist = "N/A" + } + + mpris_now.state = string.match(output, "Playing") or + string.match(output, "Paused") or "N/A" + + for k, v in string.gmatch(output, "'[^:]+:([^']+)':[%s]<%[?'([^']+)'%]?>") + do + if k == "artUrl" then mpris_now.art_url = v + elseif k == "artist" then mpris_now.artist = escape_f(v) + elseif k == "title" then mpris_now.title = escape_f(v) + elseif k == "album" then mpris_now.album = escape_f(v) + elseif k == "albumArtist" then mpris_now.album_artist = escape_f(v) + end + end + + -- customize here + widget:set_text(mpris_now.artist .. " - " .. mpris_now.title) + end +}) +``` + +### upower + +```lua +-- battery infos from freedesktop upower +local mybattery = lain.widget.watch({ + timeout = 30, + cmd = { awful.util.shell, "-c", "upower -i /org/freedesktop/UPower/devices/battery_BAT | sed -n '/present/,/icon-name/p'" }, + settings = function() + local bat_now = { + present = "N/A", + state = "N/A", + warninglevel = "N/A", + energy = "N/A", + energyfull = "N/A", + energyrate = "N/A", + voltage = "N/A", + percentage = "N/A", + capacity = "N/A", + icon = "N/A" + } + + for k, v in string.gmatch(output, '([%a]+[%a|-]+):%s*([%a|%d]+[,|%a|%d]-)') do + if k == "present" then bat_now.present = v + elseif k == "state" then bat_now.state = v + elseif k == "warning-level" then bat_now.warninglevel = v + elseif k == "energy" then bat_now.energy = string.gsub(v, ",", ".") -- Wh + elseif k == "energy-full" then bat_now.energyfull = string.gsub(v, ",", ".") -- Wh + elseif k == "energy-rate" then bat_now.energyrate = string.gsub(v, ",", ".") -- W + elseif k == "voltage" then bat_now.voltage = string.gsub(v, ",", ".") -- V + elseif k == "percentage" then bat_now.percentage = tonumber(v) -- % + elseif k == "capacity" then bat_now.capacity = string.gsub(v, ",", ".") -- % + elseif k == "icon-name" then bat_now.icon = v + end + end + + -- customize here + widget:set_text("Bat: " .. bat_now.percentage .. " " .. bat_now.state) + end +}) +``` diff --git a/config/awesome/lain/wiki/weather.md b/config/awesome/lain/wiki/weather.md new file mode 100755 index 000000000..1875965c0 --- /dev/null +++ b/config/awesome/lain/wiki/weather.md @@ -0,0 +1,150 @@ +## Usage + +[Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage) + +### Description + +Provides current weather status widgets and X-days forecast popup notifications. + +Powered by [OpenWeatherMap](http://openweathermap.org/api) API. + +By default, it uses [current](http://openweathermap.org/current) for current weather data and [forecast16](http://openweathermap.org/forecast16) for forecasts. + +```lua +local myweather = lain.widget.weather() +``` + +## Input table + +Variable | Meaning | Type | Default +--- | --- | --- | --- +`timeout` | Refresh timeout seconds for current weather status | number | 900 (15 min) +`timeout_forecast` | Refresh timeout seconds for forecast notification | number | 86400 (24 hrs) +`current_call` | Command to fetch weather status data from the API | string | see `default_current_call` +`forecast_call` | Command to fetch forecast data from the API | string | see `default_forecast_call` +`city_id` | API city code | number | not set +`utc_offset` | UTC time offset | function | see [here](https://github.com/lcpz/lain/blob/master/widget/weather.lua#L35-L39) +`units` | Temperature units system | string | "metric" +`lang` | API data localization | string | "en" +`cnt` | Forecast days interval | integer | 5 +`date_cmd` | Forecast notification format style | string | "date -u -d @%d +'%%a %%d'" +`icons_path` | Icons path | string | `lain/icons/openweathermap` +`notification_preset` | Preset for notifications | table | empty table +`notification_text_fun` | Function to format forecast notifications | function | see `notification_text_fun` below +`weather_na_markup` | Markup to be used when weather textbox is not available | text | " N/A " +`followtag` | Display the notification on currently focused screen | boolean | false +`showpopup` | Display popups with mouse hovering | string, possible values: "on", "off" | "on" +`settings` | User settings | function | empty function + +- ``default_current_call`` + + `"curl -s 'http://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s'"` + + You can rewrite it using any fetcher solution you like, or you can modify it in order to fetch data by city name, instead of ID: just replace `id` with `q`: + + `"curl -s 'http://api.openweathermap.org/data/2.5/weather?q=%s&units=%s&lang=%s'"` + + and set `city_id` with your city name, for instance `city_id = "London,UK"`. + +- ``default_forecast_call`` + + `"curl -s 'http://api.openweathermap.org/data/2.5/forecast/daily?id=%s&units=%s&lang=%s&cnt=%s'"` + + Like above. + If you want to use [forecast5](http://openweathermap.org/forecast5), use this API call string: + `http://api.openweathermap.org/data/2.5/forecast?id=%s&units=%s&lang=%s&cnt=%s` + +- ``city_id`` + + An integer that defines the OpenWeatherMap ID code of your city. + To obtain it go to [OpenWeatherMap](http://openweathermap.org/) and query for your city in the top search bar. The link will look like this: + + http://openweathermap.org/city/2643743 + + your `city_id` is the number at the end. + +- ``units`` + + - For temperature in Fahrenheit use `units = "imperial"` + - For temperature in Celsius use `units = "metric"` (Lain default) + - For temperature in Kelvin use `units = "standard"` (OpenWeatherMap default) + +- ``lang`` + + See *Multilingual Support* section [here](http://openweathermap.org/current). + +- ``cnt`` + + Determines how many days to show in the forecast notification. Up to 16 if you use [forecast16](http://openweathermap.org/forecast16) (default), and up to 5 if you use [forecast5](http://openweathermap.org/forecast5). + +- ``date_cmd`` + + OpenWeatherMap time is in UNIX format, so this variable uses `date` to determine how each line in the forecast notification is formatted. Default looks like this: + + day #daynumber: forecast, temp_min - temp_max + + see `man date` for your customizations. + +- ``icons_path`` + + You can set your own icons path if you don't wish to use `lain/icons/openweathermap`. Just be sure that your icons are PNGs and named exactly like [OpenWeatherMap ones](http://openweathermap.org/weather-conditions). + +- ``notification_preset`` + + Notifications preset table. See [here](https://awesomewm.org/doc/api/libraries/naughty.html#notify) for the details. + +- ``notification_text_fun`` + ```lua + function (wn) + local day = string.gsub(read_pipe(string.format(date_cmd, wn["dt"])), "\n", "") + local tmin = math.floor(wn["temp"]["min"]) + local tmax = math.floor(wn["temp"]["max"]) + local desc = wn["weather"][1]["description"] + + return string.format("%s: %s, %d - %d ", day, desc, tmin, tmax) + end + ``` + See [here](https://github.com/lcpz/lain/issues/186#issuecomment-203400918) for a complete customization example. + +- ``followtag`` + + With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen. + +- ``settings`` + + In your `settings` function, you can use `widget` variable to refer to the textbox, and the dictionary `weather_now` to refer to data retrieved by `current_call`. The dictionary is built with [dkjson library](http://dkolf.de/src/dkjson-lua.fsl/home), and its structure is defined [here](http://openweathermap.org/weather-data). + For instance, you can retrieve current weather status and temperature in this way: + ```lua + descr = weather_now["weather"][1]["description"]:lower() + units = math.floor(weather_now["main"]["temp"]) + ``` + +## Output table + +Variable | Meaning | Type +--- | --- | --- +`widget` | The widget | `wibox.widget.textbox` +`icon` | The icon | `wibox.widget.imagebox` +`update` | Update `widget` | function +`timer` | The widget timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) +`timer_forecast` | The forecast notification timer | [`gears.timer`](https://awesomewm.org/doc/api/classes/gears.timer.html) + +## Functions + +You can attach the forecast notification to any widget like this: + +```lua +myweather.attach(obj) +``` + +Hovering over ``obj`` will display the notification. + +## Keybindings + +You can create a keybinding for the weather popup like this: + +```lua +awful.key( { "Mod1" }, "w", function () myweather.show(5) end ) +``` + +where ``show`` argument is an integer defining timeout seconds. diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua new file mode 100644 index 000000000..cc7a56e45 --- /dev/null +++ b/config/awesome/rc.lua @@ -0,0 +1,545 @@ + -- Standard awesome library +local gears = require("gears") --Utilities such as color parsing and objects +local awful = require("awful") --Everything related to window managment +require("awful.autofocus") + -- Custom libraries +local battery_widget = require("awesome-wm-widgets.battery-widget.battery") +local volume_widget = require('awesome-wm-widgets.volume-widget.volume') +local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness") +local logout_menu_widget = require("awesome-wm-widgets.logout-menu-widget.logout-menu") + -- Widget and layout library +local wibox = require("wibox") + -- Theme handling library +local beautiful = require("beautiful") + -- Notification library +local naughty = require("naughty") +naughty.config.defaults['icon_size'] = 100 + -- Lain library +local lain = require("lain") +-- Enable hotkeys help widget for VIM and other apps +-- when client with a matching name is opened: +local hotkeys_popup = require("awful.hotkeys_popup").widget + require("awful.hotkeys_popup.keys") +local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility + +if awesome.startup_errors then + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) end +do + local in_error = false + awesome.connect_signal("debug::error", function (err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) +end +local function run_once(cmd_arr) + for _, cmd in ipairs(cmd_arr) do + awful.spawn.with_shell(string.format("pgrep -u $USER -fx '%s' > /dev/null || (%s)", cmd, cmd)) + end +end +run_once({ "unclutter -root" }) -- entries must be comma-separated + +local themes = { + "gruvbox-dark" -- 1 +} +local chosen_theme = themes[1] +local theme_path = string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme) +beautiful.init(theme_path) +beautiful.init(string.format(gears.filesystem.get_configuration_dir() .. "/themes/%s/theme.lua", chosen_theme)) + +awful.layout.suit.tile.left.mirror = true +awful.layout.layouts = { + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + --awful.layout.suit.fair, + --awful.layout.suit.fair.horizontal, + --awful.layout.suit.spiral, + --awful.layout.suit.spiral.dwindle, + awful.layout.suit.max, + --awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.floating, + --awful.layout.suit.corner.nw, + --awful.layout.suit.corner.ne, + --awful.layout.suit.corner.sw, + --awful.layout.suit.corner.se, + --lain.layout.cascade, + --lain.layout.cascade.tile, + --lain.layout.centerwork, + --lain.layout.centerwork.horizontal, + --lain.layout.termfair, + --lain.layout.termfair.center, +} + +lain.layout.termfair.nmaster = 3 +lain.layout.termfair.ncol = 1 +lain.layout.termfair.center.nmaster = 3 +lain.layout.termfair.center.ncol = 1 +lain.layout.cascade.tile.offset_x = 2 +lain.layout.cascade.tile.offset_y = 32 +lain.layout.cascade.tile.extra_padding = 5 +lain.layout.cascade.tile.nmaster = 5 +lain.layout.cascade.tile.ncol = 2 + +awful.util.terminal = terminal + +local editor = os.getenv("EDITOR") or "/home/drk/.local/bin/./neovide" +local editorgui = "emacsclient -c -a 'emacs'" +local terminal = "alacritty" +local filemanager = "alacritty -e ./.config/vifm/scripts/vifmrun" +local filemanagergui = "pcmanfm" +local audiomixer = "alacritty -e pulsemixer" +local audiomixer2 = "alacritty -e alsamixer" +local browser = "firefox" +local browser2 = "qutebrowser" +local musicplayer = "alacritty -e musikcube" +local musicplayergui = "lollypop" +local emailclient = "thunderbird" +local element = "element-desktop" +local whatsapp = 'firefox --new-window web.whatsapp.com' +-- Key bindings variables +local modkey = "Mod4" +local altkey = "Mod1" +local modkey1 = "Control" + +awful.util.tagnames = { " CODE ", " WEB ", " MUSIC ", " CHAT ", " TERM1 ", " TERM2 ", " WORK1 ", " WORK2 ", " GAME " } + +awful.util.taglist_buttons = my_table.join( + awful.button({ }, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), + awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) +) +awful.util.tasklist_buttons = my_table.join( + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + c:emit_signal("request::activate", "tasklist", {raise = true}) + end + end), + awful.button({ }, 3, function () + local instance = nil + + return function () + if instance and instance.wibox.visible then + instance:hide() + instance = nil + else + instance = awful.menu.clients({theme = {width = 250}}) + end + end + end), + awful.button({ }, 4, function () awful.client.focus.byidx(1) end), + awful.button({ }, 5, function () awful.client.focus.byidx(-1) end) +) +screen.connect_signal("property::geometry", function(s) + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end +end) +awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end) + +-- Mouse bindings +root.buttons(gears.table.join( + awful.button({ }, 4, awful.tag.viewnext), + awful.button({ }, 5, awful.tag.viewprev) +)) + +-- Awesome things +globalkeys = my_table.join( + awful.key({ modkey, }, "s", hotkeys_popup.show_help, + {description="show help", group="awesome"}), + awful.key({ modkey, "Control" }, "r", awesome.restart, + {description = "reload awesome", group = "awesome"}), + awful.key({ modkey, "Shift" }, "q", awesome.quit, + {description = "quit awesome", group = "awesome"}), + +-- Tag browsing arrow keys and escape + awful.key({ modkey, }, "Left", awful.tag.viewprev, + {description = "view previous", group = "tag"}), + awful.key({ modkey, }, "Right", awful.tag.viewnext, + {description = "view next", group = "tag"}), + awful.key({ modkey, }, "Escape", awful.tag.history.restore, + {description = "go back", group = "tag"}), + +-- Tag browsing alt + tab + awful.key({ altkey, }, "Tab", awful.tag.viewnext, + {description = "view next", group = "tag"}), + awful.key({ altkey, "Shift" }, "Tab", awful.tag.viewprev, + {description = "view previous", group = "tag"}), + +-- Copy primary to clipboard (terminals to gtk) + awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end, + {description = "copy terminal to gtk", group = "hotkeys"}), + +-- Copy clipboard to primary (gtk to terminals) + awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end, + {description = "copy gtk to terminal", group = "hotkeys"}), + +-- Client focus + awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) end, + {description = "focus next by index", group = "client"}), + awful.key({ modkey, }, "k", function () awful.client.focus.byidx(-1) end, + {description = "focus previous by index", group = "client"}), + +-- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, + {description = "swap with next client by index", group = "client"}), + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, + {description = "swap with previous client by index", group = "client"}), + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, + {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, + {description = "focus the previous screen", group = "screen"}), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto, + {description = "jump to urgent client", group = "client"}), + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + {description = "go back", group = "client"}), + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, + {description = "increase master width factor", group = "layout"}), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, + {description = "decrease master width factor", group = "layout"}), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, + {description = "increase the number of master clients", group = "layout"}), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, + {description = "decrease the number of master clients", group = "layout"}), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, + {description = "increase the number of columns", group = "layout"}), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, + {description = "decrease the number of columns", group = "layout"}), + awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, + {description = "select next", group = "layout"}), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, + {description = "select previous", group = "layout"}), + +-- Rofi + awful.key({ modkey }, "d", function () awful.spawn(string.format("rofi -show drun", beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) end, + {description = "show rofi drun menu", group = "hotkeys"}), + awful.key({ modkey }, "r", function () awful.spawn(string.format("rofi -show run", beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) end, + {description = "show rofi run menu", group = "hotkeys"}), + awful.key({ modkey }, "Tab", function () awful.spawn(string.format("rofi -show window", beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) end, + {description = "show rofi window menu", group = "hotkeys"}), + awful.key({ modkey }, "w", function () awful.util.spawn("./.shell-scripts/rofi-wifi-menu.sh") end, + {description = "show rofi wifi menu", group = "hotkeys"}), + +-- Keyboard Layouts + awful.key({ modkey, "Shift" }, "e", function () awful.util.spawn("setxkbmap -layout es") end, + {description = "switch to es keyboard layout", group = "keyboard"}), + awful.key({ modkey, "Shift" }, "u", function () awful.util.spawn("setxkbmap -layout us") end, + {description = "switch to us keyboard layout", group = "keyboard"}), + +-- Apps + -- terminal + awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + {description = "open a terminal", group = "launcher"}), + -- code + awful.key({ modkey }, "F1", function () awful.spawn(editorgui) end, + {description = "launch emacs", group = "apps"}), + awful.key({ modkey, "Shift" }, "F1", function () awful.spawn(editor) end, + {description = "launch spacevim", group = "apps"}), + -- web + awful.key({ modkey }, "F2", function () awful.spawn(browser) end, + {description = "launch firefox", group = "apps"}), + awful.key({ modkey, "Shift" }, "F2", function () awful.spawn(browser2) end, + {description = "launch qutebrowser", group = "apps"}), + -- music + awful.key({ modkey }, "F3", function () awful.spawn(musicplayer) end, + {description = "launch musikcube", group = "apps"}), + awful.key({ modkey, "Shift" }, "F3", function () awful.spawn(musicplayergui) end, + {description = "launch lollypop", group = "apps"}), + -- chat + awful.key({ modkey }, "F4", function () awful.spawn(element) end, + {description = "launch element", group = "apps"}), + awful.key({ modkey, "Shift" }, "F4", function () awful.spawn(whatsapp) end, + {description = "launch whatsapp", group = "apps"}), + -- term1, term2, work1, work2 + awful.key({ modkey, "Shift" }, "f", function () awful.spawn(filemanager) end, + {description = "launch vifm", group = "apps"}), + awful.key({ modkey, altkey }, "f", function () awful.spawn(filemanagergui) end, + {description = "launch pcmanfm", group = "apps"}), + awful.key({ modkey, "Shift" }, "m", function () awful.spawn(audiomixer) end, + {description = "launch pulsemixer", group = "apps"}), + awful.key({ modkey, altkey }, "m", function () awful.spawn(audiomixer2) end, + {description = "launch alsamixer", group = "apps"}), + -- game + awful.key({ modkey }, "F9", function () awful.util.spawn("retroarch") end, + {description = "launch retroarch", group = "apps"}), + +-- Volume Control + awful.key({}, "XF86AudioRaiseVolume", function() volume_widget:inc(5) end, + {description = "increase volume", group = "volume"}), + awful.key({}, "XF86AudioLowerVolume", function() volume_widget:dec(5) end, + {description = "decrease volume", group = "volume"}), + awful.key({}, "XF86AudioMute", function() volume_widget:toggle() end, + {description = "mute volume", group = "volume"}), + +-- Screenshot + awful.key({}, "Print", function() awful.util.spawn("scrot") end, + {description = "take a complete screenshot", group = "screenshot"}), + awful.key({"Control"}, "Print", function() awful.util.spawn("scrot -s") end, + {description = "take an area screenshot", group = "screenshot"}), + +-- Brightness + awful.key({}, "XF86MonBrightnessUp", function () brightness_widget:inc(5) end, + {description = "increase brightness", group = "brightness"}), + awful.key({}, "XF86MonBrightnessDown", function () brightness_widget:dec(5) end, + {description = "decrease brightness", group = "brightness"}), + +-- Screen configuration + awful.key({ modkey }, "p", function() awful.util.spawn("arandr") end, + {description = "launch screen configuration tool", group = ("screen")}), + +-- Show/Hide Wibox + awful.key({ modkey }, "b", function () + for s in screen do + s.mywibox.visible = not s.mywibox.visible + if s.mybottomwibox then + s.mybottomwibox.visible = not s.mybottomwibox.visible + end + end + end, + {description = "toggle wibox", group = "awesome"}), + +-- On the fly useless gaps change + awful.key({ altkey, "Control" }, "j", function () lain.util.useless_gaps_resize(1) end, + {description = "increment gaps", group = "tag"}), + awful.key({ altkey, "Control" }, "l", function () lain.util.useless_gaps_resize(-1) end, + {description = "decrement gaps", group = "tag"}), + +-- Dynamic tagging + awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end, + {description = "add new tag", group = "tag"}), + awful.key({ modkey, "Control" }, "r", function () lain.util.rename_tag() end, + {description = "rename tag", group = "tag"}), + awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end, + {description = "move tag to the left", group = "tag"}), + awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end, + {description = "move tag to the right", group = "tag"}), + awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end, + {description = "delete tag", group = "tag"}), + +-- Minimize, maximize, moving clients, fullscreen, etc + awful.key({ modkey, "Control" }, "n", + function () + local c = awful.client.restore() + -- Focus restored client + if c then + client.focus = c + c:raise() + end + end, + {description = "restore minimized", group = "client"}) +) +clientkeys = gears.table.join( + awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen c:raise() end, + {description = "toggle fullscreen", group = "client"}), + awful.key({ modkey }, "q", function (c) c:kill() end, + {description = "close", group = "client"}), + awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, + {description = "toggle floating", group = "client"}), + awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, + {description = "move to master", group = "client"}), + awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, + {description = "move to screen", group = "client"}), + awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, + {description = "toggle keep on top", group = "client"}), + awful.key({ modkey, }, "n", + function (c) + c.minimized = true + end , + {description = "minimize", group = "client"}), + awful.key({ modkey, }, "m", + function (c) + c.maximized = not c.maximized + c:raise() + end , + {description = "(un)maximize", group = "client"}), + awful.key({ modkey, "Control" }, "m", + function (c) + c.maximized_vertical = not c.maximized_vertical + c:raise() + end , + {description = "(un)maximize vertically", group = "client"}), + awful.key({ modkey, "Shift" }, "m", + function (c) + c.maximized_horizontal = not c.maximized_horizontal + c:raise() + end , + {description = "(un)maximize horizontally", group = "client"}) +) + +-- Bind all key numbers to tags. +-- Be careful: we use keycodes to make it works on any keyboard layout. +-- This should map on the top row of your keyboard, usually 1 to 9. +for i = 1, 9 do + -- Hack to only show tags 1 and 9 in the shortcut window (mod+s) + local descr_view, descr_toggle, descr_move, descr_toggle_focus + if i == 1 or i == 9 then + descr_view = {description = "view tag #", group = "tag"} + descr_toggle = {description = "toggle tag #", group = "tag"} + descr_move = {description = "move focused client to tag #", group = "tag"} + descr_toggle_focus = {description = "toggle focused client on tag #", group = "tag"} + end + globalkeys = my_table.join(globalkeys, + -- View tag only. + awful.key({ modkey }, "#" .. i + 9, + function () + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end, + descr_view), + -- Toggle tag display. + awful.key({ modkey, "Control" }, "#" .. i + 9, + function () + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, + descr_toggle), + -- Move client to tag. + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function () + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + descr_move), + -- Toggle tag on focused client. + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function () + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end, + descr_toggle_focus) + ) +end + +-- Other mouse bindings +clientbuttons = gears.table.join( + awful.button({ }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + end), + awful.button({ modkey }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.resize(c) + end) +) + +-- Set keys +root.keys(globalkeys) + +-- Rules to apply to new clients (through the "manage" signal). +awful.rules.rules = { + -- All clients will match this rule. + { rule = { }, + properties = { border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = clientkeys, + buttons = clientbuttons, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap+awful.placement.no_offscreen, + callback = awful.client.setslave + } + }, + -- Floating clients. + { rule_any = { + instance = { + "DTA", -- Firefox addon DownThemAll. + "copyq", -- Includes session name in class. + "pinentry", + }, + class = { + "Arandr", + "Blueman-manager", + "Gpick", + "Kruler", + "MessageWin", -- kalarm. + -- "Sxiv", + "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. + "Wpa_gui", + "veromix", + "xtightvncviewer"}, + -- Note that the name property shown in xprop might be set slightly after creation of the client + -- and the name shown there might not match defined rules here. + name = { + "Event Tester", -- xev. + }, + role = { + "AlarmWindow", -- Thunderbird's calendar. + "ConfigManager", -- Thunderbird's about:config. + "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. + } + }, properties = { floating = true }}, +} + +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c) + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- if not awesome.startup then awful.client.setslave(c) end + if awesome.startup and + not c.size_hints.user_position + and not c.size_hints.program_position then + -- Prevent clients from being unreachable after screen count changes. + awful.placement.no_offscreen(c) + end +end) + +-- Enable sloppy focus, so that focus follows mouse. +client.connect_signal("mouse::enter", function(c) + c:emit_signal("request::activate", "mouse_enter", {raise = false}) +end) +client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) +client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) + +awful.util.spawn_with_shell("nitrogen --restore") +awful.util.spawn_with_shell("lxpolkit") +awful.util.spawn_with_shell("picom") +awful.util.spawn_with_shell("/usr/bin/emacs --daemon &") diff --git a/config/awesome/screenshot.png b/config/awesome/screenshot.png new file mode 100644 index 000000000..e5408264f Binary files /dev/null and b/config/awesome/screenshot.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/ac.png b/config/awesome/themes/gruvbox-dark/icons/ac.png new file mode 100644 index 000000000..96efcb4e6 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/ac.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/battery.png b/config/awesome/themes/gruvbox-dark/icons/battery.png new file mode 100644 index 000000000..8c85596da Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/battery.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/battery_empty.png b/config/awesome/themes/gruvbox-dark/icons/battery_empty.png new file mode 100644 index 000000000..00821c91e Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/battery_empty.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/battery_low.png b/config/awesome/themes/gruvbox-dark/icons/battery_low.png new file mode 100644 index 000000000..29f3fc587 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/battery_low.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/centerfair.png b/config/awesome/themes/gruvbox-dark/icons/centerfair.png new file mode 100644 index 000000000..c4f64b0f1 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/centerfair.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/centerwork.png b/config/awesome/themes/gruvbox-dark/icons/centerwork.png new file mode 100644 index 000000000..90715169a Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/centerwork.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/centerworkh.png b/config/awesome/themes/gruvbox-dark/icons/centerworkh.png new file mode 100644 index 000000000..b1d13793f Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/centerworkh.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/cpu.png b/config/awesome/themes/gruvbox-dark/icons/cpu.png new file mode 100644 index 000000000..35af1c39c Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/cpu.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/dwindle.png b/config/awesome/themes/gruvbox-dark/icons/dwindle.png new file mode 100644 index 000000000..649ea993e Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/dwindle.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/fairh.png b/config/awesome/themes/gruvbox-dark/icons/fairh.png new file mode 100644 index 000000000..62d3d99eb Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/fairh.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/fairv.png b/config/awesome/themes/gruvbox-dark/icons/fairv.png new file mode 100644 index 000000000..131dd0f91 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/fairv.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/floating.png b/config/awesome/themes/gruvbox-dark/icons/floating.png new file mode 100644 index 000000000..d25c47b96 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/floating.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/hdd.png b/config/awesome/themes/gruvbox-dark/icons/hdd.png new file mode 100644 index 000000000..0fb683399 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/hdd.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/internet.png b/config/awesome/themes/gruvbox-dark/icons/internet.png new file mode 100644 index 000000000..fdd9ae84e Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/internet.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/internet_na.png b/config/awesome/themes/gruvbox-dark/icons/internet_na.png new file mode 100644 index 000000000..67157278d Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/internet_na.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/magnifier.png b/config/awesome/themes/gruvbox-dark/icons/magnifier.png new file mode 100644 index 000000000..60d3e0d85 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/magnifier.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/mail.png b/config/awesome/themes/gruvbox-dark/icons/mail.png new file mode 100644 index 000000000..474e60204 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/mail.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/mail_on.png b/config/awesome/themes/gruvbox-dark/icons/mail_on.png new file mode 100644 index 000000000..19106d7bb Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/mail_on.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/max.png b/config/awesome/themes/gruvbox-dark/icons/max.png new file mode 100644 index 000000000..5b0a5b711 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/max.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/mem.png b/config/awesome/themes/gruvbox-dark/icons/mem.png new file mode 100644 index 000000000..7860a1a0e Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/mem.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/net.png b/config/awesome/themes/gruvbox-dark/icons/net.png new file mode 100644 index 000000000..bc42fdc3e Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/net.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/net_wired.png b/config/awesome/themes/gruvbox-dark/icons/net_wired.png new file mode 100644 index 000000000..e8cc2bded Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/net_wired.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/note.png b/config/awesome/themes/gruvbox-dark/icons/note.png new file mode 100644 index 000000000..baa29c325 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/note.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/note_on.png b/config/awesome/themes/gruvbox-dark/icons/note_on.png new file mode 100644 index 000000000..1a7ab9476 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/note_on.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/scissors.png b/config/awesome/themes/gruvbox-dark/icons/scissors.png new file mode 100644 index 000000000..f8c700de3 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/scissors.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/spiral.png b/config/awesome/themes/gruvbox-dark/icons/spiral.png new file mode 100644 index 000000000..d9ee0f6b1 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/spiral.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/square_sel.png b/config/awesome/themes/gruvbox-dark/icons/square_sel.png new file mode 100644 index 000000000..1102a9f1c Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/square_sel.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/square_unsel.png b/config/awesome/themes/gruvbox-dark/icons/square_unsel.png new file mode 100644 index 000000000..7386b85f6 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/square_unsel.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/submenu.png b/config/awesome/themes/gruvbox-dark/icons/submenu.png new file mode 100644 index 000000000..b55ebced8 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/submenu.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/task.png b/config/awesome/themes/gruvbox-dark/icons/task.png new file mode 100644 index 000000000..9701b6848 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/task.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/temp.png b/config/awesome/themes/gruvbox-dark/icons/temp.png new file mode 100644 index 000000000..6793a9fba Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/temp.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/termfair.png b/config/awesome/themes/gruvbox-dark/icons/termfair.png new file mode 100644 index 000000000..3e060236f Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/termfair.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/tile.png b/config/awesome/themes/gruvbox-dark/icons/tile.png new file mode 100644 index 000000000..922c05caf Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/tile.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/tilebottom.png b/config/awesome/themes/gruvbox-dark/icons/tilebottom.png new file mode 100644 index 000000000..6ec9cb873 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/tilebottom.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/tileleft.png b/config/awesome/themes/gruvbox-dark/icons/tileleft.png new file mode 100644 index 000000000..8e3d2d62e Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/tileleft.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/tiletop.png b/config/awesome/themes/gruvbox-dark/icons/tiletop.png new file mode 100644 index 000000000..3da75a195 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/tiletop.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/close_focus.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/close_focus.png new file mode 100644 index 000000000..b2051b02e Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/close_focus.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/close_normal.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/close_normal.png new file mode 100644 index 000000000..da6028c16 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/close_normal.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_active.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_active.png new file mode 100644 index 000000000..5fe84c0db Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_active.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_inactive.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_inactive.png new file mode 100644 index 000000000..47f19f6da Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_focus_inactive.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_active.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_active.png new file mode 100644 index 000000000..576fa3679 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_active.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_inactive.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_inactive.png new file mode 100644 index 000000000..4adc5e9dd Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/floating_normal_inactive.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_active.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_active.png new file mode 100644 index 000000000..7d9a11a12 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_active.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_inactive.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_inactive.png new file mode 100644 index 000000000..bce1d0005 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_focus_inactive.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_active.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_active.png new file mode 100644 index 000000000..9f24945b9 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_active.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_inactive.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_inactive.png new file mode 100644 index 000000000..2e56d327b Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/maximized_normal_inactive.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_active.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_active.png new file mode 100644 index 000000000..41a69e27b Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_active.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_inactive.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_inactive.png new file mode 100644 index 000000000..2f3a2be2a Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_focus_inactive.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_active.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_active.png new file mode 100644 index 000000000..0f937b7cb Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_active.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_inactive.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_inactive.png new file mode 100644 index 000000000..a9a320684 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/ontop_normal_inactive.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_active.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_active.png new file mode 100644 index 000000000..a9bc8a214 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_active.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_inactive.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_inactive.png new file mode 100644 index 000000000..5493d8ec2 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_focus_inactive.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_active.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_active.png new file mode 100644 index 000000000..1e150f585 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_active.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_inactive.png b/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_inactive.png new file mode 100644 index 000000000..7e6c99b66 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/titlebar/sticky_normal_inactive.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/vol.png b/config/awesome/themes/gruvbox-dark/icons/vol.png new file mode 100644 index 000000000..bbf33d424 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/vol.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/vol_low.png b/config/awesome/themes/gruvbox-dark/icons/vol_low.png new file mode 100644 index 000000000..aa3ce4dc8 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/vol_low.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/vol_mute.png b/config/awesome/themes/gruvbox-dark/icons/vol_mute.png new file mode 100644 index 000000000..e855fd24f Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/vol_mute.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/vol_no.png b/config/awesome/themes/gruvbox-dark/icons/vol_no.png new file mode 100644 index 000000000..bbe917bdd Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/vol_no.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/wired.png b/config/awesome/themes/gruvbox-dark/icons/wired.png new file mode 100644 index 000000000..e8cc2bded Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/wired.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/wired_na.png b/config/awesome/themes/gruvbox-dark/icons/wired_na.png new file mode 100644 index 000000000..e5c197ed9 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/wired_na.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/wireless_0.png b/config/awesome/themes/gruvbox-dark/icons/wireless_0.png new file mode 100644 index 000000000..fcd877128 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/wireless_0.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/wireless_1.png b/config/awesome/themes/gruvbox-dark/icons/wireless_1.png new file mode 100644 index 000000000..0af2040c5 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/wireless_1.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/wireless_2.png b/config/awesome/themes/gruvbox-dark/icons/wireless_2.png new file mode 100644 index 000000000..654e3ba9f Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/wireless_2.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/wireless_3.png b/config/awesome/themes/gruvbox-dark/icons/wireless_3.png new file mode 100644 index 000000000..bc42fdc3e Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/wireless_3.png differ diff --git a/config/awesome/themes/gruvbox-dark/icons/wireless_na.png b/config/awesome/themes/gruvbox-dark/icons/wireless_na.png new file mode 100644 index 000000000..7201fb2c1 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/icons/wireless_na.png differ diff --git a/config/awesome/themes/gruvbox-dark/theme.lua b/config/awesome/themes/gruvbox-dark/theme.lua new file mode 100644 index 000000000..44a0adf10 --- /dev/null +++ b/config/awesome/themes/gruvbox-dark/theme.lua @@ -0,0 +1,204 @@ +-- ____ ____ _ __ +-- | _ \| _ \| |/ / +-- | | | | |_) | ' / Clay Gomera (Drake) +-- | |_| | _ <| . \ This is my custom awesomewm gruvbox-dark theme for my laptop +-- |____/|_| \_\_|\_\ +-- + +--[[ + VARIABLES +]] + +local gears = require("gears") +local lain = require("lain") +local lain_helpers = require("lain.helpers") +local awful = require("awful") +local wibox = require("wibox") +local lgi = require("lgi") +local dpi = require("beautiful.xresources").apply_dpi + +-- Custom libraries +local battery_widget = require("awesome-wm-widgets.battery-widget.battery") +local volume_widget = require('awesome-wm-widgets.volume-widget.volume') +local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness") +local logout_menu_widget = require("awesome-wm-widgets.logout-menu-widget.logout-menu") + +local os = os +local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility + +local theme = {} +theme.machine_name = lain_helpers.first_line("/sys/class/dmi/id/product_name") +theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/gruvbox-dark" + +-- fonts +local theme_font_type = "mononoki Nerd Font" +local theme_font_size = "9" +local hotkeys_font_type = "mononoki Nerd Font" +local hotkeys_font_size = "9" +theme.font = theme_font_type .. " " .. theme_font_size +theme.hotkeys_font = hotkeys_font_type .. " " .. hotkeys_font_size +theme.hotkeys_description_font = theme.font + +theme.fg_normal = "#ebdbb2" +theme.fg_focus = "#FB4934" +theme.fg_urgent = "#CC9393" +theme.bg_normal = "#1d2021" +theme.bg_focus = "#313131" +theme.bg_urgent = theme.bg_normal +theme.border_width = dpi(1) +theme.border_normal = "#3F3F3F" +theme.border_focus = "#FB4934" +theme.border_marked = "#CC9393" +theme.tasklist_bg_focus = theme.bg_normal +theme.titlebar_bg_focus = theme.bg_focus +theme.titlebar_bg_normal = theme.bg_normal +theme.titlebar_fg_focus = "#FABD2F" -- gruvbox yellow +theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png" +theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png" +theme.layout_tile = theme.dir .. "/icons/tile.png" +theme.layout_tileleft = theme.dir .. "/icons/tileleft.png" +theme.layout_tilebottom = theme.dir .. "/icons/tilebottom.png" +theme.layout_tiletop = theme.dir .. "/icons/tiletop.png" +theme.layout_fairv = theme.dir .. "/icons/fairv.png" +theme.layout_fairh = theme.dir .. "/icons/fairh.png" +theme.layout_spiral = theme.dir .. "/icons/spiral.png" +theme.layout_dwindle = theme.dir .. "/icons/dwindle.png" +theme.layout_max = theme.dir .. "/icons/max.png" +theme.layout_fullscreen = theme.dir .. "/icons/fullscreen.png" +theme.layout_magnifier = theme.dir .. "/icons/magnifier.png" +theme.layout_floating = theme.dir .. "/icons/floating.png" +theme.widget_ac = theme.dir .. "/icons/ac.png" +theme.widget_battery = theme.dir .. "/icons/battery.png" +theme.widget_battery_low = theme.dir .. "/icons/battery_low.png" +theme.widget_battery_empty = theme.dir .. "/icons/battery_empty.png" +theme.widget_mem = theme.dir .. "/icons/mem.png" +theme.widget_cpu = theme.dir .. "/icons/cpu.png" +theme.widget_temp = theme.dir .. "/icons/temp.png" +theme.widget_wireless_0 = theme.dir .. "/icons/wireless_0.png" +theme.widget_wireless_1 = theme.dir .. "/icons/wireless_1.png" +theme.widget_wireless_2 = theme.dir .. "/icons/wireless_2.png" +theme.widget_wireless_3 = theme.dir .. "/icons/wireless_3.png" +theme.widget_wireless_na = theme.dir .. "/icons/wireless_na.png" +theme.widget_wired = theme.dir .. "/icons/wired.png" +theme.widget_wired_na = theme.dir .. "/icons/wired_na.png" +theme.widget_hdd = theme.dir .. "/icons/hdd.png" +theme.widget_music = theme.dir .. "/icons/note.png" +theme.widget_music_on = theme.dir .. "/icons/note_on.png" +theme.widget_vol = theme.dir .. "/icons/vol.png" +theme.widget_vol_low = theme.dir .. "/icons/vol_low.png" +theme.widget_vol_no = theme.dir .. "/icons/vol_no.png" +theme.widget_vol_mute = theme.dir .. "/icons/vol_mute.png" +theme.widget_mail = theme.dir .. "/icons/mail.png" +theme.widget_mail_on = theme.dir .. "/icons/mail_on.png" +theme.tasklist_plain_task_name = true +theme.tasklist_disable_icon = true +theme.useless_gap = dpi(2) +theme.titlebar_close_button_focus = theme.dir .. "/icons/titlebar/close_focus.png" +theme.titlebar_close_button_normal = theme.dir .. "/icons/titlebar/close_normal.png" +theme.titlebar_ontop_button_focus_active = theme.dir .. "/icons/titlebar/ontop_focus_active.png" +theme.titlebar_ontop_button_normal_active = theme.dir .. "/icons/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_inactive = theme.dir .. "/icons/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_inactive = theme.dir .. "/icons/titlebar/ontop_normal_inactive.png" +theme.titlebar_sticky_button_focus_active = theme.dir .. "/icons/titlebar/sticky_focus_active.png" +theme.titlebar_sticky_button_normal_active = theme.dir .. "/icons/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_inactive = theme.dir .. "/icons/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_inactive = theme.dir .. "/icons/titlebar/sticky_normal_inactive.png" +theme.titlebar_floating_button_focus_active = theme.dir .. "/icons/titlebar/floating_focus_active.png" +theme.titlebar_floating_button_normal_active = theme.dir .. "/icons/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_inactive = theme.dir .. "/icons/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_inactive = theme.dir .. "/icons/titlebar/floating_normal_inactive.png" +theme.titlebar_maximized_button_focus_active = theme.dir .. "/icons/titlebar/maximized_focus_active.png" +theme.titlebar_maximized_button_normal_active = theme.dir .. "/icons/titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_inactive = theme.dir .. "/icons/titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_inactive = theme.dir .. "/icons/titlebar/maximized_normal_inactive.png" + +local markup = lain.util.markup +local separators = lain.util.separators + +-- Textclock +local clockicon = wibox.widget.imagebox(theme.widget_clock) +local clock = awful.widget.watch( + "date +'%a %d %b %I:%M '", 60, + function(widget, stdout) + widget:set_markup(" " .. markup.font(theme.font, stdout)) + end +) +-- Separators +local spr = wibox.widget.textbox(' ') +local arrl_dl = separators.arrow_left(theme.bg_focus, "alpha") +local arrl_ld = separators.arrow_left("alpha", theme.bg_focus) + +function theme.at_screen_connect(s) + -- Tags + awful.tag(awful.util.tagnames, + s, awful.layout.layouts[1] -- Use first defined layout as default for initialized tags + ) + + -- Create a promptbox for each screen + s.mypromptbox = awful.widget.prompt() + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + s.mylayoutbox = awful.widget.layoutbox(s) + s.mylayoutbox:buttons(my_table.join( + awful.button({}, 1, function () awful.layout.inc( 1) end), + awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end), + awful.button({}, 3, function () awful.layout.inc(-1) end), + awful.button({}, 4, function () awful.layout.inc( 1) end), + awful.button({}, 5, function () awful.layout.inc(-1) end))) + + -- Keyboard map indicator and switcher + mykeyboardlayout = awful.widget.keyboardlayout() + -- Create a taglist widget + s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons) + + -- Create a tasklist widget + s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) + + -- Create the wibox + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(20), bg = theme.bg_normal, fg = theme.fg_normal }) + + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.stack, + { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + wibox.container.background(s.mylayoutbox, theme.bg_focus), + spr, + s.mytaglist, + }, + nil, + { -- Right widgets. + layout = wibox.layout.fixed.horizontal, + arrl_ld, + wibox.container.background(mykeyboardlayout, theme.bg_focus), + arrl_dl, + arrl_ld, + wibox.container.background(volume_widget{ + widget_type = 'icon_and_text', + device = 'default'}, theme.bg_focus), + arrl_dl, + arrl_ld, + wibox.container.background(battery_widget(), theme.bg_focus), + arrl_dl, + arrl_ld, + wibox.container.background(brightness_widget{ + type = 'icon_and_text', + program = 'xbacklight'}, theme.bg_focus), + arrl_dl, + arrl_ld, + wibox.container.background(logout_menu_widget{ + font = 'mononoki Nerd Font'}, theme.bg_focus), + }, + }, + { + wibox.container.background(clock, theme.bg_normal), + valign = "center", + halign = "center", + layout = wibox.container.place + }, +} + end + +return theme diff --git a/config/awesome/themes/gruvbox-dark/wall.png b/config/awesome/themes/gruvbox-dark/wall.png new file mode 100644 index 000000000..0989db926 Binary files /dev/null and b/config/awesome/themes/gruvbox-dark/wall.png differ diff --git a/config/fish/config.fish b/config/fish/config.fish new file mode 100644 index 000000000..7fa4c1967 --- /dev/null +++ b/config/fish/config.fish @@ -0,0 +1,152 @@ +## ____ ____ _ __ +## | _ \| _ \| |/ / +## | | | | |_) | ' / Clay Gomera (Drake) +## | |_| | _ <| . \ This is my custom fish config for my laptop +## |____/|_| \_\_|\_\ +## + +if status is-interactive + # Commands to run in interactive sessions can go here +end + +### EXPORT +set -U fish_greeting "" +set EDITOR "emacsclient -t -a ''" # $EDITOR use Emacs in terminal +set VISUAL "emacsclient -c -a emacs" # $VISUAL use Emacs in GUI mode + +### ADDING TO THE PATH +# First line removes the path; second line sets it. Without the first line, +# your path gets massive and fish becomes very slow. +set -e fish_user_paths +set -U fish_user_paths $HOME/.local/bin $HOME/Applications $fish_user_paths + +# Vi mode +function fish_user_key_bindings + # fish_default_key_bindings + fish_vi_key_bindings +end + +### "bat" as manpager +set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" + +### AUTOCOMPLETE AND HIGHLIGHT COLORS ### +set fish_color_normal brcyan +set fish_color_autosuggestion '#7d7d7d' +set fish_color_command brcyan +set fish_color_error '#ff6c6b' +set fish_color_param brcyan + +### ALIASES +# navigation +alias ..='cd ..' +alias .2='cd ../..' +alias .3='cd ../../..' +alias .4='cd ../../../..' +alias .5='cd ../../../../..' + +# text editors +alias vim='nvim' + +# bat as cat +alias cat='bat' + +# DOOM emacs +alias doom-sync="~/.emacs.d/bin/doom sync" +alias doom-doctor="~/.emacs.d/bin/doom doctor" +alias doom-upgrade="~/.emacs.d/bin/doom upgrade" +alias doom-purge="~/.emacs.d/bin/doom purge" +alias em='/usr/bin/emacs -nw' +alias emacs="emacsclient -c -a 'emacs'" + +# Changing "ls" to "exa" +alias ls='exa -al --color=always --group-directories-first' # my preferred listing +alias la='exa -a --color=always --group-directories-first' # all files and dirs +alias ll='exa -l --color=always --group-directories-first' # long format +alias lt='exa -aT --color=always --group-directories-first' # tree listing +alias l.='exa -a | egrep "^\."' + +# xbps +alias xb-up='sudo xbps-install -Su' # update the whole system +alias xb-get='sudo xbps-install' # install a program +alias xb-qry='sudo xbps-query' # query details about a program +alias xb-rmv='sudo xbps-remove' # remove a package with all its dependencies (it may brake something) +alias xb-cln='sudo xbps-remove -o' # remove unnecesary packages +alias xb-cln-cache='sudo xbps-remove -O' # clean the package cache + +# xbps-src +alias xbsrc='~/.void-packages/./xbps-src pkg' +alias xbins='cd ~/.void-packages/ && xi' + +# confirm before overwriting something +alias rm='rm -i' +alias mv='mv -i' +alias cp='cp -i' + +# git +alias gt-cl='git clone' + +# ani-cli +alias ani='ani-cli' +alias ani-q='ani-cli -q' # to select video quality + +# ytfzf +alias yt='ytfzf -f' + +# mount and unmount drives +alias mnt='sudo mount' +alias umnt='sudo umount' + +# mixers +alias mx='pulsemixer' +alias amx='alsamixer' + +# music player +alias mk='musikcube' + +# battery (just for laptops) +alias bt='acpi' + +# power management +alias po='loginctl poweroff' +alias sp='loginctl suspend' +alias rb='loginctl reboot' + +# file manager +alias fm='./.config/vifm/scripts/vifmrun' + +# system monitor +alias tp='htop' +alias top='htop' + +# get error messages from journalctl +alias jctl="journalctl -p 3 -xb" + +# youtube-dl +alias yta-aac="youtube-dl --extract-audio --audio-format aac " +alias yta-best="youtube-dl --extract-audio --audio-format best " +alias yta-flac="youtube-dl --extract-audio --audio-format flac " +alias yta-m4a="youtube-dl --extract-audio --audio-format m4a " +alias yta-mp3="youtube-dl --extract-audio --audio-format mp3 " +alias yta-opus="youtube-dl --extract-audio --audio-format opus " +alias yta-vorbis="youtube-dl --extract-audio --audio-format vorbis " +alias yta-wav="youtube-dl --extract-audio --audio-format wav " +alias ytv-best="youtube-dl -f bestvideo+bestaudio " + +# Network Manager and bluetooth +alias netstats='nmcli dev' +alias wfi='nmtui-connect' +alias wfi-scan='nmcli dev wifi list' +alias wfi-edit='nmtui-edit' +alias blt='bluetoothctl' + +# cd to diferent directories +alias games='cd /media/Storage/multimedia/games/linux && ls' +alias anime='cd /media/Storage/multimedia/anime/ && ls' +alias manga='cd /media/Storage/multimedia/manga/ && ls' +alias videos='cd /media/Storage/multimedia/videos/ && ls' + +# the terminal rickroll +alias rr='curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash' + +### SETTING THE STARSHIP PROMPT ### +starship init fish | source diff --git a/config/picom.conf b/config/picom.conf new file mode 100755 index 000000000..3787ad9ea --- /dev/null +++ b/config/picom.conf @@ -0,0 +1,427 @@ +## ____ ____ _ __ +## | _ \| _ \| |/ / +## | | | | |_) | ' / Clay Gomera (Drake) +## | |_| | _ <| . \ This is my custom picom config for my laptop +## |____/|_| \_\_|\_\ +## + +################################# +# 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 = 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; + +# 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 = [] +shadow-exclude = [ + "name = 'Notification'", + "class_g = 'Conky'", + "class_g ?= 'Notify-osd'", + "class_g = 'Cairo-clock'", + "_GTK_FRAME_EXTENTS@:c" +]; + +# 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.028 +fade-in-step = 0.05; + +# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) +# fade-out-step = 0.03 +fade-out-step = 0.05; + +# 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 = [] + +# 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.00; + +# 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_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 = [ "class_g = 'Cairo-clock'" ]; + +# 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'" ]; +# +# opaity-rule = [] + + +################################# +# 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 = 0 + +# Exclude conditions for rounded corners. +rounded-corners-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'" +]; + + +################################# +# 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 = "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; + +# Specify refresh rate of the screen. If not specified or 0, picom will +# try detecting this with X RandR extension. +# +# refresh-rate = 60 +refresh-rate = 0; + +# 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 = 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. 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 = false + +# 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; + +# 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/starship.toml b/config/starship.toml new file mode 100755 index 000000000..ff9488192 --- /dev/null +++ b/config/starship.toml @@ -0,0 +1,39 @@ +## ____ ____ _ __ +## | _ \| _ \| |/ / +## | | | | |_) | ' / Clay Gomera (Drake) +## | |_| | _ <| . \ This is my custom starship config for my laptop +## |____/|_| \_\_|\_\ +## + +# ~/.config/starship.toml + +# disable starship from forcing a new line to be taken. Solved the empty line +# at start of terminal +add_newline = false + +[line_break] +disabled = true + +# character settings +[character] +error_symbol = "[✘](bold red) " +success_symbol = "[↳](bold green)" + +# directory settings +[directory] +truncation_length = 5 +format = "[$path]($style)[$lock_symbol]($lock_style) " + +# shows the hostname on new lines +[hostname] +ssh_only = false +disabled = false +style = "bold italic #87A752" + +[package] +disabled = true + +# the user name will always show up +[username] +style_user = "bold dimmed blue" +show_always = true diff --git a/config/vifm/colors/Default.vifm b/config/vifm/colors/Default.vifm new file mode 100644 index 000000000..1647f96c3 --- /dev/null +++ b/config/vifm/colors/Default.vifm @@ -0,0 +1,87 @@ +" You can edit this file by hand. +" The " character at the beginning of a line comments out the line. +" Blank lines are ignored. + +" The Default color scheme is used for any directory that does not have +" a specified scheme and for parts of user interface like menus. A +" color scheme set for a base directory will also +" be used for the sub directories. + +" The standard ncurses colors are: +" Default = -1 = None, can be used for transparency or default color +" Black = 0 +" Red = 1 +" Green = 2 +" Yellow = 3 +" Blue = 4 +" Magenta = 5 +" Cyan = 6 +" White = 7 + +" Light versions of colors are also available (they set bold +" attribute in terminals with less than 16 colors): +" LightBlack +" LightRed +" LightGreen +" LightYellow +" LightBlue +" LightMagenta +" LightCyan +" LightWhite + +" Available attributes (some of them can be combined): +" bold +" underline +" reverse or inverse +" standout +" italic (on unsupported systems becomes reverse) +" combine +" none + +" Vifm supports 256 colors you can use color numbers 0-255 +" (requires properly set up terminal: set your TERM environment variable +" (directly or using resources) to some color terminal name (e.g. +" xterm-256color) from /usr/lib/terminfo/; you can check current number +" of colors in your terminal with tput colors command) + +" highlight group cterm=attrs ctermfg=foreground_color ctermbg=background_color + +highlight clear + +highlight Win cterm=none ctermfg=white ctermbg=black +highlight Directory cterm=bold ctermfg=cyan ctermbg=default +highlight Link cterm=bold ctermfg=yellow ctermbg=default +highlight BrokenLink cterm=bold ctermfg=red ctermbg=default +highlight HardLink cterm=none ctermfg=yellow ctermbg=default +highlight Socket cterm=bold ctermfg=magenta ctermbg=default +highlight Device cterm=bold ctermfg=red ctermbg=default +highlight Fifo cterm=bold ctermfg=cyan ctermbg=default +highlight Executable cterm=bold ctermfg=green ctermbg=default +highlight Selected cterm=bold ctermfg=magenta ctermbg=default +highlight CurrLine cterm=bold,reverse ctermfg=default ctermbg=default +highlight TopLine cterm=none ctermfg=black ctermbg=white +highlight TopLineSel cterm=bold ctermfg=black ctermbg=default +highlight StatusLine cterm=bold ctermfg=black ctermbg=white +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black +highlight Border cterm=none ctermfg=black ctermbg=white +highlight OtherLine ctermfg=default ctermbg=default +highlight JobLine cterm=bold,reverse ctermfg=black ctermbg=white +highlight SuggestBox cterm=bold ctermfg=default ctermbg=default +highlight CmpMismatch cterm=bold ctermfg=white ctermbg=red +highlight AuxWin ctermfg=default ctermbg=default +highlight TabLine cterm=none ctermfg=white ctermbg=black +highlight TabLineSel cterm=bold,reverse ctermfg=default ctermbg=default +highlight User1 ctermfg=default ctermbg=default +highlight User2 ctermfg=default ctermbg=default +highlight User3 ctermfg=default ctermbg=default +highlight User4 ctermfg=default ctermbg=default +highlight User5 ctermfg=default ctermbg=default +highlight User6 ctermfg=default ctermbg=default +highlight User7 ctermfg=default ctermbg=default +highlight User8 ctermfg=default ctermbg=default +highlight User9 ctermfg=default ctermbg=default +highlight OtherWin ctermfg=default ctermbg=default +highlight LineNr ctermfg=default ctermbg=default +highlight OddLine ctermfg=default ctermbg=default diff --git a/config/vifm/scripts/README b/config/vifm/scripts/README new file mode 100644 index 000000000..769495228 --- /dev/null +++ b/config/vifm/scripts/README @@ -0,0 +1,6 @@ +This directory is dedicated for user-supplied scripts/executables. +vifm modifies its PATH environment variable to let user run those +scripts without specifying full path. All subdirectories are added +as well. File in a subdirectory overrules file with the same name +in parent directories. Restart might be needed to recognize files +in newly created or renamed subdirectories. \ No newline at end of file diff --git a/config/vifm/scripts/vifmimg b/config/vifm/scripts/vifmimg new file mode 100755 index 000000000..e5d8763a0 --- /dev/null +++ b/config/vifm/scripts/vifmimg @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +readonly ID_PREVIEW="preview" + +#AUTO_REMOVE="yes" +# By enabling this option the script will remove the preview file after it is drawn +# and by doing so the preview will always be up-to-date with the file. +# This however, requires more CPU and therefore affects the overall performance. + +if [ -e "$FIFO_UEBERZUG" ]; then + if [[ "$1" == "draw" ]]; then + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="${PWD}/$6") \ + > "$FIFO_UEBERZUG" + + elif [[ "$1" == "videopreview" ]]; then + echo -e "Loading preview..\nFile: $6" + [[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/" + [[ ! -f "/tmp${PWD}/$6.png" ]] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp${PWD}/$6.png" -s 0 -q 10 + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp${PWD}/$6.png") \ + > "$FIFO_UEBERZUG" + + elif [[ "$1" == "gifpreview" ]]; then + echo -e "Loading preview..\nFile: $6" + [[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/" && convert -coalesce "${PWD}/$6" "/tmp${PWD}/$6/$6.png" + for frame in $(ls -1 /tmp${PWD}/$6/$6*.png | sort -V); do + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="$frame") \ + > "$FIFO_UEBERZUG" + # Sleep between frames to make the animation smooth. + sleep .07 + done + + elif [[ "$1" == "pdfpreview" ]]; then + echo -e "Loading preview..\nFile: $6" + [[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/" + [[ ! -f "/tmp${PWD}/$6.png" ]] && pdftoppm -png -singlefile "$6" "/tmp${PWD}/$6" + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp${PWD}/$6.png") \ + > "$FIFO_UEBERZUG" + + elif [[ "$1" == "clear" ]]; then + declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \ + > "$FIFO_UEBERZUG" + [[ ! -z $AUTO_REMOVE ]] && [[ -f "/tmp${PWD}/$6.png" ]] && rm -f "/tmp${PWD}/$6.png" + [[ ! -z $AUTO_REMOVE ]] && [[ -d "/tmp${PWD}/$6/" ]] && rm -rf "/tmp${PWD}/$6/" + + fi +fi diff --git a/config/vifm/scripts/vifmrun b/config/vifm/scripts/vifmrun new file mode 100755 index 000000000..9eda32a99 --- /dev/null +++ b/config/vifm/scripts/vifmrun @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" + +function cleanup { + rm "$FIFO_UEBERZUG" 2>/dev/null + pkill -P $$ 2>/dev/null +} + +rm "$FIFO_UEBERZUG" 2>/dev/null +mkfifo "$FIFO_UEBERZUG" +trap cleanup EXIT +tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash & + +vifm +cleanup diff --git a/config/vifm/vifm-help.txt b/config/vifm/vifm-help.txt new file mode 100644 index 000000000..df216c383 --- /dev/null +++ b/config/vifm/vifm-help.txt @@ -0,0 +1,6568 @@ +VIFM(1) General Commands Manual VIFM(1) + +NAME + vifm - vi file manager + +SYNOPSIS + vifm [OPTION]... + vifm [OPTION]... path + vifm [OPTION]... path path + +DESCRIPTION + Vifm is an ncurses based file manager with vi like keybindings. If you + use vi, vifm gives you complete keyboard control over your files + without having to learn a new set of commands. + +OPTIONS + vifm starts in the current directory unless it is given a different + directory on the command line or 'vifminfo' option includes "savedirs" + (in which case last visited directories are used as defaults). + + - Read list of files from standard input stream and compose custom + view out of them (see "Custom views" section). Current working + directory is used as a base for relative paths. + + Starts Vifm in the specified path. + + + Starts Vifm in the specified paths. + + Specifying two directories triggers split view even when vifm was in + single-view mode on finishing previous run. To suppress this behaviour + :only command can be put in the vifmrc file. + + When only one path argument is found on command-line, the left/top pane + is automatically set as the current view. + + Paths to files are also allowed in case you want vifm to start with + some archive opened. + + --select + Open parent directory of the given path and select specified + file in it. + + -f Makes vifm instead of opening files write selection to + $VIFM/vimfiles and quit. + + --choose-files |- + Sets output file to write selection into on exit instead of + opening files. "-" means standard output. Use empty value to + disable it. + + --choose-dir |- + Sets output file to write last visited directory into on exit. + "-" means standard output. Use empty value to disable it. + + --delimiter + Sets separator for list of file paths written out by vifm. + Empty value means null character. Default is new line + character. + + --on-choose + Sets command to be executed on selected files instead of opening + them. The command may use any of macros described in "Command + macros" section below. The command is executed once for whole + selection. + + --logging[=] + Log some operational details $VIFM/log. If the optional startup + log path is specified and permissions allow to open it for + writing, then logging of early initialization (before value of + $VIFM is determined) is put there. + + --server-list + List available server names and exit. + + --server-name + Name of target or this instance (sequential numbers are appended + on name conflict). + + --remote + Sends the rest of the command line to another instance of vifm, + --server-name is treated just like any other argument and should + precede --remote on the command line. When there is no server, + quits silently. There is no limit on how many arguments can be + processed. One can combine --remote with -c or + + to execute commands in already running instance of + vifm. See also "Client-Server" section below. + + --remote-expr + passes expression to vifm server and prints result. See also + "Client-Server" section below. + + -c or + + Run command-line mode on startup. Commands in such + arguments are executed in the order they appear in command line. + Commands with spaces or special symbols must be enclosed in + double or single quotes or all special symbols should be escaped + (the exact syntax strongly depends on shell). "+" argument is + equivalent to "$" and thus picks last item of of the view. + + --help, -h + Show a brief command summary and exit vifm. + + --version, -v + Show version information and quit. + + --no-configs + Skip reading vifmrc and vifminfo. + + + See "Startup" section below for the explanations on $VIFM. + +General keys + Ctrl-C or Escape + cancel most operations (see "Cancellation" section below), clear + all selected files. + + Ctrl-L clear and redraw the screen. + +Basic Movement + The basic vi key bindings are used to move through the files and pop-up + windows. + + k, gk, or Ctrl-P + move cursor up one line. + + j, gj or Ctrl-N + move cursor down one line. + + h when 'lsview' is off move up one directory (moves to parent + directory node in tree view), otherwise move left one file. + + l when 'lsview' is off move into a directory or launch a file, + otherwise move right one file. See "Selection" section below. + + gg move to the first line of the file list. + + G move to the last line in the file list. + + gh go up one directory regardless of view representation (regular, + ls-like). Also can be used to leave custom views including tree + view. + + gl or Enter + enter directory or launch a file. See "Selection" section + below. + + H move to the first file in the window. + + M move to the file in the middle of the window. + + L move to the last file in the window. + + Ctrl-F or Page Down + move forward one page. + + Ctrl-B or Page Up + move back one page. + + Ctrl-D jump back one half page. + + Ctrl-U jump forward one half page. + + n% move to the file that is n percent from the top of the list (for + example 25%). + + 0 or ^ move cursor to the first column. See 'lsview' option + description. + + $ move cursor to the last column. See 'lsview' option + description. + + Space switch file lists. + + gt switch to the next tab (wrapping around). + + {n}gt switch to the tab number {n} (wrapping around). + + gT switch to the previous tab (wrapping around). + + {n}gT switch to {n}-th previous tab. + +Movement with Count + Most movement commands also accept a count, 12j would move down 12 + files. + + [count]% + move to percent of the file list. + + [count]j + move down [count] files. + + [count]k + move up [count] files. + + [count]G or [count]gg + move to list position [count]. + + [count]h + go up [count] directories. + +Scrolling panes + zt redraw pane with file in top of list. + + zz redraw pane with file in center of list. + + zb redraw pane with file in bottom of list. + + Ctrl-E scroll pane one line down. + + Ctrl-Y scroll pane one line up. + +Pane manipulation + Second character can be entered with or without Control key. + + Ctrl-W H + move the pane to the far left. + + Ctrl-W J + move the pane to the very bottom. + + Ctrl-W K + move the pane to the very top. + + Ctrl-W L + move the pane to the far right. + + + Ctrl-W h + switch to the left pane. + + Ctrl-W j + switch to the pane below. + + Ctrl-W k + switch to the pane above. + + Ctrl-W l + switch to the right pane. + + + Ctrl-W b + switch to bottom-right window. + + Ctrl-W t + switch to top-left window. + + + Ctrl-W p + switch to previous window. + + Ctrl-W w + switch to other pane. + + + Ctrl-W o + leave only one pane. + + Ctrl-W s + split window horizontally. + + Ctrl-W v + split window vertically. + + + Ctrl-W x + exchange panes. + + Ctrl-W z + quit preview pane or view modes. + + + Ctrl-W - + decrease size of the view by count. + + Ctrl-W + + increase size of the view by count. + + Ctrl-W < + decrease size of the view by count. + + Ctrl-W > + increase size of the view by count. + + + Ctrl-W | + set current view size to count. + + Ctrl-W _ + set current view size to count. + + Ctrl-W = + make size of two views equal. + + For Ctrl-W +, Ctrl-W -, Ctrl-W <, Ctrl-W >, Ctrl-W | and Ctrl-W _ + commands count can be given before and/or after Ctrl-W. The resulting + count is a multiplication of those two. So "2 Ctrl-W 2 -" decreases + window size by 4 lines or columns. + + Ctrl-W | and Ctrl-W _ maximise current view by default. + +Marks + Marks are set the same way as they are in vi. + + You can use these characters for marks [a-z][A-Z][0-9]. + + m[a-z][A-Z][0-9] + set a mark for the file at the current cursor position. + + '[a-z][A-Z][0-9] + navigate to the file set for the mark. + + + There are also several special marks that can't be set manually: + + - ' (single quote) - previously visited directory of the view, thus + hitting '' allows switching between two last locations + + - < - the first file of the last visually selected block + + - > - the last file of the last visually selected block + +Searching + /regular expression pattern + search for files matching regular expression in forward + direction and advance cursor to next match. + + / perform forward search with top item of search pattern history. + + ?regular expression pattern + search for files matching regular expression in backward + direction and advance cursor to previous match. + + ? perform backward search with top item of search pattern history. + + Trailing slash for directories is taken into account, so /\/ searches + for directories and symbolic links to directories. At the moment // + works too, but this can change in the future, so consider escaping the + slash if not typing pattern by hand. + + Matches are automatically selected if 'hlsearch' is set. Enabling + 'incsearch' makes search interactive. 'ignorecase' and 'smartcase' + options affect case sensitivity of search queries as well as local + filter and other things detailed in the description of 'caseoptions'. + + + [count]n + go to the next file matching last search pattern. Takes last + search direction into account. + + [count]N + go to the previous file matching last search pattern. Takes + last search direction into account. + + If 'hlsearch' option is set, hitting n/N to perform search and go to + the first matching item resets current selection in normal mode. It is + not the case if search was already performed on files in the directory, + thus selection is not reset after clearing selection with escape key + and hitting n/N key again. + + Note: vifm uses extended regular expressions for / and ?. + + + [count]f[character] + search forward for file with [character] as first character in + name. Search wraps around the end of the list. + + [count]F[character] + search backward for file with [character] as first character in + name. Search wraps around the end of the list. + + [count]; + find the next match of f or F. + + [count], + find the previous match of f or F. + + Note: f, F, ; and , wrap around list beginning and end when they are + used alone and they don't wrap when they are used as selectors. + +File Filters + There are three basic file filters: + + - dot files filter (does not affect "." and ".." special directories, + whose appearance is controlled by the 'dotdirs' option), see + 'dotfiles' option; + + - permanent filter; + + - local filter (see description of the "=" normal mode command). + + Permanent filter essentially allows defining a group of files names + which are not desirable to be seen by default, like temporary or backup + files, which might be created alongside normal ones. Just like you + don't usually need to see hidden dot files (files starting with a dot). + Local filter on the other hand is for temporary immediate filtering of + file list at hand, to get rid of uninterested files in the view or to + make it possible to use % range in a :command. + + For the purposes of more deterministic editing permanent filter is + split into two parts: + + - one edited explicitly via :filter command; + + - another one which is edited implicitly via zf shortcut. + + Files are tested against both parts and a match counts if at least one + of the parts matched. + + + Each file list has its own copy of each filter. + + Filtered files are not checked in / search or :commands. + + Files and directories are filtered separately. This is done by + appending a slash to a directory name before testing whether it matches + the filter. Examples: + + + " filter directories which names end with '.files' + :filter /^.*\.files\/$/ + + " filter files which names end with '.d' + :filter {*.d} + + " filter files and directories which names end with '.o' + :filter /^.*\.o\/?$/ + + Note: vifm uses extended regular expressions. + + The basic vim folding key bindings are used for managing filters. + + + za toggle visibility of dot files. + + zo show dot files. + + zm hide dot files. + + zf add selected files to permanent filter. + + zO reset permanent filter. + + zR save and reset all filters. + + zr clear local filter. + + zM restore all filters (undoes last zR). + + zd exclude selection or current file from a custom view. Does + nothing for regular view. For tree view excluding directory + excludes that sub-tree. For compare views zd hides group of + adjacent identical files, count can be specified as 1 to exclude + just single file or selected items instead. Files excluded this + way are not counted as filtered out and can't be returned unless + view is reloaded. + + =regular expression pattern + filter out files that don't match regular expression. Whether + view is updated as regular expression is changed depends on the + value of the 'incsearch' option. This kind of filter is + automatically reset when directory is changed. + +Tree-related Keys + While some of the keys make sense outside of tree-view, they are most + useful in trees. + + [z go to first sibling of current entry. + + ]z go to last sibling of current entry. + + zj go to next directory sibling of current entry or do nothing. + + zk go to previous directory sibling of current entry or do nothing. + + zx toggle fold under the cursor or parent entry of the current file + if cursor is not on a directory. + +Other Normal Mode Keys + [count]: + enter command line mode. [count] generates range. + + q: open external editor to prompt for command-line command. See + "Command line editing" section for details. + + q/ open external editor to prompt for search pattern to be searched + in forward direction. See "Command line editing" section for + details. + + q? open external editor to prompt for search pattern to be searched + in backward direction. See "Command line editing" section for + details. + + q= open external editor to prompt for filter pattern. See "Command + line editing" section for details. Unlike other q{x} commands + this one doesn't work in Visual mode. + + [count]!! and [count]! + enter command line mode with entered ! command. [count] + modifies range. + + Ctrl-O go backwards through directory history of current view. + Nonexistent directories are automatically skipped. + + Ctrl-I if 'cpoptions' contains "t" flag, and switch active + pane just like does, otherwise it goes forward through + directory history of current view. Nonexistent directories are + automatically skipped. + + Ctrl-G show a dialog with detailed information about current file. See + "Menus and dialogs" section for controls. + + Shift-Tab + enter view mode (works only after activating view pane with + :view command). + + ga calculate directory size. Uses cached directory sizes when + possible for better performance. As a special case calculating + size of ".." entry results in calculation of size of current + directory. + + gA like ga, but force update. Ignores old values of directory + sizes. + + If file under cursor is selected, each selected item is processed, + otherwise only current file is updated. + + gf find link destination (like l with 'followlinks' off, but also + finds directories). On Windows additionally follows .lnk-files. + + gF Same as gf, but resolves final path of the chain of symbolic + links. + + gr only for MS-Windows + same as l key, but tries to run program with administrative + privileges. + + av go to visual mode into selection amending state preserving + current selection. + + gv go to visual mode restoring last selection. + + [reg]gs + when no register is specified, restore last t selection (similar + to what gv does for visual mode selection). If register is + present, then all files listed in that register and which are + visible in current view are selected. + + gu + make names of selected files lowercase. + + [count]guu and [count]gugu + make names of [count] files starting from the current one + lowercase. Without [count] only current file is affected. + + gU + make names of selected files uppercase. + + [count]gUU and [count]gUgU + make names of [count] files starting from the current one + uppercase. Without [count] only current file is affected. + + e explore file in the current pane. + + i handle file (even if it's an executable and 'runexec' option is + set). + + cw change word is used to rename a file or files. If multiple + files are selected, behaves as :rename command run without + arguments. + + cW change WORD is used to change only name of file (without + extension). + + cl change link target. + + co only for *nix + change file owner. + + cg only for *nix + change file group. + + [count]cp + change file attributes (permission on *nix and properties on + Windows). If [count] is specified, it's treated as numerical + argument for non-recursive `chmod` command (of the form + [0-7]{3,4}). See "Menus and dialogs" section for controls. + + [count]C + clone file [count] times. + + [count]dd or d[count]selector + move selected file or files to trash directory (if 'trash' + option is set, otherwise delete). See "Trash directory" section + below. + + [count]DD or D[count]selector + like dd and d, but omitting trash directory (even when + 'trash' option is set). + + Y, [count]yy or y[count]selector + yank selected files. + + p copy yanked files to the current directory or move the files to + the current directory if they were deleted with dd or :d[elete] + or if the files were yanked from trash directory. See "Trash + directory" section below. + + P move the last yanked files. The advantage of using P instead of + d followed by p is that P moves files only once. This isn't + important in case you're moving files in the same file system + where your home directory is, but using P to move files on some + other file system (or file systems, in case you want to move + files from fs1 to fs2 and your home is on fs3) can save your + time. + + al put symbolic links with absolute paths. + + rl put symbolic links with relative paths. + + t select or unselect (tag) the current file. + + u undo last change. + + Ctrl-R redo last change. + + dp in compare view of "ofboth grouppaths" kind, makes corresponding + entry of the other pane equal to the current one. The semantics + is as follows: + - nothing done for identical entries + - if file is missing in current view, its pair gets removed + - if file is missing or differs in other view, it's replaced + - file pairs are defined by matching relative paths + File removal obeys 'trash' option. When the option is enabled, + the operation can be undone/redone (although results won't be + visible automatically). + Unlike in Vim, this operation is performed on a single line + rather than a set of adjacent changes. + + do same as dp, but applies changes in the opposite direction. + + v or V enter visual mode, clears current selection. + + [count]Ctrl-A + increment first number in file name by [count] (1 by default). + + [count]Ctrl-X + decrement first number in file name by [count] (1 by default). + + ZQ same as :quit!. + + ZZ same as :quit. + + . repeat last command-line command (not normal mode command) of + this run (does nothing right after startup or :restart command). + The command doesn't depend on command-line history and can be + used with completely disabled history. + + ( go to previous group. Groups are defined by primary sorting + key. For name and iname members of each group have same first + letter, for all other sorting keys vifm uses size, uid, ... + + ) go to next group. See ( key description above. + + { speeds up navigation to closest previous entry of the opposite + type by moving to the first file backwards when cursor is on a + directory and to the first directory backwards when cursor is on + a file. This is essentially a special case of ( that is locked + on "dirs". + + } same as {, but in forward direction. + + [c go to previous mismatched entry in directory comparison view or + do nothing. + + ]c go to next mismatched entry in directory comparison view or do + nothing. + + [d go to previous directory entry or do nothing. + + ]d go to next directory entry or do nothing. + + [r same as :siblprev. + + ]r same as :siblnext. + + [R same as :siblprev!. + + ]R same as :siblnext!. + + [s go to previous selected entry or do nothing. + + ]s go to next selected entry or do nothing. + +Using Count + You can use count with commands like yy. + + [count]yy + yank count files starting from current cursor position downward. + + Or you can use count with motions passed to y, d or D. + + d[count]j + delete (count + 1) files starting from current cursor position + upward. + +Registers + vifm supports multiple registers for temporary storing list of yanked + or deleted files. + + Registers should be specified by hitting double quote key followed by a + register name. Count is specified after register name. By default + commands use unnamed register, which has double quote as its name. + + Though all commands accept registers, most of commands ignores them + (for example H or Ctrl-U). Other commands can fill register or append + new files to it. + + Presently vifm supports ", _, a-z and A-Z characters as register names. + + As mentioned above " is unnamed register and has special meaning of the + default register. Every time when you use named registers (a-z and A- + Z) unnamed register is updated to contain same list of files as the + last used register. + + _ is black hole register. It can be used for writing, but its list is + always empty. + + Registers with names from a to z and from A to Z are named ones. + Lowercase registers are cleared before adding new files, while + uppercase aren't and should be used to append new files to the existing + file list of appropriate lowercase register (A for a, B for b, ...). + + Registers can be changed on :empty command if they contain files under + trash directory (see "Trash directory" section below). + + Registers do not contain one file more than once. + + Example: + + "a2yy + + puts names of two files to register a (and to the unnamed register), + + "Ad + + removes one file and append its name to register a (and to the unnamed + register), + + p or "ap or "Ap + + inserts previously yanked and deleted files into current directory. + +Selectors + y, d, D, !, gu and gU commands accept selectors. You can combine them + with any of selectors below to quickly remove or yank several files. + + Most of selectors are like vi motions: j, k, gg, G, H, L, M, %, f, F, + ;, comma, ', ^, 0 and $. But there are some additional ones. + + a all files in current view. + + s selected files. + + S all files except selected. + + Examples: + + - dj - delete file under cursor and one below; + + - d2j - delete file under cursor and two below; + + - y6gg - yank all files from cursor position to 6th file in the list. + + When you pass a count to whole command and its selector they are + multiplied. So: + + - 2d2j - delete file under cursor and four below; + + - 2dj - delete file under cursor and two below; + + - 2y6gg - yank all files from cursor position to 12th file in the + list. + +Visual Mode + Visual mode has two generic operating submodes: + + - plain selection as it is in Vim; + + - selection editing submode. + + Both modes select files in range from cursor position at which visual + mode was entered to current cursor position (let's call it "selection + region"). Each of two borders can be adjusted by swapping them via "o" + or "O" keys and updating cursor position with regular cursor motion + keys. Obviously, once initial cursor position is altered this way, + real start position becomes unavailable. + + Plain Vim-like visual mode starts with cleared selection, which is not + restored on rejecting selection ("Escape", "Ctrl-C", "v", "V"). + Contrary to it, selection editing doesn't clear previously selected + files and restores them after reject. Accepting selection by + performing an operation on selected items (e.g. yanking them via "y") + moves cursor to the top of current selection region (not to the top + most selected file of the view). + + In turn, selection editing supports three types of editing (look at + statusbar to know which one is currently active): + + - append - amend selection by selecting elements in selection region; + + - remove - amend selection by deselecting elements in selection + region; + + - invert - amend selection by inverting selection of elements in + selection region. + + No matter how you activate selection editing it starts in "append". + One can switch type of operation (in the order given above) via "Ctrl- + G" key. + + Almost all normal mode keys work in visual mode, but instead of + accepting selectors they operate on selected items. + + Enter save selection and go back to normal mode not moving cursor. + + av leave visual mode if in amending mode (restores previous + selection), otherwise switch to amending selection mode. + + gv restore previous visual selection. + + v, V, Ctrl-C or Escape + leave visual mode if not in amending mode, otherwise switch to + normal visual selection. + + Ctrl-G switch type of amending by round robin scheme: append -> remove + -> invert. + + : enter command line mode. Selection is cleared on leaving the + mode. + + o switch active selection bound. + + O switch active selection bound. + + gu, u make names of selected files lowercase. + + gU, U make names of selected files uppercase. + + cw same as running :rename command without arguments. + +View Mode + This mode tries to imitate the less program. List of builtin shortcuts + can be found below. Shortcuts can be customized using :qmap, :qnoremap + and :qunmap command-line commands. + + Shift-Tab, Tab, q, Q, ZZ + return to normal mode. + + [count]e, [count]Ctrl-E, [count]j, [count]Ctrl-N, [count]Enter + scroll forward one line (or [count] lines). + + [count]y, [count]Ctrl-Y, [count]k, [count]Ctrl-K, [count]Ctrl-P + scroll backward one line (or [count] lines). + + [count]f, [count]Ctrl-F, [count]Ctrl-V, [count]Space + scroll forward one window (or [count] lines). + + [count]b, [count]Ctrl-B, [count]Alt-V + scroll backward one window (or [count] lines). + + [count]z + scroll forward one window (and set window to [count]). + + [count]w + scroll backward one window (and set window to [count]). + + [count]Alt-Space + scroll forward one window, but don't stop at end-of-file. + + [count]d, [count]Ctrl-D + scroll forward one half-window (and set half-window to [count]). + + [count]u, [count]Ctrl-U + scroll backward one half-window (and set half-window to + [count]). + + r, Ctrl-R, Ctrl-L + repaint screen. + + R reload view preserving scroll position. + + F toggle automatic forwarding. Roughly equivalent to periodic + file reload and scrolling to the bottom. The behaviour is + similar to `tail -F` or F key in less. + + a switch to the next viewer. Does nothing for preview constructed + via %q macro. + + A switch to the previous viewer. Does nothing for preview + constructed via %q macro. + + i toggle raw mode (ignoring of defined viewers). Does nothing for + preview constructed via %q macro. + + [count]/pattern + search forward for ([count]-th) matching line. + + [count]?pattern + search backward for ([count]-th) matching line. + + [count]n + repeat previous search (for [count]-th occurrence). + + [count]N + repeat previous search in reverse direction (for [count]-th + occurrence). + + [count]g, [count]<, [count]Alt-< + scroll to the first line of the file (or line [count]). + + [count]G, [count]>, [count]Alt-> + scroll to the last line of the file (or line [count]). + + [count]p, [count]% + scroll to the beginning of the file (or N percent into file). + + v invoke an editor to edit the current file being viewed. The + command for editing is taken from the 'vicmd' or 'vixcmd' option + value and extended with middle line number prepended by a plus + sign and name of the current file. + + All "Ctrl-W x" keys work the same was as in Normal mode. Active mode + is automatically changed on navigating among windows. When less-like + mode activated on file preview is left using one by "Ctrl-W x" keys, + its state is stored until another file is displayed using preview (it's + possible to leave the mode, hide preview pane, do something else, then + get back to the file and show preview pane again with previously stored + state in it). + +Command line Mode + These keys are available in all submodes of the command line mode: + command, search, prompt and filtering. + + Down, Up, Left, Right, Home, End and Delete are extended keys and they + are not available if vifm is compiled with --disable-extended-keys + option. + + Esc, Ctrl-C + leave command line mode, cancels input. Cancelled input is + saved into appropriate history and can be recalled later. + + Ctrl-M, Enter + execute command and leave command line mode. + + Ctrl-I, Tab + complete command or its argument. + + Shift-Tab + complete in reverse order. + + Ctrl-_ stop completion and return original input. + + Ctrl-B, Left + move cursor to the left. + + Ctrl-F, Right + move cursor to the right. + + Ctrl-A, Home + go to line beginning. + + Ctrl-E, End + go to line end. + + Alt-B go to the beginning of previous word. + + Alt-F go to the end of next word. + + Ctrl-U remove characters from cursor position till the beginning of + line. + + Ctrl-K remove characters from cursor position till the end of line. + + Ctrl-H, Backspace + remove character before the cursor. + + Ctrl-D, Delete + remove character under the cursor. + + Ctrl-W remove characters from cursor position till the beginning of + previous word. + + Alt-D remove characters from cursor position till the beginning of + next word. + + Ctrl-T swap the order of current and previous character and move cursor + forward or, if cursor past the end of line, swap the order of + two last characters in the line. + + Alt-. insert last part of previous command to current cursor position. + Each next call will insert last part of older command. + + Ctrl-G edit command-line content in external editor. See "Command line + editing" section for details. + + Ctrl-N recall more recent command-line from history. + + Ctrl-P recall older command-line from history. + + Up recall more recent command-line from history, that begins as the + current command-line. + + Down recall older command-line from history, that begins as the + current command-line. + + Ctrl-] trigger abbreviation expansion. + +Pasting special values + The shortcuts listed below insert specified values into current cursor + position. Last key of every shortcut references value that it inserts: + - c - [c]urrent file + - d - [d]irectory path + - e - [e]xtension of a file name + - r - [r]oot part of a file name + - t - [t]ail part of directory path + + - a - [a]utomatic filter + - m - [m]anual filter + - = - local filter, which is bound to "=" in normal mode + + Values related to filelist in current pane are available through Ctrl-X + prefix, while values from the other pane have doubled Ctrl-X key as + their prefix (doubled Ctrl-X is presumably easier to type than + uppercase letters; it's still easy to remap the keys to correspond to + names of similar macros). + + Ctrl-X c + name of the current file of the active pane. + + Ctrl-X d + path to the current directory of the active pane. + + Ctrl-X e + extension of the current file of the active pane. + + Ctrl-X r + name root of current file of the active pane. + + Ctrl-X t + the last component of path to the current directory of the + active pane. + + Ctrl-X Ctrl-X c + name of the current file of the inactive pane. + + Ctrl-X Ctrl-X d + path to the current directory of the inactive pane. + + Ctrl-X Ctrl-X e + extension of the current file of the inactive pane. + + Ctrl-X Ctrl-X r + name root of current file of the inactive pane. + + Ctrl-X Ctrl-X t + the last component of path to the current directory of the + inactive pane. + + + Ctrl-X a + value of implicit permanent filter (old name "automatic") of the + active pane. + + Ctrl-X m + value of explicit permanent filter (old name "manual") of the + active pane. + + Ctrl-X = + value of local filter of the active pane. + + + Ctrl-X / + last pattern from search history. + +Command line editing + vifm provides a facility to edit several kinds of data, that is usually + edited in command-line mode, in external editor (using command + specified by 'vicmd' or 'vixcmd' option). This has at least two + advantages over built-in command-line mode: + - one can use full power of Vim to edit text; + - finding and reusing history entries becomes possible. + + The facility is supported by four input submodes of the command-line: + - command; + - forward search; + - backward search; + - file rename (see description of cw and cW normal mode keys). + + Editing command-line using external editor is activated by the Ctrl-G + shortcut. It's also possible to do almost the same from Normal and + Visual modes using q:, q/ and q? commands. + + Temporary file created for the purpose of editing the line has the + following structure: + + 1. First line, which is either empty or contains text already entered + in command-line. + + 2. 2nd and all other lines with history items starting with the most + recent one. Altering this lines in any way won't change history + items stored by vifm. + + After editing application is finished the first line of the file is + taken as the result of operation, when the application returns zero + exit code. If the application returns an error (see :cquit command in + Vim), all the edits made to the file are ignored, but the initial value + of the first line is saved in appropriate history. + +More Mode + This is the mode that appears when status bar content is so big that it + doesn't fit on the screen. One can identify the mode by "-- More --" + message at the bottom. + + The following keys are handled in this mode: + + + Enter, Ctrl-J, j or Down + scroll one line down. + + Backspace, k or Up + scroll one line up. + + + d scroll one page (half of a screen) down. + + u scroll one page (half of a screen) up. + + + Space, f or PageDown + scroll down a screen. + + b or PageUp + scroll up a screen. + + + G scroll to the bottom. + + g scroll to the top. + + + q, Escape or Ctrl-C + quit the mode. + + : switch to command-line mode. + +Commands + Commands are executed with :command_name + + Commented out lines should start with the double quote symbol ("), + which may be preceded by whitespace characters intermixed with colons. + Inline comments can be added at the end of the line after double quote + symbol, only last line of a multi-line command can contain such + comment. Not all commands support inline comments as their syntax + conflicts with names of registers and fields where double quotes are + allowed. + + Most of the commands have two forms: complete and the short one. + Example: + + :noh[lsearch] + + This means the complete command is nohlsearch, and the short one is + noh. + + Most of command-line commands completely reset selection in the current + view. However, there are several exceptions: + + - `:invert s` most likely leaves some files selected; + + - :normal command (when it doesn't leave command-line mode); + + - :if and :else commands don't affect selection on successful + execution. + + '|' can be used to separate commands, so you can give multiple commands + in one line. If you want to use '|' in an argument, precede it with + '\'. + + These commands see '|' as part of their arguments even when it's + escaped: + + :[range]! + :autocmd + :cabbrev + :cmap + :cnoreabbrev + :cnoremap + :command + :dmap + :dnoremap + :filetype + :fileviewer + :filextype + :map + :mmap + :mnoremap + :nmap + :nnoremap + :noremap + :normal + :qmap + :qnoremap + :vmap + :vnoremap + :wincmd + :windo + :winrun + + To be able to use another command after one of these, wrap it with the + :execute command. An example: + + if filetype('.') == 'reg' | execute '!!echo regular file' | endif + + :[count] + + :number + move to the file number. + :12 would move to the 12th file in the list. + :0 move to the top of the list. + :$ move to the bottom of the list. + + :[count]command + The only builtin :[count]command are :[count]d[elete] and + :[count]y[ank]. + + :d3 would delete three files starting at the current file position + moving down. + + :3d would delete one file at the third line in the list. + + :command [args] + + :[range]!program + execute command via shell. Accepts macros. + + :[range]!command & + + same as above, but the command is run in the background using vifm's + means. + + Programs that write to stderr create error dialogs showing errors of + the command. + + Note the space before ampersand symbol, if you omit it, command will be + run in the background using job control of your shell. + + Accepts macros. + + :!! + + :[range]!!command + same as :!, but pauses before returning. + + :!! repeat the last command. + + :alink + + :[range]alink[!?] + create absolute symbolic links to files in directory of inactive + view. With "?" prompts for destination file names in an editor. + "!" forces overwrite. + + :[range]alink[!] path + create absolute symbolic links to files in directory specified + by the path (absolute or relative to directory of inactive + view). + + :[range]alink[!] name1 name2... + create absolute symbolic links of files in directory of other + view giving each next link a corresponding name from the + argument list. + + :apropos + + :apropos keyword... + create a menu of items returned by the apropos command. + Selecting an item in the menu opens corresponding man page. By + default the command relies on the external "apropos" utility, + which can be customized by altering value of the 'aproposprg' + option. See "Menus and dialogs" section for controls. + + :autocmd + + :au[tocmd] {event} {pat} {cmd} + register autocommand for the {event}, which can be: + - DirEnter - triggered after directory is changed + Event name is case insensitive. + + {pat} is a comma-separated list of modified globs patterns, + which can contain tilde or environment variables. All paths use + slash ('/') as directory separator. The pattern can start with + a '!', which negates it. Patterns that do not contain slashes + are matched against the last item of the path only (e.g. "dir" + in "/path/dir"). Literal comma can be entered by doubling it. + Two modifications to globs matching are as follows: + - * - never matches a slash (i.e., can signify single + directory level) + - ** - matches any character (i.e., can match path of + arbitrary depth) + + {cmd} is a :command or several of them separated with '|'. + + Examples of patterns: + - conf.d - matches conf.d directory anywhere + - *.d - matches directories ending with ".d" anywhere + - **.git - matches something.git, but not .git anywhere + - **/.git/** - matches /path/.git/objects, but not /path/.git + - **/.git/**/ - matches /path/.git/ only (because of trailing + slash) + - /etc/* - matches /etc/conf.d/, /etc/X11, but not + /etc/X11/fs + - /etc/**/*.d - matches /etc/conf.d, /etc/X11/conf.d, etc. + - /etc/**/* - matches /etc/ itself and any file below it + - /etc/**/** - matches /etc/ itself and any file below it + + :au[tocmd] [{event}] [{pat}] + list those autocommands that match given event-pattern + combination. + {event} and {pat} can be omitted to list all autocommands. To + list any autocommands for specific pattern one can use * + placeholder in place of {event}. + + :au[tocmd]! [{event}] [{pat}] + remove autocommands that match given event-pattern combination. + Syntax is the same as for listing above. + + :apropos + repeat last :apropos command. + + :bmark + + :bmark tag1 [tag2 [tag3...]] + bookmark current directory with specified tags. + + :bmark! path tag1 [tag2 [tag3...]] + same as :bmark, but allows bookmarking specific path instead of + current directory. This is for use in vifmrc and for + bookmarking files. + + Path can contain macros that expand to single path (%c, %C, %d, + %D) or those that can expand to multiple paths, but contain only + one (%f, %F, %rx). The latter is done for convenience on using + the command interactively. Complex macros that include spaces + (e.g. "%c:gs/ /_") should be escaped. + + :bmarks + + :bmarks + display all bookmarks in a menu. + + :bmarks [tag1 [tag2...]] + display menu of bookmarks that include all of the specified + tags. See "Menus and dialogs" section for controls. + + :bmgo + + :bmgo [tag1 [tag2...]] + when there are more than one match acts exactly like :bmarks, + otherwise navigates to single match immediately (and fails if + there is no match). + + :cabbrev + + :ca[bbrev] + display menu of command-line mode abbreviations. See "Menus and + dialogs" section for controls. + + :ca[bbrev] lhs-prefix + display command-line mode abbreviations which left-hand side + starts with specified prefix. + + :ca[bbrev] lhs rhs + register new or overwrites existing abbreviation for command- + line mode. rhs can contain spaces and any special sequences + accepted in rhs of mappings (see "Mappings" section below). + Abbreviations are expanded non-recursively. + + :cnoreabbrev + + :cnorea[bbrev] + display menu of command-line mode abbreviations. See "Menus and + dialogs" section for controls. + + :cnorea[bbrev] lhs-prefix + display command-line mode abbreviations which left-hand side + starts with specified prefix. + + :cnorea[bbrev] lhs rhs + same as :cabbrev, but mappings in rhs are ignored during + expansion. + + :cd + + :cd or :cd ~ or :cd $HOME + change to home directory. + + :cd - go to the last visited directory. + + :cd ~/dir + change directory to ~/dir. + + :cd /curr/dir /other/dir + change directory of the current pane to /curr/dir and directory + of the other pane to /other/dir. Relative paths are assumed to + be relative to directory of current view. Command won't fail if + one of directories is invalid. All forms of the command accept + macros. + + :cd! /dir + same as :cd /dir /dir. + + :cds + + :cds[!] pattern string + navigate to path obtained by substituting first match in current + path. Arguments can include slashes, but starting first + argument with a separator will activate below form of the + command. Specifying "!" changes directory of both panes. + + Available flags: + + - i - ignore case (the 'ignorecase' and 'smartcase' options are not + used) + + - I - don't ignore case (the 'ignorecase' and 'smartcase' options are + not used) + + :cds[!]/pattern/string/[flags] + same as above, but with :substitute-like syntax. Other + punctuation characters can be used as separators. + + :change + + :c[hange] + show a dialog to alter properties of files. + + :chmod + + :[range]chmod + display file attributes (permission on *nix and properties on + Windows) change dialog. + + :[range]chmod[!] arg... + only for *nix + change permissions for files. See `man 1 chmod` for arg format. + "!" means set permissions recursively. + + :chown + + :[range]chown + only for *nix + same as co key in normal mode. + + :[range]chown [user][:][group] + only for *nix + change owner and/or group of files. Operates on directories + recursively. + + :clone + + :[range]clone[!?] + clones files in current directory. With "?" vifm will open vi + to edit file names. "!" forces overwrite. Macros are expanded. + + :[range]clone[!] path + clones files to directory specified with the path (absolute or + relative to current directory). "!" forces overwrite. Macros + are expanded. + + :[range]clone[!] name1 name2... + clones files in current directory giving each next clone a + corresponding name from the argument list. "!" forces + overwrite. Macros are expanded. + + :colorscheme + + :colo[rscheme]? + print current color scheme name on the status bar. + + :colo[rscheme] + display a menu with a list of available color schemes. You can + choose primary color scheme here. It is used for view if no + directory specific colorscheme fits current path. It's also + used to set border color (except view titles) and colors in + menus and dialogs. See "Menus and dialogs" section for + controls. + + :colo[rscheme] color_scheme_name + change primary color scheme to color_scheme_name. In case of + errors (e.g. some colors are not supported by terminal) either + nothing is changed or color scheme is reset to builtin colors to + ensure that TUI is left in a usable state. + + :colo[rscheme] color_scheme_name directory + associate directory with the color scheme. The directory + argument can be either absolute or relative path when + :colorscheme command is executed from command line, but + mandatory should be an absolute path when the command is + executed in scripts loaded at startup (until vifm is completely + loaded). + + :colo[rscheme] color_scheme_name color_scheme_name... + loads the first color scheme in the order given that exists and + is supported by the terminal. If none matches, current one + remains unchanged. For example: + + " use a separate color scheme for panes which are inside FUSE mounts + execute 'colorscheme in-fuse' &fusehome + + :comclear + + :comc[lear] + remove all user defined commands. + + :command + + :com[mand] + display a menu of user commands. See "Menus and dialogs" + section for controls. + + :com[mand] prefix + display user defined commands that start with the prefix. + + :com[mand] name action[ &] + set or redefine a user command. + Use :com[mand]! to overwrite a previously set command of the + same name. Builtin commands can't be redefined. + User commands must start with an upper or lower case letter. + Command name can't contain special symbols except for a single + trailing '?' or '!'. Numbers are allowed provided that they + don't cause parsing ambiguity (no command name prefix that + precedes a digit can match an existing command unless it has a + digit in the same place), for example: + " good + :command mp3 command + " good + :command mp4 command + :command mp3! command + :command mp4? command + " bad + :command mp command + :command mp44 command + " good + :command mp4c command + + User commands are run in a shell by default (see below for + syntax of other options). To run a command in the background + you must mark it as a background command by adding " &" after + the command's action (e.g., `:com rm rm %f &`). + User commands of all kinds have macros expanded in them. See + "Command macros" section for more information. + + :com[mand] name /pattern + set search pattern. + + :com[mand] name =pattern + set local filter value. + + :com[mand] name filter{:filter args} + set file name filter (see :filter command description). For + example: + + " display only audio files + :command onlyaudio filter/.+.\(mp3|wav|mp3|flac|ogg|m4a|wma|ape\)$/i + " display everything except audio files + :command noaudio filter!/.+.\(mp3|wav|mp3|flac|ogg|m4a|wma|ape\)$/i + + :com[mand] name :commands + set kind of an alias for internal commands (like in a shell). + Passes range given to alias to an aliased command, so running + :%cp after + :command cp :copy %a + equals + :%copy + + :compare + + :compare [byname | bysize | bycontents | listall | listunique | + listdups | ofboth | ofone | groupids | grouppaths | skipempty]... + compare files in one or two views according to the arguments. + The default is "bycontents listall ofboth grouppaths". See + "Compare views" section below for details. Diff structure is + incompatible with alternative representations, so values of + 'lsview' and 'millerview' options are ignored. + + :copen + + :cope[n] + opens menu with contents of the last displayed menu with + navigation to files by default, if any. + + :copy + + :[range]co[py][!?][ &] + copy files to directory of other view. With "?" prompts for + destination file names in an editor. "!" forces overwrite. + + :[range]co[py][!] path[ &] + copy files to directory specified with the path (absolute or + relative to directory of other view). "!" forces overwrite. + + :[range]co[py][!] name1 name2...[ &] + copy files to directory of other view giving each next file a + corresponding name from the argument list. "!" forces + overwrite. + + :cquit + + :cq[uit][!] + same as :quit, but also aborts directory choosing via + --choose-dir (empties output file) and returns non-zero exit + code. + + :cunabbrev + + :cuna[bbrev] lhs + unregister command-line mode abbreviation by its lhs. + + :cuna[bbrev] rhs + unregister command-line mode abbreviation by its rhs, so that + abbreviation could be removed even after expansion. + + :delbmarks + + :delbmarks + remove bookmarks from current directory. + + :delbmarks tag1 [tag2 [tag3...]] + remove set of bookmarks that include all of the specified tags. + + :delbmarks! + remove all bookmarks. + + :delbmarks! path1 [path2 [path3...]] + remove bookmarks of listed paths. + + :delcommand + + :delc[ommand] user_command + remove user defined command named user_command. + + :delete + + :[range]d[elete][!][ &] + delete selected file or files. "!" means complete removal + (omitting trash). + + :[range]d[elete][!] [reg] [count][ &] + delete selected or [count] files to the reg register. "!" means + complete removal (omitting trash). + + :delmarks + + :delm[arks]! + delete all marks. + + :delm[arks] marks ... + delete specified marks, each argument is treated as a set of + marks. + + :delsession + + :delsession + delete specified session if it was stored previously. Deleting + current session doesn't detach it. + + :display + + :di[splay] + display menu with registers content. + + :di[splay] list ... + display the contents of the numbered and named registers that + are mentioned in list (for example "az to display "", "a and "z + content). + + :dirs + + :dirs display directory stack in a menu. See "Menus and dialogs" + section for controls. + + :echo + + :ec[ho] [...] + evaluate each argument as an expression and output them + separated with a space. See help on :let command for a + definition of . + + :edit + + :[range]e[dit] [file...] + open selected or passed file(s) in editor. Macros and + environment variables are expanded. + + :else + + :el[se] + execute commands until next matching :endif if all other + conditions didn't match. See also help on :if and :endif + commands. + + :elseif + + :elsei[f] {expr1} + execute commands until next matching :elseif, :else or :endif if + conditions of previous :if and :elseif branches were evaluated + to zero. See also help on :if and :endif commands. + + :empty + + :empty permanently remove files from all existing non-empty trash + directories (see "Trash directory" section below). Trash + directories which are specified via %r and/or %u also get + deleted completely. Also remove all operations from undolist + that have no sense after :empty and remove all records about + files located inside directories from all registers. Removal is + performed as background task with undetermined amount of work + and can be checked via :jobs menu. + + :endif + + :en[dif] + end conditional block. See also help on :if and :else commands. + + :execute + + :exe[cute] [...] + evaluate each argument as an expression and join results + separated by a space to get a single string which is then + executed as a command-line command. See help on :let command + for a definition of . + + :exit + + :exi[t][!] + same as :quit. + + :file + + :f[ile][ &] + display menu of programs set for the file type of the current + file. " &" forces running associated program in background. + See "Menus and dialogs" section for controls. + + :f[ile] arg[ &] + run associated command that begins with the arg skipping opening + menu. " &" forces running associated program in background. + + :filetype + + :filet[ype] pattern-list [{descr}]def_prog[ &],[{descr}]prog2[ &],... + associate given program list to each of the patterns. + Associated program (command) is used by handlers of l and Enter + keys (and also in the :file menu). If you need to insert comma + into command just double it (",,"). Space followed by an + ampersand as two last characters of a command means running of + the command in the background. Optional description can be + given to each command to ease understanding of what command will + do in the :file menu. Vifm will try the rest of the programs + for an association when the default isn't found. When program + entry doesn't contain any of vifm macros, name of current file + is appended as if program entry ended with %c macro on *nix and + %"c on Windows. On Windows path to executables containing + spaces can (and should be for correct work with such paths) be + double quoted. See "Patterns" section below for pattern + definition and "Selection" section for how selection is handled. + See also "Automatic FUSE mounts" section below. Example for zip + archives and several actions: + + filetype *.zip,*.jar,*.war,*.ear + \ {Mount with fuse-zip} + \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, + \ {View contents} + \ zip -sf %c | less, + \ {Extract here} + \ tar -xf %c, + + Note that on OS X when `open` is used to call an app, vifm is + unable to check whether that app is actually available. So if + automatic skipping of programs that aren't there is desirable, + `open` should be replaced with an actual command. + + :filet[ype] filename + list (in menu mode) currently registered patterns that match + specified file name. Same as ":filextype filename". + + :filextype + + :filex[type] pattern-list [{ description }] def_program,program2,... + same as :filetype, but this command is ignored if not running in + X. In X :filextype is equal to :filetype. See "Patterns" + section below for pattern definition and "Selection" section for + how selection is handled. See also "Automatic FUSE mounts" + section below. + + For example, consider the following settings (the order might + seem strange, but it's for the demonstration purpose): + + filetype *.html,*.htm + \ {View in lynx} + \ lynx + filextype *.html,*.htm + \ {Open with dwb} + \ dwb %f %i &, + filetype *.html,*.htm + \ {View in links} + \ links + filextype *.html,*.htm + \ {Open with firefox} + \ firefox %f &, + \ {Open with uzbl} + \ uzbl-browser %f %i &, + + If you're using vifm inside a terminal emulator that is running + in graphical environment (when X is used on *nix; always on + Windows), vifm attempts to run application in this order: + + 1. lynx + 2. dwb + 3. links + 4. firefox + 5. uzbl + + If there is no graphical environment (checked by presence of + non-empty $DISPLAY or $WAYLAND_DISPLAY environment variable on + *nix; never happens on Windows), the list will look like: + + 1. lynx + 2. links + + Just as if all :filextype commands were not there. + + The purpose of such differentiation is to allow comfortable use + of vifm with same settings in desktop environment/through remote + connection (SSH)/in native console. + + Note that on OS X $DISPLAY isn't defined unless you define it, + so :filextype should be used only if you set $DISPLAY in some + way. + + :filext[ype] filename + list (in menu mode) currently registered patterns that match + specified file name. Same as ":filetype filename". + + :fileviewer + + :filev[iewer] pattern-list command1,command2,... + register specified list of commands as viewers for each of the + patterns. Viewer is a command which output is captured and + displayed in one of the panes of vifm after pressing "e" or + running :view command. When the command doesn't contain any of + vifm macros, name of current file is appended as if command + ended with %c macro. Comma escaping and missing commands + processing rules as for :filetype apply to this command. See + "Patterns" section below for pattern definition. Supports Lua + handlers. + + Example for zip archives: + + fileviewer *.zip,*.jar,*.war,*.ear zip -sf %c, echo "No zip to preview:" + + :filev[iewer] filename + list (in menu mode) currently registered patterns that match + specified filename. + + :filter + + :filter[!] {pattern} + filter files matching the pattern out of directory listings. + '!' controls state of filter inversion after updating filter + value (see also 'cpoptions' description). Filter is matched + case sensitively on *nix and case insensitively on Windows. See + "File Filters" and "Patterns" sections. + + Example: + + " filter all files ending in .o from the filelist. + :filter /.o$/ + + + :filter[!] {empty-pattern} + same as above, but use last search pattern as pattern value. + + Example: + + :filter //I + + + :filter + reset filter (set it to an empty string) and show all files. + + :filter! + same as :invert. + + :filter? + show information on local, name and auto filters. + + :find + + :[range]fin[d] pattern + display results of find command in the menu. Searches among + selected files if any. Accepts macros. By default the command + relies on the external "find" utility, which can be customized + by altering value of the 'findprg' option. + + :[range]fin[d] -opt... + same as :find above, but user defines all find arguments. + Searches among selected files if any. + + :[range]fin[d] path -opt... + same as :find above, but user defines all find arguments. + Ignores selection and range. + + :[range]fin[d] + repeat last :find command. + + :finish + + :fini[sh] + stop sourcing a script. Can only be used in a vifm script file. + This is a quick way to skip the rest of the file. + + :goto + + :go[to] + change directory if necessary and put specified path under the + cursor. The path should be existing non-root path. Macros and + environment variables are expanded. + + :grep + + :[range]gr[ep][!] pattern + will show results of grep command in the menu. Add "!" to + request inversion of search (look for lines that do not match + pattern). Searches among selected files if any and no range + given. Ignores binary files by default. By default the command + relies on the external "grep" utility, which can be customized + by altering value of the 'grepprg' option. + + :[range]gr[ep][!] -opt... + same as :grep above, but user defines all grep arguments, which + are not escaped. Searches among selected files if any. + + :[range]gr[ep][!] + repeat last :grep command. "!" of this command inverts "!" in + repeated command. + + :help + + :h[elp] + show the help file. + + :h[elp] argument + is the same as using ':h argument' in vim. Use vifm- + to get help on vifm (tab completion works). This form of the + command doesn't work when 'vimhelp' option is off. + + :hideui + + :hideui + hide interface to show previous commands' output. + + :highlight + + :hi[ghlight] + display information about all highlight groups active at the + moment. + + :hi[ghlight] clear + reset all highlighting to builtin defaults and removed all + filename-specific rules. + + :hi[ghlight] clear ( {pat1,pat2,...} | /regexp/ ) + remove specified rule. + + :hi[ghlight] ( group-name | {pat1,pat2,...} | /regexp/ ) + display information on given highlight group or file name + pattern of color scheme used in the active view. + + :hi[ghlight] ( group-name | {pat1,pat2,...} | /regexp/[iI] ) + cterm=style | ctermfg=color | ctermbg=color | gui=style | guifg=color | + guibg=color + set style (cterm, gui), foreground (ctermfg, guifg) and/or + background (ctermbg, guibg) parameters of highlight group or + file name pattern for color scheme used in the active view. + + All style values as well as color names are case insensitive. + + Available style values (some of them can be combined): + - bold + - underline + - reverse or inverse + - standout + - italic (on unsupported systems becomes reverse) + - combine - add attributes of current group to attributes of the + parent in group hierarchy (see below) instead of replacing them + - none + + Available group-name values: + - Win - color of all windows (views, dialogs, menus) and default color + for their content (e.g. regular files in views) + - AuxWin - color of auxiliary areas of windows + - OtherWin - color of inactive pane + - Border - color of vertical parts of the border + - TabLine - tab line color (for 'tabscope' set to "global") + - TabLineSel - color of the tip of selected tab (regardless of + 'tabscope') + - TopLine - top line color of the other pane + - TopLineSel - top line color of the current pane + - CmdLine - the command line/status bar color + - ErrorMsg - color of error messages in the status bar + - StatusLine - color of the line above the status bar + - JobLine - color of job line that appears above the status line + - WildMenu - color of the wild menu items + - SuggestBox - color of key suggestion box + - CurrLine - line at cursor position in active view + - OtherLine - line at cursor position in inactive view + - OddLine - color of every second entry line in a pane + - LineNr - line number column of views + - Selected - color of selected files + - Directory - color of directories + - Link - color of symbolic links in the views + - BrokenLink - color of broken symbolic links + - HardLink - color of regular files with more than one hard link + - Socket - color of sockets + - Device - color of block and character devices + - Executable - color of executable files + - Fifo - color of fifo pipes + - CmpMismatch - color of mismatched files in side-by-side comparison + by path + - User1..User9 - 9 colors which can be used via %* 'statusline' macro + + Available colors: + - -1 or default or none - default or transparent + - black and lightblack + - red and lightred + - green and lightgreen + - yellow and lightyellow + - blue and lightblue + - magenta and lightmagenta + - cyan and lightcyan + - white and lightwhite + - 0-255 - corresponding colors from 256-color palette (for ctermfg and + ctermbg) + - #rrggbb - direct ("gui", "true", 24-bit) color in hex-notation, each + of the three compontents are in the range 0x00 to 0xff (for guifg and + guibg) + + Light versions of colors are regular colors with bold attribute set + automatically in terminals that have less than 16 colors. So order of + arguments of :highlight command is important and it's better to put + "cterm" in front of others to prevent it from overwriting attributes + set by "ctermfg" or "ctermbg" arguments. + + For convenience of color scheme authors xterm-like names for 256 color + palette is also supported. The mapping is taken from + http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim + Duplicated entries were altered by adding an underscore followed by + numerical suffix. + + 0 Black 86 Aquamarine1 172 Orange3 + 1 Red 87 DarkSlateGray2 173 LightSalmon3_2 + 2 Green 88 DarkRed_2 174 LightPink3 + 3 Yellow 89 DeepPink4_2 175 Pink3 + 4 Blue 90 DarkMagenta 176 Plum3 + 5 Magenta 91 DarkMagenta_2 177 Violet + 6 Cyan 92 DarkViolet 178 Gold3_2 + 7 White 93 Purple 179 LightGoldenrod3 + 8 LightBlack 94 Orange4_2 180 Tan + 9 LightRed 95 LightPink4 181 MistyRose3 + 10 LightGreen 96 Plum4 182 Thistle3 + 11 LightYellow 97 MediumPurple3 183 Plum2 + 12 LightBlue 98 MediumPurple3_2 184 Yellow3_2 + 13 LightMagenta 99 SlateBlue1 185 Khaki3 + 14 LightCyan 100 Yellow4 186 LightGoldenrod2 + 15 LightWhite 101 Wheat4 187 LightYellow3 + 16 Grey0 102 Grey53 188 Grey84 + 17 NavyBlue 103 LightSlateGrey 189 LightSteelBlue1 + 18 DarkBlue 104 MediumPurple 190 Yellow2 + 19 Blue3 105 LightSlateBlue 191 DarkOliveGreen1 + 20 Blue3_2 106 Yellow4_2 192 + DarkOliveGreen1_2 + 21 Blue1 107 DarkOliveGreen3 193 DarkSeaGreen1_2 + 22 DarkGreen 108 DarkSeaGreen 194 Honeydew2 + 23 DeepSkyBlue4 109 LightSkyBlue3 195 LightCyan1 + 24 DeepSkyBlue4_2 110 LightSkyBlue3_2 196 Red1 + 25 DeepSkyBlue4_3 111 SkyBlue2 197 DeepPink2 + 26 DodgerBlue3 112 Chartreuse2_2 198 DeepPink1 + 27 DodgerBlue2 113 DarkOliveGreen3_2 199 DeepPink1_2 + 28 Green4 114 PaleGreen3_2 200 Magenta2_2 + 29 SpringGreen4 115 DarkSeaGreen3 201 Magenta1 + 30 Turquoise4 116 DarkSlateGray3 202 OrangeRed1 + 31 DeepSkyBlue3 117 SkyBlue1 203 IndianRed1 + 32 DeepSkyBlue3_2 118 Chartreuse1 204 IndianRed1_2 + 33 DodgerBlue1 119 LightGreen_2 205 HotPink + 34 Green3 120 LightGreen_3 206 HotPink_2 + 35 SpringGreen3 121 PaleGreen1 207 MediumOrchid1_2 + 36 DarkCyan 122 Aquamarine1_2 208 DarkOrange + 37 LightSeaGreen 123 DarkSlateGray1 209 Salmon1 + 38 DeepSkyBlue2 124 Red3 210 LightCoral + 39 DeepSkyBlue1 125 DeepPink4_3 211 PaleVioletRed1 + 40 Green3_2 126 MediumVioletRed 212 Orchid2 + 41 SpringGreen3_2 127 Magenta3 213 Orchid1 + 42 SpringGreen2 128 DarkViolet_2 214 Orange1 + 43 Cyan3 129 Purple_2 215 SandyBrown + 44 DarkTurquoise 130 DarkOrange3 216 LightSalmon1 + 45 Turquoise2 131 IndianRed 217 LightPink1 + 46 Green1 132 HotPink3 218 Pink1 + 47 SpringGreen2_2 133 MediumOrchid3 219 Plum1 + 48 SpringGreen1 134 MediumOrchid 220 Gold1 + 49 MediumSpringGreen 135 MediumPurple2 221 + LightGoldenrod2_2 + 50 Cyan2 136 DarkGoldenrod 222 + LightGoldenrod2_3 + 51 Cyan1 137 LightSalmon3 223 NavajoWhite1 + 52 DarkRed 138 RosyBrown 224 MistyRose1 + 53 DeepPink4 139 Grey63 225 Thistle1 + 54 Purple4 140 MediumPurple2_2 226 Yellow1 + 55 Purple4_2 141 MediumPurple1 227 LightGoldenrod1 + 56 Purple3 142 Gold3 228 Khaki1 + 57 BlueViolet 143 DarkKhaki 229 Wheat1 + 58 Orange4 144 NavajoWhite3 230 Cornsilk1 + 59 Grey37 145 Grey69 231 Grey100 + 60 MediumPurple4 146 LightSteelBlue3 232 Grey3 + 61 SlateBlue3 147 LightSteelBlue 233 Grey7 + 62 SlateBlue3_2 148 Yellow3 234 Grey11 + 63 RoyalBlue1 149 DarkOliveGreen3_3 235 Grey15 + 64 Chartreuse4 150 DarkSeaGreen3_2 236 Grey19 + 65 DarkSeaGreen4 151 DarkSeaGreen2 237 Grey23 + 66 PaleTurquoise4 152 LightCyan3 238 Grey27 + 67 SteelBlue 153 LightSkyBlue1 239 Grey30 + 68 SteelBlue3 154 GreenYellow 240 Grey35 + 69 CornflowerBlue 155 DarkOliveGreen2 241 Grey39 + 70 Chartreuse3 156 PaleGreen1_2 242 Grey42 + 71 DarkSeaGreen4_2 157 DarkSeaGreen2_2 243 Grey46 + 72 CadetBlue 158 DarkSeaGreen1 244 Grey50 + 73 CadetBlue_2 159 PaleTurquoise1 245 Grey54 + 74 SkyBlue3 160 Red3_2 246 Grey58 + 75 SteelBlue1 161 DeepPink3 247 Grey62 + 76 Chartreuse3_2 162 DeepPink3_2 248 Grey66 + 77 PaleGreen3 163 Magenta3_2 249 Grey70 + 78 SeaGreen3 164 Magenta3_3 250 Grey74 + 79 Aquamarine3 165 Magenta2 251 Grey78 + 80 MediumTurquoise 166 DarkOrange3_2 252 Grey82 + 81 SteelBlue1_2 167 IndianRed_2 253 Grey85 + 82 Chartreuse2 168 HotPink3_2 254 Grey89 + 83 SeaGreen2 169 HotPink2 255 Grey93 + 84 SeaGreen1 170 Orchid + 85 SeaGreen1_2 171 MediumOrchid1 + + There are two colors (foreground and background) and only one bold + attribute. Thus single bold attribute affects both colors when + "reverse" attribute is used in vifm run inside terminal emulator. At + the same time linux native console can handle boldness of foreground + and background colors independently, but for consistency with terminal + emulators this is available only implicitly by using light versions of + colors. This behaviour might be changed in the future. + + Although vifm supports 256 colors in a sense they are supported by UI + drawing library, whether you will be able to use all of them highly + depends on your terminal. To set up terminal properly, make sure that + $TERM in the environment you run vifm is set to name of 256-color + terminal (on *nixes it can also be set via X resources), e.g. + xterm-256color. One can find list of available terminal names by + listing /usr/lib/terminfo/. Number of colors supported by terminal + with current settings can be checked via "tput colors" command. + + In order to use 24-bit colors one needs a terminal that supports them, + corresponding terminfo record (probably ends in "-direct" like in + "xterm-direct") and $TERM pointing to it. When vifm detects direct + color support "cterm*" values are ignored for groups which have at + least one of "gui*" values set, otherwise they are used after + translating via a builtin palette. + + Here is the hierarchy of highlight groups, which you need to know for + using transparency: + JobLine + SuggestBox + StatusLine + WildMenu + User1..User9 + Border + CmdLine + ErrorMsg + Win + OtherWin + AuxWin + OddLine + File name specific highlights + Directory + Link + BrokenLink + HardLink + Socket + Device + Fifo + Executable + Selected + CurrLine + LineNr (in active pane) + OtherLine + LineNr (in inactive pane) + TopLine + TopLineSel + TabLineSel (for pane tabs) + User1..User9 + TabLine + TabLineSel + User1..User9 + + "none" means default terminal color for highlight groups at the first + level of the hierarchy and transparency for all others. + + Here file name specific highlights mean those configured via globs ({}) + or regular expressions (//). At most one of them is applied per file + entry, namely the first that matches file name, hence order of + :highlight commands might be important in certain cases. + + :history + + :his[tory] + display a menu with list of visited directories. See "Menus and + dialogs" section for controls. + + :his[tory] x + x can be: + d[ir] or . show directory history. + c[md] or : show command line history. + s[earch] or / show search history and search forward on l + key. + f[search] or / show search history and search forward on l + key. + b[search] or ? show search history and search backward on l + key. + i[nput] or @ show prompt history (e.g. on one file + renaming). + fi[lter] or = show filter history (see description of the "=" + normal mode command). + See "Menus and dialogs" section for controls. + + :histnext + + :histnext + same as . The main use case for this command is to work + around the common pain point of and being the same + ASCII character: one could alter the terminal emulator settings + to emit, for example, the `F1` keycode when Ctrl-I is pressed, + then `:noremap :histnext` in vifm, add "t" flag to the + 'cpoptions', and thus have both and working as + expected. + + :histprev + + :histprev + same as . + + :if + + :if {expr1} + start conditional block. Commands are executed until next + matching :elseif, :else or :endif command if {expr1} evaluates + to non-zero, otherwise they are ignored. See also help on :else + and :endif commands. + + Example: + + if $TERM == 'screen.linux' + highlight CurrLine ctermfg=lightwhite ctermbg=lightblack + elseif $TERM == 'tmux' + highlight CurrLine cterm=reverse ctermfg=black ctermbg=white + else + highlight CurrLine cterm=bold,reverse ctermfg=black ctermbg=white + endif + + :invert + + :invert [f] + invert file name filter. + + :invert? [f] + show current filter state. + + :invert s + invert selection. + + :invert o + invert sorting order of the primary sorting key. + + :invert? o + show sorting order of the primary sorting key. + + :jobs + + :jobs display menu of current backgrounded processes. See "Menus and + dialogs" section for controls. + + :let + + :let $ENV_VAR = + set an environment variable. Warning: setting environment + variable to an empty string on Windows removes it. + + :let $ENV_VAR .= + append value to environment variable. + + :let &[l:|g:]opt = + sets option value. + + :let &[l:|g:]opt .= + append value to string option. + + :let &[l:|g:]opt += + increasing option value, adding sub-values. + + :let &[l:|g:]opt -= + decreasing option value, removing sub-values. + + Where could be a single-quoted string, double-quoted string, an + environment variable, function call or a concatanation of any of them + in any order using the '.' operator. Any whitespace is ignored. + + :locate + + :locate filename + use "locate" command to create a menu of filenames. Selecting a + file from the menu will reload the current file list in vifm to + show the selected file. By default the command relies on the + external "locate" utility (it's assumed that its database is + already built), which can be customized by altering value of the + 'locateprg' option. See "Menus and dialogs" section for + controls. + + :locate + repeat last :locate command. + + :ls + + :ls lists windows of active terminal multiplexer (only when terminal + multiplexer is used). This is achieved by issuing proper + command for active terminal multiplexer, thus the list is not + handled by vifm. + + :lstrash + + :lstrash + display a menu with list of files in trash. Each element of the + list is original path of a deleted file, thus the list can + contain duplicates. See "Menus and dialogs" section for + controls. + + :mark + + :[range]ma[rk][?] x [/full/path] [filename] + Set mark x (a-zA-Z0-9) at /full/path and filename. By default + current directory is being used. If no filename was given and + /full/path is current directory then last file in [range] is + used. Using of macros is allowed. Question mark will stop + command from overwriting existing marks. + + :marks + + :marks create a pop-up menu of marks. See "Menus and dialogs" section + for controls. + + :marks list ... + display the contents of the marks that are mentioned in list. + + :media + + :media only for *nix + display media management menu. See "Menus and dialogs" section + for controls. See also 'mediaprg' option. + + :messages + + :mes[sages] + shows previously given messages (up to 50). + + :mkdir + + :[line]mkdir[!] dir ... + create directories at specified paths. The [line] can be used + to pick node in a tree-view. "!" means make parent directories + as needed. Macros are expanded. + + :move + + :[range]m[ove][!?][ &] + move files to directory of other view. With "?" prompts for + destination file names in an editor. "!" forces overwrite. + + :[range]m[ove][!] path[ &] + move files to directory specified with the path (absolute or + relative to directory of other view). "!" forces overwrite. + + :[range]m[ove][!] name1 name2...[ &] + move files to directory of other view giving each next file a + corresponding name from the argument list. "!" forces + overwrite. + + :nohlsearch + + :noh[lsearch] + clear selection in current pane. + + :normal + + :norm[al][!] commands + execute normal mode commands. If "!" is used, user defined + mappings are ignored. Unfinished last command is aborted as if + or was typed. A ":" should be completed as well. + Commands can't start with a space, so put a count of 1 (one) + before it. + + :only + + :on[ly] + switch to a one window view. + + :plugin + + :plugin load + loads all plugins. To be used in configuration file to manually + load plugins at an earlier point. The plugins can be loaded + only once, additional calls will do nothing. + + :plugin blacklist {plugin} + adds {plugin} to the list of plugins to be ignored. + + :plugin whitelist {plugin} + adds {plugin} to the list of plugins to be loaded while ignoring + all other plugins. This list should normally be empty. + + :plugins + + :plugins + open plugins menu. See "Menus and dialogs" section for + controls. + + :popd + + :popd remove pane directories from stack. + + :pushd + + :pushd[!] /curr/dir [/other/dir] + add pane directories to stack and process arguments like :cd + command. + + :pushd exchange the top two items of the directory stack. + + :put + + :[line]pu[t][!] [reg] [ &] + put files from specified register (" by default) into current + directory. The [line] can be used to pick node in a tree-view. + "!" moves files "!" moves files from their original location + instead of copying them. During this operation no confirmation + dialogs will be shown, all checks are performed beforehand. + + :pwd + + :pw[d] show the present working directory. + + :qall + + :qa[ll][!] + exit vifm (add ! to skip saving changes and checking for active + backgrounded commands). + + :quit + + :q[uit][!] + if there is more than one tab, close the current one, otherwise + exit vifm (add ! to skip saving state and checking for active + backgrounded commands). + + :redraw + + :redr[aw] + redraw the screen immediately. + + :registers + + :reg[isters] + display menu with registers content. + + :reg[isters] list ... + display the contents of the numbered and named registers that + are mentioned in list (for example "az to display "", "a and "z + content). + + :regular + + :regular + + switch to regular view leaving custom view. + :rename + + :[range]rename[!] + rename files by editing their names in an editor. "!" renames + files recursively in subdirectories. See "External Renaming" + section. + + :[range]rename name1 name2... + rename each of selected files to a corresponding name. + + :restart + + :restart + free a lot of things (histories, commands, etc.), reread + vifminfo, vifmrc and session files and run startup commands + passed in the argument list, thus losing all unsaved changes + (e.g. recent history or keys mapped after starting this + instance). Session that wasn't yet stored gets reset. + + While many things get reset, some basic UI state and current + locations are preserved, including tabs. + + :restart full + variation of :restart that makes no attempt to preserve + anything. + + :restore + + :[range]restore + restore file from trash directory, doesn't work outside one of + trash directories. See "Trash directory" section below. + + :rlink + + :[range]rlink[!?] + create relative symbolic links to files in directory of other + view. With "?" prompts for destination file names in an editor. + "!" forces overwrite. + + :[range]rlink[!] path + create relative symbolic links of files in directory specified + with the path (absolute or relative to directory of other view). + "!" forces overwrite. + + :[range]rlink[!] name1 name2... + create relative symbolic links of files in directory of other + view giving each next link a corresponding name from the + argument list. "!" forces overwrite. + + :screen + + :screen + toggle whether to use the terminal multiplexer or not. + A terminal multiplexer uses pseudo terminals to allow multiple + windows to be used in the console or in a single xterm. + Starting vifm from terminal multiplexer with appropriate support + turned on will cause vifm to open a new terminal multiplexer + window for each new file edited or program launched from vifm. + This requires screen version 3.9.9 or newer for the screen -X + argument or tmux (1.8 version or newer is recommended). + + :screen! + enable integration with terminal multiplexers. + + :screen? + display whether integration with terminal multiplexers is + enabled. + + Note: the command is called screen for historical reasons (when tmux + wasn't yet supported) and might be changed in future releases, or get + an alias. + + :select + + :[range]select + select files in the given range (current file if no range is + given). + + :select {pattern} + select files that match specified pattern. Possible {pattern} + forms are described in "Patterns" section below. Trailing slash + for directories is taken into account, so `:select! */ | invert + s` selects only files. + + :select //[iI] + same as item above, but reuses last search pattern. + + :select !{external command} + select files from the list supplied by external command. Files + are matched by full paths, relative paths are converted to + absolute ones beforehand. + + :[range]select! [{pattern}] + same as above, but resets previously selected items before + proceeding. + + :session + + :session? + print name of the current session. + + :session + detach current session without saving it. Resets v:session. + + :session name + create or load and switch to a session with the specified name. + Name can't contain slashes. Session active at the moment is + saved before the switch. Session is also automatically saved + when quiting the application in usual ways. Sets v:session. + + :set + + :se[t] display all options that differ from their default value. + + :se[t] all + display all options. + + :se[t] opt1=val1 opt2='val2' opt3="val3" ... + sets given options. For local options both values are set. + You can use following syntax: + - for all options - option, option? and option& + - for boolean options - nooption, invoption and option! + - for integer options - option=x, option+=x and option-=x + - for string options - option=x and option+=x + - for string list options - option=x, option+=x, option-=x and + option^=x + - for enumeration options - option=x, option+=x and option-=x + - for set options - option=x, option+=x, option-=x and + option^=x + - for charset options - option=x, option+=x, option-=x and + option^=x + + the meaning: + - option - turn option on (for boolean) or print its value (for + all others) + - nooption - turn option off + - invoption - invert option state + - option! - invert option state + - option? - print option value + - option& - reset option to its default value + - option=x or option:x - set option to x + - option+=x - add/append x to option + - option-=x - remove (or subtract) x from option + - option^=x - toggle x presence among values of the option + + Option name can be prepended and appended by any number of + whitespace characters. + + :setglobal + + :setg[lobal] + display all global options that differ from their default value. + + :setg[lobal] all + display all global options. + + :setg[lobal] opt1=val1 opt2='val2' opt3="val3" ... + same as :set, but changes/prints only global options or global + values of local options. Changes to the latter might be not + visible until directory is changed. + + :setlocal + + :setl[ocal] + display all local options that differ from their default value. + + :setl[ocal] all + display all local options. + + :setl[ocal] opt1=val1 opt2='val2' opt3="val3" ... + same as :set, but changes/prints only local values of local + options. + + :shell + + :sh[ell][!] + start a shell in current directory. "!" suppresses spawning + dedicated window of terminal multiplexer for a shell. To make + vifm adaptive to environment it uses $SHELL if it's defined, + otherwise 'shell' value is used. + + + :siblnext + + :[count]siblnext[!] + + change directory to [count]th next sibling directory after + current path using value of global sort option of current pane. + "!" enables wrapping. + + For example, say, you're at /boot and root listing starts like + this: + + bin/ + boot/ + dev/ + ... + + Issuing :siblnext will navigate to /dev. + + + :siblprev + + :[count]siblprev[!] + same as :siblnext, but in the opposite direction. + + :sort + + :sor[t] + display dialog with different sorting methods, where one can + select the primary sorting key. When 'viewcolumns' options is + empty and 'lsview' is off, changing primary sorting key will + also affect view look (in particular the second column of the + view will be changed). See "Menus and dialogs" section for + controls. + + :source + + :so[urce] file + read command-line commands from the file. + + :split + + :sp[lit] + switch to a two window horizontal view. + + :sp[lit]! + toggle horizontal window splitting. + + :sp[lit] path + splits the window horizontally to show both file directories. + Also changes other pane to path (absolute or relative to current + directory of active pane). + + :stop + + :st[op] + suspend vifm (same as pressing Ctrl-Z). Does nothing if this + instance isn't running in a shell. The command exists to allow + mapping to the action of Ctrl-Z. + + :substitute + + :[range]s[ubstitute]/pattern/string/[flags] + for each file in range replace a match of pattern with string. + + String can contain \0...\9 to link to capture groups (\0 - all match, + \1 - first group, etc.). + + Pattern is stored in search history. + + Available flags: + + - i - ignore case (the 'ignorecase' and 'smartcase' options are not + used) + + - I - don't ignore case (the 'ignorecase' and 'smartcase' options are + not used) + + - g - substitute all matches in each file name (each g toggles this) + + :[range]s[ubstitute]/pattern + substitute pattern with an empty string. + + :[range]s[ubstitute]//string/[flags] + use last pattern from search history. + + :[range]s[ubstitute] + repeat previous substitution command. + + :sync + + :sync [relative path] + change the other pane to the current pane directory or to some + path relative to the current directory. Using macros is + allowed. + + :sync! change the other pane to the current pane directory and + synchronize cursor position. If current pane displays custom + list of files, position before entering it is used (current one + might not make any sense). + + + :sync! [location | cursorpos | localopts | filters | filelist | tree | + all]... + change enumerated properties of the other pane to match + corresponding properties of the current pane. Arguments have + the following meanings: + + - location - current directory of the pane; + + - cursorpos - cursor position (doesn't make sense without + "location"); + + - localopts - all local options; + + - filters - all filters; + + - filelist - list of files for custom view (implies + "location"); + + - tree - tree structure for tree view (implies "location"); + + - all - all of the above. + + :tabclose + + :tabc[lose] + close current tab, unless it's the only one open at current + scope. + + :tabmove + + :tabm[ove] [N] + without the argument or with `$` as the argument, current tab + becomes the last tab. With the argument, current tab is moved + after the tab with the specified number. Argument of `0` moves + current tab to the first position. + + :tabname + + :tabname [name] + set, update or reset (when no argument is provided) name of the + current tab. + + :tabnew + + :tabnew [path] + create new tab. Accepts optional path for the new tab. Macros + and environment variables are expanded. + + :tabnext + + :tabn[ext] + switch to the next tab (wrapping around). + + :tabn[ext] {n} + go to the tab number {n}. Tab numeration starts with 1. + + :tabonly + + :tabo[nly] + close all tabs but the current one. Closes pane tabs only at + the active side. + + :tabprevious + + :tabp[revious] + switch to the previous tab (wrapping around). + + :tabp[revious] {n} + go to the {n}-th previous tab. Note that :tabnext handles its + argument differently. + + :touch + + :[line]touch file... + create files at specified paths. Aborts on errors. Doesn't + update time of existing files. The [line] can be used to pick + node in a tree-view. Macros are expanded. + + :tr + + :[range]tr/pattern/string/ + for each file in range transliterate the characters which appear + in pattern to the corresponding character in string. When + string is shorter than pattern, it's padded with its last + character. + + :trashes + + :trashes + lists all valid trash directories in a menu. Only non-empty and + writable trash directories are shown. This is exactly the list + of directories that are cleared when :empty command is executed. + + :trashes? + same as :trashes, but also displays size of each trash + directory. + + :tree + + :tree turn pane into tree view with current directory as its root. + The tree view is implemented on top of a custom view, but is + automatically kept in sync with file system state and considers + all the filters. Thus the structure corresponds to what one + would see on visiting the directories manually. As a special + case for trees built out of custom view file-system tracking + isn't performed. + + To leave tree view go up from its root or use gh at any level of + the tree. Any command that changes directory will also do, in + particular, `:cd ..`. + + Tree structure is incompatible with alternative representations, + so values of 'lsview' and 'millerview' options are ignored. + + The "depth" argument specifies nesting level on which loading of + subdirectories won't happen (they will be folded). Values start + at 1. + + :tree! toggle current view in and out of tree mode. + + :undolist + + :undol[ist] + display list of latest changes. Use "!" to see actual commands. + See "Menus and dialogs" section for controls. + + :unlet + + :unl[et][!] $ENV_VAR1 $ENV_VAR2 ... + remove environment variables. Add ! to omit displaying of + warnings about nonexistent variables. + + :unselect + + :[range]unselect + unselect files in the given range (current file if no range is + given). + + :unselect {pattern} + unselect files that match specified pattern. Possible {pattern} + forms are described in "Patterns" section below. Trailing slash + for directories is taken into account, so `:unselect */` + unselects directories. + + :unselect !{external command} + unselect files from the list supplied by external command. + Files are matched by full paths, relative paths are converted to + absolute ones beforehand. + + :unselect //[iI] + same as item above, but reuses last search pattern. + + :version + + :ve[rsion] + show menu with version information. + + :vifm + + :vifm same as :version. + + :view + + :vie[w] + toggle on and off the quick file view (preview of file's + contents). See also 'quickview' option. + + :vie[w]! + turn on quick file view if it's off. + + :volumes + + :volumes + only for MS-Windows + display menu with volume list. Hitting l (or Enter) key opens + appropriate volume in the current pane. See "Menus and dialogs" + section for controls. + + :vsplit + + :vs[plit] + switch to a two window vertical view. + + :vs[plit]! + toggle window vertical splitting. + + :vs[plit] path + split the window vertically to show both file directories. And + changes other pane to path (absolute or relative to current + directory of active pane). + + :wincmd + + :[count]winc[md] {arg} + same as running Ctrl-W [count] {arg}. + + :windo + + :windo [command...] + execute command for each pane (same as :winrun % command). + + :winrun + + :winrun type [command...] + execute command for pane(s), which is determined by type + argument: + - ^ - top-left pane + - $ - bottom-right pane + - % - all panes + - . - current pane + - , - other pane + + :write + + :w[rite] + write current state to vifminfo and session files (if a session + is active). + + :wq + + :wq[!] same as :quit, but ! disables only the check of backgrounded + commands, while state of the application is always written. + :wqall + + :wqa[ll][!] + same as :qall, but ! disables only the check of backgrounded + commands, while state of the application is always written. + + :xall + + :xa[ll][!] + same as :qall. + + :xit + + :x[it][!] + same as :quit. + + :yank + + :[range]y[ank] [reg] [count] + will yank files to the reg register. + + :map lhs rhs + + :map lhs rhs + map lhs key sequence to rhs in normal and visual modes. + + :map! lhs rhs + map lhs key sequence to rhs in command line mode. + + + :cmap :dmap :mmap :nmap :qmap + :vmap + + :cm[ap] lhs rhs + map lhs to rhs in command line mode. + + :dm[ap] lhs rhs + map lhs to rhs in dialog modes. + + :mm[ap] lhs rhs + map lhs to rhs in menu mode. + + :nm[ap] lhs rhs + map lhs to rhs in normal mode. + + :qm[ap] lhs rhs + map lhs to rhs in view mode. + + :vm[ap] lhs rhs + map lhs to rhs in visual mode. + + + :*map + + :cm[ap] + list all maps in command line mode. + + :dm[ap] + list all maps in dialog modes. + + :mm[ap] + list all maps in menu mode. + + :nm[ap] + list all maps in normal mode. + + :qm[ap] + list all maps in view mode. + + :vm[ap] + list all maps in visual mode. + + :*map beginning + + :cm[ap] beginning + list all maps in command line mode that start with the + beginning. + + :dm[ap] beginning + list all maps in dialog modes that start with the beginning. + + :mm[ap] beginning + list all maps in menu mode that start with the beginning. + + :nm[ap] beginning + list all maps in normal mode that start with the beginning. + + :qm[ap] beginning + list all maps in view mode that start with the beginning. + + :vm[ap] beginning + list all maps in visual mode that start with the beginning. + + :noremap + + :no[remap] lhs rhs + map the key sequence lhs to rhs for normal and visual modes, but + don't expand user mappings in rhs. + + :no[remap]! lhs rhs + map the key sequence lhs to rhs for command line mode, but don't + expand user mappings in rhs. + + :cnoremap :dnoremap :mnoremap :nnoremap :qnoremap + :vnoremap + + :cno[remap] lhs rhs + map the key sequence lhs to rhs for command line mode, but don't + expand user mappings in rhs. + + :dn[oremap] lhs rhs + map the key sequence lhs to rhs for dialog modes, but don't + expand user mappings in rhs. + + :mn[oremap] lhs rhs + map the key sequence lhs to rhs for menu mode, but don't expand + user mappings in rhs. + + :nn[oremap] lhs rhs + map the key sequence lhs to rhs for normal mode, but don't + expand user mappings in rhs. + + :qn[oremap] lhs rhs + map the key sequence lhs to rhs for view mode, but don't expand + user mappings in rhs. + + :vn[oremap] lhs rhs + map the key sequence lhs to rhs for visual mode, but don't + expand user mappings in rhs. + + :unmap + + :unm[ap] lhs + remove user mapping of lhs from normal and visual modes. + + :unm[ap]! lhs + remove user mapping of lhs from command line mode. + + :cunmap :dunmap :munmap :nunmap :qunmap + :vunmap + + :cu[nmap] lhs + remove user mapping of lhs from command line mode. + + :du[nmap] lhs + remove user mapping of lhs from dialog modes. + + :mu[nmap] lhs + remove user mapping of lhs from menu mode. + + :nun[map] lhs + remove user mapping of lhs from normal mode. + + :qun[map] lhs + remove user mapping of lhs from view mode. + + :vu[nmap] lhs + remove user mapping of lhs from visual mode. + +Ranges + The ranges implemented include: + 2,3 - from second to third file in the list (including it) + % - the entire directory. + . - the current position in the filelist. + $ - the end of the filelist. + 't - the mark position t. + + Examples: + + :%delete + + would delete all files in the directory. + + :2,4delete + + would delete the files in the list positions 2 through 4. + + :.,$delete + + would delete the files from the current position to the end of the + filelist. + + :3delete4 + + would delete the files in the list positions 3, 4, 5, 6. + + If a backward range is given :4,2delete - an query message is given and + user can chose what to do next. + + The builtin commands that accept a range are :d[elete] and :y[ank]. + +Command macros + The command macros may be used in user commands. + + %a User arguments. When user arguments contain macros, they are + expanded before preforming substitution of %a. + + %c %"c The current file under the cursor. + + %C %"C The current file under the cursor in the other directory. + + %f %"f All of the selected files, but see "Selection" section below. + + %F %"F All of the selected files in the other directory list, but see + "Selection" section below. + + %b %"b Same as %f %F. + + %d %"d Full path to current directory. + + %D %"D Full path to other file list directory. + + %rx %"rx + Full paths to files in the register {x}. In case of invalid + symbol in place of {x}, it's processed with the rest of the line + and default register is used. + + %m Show command output in a menu. + + %M Same as %m, but l (or Enter) key is handled like for :locate and + :find commands. + + %u Process command output as list of paths and compose custom view + out of it. + + %U Same as %u, but implies less list updates inside vifm, which is + absence of sorting at the moment. + + %Iu Same as %u, but gives up terminal before running external + command. + + %IU Same as %U, but gives up terminal before running external + command. + + %S Show command output in the status bar. + + %q Redirect command output to quick view, which is activated if + disabled. + + %s Execute command in horizontally split window of active terminal + multiplexer (ignored if not running inside one). + + %v Same as %s, but splits vertically. + + %n Forbid use of terminal multiplexer to run the command. + + %i Completely ignore command output. For background jobs this + suppresses error dialogs, while still storing errors internally + for viewing via :jobs menu. + + %Pl Pipe list of files to standard input of a command. + + %Pz Same as %Pz, but separates paths by null ('\0') character. + + %pc Marks the end of the main command and the beginning of the clear + command for graphical preview, which is invoked on closing + preview of a file. + + %pd Marks a preview command as one that directly communicates with + the terminal. Beware that this is for things like sixel which + are self-contained sequences that depend only on current cursor + position, using this with anything else is likely to mangle + terminal state. + + The following dimensions and coordinates are in characters: + + %px x coordinate of top-left corner of preview area. + + %py y coordinate of top-left corner of preview area. + + %pw width of preview area. + + %ph height of preview area. + + + Use %% if you need to put a percent sign in your command. + + Note that %i, %Iu, %IU, %m, %M, %n, %q, %s, %S, %u, %U and %v macros + are mutually exclusive. Only the last one of them on the command will + take effect. + + Note that %Pl and %Pz are mutually exclusive. Only the last one of + them on the command will take effect. + + You can use file name modifiers after %c, %C, %f, %F, %b, %d and %D + macros. Supported modifiers are: + + - :p - full path + + - :u - UNC name of path (e.g. "\\server" in + "\\server\share"), Windows only. Expands to current computer name + for not UNC paths. + + - :~ - relative to the home directory + + - :. - relative to current directory + + - :h - head of the file name + + - :t - tail of the file name + + - :r - root of the file name (without last extension) + + - :e - extension of the file name (last one) + + - :s?pat?sub? - substitute the first occurrence of pat with sub. + You can use any character for '?', but it must not occur in pat or + sub. + + - :gs?pat?sub? - like :s, but substitutes all occurrences of pat with + sub. + + See ':h filename-modifiers' in Vim's documentation for the detailed + description. + + Using %x means expand corresponding macro escaping all characters that + have special meaning. And %"x means using of double quotes and escape + only backslash and double quote characters, which is more useful on + Windows systems. + + Position and quantity (if there is any) of %m, %M, %S or %s macros in + the command is unimportant. All their occurrences are removed from the + resulting command. + + %c and %f macros are expanded to file names only, when %C and %F are + expanded to full paths. %f and %F follow this in %b too. + + :com move mv %f %D + set the :move command to move all of the files selected in the + current directory to the other directory. + + The %a macro is replaced with any arguments given to an alias command. + All arguments are considered optional. + :com lsl !!ls -l %a - set the lsl command to execute ls -l with + or without an argument. + + :lsl + will list the directory contents of the current directory. + + :lsl filename + will list only the given filename. + + The macros can also be used in directly executing commands. ":!mv %f + %D" would move the current directory selected files to the other + directory. + + Appending & to the end of a command causes it to be executed in the + background. Typically you want to run two kinds of external commands + in the background: + + - GUI applications that doesn't fork thus block vifm (:!sxiv %f &); + + - console tools that do not work with terminal (:!mv %f %D &). + + You don't want to run terminal commands, which require terminal input + or output something in background because they will mess up vifm's TUI. + Anyway, if you did run such a command, you can use Ctrl-L key to update + vifm's TUI. + + Rewriting the example command with macros given above with + backgrounding: + + %m, %M, %s, %S, %u and %U macros cannot be combined with background + mark (" &") as it doesn't make much sense. + +Command backgrounding + Copy and move operation can take a lot of time to proceed. That's why + vifm supports backgrounding of this two operations. To run :copy, + :move or :delete command in the background just add " &" at the end of + a command. + + For each background operation a new thread is created. Job + cancellation can be requested in the :jobs menu via dd shortcut. + + You can see if command is still running in the :jobs menu. + Backgrounded commands have progress instead of process id at the line + beginning. + + Background operations cannot be undone. + +Cancellation + Note that cancellation works somewhat different on Windows platform due + to different mechanism of break signal propagation. One also might + need to use Ctrl-Break shortcut instead of Ctrl-C. + + There are two types of operations that can be cancelled: + + - file system operations; + + - mounting with FUSE (but not unmounting as it can cause loss of + data); + + - calls of external applications. + + Note that vifm never terminates applications, it sends SIGINT signal + and lets the application quit normally. + + When one of set of operations is cancelled (e.g. copying of 5th file of + 10 files), further operations are cancelled too. In this case undo + history will contain only actually performed operations. + + Cancelled operations are indicated by "(cancelled)" suffix appended to + information message on statusbar. + + File system operations + + Currently the following commands can be cancelled: :alink, :chmod, + :chown, :clone, :copy, :delete, :mkdir, :move, :restore, :rlink, + :touch. File putting (on p/P key) can be cancelled as well. It's not + hard to see that these are mainly long-running operations. + + Cancelling commands when they are repeated for undo/redo operations is + allowed for convenience, but is not recommended as further undo/redo + operations might get blocked by side-effects of partially cancelled + group of operations. + + These commands can't be cancelled: :empty, :rename, :substitute, :tr. + + Mounting with FUSE + + It's not considered to be an error, so only notification on the status + bar is shown. + + External application calls + + Each of this operations can be cancelled: :apropos, :find, :grep, + :locate. + +Selection + If there is a selection, it's stashed before proceeding further unless + file under the cursor is part of that selection. This means that when + macros are expanded for :filetype or :filextype programs, `%f` and `%F` + become equivalent to `%c` and `%C` respectively if current file is not + selected. So you run selection by running one of selected files, + otherwise you're running a single file even if there are other selected + entries. + + When running a selection it must not include broken symbolic links, has + to be consistent and set of file handlers must be compatible. + Consistency means that selection contains either only directories + (including links to them) or only files, but not their mix. + + Compatibility is a more sophisticated check, but it's defined in a + natural way so that you get what you'd expect. The following + properties of selection are taken into account while checking it for + compatibility and deciding how to handle it: + + + 1. If there any files for which handler isn't defined, then all files + are opened using 'vicmd' or 'vixcmd'. + + + 2. If all handlers match the following criteria: + - backgrounded + - include `%c` and/or `%C` + - include neither `%f` nor `%F` + then each file is executed independently of the rest. + + + 3. If all handlers are equal, the common handler is executed. This + handler might ignore selection and process only file under the + cursor. + + + 4. Otherwise, an error is reported, because handlers differ and they + don't support parallel execution. + +Patterns + :highlight, :filetype, :filextype, :fileviewer commands and 'classify' + option support globs, regular expressions and mime types to match file + names or their paths. + + There are six possible ways to write a single pattern: + + 1. [!]{comma-separated-name-globs} + + 2. [!]{{comma-separated-path-globs}} + + 3. [!]/name-regular-expression/[iI] + + 4. [!]//path-regular-expression//[iI] + + 5. [!] + + 6. undecorated-pattern + + First five forms can include leading exclamation mark that negates + pattern matching. + + The last form is implicitly refers to one of others. :highlight does + not accept undecorated form, while :filetype, :filextype, :fileviewer, + :select, :unselect and 'classify' treat it as list of name globs. + + Path patterns receive absolute path of the file that includes its name + component as well. + + To combine several patterns (AND them), make sure you're using one of + the first five forms and write patterns one after another, like this: + {*.vifm} + Mind that if you make a mistake the whole string will be treated as the + sixth form. + + :filetype, :filextype and :fileviewer commands accept comma-separated + list of patterns instead of a single pattern, thus effectively handling + OR operation on them: + {*.vifm},{*.pdf} + Forms that accept comma-separated lists of patterns also process them + as lists of alternatives. + + Patterns with regular expressions + + Regular expression patterns are case insensitive by default, see + description of commands, which might override default behaviour. + + Flags of regular expressions mean the following: + - "i" makes filter case insensitive; + - "I" makes filter case sensitive. They can be repeated multiple + times, but the later one takes precedence (e.g. "iiiI" is equivalent + to "I" and "IiIi" is the same as "i"). + + There are no implicit `^` or `$`, so make sure to specify them + explicitly if the pattern should match the whole name or path. + + Patterns with globs + + "Globs" section below provides short overview of globs and some + important points that one needs to know about them. + + Patterns with mime-types + + Mime type matching is essentially globs matching applied to mime type + of a file instead of its name/path. Note: mime types aren't detected + on Windows. + + Examples + + Associate `evince` to PDF-files only inside `/home/user/downloads/` + directory (excluding its subdirectories): + + :filextype //^/home/user/downloads/[^/]*.pdf$// evince %f + + +Globs + Globs are always case insensitive as it makes sense in general case. + + `*`, `?`, `[` and `]` are treated as special symbols in the pattern. + E.g. + + :filetype * less %c + + matches all files. One can use character classes for escaping, so + + :filetype [*] less %c + + matches only one file name, the one which contains only asterisk + symbol. + + `*` means any number of any characters (possibly an empty substring), + with one exception: asterisk at the pattern beginning doesn't match dot + in the first position. E.g. + + :fileviewer *.zip,*.jar zip -sf %c + + associates using of `zip` program to preview all files with `zip` or + `jar` extensions as listing of their content, but `.file.zip` won't be + matched. + + `?` means any character at this position. E.g. + + :fileviewer ?.out file %c + + calls `file` tool for all files which have exactly one character before + their extension (e.g. a.out, b.out). + + Square brackets designate character class, which means that whole + character class matches against any of characters listed in it. For + example + + :fileviewer *.[ch] highlight -O xterm256 -s dante --syntax c %c + + makes vifm call `highlight` program to colorize source and header files + in C language for a 256-color terminal. Equal command would be + + :fileviewer *.c,*.h highlight -O xterm256 -s dante --syntax c %c + + + Inside square brackets `^` or `!` can be used for symbol class + negotiation and the `-` symbol to set a range. `^` and `!` should + appear right after the opening square bracket. For example + + :filetype *.[!d]/ inspect_dir + + associates `inspect_dir` as additional handler for all directories that + have one character extension unless it's "d" letter. And + + :filetype [0-9].jpg sxiv + + associates `sxiv` picture viewer only for JPEG-files that contain + single digit in their name. + + If you need to include literal comma, which is normally separates + multiple globs, double it. + +:set options + Local options + These are kind of options that are local to a specific view. So + you can set ascending sorting order for left pane and descending + order for right pane. + + In addition to being local to views, each such option also has + two values: + + - local to current directory (value associated with current + location); + + - global to current directory (value associated with the + pane). + + The idea is that current directory can be made a temporary + exception to regular configuration of the view, until directory + change. Use :setlocal for that. :setglobal changes view value + not affecting settings until directory change. :set applies + changes immediately to all values. + + + 'aproposprg' + type: string + default: "apropos %a" + Specifies format for an external command to be invoked by the + :apropos command. The format supports expanding of macros, + specific for a particular *prg option, and %% sequence for + inserting percent sign literally. This option should include + the %a macro to specify placement of arguments passed to the + :apropos command. If the macro is not used, it will be + implicitly added after a space to the value of this option. + + 'autochpos' + type: boolean + default: true + When disabled vifm will set cursor to the first line in the view + after :cd and :pushd commands instead of saved cursor position. + Disabling this will also make vifm clear information about + cursor position in the view history on :cd and :pushd commands + (and on startup if 'autochpos' is disabled in the vifmrc). l + key in the ":history ." and ":trashes" menus are treated like + :cd command. This option also affects marks so that navigating + to a mark doesn't restore cursor position. + + When this option is enabled, more fine grained control over + cursor position is available via 'histcursor' option. + + 'columns' 'co' + type: integer + default: terminal width on startup + Terminal width in characters. + + 'caseoptions' + type: charset + default: "" + This option gives additional control over case sensitivity by + allowing overriding default behaviour to either always be case + sensitive or always be case insensitive. Possible values form + pairs of lower and upper case letters that configure specific + aspect of behaviour: + p - always ignore case of paths during completion. + P - always match case of paths during completion. + g - always ignore case of characters for f/F/;/,. + G - always match case of characters for f/F/;/,. + + At most one item of each pair takes affect, if both or more are + present, only the last one matters. When none of pair's + elements are present, the behaviour is default (depends on + operating system for path completion and on values of + 'ignorecase' and 'smartcase' options for file navigation). + + 'cdpath' 'cd' + type: string list + default: value of $CDPATH with commas instead of colons + Specifies locations to check on changing directory with relative + path that doesn't start with "./" or "../". When non-empty, + current directory is examined after directories listed in the + option. + + This option doesn't affect completion of :cd command. + + Example: + + set cdpath=~ + + This way ":cd bin" will switch to "~/bin" even if directory + named "bin" exists in current directory, while ":cd ./bin" + command will ignore value of 'cdpath'. + + 'chaselinks' + type: boolean + default: false + When enabled path of view is always resolved to real path (with + all symbolic links expanded). + + 'classify' + type: string list + default: ":dir:/" + Specifies file name prefixes and suffixes depending on file type + or name. The format is either of: + - [{prefix}]:{filetype}:[{suffix}] + - [{prefix}]::{pattern}::[{suffix}] + Possible {pattern} forms are described in "Patterns" section + above. + + Priority rules: + - file name patterns have priority over type patterns + - file name patterns are matched in left-to-right order of + their appearance in this option + + Either {prefix} or {suffix} or both can be omitted (which is the + default for all unspecified file types), this means empty + {prefix} and/or {suffix}. {prefix} and {suffix} should consist + of at most eight characters. Elements are separated by commas. + Neither prefixes nor suffixes are part of file names, so they + don't affect commands which operate on file names in any way. + Comma (',') character can be inserted by doubling it. List of + file type names can be found in the description of filetype() + function. + + 'confirm' 'cf' + type: set + default: delete,permdelete + Defines which operations require confirmation: + - delete - moving files to trash (on d or :delete); + - permdelete - permanent deletion of files (on D or :delete! + command or on undo/redo operation). + + 'cpoptions' 'cpo' + type: charset + default: "fst" + Contains a sequence of single-character flags. Each flag + enables behaviour of older versions of vifm. Flags: + - f - when included, running :filter command results in not + inverted (matching files are filtered out) and :filter! in + inverted (matching files are left) filter, when omitted, meaning + of the exclamation mark changes to the opposite; + - s - when included, yy, dd and DD normal mode commands act on + selection, otherwise they operate on current file only; + - t - when included, (thus ) behave as and + switches active pane, otherwise and go forward in + the view history. It's possible to make both and to + work as expected by setting up the terminal to emit a custom + sequence when is pressed; see :histnext for details. + + 'cvoptions' + type: set + default: + Specifies whether entering/leaving custom views triggers events + that normally happen on entering/leaving directories: + - autocmds - trigger autocommands on entering/leaving custom + views; + - localopts - reset local options on entering/leaving custom + views; + - localfilter - reset local filter on entering/leaving custom + views. + + 'deleteprg' + type: string + default: "" + Specifies program to run on files that are permanently removed. + When empty, files are removed as usual, otherwise this command + is invoked on each file by appending its name. If the command + doesn't remove files, they will remain on the file system. + + 'dirsize' + type: enumeration + default: size + Controls how size of directories is displayed in file views. + The following values are possible: + - size - size of directory (i.e., size used to store list of + files) + - nitems - number of entries in the directory (excluding . and + ..) + + Size obtained via ga/gA overwrites this setting so seeing count + of files and occasionally size of directories is possible. + + 'dotdirs' + type: set + default: nonrootparent,treeleafsparent + Controls displaying of dot directories. The following values + are possible: + - rootparent - show "../" in root directory of file system + - nonrootparent - show "../" in non-root directories of file + system + - treeleafsparent - show "../" in empty directories of tree + view + + Note that empty directories always contain "../" entry + regardless of value of this option. "../" disappears at the + moment at least one file is created. + + 'dotfiles' + type: boolean + default: false + Whether dot files are shown in the view. Can be controlled with + z* bindings. + + 'fastrun' + type: boolean + default: false + With this option turned on you can run partially entered + commands with unambiguous beginning using :! (e.g. :!Te instead + of :!Terminal or :!Te). + + 'fillchars' 'fcs' + type: string list + default: "" + Sets characters used to fill borders. + + item default used for + vborder:c ' ' left, middle and right vertical + borders + + If value is omitted, its default value is used. Example: + + set fillchars=vborder:. + + 'findprg' + type: string + default: "find %s %a -print , -type d \( ! -readable -o ! + -executable \) -prune" + Specifies format for an external command to be invoked by the + :find command. The format supports expansion of macros specific + for this particular option and %% sequence for inserting percent + sign literally. The macros are: + + macro value/meaning + %s literal arguments of :find or + list of paths to search in + + %A empty or + literal arguments of :find + %a empty or + literal arguments of :find or + predicate followed by escaped arguments of :find + %p empty or + literal arguments of :find or + escaped arguments (parameters) of :find + + %u redirect output to custom view instead of showing a + menu + %U redirect output to unsorted custom view instead of + showing a menu + + Predicate in %a is "-name" on *nix and "-iname" on Windows. + + If both %u and %U are specified, %U is chosen. + + Some macros can be added implicitly: + - if %s isn't present, it's appended + - if neither of %a, %A and %p is present, %a is appended + - if neither of %s, %a, %A and %p is present, %s and %a are + appended in this order + + The macros slightly change their meaning depending on format of + :find's arguments: + - if the first argument points to an existing directory, %s is + assigned all arguments while %a, %A and %p are left empty + - otherwise: + - %s is assigned a dot (".") meaning current directory or + list of selected file names, if any + - %a, %A and %p are assigned literal arguments when first + argument starts with a dash ("-"), otherwise %a gets an escaped + version of the arguments with a predicate and %p contains + escaped version of the arguments + + Starting with Windows Server 2003 a `where` command is + available. One can configure vifm to use it in the following + way: + + set findprg="where /R %s %A" + + As the syntax of this command is rather limited, one can't use + :find command with selection of more than one item because the + command ignores all directory paths except for the last one. + + When using find port on Windows, another option is to setup + 'findprg' like this: + + set findprg="find %s %a" + + + 'followlinks' + type: boolean + default: true + Follow links on l or Enter. That is navigate to destination + file instead of treating the link as if it were target file. + Doesn't affects links to directories, which are always entered + (use gf key for directories). + + 'fusehome' + type: string + default: "($XDG_DATA_HOME/.local/share | $VIFM)/fuse/" + Directory to be used as a root dir for FUSE mounts. Value of + the option can contain environment variables (in form + "$envname"), which will be expanded (prepend it with a slash to + prevent expansion). The value should expand to an absolute + path. + + If you change this option, vifm won't remount anything. It + affects future mounts only. See "Automatic FUSE mounts" section + below for more information. + + 'gdefault' 'gd' + type: boolean + default: false + When on, 'g' flag is on for :substitute by default. + + 'grepprg' + type: string + default: "grep -n -H -I -r %i %a %s" + Specifies format for an external command to be invoked by the + :grep command. The format supports expanding of macros, + specific for a particular *prg option, and %% sequence for + inserting percent sign literally. This option should include + the %i macro to specify placement of "-v" string when inversion + of results is requested, %a or %A macro to specify placement of + arguments passed to the :grep command and the %s macro to + specify placement of list of files to search in. If some of the + macros are not used, they will be implicitly added after a space + to the value of the 'grepprg' option in the following order: %i, + %a, %s. Note that when neither %a nor %A are specified, it's %a + which is added implicitly. + + Optional %u or %U macro could be used (if both specified %U is + chosen) to force redirection to custom or unsorted custom view + respectively. + + See 'findprg' option for description of difference between %a + and %A. + + Example of setup to use ack (http://beyondgrep.com/) instead of + grep: + + set grepprg='ack -H -r %i %a %s' + + or The Silver Searcher + (https://github.com/ggreer/the_silver_searcher): + + set grepprg='ag --line-numbers %i %a %s' + + + + 'histcursor' + type: set + default: startup,dirmark,direnter + Defines situations when cursor should be moved according to + directory history: + - startup - on loading file lists during startup + - dirmark - after navigating to a mark that doesn't specify + file + - direnter - on opening directory from a file list + + This option has no effect when 'autochpos' is disabled. + + Note that the list is not exhaustive and there are other + situations when cursor is positioned automatically. + + 'history' 'hi' + type: integer + default: 15 + Maximum number of stored items in all histories. + + 'hlsearch' 'hls' + type: boolean + default: true + Automatically select files that are search matches. + + 'iec' type: boolean + default: false + Use KiB, MiB, ... suffixes instead of K, M, ... when printing + size in human-friendly format. + + 'ignorecase' 'ic' + type: boolean + default: false + Ignore case in search patterns (:substitute, / and ? commands), + local filter (but not the rest of filters) and other things + detailed in the description of 'caseoptions'. + + 'incsearch' 'is' + type: boolean + default: false + When this option is set, search and view update for local filter + is be performed starting from initial cursor position each time + search pattern is changed. + + 'iooptions' + type: set + default: + Controls details of file operations. The following values are + available: + - fastfilecloning - perform fast file cloning (copy-on-write), + when available + (available on Linux and btrfs file system). + + 'laststatus' 'ls' + type: boolean + default: true + Controls if status bar is visible. + + 'lines' + type: integer + default: terminal height on startup + Terminal height in lines. + + 'locateprg' + type: string + default: "locate %a" + Specifies format for an external command to be invoked by the + :locate command. The format supports expanding of macros, + specific for a particular *prg option, and %% sequence for + inserting percent sign literally. This option should include + the %a macro to specify placement of arguments passed to the + :locate command. If the macro is not used, it will be + implicitly added after a space to the value of this option. + + Optional %u or %U macro could be used (if both specified %U is + chosen) to force redirection to custom or unsorted custom view + respectively. + + 'mediaprg' + type: string + default: path to bundled script that supports udevil, udisks and + udisks2 + (using udisks2 requires python with dbus module + installed) + OS X: path points to a python script that uses diskutil + {only for *nix} + Specifies command to be used to manage media devices. Used by + :media command. + + The command can be passed the following parameters: + - list -- list media + - mount {device} -- mount a device + - unmount {path} -- unmount given mount point + + The output of `list` subcommand is parsed in search of lines + that start with one of the following prefixes: + - device= - specifies device path (e.g., "/dev/sde") + - label= - specifies optional device label (e.g., "Memory + card") + - info= - specifies arbitrary text to display next to + device (by + default "[label]" is used, if label is + provided) + - mount-point= - specifies a mount point (can be absent or + appear more than once) + + All other lines are ignored. Each `device=` starts a new + section describing a device which should include two other + possible prefixes. + + `list` subcommand is assumed to always succeed, while exit code + of `mount` and `unmount` is taken into account to determine + whether operation was performed successfully. + + 'lsoptions' + type: string list + default: "" + scope: local + + Configures ls-like view. + + item used for + transposed filling view grid by columns rather than by + lines + + + 'lsview' + type: boolean + default: false + scope: local + When this option is set, directory view will be displayed in + multiple columns with file names similar to output of `ls -x` + command. See "ls-like view" section below for format + description. This option has no effect if 'millerview' is on. + + 'milleroptions' + type: string list + default: "lsize:1,csize:1,rsize:1,rpreview:dirs" + scope: local + + Configures miller view. + + item default used for + lsize:num 0 left column + csize:num 1 center column (can't be disabled) + rsize:num 0 right column + rpreview:str dirs right column + + *size specifies ratios of columns. Each ratio is in the range + from 0 to 100 and values are adjusted to fit the limits. Zero + disables a column, but central (main) column can't be disabled. + + rpreview specifies what file-system objects should be previewed + in the right column and can take two values: dirs (only + directories) or all. Both options don't include parent + directory (".."). + + Example of two-column mode which is useful in combination with + :view command: + + set milleroptions=lsize:1,csize:2 + + + 'millerview' + type: boolean + default: false + scope: local + When this option is set, directory view will be displayed in + multiple cascading columns. Ignores 'lsview'. + + 'mintimeoutlen' + type: integer + default: 150 + The fracture of 'timeoutlen' in milliseconds that is waited + between subsequent input polls, which affects various + asynchronous operations (detecting changes made by external + applications, monitoring background jobs, redrawing UI). There + are no strict guarantees, however the higher this value is, the + less is CPU load in idle mode. + + 'number' 'nu' + type: boolean + default: false + scope: local + Print line number in front of each file name when 'lsview' + option is turned off. Use 'numberwidth' to control width of + line number. Also see 'relativenumber'. + + 'numberwidth' 'nuw' + type: integer + default: 4 + scope: local + Minimal number of characters for line number field. + + 'previewoptions' + type: string list + default: "graphicsdelay:50000" + + Tweaks how previewing is done (in quick view, miller view's + column and view mode). + + item default meaning + graphicsdelay:num 0 delay before drawing graphics + (microseconds) + hardgraphicsclear unset redraw screen to get rid of + graphics + toptreestats unset show file counts before the tree + + graphicsdelay is needed if terminal requires some timeout before + it can draw graphics (otherwise it gets lost). + + hardgraphicsclear seems to be necessary to get rid of sixel + graphics in some terminals, where it otherwise lingers. This + can cause flicker on the screen due to erasure followed by + redrawing. + + 'previewprg' + type: string + default: "" + scope: local + + External command to be used instead of preview programs + configured via :fileviewer command. + + Example: + + " always show git log in preview of files inside some repository + au DirEnter '~/git-repo/**/*' setl previewprg='git log --color -- %c 2>&1' + + 'quickview' + type: boolean + default: false + Whether quick view (:view) is currently active or not. + + 'relativenumber' 'rnu' + type: boolean + default: false + scope: local + Print relative line number in front of each file name when + 'lsview' option is turned off. Use 'numberwidth' to control + width of line number. Various combinations of 'number' and + 'relativenumber' lead to such results: + + nonumber number + + norelativenumber | first | 1 first + | second | 2 second + | third | 3 third + + relativenumber | 1 first | 1 first + | 0 second |2 second + | 1 third | 1 third + + + 'rulerformat' 'ruf' + type: string + default: "%l/%S " + Determines the content of the ruler. Its minimal width is 13 + characters and it's right aligned. Following macros are + supported: + %= - separation point between left and right aligned halves of + the line + %l - file number + %L - total number of files in view (including filtered out + ones) + %x - number of files excluded by filters + %0- - old name for %x macro + %P - percentage through file list (All, Top, xx% or Bot), + always 3 in length + %S - number of displayed files + %= - separation point between left and right align items + %% - literal percent sign + %[ - designates beginning of an optional block + %] - designates end of an optional block + + Percent sign can be followed by optional minimum field width. + Add '-' before minimum field width if you want field to be right + aligned. + + Optional blocks are ignored unless at least one macro inside of + them is expanded to a non-empty value. + + Example: + + set rulerformat='%2l-%S%[ +%x%]' + + 'runexec' + type: boolean + default: false + Run executable file on Enter, l or Right Arrow key. Behaviour + of the last two depends on the value of the 'lsview' option. + + 'scrollbind' 'scb' + type: boolean + default: false + When this option is set, vifm will try to keep difference of + scrolling positions of two windows constant. + + 'scrolloff' 'so' + type: integer + default: 0 + Minimal number of screen lines to keep above and below the + cursor. If you want cursor line to always be in the middle of + the view (except at the beginning or end of the file list), set + this option to some large value (e.g. 999). + + 'sessionoptions' 'ssop' + sessionoptions ssop + type: set + default: tui,state,tabs,savedirs,dhistory + An equivalent of 'vifminfo' for sessions, uses the same values. + When both options include the same value, data from session file + has higher priority (data from vifminfo isn't necessarily + completely discarded, instead it's merged with the state of a + session the same way state of multiple instances is merged on + exit). + + 'shell' 'sh' + type: string + default: $SHELL or "/bin/sh" or "cmd" (on MS-Windows) + Full path to the shell to use to run external commands. On *nix + a shell argument can be supplied. + + 'shellcmdflag' 'shcf' + type: string + default: "-c" or "/C" (for cmd.exe on MS-Windows) + Command-line option used to pass a command to 'shell'. It's + used in contexts where command comes from the user. + + Note that using this option to force interactive mode of the + shell is most likely a BAD IDEA. In general interactive host + and interactive child shell can't share the same terminal + session. You can't even run such a shell in background. + Consider writing a wrapper for your shell that preloads aliases + and commands without making the shell interactive and ending up + using it in a way it was not meant to be used. + + Note that this option is ignored when 'shell' is set to + PowerShell due to the internal use of `-encodedCommand`. + + 'shortmess' 'shm' + type: charset + default: "p" + Contains a sequence of single-character flags. Each flag + enables shortening of some message displayed by vifm in the TUI. + Flags: + - L - display only last directory in tab line instead of full + path. + - M - shorten titles in windows of terminal multiplexers + created by vifm down to file name instead of using full path. + - T - truncate status-bar messages in the middle if they are + too long to fit on the command line. "..." will appear in the + middle. + - p - use tilde shortening in view titles. + + + 'showtabline' 'stal' + type: enumeration + default: multiple + Specifies when tab line should be displayed. Possible values: + - never - never display tab line + - multiple - show tab line only when there are at least two + tabs + - always - display tab line always + + Alternatively 0, 1 and 2 Vim-like values are also accepted and + correspond to "never", "multiple" and "always" respectively. + + 'sizefmt' + type: string list + default: "units:iec" + Configures the way size is formatted in human-friendly way. + + item value meaning + units: iec Use 1024 byte units (K or KiB, + etc.). + See 'iec' option. + si Use 1000 byte units (KB, etc.). + precision: i > 0 How many fraction digits to + consider. + {not set} Precision of 1 for integer part + < 10, + 0 otherwise (provides old + behaviour). + space {present} Insert space before unit + symbols. + This is the default. + nospace {present} Do not insert space before unit + symbols. + + Numbers are rounded from zero. Trailing zeros are dropped. + + Example: + + set sizefmt=units:iec,precision:2,nospace + + + 'slowfs' + type: string list + default: "" + only for *nix + A list of mounter fs name beginnings (first column in /etc/mtab + or /proc/mounts) or paths prefixes for fs/directories that work + too slow for you. This option can be used to stop vifm from + making some requests to particular kinds of file systems that + can slow down file browsing. Currently this means don't check + if directory has changed, skip check if target of symbolic links + exists, assume that link target located on slow fs to be a + directory (allows entering directories and navigating to files + via gf). If you set the option to "*", it means all the systems + are considered slow (useful for cygwin, where all the checks + might render vifm very slow if there are network mounts). + + Example for autofs root /mnt/autofs: + + set slowfs+=/mnt/autofs + + 'smartcase' 'scs' + type: boolean + default: false + Overrides the ignorecase option if a pattern contains at least + one upper case character. Only used when 'ignorecase' option is + enabled. + + 'sort' type: string list + default: +name on *nix and +iname on Windows + scope: local + Sets list of sorting keys (first item is primary key, second is + secondary key, etc.): + [+-]ext - extension of files and directories + [+-]fileext - extension of files only + [+-]name - name (including extension) + [+-]iname - name (including extension, ignores case) + [+-]type - file type + (dir/reg/exe/link/char/block/sock/fifo) + [+-]dir - directory grouping (directory < file) + [+-]gid - group id (*nix only) + [+-]gname - group name (*nix only) + [+-]mode - file type derived from its mode (*nix only) + [+-]perms - permissions string (*nix only) + [+-]uid - owner id (*nix only) + [+-]uname - owner name (*nix only) + [+-]nlinks - number of hard links (*nix only) + [+-]inode - inode number (*nix only) + [+-]size - size + [+-]nitems - number of items in a directory (zero for files) + [+-]groups - groups extracted via regexps from 'sortgroups' + [+-]target - symbolic link target (empty for other file + types) + [+-]atime - time accessed (e.g., read, executed) + [+-]ctime - time changed (changes in metadata, like mode) + [+-]mtime - time modified (when file contents is changed) + + Note: look for st_atime, st_ctime and st_mtime in "man 2 stat" + for more information on time keys. + + '+' means ascending sort for this key, and '-' means descending + sort. + + "dir" key is somewhat similar in this regard but it's added + implicitly: when "dir" is not specified, sorting behaves as if + it was the first key in the list. That's why if one wants + sorting algorithm to mix directories and files, "dir" should be + appended to sorting option, for example like this: + + set sort+=dir + + or + + set sort=-size,dir + + Value of the option is checked to include dir key and default + sorting key (name on *nix, iname on Windows). Here is what + happens if one of them is missing: + + - type key is added at the beginning; + + - default key is added at the end; + + all other keys are left untouched (at most they are moved). + + This option also changes view columns according to primary + sorting key set, unless 'viewcolumns' option is not empty. + + 'sortnumbers' + type: boolean + default: false + scope: local + Natural sort of (version) numbers within text. + + 'sortgroups' + type: string + default: "" + scope: local + Sets comma-separated list of regular expressions for group type + of sorting. Double the comma to insert it literally. + + The regular expressions are used to extract substrings of file + names to serve as keys for sorting. It is essentially a way to + ignore uninteresting parts of file names during sorting by name. + + Each expression should contain at least one group or its value + will be considered to be always empty. Also, only the first + match of regular expression is processed. + + The first group divides list of files into sub-groups, each of + which is then sorted by substrings extracted using second + regular expression and so on recursively. + + Example: + set sortgroups=-(todo|done).* + this would group files with "-done" in their names and files + with "-todo" separately. On ascending sorting, group containing + "-done" would appear before the other one. + + 'sortorder' + type: enumeration + default: ascending + Sets sort order for primary key: ascending, descending. + + 'statusline' 'stl' + type: string + default: "" + Determines the content of the status line (the line right above + command-line). Empty string means use same format like in + previous versions. Following macros are supported: + + - %N - line break (increases height of the status line + accordingly), ignores %[ %] blocks + + - %t - file name (considering value of the 'classify' option) + + - %T - symbolic link target (empty for other filetypes) + + - %f - file name relative to current directory (considers + 'classify') + + - %A - file attributes (permissions on *nix or properties on + Windows) + + - %u - user name or uid (if it cannot be resolved) + + - %g - group name or gid (if it cannot be resolved) + + - %s - file size in human readable format + + - %E - size of selected files in human readable format, same as + %s when no files are selected, except that it will never show + size of ../ in visual mode, since it cannot be selected + + - %d - file modification date (uses 'timefmt' option) + + - %D - path of the other pane for single-pane layout + + - %a - amount of free space available on current FS + + - %c - size of current FS + + - %z - short tips/tricks/hints that chosen randomly after one + minute period + + - %{} - evaluate arbitrary vifm expression '', e.g. + '&sort' + + - %* - resets or applies one of User1..User9 highlight groups; + reset happens when width field is 0 or not specified, one of + groups gets picked when width field is in the range from 1 to + 9 + + - all 'rulerformat' macros + + Percent sign can be followed by optional minimum field width. + Add '-' before minimum field width if you want field to be right + aligned. + + On Windows file properties include the following flags (upper + case means flag is on): + A - archive + H - hidden + I - content isn't indexed + R - readonly + S - system + C - compressed + D - directory + E - encrypted + P - reparse point (e.g. symbolic link) + Z - sparse file + + Example without colors: + + set statusline=" %t%= %A %10u:%-7g %15s %20d %{&sort} " + + Example with colors: + + highlight User1 ctermbg=yellow + highlight User2 ctermbg=blue ctermfg=white cterm=bold + set statusline="%1* %-26t %2* %= %1* %A %2* %7u:%-7g %1* %-5s %2* %d " + + + 'suggestoptions' + type: string list + default: + Controls when, for what and how suggestions are displayed. The + following values are available: + - normal - in normal mode; + - visual - in visual mode; + - view - in view mode; + - otherpane - use other pane to display suggestions, when + available; + - delay[:num] - display suggestions after a small delay (to + do not annoy if you just want to type a fast shortcut consisting + of multiple keys), num specifies the delay in ms (500 by + default), 'timeoutlen' at most; + - keys - include shortcuts (commands and selectors); + - foldsubkeys - fold multiple keys with common prefix; + - marks - include marks; + - registers[:num] - include registers, at most num files (5 by + default). + + 'syncregs' + type: string + default: + Specifies identifier of group of instances that share registers + between each other. When several instances of vifm have this + option set to identical value, they automatically synchronize + contents of their registers on operations which use them. + + 'syscalls' + type: boolean + default: false + When disabled, vifm will rely on external applications to + perform file-system operations, otherwise system calls are used + instead (much faster and supports progress tracking). The + option should eventually be removed. Mostly *nix-like systems + are affected. + + 'tablabel' + type: string + default: "" + When non-empty, determines format of the main part of a single + tab's label. + + When empty, tab label is set to either tab name for named tabs + or to view title (usually current path) for unnamed tabs. + + The following macros can appear in the format (see below for + what a flag is): + + - %C - flag of a current tab + + - %N - number of the tab + + - %T - flag of a tree mode + + - %c - description of a custom view + + - %n - name of the tab + + - %p - path of the view (handles filename modifiers) + + - %t - title of the view (affected by 'shortmess' flags) + + - %% - literal percent sign + + - %[ - designates beginning of an optional block + + - %] - designates end of an optional block + + - %*, %0* - resets highlighting + + - %1-%9 - applies one of User1..User9 highlight groups + + In global tabs the view in bullets above refers to currently + active view of that tab. + + Flag macros are a special kind of macros that always expand to + an empty value and are ment to be used inside optional blocks to + control their visibility. + + Optional blocks are ignored unless at least one macro inside of + them is expanded to a non-empty value or is a set flag macro. + + " %[(%n)%] -- optional name of the tab + " %[ -- optional description of the view + " %[%T{tree}%] -- mark of tree mode + " %[{%c}%] -- description of custom view + " @ -- just an extra separator before the path + ' %] + " %p:t -- tail part of view's location + set tablabel=%[(%n)%]%[%[%T{tree}%]%[{%c}%]@%]%p:t + + 'tabprefix' + type: string + default: "[%N:" + Determines prefix of a tab's label. Formatting is done as for + 'tablabel' option. + + 'tabscope' + type: enumeration + default: global + Picks style of tabs, which defines what a single tab contains. + Possible values: + - global - tab describes complete UI of two views and how they + are arranged + - pane - tab is located "inside" a pane and manages it and + quick view + + 'tabstop' 'ts' + type: integer + default: value from curses library + Number of spaces that a Tab in the file counts for. + + 'tabsuffix' + type: string + default: "]" + Determines suffix of a tab's label. Formatting is done as for + 'tablabel' option. + + 'timefmt' + type: string + default: "%m/%d %H:%M" + Format of time in file list. See "man 1 date" or "man 3 + strftime" for details. + + 'timeoutlen' 'tm' + type: integer + default: 1000 + The time in milliseconds that is waited for a mapped key in case + of already typed key sequence is ambiguous. + + 'title' + type: boolean + default: true when title can be restored, false otherwise + When enabled, title of the terminal or terminal multiplexer's + window is updated according to current location. Because not + all terminals support setting title, this works only if `$TERM` + value matches one of the following conditions: + - equals "xterm" or starts with "xterm-" + - equals "rxvt" or starts with "rxvt-" + - equals "screen" or starts with "screen-" + - equals "aterm" + - equals "Eterm" + + 'trash' + type: boolean + default: true + Use trash directory. See "Trash directory" section below. + + 'trashdir' + type: string + default: on *nix: + "%r/.vifm-Trash-%u,$VIFM/Trash,%r/.vifm-Trash" + or if $VIFM/Trash doesn't exist + "%r/.vifm-Trash-%u,$XDG_DATA_HOME/vifm/Trash,%r/.vifm-Trash" + on Windows: + "%r/.vifm-Trash,$XDG_DATA_HOME/vifm/Trash" + List of trash directory path specifications, separated with + commas. Each list item either defines an absolute path to trash + directory or a path relative to a mount point root when list + element starts with "%r/". Value of the option can contain + environment variables (of form "$envname"), which will be + expanded (prepend $ with a slash to prevent expansion). + Environment variables are expanded when the option is set. + + On *nix, if element ends with "%u", the mark is replaced with + real user ID and permissions are set so that only that only + owner is able to use it. + Note that even this setup is not completely secure when combined + with "%r/" and it's overall safer to keep files in home + directory, but that implies cost of copying files between + partitions. + + When new file gets cut (deleted) vifm traverses each element of + the option in the order of their appearance and uses first trash + directory that it was able to create or that is already + writable. + + Default value tries to use trash directory per mount point and + falls back to ~/.vifm/Trash on failure. + + Will attempt to create the directory if it does not exist. See + "Trash directory" section below. + + 'tuioptions' 'to' + type: charset + default: "psv" + Each flag configures some aspect of TUI appearance. The flags + are: + p - when included: + * file list inside a pane gets additional single character + padding on left and right sides; + * quick view and view mode get single character padding. + s - when included, left and right borders (side borders, hence + "s" character) are visible. + u - use Unicode characters in the TUI (Unicode ellipsis instead + of "..."). + v - vary width of middle border to equalize view sizes. + + Each pane title contains the path of the listed directory. If + too large, the path is truncated on the left for the active pane + and on the right for the other pane. This can be modified with: + + l - truncation is always on the left. + r - truncation is always on the right. + + 'undolevels' 'ul' + type: integer + default: 100 + Maximum number of changes that can be undone. Note that here + single file operation is used as a unit, not operation, i.e. + deletion of 101 files will exceed default limit. + + 'vicmd' + type: string + default: "vim" + Command used to edit files in various contexts. Ampersand sign + at the end (regardless whether it's preceded by space or not) + means backgrounding of command. + + Background flag is ignored in certain context where vifm waits + for the editor to finish. Such contexts include any command + that spawns editor to change list of file names or a command, + with :rename being one example. `-f` is also appended to + prevent forking in such cases, so the command needs to handle + the flag. + + Additionally `+{num}` and `+'call cursor()'` arguments are used + to position cursor when location is known. + + 'viewcolumns' + type: string + default: "" + scope: local + Format string containing list of columns in the view. When this + option is empty, view columns to show are chosen automatically + using sorting keys (see 'sort') as a base. Value of this option + is ignored if 'lsview' is set. See "Column view" section below + for format description. + + An example of setting the options for both panes (note :windo + command): + + windo set viewcolumns=-{name}..,6{size},11{perms} + + 'vixcmd' + type: string + default: value of 'vicmd' + Same as 'vicmd', but takes precedence over it when running + inside a graphical environment. + + 'vifminfo' + type: set + default: bookmarks,bmarks + Controls what will be saved in the $VIFM/vifminfo file. + + bmarks - named bookmarks (see :bmark command) + bookmarks - marks, except special ones like '< and '> + tui - state of the user interface (sorting, number of + windows, quick + view state, active view) + dhistory - directory history + state - file name and dot filters and terminal + multiplexers integration + state + cs - primary color scheme + savedirs - save last visited directory + chistory - command line history + shistory - search history (/ and ? commands) + phistory - prompt history + fhistory - history of local filter (see description of the + "=" normal mode + command) + dirstack - directory stack overwrites previous stack, unless + stack of + current instance is empty + registers - registers content + tabs - global or pane tabs + options - all options that can be set with the :set command + (obsolete) + filetypes - associated programs and viewers (obsolete) + commands - user defined commands (see :command description) + (obsolete) + + 'vimhelp' + type: boolean + default: false + Use vim help format. + + 'wildmenu' 'wmnu' + type: boolean + default: false + Controls whether possible matches of completion will be shown + above the command line. + + 'wildstyle' + type: enumeration + default: bar + Picks presentation style of wild menu. Possible values: + - bar - one-line with left-to-right cursor + - popup - multi-line with top-to-bottom cursor + + 'wordchars' + type: string list + default: "1-8,14-31,33-255" (that is all non-whitespace + characters) + Specifies which characters in command-line mode should be + considered as part of a word. Value of the option is comma- + separated list of ranges. If both endpoints of a range match, + single endpoint is enough (e.g. "a" = "a-a"). Both endpoints + are inclusive. There are two accepted forms: character + representing itself or number encoding character according to + ASCII table. In case of ambiguous characters (dash, comma, + digit) use numeric form. Accepted characters are in the range + from 0 to 255. Any Unicode character with code greater than 255 + is considered to be part of a word. + + The option affects Alt-D, Alt-B and Alt-F, but not Ctrl-W. This + is intentionally to allow two use cases: + + - Moving by WORDS and deletion by words. + - Moving by words and deletion by WORDS. + + To get the latter use the following mapping: + + cnoremap + + Also used for abbreviations. + + 'wrap' type: boolean + default: true + Controls whether to wrap text in quick view. + + 'wrapscan' 'ws' + type: boolean + default: true + Searches wrap around end of the list. + +Mappings + Map arguments + + LHS of mappings can be preceded by arguments which take the form of + special sequences: + + + Postpone UI updates until RHS is completely processed. + + In case of builtin mapping causing conflict for a user-defined + mapping (e.g., `t` builtin to a partially typed `ta` user- + defined mapping), ignore the builtin mapping and wait for input + indefinitely as opposed to default behaviour of triggering the + builtin mapping after a delay defined by 'timeoutlen'. Example: + + nnoremap tw :set wrap! + nnoremap tn :set number! + nnoremap tr :set relativenumber! + + Special sequences + + Since it's not easy to enter special characters there are several + special sequences that can be used in place of them. They are: + + Enter key. + + Escape key. + + + Space key. + + Less-than character (<). + + provides a way to disable a mapping (by mapping it to ). + + Backspace key (see key conflict description below). + + + Tabulation and Shift+Tabulation keys. + + + Home/End. + + + Arrow keys. + + + PageUp/PageDown. + + + Delete key. and mean different codes, but + is more common. + + + Insert key. + + ,,...,,,,,, + Control + some key (see key conflict description below). + + only for *nix + Control + Space. + + ,,..., + ,,..., Alt + some key. + + ,,..., + ,,..., only for *nix + Alt + Ctrl + some key. + + - + Functional keys. + + - + only for MS-Windows + functional keys with Control key pressed. + + - + only for MS-Windows + functional keys with Alt key pressed. + + - + only for MS-Windows + functional keys with Shift key pressed. + + Note that due to the way terminals process their input, several + keyboard keys might be mapped to single key code, for example: + + - and ; + + - and ; + + - and ; + + - etc. + + Most of the time they are defined consistently and don't cause + surprises, but and are treated differently in different + environments (although they match each other all the time), that's why + they correspond to different keys in vifm. As a consequence, if you + map or be sure to repeat the mapping with the other one so + that it works in all environments. Alternatively, provide your mapping + in one form and add one of the following: + + " if mappings with in the LHS work + map + " if mappings with in the LHS work + map + + Whitespace + + vifm removes whitespace characters at the beginning and end of + commands. That's why you may want to use at the end of rhs in + mappings. For example: + + cmap man + + will put "man " in line when you hit the key in the command line + mode. + +Expression syntax + Supported expressions is a subset of what VimL provides. + + Expression syntax summary, from least to most significant: + + expr1 expr2 + expr2 || expr2 .. logical OR + + expr2 expr3 + expr3 && expr3 .. logical AND + + expr3 expr4 + expr4 == expr4 equal + expr4 != expr4 not equal + expr4 > expr4 greater than + expr4 >= expr4 greater than or equal + expr4 < expr4 smaller than + expr4 <= expr4 smaller than or equal + + expr4 expr5 + expr5 + expr5 .. number addition + expr5 - expr5 .. number subtraction + + expr5 expr6 + expr6 . expr6 .. string concatenation + + expr6 expr7 + - expr6 unary minus + + expr6 unary plus + ! expr6 logical NOT + + expr7 number number constant + "string" string constant, \ is special + 'string' string constant, ' is doubled + &option option value + $VAR environment variable + v:var builtin variable + function(expr1, ...) function call + (expr1) nested expression + + ".." indicates that the operations in this level can be concatenated. + + expr1 + ----- + expr2 || expr2 + + Arguments are converted to numbers before evaluation. + + Result is non-zero if at least one of arguments is non-zero. + + It's right associative and with short-circuiting, so sub-expressions + are evaluated from left to right until result of whole expression is + determined (i.e., until first non-zero) or end of the expression. + + expr2 + ----- + expr3 && expr3 + + Arguments are converted to numbers before evaluation. + + Result is non-zero only if both arguments are non-zero. + + It's right associative and with short-circuiting, so sub-expressions + are evaluated from left to right until result of whole expression is + determined (i.e., until first zero) or end of the expression. + + expr3 + ----- + expr4 {cmp} expr4 + + Compare two expr4 expressions, resulting in a 0 if it evaluates to + false or 1 if it evaluates to true. + + equal == + not equal != + greater than > + greater than or equal >= + smaller than < + smaller than or equal <= + + Examples: + + 'a' == 'a' == 1 + 'a' > 'b' == 1 + 'a' == 'b' == 0 + '2' > 'b' == 0 + 2 > 'b' == 1 + 2 > '1b' == 1 + 2 > '9b' == 0 + -1 == -'1' == 1 + 0 == '--1' == 1 + + expr4 + ----- + expr5 + expr5 .. number addition expr5 - expr5 .. number + subtraction + + Examples: + + 1 + 3 - 3 == 1 + 1 + '2' == 3 + + expr5 + ----- + expr6 . expr6 .. string concatenation + + Examples: + + 'a' . 'b' == 'ab' + 'aaa' . '' . 'c' == 'aaac' + + expr6 + ----- + + - expr6 unary minus + + expr6 unary plus + ! expr6 logical NOT + + For '-' the sign of the number is changed. + For '+' the number is unchanged. + For '!' non-zero becomes zero, zero becomes one. + + A String will be converted to a Number first. + + These operations can be repeated and mixed. Examples: + + --9 == 9 + ---9 == -9 + -+9 == 9 + !-9 == 0 + !'' == 1 + !'x' == 0 + !!9 == 1 + + expr7 + ----- + + number number constant + ----- + + Decimal number. Examples: + + 0 == 0 + 0000 == 0 + 01 == 1 + 123 == 123 + 10000 == 10000 + + string + ------ + "string" string constant + + Note that double quotes are used. + + A string constant accepts these special characters: + \b backspace + \e escape + \n newline + \r return + \t tab + \\ backslash + \" double quote + + Examples: + + "\"Hello,\tWorld!\"" + "Hi,\nthere!" + + literal-string + -------------- + 'string' string constant + + Note that single quotes are used. + + This string is taken as it is. No backslashes are removed or have a + special meaning. The only exception is that two quotes stand for one + quote. + + Examples: + + 'All\slashes\are\saved.' + 'This string contains doubled single quotes ''here''' + + option + ------ + &option option value (local one is preferred, if exists) + &g:option global option value &l:option local + option value + + Examples: + + echo 'Terminal size: '.&columns.'x'.&lines + if &columns > 100 + + Any valid option name can be used here (note that "all" in ":set all" + is a pseudo option). See ":set options" section above. + + environment variable + -------------------- + $VAR environment variable + + The String value of any environment variable. When it is not defined, + the result is an empty string. + + Examples: + + 'This is my $PATH env: ' . $PATH + 'vifmrc at ' . $MYVIFMRC . ' is used.' + + builtin variable + -------------------- + v:var builtin variable + + Information exposed by vifm for use in scripting. + + v:count + count passed to : command, 0 by default. Can be used in mappings to + passthe count to a different command. + v:count1 + same as v:count, but 1 by default. + v:jobcount + number of active jobs (as can be seen in the :jobs menu). + v:session + name of the current session or empty string. + v:servername + See below. + + function call + ------------- + function(expr1, ...) function call + + See "Functions" section below. + + Examples: + + "'" . filetype('.') . "'" + filetype('.') == 'reg' + + expression nesting + ------------------ + (expr1) nested expression + + Groups any other expression of arbitrary complexity enforcing order in + which operators are applied. + + +Functions + USAGE RESULT DESCRIPTION + + chooseopt({opt}) String Queries choose parameters passed on + startup. + executable({expr}) Integer Checks whether {expr} command + available. + expand({expr}) String Expands special keywords in {expr}. + extcached({cache}, {path}, {extcmd}) + String Caches output of {extcmd} per {cache} + and + {path} combination. + filetype({fnum} [, {resolve}]) + String Returns file type from position. + fnameescape({expr}) String Escapes {expr} for use in a :command. + getpanetype() String Returns type of current pane. + has({property}) Integer Checks whether instance has + {property}. + layoutis({type}) Integer Checks whether layout is of type + {type}. + paneisat({loc}) Integer Checks whether current pane is at + {loc}. + system({command}) String Executes shell command and returns + its output. + tabpagenr([{arg}]) Integer Returns number of current or last + tab. + term({command}) String Like system(), but for interactive + commands. + + chooseopt({opt}) + + Retrieves values of options related to file choosing. {opt} can be one + of: + files returns argument of --choose-files or empty string + dir returns argument of --choose-dir or empty string + cmd returns argument of --on-choose or empty string + delimiter returns argument of --delimiter or the default one (\n) + + executable({expr}) + + If {expr} is absolute or relative path, checks whether path destination + exists and refers to an executable, otherwise checks whether command + named {expr} is present in directories listed in $PATH. Checks for + various executable extensions on Windows. Returns boolean value + describing result of the check. + + Example: + + " use custom default viewer script if it's available and installed + " in predefined system directory, otherwise try to find it elsewhere + if executable('/usr/local/bin/defviewer') + fileview * /usr/local/bin/defviewer %c + else + if executable('defviewer') + fileview * defviewer %c + endif + endif + + expand({expr}) + + Expands environment variables and macros in {expr} just like it's done + for command-line commands. Returns a string. See "Command macros" + section above. + + Examples: + + " percent sign + :echo expand('%%') + " the last part of directory name of the other pane + :echo expand('%D:t') + " $PATH environment variable (same as `:echo $PATH`) + :echo expand('$PATH') + + extcached({cache}, {path}, {extcmd}) + + Caches value of {extcmd} external command automatically updating it as + necessary based on monitoring change date of a {path}. The cache is + invalidated when file or its meta-data is updated. A single path can + have multiple caches associated with it. + + {path} value is normalized, but symbolic links in it aren't resolved. + + Example: + + " display number and size of blocks actually used by a file or directory + set statusline+=" Uses: %{ extcached('uses', + expand('%c'), + expand('stat --format=%%bx%%B %c')) }" + + filetype({fnum} [, {resolve}]) + + The result is a string, which represents file type and is one of the + list: + exe executables + reg regular files + link symbolic links + broken broken symbolic links (appears only when resolving) + dir directories + char character devices + block block devices + fifo pipes + sock *nix domain sockets + ? unknown file type (should not normally happen) or + non-file (pseudo-entries in compare view) + + The result can also be an empty string in case of invalid argument. + + Parameter {fnum} can have following values: + - '.' to get type of file under the cursor in the active pane + - numerical value base 1 to get type of file on specified line + number + + Optional parameter {resolve} is treated as a boolean and specifies + whether symbolic links should be resolved. + + fnameescape({expr}) + + Escapes parameter to make it suitable for use as an argument of a + :command. List of escaped characters includes %, which is doubled. + + Usage example: + + " navigate to most recently modified file in current directory + execute 'goto' fnameescape(system('ls -t | head -1')) + + getpanetype() + + Retrieves string describing type of current pane. Possible return + values: + regular regular file listing of some directory + custom custom file list (%u) + very-custom very custom file list (%U) + tree tree view + + has({property}) + + Allows examining internal parameters from scripts to e.g. figure out + environment in which application is running. Returns 1 if property is + true/present, otherwise 0 is returned. Currently the following + properties are supported (anything else will yield 0): + unix runs in *nix-like environment (including Cygwin) + win runs on Windows + + Usage example: + + " skip user/group on Windows + if !has('win') + let $RIGHTS = '%10u:%-7g ' + endif + + execute 'set' 'statusline=" %t%= %A '.$RIGHTS.'%15E %20d "' + + layoutis({type}) + + Checks whether current interface layout is {type} or not, where {type} + can be: + only single-pane mode + split double-pane mode (either vertical or horizontal split) + vsplit vertical split (left and right panes) + hsplit horizontal split (top and bottom panes) + + Usage example: + + " automatically split vertically before enabling preview + :nnoremap w :if layoutis('only') | vsplit | endif | view! + + paneisat({loc}) + + Checks whether position of active pane in current layout matches one of + the following locations: + top pane reaches top border + bottom pane reaches bottom border + left pane reaches left border + right pane reaches right border + + system({command}) + + Runs the command in shell and returns its output (joined standard + output and standard error streams). All trailing newline characters + are stripped to allow easy appending to command output. Ctrl-C should + interrupt the command. + + Use this function to consume output of external commands that don't + require user interaction and term() for interactive commands that make + use of terminal and are capable of handling stream redirection. + + Usage example: + + " command to enter .git/ directory of git-repository (when ran inside one) + command! cdgit :execute 'cd' fnameescape(system('git rev-parse --git-dir')) + + tabpagenr([{arg}]) + + When called without arguments returns number of current tab page base + one. + + When called with "$" as an argument returns number of the last tab page + base one, which is the same as number of tabs. + + term({command}) + + Same as system() function, but user interface is shutdown during the + execution of the command, which makes sure that external interactive + applications won't affect the way terminal is used by vifm. + + Usage example: + + " command to change directory by picking it via fzf + command! fzfcd :execute 'cd' + fnameescape(term('find -type d | fzf 2> /dev/tty')) + +Menus and dialogs + When navigating to some path from a menu there is a difference in end + location depending on whether path has trailing slash or not. Files + normally don't have trailing slashes so "file/" won't work and one can + only navigate to a file anyway. On the other hand with directories + there are two options: navigate to a directory or inside of it. To + allow both use cases, the first one is used on paths like "dir" and the + second one for "dir/". + + Commands + + :range navigate to a menu line. + + :exi[t][!] :q[uit][!] :x[it][!] + leave menu mode. + + :noh[lsearch] + reset search match highlighting. + + :w[rite] {dest} + write all menu lines into file specified by {dest}. + + General + + j, Ctrl-N - move down. + k, Ctrl-P - move up. + Enter, l - select and exit the menu. + Ctrl-L - redraw the menu. + + Escape, Ctrl-C, ZZ, ZQ, q - quit. + + In all menus + + The following set of keys has the same meaning as in normal mode. + + Ctrl-B, Ctrl-F + Ctrl-D, Ctrl-U + Ctrl-E, Ctrl-Y + /, ? + n, N + [count]G, [count]gg + H, M, L + zb, zt, zz + + zh - scroll menu items [count] characters to the right. + zl - scroll menu items [count] characters to the left. + zH - scroll menu items half of screen width characters to the right. + zL - scroll menu items half of screen width characters to the left. + + : - enter command line mode for menus (currently only :exi[t], :q[uit], + :x[it] and :{range} are supported). + + b - interpret content of the menu as list of paths and use it to create + custom view in place of previously active pane. See "Custom views" + section below. + B - same as above, but creates unsorted view. + + v - load menu content into quickfix list of the editor (Vim compatible + by assumption) or if list doesn't have separators after file names + (colons) open each line as a file name. + + + Below is description of additional commands and reaction on selection + in some menus and dialogs. + + Apropos menu + + Selecting menu item runs man on a given topic. Menu won't be closed + automatically to allow view several pages one by one. + + Command-line mode abbreviations menu + + Type dd on an abbreviation to remove it. + + c leaves menu preserving file selection and inserts right-hand side of + selected command into command-line. + + Color scheme menu + + Selecting name of a color scheme applies it the same way as if + ":colorscheme " was executed on the command-line. + + Commands menu + + Selecting command executes it with empty arguments (%a). + + dd on a command to remove. + + Marks menu + + Selecting mark navigates to it. + + dd on a mark to remove it. + + Bookmarks menu + + Selecting a bookmark navigates to it. + + Type dd on a bookmark to remove it. + + gf and e also work to make it more convenient to bookmark files. + + Trash (:lstrash) menu + + r on a file name to restore it from trash. + + dd deletes file under the cursor. + + Trashes (:trashes) menu + + dd empties selected trash in background. + + Directory history and Trashes menus + + Selecting directory name will change directory of the current view as + if :cd command was used. + + Directory stack menu + + Selecting directory name will rotate stack to put selected directory + pair at the top of the stack. + + File (:file) menu + + Commands from vifmrc or typed in command-line are displayed above empty + line. All commands below empty line are from .desktop files. + + c leaves menu preserving file selection and inserts command after :! in + command-line mode. + + Grep, find, locate, bookmarks and user menu with navigation (%M macro) + + gf - navigate previously active view to currently selected item. + Leaves menu mode except for grep menu. Pressing Enter key has the same + effect. + + e - open selected path in the editor, stays in menu mode. + + c - leave menu preserving file selection and insert file name after :! + in command-line mode. + + User menu without navigation (%m macro) + + c leaves menu preserving file selection and inserts whole line after :! + in command-line mode. + + Grep menu + + Selecting file (via Enter or l key) opens it in editor set by 'vicmd' + at given line number. Menu won't be closed automatically to allow + viewing more than one result. + + See above for "gf" and "e" keys description. + + Command-line history menu + + Selecting an item executes it as command-line command, search query or + local filter. + + c leaves menu preserving file selection and inserts line into command- + line of appropriate kind. + + Volumes menu + + Selecting a drive navigates previously active pane to the root of that + drive. + + Fileinfo dialog + + Enter, q - close dialog + + Sort dialog + + h, Space - switch ascending/descending. + q - close dialog + + One shortcut per sorting key (see the dialog). + + Attributes (permissions or properties) dialog + + h, Space - check/uncheck. + q - close dialog + r - (*nix only) (un)set all read bits + w - (*nix only) (un)set all write bits + x - (*nix only) (un)set all execute bits + s - (*nix only) (un)set all special (SetUID, SetGID, Sticky) bits + e - (*nix only) (un)set recursion (for directories only) + + Item states: + + - * - checked flag. + + - X - means that it has different value for files in selection. + + - d (*nix only) - (only for execute flags) means u-x+X, g-x+X or o-x+X + argument for the chmod program. If you're not on OS X and want to + remove execute permission bit from all files, but preserve it for + directories, set all execute flags to 'd' and check 'Set Recursively' + flag. + + Jobs menu + + dd requests cancellation of job under cursor. The job won't be removed + from the list, but marked as being cancelled (if cancellation was + successfully requested). A message will pop up if the job has already + stopped. Note that on Windows cancelling external programs like this + might not work, because their parent shell doesn't have any windows. + + e key displays errors of selected job if any were collected. They are + displayed in a new menu, but you can get back to jobs menu by pressing + h. + + + Undolist menu + + r - reset undo position to group under the cursor. + + + Media menu + + Selecting a device either mounts (if it wasn't mounted yet) or + navigates to its first mount point. + + Selecting a mount point navigates to it. + + Selecting "not mounted" line causes mounting. + + Selecting any other line does nothing. + + r - reload the list. + + m - mount/unmount device (cursor should be positioned on lines under + device information). + + [ - put cursor on the previous device. + + ] - put cursor on the next device. + + + Plugins menu + + e - display log messages of selected plugin if any were collected. + They are displayed in a new menu, but you can get back to plugins menu + by pressing h. + + gf - navigate previously active view to the location of selected + plugin. Leaves menu mode. + + +Custom views + Definition + + Normally file views contain list of files from a single directory, but + sometimes it's useful to populate them with list of files that do not + belong to the same directory, which is what custom views are for. + + Presentation + + Custom views are still related to directory they were in before custom + list was loaded. Path to that directory (original directory) can be + seen in the title of a custom view. + + Files in same directory have to be named differently, this doesn't hold + for custom views thus seeing just file names might be rather confusing. + In order to give an idea where files come from and when possible, + relative paths to original directory of the view is displayed, + otherwise full path is used instead. + + Custom views normally don't contain any inexistent files. + + Navigation + + Custom views have some differences related to navigation in regular + views. + + gf - acts similar to gf on symbolic links and navigates to the file at + its real + location. + + h - go to closes parent node in tree view, otherwise return to the + original directory. + + gh - return to the original directory. + + Opening ".." entry also causes return to the original directory. + + History + + Custom list exists only while it's visible, once left one can't return + to it, so there is no appearances of it in any history. + + Filters + + Only local filter affects content of the view. This is intentional, + presumably if one loads list, precisely that list should be displayed + (except for inexistent paths, which are ignored). + + Search + + Although directory names are visible in listing, they are not + searchable. Only file names are taken into account (might be changed + in future, searching whole lines seems quite reasonable). + + Sorting + + Contrary to search sorting by name works on whole visible part of file + path. + + Highlight + + Whole file name is highlighted as one entity, even if there are + directory elements. + + Updates + + Reloads can occur, though they are not automatic due to files being + scattered among different places. On a reload, inexistent files are + removed and meta-data of all other files is updated. + + Once custom view forgets about the file, it won't add it back even if + it's created again. So not seeing file previously affected by an + operation, which was undone is normal. + + Operations + + All operations that add files are forbidden for custom views. For + example, moving/copying/putting files into a custom view doesn't work, + because it doesn't make much sense. + + On the other hand, operations that use files of a custom view as a + source (e.g. yanking, copying, moving file from custom view, deletion) + and operations that modify names are all allowed. + +Compare views + Kinds + + :compare can produce four different results depending on arguments: + - single compare view (ofone and either listall or listdups); + - single custom view (ofone and listunique); + - two compare views (ofboth and either listall or listdups); + - two custom views (ofboth and listunique). + + The first two display files of one file system tree. Here duplicates + are files that have at least one copy in the same tree. The other two + kinds of operation compare two trees, in which duplicates are files + that are found in both trees. + + Lists of unique files are presented in custom views because there is no + file grouping to preserve as all file ids are guaranteed to be + distinct. + + Creation + + Arguments passed to :compare form four categories each with its own + prefix and is responsible for particular property of operation. + + Which files to compare: + - ofboth - compares files of two panes against each other; + - ofone - compares files of the same directory. + + How files are compared: + - byname - by their name only; + - bysize - only by their size; + - bycontents - by data they contain (combination of size and hash of + small chunk of contents is used as first approximation, so don't worry + too much about large files). + + Which files to display: + - listall - all files; + - listunique - unique files only; + - listdups - only duplicated files. + + How results are grouped (has no effect if "ofone" specified): + - groupids - files considered identical are always adjacent in + output; + - grouppaths - file system ordering is preferred (this also enables + displaying identically named files as mismatches). + + Which files to omit: + - skipempty - ignore empty files. + + Each argument can appear multiple times, the rightmost one of the group + is considered. Arguments alter default behaviour instead of + substituting it. + + Examples + + The defaults corresponds to probably the most common use case of + comparing files in two trees with grouping by paths, so the following + are equivalent: + + :compare + :compare bycontents grouppaths + :compare bycontents listall ofboth grouppaths + + Another use case is to find duplicates in the current sub-tree: + + :compare listdups ofone + + The following command lists files that are unique to each pane: + + :compare listunique + + Look + + The view can't switch to ls-like view as it's unable to display diff- + like data. + + Comparison views have second column displaying id of the file, files + with same id are considered to be equal. The view columns + configuration is predefined. + + Behaviour + + When two views are being compared against each other the following + changes to the regular behaviour apply: + - views are scrolled synchronously (as if 'scrollbind' was set); + - views' cursors are synchronized; + - local filtering is disabled (its results wouldn't be meaningful); + - zd excludes groups of adjacent identical files, 1zd gives usual + behaviour; + - sorting is permanently disabled (ordering is fixed); + - removed files hide their counter pairs; + - exiting one of the views terminates the other immediately; + - renaming files isn't blocked, but isn't taken into account and might + require regeneration of comparison; + - entries which indicate absence of equivalent file have empty names + and can be matched as such; + - when unique files of both views are listed custom views can be + empty, this absence of unique files is stated clearly. + + One compare view has similar properties (those that are applicable for + single pane). + + Files are gathered in this way: + - recursively starting at current location of the view; + - dot files are excluded if view hides them at the moment of + comparison, file name filters are obeyed as well so you end up + comparing what you see; + - directories are not taken into account; + - symbolic links to directories are ignored. + +Startup + On startup vifm determines several variables that are used during + execution. They are determined in the order they appear below. + + On *nix systems $HOME is normally present and used as is. On Windows + systems vifm tries to find correct home directory in the following + order: + - $HOME variable; + - $USERPROFILE variable (on Windows only); + - a combination of $HOMEDRIVE and $HOMEPATH variables (on Windows + only). + + vifm tries to find correct configuration directory by checking the + following places: + - $VIFM variable; + - parent directory of the executable file (on Windows only); + - $HOME/.vifm directory; + - $APPDATA/Vifm directory (on Windows only); + - $XDG_CONFIG_HOME/vifm directory; + - $HOME/.config/vifm directory. + + vifm tries to find correct configuration file by checking the following + places: + - $MYVIFMRC variable; + - vifmrc in parent directory of the executable file (on Windows only); + - $VIFM/vifmrc file. + +Configure + See "Startup" section above for the explanations on $VIFM and + $MYVIFMRC. + + The vifmrc file contains commands that will be executed on vifm + startup. There are two such files: global and local. Global one is at + {prefix}/etc/vifm/vifmrc, see $MYVIFMRC variable description for the + search algorithm used to find local vifmrc. Global vifmrc is loaded + before the local one, so that the later one can redefine anything + configured globally. + + Use vifmrc to set settings, mappings, filetypes etc. To use multi line + commands precede each next line with a slash (whitespace before slash + is ignored, but all spaces at the end of the lines are saved). For + example: + + set + \smartcase + + equals "setsmartcase". When + + set + \ smartcase + + equals "set smartcase". + + The $VIFM/vifminfo file contains generic state of the application. You + can control what is stored in vifminfo by setting 'vifminfo' option. + Vifm always writes this file on exit unless 'vifminfo' option is empty. + Marks, bookmarks, commands, histories, filetypes, fileviewers and + registers in the file are merged with vifm configuration (which has + bigger priority). + + Generally, runtime configuration has bigger priority during merging, + but there are some exceptions: + + - directory stack stored in the file is not overwritten unless + something is changed in vifm instance that performs merge; + + - each mark or bookmark is marked with a timestamp, so that newer + value is not overwritten by older one, thus no matter from where it + comes, the newer one wins; + + - all histories are marked with timestamps on storing, this means + that last instance to quit puts its elements on top of the list; + + - tabs are merged only if both current instance and stored state + contain exactly one tab of any kind. + + The $VIFM/scripts directory can contain shell scripts. vifm modifies + its PATH environment variable to let user run those scripts without + specifying full path. All subdirectories of the $VIFM/scripts will be + added to PATH too. Script in a subdirectory overlaps script with the + same name in all its parent directories. + + The $VIFM/colors/ and {prefix}/etc/vifm/colors/ directories contain + color schemes. Available color schemes are searched in that order, so + on name conflict the one in $VIFM/colors/ wins. + + Each color scheme should have ".vifm" extension. This wasn't the case + before and for this reason the following rules apply during lookup: + + - if there is no file with .vifm extension, all regular files are + listed; + + - otherwise only files with .vifm extension are listed (with the + extension being truncated). + +Sessions + Sessions provide a way to have multiple persistent runtime + configurations. Think of them as second-level vifminfo files in + addition to the first-level one used by all sessions. In other words, + they aren't a replacement for vifminfo file that exists without + sessions, but an addition to it. One can empty 'vifminfo' option and + rely solely on sessions, but in practice one might want to share some + state among instances in different sessions or have an "out-of- + sessions" state for tasks that don't deserve a session of their own. + + This leads to a two-level structure where data in session files has + higher priority than data in vifminfo files (where this makes sense) + following the same rules that merging of vifminfo file obeys. In + addition to that, history items from session files are never ordered + before history items from vifminfo file. + + Format + + Sessions have the format of vifminfo files, they do not consist of + sequence of command-line commands and are not meant to be sourced via + :source command. + + Storage and naming + + `$VIFM/sessions/` directory serves as a storage for sessions. + Consequently names should be valid filenames. The structure of the + storage is flat meaning that there are no subdirectories, that's why + names of sessions can't contain slashes. + + Usage model + + Contrary to Vim, vifm automates basic management of sessions. You can + start, switch, stop or delete a session using builtin means. + + Current session is saved at the same time vifminfo is saved (on normal + exits or explicitly on :write command) and right before switching to + another session. To avoid saving in those cases use :session command + to detach (without saving) from a session before proceeding. + + Related topics + + Commands: :session, :delsession + Options: 'sessionoptions' + Variables: v:session + +Automatic FUSE mounts + vifm has a builtin support of automated FUSE file system mounts. It is + implemented using file associations mechanism. To enable automated + mounts, one needs to use a specially formatted program line in filetype + or filextype commands. These use special macros, which differ from + macros in commands unrelated to FUSE. Currently three formats are + supported: + + 1) FUSE_MOUNT This format should be used in case when all information + needed for mounting all files of a particular type is the same. E.g. + mounting of tar files don't require any file specific options. + + Format line: + FUSE_MOUNT|mounter %SOURCE_FILE %DESTINATION_DIR [%FOREGROUND] + + Example filetype command: + + :filetype FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR + + 2) FUSE_MOUNT2 This format allows one to use specially formatted files + to perform mounting and is useful for mounting remotes, for example + remote file systems over ftp or ssh. + + Format line: + FUSE_MOUNT2|mounter %PARAM %DESTINATION_DIR [%FOREGROUND] + + Example filetype command: + + :filetype *.ssh FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR + + Example file content: + + root@127.0.0.1:/ + + 3) FUSE_MOUNT3 + + This format is equivalent to FUSE_MOUNT, but omits unmounting. It is + useful for cases, when unmounting isn't needed, like when using AVFS. + + Example :filetype command: + + :filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz,*.deb + \ {Mount with avfs} + \ FUSE_MOUNT3|mount-avfs %DESTINATION_DIR %SOURCE_FILE + + Example `mount-avfs` helper script: + + #!/bin/sh + + dest=$1 + file=$2 + + rmdir "$dest" + ln -s "$HOME/.avfs$file#/" "$dest" + + All % macros are expanded by vifm at runtime and have the following + meaning: + - %SOURCE_FILE is replaced by full path to selected file; + - %DESTINATION_DIR is replaced by full path to mount directory, which + is created by vifm basing on the value of 'fusehome' option; + - %PARAM value is filled from the first line of file (whole line), + though in the future it can be changed to whole file content; + - %FOREGROUND means that you want to run mount command as a regular + command (required to be able to provide input for communication with + mounter in interactive way). + + %FOREGROUND is an optional macro. Other macros are not mandatory, but + mount commands likely won't work without them. + + %CLEAR is obsolete name of %FOREGROUND, which is still supported, but + might be removed in future. Its use is discouraged. + + Unlike macros elsewhere, these are recognized only if they appear at + the end of a command or are followed by a space. There is no way to + escape % either. These are historical limitations, which might be + addressed in the future. + + The mounted FUSE file systems will be automatically unmounted in two + cases: + + - when vifm quits (with ZZ, :q, etc. or when killed by signal); + + - when you explicitly leave mount point going up to its parent + directory (with h, Enter on "../" or ":cd ..") and other pane is + not in the same directory or its child directories. + +View look + vifm supports displaying of file list view in two different ways: + + - in a table mode, when multiple columns can be set using + 'viewcolumns' option (see "Column view" section below for details); + + - in a multicolumn list manner which looks almost like `ls -x` + command output (see "ls-like view" section below for details). + + The look is local for each view and can be chosen by changing value of + the 'lsview' boolean option. + + Depending on view look some of keys change their meaning to allow more + natural cursor moving. This concerns mainly h, j, k, l and other + similar navigation keys. + + Also some of options can be ignored if they don't affect view + displaying in selected look. For example value of 'viewcolumns' when + 'lsview' is set. + +ls-like view + When this view look is enabled by setting 'lsview' option on, vifm will + display files in multiple columns. Number of columns depends on the + length of the longest file name present in current directory of the + view. Whole file list is automatically reflowed on directory change, + terminal or view resize. + + View looks close to output of `ls -x` command, so files are listed left + to right in rows. + + In this mode file manipulation commands (e.g. d) don't work line-wise + like they do in Vim, since such operations would be uncommon for file + manipulation tasks. Thus, for example, dd will remove only current + file. + + By default the view is filled by lines, 'lsoptions' can be used to get + filling by columns. + + Note that tree-view and compare view inhibit ls-like view. + +Column view + View columns are described by a comma-separated list of column + descriptions, each of which has the following format + [ '-' | '*' ] [ fw ( [ '.' tw ] | '%' ) ] '{' type | literal '}' + '.'{0,3} + where fw stands for full width, tw stands for text width, bar is + logical or, square brackets denote optional parts and curly braces + define range of repetitions for a symbol that precedes them. + + So it basically consists of four parts: + 1. Optional alignment specifier + 2. Optional width specifier + 3. Mandatory column name + 4. Optional cropping specifier + + Alignment specifier + + It's an optional minus or asterisk sign as the first symbol of the + string. + + Specifies type of text alignment within a column. Three types are + supported: + + - left align + + set viewcolumns=-{name} + + - right align (default) + + set viewcolumns={name} + + - dynamic align + + It's like left alignment, but when the text is bigger than the + column, the alignment is made at the right (so the part of the field + is always visible). + + set viewcolumns=*{name} + + Width specifier + + It's a number followed by a percent sign, two numbers (second one + should be less than or equal to the first one) separated with a dot or + a single number. + + Specifies column width and its units. There are three size types: + + - absolute size - column width is specified in characters + + set viewcolumns=-100{name},20.15{ext} + + results in two columns with lengths of 100 and 20 and a reserved + space of five characters on the left of second column. + + - relative (percent) size - column width is specified in percents of + view width + + set viewcolumns=-80%{name},15%{ext},5%{mtime} + + results in three columns with lengths of 80/100, 15/100 and 5/100 of + view width. + + - auto size (default) - column width is automatically determined + + set viewcolumns=-{name},{ext},{mtime} + + results in three columns with length of one third of view width. + There is no size adjustment to content, since it will slow down + rendering. + + Columns of different sizing types can be freely mixed in one view. + Though sometimes some of columns can be seen partly or be completely + invisible if there is not enough space to display them. + + Column contents + + This is usually a sorting key surrounded with curly braces, e.g. + + {name},{ext},{mtime} + + {name} and {iname} types are the same and present both for consistency + with 'sort' option. + + Following types don't have corresponding sorting keys: + + - {root} - display name without extension (as a complement for + {ext}) + + - {fileroot} - display name without extension for anything except for + directories and symbolic links to directories (as a complement for + {fileext}) + + Empty curly braces ({}) are replaced with the default secondary column + for primary sort key. So after the next command view will be displayed + almost as if 'viewcolumns' is empty, but adding ellipsis for long file + names: + + set viewcolumns=-{name}..,6{}. + + The last kind of column value is a string literal. The literal is used + as a column value for every row. The syntax is "{#literal}", for + example: + + 3{#},{#|},{# | } + + This can be used to draw column separators. Mind that for convenience + literals have different defaults: truncation and automatically + determined absolute size, which is what you usually want for them. + Example: + + set viewcolumns=*{name}..,{#|},6{}. + + Cropping specifier + + It's from one to three dots after closing curly brace in column format. + + Specifies type of text truncation if it doesn't fit in the column. + Currently three types are supported: + + - truncation - text is truncated + + set viewcolumns=-{name}. + + results in truncation of names that are too long too fit in the + view. + + - adding of ellipsis - ellipsis on the left or right are added when + needed + + set viewcolumns=-{name}.. + + results in that ellipsis are added at the end of too long file + names. + + - none (default) - text can pass column boundaries + + set viewcolumns=-{name}...,{ext} + + results in that long file names can partially be written on the ext + column. + +Color schemes + The color schemes in vifm can be applied in two different ways: + + - as the primary color scheme; + + - as local to a pane color scheme. + + Both types are set using :colorscheme command, but of different forms: + + - :colorscheme color_scheme_name - for the primary color scheme; + + - :colorscheme color_scheme_name directory - for local color schemes. + + Look of different parts of the TUI (Text User Interface) is determined + in this way: + + - Border, TabLine, TabLineSel, TopLineSel, TopLine, CmdLine, + ErrorMsg, StatusLine, JobLine, SuggestBox and WildMenu are always + determined by the primary color scheme; + + - CurrLine, Selected, Directory, Link, BrokenLink, Socket, Device, + Executable, Fifo, CmpMismatch, Win, AuxWin and OtherWin are + determined by primary color scheme and a set of local color + schemes, which can be empty. + + There might be a set of local color schemes because they are structured + hierarchically according to file system structure. For example, having + the following piece of file system: + + ~ + `-- bin + | + `-- my + + Two color schemes: + + # ~/.vifm/colors/for_bin + highlight Win cterm=none ctermfg=white ctermbg=red + highlight CurrLine cterm=none ctermfg=red ctermbg=black + + # ~/.vifm/colors/for_bin_my + highlight CurrLine cterm=none ctermfg=green ctermbg=black + + And these three commands in the vifmrc file: + + colorscheme Default + colorscheme for_bin ~/bin + colorscheme for_bin_my ~/bin/my + + File list will look in the following way for each level: + + - ~/ - Default color scheme + black background + cursor with blue background + + - ~/bin/ - mix of Default and for_bin color schemes + red background + cursor with black background and red foreground + + - ~/bin/my/ - mix of Default, for_bin and for_bin_my color schemes + red background + cursor with black background and green foreground + +Trash directory + vifm has support of trash directory, which is used as temporary storage + for deleted files or files that were cut. Using trash is controlled by + the 'trash' option, and exact path to the trash can be set with + 'trashdir' option. Trash directory in vifm differs from the system- + wide one by default, because of possible incompatibilities of storing + deleted files among different file managers. But one can set + 'trashdir' to "~/.local/share/Trash" to use a "standard" trash + directory. + + There are two scenarios of using trash in vifm: + + 1. As a place for storing files that were cut by "d" and may be + inserted to some other place in file system. + + 2. As a storage of files, that are deleted but not purged yet. + + The first scenario uses deletion ("d") operations to put files to trash + and put ("p") operations to restore files from trash directory. Note + that such operations move files to and from trash directory, which can + be long term operations in case of different partitions or remote + drives mounted locally. + + The second scenario uses deletion ("d") operations for moving files to + trash directory and :empty command-line command to purge all previously + deleted files. + + Deletion and put operations depend on registers, which can point to + files in trash directory. Normally, there are no nonexistent files in + registers, but vifm doesn't keep track of modifications under trash + directory, so one shouldn't expect value of registers to be absolutely + correct if trash directory was modified not by operation that are meant + for it. But this won't lead to any issues with operations, since they + ignore nonexistent files. + +Client-Server + vifm supports remote execution of command-line mode commands, remote + changing of directories and expression evaluation. This is possible + using --remote and --remote-expr command-line arguments. + + To execute a command remotely combine --remote argument with -c + or +. For example: + + vifm --remote -c 'cd /' + vifm --remote '+cd /' + + To change directory not using command-line mode commands one can + specify paths right after --remote argument, like this: + + vifm --remote / + vifm --remote ~ + vifm --remote /usr/bin /tmp + + Evaluating expression remotely might be useful to query information + about an instance, for example its location: + + vifm --remote-expr 'expand("%d")' + + If there are several running instances, the target can be specified + with --server-name option (otherwise, the first one lexicographically + is used): + + vifm --server-name work --remote ~/work/project + + List of names of running instances can be obtained via --server-list + option. Name of the current one is available via v:servername. + + + v:servername + server name of the running vifm instance. Empty if client- + server feature is disabled. + +External Renaming + When an editor is run to edit list of file names, contents of the + temporary file has the following format: + + 1. Order of lines correspond to the order of files in a view. + + 2. Lines that start with a "#" are comments and are ignored. + + 3. Single backslash at the beginning of a line is ignored, so that a + file starting with a backslash will appear like "\#name". + + If an operation was rejected due to issues with file names, next time + you'll see the following in this order: + + 1. Last error (in comments). + + 2. Original file names (in comments). + + 3. Failed list of new names. + + Mind that Vim plugin will extract list of original names and show them + in a vertical split. + + You can cancel renaming by removing all non-comments from the buffer. + This also erases information about previous edits. + +Plugin + Plugin for using vifm in vim as a file selector. + + Commands: + + :EditVifm select a file or files to open in the current buffer. + :Vifm alias for :EditVifm. + :SplitVifm split buffer and select a file or files to open. + :VsplitVifm vertically split buffer and select a file or files to + open. + :DiffVifm select a file or files to compare to the current file + with + :vert diffsplit. + :TabVifm select a file or files to open in tabs. + + Each command accepts up to two arguments: left pane directory and right + pane directory. After arguments are checked, vifm process is spawned + in a special "file-picker" mode. To pick files just open them either + by pressing l, i or Enter keys, or by running :edit command. If no + files are selected, file under the cursor is opened, otherwise whole + selection is passed to the plugin and opened in vim. + + The plugin have only two settings. It's a string variable named + g:vifm_term to let user specify command to run GUI terminal. By + default it's equal to 'xterm -e'. And another string variable named + g:vifm_exec, which equals "vifm" by default and specifies path to + vifm's executable. To pass arguments to vifm use g:vifm_exec_args, + which is empty by default. + + To use the plugin copy the vifm.vim file to either the system wide + vim/plugin directory or into ~/.vim/plugin. + + If you would prefer not to use the plugin and it is in the system wide + plugin directory add + + let loaded_vifm=1 + + to your ~/.vimrc file. + +Reserved + The following command names are reserved and shouldn't be used for user + commands. + + g[lobal] + v[global] + +ENVIRONMENT + VIFM Points to main configuration directory (usually ~/.vifm/). + + MYVIFMRC + Points to main configuration file (usually ~/.vifm/vifmrc). + + These environment variables are valid inside vifm and also can be used + to configure it by setting some of them before running vifm. + + When $MYVIFMRC isn't set, it's made as $VIFM/vifmrc (exception for + Windows: vifmrc in the same directory as vifm.exe has higher priority + than $VIFM/vifmrc). + + See "Startup" section above for more details. + + VIFM_FUSE_FILE + On execution of external commands this variable is set to the + full path of file used to initiate FUSE mount of the closest + mount point from current pane's directory up. It's not set when + outside FUSE mount point. When vifm is used inside terminal + multiplexer, it tries to set this variable as well (it doesn't + work this way on its own). + +SEE ALSO + vifm-convert-dircolors(1), vifm-pause(1) + + Website: https://vifm.info/ + Wiki: https://wiki.vifm.info/ + + Esperanto translation of the documentation by Sebastian Cyprych: + http://cyprych.neostrada.pl/tekstoj/komputiloj/vifm-help.eo.html + +AUTHOR + Vifm was written by ksteen + And currently is developed by xaizek + +vifm 0.12 September 29, 2021 VIFM(1) diff --git a/config/vifm/vifminfo.json b/config/vifm/vifminfo.json new file mode 100644 index 000000000..cd505ff9e --- /dev/null +++ b/config/vifm/vifminfo.json @@ -0,0 +1 @@ +{"gtabs":[{"panes":[{"ptabs":[{"history":[{"dir":"/media","file":"Storage","relpos":1,"ts":1640476285},{"dir":"/media/Storage","file":"things","relpos":4,"ts":1640476285},{"dir":"/media","file":"Storage","relpos":1,"ts":1640476285},{"dir":"/","file":"home","relpos":4,"ts":1640476285},{"dir":"/home","file":"drk","relpos":1,"ts":1640555900},{"dir":"/home/drk","file":"Downloads","relpos":16,"ts":1640555900},{"dir":"/home/drk/Downloads","file":"archlinux-2021.12.01-x86_64.iso","relpos":1,"ts":1640555900},{"dir":"/home/drk","file":"Notes","relpos":17,"ts":1640555900},{"dir":"/home/drk/Notes","file":"..","relpos":0,"ts":1640555900},{"dir":"/home/drk","file":"Pictures","relpos":18,"ts":1640555900},{"dir":"/home/drk/Pictures","file":"..","relpos":0,"ts":1640555900},{"dir":"/home/drk","file":"Notes","relpos":17,"ts":1640555900},{"dir":"/home/drk/Notes","file":"..","relpos":0,"ts":1640555900},{"dir":"/home/drk","file":"Pictures","relpos":18,"ts":1640555900},{"dir":"/home/drk/Pictures","file":"Other Images","relpos":2,"ts":1640555900},{"dir":"/home/drk/Pictures/Other Images","file":"..","relpos":0,"ts":1640555900},{"dir":"/home/drk/Pictures","file":"Other Images","relpos":2,"ts":1640555900},{"dir":"/home/drk","file":"Wrk","relpos":19,"ts":1640555900},{"dir":"/home/drk/Wrk","file":"..","relpos":0,"ts":1640555900},{"dir":"/home/drk","file":"Desktop","relpos":14,"ts":1640555900},{"dir":"/home/drk/Desktop","file":"..","relpos":0,"ts":1640555900},{"dir":"/home/drk","file":"Desktop","relpos":14,"ts":1640555900},{"dir":"/home/drk/Desktop","file":"..","relpos":0,"ts":1640555900},{"dir":"/home/drk","file":"Documents","relpos":15,"ts":1640555900},{"dir":"/home/drk/Documents","file":"..","relpos":0,"ts":1640555900},{"dir":"/home/drk","file":"Downloads","relpos":16,"ts":1640555900},{"dir":"/home/drk/Downloads","file":"archlinux-2021.12.01-x86_64.iso","relpos":1,"ts":1640555900},{"dir":"/home/drk","file":".config","relpos":3,"ts":1640555900},{"dir":"/home/drk/.config","file":"inkscape","relpos":21,"ts":1640555900},{"dir":"/home/drk","file":".config","relpos":3,"ts":1640663323},{"dir":"/home","file":"drk","relpos":1,"ts":1640663323},{"dir":"/","file":"mnt","relpos":10,"ts":1640663323},{"dir":"/mnt","file":"Games","relpos":2,"ts":1640663323},{"dir":"/mnt/Games","file":"snes","relpos":10,"ts":1640663323},{"dir":"/mnt","file":"..","relpos":0,"ts":1640723593},{"dir":"/","file":"home","relpos":4,"ts":1640723593},{"dir":"/home","file":"..","relpos":0,"ts":1640723593},{"dir":"/","file":"home","relpos":4,"ts":1640723593},{"dir":"/home","file":"drk","relpos":1,"ts":1640723593},{"dir":"/home/drk","file":".config","relpos":6,"ts":1640723593},{"dir":"/home/drk/.config","file":"inkscape","relpos":21,"ts":1640723593},{"dir":"/home/drk","file":".config","relpos":6,"ts":1640723593},{"dir":"/home/drk/.config","file":"browsh","relpos":6,"ts":1640723593},{"dir":"/home/drk/.config/browsh","file":"..","relpos":0,"ts":1640723593},{"dir":"/home/drk/.config","file":"awesome","relpos":5,"ts":1640723593},{"dir":"/home/drk/.config/awesome","file":"config.org","relpos":4,"ts":1640723593},{"dir":"/home/drk/.config","file":"awesome","relpos":5,"ts":1640724275},{"dir":"/home/drk","file":"Documents","relpos":18,"ts":1640724275},{"dir":"/home","file":"lost+found","relpos":2,"ts":1640734120},{"dir":"/","file":"mnt","relpos":10,"ts":1640734120},{"dir":"/mnt","file":".vifm-Trash-1000","relpos":1,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000","file":"000_Pictures","relpos":1,"ts":1640734120},{"dir":"/mnt","file":".vifm-Trash-1000","relpos":1,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000","file":"000_Pictures","relpos":1,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000/000_Pictures","file":"Backgrounds","relpos":1,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000/000_Pictures/Backgrounds","file":"..","relpos":0,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000/000_Pictures","file":"Backgrounds","relpos":1,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000/000_Pictures/Backgrounds","file":"..","relpos":0,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000/000_Pictures","file":"Backgrounds","relpos":1,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000/000_Pictures/Backgrounds","file":"..","relpos":0,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000/000_Pictures","file":"Backgrounds","relpos":1,"ts":1640734120},{"dir":"/mnt/.vifm-Trash-1000","file":"000_completions","relpos":2,"ts":1640734120},{"dir":"/mnt","file":"..","relpos":0,"ts":1640734120},{"dir":"/","file":"home","relpos":4,"ts":1640786407},{"dir":"/home","file":"drk","relpos":1,"ts":1640786407},{"dir":"/home/drk","file":"Pictures","relpos":21,"ts":1640786407},{"dir":"/home/drk/Pictures","file":"o&s.jpg","relpos":3,"ts":1640786715},{"dir":"/home/drk","file":"Notes","relpos":20,"ts":1640787210},{"dir":"/home","file":"drk","relpos":1,"ts":1640787210},{"dir":"/","file":"media","relpos":9,"ts":1640787210},{"dir":"/media","file":"Storage","relpos":1,"ts":1640787210},{"dir":"/media/Storage","file":"multimedia","relpos":3,"ts":1640787210},{"dir":"/media/Storage/multimedia","file":"videos","relpos":5,"ts":1640787210},{"dir":"/media/Storage/multimedia/videos","file":"live-presentations","relpos":2,"ts":1640787210},{"dir":"/media/Storage/multimedia/videos/live-presentations","file":"For-A-Free-Digital Society-Richard-Stallman.webm","relpos":1,"ts":1640787210},{"dir":"/media/Storage/multimedia/videos","file":"live-presentations","relpos":2,"ts":1640787227},{"dir":"/media/Storage/multimedia","file":"videos","relpos":5,"ts":1640787227},{"dir":"/media/Storage","file":"multimedia","relpos":3,"ts":1640787227},{"dir":"/media","file":"Storage","relpos":1,"ts":1640787227},{"dir":"/","file":"home","relpos":4,"ts":1640787227},{"dir":"/home","file":"drk","relpos":1,"ts":1640787227},{"dir":"/home/drk","file":"Pictures","relpos":21,"ts":1640787227},{"dir":"/home/drk/Pictures","file":"o&s.jpg","relpos":3,"ts":1640787853},{"dir":"/home/drk","file":"Downloads","relpos":19,"ts":1640787853},{"dir":"/home","file":"drk","relpos":1,"ts":1640789861},{"dir":"/","file":"media","relpos":9,"ts":1640789861},{"dir":"/media","file":"Storage","relpos":1,"ts":1640789861},{"dir":"/media/Storage","file":"multimedia","relpos":3,"ts":1640789861},{"dir":"/media/Storage/multimedia","file":"manga","relpos":3,"ts":1640789861},{"dir":"/media/Storage/multimedia/manga","file":"Baki Series (1999-2018)","relpos":1,"ts":1640789861},{"dir":"/media/Storage/multimedia/manga/Baki Series (1999-2018)","file":"1 - Glapper Baki","relpos":1,"ts":1640789861},{"dir":"/media/Storage/multimedia/manga/Baki Series (1999-2018)/1 - Glapper Baki","file":"Grappler Baki Vol. 4.cbz","relpos":3,"ts":1640789861},{"dir":"/media/Storage/multimedia/manga/Baki Series (1999-2018)","file":"1 - Glapper Baki","relpos":1,"ts":1640797893},{"dir":"/media/Storage/multimedia/manga","file":"Baki Series (1999-2018)","relpos":1,"ts":1640797893},{"dir":"/media/Storage/multimedia","file":"manga","relpos":3,"ts":1640797893},{"dir":"/media/Storage","file":"multimedia","relpos":3,"ts":1640797893},{"dir":"/media","file":"Storage","relpos":1,"ts":1640797893},{"dir":"/media/Storage","file":"multimedia","relpos":3,"ts":1640797893},{"dir":"/media/Storage/multimedia","file":"music","relpos":4,"ts":1640797893},{"dir":"/media/Storage/multimedia/music","file":"AC-DC - Discography","relpos":1,"ts":1640797893}],"filters":{"invert":true,"dot":false,"manual":"","auto":""},"last-location":"/media/Storage/multimedia/music","sorting":[2],"preview":false}]},{"ptabs":[{"history":[{"dir":"/home/drk","file":"Documents","relpos":13,"ts":1639965128},{"dir":"/media/Storage/multimedia/games/linux","file":"Minecraft.1.17.1","relpos":3,"ts":1640128736},{"dir":"/media/Storage/multimedia/games","file":"linux","relpos":7,"ts":1640148923},{"dir":"/media/Storage/multimedia","file":"games","relpos":2,"ts":1640148923},{"dir":"/media/Storage","file":".Trash-1000","relpos":1,"ts":1640148923},{"dir":"/media/Storage/.Trash-1000","file":"expunged","relpos":1,"ts":1640148923},{"dir":"/media/Storage","file":".Trash-1000","relpos":1,"ts":1640148923},{"dir":"/media","file":"Storage","relpos":1,"ts":1640148923},{"dir":"/","file":"home","relpos":4,"ts":1640148923},{"dir":"/home","file":"drk","relpos":1,"ts":1640148923},{"dir":"/home/drk","file":"Downloads","relpos":15,"ts":1640148923},{"dir":"/home","file":"drk","relpos":1,"ts":1640149260},{"dir":"/home/drk","file":".bashrc","relpos":23,"ts":1640149260},{"dir":"/home","file":"drk","relpos":1,"ts":1640228248},{"dir":"/home/drk","file":".config","relpos":3,"ts":1640228248},{"dir":"/home/drk/.config","file":"vifm","relpos":37,"ts":1640228248},{"dir":"/home/drk","file":".config","relpos":3,"ts":1640228248},{"dir":"/home","file":"..","relpos":0,"ts":1640228248},{"dir":"/","file":"home","relpos":4,"ts":1640228248},{"dir":"/home","file":"drk","relpos":1,"ts":1640228248},{"dir":"/home/drk","file":".config","relpos":3,"ts":1640228248},{"dir":"/home/drk/.config","file":"fish","relpos":11,"ts":1640228248},{"dir":"/home/drk/.config/fish","file":"completions","relpos":1,"ts":1640228248},{"dir":"/home/drk/.config","file":"awesome","relpos":5,"ts":1640228248},{"dir":"/home/drk","file":".config","relpos":3,"ts":1640368932},{"dir":"/home/drk/.config","file":"awesome","relpos":5,"ts":1640397711},{"dir":"/home/drk","file":"Documents","relpos":14,"ts":1640397711},{"dir":"/home/drk/Documents","file":".config","relpos":1,"ts":1640397711},{"dir":"/home/drk","file":".doom.d","relpos":5,"ts":1640453750},{"dir":"/home","file":"drk","relpos":1,"ts":1640457832},{"dir":"/","file":"mnt","relpos":10,"ts":1640457832},{"dir":"/mnt","file":"Tool - Discography","relpos":4,"ts":1640457832},{"dir":"/","file":"media","relpos":9,"ts":1640457832},{"dir":"/media","file":"Storage","relpos":1,"ts":1640457832},{"dir":"/media/Storage","file":"multimedia","relpos":3,"ts":1640457832},{"dir":"/media","file":"Storage","relpos":1,"ts":1640457832},{"dir":"/","file":"mnt","relpos":10,"ts":1640457832},{"dir":"/mnt","file":"..","relpos":0,"ts":1640457832},{"dir":"/","file":"home","relpos":4,"ts":1640460950},{"dir":"/home","file":"drk","relpos":1,"ts":1640460950},{"dir":"/home/drk","file":"Downloads","relpos":15,"ts":1640460950},{"dir":"/home/drk/Downloads","file":"..","relpos":0,"ts":1640460950},{"dir":"/home/drk","file":"Documents","relpos":15,"ts":1640460950},{"dir":"/home","file":"lost+found","relpos":2,"ts":1640663323},{"dir":"/","file":"media","relpos":9,"ts":1640663323},{"dir":"/media","file":"Storage","relpos":1,"ts":1640663323},{"dir":"/media/Storage","file":"multimedia","relpos":3,"ts":1640663323},{"dir":"/media/Storage/multimedia","file":"anime","relpos":1,"ts":1640663323},{"dir":"/media/Storage/multimedia/anime","file":"..","relpos":0,"ts":1640663323},{"dir":"/media/Storage/multimedia","file":"games","relpos":2,"ts":1640663323},{"dir":"/media/Storage/multimedia/games","file":"gg","relpos":6,"ts":1640663323},{"dir":"/media/Storage/multimedia","file":"games","relpos":2,"ts":1640663323},{"dir":"/media/Storage/multimedia/games","file":"snes","relpos":15,"ts":1640663323},{"dir":"/media/Storage/multimedia","file":"games","relpos":2,"ts":1640723593},{"dir":"/media/Storage","file":"multimedia","relpos":3,"ts":1640723593},{"dir":"/media","file":"Storage","relpos":1,"ts":1640723593},{"dir":"/","file":"home","relpos":4,"ts":1640723593},{"dir":"/home","file":"drk","relpos":1,"ts":1640723593},{"dir":"/home/drk","file":"Desktop","relpos":18,"ts":1640723593},{"dir":"/home/drk/Desktop","file":"..","relpos":0,"ts":1640723593},{"dir":"/home/drk","file":"Documents","relpos":19,"ts":1640723593},{"dir":"/home/drk/Documents","file":"..","relpos":0,"ts":1640723593},{"dir":"/home/drk","file":".config","relpos":6,"ts":1640724275},{"dir":"/home/drk/.config","file":"awesome","relpos":5,"ts":1640724275},{"dir":"/home/drk/.config/awesome","file":"lain","relpos":2,"ts":1640724275},{"dir":"/home/drk/.config","file":"awesome","relpos":5,"ts":1640734120},{"dir":"/home/drk","file":"Downloads","relpos":19,"ts":1640734120},{"dir":"/home/drk/Downloads","file":"Pictures","relpos":1,"ts":1640734120},{"dir":"/home/drk/Downloads/Pictures","file":"Backgrounds","relpos":1,"ts":1640734120},{"dir":"/home/drk/Downloads/Pictures/Backgrounds","file":"2.jpg","relpos":1,"ts":1640734120},{"dir":"/home/drk/Downloads/Pictures","file":"Backgrounds","relpos":1,"ts":1640734120},{"dir":"/home/drk/Downloads/Pictures/Backgrounds","file":"..","relpos":0,"ts":1640734120},{"dir":"/home/drk/Downloads/Pictures","file":"Backgrounds","relpos":1,"ts":1640786407},{"dir":"/home/drk/Downloads","file":"Pictures","relpos":1,"ts":1640786407},{"dir":"/home/drk","file":"..","relpos":0,"ts":1640786407},{"dir":"/home","file":"drk","relpos":1,"ts":1640797893},{"dir":"/","file":"mnt","relpos":10,"ts":1640797893},{"dir":"/mnt","file":".vifm-Trash-1000","relpos":1,"ts":1640797893},{"dir":"/mnt/.vifm-Trash-1000","file":"..","relpos":0,"ts":1640797893},{"dir":"/mnt","file":".vifm-Trash-1000","relpos":1,"ts":1640797893},{"dir":"/mnt/.vifm-Trash-1000","file":"..","relpos":0,"ts":1640797893},{"dir":"/mnt","file":".vifm-Trash-1000","relpos":1,"ts":1640797893},{"dir":"/mnt/.vifm-Trash-1000","file":"..","relpos":0,"ts":1640797893},{"dir":"/mnt","file":"..","relpos":0,"ts":1640797893},{"dir":"/","file":"mnt","relpos":10,"ts":1640797893},{"dir":"/mnt","file":"..","relpos":0,"ts":1640797893}],"filters":{"invert":true,"dot":false,"manual":"","auto":""},"last-location":"/mnt","sorting":[2],"preview":false}]}],"active-pane":1,"preview":false,"splitter":{"pos":-1,"ratio":0.5,"orientation":"v","expanded":false}}],"trash":[{"trashed":"/home/drk/.local/share/vifm/Trash/000_README.org","original":"/home/drk/.config/awesome/README.org"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.git","original":"/home/drk/.config/awesome/awesome-wm-widgets/.git"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.github","original":"/home/drk/.config/awesome/awesome-wm-widgets/.github"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.gitignore","original":"/home/drk/.config/awesome/awesome-wm-widgets/.gitignore"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_LICENSE","original":"/home/drk/.config/awesome/awesome-wm-widgets/LICENSE"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_README.md","original":"/home/drk/.config/awesome/awesome-wm-widgets/README.md"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_Screenshot from 2019-03-01 14-28-18.png","original":"/home/drk/.config/awesome/awesome-wm-widgets/Screenshot from 2019-03-01 14-28-18.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_apt-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/apt-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_awesome-o.png","original":"/home/drk/.config/awesome/awesome-wm-widgets/awesome-o.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_awesome.png","original":"/home/drk/.config/awesome/awesome-wm-widgets/awesome.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_batteryarc-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/batteryarc-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_bitbucket-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/bitbucket-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_calendar-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/calendar-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_cpu-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/cpu-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_docker-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/docker-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_email-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/email-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_experiments","original":"/home/drk/.config/awesome/awesome-wm-widgets/experiments"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_fs-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/fs-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_gerrit-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/gerrit-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_github-activity-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/github-activity-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_github-contributions-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/github-contributions-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_github-prs-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/github-prs-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_gitlab-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/gitlab-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_jira-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/jira-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_logout-popup-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/logout-popup-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_mpdarc-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/mpdarc-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_mpris-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/mpris-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_net-speed-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/net-speed-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_pomodoroarc-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/pomodoroarc-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_ram-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/ram-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_run-shell","original":"/home/drk/.config/awesome/awesome-wm-widgets/run-shell"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_run-shell-2","original":"/home/drk/.config/awesome/awesome-wm-widgets/run-shell-2"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_run-shell-3","original":"/home/drk/.config/awesome/awesome-wm-widgets/run-shell-3"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_screenshot.png","original":"/home/drk/.config/awesome/awesome-wm-widgets/screenshot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_screenshot_with_sprtrs.png","original":"/home/drk/.config/awesome/awesome-wm-widgets/screenshot_with_sprtrs.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_spotify-shell","original":"/home/drk/.config/awesome/awesome-wm-widgets/spotify-shell"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_spotify-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/spotify-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_stackoverflow-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/stackoverflow-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_todo-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/todo-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_translate-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/translate-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_weather-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/weather-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_widgets-icons.png","original":"/home/drk/.config/awesome/awesome-wm-widgets/widgets-icons.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_word-clock-widget","original":"/home/drk/.config/awesome/awesome-wm-widgets/word-clock-widget"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_freedesktop","original":"/home/drk/.config/awesome/freedesktop"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_rc.lua","original":"/home/drk/.config/awesome/rc.lua"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_scripts","original":"/home/drk/.config/awesome/scripts"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_awesome-wm-widgets","original":"/home/drk/.config/awesome/themes/gruvbox-dark/awesome-wm-widgets"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_multicolor","original":"/home/drk/.config/awesome/themes/multicolor"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_powerarrow","original":"/home/drk/.config/awesome/themes/powerarrow"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_powerarrow-blue","original":"/home/drk/.config/awesome/themes/powerarrow-blue"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.dvdcss","original":"/home/drk/.dvdcss"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_ani-cli","original":"/home/drk/.git-clones/ani-cli"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_arc-icon-theme","original":"/home/drk/.git-clones/arc-icon-theme"},{"trashed":"/home/drk/.local/share/vifm/Trash/001_awesome-wm-widgets","original":"/home/drk/.git-clones/awesome-wm-widgets"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_awesomewm-gruvbox","original":"/home/drk/.git-clones/awesomewm-gruvbox"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_firefox-minima","original":"/home/drk/.git-clones/firefox-minima"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_gruvbox-dark-gtk","original":"/home/drk/.git-clones/gruvbox-dark-gtk"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_gruvbox-gtk","original":"/home/drk/.git-clones/gruvbox-gtk"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_gruvbox-material-gtk","original":"/home/drk/.git-clones/gruvbox-material-gtk"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_shell-color-scripts","original":"/home/drk/.git-clones/shell-color-scripts"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_volantes-cursors","original":"/home/drk/.git-clones/volantes-cursors"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.pinerc","original":"/home/drk/.pinerc"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.txt-resources","original":"/home/drk/.txt-resources"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.var","original":"/home/drk/.var"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.wegorc","original":"/home/drk/.wegorc"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.xonotic","original":"/home/drk/.xonotic"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-19-160504_1920x1080_scrot.png","original":"/home/drk/2021-12-19-160504_1920x1080_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-19-162513_702x245_scrot.png","original":"/home/drk/2021-12-19-162513_702x245_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-22-132615_491x223_scrot.png","original":"/home/drk/2021-12-22-132615_491x223_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-22-162921_1920x1080_scrot.png","original":"/home/drk/2021-12-22-162921_1920x1080_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-24-172232_1920x1080_scrot.png","original":"/home/drk/2021-12-24-172232_1920x1080_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-24-172445_1920x1080_scrot.png","original":"/home/drk/2021-12-24-172445_1920x1080_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-24-172610_1920x1080_scrot.png","original":"/home/drk/2021-12-24-172610_1920x1080_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-28-114537_1920x1080_scrot.png","original":"/home/drk/2021-12-28-114537_1920x1080_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-28-121042_808x223_scrot.png","original":"/home/drk/2021-12-28-121042_808x223_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_2021-12-28-121142_1494x367_scrot.png","original":"/home/drk/2021-12-28-121142_1494x367_scrot.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_Audio","original":"/home/drk/Audio"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_Desktop","original":"/home/drk/Desktop"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.config","original":"/home/drk/Documents/.config"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_.config.tar","original":"/home/drk/Documents/.config.tar"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_Death_Star.png","original":"/home/drk/Downloads/Pictures/Backgrounds/Death_Star.png"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_The.Witcher.S02.2160p.NF.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-MZABI[rartv]","original":"/home/drk/Downloads/The.Witcher.S02.2160p.NF.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-MZABI[rartv]"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_The.Witcher.S02.WEBRip.x265-ION265","original":"/home/drk/Downloads/The.Witcher.S02.WEBRip.x265-ION265"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_awesomebackup","original":"/home/drk/Downloads/awesomebackup"},{"trashed":"/home/drk/.local/share/vifm/Trash/001_freedesktop","original":"/home/drk/Downloads/freedesktop"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_ninvaders-0.1.1.tar.gz","original":"/home/drk/Downloads/ninvaders-0.1.1.tar.gz"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_parabola-2021.08.11","original":"/home/drk/Downloads/parabola-2021.08.11"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_retroarch_system-RetroArch","original":"/home/drk/Downloads/retroarch_system-RetroArch"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_testing.org","original":"/home/drk/Notes/testing.org"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_Video","original":"/home/drk/Video"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_org","original":"/home/drk/org"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_test.txt","original":"/home/drk/test.txt"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_AC-DC - Discography","original":"/mnt/AC-DC - Discography"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_Aerosmith - Discography","original":"/mnt/Aerosmith - Discography"},{"trashed":"/home/drk/.local/share/vifm/Trash/000_Avenged Sevenfold - Discography","original":"/mnt/Avenged Sevenfold - Discography"},{"trashed":"/mnt/.vifm-Trash-1000/000_Pictures","original":"/mnt/Pictures"},{"trashed":"/mnt/.vifm-Trash-1000/000_thonkpad-dotfiles","original":"/mnt/thonkpad-dotfiles"}],"marks":{"H":{"dir":"/home/drk/","file":"..","ts":1639964372},"h":{"dir":"/home/drk/","file":"..","ts":1639965122},"z":{"dir":"/home/drk/.config/vifm","file":"..","ts":1639964372}},"bmarks":{},"cmd-hist":[{"text":"touch test.txt","ts":1639965319},{"text":"sh start.sh","ts":1640128736},{"text":"execute","ts":1640128736},{"text":"h","ts":1640148923},{"text":"mkdir .config","ts":1640228248},{"text":"mkdir fish","ts":1640228248},{"text":"rename powerarrow-dark","ts":1640377863},{"text":"rename gruvbox-dark","ts":1640377863},{"text":"mkdir Games","ts":1640663323},{"text":"touch rc.lua","ts":1640723823},{"text":"rename screenshot.png","ts":1640724275},{"text":"move","ts":1640724275},{"text":"mkdir Pictures","ts":1640734120},{"text":"mkdir Backgrounds","ts":1640734120},{"text":"delete","ts":1640734120},{"text":"q","ts":1640786407}],"regs":{"\"":["/media/Storage/multimedia/music/AC-DC - Discography","/media/Storage/multimedia/music/Aerosmith - Discography","/media/Storage/multimedia/music/Avenged Sevenfold - Discography","/media/Storage/multimedia/music/Black Sabbath - Discography","/media/Storage/multimedia/music/David Bowie - Discography","/media/Storage/multimedia/music/Diana Krall - Discography"]},"dir-stack":[],"use-term-multiplexer":false} \ No newline at end of file diff --git a/config/vifm/vifmrc b/config/vifm/vifmrc new file mode 100755 index 000000000..0815a9055 --- /dev/null +++ b/config/vifm/vifmrc @@ -0,0 +1,513 @@ +" ____ _____ +" | _ \_ _| Derek Taylor (DistroTube) +" | | | || | http://www.youtube.com/c/DistroTube +" | |_| || | http://www.gitlab.com/dwt1/ +" |____/ |_| + +" vim: filetype=vifm : +" My config file for the vifm terminal file manager. +" ------------------------------------------------------------------------------ + +" This is the actual command used to start vi. The default is vim. +" If you would like to use emacs or emacsclient, you can use them. +" Since emacs is a GUI app and not a terminal app like vim, append the command +" with an ampersand (&). + +set vicmd=nvim + +" This makes vifm perform file operations on its own instead of relying on +" standard utilities like `cp`. While using `cp` and alike is a more universal +" solution, it's also much slower when processing large amounts of files and +" doesn't support progress measuring. + +set syscalls + +" Trash Directory +" The default is to move files that are deleted with dd or :d to +" the trash directory. If you change this you will not be able to move +" files by deleting them and then using p to put the file in the new location. +" I recommend not changing this until you are familiar with vifm. +" This probably shouldn't be an option. + +set trash + +" This is how many directories to store in the directory history. + +set history=100 + +" Automatically resolve symbolic links on l or Enter. + +set nofollowlinks + +" With this option turned on you can run partially entered commands with +" unambiguous beginning using :! (e.g. :!Te instead of :!Terminal or :!Te). + +" set fastrun + +" Natural sort of (version) numbers within text. + +set sortnumbers + +" Maximum number of changes that can be undone. + +set undolevels=100 + +" If you installed the vim.txt help file set vimhelp. +" If would rather use a plain text help file set novimhelp. + +set novimhelp + +" If you would like to run an executable file when you +" press return on the file name set this. + +set norunexec + +" Selected color scheme +" The following line will cause issues if using vifm.vim with regular vim. +" Either use neovim or comment out the following line. +colorscheme distrotube + +" Format for displaying time in file list. For example: +" TIME_STAMP_FORMAT=%m/%d-%H:%M +" See man date or man strftime for details. + +set timefmt=%m/%d\ %H:%M + +" Show list of matches on tab completion in command-line mode + +set wildmenu + +" Display completions in a form of popup with descriptions of the matches + +set wildstyle=popup + +" Display suggestions in normal, visual and view modes for keys, marks and +" registers (at most 5 files). In other view, when available. + +set suggestoptions=normal,visual,view,otherpane,keys,marks,registers + +" Ignore case in search patterns unless it contains at least one uppercase +" letter + +set ignorecase +set smartcase + +" Don't highlight search results automatically + +set nohlsearch + +" Use increment searching (search while typing) +set incsearch + +" Try to leave some space from cursor to upper/lower border in lists + +set scrolloff=4 + +" Don't do too many requests to slow file systems + +if !has('win') + set slowfs=curlftpfs +endif + +" Set custom status line look + +set statusline=" Hint: %z%= %A %10u:%-7g %15s %20d " + +" Set line numbers to show + +" ------------------------------------------------------------------------------ + +" :mark mark /full/directory/path [filename] + +mark h ~/ + +" ------------------------------------------------------------------------------ + +" :com[mand][!] command_name action +" The following macros can be used in a command +" %a is replaced with the user arguments. +" %c the current file under the cursor. +" %C the current file under the cursor in the other directory. +" %f the current selected file, or files. +" %F the current selected file, or files in the other directory. +" %b same as %f %F. +" %d the current directory name. +" %D the other window directory name. +" %m run the command in a menu window + +command! df df -h %m 2> /dev/null +command! diff vim -d %f %F +command! zip zip -r %f.zip %f +command! run !! ./%f +command! make !!make %a +command! mkcd :mkdir %a | cd %a +command! vgrep vim "+grep %a" +command! reload :write | restart + +" ------------------------------------------------------------------------------ + +" The file type is for the default programs to be used with +" a file extension. +" :filetype pattern1,pattern2 defaultprogram,program2 +" :fileviewer pattern1,pattern2 consoleviewer +" The other programs for the file type can be accessed with the :file command +" The command macros %f, %F, %d, %F may be used in the commands. +" The %a macro is ignored. To use a % you must put %%. + +" For automated FUSE mounts, you must register an extension with :file[x]type +" in one of following formats: +" +" :filetype extensions FUSE_MOUNT|some_mount_command using %SOURCE_FILE and %DESTINATION_DIR variables +" %SOURCE_FILE and %DESTINATION_DIR are filled in by vifm at runtime. +" A sample line might look like this: +" :filetype *.zip,*.jar,*.war,*.ear FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR +" +" :filetype extensions FUSE_MOUNT2|some_mount_command using %PARAM and %DESTINATION_DIR variables +" %PARAM and %DESTINATION_DIR are filled in by vifm at runtime. +" A sample line might look like this: +" :filetype *.ssh FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR +" %PARAM value is filled from the first line of file (whole line). +" Example first line for SshMount filetype: root@127.0.0.1:/ +" +" You can also add %CLEAR if you want to clear screen before running FUSE +" program. + +" Pdf +filextype *.pdf zathura %c %i &, apvlv %c, xpdf %c +fileviewer *.pdf + \ vifmimg pdfpreview %px %py %pw %ph %c + \ %pc + \ vifmimg clear + " \ pdftotext -nopgbrk %c - + +" PostScript +filextype *.ps,*.eps,*.ps.gz + \ {View in zathura} + \ zathura %f, + \ {View in gv} + \ gv %c %i &, + +" Djvu +filextype *.djvu + \ {View in zathura} + \ zathura %f, + \ {View in apvlv} + \ apvlv %f, + +" Audio +filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus + \ {View using cmus} + \ alacritty -e cmus %f &, + \ {Play using ffplay} + \ ffplay -nodisp -autoexit %c, + \ {Play using MPlayer} + \ mplayer %f, +fileviewer *.mp3 mp3info +fileviewer *.flac soxi + +" Video +filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, + \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, + \*.as[fx] + \ {View using ffplay} + \ ffplay -fs -autoexit %f, + \ {View using Dragon} + \ dragon %f:p, + \ {View using mplayer} + \ mplayer %f, +fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, + \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, + \*.as[fx] + \ vifmimg videopreview %px %py %pw %ph %c + \ %pc + \ vifmimg clear + " \ ffprobe -pretty %c 2>&1 + +" Web +filextype *.html,*.htm + \ {Open with emacs} + \ emacsclient -c %c &, + \ {Open with vim} + \ vim %c &, + \ {Open with dwb} + \ dwb %f %i &, + \ {Open with firefox} + \ firefox %f &, + \ {Open with uzbl} + \ uzbl-browser %f %i &, +filetype *.html,*.htm links, lynx + +" Object +filetype *.o nm %f | less + +" Man page +filetype *.[1-8] man ./%c +fileviewer *.[1-8] man ./%c | col -b + +" Images +filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm + \ {View in sxiv} + \ sxiv -ia %f &, + \ {View in imv} + \ imv -b 1D2330 -d %d &, + \ {View in feh} + \ feh %d &, + \ {View in cacaview} + \ cacaview %c &, +fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm + \ vifmimg draw %px %py %pw %ph %c + \ %pc + \ vifmimg clear +fileviewer *.gif + \ vifmimg gifpreview %px %py %pw %ph %c + \ %pc + \ vifmimg clear + +" OpenRaster +filextype *.ora + \ {Edit in MyPaint} + \ mypaint %f, + +" Mindmap +filextype *.vym + \ {Open with VYM} + \ vym %f &, + +" MD5 +filetype *.md5 + \ {Check MD5 hash sum} + \ md5sum -c %f %S, + +" SHA1 +filetype *.sha1 + \ {Check SHA1 hash sum} + \ sha1sum -c %f %S, + +" SHA256 +filetype *.sha256 + \ {Check SHA256 hash sum} + \ sha256sum -c %f %S, + +" SHA512 +filetype *.sha512 + \ {Check SHA512 hash sum} + \ sha512sum -c %f %S, + +" GPG signature +filetype *.asc + \ {Check signature} + \ !!gpg --verify %c, + +" Torrent +filetype *.torrent ktorrent %f & +fileviewer *.torrent dumptorrent -v %c + +" FuseZipMount +filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg + \ {Mount with fuse-zip} + \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, + \ {View contents} + \ zip -sf %c | less, + \ {Extract here} + \ tar -xf %c, +fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c + +" ArchiveMount +filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz + \ {Mount with archivemount} + \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, +fileviewer *.tgz,*.tar.gz tar -tzf %c +fileviewer *.tar.bz2,*.tbz2 tar -tjf %c +fileviewer *.tar.txz,*.txz xz --list %c +fileviewer *.tar tar -tf %c + +" Rar2FsMount and rar archives +filetype *.rar + \ {Mount with rar2fs} + \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, +fileviewer *.rar unrar v %c + +" IsoMount +filetype *.iso + \ {Mount with fuseiso} + \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR, + +" SshMount +filetype *.ssh + \ {Mount with sshfs} + \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND, + +" FtpMount +filetype *.ftp + \ {Mount with curlftpfs} + \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND, + +" Fuse7z and 7z archives +filetype *.7z + \ {Mount with fuse-7z} + \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR, +fileviewer *.7z 7z l %c + +" Office files +filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx libreoffice %f & +fileviewer *.doc catdoc %c +fileviewer *.docx docx2txt.pl %f - + +" TuDu files +filetype *.tudu tudu -f %c + +" Qt projects +filextype *.pro qtcreator %f & + +" Directories +filextype */ + \ {View in thunar} + \ Thunar %f &, + +" Syntax highlighting in preview +" +" Explicitly set highlight type for some extensions +" +" 256-color terminal +" fileviewer *.[ch],*.[ch]pp highlight -O xterm256 -s dante --syntax c %c +" fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c +" +" 16-color terminal +" fileviewer *.c,*.h highlight -O ansi -s dante %c +" +" Or leave it for automatic detection +" +" fileviewer *[^/] pygmentize -O style=monokai -f console256 -g + +" Displaying pictures in terminal +" +" fileviewer *.jpg,*.png shellpic %c + +" Open all other files with default system programs (you can also remove all +" :file[x]type commands above to ensure they don't interfere with system-wide +" settings). By default all unknown files are opened with 'vi[x]cmd' +" uncommenting one of lines below will result in ignoring 'vi[x]cmd' option +" for unknown file types. +" For *nix: +" filetype * xdg-open +" For OS X: +" filetype * open +" For Windows: +" filetype * start, explorer + +" GETTING ICONS TO DISPLAY IN VIFM +" You need the next 14 lines! + +" file types +set classify=' :dir:/, :exe:, :reg:, :link:' +" various file names +set classify+=' ::../::, ::*.sh::, ::*.[hc]pp::, ::*.[hc]::, ::/^copying|license$/::, ::.git/,,*.git/::, ::*.epub,,*.fb2,,*.djvu::, ::*.pdf::, ::*.htm,,*.html,,**.[sx]html,,*.xml::' +" archives +set classify+=' ::*.7z,,*.ace,,*.arj,,*.bz2,,*.cpio,,*.deb,,*.dz,,*.gz,,*.jar,,*.lzh,,*.lzma,,*.rar,,*.rpm,,*.rz,,*.tar,,*.taz,,*.tb2,,*.tbz,,*.tbz2,,*.tgz,,*.tlz,,*.trz,,*.txz,,*.tz,,*.tz2,,*.xz,,*.z,,*.zip,,*.zoo::' +" images +set classify+=' ::*.bmp,,*.gif,,*.jpeg,,*.jpg,,*.ico,,*.png,,*.ppm,,*.svg,,*.svgz,,*.tga,,*.tif,,*.tiff,,*.xbm,,*.xcf,,*.xpm,,*.xspf,,*.xwd::' +" audio +set classify+=' ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::' +" media +set classify+=' ::*.avi,,*.ts,,*.axv,,*.divx,,*.m2v,,*.m4p,,*.m4v,,.mka,,*.mkv,,*.mov,,*.mp4,,*.flv,,*.mp4v,,*.mpeg,,*.mpg,,*.nuv,,*.ogv,,*.pbm,,*.pgm,,*.qt,,*.vob,,*.wmv,,*.xvid::' +" office files +set classify+=' ::*.doc,,*.docx::, ::*.xls,,*.xls[mx]::, ::*.pptx,,*.ppt::' + +" ------------------------------------------------------------------------------ + +" What should be saved automatically between vifm runs +" Like in previous versions of vifm +" set vifminfo=options,filetypes,commands,bookmarks,dhistory,state,cs +" Like in vi +set vifminfo=dhistory,savedirs,chistory,state,tui,shistory, + \phistory,fhistory,dirstack,registers,bookmarks,bmarks + +" ------------------------------------------------------------------------------ + +" Examples of configuring both panels + +" Customize view columns a bit (enable ellipsis for truncated file names) +" +" set viewcolumns=-{name}..,6{}. + +" Filter-out build and temporary files +" +" filter! /^.*\.(lo|o|d|class|py[co])$|.*~$/ + +" ------------------------------------------------------------------------------ + +" Sample mappings + +"Open all images in current directory in sxiv thumbnail mode +nnoremap sx :!sxiv -t %d & + +"Open selected images in gimp +nnoremap gp :!gimp %f & + +" Start shell in current directory +nnoremap s :shell + +" Display sorting dialog +nnoremap S :sort + +" Toggle visibility of preview window +nnoremap w :view +vnoremap w :viewgv + +" Open file in the background using its default program +nnoremap gb :file &l + +" Yank current directory path into the clipboard +nnoremap yd :!echo %d | xclip %i + +" Yank current file path into the clipboard +nnoremap yf :!echo %c:p | xclip %i + +" Mappings for faster renaming +nnoremap I cw +nnoremap cc cw +nnoremap A cw + +" Open console in current directory +nnoremap ,t :!xterm & + +" Open editor to edit vifmrc and apply settings after returning to vifm +nnoremap ,c :write | edit $MYVIFMRC | restart +" Open gvim to edit vifmrc +nnoremap ,C :!gvim --remote-tab-silent $MYVIFMRC & + +" Toggle wrap setting on ,w key +nnoremap ,w :set wrap! + +" Example of standard two-panel file managers mappings +nnoremap :!less %f +nnoremap :edit +nnoremap :copy +nnoremap :move +nnoremap :mkdir +nnoremap :delete + +" ------------------------------------------------------------------------------ + +" Various customization examples + +" Use ag (the silver searcher) instead of grep +" +" set grepprg='ag --line-numbers %i %a %s' + +" Add additional place to look for executables +" +" let $PATH = $HOME.'/bin/fuse:'.$PATH + +" Block particular shortcut +" +" nnoremap + +" Export IPC name of current instance as environment variable and use it to +" communicate with the instance later. +" +" It can be used in some shell script that gets run from inside vifm, for +" example, like this: +" vifm --server-name "$VIFM_SERVER_NAME" --remote +"cd '$PWD'" +" +" let $VIFM_SERVER_NAME = v:servername