Port a few more options to zenity and separate dwm from the install script
5
config-files/.Xresources
Normal file
@@ -0,0 +1,5 @@
|
||||
# Change Xorg display scaling if needed.
|
||||
|
||||
# Xft.dpi: 192 # 200% Scale
|
||||
# Xft.dpi: 160 # 166% Scale
|
||||
# Xft.dpi: 96 # Default
|
||||
100
config-files/.bashrc
Normal file
@@ -0,0 +1,100 @@
|
||||
export EDITOR="nvim";
|
||||
export PS1="\n[\[\e[37m\]\u\[\e[0m\]@\[\e[37;2m\]\h\[\e[0m\]] \[\e[1m\]\w \[\e[0;2m\]J:\[\e[0m\]\j\n\$ ";
|
||||
|
||||
extract() {
|
||||
if [ -f $1 ]; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf $1 ;;
|
||||
*.tar.gz) tar xzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar e $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
pushall() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Usage: pushall \"commit message\""
|
||||
else
|
||||
git pull
|
||||
git diff
|
||||
read -p "Press ENTER to continue..."
|
||||
git add -A
|
||||
git commit -m "$@"
|
||||
git push
|
||||
fi
|
||||
}
|
||||
|
||||
hex2color(){
|
||||
hex=${1#"#"}
|
||||
r=$(printf '0x%0.2s' "$hex")
|
||||
g=$(printf '0x%0.2s' ${hex#??})
|
||||
b=$(printf '0x%0.2s' ${hex#????})
|
||||
printf '%03d' "$(( (r<75?0:(r-35)/40)*6*6 +
|
||||
(g<75?0:(g-35)/40)*6 +
|
||||
(b<75?0:(b-35)/40) + 16 ))"
|
||||
}
|
||||
|
||||
color2hex(){
|
||||
dec=$(($1%256)) ### input must be a number in range 0-255.
|
||||
if [ "$dec" -lt "16" ]; then
|
||||
bas=$(( dec%16 ))
|
||||
mul=128
|
||||
[ "$bas" -eq "7" ] && mul=192
|
||||
[ "$bas" -eq "8" ] && bas=7
|
||||
[ "$bas" -gt "8" ] && mul=255
|
||||
a="$(( (bas&1) *mul ))"
|
||||
b="$(( ((bas&2)>>1)*mul ))"
|
||||
c="$(( ((bas&4)>>2)*mul ))"
|
||||
printf 'dec= %3s basic= #%02x%02x%02x\n' "$dec" "$a" "$b" "$c"
|
||||
elif [ "$dec" -gt 15 ] && [ "$dec" -lt 232 ]; then
|
||||
b=$(( (dec-16)%6 )); b=$(( b==0?0: b*40 + 55 ))
|
||||
g=$(( (dec-16)/6%6)); g=$(( g==0?0: g*40 + 55 ))
|
||||
r=$(( (dec-16)/36 )); r=$(( r==0?0: r*40 + 55 ))
|
||||
printf 'dec= %3s color= #%02x%02x%02x\n' "$dec" "$r" "$g" "$b"
|
||||
else
|
||||
gray=$(( (dec-232)*10+8 ))
|
||||
printf 'dec= %3s gray= #%02x%02x%02x\n' "$dec" "$gray" "$gray" "$gray"
|
||||
fi
|
||||
}
|
||||
|
||||
# Commands that should be applied only for interactive shells.
|
||||
[[ $- == *i* ]] || return
|
||||
|
||||
HISTFILESIZE=100000
|
||||
HISTSIZE=10000
|
||||
|
||||
shopt -s histappend
|
||||
shopt -s checkwinsize
|
||||
shopt -s extglob
|
||||
shopt -s globstar
|
||||
shopt -s checkjobs
|
||||
|
||||
alias l='ls -alh'
|
||||
alias ls='ls --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
alias ll='ls -lhi'
|
||||
alias ta='tmux attach'
|
||||
alias t='tmux'
|
||||
alias v='nvim'
|
||||
alias cpp='rsync -ah --progress'
|
||||
|
||||
set completion-ignore-case On
|
||||
|
||||
# Use bash-completion, if available
|
||||
[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
|
||||
export OFLAGS="--ozone-platform-hint=auto"
|
||||
|
||||
export PATH=$PATH:/home/trude/.local/bin
|
||||
436
config-files/.config/dunst/dunstrc
Normal file
@@ -0,0 +1,436 @@
|
||||
# See dunst(5) for all configuration options
|
||||
|
||||
[global]
|
||||
### Display ###
|
||||
|
||||
# Which monitor should the notifications be displayed on.
|
||||
monitor = 0
|
||||
|
||||
# Display notification on focused monitor. Possible modes are:
|
||||
# mouse: follow mouse pointer
|
||||
# keyboard: follow window with keyboard focus
|
||||
# none: don't follow anything
|
||||
#
|
||||
# "keyboard" needs a window manager that exports the
|
||||
# _NET_ACTIVE_WINDOW property.
|
||||
# This should be the case for almost all modern window managers.
|
||||
#
|
||||
# If this option is set to mouse or keyboard, the monitor option
|
||||
# will be ignored.
|
||||
follow = mouse
|
||||
|
||||
### Geometry ###
|
||||
|
||||
# dynamic width from 0 to 300
|
||||
# width = (0, 300)
|
||||
# constant width of 300
|
||||
width = 400
|
||||
|
||||
# The maximum height of a single notification, excluding the frame.
|
||||
height = 400
|
||||
|
||||
# Position the notification in the top right corner
|
||||
origin = top-center
|
||||
|
||||
# Offset from the origin
|
||||
offset = 10x10
|
||||
|
||||
# Scale factor. It is auto-detected if value is 0.
|
||||
scale = 0
|
||||
|
||||
# Maximum number of notification (0 means no limit)
|
||||
notification_limit = 4
|
||||
|
||||
### Progress bar ###
|
||||
|
||||
# Turn on the progess bar. It appears when a progress hint is passed with
|
||||
# for example dunstify -h int:value:12
|
||||
progress_bar = true
|
||||
|
||||
# Set the progress bar height. This includes the frame, so make sure
|
||||
# it's at least twice as big as the frame width.
|
||||
progress_bar_height = 10
|
||||
|
||||
# Set the frame width of the progress bar
|
||||
progress_bar_frame_width = 1
|
||||
|
||||
# Set the minimum width for the progress bar
|
||||
progress_bar_min_width = 150
|
||||
|
||||
# Set the maximum width for the progress bar
|
||||
progress_bar_max_width = 300
|
||||
|
||||
|
||||
# Show how many messages are currently hidden (because of
|
||||
# notification_limit).
|
||||
indicate_hidden = yes
|
||||
|
||||
# The transparency of the window. Range: [0; 100].
|
||||
# This option will only work if a compositing window manager is
|
||||
# present (e.g. xcompmgr, compiz, etc.). (X11 only)
|
||||
transparency = 15
|
||||
|
||||
# Draw a line of "separator_height" pixel height between two
|
||||
# notifications.
|
||||
# Set to 0 to disable.
|
||||
separator_height = 1
|
||||
|
||||
# Padding between text and separator.
|
||||
padding = 8
|
||||
|
||||
# Horizontal padding.
|
||||
horizontal_padding = 10
|
||||
|
||||
# Padding between text and icon.
|
||||
text_icon_padding = 0
|
||||
|
||||
# Defines width in pixels of frame around the notification window.
|
||||
# Set to 0 to disable.
|
||||
frame_width = 2
|
||||
|
||||
# Defines color of the frame around the notification window.
|
||||
frame_color = "#ebdbb2"
|
||||
|
||||
# Define a color for the separator.
|
||||
# possible values are:
|
||||
# * auto: dunst tries to find a color fitting to the background;
|
||||
# * foreground: use the same color as the foreground;
|
||||
# * frame: use the same color as the frame;
|
||||
# * anything else will be interpreted as a X color.
|
||||
separator_color = frame
|
||||
|
||||
# Sort messages by urgency.
|
||||
sort = yes
|
||||
|
||||
# Don't remove messages, if the user is idle (no mouse or keyboard input)
|
||||
# for longer than idle_threshold seconds.
|
||||
# Set to 0 to disable.
|
||||
# A client can set the 'transient' hint to bypass this. See the rules
|
||||
# section for how to disable this if necessary
|
||||
idle_threshold = 120
|
||||
|
||||
### Text ###
|
||||
|
||||
font = JetBrains Mono Nerd Font 10
|
||||
|
||||
# The spacing between lines. If the height is smaller than the
|
||||
# font height, it will get raised to the font height.
|
||||
line_height = 0
|
||||
|
||||
# Possible values are:
|
||||
# full: Allow a small subset of html markup in notifications:
|
||||
# <b>bold</b>
|
||||
# <i>italic</i>
|
||||
# <s>strikethrough</s>
|
||||
# <u>underline</u>
|
||||
#
|
||||
# For a complete reference see
|
||||
# <https://developer.gnome.org/pango/stable/pango-Markup.html>.
|
||||
#
|
||||
# strip: This setting is provided for compatibility with some broken
|
||||
# clients that send markup even though it's not enabled on the
|
||||
# server. Dunst will try to strip the markup but the parsing is
|
||||
# simplistic so using this option outside of matching rules for
|
||||
# specific applications *IS GREATLY DISCOURAGED*.
|
||||
#
|
||||
# no: Disable markup parsing, incoming notifications will be treated as
|
||||
# plain text. Dunst will not advertise that it has the body-markup
|
||||
# capability if this is set as a global setting.
|
||||
#
|
||||
# It's important to note that markup inside the format option will be parsed
|
||||
# regardless of what this is set to.
|
||||
markup = full
|
||||
|
||||
# The format of the message. Possible variables are:
|
||||
# %a appname
|
||||
# %s summary
|
||||
# %b body
|
||||
# %i iconname (including its path)
|
||||
# %I iconname (without its path)
|
||||
# %p progress value if set ([ 0%] to [100%]) or nothing
|
||||
# %n progress value if set without any extra characters
|
||||
# %% Literal %
|
||||
# Markup is allowed
|
||||
format = "%s %p\n%b"
|
||||
|
||||
# Alignment of message text.
|
||||
# Possible values are "left", "center" and "right".
|
||||
alignment = center
|
||||
|
||||
# Vertical alignment of message text and icon.
|
||||
# Possible values are "top", "center" and "bottom".
|
||||
vertical_alignment = center
|
||||
|
||||
# Show age of message if message is older than show_age_threshold
|
||||
# seconds.
|
||||
# Set to -1 to disable.
|
||||
show_age_threshold = 60
|
||||
|
||||
# Specify where to make an ellipsis in long lines.
|
||||
# Possible values are "start", "middle" and "end".
|
||||
ellipsize = middle
|
||||
|
||||
# Ignore newlines '\n' in notifications.
|
||||
ignore_newline = no
|
||||
|
||||
# Stack together notifications with the same content
|
||||
stack_duplicates = true
|
||||
|
||||
# Hide the count of stacked notifications with the same content
|
||||
hide_duplicate_count = false
|
||||
|
||||
# Display indicators for URLs (U) and actions (A).
|
||||
show_indicators = yes
|
||||
|
||||
### Icons ###
|
||||
|
||||
# Align icons left/right/off
|
||||
icon_position = left
|
||||
|
||||
# Scale small icons up to this size, set to 0 to disable. Helpful
|
||||
# for e.g. small files or high-dpi screens. In case of conflict,
|
||||
# max_icon_size takes precedence over this.
|
||||
min_icon_size = 0
|
||||
|
||||
# Scale larger icons down to this size, set to 0 to disable
|
||||
max_icon_size = 64
|
||||
|
||||
# Paths to default icons.
|
||||
icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
|
||||
|
||||
### History ###
|
||||
|
||||
# Should a notification popped up from history be sticky or timeout
|
||||
# as if it would normally do.
|
||||
sticky_history = yes
|
||||
|
||||
# Maximum amount of notifications kept in history
|
||||
history_length = 20
|
||||
|
||||
### Misc/Advanced ###
|
||||
|
||||
# dmenu path.
|
||||
dmenu = dmenu -p dunst:
|
||||
|
||||
# Browser for opening urls in context menu.
|
||||
browser = firefox -new-tab
|
||||
|
||||
# Always run rule-defined scripts, even if the notification is suppressed
|
||||
always_run_script = true
|
||||
|
||||
# Define the title of the windows spawned by dunst
|
||||
title = Dunst
|
||||
|
||||
# Define the class of the windows spawned by dunst
|
||||
class = Dunst
|
||||
|
||||
# Define the corner radius of the notification window
|
||||
# in pixel size. If the radius is 0, you have no rounded
|
||||
# corners.
|
||||
# The radius will be automatically lowered if it exceeds half of the
|
||||
# notification height to avoid clipping text and/or icons.
|
||||
corner_radius = 0
|
||||
|
||||
# Ignore the dbus closeNotification message.
|
||||
# Useful to enforce the timeout set by dunst configuration. Without this
|
||||
# parameter, an application may close the notification sent before the
|
||||
# user defined timeout.
|
||||
ignore_dbusclose = false
|
||||
|
||||
### Wayland ###
|
||||
# These settings are Wayland-specific. They have no effect when using X11
|
||||
|
||||
# Uncomment this if you want to let notications appear under fullscreen
|
||||
# applications (default: overlay)
|
||||
# layer = top
|
||||
|
||||
# Set this to true to use X11 output on Wayland.
|
||||
force_xwayland = false
|
||||
|
||||
### Legacy
|
||||
|
||||
# Use the Xinerama extension instead of RandR for multi-monitor support.
|
||||
# This setting is provided for compatibility with older nVidia drivers that
|
||||
# do not support RandR and using it on systems that support RandR is highly
|
||||
# discouraged.
|
||||
#
|
||||
# By enabling this setting dunst will not be able to detect when a monitor
|
||||
# is connected or disconnected which might break follow mode if the screen
|
||||
# layout changes.
|
||||
force_xinerama = false
|
||||
|
||||
### mouse
|
||||
|
||||
# Defines list of actions for each mouse event
|
||||
# Possible values are:
|
||||
# * none: Don't do anything.
|
||||
# * do_action: Invoke the action determined by the action_name rule. If there is no
|
||||
# such action, open the context menu.
|
||||
# * open_url: If the notification has exactly one url, open it. If there are multiple
|
||||
# ones, open the context menu.
|
||||
# * close_current: Close current notification.
|
||||
# * close_all: Close all notifications.
|
||||
# * context: Open context menu for the notification.
|
||||
# * context_all: Open context menu for all notifications.
|
||||
# These values can be strung together for each mouse event, and
|
||||
# will be executed in sequence.
|
||||
mouse_left_click = close_current
|
||||
mouse_middle_click = do_action, close_current
|
||||
mouse_right_click = close_all
|
||||
|
||||
# Experimental features that may or may not work correctly. Do not expect them
|
||||
# to have a consistent behaviour across releases.
|
||||
[experimental]
|
||||
# Calculate the dpi to use on a per-monitor basis.
|
||||
# If this setting is enabled the Xft.dpi value will be ignored and instead
|
||||
# dunst will attempt to calculate an appropriate dpi value for each monitor
|
||||
# using the resolution and physical size. This might be useful in setups
|
||||
# where there are multiple screens with very different dpi values.
|
||||
per_monitor_dpi = false
|
||||
|
||||
|
||||
[urgency_low]
|
||||
# IMPORTANT: colors have to be defined in quotation marks.
|
||||
# Otherwise the "#" and following would be interpreted as a comment.
|
||||
background = "#282828"
|
||||
foreground = "#ebdbb2"
|
||||
timeout = 10
|
||||
# Icon for notifications with low urgency, uncomment to enable
|
||||
#new_icon = /path/to/icon
|
||||
|
||||
[urgency_normal]
|
||||
background = "#282828"
|
||||
foreground = "#ebdbb2"
|
||||
timeout = 10
|
||||
# Icon for notifications with normal urgency, uncomment to enable
|
||||
#new_icon = /path/to/icon
|
||||
|
||||
[urgency_critical]
|
||||
background = "#282828"
|
||||
foreground = "#ebdbb2"
|
||||
frame_color = "#fb4934"
|
||||
timeout = 0
|
||||
# Icon for notifications with critical urgency, uncomment to enable
|
||||
#new_icon = /path/to/icon
|
||||
|
||||
# Every section that isn't one of the above is interpreted as a rules to
|
||||
# override settings for certain messages.
|
||||
#
|
||||
# Messages can be matched by
|
||||
# appname (discouraged, see desktop_entry)
|
||||
# body
|
||||
# category
|
||||
# desktop_entry
|
||||
# icon
|
||||
# match_transient
|
||||
# msg_urgency
|
||||
# stack_tag
|
||||
# summary
|
||||
#
|
||||
# and you can override the
|
||||
# background
|
||||
# foreground
|
||||
# format
|
||||
# frame_color
|
||||
# fullscreen
|
||||
# new_icon
|
||||
# set_stack_tag
|
||||
# set_transient
|
||||
# set_category
|
||||
# timeout
|
||||
# urgency
|
||||
# skip_display
|
||||
# history_ignore
|
||||
# action_name
|
||||
# word_wrap
|
||||
# ellipsize
|
||||
# alignment
|
||||
#
|
||||
# Shell-like globbing will get expanded.
|
||||
#
|
||||
# Instead of the appname filter, it's recommended to use the desktop_entry filter.
|
||||
# GLib based applications export their desktop-entry name. In comparison to the appname,
|
||||
# the desktop-entry won't get localized.
|
||||
#
|
||||
# SCRIPTING
|
||||
# You can specify a script that gets run when the rule matches by
|
||||
# setting the "script" option.
|
||||
# The script will be called as follows:
|
||||
# script appname summary body icon urgency
|
||||
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
|
||||
#
|
||||
# NOTE: It might be helpful to run dunst -print in a terminal in order
|
||||
# to find fitting options for rules.
|
||||
|
||||
# Disable the transient hint so that idle_threshold cannot be bypassed from the
|
||||
# client
|
||||
#[transient_disable]
|
||||
# match_transient = yes
|
||||
# set_transient = no
|
||||
#
|
||||
# Make the handling of transient notifications more strict by making them not
|
||||
# be placed in history.
|
||||
#[transient_history_ignore]
|
||||
# match_transient = yes
|
||||
# history_ignore = yes
|
||||
|
||||
# fullscreen values
|
||||
# show: show the notifications, regardless if there is a fullscreen window opened
|
||||
# delay: displays the new notification, if there is no fullscreen window active
|
||||
# If the notification is already drawn, it won't get undrawn.
|
||||
# pushback: same as delay, but when switching into fullscreen, the notification will get
|
||||
# withdrawn from screen again and will get delayed like a new notification
|
||||
#[fullscreen_delay_everything]
|
||||
# fullscreen = delay
|
||||
#[fullscreen_show_critical]
|
||||
# msg_urgency = critical
|
||||
# fullscreen = show
|
||||
|
||||
#[espeak]
|
||||
# summary = "*"
|
||||
# script = dunst_espeak.sh
|
||||
|
||||
#[script-test]
|
||||
# summary = "*script*"
|
||||
# script = dunst_test.sh
|
||||
|
||||
#[ignore]
|
||||
# # This notification will not be displayed
|
||||
# summary = "foobar"
|
||||
# skip_display = true
|
||||
|
||||
#[history-ignore]
|
||||
# # This notification will not be saved in history
|
||||
# summary = "foobar"
|
||||
# history_ignore = yes
|
||||
|
||||
#[skip-display]
|
||||
# # This notification will not be displayed, but will be included in the history
|
||||
# summary = "foobar"
|
||||
# skip_display = yes
|
||||
|
||||
#[signed_on]
|
||||
# appname = Pidgin
|
||||
# summary = "*signed on*"
|
||||
# urgency = low
|
||||
#
|
||||
#[signed_off]
|
||||
# appname = Pidgin
|
||||
# summary = *signed off*
|
||||
# urgency = low
|
||||
#
|
||||
#[says]
|
||||
# appname = Pidgin
|
||||
# summary = *says*
|
||||
# urgency = critical
|
||||
#
|
||||
#[twitter]
|
||||
# appname = Pidgin
|
||||
# summary = *twitter.com*
|
||||
# urgency = normal
|
||||
#
|
||||
#[stack-volumes]
|
||||
# appname = "some_volume_notifiers"
|
||||
# set_stack_tag = "volume"
|
||||
#
|
||||
# vim: ft=cfg
|
||||
11
config-files/.config/git/config
Normal file
@@ -0,0 +1,11 @@
|
||||
[user]
|
||||
email = "ehtrude@gmail.com"
|
||||
name = "TrudeEH"
|
||||
|
||||
[credential "https://github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
[credential "https://gist.github.com"]
|
||||
helper =
|
||||
helper = !/usr/bin/gh auth git-credential
|
||||
|
||||
6
config-files/.config/nvim/.stylua.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
column_width = 160
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "None"
|
||||
24
config-files/.config/nvim/doc/kickstart.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
================================================================================
|
||||
INTRODUCTION *kickstart.nvim*
|
||||
|
||||
Kickstart.nvim is a project to help you get started on your neovim journey.
|
||||
|
||||
*kickstart-is-not*
|
||||
It is not:
|
||||
- Complete framework for every plugin under the sun
|
||||
- Place to add every plugin that could ever be useful
|
||||
|
||||
*kickstart-is*
|
||||
It is:
|
||||
- Somewhere that has a good start for the most common "IDE" type features:
|
||||
- autocompletion
|
||||
- goto-definition
|
||||
- find references
|
||||
- fuzzy finding
|
||||
- and hinting at what more can be done :)
|
||||
- A place to _kickstart_ your journey.
|
||||
- You should fork this project and use/modify it so that it matches your
|
||||
style and preferences. If you don't want to do that, there are probably
|
||||
other projects that would fit much better for you (and that's great!)!
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
3
config-files/.config/nvim/doc/tags
Normal file
@@ -0,0 +1,3 @@
|
||||
kickstart-is kickstart.txt /*kickstart-is*
|
||||
kickstart-is-not kickstart.txt /*kickstart-is-not*
|
||||
kickstart.nvim kickstart.txt /*kickstart.nvim*
|
||||
722
config-files/.config/nvim/init.lua
Normal file
@@ -0,0 +1,722 @@
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- NOTE: OPTIONS
|
||||
-- See `:help vim.opt`
|
||||
-- For more options, you can see `:help option-list`
|
||||
|
||||
vim.opt.number = true -- Enable line numbers
|
||||
vim.opt.relativenumber = true -- Lines are relative (helps with jumping)
|
||||
vim.opt.mouse = 'a' -- Enable the mouse
|
||||
vim.opt.showmode = false -- Do not show mode (already in the statusline)
|
||||
vim.opt.clipboard = 'unnamedplus' -- Vim <-> OS Clipboard
|
||||
vim.opt.breakindent = true
|
||||
vim.opt.undofile = true -- Undo history
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.updatetime = 250
|
||||
vim.opt.timeoutlen = 300
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||
vim.opt.inccommand = 'split' -- Preview substitutions
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- NOTE: Basic Keymaps
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||
vim.opt.hlsearch = true
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
--
|
||||
-- This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- NOTE: Basic Autocommands
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
-- Highlight when yanking (copying) text
|
||||
-- Try it with `yap` in normal mode
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
-- NOTE: Install `lazy.nvim` plugin manager
|
||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||
end ---@diagnostic disable-next-line: undefined-field
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- NOTE: Configure and install plugins
|
||||
--
|
||||
-- To check the current status of your plugins, run
|
||||
-- :Lazy
|
||||
--
|
||||
-- You can press `?` in this menu for help. Use `:q` to close the window
|
||||
--
|
||||
-- To update plugins you can run
|
||||
-- :Lazy update
|
||||
--
|
||||
require('lazy').setup({
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
{ 'numToStr/Comment.nvim', opts = {} }, -- "gc" to comment visual regions/lines
|
||||
|
||||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ -- Useful plugin to show you pending keybinds.
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||
config = function() -- This is the function that runs, AFTER loading
|
||||
require('which-key').setup()
|
||||
|
||||
-- Document existing key chains
|
||||
require('which-key').register {
|
||||
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
||||
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
||||
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
||||
}
|
||||
-- visual mode
|
||||
require('which-key').register({
|
||||
['<leader>h'] = { 'Git [H]unk' },
|
||||
}, { mode = 'v' })
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- Fuzzy Finder (files, lsp, etc)
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'VimEnter',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
|
||||
-- `build` is used to run some command when the plugin is installed/updated.
|
||||
-- This is only run then, not every time Neovim starts up.
|
||||
build = 'make',
|
||||
|
||||
-- `cond` is a condition used to determine whether this plugin should be
|
||||
-- installed and loaded.
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
end,
|
||||
},
|
||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||
|
||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
-- Two important keymaps to use while in Telescope are:
|
||||
-- - Insert mode: <c-/>
|
||||
-- - Normal mode: ?
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
-- You can put your default mappings / updates / etc. in here
|
||||
-- All the info you're looking for is in `:help telescope.setup()`
|
||||
--
|
||||
-- defaults = {
|
||||
-- mappings = {
|
||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
||||
-- },
|
||||
-- },
|
||||
-- pickers = {}
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable Telescope extensions if they are installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
}
|
||||
end, { desc = '[S]earch [/] in Open Files' })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[S]earch [N]eovim files' })
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- NOTE: LSP Configuration & Plugins
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||
{ 'williamboman/mason.nvim', config = true },
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
-- `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
{ 'folke/neodev.nvim', opts = {} },
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc)
|
||||
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
-- Opens a popup that displays documentation about the word under your cursor
|
||||
-- See `:help K` for why this keymap.
|
||||
map('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
-- The following two autocommands are used to highlight references of the
|
||||
-- word under your cursor when your cursor rests there for a little while.
|
||||
-- See `:help CursorHold` for information about when this is executed
|
||||
--
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.server_capabilities.documentHighlightProvider then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspDetach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- The following autocommand is used to enable inlay hints in your
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. Available keys are:
|
||||
-- - cmd (table): Override the default command used to start the server
|
||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
||||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`tsserver`) will work just fine
|
||||
-- tsserver = {},
|
||||
--
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = {...},
|
||||
-- filetypes = { ...},
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
-- To check the current status of installed tools and/or manually install
|
||||
-- other tools, you can run
|
||||
-- :Mason
|
||||
--
|
||||
-- You can press `g?` for help in this menu.
|
||||
require('mason').setup()
|
||||
|
||||
-- You can add other tools here that you want Mason to install
|
||||
-- for you, so that they are available from within Neovim.
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua', -- Used to format Lua code
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- Autoformat
|
||||
'stevearc/conform.nvim',
|
||||
lazy = false,
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_fallback = true }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use a sub-list to tell conform to run *until* a formatter
|
||||
-- is found.
|
||||
-- javascript = { { "prettierd", "prettier" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ -- Autocompletion
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = (function()
|
||||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
-- Remove the below condition to re-enable on windows.
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
-- {
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- config = function()
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
-- Adds other completion capabilities.
|
||||
-- nvim-cmp does not ship with all sources by default. They are split
|
||||
-- into multiple repos for maintenance purposes.
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
luasnip.config.setup {}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||
|
||||
-- For an understanding of why these mappings were
|
||||
-- chosen, you will need to read `:help ins-completion`
|
||||
--
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
-- Select the [n]ext item
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Select the [p]revious item
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- Scroll the documentation window [b]ack / [f]orward
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
-- Accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
|
||||
-- If you prefer more traditional completion keymaps,
|
||||
-- you can uncomment the following lines
|
||||
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
|
||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
||||
-- So if you have a snippet that's like:
|
||||
-- function $name($args)
|
||||
-- $body
|
||||
-- end
|
||||
--
|
||||
-- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- <c-h> is similar, except moving you backwards.
|
||||
['<C-l>'] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-h>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- You can easily change to a different colorscheme.
|
||||
-- Change the name of the colorscheme plugin below, and then
|
||||
-- change the command in the config to whatever the name of that colorscheme is.
|
||||
--
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
init = function()
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
vim.cmd.colorscheme 'gruvbox'
|
||||
|
||||
-- You can configure highlights by doing something like:
|
||||
vim.cmd.hi 'Comment gui=none'
|
||||
end,
|
||||
},
|
||||
|
||||
-- Highlight todo, notes, etc in comments
|
||||
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||
|
||||
{ -- Collection of various small independent plugins/modules
|
||||
'echasnovski/mini.nvim',
|
||||
config = function()
|
||||
-- Better Around/Inside textobjects
|
||||
--
|
||||
-- Examples:
|
||||
-- - va) - [V]isually select [A]round [)]paren
|
||||
-- - yinq - [Y]ank [I]nside [N]ext [']quote
|
||||
-- - ci' - [C]hange [I]nside [']quote
|
||||
require('mini.ai').setup { n_lines = 500 }
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
--
|
||||
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
||||
-- - sd' - [S]urround [D]elete [']quotes
|
||||
-- - sr)' - [S]urround [R]eplace [)] [']
|
||||
require('mini.surround').setup()
|
||||
|
||||
-- Simple and easy statusline.
|
||||
-- You could remove this setup call if you don't like it,
|
||||
-- and try some other statusline plugin
|
||||
local statusline = require 'mini.statusline'
|
||||
-- set use_icons to true if you have a Nerd Font
|
||||
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||
|
||||
-- You can configure sections in the statusline by overriding their
|
||||
-- default behavior. For example, here we set the section for
|
||||
-- cursor location to LINE:COLUMN
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return '%2l:%-2v'
|
||||
end
|
||||
|
||||
-- ... and there is more!
|
||||
-- Check out: https://github.com/echasnovski/mini.nvim
|
||||
end,
|
||||
},
|
||||
{ -- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
opts = {
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
||||
-- If you are experiencing weird indenting issues, add the language to
|
||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
|
||||
-- Prefer git instead of curl in order to improve connectivity in some environments
|
||||
require('nvim-treesitter.install').prefer_git = true
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('nvim-treesitter.configs').setup(opts)
|
||||
|
||||
-- There are additional nvim-treesitter modules that you can use to interact
|
||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||
--
|
||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||
end,
|
||||
},
|
||||
|
||||
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||
-- place them in the correct locations.
|
||||
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
-- Optional dependency
|
||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||
config = function()
|
||||
require('nvim-autopairs').setup {}
|
||||
-- If you want to automatically add `(` after selecting a function or method
|
||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||
local cmp = require 'cmp'
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
|
||||
},
|
||||
opts = {
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
['\\'] = 'close_window',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
|
||||
--
|
||||
-- Here are some example plugins that I've included in the Kickstart repository.
|
||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
||||
--
|
||||
-- require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- This is the easiest way to modularize your config.
|
||||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
||||
-- { import = 'custom.plugins' },
|
||||
}, {
|
||||
ui = {
|
||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
||||
icons = vim.g.have_nerd_font and {} or {
|
||||
cmd = '⌘',
|
||||
config = '🛠',
|
||||
event = '📅',
|
||||
ft = '📂',
|
||||
init = '⚙',
|
||||
keys = '🗝',
|
||||
plugin = '🔌',
|
||||
runtime = '💻',
|
||||
require = '🌙',
|
||||
source = '📄',
|
||||
start = '🚀',
|
||||
task = '📌',
|
||||
lazy = '💤 ',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
5
config-files/.config/nvim/lua/custom/plugins/init.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
-- You can add your own plugins here or in other files in this directory!
|
||||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
52
config-files/.config/nvim/lua/kickstart/health.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
--[[
|
||||
--
|
||||
-- This file is not required for your own configuration,
|
||||
-- but helps people determine if their system is setup correctly.
|
||||
--
|
||||
--]]
|
||||
|
||||
local check_version = function()
|
||||
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
|
||||
if not vim.version.cmp then
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
return
|
||||
end
|
||||
|
||||
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
|
||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||
else
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
end
|
||||
end
|
||||
|
||||
local check_external_reqs = function()
|
||||
-- Basic utils: `git`, `make`, `unzip`
|
||||
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
|
||||
local is_executable = vim.fn.executable(exe) == 1
|
||||
if is_executable then
|
||||
vim.health.ok(string.format("Found executable: '%s'", exe))
|
||||
else
|
||||
vim.health.warn(string.format("Could not find executable: '%s'", exe))
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return {
|
||||
check = function()
|
||||
vim.health.start 'kickstart.nvim'
|
||||
|
||||
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
|
||||
|
||||
Fix only warnings for plugins and languages you intend to use.
|
||||
Mason will give warnings for languages that are not installed.
|
||||
You do not need to install, unless you want to use those languages!]]
|
||||
|
||||
local uv = vim.uv or vim.loop
|
||||
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
|
||||
|
||||
check_version()
|
||||
check_external_reqs()
|
||||
end,
|
||||
}
|
||||
96
config-files/.config/nvim/lua/kickstart/plugins/debug.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
-- debug.lua
|
||||
--
|
||||
-- Shows how to use the DAP plugin to debug your code.
|
||||
--
|
||||
-- Primarily focused on configuring the debugger for Go, but can
|
||||
-- be extended to other languages as well. That's why it's called
|
||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||
|
||||
return {
|
||||
-- NOTE: Yes, you can install new plugins here!
|
||||
'mfussenegger/nvim-dap',
|
||||
-- NOTE: And you can specify dependencies as well
|
||||
dependencies = {
|
||||
-- Creates a beautiful debugger UI
|
||||
'rcarriga/nvim-dap-ui',
|
||||
|
||||
-- Required dependency for nvim-dap-ui
|
||||
'nvim-neotest/nvim-nio',
|
||||
|
||||
-- Installs the debug adapters for you
|
||||
'williamboman/mason.nvim',
|
||||
'jay-babu/mason-nvim-dap.nvim',
|
||||
|
||||
-- Add your own debuggers here
|
||||
'leoluz/nvim-dap-go',
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
|
||||
require('mason-nvim-dap').setup {
|
||||
-- Makes a best effort to setup the various debuggers with
|
||||
-- reasonable debug configurations
|
||||
automatic_installation = true,
|
||||
|
||||
-- You can provide additional configuration to the handlers,
|
||||
-- see mason-nvim-dap README for more information
|
||||
handlers = {},
|
||||
|
||||
-- You'll need to check that you have the required things installed
|
||||
-- online, please don't ask me how to install them :)
|
||||
ensure_installed = {
|
||||
-- Update this to ensure that you have the debuggers for the langs you want
|
||||
'delve',
|
||||
},
|
||||
}
|
||||
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
|
||||
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
|
||||
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
|
||||
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
|
||||
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
|
||||
vim.keymap.set('n', '<leader>B', function()
|
||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||
end, { desc = 'Debug: Set Breakpoint' })
|
||||
|
||||
-- Dap UI setup
|
||||
-- For more information, see |:help nvim-dap-ui|
|
||||
dapui.setup {
|
||||
-- Set icons to characters that are more likely to work in every terminal.
|
||||
-- Feel free to remove or use ones that you like more! :)
|
||||
-- Don't feel like these are good choices.
|
||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||
controls = {
|
||||
icons = {
|
||||
pause = '⏸',
|
||||
play = '▶',
|
||||
step_into = '⏎',
|
||||
step_over = '⏭',
|
||||
step_out = '⏮',
|
||||
step_back = 'b',
|
||||
run_last = '▶▶',
|
||||
terminate = '⏹',
|
||||
disconnect = '⏏',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' })
|
||||
|
||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
|
||||
-- Install golang specific config
|
||||
require('dap-go').setup {
|
||||
delve = {
|
||||
-- On Windows delve must be run attached or it crashes.
|
||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||
detached = vim.fn.has 'win32' == 0,
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
61
config-files/.config/nvim/lua/kickstart/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
||||
-- config. This will add also the recommended keymaps.
|
||||
|
||||
return {
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'stage git hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'reset git hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gitsigns.diffthis '@'
|
||||
end, { desc = 'git [D]iff against last commit' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{ -- Add indentation guides even on blank lines
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help ibl`
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
55
config-files/.config/nvim/lua/kickstart/plugins/lint.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
return {
|
||||
|
||||
{ -- Linting
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
markdown = { 'markdownlint' },
|
||||
}
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||
--
|
||||
-- However, note that this will enable a set of default linters,
|
||||
-- which will cause errors unless these tools are available:
|
||||
-- {
|
||||
-- clojure = { "clj-kondo" },
|
||||
-- dockerfile = { "hadolint" },
|
||||
-- inko = { "inko" },
|
||||
-- janet = { "janet" },
|
||||
-- json = { "jsonlint" },
|
||||
-- markdown = { "vale" },
|
||||
-- rst = { "vale" },
|
||||
-- ruby = { "ruby" },
|
||||
-- terraform = { "tflint" },
|
||||
-- text = { "vale" }
|
||||
-- }
|
||||
--
|
||||
-- You can disable the default linters by setting their filetypes to nil:
|
||||
-- lint.linters_by_ft['clojure'] = nil
|
||||
-- lint.linters_by_ft['dockerfile'] = nil
|
||||
-- lint.linters_by_ft['inko'] = nil
|
||||
-- lint.linters_by_ft['janet'] = nil
|
||||
-- lint.linters_by_ft['json'] = nil
|
||||
-- lint.linters_by_ft['markdown'] = nil
|
||||
-- lint.linters_by_ft['rst'] = nil
|
||||
-- lint.linters_by_ft['ruby'] = nil
|
||||
-- lint.linters_by_ft['terraform'] = nil
|
||||
-- lint.linters_by_ft['text'] = nil
|
||||
|
||||
-- Create autocommand which carries out the actual linting
|
||||
-- on the specified events.
|
||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
require('lint').try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
25
config-files/.config/nvim/lua/kickstart/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
-- Neo-tree is a Neovim plugin to browse the file system
|
||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
|
||||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
|
||||
},
|
||||
opts = {
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
['\\'] = 'close_window',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
61
config-files/.config/picom/picom.conf
Normal file
@@ -0,0 +1,61 @@
|
||||
backend = "glx";
|
||||
glx-no-stencil = true;
|
||||
glx-copy-from-front = false;
|
||||
|
||||
# Opacity
|
||||
active-opacity = 1;
|
||||
inactive-opacity = 1;
|
||||
frame-opacity = 1;
|
||||
#inactive-opacity-override = false;
|
||||
#blur-background = false;
|
||||
#blur-background-exclude = [
|
||||
# "window_type = 'dock'
|
||||
#]
|
||||
|
||||
#blur-method = "dual_kawase";
|
||||
#blur-strength = 8;
|
||||
|
||||
# Fading
|
||||
fading = false;
|
||||
#fade-delta = 2;
|
||||
#no-fading-openclose = false;
|
||||
|
||||
#fade-exclude = [ ];
|
||||
|
||||
# Other
|
||||
#mark-wmwin-focused = true;
|
||||
#mark-ovredir-focused = true;
|
||||
#detect-rounded-corners = true;
|
||||
#detect-clien-opacity = true;
|
||||
vsync = true;
|
||||
dbe = false;
|
||||
#unredir-if-possible = false;
|
||||
#focus-exclude = [ ];
|
||||
#detect-transient = true;
|
||||
#detect-client-leader = true;
|
||||
|
||||
# Window type settings
|
||||
#wintypes:
|
||||
#{
|
||||
# dock = {
|
||||
# shadow = false;
|
||||
# };
|
||||
#};
|
||||
|
||||
# Window transparency
|
||||
opacity-rule = [
|
||||
#"90:class_g = 'st'",
|
||||
];
|
||||
|
||||
shadow = false;
|
||||
#shadow-radius = 12;
|
||||
#shadow-offset-x = -5;
|
||||
#shadow-offset-y = -5;
|
||||
#shadow-opacity = 0.5;
|
||||
#shadow-green = 1.0;
|
||||
|
||||
#shadow-exclude = [ ];
|
||||
|
||||
#corner-radius = 0;
|
||||
|
||||
xrender-sync-fence = true;
|
||||
139
config-files/.config/zed/settings.json
Normal file
@@ -0,0 +1,139 @@
|
||||
// Trude's Zed Settings
|
||||
//
|
||||
// For information on how to configure Zed, see the Zed
|
||||
// documentation: https://zed.dev/docs/configuring-zed
|
||||
//
|
||||
// To see all of Zed's default settings without changing your
|
||||
// custom settings, run the `open default settings` command
|
||||
// from the command palette or from `Zed` application menu.
|
||||
{
|
||||
"base_keymap": "VSCode",
|
||||
"vim_mode": false,
|
||||
"telemetry": {
|
||||
"diagnostics": false,
|
||||
"metrics": false
|
||||
},
|
||||
"ui_font_size": 14,
|
||||
"buffer_font_size": 14,
|
||||
"buffer_font_family": "JetBrainsMono NF",
|
||||
"buffer_font_features": {
|
||||
// Enable ligatures:
|
||||
"calt": true
|
||||
},
|
||||
"buffer_font_weight": 300,
|
||||
"buffer_line_height": "comfortable",
|
||||
"ui_font_family": "JetBrainsMono NF",
|
||||
// The OpenType features to enable for text in the UI
|
||||
"ui_font_features": {
|
||||
"calt": true
|
||||
},
|
||||
"hover_popover_enabled": true,
|
||||
"confirm_quit": false,
|
||||
"restore_on_startup": "last_workspace",
|
||||
"show_completions_on_input": true,
|
||||
"show_completion_documentation": true,
|
||||
"show_wrap_guides": true,
|
||||
"redact_private_values": true,
|
||||
"private_files": [
|
||||
"**/.env*",
|
||||
"**/*.pem",
|
||||
"**/*.key",
|
||||
"**/*.cert",
|
||||
"**/*.crt",
|
||||
"**/secrets.yml"
|
||||
],
|
||||
"use_on_type_format": true,
|
||||
"use_autoclose": true,
|
||||
"use_auto_surround": true,
|
||||
"always_treat_brackets_as_autoclosed": false,
|
||||
"show_inline_completions": true,
|
||||
"calls": {
|
||||
"mute_on_join": true,
|
||||
"share_on_join": false
|
||||
},
|
||||
"toolbar": {
|
||||
"breadcrumbs": true,
|
||||
"quick_actions": true,
|
||||
"selections_menu": true
|
||||
},
|
||||
"message_editor": {
|
||||
"auto_replace_emoji_shortcode": false
|
||||
},
|
||||
"enable_language_server": true,
|
||||
"autosave": "off",
|
||||
"tab_bar": {
|
||||
"show": true,
|
||||
"show_nav_history_buttons": true
|
||||
},
|
||||
"tabs": {
|
||||
"git_status": false,
|
||||
"close_position": "right"
|
||||
},
|
||||
"format_on_save": "on",
|
||||
"formatter": "auto",
|
||||
"auto_update": true,
|
||||
"file_scan_exclusions": [
|
||||
"**/.git",
|
||||
"**/.svn",
|
||||
"**/.hg",
|
||||
"**/CVS",
|
||||
"**/.DS_Store",
|
||||
"**/Thumbs.db",
|
||||
"**/.classpath",
|
||||
"**/.settings"
|
||||
],
|
||||
"auto_install_extensions": {
|
||||
"html": true,
|
||||
"make": true,
|
||||
"emmet": true
|
||||
},
|
||||
"languages": {
|
||||
"C": {
|
||||
"format_on_save": "on"
|
||||
},
|
||||
"C++": {
|
||||
"format_on_save": "on"
|
||||
}
|
||||
},
|
||||
"vim": {
|
||||
"use_system_clipboard": "always",
|
||||
"use_multiline_find": false,
|
||||
"use_smartcase_find": false
|
||||
},
|
||||
"server_url": "https://zed.dev",
|
||||
"terminal": {
|
||||
"shell": "system",
|
||||
"dock": "bottom",
|
||||
"default_width": 640,
|
||||
"default_height": 320,
|
||||
"working_directory": "current_project_directory",
|
||||
"blinking": "terminal_controlled",
|
||||
"alternate_scroll": "on",
|
||||
"option_as_meta": false,
|
||||
"copy_on_select": true,
|
||||
"button": true,
|
||||
"env": {
|
||||
// "KEY": "value1:value2"
|
||||
},
|
||||
"line_height": "standard",
|
||||
"detect_venv": {
|
||||
"on": {
|
||||
"directories": [".env", "env", ".venv", "venv"],
|
||||
"activate_script": "default"
|
||||
}
|
||||
},
|
||||
"toolbar": {
|
||||
"title": true
|
||||
}
|
||||
},
|
||||
"code_actions_on_format": {},
|
||||
"tasks": {
|
||||
"variables": {}
|
||||
},
|
||||
"show_whitespaces": "selection",
|
||||
"theme": {
|
||||
"mode": "system",
|
||||
"light": "One Light",
|
||||
"dark": "Ayu Dark"
|
||||
}
|
||||
}
|
||||
147
config-files/.dialogrc
Normal file
@@ -0,0 +1,147 @@
|
||||
#
|
||||
# Run-time configuration file for dialog
|
||||
#
|
||||
# Automatically generated by "dialog --create-rc <file>"
|
||||
#
|
||||
#
|
||||
# Types of values:
|
||||
#
|
||||
# Number - <number>
|
||||
# String - "string"
|
||||
# Boolean - <ON|OFF>
|
||||
# Attribute - (foreground,background,highlight?,underline?,reverse?)
|
||||
|
||||
# Set aspect-ration.
|
||||
aspect = 0
|
||||
|
||||
# Set separator (for multiple widgets output).
|
||||
separate_widget = ""
|
||||
|
||||
# Set tab-length (for textbox tab-conversion).
|
||||
tab_len = 0
|
||||
|
||||
# Make tab-traversal for checklist, etc., include the list.
|
||||
visit_items = OFF
|
||||
|
||||
# Show scrollbar in dialog boxes?
|
||||
# use_scrollbar = OFF
|
||||
|
||||
# Shadow dialog boxes? This also turns on color.
|
||||
use_shadow = ON
|
||||
|
||||
# Turn color support ON or OFF
|
||||
use_colors = ON
|
||||
|
||||
# Screen color
|
||||
screen_color = (WHITE,BLACK,OFF)
|
||||
|
||||
# Shadow color
|
||||
shadow_color = (BLACK,BLACK,ON)
|
||||
|
||||
# Dialog box color
|
||||
dialog_color = (BLACK,WHITE,OFF)
|
||||
|
||||
# Dialog box title color
|
||||
title_color = (BLACK,WHITE,OFF)
|
||||
|
||||
# Dialog box border color
|
||||
border_color = (WHITE,WHITE,ON)
|
||||
|
||||
# Active button color
|
||||
button_active_color = (WHITE,BLACK,ON)
|
||||
|
||||
# Inactive button color
|
||||
button_inactive_color = dialog_color
|
||||
|
||||
# Active button key color
|
||||
button_key_active_color = button_active_color
|
||||
|
||||
# Inactive button key color
|
||||
button_key_inactive_color = (BLACK,WHITE,OFF)
|
||||
|
||||
# Active button label color
|
||||
button_label_active_color = (WHITE,BLACK,ON)
|
||||
|
||||
# Inactive button label color
|
||||
button_label_inactive_color = (BLACK,WHITE,ON)
|
||||
|
||||
# Input box color
|
||||
inputbox_color = dialog_color
|
||||
|
||||
# Input box border color
|
||||
inputbox_border_color = dialog_color
|
||||
|
||||
# Search box color
|
||||
searchbox_color = dialog_color
|
||||
|
||||
# Search box title color
|
||||
searchbox_title_color = title_color
|
||||
|
||||
# Search box border color
|
||||
searchbox_border_color = border_color
|
||||
|
||||
# File position indicator color
|
||||
position_indicator_color = title_color
|
||||
|
||||
# Menu box color
|
||||
menubox_color = dialog_color
|
||||
|
||||
# Menu box border color
|
||||
menubox_border_color = border_color
|
||||
|
||||
# Item color
|
||||
item_color = dialog_color
|
||||
|
||||
# Selected item color
|
||||
item_selected_color = button_active_color
|
||||
|
||||
# Tag color
|
||||
tag_color = title_color
|
||||
|
||||
# Selected tag color
|
||||
tag_selected_color = button_label_active_color
|
||||
|
||||
# Tag key color
|
||||
tag_key_color = button_key_inactive_color
|
||||
|
||||
# Selected tag key color
|
||||
tag_key_selected_color = (WHITE,BLACK,ON)
|
||||
|
||||
# Check box color
|
||||
check_color = dialog_color
|
||||
|
||||
# Selected check box color
|
||||
check_selected_color = button_active_color
|
||||
|
||||
# Up arrow color
|
||||
uarrow_color = (GREEN,WHITE,ON)
|
||||
|
||||
# Down arrow color
|
||||
darrow_color = uarrow_color
|
||||
|
||||
# Item help-text color
|
||||
itemhelp_color = screen_color
|
||||
|
||||
# Active form text color
|
||||
form_active_text_color = button_active_color
|
||||
|
||||
# Form text color
|
||||
form_text_color = (WHITE,BLACK,ON)
|
||||
|
||||
# Readonly form item color
|
||||
form_item_readonly_color = (BLACK,WHITE,ON)
|
||||
|
||||
# Dialog box gauge color
|
||||
gauge_color = title_color
|
||||
|
||||
# Dialog box border2 color
|
||||
border2_color = dialog_color
|
||||
|
||||
# Input box border2 color
|
||||
inputbox_border2_color = dialog_color
|
||||
|
||||
# Search box border2 color
|
||||
searchbox_border2_color = dialog_color
|
||||
|
||||
# Menu box border2 color
|
||||
menubox_border2_color = dialog_color
|
||||
BIN
config-files/.fonts/JetBrainsMonoNerdFont-Bold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-BoldItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-ExtraBold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-ExtraBoldItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-ExtraLight.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-ExtraLightItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-Italic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-Light.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-LightItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-Medium.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-MediumItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-Regular.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-SemiBold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-SemiBoldItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-Thin.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFont-ThinItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-Bold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-BoldItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-ExtraBold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-ExtraLight.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-Italic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-Light.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-LightItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-Medium.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-MediumItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-Regular.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-SemiBold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-SemiBoldItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-Thin.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontMono-ThinItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-Bold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-BoldItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-ExtraBold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-ExtraLight.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-Italic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-Light.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-LightItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-Medium.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-MediumItalic.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-Regular.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-SemiBold.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-Thin.ttf
Normal file
BIN
config-files/.fonts/JetBrainsMonoNerdFontPropo-ThinItalic.ttf
Normal file
18
config-files/.homepage/index.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<title>Homepage</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="clock" id="clock">
|
||||
<span id="clock-text"></span>
|
||||
</div>
|
||||
<div class="date" id="date">
|
||||
<span id="date-text"></span>
|
||||
</div>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
44
config-files/.homepage/script.js
Normal file
@@ -0,0 +1,44 @@
|
||||
// Load the config.json file (using JavaScript vanilla)
|
||||
|
||||
let clock_text = document.getElementById('clock-text');
|
||||
let date_text = document.getElementById('date-text');
|
||||
|
||||
displayTime();
|
||||
setInterval(displayTime, 1000);
|
||||
displayDate();
|
||||
setInterval(displayDate, 60000);
|
||||
|
||||
function displayTime() {
|
||||
let date = new Date();
|
||||
let hours = date.getHours();
|
||||
let minutes = date.getMinutes();
|
||||
let ampm = hours >= 12 ? 'PM' : 'AM';
|
||||
hours = hours % 12;
|
||||
hours = hours ? hours : 12;
|
||||
minutes = minutes < 10 ? '0'+minutes : minutes;
|
||||
let time = hours + ":" + minutes + " " + ampm;
|
||||
clock_text.innerHTML = time;
|
||||
}
|
||||
|
||||
function displayDate() {
|
||||
let date = new Date();
|
||||
let days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
let day = days[date.getDay()];
|
||||
let dayNumber = date.getDate();
|
||||
let month = date.toLocaleString('default', { month: 'long' });
|
||||
let year = date.getFullYear();
|
||||
|
||||
if (dayNumber == 1 || dayNumber == 21 || dayNumber == 31) {
|
||||
dayNumber += "st";
|
||||
} else if (dayNumber == 2 || dayNumber == 22) {
|
||||
dayNumber += "nd";
|
||||
} else if (dayNumber == 3 || dayNumber == 23) {
|
||||
dayNumber += "rd";
|
||||
} else {
|
||||
dayNumber += "th";
|
||||
}
|
||||
|
||||
let dateText = day + ", " + dayNumber + " " + month + " " + year;
|
||||
date_text.innerHTML = dateText;
|
||||
}
|
||||
|
||||
19
config-files/.homepage/style.css
Normal file
@@ -0,0 +1,19 @@
|
||||
html, body {
|
||||
font-family: "JetBrainsMono NF", system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
color: #ebdbb2;
|
||||
text-align: center;
|
||||
background: #282828;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clock {
|
||||
font-size: 8rem;
|
||||
}
|
||||
|
||||
.date {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
412
config-files/.local/bin/dm-bluetooth
Executable file
@@ -0,0 +1,412 @@
|
||||
#!/usr/bin/env bash
|
||||
# _ _ _ _ _ _
|
||||
# __| |_ __ ___ ___ _ __ _ _ | |__ | |_ _ ___| |_ ___ ___ | |_ | |__
|
||||
# / _` | '_ ` _ \ / _ \ '_ \| | | |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __|| '_ \
|
||||
# | (_| | | | | | | __/ | | | |_| |_____| |_) | | |_| | __/ || (_) | (_) | |_ | | | |
|
||||
# \__,_|_| |_| |_|\___|_| |_|\__,_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__||_| |_|
|
||||
#
|
||||
# Author: Nick Clyde (clydedroid)
|
||||
# dmenu support by: Layerex
|
||||
# Original script: https://github.com/nickclyde/rofi-bluetooth
|
||||
#
|
||||
# A script that generates a dmenu menu that uses bluetoothctl to
|
||||
# connect to bluetooth devices and display status info.
|
||||
#
|
||||
# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu)
|
||||
# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl)
|
||||
#
|
||||
# Depends on:
|
||||
# Arch repositories: dmenu, bluez-utils (contains bluetoothctl)
|
||||
|
||||
# Constants
|
||||
divider="---------"
|
||||
goback="Back"
|
||||
exit="Exit"
|
||||
connected_icon=""
|
||||
|
||||
# Checks if bluetooth controller is powered on
|
||||
power_on() {
|
||||
if bluetoothctl show | grep -F -q "Powered: yes"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles power state
|
||||
toggle_power() {
|
||||
if power_on; then
|
||||
bluetoothctl power off
|
||||
show_menu
|
||||
else
|
||||
if rfkill list bluetooth | grep -F -q 'blocked: yes'; then
|
||||
rfkill unblock bluetooth && sleep 3
|
||||
fi
|
||||
bluetoothctl power on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is scanning for new devices
|
||||
scan_on() {
|
||||
if bluetoothctl show | grep -F -q "Discovering: yes"; then
|
||||
echo "Scan: on"
|
||||
return 0
|
||||
else
|
||||
echo "Scan: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles scanning state
|
||||
toggle_scan() {
|
||||
if scan_on; then
|
||||
kill "$(pgrep -f "bluetoothctl scan on")"
|
||||
bluetoothctl scan off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl scan on &
|
||||
echo "Scanning..."
|
||||
sleep 5
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is able to pair to devices
|
||||
pairable_on() {
|
||||
if bluetoothctl show | grep -F -q "Pairable: yes"; then
|
||||
echo "Pairable: on"
|
||||
return 0
|
||||
else
|
||||
echo "Pairable: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles pairable state
|
||||
toggle_pairable() {
|
||||
if pairable_on; then
|
||||
bluetoothctl pairable off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl pairable on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is discoverable by other devices
|
||||
discoverable_on() {
|
||||
if bluetoothctl show | grep -F -q "Discoverable: yes"; then
|
||||
echo "Discoverable: on"
|
||||
return 0
|
||||
else
|
||||
echo "Discoverable: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles discoverable state
|
||||
toggle_discoverable() {
|
||||
if discoverable_on; then
|
||||
bluetoothctl discoverable off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl discoverable on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is connected
|
||||
device_connected() {
|
||||
if bluetoothctl info "$1" | grep -F -q "Connected: yes"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device connection
|
||||
toggle_connection() {
|
||||
if device_connected "$1"; then
|
||||
bluetoothctl disconnect "$1"
|
||||
# device_menu "$device"
|
||||
else
|
||||
bluetoothctl connect "$1"
|
||||
# device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is paired
|
||||
device_paired() {
|
||||
if bluetoothctl info "$1" | grep -F -q "Paired: yes"; then
|
||||
echo "Paired: yes"
|
||||
return 0
|
||||
else
|
||||
echo "Paired: no"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device paired state
|
||||
toggle_paired() {
|
||||
if device_paired "$1"; then
|
||||
bluetoothctl remove "$1"
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl pair "$1"
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is trusted
|
||||
device_trusted() {
|
||||
if bluetoothctl info "$1" | grep -F -q "Trusted: yes"; then
|
||||
echo "Trusted: yes"
|
||||
return 0
|
||||
else
|
||||
echo "Trusted: no"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device connection
|
||||
toggle_trust() {
|
||||
if device_trusted "$1"; then
|
||||
bluetoothctl untrust "$1"
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl trust "$1"
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prints a short string with the current bluetooth status
|
||||
# Useful for status bars like polybar, etc.
|
||||
print_status() {
|
||||
if power_on; then
|
||||
printf ''
|
||||
|
||||
mapfile -t paired_devices < <(bluetoothctl paired-devices | grep -F Device | cut -d ' ' -f 2)
|
||||
counter=0
|
||||
|
||||
for device in "${paired_devices[@]}"; do
|
||||
if device_connected "$device"; then
|
||||
device_alias="$(bluetoothctl info "$device" | grep -F "Alias" | cut -d ' ' -f 2-)"
|
||||
|
||||
if [ $counter -gt 0 ]; then
|
||||
printf ", %s" "$device_alias"
|
||||
else
|
||||
printf " %s" "$device_alias"
|
||||
fi
|
||||
|
||||
((counter++))
|
||||
fi
|
||||
done
|
||||
printf "\n"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# A submenu for a specific device that allows connecting, pairing, and trusting
|
||||
device_menu() {
|
||||
device="$1"
|
||||
|
||||
# Get device name and mac address
|
||||
device_name="$(echo "$device" | cut -d ' ' -f 3-)"
|
||||
mac="$(echo "$device" | cut -d ' ' -f 2)"
|
||||
|
||||
# Build options
|
||||
if device_connected "$mac"; then
|
||||
connected="Connected: yes"
|
||||
else
|
||||
connected="Connected: no"
|
||||
fi
|
||||
paired="$(device_paired "$mac")"
|
||||
trusted="$(device_trusted "$mac")"
|
||||
options="$connected\n$paired\n$trusted\n$divider\n$goback\n$exit"
|
||||
|
||||
# Open dmenu menu, read chosen option
|
||||
chosen="$(echo -e "$options" | run_dmenu "$device_name")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
"" | "$divider")
|
||||
echo "No option chosen."
|
||||
;;
|
||||
"$connected")
|
||||
toggle_connection "$mac"
|
||||
;;
|
||||
"$paired")
|
||||
toggle_paired "$mac"
|
||||
;;
|
||||
"$trusted")
|
||||
toggle_trust "$mac"
|
||||
;;
|
||||
"$goback")
|
||||
show_menu
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Opens a dmenu menu with current bluetooth status and options to connect
|
||||
show_menu() {
|
||||
# Get menu options
|
||||
if power_on; then
|
||||
power="Power: on"
|
||||
|
||||
# Human-readable names of devices, one per line
|
||||
# If scan is off, will only list paired devices
|
||||
if [[ -n "$connected_icon" ]]; then
|
||||
devices="$(bluetoothctl devices | grep -F Device | while read -r device; do
|
||||
device_name="$(echo "$device" | cut -d ' ' -f 3-)"
|
||||
mac="$(echo "$device" | cut -d ' ' -f 2)"
|
||||
icon=""
|
||||
|
||||
if device_connected "$mac" && [[ -n $connected_icon ]]; then
|
||||
icon=" $connected_icon"
|
||||
fi
|
||||
|
||||
echo "$device_name${icon}"
|
||||
done)"
|
||||
else
|
||||
devices="$(bluetoothctl devices | grep -F Device | cut -d ' ' -f 3-)"
|
||||
fi
|
||||
|
||||
# Get controller flags
|
||||
scan="$(scan_on)"
|
||||
pairable="$(pairable_on)"
|
||||
discoverable="$(discoverable_on)"
|
||||
|
||||
# Options passed to dmenu
|
||||
[[ -n $devices ]] && devices_part="$devices\n$divider\n"
|
||||
options="$devices_part$power\n$scan\n$pairable\n$discoverable\n$exit"
|
||||
else
|
||||
power="Power: off"
|
||||
options="$power\n$exit"
|
||||
fi
|
||||
|
||||
# Open dmenu menu, read chosen option
|
||||
chosen="$(echo -e "$options" | run_dmenu "Bluetooth")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
"" | "$divider")
|
||||
echo "No option chosen."
|
||||
;;
|
||||
"$power")
|
||||
toggle_power
|
||||
;;
|
||||
"$scan")
|
||||
toggle_scan
|
||||
;;
|
||||
"$discoverable")
|
||||
toggle_discoverable
|
||||
;;
|
||||
"$pairable")
|
||||
toggle_pairable
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$connected_icon" ]]; then
|
||||
chosen="${chosen%% ${connected_icon}}"
|
||||
fi
|
||||
device="$(bluetoothctl devices | grep -F "$chosen")"
|
||||
# Open a submenu if a device is selected
|
||||
if [[ -n "$device" ]]; then device_menu "$device"; fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# dmenu command to pipe into. Extra arguments to dmenu-bluetooth are passed through to dmenu. This
|
||||
# allows the user to set fonts, sizes, colours, etc.
|
||||
DMENU_BLUETOOTH_LAUNCHER="${DMENU_BLUETOOTH_LAUNCHER:-dmenu}"
|
||||
run_dmenu() {
|
||||
case "$DMENU_BLUETOOTH_LAUNCHER" in
|
||||
rofi)
|
||||
DMENU_BLUETOOTH_LAUNCHER="rofi -dmenu"
|
||||
;;
|
||||
fuzzel)
|
||||
DMENU_BLUETOOTH_LAUNCHER="fuzzel --dmenu"
|
||||
;;
|
||||
esac
|
||||
$DMENU_BLUETOOTH_LAUNCHER -i -p "$DMENU_BLUETOOTH_PROMPT" "-l" "20" "${dmenu_args[@]}"
|
||||
}
|
||||
|
||||
print_help() {
|
||||
echo "usage: $0 [--help] [--status] [--connected-icon [ICON]] [PROMPT] DMENU_ARGS..."
|
||||
echo ""
|
||||
echo "A script that generates a dmenu menu that uses bluetoothctl to connect to bluetooth devices and display status info."
|
||||
echo ""
|
||||
echo "positional arguments:"
|
||||
echo " PROMPT dmenu prompt"
|
||||
echo " DMENU_ARGS... arguments passed to dmenu"
|
||||
echo ""
|
||||
echo "options:"
|
||||
echo "--help show this help message and exit"
|
||||
echo "--status print a short string about current bluetooth status and exit"
|
||||
echo "--connected-icon [ICON] add icon on device list next to connected devices"
|
||||
echo ""
|
||||
echo "environment variables:"
|
||||
echo " DMENU_BLUETOOTH_PROMPT dmenu prompt"
|
||||
echo " DMENU_BLUETOOTH_LAUNCHER command to use instead of 'dmenu'"
|
||||
echo ""
|
||||
echo "Positional arguments have to be placed after all other arguments."
|
||||
echo "A PROMPT positional argument will be interpreted as part of DMENU_ARGS if it starts with '-'. It won't be parsed if the DMENU_BLUETOOTH_PROMPT environment variable is set."
|
||||
echo "Use the DMENU_BLUETOOTH_LAUNCHER environment variable to use launchers other than dmenu. Rofi, fuzzel, and any dmenu-compatible launchers are supported."
|
||||
}
|
||||
|
||||
command_present() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "$1. $2." >&2
|
||||
command_present notify-send && notify-send "$1" "$2."
|
||||
}
|
||||
|
||||
# Check if bluetooth daemon is running. Start it if possible.
|
||||
if command_present systemctl; then
|
||||
systemctl is-active --quiet bluetooth
|
||||
case $? in
|
||||
3)
|
||||
error "Bluetooth daemon is not running" "Start it to use this script"
|
||||
systemctl start bluetooth || exit 3
|
||||
;;
|
||||
4)
|
||||
error "Bluetooth daemon is not present" "On Arch Linux install bluez and bluez-utils packages"
|
||||
exit 4
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
dmenu_args=("$@")
|
||||
case "$1" in
|
||||
--help)
|
||||
print_help
|
||||
exit
|
||||
;;
|
||||
--status)
|
||||
print_status
|
||||
exit
|
||||
;;
|
||||
--connected-icon)
|
||||
if [[ "$2" == "--" ]]; then
|
||||
connected_icon=""
|
||||
else
|
||||
connected_icon="$2"
|
||||
fi
|
||||
dmenu_args=("${dmenu_args[@]:2}")
|
||||
;;
|
||||
esac
|
||||
case "${dmenu_args[0]}" in
|
||||
-*)
|
||||
;;
|
||||
*)
|
||||
if [[ -z "$DMENU_BLUETOOTH_PROMPT" ]]; then
|
||||
DMENU_BLUETOOTH_PROMPT="${dmenu_args[0]}"
|
||||
dmenu_args=("${dmenu_args[@]:1}")
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
show_menu
|
||||
23
config-files/.local/bin/dm-kill
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# dmenu theming
|
||||
lines="-l 20"
|
||||
|
||||
selected="$(ps -a -u $USER | \
|
||||
dmenu -i -p "Type to search and select process to kill" \
|
||||
$lines | \
|
||||
awk '{print $1" "$4}')";
|
||||
|
||||
if [[ ! -z $selected ]]; then
|
||||
|
||||
answer="$(echo -e "Yes\nNo" | \
|
||||
dmenu -i -p "$selected will be killed, are you sure?" \
|
||||
$lines )"
|
||||
|
||||
if [[ $answer == "Yes" ]]; then
|
||||
selpid="$(awk '{print $1}' <<< $selected)";
|
||||
kill -9 $selpid
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
18
config-files/.local/bin/dm-mansearch
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
prompt="-p Manual:"
|
||||
|
||||
# terminal to open manual
|
||||
terminal="st"
|
||||
|
||||
# list all manuals
|
||||
manual="$(man -k . | dmenu $prompt | awk '{print $1}')"
|
||||
|
||||
# open selected manual with terminal
|
||||
if [[ ! -z "$manual" ]]; then
|
||||
eval "$($terminal -e man $manual)"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
76
config-files/.local/bin/dm-mpd
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
all_name='[ALL]'
|
||||
mode=library
|
||||
|
||||
d_artist() {
|
||||
mpc list artist | sort -f | dmenu -p artist "${dmenu_args[@]}"
|
||||
}
|
||||
|
||||
d_album() {
|
||||
local artist="$1"
|
||||
local albums
|
||||
|
||||
mapfile -t albums < <(mpc list album artist "$artist")
|
||||
if (( ${#albums[@]} > 1 )) ; then
|
||||
{
|
||||
printf '%s\n' "$all_name"
|
||||
printf '%s\n' "${albums[@]}" | sort -f
|
||||
} | dmenu -p album "${dmenu_args[@]}"
|
||||
else
|
||||
# We only have one album, so just use that.
|
||||
printf '%s\n' "${albums[0]}"
|
||||
fi
|
||||
}
|
||||
|
||||
d_playlist() {
|
||||
local format="%position% %title%"
|
||||
local extra_format="(%artist% - %album%)"
|
||||
local track
|
||||
local num_extras
|
||||
|
||||
# If all tracks are from the same artist and album, no need to display that
|
||||
num_extras=$(mpc playlist -f "$extra_format" | sort | uniq | wc -l)
|
||||
(( num_extras == 1 )) || format+=" $extra_format"
|
||||
|
||||
track=$(mpc playlist -f "$format" | dmenu -p track "${dmenu_args[@]}")
|
||||
printf '%s' "${track%% *}"
|
||||
}
|
||||
|
||||
i=2
|
||||
|
||||
for arg do
|
||||
if [[ $arg == :: ]]; then
|
||||
dmenu_args=( "${@:$i}" )
|
||||
break
|
||||
fi
|
||||
|
||||
case "$arg" in
|
||||
-l) mode=library ;;
|
||||
-p) mode=playlist ;;
|
||||
esac
|
||||
|
||||
let i++
|
||||
done
|
||||
|
||||
case "$mode" in
|
||||
library)
|
||||
artist=$(d_artist)
|
||||
[[ $artist ]] || exit 1
|
||||
|
||||
album=$(d_album "$artist")
|
||||
[[ $album ]] || exit 2
|
||||
|
||||
mpc clear
|
||||
if [[ $album == "$all_name" ]]; then
|
||||
mpc find artist "$artist" | sort | mpc add
|
||||
else
|
||||
mpc find artist "$artist" album "$album" | sort | mpc add
|
||||
fi
|
||||
|
||||
mpc play >/dev/null
|
||||
;;
|
||||
playlist)
|
||||
mpc play "$(d_playlist)" >/dev/null
|
||||
;;
|
||||
esac
|
||||
60
config-files/.local/bin/dm-pass
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
shopt -s nullglob globstar
|
||||
|
||||
typeit=0
|
||||
if [[ $1 == "--type" ]]; then
|
||||
typeit=1
|
||||
shift
|
||||
fi
|
||||
|
||||
|
||||
STARTDIR=${PASSWORD_STORE_DIR-~/.password-store}
|
||||
BASEDIR=$STARTDIR
|
||||
DONE=0
|
||||
LEVEL=0
|
||||
PREVSELECTION=""
|
||||
SELECTION=""
|
||||
|
||||
while [ "$DONE" -eq 0 ] ; do
|
||||
password_files=( "$STARTDIR"/* )
|
||||
password_files=( "${password_files[@]#"$STARTDIR"/}" )
|
||||
password_files=( "${password_files[@]%.gpg}" )
|
||||
|
||||
if [ "$LEVEL" -ne 0 ] ; then
|
||||
password_files=(".." "${password_files[@]}")
|
||||
fi
|
||||
entry=$(printf '%s\n' "${password_files[@]}" | dmenu "$@" -l 15)
|
||||
|
||||
echo "entry: $entry"
|
||||
if [ -z "$entry" ] ; then
|
||||
DONE=1
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$entry" != ".." ] ; then
|
||||
PREVSELECTION=$SELECTION
|
||||
SELECTION="$SELECTION/$entry"
|
||||
|
||||
# check if another dir
|
||||
if [ -d "$STARTDIR/$entry" ] ; then
|
||||
STARTDIR="$STARTDIR/$entry"
|
||||
LEVEL=$((LEVEL+1))
|
||||
else
|
||||
# not a directory so it must be a real password entry
|
||||
|
||||
if [[ $typeit -eq 0 ]]; then
|
||||
pass show -c "$SELECTION" 2>/dev/null
|
||||
else
|
||||
xdotool - <<<"type --clearmodifiers -- $(pass show "$SELECTION" | head -n 1)"
|
||||
fi
|
||||
DONE=1
|
||||
fi
|
||||
|
||||
else
|
||||
LEVEL=$((LEVEL-1))
|
||||
SELECTION=$PREVSELECTION
|
||||
STARTDIR="$BASEDIR/$SELECTION"
|
||||
fi
|
||||
done
|
||||
|
||||
28
config-files/.local/bin/dm-todo
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Write/remove a task to do later.
|
||||
#
|
||||
# Select an existing entry to remove it from the file, or type a new entry to
|
||||
# add it.
|
||||
#
|
||||
|
||||
file="$HOME/.todo"
|
||||
touch "$file"
|
||||
height=$(wc -l "$file" | awk '{print $1}')
|
||||
prompt="Add/delete a task: "
|
||||
|
||||
cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file")
|
||||
while [ -n "$cmd" ]; do
|
||||
if grep -q "^$cmd\$" "$file"; then
|
||||
grep -v "^$cmd\$" "$file" > "$file.$$"
|
||||
mv "$file.$$" "$file"
|
||||
height=$(( height - 1 ))
|
||||
else
|
||||
echo "$cmd" >> "$file"
|
||||
height=$(( height + 1 ))
|
||||
fi
|
||||
|
||||
cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file")
|
||||
done
|
||||
|
||||
exit 0
|
||||
4
config-files/.local/bin/dm-usb-mount
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
udisksctl mount -b $(lsblk -lp | awk '/part/ {print $1, "(" $4 ")"}' | dmenu -p mount)
|
||||
|
||||
3
config-files/.local/bin/dm-usb-poweroff
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
udisksctl power-off -b $(lsblk -lp | awk '/part/ {print $1, "(" $4 ")"}' | dmenu -p poweroff)
|
||||
3
config-files/.local/bin/dm-usb-unmount
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
udisksctl unmount -b $(lsblk -lp | awk '/part/ {print $1, "(" $4 ")"}' | dmenu -p unmount)
|
||||
28
config-files/.local/bin/dm-web
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
engine="https://www.google.com/search?q="
|
||||
|
||||
declare -A bookmarks=(
|
||||
["YouTube"]="https://www.youtube.com/"
|
||||
["GitHub"]="https://github.com/TrudeEH/dotfiles"
|
||||
["TrudeWeb"]="https://trudeeh.github.io/web/"
|
||||
["Gemini"]="https://gemini.google.com/app"
|
||||
["Element"]="https://app.element.io/#/home"
|
||||
["Gmail"]="https://mail.google.com/mail/u/0/#inbox"
|
||||
["Google Messages"]="https://messages.google.com/web/conversations"
|
||||
["WOL"]="https://wol.jw.org/pt-PT/"
|
||||
["Discord"]="https://discord.com/app"
|
||||
)
|
||||
|
||||
choice=$(printf "%s\n" "${!bookmarks[@]}" | dmenu -i -p "Search:")
|
||||
|
||||
if [[ -n "$choice" ]]; then
|
||||
# Find the matching URL
|
||||
url=${bookmarks[$choice]}
|
||||
|
||||
if [[ -n "$url" ]]; then
|
||||
xdg-open $url
|
||||
else
|
||||
xdg-open $engine$choice
|
||||
fi
|
||||
fi
|
||||
1038
config-files/.local/bin/dm-wifi
Executable file
4
config-files/.local/bin/multimc
Executable file
@@ -0,0 +1,4 @@
|
||||
#! /bin/bash
|
||||
|
||||
/opt/multimc/run.sh
|
||||
|
||||
25
config-files/.local/bin/sb-battery
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prints all batteries, their percentage remaining and an emoji corresponding
|
||||
# to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.).
|
||||
|
||||
# Loop through all attached batteries and format the info
|
||||
# for battery in /sys/class/power_supply/BAT?*; do # For standard devices, use this line instead.
|
||||
for battery in /sys/class/power_supply/?*; do
|
||||
# If non-first battery, print a space separator.
|
||||
[ -n "${capacity+x}" ] && [ -f "$battery/status" ] && printf " "
|
||||
# Sets up the status and capacity
|
||||
case "$(cat "$battery/status" 2>&1)" in
|
||||
"Full") status=" " ;;
|
||||
"Discharging") status=" " ;;
|
||||
"Charging") status=" " ;;
|
||||
"Not charging") status=" " ;;
|
||||
"Unknown") status=" " ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||
# Will make a warn variable if discharging and low
|
||||
[ "$status" = " " ] && [ "$capacity" -le 25 ] && warn=" "
|
||||
# Prints the info
|
||||
printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
|
||||
done && printf "\\n"
|
||||
26
config-files/.local/bin/sb-cpu
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Module showing overall CPU usage as a percentage.
|
||||
# Cache in tmpfs to improve speed and reduce SSD load
|
||||
cache=/tmp/cpubarscache
|
||||
|
||||
# Extract CPU stats (total time and idle time)
|
||||
cpu_stats=$(awk '/^cpu / {print $2 + $3 + $4 + $5, $5}' /proc/stat)
|
||||
|
||||
# Check if cache exists, if not, initialize it
|
||||
[ ! -f $cache ] && echo "$cpu_stats" > "$cache"
|
||||
|
||||
# Read previous CPU stats from cache
|
||||
prev_stats=$(cat "$cache")
|
||||
|
||||
# Calculate CPU usage percentage and exit immediately
|
||||
echo "$cpu_stats $prev_stats" | awk '{
|
||||
total_diff = $1 - $3
|
||||
idle_diff = $2 - $4
|
||||
usage = 100 * (1 - idle_diff / total_diff)
|
||||
printf " %.1f%%\n", usage
|
||||
exit # Terminate script after printing the first line
|
||||
}'
|
||||
|
||||
# Update cache with current stats
|
||||
echo "$cpu_stats" > "$cache"
|
||||
3
config-files/.local/bin/sb-memory
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
free --mebi | sed -n '2{p;q}' | awk '{printf (" %2.2fGB/%2.2fGB\n", ( $3 / 1024), ($2 / 1024))}'
|
||||
17
config-files/.local/bin/sb-network
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Show wifi 📶 and percent strength or 📡 if none.
|
||||
# Show 🌐 if connected to ethernet or ❎ if none.
|
||||
# Show 🔒 if a vpn connection is active
|
||||
|
||||
# Wifi
|
||||
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
|
||||
wifiicon="$(awk '/^[[:space:]]*w/ { gsub(/[[:space:]]+/, " "); print " ", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
|
||||
elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
|
||||
wifiicon=" "
|
||||
fi
|
||||
|
||||
# Ethernet
|
||||
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon=" " || ethericon=" "
|
||||
|
||||
printf "%s%s\n" "$wifiicon" "$ethericon"
|
||||
28
config-files/.local/bin/sb-volume
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prints the current volume or if muted.
|
||||
|
||||
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
||||
|
||||
# If muted, print and exit.
|
||||
[ "$vol" != "${vol%\[MUTED\]}" ] && echo " " && exit
|
||||
|
||||
vol="${vol#Volume: }"
|
||||
|
||||
split() {
|
||||
# For ommiting the . without calling and external program.
|
||||
IFS=$2
|
||||
set -- $1
|
||||
printf '%s' "$@"
|
||||
}
|
||||
|
||||
vol="$(printf "%.0f" "$(split "$vol" ".")")"
|
||||
|
||||
case 1 in
|
||||
$((vol >= 70)) ) icon=" " ;;
|
||||
$((vol >= 30)) ) icon=" " ;;
|
||||
$((vol >= 1)) ) icon=" " ;;
|
||||
* ) echo " " && exit ;;
|
||||
esac
|
||||
|
||||
echo "$icon$vol%"
|
||||
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline"><path d="M388 342c-2.207 0-4 1.793-4 4s1.793 4 4 4c2.208 0 4-1.793 4-4s-1.792-4-4-4z" style="color:#bebebe;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:'Andale Mono';text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.389;marker:none" transform="translate(-381 -339)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 689 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 268 B |
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline;opacity:1"><path style="color:#000;display:inline;fill:#bebebe;fill-opacity:1;stroke-linecap:round;-inkscape-stroke:none" d="M414.145 341.9a1.25 1.25 0 0 0-1.766.092l-5.68 6.305-2.881-2.909a1.25 1.25 0 0 0-1.766 1.77l4.743 4.768 7.442-8.262a1.25 1.25 0 0 0-.092-1.764z" transform="translate(-401 -339)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 402 B |
|
After Width: | Height: | Size: 244 B |
|
After Width: | Height: | Size: 369 B |
@@ -0,0 +1 @@
|
||||
<svg height="14" width="14" xmlns="http://www.w3.org/2000/svg"><g style="display:inline"><path style="color:#000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000;solid-opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="M407 367h8c1.108 0 2 .892 2 2s-.892 2-2 2h-8c-1.108 0-2-.892-2-2s.892-2 2-2z" transform="translate(-404 -362)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 183 B |
|
After Width: | Height: | Size: 922 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 705 B |