dots

Mika's dotfiles
git clone git://popovic.xyz/dots.git/
Log | Files | Refs | README

commit b5497b8b9039aa7b3a7f36f550e0c6bec7daad48
Author: Milutin Popovic <mika@popovic.xyz>
Date:   Sun, 30 Nov 2025 19:09:58 +0000

init

Diffstat:
A.config/X/Xresources | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/X/Xresources.mon | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/X11/xinitrc | 7+++++++
A.config/X11/xprofile | 48++++++++++++++++++++++++++++++++++++++++++++++++
A.config/dunst/dunstrc | 457+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/isync/mbsyncrc | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/lf/cleaner | 4++++
A.config/lf/icons | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/lf/lfrc | 164+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/lf/scope | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/msmtp/config | 27+++++++++++++++++++++++++++
A.config/mutt/accounts/1-milutin@popovic.xyz.muttrc | 46++++++++++++++++++++++++++++++++++++++++++++++
A.config/mutt/accounts/2-mika@popovic.xyz.muttrc | 46++++++++++++++++++++++++++++++++++++++++++++++
A.config/mutt/accounts/3-a11807930@unet.univie.ac.at.muttrc | 47+++++++++++++++++++++++++++++++++++++++++++++++
A.config/mutt/general.muttrc | 162+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/mutt/mailcap | 9+++++++++
A.config/mutt/muttrc | 14++++++++++++++
A.config/mutt/signature | 3+++
A.config/nvim/after/ftplugin/html.lua | 4++++
A.config/nvim/after/ftplugin/javascript.lua | 3+++
A.config/nvim/after/ftplugin/javascriptreact.lua | 3+++
A.config/nvim/after/ftplugin/json.lua | 3+++
A.config/nvim/after/ftplugin/julia.lua | 1+
A.config/nvim/after/ftplugin/lua.lua | 10++++++++++
A.config/nvim/after/ftplugin/tex.lua | 3+++
A.config/nvim/after/ftplugin/typescript.lua | 3+++
A.config/nvim/after/ftplugin/typescriptreact.lua | 3+++
A.config/nvim/init.lua | 1+
A.config/nvim/lua/config/autocmd.lua | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/config/init.lua | 4++++
A.config/nvim/lua/config/keymaps.lua | 22++++++++++++++++++++++
A.config/nvim/lua/config/lazy.lua | 36++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/config/set.lua | 39+++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/autorepair.lua | 8++++++++
A.config/nvim/lua/plugins/color.lua | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/copilot.lua | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/copilotchat.lua | 45+++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/floaterm.lua | 8++++++++
A.config/nvim/lua/plugins/lsp.lua | 278+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/luasnip.lua | 18++++++++++++++++++
A.config/nvim/lua/plugins/rustacean.lua | 112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/telescope.lua | 106+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/treesitter.lua | 48++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/plugins/undotree.lua | 6++++++
A.config/nvim/lua/plugins/vimtex.lua | 29+++++++++++++++++++++++++++++
A.config/nvim/lua/snippets/basic.lua | 18++++++++++++++++++
A.config/nvim/lua/snippets/latex.lua | 623+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/lua/snippets/rust.lua | 18++++++++++++++++++
A.config/redshift/hooks/brightness.sh | 31+++++++++++++++++++++++++++++++
A.config/shell/aliases | 29+++++++++++++++++++++++++++++
A.config/shell/colors | 40++++++++++++++++++++++++++++++++++++++++
A.config/shell/profile | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/shell/vimode | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/sxiv/exec/key-handler | 47+++++++++++++++++++++++++++++++++++++++++++++++
A.config/systemd/user/mbsync.service | 10++++++++++
A.config/systemd/user/mbsync.timer | 13+++++++++++++
A.config/tmux/tmux.conf | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/zathura/zathurarc | 18++++++++++++++++++
A.config/zsh/.zprofile | 1+
A.config/zsh/.zshenv | 1+
A.config/zsh/.zshrc | 38++++++++++++++++++++++++++++++++++++++
A.gitignore | 1+
A.local/bin/dwmstatus/bar-battery | 31+++++++++++++++++++++++++++++++
A.local/bin/dwmstatus/bar-bluetooth | 33+++++++++++++++++++++++++++++++++
A.local/bin/dwmstatus/bar-clock | 27+++++++++++++++++++++++++++
A.local/bin/dwmstatus/bar-cpu | 15+++++++++++++++
A.local/bin/dwmstatus/bar-internet | 16++++++++++++++++
A.local/bin/dwmstatus/bar-lang | 8++++++++
A.local/bin/dwmstatus/bar-mail | 30++++++++++++++++++++++++++++++
A.local/bin/dwmstatus/bar-mem | 13+++++++++++++
A.local/bin/dwmstatus/bar-server | 19+++++++++++++++++++
A.local/bin/dwmstatus/bar-traffic | 23+++++++++++++++++++++++
A.local/bin/dwmstatus/bar-volume | 25+++++++++++++++++++++++++
A.local/bin/dwmstatus/bar-vpn | 18++++++++++++++++++
A.local/bin/dwmstatus/bar-weather | 32++++++++++++++++++++++++++++++++
A.local/bin/scripts/.ipynb_checkpoints/Untitled-checkpoint.ipynb | 6++++++
A.local/bin/scripts/.ipynb_checkpoints/untitled-checkpoint.txt | 0
A.local/bin/scripts/background | 4++++
A.local/bin/scripts/cpstat | 5+++++
A.local/bin/scripts/dev_tmux | 6++++++
A.local/bin/scripts/dmenu-bluetooth | 419+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.local/bin/scripts/down | 4++++
A.local/bin/scripts/edid_mulmon | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.local/bin/scripts/fenics | 39+++++++++++++++++++++++++++++++++++++++
A.local/bin/scripts/lfub | 24++++++++++++++++++++++++
A.local/bin/scripts/monitor_recon | 44++++++++++++++++++++++++++++++++++++++++++++
A.local/bin/scripts/notebook | 24++++++++++++++++++++++++
A.local/bin/scripts/passmenu-otp | 30++++++++++++++++++++++++++++++
A.local/bin/scripts/transmission-finish | 3+++
A.local/bin/scripts/trm | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.local/bin/scripts/volume | 19+++++++++++++++++++
A.local/bin/scripts/vpn | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.local/share/applications/cal.desktop | 4++++
A.local/share/applications/file.desktop | 4++++
A.local/share/applications/gif.desktop | 4++++
A.local/share/applications/img.desktop | 4++++
A.local/share/applications/links.desktop | 4++++
A.local/share/applications/mail.desktop | 4++++
A.local/share/applications/mimeinfo.cache | 9+++++++++
A.local/share/applications/pdf.desktop | 4++++
A.local/share/applications/rss.desktop | 4++++
A.local/share/applications/text.desktop | 4++++
A.local/share/applications/torrent.desktop | 6++++++
A.zshenv | 3+++
AREADME.md | 20++++++++++++++++++++
105 files changed, 4604 insertions(+), 0 deletions(-)

