Renamed dotfiles folder to assets

This commit is contained in:
Random936
2026-02-13 15:17:51 -05:00
parent b062663705
commit f3ea0b7922
61 changed files with 24 additions and 24 deletions

2
assets/.Xmodmap Normal file
View File

@@ -0,0 +1,2 @@
clear Lock
keycode 66 = Escape

23
assets/.Xresources Normal file
View File

@@ -0,0 +1,23 @@
! Terminal Customization
URxvt.depth: 32
URxvt.background: [80]#000000
URxvt.foreground: #ffffff
URxvt.internalBorder: 10
URxvt.scrollBar: false
! Font styles
URxvt.font: xft:MesloLGS NF:size=16
URxvt.cursorColor: #0000ff
URxvt.highlightColor: #303030
URxvt.highlightTextColor: #A0A0A0
URxvt.saveLines: 200000
! Resize terminal
URxvt.keysym.Shift-Control-J: resize-font:smaller
URxvt.keysym.Shift-Control-K: resize-font:bigger
! Ctrl-HJKL
URxvt.keysym.Control-j: \033[1;5A
URxvt.keysym.Control-k: \033[1;5B
URxvt.keysym.Control-h: \033[1;5D
URxvt.keysym.Control-l: \033[1;5C

105
assets/.aerospace.toml Normal file
View File

@@ -0,0 +1,105 @@
start-at-login = true
# Mouse follows focus when focused monitor changes
on-focused-monitor-changed = ['move-mouse monitor-lazy-center']
# Sketchybar Integration
after-startup-command = ['exec-and-forget sketchybar']
# Notify Sketchybar about workspace change
exec-on-workspace-change = [
'/bin/bash', '-c',
'sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE'
]
on-focus-changed = [
'exec-and-forget sketchybar --trigger front_app_switched',
'exec-and-forget --trigger update_windows'
]
enable-normalization-flatten-containers = false
enable-normalization-opposite-orientation-for-nested-containers = false
[gaps]
inner.horizontal = 5
inner.vertical = 5
outer.top = 45
outer.left = 5
outer.bottom = 5
outer.right = 5
[mode.main.binding]
# See: https://nikitabobko.github.io/AeroSpace/goodness#open-a-new-window-with-applescript
cmd-enter = '''exec-and-forget osascript << EOF
tell application "Ghostty"
if it is running then
activate
tell application "System Events" to keystroke "n" using {command down}
else
activate
end if
end tell
EOF'''
cmd-shift-e = 'exec-and-forget /etc/profiles/per-user/*/bin/emacs'
cmd-shift-f = 'exec-and-forget open -n -a "Firefox"'
cmd-shift-d = 'exec-and-forget open -n -a "Discord"'
# i3 wraps focus by default
cmd-h = 'focus --boundaries-action wrap-around-the-workspace left'
cmd-j = 'focus --boundaries-action wrap-around-the-workspace down'
cmd-k = 'focus --boundaries-action wrap-around-the-workspace up'
cmd-l = 'focus --boundaries-action wrap-around-the-workspace right'
cmd-shift-h = 'move left'
cmd-shift-j = 'move down'
cmd-shift-k = 'move up'
cmd-shift-l = 'move right'
cmd-f = 'fullscreen'
cmd-s = 'layout v_accordion' # 'layout stacking' in i3
cmd-e = 'layout tiles horizontal vertical' # 'layout toggle split' in i3
cmd-q = 'close'
cmd-semicolon = 'split horizontal' # split in horizontal orientation
cmd-shift-space = 'layout floating tiling' # 'floating toggle' in i3
# Not supported, because this command is redundant in AeroSpace mental model.
# See: https://nikitabobko.github.io/AeroSpace/guide#floating-windows
#cmd-space = 'focus toggle_tiling_floating'
# `focus parent`/`focus child` are not yet supported, and it's not clear whether they
# should be supported at all https://github.com/nikitabobko/AeroSpace/issues/5
# cmd-a = 'focus parent'
cmd-1 = 'workspace 1'
cmd-2 = 'workspace 2'
cmd-3 = 'workspace 3'
cmd-4 = 'workspace 4'
cmd-5 = 'workspace 5'
cmd-6 = 'workspace 6'
cmd-7 = 'workspace 7'
cmd-8 = 'workspace 8'
cmd-9 = 'workspace 9'
cmd-0 = 'workspace 10'
cmd-shift-1 = 'move-node-to-workspace 1'
cmd-shift-2 = 'move-node-to-workspace 2'
cmd-shift-3 = 'move-node-to-workspace 3'
cmd-shift-4 = 'move-node-to-workspace 4'
cmd-shift-5 = 'move-node-to-workspace 5'
cmd-shift-6 = 'move-node-to-workspace 6'
cmd-shift-7 = 'move-node-to-workspace 7'
cmd-shift-8 = 'move-node-to-workspace 8'
cmd-shift-9 = 'move-node-to-workspace 9'
cmd-shift-0 = 'move-node-to-workspace 10'
cmd-shift-c = 'reload-config'
cmd-shift-r = 'mode resize'
[mode.resize.binding]
h = 'resize width +50'
j = 'resize height -50'
k = 'resize height +50'
l = 'resize width -50'
enter = 'mode main'
esc = 'mode main'

View File

@@ -0,0 +1,3 @@
[window]
opacity = 0.8
padding = { x = 3, y = 5 }

View File

@@ -0,0 +1,25 @@
#! /bin/sh
pgrep -x sxhkd > /dev/null || sxhkd &
bspc monitor -d I II III IV V VI VII VIII IX X
bspc config border_width 2
bspc config window_gap 12
bspc config split_ratio 0.52
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc rule -a Gimp desktop='^8' state=floating follow=on
bspc rule -a Chromium desktop='^2'
bspc rule -a mplayer2 state=floating
bspc rule -a Kupfer.py focus=on
bspc rule -a Screenkey manage=off
# Setup monitors and restore wallpapers
xrandr --output HDMI-0 --mode 2560x1080 --pos 0x554 --rotate normal --output DP-0 --off --output DP-1 --off --output DP-2 --primary --mode 3440x1440 --pos 2560x0 --rotate normal --output DP-3 --off --output DP-4 --off --output DP-5 --off
nitrogen --restore &
# Launch the polybar script
$HOME/.config/polybar/launch.sh

View File

@@ -0,0 +1,122 @@
#
# wm independent hotkeys
#
# terminal emulator
alt + Return
urxvt
# make sxhkd reload its configuration files:
alt + Escape
pkill -USR1 -x sxhkd
# open rofi run window
alt + d
rofi -show run -theme dmenu
#
# bspwm hotkeys
#
# quit/restart bspwm
alt + shift + e
bspc {quit,wm -r}
# close and kill
alt + {_,shift + }q
bspc node -{c,k}
# alternate between the tiled and monocle layout
alt + m
bspc desktop -l next
# send the newest marked node to the newest preselected node
alt + y
bspc node newest.marked.local -n newest.!automatic.local
# swap the current node and the biggest window
alt + g
bspc node -s biggest.window
#
# state/flags
#
# set the window state
alt + {t,shift + t,s,f}
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
# set the node flags
alt + ctrl + {m,x,y,z}
bspc node -g {marked,locked,sticky,private}
#
# focus/swap
#
# focus the node in the given direction
alt + {_,shift + }{j,k,l,semicolon}
bspc node -{f,s} {west,south,north,east}
# focus the node for the given path jump
alt + {p,b,comma,period}
bspc node -f @{parent,brother,first,second}
# focus the next/previous window in the current desktop
alt + {_,shift + }c
bspc node -f {next,prev}.local.!hidden.window
# focus the next/previous desktop in the current monitor
alt + bracket{left,right}
bspc desktop -f {prev,next}.local
# focus the last node/desktop
alt + {grave,Tab}
bspc {node,desktop} -f last
# focus the older or newer node in the focus history
alt + {o,i}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send to the given desktop
alt + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
#
# preselect
#
# preselect the direction
alt + ctrl + {j,k,l,semicolon}
bspc node -p {west,south,north,east}
# preselect the ratio
alt + ctrl + {1-9}
bspc node -o 0.{1-9}
# cancel the preselection for the focused node
alt + ctrl + space
bspc node -p cancel
# cancel the preselection for the focused desktop
alt + ctrl + shift + space
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
#
# move/resize
#
# expand a window by moving one of its side outward
super + alt + {j,k,l,semicolon}
bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
# contract a window by moving one of its side inward
super + alt + shift + {j,k,l,semicolon}
bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
# move a floating window
super + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}

146
assets/.config/compton.conf Normal file
View File

@@ -0,0 +1,146 @@
# This is my compton configuration after a quick cleanup. (It's still none too organized; sorry about that.)
# With this file at ~/.config/compton.conf, I can run compton without any arguments (just plain `compton`).
#
# In the hopes that explaining my software and hardware environment might be helpful to you:
#
# I use this configuration on Ubuntu 15.10 (and have used it on previous releases); I am currently using the 352.63 ("long-lived
# branch") NVIDIA binary drivers, installed from the Ubuntu software repositories. I use fluxbox as my window manager; most of
# the other components of my desktop environment are borrowed from Xfce.
#
# My workstation at home has an i7-4930K and a GTX 970 in it, which are together more than enough to drive several 4K displays
# without tearing or lagging. Even with quite a few windows open at the moment, 'nvidia-smi' shows the X.org server using
# about 600 MiB of video memory; both the CPU and the GPU are effectively idle.
#
# I use the version of compton packaged in my PPA (https://launchpad.net/~kelleyk/+archive/ubuntu/compton). As of the time of this
# writing, that is d7f95b5, which is the what's on the master branch of the upstream compton repository.
#
# My X11 configuration is very "normal". On 15.04, I did have the following in a file in /etc/X11/xorg.conf.d/; I have not
# investigated yet, but I haven't noticed any ill effects from *not* having it since installing 15.10 a few hours ago.
# In some cases, UseEvents can make things unstable (though I haven't run into that in a long time); however, not enabling
# it will cause the X server to spin (leading to high CPU usage) while waiting for certain resources.
# ---------------------------
# Section "Device"
# Identifier "Device0"
# Option "UseEvents" "True"
# EndSection
# ---------------------------
#
# Good luck!
# References:
# - https://github.com/chjj/compton/wiki
# - http://ubuntuforums.org/showthread.php?t=2144468
### Backend/performance options
backend = "glx";
paint-on-overlay = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
# (TODO: Clean up my notes about selecting a vsync implementation.)
xrender-sync-fence = true;
vsync = "opengl-swc";
# This option throttles refresh rates. Not compatible with vsync=drm/opengl/opengl-oml.
# (Note: for me, enabling this just makes the choppy dragging more noticeable, like the update rate has gone down.)
sw-opti = true;
# # Per compton performance tips (from the GitHub wiki), only one of these three
# # (glx-use-copysubbuffermesa, glx-copy-from-front, glx-swap-method)
# # should be used.
# glx-use-copysubbuffermesa = true;
# glx-copy-from-front = false;
# glx-swap-method = "undefined";
glx-swap-method = "exchange"; # requires "allow fipping" in nvidia-settings
### Shadow
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
shadow-opacity = 0.5;
# shadow-red = 0.0;
# shadow-green = 0.0;
# shadow-blue = 0.0;
shadow-exclude = [
# From the Ubuntu forums link ('screaminj3sus')
"! name~=''",
"n:e:Notification",
"n:e:Plank",
"n:e:Docky",
"g:e:Synapse",
"g:e:Kupfer",
"g:e:Conky",
"n:w:*Firefox*",
"n:w:*Chrome*",
"n:w:*Chromium*",
"class_g ?= 'Notify-osd'",
"class_g ?= 'Cairo-dock'",
"class_g ?= 'Xfce4-notifyd'",
"class_g ?= 'Xfce4-power-manager'"
];
shadow-ignore-shaped = false;
# shadow-exclude-reg = "x10+0+0";
# xinerama-shadow-crop = true;
### Opacity
menu-opacity = 0.90;
# inactive-opacity = 0.85;
# active-opacity = 0.8;
frame-opacity = 0.90; # i.e. titlebars, borders
inactive-opacity-override = false;
alpha-step = 0.06;
# opacity-rule = [ "80:class_g = 'URxvt'" ];
# inactive-dim = 0.2;
# inactive-dim-fixed = true;
### Blur options
# blur-background = true;
# blur-background-frame = true;
# blur-kern = "3x3box"
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
# blur-background-fixed = true;
blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ];
### Fading
fading = true;
fade-delta = 4; # 30;
fade-in-step = 0.03;
fade-out-step = 0.03;
# no-fading-openclose = true;
fade-exclude = [ ];
### Other
mark-wmwin-focused = true;
mark-ovredir-focused = true;
# Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused instead of using FocusIn/Out events.
# Usually more reliable but depends on a EWMH-compliant WM.
use-ewmh-active-win = true;
# # Detect rounded corners and treat them as rectangular when --shadow-ignore-shaped is on.
# detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0;
dbe = false;
unredir-if-possible = true;
# unredir-if-possible-delay = 5000;
# unredir-if-possible-exclude = [ ];
focus-exclude = [ "class_g = 'Cairo-clock'" ];
detect-transient = true;
detect-client-leader = true;
invert-color-include = [ ];
# resize-damage = 1;
# Window type settings
wintypes:
{
tooltip = { fade = true; shadow = false; opacity = 0.75; focus = true; };
};

View File

@@ -0,0 +1,454 @@
# 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 = none
### Geometry ###
# dynamic width from 0 to 300
# width = (0, 300)
# constant width of 300
width = 300
# The maximum height of a single notification, excluding the frame.
height = 300
# Position the notification in the top right corner
origin = top-right
# Offset from the origin
offset = 10x50
# Scale factor. It is auto-detected if value is 0.
scale = 0
# Maximum number of notification (0 means no limit)
notification_limit = 0
### Progress bar ###
# Turn on the progess bar. It appears when a progress hint is passed with
# for example dunstify -h int:value:12
progress_bar = true
# Set the progress bar height. This includes the frame, so make sure
# it's at least twice as big as the frame width.
progress_bar_height = 10
# Set the frame width of the progress bar
progress_bar_frame_width = 1
# Set the minimum width for the progress bar
progress_bar_min_width = 150
# Set the maximum width for the progress bar
progress_bar_max_width = 300
# Show how many messages are currently hidden (because of
# notification_limit).
indicate_hidden = yes
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing window manager is
# present (e.g. xcompmgr, compiz, etc.). (X11 only)
transparency = 0
# Draw a line of "separator_height" pixel height between two
# notifications.
# Set to 0 to disable.
# If gap_size is greater than 0, this setting will be ignored.
separator_height = 2
# Padding between text and separator.
padding = 8
# Horizontal padding.
horizontal_padding = 8
# Padding between text and icon.
text_icon_padding = 0
# Defines width in pixels of frame around the notification window.
# Set to 0 to disable.
frame_width = 3
# Defines color of the frame around the notification window.
frame_color = "#eeeeee"
# Size of gap to display between notifications - requires a compositor.
# If value is greater than 0, separator_height will be ignored and a border
# of size frame_width will be drawn around each notification instead.
# Click events on gaps do not currently propagate to applications below.
gap_size = 0
# 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 = Monospace 8
# 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://docs.gtk.org/Pango/pango_markup.html>.
#
# strip: This setting is provided for compatibility with some broken
# clients that send markup even though it's not enabled on the
# server. Dunst will try to strip the markup but the parsing is
# simplistic so using this option outside of matching rules for
# specific applications *IS GREATLY DISCOURAGED*.
#
# no: Disable markup parsing, incoming notifications will be treated as
# plain text. Dunst will not advertise that it has the body-markup
# capability if this is set as a global setting.
#
# It's important to note that markup inside the format option will be parsed
# regardless of what this is set to.
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "<b>%s</b>\n%b"
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left
# Vertical alignment of message text and icon.
# Possible values are "top", "center" and "bottom".
vertical_alignment = center
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 60
# Specify where to make an ellipsis in long lines.
# Possible values are "start", "middle" and "end".
ellipsize = middle
# Ignore newlines '\n' in notifications.
ignore_newline = no
# Stack together notifications with the same content
stack_duplicates = 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 ###
# Recursive icon lookup. You can set a single theme, instead of having to
# define all lookup paths.
enable_recursive_icon_lookup = true
# Set icon theme (only used for recursive icon lookup)
icon_theme = Adwaita
# You can also set multiple icon themes, with the leftmost one being used first.
# icon_theme = "Adwaita, breeze"
# Align icons left/right/top/off
icon_position = left
# Scale small icons up to this size, set to 0 to disable. Helpful
# for e.g. small files or high-dpi screens. In case of conflict,
# max_icon_size takes precedence over this.
min_icon_size = 32
# Scale larger icons down to this size, set to 0 to disable
max_icon_size = 128
# Paths to default icons (only neccesary when not using recursive icon lookup)
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 = /usr/bin/dmenu -p dunst:
# Browser for opening urls in context menu.
browser = /usr/bin/xdg-open
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
# Define the title of the windows spawned by dunst
title = Dunst
# Define the class of the windows spawned by dunst
class = Dunst
# Define the corner radius of the notification window
# in pixel size. If the radius is 0, you have no rounded
# corners.
# The radius will be automatically lowered if it exceeds half of the
# notification height to avoid clipping text and/or icons.
corner_radius = 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 = "#000000"
foreground = "#ffffff"
timeout = 5
# Icon for notifications with low urgency, uncomment to enable
#default_icon = /path/to/icon
[urgency_normal]
background = "#000000"
foreground = "#ffffff"
timeout = 5
# Icon for notifications with normal urgency, uncomment to enable
#default_icon = /path/to/icon
[urgency_critical]
background = "#000000"
foreground = "#ff0000"
frame_color = "#ff0000"
timeout = 0
# Icon for notifications with critical urgency, uncomment to enable
#default_icon = /path/to/icon
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
#
# Messages can be matched by
# appname (discouraged, see desktop_entry)
# body
# category
# desktop_entry
# icon
# match_transient
# msg_urgency
# stack_tag
# summary
#
# and you can override the
# background
# foreground
# format
# frame_color
# fullscreen
# new_icon
# set_stack_tag
# set_transient
# set_category
# timeout
# urgency
# icon_position
# skip_display
# history_ignore
# action_name
# word_wrap
# ellipsize
# alignment
# hide_text
#
# Shell-like globbing will get expanded.
#
# Instead of the appname filter, it's recommended to use the desktop_entry filter.
# GLib based applications export their desktop-entry name. In comparison to the appname,
# the desktop-entry won't get localized.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
# Disable the transient hint so that idle_threshold cannot be bypassed from the
# client
#[transient_disable]
# match_transient = yes
# set_transient = no
#
# Make the handling of transient notifications more strict by making them not
# be placed in history.
#[transient_history_ignore]
# match_transient = yes
# history_ignore = yes
# fullscreen values
# show: show the notifications, regardless if there is a fullscreen window opened
# delay: displays the new notification, if there is no fullscreen window active
# If the notification is already drawn, it won't get undrawn.
# pushback: same as delay, but when switching into fullscreen, the notification will get
# withdrawn from screen again and will get delayed like a new notification
#[fullscreen_delay_everything]
# fullscreen = delay
#[fullscreen_show_critical]
# msg_urgency = critical
# fullscreen = show
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# skip_display = true
#[history-ignore]
# # This notification will not be saved in history
# summary = "foobar"
# history_ignore = yes
#[skip-display]
# # This notification will not be displayed, but will be included in the history
# summary = "foobar"
# skip_display = yes
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
#[stack-volumes]
# appname = "some_volume_notifiers"
# set_stack_tag = "volume"
#
# vim: ft=cfg

View File

@@ -0,0 +1 @@
confirm-close-surface = false

166
assets/.config/i3/config Normal file
View File

@@ -0,0 +1,166 @@
set $mod Mod4
# Set font
font pango:monospace 8
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id wpctl set-volume @DEFAULT_SINK@ 5%+ && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id wpctl set-volume @DEFAULT_SINK@ 5%- && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id wpctl set-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# Application hot keys
bindsym $mod+Return exec "alacritty"
bindsym $mod+Shift+b exec "blueman-manager"
bindsym $mod+Shift+d exec "vesktop"
bindsym $mod+Shift+e exec "emacsclient -c"
bindsym $mod+Shift+f exec "qutebrowser"
bindsym $mod+Shift+m exec "proton-mail"
bindsym $mod+Shift+p exec "rofi-rbw"
bindsym $mod+Shift+s exec "flameshot gui"
bindsym $mod+Shift+t exec "thunar"
bindsym $mod+Shift+x exec "i3lock-fancy"
# kill focused window
bindsym $mod+q kill
bindsym $mod+Shift+q kill
# Start Rofi
bindsym $mod+d exec --no-startup-id rofi -show drun -run-shell-command '{terminal} -e zsh -ic "{cmd} && read"'
# change focus
bindsym $mod+h focus left
bindsym $mod+k focus up
bindsym $mod+j focus down
bindsym $mod+l focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+k move up
bindsym $mod+Shift+j move down
bindsym $mod+Shift+l move right
# move entire workspace
bindsym $mod+Shift+period move workspace to output right
bindsym $mod+Shift+comma move workspace to output left
# split in horizontal orientation
bindsym $mod+semicolon split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
#bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym h resize grow width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize shrink width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize grow width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize shrink width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Brightness keys setup
bindsym XF86MonBrightnessDown exec --no-startup-id "sudo $HOME/.scripts/brightness.sh -5"
bindsym XF86MonBrightnessUp exec --no-startup-id "sudo $HOME/.scripts/brightness.sh 5"
# Window Cosmetic Changes
gaps inner 5
new_window pixel 3
client.focused #555555 #555555 #ffffff #333333 #0000ff
client.focused_inactive #333333 #222222 #888888 #292d2e #eeeeee
client.unfocused #333333 #222222 #888888 #292d2e #eeeeee
# Auto lock the screen after X minutes
#exec "xautolock -detectsleep -time 30 -locker i3lock-fancy"
# Startup Applications
exec --no-startup-id "$HOME/.screenlayout/launch.sh &" # setup screen layout and wallpapers
exec --no-startup-id "$HOME/.scripts/autostart_desktop.sh &" # run autostart desktop apps

View File

@@ -0,0 +1,55 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 1
}
order += "wireless tun0"
order += "ethernet _first_"
order += "disk /"
order += "cpu_usage"
order += "memory"
order += "volume master"
order += "tztime local"
wireless tun0 {
format_up = "VPN: %ip"
format_down = "VPN: down"
}
ethernet _first_ {
format_up = "Ethernet: %ip"
format_down = "Ethernet: down"
}
disk "/" {
format = "HDD: %avail free, %used used"
}
cpu_usage {
format = "CPU: %usage"
}
memory {
format = "Memory: %used used, %available free"
threshold_degraded = "1G"
}
volume master {
format = " %volume"
format_muted = " %volume"
device = "default"
mixer = "Master"
mixer_idx = 0
}
tztime local {
format = "%A %Y-%m-%d %I:%M:%S"
}

View File

@@ -0,0 +1,61 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 1
}
order += "wireless tun0"
order += "wireless _first_"
order += "disk /"
order += "cpu_usage"
order += "memory"
order += "battery 0"
order += "volume master"
order += "tztime local"
wireless _first_ {
format_up = "WiFi: %ip (%bitrate at %essid)"
format_down = "WiFi: down"
}
wireless tun0 {
format_up = "VPN: %ip (%bitrate)"
format_down = "VPN: down"
}
disk "/" {
format = "HDD: %avail free, %used used"
}
cpu_usage {
format = "CPU: %usage"
}
memory {
format = "Memory: %used used, %available free"
threshold_degraded = "1G"
}
battery 0 {
format = "%status %percentage %remaining Hours"
path = "/sys/class/power_supply/BAT0/uevent"
}
volume master {
format = " %volume"
format_muted = " %volume"
device = "default"
mixer = "Master"
mixer_idx = 0
}
tztime local {
format = "%A %m-%d-%Y %I:%M:%S"
}

