added stuff
872
config/alacritty/alacritty.yml
Executable file
|
@ -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 }
|
24
config/awesome/awesome-wm-widgets/.luacheckrc
Normal file
|
@ -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",
|
||||||
|
}
|
74
config/awesome/awesome-wm-widgets/battery-widget/README.md
Normal file
|
@ -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(),
|
||||||
|
...
|
||||||
|
```
|
BIN
config/awesome/awesome-wm-widgets/battery-widget/bat-wid-1.png
Normal file
After Width: | Height: | Size: 700 B |
BIN
config/awesome/awesome-wm-widgets/battery-widget/bat-wid-2.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
config/awesome/awesome-wm-widgets/battery-widget/bat-wid-22.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
config/awesome/awesome-wm-widgets/battery-widget/bat-wid-3.png
Normal file
After Width: | Height: | Size: 14 KiB |
200
config/awesome/awesome-wm-widgets/battery-widget/battery.lua
Normal file
|
@ -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 })
|
BIN
config/awesome/awesome-wm-widgets/battery-widget/spaceman.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
|
@ -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.
|
BIN
config/awesome/awesome-wm-widgets/brightness-widget/br-wid-1.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
|
@ -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' -- <level>
|
||||||
|
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' -- <level>
|
||||||
|
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%%' -- <level>
|
||||||
|
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 })
|
|
@ -0,0 +1,153 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
id="svg2"
|
||||||
|
sodipodi:version="0.32"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
version="1.0"
|
||||||
|
sodipodi:docname="display-brightness-symbolic.svg"
|
||||||
|
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||||
|
style="display:inline">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#e7e7e7"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="44.218752"
|
||||||
|
inkscape:cx="12.155025"
|
||||||
|
inkscape:cy="7.6228779"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
showguides="false"
|
||||||
|
inkscape:guide-bbox="true"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1029"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:snap-global="true">
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="1,0"
|
||||||
|
position="0,112"
|
||||||
|
id="guide2383" />
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="0,1"
|
||||||
|
position="26.278146,128"
|
||||||
|
id="guide2385" />
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="1,0"
|
||||||
|
position="128,54.082119"
|
||||||
|
id="guide2387" />
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="0,1"
|
||||||
|
position="78.156291,0"
|
||||||
|
id="guide2389" />
|
||||||
|
<sodipodi:guide
|
||||||
|
orientation="0,1"
|
||||||
|
position="60.863576,64.084768"
|
||||||
|
id="guide2391" />
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid3672"
|
||||||
|
visible="true"
|
||||||
|
enabled="true"
|
||||||
|
empspacing="8"
|
||||||
|
snapvisiblegridlinesonly="true" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Icon"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
style="display:inline"
|
||||||
|
transform="translate(0,-6)">
|
||||||
|
<path
|
||||||
|
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||||
|
d="m -12,6 -1,3 2,0 -1,-3 z m -5.65625,2.34375 1.40625,2.8125 1.40625,-1.40625 -2.8125,-1.40625 z m 11.3125,0 L -9.15625,9.75 -7.75,11.15625 -6.34375,8.34375 z M -12,10 c -2.209139,0 -4,1.790861 -4,4 0,2.209139 1.790861,4 4,4 2.209139,0 4,-1.790861 4,-4 0,-2.209139 -1.790861,-4 -4,-4 z m 0,1.5 c 1.380712,0 2.5,1.119288 2.5,2.5 0,1.380712 -1.119288,2.5 -2.5,2.5 -1.380712,0 -2.5,-1.119288 -2.5,-2.5 0,-1.380712 1.119288,-2.5 2.5,-2.5 z m -5,1.5 -3,1 3,1 0,-2 z m 10,0 0,2 3,-1 -3,-1 z m -9.25,3.84375 -1.40625,2.8125 2.8125,-1.40625 -1.40625,-1.40625 z m 8.5,0 -1.40625,1.40625 2.8125,1.40625 L -7.75,16.84375 z M -13,19 l 1,3 1,-3 -2,0 z"
|
||||||
|
id="path3085"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
id="path3102"
|
||||||
|
d="m 8,30 c -2.209139,0 -4,1.790861 -4,4 0,2.209139 1.790861,4 4,4 2.209139,0 4,-1.790861 4,-4 0,-2.209139 -1.790861,-4 -4,-4 z m 0,2 c 1.1045695,0 2,0.89543 2,2 0,1.104569 -0.8954305,2 -2,2 -1.1045695,0 -2,-0.895431 -2,-2 0,-1.10457 0.8954305,-2 2,-2 z"
|
||||||
|
style="opacity:0.35;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
inkscape:transform-center-y="-6.5"
|
||||||
|
sodipodi:nodetypes="cccc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path3104"
|
||||||
|
d="m 6,29 4,0 -2,-3 z"
|
||||||
|
style="fill:#808080;stroke:none" />
|
||||||
|
<path
|
||||||
|
inkscape:transform-center-y="-2.4999999"
|
||||||
|
inkscape:transform-center-x="-5.1291655"
|
||||||
|
style="fill:#808080;stroke:none"
|
||||||
|
d="m 11.330127,29.767949 2,3.464102 L 14.928204,30 z"
|
||||||
|
id="path3106"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="cccc" />
|
||||||
|
<path
|
||||||
|
sodipodi:nodetypes="cccc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path3108"
|
||||||
|
d="m 13.330127,34.767949 -2,3.464102 L 14.928203,38 z"
|
||||||
|
style="fill:#808080;stroke:none"
|
||||||
|
inkscape:transform-center-x="-5.129165"
|
||||||
|
inkscape:transform-center-y="2.5" />
|
||||||
|
<path
|
||||||
|
inkscape:transform-center-y="6.5"
|
||||||
|
style="fill:#808080;stroke:none"
|
||||||
|
d="m 10,39 -4.0000002,0 2.0000001,3 z"
|
||||||
|
id="path3110"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="cccc" />
|
||||||
|
<path
|
||||||
|
inkscape:transform-center-x="5.1291651"
|
||||||
|
sodipodi:nodetypes="cccc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path3112"
|
||||||
|
d="M 4.6698729,38.232051 2.6698728,34.767949 1.0717967,38 z"
|
||||||
|
style="fill:#808080;stroke:none"
|
||||||
|
inkscape:transform-center-y="2.5" />
|
||||||
|
<path
|
||||||
|
inkscape:transform-center-y="-2.5"
|
||||||
|
style="fill:#808080;stroke:none"
|
||||||
|
d="M 2.6698727,33.232051 4.669873,29.767949 1.0717967,30 z"
|
||||||
|
id="path3114"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="cccc"
|
||||||
|
inkscape:transform-center-x="5.129165" />
|
||||||
|
<path
|
||||||
|
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||||
|
d="M 5.84375 0 L 5.09375 2.96875 L 2.15625 2.15625 L 2.96875 5.09375 L 0 5.84375 L 2.1875 8 L 0 10.15625 L 2.96875 10.90625 L 2.15625 13.84375 L 5.09375 13.03125 L 5.84375 16 L 8 13.8125 L 10.15625 16 L 10.90625 13.03125 L 13.84375 13.84375 L 13.03125 10.90625 L 16 10.15625 L 13.8125 8 L 16 5.84375 L 13.03125 5.09375 L 13.84375 2.15625 L 10.90625 2.96875 L 10.15625 0 L 8 2.1875 L 5.84375 0 z M 8 3 C 10.761424 3 13 5.2385763 13 8 C 13 10.761424 10.761424 13 8 13 L 8 3 z "
|
||||||
|
transform="translate(0,6)"
|
||||||
|
id="path3075" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 6.3 KiB |
|
@ -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 |
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ECEFF4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-lock"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>
|
After Width: | Height: | Size: 316 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ECEFF4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>
|
After Width: | Height: | Size: 362 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ECEFF4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
|
After Width: | Height: | Size: 276 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#BF616A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-power"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg>
|
After Width: | Height: | Size: 303 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ECEFF4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-power"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg>
|
After Width: | Height: | Size: 303 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ECEFF4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-refresh-cw"><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg>
|
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 46 KiB |
|
@ -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 })
|
119
config/awesome/awesome-wm-widgets/volume-widget/README.md
Normal file
|
@ -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|
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="16"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
height="16"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r"
|
||||||
|
sodipodi:docname="audio-volume-high-symbolic.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata30">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1215"
|
||||||
|
inkscape:window-height="776"
|
||||||
|
id="namedview28"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="38.125"
|
||||||
|
inkscape:cx="8"
|
||||||
|
inkscape:cy="8"
|
||||||
|
inkscape:window-x="65"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:snap-intersection-paths="false"
|
||||||
|
inkscape:object-paths="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid4158" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<path
|
||||||
|
d="M 6,2 2,6 2,10 6,14 6,9 7,8 6,7 Z"
|
||||||
|
id="path18"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#bebebe"
|
||||||
|
sodipodi:nodetypes="cccccccc" />
|
||||||
|
<path
|
||||||
|
d="M 1.300003,5 C 0.216589,5 0,6.163269 0,7.4 L 0,8.6 C 0,9.836747 0.24312,11 1.300003,11 L 3,11 3,5 Z"
|
||||||
|
id="path20"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#bebebe"
|
||||||
|
sodipodi:nodetypes="ssssccs" />
|
||||||
|
<path
|
||||||
|
style="opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 13.140638,1 11.726417,2.413582 C 12.808349,3.4955144 13.990412,5.4467621 14,8 c 0,2.551493 -1.192916,4.505751 -2.273583,5.586418 L 13.140638,15 C 14.595711,13.544927 16.019176,11 16,8 16.035061,5 14.595117,2.4544787 13.140638,1 Z"
|
||||||
|
id="path4508"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
<path
|
||||||
|
style="opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 11,3.1156678 9.5897193,4.5261118 C 10.372347,5.3087395 11,6.5690611 11,8 11,9.4309388 10.372767,10.690952 9.5897193,11.474 L 11,12.884 C 12.275645,11.608355 13,9.854095 13,8 13,6.1543677 12.273068,4.3887355 11,3.1156678 Z"
|
||||||
|
id="path4529"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
<path
|
||||||
|
style="opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 8.629,5 7.2094668,6.4096296 C 8,7.05621 8,7.805653 8,8 8,8.1932576 7.982199,8.9408674 7.209,9.59 L 8.6289063,11 C 9.8466375,9.952694 10,8.5984701 10,8 10,7.400497 9.854476,6.062891 8.629,5 Z"
|
||||||
|
id="path4569"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccscccc" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1,88 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="16"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
height="16"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r"
|
||||||
|
sodipodi:docname="audio-volume-low-symbolic.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata30">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1215"
|
||||||
|
inkscape:window-height="776"
|
||||||
|
id="namedview28"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="38.125"
|
||||||
|
inkscape:cx="8"
|
||||||
|
inkscape:cy="8"
|
||||||
|
inkscape:window-x="65"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:snap-intersection-paths="false"
|
||||||
|
inkscape:object-paths="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid4158" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<path
|
||||||
|
d="M 6,2 2,6 2,10 6,14 6,9 7,8 6,7 Z"
|
||||||
|
id="path18"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#bebebe"
|
||||||
|
sodipodi:nodetypes="cccccccc" />
|
||||||
|
<path
|
||||||
|
d="M 1.300003,5 C 0.216589,5 0,6.163269 0,7.4 L 0,8.6 C 0,9.836747 0.24312,11 1.300003,11 L 3,11 3,5 Z"
|
||||||
|
id="path20"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#bebebe"
|
||||||
|
sodipodi:nodetypes="ssssccs" />
|
||||||
|
<path
|
||||||
|
style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 13.140638,1 11.726417,2.413582 C 12.808349,3.4955144 13.990412,5.4467621 14,8 c 0,2.551493 -1.192916,4.505751 -2.273583,5.586418 L 13.140638,15 C 14.595711,13.544927 16.019176,11 16,8 16.035061,5 14.595117,2.4544787 13.140638,1 Z"
|
||||||
|
id="path4508"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
<path
|
||||||
|
style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 11,3.1156678 9.5897193,4.5261118 C 10.372347,5.3087395 11,6.5690611 11,8 11,9.4309388 10.372767,10.690952 9.5897193,11.474 L 11,12.884 C 12.275645,11.608355 13,9.854095 13,8 13,6.1543677 12.273068,4.3887355 11,3.1156678 Z"
|
||||||
|
id="path4529"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
<path
|
||||||
|
style="opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 8.629,5 7.2094668,6.4096296 C 8,7.05621 8,7.805653 8,8 8,8.1932576 7.982199,8.9408674 7.209,9.59 L 8.6289063,11 C 9.8466375,9.952694 10,8.5984701 10,8 10,7.400497 9.854476,6.062891 8.629,5 Z"
|
||||||
|
id="path4569"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccscccc" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1,88 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="16"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
height="16"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r"
|
||||||
|
sodipodi:docname="audio-volume-medium-symbolic.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata30">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1215"
|
||||||
|
inkscape:window-height="776"
|
||||||
|
id="namedview28"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="38.125"
|
||||||
|
inkscape:cx="8"
|
||||||
|
inkscape:cy="8"
|
||||||
|
inkscape:window-x="65"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:snap-intersection-paths="false"
|
||||||
|
inkscape:object-paths="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid4158" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<path
|
||||||
|
d="M 6,2 2,6 2,10 6,14 6,9 7,8 6,7 Z"
|
||||||
|
id="path18"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#bebebe"
|
||||||
|
sodipodi:nodetypes="cccccccc" />
|
||||||
|
<path
|
||||||
|
d="M 1.300003,5 C 0.216589,5 0,6.163269 0,7.4 L 0,8.6 C 0,9.836747 0.24312,11 1.300003,11 L 3,11 3,5 Z"
|
||||||
|
id="path20"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#bebebe"
|
||||||
|
sodipodi:nodetypes="ssssccs" />
|
||||||
|
<path
|
||||||
|
style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 13.140638,1 11.726417,2.413582 C 12.808349,3.4955144 13.990412,5.4467621 14,8 c 0,2.551493 -1.192916,4.505751 -2.273583,5.586418 L 13.140638,15 C 14.595711,13.544927 16.019176,11 16,8 16.035061,5 14.595117,2.4544787 13.140638,1 Z"
|
||||||
|
id="path4508"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
<path
|
||||||
|
style="opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 11,3.1156678 9.5897193,4.5261118 C 10.372347,5.3087395 11,6.5690611 11,8 11,9.4309388 10.372767,10.690952 9.5897193,11.474 L 11,12.884 C 12.275645,11.608355 13,9.854095 13,8 13,6.1543677 12.273068,4.3887355 11,3.1156678 Z"
|
||||||
|
id="path4529"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
<path
|
||||||
|
style="opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 8.629,5 7.2094668,6.4096296 C 8,7.05621 8,7.805653 8,8 8,8.1932576 7.982199,8.9408674 7.209,9.59 L 8.6289063,11 C 9.8466375,9.952694 10,8.5984701 10,8 10,7.400497 9.854476,6.062891 8.629,5 Z"
|
||||||
|
id="path4569"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccscccc" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1,88 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="16"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
height="16"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="audio-volume-muted-symbolic.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata30">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1215"
|
||||||
|
inkscape:window-height="776"
|
||||||
|
id="namedview28"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="38.125"
|
||||||
|
inkscape:cx="3.4229508"
|
||||||
|
inkscape:cy="7.947541"
|
||||||
|
inkscape:window-x="65"
|
||||||
|
inkscape:window-y="24"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:snap-intersection-paths="false"
|
||||||
|
inkscape:object-paths="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid4158" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<path
|
||||||
|
d="M 6,2 2,6 2,10 6,14 6,9 7,8 6,7 Z"
|
||||||
|
id="path18"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#bebebe"
|
||||||
|
sodipodi:nodetypes="cccccccc" />
|
||||||
|
<path
|
||||||
|
d="M 1.300003,5 C 0.216589,5 0,6.163269 0,7.4 L 0,8.6 C 0,9.836747 0.24312,11 1.300003,11 L 3,11 3,5 Z"
|
||||||
|
id="path20"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#bebebe"
|
||||||
|
sodipodi:nodetypes="ssssccs" />
|
||||||
|
<path
|
||||||
|
style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 13.140638,1 11.726417,2.413582 C 12.808349,3.4955144 13.990412,5.4467621 14,8 c 0,2.551493 -1.192916,4.505751 -2.273583,5.586418 L 13.140638,15 C 14.595711,13.544927 16.019176,11 16,8 16.035061,5 14.595117,2.4544787 13.140638,1 Z"
|
||||||
|
id="path4508"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
<path
|
||||||
|
style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 11,3.1156678 9.5897193,4.5261118 C 10.372347,5.3087395 11,6.5690611 11,8 11,9.4309388 10.372767,10.690952 9.5897193,11.474 L 11,12.884 C 12.275645,11.608355 13,9.854095 13,8 13,6.1543677 12.273068,4.3887355 11,3.1156678 Z"
|
||||||
|
id="path4529"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccccccc" />
|
||||||
|
<path
|
||||||
|
style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 8.629,5 7.2094668,6.4096296 C 8,7.05621 8,7.805653 8,8 8,8.1932576 7.982199,8.9408674 7.209,9.59 L 8.6289063,11 C 9.8466375,9.952694 10,8.5984701 10,8 10,7.400497 9.854476,6.062891 8.629,5 Z"
|
||||||
|
id="path4569"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccscccc" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 72 KiB |
105
config/awesome/awesome-wm-widgets/volume-widget/utils.lua
Normal file
|
@ -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
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-2"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"></path></svg>
|
After Width: | Height: | Size: 354 B |
228
config/awesome/awesome-wm-widgets/volume-widget/volume.lua
Normal file
|
@ -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 = "<b>" .. text .. "</b>",
|
||||||
|
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 })
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
645
config/awesome/config.org
Normal file
|
@ -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
|
203
config/awesome/lain/helpers.lua
Executable file
|
@ -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
|
BIN
config/awesome/lain/icons/cal/black/1.png
Executable file
After Width: | Height: | Size: 836 B |
BIN
config/awesome/lain/icons/cal/black/10.png
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
config/awesome/lain/icons/cal/black/11.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
config/awesome/lain/icons/cal/black/12.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
config/awesome/lain/icons/cal/black/13.png
Executable file
After Width: | Height: | Size: 2.4 KiB |
BIN
config/awesome/lain/icons/cal/black/14.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
config/awesome/lain/icons/cal/black/15.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
config/awesome/lain/icons/cal/black/16.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/black/17.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
config/awesome/lain/icons/cal/black/18.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
config/awesome/lain/icons/cal/black/19.png
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
config/awesome/lain/icons/cal/black/2.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
config/awesome/lain/icons/cal/black/20.png
Executable file
After Width: | Height: | Size: 2.5 KiB |
BIN
config/awesome/lain/icons/cal/black/21.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/black/22.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
config/awesome/lain/icons/cal/black/23.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
config/awesome/lain/icons/cal/black/24.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/black/25.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/black/26.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
config/awesome/lain/icons/cal/black/27.png
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
config/awesome/lain/icons/cal/black/28.png
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
config/awesome/lain/icons/cal/black/29.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
config/awesome/lain/icons/cal/black/3.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
config/awesome/lain/icons/cal/black/30.png
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
config/awesome/lain/icons/cal/black/31.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
config/awesome/lain/icons/cal/black/4.png
Executable file
After Width: | Height: | Size: 1 KiB |
BIN
config/awesome/lain/icons/cal/black/5.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
config/awesome/lain/icons/cal/black/6.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
config/awesome/lain/icons/cal/black/7.png
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
config/awesome/lain/icons/cal/black/8.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
config/awesome/lain/icons/cal/black/9.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
config/awesome/lain/icons/cal/white/1.png
Executable file
After Width: | Height: | Size: 714 B |
BIN
config/awesome/lain/icons/cal/white/10.png
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
config/awesome/lain/icons/cal/white/11.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
config/awesome/lain/icons/cal/white/12.png
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
config/awesome/lain/icons/cal/white/13.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/white/14.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
config/awesome/lain/icons/cal/white/15.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
config/awesome/lain/icons/cal/white/16.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/white/17.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
config/awesome/lain/icons/cal/white/18.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
config/awesome/lain/icons/cal/white/19.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/white/2.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
config/awesome/lain/icons/cal/white/20.png
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
config/awesome/lain/icons/cal/white/21.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/white/22.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
config/awesome/lain/icons/cal/white/23.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
config/awesome/lain/icons/cal/white/24.png
Executable file
After Width: | Height: | Size: 2 KiB |
BIN
config/awesome/lain/icons/cal/white/25.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
config/awesome/lain/icons/cal/white/26.png
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
config/awesome/lain/icons/cal/white/27.png
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
config/awesome/lain/icons/cal/white/28.png
Executable file
After Width: | Height: | Size: 2.4 KiB |
BIN
config/awesome/lain/icons/cal/white/29.png
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
config/awesome/lain/icons/cal/white/3.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
config/awesome/lain/icons/cal/white/30.png
Executable file
After Width: | Height: | Size: 2.7 KiB |
BIN
config/awesome/lain/icons/cal/white/31.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
config/awesome/lain/icons/cal/white/4.png
Executable file
After Width: | Height: | Size: 1,000 B |
BIN
config/awesome/lain/icons/cal/white/5.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
config/awesome/lain/icons/cal/white/6.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
config/awesome/lain/icons/cal/white/7.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
config/awesome/lain/icons/cal/white/8.png
Executable file
After Width: | Height: | Size: 1.8 KiB |