diff --git a/.config/X/Xresources b/.config/X/Xresources @@ -0,0 +1,67 @@ +Xft.dpi: 96 + +dwm.font0: terminus:size=20:style=Bold +dwm.font1: terminus:size=20:style=Bold +dwm.dmenufont: terminus:size=20:style=Bold +dmenu.font: terminus:size=20:style=Bold +st.font: terminus:size=20 +st.font2: Noto Color Emoji:size=20 + +dwm.normfgcolor: #ffffff +dwm.normbgcolor: #000000 +dwm.normbordercolor: #263238 +dwm.selfgcolor: #000000 +dwm.selbgcolor: #bcbcbc +dwm.selbordercolor: #A96C8A +dwm.baralpha: 0 +dwm.borderalpha: 1000 + +dmenu.normfgcolor: #ffffff +dmenu.normbgcolor: #000000 +dmenu.selfgcolor: #000000 +dmenu.selbgcolor: #6CA98A +dmenu.bordercolor: #A96C8A +dmenu.alphanorm: 230 +dmenu.alphasel: 230 +dmenu.alphaout: 230 +dmenu.lines: 15 + +slock.draw_on_two: 0 + +st.alpha : 0.96 + +*.foreground: #EEEEEE +*.background: #000000 +*.cursorColor: #EEEEEE + +! black +*.color0: #000000 +*.color8: #262626 + +! red +*.color1: #ed0b0b +*.color9: #b55454 + +! green +*.color2: #40a62f +*.color10: #78a670 + +! yellow +*.color3: #f2e635 +*.color11: #faf380 + +! blue +*.color4: #327bd1 +*.color12: #68a7d4 + +! magenta +*.color5: #b30ad0 +*.color13: #c583d0 + +! cyan +*.color6: #3975b8 +*.color14: #3975b8 + +! white +*.color7: #EEEEEE +*.color15: #EEEEEE diff --git a/.config/X/Xresources.mon b/.config/X/Xresources.mon @@ -0,0 +1,67 @@ +dwm.font0: terminus:size=14:style=Bold +dwm.font1: terminus:size=14:style=Bold +dwm.dmenufont: terminus:size=14:style=Bold +dmenu.font: terminus:size=14:style=Bold +st.font: terminus:size=14 +st.font2: Noto Color Emoji:size=12 + +dwm.normfgcolor: #ffffff +dwm.normbgcolor: #000000 +dwm.normbordercolor: #263238 +dwm.selfgcolor: #000000 +dwm.selbgcolor: #bcbcbc +dwm.selbordercolor: #A96C8A +dwm.baralpha: 0 +dwm.borderalpha: 1000 + +dmenu.normfgcolor: #ffffff +dmenu.normbgcolor: #000000 +dmenu.selfgcolor: #000000 +dmenu.selbgcolor: #6CA98A +dmenu.bordercolor: #A96C8A +dmenu.alphanorm: 230 +dmenu.alphasel: 230 +dmenu.alphaout: 230 +dmenu.lines: 15 + +st.alpha : 1 + +slock.draw_on_two: 1 + +Xcursor.size: 10 + +*.foreground: #EEEEEE +*.background: #000000 +*.cursorColor: #EEEEEE + +! black +*.color0: #000000 +*.color8: #262626 + +! red +*.color1: #ed0b0b +*.color9: #b55454 + +! green +*.color2: #40a62f +*.color10: #78a670 + +! yellow +*.color3: #f2e635 +*.color11: #faf380 + +! blue +*.color4: #327bd1 +*.color12: #68a7d4 + +! magenta +*.color5: #b30ad0 +*.color13: #c583d0 + +! cyan +*.color6: #3975b8 +*.color14: #3975b8 + +! white +*.color7: #EEEEEE +*.color15: #EEEEEE diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc @@ -0,0 +1,7 @@ +#!/bin/sh + +source "${XDG_CONFIG_HOME:-$HOME/.config}/X11/xprofile" & +while true; do + ssh-agent dwm > /dev/null 2>&1 +done + diff --git a/.config/X11/xprofile b/.config/X11/xprofile @@ -0,0 +1,48 @@ +#!/usr/bin/zsh + + + +if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]]; then + export $(dbus-launch --exit-with-x11) +fi + +if (( $(xrandr | grep " connected "| wc -l) == 3 ));then + export MONITOR_OUT=1 + edid_mulmon &\ + xrdb $XDG_CONFIG_HOME/X/Xresources.mon & + num=$(xinput | grep "Razer Razer DeathAdder Essential " | head -1 | grep -oP "id=\K\d+") + xinput --set-prop $num 'libinput Accel Speed' -0.75 & +else + export MONITOR_OUT=0 + xrdb $XDG_CONFIG_HOME/X/Xresources & +fi + +monitor_recon &\ +amixer -c 1 sset Master unmute &\ +xset r rate 300 50 &\ +xset mouse 1.8 0 &\ +setxkbmap -model p104 -layout us,de -option grp:shifts_toggle &\ +dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY &\ +down redshift & redshift -l $(curl ipinfo.io/loc | sed "s/,/:/") &\ + +xidlehook \ + --not-when-fullscreen \ + --not-when-audio\ + --timer 300 \ + 'slock' \ + '' \ + --timer 600 \ + 'systemctl suspend-then-hibernate' \ + '' & + +down dunst & dunst &\ +xcompmgr &\ +#nextcloud --background &\ +dwmblocks & + +if [[ $(cat /sys/class/power_supply/ACAD/online) == "1" ]] then + sudo powerprofilesctl set performance & +else + sudo powerprofilesctl set balanced & +fi + diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc @@ -0,0 +1,457 @@ +# See dunst(5) for all configuration options + +[global] + ### Display ### + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a window manager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern window managers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = keyboard + + ### Geometry ### + + # dynamic width from 0 to 300 + # width = (0, 300) + # constant width of 300 + width = 400 + + # The maximum height of a single notification, excluding the frame. + height = (0, 300) + + # Position the notification in the top right corner + origin = top-right + + # Offset from the origin + offset = (10, 40) + + # Scale factor. It is auto-detected if value is 0. + scale = 0 + + # Maximum number of notification (0 means no limit) + notification_limit = 20 + + ### 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 + + # Corner radius for the progress bar. 0 disables rounded corners. + progress_bar_corner_radius = 0 + + # Corner radius for the icon image. + icon_corner_radius = 0 + + # 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 = 10 + + # 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 = "#FFFFFF" + + # 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 = terminus 20 + + # 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 = center + + # Vertical alignment of message text and icon. + # Possible values are "top", "center" and "bottom". + vertical_alignment = center + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Specify where to make an ellipsis in long lines. + # Possible values are "start", "middle" and "end". + ellipsize = middle + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Stack together notifications with the same content + stack_duplicates = true + + # Hide the count of stacked notifications with the same content + hide_duplicate_count = false + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + ### Icons ### + + # 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 = 64 + + # 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 = "#222222" + foreground = "#ffffff" + timeout = 5 + # Icon for notifications with low urgency, uncomment to enable + +[urgency_normal] + background = "#000000" + foreground = "#ffffff" + timeout = 5 + # Icon for notifications with normal urgency, uncomment to enable + +[urgency_critical] + background = "#000000" + foreground = "#ffffff" + 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 diff --git a/.config/isync/mbsyncrc b/.config/isync/mbsyncrc @@ -0,0 +1,80 @@ +IMAPStore milutin@popovic.xyz-remote +Host mail.popovic.xyz +Port 993 +User milutin +PassCmd "pass mw-milutin@popovic.xyz" +AuthMechs LOGIN +# SSLType IMAPS +TLSType IMAPS +CertificateFile /etc/ssl/certs/ca-certificates.crt + +MaildirStore milutin@popovic.xyz-local +Subfolders Verbatim +Path /home/mika/.local/share/mail/milutin@popovic.xyz/ +Inbox /home/mika/.local/share/mail/milutin@popovic.xyz/INBOX +Flatten . + +Channel milutin@popovic.xyz +Expunge Both +Far :milutin@popovic.xyz-remote: +Near :milutin@popovic.xyz-local: +Patterns * !"[Gmail]/All Mail" +Create Both +SyncState * +MaxMessages 0 +ExpireUnread no +# End profile + +IMAPStore mika@popovic.xyz-remote +Host mail.popovic.xyz +Port 993 +User mika +PassCmd "pass mw-mika@popovic.xyz" +AuthMechs LOGIN +# SSLType IMAPS +TLSType IMAPS +CertificateFile /etc/ssl/certs/ca-certificates.crt + +MaildirStore mika@popovic.xyz-local +Subfolders Verbatim +Path /home/mika/.local/share/mail/mika@popovic.xyz/ +Inbox /home/mika/.local/share/mail/mika@popovic.xyz/INBOX +Flatten . + +Channel mika@popovic.xyz +Expunge Both +Far :mika@popovic.xyz-remote: +Near :mika@popovic.xyz-local: +Patterns * !"[Gmail]/All Mail" +Create Both +SyncState * +MaxMessages 0 +ExpireUnread no +# End profile + +#IMAPStore a11807930@unet.univie.ac.at-remote +#Host imap.univie.ac.at +#Port 993 +#User milutinp00 +#PassCmd "pass mw-a11807930@unet.univie.ac.at" +#AuthMechs LOGIN +## SSLType IMAPS +#TLSType IMAPS +#CertificateFile /etc/ssl/certs/ca-certificates.crt +# +#MaildirStore a11807930@unet.univie.ac.at-local +#Subfolders Verbatim +#Path /home/mika/.local/share/mail/a11807930@unet.univie.ac.at/ +#Inbox /home/mika/.local/share/mail/a11807930@unet.univie.ac.at/INBOX +#Flatten . +# +#Channel a11807930@unet.univie.ac.at +#Expunge Both +#Far :a11807930@unet.univie.ac.at-remote: +#Near :a11807930@unet.univie.ac.at-local: +#Patterns * !"[Gmail]/All Mail" +#Create Both +#SyncState * +#MaxMessages 0 +#ExpireUnread no +## End profile diff --git a/.config/lf/cleaner b/.config/lf/cleaner @@ -0,0 +1,4 @@ +#!/bin/sh +if [ -n "$FIFO_UEBERZUG" ]; then + printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG" +fi diff --git a/.config/lf/icons b/.config/lf/icons @@ -0,0 +1,77 @@ +di 📁 +fi 📃 +tw 🤝 +ow 📂 +ln ⛓ +or ❌ +ex 🎯 +*.txt ✍ +*.mom ✍ +*.me ✍ +*.ms ✍ +*.avif 🖼 +*.png 🖼 +*.webp 🖼 +*.ico 🖼 +*.jpg 📸 +*.jpe 📸 +*.jpeg 📸 +*.gif 🖼 +*.svg 🗺 +*.tif 🖼 +*.tiff 🖼 +*.xcf 🖌 +*.html 🌎 +*.xml 📰 +*.gpg 🔒 +*.css 🎨 +*.pdf 📚 +*.djvu 📚 +*.epub 📚 +*.csv 📓 +*.xlsx 📓 +*.tex 📜 +*.md 📘 +*.r 📊 +*.R 📊 +*.rmd 📊 +*.Rmd 📊 +*.m 📊 +*.mp3 🎵 +*.opus 🎵 +*.ogg 🎵 +*.m4a 🎵 +*.flac 🎼 +*.wav 🎼 +*.mkv 🎥 +*.mp4 🎥 +*.webm 🎥 +*.mpeg 🎥 +*.avi 🎥 +*.mov 🎥 +*.mpg 🎥 +*.wmv 🎥 +*.m4b 🎥 +*.flv 🎥 +*.zip 📦 +*.rar 📦 +*.7z 📦 +*.tar 📦 +*.z64 🎮 +*.v64 🎮 +*.n64 🎮 +*.gba 🎮 +*.nes 🎮 +*.gdi 🎮 +*.1 ℹ +*.nfo ℹ +*.info ℹ +*.log 📙 +*.iso 📀 +*.img 📀 +*.bib 🎓 +*.ged 👪 +*.part 💔 +*.torrent 🔽 +*.jar ♨ +*.java ♨ diff --git a/.config/lf/lfrc b/.config/lf/lfrc @@ -0,0 +1,164 @@ +# Note on Image Previews +# For those wanting image previews, like this system, there are four steps to +# set it up. These are done automatically for LARBS users, but I will state +# them here for others doing it manually. +# +# 1. ueberzug must be installed. +# 2. The scope file (~/.config/lf/scope for me), must have a command similar to +# mine to generate ueberzug images. +# 3. A `set cleaner` line as below is a cleaner script. +# 4. lf should be started through a wrapper script (~/.local/bin/lfub for me) +# that creates the environment for ueberzug. This command can be be aliased +# in your shellrc (`alias lf="lfub") or if set to a binding, should be +# called directly instead of normal lf. + +# Basic vars +set shellopts '-eu' +set ifs "\n" +set scrolloff 10 +set icons true +set drawbox true +set ignorecase true +set period 1 +set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" +set cleaner '~/.config/lf/cleaner' +set previewer '~/.config/lf/scope' +set autoquit true + +# cmds/functions +cmd open ${{ + case $(file --mime-type "$(readlink -f $f)" -b) in + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; + image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; + text/*|application/json|application/javascript|inode/x-empty|application/x-subrip) $EDITOR $fx;; + image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; + image/svg+xml) display -- $f ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | + setsid -f sxiv -aio 2>/dev/null | while read -r file; do + [ -z "$file" ] && continue + lf -remote "send select \"$file\"" + lf -remote "send toggle" + done & + ;; + audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; + video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; + application/pgp-encrypted) $EDITOR $fx ;; + application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; + esac +}} + +cmd mkdir $mkdir -p "$@" + +cmd extract ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "extract?[y/N]" + read ans + [ $ans = "y" ] && { + case $fx in + *.tar.bz2) tar xjf $fx ;; + *.tar.gz) tar xzf $fx ;; + *.bz2) bunzip2 $fx ;; + *.rar) unrar e $fx ;; + *.gz) gunzip $fx ;; + *.tar) tar xf $fx ;; + *.tbz2) tar xjf $fx ;; + *.tgz) tar xzf $fx ;; + *.zip) unzip $fx ;; + *.Z) uncompress $fx ;; + *.7z) 7z x $fx ;; + *.tar.xz) tar xf $fx ;; + esac + } +}} + +cmd delete ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "delete?[y/N]" + read ans + [ $ans = "y" ] && rm -rf -- $fx +}} + +cmd moveto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + clear; echo "Move to where?" + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" && + for x in $fx; do + eval mv -iv \"$x\" \"$dest\" + done && + notify-send "🚚 File(s) moved." "File(s) moved to $dest." +}} + +cmd copyto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + clear; echo "Copy to where?" + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" && + for x in $fx; do + eval cp -ivr \"$x\" \"$dest\" + done && + notify-send "📋 File(s) copied." "File(s) copies to $dest." +}} + +cmd setbg "$1" + +cmd bulkrename ${{ + tmpfile_old="$(mktemp)" + tmpfile_new="$(mktemp)" + + [ -n "$fs" ] && fs=$(basename -a $fs) || fs=$(ls) + + echo "$fs" > "$tmpfile_old" + echo "$fs" > "$tmpfile_new" + $EDITOR "$tmpfile_new" + + [ "$(wc -l < "$tmpfile_old")" -eq "$(wc -l < "$tmpfile_new")" ] || { rm -f "$tmpfile_old" "$tmpfile_new"; exit 1; } + + paste "$tmpfile_old" "$tmpfile_new" | while IFS="$(printf '\t')" read -r src dst + do + [ "$src" = "$dst" ] || [ -e "$dst" ] || mv -- "$src" "$dst" + done + + rm -f "$tmpfile_old" "$tmpfile_new" + lf -remote "send $id unselect" +}} + +# Bindings +map <c-f> $lf -remote "send $id select \"$(fzf)\"" +map gh +map g top +map D delete +map E extract +map C copyto +map M moveto +map <c-n> push :mkdir<space>""<left> +map <c-r> reload +map <c-s> set hidden! +map <enter> shell +map x $$f +map X !$f +map o &mimeopen "$f" +map O $mimeopen --ask "$f" + +map A :rename; cmd-end # at the very end +map c push A<c-u> # new rename +map I :rename; cmd-home # at the very beginning +map i :rename # before extension +map a :rename; cmd-right # after extension +map B bulkrename +map b $setbg $f + +map <c-e> down +map <c-y> up +map V push :!nvim<space> + +map W $setsid -f $TERMINAL >/dev/null 2>&1 + +map Y $printf "%s" "$fx" | xclip -selection clipboard + diff --git a/.config/lf/scope b/.config/lf/scope @@ -0,0 +1,57 @@ +#!/bin/sh + +# File preview handler for lf. + +set -C -f +IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" + +image() { + if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then + printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" + else + mediainfo "$6" + fi +} + +# Note that the cache file name is a function of file information, meaning if +# an image appears in multiple places across the machine, it will not have to +# be regenerated once seen. + +case "$(file --dereference --brief --mime-type -- "$1")" in + image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; + image/vnd.djvu) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | convert -density 200 - "$CACHE.jpg" > /dev/null 2>&1 + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; +image/svg+xml) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && inkscape --convert-dpi-method=none -o "$CACHE.png" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1" + image "$CACHE.png" "$2" "$3" "$4" "$5" "$1" + ;; + image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; + text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; + text/troff) man ./ "$1" | col -b ;; + text/* | */xml | application/json | application/x-ndjson | application/javascript ) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + video/* ) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + image "$CACHE" "$2" "$3" "$4" "$5" "$1" + ;; + */pdf) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + */epub+zip|*/mobi*) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + application/*zip) atool --list -- "$1" ;; + *opendocument*) odt2txt "$1" ;; + application/pgp-encrypted) gpg -d -- "$1" ;; +esac +exit 1 diff --git a/.config/msmtp/config b/.config/msmtp/config @@ -0,0 +1,27 @@ +defaults +auth on +tls on +tls_trust_file /etc/ssl/certs/ca-certificates.crt +logfile ~/.config/msmtp/msmtp.log + +account milutin@popovic.xyz +host mail.popovic.xyz +port 587 +from milutin@popovic.xyz +user milutin +passwordeval "pass mw-milutin@popovic.xyz" + +account mika@popovic.xyz +host mail.popovic.xyz +port 587 +from mika@popovic.xyz +user mika +passwordeval "pass mw-mika@popovic.xyz" + +#account a11807930@unet.univie.ac.at +#host mail.univie.ac.at +#port 465 +#from a11807930@unet.univie.ac.at +#user milutinp00 +#passwordeval "pass mw-a11807930@unet.univie.ac.at" +#tls_starttls off diff --git a/.config/mutt/accounts/1-milutin@popovic.xyz.muttrc b/.config/mutt/accounts/1-milutin@popovic.xyz.muttrc @@ -0,0 +1,46 @@ +# vim: filetype=neomuttrc +# muttrc file for account milutin@popovic.xyz +set realname = "Milutin Popović" +set from = "milutin@popovic.xyz" +set status_format = "milutin@popovic.xyz" +set sendmail = "msmtp -a milutin@popovic.xyz" +alias me <milutin@popovic.xyz> +set folder = "/home/mika/.local/share/mail/milutin@popovic.xyz" +set header_cache = /home/mika/.cache/mutt-wizard/milutin@popovic.xyz/headers +set message_cachedir = /home/mika/.cache/mutt-wizard/milutin@popovic.xyz/bodies +set mbox_type = Maildir + +bind index,pager gg noop +bind index,pager g noop +bind index,pager M noop +bind index,pager C noop +bind index gg first-entry +macro index o "<shell-escape>mw -y milutin@popovic.xyz<enter>" "run mbsync to sync milutin@popovic.xyz" +unmailboxes * + +mailboxes "=INBOX" "=Archive" "=Sent" "=Drafts" "=Trash" + +set spoolfile = "+INBOX" # mw-autogenerated +set postponed = "+Drafts" # mw-autogenerated +set record = "+Sent" # mw-autogenerated +set trash = "+Trash" # mw-autogenerated + +macro index,pager gi "<change-folder>=INBOX<enter>" "go to inbox" # mw-autogenerated +macro index,pager Mi ";<save-message>=INBOX<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Ci ";<copy-message>=INBOX<enter>" "copy mail to inbox" # mw-autogenerated + +macro index,pager ga "<change-folder>=Archive<enter>" "go to inbox" # mw-autogenerated +macro index,pager Ma ";<save-message>=Archive<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Ca ";<copy-message>=Archive<enter>" "copy mail to inbox" # mw-autogenerated + +macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts" # mw-autogenerated +macro index,pager Md ";<save-message>=Drafts<enter>" "move mail to drafts" # mw-autogenerated +macro index,pager Cd ";<copy-message>=Drafts<enter>" "copy mail to drafts" # mw-autogenerated + +macro index,pager gs "<change-folder>=Sent<enter>" "go to sent" # mw-autogenerated +macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent" # mw-autogenerated +macro index,pager Cs ";<copy-message>=Sent<enter>" "copy mail to sent" # mw-autogenerated + +macro index,pager gt "<change-folder>=Trash<enter>" "go to trash" # mw-autogenerated +macro index,pager Mt ";<save-message>=Trash<enter>" "move mail to trash" # mw-autogenerated +macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash" # mw-autogenerated diff --git a/.config/mutt/accounts/2-mika@popovic.xyz.muttrc b/.config/mutt/accounts/2-mika@popovic.xyz.muttrc @@ -0,0 +1,46 @@ +# vim: filetype=neomuttrc +# muttrc file for account mika@popovic.xyz +set realname = "Mika" +set from = "mika@popovic.xyz" +set status_format = "mika@popovic.xyz" +set sendmail = "msmtp -a mika@popovic.xyz" +alias me <mika@popovic.xyz> +set folder = "/home/mika/.local/share/mail/mika@popovic.xyz" +set header_cache = /home/mika/.cache/mutt-wizard/mika@popovic.xyz/headers +set message_cachedir = /home/mika/.cache/mutt-wizard/mika@popovic.xyz/bodies +set mbox_type = Maildir + +bind index,pager gg noop +bind index,pager g noop +bind index,pager M noop +bind index,pager C noop +bind index gg first-entry +macro index o "<shell-escape>mw -y mika@popovic.xyz<enter>" "run mbsync to sync mika@popovic.xyz" +unmailboxes * + +mailboxes "=INBOX" "=Archive" "=Sent" "=Drafts" "=Trash" + +set spoolfile = "+INBOX" # mw-autogenerated +set postponed = "+Drafts" # mw-autogenerated +set record = "+Sent" # mw-autogenerated +set trash = "+Trash" # mw-autogenerated + +macro index,pager gi "<change-folder>=INBOX<enter>" "go to inbox" # mw-autogenerated +macro index,pager Mi ";<save-message>=INBOX<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Ci ";<copy-message>=INBOX<enter>" "copy mail to inbox" # mw-autogenerated + +macro index,pager ga "<change-folder>=Archive<enter>" "go to inbox" # mw-autogenerated +macro index,pager Ma ";<save-message>=Archive<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Ca ";<copy-message>=Archive<enter>" "copy mail to inbox" # mw-autogenerated + +macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts" # mw-autogenerated +macro index,pager Md ";<save-message>=Drafts<enter>" "move mail to drafts" # mw-autogenerated +macro index,pager Cd ";<copy-message>=Drafts<enter>" "copy mail to drafts" # mw-autogenerated + +macro index,pager gs "<change-folder>=Sent<enter>" "go to sent" # mw-autogenerated +macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent" # mw-autogenerated +macro index,pager Cs ";<copy-message>=Sent<enter>" "copy mail to sent" # mw-autogenerated + +macro index,pager gt "<change-folder>=Trash<enter>" "go to trash" # mw-autogenerated +macro index,pager Mt ";<save-message>=Trash<enter>" "move mail to trash" # mw-autogenerated +macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash" # mw-autogenerated diff --git a/.config/mutt/accounts/3-a11807930@unet.univie.ac.at.muttrc b/.config/mutt/accounts/3-a11807930@unet.univie.ac.at.muttrc @@ -0,0 +1,47 @@ +# vim: filetype=neomuttrc +# muttrc file for account a11807930@unet.univie.ac.at +set realname = "Milutin Popovic" +set from = "a11807930@unet.univie.ac.at" +set status_format = "unet.univie.ac.at" +set sendmail = "msmtp -a a11807930@unet.univie.ac.at" +alias me Milutin Popovic <a11807930@unet.univie.ac.at> +set folder = "/home/mika/.local/share/mail/a11807930@unet.univie.ac.at" +set header_cache = /home/mika/.cache/mutt-wizard/a11807930@unet.univie.ac.at/headers +set message_cachedir = /home/mika/.cache/mutt-wizard/a11807930@unet.univie.ac.at/bodies +set mbox_type = Maildir + +bind index,pager gg noop +bind index,pager g noop +bind index,pager M noop +bind index,pager C noop +bind index gg first-entry +macro index o "<shell-escape>mw -y a11807930@unet.univie.ac.at<enter>" "run mbsync to sync a11807930@unet.univie.ac.at" +unmailboxes * + +mailboxes "=INBOX" "=Archive" "=Sent" "=Drafts" "=Trash" + +set spoolfile = "+INBOX" # mw-autogenerated +set postponed = "+Drafts" # mw-autogenerated +set record = "+Sent" # mw-autogenerated +set trash = "+Trash" # mw-autogenerated + + +macro index,pager gd "<change-folder>=Drafts<enter>" "go to inbox" # mw-autogenerated +macro index,pager Md ";<save-message>=Drafts<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Cd ";<copy-message>=Drafts<enter>" "copy mail to inbox" # mw-autogenerated + +macro index,pager gs "<change-folder>=Sent<enter>" "go to inbox" # mw-autogenerated +macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Cs ";<copy-message>=Sent<enter>" "copy mail to inbox" # mw-autogenerated + +macro index,pager gt "<change-folder>=Trash<enter>" "go to inbox" # mw-autogenerated +macro index,pager Mt ";<save-message>=Trash<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to inbox" # mw-autogenerated + +macro index,pager ga "<change-folder>=Archive<enter>" "go to inbox" # mw-autogenerated +macro index,pager Ma ";<save-message>=Archive<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Ca ";<copy-message>=Archive<enter>" "copy mail to inbox" # mw-autogenerated + +macro index,pager gi "<change-folder>=INBOX<enter>" "go to inbox" # mw-autogenerated +macro index,pager Mi ";<save-message>=INBOX<enter>" "move mail to inbox" # mw-autogenerated +macro index,pager Ci ";<copy-message>=INBOX<enter>" "copy mail to inbox" # mw-autogenerated diff --git a/.config/mutt/general.muttrc b/.config/mutt/general.muttrc @@ -0,0 +1,162 @@ +# vim: filetype=neomuttrc +# This file contains all of mutt-wizard's default settings. +# mutt-wizard will have this file sourced from your muttrc. +# In the interest of seamless updating, do not edit this file. +# If you want to override any settings, set those in your muttrc. +set mailcap_path = /home/mika/.config/mutt/mailcap +set date_format="%d/%m/%y %I:%M%p" +set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" +set sort = 'reverse-date' +set smtp_authenticators = 'gssapi:login' +set query_command = "abook --mutt-query '%s'" +set rfc2047_parameters = yes +set sleep_time = 0 # Pause 0 seconds for informational messages +set markers = no # Disables the `+` displayed at line wraps +set mark_old = no # Unread mail stay unread until read +set mime_forward = yes # attachments are forwarded with mail +set wait_key = no # mutt won't ask "press key to continue" +set fast_reply # skip to compose when replying +set fcc_attach # save attachments with the body +set forward_format = "Fwd: %s" # format of subject when forwarding +set forward_quote # include message in forwards +set reverse_name # reply as whomever it was to +set include # include message in replies +set mail_check=60 # to avoid lags using IMAP with some email providers (yahoo for example) +auto_view text/html # automatically show html (mailcap uses lynx) +auto_view application/pgp-encrypted +set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. +alternative_order text/plain text/enriched text/html +bind index,pager i noop +bind index,pager g noop +bind index \Cf noop + +# General rebindings +bind index j next-entry +bind index k previous-entry +bind attach <return> view-mailcap +bind attach l view-mailcap +bind editor <space> noop +bind index G last-entry +bind index gg first-entry +bind pager,attach h exit +bind pager j next-line +bind pager k previous-line +bind pager l view-attachments +bind index D delete-message +bind index U undelete-message +bind index L limit +bind index h noop +bind index l display-message +bind index,query <space> tag-entry +#bind browser h goto-parent +macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" +bind index,pager H view-raw-message +bind browser l select-entry +bind pager,browser gg top-page +bind pager,browser G bottom-page +bind index,pager,browser d half-down +bind index,pager,browser u half-up +bind index,pager S sync-mailbox +bind index,pager R group-reply +bind index \031 previous-undeleted # Mouse wheel +bind index \005 next-undeleted # Mouse wheel +bind pager \031 previous-line # Mouse wheel +bind pager \005 next-line # Mouse wheel +bind editor <Tab> complete-query + +#set crypt_autosign = yes +#set crypt_opportunistic_encrypt = yes +#set pgp_self_encrypt = yes +#set pgp_default_key = 'your@gpgemailaddre.ss' + +macro index,pager a "<enter-command>set my_pipe_decode=\$pipe_decode pipe_decode<return><pipe-message>abook --add-email<return><enter-command>set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<return>" "add the sender address to abook" +macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read" +macro index O "<shell-escape>mw -Y<enter>" "run mw -Y to sync all mail" +macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>printf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern" +macro index A "<limit>all\n" "show all messages (undo limit)" + +# Sidebar mappings +set sidebar_visible = yes +set sidebar_width = 20 +set sidebar_short_path = yes +set sidebar_next_new_wrap = yes +set mail_check_stats +set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' +bind index,pager \Ck sidebar-prev +bind index,pager \Cj sidebar-next +bind index,pager \Co sidebar-open +bind index,pager \Cp sidebar-prev-new +bind index,pager \Cn sidebar-next-new +bind index,pager B sidebar-toggle-visible + +# Default index colors: +color index white default '.*' +color index_author red default '.*' +color index_number blue default +color index_subject cyan default '.*' + +# New mail is boldened: +color index red black "~N" +color index_author yellow black "~N" +color index_subject yellow black "~N" + +# Tagged mail is highlighted: +color index brightyellow blue "~T" +color index_author brightred blue "~T" +color index_subject brightcyan blue "~T" + +# Other colors and aesthetic settings: +mono bold bold +mono underline underline +mono indicator reverse +mono error bold +color normal default default +color indicator brightblack white +color sidebar_highlight red default +color sidebar_divider brightblack black +color sidebar_flagged red black +color sidebar_new green black +color normal brightyellow default +color error red default +color tilde black default +color message cyan default +color markers red white +color attachment white default +color search brightmagenta default +color status brightblue black +color hdrdefault brightgreen default +color quoted green default +color quoted1 blue default +color quoted2 cyan default +color quoted3 yellow default +color quoted4 red default +color quoted5 brightred default +color signature brightgreen default +color bold black default +color underline black default +color normal brightwhite default + +# Regex highlighting: +color header magenta default ".*" +color header brightcyan default "^(From)" +color header brightcyan default "^(Subject)" +color header brightwhite default "^(CC|BCC)" +color body brightblue default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses +color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL +color body green default "\`[^\`]*\`" # Green text between ` and ` +color body brightblue default "^# \.*" # Headings as bold blue +color body brightcyan default "^## \.*" # Subheadings as bold cyan +color body brightgreen default "^### \.*" # Subsubheadings as bold green +color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow +color body brightcyan default "[;:][-o][)/(|]" # emoticons +color body brightcyan default "[;:][)(|]" # emoticons +color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? +color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? +color body red default "(BAD signature)" +color body cyan default "(Good signature)" +color body brightblack default "^gpg: Good signature .*" +color body brightyellow default "^gpg: " +color body brightyellow red "^gpg: BAD signature from.*" +mono body bold "^gpg: Good signature" +mono body bold "^gpg: BAD signature from.*" +color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" diff --git a/.config/mutt/mailcap b/.config/mutt/mailcap @@ -0,0 +1,9 @@ +text/plain; $EDITOR %s ; +text/html; $BROWSER %s ; nametemplate=%s.html +text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput; +image/*; sxiv %s ; +video/*; setsid mpv --quiet %s &; copiousoutput +audio/*; mpv %s ; +application/pdf; setsid zathura %s &; +application/pgp-encrypted; gpg -d '%s'; copiousoutput; +application/pgp-keys; gpg --import '%s'; copiousoutput; diff --git a/.config/mutt/muttrc b/.config/mutt/muttrc @@ -0,0 +1,14 @@ +# vim: filetype=neomuttrc +source /home/mika/.config/mutt/general.muttrc + +set new_mail_command="notify-send 'New Email' '%n new messages, %u unread.' &" + +source /home/mika/.config/mutt/accounts/1-milutin@popovic.xyz.muttrc # mw-autogenerated +macro index,pager i1 '<sync-mailbox><enter-command>source /home/mika/.config/mutt/accounts/1-milutin@popovic.xyz.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to milutin@popovic.xyz" # mw-autogenerated + +#source /home/mika/.config/mutt/accounts/2-mika@popovic.xyz.muttrc # mw-autogenerated +macro index,pager i2 '<sync-mailbox><enter-command>source /home/mika/.config/mutt/accounts/2-mika@popovic.xyz.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to mika@popovic.xyz" # mw-autogenerated + +macro index,pager i3 '<sync-mailbox><enter-command>source /home/mika/.config/mutt/accounts/3-a11807930@unet.univie.ac.at.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to a11807930@unet.univie.ac.at" # mw-autogenerated + +set signature = $XDG_CONFIG_HOME/mutt/signature diff --git a/.config/mutt/signature b/.config/mutt/signature @@ -0,0 +1,3 @@ + +Milutin + diff --git a/.config/nvim/after/ftplugin/html.lua b/.config/nvim/after/ftplugin/html.lua @@ -0,0 +1,4 @@ +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.softtabstop = 2 +vim.opt_local.syntax = "on" diff --git a/.config/nvim/after/ftplugin/javascript.lua b/.config/nvim/after/ftplugin/javascript.lua @@ -0,0 +1,3 @@ +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.softtabstop = 2 diff --git a/.config/nvim/after/ftplugin/javascriptreact.lua b/.config/nvim/after/ftplugin/javascriptreact.lua @@ -0,0 +1,3 @@ +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.softtabstop = 2 diff --git a/.config/nvim/after/ftplugin/json.lua b/.config/nvim/after/ftplugin/json.lua @@ -0,0 +1,3 @@ +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.softtabstop = 2 diff --git a/.config/nvim/after/ftplugin/julia.lua b/.config/nvim/after/ftplugin/julia.lua @@ -0,0 +1 @@ +vim.bo.textwidth = 77 diff --git a/.config/nvim/after/ftplugin/lua.lua b/.config/nvim/after/ftplugin/lua.lua @@ -0,0 +1,10 @@ +vim.opt_local.suffixesadd:prepend('.lua') +vim.opt_local.suffixesadd:prepend('init.lua') +vim.opt_local.path:prepend(vim.fn.stdpath('config')..'/lua') + +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.softtabstop = 2 +vim.opt.syntax = "off" + + diff --git a/.config/nvim/after/ftplugin/tex.lua b/.config/nvim/after/ftplugin/tex.lua @@ -0,0 +1,3 @@ +vim.g.tex_flavor = "latex" +vim.bo.textwidth = 77 +vim.wo.wrap = true diff --git a/.config/nvim/after/ftplugin/typescript.lua b/.config/nvim/after/ftplugin/typescript.lua @@ -0,0 +1,3 @@ +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.softtabstop = 2 diff --git a/.config/nvim/after/ftplugin/typescriptreact.lua b/.config/nvim/after/ftplugin/typescriptreact.lua @@ -0,0 +1,3 @@ +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.softtabstop = 2 diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua @@ -0,0 +1 @@ +require("config") diff --git a/.config/nvim/lua/config/autocmd.lua b/.config/nvim/lua/config/autocmd.lua @@ -0,0 +1,51 @@ +local autocmd = vim.api.nvim_create_autocmd + +-- Delete trailing whitespace +autocmd({'BufWritePre'}, { + pattern = '*', + command = [[%s/\s\+$//e]], +}) + +autocmd({'BufWritePost'}, { + pattern = vim.fn.expand('~') .. '/.config/X/Xresources', + command = '!xrdb %', +}) + +autocmd({'BufWritePost'}, { + pattern = vim.fn.expand('~') .. '/.config/X/Xresources.mon', + command = '!xrdb %', +}) + +autocmd({'BufWritePost'}, { + pattern = vim.fn.expand('~') .. '/.local/src/dmenu/config.def.h', + command = '!cd ~/.local/src/dmenu/; sudo make clean install && { killall -q dmenu}', +}) + +autocmd({'BufWritePost'}, { + pattern = vim.fn.expand('~') .. '/.local/src/dwm/config.def.h', + command = '!cd ~/.local/src/dwm/; sudo make clean install && { killall -q dwm;setsid dwm & }', +}) + +autocmd({'BufWritePost'}, { + pattern = vim.fn.expand('~') .. '/.local/src/dwmblocks/config.h', + command = '!cd ~/.local/src/dwmblocks/; sudo make clean install && { killall -q dwmblocks;setsid dwmblocks & }', +}) + +autocmd({'BufWritePost'}, { + pattern = vim.fn.expand('~') .. '/.local/src/st/config.h', + command = '!cd ~/.local/src/st/; sudo make clean install && { killall -q st;setsid st & }', +}) + +autocmd({'BufWritePost'}, { + pattern = vim.fn.expand('~') .. '/.local/src/slock/config.h', + command = '!cd ~/.local/src/slock/; sudo make clean install && { killall -q slock;setsid & }', +}) + + + + + + + + + diff --git a/.config/nvim/lua/config/init.lua b/.config/nvim/lua/config/init.lua @@ -0,0 +1,4 @@ +require("config.keymaps") +require("config.set") +require("config.lazy") +require("config.autocmd") diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua @@ -0,0 +1,22 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = "," +vim.keymap.set("n", "<leader>pv", vim.cmd.Ex) + +vim.keymap.set("n", "<leader>ce", ":setlocal spell! spelllang=en_us<cr>") +vim.keymap.set("n", "<leader>cd", ":setlocal spell! spelllang=de<cr>") +vim.keymap.set("n", "<leader>cs", ":setlocal spell! spelllang=sr@latin<cr>") + +vim.keymap.set("n", "<C-h>", "<C-w>h") +vim.keymap.set("n", "<C-j>", "<C-w>j") +vim.keymap.set("n", "<C-k>", "<C-w>k") +vim.keymap.set("n", "<C-l>", "<C-w>l") + +vim.keymap.set("n", "<leader>b", ":! firefox %") + +vim.keymap.set('c', 'w!!', ':w ! sudo tee % > /dev/null') + +vim.keymap.set('n', '<C-S>', function() + local bad = vim.fn.expand("<cword>") + local word_list = vim.fn.spellsuggest(bad) + end +) diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,36 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +print(lazypath) +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = false }, +}) diff --git a/.config/nvim/lua/config/set.lua b/.config/nvim/lua/config/set.lua @@ -0,0 +1,39 @@ +vim.cmd('filetype on') +vim.cmd('filetype plugin indent on') + +vim.bo.filetype = "on" +vim.opt.number = true +vim.opt.relativenumber = true +vim.g.show_whitespace = 1 +vim.g.loaded_perl_provider = false + +vim.opt.clipboard = "unnamedplus" + +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.softtabstop = 4 +vim.opt.smartindent = true +vim.opt.smartcase = true +vim.opt.expandtab = true + +vim.opt.undodir = os.getenv("XDG_CONFIG_HOME") .. "/nvim/undodir" +vim.opt.undofile = true + +vim.opt.scrolloff = 10 +vim.opt.hlsearch = false + +vim.opt.ttimeoutlen = 0 +vim.opt.timeoutlen = 1000 + +vim.opt.scrolloff = 10 +vim.opt.mouse = "" +vim.opt.mousescroll = "ver:0,hor:0" +vim.opt.wildmode= "longest,list,full" +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.viminfofile = os.getenv("XDG_CONFIG_HOME") .. "/nvim/viminfo" + +vim.opt.spellsuggest = { "best", 5 } diff --git a/.config/nvim/lua/plugins/autorepair.lua b/.config/nvim/lua/plugins/autorepair.lua @@ -0,0 +1,8 @@ +return { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true, + disable_filetype = { "TelescopePrompt" , "vim" }, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function +} diff --git a/.config/nvim/lua/plugins/color.lua b/.config/nvim/lua/plugins/color.lua @@ -0,0 +1,58 @@ +function ColorMyPencils(color) + color = color or "rose-pine-moon" + vim.cmd.colorscheme(color) + vim.opt.cursorline = true + + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) + vim.api.nvim_set_hl(0, "MatchParen", { bg= "darkred" }) + vim.api.nvim_set_hl(0, "SpellBad", { bold=true, underline=true, fg= "red" }) + + -- separators + vim.api.nvim_set_hl(0, "WinSeparator", { fg="#A96C8A", bold=true }) + vim.api.nvim_set_hl(0, "StatusLine", { fg="#6CA98A" }) + + vim.fn.matchadd("ExtraWhiteSpace", '\\v\\s+$') + vim.api.nvim_set_hl(0, "ExtraWhiteSpace", { ctermbg="red", bg="red" }) + local nontexthl = vim.api.nvim_get_hl_by_name("NonText", true) + + -- colpilot chat + vim.api.nvim_set_hl(0, 'CopilotChatHeader', { fg = '#7C3AED', bold = true }) + vim.api.nvim_set_hl(0, 'CopilotChatSeparator', { fg = '#374151' }) + + -- TelescopeBorder + vim.api.nvim_set_hl(0, 'TelescopeBorder', { fg = '#A96C8A', bold=true }) + vim.api.nvim_set_hl(0, 'TelescopeTitle', { fg = '#6CA98A', bold=true }) + + -- lsp hints + vim.api.nvim_set_hl(0, "LspInlayHint", { bg = "none", fg = nontexthl.foreground }) + vim.api.nvim_set_hl(0, "FloatBorder", { bg = "none", fg = "#6CA98A", bold = true }) +end + +return { + { + "rose-pine/neovim", + name = "rose-pine", + config = function() + require('rose-pine').setup({ + dark_variant = "main", + dim_inactive_windows = true, + disable_background = true, + disable_nc_background = true, + disable_float_background = true, + extend_background_behind_borders = true, + enable = { + terminal = true, + legacy_highlights = true, + migrations = true, + }, + styles = { + bold = true, + italic = true, + transparency = false, + }, + }) + ColorMyPencils(); + end + }, +} diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua @@ -0,0 +1,56 @@ +return { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + requires = { + "copilotlsp-nvim/copilot-lsp", -- (optional) for NES functionality + }, + config = function() + require("copilot").setup({ + copilot_model = "gpt-5.1", + panel = { + enabled = true, + auto_refresh = true, + keymap = { + jump_prev = "[[", + jump_next = "]]", + accept = "<CR>", + refresh = "gr", + open = "<M-CR>" + }, + layout = { + position = "bottom", -- | top | left | right | horizontal | vertical + ratio = 0.4 + }, + }, + suggestion = { + enabled = false, + auto_trigger = true, + is_visible = true, + hide_during_completion = true, + debounce = 75, + keymap = { + accept = "<M-l>", + accept_word = false, + accept_line = false, + next = "<M-]>", + prev = "<M-[>", + dismiss = "<C-]>", + }, + }, + filetypes = { + yaml = false, + markdown = false, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + svn = false, + cvs = false, + ["."] = false, + }, + copilot_node_command = 'node', -- Node.js version must be > 18.x + server_opts_overrides = {}, + }) + end, +} diff --git a/.config/nvim/lua/plugins/copilotchat.lua b/.config/nvim/lua/plugins/copilotchat.lua @@ -0,0 +1,45 @@ +return { + "CopilotC-Nvim/CopilotChat.nvim", + dependencies = { + "zbirenbaum/copilot.lua", -- or + "nvim-lua/plenary.nvim", -- for curl, log and async functions + }, + event = "VeryLazy", + build = "make tiktoken", -- Only on MacOS or Linux + opts = { + model = "gpt-5.1", + window = { + layout = 'horizontal', + width = 1, -- Fixed width in columns + height = 0.3, -- Fixed height in rows + title = '🤖 AI Assistant', + }, + headers = { + user = '👤 You', + assistant = '🤖 Copilot', + tool = '🔧 Tool', + }, + suggestion = { enabled = true }, + separator = '━━', + auto_fold = true, -- Automatically folds non-assistant messages + }, + config = function(_, opts) + require("CopilotChat").setup(opts) + end, + keys = { + { + "<leader>ao", + function() + vim.cmd("CopilotChatOpen") + end, + desc = "CopilotChat - Activate", + }, + { + "<leader>ar", + function() + vim.cmd("CopilotChatReset") + end, + desc = "CopilotChat - Reset", + }, + }, +} diff --git a/.config/nvim/lua/plugins/floaterm.lua b/.config/nvim/lua/plugins/floaterm.lua @@ -0,0 +1,8 @@ +return { + "voldikss/vim-floaterm", + config = function() + vim.keymap.set('n', "<leader>ft", ":FloatermNew --name=myfloat --height=0.6 --width=0.7 --autoclose=2 zsh<CR> ") + vim.keymap.set('n', "t", ":FloatermToggle myfloat<CR>") + vim.keymap.set('t', "<C-t>", "<C-\\><C-n>:q<CR>") + end +} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,278 @@ +return { + "neovim/nvim-lspconfig", + dependencies = { + "stevearc/conform.nvim", + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "L3MON4D3/LuaSnip", + "j-hui/fidget.nvim", + "chrisgrieser/nvim-lsp-endhints", + "zbirenbaum/copilot-cmp" + }, + opts = { + setup = { + rust_analyzer = function() + return true + end, + }, + }, + config = function () + vim.opt.signcolumn = 'yes' + vim.o.winborder = 'single' + vim.diagnostic.enable(false) + vim.lsp.inlay_hint.enable(true) + vim.diagnostic.config({ + virtual_lines = true, + virtual_text = true, + }) + + + local lspconfig_defaults = require('lspconfig').util.default_config + require("conform").setup({ + formatters_by_ft = { } + }) + local cmp = require("cmp") + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + 'force', + lspconfig_defaults.capabilities, + cmp_lsp.default_capabilities() + ) + lspconfig_defaults.capabilities = capabilities + + vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + local opts = {buffer = event.buf} + + vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts) + vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts) + vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts) + vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts) + vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts) + vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts) + vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts) + vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts) + vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts) + vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts) + end, + }) + + + require("fidget").setup({}) + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", + }, + handlers = { + function(server_name) + require("lspconfig")[server_name].setup { + capabilities = capabilities + } + end, + ['bashls'] = function() + local lspconfig = require("lspconfig") + lspconfig.bashls.setup { + cmd = {'bash-language-server', 'start'}, + filetypes = {'zsh', 'bash', 'sh'}, + capabilities = capabilities + } + end, + ["rust_analyzer"] = function() end, + ["lua_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + telemetry = { + enable = false + }, + diagnostics = { + globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + } + } + }, + on_init = function(client) + local join = vim.fs.joinpath + local path = client.workspace_folders[1].name + if vim.uv.fs_stat(join(path, '.luarc.json')) + or vim.uv.fs_stat(join(path, '.luarc.jsonc')) + then + return + end + + local runtime_path = vim.split(package.path, ';') + table.insert(runtime_path, join('lua', '?.lua')) + table.insert(runtime_path, join('lua', '?', 'init.lua')) + + local nvim_settings = { + runtime = { + version = 'LuaJIT', + path = runtime_path + }, + diagnostics = { + globals = {'vim'} + }, + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + vim.fn.stdpath('config'), + }, + }, + } + + client.config.settings.Lua = vim.tbl_deep_extend( + 'force', + client.config.settings.Lua, + nvim_settings + ) + end + }) + end, + } + }) + + local cmp_select = { behavior = cmp.SelectBehavior.Select } + local luasnip = require("luasnip") + require("copilot_cmp").setup() + + local has_words_before = function() + if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil + end + + cmp.setup({ + snippet = { + expand = function(args) + --require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + vim.snippet.expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), + ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), + ["<C-Space>"] = cmp.mapping.complete(), + ['<`-j>'] = cmp.mapping.scroll_docs(-4), + ['<`-k>'] = cmp.mapping.scroll_docs(4), + ['<C-a>'] = cmp.mapping(function(fallback) + if cmp.visible() then + if luasnip.expandable() then + luasnip.expand() + else + cmp.confirm({ select = true, + }) + end + else + fallback() + end + end), + ["<Tab>"] = vim.schedule_wrap(function(fallback) + if cmp.visible() and has_words_before() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + elseif luasnip.locally_jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end), + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = 'path' }, -- file paths + { name = 'luasnip' }, -- file paths + { name = 'nvim_lsp', keyword_length = 3 }, -- from language server + { name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized + { name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.* + { name = 'buffer', keyword_length = 2 }, -- source current buffer + { name = 'calc'}, -- source for math calculation + { name = 'copilot'}, -- source for math calculation + }), + window = { + documentation = cmp.config.window.bordered({ + winhighlight = 'Normal:CmpPmenu,CursorLine:PmenuSel,Search:None,NormalFloat:Normal', + }), + completion = cmp.config.window.bordered({ + winhighlight = 'Normal:CmpPmenu,CursorLine:PmenuSel,Search:None,NormalFloat:Normal', + }), + }, + formatting = { + fields = {'menu', 'abbr', 'kind'}, + format = function(entry, item) + local menu_icon ={ + nvim_lsp = 'λ', + luasnip = '⋗', + buffer = 'Ω', + path = '🖫', + copilot = " " + } + --item.kind = string.format('%s %s', kind_icons[item.kind], item.kind) + item.menu = menu_icon[entry.source.name] + return item + end, + }, + }) + + vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'rounded' }) + vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = 'rounded' }) + + local endhints = require("lsp-endhints") + endhints.enable() + endhints.setup { + icons = { + type = "-> ", + parameter = "<= ", + offspec = "<= ", -- hint kind not defined in official LSP spec + unknown = "? ", -- hint kind is nil + }, + label = { + truncateAtChars = 50, + padding = 1, + marginLeft = 0, + sameKindSeparator = ", ", + }, + extmark = { + priority = 50, + }, + autoEnableHints = true, + } + + vim.keymap.set('n', '<leader>h', function(bufnr) + if vim.lsp.inlay_hint.is_enabled() then + print("Inlay Hitnts OFF") + else + print("Inlay Hitnts ON") + end + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(), bufnr) + end, { silent = true, noremap = true }) + + vim.keymap.set('n', '<leader>d', function() + if vim.diagnostic.is_enabled() then + print("Diagnostics OFF") + else + print("Diagnostics ON") + end + vim.diagnostic.enable(not vim.diagnostic.is_enabled()) + end, { silent = true, noremap = true }) + end +} + + diff --git a/.config/nvim/lua/plugins/luasnip.lua b/.config/nvim/lua/plugins/luasnip.lua @@ -0,0 +1,18 @@ +return { + "L3MON4D3/LuaSnip", + version = "v2.3.0", + build = "make install_jsregexp", + config = function() + local ls = require("luasnip") + ls.config.setup({ + enable_autosnippets = true, + store_selection_keys = "<c-s>", + }) + for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do + loadfile(ft_path)() + end + + + + end +} diff --git a/.config/nvim/lua/plugins/rustacean.lua b/.config/nvim/lua/plugins/rustacean.lua @@ -0,0 +1,112 @@ +return { + 'mrcjkb/rustaceanvim', + version = '^6', -- Recommended + lazy = false, -- This plugin is already lazy + dependencies = { + "mason-org/mason-registry", + }, + config = function() + vim.g.rustaceanvim = { + tools = { + float_win_config = { + border = "rounded", + } + }, + server = { + on_attach = function(client, bufnr) + vim.keymap.set( + "n", + "<leader>a", + function() + vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping + -- or vim.lsp.buf.codeAction() if you don't want grouping. + end, + { silent = true, buffer = bufnr } + ) + vim.keymap.set( + "n", + "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions + function() + vim.cmd.RustLsp({'hover', 'actions'}) + end, + { silent = true, buffer = bufnr } + ) + end, + cmd = function() + local mason_registry = require('mason-registry') + if mason_registry.is_installed('rust-analyzer') then + -- This may need to be tweaked depending on the operating system. + local ra = mason_registry.get_package('rust-analyzer') + local ra_filename = ra:get_receipt():get().links.bin['rust-analyzer'] + return { ('%s/%s'):format(ra:get_install_path(), ra_filename or 'rust-analyzer') } + else + -- global installation + return { 'rust-analyzer' } + end + end, + default_settings = { + -- rust-analyzer language server configuration + ['rust-analyzer'] = { + diagnostics = { + enable = true; + }, + cargo = { + allFeatures = true, + }, + }, + }, + settings = { + ['rust-analyzer'] = { + inlayHints = { + maxLength = 50, + renderColons = true, + bindingModeHints = { + enable = false, + }, + chainingHints = { + enable = true, + }, + closingBraceHints = { + enable = true, + minLines = 50, + }, + closureCaptureTypeHints = { + enable = true, + }, + closureReturnTypeHints = { + enable = true, + }, + lifetimeElisionHints = { + enable = true, + useParameterNames = false, + }, + genericParameterHints = { + const = { + enable = true, + }, + lifetime = { + enable = true, + }, + type = { + enable = true, + }, + }, + parameterHints = { + enable = true, + }, + reborrowHints = { + enable = "never", + }, + typeHints = { + enable = true, + hideClosureInitialization = false, + hideNamedConstructor = false, + }, + }, + }, + }, + }, + } + + end +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,106 @@ +return { + "nvim-telescope/telescope.nvim", + + + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-lua/popup.nvim", + "nvim-telescope/telescope-fzy-native.nvim", + }, + + config = function() + local previewers = require("telescope.previewers") + local _bad = { ".*%.tex", ".*%.md", ".*%.html" } + local bad_files = function(filepath) + for _, v in ipairs(_bad) do + if filepath:match(v) then + return false + end + end + return true + end + local new_maker = function(filepath, bufnr, opts) + opts = opts or {} + if opts.use_ft_detect == nil then opts.use_ft_detect = true end + opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath) + previewers.buffer_previewer_maker(filepath, bufnr, opts) + end + + + local edge_borders = { + prompt = { "─", "│", "", "│", "┌", "┐", "│", "│" }, + results = { "─", "│", "─", "│", "├", "┤", "┘", "└" }, + preview = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, + } + + + require("telescope").setup { + defaults = + vim.tbl_extend( + "force", + require("telescope.themes").get_dropdown({ + borderchars = edge_borders, + }), + { + buffer_previewer_maker = new_maker, + } + ), + extentions = { + fzf = {} + } + } + + local builtin = require('telescope.builtin') + require('telescope').load_extension('fzy_native') + + vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) + vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) + vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) + vim.keymap.set('n', '<leader>fh', builtin.help_tags, {}) + + vim.api.nvim_create_user_command( + 'FindConfig', + function () + builtin.find_files({ + search_dirs = { + os.getenv("XDG_CONFIG_HOME") .. "/nvim/lua", + os.getenv("XDG_CONFIG_HOME") .. "/nvim/after", + os.getenv("XDG_CONFIG_HOME") .. "/zsh", + os.getenv("XDG_CONFIG_HOME") .. "/shell", + os.getenv("XDG_CONFIG_HOME") .. "/X", + os.getenv("XDG_CONFIG_HOME") .. "/X11", + os.getenv("XDG_LOCAL_HOME") .. "/src", + os.getenv("XDG_LOCAL_HOME") .. "/bin", + }, + hidden = true, + }) + end, + {} + ) + vim.keymap.set('n', '<leader>lf', ":FindConfig<CR>") + + vim.api.nvim_create_user_command( + 'GrepConfig', + function () + builtin.live_grep({ + search_dirs = { + os.getenv("XDG_CONFIG_HOME") .. "/nvim/lua", + os.getenv("XDG_CONFIG_HOME") .. "/nvim/after", + os.getenv("XDG_CONFIG_HOME") .. "/zsh", + os.getenv("XDG_CONFIG_HOME") .. "/shell", + os.getenv("XDG_CONFIG_HOME") .. "/X", + os.getenv("XDG_CONFIG_HOME") .. "/X11", + os.getenv("XDG_LOCAL_HOME") .. "/src", + os.getenv("XDG_LOCAL_HOME") .. "/bin", + }, + hidden = true, + }) + end, + {} + ) + vim.keymap.set('n', '<leader>lg', ":GrepConfig<CR>") + + vim.keymap.set('n', '<C-s>', builtin.spell_suggest, {}) + end +} + diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,48 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function () + require("nvim-treesitter.configs").setup({ + ensure_installed = "all", + auto_install = true, + indent = { + enable = true + }, + highlight = { + enable = true, + disable = function(lang, buf) + local langs = { "latex", "html" , "markdown", "text"} + for i=1,#langs do + if lang == langs[i] then + return true + end + end + + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + vim.notify( + "File larger than 100KB treesitter disabled for performance", + vim.log.levels.WARN, + {title = "Treesitter"} + ) + return true + end + end, + additional_vim_regex_highlighting=false, + }, + }) + + local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs() + treesitter_parser_config.templ = { + install_info = { + url = "https://github.com/vrischmann/tree-sitter-templ.git", + files = {"src/parser.c", "src/scanner.c"}, + branch = "master", + }, + } + + vim.treesitter.language.register("templ", "templ") + end + +} diff --git a/.config/nvim/lua/plugins/undotree.lua b/.config/nvim/lua/plugins/undotree.lua @@ -0,0 +1,6 @@ +return { + "mbbill/undotree", + config = function() + vim.keymap.set('n', '<leader>u', ":UndotreeToggle<CR>") + end +} diff --git a/.config/nvim/lua/plugins/vimtex.lua b/.config/nvim/lua/plugins/vimtex.lua @@ -0,0 +1,29 @@ +return { + "lervag/vimtex", + lazy = false, + init = function() + vim.opt.conceallevel = 2 + vim.g.vimtex_view_method = "zathura" + vim.g.latex_to_unicode_auto = 1 + vim.g.tex_flavour = "latex" + vim.g.vimtex_compiler_latexmk = { + executable = "latexmk", + options = { + "-synctex=0", + "-verbose", + "-file-line-error", + "-interaction=nonstopmode", + "-shell-escape", + "-synctex=1" + }, + out_dir = "build", + aux_dir = "build" + } + vim.g.vimtex_quickfix_mode = 0 + vim.g.tex_conceal = "abdmg" + + vim.keymap.set('n', '<leader>tp', "<Esc>:w<CR>:VimtexCompile<CR>") + vim.keymap.set('n', '<leader>te', "<Esc>:w<CR>:VimtexErrors<CR>") + + end +} diff --git a/.config/nvim/lua/snippets/basic.lua b/.config/nvim/lua/snippets/basic.lua @@ -0,0 +1,18 @@ +local ls = require("luasnip") + +local s = ls.snippet + +local date = function() return {os.date('%Y-%m-%d')} end +local func = ls.function_node + +ls.add_snippets(nil, { + all = { + s({ + trig = "date", + namr = "Date", + dscr = "Date in the form of YYYY-MM-DD", + }, { + func(date, {}), + }), + }, +}) diff --git a/.config/nvim/lua/snippets/latex.lua b/.config/nvim/lua/snippets/latex.lua @@ -0,0 +1,623 @@ +local ls = require("luasnip") +local s = ls.snippet +local i = ls.insert_node +local t = ls.text_node +local fmt = require("luasnip.extras.fmt").fmt +local extras = require("luasnip.extras") +local rep = extras.rep + +local function math() + return vim.api.nvim_eval('vimtex#syntax#in_mathzone()') == 1 +end +local function env(name) + local is_inside = vim.fn['vimtex#env#is_inside'](name) + return (is_inside[1] > 0 and is_inside[2] > 0) +end +local function tikz() + return env("tikzpicture") +end + +ls.add_snippets("tex", { +s({ trig = "beg", snippetType = "snippet", descr = "begin env"}, fmt([[ + \begin{<>} + <> + \end{<>}]], + { i(1, "env"), i(0), rep(1) }, + { delimiters = "<>" } +)), +s({ trig = "...", wordTrig = false, snippetType = "autosnippet", descr = "ldots" }, { t("\\ldots") }), +s("template", fmt([[ + \documentclass[a4paper]{article} + + \usepackage[T1]{fontenc} + \usepackage[utf8]{inputenc} + \usepackage{mlmodern} + + \usepackage[parfill]{parskip} + \usepackage[colorlinks=true,naturalnames=true,plainpages=false,pdfpagelabels=true]{hyperref} + \usepackage[parfill]{parskip} + \usepackage{lipsum} + + \usepackage{amsmath, amssymb} + \usepackage{subcaption} + \usepackage[shortlabels]{enumitem} + \usepackage{amsthm} + \usepackage{mathtools} + \usepackage{braket} + \usepackage{bbm} + + \usepackage{graphicx} + \usepackage{geometry} + \geometry{a4paper, top=15mm} + + % figure support + \usepackage{import} + \usepackage{xifthen} + \pdfminorversion=7 + \usepackage{pdfpages} + \usepackage{transparent} + \newcommand{\incfig}[1]{% + \def\svgwidth{\columnwidth} + \import{./figures/}{#1.pdf_tex} + } + + \pdfsuppresswarningpagegroup=1 + + %\usepackage[backend=biber, sorting=none]{biblatex} + %\addbibresource{uni.bib} + + \title{<>} + \author{Milutin Popović} + + \begin{document} + %\tableofcontents + \maketitle + <> + %\printbibliography + \end{document} + ]], + { i(1, "Title"), i(0) }, + { + delimiters = "<>", + })), +s({ trig = "document", descr = "document environment", snippetType = "snippet" }, + fmt([[ + \begin{document} + \tableofcontents + <> + \printbibliography + \end{document} + ]], + { i(0) }, + { delimiters = "<>" } + )), +s({ trig = "table", descr = "table environment" , snippetType = "snippet" }, + fmt([[ + \begin{table}[htb] + \centering + \caption{<>} + \label{tab:<>} + \begin{tabular}{<>} + <> + \end{tabular} + \end{table} + ]], + { i(1, "caption"), i(2, "label"), i(3, "c"), i(0) }, + { delimiters = "<>" } + )), +s({ trig = "fig", descr = "figure environment" }, + fmt([[ + \begin{figure}[htb!] + \centering + \includegraphics[width=0.8\textwidth]{<>} + \caption{<>} + \label{fig:<>} + \end{figure} + ]], + { i(1, "path"), i(2, "caption"), i(3, "0") }, + { delimiters = "<>" } + )), +s({ trig = "align", descr = "align", snippetType = "autosnippet" }, + fmt([[ + \begin{align} + <> + \end{align} + ]], + { i(1) }, + { delimiters = "<>" } + )), +s({ trig = "enumerate", descr = "enumerate", snippetType = "autosnippet" }, + fmt([[ + \begin{enumerate} + \item <> + \end{enumerate} + ]], + { i(1) }, + { delimiters = "<>" } + )), +s({ trig = "itemize", descr = "itemize", snippetType = "autosnippet" }, + fmt([[ + \begin{itemize} + \item <> + \end{itemize} + ]], + { i(1) }, + { delimiters = "<>" } + )), +s({ trig = "frame", descr = "frame", snippetType = "snippet" }, + fmt([[ + \begin{frame}{<>} + <> + \end{frame} + ]], + { i(1), i(0) }, + { delimiters = "<>" } + )), +s({ trig = "desc", descr = "description", snippetType = "snippet" }, + fmt([[ + \begin{description} + \item[<>] <> + \end{description} + ]], + { i(1), i(0) }, + { delimiters = "<>" } + )), +s({ trig = "pac", descr = "package", snippetType = "snippet" }, + fmt([[\usepackage[<>]{<>}<> ]], + { i(1, "options"), i(2, "package"), i(0) }, + { delimiters = "<>" } + )), +s({ trig = "=>", wordTrig = false, descr = "implies", snippetType = "autosnippet" }, + { t("\\implies") }, + { condition = math, show_condition = math } + ), +s({ trig = "=<", wordTrig = false, descr = "impliedby", snippetType = "autosnippet" }, + { t("\\impliedby") }, + { condition = math, show_condition = math } + ), +s({ trig = "iff", wordTrig = false, descr = "iff", snippetType = "autosnippet" }, + { t("\\iff") }, + { condition = math, show_condition = math } + ), +s({ trig = "//", wordTrig = false, descr = "Fraction", snippetType = "autosnippet" }, + fmt([[\frac{<>}{<>}<>]], { i(1), i(2), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "==", wordTrig = false, descr = "equals", snippetType = "autosnippet" }, + fmt([[ + &= <> \\ + ]], { i(1) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "!=", wordTrig = false, descr = "not equals", snippetType = "autosnippet" }, + { t("\\neq") }, + { condition = math, show_condition = math } + ), +s({ trig = "ceil", wordTrig = false, descr = "ceiling function", snippetType = "autosnippet" }, + fmt([[\left\lceil <> \right\rceil <>]], { i(1), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "floor", wordTrig = false, descr = "floor function", snippetType = "autosnippet" }, + fmt([[\left\lfloor <> \right\rfloor <>]], { i(1), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "pmat", wordTrig = false, descr = "pmatrix", snippetType = "autosnippet" }, + fmt([[\begin{pmatrix} <> \end{pmatrix} <>]], { i(1), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "bmat", wordTrig = false, descr = "pmatrix", snippetType = "autosnippet" }, + fmt([[\begin{bmatrix} <> \end{bmatrix} <>]], { i(1), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "lr", wordTrig = false, descr = "left* right*", snippetType = "snippet" }, + fmt([[\left<> <> \right<>]], { i(1), i(0), rep(1) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "lr(", wordTrig = false, descr = "left( right)", snippetType = "autosnippet" }, + fmt([[\left( <> \right)]], { i(1) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "lr|", wordTrig = false, descr = "left| right|", snippetType = "autosnippet" }, + fmt([[\left| <> \right|]], { i(1) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "lr{", wordTrig = false, descr = "left{ right}", snippetType = "autosnippet" }, + fmt([[\left\{ <> \right\}]], { i(1) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "lr[", wordTrig = false, descr = "left{ right}", snippetType = "autosnippet" }, + fmt([[\left[ <> \right] ]], { i(1) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "lra", wordTrig = false, descr = "left< right>", snippetType = "autosnippet" }, + fmt([[\left\langle <> \right\rangle] ]], { i(1) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "conj", descr = "conjugate", snippetType = "autosnippet" }, + fmt([[\overline{<>}<>]], { i(1), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "sum", wordTrig = false, descr = "sum", snippetType = "autosnippet" }, + fmt([[\sum_{<>}^{<>} <>]], { i(1), i(2), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "lim", wordTrig = false, descr = "lim", snippetType = "autosnippet" }, + fmt([[\lim_{<> \to <>} <>]], { i(1), i(2, "\\infty"), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "limsup", wordTrig = false, descr = "limsup", snippetType = "autosnippet" }, + fmt([[\limsup_{<> \to <>} <>]], { i(1), i(2, "\\infty"), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "prod", wordTrig = false, descr = "product", snippetType = "autosnippet" }, + fmt([[\prod_{<>}^{<>} <>]], { i(1), i(2), i(0) }, { delimiters = "<>" }), + { condition = math, show_condition = math } + ), +s({ trig = "part", wordTrig = false, descr = "d/dx", snippetType = "snippet" }, + fmt( + [[\frac{\partial <>}{\partial <>} <>]], + { i(1, "f"), i(2, "x"), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "sqrt", wordTrig = false, descr = "sqrt", snippetType = "autosnippet" }, + fmt( + [[\sqrt{<>} <>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "hat", wordTrig = false, descr = "hat", snippetType = "autosnippet" }, + fmt( + [[\hat{<>}<>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "tilde", wordTrig = false, descr = "tilde", snippetType = "autosnippet" }, + fmt( + [[\tilde{<>}<>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "td", wordTrig = false, descr = "to the .. power", snippetType = "autosnippet" }, + fmt( + [[^{<>} <>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "rd", wordTrig = false, descr = "to the .. (power)", snippetType = "autosnippet" }, + fmt( + [[^{(<>)} <>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "rd", wordTrig = false, descr = "to the .. (power)", snippetType = "autosnippet" }, + fmt( + [[^{(<>)} <>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "__", wordTrig = false, descr = "subscript", snippetType = "autosnippet" }, + fmt( + [[_{<>}<>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "ooo", wordTrig = false, descr = "infty", snippetType = "autosnippet" }, + { t("\\infty") }, + { condition = math, show_condition = math } + ), +s({ trig = "<=", wordTrig = false, descr = "leq", snippetType = "autosnippet" }, + { t("\\le") }, + { condition = math, show_condition = math } + ), +s({ trig = ">=", wordTrig = false, descr = "geq", snippetType = "autosnippet" }, + { t("\\ge") }, + { condition = math, show_condition = math } + ), +s({ trig = "EE", wordTrig = false, descr = "exists", snippetType = "autosnippet" }, + { t("\\exists") }, + { condition = math, show_condition = math } + ), +s({ trig = "AA", wordTrig = false, descr = "forall", snippetType = "autosnippet" }, + { t("\\forall") }, + { condition = math, show_condition = math } + ), +s({ trig = "xnn", wordTrig = false, descr = "x_n", snippetType = "autosnippet" }, + { t("x_{n}") }, + { condition = math, show_condition = math } + ), +s({ trig = "ynn", wordTrig = false, descr = "y_n", snippetType = "autosnippet" }, + { t("y_{n}") }, + { condition = math, show_condition = math } + ), +s({ trig = "xii", wordTrig = false, descr = "x_i", snippetType = "autosnippet" }, + { t("x_{i}") }, + { condition = math, show_condition = math } + ), +s({ trig = "yii", wordTrig = false, descr = "y_i", snippetType = "autosnippet" }, + { t("y_{i}") }, + { condition = math, show_condition = math } + ), +s({ trig = "xjj", wordTrig = false, descr = "x_j", snippetType = "autosnippet" }, + { t("x_{j}") }, + { condition = math, show_condition = math } + ), +s({ trig = "yjj", wordTrig = false, descr = "y_j", snippetType = "autosnippet" }, + { t("y_{j}") }, + { condition = math, show_condition = math } + ), +s({ trig = "mcal", wordTrig = false, descr = "mathcal", snippetType = "autosnippet" }, + fmt( + [[\mathcal{<>}<>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "lll", wordTrig = false, descr = "l", snippetType = "autosnippet" }, + { t("\\ell") }, + { condition = math, show_condition = math } + ), +s({ trig = "nabl", wordTrig = false, descr = "nabla", snippetType = "autosnippet" }, + { t("\\nabla") }, + { condition = math, show_condition = math } + ), +s({ trig = "xx", wordTrig = false, descr = "cross", snippetType = "autosnippet" }, + { t("\\times") }, + { condition = math, show_condition = math } + ), +s({ trig = "**", wordTrig = false, descr = "cdot", snippetType = "autosnippet" }, + { t("\\cdot") }, + { condition = math, show_condition = math } + ), +s({ trig = "pi", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\pi") }, + { condition = math, show_condition = math } + ), +s({ trig = "arcsin", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\arcsin") }, + { condition = math, show_condition = math } + ), +s({ trig = "sin", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\sin") }, + { condition = math, show_condition = math } + ), +s({ trig = "cos", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\cos") }, + { condition = math, show_condition = math } + ), +s({ trig = "arccot", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\arrcot") }, + { condition = math, show_condition = math } + ), +s({ trig = "cot", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\cot") }, + { condition = math, show_condition = math } + ), +s({ trig = "csc", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\csc") }, + { condition = math, show_condition = math } + ), +s({ trig = "ln", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\ln") }, + { condition = math, show_condition = math } + ), +s({ trig = "log", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\log") }, + { condition = math, show_condition = math } + ), +s({ trig = "exp", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\exp") }, + { condition = math, show_condition = math } + ), +s({ trig = "star", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\star") }, + { condition = math, show_condition = math } + ), +s({ trig = "perp", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\perp") }, + { condition = math, show_condition = math } + ), +s({ trig = "int ", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\int") }, + { condition = math, show_condition = math } + ), +s({ trig = "zeta", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\zeta") }, + { condition = math, show_condition = math } + ), +s({ trig = "arccos", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\arccos") }, + { condition = math, show_condition = math } + ), +s({ trig = "actan", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\arctan") }, + { condition = math, show_condition = math } + ), +s({ trig = "tan", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\tan") }, + { condition = math, show_condition = math } + ), +s({ trig = "arccsc", wordTrig = false, descr = "fill", snippetType = "autosnippet" }, + { t("\\arcsc") }, + { condition = math, show_condition = math } + ), +s({ trig = "dint", wordTrig = false, descr = "integral", snippetType = "autosnippet" }, + fmt( + [[\int_{<>}^{<>} <> <>]], + { i(1), i(2), i(3), i(4) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "->", wordTrig = false, descr = "to", snippetType = "autosnippet" }, + { t("\\to") }, + { condition = math, show_condition = math } + ), +s({ trig = "<->", wordTrig = false, descr = "leftrightarrow", snippetType = "autosnippet" }, + { t("\\leftrightarrow") }, + { condition = math, show_condition = math } + ), +s({ trig = "!>", wordTrig = false, descr = "mapsto", snippetType = "autosnippet" }, + { t("\\mapsto") }, + { condition = math, show_condition = math } + ), +s({ trig = "ivs", wordTrig = false, descr = "inverse", snippetType = "autosnippet" }, + { t("^{-1}") }, + { condition = math, show_condition = math } + ), +s({ trig = "compl", wordTrig = false, descr = "compliment", snippetType = "autosnippet" }, + { t("^{c}") }, + { condition = math, show_condition = math } + ), +s({ trig = "\\\\\\", wordTrig = false, descr = "setminus", snippetType = "autosnippet" }, + { t("\\setminus") }, + { condition = math, show_condition = math } + ), +s({ trig = ">>", wordTrig = false, descr = ">>", snippetType = "autosnippet" }, + { t("\\gg") }, + { condition = math, show_condition = math } + ), +s({ trig = "<<", wordTrig = false, descr = "<<", snippetType = "autosnippet" }, + { t("\\ll") }, + { condition = math, show_condition = math } + ), +s({ trig = "~~", wordTrig = false, descr = "~", snippetType = "autosnippet" }, + { t("\\sim") }, + { condition = math, show_condition = math } + ), +s({ trig = "sub", wordTrig = false, descr = "~", snippetType = "autosnippet" }, + { t("\\subseteq") }, + { condition = math, show_condition = math } + ), +s({ trig = "set", wordTrig = false, descr = "set", snippetType = "autosnippet" }, + fmt( + [[\{<>\} <>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "||", wordTrig = false, descr = "mid", snippetType = "autosnippet" }, + { t("\\mid") }, + { condition = math, show_condition = math } + ), +s({ trig = "cc", wordTrig = false, descr = "subseet", snippetType = "autosnippet" }, + { t("\\subset") }, + { condition = math, show_condition = math } + ), +s({ trig = "notin", wordTrig = false, descr = "not in", snippetType = "autosnippet" }, + { t("\\not\\in") }, + { condition = math, show_condition = math } + ), +s({ trig = "inn", wordTrig = false, descr = "in", snippetType = "autosnippet" }, + { t("\\in") }, + { condition = math, show_condition = math } + ), +s({ trig = "Nn", wordTrig = false, descr = "cap", snippetType = "autosnippet" }, + { t("\\cap") }, + { condition = math, show_condition = math } + ), +s({ trig = "UU", wordTrig = false, descr = "cup", snippetType = "autosnippet" }, + { t("\\cup") }, + { condition = math, show_condition = math } + ), +s({ trig = "uuu", wordTrig = false, descr = "bigcup", snippetType = "autosnippet" }, + fmt( + [[\bigcup_{<>} <>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "nnn", wordTrig = false, descr = "bigcap", snippetType = "autosnippet" }, + fmt( + [[\bigcap_{<>} <>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "OO", wordTrig = false, descr = "emptyset", snippetType = "autosnippet" }, + { t("\\O") }, + { condition = math, show_condition = math } + ), +s({ trig = "<!", wordTrig = false, descr = "normal", snippetType = "autosnippet" }, + { t("\\triangleleft") }, + { condition = math, show_condition = math } + ), +s({ trig = "<>", wordTrig = false, descr = "hokje", snippetType = "autosnippet" }, + { t("\\diamond") }, + { condition = math, show_condition = math } + ), +s({ trig = "tt", wordTrig = false, descr = "text", snippetType = "autosnippet" }, + fmt( + [[\text{<>} <>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "case", wordTrig = false, descr = "cases", snippetType = "autosnippet" }, + fmt([[ + \begin{cases} + <> + \end{cases} + ]], + { i(1) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "cvec", wordTrig = false, descr = "column vector", snippetType = "autosnippet" }, + fmt( + [[\begin{pmatrix} <>_<> \\ \vdots \\ <>_<> \end{pmatrix}]], + { i(1, "x"), i(2, "1"), i(3, "x"), i(4, "n") }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "bar", wordTrig = false, descr = "bar", snippetType = "autosnippet" }, + fmt( + [[\overline{<>}<>]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "dL", wordTrig = false, descr = "double letter", snippetType = "autosnippet" }, + fmt( + [[ \mathbb{<>}<> ]], + { i(1), i(0) }, + { delimiters = "<>" } + ), + { condition = math, show_condition = math } + ), +s({ trig = "eps", wordTrig = false, descr = "varepsilon", snippetType = "autosnippet" }, + { t("\\varepsilon") }, + { condition = math, show_condition = math } + ), +s({ trig = "vrho", wordTrig = false, descr = "varrho", snippetType = "autosnippet" }, + { t("\\varrho") }, + { condition = math, show_condition = math } + ), +s({ trig = "vphi", wordTrig = false, descr = "varphi", snippetType = "autosnippet" }, + { t("\\varphi") }, + { condition = math, show_condition = math } + ), +}) diff --git a/.config/nvim/lua/snippets/rust.lua b/.config/nvim/lua/snippets/rust.lua @@ -0,0 +1,18 @@ +local ls = require("luasnip") +local s = ls.snippet +local i = ls.insert_node +local fmt = require("luasnip.extras.fmt").fmt + +ls.add_snippets("rust", { + s( + "match", + fmt([[ + match {} {{ + {} => {{ + {} + }} + {} => {{ + {} + }} + }};]], { i(1), i(2), i(3), i(4), i(5) })), +}) diff --git a/.config/redshift/hooks/brightness.sh b/.config/redshift/hooks/brightness.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Set brightness via xbrightness when redshift status changes + +# Set brightness values for each status. +# Range from 1 to 100 is valid +brightness_day=85 +brightness_transition=50 +brightness_night=30 +# Set fps for smoooooth transition +fps=1000 + +set_brightness() { + for backlight in "${backlights[@]}" + do + xbacklight -set $1 -fps $fps & + done +} + +if [ "$1" = period-changed ]; then + case $3 in + night) + set_brightness $brightness_night + ;; + transition) + set_brightness $brightness_transition + ;; + daytime) + set_brightness $brightness_day + ;; + esac +fi diff --git a/.config/shell/aliases b/.config/shell/aliases @@ -0,0 +1,29 @@ +#!/usr/bin/zsh + +alias sudo="sudo " +alias su="sudo -E su" +alias ls="ls --color=auto" +alias pacman="sudo pacman" +alias shutdown="sudo shutdown -h now" +alias vim="nvim" + +alias mbsync="mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc" +alias tmux="tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf" +alias trr="transmission-remote" +alias wget="wget --hsts-file=$XDG_CACHE_HOME/wget-hist" +alias newsboat="newsboat --config-file=$XDG_CONFIG_HOME/newsboat/config --url-file=$XDG_CONFIG_HOME/newsboat/urls" +alias monerod="monerod --config-file=$XDG_DATA_HOME/bitmonerod/monerod.conf" +alias monero-wallet-cli="monero-wallet-cli --config-file=$XDG_CONFIG_HOME/monero/monero.conf" +alias yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config" +alias pdflatex="pdflatex --shell-escape" +alias zathura="devour zathura" +alias htop="sudo htop" +alias multitex="latexmk -pdf -outdir=build" +alias neomutt="TZ=Europe/Berlin neomutt" +alias cmake="cmake -D CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" + +alias cpr="rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1" +alias mvr="rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files" +alias pyenv="source $HOME/.local/py_env/bin/activate" +alias lf="lfub" +alias dots="git --git-dir=$HOME/.dots --work-tree=$HOME" diff --git a/.config/shell/colors b/.config/shell/colors @@ -0,0 +1,40 @@ +#!/usr/bin/zsh + +LS_COLORS=$LS_COLORS:'di=1;36:' +export LS_COLORS + +source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null + + +# Override highlighter colors +FAST_HIGHLIGHT_STYLES[alias]=fg=none +FAST_HIGHLIGHT_STYLES[default]=fg=none +FAST_HIGHLIGHT_STYLES[builtin]=fg=none +FAST_HIGHLIGHT_STYLES[precommand]=fg=none +FAST_HIGHLIGHT_STYLES[command]=fg=none +FAST_HIGHLIGHT_STYLES[commandseparator]=none +FAST_HIGHLIGHT_STYLES[unknown-token]=fg=red,bold +FAST_HIGHLIGHT_STYLES[reserver-word]=fg=red,bold +FAST_HIGHLIGHT_STYLES[assign]=none +FAST_HIGHLIGHT_STYLES[history-expansion]=none +FAST_HIGHLIGHT_STYLES[single-hyphen-option]=none +FAST_HIGHLIGHT_STYLES[double-hyphen-option]=none +FAST_HIGHLIGHT_STYLES[single-quoted-argument]=none +FAST_HIGHLIGHT_STYLES[double-quoted-argument]=none +FAST_HIGHLIGHT_STYLES[path]=none +FAST_HIGHLIGHT_STYLES[path-to-dir]=none + +man() { + LESS="-N" \ + LESS_TERMCAP_md=$'\e[01;31m' \ + LESS_TERMCAP_me=$'\e[0m' \ + LESS_TERMCAP_so=$'\e[01;44;33m' \ + LESS_TERMCAP_se=$'\e[0m' \ + LESS_TERMCAP_us=$'\e[01;32m' \ + LESS_TERMCAP_ue=$'\e[0m' \ + command man "$@" +} + + +source /usr/share/zsh/plugins/zsh-system-clipboard/zsh-system-clipboard.zsh 2>/dev/null + diff --git a/.config/shell/profile b/.config/shell/profile @@ -0,0 +1,53 @@ +#!/bin/sh + +export PATH="$PATH:$(du "$HOME/.local/bin"| cut -f2 | tr '\n' ':'):$HOME/.local/share/cargo/bin" +export PATH="$PATH:$HOME/.local/share/gem/ruby/3.4.0/bin" + +# Default Programs: +export EDITOR="nvim" +export TERMINAL="st" +export BROWSER="firefox" + + +# ~/ Clean-up: XDG-Base-Directory Specs. +export XDG_SESSION_TYPE="x11" +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_LOCAL_HOME="$HOME/.local" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_PUBLICSHARE_DIR="$HOME/Cloud" +export XDG_DOWNLOAD_DIR="$HOME/Downloads" + +export RANGER_DEVICONS_SEPARATOR=" " +export CARGO_HOME="$XDG_DATA_HOME/cargo" +export ELECTRUMDIR="$XDG_DATA_HOME/electrum" +export GNUPGHOME="$XDG_DATA_HOME/gnupg" +export HISTFILE="$XDG_DATA_HOME/zsh/history" +export IPYTHONDIR="$XDG_CONFIG_HOME/jupyter" +export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH" +export JULIA_HISTORY="$XDG_CACHE_HOME/julia/history.jl" +export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter" +export LESSHISTFILE=- +export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch-config" +export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc +export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" +export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc" +export SSB_HOME="$XDG_DATA_HOME/zoom" +export WGETRC="$XDG_CONFIG_HOME/wgetrc" +export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" +export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" +export _JAVA_AWT_WM_NONREPARENTING=1 +export PGPLOT_FONT='/usr/lib/grfont.dat' +export RUSTUP_HOME="$XDG_DATA_HOME"/rustup +export MANPAGER="less -R --use-color -Dd+r -Du+b" +export MANROFFOPT="-P -c" +export GTK_THEME=Adwaita-dark +export GTK2_RC_FILES=/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc +export QT_STYLE_OVERRIDE=adwaita-dark. +export WINEPREFIX="$XDG_DATA_HOME"/wineprefixes/default +export JP_LSP_VIRTUAL_DIR="$XDG_CACHE_HOME/jupyter/" +export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history +export BUN_INSTALL="$XDG_CONFIG_HOME/bun" +export FOUNDRY_DISABLE_NIGHTLY_WARNING=true +export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java diff --git a/.config/shell/vimode b/.config/shell/vimode @@ -0,0 +1,75 @@ +#!/usr/bin/zsh + +# vi mode +bindkey -v +export KEYTIMEOUT=1 + +# Change cursor shape when in vi mode +function zle-keymap-select { + if [[ ${KEYMAP} == vicmd ]] || + [[ $1 = 'block' ]]; then + echo -ne '\e[1 q' + elif [[ ${KEYMAP} == main ]] || + [[ ${KEYMAP} == viins ]] || + [[ ${KEYMAP} = '' ]] || + [[ $1 = 'beam' ]]; then + echo -ne '\e[5 q' + fi +} +zle -N zle-keymap-select +zle-line-init() { + zle -K viins # initiate 'vi insert' keymap (can be removed if 'bindkey -V' has been set elsewhere) + echo -ne "\e[5 q" +} +zle -N zle-line-init +echo -ne '\e[5 q' # Usea beam shape cursor on startup +preexec() { echo -ne '\e[5 q' ;} # use beam shape cursor for each new prompt + +# zkbd compatible hash +# To add other keys to this hash, see: man 5 terminfo +typeset -g -A key + +key[Home]="${terminfo[khome]}" +key[End]="${terminfo[kend]}" +key[Insert]="${terminfo[kich1]}" +key[Backspace]="${terminfo[kbs]}" +key[Delete]="${terminfo[kdch1]}" +key[Up]="${terminfo[kcuu1]}" +key[Down]="${terminfo[kcud1]}" +key[Left]="${terminfo[kcub1]}" +key[Right]="${terminfo[kcuf1]}" +key[PageUp]="${terminfo[kpp]}" +key[PageDown]="${terminfo[knp]}" +key[ShiftTab]="${terminfo[kcbt]}" + +autoload -Uz up-line-or-beginning-search down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search + +# setup key accordingly +[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line +[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line +[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" override-mode +[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char +[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char +[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search +[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search +[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char +[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char +[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history +[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history +[[ -n "${key[ShiftTab]}" ]] && bindkey -- "${key[ShiftTab]}" reverse-menu-complete + +# Finally, make sure the terminal is in application mode, when zle is +# active. Oly then are the values from $terminfo valid. +if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then + autoload -Uz add-zle-hook-widget + function zle_application_mode_start { + echoti smkx + } + function zle_application_mode_stop { + echoti rmkx + } + add-zle-hook-widget -Uz zle-line-init zle_application_mode_start + add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop +fi diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler @@ -0,0 +1,47 @@ +#!/bin/sh +while read file +do + case "$1" in + "w") feh --no-fehbg --bg-scale "$file" & ;; + + "c") + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs |\ + awk '{print $2}' | dmenu -l 20 -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & ;; + + "m") + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs |\ + awk '{print $2}' | dmenu -l 20 -p "Move file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & ;; + + "r") + convert -rotate 90 "$file" "$file" ;; + + "R") + convert -rotate -90 "$file" "$file" ;; + + "f") + convert -flop "$file" "$file" ;; + + "y") + echo -n "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$file copied to clipboard" & ;; + + "Y") + readlink -f "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$(readlink -f "$file") copied to clipboard" & ;; + + "d") + [ "$(printf "No\\nYes" | dmenu -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;; + + "g") ifinstalled gimp && setsid -f gimp "$file" ;; + + "i") notify-send "File information" "$(mediainfo "$file")" ;; + + "n") [ -z "$newname" ] && newname="$(dmenu -l 20 -p "Rename file to "$file":")" + mv "$file" "$newname" && notify-send -i "$(readlink -f "$newname")" "$file renamed to $newname" && pgrep sxiv |\ + xargs kill -9 && sxiv "$newname" * & ;; + esac +done diff --git a/.config/systemd/user/mbsync.service b/.config/systemd/user/mbsync.service @@ -0,0 +1,10 @@ +[Unit] +Description=Mailbox synchronization service +RefuseManualStart=no +RefuseManualStop=yes + +[Service] +Type=oneshot +ExecStart=/usr/bin/zsh -c 'mbsync -c .config/isync/mbsyncrc -a -q' +StandardOutput=syslog +StandardError=syslog diff --git a/.config/systemd/user/mbsync.timer b/.config/systemd/user/mbsync.timer @@ -0,0 +1,13 @@ +[Unit] +Description=Mailbox synchronization timer +RefuseManualStop=no +RefuseManualStart=no + +[Timer] +Persistent=false +OnBootSec=0.3m +OnUnitActiveSec=0.5m +Unit=mbsync.service + +[Install] +WantedBy=default.target diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf @@ -0,0 +1,54 @@ +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +bind s split-window -v +bind v split-window -h + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +#resiz panes +bind < resize-pane -L 10 +bind > resize-pane -R 10 +bind - resize-pane -D 10 +bind + resize-pane -U 10 + +set -g allow-passthrough on + +set -ga update-environment TERM +set -ga update-environment TERM_PROGRAM + +# default statusbar colors +set-option -g status-style fg=colour136,bg=colour235 #yellow and base02 + +# default window title colors +set-window-option -g window-status-style fg=colour244,bg=default #base0 and default +#set-window-option -g window-status-style dim + +# active window title colors +set-window-option -g window-status-current-style fg=colour166,bg=default #orange and default +#set-window-option -g window-status-current-style bright + +# pane border +set-option -g pane-border-style fg=colour235 #base02 +set-option -g pane-active-border-style fg=colour240 #base01 + +# message text +set-option -g message-style fg=colour166,bg=colour235 #orange and base02 + +# pane number display +set-option -g display-panes-active-colour colour33 #blue +set-option -g display-panes-colour colour166 #orange + +# clock +set-window-option -g clock-mode-colour colour64 #green + +# bell +set-window-option -g window-status-bell-style fg=colour235,bg=colour160 #base02, red + + +set -g status-left '#[fg=default]#H #[fg=black]• #[default]' +set -g status-right '' diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc @@ -0,0 +1,18 @@ +set selection-clipboard clipboard +set statusbar-h-padding 0 +set window-title-basename "true" +set statusbar-v-padding 0 +set page-padding 1 +set recolor-darkcolor "#a6a28c" +set recolor-lightcolor "#20201d" +map u scroll half-up +map d scroll half-down +map D toggle_page_mode +map r reload +map R rotate +map K zoom in +map J zoom out +map i recolor +map p print + +#set recolor true diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile @@ -0,0 +1 @@ +[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx "$XDG_CONFIG_HOME/X11/xinitrc" vt1 diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv @@ -0,0 +1 @@ +export PATH="$PATH:/home/mika/.config/.foundry/bin" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc @@ -0,0 +1,38 @@ +#!/usr/bin/zsh +# *-* zshrc *-* + +HISTFILE=~/.cache/zsh/.histfile +HISTSIZE=10000 +SAVEHIST=10000 + +autoload -U colors && colors +autoload -U compinit + +#256 +#color=$( ( shuf -i 52-57 && shuf -i 88-99 && shuf -i 124-135 && shuf -i 160-177 ) | shuf -n 1) +#PS1=" %F{white}%B%2~ %F{$color} Ψ %F{white} >%b " +PS1=" %F{white}%B%2~%F{white} >%b " + +# vi mode +bindkey -v +export KEYTIMEOUT=1 + + +# The following lines were added by compinstall +zstyle ':completion:*' completer _complete _ignored +zstyle ':completion:*' list-colors 'di=1;36' +zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._-]=** r:|=**' +zstyle :compinstall filename '/home/mika/.config/zsh/.zshrc' + +autoload -U compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit + +source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/vimode" +source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliases" +source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/colors" + +# bun completions +[ -s "/home/mika/.bun/_bun" ] && source "/home/mika/.bun/_bun" diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +.dots diff --git a/.local/bin/dwmstatus/bar-battery b/.local/bin/dwmstatus/bar-battery @@ -0,0 +1,31 @@ +#!/usr/bin/zsh +[[ ! -e /sys/class/power_supply/BAT1 ]] && exit 1 + +capacity=$(cat /sys/class/power_supply/BAT1/capacity) +bat=$(cat /sys/class/power_supply/ACAD/online) + +if [[ "0" -lt "$capacity" ]] && [[ "$capacity" -le "20" ]]; then + emoji="" +elif [[ "20" -lt "$capacity" ]] && [[ "$capacity" -le "40" ]]; then + emoji="" +elif [[ "40" -lt "$capacity" ]] && [[ "$capacity" -le "60" ]]; then + emoji="" +elif [[ "60" -lt "$capacity" ]] && [[ "$capacity" -le "80" ]]; then + emoji="" +elif [[ "80" -lt "$capacity" ]] && [[ "$capacity" -le "100" ]]; then + emoji="" +fi + + +if [[ "$bat" = "1" ]]; then + emoji="" +fi + +echo "$emoji" + +case "$BLOCK_BUTTON" in + 1) notify-send "$capacity%" "$(acpi -b | sed 's/Battery 1: //')";; + 4) sudo xbacklight -inc 1 ;; + 5) sudo xbacklight -dec 1 ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac diff --git a/.local/bin/dwmstatus/bar-bluetooth b/.local/bin/dwmstatus/bar-bluetooth @@ -0,0 +1,33 @@ +#!/usr/bin/zsh + +emoji="$(dmenu-bluetooth --status | awk '{print $1}')" + +if [[ $emoji == "" ]]; then + capacity=$(upower --dump | awk '/headset/' RS="\n\n" ORS="" | grep percentage | awk -v N=2 '{printf $N}' | sed 's/\%//') + if [[ "0" -lt "$capacity" ]] && [[ "$capacity" -le "20" ]]; then + bat="" + elif [[ "20" -lt "$capacity" ]] && [[ "$capacity" -le "40" ]]; then + bat="" + elif [[ "40" -lt "$capacity" ]] && [[ "$capacity" -le "60" ]]; then + bat="" + elif [[ "60" -lt "$capacity" ]] && [[ "$capacity" -le "80" ]]; then + bat="" + elif [[ "80" -lt "$capacity" ]] && [[ "$capacity" -le "100" ]]; then + bat="" + fi + + if [[ $capacity == "" ]]; then + echo "$emoji" + else + echo "$emoji $bat" + fi +else + echo "$emoji" +fi + + +case $BLOCK_BUTTON in + 1) notify-send "$capacity";; + 2) dmenu-bluetooth;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac diff --git a/.local/bin/dwmstatus/bar-clock b/.local/bin/dwmstatus/bar-clock @@ -0,0 +1,27 @@ +#!/bin/zsh + +#clock=$(date '+%I') +# +#case "$clock" in +# "00") icon="🕛" ;; +# "01") icon="🕐" ;; +# "02") icon="🕑" ;; +# "03") icon="🕒" ;; +# "04") icon="🕓" ;; +# "05") icon="🕔" ;; +# "06") icon="🕕" ;; +# "07") icon="🕖" ;; +# "08") icon="🕗" ;; +# "09") icon="🕘" ;; +# "10") icon="🕙" ;; +# "11") icon="🕚" ;; +# "12") icon="🕛" ;; +#esac + +date +"%R:%S " + +case $BLOCK_BUTTON in + 1) notify-send "$(date +' :%a %d.%m.')" "$(cal | sed "s/\<$(date +'%e'|tr -d ' ')\>/<b><span color='red'>&<\/span><\/b>/")";; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + diff --git a/.local/bin/dwmstatus/bar-cpu b/.local/bin/dwmstatus/bar-cpu @@ -0,0 +1,15 @@ +#!/bin/zsh + +usage=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{printf "%1.0f%",100 - $1}') +temp=$(sensors | grep -A 2 k10temp | grep Tctl | awk '{printf +$2.}' | xargs printf "%.f") + +echo -n "🧠 :$usage $temp°" + +case $BLOCK_BUTTON in + 1) "$TERMINAL" -e sudo htop ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + + + + diff --git a/.local/bin/dwmstatus/bar-internet b/.local/bin/dwmstatus/bar-internet @@ -0,0 +1,16 @@ +#!/usr/bin/zsh + +NETDEVICE="wlan0" + +case "$(cat /sys/class/net/$NETDEVICE/operstate 2>/dev/null)" in + down) wifiicon="" ;; + up) wifiicon="" ;; +esac + +echo "$wifiicon" + +case $BLOCK_BUTTON in + 1) "$TERMINAL" -e nmtui; pkill -RTMIN+6 dwmblocks ;; + 3) notify-send "Strength" "$(awk '/^\s*w/ { print int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac diff --git a/.local/bin/dwmstatus/bar-lang b/.local/bin/dwmstatus/bar-lang @@ -0,0 +1,8 @@ +#!/bin/zsh + +echo $(xkblayout-state print %s | awk '{print toupper($0)}') + +case $BLOCK_BUTTON in + 1) xdotool key Shift_L+Shift_R ; pkill -RTMIN+11 dwmblocks ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac diff --git a/.local/bin/dwmstatus/bar-mail b/.local/bin/dwmstatus/bar-mail @@ -0,0 +1,30 @@ +#!/bin/zsh + + +number_of_mails=$( (ls $XDG_DATA_HOME/mail/milutin@popovic.xyz/INBOX/new &\ + ls $XDG_DATA_HOME/mail/a11807930@unet.univie.ac.at/INBOX/new &\ + ls $XDG_DATA_HOME/mail/mika@popovic.xyz/INBOX/new) | wc -l) + +last_new=$(cat $XDG_CACHE_HOME/status/mail.new) + + +if [[ $number_of_mails -gt $last_new ]] +then + notify-send "New Email" "$number_of_mails new messages" + echo $number_of_mails > $XDG_CACHE_HOME/status/mail.new + +else + echo $number_of_mails > $XDG_CACHE_HOME/status/mail.new +fi + +if [[ "number_of_mails" -gt "0" ]] +then + echo "" +fi + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e neomutt ;; + 2) pkill -RTMIN+3 dwmblocks && setsid -f mbsync -a ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + diff --git a/.local/bin/dwmstatus/bar-mem b/.local/bin/dwmstatus/bar-mem @@ -0,0 +1,13 @@ +#!/usr/bin/zsh + +#mem=$(free -m | grep 'Mem:' | awk '{printf "%.1f/%.1f G", $2/1000, $3/1000}') +mem=$(free -m | grep 'Mem:' | awk '{printf "%.1f G", $3/1000}') + +echo -n " :$mem" + +case $BLOCK_BUTTON in + 1) "$TERMINAL" -e sudo htop ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + + diff --git a/.local/bin/dwmstatus/bar-server b/.local/bin/dwmstatus/bar-server @@ -0,0 +1,19 @@ +#!/bin/zsh + +response=$(wget -4 --server-response --max-redirect=0 popovic.xyz:80) + +if [[ $response == *"Connection refused"* ]] + then + emoji="" > $XDG_DATA_HOME/status/server-status.info + else + emoji="" > $XDG_DATA_HOME/status/server-status.info +fi + +echo ":$emoji" + +case $BLOCK_BUTTON in + 1) nextcloud ;; + 3) setsid -f "$TERMINAL" -e ssh server;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + diff --git a/.local/bin/dwmstatus/bar-traffic b/.local/bin/dwmstatus/bar-traffic @@ -0,0 +1,23 @@ +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e bmon ;; + 3) notify-send "🌐 Network traffic module" "🔻: Traffic received +🔺: Traffic transmitted" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +update() { + sum=0 + for arg; do + read -r i < "$arg" + sum=$(( sum + i )) + done + cache=/tmp/${1##*/} + [ -f "$cache" ] && read -r old < "$cache" || old=0 + printf %d\\n "$sum" > "$cache" + printf %d\\n $(( sum - old )) +} + +rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) +tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) + +printf "🔻%4sB 🔺%4sB\\n" $(numfmt --to=iec $rx $tx) diff --git a/.local/bin/dwmstatus/bar-volume b/.local/bin/dwmstatus/bar-volume @@ -0,0 +1,25 @@ +#!/usr/bin/zsh + +#EMOJI=$(cat $XDG_DATA_HOME/status/sink.info) +volume=$(pamixer --get-volume-human | sed 's/\%//') +emoji="" + +if [[ "0" -lt "$volume" ]] && [[ "$volume" -le "20" ]]; then + emoji="" +elif [[ "20" -lt "$volume" ]] && [[ "$volume" -le "80" ]]; then + emoji="" +elif [[ "80" -lt "$volume" ]] && [[ "$volume" -le "100" ]]; then + emoji="" +elif [[ $volume == "muted" ]]; then + emoji="" +fi + +echo "$emoji" + +case $BLOCK_BUTTON in + 1) notify-send "Volume:" "$volume%" ;; + 2) setsid -f pavucontrol ;; + 4) pkill -RTMIN+5 dwmblocks ; pactl set-sink-volume @DEFAULT_SINK@ -5% ;; + 5) pkill -RTMIN+5 dwmblocks ; pactl set-sink-volume @DEFAULT_SINK@ +5% ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac diff --git a/.local/bin/dwmstatus/bar-vpn b/.local/bin/dwmstatus/bar-vpn @@ -0,0 +1,18 @@ +#!/usr/bin/zsh + +output="" +status_file=$XDG_CACHE_HOME/status/vpn_tz + +if [[ -n $(sudo wg show | grep -Eo "wg0-(.*)") ]]; then + curl --fail -s https://ipapi.co/timezone > $status_file + output="" +elif [[ -n $(f5fpc --info | grep -Eo "session established") ]]; then + curl --fail -s https://ipapi.co/timezone > $status_file + output="" +else + echo > $status_file +fi + +if [[ $output != "" ]]; then + echo $output +fi diff --git a/.local/bin/dwmstatus/bar-weather b/.local/bin/dwmstatus/bar-weather @@ -0,0 +1,32 @@ +#!/bin/sh + +weather=$HOME/.local/share/status/weather + +getforcast() { + curl -sf wttr.in/$(curl ipinfo.io/loc) > $weather || exit 1; +} + +showweather() { + printf "%s" "$(sed '16q;d' $weather | + grep -wo "[0-9]*%" |\ + sort -rn | sed "s/^/☔:/g;1q" | tr -d '\n')" + sed '13q;d' $weather |\ + grep -o "m\\([-+]\\)*[0-9]\\+" |\ + sort -n -t 'm' -k 2n |\ + sed -e 1b -e '$!d' |\ + tr '\n|m' ' ' |\ + awk '{print "  :" $2"("$1")" "°"}' ; +} + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e less -Srf "$weather" ;; + 3) getforcast && showweather ; pkill -RTMIN+2 dwmblocks ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + + +[ "$(stat -c %y $weather 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || + getforcast +showweather + +"$@" diff --git a/.local/bin/scripts/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/.local/bin/scripts/.ipynb_checkpoints/Untitled-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/.local/bin/scripts/.ipynb_checkpoints/untitled-checkpoint.txt b/.local/bin/scripts/.ipynb_checkpoints/untitled-checkpoint.txt diff --git a/.local/bin/scripts/background b/.local/bin/scripts/background @@ -0,0 +1,4 @@ +#!/usr/bin/zsh + +WALLPAPER=$(find "${XDG_DATA_HOME}/wallpaper/walls" -type f | sort -R | tail -1) +feh --no-fehbg --bg-scale $WALLPAPER diff --git a/.local/bin/scripts/cpstat b/.local/bin/scripts/cpstat @@ -0,0 +1,5 @@ +#!/usr/bin/zsh + +tar c "$1" | pv | tar x -C "$2" + +"$@" diff --git a/.local/bin/scripts/dev_tmux b/.local/bin/scripts/dev_tmux @@ -0,0 +1,6 @@ +#!/usr/bin/zsh +tmux new-session -d -s dev +tmux new-window -t dev +tmux new-window -t dev +tmux a + diff --git a/.local/bin/scripts/dmenu-bluetooth b/.local/bin/scripts/dmenu-bluetooth @@ -0,0 +1,419 @@ +#!/usr/bin/env bash +# _ _ _ _ _ _ +# __| |_ __ ___ ___ _ __ _ _ | |__ | |_ _ ___| |_ ___ ___ | |_ | |__ +# / _` | '_ ` _ \ / _ \ '_ \| | | |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __|| '_ \ +# | (_| | | | | | | __/ | | | |_| |_____| |_) | | |_| | __/ || (_) | (_) | |_ | | | | +# \__,_|_| |_| |_|\___|_| |_|\__,_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__||_| |_| +# +# Author: Nick Clyde (clydedroid) +# dmenu support by: Layerex +# Original script: https://github.com/nickclyde/rofi-bluetooth +# +# A script that generates a dmenu menu that uses bluetoothctl to +# connect to bluetooth devices and display status info. +# +# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu) +# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl) +# +# Depends on: +# Arch repositories: dmenu, bluez-utils (contains bluetoothctl) + +# Constants +divider="---------" +goback="Back" +exit="Exit" +connected_icon="" + +# Checks if bluetooth controller is powered on +power_on() { + if bluetoothctl -- show | grep -F -q "Powered: yes"; then + return 0 + else + return 1 + fi +} + +# Toggles power state +toggle_power() { + if power_on; then + bluetoothctl -- power off + show_menu + else + if rfkill list bluetooth | grep -F -q 'blocked: yes'; then + rfkill unblock bluetooth && sleep 3 + fi + bluetoothctl -- power on + show_menu + fi +} + +# Checks if controller is scanning for new devices +scan_on() { + if bluetoothctl -- show | grep -F -q "Discovering: yes"; then + echo "Scan: on" + return 0 + else + echo "Scan: off" + return 1 + fi +} + +# Toggles scanning state +toggle_scan() { + if scan_on; then + kill "$(pgrep -f "bluetoothctl --timeout 60 -- scan on")" + #bluetoothctl scan off + show_menu + else + bluetoothctl --timeout 60 -- scan on & + echo "Scanning..." + sleep 5 + show_menu + fi +} + +# Checks if controller is able to pair to devices +pairable_on() { + if bluetoothctl -- show | grep -F -q "Pairable: yes"; then + echo "Pairable: on" + return 0 + else + echo "Pairable: off" + return 1 + fi +} + +# Toggles pairable state +toggle_pairable() { + if pairable_on; then + bluetoothctl -- pairable off + show_menu + else + bluetoothctl -- pairable on + show_menu + fi +} + +# Checks if controller is discoverable by other devices +discoverable_on() { + if bluetoothctl -- show | grep -F -q "Discoverable: yes"; then + echo "Discoverable: on" + return 0 + else + echo "Discoverable: off" + return 1 + fi +} + +# Toggles discoverable state +toggle_discoverable() { + if discoverable_on; then + bluetoothctl -- discoverable off + show_menu + else + bluetoothctl -- discoverable on + show_menu + fi +} + +# Checks if a device is connected +device_connected() { + if bluetoothctl -- info "$1" | grep -F -q "Connected: yes"; then + return 0 + else + return 1 + fi +} + +# Toggles device connection +toggle_connection() { + if device_connected "$1"; then + bluetoothctl -- disconnect "$1" + # device_menu "$device" + else + bluetoothctl -- connect "$1" + # device_menu "$device" + fi +} + +# Checks if a device is paired +device_paired() { + if bluetoothctl -- info "$1" | grep -F -q "Paired: yes"; then + echo "Paired: yes" + return 0 + else + echo "Paired: no" + return 1 + fi +} + +# Toggles device paired state +toggle_paired() { + if device_paired "$1"; then + bluetoothctl -- remove "$1" + device_menu "$device" + else + bluetoothctl -- pair "$1" + device_menu "$device" + fi +} + +# Checks if a device is trusted +device_trusted() { + if bluetoothctl -- info "$1" | grep -F -q "Trusted: yes"; then + echo "Trusted: yes" + return 0 + else + echo "Trusted: no" + return 1 + fi +} + +# Toggles device connection +toggle_trust() { + if device_trusted "$1"; then + bluetoothctl -- untrust "$1" + device_menu "$device" + else + bluetoothctl -- trust "$1" + device_menu "$device" + fi +} + +remove_device() { + bluetoothctl -- remove "$1" +} + +# Prints a short string with the current bluetooth status +# Useful for status bars like polybar, etc. +print_status() { + if power_on; then + printf '' + + mapfile -t paired_devices < <(bluetoothctl -- devices Paired | grep -F Device | cut -d ' ' -f 2) + counter=0 + + for device in "${paired_devices[@]}"; do + if device_connected "$device"; then + device_alias="$(bluetoothctl -- info "$device" | grep -F "Alias" | cut -d ' ' -f 2-)" + + if [ $counter -gt 0 ]; then + printf ", %s" "$device_alias" + else + printf " %s" "$device_alias" + fi + + ((counter++)) + fi + done + printf "\n" + else + echo "" + fi +} + +# A submenu for a specific device that allows connecting, pairing, and trusting +device_menu() { + device="$1" + + # Get device name and mac address + device_name="$(echo "$device" | cut -d ' ' -f 3-)" + mac="$(echo "$device" | cut -d ' ' -f 2)" + + # Build options + if device_connected "$mac"; then + connected="Connected: yes" + else + connected="Connected: no" + fi + paired="$(device_paired "$mac")" + trusted="$(device_trusted "$mac")" + options="$connected\n$paired\n$trusted\n$divider\n$goback\n$exit" + + # Open dmenu menu, read chosen option + chosen="$(echo -e "$options" | run_dmenu "$device_name")" + + # Match chosen option to command + case $chosen in + "" | "$divider") + echo "No option chosen." + ;; + "$connected") + toggle_connection "$mac" + ;; + "$paired") + toggle_paired "$mac" + ;; + "$trusted") + toggle_trust "$mac" + ;; + "$(echo 'Remove')") + remove_device "$mac" + ;; + "$goback") + show_menu + ;; + esac +} + +# Opens a dmenu menu with current bluetooth status and options to connect +show_menu() { + # Get menu options + if power_on; then + power="Power: on" + + # Human-readable names of devices, one per line + # If scan is off, will only list paired devices + if [[ -n "$connected_icon" ]]; then + devices="$(bluetoothctl devices | grep -F Device | while read -r device; do + device_name="$(echo "$device" | cut -d ' ' -f 3-)" + mac="$(echo "$device" | cut -d ' ' -f 2)" + icon="" + + if device_connected "$mac" && [[ -n $connected_icon ]]; then + icon=" $connected_icon" + fi + + echo "$device_name${icon}" + done)" + else + devices="$(bluetoothctl devices | grep -F Device | cut -d ' ' -f 3-)" + fi + + # Get controller flags + scan="$(scan_on)" + pairable="$(pairable_on)" + discoverable="$(discoverable_on)" + + # Options passed to dmenu + [[ -n $devices ]] && devices_part="$devices\n$divider\n" + options="$devices_part$power\n$scan\n$pairable\n$discoverable\n$exit" + else + power="Power: off" + options="$power\n$exit" + fi + + # Open dmenu menu, read chosen option + chosen="$(echo -e "$options" | run_dmenu "Bluetooth")" + + # Match chosen option to command + case $chosen in + "" | "$divider") + echo "No option chosen." + ;; + "$power") + toggle_power + ;; + "$scan") + toggle_scan + ;; + "$discoverable") + toggle_discoverable + ;; + "$pairable") + toggle_pairable + ;; + *) + if [[ -n "$connected_icon" ]]; then + chosen="${chosen%% ${connected_icon}}" + fi + device="$(bluetoothctl devices | grep -F "$chosen")" + # Open a submenu if a device is selected + if [[ -n "$device" ]]; then device_menu "$device"; fi + ;; + esac +} + +# dmenu command to pipe into. Extra arguments to dmenu-bluetooth are passed through to dmenu. This +# allows the user to set fonts, sizes, colours, etc. +DMENU_BLUETOOTH_LAUNCHER="${DMENU_BLUETOOTH_LAUNCHER:-dmenu}" +run_dmenu() { + case "$DMENU_BLUETOOTH_LAUNCHER" in + rofi) + DMENU_BLUETOOTH_LAUNCHER="rofi -dmenu" + ;; + fuzzel) + DMENU_BLUETOOTH_LAUNCHER="fuzzel --dmenu" + ;; + esac + $DMENU_BLUETOOTH_LAUNCHER -i -p "$DMENU_BLUETOOTH_PROMPT" "${dmenu_args[@]}" +} + +print_help() { + echo "usage: $0 [--help] [--status] [--connected-icon [ICON]] [PROMPT] DMENU_ARGS..." + echo "" + echo "A script that generates a dmenu menu that uses bluetoothctl to connect to bluetooth devices and display status info." + echo "" + echo "positional arguments:" + echo " PROMPT dmenu prompt" + echo " DMENU_ARGS... arguments passed to dmenu" + echo "" + echo "options:" + echo "--help show this help message and exit" + echo "--status print a short string about current bluetooth status and exit" + echo "--connected-icon [ICON] add icon on device list next to connected devices" + echo "" + echo "environment variables:" + echo " DMENU_BLUETOOTH_PROMPT dmenu prompt" + echo " DMENU_BLUETOOTH_LAUNCHER command to use instead of 'dmenu'" + echo "" + echo "Positional arguments have to be placed after all other arguments." + echo "A PROMPT positional argument will be interpreted as part of DMENU_ARGS if it starts with '-'. It won't be parsed if the DMENU_BLUETOOTH_PROMPT environment variable is set." + echo "Use the DMENU_BLUETOOTH_LAUNCHER environment variable to use launchers other than dmenu. Rofi, fuzzel, and any dmenu-compatible launchers are supported." +} + +command_present() { + command -v "$1" >/dev/null 2>&1 +} + +error() { + echo "$1. $2." >&2 + command_present notify-send && notify-send "$1" "$2." +} + +# Check if bluetooth daemon is running. Start it if possible. +if command_present systemctl; then + systemctl is-active --quiet bluetooth + case $? in + 3) + error "Bluetooth daemon is not running" "Start it to use this script" + systemctl start bluetooth || exit 3 + ;; + 4) + error "Bluetooth daemon is not present" "On Arch Linux install bluez and bluez-utils packages" + exit 4 + ;; + esac +fi + +dmenu_args=("$@") +case "$1" in + --help) + print_help + exit + ;; + --status) + print_status + exit + ;; + --connected-icon) + if [[ "$2" == "--" ]]; then + connected_icon="" + else + connected_icon="$2" + fi + dmenu_args=("${dmenu_args[@]:2}") + ;; +esac +case "${dmenu_args[0]}" in + -*) + ;; + *) + if [[ -z "$DMENU_BLUETOOTH_PROMPT" ]]; then + DMENU_BLUETOOTH_PROMPT="${dmenu_args[0]}" + dmenu_args=("${dmenu_args[@]:1}") + fi + ;; +esac + +show_menu diff --git a/.local/bin/scripts/down b/.local/bin/scripts/down @@ -0,0 +1,4 @@ +#!/usr/bin/zsh + +pgrep $1 | xargs kill -9 + diff --git a/.local/bin/scripts/edid_mulmon b/.local/bin/scripts/edid_mulmon @@ -0,0 +1,59 @@ +#!/usr/bin/python + +import re +import subprocess + +M_R = "00ffffffffffff0009d1d5784554000034190103803c22782ea595a45852a0260d5054a56b80818081c08100a9c0b300d1c001010101023a801871382d40582c450056502100001e000000ff0053434630343130313031390a20000000fd00324c1e5310000a202020202020000000fc0042656e5120474c323736300a20016c020321c149901f05141304030201230907078301000067030c000000001ee2000f011d8018711c1620582c2500c48e2100009e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075" + +M_L = "00ffffffffffff0009d1d578455400000c180103803c22782ea595a45852a0260d5054a56b80818081c08100a9c0b300d1c001010101023a801871382d40582c450056502100001e000000ff0048334530343230333031390a20000000fd00324c1e5310000a202020202020000000fc0042656e5120474c323736300a2001ae020321c149901f05141304030201230907078301000067030c000000001ee2000f011d8018711c1620582c2500c48e2100009e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075" + +def get_port_edids(): + ports = [] + + xrandr = subprocess.run(['xrandr', '--verbose'], stdout=subprocess.PIPE) + lines = xrandr.stdout.decode('utf-8').split('\n') + + get_edid = False + edid = "" + for line in lines: + if " connected " in line: + port = line.split(' ')[0] + if "GAMMA_LUT_SIZE" in line: + if get_edid == True: + ports.append([port , edid.replace('\t', '')]) + edid = "" + get_edid = False + if get_edid: + edid += line + if "EDID" in line: + get_edid = True + return ports + + +def main(): + ports = get_port_edids() + + left_port = None + right_port = None + + for port in ports: + if port[1] == M_L: + left_port = port[0] + if port[1] == M_R: + right_port = port[0] + + if left_port is not None and right_port is not None: + subprocess.run([ + 'xrandr', + '--output', + 'eDP', + '--off', + '--output', + right_port, + '--right-of', + left_port + ], stdout=subprocess.PIPE) + + +if __name__ == "__main__": + main() diff --git a/.local/bin/scripts/fenics b/.local/bin/scripts/fenics @@ -0,0 +1,39 @@ +#!/usr/bin/zsh + + +py() { + docker volume create --name instant-cache > /dev/null 2>&1 + docker run --rm \ + -v instant-cache:/home/fenics/.instant \ + -v $(pwd):/home/fenics/shared \ + -w /home/fenics/shared quay.io/fenicsproject/stable:current "python3 $1" +} + +ipy() { + docker run --name notebook \ + -w /home/fenics \ + -v $(pwd):/home/fenics/shared \ + -d -p 127.0.0.1:8888:8888 \ + quay.io/fenicsproject/stable:current \ + 'cd shared && jupyter-notebook --ip=0.0.0.0' &&\ + sleep 3 &&\ + + token=$(docker logs notebook 2>&1 | grep -o "token=[a-z0-9]*" | sed -n 1p) &&\ + brave http://0.0.0.0:8888/\?$token # &&\ +# docker stop notebook && docker rm notebook +} + +rm-ipy() { + docker stop notebook && docker rm notebook +} + +convert() { + docker volume create --name instant-cache > /dev/null 2>&1 + docker run --rm \ + -v instant-cache:/home/fenics/.instant \ + -v $(pwd):/home/fenics/shared \ + -w /home/fenics/shared quay.io/fenicsproject/stable:current "dolfin-convert $1 $2" +} + + +"$@" diff --git a/.local/bin/scripts/lfub b/.local/bin/scripts/lfub @@ -0,0 +1,24 @@ +#!/bin/sh + +# This is a wrapper script for lb that allows it to create image previews with +# ueberzug. This works in concert with the lf configuration file and the +# lf-cleaner script. + +set -e + +cleanup() { + exec 3>&- + rm "$FIFO_UEBERZUG" +} + +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup HUP INT QUIT TERM PWR EXIT + lf "$@" 3>&- +fi diff --git a/.local/bin/scripts/monitor_recon b/.local/bin/scripts/monitor_recon @@ -0,0 +1,44 @@ +#!/usr/bin/zsh + +function mulmon_activate() { + sleep 5 + xrandr --auto + sleep 1 + for int i in {1..5}; do + sleep 1 + edid_mulmon + sleep 1 + done + + xset r rate 300 50 + xset mouse 1.8 0 + setxkbmap -model p104 -layout us,de -option grp:shifts_toggle + dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY + xrdb $XDG_CONFIG_HOME/X/Xresources.mon + num=$(xinput | grep "Razer Razer DeathAdder Essential " | head -1 | grep -oP "id=\K\d+") + xinput --set-prop $num 'libinput Accel Speed' -0.75 + + MONITOR_OUT=1 +} + +function mulmon_deactivate() { + xrandr --auto + xrdb $XDG_CONFIG_HOME/X/Xresources + MONITOR_OUT=0 +} + +function active_connection() { + (( $(xrandr | grep " connected "| wc -l) == 3 )) +} + +while true; do + if active_connection && [[ $MONITOR_OUT -eq 0 ]]; then + mulmon_activate + fi + + if ! active_connection && [[ $MONITOR_OUT -eq 1 ]]; then + mulmon_deactivate + fi + + sleep 2 +done diff --git a/.local/bin/scripts/notebook b/.local/bin/scripts/notebook @@ -0,0 +1,24 @@ +#!/bin/sh + +start() { + tmux new-session -d -s jupyter_sesh 'jupyter notebook --ip=0.0.0.0 --port=8080' +} + +stop(){ + tmux kill-session -t jupyter_sesh +} + +status(){ + if pgrep jupyter > /dev/null + then echo "Running" + else echo "Not Running" + fi +} + +restart() { + tmux kill-session -t jupyter_sesh && sleep 3 &&\ + tmux new-session -d -s jupyter_sesh 'jupyter notebook --ip=0.0.0.0 --port=8080' + +} + +"$@" diff --git a/.local/bin/scripts/passmenu-otp b/.local/bin/scripts/passmenu-otp @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | dmenu -l 15 "$@") + +[[ -n $password ]] || exit + +pass_cmd=show +if pass show "$password" | grep -q '^otpauth://'; then + pass_cmd=otp +fi + +if [[ $typeit -eq 0 ]]; then + pass $pass_cmd -c "$password" 2>/dev/null +else + pass $pass_cmd "$password" | { IFS= read -r pass; printf %s "$pass"; } | + xdotool type --clearmodifiers --file - +fi diff --git a/.local/bin/scripts/transmission-finish b/.local/bin/scripts/transmission-finish @@ -0,0 +1,3 @@ +#!/usr/bin/sh + +trm finish diff --git a/.local/bin/scripts/trm b/.local/bin/scripts/trm @@ -0,0 +1,77 @@ +#!/usr/bin/zsh + + +stop() { +# vpn stop + pgrep transmission | xargs kill -9 + notify-send "Transmission" "Stopped" +} + +finish() { + # notifies me when torrent finished downloading and then remove it so it doenst seed + + file=$(transmission-remote -l | grep 100% | awk '{printf $10}') + confirm=$(printf "yes\nno" | dmenu -p "Remove Torrent $file ?" ) + if [[ $confirm == "yes" ]]; then + transmission-remote -l |\ + awk '$2 == "100%"{ system("transmission-remote -t " $1 " --remove") }' &&\ + notify-send "Torrent finished downloading" "$file" + fi + +} + +start() { + var=$(nmcli | grep wlp3s0:\ connect | awk '{printf $4}') + #declare -a allowed=( DasBoot Popovic ) + + #for item in "${allowed[@]}"; do + # [[ $var == "$item" ]] &&\ +# vpn start &\ + transmission-daemon -g /home/mika/.config/transmission-daemon/ --foreground --log-info 2<&1 |\ + while read line; do + echo $line |\ + grep -v "announcer.c:\|platform.c:\|announce done (tr-dht.c:" |\ + grep -v "Saved.*variant.c:" |\ + while read line; do + echo $line | grep -q started &&\ + notify-send "Transmission Started" " " + echo $line | systemd-cat --identifier="TransWrap" --priority=5 + done 2>&1 > /dev/null + done&disown; + exit 0 + + # [[ $var != "$item" ]] && pkill -3 transmission-daemon ; exit 1 + + #done +} + +restart() { + trm stop && trm start +} + +magnet() { + LINK="$1" + + if [ -z "$LINK" ]; then + notify-send "Error" "need magnet link" + fi + + HOST="localhost" + PORT="9091" + + ss -tuna | grep 9091 || trm start &&\ + confirm=$(printf "yes\nno" | dmenu -p "Add torrent?" ) + + if [[ $confirm == "yes" ]]; then + SESSID=$(curl "http://$HOST:$PORT/transmission/rpc" | sed 's/.*<code>//g;s/<\/code>.*//g') + add=$(curl --silent --header "$SESSID" \ + "http://$HOST:$PORT/transmission/rpc"\ + -d "{\"method\":\"torrent-add\",\"arguments\":{\"filename\":\"${LINK}\"}}") + + name=$(echo $add | jq -r '.arguments[].name') &&\ + notify-send "Succsess File" "$name downloading" ||\ + notify-send "Error" "something went wrong" + fi +} + +"$@" diff --git a/.local/bin/scripts/volume b/.local/bin/scripts/volume @@ -0,0 +1,19 @@ +#!/usr/bin/bash + +up () { + cur_vol=$(pamixer --get-volume) + if (( cur_vol+$1 <= 100 )); then + pactl -- set-sink-volume @DEFAULT_SINK@ $(( cur_vol+$1 ))%; + else + pactl -- set-sink-volume @DEFAULT_SINK@ 100%; + fi + + return 1; + +} + +down () { + pactl -- set-sink-volume @DEFAULT_SINK@ -$1% +} + +"$@" diff --git a/.local/bin/scripts/vpn b/.local/bin/scripts/vpn @@ -0,0 +1,67 @@ +#!/usr/bin/zsh + +server() { + sudo wg-quick up wg0-server && pkill -RTMIN+6 dwmblocks + notify-send "VPN" "wg0-server started" +} + +mycomp() { + sudo wg-quick up wg0-mycomp && pkill -RTMIN+6 dwmblocks + notify-send "VPN" "wg0-mycomp started" +} + +router() { + sudo wg-quick up wg0-router && pkill -RTMIN+6 dwmblocks + notify-send "VPN" "wg0-router started" +} + +uni() { + f5fpc \ + -s\ + -t vpn.univie.ac.at\ + -d /etc/ssl/certs/\ + -u milutinp00@$(pass otp uni-otp)\ + -p $(pass uni-pass) + notify-send "VPN" "F5FPC-uni started" +} + +unifull() { + f5fpc -s\ + -t vpn.univie.ac.at:8443 \ + -d /etc/ssl/certs/\ + -u milutinp00@$(pass otp uni-otp)\ + -p $(pass uni-pass) + notify-send "VPN" "F5FPC-unifull started" +} + + +info() { + f5fpc --info +} + +stop() { + running_wg0=$(sudo wg show | grep -Eo "wg0-(.*)") + if [[ -n $running_wg0 ]]; then + sudo wg-quick down $running_wg0 + notify-send "VPN" "$running_wg0 stopped" + fi + if + running_f5fpc=$(f5fpc --info | grep -Eo "session established") + if [[ -n $running_f5fpc ]]; then + f5fpc --stop + notify-send "VPN" "F5FPC stopped" + fi + pkill -RTMIN+6 dwmblocks +} + +getip() { + ipv4=$(curl -4 --silent ip.me) + ipv6=$(curl -6 --silent ip.me) + notify-send "IP" "$ipv4\n$ipv6" +} + +status() { + vpn getip +} + +"$@" diff --git a/.local/share/applications/cal.desktop b/.local/share/applications/cal.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=Calendar +Exec=/usr/local/bin/st -e calcurse -i %u diff --git a/.local/share/applications/file.desktop b/.local/share/applications/file.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=File Manager +Exec=/usr/local/nautilus %u diff --git a/.local/share/applications/gif.desktop b/.local/share/applications/gif.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=Image viewer +Exec=/usr/bin/sxiv -A 25 %f diff --git a/.local/share/applications/img.desktop b/.local/share/applications/img.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=Image viewer +Exec=/usr/bin/sxiv -a %f diff --git a/.local/share/applications/links.desktop b/.local/share/applications/links.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=HTML reader +Exec=firefox %u diff --git a/.local/share/applications/mail.desktop b/.local/share/applications/mail.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=Mail +Exec=/usr/local/bin/st -e neomutt %u diff --git a/.local/share/applications/mimeinfo.cache b/.local/share/applications/mimeinfo.cache @@ -0,0 +1,9 @@ +[MIME Cache] +application/vnd.ms-htmlhelp=wine-extension-chm.desktop; +application/winhlp=wine-extension-hlp.desktop; +application/x-wine-extension-msp=wine-extension-msp.desktop; +text/vbscript=wine-extension-vbs.desktop; +x-scheme-handler/magnet=torrent.desktop; +x-scheme-handler/monero=monero-gui.desktop; +x-scheme-handler/moneroseed=monero-gui.desktop; +x-scheme-handler/riotclient=wine-protocol-riotclient.desktop; diff --git a/.local/share/applications/pdf.desktop b/.local/share/applications/pdf.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=PDF reader +Exec=/usr/bin/zathura %u diff --git a/.local/share/applications/rss.desktop b/.local/share/applications/rss.desktop @@ -0,0 +1,4 @@ +#[Desktop Entry] +#Type=Application +#Name=RSS feed addition +#Exec=/usr/bin/env rssadd %U diff --git a/.local/share/applications/text.desktop b/.local/share/applications/text.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=Text editor +Exec=st -e nvim %u diff --git a/.local/share/applications/torrent.desktop b/.local/share/applications/torrent.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=transmissionRemoteMagnet +Type=Application +Exec=trm magnet %u +NoDisplay=true +MimeType=x-scheme-handler/magnet; diff --git a/.zshenv b/.zshenv @@ -0,0 +1,3 @@ +#!/bin/zsh + +source "$HOME/.config/shell/profile" diff --git a/README.md b/README.md @@ -0,0 +1,20 @@ +# Mika's dotfiles + +What i use: +* x11 +* dwm +* st +* dmenu +* slock +* dwmstatus +* zsh +* neovim +* tmux +* dunst +* feh +* neomutt + isync/msmtp +* sxiv +* transmission +* zathura +* lf +* redshift