View File

@@ -0,0 +1,166 @@
[colors]
background = #EEEEEE
background-alt = #A0A0A0
foreground = #444444
primary = #0000FF
secondary = #8ABEB7
alert = #A54242
disabled = #707880
[bar/example]
width = 100%
height = 24pt
radius = 6
monitor = ${env:MONITOR:}
; dpi = 96
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3pt
border-size = 4pt
border-color = #00000000
padding-left = 0
padding-right = 1
module-margin = 1
separator = |
separator-foreground = ${colors.disabled}
font-0 = MesloLGS NF:2
modules-left = xworkspaces xwindow
modules-right = filesystem pulseaudio memory cpu battery network date tray
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
; wm-restack = generic
; wm-restack = bspwm
wm-restack = i3
;override-redirect = true
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-underline= ${colors.primary}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ${colors.disabled}
label-empty-padding = 1
[module/xwindow]
type = internal/xwindow
label = %title:0:80:...%
[module/filesystem]
type = internal/fs
interval = 10
mount-0 = /
label-mounted = %{F#0000FF}%mountpoint%%{F-} %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.disabled}
[module/pulseaudio]
type = internal/pulseaudio
format-volume-prefix = "VOL "
format-volume-prefix-foreground = ${colors.primary}
format-volume = <label-volume>
label-volume = %percentage%%
label-muted = muted
label-muted-foreground = ${colors.disabled}
[module/memory]
type = internal/memory
interval = 2
format-prefix = "RAM "
format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%%
[module/cpu]
type = internal/cpu
interval = 0.5
format-prefix = "CPU "
format-prefix-foreground = ${colors.primary}
format = <label> <ramp-coreload>
label = %percentage%% -
ramp-coreload-spacing = 0
ramp-coreload-0 =
ramp-coreload-1 =
ramp-coreload-2 =
ramp-coreload-3 =
ramp-coreload-4 =
ramp-coreload-5 =
ramp-coreload-6 =
ramp-coreload-7 =
[module/battery]
type = internal/battery
battery = BAT0
format-full = <label-full>
format-charging = <label-charging>
format-discharging = <label-discharging>
label-full = %percentage%%
label-charging = %percentage%% %time%
label-discharging = %percentage%% %time%
format-full-prefix = "FULL "
format-charging-prefix = "CHR "
format-discharging-prefix = "BAT "
format-full-prefix-foreground = ${colors.primary}
format-charging-prefix-foreground = ${colors.primary}
format-discharging-prefix-foreground = ${colors.primary}
[module/network]
type = internal/network
interface-type = wireless
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-disconnected = %{F#0000FF}%ifname%%{F#707880} disconnected
label-connected = %{F#0000FF}%ifname%%{F-} %essid% %local_ip%
[module/date]
type = internal/date
interval = 1
date = %a %d %I:%M %p
date-alt = %a %b %d %Y %I:%M:%S %p
label = %date%
label-foreground = ${colors.primary}
[module/tray]
type = internal/tray
format-margin = 8px
tray-spacing = 8px
[settings]
screenchange-reload = true
pseudo-transparency = true

View File

@@ -0,0 +1,15 @@
import os
from urllib.request import urlopen
# load your autoconfig, use this, if the rest of your config is empty!
config.load_autoconfig()
# Set Dark Mode
config.set("colors.webpage.darkmode.enabled", False)
config.set("colors.webpage.preferred_color_scheme", "dark")
# Toggle Dark Mode
config.bind('td', 'config-cycle colors.webpage.darkmode.enabled true false')
# Fix terminal editor
config.set('editor.command', ['alacritty', '-e', 'nvim', '{file}'])

View File

@@ -0,0 +1,17 @@
* {
background: rgba(0, 0, 0, 90%);
foreground: #EEEEEE;
normal-background: transparent;
alternate-normal-background: transparent;
selected-normal-background: rgba(0, 0, 255, 95%);
}
window {
border: 3px;
}
listview {
scrollbar: false;
border: 3px 0 0 0;
}

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# make sure it's executable with:
# chmod +x ~/.config/sketchybar/plugins/aerospace.sh
if [ "$1" = "$FOCUSED_WORKSPACE" ]; then
sketchybar --set $NAME background.drawing=on
else
sketchybar --set $NAME background.drawing=off
fi

View File

@@ -0,0 +1,28 @@
#!/bin/sh
PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)"
CHARGING="$(pmset -g batt | grep 'AC Power')"
if [ "$PERCENTAGE" = "" ]; then
exit 0
fi
case "${PERCENTAGE}" in
9[0-9]|100) ICON=""
;;
[6-8][0-9]) ICON=""
;;
[3-5][0-9]) ICON=""
;;
[1-2][0-9]) ICON=""
;;
*) ICON=""
esac
if [[ "$CHARGING" != "" ]]; then
ICON=""
fi
# The item invoking this script (name $NAME) will get its icon and label
# updated with the current battery status
sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%"

View File

@@ -0,0 +1,8 @@
#!/bin/sh
# The $NAME variable is passed from sketchybar and holds the name of
# the item invoking this script:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
sketchybar --set "$NAME" label="$(date '+%m/%d/%Y %I:%M:%S %p')"

View File

@@ -0,0 +1,10 @@
#!/bin/sh
# Some events send additional information specific to the event in the $INFO
# variable. E.g. the front_app_switched event sends the name of the newly
# focused application in the $INFO variable:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
if [ "$SENDER" = "front_app_switched" ]; then
sketchybar --set "$NAME" label="$INFO"
fi

View File

@@ -0,0 +1,7 @@
#!/bin/sh
# The $SELECTED variable is available for space components and indicates if
# the space invoking this script (with name: $NAME) is currently selected:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
sketchybar --set "$NAME" background.drawing="$SELECTED"

View File

@@ -0,0 +1,20 @@
#!/bin/sh
# The volume_change event supplies a $INFO variable in which the current volume
# percentage is passed to the script.
if [ "$SENDER" = "volume_change" ]; then
VOLUME="$INFO"
case "$VOLUME" in
[6-9][0-9]|100) ICON="󰕾"
;;
[3-5][0-9]) ICON="󰖀"
;;
[1-9]|[1-2][0-9]) ICON="󰕿"
;;
*) ICON="󰖁"
esac
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
fi

View File

@@ -0,0 +1,93 @@
# This is a demo config to showcase some of the most important commands.
# It is meant to be changed and configured, as it is intentionally kept sparse.
# For a (much) more advanced configuration example see my dotfiles:
# https://github.com/FelixKratz/dotfiles
PLUGIN_DIR="$CONFIG_DIR/plugins"
##### Bar Appearance #####
# Configuring the general appearance of the bar.
# These are only some of the options available. For all options see:
# https://felixkratz.github.io/SketchyBar/config/bar
# If you are looking for other colors, see the color picker:
# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker
bar=(
position=top
height=40
blur_radius=30
color=0x40000000
sticky=on
topmost-window
)
sketchybar --bar "${bar[@]}"
##### Changing Defaults #####
# We now change some default values, which are applied to all further items.
# For a full list of all available item properties see:
# https://felixkratz.github.io/SketchyBar/config/items
default=(
padding_left=5
padding_right=5
icon.font="Hack Nerd Font:Bold:17.0"
label.font="Hack Nerd Font:Bold:14.0"
icon.color=0xffffffff
label.color=0xffffffff
icon.padding_left=4
icon.padding_right=4
label.padding_left=4
label.padding_right=4
)
sketchybar --default "${default[@]}"
##### Aerospace Workspace Integration #####
sketchybar --add event aerospace_workspace_change
for sid in $(aerospace list-workspaces --all); do
sketchybar --add item space.$sid left \
--subscribe space.$sid aerospace_workspace_change \
--set space.$sid \
background.color=0x44ffffff \
background.corner_radius=5 \
background.height=25 \
background.drawing=off \
label="$sid" \
click_script="aerospace workspace $sid" \
script="$CONFIG_DIR/plugins/aerospace.sh $sid"
done
##### Adding Left Items #####
# We add some regular items to the left side of the bar, where
# only the properties deviating from the current defaults need to be set
sketchybar --add item chevron left \
--set chevron icon= label.drawing=off \
--add item front_app left \
--set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
--subscribe front_app front_app_switched
##### Adding Right Items #####
# In the same way as the left items we can add items to the right side.
# Additional position (e.g. center) are available, see:
# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar
# Some items refresh on a fixed cycle, e.g. the clock runs its script once
# every 10s. Other items respond to events they subscribe to, e.g. the
# volume.sh script is only executed once an actual change in system audio
# volume is registered. More info about the event system can be found here:
# https://felixkratz.github.io/SketchyBar/config/events
sketchybar --add item clock right \
--set clock update_freq=1 icon= script="$PLUGIN_DIR/clock.sh" \
--add item volume right \
--set volume script="$PLUGIN_DIR/volume.sh" \
--subscribe volume volume_change \
--add item battery right \
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
--subscribe battery system_woke power_source_change
##### Force all scripts to run the first time (never do this in a script) #####
sketchybar --update

8
assets/.emacs Normal file
View File

@@ -0,0 +1,8 @@
; Enable following symlinks
(setq vc-follow-symlinks t)
; Load the main config file for emacs
(require 'org)
(org-babel-load-file
(expand-file-name "config.org"
user-emacs-directory))

640
assets/.emacs.d/config.org Normal file
View File

@@ -0,0 +1,640 @@
* General Configuration
General configuration is configuration of vanilla Emacs. This includes making Emacs more minimal.
** Global Constants
Constants used throughout my emacs config.
#+begin_src emacs-lisp
(defconst jm/cloud-root "~/Nextcloud")
(defconst jm/notes-directory (expand-file-name "org" jm/cloud-root))
#+end_src
** Disable Error Bell
Disable error bell and visual bell. Visual bell would be nice on Linux, but on mac it is just annoying so I removed it temp.
#+begin_src emacs-lisp
(setq ring-bell-function 'ignore)
(setq visual-bell nil)
#+end_src
** Disable Dialog Box
Disables the dialog prompting box and instead prompts the user in the minibuffer.
#+begin_src emacs-lisp
(setq use-dialog-box nil)
#+end_src
** Global Auto Revert
Enabling global auto revert in Emacs so that changes across a shared file system are synced with emacs buffers.
#+begin_src emacs-lisp
(global-auto-revert-mode 1)
(setq auto-revert-use-notify nil)
(setq auto-revert-verbose 1)
#+end_src
** Relocate Custom File
Change location of custom file. This will stop *custom* from appending to the config file.
#+begin_src emacs-lisp
(setq custom-file "~/.emacs.d/custom.el")
(unless (file-exists-p custom-file)
(make-empty-file custom-file))
(load custom-file)
#+end_src
** Disable Docstring Warnings
#+begin_src emacs-lisp
(setq byte-compile-warnings '(not docstrings))
#+end_src
** Move Backup File
This moves the backup files so that Emacs doesn't clutter up directories with backup files.
#+begin_src emacs-lisp
(setq backup-directory-alist '(("." . "~/.emacs.d/backups/")))
#+end_src
** White Space
Various configuration relating to white-space.
#+begin_src emacs-lisp
(setq-default electric-ident-inhibit t) ; Stop indentation of the previous line.
#+end_src
*** Tabs/Spaces
Disable tabs and replace them with a custom number of spaces.
#+begin_src emacs-lisp
(setq-default indent-tabs-mode nil) ; Use spaces instead of tabs.
(setq-default tab-width 4)
(setq-default evil-shift-width tab-width)
; C Indentation
(setq-default c-basic-offset 4)
; Yara Indentation
(setq-default yara-indent-offset 4)
(setq-default yara-indent-section 4)
#+end_src
*** Visualizing White Space
Add a nice visualization for tabs and spaces. This can be helpful to identify which is which quickly to avoid submitting poorly spaced code.
#+begin_src emacs-lisp
(global-whitespace-mode)
(setq whitespace-global-modes '(not org-mode dired-mode erc-mode))
(setq whitespace-style '(face tabs spaces tab-mark space-mark trailing))
(custom-set-faces
'(whitespace-tab ((t (:foreground "#384551"))))
'(whitespace-space ((t (:foreground "#384551")))))
(setq whitespace-display-mappings
'((tab-mark 9 [187 9] [92 9])
(space-mark 32 [183] [46])))
#+end_src
** SSH Remoting with Tramp
Below are a few configuration changes to avoid TRAMP freezes when attempting to SSH into another system with more complex config files.
#+begin_src emacs-lisp
(setq tramp-remote-shell "/bin/sh")
(setq tramp-remote-shell-login "-l")
(setq tramp-remote-shell-args "-c")
#+end_src
** Updating PATH from User Shell
This package fixes issues with the path on MacOS by pulling the ~$PATH~ variable from the user's shell.
#+begin_src emacs-lisp
(use-package exec-path-from-shell
:config
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize)))
#+end_src
* Package Manager
Emacs and packages. Pretty much a requirement.
** Setup package
Initialize *package* and setup package archives. This lets you install packages from other archives such as [[https://melpa.org/][melpa]].
#+begin_src emacs-lisp
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
#+end_src
** Use-package
Install use package for easier installation of other packages.
#+begin_src emacs-lisp
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)
(setq use-package-compute-statistics t)
#+end_src
* Cosmetic
Packages that change the look of Emacs in some way.
** Cosmetic Configuration
Disable the useless features that make Emacs bloated.
#+begin_src emacs-lisp
; Disable startup message
(setq inhibit-startup-message t)
(scroll-bar-mode -1) ; Disable scrollbar
(tool-bar-mode -1) ; Disable toolbar
(tooltip-mode -1) ; Disable tooltips
(menu-bar-mode -1) ; Disable menu-bar
(set-fringe-mode 10) ; Add gaps on left and right
(setq scroll-margin 4) ; Scroll as cursor reaches bottom/top of page.
#+end_src
*** Change font
Pretty self explanatory.
#+begin_src emacs-lisp
(defun jm/set-font-faces ()
(set-face-attribute 'default nil :font "Maple Mono" :height 140))
#+end_src
Adding a fix for fonts when running Emacs as a daemon.
#+begin_src emacs-lisp
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(jm/set-font-faces))))
(jm/set-font-faces))
#+end_src
** Doom Modeline
Use doom modeline to make the modeline look nicer.
#+begin_src emacs-lisp
(use-package all-the-icons) ; requirement
(use-package doom-modeline
:init (doom-modeline-mode 1)
:config
(setq doom-modeline-height 45)
(display-time))
#+end_src
In order to avoid missing icons, you should also install the package ~all-the-icons-install-fonts~ through the Emacs command line.
** Doom Themes
Install doom themes for better themes.
#+begin_src emacs-lisp
(use-package doom-themes
:init (load-theme 'doom-city-lights t))
#+end_src
** Rainbow Delimiters
Colors parenthesis for better lisp syntax highlighting.
#+begin_src emacs-lisp
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode))
#+end_src
** Line Numbers
This adds relative line numbers while excluding certain modes.
#+begin_src emacs-lisp
; Disable line numbers for certain modes
(dolist (mode '(org-mode-hook
erc-mode-hook
mu4e-main-mode-hook
term-mode-hook
vterm-mode-hook
shell-mode-hook
eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
; Enable relative line numbers
(setq-default display-line-numbers-type 'visual)
(global-display-line-numbers-mode t)
#+end_src
* Keybindings
Contains the configuration for any keybindings or packages relating to keybindings.
** General Configurations
Remap quit command to make it easier to rescue a buffer. With this function, escape will be used instead of ~C-g~.
#+begin_src emacs-lisp
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
#+end_src
** Which-key
Lists all possible keybindings off of prefix.
#+begin_src emacs-lisp
(use-package which-key
:init (which-key-mode)
:diminish which-key-mode)
#+end_src
** General
General allows you to setup a prefix key easily. This makes it really easy to setup a bunch of keybindings with ease.
#+begin_src emacs-lisp
(use-package general
:config
(general-create-definer jm/leader-keys
:keymaps '(normal insert visual emacs)
:prefix "SPC"
:global-prefix "C-SPC")
(jm/leader-keys
; Emacs related keybindings
"r" '(rename-buffer :which-key "Rename buffer")
"er" '((lambda () (interactive) (load-file "~/.emacs")) :which-key "Reload emacs config")
"es" '(eshell :which-key "Open eshell terminal")))
#+end_src
** Evil
Evil is a package that adds vim keybindings to Emacs.
#+begin_src emacs-lisp
;; Setup vim keybindings with evil
(use-package evil
:init
(setq evil-want-integration t)
(setq evil-want-keybinding nil) ; replaced with evil collection
(setq evil-want-C-u-scroll t)
(setq evil-want-C-i-jump nil)
:config
(evil-mode 1)
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)
(define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join)
; Use visual line motions even outside of visual-line-mode buffers.
(evil-global-set-key 'motion "j" 'evil-next-visual-line)
(evil-global-set-key 'motion "k" 'evil-previous-visual-line)
; Modify which modes use vim keybindings.
(evil-set-initial-state 'messages-buffer-mode 'normal)
(evil-set-initial-state 'dashboard-mode 'normal))
#+end_src
*** Evil Collection
Evil collection is a package that replaces the bad ~evil-want-keybinding~ keybindings.
#+begin_src emacs-lisp
(use-package evil-collection
:after evil
:config (evil-collection-init))
#+end_src
*** Evil Numbers
The /Evil Numbers/ package implements the ability to increment or decrement numbers as you would with vim using ~C-a~ and ~C-x~.
#+begin_src emacs-lisp
(use-package evil-numbers
:after evil
:config
(evil-define-key '(normal visual) 'global (kbd "C-c =") 'evil-numbers/inc-at-pt)
(evil-define-key '(normal visual) 'global (kbd "C-c -") 'evil-numbers/dec-at-pt)
(evil-define-key '(normal visual) 'global (kbd "C-c C-=") 'evil-numbers/inc-at-pt-incremental)
(evil-define-key '(normal visual) 'global (kbd "C-c C--") 'evil-numbers/dec-at-pt-incremental))
#+end_src
** Undo-Tree
Undo tree's use is self explanatory. While the built-in Emacs undo system is fine for me, *undo-tree* is required as it fixes an issue with evil where you can't redo.
#+begin_src emacs-lisp
; Fix vim redo with undo tree
(use-package undo-tree
:after evil
:config
(evil-set-undo-system 'undo-tree)
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))
(global-undo-tree-mode 1))
#+end_src
* Other Packages
This is a list of installed packages not included in any other category.
** MacOS Environment Fix
When using emacs on MacOS, the environment variables are not synced properly and therefore require a separate package to fix this. In this case, this package is the ~exec-path-from-shell~.
#+begin_src emacs-lisp
;(use-package exec-path-from-shell
;:config
;(when (memq window-system '(mac ns x))
;(exec-path-from-shell-initialize)))
#+end_src
** Perspective
*Perspective* is a package to help with managing buffers. It allows for multiple /workspaces/ or /perspectives/ which each contain their own sub list of buffers.
#+begin_src emacs-lisp
(use-package perspective
:bind (("C-x b" . persp-switch-to-buffer*)
("C-x k" . persp-kill-buffer*))
:custom (persp-mode-prefix-key (kbd "C-x w"))
:init (persp-mode))
#+end_src
** Projectile
Projectile is a package for managing various /projects/ in emacs. It adds functionality to let you interact with various /projects/ such as quickly searching filenames, switching between all projects, grepping all files, etc.
#+begin_src emacs-lisp
(use-package projectile
:bind-keymap
("C-x p" . projectile-command-map)
:config
(projectile-mode +1)
:init
(when (file-directory-p "~/Projects")
(setq projectile-project-search-path '("~/Projects"))))
#+end_src
** Vertico
Vertico is a package that implements a drop-down like menu in the mini buffer allowing for much better searching.
#+begin_src emacs-lisp
(use-package vertico
:init
(vertico-mode))
#+end_src
When installing Vertico, the documentation mentions a few other packages that add some nice features that would come by default with something like /ivy/. I've added some descriptions of these below:
- ~savehist~ - One feature of Vertico that is really helpful is it's seamless integration with the built-in emacs package, ~savehist~, to save command history when navigating.
- ~marginalia~ - Similar to the definition of /marginalia/, this emacs package implements descriptions besides each option in Vertico completion. Some examples of this would be definitions for Elisp functions, more verbose file information, etc.
- ~orderless~ - By default, Vertico starts its completion from the start of the search the same way as default emacs completion. The ~orderless~ package changes this by implementing a nicer completion that searches for any similar options based on the provided search terms.
- ~consult~ - Adds a bunch of helpful search and navigation commands such as recursive file grepping, etc.
#+begin_src emacs-lisp
(use-package savehist
:init
(savehist-mode))
(use-package marginalia
:after vertico
:init
(marginalia-mode))
(use-package orderless
:custom
(completion-styles '(orderless basic))
(completion-category-overrides '((file (styles basic partial-completion)))))
(use-package consult
:after vertico
:config
(jm/leader-keys
"pg" 'consult-git-grep
"pf" 'consult-find))
#+end_src
** Helpful
*Helpful* is a package that improves the builtin Emacs help menus. The config below installs helpful and sets the keybindings to call helpful functions instead of the default emacs help.
#+begin_src emacs-lisp
(use-package helpful
:bind (("C-h f" . #'helpful-callable)
("C-h v" . #'helpful-variable)
("C-h k" . #'helpful-key)
("C-h x" . #'helpful-command)))
#+end_src
** Magit
*Magit* adds several features to Emacs that make using git easier.
#+begin_src emacs-lisp
(use-package magit
:bind (("C-x g" . magit-status)
("C-x C-g" . magit-status))
:config
(jm/leader-keys "gc" 'magit-clone))
#+end_src
** Dashboard
The Emacs dashboard package provides a nice dashboard when first starting up emacs.
#+begin_src emacs-lisp
(use-package dashboard
:init
(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))
dashboard-startup-banner 'logo
dashboard-icon-type 'nerd-icons
dashboard-set-file-icons t
dashboard-set-heading-icons t
dashboard-items '((projects . 5)
(recents . 5)
(agenda . 5)))
:config
(set-face-attribute 'dashboard-items-face nil :font "Maple Mono" :height 140)
(dashboard-setup-startup-hook))
#+end_src
** Ledger
Ledger is a Unix program that implements a finance tracking system or /ledger/. To implement this into emacs, you can install the ~ledger-mode~ emacs package.
#+begin_src emacs-lisp
(use-package ledger-mode
:mode ("\\.ledger\\'")
:config
(setq ledger-report-use-strict t
ledger-master-file (expand-file-name "Ledger/toc.ledger" jm/cloud-root)
ledger-accounts-file (expand-file-name "Ledger/accounts.ledger" jm/cloud-root))
(setq ledger-reports
`(("bal" ,(format "%%(binary) -f %s bal" ledger-master-file))
("budget" ,(format "%%(binary) -f %s --budget -p 'this month' bal Expenses" ledger-master-file))
("account" ,(format "%%(binary) -f %s reg %%(account)" ledger-master-file))
("monthly bal" ,(format "%%(binary) -f %s bal -p 'this month'" ledger-master-file))
("daily bal" ,(format "%%(binary) -f %s bal -p 'today'" ledger-master-file)))))
#+end_src
** Alert
Alert is another library that better implements system notifications through emacs. As I use both MacOS and Linux, notifications don't work out of the box for both systems. Using alert, I can change this by selecting a working notify system for each OS.
#+begin_src emacs-lisp
(use-package alert
:config
(setq alert-default-style
(if (eq system-type 'darwin)
'osx-notifier
'libnotify)))
#+end_src
* Builtin Package Config
** Dired
Dired is a built-in package in Emacs that allows for basic file navigation. While it serves its purpose, vanilla dired is far from a good file navigator. With some basic customization however, this can be changed.
#+begin_src emacs-lisp
(use-package dired
:ensure nil ; Melpa won't be able to find this package.
:commands (dired dired-jump)
:bind (("C-x C-j" . dired-jump))
:custom ((dired-listing-switches "-ahgo"))
:config
(evil-collection-define-key 'normal 'dired-mode-map
"h" 'dired-up-directory
"l" 'dired-find-file
"T" 'dired-create-empty-file))
#+end_src
*** All the Icons Dired
~all-the-icons-dired~ is a dired plugin that adds icons to each of the files.
#+begin_src emacs-lisp
(use-package all-the-icons-dired
:after dired
:hook (dired-mode . all-the-icons-dired-mode))
#+end_src
*** Hide Dotfiles
This hides all dotfiles in dired with the keybinding ~H~.
#+begin_src emacs-lisp
(use-package dired-hide-dotfiles
:hook (dired-mode . dired-hide-dotfiles-mode)
:config
(evil-collection-define-key 'normal 'dired-mode-map
"H" 'dired-hide-dotfiles-mode))
#+end_src
** ERC
ERC is a builtin package that adds IRC chatting functionality to emacs.
#+begin_src emacs-lisp
;; Shotcuts for general
(jm/leader-keys
"cc" '(erc-tls :which-key "Connect to IRC over TLS")
"cb" '(erc-switch-to-buffer :which-key "Switch IRC buffers"))
(use-package erc
:ensure nil
:defer t
:custom
(erc-nick "random936")
(erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
"353" "324" "329" "332" "333" "353" "477"))
(erc-autojoin-channels-alist '((".*\.libera\.chat" "#emacs" "#gentoo" "#systemcrafters")))
(erc-fill-column 120)
(erc-fill-function 'erc-fill-static)
(erc-fill-static-center 20)
(erc-kill-buffer-on-part t)
(erc-kill-queries-on-quit t)
(erc-kill-server-buffer-on-quit t)
:config
(add-to-list 'erc-modules 'notifications)
;; Fix for perspective.el not adding ERC buffers to active perspective.
(add-hook 'erc-join-hook (lambda (&rest args)
(persp-add-buffer (current-buffer)))))
#+end_src
*** ERC Extensions
To highlight each nickname with a different color, I can use the ~erc-hl-nicks~ package. I can also use the ~erc-image~ package to render images sent by other users over IRC.
#+begin_src emacs-lisp
(use-package erc-hl-nicks
:after erc
:config (add-to-list 'erc-modules 'hl-nicks))
(use-package erc-image
:after erc
:config
(setq erc-image-inline-rescale 300)
(add-to-list 'erc-modules 'image))
#+end_src
*** ERC Alert Integration
Alert is a notification system that works with MacOS, however it is not integrated by default. To fix this, you need to create a function to hook with the ERC text matching.
#+begin_src emacs-lisp
(defun jm/erc-alert-integration (match-type nick message)
(alert message :title (format "%s in %s" nick (buffer-name)) :category 'erc))
(add-hook 'erc-text-matched-hook 'jm/erc-alert-integration)
#+end_src
* Import Other Files
This is the section to include imports from other files.
#+begin_src emacs-lisp
(defun jm/load-config-if-exists (file-path)
(if (file-exists-p file-path)
(org-babel-load-file file-path)
(warn (concat "Failed to load config: " file-path))))
(jm/load-config-if-exists "~/.emacs.d/functions.org") ; Personal Elisp Functions
(jm/load-config-if-exists "~/.emacs.d/org.org") ; Org-mode
(jm/load-config-if-exists "~/.emacs.d/lsp.org") ; Language Server Protocol
(jm/load-config-if-exists "~/.emacs.d/terminal.org") ; Emacs Terminal
(jm/load-config-if-exists "~/.emacs.d/email.org") ; Mu4e/SMTP Config
;; Load EXWM configuration if environment variable set.
(let ((exwm-org-file "~/.emacs.d/exwm.org"))
(when (and (file-exists-p exwm-org-file) (getenv "USING_EXWM"))
(org-babel-load-file exwm-org-file)))
#+end_src

151
assets/.emacs.d/email.org Normal file
View File

@@ -0,0 +1,151 @@
#+TITLE: Email Configuration
* Initial Setup
Before installing any packages with emacs, there is some initial setup that needs to be done.
** Exporting TLS Certificates
After installing the ~proton-mail-bridge~, you will need to export the certificates by going to Settings > Advanced settings > Export TLS certificates. From here you should place this at the path ~~/.config/protonmail/bridge/~.
** Mu4e Installation
In this section, I'm setting up ~mu4e~ to give emacs the capability to send emails using my gmail account. To start, you need to install the ~mu4e~ package outside of Emacs.
#+begin_src bash
yay -S mu
#+end_src
After installing the ~mu~ client, I also need to run a initial index using the following command:
#+begin_src bash
mkdir ~/.mail && mbsync -a
mu init --maildir=~/.mail --my-address=jadenprovost@gmail.com
mu index
#+end_src
* Custom Functions
#+begin_src emacs-lisp
(defconst jm/email-filters-path "~/Nextcloud/filters.json")
(defun jm/any-string-match-p (needles haystack)
(when (listp needles)
(let (result)
(dolist (needle needles result)
(setq result (or result (s-matches-p needle haystack)))))))
(defun jm/load-email-filters (msg)
(let ((filters (append (json-read-file jm/email-filters-path) nil))
(trash-flag (member
(car (mu4e-string-to-flags "T"))
(mu4e-message-field msg :flags)))
folder)
(if trash-flag
"/Trash"
(dolist (filter filters)
(let ((subject (mu4e-message-field msg :subject))
(filter-folder (cdr (assoc-string "folder" filter)))
(subject-filters (append (cdr (assoc-string "subject" filter)) nil))
(from-filters (append (cdr (assoc-string "from-contact" filter)) nil))
(bcc-filters (append (cdr (assoc-string "bcc-contact" filter)) nil)))
(when (or (jm/any-string-match-p subject-filters subject)
(mu4e-message-contact-field-matches msg :from from-filters)
(mu4e-message-contact-field-matches msg :bcc bcc-filters))
(setq folder filter-folder))))
(if folder folder "/Archive"))))
#+end_src
* Mu4e
This section contains the ~mu4e~ emacs specific configuration.
#+begin_src emacs-lisp
(use-package mu4e
:ensure nil
:bind ("C-x m" . mu4e)
:config
(add-hook 'mu4e-compose-mode-hook (lambda () (use-hard-newlines -1)))
(setq mu4e-mu-binary (executable-find "mu")
mu4e-change-filenames-when-moving t ; Avoids syncing issues.
mu4e-search-results-limit 2000 ; Extend header view max message count.
mu4e-compose-format-flowed t) ; Disable hard line wrapping
;; Fix message citation style for gmail.
(setq message-cite-style message-cite-style-gmail
message-citation-line-format "On %a, %b %d, %Y at %H:%M %p %f wrote:"
message-citation-line-function 'message-insert-formatted-citation-line)
;; Refresh mail every X seconds. Set to 5 minutes currently
(setq mu4e-update-interval (* 5 60)
mu4e-get-mail-command "mbsync -a"
mu4e-maildir "~/.mail")
;; Config mu4e folders
(setq mu4e-drafts-folder "/Drafts"
mu4e-sent-folder "/Sent"
mu4e-trash-folder "/Trash"
mu4e-refile-folder #'jm/load-email-filters)
;; Config mu4e bookmarks
(setq mu4e-bookmarks
'((:name "Filtered unread messages" :query "flag:unread AND (maildir:/Archive OR maildir:/INBOX) AND NOT flag:trashed" :key ?u)
(:name "All unread messages" :query "flag:unread" :key ?U)
(:name "Today's messages" :query "date:today..now" :key ?t)
(:name "Last 7 days" :query "date:7d..now" :hide-unread t :key ?w)
(:name "Flagged messages" :query "flag:flagged" :key ?f)))
(setq mu4e-maildir-shortcuts
;; Proton folders
'((:maildir "/INBOX" :key ?i)
(:maildir "/Archive" :key ?a)
(:maildir "/Drafts" :key ?d)
(:maildir "/Sent" :key ?s)
(:maildir "/Spam" :key ?S)
(:maildir "/Trash" :key ?t)
;; My folders
(:maildir "/Folders/Finance" :key ?f)
(:maildir "/Folders/Packages" :key ?p)
(:maildir "/Folders/Work" :key ?w)
(:maildir "/Folders/Club" :key ?c)
(:maildir "/Folders/UCSC" :key ?u)
(:maildir "/Folders/Newsletters" :key ?n))))
#+end_src
Adding some configuration to correct ~mu4e~'s default values.
#+begin_src emacs-lisp
(setq user-full-name "Jaden Provost Maxwell-Comfort")
(setq user-mail-address "jadenprovost@proton.me")
#+end_src
* SMTP
In order to send mail with ~mu4e~, you must also configure an SMTP client. Based on the ~mu4e~ wiki, I was able to shamelessly steal some of the config for the gmail configuration found [[https://www.djcbsoftware.nl/code/mu/mu4e/Gmail-configuration.html][here]].
#+begin_src emacs-lisp
(use-package smtpmail
:after mu4e
:config
(setq smtpmail-stream-type 'starttls
smtpmail-smtp-server "127.0.0.1"
smtpmail-smtp-service 1025))
(setq send-mail-function 'smtpmail-send-it)
#+end_src
When running this however, you need to authenticate by creating an ~~/.authinfo~ file. This file is formatted as follows:
#+begin_src authinfo
# For gmail
machine smtp.gmail.com port 465 login "<USER>" password "<PASS>"
# For Proton Mail
# Copy the remaining information from the proton-mail-bridge for both IMAP and SMTP
machine 127.0.0.1 port <PORT> login "<USER>" password "<PASS>"
machine 127.0.0.1 port <PORT> login "<USER>" password "<PASS>"
#+end_src
Similarly to the password configured above for the IMAP server, you can also pass an ~authinfo.gpg~ file for some added security. If you are using proton mail, make sure this matches the path set in your ~.mbsyncrc~ file.

98
assets/.emacs.d/exwm.org Normal file
View File

@@ -0,0 +1,98 @@
* General Config
This section contains the general configuration for EXWM.
#+begin_src emacs-lisp
(defun jm/exwm-update-class ()
(exwm-workspace-rename-buffer exwm-class-name))
(use-package exwm
:config
; Set default number of workspaces
(setq exwm-workspace-number 5)
; Add key remaps
(start-process-shell-command "xmodmap" nil "xmodmap ~/.Xmodmap")
; Add hook to rename EXWM window to running application name
(add-hook 'exwm-update-class-hook #'jm/exwm-update-class)
;; These keys should always pass through to Emacs
(setq exwm-input-prefix-keys
'(?\C-x
?\C-w
?\C-u
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\C-\M-j ;; Buffer list
?\C-\ )) ;; Ctrl+Space
;; Set up global key bindings. These always work, no matter the input state!
;; Keep in mind that changing this list after EXWM initializes has no effect.
(setq exwm-input-global-keys
`(
;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
([?\s-r] . exwm-reset)
;; Move window to other workspace
([?\s-m] . exwm-workspace-move-window)
;; Launch applications via shell command
([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; Switch workspace
([?\s-w] . exwm-workspace-switch)
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
(exwm-enable))
#+end_src
* Randr
EXWM Randr is a built-in plugin that allows you to add two monitor support. By default EXWM merges the two monitors into one making the desktop environment unusable.
#+begin_src emacs-lisp
(use-package exwm-randr
:ensure nil
:config
(exwm-randr-enable)
(start-process-shell-command "xrandr" nil "xrandr --output HDMI-1 --mode 2560x1080 --pos 0x694 --rotate normal --output DP-0 --off --output DP-1 --primary --mode 3440x1440 --pos 2560x0 --rotate normal --output DP-2 --off --output DP-3 --off --output DP-4 --off --output DP-5 --off")
;; This will need to be updated to the name of a display! You can find
;; the names of your displays by looking at arandr or the output of xrandr
(setq exwm-randr-workspace-monitor-plist '(2 "HDMI-1" 3 "HDMI-1")))
#+end_src
* System Tray
#+begin_src emacs-lisp
(use-package exwm-systemtray
:ensure nil
:config
(exwm-systemtray-enable))
#+end_src
* Volume Control
To control volume through EXWM you can install the ~pulseaudio-control~ package.
#+begin_src emacs-lisp
(use-package pulseaudio-control
:config
(pulseaudio-control-default-keybindings))
#+end_src

View File

@@ -0,0 +1,230 @@
#+TITLE: Custom Elisp Functions
* Org-Roam
** Refresh Org Roam Agenda
Creates a function to refresh the ~org-agenda-files~ variable to be set to include all org roam notes files.
#+begin_src emacs-lisp
(defun jm/org-roam-refresh-agenda-list ()
(interactive)
(org-roam-db-sync)
(let ((directory (expand-file-name org-roam-dailies-directory org-roam-directory)))
(setq org-agenda-files
(seq-filter
(lambda (file-path) (not (s-starts-with-p directory file-path)))
(org-roam-list-files)))))
#+end_src
** Custom Org-Roam Indexing Functions
Before getting into the main config for Org-roam, I've created a few functions for better indexing nodes stored in the org-roam database. Specifically, these functions separate the org roam dailies nodes from other nodes.
#+begin_src emacs-lisp
(defun jm/org-roam-find-filter (node)
(let ((directory (expand-file-name org-roam-dailies-directory org-roam-directory)))
(string= (file-name-directory (org-roam-node-file node))
directory)))
(defun jm/org-roam-dailies-find ()
(interactive)
(org-roam-node-find nil nil #'jm/org-roam-find-filter))
(defun jm/org-roam-find ()
(interactive)
(org-roam-node-find
nil nil
(lambda (node) (not (jm/org-roam-find-filter node)))))
#+end_src
** Org Roam Dailies Shortcuts
Shortcut to goto todays org-roam dailies document.
#+begin_src emacs-lisp
(defun jm/dailies-file-p ()
(when-let ((file (buffer-file-name))
(file-base (file-name-base (buffer-file-name))))
(s-matches-p "^[0-9]+-[0-9]+-[0-9]+$" file-base)))
(defun jm/org-roam-capture-today ()
(interactive)
(jm/org-roam-goto-day 0 t "t")
(delete-other-windows))
(defun jm/org-roam-goto-day (days &optional force-capture keys)
(let* ((base-time
(if (and (jm/dailies-file-p) (not (eq days 0)))
(date-to-time (file-name-base (buffer-file-name)))
(current-time)))
(rel-time (time-add base-time (days-to-time days)))
(path (format-time-string "%Y-%m-%d.org" rel-time))
(full-path (file-name-concat org-roam-directory "daily" path)))
(jm/org-roam-refresh-agenda-list)
(if (and (file-exists-p full-path) (not force-capture))
(find-file full-path)
(org-roam-dailies--capture rel-time nil keys))))
(jm/leader-keys
"oy" '((lambda () (interactive) (jm/org-roam-goto-day -1)) :which-key "Open/create yesterday's daily notes file")
"ot" '((lambda () (interactive) (jm/org-roam-goto-day 0)) :which-key "Open/create today's daily notes file")
"ok" '((lambda () (interactive) (jm/org-roam-goto-day 1)) :which-key "Open/create tomorrow's daily notes file"))
#+end_src
* Capture Template Functions
These functions are for my org roam daily capture template.
** Helper Functions
#+begin_src emacs-lisp
(defun jm/dt-filter-tasks (helper query)
(let ((entries (org-map-entries helper query 'agenda)))
(string-join (delq nil entries) "\n")))
(defun jm/dt-format-link (prefix)
(let ((item-name (org-entry-get nil "ITEM"))
(item-id (org-id-get-create))
(doc-title (org-get-title)))
(if doc-title
(format "%s [[id:%s][%s - %s]]" prefix item-id doc-title item-name)
(format "%s [[id:%s][%s]]" prefix item-id item-name))))
(defun jm/dt-concat-todos (todo-lists)
(let ((todos nil))
(dolist (todo todo-lists todos)
(setq todos (append todos (string-lines todo))))
(string-join (delete "" (delete-dups todos)) "\n")))
#+end_src
** Queries
#+begin_src emacs-lisp
(defun jm/dt-get-priority (priority &optional prompt)
(jm/dt-filter-tasks
(lambda () (when (equal priority (org-entry-get nil "PRIORITY"))
(jm/dt-format-link (or prompt "+"))))
"TODO=\"TODO\"|TODO=\"IN PROGRESS\""))
(defun jm/dt-get-status (status &optional prompt)
(jm/dt-filter-tasks (lambda () (jm/dt-format-link (or prompt "+ [ ]")))
(concat "TODO=\"" status "\"")))
(defconst jm/dt-deadline "DEADLINE")
(defconst jm/dt-scheduled "SCHEDULED")
(defun jm/dt-get-within (type days &optional prompt)
(unless (or (eq type jm/dt-deadline) (eq type jm/dt-scheduled))
(error "Invalid type for jm/dt-get-within."))
(let* ((time (or (org-capture-get :default-time) (current-time)))
(date (time-add time (days-to-time days))))
(jm/dt-filter-tasks
(lambda () (when (member (org-get-todo-state) '("TODO" "WAITING" "IN PROGRESS"))
(jm/dt-format-link (or prompt "+"))))
(concat type (format-time-string "<=\"<%Y-%m-%d>\"" date)))))
(defun jm/dt-get-due-within (days &optional prompt)
(jm/dt-get-within jm/dt-deadline days prompt))
(defun jm/dt-get-scheduled-within (days &optional prompt)
(jm/dt-get-within jm/dt-scheduled days prompt))
#+end_src
** Dynamic Habits
#+begin_src emacs-lisp
(defun jm/dt-habit (habit)
(let* ((org-date (or (org-capture-get :default-time) (current-time)))
(today (downcase (format-time-string "%a" org-date))))
(when (seq-contains-p (cdr habit) today)
(car habit))))
(defun jm/dt-habits (habits)
(let ((out-list '()))
(dolist (habit habits out-list)
(when-let (out (jm/dt-habit habit))
(push out out-list)))
(string-join out-list "\n")))
#+end_src
** Weekly Scorecard
Taken from the book /12 Week Year/, the weekly scorecard is a way to measure how well you've been acting on your plan towards your weekly goal. By seeing how effective you're execution is, you are forced to face the objective truths about your productivity.
+ [ ] My test checkbox.
+ [ ] Other checkbox.
+ [X] My test checkbox.
#+begin_src emacs-lisp
(defun jm/checkbox-checked-p (checkbox)
(eq 'on (org-element-property :checkbox checkbox)))
(defun jm/catalog-checkboxes (buffer)
(with-current-buffer buffer
(let* ((filter-fn (lambda (elem) (when (org-element-property :checkbox elem) elem)))
(elem-list (org-element-map (org-element-parse-buffer) 'item filter-fn)))
(delq nil elem-list))))
(defun jm/score-checkboxes (buffer &optional dictionary)
(dolist (box (jm/catalog-checkboxes buffer) dictionary)
(with-current-buffer buffer
(let* ((start (org-element-property :contents-begin box))
(end (progn (goto-char start)
(or (- (search-forward "\n" nil t) 1) (point-max))))
(key (buffer-substring-no-properties start end))
(checked (if (jm/checkbox-checked-p box) 1 0))
(pair (assoc key dictionary))
(counts (cdr pair)))
(if pair
(setcdr pair (list (+ checked (car counts)) (1+ (cadr counts))))
(push (cons key (list checked 1)) dictionary))))))
(defun jm/n-day-scorecard (n &optional start-time)
(let ((time (or start-time (org-capture-get :default-time) (current-time)))
(dailies-directory (expand-file-name org-roam-dailies-directory org-roam-directory))
(dict nil))
(dotimes (i n dict)
(let* ((day (time-subtract time (days-to-time i)))
(file-name (format-time-string "%Y-%m-%d.org" day))
(file-path (expand-file-name file-name dailies-directory))
(open (get-file-buffer file-path))
(buffer (find-file-noselect file-path)))
(setq dict (jm/score-checkboxes buffer dict))
(unless open (kill-buffer buffer))))))
(defun jm/scorecard-table (tasks)
(let* ((separator "|---|---|---|---|\n")
(table (concat "| Task | Completed | Total | Percentage |\n" separator))
(checked-sum 0)
(total-sum 0))
(dolist (box tasks table)
(let* ((name (car box))
(checked (cadr box))
(total (cadr (cdr box)))
(percentage (* (/ (float checked) total) 100)))
(setq total-sum (+ total total-sum)
checked-sum (+ checked checked-sum)
table (format "%s| %s | %d | %d | %d%% |\n"
table name checked total percentage))))
(format "%s%s| Average | %d | %d | %d%% |\n"
table separator checked-sum total-sum
(* (/ (float checked-sum) total-sum) 100))))
(defun jm/scorecard (days &optional start-time)
(interactive)
(jm/scorecard-table (jm/n-day-scorecard days start-time)))
(defun jm/scorecard-from-heading ()
(interactive)
(save-excursion
(save-restriction
(org-back-to-heading-or-point-min)
(org-narrow-to-subtree)
(let* ((score (jm/score-checkboxes (current-buffer)))
(table (jm/scorecard-table score)))
(org-end-of-subtree)
(insert "\n" table "\n")))))
(jm/leader-keys
"os" '(jm/scorecard-from-heading :which-key "Open/create yesterday's daily notes file"))
#+end_src

250
assets/.emacs.d/lsp.org Normal file
View File

@@ -0,0 +1,250 @@
Language servers provide auto completion and syntax highlighting capabilities making them essential for development.
* Lsp Mode
Lsp Mode is a package that adds language server functionalities to Emacs.
** Breadcrumb Header Line
This adds a headerline that shows the scope of where the cursor is in the code. For example if the user is in the main function, the headerline will contain main.
#+begin_src emacs-lisp
(defun jm/lsp-mode-setup ()
(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
(lsp-headerline-breadcrumb-mode))
#+end_src
** Install Lsp Mode
Below I am installing the actual package and adding some basic configuration.
#+begin_src emacs-lisp
(use-package lsp-mode
:init (setq lsp-keymap-prefix "C-c l") ; Lsp mode prefix
:hook (lsp-mode . jm/lsp-mode-setup)
:commands (lsp lsp-deferred) ; Startup commands
:config
(lsp-enable-which-key-integration t)
(setq lsp-enable-snippet nil))
#+end_src
** Lsp Additional Packages
#+begin_src emacs-lisp
(use-package lsp-ui
:hook (lsp-mode . lsp-ui-mode)
:config
(setq lsp-ui-sideline-enable t
lsp-ui-show-diagnostics t
lsp-ui-doc-enable t))
#+end_src
** Company Mode
Company is a package that automatically finds completions instead of making the user run a command for completions.
#+begin_src emacs-lisp
(use-package company
:after lsp-mode
:hook (lsp-mode . company-mode)
:bind (:map company-active-map ; Map tab to select completion
("<tab>" . company-complete-selection))
(:map lsp-mode-map
("<tab>" . company-indent-or-complete-common)))
#+end_src
** Flycheck
#+begin_src emacs-lisp
(use-package flycheck
:init (global-flycheck-mode))
#+end_src
** Direnv for Nix-Shell Integration
Direnv is a program that will automatically run ~nix-shell~ when a ~.envrc~ file is found. Using the ~emacs-direnv~ package, you can more easily integrate nix into your development environment.
#+begin_src emacs-lisp
(use-package direnv
:config
(direnv-mode))
#+end_src
* Language Servers
This will include any language server packages and configuration.
** HTML
#+begin_src emacs-lisp
(use-package web-mode
:defer t
:mode ("\\.html\\'" "\\.svelte\\'")
:hook (web-mode . lsp-deferred)
:init
(setq web-mode-engines-alist '(("svelte" . "\\.svelte\\'"))))
#+end_src
** JavaScript/Typescript
#+begin_src emacs-lisp
(use-package typescript-mode
:defer t
:mode ("\\.ts\\'" "\\.js\\'")
:hook (typescript-mode . lsp-deferred))
#+end_src
Install the ~typescript-language-server~ through npm.
#+begin_src sh
npm install -g typescript-language-server
#+end_src
** Python
#+begin_src emacs-lisp
(use-package python-mode
:defer t
:mode ("\\.py\\'")
:hook (python-mode . lsp-deferred))
#+end_src
Install the ~python-lsp-server~ though pip.
#+begin_src sh
pip install python-lsp-server
#+end_src
** C/C++
#+begin_src emacs-lisp
(use-package ccls
:defer t
:hook ((c-mode cc-mode c++-mode objc-mode cuda-mode) .
(lambda () (require 'ccls) (lsp)))
:config
(setq ccls-executable "/usr/bin/ccls"))
#+end_src
Install ~ccls~ with homebrew using the following command.
#+begin_src sh
sudo apt install ccls
#+end_src
** Golang
#+begin_src emacs-lisp
(use-package go-mode
:defer t
:hook (go-mode . lsp-deferred))
#+end_src
** Rust
#+begin_src emacs-lisp
(use-package rustic
:defer t
:hook (rust-mode . lsp-deferred)
:init
(let ((brew-prefix (string-trim (shell-command-to-string "brew --prefix"))))
(when (and (memq window-system '(mac ns x)) brew-prefix (f-directory-p brew-prefix))
(setenv "YARA_LIBRARY_PATH" (expand-file-name "lib" brew-prefix))
(setenv "YARA_INCLUDE_DIR" (expand-file-name "include" brew-prefix)))))
#+end_src
** C#
#+begin_src emacs-lisp
(use-package csharp-mode
:defer t
:hook (csharp-mode . lsp-deferred))
#+end_src
** JSON
#+begin_src emacs-lisp
(use-package json-mode
:defer t
:hook (json-mode . lsp-deferred))
#+end_src
** Yaml
#+begin_src emacs-lisp
(use-package yaml-mode
:defer t
:hook (yaml-mode . lsp-deferred))
#+end_src
** Yara
To install the corresponding LSP, you need to install ~yls~. Using the command ~pip install -U yls-yara~. Keep in mind that ~yls~ is dependent on an up to date version of ~yara-python~.
#+begin_src emacs-lisp
(use-package yara-mode
:defer t
:hook (yara-mode . lsp-deferred)
:config
(with-eval-after-load 'lsp-mode
(add-to-list 'lsp-language-id-configuration
'(yara-mode . "yara"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "yls")
:activation-fn (lsp-activate-on "yara")
:server-id 'yls))))
#+end_src
** R
#+begin_src emacs-lisp
(use-package ess
:defer t
:hook (R-mode . lsp-deferred))
#+end_src
** Haskell
#+begin_src emacs-lisp
(use-package haskell-mode
:defer t
:hook (haskell-mode . lsp-deferred))
(use-package lsp-haskell
:defer t
:hook (lsp-literate-mode . lsp-deferred))
#+end_src
** Ebuild
Ebuild is the language used for Gentoo packages installed with the ~emerge~ utility. As this package is Gentoo specific, you will have to install it the command below:
#+begin_src bash
sudo emerge -v app-emacs/ebuild-mode
#+end_src
#+begin_src emacs-lisp
(use-package ebuild-mode
:ensure nil
:defer t
:hook (ebuild-mode . lsp-deferred))
#+end_src
** Nix
Nix is the language used by NixOS and the Nix package manager.
#+begin_src emacs-lisp
(use-package lsp-nix
:ensure lsp-mode
:after (lsp-mode)
:demand t
:custom (lsp-nix-nil-formatter ["nixpkgs-fmt"]))
(use-package nix-mode
:mode "\\.nix\\'"
:hook (nix-mode . lsp-deferred))
#+end_src

270
assets/.emacs.d/org.org Normal file
View File

@@ -0,0 +1,270 @@
Org is a package that allows you to create files like this one that look nice while also being able to run code. In this file, the code being run is stored in code blocks and all other text is disregarded.
* Org Setup
This installs the org package and creates a setup function to enable/disable certain functionalities.
#+begin_src emacs-lisp
;; Setup org mode
(defun jm/org-mode-setup ()
(org-indent-mode)
(flyspell-mode)
(variable-pitch-mode 1)
(visual-line-mode 1)
(add-to-list 'org-link-frame-setup '(file . find-file))) ; Open link in current window not other window.
(use-package org
:hook ((org-mode . jm/org-mode-setup)
(org-agenda-mode . jm/org-roam-refresh-agenda-list))
:config
(setq jm/inbox-file (expand-file-name "inbox.org" jm/notes-directory)
org-ellipsis ""
org-pretty-entities t
org-hide-emphasis-markers t
org-src-preserve-indentation t
;; Default export configuration
org-export-with-toc nil
org-export-with-section-numbers nil
org-export-with-sub-superscripts nil
org-latex-src-block-backend 'listings
org-format-latex-options (plist-put org-format-latex-options :scale 1.3)
;; Org agenda timestamp formatting
org-display-custom-times t
org-time-stamp-custom-formats '("%m-%d-%y %a" . "%m-%d-%y %a %I:%M %p")
;; Capture templates
org-capture-templates '(("i" "Inbox" entry (file jm/inbox-file)
"* TODO %^{Task}\nDEADLINE: %^t SCHEDULED: %^t")))
(jm/leader-keys
"oa" '(org-agenda :which-key "Org agenda")
"oc" '(org-capture :which-key "Org capture")
"oi" '((lambda () (interactive) (find-file jm/inbox-file)) :which-key "Open inbox file")))
#+end_src
* Cosmetics
** Org-Modern
Org-Modern is a package that adds several features to emacs to make it look more /modern/.
#+begin_src emacs-lisp
(use-package org-modern
:after org
:hook ((org-mode . org-modern-mode)
(org-agenda-finalize . org-modern-agenda))
:config
(setq org-modern-star 'replace
org-modern-replace-stars '("" "" "" "" "" "" "")))
#+end_src
Some examples:
** Font Changes
Org-faces changes the font size of the headings to make them bigger in the org file. Though this code also changes the font to a variable-pitch font. To make it so that only fixed-pitch fonts are used in things like code blocks, *set-face-attribute* is used below.
#+begin_src emacs-lisp
(with-eval-after-load 'org-faces
;; Set faces for heading size levels
(dolist (face '((org-level-1 . 1.2)
(org-level-2 . 1.1)
(org-level-3 . 1.05)
(org-level-4 . 1.0)
(org-level-5 . 1.0)
(org-level-6 . 1.0)
(org-level-7 . 1.0)
(org-level-8 . 1.0)))
(set-face-attribute (car face) nil :font "Maple Mono" :height (cdr face)))
;; Ensure that anything that should be fixed-pitch in Org files appears that way
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number nil :inherit 'fixed-pitch)
(set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
#+end_src
** Syntax Highlighting in Latex Exports
By default the syntax highlighting for latex/PDF documents exported with Emacs is pretty lackluster. To improve this, I can install the ~engrave-faces~ package.
#+begin_src emacs-lisp
(use-package engrave-faces
:after ox-latex
:config
(setq org-latex-src-block-backend 'engraved))
#+end_src
* Todo Items
** Custom States
Adds custom states to tasks such as ~IN PROGRESS~, ~CANCELLED~, etc. I've also added some changes to the color of the todo items based on the status. For example, turning the task face orange if it is /in progress/.
#+begin_src emacs-lisp
(setq org-todo-keyword-faces
'(("IN PROGRESS" . (:foreground "orange" :weight bold))
("WAITING" . (:foreground "yellow" :weight bold))))
(setq org-modern-todo-faces
'(("IN PROGRESS" . (:background "orange" :foreground "black" :weight bold))
("WAITING" . (:background "yellow" :foreground "black" :weight bold))))
(setq org-todo-keywords
'((sequence
"TODO(t)"
"IN PROGRESS(i)"
"WAITING(w)"
"|"
"DONE(d)"
"CANCELLED(c)"
"FAILED(f)")))
(setq org-clock-in-switch-to-state "IN PROGRESS")
#+end_src
** Refresh Checkboxes
Adds a hook to repeated tasks in org agenda that, when repeated, checkboxes will be reset to an unchecked state.
#+begin_src emacs-lisp
(add-hook 'org-todo-repeat-hook #'org-reset-checkbox-state-subtree)
#+end_src
** Automatic UUIDs
#+begin_src emacs-lisp
(add-hook 'org-after-todo-state-change-hook
(lambda () (when (org-get-todo-state)
(org-id-get-create))))
#+end_src
** Org Agenda
Org mode by default contains an /agenda/ system which is like a basic calendar that allows you to schedule todo items from org documents. All of the todo items from each org document are stored in a central area to allow for a formation of an /agenda/.
#+begin_src emacs-lisp
(setq org-agenda-start-with-log-mode t)
(setq org-log-done 'time)
(setq org-log-into-drawer t)
(setq org-priority-default ?D)
(setq org-priority-lowest ?D)
#+end_src
* Org Roam
Org-roam is a plain-text knowledge management system. It brings some of Roam's more powerful features into the Org-mode ecosystem such as org-file linking, etc. Below is the main config for org-roam.
#+begin_src emacs-lisp
(use-package org-roam
:init (require 'org-roam-dailies)
:custom
(org-roam-directory jm/notes-directory)
(org-roam-node-display-template "${title:60} ${file-title}")
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . jm/org-roam-find)
("C-c n d" . jm/org-roam-dailies-find)
("C-c n i" . org-roam-node-insert)
("C-c n c" . org-roam-capture)
("C-c n o" . org-id-get-create)
("C-c n y" . org-roam-dailies-capture-yesterday)
("C-c n t" . org-roam-dailies-capture-today)
("C-c n k" . org-roam-dailies-capture-tomorrow)
("C-c n r" . jm/org-roam-refresh-agenda-list))
:config
;; Config for org-roam capture templates.
(setq jm/org-roam-templates-directory (expand-file-name "templates" org-roam-directory)
org-roam-capture-templates
`(("d" "Default" plain "%?"
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("p" "Project" plain
(file ,(expand-file-name "project.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n")
:unnarrowed t)
("y" "12 Week Year" plain
(file ,(expand-file-name "12-week-year.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n")
:unnarrowed t)))
(setq org-roam-dailies-capture-templates
`(("d" "Default" entry "* %?"
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))
("r" "Reflection" entry
(file ,(expand-file-name "reflection.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t)
("S" "Weekly Scorecard" entry
(file ,(expand-file-name "weekly-scorecard.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t)
("s" "Daily Scorecard" entry
(file ,(expand-file-name "daily-scorecard.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t)
("t" "Todos" entry
(file ,(expand-file-name "daily.org" jm/org-roam-templates-directory))
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n")
:unnarrowed t)))
;; Create org roam directory and templates directory if not found.
(unless (file-directory-p org-roam-directory)
(make-directory org-roam-directory))
(unless (file-directory-p jm/org-roam-templates-directory)
(make-directory jm/org-roam-templates-directory))
(org-roam-db-autosync-mode))
#+end_src
** Consult Integration
Consult Org Roam is a package that integrates searching from consult with ~org-roam~ which adds functionality such as full text searches over notes.
#+begin_src emacs-lisp
(use-package consult-org-roam
:after org-roam
:bind (("C-c n s" . consult-org-roam-search))
:init (consult-org-roam-mode 1))
#+end_src
* Other Packages
** Evil Org
By default, many of the org specific keybindings do not feel intuitive when using evil mode. ~evil-org~ is a package that attempts to fix this by rebinding many of the default org keybindings to work better with Evil mode.
#+begin_src emacs-lisp
(use-package evil-org
:after org
:hook (org-mode . (lambda () evil-org-mode))
:config
(require 'evil-org-agenda)
(evil-org-agenda-set-keys))
#+end_src
** Fix Snippets
This is required as of org 9.2 as snippets such as ~<s~ don't work. Without this fix, you are required to manually type out structures like code blocks.
#+begin_src emacs-lisp
(require 'org-tempo)
#+end_src
** Ispell
Configure ~Ispell~ to not spell check certain org mode specific keywords. By default, ~Ispell~ doesn't have a default dictionary selected. This can be changed by running ~ispell-change-dictionary~. If no dictionaries are found, you can install them from the ~hunspell-en_us~ pacman package.
#+begin_src emacs-lisp
(add-to-list 'ispell-skip-region-alist '(":\\(PROPERTIES\\|LOGBOOK\\):" . ":END:")) ;
(add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" . "#\\+END_SRC"))
(add-to-list 'ispell-skip-region-alist '("~" . "~"))
(add-to-list 'ispell-skip-region-alist '("\\[\\[" . "\\]"))
#+end_src

4
assets/.emacs.d/start-exwm.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
export USING_EXWM=t
exec dbus-launch --exit-with-session emacs -mm --debug-init

View File

@@ -0,0 +1,45 @@
Emacs also has the functionality to run a terminal environment. While many other terminals will try to have similar capabilities with keybindings, nothing matches just integrating your terminal in emacs.
* VTerm
VTerm is a terminal emulator written in C. While emacs has a few built-in terminal all of them either lack speed or are missing many escape sequences.
#+begin_src emacs-lisp
(use-package vterm
:config
(setq vterm-max-scrollback 10000)
; Fixes vterm issue with cursor not updating
(advice-add #'vterm--redraw :after (lambda (&rest args) (evil-refresh-cursor evil-state))))
#+end_src
There are a few packages that you need to install in order to use VTerm.
#+begin_src bash
sudo apt install cmake libtool-bin
#+end_src
* Multi-Vterm
Multi-vterm is a package that adds the capability to easily create multiple vterm terminal buffers without having to manually rename them each time.
#+begin_src emacs-lisp
(use-package multi-vterm
:after vterm
:config
(jm/leader-keys
"vj" '(multi-vterm-next :which-key "Go to next vterm window")
"vk" '(multi-vterm-next :which-key "Go to previous vterm window")
"vn" '(multi-vterm :which-key "Create new vterm terminal")))
#+end_src
* Change Terminal Font
When using zsh with powerlevel10k, the ~MesloLGS NF~ font is required to make the prompt align properly. Due to this, this code is implemented to change the font only when VTerm is being used.
#+begin_src emacs-lisp
(add-hook 'vterm-mode-hook
(lambda ()
(set (make-local-variable 'buffer-face-mode-face) '(:family "MesloLGS NF" :height 135))
(buffer-face-mode t)))
#+end_src

11
assets/.functions.zsh Normal file
View File

@@ -0,0 +1,11 @@
awkuniq() {
if [[ "$1" == "-c" ]]; then
awk '{ !x[$0]++ } END { for (i in x) print x[i] "\t" i }'
else
awk '!x[$0]++'
fi
}
bw-ssh() {
sshpass -p "$(rbw get "$1")" ssh ${@:2}
}

View File

@@ -0,0 +1,2 @@
allow-emacs-pinentry
pinentry-program /opt/homebrew/bin/pinentry-mac

View File

@@ -0,0 +1,4 @@
[Desktop Entry]
Name=EXWM
Comment=Emacs Window Manager
Exec=/home/random/.emacs.d/start-exwm.sh

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

25
assets/.mbsyncrc Normal file
View File

@@ -0,0 +1,25 @@
IMAPAccount protonmail
Host 127.0.0.1
User jadenprovost@proton.me
PassCmd "cat ~/.authinfo | awk '/machine 127.0.0.1 port 1143/ {print $NF}'"
Port 1143
TLSType STARTTLS
AuthMechs LOGIN
CertificateFile ~/.config/protonmail/bridge/cert.pem
IMAPStore protonmail-remote
Account protonmail
MaildirStore protonmail-local
Subfolders Verbatim
Path ~/.mail/
Inbox ~/.mail/INBOX
SubFolders Verbatim
Channel protonmail
Far :protonmail-remote:
Near :protonmail-local:
Patterns * "!All Mail"
Create Both
Expunge Both
SyncState *

1603
assets/.p10k.zsh Executable file

File diff suppressed because it is too large Load Diff

13
assets/.screenlayout/launch.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
function load_script() {
if [ -f "$1" ]; then
bash "$1" &
fi
}
# I guess I have to run this twice? Fixes wallpaper rendering images.
load_script "$HOME/.screenlayout/wallpapers.sh"
load_script "$HOME/.screenlayout/layout.sh"
load_script "$HOME/.screenlayout/wallpapers.sh"
load_script "$HOME/.screenlayout/polybar.sh"

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
if which xrandr; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
MONITOR=$m polybar --reload example &
done
else
polybar --reload example &
fi

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Dynamically load background with feh
feh_command="feh"
while read resolution; do
echo "Assigning wallpaper-$resolution.jpg to $(xrandr | grep ' connected' | grep $resolution | awk '{print $1}')"
feh_command="$feh_command --bg-fill ~/Pictures/wallpaper-$resolution.jpg"
done < <(xrandr --listmonitors | grep -oP '[0-9]+\/[0-9]+x[0-9]+\/[0-9]+' | awk -F'[/x]' '{printf "%sx%s\n", $1, $3}')
echo "$feh_command"
eval "$feh_command"

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
for file in $HOME/.config/autostart/*; do
exec_line=$(cat "$file" | grep '^Exec' | cut -d '=' -f2-)
eval "$exec_line"
done

22
assets/.scripts/brightness.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
if [[ $# != 1 ]]; then
echo "Usage: $0 <brightness percentage>"
echo "Example: $0 5 # Increase brighness by 5%"
echo "Example: $0 -5 # Decrease brighness by 5%"
exit 1
fi
file_root="/sys/class/backlight/$(ls /sys/class/backlight | head -n 1)"
max=$(cat "$file_root/max_brightness")
current=$(cat "$file_root/actual_brightness")
new=$(($current + ($max / 100 * $1)))
if [ "$new" -ge "$max" ]; then
echo "$max" > $file_root/brightness
elif [ "$new" -le "0" ]; then
echo "0" > $file_root/brightness
else
echo "$new" > $file_root/brightness
fi

View File

@@ -0,0 +1,2 @@
\.git
README.org

52
assets/.tmux.conf Normal file
View File

@@ -0,0 +1,52 @@
# remap prefix from 'C-b' to 'C-w'
unbind C-b
set-option -g prefix C-w
bind-key C-w send-prefix
# Vim window split commands
bind v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# Enable mouse mode
set -g mouse on
# Switch panes with vim keybindings
bind k selectp -U
bind j selectp -D
bind h selectp -L
bind l selectp -R
# Move panes with vim keybindings
bind C-k resize-pane -U
bind C-j resize-pane -D
bind C-h resize-pane -L
bind C-l resize-pane -R
# Move pane to the far right/left/bottom/top
# Source: https://superuser.com/questions/1601701/tmux-how-to-move-current-pane-to-far-left-right-up-down-like-in-vim
bind H splitw -fhb \; swapp -t ! \; killp -t !
bind L splitw -fh \; swapp -t ! \; killp -t !
bind J splitw -fv \; swapp -t ! \; killp -t !
bind K splitw -fvb \; swapp -t ! \; killp -t !
# Vim quit key
bind q killp
unbind x
# Disable auto renaming panes
set -g allow-rename off
# Tmux Plugin Manager (TPM)
# To install plugins open tmux and type Prefix+I
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'erikw/tmux-powerline'
# Install tmux themes
set -g @plugin 'wfxr/tmux-power'
set -g @tmux_power_theme 'snow'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

33
assets/.xinitrc Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
/usr/libexec/polkit-gnome-authentication-agent-1 &
$HOME/.screenlayout/launch.sh &
exec dbus-launch --exit-with-session i3

245
assets/.zshrc Normal file
View File

@@ -0,0 +1,245 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# ~/.zshrc file for zsh interactive shells.
# see /usr/share/doc/zsh/examples/zshrc for examples
setopt autocd # change directory just by typing its name
#setopt correct # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form anything=expression
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
setopt promptsubst # enable command substitution in prompt
WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
# hide EOL sign ('%')
PROMPT_EOL_MARK=""
# configure key keybindings
bindkey -e # emacs key bindings
bindkey ' ' magic-space # do history expansion on space
bindkey '^[[3;5~' kill-word # ctrl + Supr
bindkey '^[[3~' delete-char # delete
bindkey '^[[1;5C' forward-word # ctrl + ->
bindkey '^[[1;5D' backward-word # ctrl + <-
bindkey '^[[5~' beginning-of-buffer-or-history # page up
bindkey '^[[6~' end-of-buffer-or-history # page down
bindkey '^[[H' beginning-of-line # home
bindkey '^[[F' end-of-line # end
bindkey '^[[Z' undo # shift + tab undo last action
# enable completion features
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # case insensitive tab completion
# History configurations
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt share_history # share command history data
# force zsh to show the complete history
alias history="history 0"
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
# enable syntax-highlighting
if [ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ] && [ "$color_prompt" = yes ]; then
. /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=magenta
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=underline
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=magenta
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=green
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
fi
else
PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%# '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}%n@%m: %~\a'
;;
*)
;;
esac
new_line_before_prompt=yes
precmd() {
# Print the previously configured title
print -Pnr -- "$TERM_TITLE"
# Print a new line before the prompt, but only if it is not the first line
if [ "$new_line_before_prompt" = yes ]; then
if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
_NEW_LINE_BEFORE_PROMPT=1
else
print ""
fi
fi
}
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias ip='ip --color=auto'
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
# Take advantage of $LS_COLORS for completion as well
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# enable auto-suggestions based on the history
if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
. /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# change suggestion color
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
fi
# Function that goes thorugh each argument and attempts to source it if it exists.
function attempt-source() {
for arg in "$@"; do
if [ -f "$arg" ]; then
source "$arg"
return
fi
done
echo "Failed to source $(basename $1)"
}
# Load zplug and extensions
attempt-source "$HOME/.zplug/init.zsh" "/usr/share/zplug/init.zsh" "/opt/homebrew/Cellar/zplug/2.4.2/init.zsh"
zplug romkatv/powerlevel10k, as:theme, depth:1
zplug load
# Source completion and highlighting scripts
attempt-source "/usr/share/fzf/completion.zsh" "/usr/share/doc/fzf/examples/completion.zsh" "/usr/share/doc/fzf/examples/completion.zsh" /opt/homebrew/Cellar/fzf/*/shell/completion.zsh
attempt-source "/usr/share/fzf/key-bindings.zsh" "/usr/share/doc/fzf/examples/key-bindings.zsh" /opt/homebrew/Cellar/fzf/*/shell/key-bindings.zsh
attempt-source "/usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh" "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" "/opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
#attempt-source "/usr/share/doc/pkgfile/command-not-found.zsh"
# Fix arch linux valgrind issue.
[[ $(uname -r) == *"arch"* ]] && export DEBUGINFOD_URLS="https://debuginfod.archlinux.org"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
# Initializing zoxide
export PATH="$PATH:$HOME/.cargo/bin"
eval "$(zoxide init zsh)"
# CUSTOM ALIASES & FUNCTIONS
# Cd multiple directoryies alias.
function .. () {cd ..}
function ... () {cd ../../}
function .... () {cd ../../../}
function ..... () {cd ../../../../}
function ...... () {cd ../../../../../}
# Wordlists
export rockyou="/usr/share/seclists/Passwords/Leaked-Databases/rockyou.txt"
export fasttrack="/usr/share/seclists/Passwords/fasttrack.txt"
# Ease of use
alias cd="z"
alias ls="eza"
alias open='xdg-open'
alias tryhackme="sudo openvpn ~/.tryhackme.ovpn"
alias listen="rlwrap nc -lnvp"
alias reload="source ~/.zshrc"
# Environment variable stuff for libyara development on macos
if [[ -d "/opt/homebrew" ]]; then
export PATH="/opt/homebrew/sbin:$PATH"
export YARA_LIBRARY_PATH="$(brew --prefix)/lib"
export YARA_INCLUDE_DIR="$(brew --prefix)/include"
fi

9
assets/README.org Normal file
View File

@@ -0,0 +1,9 @@
* Dotfiles Repo
To install these dotfiles, you can use gnu stow. Running the following command will automatically create symlinks for every file in this repo.
#+begin_src bash
git clone https://github.com/Random936/dotfiles
cd dotfiles/
stow .
#+end_src